From b652b438fcad4c9c079d0774e9d45ee58fae22e2 Mon Sep 17 00:00:00 2001 From: Russell King Date: Wed, 15 Jun 2005 12:38:14 +0100 Subject: [PATCH] I2C: Add PXA I2C driver Add support for the I2C PXA driver. Signed-off-by: Russell King --- include/asm-arm/arch-pxa/i2c.h | 70 ++++++++++++++++++++++++++++++++++++++++++ include/linux/i2c-id.h | 1 + include/linux/i2c-pxa.h | 48 +++++++++++++++++++++++++++++ 3 files changed, 119 insertions(+) create mode 100644 include/asm-arm/arch-pxa/i2c.h create mode 100644 include/linux/i2c-pxa.h (limited to 'include') diff --git a/include/asm-arm/arch-pxa/i2c.h b/include/asm-arm/arch-pxa/i2c.h new file mode 100644 index 00000000000..46ec2243974 --- /dev/null +++ b/include/asm-arm/arch-pxa/i2c.h @@ -0,0 +1,70 @@ +/* + * i2c_pxa.h + * + * Copyright (C) 2002 Intrinsyc Software Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + */ +#ifndef _I2C_PXA_H_ +#define _I2C_PXA_H_ + +#if 0 +#define DEF_TIMEOUT 3 +#else +/* need a longer timeout if we're dealing with the fact we may well be + * looking at a multi-master environment +*/ +#define DEF_TIMEOUT 32 +#endif + +#define BUS_ERROR (-EREMOTEIO) +#define XFER_NAKED (-ECONNREFUSED) +#define I2C_RETRY (-2000) /* an error has occurred retry transmit */ + +/* ICR initialize bit values +* +* 15. FM 0 (100 Khz operation) +* 14. UR 0 (No unit reset) +* 13. SADIE 0 (Disables the unit from interrupting on slave addresses +* matching its slave address) +* 12. ALDIE 0 (Disables the unit from interrupt when it loses arbitration +* in master mode) +* 11. SSDIE 0 (Disables interrupts from a slave stop detected, in slave mode) +* 10. BEIE 1 (Enable interrupts from detected bus errors, no ACK sent) +* 9. IRFIE 1 (Enable interrupts from full buffer received) +* 8. ITEIE 1 (Enables the I2C unit to interrupt when transmit buffer empty) +* 7. GCD 1 (Disables i2c unit response to general call messages as a slave) +* 6. IUE 0 (Disable unit until we change settings) +* 5. SCLE 1 (Enables the i2c clock output for master mode (drives SCL) +* 4. MA 0 (Only send stop with the ICR stop bit) +* 3. TB 0 (We are not transmitting a byte initially) +* 2. ACKNAK 0 (Send an ACK after the unit receives a byte) +* 1. STOP 0 (Do not send a STOP) +* 0. START 0 (Do not send a START) +* +*/ +#define I2C_ICR_INIT (ICR_BEIE | ICR_IRFIE | ICR_ITEIE | ICR_GCD | ICR_SCLE) + +/* I2C status register init values + * + * 10. BED 1 (Clear bus error detected) + * 9. SAD 1 (Clear slave address detected) + * 7. IRF 1 (Clear IDBR Receive Full) + * 6. ITE 1 (Clear IDBR Transmit Empty) + * 5. ALD 1 (Clear Arbitration Loss Detected) + * 4. SSD 1 (Clear Slave Stop Detected) + */ +#define I2C_ISR_INIT 0x7FF /* status register init */ + +struct i2c_slave_client; + +struct i2c_pxa_platform_data { + unsigned int slave_addr; + struct i2c_slave_client *slave; +}; + +extern void pxa_set_i2c_info(struct i2c_pxa_platform_data *info); +#endif diff --git a/include/linux/i2c-id.h b/include/linux/i2c-id.h index 89270ce5147..74d6dc94271 100644 --- a/include/linux/i2c-id.h +++ b/include/linux/i2c-id.h @@ -203,6 +203,7 @@ #define I2C_ALGO_MV64XXX 0x190000 /* Marvell mv64xxx i2c ctlr */ #define I2C_ALGO_PCA 0x1a0000 /* PCA 9564 style adapters */ #define I2C_ALGO_AU1550 0x1b0000 /* Au1550 PSC algorithm */ +#define I2C_ALGO_PXA 0x1c0000 /* Intel PXA I2C algorithm */ #define I2C_ALGO_EXP 0x800000 /* experimental */ diff --git a/include/linux/i2c-pxa.h b/include/linux/i2c-pxa.h new file mode 100644 index 00000000000..5f3eaf80222 --- /dev/null +++ b/include/linux/i2c-pxa.h @@ -0,0 +1,48 @@ +#ifndef _LINUX_I2C_ALGO_PXA_H +#define _LINUX_I2C_ALGO_PXA_H + +struct i2c_eeprom_emu_watcher { + void (*write)(void *, unsigned int addr, unsigned char newval); +}; + +struct i2c_eeprom_emu_watch { + struct list_head node; + unsigned int start; + unsigned int end; + struct i2c_eeprom_emu_watcher *ops; + void *data; +}; + +#define I2C_EEPROM_EMU_SIZE (256) + +struct i2c_eeprom_emu { + unsigned int size; + unsigned int ptr; + unsigned int seen_start; + struct list_head watch; + + unsigned char bytes[I2C_EEPROM_EMU_SIZE]; +}; + +typedef enum i2c_slave_event_e { + I2C_SLAVE_EVENT_START_READ, + I2C_SLAVE_EVENT_START_WRITE, + I2C_SLAVE_EVENT_STOP +} i2c_slave_event_t; + +struct i2c_slave_client { + void *data; + void (*event)(void *ptr, i2c_slave_event_t event); + int (*read) (void *ptr); + void (*write)(void *ptr, unsigned int val); +}; + +extern int i2c_eeprom_emu_addwatcher(struct i2c_eeprom_emu *, void *data, + unsigned int addr, unsigned int size, + struct i2c_eeprom_emu_watcher *); + +extern void i2c_eeprom_emu_delwatcher(struct i2c_eeprom_emu *, void *data, struct i2c_eeprom_emu_watcher *watcher); + +extern struct i2c_eeprom_emu *i2c_pxa_get_eeprom(void); + +#endif /* _LINUX_I2C_ALGO_PXA_H */ -- cgit v1.2.3-70-g09d2 From df46b9a44ceb5af2ea2351ce8e28ae7bd840b00f Mon Sep 17 00:00:00 2001 From: Mike Christie Date: Mon, 20 Jun 2005 14:04:44 +0200 Subject: [PATCH] Add blk_rq_map_kern() Add blk_rq_map_kern which takes a kernel buffer and maps it into a request and bio. This can be used by the dm hw_handlers, old sg_scsi_ioctl, and one day scsi special requests so all requests comming into scsi will have bios. All requests having bios should allow scsi to use scatter lists for all IO and allow it to use block layer functions. Signed-off-by: Jens Axboe --- drivers/block/ll_rw_blk.c | 56 ++++++++++++++++++++++++++++++++++++++++ fs/bio.c | 66 +++++++++++++++++++++++++++++++++++++++++++++++ include/linux/bio.h | 2 ++ include/linux/blkdev.h | 2 ++ 4 files changed, 126 insertions(+) (limited to 'include') diff --git a/drivers/block/ll_rw_blk.c b/drivers/block/ll_rw_blk.c index f20eba22b14..e30a3c93b70 100644 --- a/drivers/block/ll_rw_blk.c +++ b/drivers/block/ll_rw_blk.c @@ -281,6 +281,7 @@ static inline void rq_init(request_queue_t *q, struct request *rq) rq->special = NULL; rq->data_len = 0; rq->data = NULL; + rq->nr_phys_segments = 0; rq->sense = NULL; rq->end_io = NULL; rq->end_io_data = NULL; @@ -2176,6 +2177,61 @@ int blk_rq_unmap_user(struct request *rq, struct bio *bio, unsigned int ulen) EXPORT_SYMBOL(blk_rq_unmap_user); +static int blk_rq_map_kern_endio(struct bio *bio, unsigned int bytes_done, + int error) +{ + if (bio->bi_size) + return 1; + + bio_put(bio); + return 0; +} + +/** + * blk_rq_map_kern - map kernel data to a request, for REQ_BLOCK_PC usage + * @q: request queue where request should be inserted + * @rw: READ or WRITE data + * @kbuf: the kernel buffer + * @len: length of user data + */ +struct request *blk_rq_map_kern(request_queue_t *q, int rw, void *kbuf, + unsigned int len, unsigned int gfp_mask) +{ + struct request *rq; + struct bio *bio; + + if (len > (q->max_sectors << 9)) + return ERR_PTR(-EINVAL); + if ((!len && kbuf) || (len && !kbuf)) + return ERR_PTR(-EINVAL); + + rq = blk_get_request(q, rw, gfp_mask); + if (!rq) + return ERR_PTR(-ENOMEM); + + bio = bio_map_kern(q, kbuf, len, gfp_mask); + if (!IS_ERR(bio)) { + if (rw) + bio->bi_rw |= (1 << BIO_RW); + bio->bi_end_io = blk_rq_map_kern_endio; + + rq->bio = rq->biotail = bio; + blk_rq_bio_prep(q, rq, bio); + + rq->buffer = rq->data = NULL; + rq->data_len = len; + return rq; + } + + /* + * bio is the err-ptr + */ + blk_put_request(rq); + return (struct request *) bio; +} + +EXPORT_SYMBOL(blk_rq_map_kern); + /** * blk_execute_rq - insert a request into queue for execution * @q: queue to insert the request in diff --git a/fs/bio.c b/fs/bio.c index 3a1472acc36..707b9af2dd0 100644 --- a/fs/bio.c +++ b/fs/bio.c @@ -701,6 +701,71 @@ void bio_unmap_user(struct bio *bio) bio_put(bio); } +static struct bio *__bio_map_kern(request_queue_t *q, void *data, + unsigned int len, unsigned int gfp_mask) +{ + unsigned long kaddr = (unsigned long)data; + unsigned long end = (kaddr + len + PAGE_SIZE - 1) >> PAGE_SHIFT; + unsigned long start = kaddr >> PAGE_SHIFT; + const int nr_pages = end - start; + int offset, i; + struct bio *bio; + + bio = bio_alloc(gfp_mask, nr_pages); + if (!bio) + return ERR_PTR(-ENOMEM); + + offset = offset_in_page(kaddr); + for (i = 0; i < nr_pages; i++) { + unsigned int bytes = PAGE_SIZE - offset; + + if (len <= 0) + break; + + if (bytes > len) + bytes = len; + + if (__bio_add_page(q, bio, virt_to_page(data), bytes, + offset) < bytes) + break; + + data += bytes; + len -= bytes; + offset = 0; + } + + return bio; +} + +/** + * bio_map_kern - map kernel address into bio + * @q: the request_queue_t for the bio + * @data: pointer to buffer to map + * @len: length in bytes + * @gfp_mask: allocation flags for bio allocation + * + * Map the kernel address into a bio suitable for io to a block + * device. Returns an error pointer in case of error. + */ +struct bio *bio_map_kern(request_queue_t *q, void *data, unsigned int len, + unsigned int gfp_mask) +{ + struct bio *bio; + + bio = __bio_map_kern(q, data, len, gfp_mask); + if (IS_ERR(bio)) + return bio; + + if (bio->bi_size == len) + return bio; + + /* + * Don't support partial mappings. + */ + bio_put(bio); + return ERR_PTR(-EINVAL); +} + /* * bio_set_pages_dirty() and bio_check_pages_dirty() are support functions * for performing direct-IO in BIOs. @@ -1088,6 +1153,7 @@ EXPORT_SYMBOL(bio_add_page); EXPORT_SYMBOL(bio_get_nr_vecs); EXPORT_SYMBOL(bio_map_user); EXPORT_SYMBOL(bio_unmap_user); +EXPORT_SYMBOL(bio_map_kern); EXPORT_SYMBOL(bio_pair_release); EXPORT_SYMBOL(bio_split); EXPORT_SYMBOL(bio_split_pool); diff --git a/include/linux/bio.h b/include/linux/bio.h index 038022763f0..1dd2bc2e84a 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h @@ -282,6 +282,8 @@ extern int bio_get_nr_vecs(struct block_device *); extern struct bio *bio_map_user(struct request_queue *, struct block_device *, unsigned long, unsigned int, int); extern void bio_unmap_user(struct bio *); +extern struct bio *bio_map_kern(struct request_queue *, void *, unsigned int, + unsigned int); extern void bio_set_pages_dirty(struct bio *bio); extern void bio_check_pages_dirty(struct bio *bio); extern struct bio *bio_copy_user(struct request_queue *, unsigned long, unsigned int, int); diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 4a99b76c5a3..67339bc5f6b 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -560,6 +560,8 @@ extern void blk_run_queue(request_queue_t *); extern void blk_queue_activity_fn(request_queue_t *, activity_fn *, void *); extern struct request *blk_rq_map_user(request_queue_t *, int, void __user *, unsigned int); extern int blk_rq_unmap_user(struct request *, struct bio *, unsigned int); +extern struct request *blk_rq_map_kern(request_queue_t *, int, void *, + unsigned int, unsigned int); extern int blk_execute_rq(request_queue_t *, struct gendisk *, struct request *); static inline request_queue_t *bdev_get_queue(struct block_device *bdev) -- cgit v1.2.3-70-g09d2 From dd1cab95f356f1395278633565f198463cf6bd24 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Mon, 20 Jun 2005 14:06:01 +0200 Subject: [PATCH] Cleanup blk_rq_map_* interfaces Change the blk_rq_map_user() and blk_rq_map_kern() interface to require a previously allocated request to be passed in. This is both more efficient for multiple iterations of mapping data to the same request, and it is also a much nicer API. Signed-off-by: Jens Axboe --- drivers/block/ll_rw_blk.c | 68 ++++++++++++++++++---------------------------- drivers/block/scsi_ioctl.c | 23 ++++++++++------ drivers/cdrom/cdrom.c | 13 ++++++--- include/linux/blkdev.h | 7 ++--- 4 files changed, 53 insertions(+), 58 deletions(-) (limited to 'include') diff --git a/drivers/block/ll_rw_blk.c b/drivers/block/ll_rw_blk.c index 1471aca6fa1..42c4f3651cf 100644 --- a/drivers/block/ll_rw_blk.c +++ b/drivers/block/ll_rw_blk.c @@ -2107,21 +2107,19 @@ EXPORT_SYMBOL(blk_insert_request); * original bio must be passed back in to blk_rq_unmap_user() for proper * unmapping. */ -struct request *blk_rq_map_user(request_queue_t *q, int rw, void __user *ubuf, - unsigned int len) +int blk_rq_map_user(request_queue_t *q, struct request *rq, void __user *ubuf, + unsigned int len) { unsigned long uaddr; - struct request *rq; struct bio *bio; + int reading; if (len > (q->max_sectors << 9)) - return ERR_PTR(-EINVAL); - if ((!len && ubuf) || (len && !ubuf)) - return ERR_PTR(-EINVAL); + return -EINVAL; + if (!len || !ubuf) + return -EINVAL; - rq = blk_get_request(q, rw, __GFP_WAIT); - if (!rq) - return ERR_PTR(-ENOMEM); + reading = rq_data_dir(rq) == READ; /* * if alignment requirement is satisfied, map in user pages for @@ -2129,9 +2127,9 @@ struct request *blk_rq_map_user(request_queue_t *q, int rw, void __user *ubuf, */ uaddr = (unsigned long) ubuf; if (!(uaddr & queue_dma_alignment(q)) && !(len & queue_dma_alignment(q))) - bio = bio_map_user(q, NULL, uaddr, len, rw == READ); + bio = bio_map_user(q, NULL, uaddr, len, reading); else - bio = bio_copy_user(q, uaddr, len, rw == READ); + bio = bio_copy_user(q, uaddr, len, reading); if (!IS_ERR(bio)) { rq->bio = rq->biotail = bio; @@ -2139,14 +2137,13 @@ struct request *blk_rq_map_user(request_queue_t *q, int rw, void __user *ubuf, rq->buffer = rq->data = NULL; rq->data_len = len; - return rq; + return 0; } /* * bio is the err-ptr */ - blk_put_request(rq); - return (struct request *) bio; + return PTR_ERR(bio); } EXPORT_SYMBOL(blk_rq_map_user); @@ -2160,7 +2157,7 @@ EXPORT_SYMBOL(blk_rq_map_user); * Description: * Unmap a request previously mapped by blk_rq_map_user(). */ -int blk_rq_unmap_user(struct request *rq, struct bio *bio, unsigned int ulen) +int blk_rq_unmap_user(struct bio *bio, unsigned int ulen) { int ret = 0; @@ -2171,8 +2168,7 @@ int blk_rq_unmap_user(struct request *rq, struct bio *bio, unsigned int ulen) ret = bio_uncopy_user(bio); } - blk_put_request(rq); - return ret; + return 0; } EXPORT_SYMBOL(blk_rq_unmap_user); @@ -2184,39 +2180,29 @@ EXPORT_SYMBOL(blk_rq_unmap_user); * @kbuf: the kernel buffer * @len: length of user data */ -struct request *blk_rq_map_kern(request_queue_t *q, int rw, void *kbuf, - unsigned int len, unsigned int gfp_mask) +int blk_rq_map_kern(request_queue_t *q, struct request *rq, void *kbuf, + unsigned int len, unsigned int gfp_mask) { - struct request *rq; struct bio *bio; if (len > (q->max_sectors << 9)) - return ERR_PTR(-EINVAL); - if ((!len && kbuf) || (len && !kbuf)) - return ERR_PTR(-EINVAL); - - rq = blk_get_request(q, rw, gfp_mask); - if (!rq) - return ERR_PTR(-ENOMEM); + return -EINVAL; + if (!len || !kbuf) + return -EINVAL; bio = bio_map_kern(q, kbuf, len, gfp_mask); - if (!IS_ERR(bio)) { - if (rw) - bio->bi_rw |= (1 << BIO_RW); + if (IS_ERR(bio)) + return PTR_ERR(bio); - rq->bio = rq->biotail = bio; - blk_rq_bio_prep(q, rq, bio); + if (rq_data_dir(rq) == WRITE) + bio->bi_rw |= (1 << BIO_RW); - rq->buffer = rq->data = NULL; - rq->data_len = len; - return rq; - } + rq->bio = rq->biotail = bio; + blk_rq_bio_prep(q, rq, bio); - /* - * bio is the err-ptr - */ - blk_put_request(rq); - return (struct request *) bio; + rq->buffer = rq->data = NULL; + rq->data_len = len; + return 0; } EXPORT_SYMBOL(blk_rq_map_kern); diff --git a/drivers/block/scsi_ioctl.c b/drivers/block/scsi_ioctl.c index 681871ca5d6..93c4ca874be 100644 --- a/drivers/block/scsi_ioctl.c +++ b/drivers/block/scsi_ioctl.c @@ -216,7 +216,7 @@ static int sg_io(struct file *file, request_queue_t *q, struct gendisk *bd_disk, struct sg_io_hdr *hdr) { unsigned long start_time; - int reading, writing; + int reading, writing, ret; struct request *rq; struct bio *bio; char sense[SCSI_SENSE_BUFFERSIZE]; @@ -255,14 +255,17 @@ static int sg_io(struct file *file, request_queue_t *q, reading = 1; break; } + } - rq = blk_rq_map_user(q, writing ? WRITE : READ, hdr->dxferp, - hdr->dxfer_len); + rq = blk_get_request(q, writing ? WRITE : READ, GFP_KERNEL); + if (!rq) + return -ENOMEM; - if (IS_ERR(rq)) - return PTR_ERR(rq); - } else - rq = blk_get_request(q, READ, __GFP_WAIT); + if (reading || writing) { + ret = blk_rq_map_user(q, rq, hdr->dxferp, hdr->dxfer_len); + if (ret) + goto out; + } /* * fill in request structure @@ -321,11 +324,13 @@ static int sg_io(struct file *file, request_queue_t *q, } if (blk_rq_unmap_user(rq, bio, hdr->dxfer_len)) - return -EFAULT; + ret = -EFAULT; /* may not have succeeded, but output values written to control * structure (struct sg_io_hdr). */ - return 0; +out: + blk_put_request(rq); + return ret; } #define OMAX_SB_LEN 16 /* For backward compatibility */ diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c index beaa561f2ed..6a7d926774a 100644 --- a/drivers/cdrom/cdrom.c +++ b/drivers/cdrom/cdrom.c @@ -2097,6 +2097,10 @@ static int cdrom_read_cdda_bpc(struct cdrom_device_info *cdi, __u8 __user *ubuf, if (!q) return -ENXIO; + rq = blk_get_request(q, READ, GFP_KERNEL); + if (!rq) + return -ENOMEM; + cdi->last_sense = 0; while (nframes) { @@ -2108,9 +2112,9 @@ static int cdrom_read_cdda_bpc(struct cdrom_device_info *cdi, __u8 __user *ubuf, len = nr * CD_FRAMESIZE_RAW; - rq = blk_rq_map_user(q, READ, ubuf, len); - if (IS_ERR(rq)) - return PTR_ERR(rq); + ret = blk_rq_map_user(q, rq, ubuf, len); + if (ret) + break; memset(rq->cmd, 0, sizeof(rq->cmd)); rq->cmd[0] = GPCMD_READ_CD; @@ -2138,7 +2142,7 @@ static int cdrom_read_cdda_bpc(struct cdrom_device_info *cdi, __u8 __user *ubuf, cdi->last_sense = s->sense_key; } - if (blk_rq_unmap_user(rq, bio, len)) + if (blk_rq_unmap_user(bio, len)) ret = -EFAULT; if (ret) @@ -2149,6 +2153,7 @@ static int cdrom_read_cdda_bpc(struct cdrom_device_info *cdi, __u8 __user *ubuf, ubuf += len; } + blk_put_request(rq); return ret; } diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 67339bc5f6b..fc0dce07861 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -558,10 +558,9 @@ extern void blk_sync_queue(struct request_queue *q); extern void __blk_stop_queue(request_queue_t *q); extern void blk_run_queue(request_queue_t *); extern void blk_queue_activity_fn(request_queue_t *, activity_fn *, void *); -extern struct request *blk_rq_map_user(request_queue_t *, int, void __user *, unsigned int); -extern int blk_rq_unmap_user(struct request *, struct bio *, unsigned int); -extern struct request *blk_rq_map_kern(request_queue_t *, int, void *, - unsigned int, unsigned int); +extern int blk_rq_map_user(request_queue_t *, struct request *, void __user *, unsigned int); +extern int blk_rq_unmap_user(struct bio *, unsigned int); +extern int blk_rq_map_kern(request_queue_t *, struct request *, void *, unsigned int, unsigned int); extern int blk_execute_rq(request_queue_t *, struct gendisk *, struct request *); static inline request_queue_t *bdev_get_queue(struct block_device *bdev) -- cgit v1.2.3-70-g09d2 From f1970baf6d74e03bd32072ab453f2fc01bc1b8d3 Mon Sep 17 00:00:00 2001 From: James Bottomley Date: Mon, 20 Jun 2005 14:06:52 +0200 Subject: [PATCH] Add scatter-gather support for the block layer SG_IO Signed-off-by: Jens Axboe --- drivers/block/ll_rw_blk.c | 64 +++++++++++++++++-- drivers/block/scsi_ioctl.c | 34 ++++++---- fs/bio.c | 150 +++++++++++++++++++++++++++++++-------------- include/linux/bio.h | 4 ++ include/linux/blkdev.h | 1 + 5 files changed, 191 insertions(+), 62 deletions(-) (limited to 'include') diff --git a/drivers/block/ll_rw_blk.c b/drivers/block/ll_rw_blk.c index 42c4f3651cf..874e46fc374 100644 --- a/drivers/block/ll_rw_blk.c +++ b/drivers/block/ll_rw_blk.c @@ -2148,6 +2148,50 @@ int blk_rq_map_user(request_queue_t *q, struct request *rq, void __user *ubuf, EXPORT_SYMBOL(blk_rq_map_user); +/** + * blk_rq_map_user_iov - map user data to a request, for REQ_BLOCK_PC usage + * @q: request queue where request should be inserted + * @rq: request to map data to + * @iov: pointer to the iovec + * @iov_count: number of elements in the iovec + * + * Description: + * Data will be mapped directly for zero copy io, if possible. Otherwise + * a kernel bounce buffer is used. + * + * A matching blk_rq_unmap_user() must be issued at the end of io, while + * still in process context. + * + * Note: The mapped bio may need to be bounced through blk_queue_bounce() + * before being submitted to the device, as pages mapped may be out of + * reach. It's the callers responsibility to make sure this happens. The + * original bio must be passed back in to blk_rq_unmap_user() for proper + * unmapping. + */ +int blk_rq_map_user_iov(request_queue_t *q, struct request *rq, + struct sg_iovec *iov, int iov_count) +{ + struct bio *bio; + + if (!iov || iov_count <= 0) + return -EINVAL; + + /* we don't allow misaligned data like bio_map_user() does. If the + * user is using sg, they're expected to know the alignment constraints + * and respect them accordingly */ + bio = bio_map_user_iov(q, NULL, iov, iov_count, rq_data_dir(rq)== READ); + if (IS_ERR(bio)) + return PTR_ERR(bio); + + rq->bio = rq->biotail = bio; + blk_rq_bio_prep(q, rq, bio); + rq->buffer = rq->data = NULL; + rq->data_len = bio->bi_size; + return 0; +} + +EXPORT_SYMBOL(blk_rq_map_user_iov); + /** * blk_rq_unmap_user - unmap a request with user data * @rq: request to be unmapped @@ -2207,6 +2251,19 @@ int blk_rq_map_kern(request_queue_t *q, struct request *rq, void *kbuf, EXPORT_SYMBOL(blk_rq_map_kern); +void blk_execute_rq_nowait(request_queue_t *q, struct gendisk *bd_disk, + struct request *rq, int at_head, + void (*done)(struct request *)) +{ + int where = at_head ? ELEVATOR_INSERT_FRONT : ELEVATOR_INSERT_BACK; + + rq->rq_disk = bd_disk; + rq->flags |= REQ_NOMERGE; + rq->end_io = done; + elv_add_request(q, rq, where, 1); + generic_unplug_device(q); +} + /** * blk_execute_rq - insert a request into queue for execution * @q: queue to insert the request in @@ -2224,8 +2281,6 @@ int blk_execute_rq(request_queue_t *q, struct gendisk *bd_disk, char sense[SCSI_SENSE_BUFFERSIZE]; int err = 0; - rq->rq_disk = bd_disk; - /* * we need an extra reference to the request, so we can look at * it after io completion @@ -2238,11 +2293,8 @@ int blk_execute_rq(request_queue_t *q, struct gendisk *bd_disk, rq->sense_len = 0; } - rq->flags |= REQ_NOMERGE; rq->waiting = &wait; - rq->end_io = blk_end_sync_rq; - elv_add_request(q, rq, ELEVATOR_INSERT_BACK, 1); - generic_unplug_device(q); + blk_execute_rq_nowait(q, bd_disk, rq, 0, blk_end_sync_rq); wait_for_completion(&wait); rq->waiting = NULL; diff --git a/drivers/block/scsi_ioctl.c b/drivers/block/scsi_ioctl.c index 93c4ca874be..09a7e73a081 100644 --- a/drivers/block/scsi_ioctl.c +++ b/drivers/block/scsi_ioctl.c @@ -231,17 +231,11 @@ static int sg_io(struct file *file, request_queue_t *q, if (verify_command(file, cmd)) return -EPERM; - /* - * we'll do that later - */ - if (hdr->iovec_count) - return -EOPNOTSUPP; - if (hdr->dxfer_len > (q->max_sectors << 9)) return -EIO; reading = writing = 0; - if (hdr->dxfer_len) { + if (hdr->dxfer_len) switch (hdr->dxfer_direction) { default: return -EINVAL; @@ -261,11 +255,29 @@ static int sg_io(struct file *file, request_queue_t *q, if (!rq) return -ENOMEM; - if (reading || writing) { - ret = blk_rq_map_user(q, rq, hdr->dxferp, hdr->dxfer_len); - if (ret) + if (hdr->iovec_count) { + const int size = sizeof(struct sg_iovec) * hdr->iovec_count; + struct sg_iovec *iov; + + iov = kmalloc(size, GFP_KERNEL); + if (!iov) { + ret = -ENOMEM; goto out; - } + } + + if (copy_from_user(iov, hdr->dxferp, size)) { + kfree(iov); + ret = -EFAULT; + goto out; + } + + ret = blk_rq_map_user_iov(q, rq, iov, hdr->iovec_count); + kfree(iov); + } else if (hdr->dxfer_len) + ret = blk_rq_map_user(q, rq, hdr->dxferp, hdr->dxfer_len); + + if (ret) + goto out; /* * fill in request structure diff --git a/fs/bio.c b/fs/bio.c index c0d9140e470..24e4045788e 100644 --- a/fs/bio.c +++ b/fs/bio.c @@ -25,6 +25,7 @@ #include #include #include +#include /* for struct sg_iovec */ #define BIO_POOL_SIZE 256 @@ -549,22 +550,34 @@ out_bmd: return ERR_PTR(ret); } -static struct bio *__bio_map_user(request_queue_t *q, struct block_device *bdev, - unsigned long uaddr, unsigned int len, - int write_to_vm) +static struct bio *__bio_map_user_iov(request_queue_t *q, + struct block_device *bdev, + struct sg_iovec *iov, int iov_count, + int write_to_vm) { - unsigned long end = (uaddr + len + PAGE_SIZE - 1) >> PAGE_SHIFT; - unsigned long start = uaddr >> PAGE_SHIFT; - const int nr_pages = end - start; - int ret, offset, i; + int i, j; + int nr_pages = 0; struct page **pages; struct bio *bio; + int cur_page = 0; + int ret, offset; - /* - * transfer and buffer must be aligned to at least hardsector - * size for now, in the future we can relax this restriction - */ - if ((uaddr & queue_dma_alignment(q)) || (len & queue_dma_alignment(q))) + for (i = 0; i < iov_count; i++) { + unsigned long uaddr = (unsigned long)iov[i].iov_base; + unsigned long len = iov[i].iov_len; + unsigned long end = (uaddr + len + PAGE_SIZE - 1) >> PAGE_SHIFT; + unsigned long start = uaddr >> PAGE_SHIFT; + + nr_pages += end - start; + /* + * transfer and buffer must be aligned to at least hardsector + * size for now, in the future we can relax this restriction + */ + if ((uaddr & queue_dma_alignment(q)) || (len & queue_dma_alignment(q))) + return ERR_PTR(-EINVAL); + } + + if (!nr_pages) return ERR_PTR(-EINVAL); bio = bio_alloc(GFP_KERNEL, nr_pages); @@ -576,42 +589,54 @@ static struct bio *__bio_map_user(request_queue_t *q, struct block_device *bdev, if (!pages) goto out; - down_read(¤t->mm->mmap_sem); - ret = get_user_pages(current, current->mm, uaddr, nr_pages, - write_to_vm, 0, pages, NULL); - up_read(¤t->mm->mmap_sem); - - if (ret < nr_pages) - goto out; - - bio->bi_bdev = bdev; - - offset = uaddr & ~PAGE_MASK; - for (i = 0; i < nr_pages; i++) { - unsigned int bytes = PAGE_SIZE - offset; - - if (len <= 0) - break; - - if (bytes > len) - bytes = len; + memset(pages, 0, nr_pages * sizeof(struct page *)); + + for (i = 0; i < iov_count; i++) { + unsigned long uaddr = (unsigned long)iov[i].iov_base; + unsigned long len = iov[i].iov_len; + unsigned long end = (uaddr + len + PAGE_SIZE - 1) >> PAGE_SHIFT; + unsigned long start = uaddr >> PAGE_SHIFT; + const int local_nr_pages = end - start; + const int page_limit = cur_page + local_nr_pages; + + down_read(¤t->mm->mmap_sem); + ret = get_user_pages(current, current->mm, uaddr, + local_nr_pages, + write_to_vm, 0, &pages[cur_page], NULL); + up_read(¤t->mm->mmap_sem); + + if (ret < local_nr_pages) + goto out_unmap; + + + offset = uaddr & ~PAGE_MASK; + for (j = cur_page; j < page_limit; j++) { + unsigned int bytes = PAGE_SIZE - offset; + + if (len <= 0) + break; + + if (bytes > len) + bytes = len; + + /* + * sorry... + */ + if (__bio_add_page(q, bio, pages[j], bytes, offset) < bytes) + break; + + len -= bytes; + offset = 0; + } + cur_page = j; /* - * sorry... + * release the pages we didn't map into the bio, if any */ - if (__bio_add_page(q, bio, pages[i], bytes, offset) < bytes) - break; - - len -= bytes; - offset = 0; + while (j < page_limit) + page_cache_release(pages[j++]); } - /* - * release the pages we didn't map into the bio, if any - */ - while (i < nr_pages) - page_cache_release(pages[i++]); - kfree(pages); /* @@ -620,9 +645,17 @@ static struct bio *__bio_map_user(request_queue_t *q, struct block_device *bdev, if (!write_to_vm) bio->bi_rw |= (1 << BIO_RW); + bio->bi_bdev = bdev; bio->bi_flags |= (1 << BIO_USER_MAPPED); return bio; -out: + + out_unmap: + for (i = 0; i < nr_pages; i++) { + if(!pages[i]) + break; + page_cache_release(pages[i]); + } + out: kfree(pages); bio_put(bio); return ERR_PTR(ret); @@ -641,10 +674,34 @@ out: */ struct bio *bio_map_user(request_queue_t *q, struct block_device *bdev, unsigned long uaddr, unsigned int len, int write_to_vm) +{ + struct sg_iovec iov; + + iov.iov_base = (__user void *)uaddr; + iov.iov_len = len; + + return bio_map_user_iov(q, bdev, &iov, 1, write_to_vm); +} + +/** + * bio_map_user_iov - map user sg_iovec table into bio + * @q: the request_queue_t for the bio + * @bdev: destination block device + * @iov: the iovec. + * @iov_count: number of elements in the iovec + * @write_to_vm: bool indicating writing to pages or not + * + * Map the user space address into a bio suitable for io to a block + * device. Returns an error pointer in case of error. + */ +struct bio *bio_map_user_iov(request_queue_t *q, struct block_device *bdev, + struct sg_iovec *iov, int iov_count, + int write_to_vm) { struct bio *bio; + int len = 0, i; - bio = __bio_map_user(q, bdev, uaddr, len, write_to_vm); + bio = __bio_map_user_iov(q, bdev, iov, iov_count, write_to_vm); if (IS_ERR(bio)) return bio; @@ -657,6 +714,9 @@ struct bio *bio_map_user(request_queue_t *q, struct block_device *bdev, */ bio_get(bio); + for (i = 0; i < iov_count; i++) + len += iov[i].iov_len; + if (bio->bi_size == len) return bio; diff --git a/include/linux/bio.h b/include/linux/bio.h index 1dd2bc2e84a..ebcd03ba2e2 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h @@ -281,6 +281,10 @@ extern int bio_add_page(struct bio *, struct page *, unsigned int,unsigned int); extern int bio_get_nr_vecs(struct block_device *); extern struct bio *bio_map_user(struct request_queue *, struct block_device *, unsigned long, unsigned int, int); +struct sg_iovec; +extern struct bio *bio_map_user_iov(struct request_queue *, + struct block_device *, + struct sg_iovec *, int, int); extern void bio_unmap_user(struct bio *); extern struct bio *bio_map_kern(struct request_queue *, void *, unsigned int, unsigned int); diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index fc0dce07861..0430ea3e5f2 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -561,6 +561,7 @@ extern void blk_queue_activity_fn(request_queue_t *, activity_fn *, void *); extern int blk_rq_map_user(request_queue_t *, struct request *, void __user *, unsigned int); extern int blk_rq_unmap_user(struct bio *, unsigned int); extern int blk_rq_map_kern(request_queue_t *, struct request *, void *, unsigned int, unsigned int); +extern int blk_rq_map_user_iov(request_queue_t *, struct request *, struct sg_iovec *, int); extern int blk_execute_rq(request_queue_t *, struct gendisk *, struct request *); static inline request_queue_t *bdev_get_queue(struct block_device *bdev) -- cgit v1.2.3-70-g09d2 From 994ca9a19616f0d4161a9e825f0835925d522426 Mon Sep 17 00:00:00 2001 From: James Bottomley Date: Mon, 20 Jun 2005 14:11:09 +0200 Subject: [PATCH] update blk_execute_rq to take an at_head parameter Original From: Mike Christie Modified to split out block changes (this patch) and SCSI pieces. Signed-off-by: Jens Axboe Signed-off-by: James Bottomley --- drivers/block/ll_rw_blk.c | 7 ++++--- drivers/block/scsi_ioctl.c | 6 +++--- drivers/cdrom/cdrom.c | 2 +- drivers/ide/ide-disk.c | 2 +- include/linux/blkdev.h | 4 ++-- 5 files changed, 11 insertions(+), 10 deletions(-) (limited to 'include') diff --git a/drivers/block/ll_rw_blk.c b/drivers/block/ll_rw_blk.c index 874e46fc374..d260a2ce9a7 100644 --- a/drivers/block/ll_rw_blk.c +++ b/drivers/block/ll_rw_blk.c @@ -2269,13 +2269,14 @@ void blk_execute_rq_nowait(request_queue_t *q, struct gendisk *bd_disk, * @q: queue to insert the request in * @bd_disk: matching gendisk * @rq: request to insert + * @at_head: insert request at head or tail of queue * * Description: * Insert a fully prepared request at the back of the io scheduler queue * for execution. */ int blk_execute_rq(request_queue_t *q, struct gendisk *bd_disk, - struct request *rq) + struct request *rq, int at_head) { DECLARE_COMPLETION(wait); char sense[SCSI_SENSE_BUFFERSIZE]; @@ -2294,7 +2295,7 @@ int blk_execute_rq(request_queue_t *q, struct gendisk *bd_disk, } rq->waiting = &wait; - blk_execute_rq_nowait(q, bd_disk, rq, 0, blk_end_sync_rq); + blk_execute_rq_nowait(q, bd_disk, rq, at_head, blk_end_sync_rq); wait_for_completion(&wait); rq->waiting = NULL; @@ -2361,7 +2362,7 @@ int blkdev_scsi_issue_flush_fn(request_queue_t *q, struct gendisk *disk, rq->data_len = 0; rq->timeout = 60 * HZ; - ret = blk_execute_rq(q, disk, rq); + ret = blk_execute_rq(q, disk, rq, 0); if (ret && error_sector) *error_sector = rq->sector; diff --git a/drivers/block/scsi_ioctl.c b/drivers/block/scsi_ioctl.c index 7717b76f7f2..abb2df249fd 100644 --- a/drivers/block/scsi_ioctl.c +++ b/drivers/block/scsi_ioctl.c @@ -308,7 +308,7 @@ static int sg_io(struct file *file, request_queue_t *q, * (if he doesn't check that is his problem). * N.B. a non-zero SCSI status is _not_ necessarily an error. */ - blk_execute_rq(q, bd_disk, rq); + blk_execute_rq(q, bd_disk, rq, 0); /* write to all output members */ hdr->status = 0xff & rq->errors; @@ -420,7 +420,7 @@ static int sg_scsi_ioctl(struct file *file, request_queue_t *q, rq->data_len = bytes; rq->flags |= REQ_BLOCK_PC; - blk_execute_rq(q, bd_disk, rq); + blk_execute_rq(q, bd_disk, rq, 0); err = rq->errors & 0xff; /* only 8 bit SCSI status */ if (err) { if (rq->sense_len && rq->sense) { @@ -573,7 +573,7 @@ int scsi_cmd_ioctl(struct file *file, struct gendisk *bd_disk, unsigned int cmd, rq->cmd[0] = GPCMD_START_STOP_UNIT; rq->cmd[4] = 0x02 + (close != 0); rq->cmd_len = 6; - err = blk_execute_rq(q, bd_disk, rq); + err = blk_execute_rq(q, bd_disk, rq, 0); blk_put_request(rq); break; default: diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c index 6a7d926774a..15396034841 100644 --- a/drivers/cdrom/cdrom.c +++ b/drivers/cdrom/cdrom.c @@ -2136,7 +2136,7 @@ static int cdrom_read_cdda_bpc(struct cdrom_device_info *cdi, __u8 __user *ubuf, if (rq->bio) blk_queue_bounce(q, &rq->bio); - if (blk_execute_rq(q, cdi->disk, rq)) { + if (blk_execute_rq(q, cdi->disk, rq, 0)) { struct request_sense *s = rq->sense; ret = -EIO; cdi->last_sense = s->sense_key; diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c index 3302cd8eab4..9176da7a985 100644 --- a/drivers/ide/ide-disk.c +++ b/drivers/ide/ide-disk.c @@ -750,7 +750,7 @@ static int idedisk_issue_flush(request_queue_t *q, struct gendisk *disk, idedisk_prepare_flush(q, rq); - ret = blk_execute_rq(q, disk, rq); + ret = blk_execute_rq(q, disk, rq, 0); /* * if we failed and caller wants error offset, get it diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 0430ea3e5f2..a48dc12c669 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -562,8 +562,8 @@ extern int blk_rq_map_user(request_queue_t *, struct request *, void __user *, u extern int blk_rq_unmap_user(struct bio *, unsigned int); extern int blk_rq_map_kern(request_queue_t *, struct request *, void *, unsigned int, unsigned int); extern int blk_rq_map_user_iov(request_queue_t *, struct request *, struct sg_iovec *, int); -extern int blk_execute_rq(request_queue_t *, struct gendisk *, struct request *); - +extern int blk_execute_rq(request_queue_t *, struct gendisk *, + struct request *, int); static inline request_queue_t *bdev_get_queue(struct block_device *bdev) { return bdev->bd_disk->queue; -- cgit v1.2.3-70-g09d2 From 6f42ccf2fc50ecee8ea170040627f268430c1648 Mon Sep 17 00:00:00 2001 From: Robert Moore Date: Fri, 13 May 2005 00:00:00 -0400 Subject: ACPICA from Bob Moore Implemented support for PCI Express root bridges -- added support for device PNP0A08 in the root bridge search within AcpiEvPciConfigRegionSetup. acpi_ev_pci_config_region_setup(). The interpreter now automatically truncates incoming 64-bit constants to 32 bits if currently executing out of a 32-bit ACPI table (Revision < 2). This also affects the iASL compiler constant folding. (Note: as per below, the iASL compiler no longer allows 64-bit constants within 32-bit tables.) Fixed a problem where string and buffer objects with "static" pointers (pointers to initialization data within an ACPI table) were not handled consistently. The internal object copy operation now always copies the data to a newly allocated buffer, regardless of whether the source object is static or not. Fixed a problem with the FromBCD operator where an implicit result conversion was improperly performed while storing the result to the target operand. Since this is an "explicit conversion" operator, the implicit conversion should never be performed on the output. Fixed a problem with the CopyObject operator where a copy to an existing named object did not always completely overwrite the existing object stored at name. Specifically, a buffer-to-buffer copy did not delete the existing buffer. Replaced "interrupt_level" with "interrupt_number" in all GPE interfaces and structs for consistency. Signed-off-by: Len Brown --- drivers/acpi/dispatcher/dsobject.c | 3 +++ drivers/acpi/dispatcher/dswstate.c | 4 ++-- drivers/acpi/events/evgpeblk.c | 36 ++++++++++++++--------------- drivers/acpi/events/evrgnini.c | 10 ++++++--- drivers/acpi/events/evxfevnt.c | 6 ++--- drivers/acpi/executer/exdump.c | 14 ++++++------ drivers/acpi/executer/exstore.c | 4 ++-- drivers/acpi/executer/exstoren.c | 4 ---- drivers/acpi/namespace/nsdump.c | 31 +++++++++++++------------ drivers/acpi/parser/psopcode.c | 2 +- drivers/acpi/resources/rsdump.c | 4 +++- drivers/acpi/utilities/utcopy.c | 46 ++++++++++++++++---------------------- include/acpi/acconfig.h | 2 +- include/acpi/acevents.h | 2 +- include/acpi/aclocal.h | 3 ++- include/acpi/acopcode.h | 2 +- include/acpi/acpixf.h | 2 +- 17 files changed, 86 insertions(+), 89 deletions(-) (limited to 'include') diff --git a/drivers/acpi/dispatcher/dsobject.c b/drivers/acpi/dispatcher/dsobject.c index bfbae4e4c66..1eee2d54180 100644 --- a/drivers/acpi/dispatcher/dsobject.c +++ b/drivers/acpi/dispatcher/dsobject.c @@ -547,6 +547,9 @@ acpi_ds_init_object_from_op ( case AML_TYPE_LITERAL: obj_desc->integer.value = op->common.value.integer; +#ifndef ACPI_NO_METHOD_EXECUTION + acpi_ex_truncate_for32bit_table (obj_desc); +#endif break; diff --git a/drivers/acpi/dispatcher/dswstate.c b/drivers/acpi/dispatcher/dswstate.c index 9cd3db652b3..4ef0e85c677 100644 --- a/drivers/acpi/dispatcher/dswstate.c +++ b/drivers/acpi/dispatcher/dswstate.c @@ -261,12 +261,12 @@ acpi_ds_result_pop_from_bottom ( if (!*object) { ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Null operand! State=%p #Ops=%X, Index=%X\n", + "Null operand! State=%p #Ops=%X Index=%X\n", walk_state, state->results.num_results, (u32) index)); return (AE_AML_NO_RETURN_VALUE); } - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s], Results=%p State=%p\n", + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s] Results=%p State=%p\n", *object, (*object) ? acpi_ut_get_object_type_name (*object) : "NULL", state, walk_state)); diff --git a/drivers/acpi/events/evgpeblk.c b/drivers/acpi/events/evgpeblk.c index 84186a7d17b..ee5419b8f1b 100644 --- a/drivers/acpi/events/evgpeblk.c +++ b/drivers/acpi/events/evgpeblk.c @@ -66,7 +66,7 @@ acpi_ev_match_prw_and_gpe ( static struct acpi_gpe_xrupt_info * acpi_ev_get_gpe_xrupt_block ( - u32 interrupt_level); + u32 interrupt_number); static acpi_status acpi_ev_delete_gpe_xrupt ( @@ -75,7 +75,7 @@ acpi_ev_delete_gpe_xrupt ( static acpi_status acpi_ev_install_gpe_block ( struct acpi_gpe_block_info *gpe_block, - u32 interrupt_level); + u32 interrupt_number); static acpi_status acpi_ev_create_gpe_info_blocks ( @@ -482,7 +482,7 @@ cleanup: * * FUNCTION: acpi_ev_get_gpe_xrupt_block * - * PARAMETERS: interrupt_level - Interrupt for a GPE block + * PARAMETERS: interrupt_number - Interrupt for a GPE block * * RETURN: A GPE interrupt block * @@ -495,7 +495,7 @@ cleanup: static struct acpi_gpe_xrupt_info * acpi_ev_get_gpe_xrupt_block ( - u32 interrupt_level) + u32 interrupt_number) { struct acpi_gpe_xrupt_info *next_gpe_xrupt; struct acpi_gpe_xrupt_info *gpe_xrupt; @@ -509,7 +509,7 @@ acpi_ev_get_gpe_xrupt_block ( next_gpe_xrupt = acpi_gbl_gpe_xrupt_list_head; while (next_gpe_xrupt) { - if (next_gpe_xrupt->interrupt_level == interrupt_level) { + if (next_gpe_xrupt->interrupt_number == interrupt_number) { return_PTR (next_gpe_xrupt); } @@ -523,7 +523,7 @@ acpi_ev_get_gpe_xrupt_block ( return_PTR (NULL); } - gpe_xrupt->interrupt_level = interrupt_level; + gpe_xrupt->interrupt_number = interrupt_number; /* Install new interrupt descriptor with spin lock */ @@ -544,13 +544,13 @@ acpi_ev_get_gpe_xrupt_block ( /* Install new interrupt handler if not SCI_INT */ - if (interrupt_level != acpi_gbl_FADT->sci_int) { - status = acpi_os_install_interrupt_handler (interrupt_level, + if (interrupt_number != acpi_gbl_FADT->sci_int) { + status = acpi_os_install_interrupt_handler (interrupt_number, acpi_ev_gpe_xrupt_handler, gpe_xrupt); if (ACPI_FAILURE (status)) { ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not install GPE interrupt handler at level 0x%X\n", - interrupt_level)); + interrupt_number)); return_PTR (NULL); } } @@ -584,14 +584,14 @@ acpi_ev_delete_gpe_xrupt ( /* We never want to remove the SCI interrupt handler */ - if (gpe_xrupt->interrupt_level == acpi_gbl_FADT->sci_int) { + if (gpe_xrupt->interrupt_number == acpi_gbl_FADT->sci_int) { gpe_xrupt->gpe_block_list_head = NULL; return_ACPI_STATUS (AE_OK); } /* Disable this interrupt */ - status = acpi_os_remove_interrupt_handler (gpe_xrupt->interrupt_level, + status = acpi_os_remove_interrupt_handler (gpe_xrupt->interrupt_number, acpi_ev_gpe_xrupt_handler); if (ACPI_FAILURE (status)) { return_ACPI_STATUS (status); @@ -621,7 +621,7 @@ acpi_ev_delete_gpe_xrupt ( * FUNCTION: acpi_ev_install_gpe_block * * PARAMETERS: gpe_block - New GPE block - * interrupt_level - Level to be associated with this GPE block + * interrupt_number - Xrupt to be associated with this GPE block * * RETURN: Status * @@ -632,7 +632,7 @@ acpi_ev_delete_gpe_xrupt ( static acpi_status acpi_ev_install_gpe_block ( struct acpi_gpe_block_info *gpe_block, - u32 interrupt_level) + u32 interrupt_number) { struct acpi_gpe_block_info *next_gpe_block; struct acpi_gpe_xrupt_info *gpe_xrupt_block; @@ -647,7 +647,7 @@ acpi_ev_install_gpe_block ( return_ACPI_STATUS (status); } - gpe_xrupt_block = acpi_ev_get_gpe_xrupt_block (interrupt_level); + gpe_xrupt_block = acpi_ev_get_gpe_xrupt_block (interrupt_number); if (!gpe_xrupt_block) { status = AE_NO_MEMORY; goto unlock_and_exit; @@ -887,7 +887,7 @@ error_exit: * gpe_block_address - Address and space_iD * register_count - Number of GPE register pairs in the block * gpe_block_base_number - Starting GPE number for the block - * interrupt_level - H/W interrupt for the block + * interrupt_number - H/W interrupt for the block * return_gpe_block - Where the new block descriptor is returned * * RETURN: Status @@ -902,7 +902,7 @@ acpi_ev_create_gpe_block ( struct acpi_generic_address *gpe_block_address, u32 register_count, u8 gpe_block_base_number, - u32 interrupt_level, + u32 interrupt_number, struct acpi_gpe_block_info **return_gpe_block) { struct acpi_gpe_block_info *gpe_block; @@ -948,7 +948,7 @@ acpi_ev_create_gpe_block ( /* Install the new block in the global list(s) */ - status = acpi_ev_install_gpe_block (gpe_block, interrupt_level); + status = acpi_ev_install_gpe_block (gpe_block, interrupt_number); if (ACPI_FAILURE (status)) { ACPI_MEM_FREE (gpe_block); return_ACPI_STATUS (status); @@ -1013,7 +1013,7 @@ acpi_ev_create_gpe_block ( ((gpe_block->register_count * ACPI_GPE_REGISTER_WIDTH) -1)), gpe_device->name.ascii, gpe_block->register_count, - interrupt_level)); + interrupt_number)); /* Enable all valid GPEs found above */ diff --git a/drivers/acpi/events/evrgnini.c b/drivers/acpi/events/evrgnini.c index 95bc09c73a6..f2d53af9761 100644 --- a/drivers/acpi/events/evrgnini.c +++ b/drivers/acpi/events/evrgnini.c @@ -218,10 +218,14 @@ acpi_ev_pci_config_region_setup ( while (pci_root_node != acpi_gbl_root_node) { status = acpi_ut_execute_HID (pci_root_node, &object_hID); if (ACPI_SUCCESS (status)) { - /* Got a valid _HID, check if this is a PCI root */ - + /* + * Got a valid _HID string, check if this is a PCI root. + * New for ACPI 3.0: check for a PCI Express root also. + */ if (!(ACPI_STRNCMP (object_hID.value, PCI_ROOT_HID_STRING, - sizeof (PCI_ROOT_HID_STRING)))) { + sizeof (PCI_ROOT_HID_STRING)) || + !(ACPI_STRNCMP (object_hID.value, PCI_EXPRESS_ROOT_HID_STRING, + sizeof (PCI_EXPRESS_ROOT_HID_STRING))))) { /* Install a handler for this PCI root bridge */ status = acpi_install_address_space_handler ((acpi_handle) pci_root_node, diff --git a/drivers/acpi/events/evxfevnt.c b/drivers/acpi/events/evxfevnt.c index f337dc2cc56..c5f74d7b64d 100644 --- a/drivers/acpi/events/evxfevnt.c +++ b/drivers/acpi/events/evxfevnt.c @@ -635,7 +635,7 @@ unlock_and_exit: * PARAMETERS: gpe_device - Handle to the parent GPE Block Device * gpe_block_address - Address and space_iD * register_count - Number of GPE register pairs in the block - * interrupt_level - H/W interrupt for the block + * interrupt_number - H/W interrupt for the block * * RETURN: Status * @@ -648,7 +648,7 @@ acpi_install_gpe_block ( acpi_handle gpe_device, struct acpi_generic_address *gpe_block_address, u32 register_count, - u32 interrupt_level) + u32 interrupt_number) { acpi_status status; union acpi_operand_object *obj_desc; @@ -681,7 +681,7 @@ acpi_install_gpe_block ( * is always zero */ status = acpi_ev_create_gpe_block (node, gpe_block_address, register_count, - 0, interrupt_level, &gpe_block); + 0, interrupt_number, &gpe_block); if (ACPI_FAILURE (status)) { goto unlock_and_exit; } diff --git a/drivers/acpi/executer/exdump.c b/drivers/acpi/executer/exdump.c index 40850064811..ae6cad85e01 100644 --- a/drivers/acpi/executer/exdump.c +++ b/drivers/acpi/executer/exdump.c @@ -51,6 +51,11 @@ #define _COMPONENT ACPI_EXECUTER ACPI_MODULE_NAME ("exdump") +/* + * The following routines are used for debug output only + */ +#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) + /* Local prototypes */ #ifdef ACPI_FUTURE_USAGE @@ -76,11 +81,6 @@ acpi_ex_out_address ( #endif /* ACPI_FUTURE_USAGE */ -/* - * The following routines are used for debug output only - */ -#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) - /******************************************************************************* * * FUNCTION: acpi_ex_dump_operand @@ -118,7 +118,7 @@ acpi_ex_dump_operand ( } if (ACPI_GET_DESCRIPTOR_TYPE (obj_desc) == ACPI_DESC_TYPE_NAMED) { - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%p is a NS Node: ", obj_desc)); + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%p Namespace Node: ", obj_desc)); ACPI_DUMP_ENTRY (obj_desc, ACPI_LV_EXEC); return; } @@ -467,7 +467,7 @@ acpi_ex_dump_operands ( } ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "************* Stack dump from %s(%d), %s\n", + "************* Operand Stack dump from %s(%d), %s\n", module_name, line_number, note)); return; } diff --git a/drivers/acpi/executer/exstore.c b/drivers/acpi/executer/exstore.c index 2725db0901b..763ffeea850 100644 --- a/drivers/acpi/executer/exstore.c +++ b/drivers/acpi/executer/exstore.c @@ -574,7 +574,7 @@ acpi_ex_store_object_to_node ( /* If no implicit conversion, drop into the default case below */ - if (!implicit_conversion) { + if ((!implicit_conversion) || (walk_state->opcode == AML_COPY_OP)) { /* Force execution of default (no implicit conversion) */ target_type = ACPI_TYPE_ANY; @@ -634,7 +634,7 @@ acpi_ex_store_object_to_node ( default: ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "Storing %s (%p) directly into node (%p), no implicit conversion\n", + "Storing %s (%p) directly into node (%p) with no implicit conversion\n", acpi_ut_get_object_type_name (source_desc), source_desc, node)); /* No conversions for all other types. Just attach the source object */ diff --git a/drivers/acpi/executer/exstoren.c b/drivers/acpi/executer/exstoren.c index 120f30ed0bd..433588ab432 100644 --- a/drivers/acpi/executer/exstoren.c +++ b/drivers/acpi/executer/exstoren.c @@ -265,10 +265,6 @@ acpi_ex_store_object_to_object ( case ACPI_TYPE_BUFFER: - /* - * Note: There is different store behavior depending on the original - * source type - */ status = acpi_ex_store_buffer_to_buffer (actual_src_desc, dest_desc); break; diff --git a/drivers/acpi/namespace/nsdump.c b/drivers/acpi/namespace/nsdump.c index 6c2aef0e0dd..05af95322a6 100644 --- a/drivers/acpi/namespace/nsdump.c +++ b/drivers/acpi/namespace/nsdump.c @@ -475,7 +475,7 @@ acpi_ns_dump_one_object ( while (obj_desc) { obj_type = ACPI_TYPE_INVALID; - acpi_os_printf (" Attached Object %p: ", obj_desc); + acpi_os_printf ("Attached Object %p: ", obj_desc); /* Decode the type of attached object and dump the contents */ @@ -484,9 +484,9 @@ acpi_ns_dump_one_object ( acpi_os_printf ("(Ptr to Node)\n"); bytes_to_dump = sizeof (struct acpi_namespace_node); + ACPI_DUMP_BUFFER (obj_desc, bytes_to_dump); break; - case ACPI_DESC_TYPE_OPERAND: obj_type = ACPI_GET_OBJECT_TYPE (obj_desc); @@ -497,24 +497,19 @@ acpi_ns_dump_one_object ( bytes_to_dump = 32; } else { - acpi_os_printf ("(Ptr to ACPI Object type %s, %X)\n", - acpi_ut_get_type_name (obj_type), obj_type); + acpi_os_printf ("(Ptr to ACPI Object type %X [%s])\n", + obj_type, acpi_ut_get_type_name (obj_type)); bytes_to_dump = sizeof (union acpi_operand_object); } - break; + ACPI_DUMP_BUFFER (obj_desc, bytes_to_dump); + break; default: - acpi_os_printf ( - "(String or Buffer ptr - not an object descriptor) [%s]\n", - acpi_ut_get_descriptor_name (obj_desc)); - bytes_to_dump = 16; break; } - ACPI_DUMP_BUFFER (obj_desc, bytes_to_dump); - /* If value is NOT an internal object, we are done */ if (ACPI_GET_DESCRIPTOR_TYPE (obj_desc) != ACPI_DESC_TYPE_OPERAND) { @@ -525,13 +520,17 @@ acpi_ns_dump_one_object ( * Valid object, get the pointer to next level, if any */ switch (obj_type) { + case ACPI_TYPE_BUFFER: case ACPI_TYPE_STRING: + /* + * NOTE: takes advantage of common fields between string/buffer + */ + bytes_to_dump = obj_desc->string.length; obj_desc = (void *) obj_desc->string.pointer; - break; - - case ACPI_TYPE_BUFFER: - obj_desc = (void *) obj_desc->buffer.pointer; - break; + acpi_os_printf ( "(Buffer/String pointer %p length %X)\n", + obj_desc, bytes_to_dump); + ACPI_DUMP_BUFFER (obj_desc, bytes_to_dump); + goto cleanup; case ACPI_TYPE_BUFFER_FIELD: obj_desc = (union acpi_operand_object *) obj_desc->buffer_field.buffer_obj; diff --git a/drivers/acpi/parser/psopcode.c b/drivers/acpi/parser/psopcode.c index 5744673568c..95ef5e8947a 100644 --- a/drivers/acpi/parser/psopcode.c +++ b/drivers/acpi/parser/psopcode.c @@ -311,7 +311,7 @@ const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES] = /* ACPI 2.0 opcodes */ /* 6E */ ACPI_OP ("QwordConst", ARGP_QWORD_OP, ARGI_QWORD_OP, ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, AML_CONSTANT), -/* 6F */ ACPI_OP ("Package /*Var*/", ARGP_VAR_PACKAGE_OP, ARGI_VAR_PACKAGE_OP, ACPI_TYPE_PACKAGE, AML_CLASS_CREATE, AML_TYPE_CREATE_OBJECT, AML_HAS_ARGS | AML_DEFER), +/* 6F */ ACPI_OP ("Package", /* Var */ ARGP_VAR_PACKAGE_OP, ARGI_VAR_PACKAGE_OP, ACPI_TYPE_PACKAGE, AML_CLASS_CREATE, AML_TYPE_CREATE_OBJECT, AML_HAS_ARGS | AML_DEFER), /* 70 */ ACPI_OP ("ConcatenateResTemplate", ARGP_CONCAT_RES_OP, ARGI_CONCAT_RES_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_CONSTANT), /* 71 */ ACPI_OP ("Mod", ARGP_MOD_OP, ARGI_MOD_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_CONSTANT), /* 72 */ ACPI_OP ("CreateQWordField", ARGP_CREATE_QWORD_FIELD_OP,ARGI_CREATE_QWORD_FIELD_OP, ACPI_TYPE_BUFFER_FIELD, AML_CLASS_CREATE, AML_TYPE_CREATE_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | AML_DEFER | AML_CREATE), diff --git a/drivers/acpi/resources/rsdump.c b/drivers/acpi/resources/rsdump.c index 1935dab2ab5..2c3bb8c3574 100644 --- a/drivers/acpi/resources/rsdump.c +++ b/drivers/acpi/resources/rsdump.c @@ -48,6 +48,9 @@ #define _COMPONENT ACPI_RESOURCES ACPI_MODULE_NAME ("rsdump") + +#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) + /* Local prototypes */ static void @@ -103,7 +106,6 @@ acpi_rs_dump_vendor_specific ( union acpi_resource_data *data); -#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) /******************************************************************************* * * FUNCTION: acpi_rs_dump_irq diff --git a/drivers/acpi/utilities/utcopy.c b/drivers/acpi/utilities/utcopy.c index 11e88495716..31c30a32e5c 100644 --- a/drivers/acpi/utilities/utcopy.c +++ b/drivers/acpi/utilities/utcopy.c @@ -694,58 +694,50 @@ acpi_ut_copy_simple_object ( dest_desc->common.reference_count = reference_count; dest_desc->common.next_object = next_object; + /* New object is not static, regardless of source */ + + dest_desc->common.flags &= ~AOPOBJ_STATIC_POINTER; + /* Handle the objects with extra data */ switch (ACPI_GET_OBJECT_TYPE (dest_desc)) { case ACPI_TYPE_BUFFER: - - dest_desc->buffer.node = NULL; - dest_desc->common.flags = source_desc->common.flags; - /* * Allocate and copy the actual buffer if and only if: * 1) There is a valid buffer pointer - * 2) The buffer is not static (not in an ACPI table) (in this case, - * the actual pointer was already copied above) + * 2) The buffer has a length > 0 */ if ((source_desc->buffer.pointer) && - (!(source_desc->common.flags & AOPOBJ_STATIC_POINTER))) { - dest_desc->buffer.pointer = NULL; - - /* Create an actual buffer only if length > 0 */ - - if (source_desc->buffer.length) { - dest_desc->buffer.pointer = - ACPI_MEM_ALLOCATE (source_desc->buffer.length); - if (!dest_desc->buffer.pointer) { - return (AE_NO_MEMORY); - } + (source_desc->buffer.length)) { + dest_desc->buffer.pointer = + ACPI_MEM_ALLOCATE (source_desc->buffer.length); + if (!dest_desc->buffer.pointer) { + return (AE_NO_MEMORY); + } - /* Copy the actual buffer data */ + /* Copy the actual buffer data */ - ACPI_MEMCPY (dest_desc->buffer.pointer, - source_desc->buffer.pointer, - source_desc->buffer.length); - } + ACPI_MEMCPY (dest_desc->buffer.pointer, + source_desc->buffer.pointer, + source_desc->buffer.length); } break; case ACPI_TYPE_STRING: - /* * Allocate and copy the actual string if and only if: * 1) There is a valid string pointer - * 2) The string is not static (not in an ACPI table) (in this case, - * the actual pointer was already copied above) + * (Pointer to a NULL string is allowed) */ - if ((source_desc->string.pointer) && - (!(source_desc->common.flags & AOPOBJ_STATIC_POINTER))) { + if (source_desc->string.pointer) { dest_desc->string.pointer = ACPI_MEM_ALLOCATE ((acpi_size) source_desc->string.length + 1); if (!dest_desc->string.pointer) { return (AE_NO_MEMORY); } + /* Copy the actual string data */ + ACPI_MEMCPY (dest_desc->string.pointer, source_desc->string.pointer, (acpi_size) source_desc->string.length + 1); } diff --git a/include/acpi/acconfig.h b/include/acpi/acconfig.h index 2f6ab189fc6..a268c4ae187 100644 --- a/include/acpi/acconfig.h +++ b/include/acpi/acconfig.h @@ -64,7 +64,7 @@ /* Version string */ -#define ACPI_CA_VERSION 0x20050408 +#define ACPI_CA_VERSION 0x20050513 /* * OS name, used for the _OS object. The _OS object is essentially obsolete, diff --git a/include/acpi/acevents.h b/include/acpi/acevents.h index 61a27c8c507..301c5cce666 100644 --- a/include/acpi/acevents.h +++ b/include/acpi/acevents.h @@ -136,7 +136,7 @@ acpi_ev_create_gpe_block ( struct acpi_generic_address *gpe_block_address, u32 register_count, u8 gpe_block_base_number, - u32 interrupt_level, + u32 interrupt_number, struct acpi_gpe_block_info **return_gpe_block); acpi_status diff --git a/include/acpi/aclocal.h b/include/acpi/aclocal.h index 030e641115c..52c6a202586 100644 --- a/include/acpi/aclocal.h +++ b/include/acpi/aclocal.h @@ -365,7 +365,7 @@ struct acpi_gpe_xrupt_info struct acpi_gpe_xrupt_info *previous; struct acpi_gpe_xrupt_info *next; struct acpi_gpe_block_info *gpe_block_list_head; /* List of GPE blocks for this xrupt */ - u32 interrupt_level; /* System interrupt level */ + u32 interrupt_number; /* System interrupt number */ }; @@ -737,6 +737,7 @@ struct acpi_parse_state ****************************************************************************/ #define PCI_ROOT_HID_STRING "PNP0A03" +#define PCI_EXPRESS_ROOT_HID_STRING "PNP0A08" struct acpi_bit_register_info { diff --git a/include/acpi/acopcode.h b/include/acpi/acopcode.h index 118ecba4cf0..093f697e8c5 100644 --- a/include/acpi/acopcode.h +++ b/include/acpi/acopcode.h @@ -246,7 +246,7 @@ #define ARGI_FIELD_OP ARGI_INVALID_OPCODE #define ARGI_FIND_SET_LEFT_BIT_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_TARGETREF) #define ARGI_FIND_SET_RIGHT_BIT_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_TARGETREF) -#define ARGI_FROM_BCD_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_TARGETREF) +#define ARGI_FROM_BCD_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_FIXED_TARGET) #define ARGI_IF_OP ARGI_INVALID_OPCODE #define ARGI_INCREMENT_OP ARGI_LIST1 (ARGI_INTEGER_REF) #define ARGI_INDEX_FIELD_OP ARGI_INVALID_OPCODE diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h index f8f619f8e4f..9ca212d73fb 100644 --- a/include/acpi/acpixf.h +++ b/include/acpi/acpixf.h @@ -387,7 +387,7 @@ acpi_install_gpe_block ( acpi_handle gpe_device, struct acpi_generic_address *gpe_block_address, u32 register_count, - u32 interrupt_level); + u32 interrupt_number); acpi_status acpi_remove_gpe_block ( -- cgit v1.2.3-70-g09d2 From 88ac00f5a841dcfc5c682000f4a6add0add8caac Mon Sep 17 00:00:00 2001 From: Robert Moore Date: Thu, 26 May 2005 00:00:00 -0400 Subject: ACPICA 20050526 from Bob Moore Implemented support to execute Type 1 and Type 2 AML opcodes appearing at the module level (not within a control method.) These opcodes are executed exactly once at the time the table is loaded. This type of code was legal up until the release of ACPI 2.0B (2002) and is now supported within ACPI CA in order to provide backwards compatibility with earlier BIOS implementations. This eliminates the "Encountered executable code at module level" warning that was previously generated upon detection of such code. Fixed a problem in the interpreter where an AE_NOT_FOUND exception could inadvertently be generated during the lookup of namespace objects in the second pass parse of ACPI tables and control methods. It appears that this problem could occur during the resolution of forward references to namespace objects. Added the ACPI_MUTEX_DEBUG #ifdef to the acpi_ut_release_mutex function, corresponding to the same the deadlock detection debug code to be compiled out in the normal case, improving mutex performance (and overall subsystem performance) considerably. As suggested by Alexey Starikovskiy. Implemented a handful of miscellaneous fixes for possible memory leaks on error conditions and error handling control paths. These fixes were suggested by FreeBSD and the Coverity Prevent source code analysis tool. Added a check for a null RSDT pointer in acpi_get_firmware_table (tbxfroot.c) to prevent a fault in this error case. Signed-off-by Len Brown --- drivers/acpi/dispatcher/dsmethod.c | 8 ++- drivers/acpi/dispatcher/dsopcode.c | 15 +++-- drivers/acpi/dispatcher/dswload.c | 56 ++++++++++++------- drivers/acpi/dispatcher/dswstate.c | 1 + drivers/acpi/executer/exconfig.c | 27 +++++---- drivers/acpi/executer/exfield.c | 5 +- drivers/acpi/executer/exnames.c | 7 +++ drivers/acpi/executer/exoparg1.c | 11 ++-- drivers/acpi/namespace/nsparse.c | 2 + drivers/acpi/parser/psparse.c | 109 ++++++++++++++++++++++++++++--------- drivers/acpi/tables/tbxfroot.c | 6 +- drivers/acpi/utilities/utmisc.c | 38 +++++++------ include/acpi/acconfig.h | 2 +- include/acpi/acstruct.h | 2 +- 14 files changed, 198 insertions(+), 91 deletions(-) (limited to 'include') diff --git a/drivers/acpi/dispatcher/dsmethod.c b/drivers/acpi/dispatcher/dsmethod.c index 9fc3f4c033e..c9d9a6c45ae 100644 --- a/drivers/acpi/dispatcher/dsmethod.c +++ b/drivers/acpi/dispatcher/dsmethod.c @@ -139,7 +139,8 @@ acpi_ds_parse_method ( walk_state = acpi_ds_create_walk_state (owner_id, NULL, NULL, NULL); if (!walk_state) { - return_ACPI_STATUS (AE_NO_MEMORY); + status = AE_NO_MEMORY; + goto cleanup; } status = acpi_ds_init_aml_walk (walk_state, op, node, @@ -147,7 +148,7 @@ acpi_ds_parse_method ( obj_desc->method.aml_length, NULL, 1); if (ACPI_FAILURE (status)) { acpi_ds_delete_walk_state (walk_state); - return_ACPI_STATUS (status); + goto cleanup; } /* @@ -161,13 +162,14 @@ acpi_ds_parse_method ( */ status = acpi_ps_parse_aml (walk_state); if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + goto cleanup; } ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "**** [%4.4s] Parsed **** named_obj=%p Op=%p\n", acpi_ut_get_node_name (obj_handle), obj_handle, op)); +cleanup: acpi_ps_delete_parse_tree (op); return_ACPI_STATUS (status); } diff --git a/drivers/acpi/dispatcher/dsopcode.c b/drivers/acpi/dispatcher/dsopcode.c index ba13bca28be..750bdb1ac34 100644 --- a/drivers/acpi/dispatcher/dsopcode.c +++ b/drivers/acpi/dispatcher/dsopcode.c @@ -119,14 +119,15 @@ acpi_ds_execute_arguments ( walk_state = acpi_ds_create_walk_state (0, NULL, NULL, NULL); if (!walk_state) { - return_ACPI_STATUS (AE_NO_MEMORY); + status = AE_NO_MEMORY; + goto cleanup; } status = acpi_ds_init_aml_walk (walk_state, op, NULL, aml_start, aml_length, NULL, 1); if (ACPI_FAILURE (status)) { acpi_ds_delete_walk_state (walk_state); - return_ACPI_STATUS (status); + goto cleanup; } /* Mark this parse as a deferred opcode */ @@ -138,8 +139,7 @@ acpi_ds_execute_arguments ( status = acpi_ps_parse_aml (walk_state); if (ACPI_FAILURE (status)) { - acpi_ps_delete_parse_tree (op); - return_ACPI_STATUS (status); + goto cleanup; } /* Get and init the Op created above */ @@ -160,7 +160,8 @@ acpi_ds_execute_arguments ( walk_state = acpi_ds_create_walk_state (0, NULL, NULL, NULL); if (!walk_state) { - return_ACPI_STATUS (AE_NO_MEMORY); + status = AE_NO_MEMORY; + goto cleanup; } /* Execute the opcode and arguments */ @@ -169,13 +170,15 @@ acpi_ds_execute_arguments ( aml_length, NULL, 3); if (ACPI_FAILURE (status)) { acpi_ds_delete_walk_state (walk_state); - return_ACPI_STATUS (status); + goto cleanup; } /* Mark this execution as a deferred opcode */ walk_state->deferred_node = node; status = acpi_ps_parse_aml (walk_state); + +cleanup: acpi_ps_delete_parse_tree (op); return_ACPI_STATUS (status); } diff --git a/drivers/acpi/dispatcher/dswload.c b/drivers/acpi/dispatcher/dswload.c index 1ac197ccfc8..e2e0a855be2 100644 --- a/drivers/acpi/dispatcher/dswload.c +++ b/drivers/acpi/dispatcher/dswload.c @@ -145,15 +145,6 @@ acpi_ds_load1_begin_op ( if (op) { if (!(walk_state->op_info->flags & AML_NAMED)) { -#if 0 - if ((walk_state->op_info->class == AML_CLASS_EXECUTE) || - (walk_state->op_info->class == AML_CLASS_CONTROL)) { - acpi_os_printf ("\n\n***EXECUTABLE OPCODE %s***\n\n", - walk_state->op_info->name); - *out_op = op; - return (AE_CTRL_SKIP); - } -#endif *out_op = op; return (AE_OK); } @@ -486,6 +477,15 @@ acpi_ds_load2_begin_op ( ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op, walk_state)); if (op) { + if ((walk_state->control_state) && + (walk_state->control_state->common.state == + ACPI_CONTROL_CONDITIONAL_EXECUTING)) { + /* We are executing a while loop outside of a method */ + + status = acpi_ds_exec_begin_op (walk_state, out_op); + return_ACPI_STATUS (status); + } + /* We only care about Namespace opcodes here */ if ((!(walk_state->op_info->flags & AML_NSOPCODE) && @@ -493,9 +493,14 @@ acpi_ds_load2_begin_op ( (!(walk_state->op_info->flags & AML_NAMED))) { if ((walk_state->op_info->class == AML_CLASS_EXECUTE) || (walk_state->op_info->class == AML_CLASS_CONTROL)) { - ACPI_REPORT_WARNING (( - "Encountered executable code at module level, [%s]\n", - acpi_ps_get_opcode_name (walk_state->opcode))); + ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, + "Begin/EXEC: %s (fl %8.8X)\n", walk_state->op_info->name, + walk_state->op_info->flags)); + + /* Executing a type1 or type2 opcode outside of a method */ + + status = acpi_ds_exec_begin_op (walk_state, out_op); + return_ACPI_STATUS (status); } return_ACPI_STATUS (AE_OK); } @@ -657,8 +662,10 @@ acpi_ds_load2_begin_op ( break; } + /* Add new entry into namespace */ + status = acpi_ns_lookup (walk_state->scope_info, buffer_ptr, object_type, - ACPI_IMODE_EXECUTE, ACPI_NS_NO_UPSEARCH, + ACPI_IMODE_LOAD_PASS2, ACPI_NS_NO_UPSEARCH, walk_state, &(node)); break; } @@ -668,7 +675,6 @@ acpi_ds_load2_begin_op ( return_ACPI_STATUS (status); } - if (!op) { /* Create a new op */ @@ -682,9 +688,7 @@ acpi_ds_load2_begin_op ( if (node) { op->named.name = node->name.integer; } - if (out_op) { - *out_op = op; - } + *out_op = op; } /* @@ -731,9 +735,24 @@ acpi_ds_load2_end_op ( ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Opcode [%s] Op %p State %p\n", walk_state->op_info->name, op, walk_state)); - /* Only interested in opcodes that have namespace objects */ + /* Check if opcode had an associated namespace object */ if (!(walk_state->op_info->flags & AML_NSOBJECT)) { +#ifndef ACPI_NO_METHOD_EXECUTION + /* No namespace object. Executable opcode? */ + + if ((walk_state->op_info->class == AML_CLASS_EXECUTE) || + (walk_state->op_info->class == AML_CLASS_CONTROL)) { + ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, + "End/EXEC: %s (fl %8.8X)\n", walk_state->op_info->name, + walk_state->op_info->flags)); + + /* Executing a type1 or type2 opcode outside of a method */ + + status = acpi_ds_exec_end_op (walk_state); + return_ACPI_STATUS (status); + } +#endif return_ACPI_STATUS (AE_OK); } @@ -742,7 +761,6 @@ acpi_ds_load2_end_op ( "Ending scope Op=%p State=%p\n", op, walk_state)); } - object_type = walk_state->op_info->object_type; /* diff --git a/drivers/acpi/dispatcher/dswstate.c b/drivers/acpi/dispatcher/dswstate.c index 4ef0e85c677..cc45d52225d 100644 --- a/drivers/acpi/dispatcher/dswstate.c +++ b/drivers/acpi/dispatcher/dswstate.c @@ -762,6 +762,7 @@ acpi_ds_init_aml_walk ( /* The next_op of the next_walk will be the beginning of the method */ walk_state->next_op = NULL; + walk_state->pass_number = (u8) pass_number; if (info) { if (info->parameter_type == ACPI_PARAM_GPE) { diff --git a/drivers/acpi/executer/exconfig.c b/drivers/acpi/executer/exconfig.c index 734b2f24af4..8bfa6effaa0 100644 --- a/drivers/acpi/executer/exconfig.c +++ b/drivers/acpi/executer/exconfig.c @@ -376,16 +376,22 @@ acpi_ex_load_op ( */ status = acpi_ex_read_data_from_field (walk_state, obj_desc, &buffer_desc); if (ACPI_FAILURE (status)) { - goto cleanup; + return_ACPI_STATUS (status); } table_ptr = ACPI_CAST_PTR (struct acpi_table_header, buffer_desc->buffer.pointer); - /* Sanity check the table length */ + /* All done with the buffer_desc, delete it */ + + buffer_desc->buffer.pointer = NULL; + acpi_ut_remove_reference (buffer_desc); + + /* Sanity check the table length */ if (table_ptr->length < sizeof (struct acpi_table_header)) { - return_ACPI_STATUS (AE_BAD_HEADER); + status = AE_BAD_HEADER; + goto cleanup; } break; @@ -413,7 +419,9 @@ acpi_ex_load_op ( status = acpi_ex_add_table (table_ptr, acpi_gbl_root_node, &ddb_handle); if (ACPI_FAILURE (status)) { - goto cleanup; + /* On error, table_ptr was deallocated above */ + + return_ACPI_STATUS (status); } /* Store the ddb_handle into the Target operand */ @@ -421,17 +429,14 @@ acpi_ex_load_op ( status = acpi_ex_store (ddb_handle, target, walk_state); if (ACPI_FAILURE (status)) { (void) acpi_ex_unload_table (ddb_handle); - } - return_ACPI_STATUS (status); + /* table_ptr was deallocated above */ + return_ACPI_STATUS (status); + } cleanup: - - if (buffer_desc) { - acpi_ut_remove_reference (buffer_desc); - } - else { + if (ACPI_FAILURE (status)) { ACPI_MEM_FREE (table_ptr); } return_ACPI_STATUS (status); diff --git a/drivers/acpi/executer/exfield.c b/drivers/acpi/executer/exfield.c index 22c8fa480f6..a690c925099 100644 --- a/drivers/acpi/executer/exfield.c +++ b/drivers/acpi/executer/exfield.c @@ -87,6 +87,9 @@ acpi_ex_read_data_from_field ( if (!obj_desc) { return_ACPI_STATUS (AE_AML_NO_OPERAND); } + if (!ret_buffer_desc) { + return_ACPI_STATUS (AE_BAD_PARAMETER); + } if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_BUFFER_FIELD) { /* @@ -182,7 +185,7 @@ exit: if (ACPI_FAILURE (status)) { acpi_ut_remove_reference (buffer_desc); } - else if (ret_buffer_desc) { + else { *ret_buffer_desc = buffer_desc; } diff --git a/drivers/acpi/executer/exnames.c b/drivers/acpi/executer/exnames.c index 639f0bd3f6d..b6ba1a7a677 100644 --- a/drivers/acpi/executer/exnames.c +++ b/drivers/acpi/executer/exnames.c @@ -438,6 +438,13 @@ acpi_ex_get_name_string ( status = AE_AML_BAD_NAME; } + if (ACPI_FAILURE (status)) { + if (name_string) { + ACPI_MEM_FREE (name_string); + } + return_ACPI_STATUS (status); + } + *out_name_string = name_string; *out_name_length = (u32) (aml_address - in_aml_address); diff --git a/drivers/acpi/executer/exoparg1.c b/drivers/acpi/executer/exoparg1.c index dbdf8262ba0..ffc61ddeb65 100644 --- a/drivers/acpi/executer/exoparg1.c +++ b/drivers/acpi/executer/exoparg1.c @@ -127,15 +127,16 @@ acpi_ex_opcode_0A_0T_1R ( cleanup: - if (!walk_state->result_obj) { - walk_state->result_obj = return_desc; - } - /* Delete return object on error */ - if (ACPI_FAILURE (status)) { + if ((ACPI_FAILURE (status)) || walk_state->result_obj) { acpi_ut_remove_reference (return_desc); } + else { + /* Save the return value */ + + walk_state->result_obj = return_desc; + } return_ACPI_STATUS (status); } diff --git a/drivers/acpi/namespace/nsparse.c b/drivers/acpi/namespace/nsparse.c index a0e13e8d376..f81b836e77f 100644 --- a/drivers/acpi/namespace/nsparse.c +++ b/drivers/acpi/namespace/nsparse.c @@ -146,6 +146,7 @@ acpi_ns_parse_table ( * to service the entire parse. The second pass of the parse then * performs another complete parse of the AML.. */ + ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "**** Start pass 1\n")); status = acpi_ns_one_complete_parse (1, table_desc); if (ACPI_FAILURE (status)) { return_ACPI_STATUS (status); @@ -160,6 +161,7 @@ acpi_ns_parse_table ( * overhead of this is compensated for by the fact that the * parse objects are all cached. */ + ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "**** Start pass 2\n")); status = acpi_ns_one_complete_parse (2, table_desc); if (ACPI_FAILURE (status)) { return_ACPI_STATUS (status); diff --git a/drivers/acpi/parser/psparse.c b/drivers/acpi/parser/psparse.c index bbfdc1a58c2..bdbe0d99486 100644 --- a/drivers/acpi/parser/psparse.c +++ b/drivers/acpi/parser/psparse.c @@ -66,7 +66,7 @@ static u32 acpi_gbl_depth = 0; /* Local prototypes */ -static void +static acpi_status acpi_ps_complete_this_op ( struct acpi_walk_state *walk_state, union acpi_parse_object *op); @@ -152,13 +152,13 @@ acpi_ps_peek_opcode ( * PARAMETERS: walk_state - Current State * Op - Op to complete * - * RETURN: None. + * RETURN: Status * * DESCRIPTION: Perform any cleanup at the completion of an Op. * ******************************************************************************/ -static void +static acpi_status acpi_ps_complete_this_op ( struct acpi_walk_state *walk_state, union acpi_parse_object *op) @@ -175,19 +175,26 @@ acpi_ps_complete_this_op ( /* Check for null Op, can happen if AML code is corrupt */ if (!op) { - return_VOID; + return_ACPI_STATUS (AE_OK); /* OK for now */ } /* Delete this op and the subtree below it if asked to */ if (((walk_state->parse_flags & ACPI_PARSE_TREE_MASK) != ACPI_PARSE_DELETE_TREE) || (walk_state->op_info->class == AML_CLASS_ARGUMENT)) { - return_VOID; + return_ACPI_STATUS (AE_OK); } /* Make sure that we only delete this subtree */ if (op->common.parent) { + prev = op->common.parent->common.value.arg; + if (!prev) { + /* Nothing more to do */ + + goto cleanup; + } + /* * Check if we need to replace the operator and its subtree * with a return value op (placeholder op) @@ -206,7 +213,7 @@ acpi_ps_complete_this_op ( */ replacement_op = acpi_ps_alloc_op (AML_INT_RETURN_VALUE_OP); if (!replacement_op) { - goto cleanup; + goto allocate_error; } break; @@ -223,18 +230,17 @@ acpi_ps_complete_this_op ( (op->common.parent->common.aml_opcode == AML_VAR_PACKAGE_OP)) { replacement_op = acpi_ps_alloc_op (AML_INT_RETURN_VALUE_OP); if (!replacement_op) { - goto cleanup; + goto allocate_error; } } - - if ((op->common.parent->common.aml_opcode == AML_NAME_OP) && - (walk_state->descending_callback != acpi_ds_exec_begin_op)) { + else if ((op->common.parent->common.aml_opcode == AML_NAME_OP) && + (walk_state->pass_number <= ACPI_IMODE_LOAD_PASS2)) { if ((op->common.aml_opcode == AML_BUFFER_OP) || (op->common.aml_opcode == AML_PACKAGE_OP) || (op->common.aml_opcode == AML_VAR_PACKAGE_OP)) { replacement_op = acpi_ps_alloc_op (op->common.aml_opcode); if (!replacement_op) { - goto cleanup; + goto allocate_error; } replacement_op->named.data = op->named.data; @@ -244,15 +250,15 @@ acpi_ps_complete_this_op ( break; default: + replacement_op = acpi_ps_alloc_op (AML_INT_RETURN_VALUE_OP); if (!replacement_op) { - goto cleanup; + goto allocate_error; } } /* We must unlink this op from the parent tree */ - prev = op->common.parent->common.value.arg; if (prev == op) { /* This op is the first in the list */ @@ -298,7 +304,15 @@ cleanup: /* Now we can actually delete the subtree rooted at Op */ acpi_ps_delete_parse_tree (op); - return_VOID; + return_ACPI_STATUS (AE_OK); + + +allocate_error: + + /* Always delete the subtree, even on error */ + + acpi_ps_delete_parse_tree (op); + return_ACPI_STATUS (AE_NO_MEMORY); } @@ -443,6 +457,7 @@ acpi_ps_parse_loop ( struct acpi_walk_state *walk_state) { acpi_status status = AE_OK; + acpi_status status2; union acpi_parse_object *op = NULL; /* current op */ union acpi_parse_object *arg = NULL; union acpi_parse_object *pre_op = NULL; @@ -744,7 +759,6 @@ acpi_ps_parse_loop ( break; default: - /* * Op is not a constant or string, append each argument * to the Op @@ -770,6 +784,23 @@ acpi_ps_parse_loop ( /* Special processing for certain opcodes */ + if (walk_state->pass_number <= ACPI_IMODE_LOAD_PASS1) { + switch (op->common.aml_opcode) { + case AML_IF_OP: + case AML_ELSE_OP: + case AML_WHILE_OP: + + /* Skip body of if/else/while in pass 1 */ + + parser_state->aml = parser_state->pkg_end; + walk_state->arg_count = 0; + break; + + default: + break; + } + } + switch (op->common.aml_opcode) { case AML_METHOD_OP: @@ -796,7 +827,7 @@ acpi_ps_parse_loop ( if ((op->common.parent) && (op->common.parent->common.aml_opcode == AML_NAME_OP) && - (walk_state->descending_callback != acpi_ds_exec_begin_op)) { + (walk_state->pass_number <= ACPI_IMODE_LOAD_PASS2)) { /* * Skip parsing of Buffers and Packages * because we don't have enough info in the first pass @@ -900,15 +931,21 @@ close_this_op: */ parser_state->scope->parse_scope.arg_count--; - /* Close this Op (will result in parse subtree deletion) */ + /* Finished with pre_op */ - acpi_ps_complete_this_op (walk_state, op); - op = NULL; if (pre_op) { acpi_ps_free_op (pre_op); pre_op = NULL; } + /* Close this Op (will result in parse subtree deletion) */ + + status2 = acpi_ps_complete_this_op (walk_state, op); + if (ACPI_FAILURE (status2)) { + return_ACPI_STATUS (status2); + } + op = NULL; + switch (status) { case AE_OK: break; @@ -936,7 +973,10 @@ close_this_op: status = walk_state->ascending_callback (walk_state); status = acpi_ps_next_parse_state (walk_state, op, status); - acpi_ps_complete_this_op (walk_state, op); + status2 = acpi_ps_complete_this_op (walk_state, op); + if (ACPI_FAILURE (status2)) { + return_ACPI_STATUS (status2); + } op = NULL; } status = AE_OK; @@ -962,7 +1002,10 @@ close_this_op: status = walk_state->ascending_callback (walk_state); status = acpi_ps_next_parse_state (walk_state, op, status); - acpi_ps_complete_this_op (walk_state, op); + status2 = acpi_ps_complete_this_op (walk_state, op); + if (ACPI_FAILURE (status2)) { + return_ACPI_STATUS (status2); + } op = NULL; status = AE_OK; @@ -976,7 +1019,10 @@ close_this_op: /* Clean up */ do { if (op) { - acpi_ps_complete_this_op (walk_state, op); + status2 = acpi_ps_complete_this_op (walk_state, op); + if (ACPI_FAILURE (status2)) { + return_ACPI_STATUS (status2); + } } acpi_ps_pop_scope (parser_state, &op, &walk_state->arg_types, &walk_state->arg_count); @@ -990,7 +1036,10 @@ close_this_op: do { if (op) { - acpi_ps_complete_this_op (walk_state, op); + status2 = acpi_ps_complete_this_op (walk_state, op); + if (ACPI_FAILURE (status2)) { + return_ACPI_STATUS (status2); + } } acpi_ps_pop_scope (parser_state, &op, &walk_state->arg_types, &walk_state->arg_count); @@ -1053,7 +1102,10 @@ close_this_op: /* Clean up */ do { if (op) { - acpi_ps_complete_this_op (walk_state, op); + status2 = acpi_ps_complete_this_op (walk_state, op); + if (ACPI_FAILURE (status2)) { + return_ACPI_STATUS (status2); + } } acpi_ps_pop_scope (parser_state, &op, @@ -1065,12 +1117,17 @@ close_this_op: } else if (ACPI_FAILURE (status)) { - acpi_ps_complete_this_op (walk_state, op); + /* First error is most important */ + + (void) acpi_ps_complete_this_op (walk_state, op); return_ACPI_STATUS (status); } } - acpi_ps_complete_this_op (walk_state, op); + status2 = acpi_ps_complete_this_op (walk_state, op); + if (ACPI_FAILURE (status2)) { + return_ACPI_STATUS (status2); + } } acpi_ps_pop_scope (parser_state, &op, &walk_state->arg_types, diff --git a/drivers/acpi/tables/tbxfroot.c b/drivers/acpi/tables/tbxfroot.c index dc3c3f6a9f6..198997aa7fb 100644 --- a/drivers/acpi/tables/tbxfroot.c +++ b/drivers/acpi/tables/tbxfroot.c @@ -331,8 +331,10 @@ acpi_get_firmware_table ( cleanup: - acpi_os_unmap_memory (rsdt_info->pointer, - (acpi_size) rsdt_info->pointer->length); + if (rsdt_info->pointer) { + acpi_os_unmap_memory (rsdt_info->pointer, + (acpi_size) rsdt_info->pointer->length); + } ACPI_MEM_FREE (rsdt_info); if (header) { diff --git a/drivers/acpi/utilities/utmisc.c b/drivers/acpi/utilities/utmisc.c index f6de4ed3d52..bb658777fa8 100644 --- a/drivers/acpi/utilities/utmisc.c +++ b/drivers/acpi/utilities/utmisc.c @@ -787,7 +787,6 @@ acpi_ut_release_mutex ( acpi_mutex_handle mutex_id) { acpi_status status; - u32 i; u32 this_thread_id; @@ -814,25 +813,32 @@ acpi_ut_release_mutex ( return (AE_NOT_ACQUIRED); } - /* - * Deadlock prevention. Check if this thread owns any mutexes of value - * greater than this one. If so, the thread has violated the mutex - * ordering rule. This indicates a coding error somewhere in - * the ACPI subsystem code. - */ - for (i = mutex_id; i < MAX_MUTEX; i++) { - if (acpi_gbl_mutex_info[i].owner_id == this_thread_id) { - if (i == mutex_id) { - continue; - } +#ifdef ACPI_MUTEX_DEBUG + { + u32 i; + /* + * Mutex debug code, for internal debugging only. + * + * Deadlock prevention. Check if this thread owns any mutexes of value + * greater than this one. If so, the thread has violated the mutex + * ordering rule. This indicates a coding error somewhere in + * the ACPI subsystem code. + */ + for (i = mutex_id; i < MAX_MUTEX; i++) { + if (acpi_gbl_mutex_info[i].owner_id == this_thread_id) { + if (i == mutex_id) { + continue; + } - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Invalid release order: owns [%s], releasing [%s]\n", - acpi_ut_get_mutex_name (i), acpi_ut_get_mutex_name (mutex_id))); + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, + "Invalid release order: owns [%s], releasing [%s]\n", + acpi_ut_get_mutex_name (i), acpi_ut_get_mutex_name (mutex_id))); - return (AE_RELEASE_DEADLOCK); + return (AE_RELEASE_DEADLOCK); + } } } +#endif /* Mark unlocked FIRST */ diff --git a/include/acpi/acconfig.h b/include/acpi/acconfig.h index a268c4ae187..6babcb10493 100644 --- a/include/acpi/acconfig.h +++ b/include/acpi/acconfig.h @@ -64,7 +64,7 @@ /* Version string */ -#define ACPI_CA_VERSION 0x20050513 +#define ACPI_CA_VERSION 0x20050526 /* * OS name, used for the _OS object. The _OS object is essentially obsolete, diff --git a/include/acpi/acstruct.h b/include/acpi/acstruct.h index e6b9e36a2ed..4e926457bd2 100644 --- a/include/acpi/acstruct.h +++ b/include/acpi/acstruct.h @@ -78,7 +78,7 @@ struct acpi_walk_state u8 return_used; u16 opcode; /* Current AML opcode */ u8 scope_depth; - u8 reserved1; + u8 pass_number; /* Parse pass during table load */ u32 arg_count; /* push for fixed or var args */ u32 aml_offset; u32 arg_types; -- cgit v1.2.3-70-g09d2 From 73459f73e5d1602c59ebec114fc45185521353c1 Mon Sep 17 00:00:00 2001 From: Robert Moore Date: Fri, 24 Jun 2005 00:00:00 -0400 Subject: ACPICA 20050617-0624 from Bob Moore ACPICA 20050617: Moved the object cache operations into the OS interface layer (OSL) to allow the host OS to handle these operations if desired (for example, the Linux OSL will invoke the slab allocator). This support is optional; the compile time define ACPI_USE_LOCAL_CACHE may be used to utilize the original cache code in the ACPI CA core. The new OSL interfaces are shown below. See utalloc.c for an example implementation, and acpiosxf.h for the exact interface definitions. Thanks to Alexey Starikovskiy. acpi_os_create_cache acpi_os_delete_cache acpi_os_purge_cache acpi_os_acquire_object acpi_os_release_object Modified the interfaces to acpi_os_acquire_lock and acpi_os_release_lock to return and restore a flags parameter. This fits better with many OS lock models. Note: the current execution state (interrupt handler or not) is no longer passed to these interfaces. If necessary, the OSL must determine this state by itself, a simple and fast operation. Thanks to Alexey Starikovskiy. Fixed a problem in the ACPI table handling where a valid XSDT was assumed present if the revision of the RSDP was 2 or greater. According to the ACPI specification, the XSDT is optional in all cases, and the table manager therefore now checks for both an RSDP >=2 and a valid XSDT pointer. Otherwise, the RSDT pointer is used. Some ACPI 2.0 compliant BIOSs contain only the RSDT. Fixed an interpreter problem with the Mid() operator in the case of an input string where the resulting output string is of zero length. It now correctly returns a valid, null terminated string object instead of a string object with a null pointer. Fixed a problem with the control method argument handling to allow a store to an Arg object that already contains an object of type Device. The Device object is now correctly overwritten. Previously, an error was returned. ACPICA 20050624: Modified the new OSL cache interfaces to use ACPI_CACHE_T as the type for the host-defined cache object. This allows the OSL implementation to define and type this object in any manner desired, simplifying the OSL implementation. For example, ACPI_CACHE_T is defined as kmem_cache_t for Linux, and should be defined in the OS-specific header file for other operating systems as required. Changed the interface to AcpiOsAcquireObject to directly return the requested object as the function return (instead of ACPI_STATUS.) This change was made for performance reasons, since this is the purpose of the interface in the first place. acpi_os_acquire_object is now similar to the acpi_os_allocate interface. Thanks to Alexey Starikovskiy. Modified the initialization sequence in acpi_initialize_subsystem to call the OSL interface acpi_osl_initialize first, before any local initialization. This change was required because the global initialization now calls OSL interfaces. Restructured the code base to split some files because of size and/or because the code logically belonged in a separate file. New files are listed below. utilities/utcache.c /* Local cache interfaces */ utilities/utmutex.c /* Local mutex support */ utilities/utstate.c /* State object support */ parser/psloop.c /* Main AML parse loop */ Signed-off-by: Len Brown --- drivers/acpi/dispatcher/dsmthdat.c | 15 +- drivers/acpi/dispatcher/dswload.c | 6 +- drivers/acpi/dispatcher/dswstate.c | 33 +- drivers/acpi/events/evgpe.c | 5 +- drivers/acpi/events/evgpeblk.c | 27 +- drivers/acpi/events/evmisc.c | 4 +- drivers/acpi/events/evxface.c | 10 +- drivers/acpi/executer/exconvrt.c | 2 +- drivers/acpi/executer/exdump.c | 174 +++++++-- drivers/acpi/executer/exmisc.c | 2 +- drivers/acpi/executer/exoparg1.c | 3 +- drivers/acpi/executer/exoparg3.c | 63 ++- drivers/acpi/executer/exstore.c | 2 +- drivers/acpi/executer/exutils.c | 2 +- drivers/acpi/hardware/hwgpe.c | 20 +- drivers/acpi/hardware/hwregs.c | 2 +- drivers/acpi/hardware/hwsleep.c | 12 +- drivers/acpi/namespace/nsaccess.c | 2 +- drivers/acpi/namespace/nsalloc.c | 6 +- drivers/acpi/namespace/nsdump.c | 30 +- drivers/acpi/osl.c | 196 +++++++--- drivers/acpi/parser/Makefile | 2 +- drivers/acpi/parser/psloop.c | 775 +++++++++++++++++++++++++++++++++++++ drivers/acpi/parser/psopcode.c | 28 +- drivers/acpi/parser/psparse.c | 728 +--------------------------------- drivers/acpi/parser/psutils.c | 37 +- drivers/acpi/tables/tbconvrt.c | 8 +- drivers/acpi/tables/tbrsdt.c | 34 +- drivers/acpi/tables/tbxfroot.c | 8 +- drivers/acpi/utilities/Makefile | 2 +- drivers/acpi/utilities/utalloc.c | 304 ++++++--------- drivers/acpi/utilities/utcache.c | 322 +++++++++++++++ drivers/acpi/utilities/utdebug.c | 4 +- drivers/acpi/utilities/utglobal.c | 38 +- drivers/acpi/utilities/utinit.c | 2 +- drivers/acpi/utilities/utmisc.c | 689 +-------------------------------- drivers/acpi/utilities/utmutex.c | 380 ++++++++++++++++++ drivers/acpi/utilities/utobject.c | 34 +- drivers/acpi/utilities/utstate.c | 376 ++++++++++++++++++ drivers/acpi/utilities/utxface.c | 23 +- include/acpi/acconfig.h | 9 +- include/acpi/acdebug.h | 6 +- include/acpi/acdisasm.h | 1 + include/acpi/acdispat.h | 6 - include/acpi/acevents.h | 3 +- include/acpi/acglobal.h | 26 +- include/acpi/achware.h | 6 +- include/acpi/aclocal.h | 24 +- include/acpi/acparser.h | 26 +- include/acpi/acpiosxf.h | 35 +- include/acpi/acstruct.h | 3 + include/acpi/actypes.h | 5 + include/acpi/acutils.h | 63 ++- include/acpi/amlcode.h | 4 +- include/acpi/platform/acenv.h | 19 +- include/acpi/platform/aclinux.h | 11 + 56 files changed, 2624 insertions(+), 2033 deletions(-) create mode 100644 drivers/acpi/parser/psloop.c create mode 100644 drivers/acpi/utilities/utcache.c create mode 100644 drivers/acpi/utilities/utmutex.c create mode 100644 drivers/acpi/utilities/utstate.c (limited to 'include') diff --git a/drivers/acpi/dispatcher/dsmthdat.c b/drivers/acpi/dispatcher/dsmthdat.c index f7998306f75..c83d53fd639 100644 --- a/drivers/acpi/dispatcher/dsmthdat.c +++ b/drivers/acpi/dispatcher/dsmthdat.c @@ -632,23 +632,12 @@ acpi_ds_store_object_to_local ( * Weird, but true. */ if (opcode == AML_ARG_OP) { - /* - * Make sure that the object is the correct type. This may be - * overkill, butit is here because references were NS nodes in - * the past. Now they are operand objects of type Reference. - */ - if (ACPI_GET_DESCRIPTOR_TYPE (current_obj_desc) != ACPI_DESC_TYPE_OPERAND) { - ACPI_REPORT_ERROR (( - "Invalid descriptor type while storing to method arg: [%s]\n", - acpi_ut_get_descriptor_name (current_obj_desc))); - return_ACPI_STATUS (AE_AML_INTERNAL); - } - /* * If we have a valid reference object that came from ref_of(), * do the indirect store */ - if ((current_obj_desc->common.type == ACPI_TYPE_LOCAL_REFERENCE) && + if ((ACPI_GET_DESCRIPTOR_TYPE (current_obj_desc) == ACPI_DESC_TYPE_OPERAND) && + (current_obj_desc->common.type == ACPI_TYPE_LOCAL_REFERENCE) && (current_obj_desc->reference.opcode == AML_REF_OF_OP)) { ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Arg (%p) is an obj_ref(Node), storing in node %p\n", diff --git a/drivers/acpi/dispatcher/dswload.c b/drivers/acpi/dispatcher/dswload.c index e2e0a855be2..d2c603f54fd 100644 --- a/drivers/acpi/dispatcher/dswload.c +++ b/drivers/acpi/dispatcher/dswload.c @@ -50,7 +50,7 @@ #include #include -#ifdef _ACPI_ASL_COMPILER +#ifdef ACPI_ASL_COMPILER #include #endif @@ -176,7 +176,7 @@ acpi_ds_load1_begin_op ( */ status = acpi_ns_lookup (walk_state->scope_info, path, object_type, ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, walk_state, &(node)); -#ifdef _ACPI_ASL_COMPILER +#ifdef ACPI_ASL_COMPILER if (status == AE_NOT_FOUND) { /* * Table disassembly: @@ -569,7 +569,7 @@ acpi_ds_load2_begin_op ( ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, walk_state, &(node)); if (ACPI_FAILURE (status)) { -#ifdef _ACPI_ASL_COMPILER +#ifdef ACPI_ASL_COMPILER if (status == AE_NOT_FOUND) { status = AE_OK; } diff --git a/drivers/acpi/dispatcher/dswstate.c b/drivers/acpi/dispatcher/dswstate.c index cc45d52225d..d360d8e8954 100644 --- a/drivers/acpi/dispatcher/dswstate.c +++ b/drivers/acpi/dispatcher/dswstate.c @@ -681,7 +681,7 @@ acpi_ds_create_walk_state ( ACPI_FUNCTION_TRACE ("ds_create_walk_state"); - walk_state = acpi_ut_acquire_from_cache (ACPI_MEM_LIST_WALK); + walk_state = ACPI_MEM_CALLOCATE (sizeof (struct acpi_walk_state)); if (!walk_state) { return_PTR (NULL); } @@ -704,7 +704,7 @@ acpi_ds_create_walk_state ( status = acpi_ds_result_stack_push (walk_state); if (ACPI_FAILURE (status)) { - acpi_ut_release_to_cache (ACPI_MEM_LIST_WALK, walk_state); + ACPI_MEM_FREE (walk_state); return_PTR (NULL); } @@ -900,38 +900,11 @@ acpi_ds_delete_walk_state ( acpi_ut_delete_generic_state (state); } - acpi_ut_release_to_cache (ACPI_MEM_LIST_WALK, walk_state); + ACPI_MEM_FREE (walk_state); return_VOID; } -#ifdef ACPI_ENABLE_OBJECT_CACHE -/****************************************************************************** - * - * FUNCTION: acpi_ds_delete_walk_state_cache - * - * PARAMETERS: None - * - * RETURN: None - * - * DESCRIPTION: Purge the global state object cache. Used during subsystem - * termination. - * - ******************************************************************************/ - -void -acpi_ds_delete_walk_state_cache ( - void) -{ - ACPI_FUNCTION_TRACE ("ds_delete_walk_state_cache"); - - - acpi_ut_delete_generic_cache (ACPI_MEM_LIST_WALK); - return_VOID; -} -#endif - - #ifdef ACPI_OBSOLETE_FUNCTIONS /******************************************************************************* * diff --git a/drivers/acpi/events/evgpe.c b/drivers/acpi/events/evgpe.c index 081120b109b..ede834df4f6 100644 --- a/drivers/acpi/events/evgpe.c +++ b/drivers/acpi/events/evgpe.c @@ -396,6 +396,7 @@ acpi_ev_gpe_detect ( struct acpi_gpe_register_info *gpe_register_info; u32 status_reg; u32 enable_reg; + u32 flags; acpi_status status; struct acpi_gpe_block_info *gpe_block; acpi_native_uint i; @@ -412,7 +413,7 @@ acpi_ev_gpe_detect ( /* Examine all GPE blocks attached to this interrupt level */ - acpi_os_acquire_lock (acpi_gbl_gpe_lock, ACPI_ISR); + flags = acpi_os_acquire_lock (acpi_gbl_gpe_lock); gpe_block = gpe_xrupt_list->gpe_block_list_head; while (gpe_block) { /* @@ -476,7 +477,7 @@ acpi_ev_gpe_detect ( unlock_and_exit: - acpi_os_release_lock (acpi_gbl_gpe_lock, ACPI_ISR); + acpi_os_release_lock (acpi_gbl_gpe_lock, flags); return (int_status); } diff --git a/drivers/acpi/events/evgpeblk.c b/drivers/acpi/events/evgpeblk.c index ee5419b8f1b..dfc54692b12 100644 --- a/drivers/acpi/events/evgpeblk.c +++ b/drivers/acpi/events/evgpeblk.c @@ -138,7 +138,6 @@ acpi_ev_valid_gpe_event ( * FUNCTION: acpi_ev_walk_gpe_list * * PARAMETERS: gpe_walk_callback - Routine called for each GPE block - * Flags - ACPI_NOT_ISR or ACPI_ISR * * RETURN: Status * @@ -148,18 +147,18 @@ acpi_ev_valid_gpe_event ( acpi_status acpi_ev_walk_gpe_list ( - ACPI_GPE_CALLBACK gpe_walk_callback, - u32 flags) + ACPI_GPE_CALLBACK gpe_walk_callback) { struct acpi_gpe_block_info *gpe_block; struct acpi_gpe_xrupt_info *gpe_xrupt_info; acpi_status status = AE_OK; + u32 flags; ACPI_FUNCTION_TRACE ("ev_walk_gpe_list"); - acpi_os_acquire_lock (acpi_gbl_gpe_lock, flags); + flags = acpi_os_acquire_lock (acpi_gbl_gpe_lock); /* Walk the interrupt level descriptor list */ @@ -500,6 +499,7 @@ acpi_ev_get_gpe_xrupt_block ( struct acpi_gpe_xrupt_info *next_gpe_xrupt; struct acpi_gpe_xrupt_info *gpe_xrupt; acpi_status status; + u32 flags; ACPI_FUNCTION_TRACE ("ev_get_gpe_xrupt_block"); @@ -527,7 +527,7 @@ acpi_ev_get_gpe_xrupt_block ( /* Install new interrupt descriptor with spin lock */ - acpi_os_acquire_lock (acpi_gbl_gpe_lock, ACPI_NOT_ISR); + flags = acpi_os_acquire_lock (acpi_gbl_gpe_lock); if (acpi_gbl_gpe_xrupt_list_head) { next_gpe_xrupt = acpi_gbl_gpe_xrupt_list_head; while (next_gpe_xrupt->next) { @@ -540,7 +540,7 @@ acpi_ev_get_gpe_xrupt_block ( else { acpi_gbl_gpe_xrupt_list_head = gpe_xrupt; } - acpi_os_release_lock (acpi_gbl_gpe_lock, ACPI_NOT_ISR); + acpi_os_release_lock (acpi_gbl_gpe_lock, flags); /* Install new interrupt handler if not SCI_INT */ @@ -577,6 +577,7 @@ acpi_ev_delete_gpe_xrupt ( struct acpi_gpe_xrupt_info *gpe_xrupt) { acpi_status status; + u32 flags; ACPI_FUNCTION_TRACE ("ev_delete_gpe_xrupt"); @@ -599,7 +600,7 @@ acpi_ev_delete_gpe_xrupt ( /* Unlink the interrupt block with lock */ - acpi_os_acquire_lock (acpi_gbl_gpe_lock, ACPI_NOT_ISR); + flags = acpi_os_acquire_lock (acpi_gbl_gpe_lock); if (gpe_xrupt->previous) { gpe_xrupt->previous->next = gpe_xrupt->next; } @@ -607,7 +608,7 @@ acpi_ev_delete_gpe_xrupt ( if (gpe_xrupt->next) { gpe_xrupt->next->previous = gpe_xrupt->previous; } - acpi_os_release_lock (acpi_gbl_gpe_lock, ACPI_NOT_ISR); + acpi_os_release_lock (acpi_gbl_gpe_lock, flags); /* Free the block */ @@ -637,6 +638,7 @@ acpi_ev_install_gpe_block ( struct acpi_gpe_block_info *next_gpe_block; struct acpi_gpe_xrupt_info *gpe_xrupt_block; acpi_status status; + u32 flags; ACPI_FUNCTION_TRACE ("ev_install_gpe_block"); @@ -655,7 +657,7 @@ acpi_ev_install_gpe_block ( /* Install the new block at the end of the list with lock */ - acpi_os_acquire_lock (acpi_gbl_gpe_lock, ACPI_NOT_ISR); + flags = acpi_os_acquire_lock (acpi_gbl_gpe_lock); if (gpe_xrupt_block->gpe_block_list_head) { next_gpe_block = gpe_xrupt_block->gpe_block_list_head; while (next_gpe_block->next) { @@ -670,7 +672,7 @@ acpi_ev_install_gpe_block ( } gpe_block->xrupt_block = gpe_xrupt_block; - acpi_os_release_lock (acpi_gbl_gpe_lock, ACPI_NOT_ISR); + acpi_os_release_lock (acpi_gbl_gpe_lock, flags); unlock_and_exit: status = acpi_ut_release_mutex (ACPI_MTX_EVENTS); @@ -695,6 +697,7 @@ acpi_ev_delete_gpe_block ( struct acpi_gpe_block_info *gpe_block) { acpi_status status; + u32 flags; ACPI_FUNCTION_TRACE ("ev_install_gpe_block"); @@ -720,7 +723,7 @@ acpi_ev_delete_gpe_block ( else { /* Remove the block on this interrupt with lock */ - acpi_os_acquire_lock (acpi_gbl_gpe_lock, ACPI_NOT_ISR); + flags = acpi_os_acquire_lock (acpi_gbl_gpe_lock); if (gpe_block->previous) { gpe_block->previous->next = gpe_block->next; } @@ -731,7 +734,7 @@ acpi_ev_delete_gpe_block ( if (gpe_block->next) { gpe_block->next->previous = gpe_block->previous; } - acpi_os_release_lock (acpi_gbl_gpe_lock, ACPI_NOT_ISR); + acpi_os_release_lock (acpi_gbl_gpe_lock, flags); } /* Free the gpe_block */ diff --git a/drivers/acpi/events/evmisc.c b/drivers/acpi/events/evmisc.c index 659e9095611..38d7ab8aef3 100644 --- a/drivers/acpi/events/evmisc.c +++ b/drivers/acpi/events/evmisc.c @@ -589,7 +589,7 @@ acpi_ev_terminate ( /* Disable all GPEs in all GPE blocks */ - status = acpi_ev_walk_gpe_list (acpi_hw_disable_gpe_block, ACPI_NOT_ISR); + status = acpi_ev_walk_gpe_list (acpi_hw_disable_gpe_block); /* Remove SCI handler */ @@ -602,7 +602,7 @@ acpi_ev_terminate ( /* Deallocate all handler objects installed within GPE info structs */ - status = acpi_ev_walk_gpe_list (acpi_ev_delete_gpe_handlers, ACPI_NOT_ISR); + status = acpi_ev_walk_gpe_list (acpi_ev_delete_gpe_handlers); /* Return to original mode if necessary */ diff --git a/drivers/acpi/events/evxface.c b/drivers/acpi/events/evxface.c index 4092d47f675..4c1c25e316a 100644 --- a/drivers/acpi/events/evxface.c +++ b/drivers/acpi/events/evxface.c @@ -591,6 +591,7 @@ acpi_install_gpe_handler ( struct acpi_gpe_event_info *gpe_event_info; struct acpi_handler_info *handler; acpi_status status; + u32 flags; ACPI_FUNCTION_TRACE ("acpi_install_gpe_handler"); @@ -643,7 +644,7 @@ acpi_install_gpe_handler ( /* Install the handler */ - acpi_os_acquire_lock (acpi_gbl_gpe_lock, ACPI_NOT_ISR); + flags = acpi_os_acquire_lock (acpi_gbl_gpe_lock); gpe_event_info->dispatch.handler = handler; /* Setup up dispatch flags to indicate handler (vs. method) */ @@ -651,7 +652,7 @@ acpi_install_gpe_handler ( gpe_event_info->flags &= ~(ACPI_GPE_XRUPT_TYPE_MASK | ACPI_GPE_DISPATCH_MASK); /* Clear bits */ gpe_event_info->flags |= (u8) (type | ACPI_GPE_DISPATCH_HANDLER); - acpi_os_release_lock (acpi_gbl_gpe_lock, ACPI_NOT_ISR); + acpi_os_release_lock (acpi_gbl_gpe_lock, flags); unlock_and_exit: @@ -685,6 +686,7 @@ acpi_remove_gpe_handler ( struct acpi_gpe_event_info *gpe_event_info; struct acpi_handler_info *handler; acpi_status status; + u32 flags; ACPI_FUNCTION_TRACE ("acpi_remove_gpe_handler"); @@ -741,7 +743,7 @@ acpi_remove_gpe_handler ( /* Remove the handler */ - acpi_os_acquire_lock (acpi_gbl_gpe_lock, ACPI_NOT_ISR); + flags = acpi_os_acquire_lock (acpi_gbl_gpe_lock); handler = gpe_event_info->dispatch.handler; /* Restore Method node (if any), set dispatch flags */ @@ -751,7 +753,7 @@ acpi_remove_gpe_handler ( if (handler->method_node) { gpe_event_info->flags |= ACPI_GPE_DISPATCH_METHOD; } - acpi_os_release_lock (acpi_gbl_gpe_lock, ACPI_NOT_ISR); + acpi_os_release_lock (acpi_gbl_gpe_lock, flags); /* Now we can free the handler object */ diff --git a/drivers/acpi/executer/exconvrt.c b/drivers/acpi/executer/exconvrt.c index 97856c48bd7..21331625e66 100644 --- a/drivers/acpi/executer/exconvrt.c +++ b/drivers/acpi/executer/exconvrt.c @@ -367,7 +367,7 @@ acpi_ex_convert_to_ascii ( /* hex_length: 2 ascii hex chars per data byte */ - hex_length = ACPI_MUL_2 (data_width); + hex_length = (acpi_native_uint) ACPI_MUL_2 (data_width); for (i = 0, j = (hex_length-1); i < hex_length; i++, j--) { /* Get one hex digit, most significant digits first */ diff --git a/drivers/acpi/executer/exdump.c b/drivers/acpi/executer/exdump.c index ae6cad85e01..7007abb6051 100644 --- a/drivers/acpi/executer/exdump.c +++ b/drivers/acpi/executer/exdump.c @@ -80,6 +80,16 @@ acpi_ex_out_address ( acpi_physical_address value); #endif /* ACPI_FUTURE_USAGE */ +static void +acpi_ex_dump_reference ( + union acpi_operand_object *obj_desc); + +static void +acpi_ex_dump_package ( + union acpi_operand_object *obj_desc, + u32 level, + u32 index); + /******************************************************************************* * @@ -508,7 +518,7 @@ acpi_ex_out_integer ( char *title, u32 value) { - acpi_os_printf ("%20s : %X\n", title, value); + acpi_os_printf ("%20s : %.2X\n", title, value); } static void @@ -563,11 +573,146 @@ acpi_ex_dump_node ( } +/******************************************************************************* + * + * FUNCTION: acpi_ex_dump_reference + * + * PARAMETERS: Object - Descriptor to dump + * + * DESCRIPTION: Dumps a reference object + * + ******************************************************************************/ + +static void +acpi_ex_dump_reference ( + union acpi_operand_object *obj_desc) +{ + struct acpi_buffer ret_buf; + acpi_status status; + + + if (obj_desc->reference.opcode == AML_INT_NAMEPATH_OP) { + acpi_os_printf ("Named Object %p ", obj_desc->reference.node); + ret_buf.length = ACPI_ALLOCATE_LOCAL_BUFFER; + status = acpi_ns_handle_to_pathname (obj_desc->reference.node, &ret_buf); + if (ACPI_FAILURE (status)) { + acpi_os_printf ("Could not convert name to pathname\n"); + } + else { + acpi_os_printf ("%s\n", ret_buf.pointer); + ACPI_MEM_FREE (ret_buf.pointer); + } + } + else if (obj_desc->reference.object) { + acpi_os_printf ("\nReferenced Object: %p\n", obj_desc->reference.object); + } +} + + +/******************************************************************************* + * + * FUNCTION: acpi_ex_dump_package + * + * PARAMETERS: Object - Descriptor to dump + * Level - Indentation Level + * Index - Package index for this object + * + * DESCRIPTION: Dumps the elements of the package + * + ******************************************************************************/ + +static void +acpi_ex_dump_package ( + union acpi_operand_object *obj_desc, + u32 level, + u32 index) +{ + u32 i; + + + /* Indentation and index output */ + + if (level > 0) { + for (i = 0; i < level; i++) { + acpi_os_printf (" "); + } + + acpi_os_printf ("[%.2d] ", index); + } + + acpi_os_printf ("%p ", obj_desc); + + /* Null package elements are allowed */ + + if (!obj_desc) { + acpi_os_printf ("[Null Object]\n"); + return; + } + + /* Packages may only contain a few object types */ + + switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { + case ACPI_TYPE_INTEGER: + + acpi_os_printf ("[Integer] = %8.8X%8.8X\n", + ACPI_FORMAT_UINT64 (obj_desc->integer.value)); + break; + + + case ACPI_TYPE_STRING: + + acpi_os_printf ("[String] Value: "); + for (i = 0; i < obj_desc->string.length; i++) { + acpi_os_printf ("%c", obj_desc->string.pointer[i]); + } + acpi_os_printf ("\n"); + break; + + + case ACPI_TYPE_BUFFER: + + acpi_os_printf ("[Buffer] Length %.2X = ", obj_desc->buffer.length); + if (obj_desc->buffer.length) { + acpi_ut_dump_buffer ((u8 *) obj_desc->buffer.pointer, + obj_desc->buffer.length, DB_DWORD_DISPLAY, _COMPONENT); + } + else { + acpi_os_printf ("\n"); + } + break; + + + case ACPI_TYPE_PACKAGE: + + acpi_os_printf ("[Package] Contains %d Elements: \n", + obj_desc->package.count); + + for (i = 0; i < obj_desc->package.count; i++) { + acpi_ex_dump_package (obj_desc->package.elements[i], level+1, i); + } + break; + + + case ACPI_TYPE_LOCAL_REFERENCE: + + acpi_os_printf ("[Object Reference] "); + acpi_ex_dump_reference (obj_desc); + break; + + + default: + + acpi_os_printf ("[Unknown Type] %X\n", ACPI_GET_OBJECT_TYPE (obj_desc)); + break; + } +} + + /******************************************************************************* * * FUNCTION: acpi_ex_dump_object_descriptor * - * PARAMETERS: *Object - Descriptor to dump + * PARAMETERS: Object - Descriptor to dump * Flags - Force display if TRUE * * DESCRIPTION: Dumps the members of the object descriptor given. @@ -579,9 +724,6 @@ acpi_ex_dump_object_descriptor ( union acpi_operand_object *obj_desc, u32 flags) { - u32 i; - - ACPI_FUNCTION_TRACE ("ex_dump_object_descriptor"); @@ -648,22 +790,13 @@ acpi_ex_dump_object_descriptor ( case ACPI_TYPE_PACKAGE: acpi_ex_out_integer ("Flags", obj_desc->package.flags); - acpi_ex_out_integer ("Count", obj_desc->package.count); - acpi_ex_out_pointer ("Elements", obj_desc->package.elements); + acpi_ex_out_integer ("Elements", obj_desc->package.count); + acpi_ex_out_pointer ("Element List", obj_desc->package.elements); /* Dump the package contents */ - if (obj_desc->package.count > 0) { - acpi_os_printf ("\nPackage Contents:\n"); - for (i = 0; i < obj_desc->package.count; i++) { - acpi_os_printf ("[%.3d] %p", i, obj_desc->package.elements[i]); - if (obj_desc->package.elements[i]) { - acpi_os_printf (" %s", - acpi_ut_get_object_type_name (obj_desc->package.elements[i])); - } - acpi_os_printf ("\n"); - } - } + acpi_os_printf ("\nPackage Contents:\n"); + acpi_ex_dump_package (obj_desc, 0, 0); break; @@ -790,10 +923,7 @@ acpi_ex_dump_object_descriptor ( acpi_ex_out_pointer ("Node", obj_desc->reference.node); acpi_ex_out_pointer ("Where", obj_desc->reference.where); - if (obj_desc->reference.object) { - acpi_os_printf ("\nReferenced Object:\n"); - acpi_ex_dump_object_descriptor (obj_desc->reference.object, flags); - } + acpi_ex_dump_reference (obj_desc); break; diff --git a/drivers/acpi/executer/exmisc.c b/drivers/acpi/executer/exmisc.c index 022f281345b..237ef28c813 100644 --- a/drivers/acpi/executer/exmisc.c +++ b/drivers/acpi/executer/exmisc.c @@ -302,7 +302,7 @@ acpi_ex_do_concatenate ( /* Result of two Integers is a Buffer */ /* Need enough buffer space for two integers */ - return_desc = acpi_ut_create_buffer_object ( + return_desc = acpi_ut_create_buffer_object ((acpi_size) ACPI_MUL_2 (acpi_gbl_integer_byte_width)); if (!return_desc) { status = AE_NO_MEMORY; diff --git a/drivers/acpi/executer/exoparg1.c b/drivers/acpi/executer/exoparg1.c index ffc61ddeb65..131f49acb1d 100644 --- a/drivers/acpi/executer/exoparg1.c +++ b/drivers/acpi/executer/exoparg1.c @@ -113,8 +113,9 @@ acpi_ex_opcode_0A_0T_1R ( status = AE_NO_MEMORY; goto cleanup; } - +#if ACPI_MACHINE_WIDTH != 16 return_desc->integer.value = acpi_os_get_timer (); +#endif break; default: /* Unknown opcode */ diff --git a/drivers/acpi/executer/exoparg3.c b/drivers/acpi/executer/exoparg3.c index 23b068adbf5..197890f443b 100644 --- a/drivers/acpi/executer/exoparg3.c +++ b/drivers/acpi/executer/exoparg3.c @@ -160,7 +160,7 @@ acpi_ex_opcode_3A_1T_1R ( { union acpi_operand_object **operand = &walk_state->operands[0]; union acpi_operand_object *return_desc = NULL; - char *buffer; + char *buffer = NULL; acpi_status status = AE_OK; acpi_integer index; acpi_size length; @@ -193,34 +193,63 @@ acpi_ex_opcode_3A_1T_1R ( * If the index is beyond the length of the String/Buffer, or if the * requested length is zero, return a zero-length String/Buffer */ - if ((index < operand[0]->string.length) && - (length > 0)) { - /* Truncate request if larger than the actual String/Buffer */ - - if ((index + length) > - operand[0]->string.length) { - length = (acpi_size) operand[0]->string.length - - (acpi_size) index; - } + if (index >= operand[0]->string.length) { + length = 0; + } + + /* Truncate request if larger than the actual String/Buffer */ + + else if ((index + length) > operand[0]->string.length) { + length = (acpi_size) operand[0]->string.length - + (acpi_size) index; + } - /* Allocate a new buffer for the String/Buffer */ + /* Strings always have a sub-pointer, not so for buffers */ + + switch (ACPI_GET_OBJECT_TYPE (operand[0])) { + case ACPI_TYPE_STRING: + + /* Always allocate a new buffer for the String */ buffer = ACPI_MEM_CALLOCATE ((acpi_size) length + 1); if (!buffer) { status = AE_NO_MEMORY; goto cleanup; } + break; + + case ACPI_TYPE_BUFFER: + + /* If the requested length is zero, don't allocate a buffer */ + + if (length > 0) { + /* Allocate a new buffer for the Buffer */ + + buffer = ACPI_MEM_CALLOCATE (length); + if (!buffer) { + status = AE_NO_MEMORY; + goto cleanup; + } + } + break; + default: /* Should not happen */ + + status = AE_AML_OPERAND_TYPE; + goto cleanup; + } + + if (length > 0) { /* Copy the portion requested */ ACPI_MEMCPY (buffer, operand[0]->string.pointer + index, length); + } - /* Set the length of the new String/Buffer */ + /* Set the length of the new String/Buffer */ - return_desc->string.pointer = buffer; - return_desc->string.length = (u32) length; - } + return_desc->string.pointer = buffer; + return_desc->string.length = (u32) length; /* Mark buffer initialized */ @@ -244,13 +273,13 @@ cleanup: /* Delete return object on error */ - if (ACPI_FAILURE (status)) { + if (ACPI_FAILURE (status) || walk_state->result_obj) { acpi_ut_remove_reference (return_desc); } /* Set the return object and exit */ - if (!walk_state->result_obj) { + else { walk_state->result_obj = return_desc; } return_ACPI_STATUS (status); diff --git a/drivers/acpi/executer/exstore.c b/drivers/acpi/executer/exstore.c index 763ffeea850..59dbfeaa54c 100644 --- a/drivers/acpi/executer/exstore.c +++ b/drivers/acpi/executer/exstore.c @@ -147,7 +147,7 @@ acpi_ex_do_debug_object ( case ACPI_TYPE_BUFFER: - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[0x%.2X]", + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[0x%.2X]\n", (u32) source_desc->buffer.length)); ACPI_DUMP_BUFFER (source_desc->buffer.pointer, (source_desc->buffer.length < 32) ? source_desc->buffer.length : 32); diff --git a/drivers/acpi/executer/exutils.c b/drivers/acpi/executer/exutils.c index 5c7ec0c0417..d00b0dcba96 100644 --- a/drivers/acpi/executer/exutils.c +++ b/drivers/acpi/executer/exutils.c @@ -369,7 +369,7 @@ acpi_ex_eisa_id_to_string ( * * RETURN: None, string * - * DESCRIPTOIN: Convert a number to string representation. Assumes string + * DESCRIPTION: Convert a number to string representation. Assumes string * buffer is large enough to hold the string. * ******************************************************************************/ diff --git a/drivers/acpi/hardware/hwgpe.c b/drivers/acpi/hardware/hwgpe.c index 8daeabb2fc7..3536bbb990c 100644 --- a/drivers/acpi/hardware/hwgpe.c +++ b/drivers/acpi/hardware/hwgpe.c @@ -374,7 +374,7 @@ acpi_hw_enable_wakeup_gpe_block ( * * FUNCTION: acpi_hw_disable_all_gpes * - * PARAMETERS: Flags - ACPI_NOT_ISR or ACPI_ISR + * PARAMETERS: None * * RETURN: Status * @@ -384,7 +384,7 @@ acpi_hw_enable_wakeup_gpe_block ( acpi_status acpi_hw_disable_all_gpes ( - u32 flags) + void) { acpi_status status; @@ -392,8 +392,8 @@ acpi_hw_disable_all_gpes ( ACPI_FUNCTION_TRACE ("hw_disable_all_gpes"); - status = acpi_ev_walk_gpe_list (acpi_hw_disable_gpe_block, flags); - status = acpi_ev_walk_gpe_list (acpi_hw_clear_gpe_block, flags); + status = acpi_ev_walk_gpe_list (acpi_hw_disable_gpe_block); + status = acpi_ev_walk_gpe_list (acpi_hw_clear_gpe_block); return_ACPI_STATUS (status); } @@ -402,7 +402,7 @@ acpi_hw_disable_all_gpes ( * * FUNCTION: acpi_hw_enable_all_runtime_gpes * - * PARAMETERS: Flags - ACPI_NOT_ISR or ACPI_ISR + * PARAMETERS: None * * RETURN: Status * @@ -412,7 +412,7 @@ acpi_hw_disable_all_gpes ( acpi_status acpi_hw_enable_all_runtime_gpes ( - u32 flags) + void) { acpi_status status; @@ -420,7 +420,7 @@ acpi_hw_enable_all_runtime_gpes ( ACPI_FUNCTION_TRACE ("hw_enable_all_runtime_gpes"); - status = acpi_ev_walk_gpe_list (acpi_hw_enable_runtime_gpe_block, flags); + status = acpi_ev_walk_gpe_list (acpi_hw_enable_runtime_gpe_block); return_ACPI_STATUS (status); } @@ -429,7 +429,7 @@ acpi_hw_enable_all_runtime_gpes ( * * FUNCTION: acpi_hw_enable_all_wakeup_gpes * - * PARAMETERS: Flags - ACPI_NOT_ISR or ACPI_ISR + * PARAMETERS: None * * RETURN: Status * @@ -439,7 +439,7 @@ acpi_hw_enable_all_runtime_gpes ( acpi_status acpi_hw_enable_all_wakeup_gpes ( - u32 flags) + void) { acpi_status status; @@ -447,7 +447,7 @@ acpi_hw_enable_all_wakeup_gpes ( ACPI_FUNCTION_TRACE ("hw_enable_all_wakeup_gpes"); - status = acpi_ev_walk_gpe_list (acpi_hw_enable_wakeup_gpe_block, flags); + status = acpi_ev_walk_gpe_list (acpi_hw_enable_wakeup_gpe_block); return_ACPI_STATUS (status); } diff --git a/drivers/acpi/hardware/hwregs.c b/drivers/acpi/hardware/hwregs.c index 6d9e4eb8483..04a058565d8 100644 --- a/drivers/acpi/hardware/hwregs.c +++ b/drivers/acpi/hardware/hwregs.c @@ -106,7 +106,7 @@ acpi_hw_clear_acpi_status ( /* Clear the GPE Bits in all GPE registers in all GPE blocks */ - status = acpi_ev_walk_gpe_list (acpi_hw_clear_gpe_block, ACPI_ISR); + status = acpi_ev_walk_gpe_list (acpi_hw_clear_gpe_block); unlock_and_exit: if (flags & ACPI_MTX_LOCK) { diff --git a/drivers/acpi/hardware/hwsleep.c b/drivers/acpi/hardware/hwsleep.c index 415d342aeab..cedee0c43b5 100644 --- a/drivers/acpi/hardware/hwsleep.c +++ b/drivers/acpi/hardware/hwsleep.c @@ -274,13 +274,13 @@ acpi_enter_sleep_state ( * 1) Disable/Clear all GPEs * 2) Enable all wakeup GPEs */ - status = acpi_hw_disable_all_gpes (ACPI_ISR); + status = acpi_hw_disable_all_gpes (); if (ACPI_FAILURE (status)) { return_ACPI_STATUS (status); } acpi_gbl_system_awake_and_running = FALSE; - status = acpi_hw_enable_all_wakeup_gpes (ACPI_ISR); + status = acpi_hw_enable_all_wakeup_gpes (); if (ACPI_FAILURE (status)) { return_ACPI_STATUS (status); } @@ -424,13 +424,13 @@ acpi_enter_sleep_state_s4bios ( * 1) Disable/Clear all GPEs * 2) Enable all wakeup GPEs */ - status = acpi_hw_disable_all_gpes (ACPI_ISR); + status = acpi_hw_disable_all_gpes (); if (ACPI_FAILURE (status)) { return_ACPI_STATUS (status); } acpi_gbl_system_awake_and_running = FALSE; - status = acpi_hw_enable_all_wakeup_gpes (ACPI_ISR); + status = acpi_hw_enable_all_wakeup_gpes (); if (ACPI_FAILURE (status)) { return_ACPI_STATUS (status); } @@ -557,13 +557,13 @@ acpi_leave_sleep_state ( * 1) Disable/Clear all GPEs * 2) Enable all runtime GPEs */ - status = acpi_hw_disable_all_gpes (ACPI_NOT_ISR); + status = acpi_hw_disable_all_gpes (); if (ACPI_FAILURE (status)) { return_ACPI_STATUS (status); } acpi_gbl_system_awake_and_running = TRUE; - status = acpi_hw_enable_all_runtime_gpes (ACPI_NOT_ISR); + status = acpi_hw_enable_all_runtime_gpes (); if (ACPI_FAILURE (status)) { return_ACPI_STATUS (status); } diff --git a/drivers/acpi/namespace/nsaccess.c b/drivers/acpi/namespace/nsaccess.c index ece7a9dedd5..9df0a64ba9e 100644 --- a/drivers/acpi/namespace/nsaccess.c +++ b/drivers/acpi/namespace/nsaccess.c @@ -159,7 +159,7 @@ acpi_ns_root_initialize ( obj_desc->method.param_count = (u8) ACPI_TO_INTEGER (val); obj_desc->common.flags |= AOPOBJ_DATA_VALID; -#if defined (_ACPI_ASL_COMPILER) || defined (_ACPI_DUMP_App) +#if defined (ACPI_ASL_COMPILER) || defined (ACPI_DUMP_App) /* * i_aSL Compiler cheats by putting parameter count diff --git a/drivers/acpi/namespace/nsalloc.c b/drivers/acpi/namespace/nsalloc.c index 5653a19d717..3f94b0806ec 100644 --- a/drivers/acpi/namespace/nsalloc.c +++ b/drivers/acpi/namespace/nsalloc.c @@ -83,7 +83,7 @@ acpi_ns_create_node ( return_PTR (NULL); } - ACPI_MEM_TRACKING (acpi_gbl_memory_lists[ACPI_MEM_LIST_NSNODE].total_allocated++); + ACPI_MEM_TRACKING (acpi_gbl_ns_node_list->total_allocated++); node->name.integer = name; node->reference_count = 1; @@ -151,7 +151,7 @@ acpi_ns_delete_node ( } } - ACPI_MEM_TRACKING (acpi_gbl_memory_lists[ACPI_MEM_LIST_NSNODE].total_freed++); + ACPI_MEM_TRACKING (acpi_gbl_ns_node_list->total_freed++); /* * Detach an object if there is one then delete the node @@ -362,7 +362,7 @@ acpi_ns_delete_children ( /* Now we can free this child object */ - ACPI_MEM_TRACKING (acpi_gbl_memory_lists[ACPI_MEM_LIST_NSNODE].total_freed++); + ACPI_MEM_TRACKING (acpi_gbl_ns_node_list->total_freed++); ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Object %p, Remaining %X\n", child_node, acpi_gbl_current_node_count)); diff --git a/drivers/acpi/namespace/nsdump.c b/drivers/acpi/namespace/nsdump.c index 05af95322a6..c9f35dd7a43 100644 --- a/drivers/acpi/namespace/nsdump.c +++ b/drivers/acpi/namespace/nsdump.c @@ -208,33 +208,37 @@ acpi_ns_dump_one_object ( return (AE_OK); } - /* Indent the object according to the level */ + if (!(info->display_type & ACPI_DISPLAY_SHORT)) { + /* Indent the object according to the level */ - acpi_os_printf ("%2d%*s", (u32) level - 1, (int) level * 2, " "); + acpi_os_printf ("%2d%*s", (u32) level - 1, (int) level * 2, " "); - /* Check the node type and name */ + /* Check the node type and name */ - if (type > ACPI_TYPE_LOCAL_MAX) { - ACPI_REPORT_WARNING (("Invalid ACPI Type %08X\n", type)); - } + if (type > ACPI_TYPE_LOCAL_MAX) { + ACPI_REPORT_WARNING (("Invalid ACPI Type %08X\n", type)); + } + + if (!acpi_ut_valid_acpi_name (this_node->name.integer)) { + ACPI_REPORT_WARNING (("Invalid ACPI Name %08X\n", + this_node->name.integer)); + } - if (!acpi_ut_valid_acpi_name (this_node->name.integer)) { - ACPI_REPORT_WARNING (("Invalid ACPI Name %08X\n", - this_node->name.integer)); + acpi_os_printf ("%4.4s", acpi_ut_get_node_name (this_node)); } /* * Now we can print out the pertinent information */ - acpi_os_printf ("%4.4s %-12s %p ", - acpi_ut_get_node_name (this_node), acpi_ut_get_type_name (type), this_node); + acpi_os_printf (" %-12s %p ", + acpi_ut_get_type_name (type), this_node); dbg_level = acpi_dbg_level; acpi_dbg_level = 0; obj_desc = acpi_ns_get_attached_object (this_node); acpi_dbg_level = dbg_level; - switch (info->display_type) { + switch (info->display_type & ACPI_DISPLAY_MASK) { case ACPI_DISPLAY_SUMMARY: if (!obj_desc) { @@ -646,7 +650,7 @@ acpi_ns_dump_entry ( } -#ifdef _ACPI_ASL_COMPILER +#ifdef ACPI_ASL_COMPILER /******************************************************************************* * * FUNCTION: acpi_ns_dump_tables diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index bdd9f37f810..56e7cedba91 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c @@ -778,54 +778,6 @@ acpi_os_delete_lock ( return_VOID; } -/* - * Acquire a spinlock. - * - * handle is a pointer to the spinlock_t. - * flags is *not* the result of save_flags - it is an ACPI-specific flag variable - * that indicates whether we are at interrupt level. - */ -void -acpi_os_acquire_lock ( - acpi_handle handle, - u32 flags) -{ - ACPI_FUNCTION_TRACE ("os_acquire_lock"); - - ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Acquiring spinlock[%p] from %s level\n", handle, - ((flags & ACPI_NOT_ISR) ? "non-interrupt" : "interrupt"))); - - if (flags & ACPI_NOT_ISR) - ACPI_DISABLE_IRQS(); - - spin_lock((spinlock_t *)handle); - - return_VOID; -} - - -/* - * Release a spinlock. See above. - */ -void -acpi_os_release_lock ( - acpi_handle handle, - u32 flags) -{ - ACPI_FUNCTION_TRACE ("os_release_lock"); - - ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Releasing spinlock[%p] from %s level\n", handle, - ((flags & ACPI_NOT_ISR) ? "non-interrupt" : "interrupt"))); - - spin_unlock((spinlock_t *)handle); - - if (flags & ACPI_NOT_ISR) - ACPI_ENABLE_IRQS(); - - return_VOID; -} - - acpi_status acpi_os_create_semaphore( u32 max_units, @@ -1172,3 +1124,151 @@ unsigned int max_cstate = ACPI_PROCESSOR_MAX_POWER; EXPORT_SYMBOL(max_cstate); + +/* + * Acquire a spinlock. + * + * handle is a pointer to the spinlock_t. + * flags is *not* the result of save_flags - it is an ACPI-specific flag variable + * that indicates whether we are at interrupt level. + */ + +unsigned long +acpi_os_acquire_lock ( + acpi_handle handle) +{ + unsigned long flags; + spin_lock_irqsave((spinlock_t *)handle, flags); + return flags; +} + +/* + * Release a spinlock. See above. + */ + +void +acpi_os_release_lock ( + acpi_handle handle, + unsigned long flags) +{ + spin_unlock_irqrestore((spinlock_t *)handle, flags); +} + + +#ifndef ACPI_USE_LOCAL_CACHE + +/******************************************************************************* + * + * FUNCTION: acpi_os_create_cache + * + * PARAMETERS: CacheName - Ascii name for the cache + * ObjectSize - Size of each cached object + * MaxDepth - Maximum depth of the cache (in objects) + * ReturnCache - Where the new cache object is returned + * + * RETURN: Status + * + * DESCRIPTION: Create a cache object + * + ******************************************************************************/ + +acpi_status +acpi_os_create_cache ( + char *name, + u16 size, + u16 depth, + acpi_cache_t **cache) +{ + *cache = kmem_cache_create (name, size, 0, 0, NULL, NULL); + return AE_OK; +} + +/******************************************************************************* + * + * FUNCTION: acpi_os_purge_cache + * + * PARAMETERS: Cache - Handle to cache object + * + * RETURN: Status + * + * DESCRIPTION: Free all objects within the requested cache. + * + ******************************************************************************/ + +acpi_status +acpi_os_purge_cache ( + acpi_cache_t *cache) +{ + (void) kmem_cache_shrink(cache); + return (AE_OK); +} + +/******************************************************************************* + * + * FUNCTION: acpi_os_delete_cache + * + * PARAMETERS: Cache - Handle to cache object + * + * RETURN: Status + * + * DESCRIPTION: Free all objects within the requested cache and delete the + * cache object. + * + ******************************************************************************/ + +acpi_status +acpi_os_delete_cache ( + acpi_cache_t *cache) +{ + (void)kmem_cache_destroy(cache); + return (AE_OK); +} + +/******************************************************************************* + * + * FUNCTION: acpi_os_release_object + * + * PARAMETERS: Cache - Handle to cache object + * Object - The object to be released + * + * RETURN: None + * + * DESCRIPTION: Release an object to the specified cache. If cache is full, + * the object is deleted. + * + ******************************************************************************/ + +acpi_status +acpi_os_release_object ( + acpi_cache_t *cache, + void *object) +{ + kmem_cache_free(cache, object); + return (AE_OK); +} + +/******************************************************************************* + * + * FUNCTION: acpi_os_acquire_object + * + * PARAMETERS: Cache - Handle to cache object + * ReturnObject - Where the object is returned + * + * RETURN: Status + * + * DESCRIPTION: Get an object from the specified cache. If cache is empty, + * the object is allocated. + * + ******************************************************************************/ + +void * +acpi_os_acquire_object ( + acpi_cache_t *cache) +{ + void *object = kmem_cache_alloc(cache, GFP_KERNEL); + WARN_ON(!object); + return object; +} + +#endif + diff --git a/drivers/acpi/parser/Makefile b/drivers/acpi/parser/Makefile index bbdd286c660..db24ee09cf1 100644 --- a/drivers/acpi/parser/Makefile +++ b/drivers/acpi/parser/Makefile @@ -2,7 +2,7 @@ # Makefile for all Linux ACPI interpreter subdirectories # -obj-y := psargs.o psparse.o pstree.o pswalk.o \ +obj-y := psargs.o psparse.o psloop.o pstree.o pswalk.o \ psopcode.o psscope.o psutils.o psxface.o EXTRA_CFLAGS += $(ACPI_CFLAGS) diff --git a/drivers/acpi/parser/psloop.c b/drivers/acpi/parser/psloop.c new file mode 100644 index 00000000000..decb2e9a049 --- /dev/null +++ b/drivers/acpi/parser/psloop.c @@ -0,0 +1,775 @@ +/****************************************************************************** + * + * Module Name: psloop - Main AML parse loop + * + *****************************************************************************/ + +/* + * Copyright (C) 2000 - 2005, R. Byron Moore + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer, + * without modification. + * 2. Redistributions in binary form must reproduce at minimum a disclaimer + * substantially similar to the "NO WARRANTY" disclaimer below + * ("Disclaimer") and any redistribution must be conditioned upon + * including a substantially similar Disclaimer requirement for further + * binary redistribution. + * 3. Neither the names of the above-listed copyright holders nor the names + * of any contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * Alternatively, this software may be distributed under the terms of the + * GNU General Public License ("GPL") version 2 as published by the Free + * Software Foundation. + * + * NO WARRANTY + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGES. + */ + + +/* + * Parse the AML and build an operation tree as most interpreters, + * like Perl, do. Parsing is done by hand rather than with a YACC + * generated parser to tightly constrain stack and dynamic memory + * usage. At the same time, parsing is kept flexible and the code + * fairly compact by parsing based on a list of AML opcode + * templates in aml_op_info[] + */ + +#include +#include +#include +#include +#include +#include + +#define _COMPONENT ACPI_PARSER + ACPI_MODULE_NAME ("psloop") + +static u32 acpi_gbl_depth = 0; + + +/******************************************************************************* + * + * FUNCTION: acpi_ps_parse_loop + * + * PARAMETERS: walk_state - Current state + * + * RETURN: Status + * + * DESCRIPTION: Parse AML (pointed to by the current parser state) and return + * a tree of ops. + * + ******************************************************************************/ + +acpi_status +acpi_ps_parse_loop ( + struct acpi_walk_state *walk_state) +{ + acpi_status status = AE_OK; + acpi_status status2; + union acpi_parse_object *op = NULL; /* current op */ + union acpi_parse_object *arg = NULL; + union acpi_parse_object *pre_op = NULL; + struct acpi_parse_state *parser_state; + u8 *aml_op_start = NULL; + + + ACPI_FUNCTION_TRACE_PTR ("ps_parse_loop", walk_state); + + if (walk_state->descending_callback == NULL) { + return_ACPI_STATUS (AE_BAD_PARAMETER); + } + + parser_state = &walk_state->parser_state; + walk_state->arg_types = 0; + +#if (!defined (ACPI_NO_METHOD_EXECUTION) && !defined (ACPI_CONSTANT_EVAL_ONLY)) + + if (walk_state->walk_type & ACPI_WALK_METHOD_RESTART) { + /* We are restarting a preempted control method */ + + if (acpi_ps_has_completed_scope (parser_state)) { + /* + * We must check if a predicate to an IF or WHILE statement + * was just completed + */ + if ((parser_state->scope->parse_scope.op) && + ((parser_state->scope->parse_scope.op->common.aml_opcode == AML_IF_OP) || + (parser_state->scope->parse_scope.op->common.aml_opcode == AML_WHILE_OP)) && + (walk_state->control_state) && + (walk_state->control_state->common.state == + ACPI_CONTROL_PREDICATE_EXECUTING)) { + /* + * A predicate was just completed, get the value of the + * predicate and branch based on that value + */ + walk_state->op = NULL; + status = acpi_ds_get_predicate_value (walk_state, ACPI_TO_POINTER (TRUE)); + if (ACPI_FAILURE (status) && + ((status & AE_CODE_MASK) != AE_CODE_CONTROL)) { + if (status == AE_AML_NO_RETURN_VALUE) { + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, + "Invoked method did not return a value, %s\n", + acpi_format_exception (status))); + + } + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, + "get_predicate Failed, %s\n", + acpi_format_exception (status))); + return_ACPI_STATUS (status); + } + + status = acpi_ps_next_parse_state (walk_state, op, status); + } + + acpi_ps_pop_scope (parser_state, &op, + &walk_state->arg_types, &walk_state->arg_count); + ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Popped scope, Op=%p\n", op)); + } + else if (walk_state->prev_op) { + /* We were in the middle of an op */ + + op = walk_state->prev_op; + walk_state->arg_types = walk_state->prev_arg_types; + } + } +#endif + + /* Iterative parsing loop, while there is more AML to process: */ + + while ((parser_state->aml < parser_state->aml_end) || (op)) { + aml_op_start = parser_state->aml; + if (!op) { + /* Get the next opcode from the AML stream */ + + walk_state->aml_offset = (u32) ACPI_PTR_DIFF (parser_state->aml, + parser_state->aml_start); + walk_state->opcode = acpi_ps_peek_opcode (parser_state); + + /* + * First cut to determine what we have found: + * 1) A valid AML opcode + * 2) A name string + * 3) An unknown/invalid opcode + */ + walk_state->op_info = acpi_ps_get_opcode_info (walk_state->opcode); + switch (walk_state->op_info->class) { + case AML_CLASS_ASCII: + case AML_CLASS_PREFIX: + /* + * Starts with a valid prefix or ASCII char, this is a name + * string. Convert the bare name string to a namepath. + */ + walk_state->opcode = AML_INT_NAMEPATH_OP; + walk_state->arg_types = ARGP_NAMESTRING; + break; + + case AML_CLASS_UNKNOWN: + + /* The opcode is unrecognized. Just skip unknown opcodes */ + + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, + "Found unknown opcode %X at AML address %p offset %X, ignoring\n", + walk_state->opcode, parser_state->aml, walk_state->aml_offset)); + + ACPI_DUMP_BUFFER (parser_state->aml, 128); + + /* Assume one-byte bad opcode */ + + parser_state->aml++; + continue; + + default: + + /* Found opcode info, this is a normal opcode */ + + parser_state->aml += acpi_ps_get_opcode_size (walk_state->opcode); + walk_state->arg_types = walk_state->op_info->parse_args; + break; + } + + /* Create Op structure and append to parent's argument list */ + + if (walk_state->op_info->flags & AML_NAMED) { + /* Allocate a new pre_op if necessary */ + + if (!pre_op) { + pre_op = acpi_ps_alloc_op (walk_state->opcode); + if (!pre_op) { + status = AE_NO_MEMORY; + goto close_this_op; + } + } + + pre_op->common.value.arg = NULL; + pre_op->common.aml_opcode = walk_state->opcode; + + /* + * Get and append arguments until we find the node that contains + * the name (the type ARGP_NAME). + */ + while (GET_CURRENT_ARG_TYPE (walk_state->arg_types) && + (GET_CURRENT_ARG_TYPE (walk_state->arg_types) != ARGP_NAME)) { + status = acpi_ps_get_next_arg (walk_state, parser_state, + GET_CURRENT_ARG_TYPE (walk_state->arg_types), &arg); + if (ACPI_FAILURE (status)) { + goto close_this_op; + } + + acpi_ps_append_arg (pre_op, arg); + INCREMENT_ARG_LIST (walk_state->arg_types); + } + + /* + * Make sure that we found a NAME and didn't run out of + * arguments + */ + if (!GET_CURRENT_ARG_TYPE (walk_state->arg_types)) { + status = AE_AML_NO_OPERAND; + goto close_this_op; + } + + /* We know that this arg is a name, move to next arg */ + + INCREMENT_ARG_LIST (walk_state->arg_types); + + /* + * Find the object. This will either insert the object into + * the namespace or simply look it up + */ + walk_state->op = NULL; + + status = walk_state->descending_callback (walk_state, &op); + if (ACPI_FAILURE (status)) { + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, + "During name lookup/catalog, %s\n", + acpi_format_exception (status))); + goto close_this_op; + } + + if (!op) { + continue; + } + + status = acpi_ps_next_parse_state (walk_state, op, status); + if (status == AE_CTRL_PENDING) { + status = AE_OK; + goto close_this_op; + } + + if (ACPI_FAILURE (status)) { + goto close_this_op; + } + + acpi_ps_append_arg (op, pre_op->common.value.arg); + acpi_gbl_depth++; + + if (op->common.aml_opcode == AML_REGION_OP) { + /* + * Defer final parsing of an operation_region body, + * because we don't have enough info in the first pass + * to parse it correctly (i.e., there may be method + * calls within the term_arg elements of the body.) + * + * However, we must continue parsing because + * the opregion is not a standalone package -- + * we don't know where the end is at this point. + * + * (Length is unknown until parse of the body complete) + */ + op->named.data = aml_op_start; + op->named.length = 0; + } + } + else { + /* Not a named opcode, just allocate Op and append to parent */ + + walk_state->op_info = acpi_ps_get_opcode_info (walk_state->opcode); + op = acpi_ps_alloc_op (walk_state->opcode); + if (!op) { + status = AE_NO_MEMORY; + goto close_this_op; + } + + if (walk_state->op_info->flags & AML_CREATE) { + /* + * Backup to beginning of create_xXXfield declaration + * body_length is unknown until we parse the body + */ + op->named.data = aml_op_start; + op->named.length = 0; + } + + acpi_ps_append_arg (acpi_ps_get_parent_scope (parser_state), op); + + if ((walk_state->descending_callback != NULL)) { + /* + * Find the object. This will either insert the object into + * the namespace or simply look it up + */ + walk_state->op = op; + + status = walk_state->descending_callback (walk_state, &op); + status = acpi_ps_next_parse_state (walk_state, op, status); + if (status == AE_CTRL_PENDING) { + status = AE_OK; + goto close_this_op; + } + + if (ACPI_FAILURE (status)) { + goto close_this_op; + } + } + } + + op->common.aml_offset = walk_state->aml_offset; + + if (walk_state->op_info) { + ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, + "Opcode %4.4X [%s] Op %p Aml %p aml_offset %5.5X\n", + (u32) op->common.aml_opcode, walk_state->op_info->name, + op, parser_state->aml, op->common.aml_offset)); + } + } + + + /* + * Start arg_count at zero because we don't know if there are + * any args yet + */ + walk_state->arg_count = 0; + + /* Are there any arguments that must be processed? */ + + if (walk_state->arg_types) { + /* Get arguments */ + + switch (op->common.aml_opcode) { + case AML_BYTE_OP: /* AML_BYTEDATA_ARG */ + case AML_WORD_OP: /* AML_WORDDATA_ARG */ + case AML_DWORD_OP: /* AML_DWORDATA_ARG */ + case AML_QWORD_OP: /* AML_QWORDATA_ARG */ + case AML_STRING_OP: /* AML_ASCIICHARLIST_ARG */ + + /* Fill in constant or string argument directly */ + + acpi_ps_get_next_simple_arg (parser_state, + GET_CURRENT_ARG_TYPE (walk_state->arg_types), op); + break; + + case AML_INT_NAMEPATH_OP: /* AML_NAMESTRING_ARG */ + + status = acpi_ps_get_next_namepath (walk_state, parser_state, op, 1); + if (ACPI_FAILURE (status)) { + goto close_this_op; + } + + walk_state->arg_types = 0; + break; + + default: + /* + * Op is not a constant or string, append each argument + * to the Op + */ + while (GET_CURRENT_ARG_TYPE (walk_state->arg_types) && + !walk_state->arg_count) { + walk_state->aml_offset = (u32) + ACPI_PTR_DIFF (parser_state->aml, parser_state->aml_start); + + status = acpi_ps_get_next_arg (walk_state, parser_state, + GET_CURRENT_ARG_TYPE (walk_state->arg_types), + &arg); + if (ACPI_FAILURE (status)) { + goto close_this_op; + } + + if (arg) { + arg->common.aml_offset = walk_state->aml_offset; + acpi_ps_append_arg (op, arg); + } + INCREMENT_ARG_LIST (walk_state->arg_types); + } + + /* Special processing for certain opcodes */ + + if ((walk_state->pass_number <= ACPI_IMODE_LOAD_PASS1) && + ((walk_state->parse_flags & ACPI_PARSE_DISASSEMBLE) == 0)) { + /* + * We want to skip If/Else/While constructs during Pass1 + * because we want to actually conditionally execute the + * code during Pass2. + * + * Except for disassembly, where we always want to + * walk the If/Else/While packages + */ + switch (op->common.aml_opcode) { + case AML_IF_OP: + case AML_ELSE_OP: + case AML_WHILE_OP: + + /* Skip body of if/else/while in pass 1 */ + + parser_state->aml = parser_state->pkg_end; + walk_state->arg_count = 0; + break; + + default: + break; + } + } + + switch (op->common.aml_opcode) { + case AML_METHOD_OP: + + /* + * Skip parsing of control method + * because we don't have enough info in the first pass + * to parse it correctly. + * + * Save the length and address of the body + */ + op->named.data = parser_state->aml; + op->named.length = (u32) (parser_state->pkg_end - + parser_state->aml); + + /* Skip body of method */ + + parser_state->aml = parser_state->pkg_end; + walk_state->arg_count = 0; + break; + + case AML_BUFFER_OP: + case AML_PACKAGE_OP: + case AML_VAR_PACKAGE_OP: + + if ((op->common.parent) && + (op->common.parent->common.aml_opcode == AML_NAME_OP) && + (walk_state->pass_number <= ACPI_IMODE_LOAD_PASS2)) { + /* + * Skip parsing of Buffers and Packages + * because we don't have enough info in the first pass + * to parse them correctly. + */ + op->named.data = aml_op_start; + op->named.length = (u32) (parser_state->pkg_end - + aml_op_start); + + /* Skip body */ + + parser_state->aml = parser_state->pkg_end; + walk_state->arg_count = 0; + } + break; + + case AML_WHILE_OP: + + if (walk_state->control_state) { + walk_state->control_state->control.package_end = + parser_state->pkg_end; + } + break; + + default: + + /* No action for all other opcodes */ + break; + } + break; + } + } + + /* Check for arguments that need to be processed */ + + if (walk_state->arg_count) { + /* + * There are arguments (complex ones), push Op and + * prepare for argument + */ + status = acpi_ps_push_scope (parser_state, op, + walk_state->arg_types, walk_state->arg_count); + if (ACPI_FAILURE (status)) { + goto close_this_op; + } + op = NULL; + continue; + } + + /* + * All arguments have been processed -- Op is complete, + * prepare for next + */ + walk_state->op_info = acpi_ps_get_opcode_info (op->common.aml_opcode); + if (walk_state->op_info->flags & AML_NAMED) { + if (acpi_gbl_depth) { + acpi_gbl_depth--; + } + + if (op->common.aml_opcode == AML_REGION_OP) { + /* + * Skip parsing of control method or opregion body, + * because we don't have enough info in the first pass + * to parse them correctly. + * + * Completed parsing an op_region declaration, we now + * know the length. + */ + op->named.length = (u32) (parser_state->aml - op->named.data); + } + } + + if (walk_state->op_info->flags & AML_CREATE) { + /* + * Backup to beginning of create_xXXfield declaration (1 for + * Opcode) + * + * body_length is unknown until we parse the body + */ + op->named.length = (u32) (parser_state->aml - op->named.data); + } + + /* This op complete, notify the dispatcher */ + + if (walk_state->ascending_callback != NULL) { + walk_state->op = op; + walk_state->opcode = op->common.aml_opcode; + + status = walk_state->ascending_callback (walk_state); + status = acpi_ps_next_parse_state (walk_state, op, status); + if (status == AE_CTRL_PENDING) { + status = AE_OK; + goto close_this_op; + } + } + + +close_this_op: + /* + * Finished one argument of the containing scope + */ + parser_state->scope->parse_scope.arg_count--; + + /* Finished with pre_op */ + + if (pre_op) { + acpi_ps_free_op (pre_op); + pre_op = NULL; + } + + /* Close this Op (will result in parse subtree deletion) */ + + status2 = acpi_ps_complete_this_op (walk_state, op); + if (ACPI_FAILURE (status2)) { + return_ACPI_STATUS (status2); + } + op = NULL; + + switch (status) { + case AE_OK: + break; + + + case AE_CTRL_TRANSFER: + + /* We are about to transfer to a called method. */ + + walk_state->prev_op = op; + walk_state->prev_arg_types = walk_state->arg_types; + return_ACPI_STATUS (status); + + + case AE_CTRL_END: + + acpi_ps_pop_scope (parser_state, &op, + &walk_state->arg_types, &walk_state->arg_count); + + if (op) { + walk_state->op = op; + walk_state->op_info = acpi_ps_get_opcode_info (op->common.aml_opcode); + walk_state->opcode = op->common.aml_opcode; + + status = walk_state->ascending_callback (walk_state); + status = acpi_ps_next_parse_state (walk_state, op, status); + + status2 = acpi_ps_complete_this_op (walk_state, op); + if (ACPI_FAILURE (status2)) { + return_ACPI_STATUS (status2); + } + op = NULL; + } + status = AE_OK; + break; + + + case AE_CTRL_BREAK: + case AE_CTRL_CONTINUE: + + /* Pop off scopes until we find the While */ + + while (!op || (op->common.aml_opcode != AML_WHILE_OP)) { + acpi_ps_pop_scope (parser_state, &op, + &walk_state->arg_types, &walk_state->arg_count); + } + + /* Close this iteration of the While loop */ + + walk_state->op = op; + walk_state->op_info = acpi_ps_get_opcode_info (op->common.aml_opcode); + walk_state->opcode = op->common.aml_opcode; + + status = walk_state->ascending_callback (walk_state); + status = acpi_ps_next_parse_state (walk_state, op, status); + + status2 = acpi_ps_complete_this_op (walk_state, op); + if (ACPI_FAILURE (status2)) { + return_ACPI_STATUS (status2); + } + op = NULL; + + status = AE_OK; + break; + + + case AE_CTRL_TERMINATE: + + status = AE_OK; + + /* Clean up */ + do { + if (op) { + status2 = acpi_ps_complete_this_op (walk_state, op); + if (ACPI_FAILURE (status2)) { + return_ACPI_STATUS (status2); + } + } + acpi_ps_pop_scope (parser_state, &op, + &walk_state->arg_types, &walk_state->arg_count); + + } while (op); + + return_ACPI_STATUS (status); + + + default: /* All other non-AE_OK status */ + + do { + if (op) { + status2 = acpi_ps_complete_this_op (walk_state, op); + if (ACPI_FAILURE (status2)) { + return_ACPI_STATUS (status2); + } + } + acpi_ps_pop_scope (parser_state, &op, + &walk_state->arg_types, &walk_state->arg_count); + + } while (op); + + + /* + * TBD: Cleanup parse ops on error + */ +#if 0 + if (op == NULL) { + acpi_ps_pop_scope (parser_state, &op, + &walk_state->arg_types, &walk_state->arg_count); + } +#endif + walk_state->prev_op = op; + walk_state->prev_arg_types = walk_state->arg_types; + return_ACPI_STATUS (status); + } + + /* This scope complete? */ + + if (acpi_ps_has_completed_scope (parser_state)) { + acpi_ps_pop_scope (parser_state, &op, + &walk_state->arg_types, &walk_state->arg_count); + ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Popped scope, Op=%p\n", op)); + } + else { + op = NULL; + } + + } /* while parser_state->Aml */ + + + /* + * Complete the last Op (if not completed), and clear the scope stack. + * It is easily possible to end an AML "package" with an unbounded number + * of open scopes (such as when several ASL blocks are closed with + * sequential closing braces). We want to terminate each one cleanly. + */ + ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "AML package complete at Op %p\n", op)); + do { + if (op) { + if (walk_state->ascending_callback != NULL) { + walk_state->op = op; + walk_state->op_info = acpi_ps_get_opcode_info (op->common.aml_opcode); + walk_state->opcode = op->common.aml_opcode; + + status = walk_state->ascending_callback (walk_state); + status = acpi_ps_next_parse_state (walk_state, op, status); + if (status == AE_CTRL_PENDING) { + status = AE_OK; + goto close_this_op; + } + + if (status == AE_CTRL_TERMINATE) { + status = AE_OK; + + /* Clean up */ + do { + if (op) { + status2 = acpi_ps_complete_this_op (walk_state, op); + if (ACPI_FAILURE (status2)) { + return_ACPI_STATUS (status2); + } + } + + acpi_ps_pop_scope (parser_state, &op, + &walk_state->arg_types, &walk_state->arg_count); + + } while (op); + + return_ACPI_STATUS (status); + } + + else if (ACPI_FAILURE (status)) { + /* First error is most important */ + + (void) acpi_ps_complete_this_op (walk_state, op); + return_ACPI_STATUS (status); + } + } + + status2 = acpi_ps_complete_this_op (walk_state, op); + if (ACPI_FAILURE (status2)) { + return_ACPI_STATUS (status2); + } + } + + acpi_ps_pop_scope (parser_state, &op, &walk_state->arg_types, + &walk_state->arg_count); + + } while (op); + + return_ACPI_STATUS (status); +} + + diff --git a/drivers/acpi/parser/psopcode.c b/drivers/acpi/parser/psopcode.c index 95ef5e8947a..6f7594a516d 100644 --- a/drivers/acpi/parser/psopcode.c +++ b/drivers/acpi/parser/psopcode.c @@ -428,33 +428,23 @@ acpi_ps_get_opcode_info ( /* * Detect normal 8-bit opcode or extended 16-bit opcode */ - switch ((u8) (opcode >> 8)) { - case 0: - + if (!(opcode & 0xFF00)) { /* Simple (8-bit) opcode: 0-255, can't index beyond table */ return (&acpi_gbl_aml_op_info [acpi_gbl_short_op_index [(u8) opcode]]); + } - case AML_EXTOP: - - /* Extended (16-bit, prefix+opcode) opcode */ - - if (((u8) opcode) <= MAX_EXTENDED_OPCODE) { - return (&acpi_gbl_aml_op_info [acpi_gbl_long_op_index [(u8) opcode]]); - } - - /* Else fall through to error case below */ - /*lint -fallthrough */ - - default: + if (((opcode & 0xFF00) == AML_EXTENDED_OPCODE) && + (((u8) opcode) <= MAX_EXTENDED_OPCODE)) { + /* Valid extended (16-bit) opcode */ - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Unknown AML opcode [%4.4X]\n", opcode)); - break; + return (&acpi_gbl_aml_op_info [acpi_gbl_long_op_index [(u8) opcode]]); } + /* Unknown AML opcode */ - /* Default is "unknown opcode" */ + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, + "Unknown AML opcode [%4.4X]\n", opcode)); return (&acpi_gbl_aml_op_info [_UNK]); } diff --git a/drivers/acpi/parser/psparse.c b/drivers/acpi/parser/psparse.c index bdbe0d99486..16b84a3d043 100644 --- a/drivers/acpi/parser/psparse.c +++ b/drivers/acpi/parser/psparse.c @@ -62,26 +62,6 @@ ACPI_MODULE_NAME ("psparse") -static u32 acpi_gbl_depth = 0; - -/* Local prototypes */ - -static acpi_status -acpi_ps_complete_this_op ( - struct acpi_walk_state *walk_state, - union acpi_parse_object *op); - -static acpi_status -acpi_ps_next_parse_state ( - struct acpi_walk_state *walk_state, - union acpi_parse_object *op, - acpi_status callback_status); - -static acpi_status -acpi_ps_parse_loop ( - struct acpi_walk_state *walk_state); - - /******************************************************************************* * * FUNCTION: acpi_ps_get_opcode_size @@ -134,8 +114,8 @@ acpi_ps_peek_opcode ( aml = parser_state->aml; opcode = (u16) ACPI_GET8 (aml); - if (opcode == AML_EXTOP) { - /* Extended opcode */ + if (opcode == AML_EXTENDED_OP_PREFIX) { + /* Extended opcode, get the second opcode byte */ aml++; opcode = (u16) ((opcode << 8) | ACPI_GET8 (aml)); @@ -158,7 +138,7 @@ acpi_ps_peek_opcode ( * ******************************************************************************/ -static acpi_status +acpi_status acpi_ps_complete_this_op ( struct acpi_walk_state *walk_state, union acpi_parse_object *op) @@ -331,7 +311,7 @@ allocate_error: * ******************************************************************************/ -static acpi_status +acpi_status acpi_ps_next_parse_state ( struct acpi_walk_state *walk_state, union acpi_parse_object *op, @@ -439,706 +419,6 @@ acpi_ps_next_parse_state ( } -/******************************************************************************* - * - * FUNCTION: acpi_ps_parse_loop - * - * PARAMETERS: walk_state - Current state - * - * RETURN: Status - * - * DESCRIPTION: Parse AML (pointed to by the current parser state) and return - * a tree of ops. - * - ******************************************************************************/ - -static acpi_status -acpi_ps_parse_loop ( - struct acpi_walk_state *walk_state) -{ - acpi_status status = AE_OK; - acpi_status status2; - union acpi_parse_object *op = NULL; /* current op */ - union acpi_parse_object *arg = NULL; - union acpi_parse_object *pre_op = NULL; - struct acpi_parse_state *parser_state; - u8 *aml_op_start = NULL; - - - ACPI_FUNCTION_TRACE_PTR ("ps_parse_loop", walk_state); - - if (walk_state->descending_callback == NULL) { - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - - parser_state = &walk_state->parser_state; - walk_state->arg_types = 0; - -#if (!defined (ACPI_NO_METHOD_EXECUTION) && !defined (ACPI_CONSTANT_EVAL_ONLY)) - - if (walk_state->walk_type & ACPI_WALK_METHOD_RESTART) { - /* We are restarting a preempted control method */ - - if (acpi_ps_has_completed_scope (parser_state)) { - /* - * We must check if a predicate to an IF or WHILE statement - * was just completed - */ - if ((parser_state->scope->parse_scope.op) && - ((parser_state->scope->parse_scope.op->common.aml_opcode == AML_IF_OP) || - (parser_state->scope->parse_scope.op->common.aml_opcode == AML_WHILE_OP)) && - (walk_state->control_state) && - (walk_state->control_state->common.state == - ACPI_CONTROL_PREDICATE_EXECUTING)) { - /* - * A predicate was just completed, get the value of the - * predicate and branch based on that value - */ - walk_state->op = NULL; - status = acpi_ds_get_predicate_value (walk_state, ACPI_TO_POINTER (TRUE)); - if (ACPI_FAILURE (status) && - ((status & AE_CODE_MASK) != AE_CODE_CONTROL)) { - if (status == AE_AML_NO_RETURN_VALUE) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Invoked method did not return a value, %s\n", - acpi_format_exception (status))); - - } - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "get_predicate Failed, %s\n", - acpi_format_exception (status))); - return_ACPI_STATUS (status); - } - - status = acpi_ps_next_parse_state (walk_state, op, status); - } - - acpi_ps_pop_scope (parser_state, &op, - &walk_state->arg_types, &walk_state->arg_count); - ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Popped scope, Op=%p\n", op)); - } - else if (walk_state->prev_op) { - /* We were in the middle of an op */ - - op = walk_state->prev_op; - walk_state->arg_types = walk_state->prev_arg_types; - } - } -#endif - - /* Iterative parsing loop, while there is more AML to process: */ - - while ((parser_state->aml < parser_state->aml_end) || (op)) { - aml_op_start = parser_state->aml; - if (!op) { - /* Get the next opcode from the AML stream */ - - walk_state->aml_offset = (u32) ACPI_PTR_DIFF (parser_state->aml, - parser_state->aml_start); - walk_state->opcode = acpi_ps_peek_opcode (parser_state); - - /* - * First cut to determine what we have found: - * 1) A valid AML opcode - * 2) A name string - * 3) An unknown/invalid opcode - */ - walk_state->op_info = acpi_ps_get_opcode_info (walk_state->opcode); - switch (walk_state->op_info->class) { - case AML_CLASS_ASCII: - case AML_CLASS_PREFIX: - /* - * Starts with a valid prefix or ASCII char, this is a name - * string. Convert the bare name string to a namepath. - */ - walk_state->opcode = AML_INT_NAMEPATH_OP; - walk_state->arg_types = ARGP_NAMESTRING; - break; - - case AML_CLASS_UNKNOWN: - - /* The opcode is unrecognized. Just skip unknown opcodes */ - - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Found unknown opcode %X at AML address %p offset %X, ignoring\n", - walk_state->opcode, parser_state->aml, walk_state->aml_offset)); - - ACPI_DUMP_BUFFER (parser_state->aml, 128); - - /* Assume one-byte bad opcode */ - - parser_state->aml++; - continue; - - default: - - /* Found opcode info, this is a normal opcode */ - - parser_state->aml += acpi_ps_get_opcode_size (walk_state->opcode); - walk_state->arg_types = walk_state->op_info->parse_args; - break; - } - - /* Create Op structure and append to parent's argument list */ - - if (walk_state->op_info->flags & AML_NAMED) { - /* Allocate a new pre_op if necessary */ - - if (!pre_op) { - pre_op = acpi_ps_alloc_op (walk_state->opcode); - if (!pre_op) { - status = AE_NO_MEMORY; - goto close_this_op; - } - } - - pre_op->common.value.arg = NULL; - pre_op->common.aml_opcode = walk_state->opcode; - - /* - * Get and append arguments until we find the node that contains - * the name (the type ARGP_NAME). - */ - while (GET_CURRENT_ARG_TYPE (walk_state->arg_types) && - (GET_CURRENT_ARG_TYPE (walk_state->arg_types) != ARGP_NAME)) { - status = acpi_ps_get_next_arg (walk_state, parser_state, - GET_CURRENT_ARG_TYPE (walk_state->arg_types), &arg); - if (ACPI_FAILURE (status)) { - goto close_this_op; - } - - acpi_ps_append_arg (pre_op, arg); - INCREMENT_ARG_LIST (walk_state->arg_types); - } - - /* - * Make sure that we found a NAME and didn't run out of - * arguments - */ - if (!GET_CURRENT_ARG_TYPE (walk_state->arg_types)) { - status = AE_AML_NO_OPERAND; - goto close_this_op; - } - - /* We know that this arg is a name, move to next arg */ - - INCREMENT_ARG_LIST (walk_state->arg_types); - - /* - * Find the object. This will either insert the object into - * the namespace or simply look it up - */ - walk_state->op = NULL; - - status = walk_state->descending_callback (walk_state, &op); - if (ACPI_FAILURE (status)) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "During name lookup/catalog, %s\n", - acpi_format_exception (status))); - goto close_this_op; - } - - if (!op) { - continue; - } - - status = acpi_ps_next_parse_state (walk_state, op, status); - if (status == AE_CTRL_PENDING) { - status = AE_OK; - goto close_this_op; - } - - if (ACPI_FAILURE (status)) { - goto close_this_op; - } - - acpi_ps_append_arg (op, pre_op->common.value.arg); - acpi_gbl_depth++; - - if (op->common.aml_opcode == AML_REGION_OP) { - /* - * Defer final parsing of an operation_region body, - * because we don't have enough info in the first pass - * to parse it correctly (i.e., there may be method - * calls within the term_arg elements of the body.) - * - * However, we must continue parsing because - * the opregion is not a standalone package -- - * we don't know where the end is at this point. - * - * (Length is unknown until parse of the body complete) - */ - op->named.data = aml_op_start; - op->named.length = 0; - } - } - else { - /* Not a named opcode, just allocate Op and append to parent */ - - walk_state->op_info = acpi_ps_get_opcode_info (walk_state->opcode); - op = acpi_ps_alloc_op (walk_state->opcode); - if (!op) { - status = AE_NO_MEMORY; - goto close_this_op; - } - - if (walk_state->op_info->flags & AML_CREATE) { - /* - * Backup to beginning of create_xXXfield declaration - * body_length is unknown until we parse the body - */ - op->named.data = aml_op_start; - op->named.length = 0; - } - - acpi_ps_append_arg (acpi_ps_get_parent_scope (parser_state), op); - - if ((walk_state->descending_callback != NULL)) { - /* - * Find the object. This will either insert the object into - * the namespace or simply look it up - */ - walk_state->op = op; - - status = walk_state->descending_callback (walk_state, &op); - status = acpi_ps_next_parse_state (walk_state, op, status); - if (status == AE_CTRL_PENDING) { - status = AE_OK; - goto close_this_op; - } - - if (ACPI_FAILURE (status)) { - goto close_this_op; - } - } - } - - op->common.aml_offset = walk_state->aml_offset; - - if (walk_state->op_info) { - ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, - "Opcode %4.4X [%s] Op %p Aml %p aml_offset %5.5X\n", - (u32) op->common.aml_opcode, walk_state->op_info->name, - op, parser_state->aml, op->common.aml_offset)); - } - } - - - /* - * Start arg_count at zero because we don't know if there are - * any args yet - */ - walk_state->arg_count = 0; - - /* Are there any arguments that must be processed? */ - - if (walk_state->arg_types) { - /* Get arguments */ - - switch (op->common.aml_opcode) { - case AML_BYTE_OP: /* AML_BYTEDATA_ARG */ - case AML_WORD_OP: /* AML_WORDDATA_ARG */ - case AML_DWORD_OP: /* AML_DWORDATA_ARG */ - case AML_QWORD_OP: /* AML_QWORDATA_ARG */ - case AML_STRING_OP: /* AML_ASCIICHARLIST_ARG */ - - /* Fill in constant or string argument directly */ - - acpi_ps_get_next_simple_arg (parser_state, - GET_CURRENT_ARG_TYPE (walk_state->arg_types), op); - break; - - case AML_INT_NAMEPATH_OP: /* AML_NAMESTRING_ARG */ - - status = acpi_ps_get_next_namepath (walk_state, parser_state, op, 1); - if (ACPI_FAILURE (status)) { - goto close_this_op; - } - - walk_state->arg_types = 0; - break; - - default: - /* - * Op is not a constant or string, append each argument - * to the Op - */ - while (GET_CURRENT_ARG_TYPE (walk_state->arg_types) && - !walk_state->arg_count) { - walk_state->aml_offset = (u32) - ACPI_PTR_DIFF (parser_state->aml, parser_state->aml_start); - - status = acpi_ps_get_next_arg (walk_state, parser_state, - GET_CURRENT_ARG_TYPE (walk_state->arg_types), - &arg); - if (ACPI_FAILURE (status)) { - goto close_this_op; - } - - if (arg) { - arg->common.aml_offset = walk_state->aml_offset; - acpi_ps_append_arg (op, arg); - } - INCREMENT_ARG_LIST (walk_state->arg_types); - } - - /* Special processing for certain opcodes */ - - if (walk_state->pass_number <= ACPI_IMODE_LOAD_PASS1) { - switch (op->common.aml_opcode) { - case AML_IF_OP: - case AML_ELSE_OP: - case AML_WHILE_OP: - - /* Skip body of if/else/while in pass 1 */ - - parser_state->aml = parser_state->pkg_end; - walk_state->arg_count = 0; - break; - - default: - break; - } - } - - switch (op->common.aml_opcode) { - case AML_METHOD_OP: - - /* - * Skip parsing of control method - * because we don't have enough info in the first pass - * to parse it correctly. - * - * Save the length and address of the body - */ - op->named.data = parser_state->aml; - op->named.length = (u32) (parser_state->pkg_end - - parser_state->aml); - - /* Skip body of method */ - - parser_state->aml = parser_state->pkg_end; - walk_state->arg_count = 0; - break; - - case AML_BUFFER_OP: - case AML_PACKAGE_OP: - case AML_VAR_PACKAGE_OP: - - if ((op->common.parent) && - (op->common.parent->common.aml_opcode == AML_NAME_OP) && - (walk_state->pass_number <= ACPI_IMODE_LOAD_PASS2)) { - /* - * Skip parsing of Buffers and Packages - * because we don't have enough info in the first pass - * to parse them correctly. - */ - op->named.data = aml_op_start; - op->named.length = (u32) (parser_state->pkg_end - - aml_op_start); - - /* Skip body */ - - parser_state->aml = parser_state->pkg_end; - walk_state->arg_count = 0; - } - break; - - case AML_WHILE_OP: - - if (walk_state->control_state) { - walk_state->control_state->control.package_end = - parser_state->pkg_end; - } - break; - - default: - - /* No action for all other opcodes */ - break; - } - break; - } - } - - /* Check for arguments that need to be processed */ - - if (walk_state->arg_count) { - /* - * There are arguments (complex ones), push Op and - * prepare for argument - */ - status = acpi_ps_push_scope (parser_state, op, - walk_state->arg_types, walk_state->arg_count); - if (ACPI_FAILURE (status)) { - goto close_this_op; - } - op = NULL; - continue; - } - - /* - * All arguments have been processed -- Op is complete, - * prepare for next - */ - walk_state->op_info = acpi_ps_get_opcode_info (op->common.aml_opcode); - if (walk_state->op_info->flags & AML_NAMED) { - if (acpi_gbl_depth) { - acpi_gbl_depth--; - } - - if (op->common.aml_opcode == AML_REGION_OP) { - /* - * Skip parsing of control method or opregion body, - * because we don't have enough info in the first pass - * to parse them correctly. - * - * Completed parsing an op_region declaration, we now - * know the length. - */ - op->named.length = (u32) (parser_state->aml - op->named.data); - } - } - - if (walk_state->op_info->flags & AML_CREATE) { - /* - * Backup to beginning of create_xXXfield declaration (1 for - * Opcode) - * - * body_length is unknown until we parse the body - */ - op->named.length = (u32) (parser_state->aml - op->named.data); - } - - /* This op complete, notify the dispatcher */ - - if (walk_state->ascending_callback != NULL) { - walk_state->op = op; - walk_state->opcode = op->common.aml_opcode; - - status = walk_state->ascending_callback (walk_state); - status = acpi_ps_next_parse_state (walk_state, op, status); - if (status == AE_CTRL_PENDING) { - status = AE_OK; - goto close_this_op; - } - } - - -close_this_op: - /* - * Finished one argument of the containing scope - */ - parser_state->scope->parse_scope.arg_count--; - - /* Finished with pre_op */ - - if (pre_op) { - acpi_ps_free_op (pre_op); - pre_op = NULL; - } - - /* Close this Op (will result in parse subtree deletion) */ - - status2 = acpi_ps_complete_this_op (walk_state, op); - if (ACPI_FAILURE (status2)) { - return_ACPI_STATUS (status2); - } - op = NULL; - - switch (status) { - case AE_OK: - break; - - - case AE_CTRL_TRANSFER: - - /* We are about to transfer to a called method. */ - - walk_state->prev_op = op; - walk_state->prev_arg_types = walk_state->arg_types; - return_ACPI_STATUS (status); - - - case AE_CTRL_END: - - acpi_ps_pop_scope (parser_state, &op, - &walk_state->arg_types, &walk_state->arg_count); - - if (op) { - walk_state->op = op; - walk_state->op_info = acpi_ps_get_opcode_info (op->common.aml_opcode); - walk_state->opcode = op->common.aml_opcode; - - status = walk_state->ascending_callback (walk_state); - status = acpi_ps_next_parse_state (walk_state, op, status); - - status2 = acpi_ps_complete_this_op (walk_state, op); - if (ACPI_FAILURE (status2)) { - return_ACPI_STATUS (status2); - } - op = NULL; - } - status = AE_OK; - break; - - - case AE_CTRL_BREAK: - case AE_CTRL_CONTINUE: - - /* Pop off scopes until we find the While */ - - while (!op || (op->common.aml_opcode != AML_WHILE_OP)) { - acpi_ps_pop_scope (parser_state, &op, - &walk_state->arg_types, &walk_state->arg_count); - } - - /* Close this iteration of the While loop */ - - walk_state->op = op; - walk_state->op_info = acpi_ps_get_opcode_info (op->common.aml_opcode); - walk_state->opcode = op->common.aml_opcode; - - status = walk_state->ascending_callback (walk_state); - status = acpi_ps_next_parse_state (walk_state, op, status); - - status2 = acpi_ps_complete_this_op (walk_state, op); - if (ACPI_FAILURE (status2)) { - return_ACPI_STATUS (status2); - } - op = NULL; - - status = AE_OK; - break; - - - case AE_CTRL_TERMINATE: - - status = AE_OK; - - /* Clean up */ - do { - if (op) { - status2 = acpi_ps_complete_this_op (walk_state, op); - if (ACPI_FAILURE (status2)) { - return_ACPI_STATUS (status2); - } - } - acpi_ps_pop_scope (parser_state, &op, - &walk_state->arg_types, &walk_state->arg_count); - - } while (op); - - return_ACPI_STATUS (status); - - - default: /* All other non-AE_OK status */ - - do { - if (op) { - status2 = acpi_ps_complete_this_op (walk_state, op); - if (ACPI_FAILURE (status2)) { - return_ACPI_STATUS (status2); - } - } - acpi_ps_pop_scope (parser_state, &op, - &walk_state->arg_types, &walk_state->arg_count); - - } while (op); - - - /* - * TBD: Cleanup parse ops on error - */ -#if 0 - if (op == NULL) { - acpi_ps_pop_scope (parser_state, &op, - &walk_state->arg_types, &walk_state->arg_count); - } -#endif - walk_state->prev_op = op; - walk_state->prev_arg_types = walk_state->arg_types; - return_ACPI_STATUS (status); - } - - /* This scope complete? */ - - if (acpi_ps_has_completed_scope (parser_state)) { - acpi_ps_pop_scope (parser_state, &op, - &walk_state->arg_types, &walk_state->arg_count); - ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Popped scope, Op=%p\n", op)); - } - else { - op = NULL; - } - - } /* while parser_state->Aml */ - - - /* - * Complete the last Op (if not completed), and clear the scope stack. - * It is easily possible to end an AML "package" with an unbounded number - * of open scopes (such as when several ASL blocks are closed with - * sequential closing braces). We want to terminate each one cleanly. - */ - ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "AML package complete at Op %p\n", op)); - do { - if (op) { - if (walk_state->ascending_callback != NULL) { - walk_state->op = op; - walk_state->op_info = acpi_ps_get_opcode_info (op->common.aml_opcode); - walk_state->opcode = op->common.aml_opcode; - - status = walk_state->ascending_callback (walk_state); - status = acpi_ps_next_parse_state (walk_state, op, status); - if (status == AE_CTRL_PENDING) { - status = AE_OK; - goto close_this_op; - } - - if (status == AE_CTRL_TERMINATE) { - status = AE_OK; - - /* Clean up */ - do { - if (op) { - status2 = acpi_ps_complete_this_op (walk_state, op); - if (ACPI_FAILURE (status2)) { - return_ACPI_STATUS (status2); - } - } - - acpi_ps_pop_scope (parser_state, &op, - &walk_state->arg_types, &walk_state->arg_count); - - } while (op); - - return_ACPI_STATUS (status); - } - - else if (ACPI_FAILURE (status)) { - /* First error is most important */ - - (void) acpi_ps_complete_this_op (walk_state, op); - return_ACPI_STATUS (status); - } - } - - status2 = acpi_ps_complete_this_op (walk_state, op); - if (ACPI_FAILURE (status2)) { - return_ACPI_STATUS (status2); - } - } - - acpi_ps_pop_scope (parser_state, &op, &walk_state->arg_types, - &walk_state->arg_count); - - } while (op); - - return_ACPI_STATUS (status); -} - - /******************************************************************************* * * FUNCTION: acpi_ps_parse_aml diff --git a/drivers/acpi/parser/psutils.c b/drivers/acpi/parser/psutils.c index a10f88715d4..19a27020eee 100644 --- a/drivers/acpi/parser/psutils.c +++ b/drivers/acpi/parser/psutils.c @@ -154,12 +154,14 @@ acpi_ps_alloc_op ( if (flags == ACPI_PARSEOP_GENERIC) { /* The generic op (default) is by far the most common (16 to 1) */ - op = acpi_ut_acquire_from_cache (ACPI_MEM_LIST_PSNODE); + op = acpi_os_acquire_object (acpi_gbl_ps_node_cache); + memset(op, 0, sizeof(struct acpi_parse_obj_common)); } else { /* Extended parseop */ - op = acpi_ut_acquire_from_cache (ACPI_MEM_LIST_PSNODE_EXT); + op = acpi_os_acquire_object (acpi_gbl_ps_node_ext_cache); + memset(op, 0, sizeof(struct acpi_parse_obj_named)); } /* Initialize the Op */ @@ -198,41 +200,14 @@ acpi_ps_free_op ( } if (op->common.flags & ACPI_PARSEOP_GENERIC) { - acpi_ut_release_to_cache (ACPI_MEM_LIST_PSNODE, op); + acpi_os_release_object (acpi_gbl_ps_node_cache, op); } else { - acpi_ut_release_to_cache (ACPI_MEM_LIST_PSNODE_EXT, op); + acpi_os_release_object (acpi_gbl_ps_node_ext_cache, op); } } -#ifdef ACPI_ENABLE_OBJECT_CACHE -/******************************************************************************* - * - * FUNCTION: acpi_ps_delete_parse_cache - * - * PARAMETERS: None - * - * RETURN: None - * - * DESCRIPTION: Free all objects that are on the parse cache list. - * - ******************************************************************************/ - -void -acpi_ps_delete_parse_cache ( - void) -{ - ACPI_FUNCTION_TRACE ("ps_delete_parse_cache"); - - - acpi_ut_delete_generic_cache (ACPI_MEM_LIST_PSNODE); - acpi_ut_delete_generic_cache (ACPI_MEM_LIST_PSNODE_EXT); - return_VOID; -} -#endif - - /******************************************************************************* * * FUNCTION: Utility functions diff --git a/drivers/acpi/tables/tbconvrt.c b/drivers/acpi/tables/tbconvrt.c index 92e0c31539b..d4ff71f5fe5 100644 --- a/drivers/acpi/tables/tbconvrt.c +++ b/drivers/acpi/tables/tbconvrt.c @@ -97,7 +97,9 @@ acpi_tb_get_table_count ( ACPI_FUNCTION_ENTRY (); - if (RSDP->revision < 2) { + /* RSDT pointers are 32 bits, XSDT pointers are 64 bits */ + + if (acpi_gbl_root_table_type == ACPI_TABLE_TYPE_RSDT) { pointer_size = sizeof (u32); } else { @@ -158,7 +160,9 @@ acpi_tb_convert_to_xsdt ( /* Copy the table pointers */ for (i = 0; i < acpi_gbl_rsdt_table_count; i++) { - if (acpi_gbl_RSDP->revision < 2) { + /* RSDT pointers are 32 bits, XSDT pointers are 64 bits */ + + if (acpi_gbl_root_table_type == ACPI_TABLE_TYPE_RSDT) { ACPI_STORE_ADDRESS (new_table->table_offset_entry[i], (ACPI_CAST_PTR (struct rsdt_descriptor_rev1, table_info->pointer))->table_offset_entry[i]); diff --git a/drivers/acpi/tables/tbrsdt.c b/drivers/acpi/tables/tbrsdt.c index b7ffe39c362..13c6ddb2f54 100644 --- a/drivers/acpi/tables/tbrsdt.c +++ b/drivers/acpi/tables/tbrsdt.c @@ -159,8 +159,8 @@ cleanup: * * RETURN: None, Address * - * DESCRIPTION: Extract the address of the RSDT or XSDT, depending on the - * version of the RSDP + * DESCRIPTION: Extract the address of either the RSDT or XSDT, depending on the + * version of the RSDP and whether the XSDT pointer is valid * ******************************************************************************/ @@ -174,16 +174,19 @@ acpi_tb_get_rsdt_address ( out_address->pointer_type = acpi_gbl_table_flags | ACPI_LOGICAL_ADDRESSING; - /* - * For RSDP revision 0 or 1, we use the RSDT. - * For RSDP revision 2 (and above), we use the XSDT - */ - if (acpi_gbl_RSDP->revision < 2) { - out_address->pointer.value = acpi_gbl_RSDP->rsdt_physical_address; - } - else { + /* Use XSDT if it is present */ + + if ((acpi_gbl_RSDP->revision >= 2) && + acpi_gbl_RSDP->xsdt_physical_address) { out_address->pointer.value = acpi_gbl_RSDP->xsdt_physical_address; + acpi_gbl_root_table_type = ACPI_TABLE_TYPE_XSDT; + } + else { + /* No XSDT, use the RSDT */ + + out_address->pointer.value = acpi_gbl_RSDP->rsdt_physical_address; + acpi_gbl_root_table_type = ACPI_TABLE_TYPE_RSDT; } } @@ -211,10 +214,9 @@ acpi_tb_validate_rsdt ( /* - * For RSDP revision 0 or 1, we use the RSDT. - * For RSDP revision 2 and above, we use the XSDT + * Search for appropriate signature, RSDT or XSDT */ - if (acpi_gbl_RSDP->revision < 2) { + if (acpi_gbl_root_table_type == ACPI_TABLE_TYPE_RSDT) { no_match = ACPI_STRNCMP ((char *) table_ptr, RSDT_SIG, sizeof (RSDT_SIG) -1); } @@ -236,11 +238,11 @@ acpi_tb_validate_rsdt ( acpi_gbl_RSDP->rsdt_physical_address, (void *) (acpi_native_uint) acpi_gbl_RSDP->rsdt_physical_address)); - if (acpi_gbl_RSDP->revision < 2) { - ACPI_REPORT_ERROR (("Looking for RSDT (RSDP->Rev < 2)\n")) + if (acpi_gbl_root_table_type == ACPI_TABLE_TYPE_RSDT) { + ACPI_REPORT_ERROR (("Looking for RSDT\n")) } else { - ACPI_REPORT_ERROR (("Looking for XSDT (RSDP->Rev >= 2)\n")) + ACPI_REPORT_ERROR (("Looking for XSDT\n")) } ACPI_DUMP_BUFFER ((char *) table_ptr, 48); diff --git a/drivers/acpi/tables/tbxfroot.c b/drivers/acpi/tables/tbxfroot.c index 198997aa7fb..fe9c8317df4 100644 --- a/drivers/acpi/tables/tbxfroot.c +++ b/drivers/acpi/tables/tbxfroot.c @@ -287,9 +287,11 @@ acpi_get_firmware_table ( * requested table */ for (i = 0, j = 0; i < table_count; i++) { - /* Get the next table pointer, handle RSDT vs. XSDT */ - - if (acpi_gbl_RSDP->revision < 2) { + /* + * Get the next table pointer, handle RSDT vs. XSDT + * RSDT pointers are 32 bits, XSDT pointers are 64 bits + */ + if (acpi_gbl_root_table_type == ACPI_TABLE_TYPE_RSDT) { address.pointer.value = (ACPI_CAST_PTR ( RSDT_DESCRIPTOR, rsdt_info->pointer))->table_offset_entry[i]; } diff --git a/drivers/acpi/utilities/Makefile b/drivers/acpi/utilities/Makefile index 939c447dd52..e87108b7338 100644 --- a/drivers/acpi/utilities/Makefile +++ b/drivers/acpi/utilities/Makefile @@ -3,6 +3,6 @@ # obj-y := utalloc.o utdebug.o uteval.o utinit.o utmisc.o utxface.o \ - utcopy.o utdelete.o utglobal.o utmath.o utobject.o + utcopy.o utdelete.o utglobal.o utmath.o utobject.o utstate.o utmutex.o utobject.o utcache.o EXTRA_CFLAGS += $(ACPI_CFLAGS) diff --git a/drivers/acpi/utilities/utalloc.c b/drivers/acpi/utilities/utalloc.c index c4e7f989a2b..5061c6f0ee6 100644 --- a/drivers/acpi/utilities/utalloc.c +++ b/drivers/acpi/utilities/utalloc.c @@ -1,6 +1,6 @@ /****************************************************************************** * - * Module Name: utalloc - local cache and memory allocation routines + * Module Name: utalloc - local memory allocation routines * *****************************************************************************/ @@ -52,12 +52,10 @@ #ifdef ACPI_DBG_TRACK_ALLOCATIONS static struct acpi_debug_mem_block * acpi_ut_find_allocation ( - u32 list_id, void *allocation); static acpi_status acpi_ut_track_allocation ( - u32 list_id, struct acpi_debug_mem_block *address, acpi_size size, u8 alloc_type, @@ -67,206 +65,118 @@ acpi_ut_track_allocation ( static acpi_status acpi_ut_remove_allocation ( - u32 list_id, struct acpi_debug_mem_block *address, u32 component, char *module, u32 line); #endif /* ACPI_DBG_TRACK_ALLOCATIONS */ - -/******************************************************************************* - * - * FUNCTION: acpi_ut_release_to_cache - * - * PARAMETERS: list_id - Memory list/cache ID - * Object - The object to be released - * - * RETURN: None - * - * DESCRIPTION: Release an object to the specified cache. If cache is full, - * the object is deleted. - * - ******************************************************************************/ - -void -acpi_ut_release_to_cache ( - u32 list_id, - void *object) -{ - struct acpi_memory_list *cache_info; - - - ACPI_FUNCTION_ENTRY (); - - - cache_info = &acpi_gbl_memory_lists[list_id]; - -#ifdef ACPI_ENABLE_OBJECT_CACHE - - /* If walk cache is full, just free this wallkstate object */ - - if (cache_info->cache_depth >= cache_info->max_cache_depth) { - ACPI_MEM_FREE (object); - ACPI_MEM_TRACKING (cache_info->total_freed++); - } - - /* Otherwise put this object back into the cache */ - - else { - if (ACPI_FAILURE (acpi_ut_acquire_mutex (ACPI_MTX_CACHES))) { - return; - } - - /* Mark the object as cached */ - - ACPI_MEMSET (object, 0xCA, cache_info->object_size); - ACPI_SET_DESCRIPTOR_TYPE (object, ACPI_DESC_TYPE_CACHED); - - /* Put the object at the head of the cache list */ - - * (ACPI_CAST_INDIRECT_PTR (char, - &(((char *) object)[cache_info->link_offset]))) = cache_info->list_head; - cache_info->list_head = object; - cache_info->cache_depth++; - - (void) acpi_ut_release_mutex (ACPI_MTX_CACHES); - } - -#else - - /* Object cache is disabled; just free the object */ - - ACPI_MEM_FREE (object); - ACPI_MEM_TRACKING (cache_info->total_freed++); +#ifdef ACPI_DBG_TRACK_ALLOCATIONS +static acpi_status +acpi_ut_create_list ( + char *list_name, + u16 object_size, + acpi_handle *return_cache); #endif -} /******************************************************************************* * - * FUNCTION: acpi_ut_acquire_from_cache + * FUNCTION: acpi_ut_create_caches * - * PARAMETERS: list_id - Memory list ID + * PARAMETERS: None * - * RETURN: A requested object. NULL if the object could not be - * allocated. + * RETURN: Status * - * DESCRIPTION: Get an object from the specified cache. If cache is empty, - * the object is allocated. + * DESCRIPTION: Create all local caches * ******************************************************************************/ -void * -acpi_ut_acquire_from_cache ( - u32 list_id) +acpi_status +acpi_ut_create_caches ( + void) { - struct acpi_memory_list *cache_info; - void *object; - - - ACPI_FUNCTION_NAME ("ut_acquire_from_cache"); + acpi_status status; - cache_info = &acpi_gbl_memory_lists[list_id]; +#ifdef ACPI_DBG_TRACK_ALLOCATIONS -#ifdef ACPI_ENABLE_OBJECT_CACHE + /* Memory allocation lists */ - if (ACPI_FAILURE (acpi_ut_acquire_mutex (ACPI_MTX_CACHES))) { - return (NULL); + status = acpi_ut_create_list ("Acpi-Global", 0, + &acpi_gbl_global_list); + if (ACPI_FAILURE (status)) { + return (status); } - ACPI_MEM_TRACKING (cache_info->cache_requests++); - - /* Check the cache first */ - - if (cache_info->list_head) { - /* There is an object available, use it */ - - object = cache_info->list_head; - cache_info->list_head = *(ACPI_CAST_INDIRECT_PTR (char, - &(((char *) object)[cache_info->link_offset]))); - - ACPI_MEM_TRACKING (cache_info->cache_hits++); - cache_info->cache_depth--; - -#ifdef ACPI_DBG_TRACK_ALLOCATIONS - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Object %p from %s\n", - object, acpi_gbl_memory_lists[list_id].list_name)); + status = acpi_ut_create_list ("Acpi-Namespace", sizeof (struct acpi_namespace_node), + &acpi_gbl_ns_node_list); + if (ACPI_FAILURE (status)) { + return (status); + } #endif - if (ACPI_FAILURE (acpi_ut_release_mutex (ACPI_MTX_CACHES))) { - return (NULL); - } - - /* Clear (zero) the previously used Object */ + /* Object Caches, for frequently used objects */ - ACPI_MEMSET (object, 0, cache_info->object_size); + status = acpi_os_create_cache ("acpi_state", sizeof (union acpi_generic_state), + ACPI_MAX_STATE_CACHE_DEPTH, &acpi_gbl_state_cache); + if (ACPI_FAILURE (status)) { + return (status); } - else { - /* The cache is empty, create a new object */ - - /* Avoid deadlock with ACPI_MEM_CALLOCATE */ - - if (ACPI_FAILURE (acpi_ut_release_mutex (ACPI_MTX_CACHES))) { - return (NULL); - } - - object = ACPI_MEM_CALLOCATE (cache_info->object_size); - ACPI_MEM_TRACKING (cache_info->total_allocated++); + status = acpi_os_create_cache ("acpi_parse", sizeof (struct acpi_parse_obj_common), + ACPI_MAX_PARSE_CACHE_DEPTH, &acpi_gbl_ps_node_cache); + if (ACPI_FAILURE (status)) { + return (status); } -#else - - /* Object cache is disabled; just allocate the object */ + status = acpi_os_create_cache ("acpi_parse_ext", sizeof (struct acpi_parse_obj_named), + ACPI_MAX_EXTPARSE_CACHE_DEPTH, &acpi_gbl_ps_node_ext_cache); + if (ACPI_FAILURE (status)) { + return (status); + } - object = ACPI_MEM_CALLOCATE (cache_info->object_size); - ACPI_MEM_TRACKING (cache_info->total_allocated++); -#endif + status = acpi_os_create_cache ("acpi_operand", sizeof (union acpi_operand_object), + ACPI_MAX_OBJECT_CACHE_DEPTH, &acpi_gbl_operand_cache); + if (ACPI_FAILURE (status)) { + return (status); + } - return (object); + return (AE_OK); } -#ifdef ACPI_ENABLE_OBJECT_CACHE /******************************************************************************* * - * FUNCTION: acpi_ut_delete_generic_cache + * FUNCTION: acpi_ut_delete_caches * - * PARAMETERS: list_id - Memory list ID + * PARAMETERS: None * - * RETURN: None + * RETURN: Status * - * DESCRIPTION: Free all objects within the requested cache. + * DESCRIPTION: Purge and delete all local caches * ******************************************************************************/ -void -acpi_ut_delete_generic_cache ( - u32 list_id) +acpi_status +acpi_ut_delete_caches ( + void) { - struct acpi_memory_list *cache_info; - char *next; + (void) acpi_os_delete_cache (acpi_gbl_state_cache); + acpi_gbl_state_cache = NULL; - ACPI_FUNCTION_ENTRY (); - + (void) acpi_os_delete_cache (acpi_gbl_operand_cache); + acpi_gbl_operand_cache = NULL; - cache_info = &acpi_gbl_memory_lists[list_id]; - while (cache_info->list_head) { - /* Delete one cached state object */ + (void) acpi_os_delete_cache (acpi_gbl_ps_node_cache); + acpi_gbl_ps_node_cache = NULL; - next = *(ACPI_CAST_INDIRECT_PTR (char, - &(((char *) cache_info->list_head)[cache_info->link_offset]))); - ACPI_MEM_FREE (cache_info->list_head); + (void) acpi_os_delete_cache (acpi_gbl_ps_node_ext_cache); + acpi_gbl_ps_node_ext_cache = NULL; - cache_info->list_head = next; - cache_info->cache_depth--; - } + return (AE_OK); } -#endif - /******************************************************************************* * @@ -500,6 +410,43 @@ acpi_ut_callocate ( * occurs in the body of acpi_ut_free. */ +/******************************************************************************* + * + * FUNCTION: acpi_ut_create_list + * + * PARAMETERS: cache_name - Ascii name for the cache + * object_size - Size of each cached object + * return_cache - Where the new cache object is returned + * + * RETURN: Status + * + * DESCRIPTION: Create a local memory list for tracking purposed + * + ******************************************************************************/ + +static acpi_status +acpi_ut_create_list ( + char *list_name, + u16 object_size, + acpi_handle *return_cache) +{ + struct acpi_memory_list *cache; + + + cache = acpi_os_allocate (sizeof (struct acpi_memory_list)); + if (!cache) { + return (AE_NO_MEMORY); + } + + ACPI_MEMSET (cache, 0, sizeof (struct acpi_memory_list)); + + cache->list_name = list_name; + cache->object_size = object_size; + + *return_cache = cache; + return (AE_OK); +} + /******************************************************************************* * @@ -533,15 +480,15 @@ acpi_ut_allocate_and_track ( return (NULL); } - status = acpi_ut_track_allocation (ACPI_MEM_LIST_GLOBAL, allocation, size, + status = acpi_ut_track_allocation (allocation, size, ACPI_MEM_MALLOC, component, module, line); if (ACPI_FAILURE (status)) { acpi_os_free (allocation); return (NULL); } - acpi_gbl_memory_lists[ACPI_MEM_LIST_GLOBAL].total_allocated++; - acpi_gbl_memory_lists[ACPI_MEM_LIST_GLOBAL].current_total_size += (u32) size; + acpi_gbl_global_list->total_allocated++; + acpi_gbl_global_list->current_total_size += (u32) size; return ((void *) &allocation->user_space); } @@ -583,15 +530,15 @@ acpi_ut_callocate_and_track ( return (NULL); } - status = acpi_ut_track_allocation (ACPI_MEM_LIST_GLOBAL, allocation, size, + status = acpi_ut_track_allocation (allocation, size, ACPI_MEM_CALLOC, component, module, line); if (ACPI_FAILURE (status)) { acpi_os_free (allocation); return (NULL); } - acpi_gbl_memory_lists[ACPI_MEM_LIST_GLOBAL].total_allocated++; - acpi_gbl_memory_lists[ACPI_MEM_LIST_GLOBAL].current_total_size += (u32) size; + acpi_gbl_global_list->total_allocated++; + acpi_gbl_global_list->current_total_size += (u32) size; return ((void *) &allocation->user_space); } @@ -636,10 +583,10 @@ acpi_ut_free_and_track ( debug_block = ACPI_CAST_PTR (struct acpi_debug_mem_block, (((char *) allocation) - sizeof (struct acpi_debug_mem_header))); - acpi_gbl_memory_lists[ACPI_MEM_LIST_GLOBAL].total_freed++; - acpi_gbl_memory_lists[ACPI_MEM_LIST_GLOBAL].current_total_size -= debug_block->size; + acpi_gbl_global_list->total_freed++; + acpi_gbl_global_list->current_total_size -= debug_block->size; - status = acpi_ut_remove_allocation (ACPI_MEM_LIST_GLOBAL, debug_block, + status = acpi_ut_remove_allocation (debug_block, component, module, line); if (ACPI_FAILURE (status)) { ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not free memory, %s\n", @@ -658,8 +605,7 @@ acpi_ut_free_and_track ( * * FUNCTION: acpi_ut_find_allocation * - * PARAMETERS: list_id - Memory list to search - * Allocation - Address of allocated memory + * PARAMETERS: Allocation - Address of allocated memory * * RETURN: A list element if found; NULL otherwise. * @@ -669,7 +615,6 @@ acpi_ut_free_and_track ( static struct acpi_debug_mem_block * acpi_ut_find_allocation ( - u32 list_id, void *allocation) { struct acpi_debug_mem_block *element; @@ -678,11 +623,7 @@ acpi_ut_find_allocation ( ACPI_FUNCTION_ENTRY (); - if (list_id > ACPI_MEM_LIST_MAX) { - return (NULL); - } - - element = acpi_gbl_memory_lists[list_id].list_head; + element = acpi_gbl_global_list->list_head; /* Search for the address. */ @@ -702,8 +643,7 @@ acpi_ut_find_allocation ( * * FUNCTION: acpi_ut_track_allocation * - * PARAMETERS: list_id - Memory list to search - * Allocation - Address of allocated memory + * PARAMETERS: Allocation - Address of allocated memory * Size - Size of the allocation * alloc_type - MEM_MALLOC or MEM_CALLOC * Component - Component type of caller @@ -718,7 +658,6 @@ acpi_ut_find_allocation ( static acpi_status acpi_ut_track_allocation ( - u32 list_id, struct acpi_debug_mem_block *allocation, acpi_size size, u8 alloc_type, @@ -734,11 +673,7 @@ acpi_ut_track_allocation ( ACPI_FUNCTION_TRACE_PTR ("ut_track_allocation", allocation); - if (list_id > ACPI_MEM_LIST_MAX) { - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - - mem_list = &acpi_gbl_memory_lists[list_id]; + mem_list = acpi_gbl_global_list; status = acpi_ut_acquire_mutex (ACPI_MTX_MEMORY); if (ACPI_FAILURE (status)) { return_ACPI_STATUS (status); @@ -748,8 +683,7 @@ acpi_ut_track_allocation ( * Search list for this address to make sure it is not already on the list. * This will catch several kinds of problems. */ - - element = acpi_ut_find_allocation (list_id, allocation); + element = acpi_ut_find_allocation (allocation); if (element) { ACPI_REPORT_ERROR (( "ut_track_allocation: Allocation already present in list! (%p)\n", @@ -793,8 +727,7 @@ unlock_and_exit: * * FUNCTION: acpi_ut_remove_allocation * - * PARAMETERS: list_id - Memory list to search - * Allocation - Address of allocated memory + * PARAMETERS: Allocation - Address of allocated memory * Component - Component type of caller * Module - Source file name of caller * Line - Line number of caller @@ -807,7 +740,6 @@ unlock_and_exit: static acpi_status acpi_ut_remove_allocation ( - u32 list_id, struct acpi_debug_mem_block *allocation, u32 component, char *module, @@ -820,11 +752,7 @@ acpi_ut_remove_allocation ( ACPI_FUNCTION_TRACE ("ut_remove_allocation"); - if (list_id > ACPI_MEM_LIST_MAX) { - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - - mem_list = &acpi_gbl_memory_lists[list_id]; + mem_list = acpi_gbl_global_list; if (NULL == mem_list->list_head) { /* No allocations! */ @@ -959,7 +887,7 @@ acpi_ut_dump_allocations ( return; } - element = acpi_gbl_memory_lists[0].list_head; + element = acpi_gbl_global_list->list_head; while (element) { if ((element->component & component) && ((module == NULL) || (0 == ACPI_STRCMP (module, element->module)))) { diff --git a/drivers/acpi/utilities/utcache.c b/drivers/acpi/utilities/utcache.c new file mode 100644 index 00000000000..07588812e72 --- /dev/null +++ b/drivers/acpi/utilities/utcache.c @@ -0,0 +1,322 @@ +/****************************************************************************** + * + * Module Name: utcache - local cache allocation routines + * + *****************************************************************************/ + +/* + * Copyright (C) 2000 - 2005, R. Byron Moore + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer, + * without modification. + * 2. Redistributions in binary form must reproduce at minimum a disclaimer + * substantially similar to the "NO WARRANTY" disclaimer below + * ("Disclaimer") and any redistribution must be conditioned upon + * including a substantially similar Disclaimer requirement for further + * binary redistribution. + * 3. Neither the names of the above-listed copyright holders nor the names + * of any contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * Alternatively, this software may be distributed under the terms of the + * GNU General Public License ("GPL") version 2 as published by the Free + * Software Foundation. + * + * NO WARRANTY + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGES. + */ + + +#include + +#define _COMPONENT ACPI_UTILITIES + ACPI_MODULE_NAME ("utcache") + + +#ifdef ACPI_USE_LOCAL_CACHE +/******************************************************************************* + * + * FUNCTION: acpi_os_create_cache + * + * PARAMETERS: cache_name - Ascii name for the cache + * object_size - Size of each cached object + * max_depth - Maximum depth of the cache (in objects) + * return_cache - Where the new cache object is returned + * + * RETURN: Status + * + * DESCRIPTION: Create a cache object + * + ******************************************************************************/ + +acpi_status +acpi_os_create_cache ( + char *cache_name, + u16 object_size, + u16 max_depth, + struct acpi_memory_list **return_cache) +{ + struct acpi_memory_list *cache; + + + if (!cache_name || !return_cache || (object_size < 16)) { + return (AE_BAD_PARAMETER); + } + + /* Create the cache object */ + + cache = acpi_os_allocate (sizeof (struct acpi_memory_list)); + if (!cache) { + return (AE_NO_MEMORY); + } + + /* Populate the cache object and return it */ + + ACPI_MEMSET (cache, 0, sizeof (struct acpi_memory_list)); + cache->link_offset = 8; + cache->list_name = cache_name; + cache->object_size = object_size; + cache->max_depth = max_depth; + + *return_cache = cache; + return (AE_OK); +} + + +/******************************************************************************* + * + * FUNCTION: acpi_os_purge_cache + * + * PARAMETERS: Cache - Handle to cache object + * + * RETURN: Status + * + * DESCRIPTION: Free all objects within the requested cache. + * + ******************************************************************************/ + +acpi_status +acpi_os_purge_cache ( + struct acpi_memory_list *cache) +{ + char *next; + + + ACPI_FUNCTION_ENTRY (); + + + if (!cache) { + return (AE_BAD_PARAMETER); + } + + /* Walk the list of objects in this cache */ + + while (cache->list_head) { + /* Delete and unlink one cached state object */ + + next = *(ACPI_CAST_INDIRECT_PTR (char, + &(((char *) cache->list_head)[cache->link_offset]))); + ACPI_MEM_FREE (cache->list_head); + + cache->list_head = next; + cache->current_depth--; + } + + return (AE_OK); +} + + +/******************************************************************************* + * + * FUNCTION: acpi_os_delete_cache + * + * PARAMETERS: Cache - Handle to cache object + * + * RETURN: Status + * + * DESCRIPTION: Free all objects within the requested cache and delete the + * cache object. + * + ******************************************************************************/ + +acpi_status +acpi_os_delete_cache ( + struct acpi_memory_list *cache) +{ + acpi_status status; + + + /* Purge all objects in the cache */ + + status = acpi_os_purge_cache (cache); + if (ACPI_FAILURE (status)) { + return (status); + } + + /* Now we can delete the cache object */ + + acpi_os_free (cache); + return (AE_OK); +} + + +/******************************************************************************* + * + * FUNCTION: acpi_os_release_object + * + * PARAMETERS: Cache - Handle to cache object + * Object - The object to be released + * + * RETURN: None + * + * DESCRIPTION: Release an object to the specified cache. If cache is full, + * the object is deleted. + * + ******************************************************************************/ + +acpi_status +acpi_os_release_object ( + struct acpi_memory_list *cache, + void *object) +{ + acpi_status status; + + + ACPI_FUNCTION_ENTRY (); + + + if (!cache || !object) { + return (AE_BAD_PARAMETER); + } + + /* If cache is full, just free this object */ + + if (cache->current_depth >= cache->max_depth) { + ACPI_MEM_FREE (object); + ACPI_MEM_TRACKING (cache->total_freed++); + } + + /* Otherwise put this object back into the cache */ + + else { + status = acpi_ut_acquire_mutex (ACPI_MTX_CACHES); + if (ACPI_FAILURE (status)) { + return (status); + } + + /* Mark the object as cached */ + + ACPI_MEMSET (object, 0xCA, cache->object_size); + ACPI_SET_DESCRIPTOR_TYPE (object, ACPI_DESC_TYPE_CACHED); + + /* Put the object at the head of the cache list */ + + * (ACPI_CAST_INDIRECT_PTR (char, + &(((char *) object)[cache->link_offset]))) = cache->list_head; + cache->list_head = object; + cache->current_depth++; + + (void) acpi_ut_release_mutex (ACPI_MTX_CACHES); + } + + return (AE_OK); +} + + +/******************************************************************************* + * + * FUNCTION: acpi_os_acquire_object + * + * PARAMETERS: Cache - Handle to cache object + * + * RETURN: the acquired object. NULL on error + * + * DESCRIPTION: Get an object from the specified cache. If cache is empty, + * the object is allocated. + * + ******************************************************************************/ + +void * +acpi_os_acquire_object ( + struct acpi_memory_list *cache) +{ + acpi_status status; + void *object; + + + ACPI_FUNCTION_NAME ("ut_acquire_from_cache"); + + + if (!cache) { + return (NULL); + } + + status = acpi_ut_acquire_mutex (ACPI_MTX_CACHES); + if (ACPI_FAILURE (status)) { + return (NULL); + } + + ACPI_MEM_TRACKING (cache->requests++); + + /* Check the cache first */ + + if (cache->list_head) { + /* There is an object available, use it */ + + object = cache->list_head; + cache->list_head = *(ACPI_CAST_INDIRECT_PTR (char, + &(((char *) object)[cache->link_offset]))); + + cache->current_depth--; + + ACPI_MEM_TRACKING (cache->hits++); + ACPI_MEM_TRACKING (ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, + "Object %p from %s\n", object, cache->list_name))); + + status = acpi_ut_release_mutex (ACPI_MTX_CACHES); + if (ACPI_FAILURE (status)) { + return (NULL); + } + + /* Clear (zero) the previously used Object */ + + ACPI_MEMSET (object, 0, cache->object_size); + } + else { + /* The cache is empty, create a new object */ + + ACPI_MEM_TRACKING (cache->total_allocated++); + + /* Avoid deadlock with ACPI_MEM_CALLOCATE */ + + status = acpi_ut_release_mutex (ACPI_MTX_CACHES); + if (ACPI_FAILURE (status)) { + return (NULL); + } + + object = ACPI_MEM_CALLOCATE (cache->object_size); + if (!object) { + return (NULL); + } + } + + return (object); +} +#endif /* ACPI_USE_LOCAL_CACHE */ + + diff --git a/drivers/acpi/utilities/utdebug.c b/drivers/acpi/utilities/utdebug.c index 794c7df3f2a..08362f686ec 100644 --- a/drivers/acpi/utilities/utdebug.c +++ b/drivers/acpi/utilities/utdebug.c @@ -549,7 +549,7 @@ acpi_ut_dump_buffer ( /* Dump fill spaces */ acpi_os_printf ("%*s", ((display * 2) + 1), " "); - j += display; + j += (acpi_native_uint) display; continue; } @@ -584,7 +584,7 @@ acpi_ut_dump_buffer ( break; } - j += display; + j += (acpi_native_uint) display; } /* diff --git a/drivers/acpi/utilities/utglobal.c b/drivers/acpi/utilities/utglobal.c index 4146019b543..8653dda4f81 100644 --- a/drivers/acpi/utilities/utglobal.c +++ b/drivers/acpi/utilities/utglobal.c @@ -820,42 +820,20 @@ void acpi_ut_init_globals ( void) { + acpi_status status; u32 i; ACPI_FUNCTION_TRACE ("ut_init_globals"); - /* Memory allocation and cache lists */ - - ACPI_MEMSET (acpi_gbl_memory_lists, 0, sizeof (struct acpi_memory_list) * ACPI_NUM_MEM_LISTS); - - acpi_gbl_memory_lists[ACPI_MEM_LIST_STATE].link_offset = (u16) ACPI_PTR_DIFF (&(((union acpi_generic_state *) NULL)->common.next), NULL); - acpi_gbl_memory_lists[ACPI_MEM_LIST_PSNODE].link_offset = (u16) ACPI_PTR_DIFF (&(((union acpi_parse_object *) NULL)->common.next), NULL); - acpi_gbl_memory_lists[ACPI_MEM_LIST_PSNODE_EXT].link_offset = (u16) ACPI_PTR_DIFF (&(((union acpi_parse_object *) NULL)->common.next), NULL); - acpi_gbl_memory_lists[ACPI_MEM_LIST_OPERAND].link_offset = (u16) ACPI_PTR_DIFF (&(((union acpi_operand_object *) NULL)->cache.next), NULL); - acpi_gbl_memory_lists[ACPI_MEM_LIST_WALK].link_offset = (u16) ACPI_PTR_DIFF (&(((struct acpi_walk_state *) NULL)->next), NULL); - - acpi_gbl_memory_lists[ACPI_MEM_LIST_NSNODE].object_size = sizeof (struct acpi_namespace_node); - acpi_gbl_memory_lists[ACPI_MEM_LIST_STATE].object_size = sizeof (union acpi_generic_state); - acpi_gbl_memory_lists[ACPI_MEM_LIST_PSNODE].object_size = sizeof (struct acpi_parse_obj_common); - acpi_gbl_memory_lists[ACPI_MEM_LIST_PSNODE_EXT].object_size = sizeof (struct acpi_parse_obj_named); - acpi_gbl_memory_lists[ACPI_MEM_LIST_OPERAND].object_size = sizeof (union acpi_operand_object); - acpi_gbl_memory_lists[ACPI_MEM_LIST_WALK].object_size = sizeof (struct acpi_walk_state); - - acpi_gbl_memory_lists[ACPI_MEM_LIST_STATE].max_cache_depth = ACPI_MAX_STATE_CACHE_DEPTH; - acpi_gbl_memory_lists[ACPI_MEM_LIST_PSNODE].max_cache_depth = ACPI_MAX_PARSE_CACHE_DEPTH; - acpi_gbl_memory_lists[ACPI_MEM_LIST_PSNODE_EXT].max_cache_depth = ACPI_MAX_EXTPARSE_CACHE_DEPTH; - acpi_gbl_memory_lists[ACPI_MEM_LIST_OPERAND].max_cache_depth = ACPI_MAX_OBJECT_CACHE_DEPTH; - acpi_gbl_memory_lists[ACPI_MEM_LIST_WALK].max_cache_depth = ACPI_MAX_WALK_CACHE_DEPTH; - - ACPI_MEM_TRACKING (acpi_gbl_memory_lists[ACPI_MEM_LIST_GLOBAL].list_name = "Global Memory Allocation"); - ACPI_MEM_TRACKING (acpi_gbl_memory_lists[ACPI_MEM_LIST_NSNODE].list_name = "Namespace Nodes"); - ACPI_MEM_TRACKING (acpi_gbl_memory_lists[ACPI_MEM_LIST_STATE].list_name = "State Object Cache"); - ACPI_MEM_TRACKING (acpi_gbl_memory_lists[ACPI_MEM_LIST_PSNODE].list_name = "Parse Node Cache"); - ACPI_MEM_TRACKING (acpi_gbl_memory_lists[ACPI_MEM_LIST_PSNODE_EXT].list_name = "Extended Parse Node Cache"); - ACPI_MEM_TRACKING (acpi_gbl_memory_lists[ACPI_MEM_LIST_OPERAND].list_name = "Operand Object Cache"); - ACPI_MEM_TRACKING (acpi_gbl_memory_lists[ACPI_MEM_LIST_WALK].list_name = "Tree Walk Node Cache"); + /* Create all memory caches */ + + status = acpi_ut_create_caches (); + if (ACPI_FAILURE (status)) + { + return; + } /* ACPI table structure */ diff --git a/drivers/acpi/utilities/utinit.c b/drivers/acpi/utilities/utinit.c index 7f3713889ff..fd7ceba8322 100644 --- a/drivers/acpi/utilities/utinit.c +++ b/drivers/acpi/utilities/utinit.c @@ -264,7 +264,7 @@ acpi_ut_subsystem_shutdown ( /* Purge the local caches */ - (void) acpi_purge_cached_objects (); + (void) acpi_ut_delete_caches (); /* Debug only - display leftover memory allocation, if any */ diff --git a/drivers/acpi/utilities/utmisc.c b/drivers/acpi/utilities/utmisc.c index bb658777fa8..207c836aec6 100644 --- a/drivers/acpi/utilities/utmisc.c +++ b/drivers/acpi/utilities/utmisc.c @@ -49,16 +49,6 @@ #define _COMPONENT ACPI_UTILITIES ACPI_MODULE_NAME ("utmisc") -/* Local prototypes */ - -static acpi_status -acpi_ut_create_mutex ( - acpi_mutex_handle mutex_id); - -static acpi_status -acpi_ut_delete_mutex ( - acpi_mutex_handle mutex_id); - /******************************************************************************* * @@ -84,6 +74,10 @@ acpi_ut_strupr ( ACPI_FUNCTION_ENTRY (); + if (!src_string) { + return (NULL); + } + /* Walk entire string, uppercasing the letters */ for (string = src_string; *string; string++) { @@ -541,326 +535,6 @@ error_exit: } -/******************************************************************************* - * - * FUNCTION: acpi_ut_mutex_initialize - * - * PARAMETERS: None. - * - * RETURN: Status - * - * DESCRIPTION: Create the system mutex objects. - * - ******************************************************************************/ - -acpi_status -acpi_ut_mutex_initialize ( - void) -{ - u32 i; - acpi_status status; - - - ACPI_FUNCTION_TRACE ("ut_mutex_initialize"); - - - /* - * Create each of the predefined mutex objects - */ - for (i = 0; i < NUM_MUTEX; i++) { - status = acpi_ut_create_mutex (i); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); - } - } - - status = acpi_os_create_lock (&acpi_gbl_gpe_lock); - return_ACPI_STATUS (status); -} - - -/******************************************************************************* - * - * FUNCTION: acpi_ut_mutex_terminate - * - * PARAMETERS: None. - * - * RETURN: None. - * - * DESCRIPTION: Delete all of the system mutex objects. - * - ******************************************************************************/ - -void -acpi_ut_mutex_terminate ( - void) -{ - u32 i; - - - ACPI_FUNCTION_TRACE ("ut_mutex_terminate"); - - - /* - * Delete each predefined mutex object - */ - for (i = 0; i < NUM_MUTEX; i++) { - (void) acpi_ut_delete_mutex (i); - } - - acpi_os_delete_lock (acpi_gbl_gpe_lock); - return_VOID; -} - - -/******************************************************************************* - * - * FUNCTION: acpi_ut_create_mutex - * - * PARAMETERS: mutex_iD - ID of the mutex to be created - * - * RETURN: Status - * - * DESCRIPTION: Create a mutex object. - * - ******************************************************************************/ - -static acpi_status -acpi_ut_create_mutex ( - acpi_mutex_handle mutex_id) -{ - acpi_status status = AE_OK; - - - ACPI_FUNCTION_TRACE_U32 ("ut_create_mutex", mutex_id); - - - if (mutex_id > MAX_MUTEX) { - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - - if (!acpi_gbl_mutex_info[mutex_id].mutex) { - status = acpi_os_create_semaphore (1, 1, - &acpi_gbl_mutex_info[mutex_id].mutex); - acpi_gbl_mutex_info[mutex_id].owner_id = ACPI_MUTEX_NOT_ACQUIRED; - acpi_gbl_mutex_info[mutex_id].use_count = 0; - } - - return_ACPI_STATUS (status); -} - - -/******************************************************************************* - * - * FUNCTION: acpi_ut_delete_mutex - * - * PARAMETERS: mutex_iD - ID of the mutex to be deleted - * - * RETURN: Status - * - * DESCRIPTION: Delete a mutex object. - * - ******************************************************************************/ - -static acpi_status -acpi_ut_delete_mutex ( - acpi_mutex_handle mutex_id) -{ - acpi_status status; - - - ACPI_FUNCTION_TRACE_U32 ("ut_delete_mutex", mutex_id); - - - if (mutex_id > MAX_MUTEX) { - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - - status = acpi_os_delete_semaphore (acpi_gbl_mutex_info[mutex_id].mutex); - - acpi_gbl_mutex_info[mutex_id].mutex = NULL; - acpi_gbl_mutex_info[mutex_id].owner_id = ACPI_MUTEX_NOT_ACQUIRED; - - return_ACPI_STATUS (status); -} - - -/******************************************************************************* - * - * FUNCTION: acpi_ut_acquire_mutex - * - * PARAMETERS: mutex_iD - ID of the mutex to be acquired - * - * RETURN: Status - * - * DESCRIPTION: Acquire a mutex object. - * - ******************************************************************************/ - -acpi_status -acpi_ut_acquire_mutex ( - acpi_mutex_handle mutex_id) -{ - acpi_status status; - u32 this_thread_id; - - - ACPI_FUNCTION_NAME ("ut_acquire_mutex"); - - - if (mutex_id > MAX_MUTEX) { - return (AE_BAD_PARAMETER); - } - - this_thread_id = acpi_os_get_thread_id (); - -#ifdef ACPI_MUTEX_DEBUG - { - u32 i; - /* - * Mutex debug code, for internal debugging only. - * - * Deadlock prevention. Check if this thread owns any mutexes of value - * greater than or equal to this one. If so, the thread has violated - * the mutex ordering rule. This indicates a coding error somewhere in - * the ACPI subsystem code. - */ - for (i = mutex_id; i < MAX_MUTEX; i++) { - if (acpi_gbl_mutex_info[i].owner_id == this_thread_id) { - if (i == mutex_id) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Mutex [%s] already acquired by this thread [%X]\n", - acpi_ut_get_mutex_name (mutex_id), this_thread_id)); - - return (AE_ALREADY_ACQUIRED); - } - - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Invalid acquire order: Thread %X owns [%s], wants [%s]\n", - this_thread_id, acpi_ut_get_mutex_name (i), - acpi_ut_get_mutex_name (mutex_id))); - - return (AE_ACQUIRE_DEADLOCK); - } - } - } -#endif - - ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, - "Thread %X attempting to acquire Mutex [%s]\n", - this_thread_id, acpi_ut_get_mutex_name (mutex_id))); - - status = acpi_os_wait_semaphore (acpi_gbl_mutex_info[mutex_id].mutex, - 1, ACPI_WAIT_FOREVER); - if (ACPI_SUCCESS (status)) { - ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Thread %X acquired Mutex [%s]\n", - this_thread_id, acpi_ut_get_mutex_name (mutex_id))); - - acpi_gbl_mutex_info[mutex_id].use_count++; - acpi_gbl_mutex_info[mutex_id].owner_id = this_thread_id; - } - else { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Thread %X could not acquire Mutex [%s] %s\n", - this_thread_id, acpi_ut_get_mutex_name (mutex_id), - acpi_format_exception (status))); - } - - return (status); -} - - -/******************************************************************************* - * - * FUNCTION: acpi_ut_release_mutex - * - * PARAMETERS: mutex_iD - ID of the mutex to be released - * - * RETURN: Status - * - * DESCRIPTION: Release a mutex object. - * - ******************************************************************************/ - -acpi_status -acpi_ut_release_mutex ( - acpi_mutex_handle mutex_id) -{ - acpi_status status; - u32 this_thread_id; - - - ACPI_FUNCTION_NAME ("ut_release_mutex"); - - - this_thread_id = acpi_os_get_thread_id (); - ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, - "Thread %X releasing Mutex [%s]\n", this_thread_id, - acpi_ut_get_mutex_name (mutex_id))); - - if (mutex_id > MAX_MUTEX) { - return (AE_BAD_PARAMETER); - } - - /* - * Mutex must be acquired in order to release it! - */ - if (acpi_gbl_mutex_info[mutex_id].owner_id == ACPI_MUTEX_NOT_ACQUIRED) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Mutex [%s] is not acquired, cannot release\n", - acpi_ut_get_mutex_name (mutex_id))); - - return (AE_NOT_ACQUIRED); - } - -#ifdef ACPI_MUTEX_DEBUG - { - u32 i; - /* - * Mutex debug code, for internal debugging only. - * - * Deadlock prevention. Check if this thread owns any mutexes of value - * greater than this one. If so, the thread has violated the mutex - * ordering rule. This indicates a coding error somewhere in - * the ACPI subsystem code. - */ - for (i = mutex_id; i < MAX_MUTEX; i++) { - if (acpi_gbl_mutex_info[i].owner_id == this_thread_id) { - if (i == mutex_id) { - continue; - } - - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Invalid release order: owns [%s], releasing [%s]\n", - acpi_ut_get_mutex_name (i), acpi_ut_get_mutex_name (mutex_id))); - - return (AE_RELEASE_DEADLOCK); - } - } - } -#endif - - /* Mark unlocked FIRST */ - - acpi_gbl_mutex_info[mutex_id].owner_id = ACPI_MUTEX_NOT_ACQUIRED; - - status = acpi_os_signal_semaphore (acpi_gbl_mutex_info[mutex_id].mutex, 1); - - if (ACPI_FAILURE (status)) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Thread %X could not release Mutex [%s] %s\n", - this_thread_id, acpi_ut_get_mutex_name (mutex_id), - acpi_format_exception (status))); - } - else { - ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Thread %X released Mutex [%s]\n", - this_thread_id, acpi_ut_get_mutex_name (mutex_id))); - } - - return (status); -} - - /******************************************************************************* * * FUNCTION: acpi_ut_create_update_state_and_push @@ -903,361 +577,6 @@ acpi_ut_create_update_state_and_push ( } -/******************************************************************************* - * - * FUNCTION: acpi_ut_create_pkg_state_and_push - * - * PARAMETERS: Object - Object to be added to the new state - * Action - Increment/Decrement - * state_list - List the state will be added to - * - * RETURN: Status - * - * DESCRIPTION: Create a new state and push it - * - ******************************************************************************/ - -#ifdef ACPI_FUTURE_USAGE -acpi_status -acpi_ut_create_pkg_state_and_push ( - void *internal_object, - void *external_object, - u16 index, - union acpi_generic_state **state_list) -{ - union acpi_generic_state *state; - - - ACPI_FUNCTION_ENTRY (); - - - state = acpi_ut_create_pkg_state (internal_object, external_object, index); - if (!state) { - return (AE_NO_MEMORY); - } - - acpi_ut_push_generic_state (state_list, state); - return (AE_OK); -} -#endif /* ACPI_FUTURE_USAGE */ - -/******************************************************************************* - * - * FUNCTION: acpi_ut_push_generic_state - * - * PARAMETERS: list_head - Head of the state stack - * State - State object to push - * - * RETURN: None - * - * DESCRIPTION: Push a state object onto a state stack - * - ******************************************************************************/ - -void -acpi_ut_push_generic_state ( - union acpi_generic_state **list_head, - union acpi_generic_state *state) -{ - ACPI_FUNCTION_TRACE ("ut_push_generic_state"); - - - /* Push the state object onto the front of the list (stack) */ - - state->common.next = *list_head; - *list_head = state; - - return_VOID; -} - - -/******************************************************************************* - * - * FUNCTION: acpi_ut_pop_generic_state - * - * PARAMETERS: list_head - Head of the state stack - * - * RETURN: The popped state object - * - * DESCRIPTION: Pop a state object from a state stack - * - ******************************************************************************/ - -union acpi_generic_state * -acpi_ut_pop_generic_state ( - union acpi_generic_state **list_head) -{ - union acpi_generic_state *state; - - - ACPI_FUNCTION_TRACE ("ut_pop_generic_state"); - - - /* Remove the state object at the head of the list (stack) */ - - state = *list_head; - if (state) { - /* Update the list head */ - - *list_head = state->common.next; - } - - return_PTR (state); -} - - -/******************************************************************************* - * - * FUNCTION: acpi_ut_create_generic_state - * - * PARAMETERS: None - * - * RETURN: The new state object. NULL on failure. - * - * DESCRIPTION: Create a generic state object. Attempt to obtain one from - * the global state cache; If none available, create a new one. - * - ******************************************************************************/ - -union acpi_generic_state * -acpi_ut_create_generic_state ( - void) -{ - union acpi_generic_state *state; - - - ACPI_FUNCTION_ENTRY (); - - - state = acpi_ut_acquire_from_cache (ACPI_MEM_LIST_STATE); - - /* Initialize */ - - if (state) { - state->common.data_type = ACPI_DESC_TYPE_STATE; - } - - return (state); -} - - -/******************************************************************************* - * - * FUNCTION: acpi_ut_create_thread_state - * - * PARAMETERS: None - * - * RETURN: New Thread State. NULL on failure - * - * DESCRIPTION: Create a "Thread State" - a flavor of the generic state used - * to track per-thread info during method execution - * - ******************************************************************************/ - -struct acpi_thread_state * -acpi_ut_create_thread_state ( - void) -{ - union acpi_generic_state *state; - - - ACPI_FUNCTION_TRACE ("ut_create_thread_state"); - - - /* Create the generic state object */ - - state = acpi_ut_create_generic_state (); - if (!state) { - return_PTR (NULL); - } - - /* Init fields specific to the update struct */ - - state->common.data_type = ACPI_DESC_TYPE_STATE_THREAD; - state->thread.thread_id = acpi_os_get_thread_id (); - - return_PTR ((struct acpi_thread_state *) state); -} - - -/******************************************************************************* - * - * FUNCTION: acpi_ut_create_update_state - * - * PARAMETERS: Object - Initial Object to be installed in the state - * Action - Update action to be performed - * - * RETURN: New state object, null on failure - * - * DESCRIPTION: Create an "Update State" - a flavor of the generic state used - * to update reference counts and delete complex objects such - * as packages. - * - ******************************************************************************/ - -union acpi_generic_state * -acpi_ut_create_update_state ( - union acpi_operand_object *object, - u16 action) -{ - union acpi_generic_state *state; - - - ACPI_FUNCTION_TRACE_PTR ("ut_create_update_state", object); - - - /* Create the generic state object */ - - state = acpi_ut_create_generic_state (); - if (!state) { - return_PTR (NULL); - } - - /* Init fields specific to the update struct */ - - state->common.data_type = ACPI_DESC_TYPE_STATE_UPDATE; - state->update.object = object; - state->update.value = action; - - return_PTR (state); -} - - -/******************************************************************************* - * - * FUNCTION: acpi_ut_create_pkg_state - * - * PARAMETERS: Object - Initial Object to be installed in the state - * Action - Update action to be performed - * - * RETURN: New state object, null on failure - * - * DESCRIPTION: Create a "Package State" - * - ******************************************************************************/ - -union acpi_generic_state * -acpi_ut_create_pkg_state ( - void *internal_object, - void *external_object, - u16 index) -{ - union acpi_generic_state *state; - - - ACPI_FUNCTION_TRACE_PTR ("ut_create_pkg_state", internal_object); - - - /* Create the generic state object */ - - state = acpi_ut_create_generic_state (); - if (!state) { - return_PTR (NULL); - } - - /* Init fields specific to the update struct */ - - state->common.data_type = ACPI_DESC_TYPE_STATE_PACKAGE; - state->pkg.source_object = (union acpi_operand_object *) internal_object; - state->pkg.dest_object = external_object; - state->pkg.index = index; - state->pkg.num_packages = 1; - - return_PTR (state); -} - - -/******************************************************************************* - * - * FUNCTION: acpi_ut_create_control_state - * - * PARAMETERS: None - * - * RETURN: New state object, null on failure - * - * DESCRIPTION: Create a "Control State" - a flavor of the generic state used - * to support nested IF/WHILE constructs in the AML. - * - ******************************************************************************/ - -union acpi_generic_state * -acpi_ut_create_control_state ( - void) -{ - union acpi_generic_state *state; - - - ACPI_FUNCTION_TRACE ("ut_create_control_state"); - - - /* Create the generic state object */ - - state = acpi_ut_create_generic_state (); - if (!state) { - return_PTR (NULL); - } - - /* Init fields specific to the control struct */ - - state->common.data_type = ACPI_DESC_TYPE_STATE_CONTROL; - state->common.state = ACPI_CONTROL_CONDITIONAL_EXECUTING; - - return_PTR (state); -} - - -/******************************************************************************* - * - * FUNCTION: acpi_ut_delete_generic_state - * - * PARAMETERS: State - The state object to be deleted - * - * RETURN: None - * - * DESCRIPTION: Put a state object back into the global state cache. The object - * is not actually freed at this time. - * - ******************************************************************************/ - -void -acpi_ut_delete_generic_state ( - union acpi_generic_state *state) -{ - ACPI_FUNCTION_TRACE ("ut_delete_generic_state"); - - - acpi_ut_release_to_cache (ACPI_MEM_LIST_STATE, state); - return_VOID; -} - - -#ifdef ACPI_ENABLE_OBJECT_CACHE -/******************************************************************************* - * - * FUNCTION: acpi_ut_delete_generic_state_cache - * - * PARAMETERS: None - * - * RETURN: None - * - * DESCRIPTION: Purge the global state object cache. Used during subsystem - * termination. - * - ******************************************************************************/ - -void -acpi_ut_delete_generic_state_cache ( - void) -{ - ACPI_FUNCTION_TRACE ("ut_delete_generic_state_cache"); - - - acpi_ut_delete_generic_cache (ACPI_MEM_LIST_STATE); - return_VOID; -} -#endif - - /******************************************************************************* * * FUNCTION: acpi_ut_walk_package_tree diff --git a/drivers/acpi/utilities/utmutex.c b/drivers/acpi/utilities/utmutex.c new file mode 100644 index 00000000000..a80b97cb2e5 --- /dev/null +++ b/drivers/acpi/utilities/utmutex.c @@ -0,0 +1,380 @@ +/******************************************************************************* + * + * Module Name: utmutex - local mutex support + * + ******************************************************************************/ + +/* + * Copyright (C) 2000 - 2005, R. Byron Moore + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer, + * without modification. + * 2. Redistributions in binary form must reproduce at minimum a disclaimer + * substantially similar to the "NO WARRANTY" disclaimer below + * ("Disclaimer") and any redistribution must be conditioned upon + * including a substantially similar Disclaimer requirement for further + * binary redistribution. + * 3. Neither the names of the above-listed copyright holders nor the names + * of any contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * Alternatively, this software may be distributed under the terms of the + * GNU General Public License ("GPL") version 2 as published by the Free + * Software Foundation. + * + * NO WARRANTY + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGES. + */ + + +#include + +#define _COMPONENT ACPI_UTILITIES + ACPI_MODULE_NAME ("utmutex") + +/* Local prototypes */ + +static acpi_status +acpi_ut_create_mutex ( + acpi_mutex_handle mutex_id); + +static acpi_status +acpi_ut_delete_mutex ( + acpi_mutex_handle mutex_id); + + +/******************************************************************************* + * + * FUNCTION: acpi_ut_mutex_initialize + * + * PARAMETERS: None. + * + * RETURN: Status + * + * DESCRIPTION: Create the system mutex objects. + * + ******************************************************************************/ + +acpi_status +acpi_ut_mutex_initialize ( + void) +{ + u32 i; + acpi_status status; + + + ACPI_FUNCTION_TRACE ("ut_mutex_initialize"); + + + /* + * Create each of the predefined mutex objects + */ + for (i = 0; i < NUM_MUTEX; i++) { + status = acpi_ut_create_mutex (i); + if (ACPI_FAILURE (status)) { + return_ACPI_STATUS (status); + } + } + + status = acpi_os_create_lock (&acpi_gbl_gpe_lock); + return_ACPI_STATUS (status); +} + + +/******************************************************************************* + * + * FUNCTION: acpi_ut_mutex_terminate + * + * PARAMETERS: None. + * + * RETURN: None. + * + * DESCRIPTION: Delete all of the system mutex objects. + * + ******************************************************************************/ + +void +acpi_ut_mutex_terminate ( + void) +{ + u32 i; + + + ACPI_FUNCTION_TRACE ("ut_mutex_terminate"); + + + /* + * Delete each predefined mutex object + */ + for (i = 0; i < NUM_MUTEX; i++) { + (void) acpi_ut_delete_mutex (i); + } + + acpi_os_delete_lock (acpi_gbl_gpe_lock); + return_VOID; +} + + +/******************************************************************************* + * + * FUNCTION: acpi_ut_create_mutex + * + * PARAMETERS: mutex_iD - ID of the mutex to be created + * + * RETURN: Status + * + * DESCRIPTION: Create a mutex object. + * + ******************************************************************************/ + +static acpi_status +acpi_ut_create_mutex ( + acpi_mutex_handle mutex_id) +{ + acpi_status status = AE_OK; + + + ACPI_FUNCTION_TRACE_U32 ("ut_create_mutex", mutex_id); + + + if (mutex_id > MAX_MUTEX) { + return_ACPI_STATUS (AE_BAD_PARAMETER); + } + + if (!acpi_gbl_mutex_info[mutex_id].mutex) { + status = acpi_os_create_semaphore (1, 1, + &acpi_gbl_mutex_info[mutex_id].mutex); + acpi_gbl_mutex_info[mutex_id].owner_id = ACPI_MUTEX_NOT_ACQUIRED; + acpi_gbl_mutex_info[mutex_id].use_count = 0; + } + + return_ACPI_STATUS (status); +} + + +/******************************************************************************* + * + * FUNCTION: acpi_ut_delete_mutex + * + * PARAMETERS: mutex_iD - ID of the mutex to be deleted + * + * RETURN: Status + * + * DESCRIPTION: Delete a mutex object. + * + ******************************************************************************/ + +static acpi_status +acpi_ut_delete_mutex ( + acpi_mutex_handle mutex_id) +{ + acpi_status status; + + + ACPI_FUNCTION_TRACE_U32 ("ut_delete_mutex", mutex_id); + + + if (mutex_id > MAX_MUTEX) { + return_ACPI_STATUS (AE_BAD_PARAMETER); + } + + status = acpi_os_delete_semaphore (acpi_gbl_mutex_info[mutex_id].mutex); + + acpi_gbl_mutex_info[mutex_id].mutex = NULL; + acpi_gbl_mutex_info[mutex_id].owner_id = ACPI_MUTEX_NOT_ACQUIRED; + + return_ACPI_STATUS (status); +} + + +/******************************************************************************* + * + * FUNCTION: acpi_ut_acquire_mutex + * + * PARAMETERS: mutex_iD - ID of the mutex to be acquired + * + * RETURN: Status + * + * DESCRIPTION: Acquire a mutex object. + * + ******************************************************************************/ + +acpi_status +acpi_ut_acquire_mutex ( + acpi_mutex_handle mutex_id) +{ + acpi_status status; + u32 this_thread_id; + + + ACPI_FUNCTION_NAME ("ut_acquire_mutex"); + + + if (mutex_id > MAX_MUTEX) { + return (AE_BAD_PARAMETER); + } + + this_thread_id = acpi_os_get_thread_id (); + +#ifdef ACPI_MUTEX_DEBUG + { + u32 i; + /* + * Mutex debug code, for internal debugging only. + * + * Deadlock prevention. Check if this thread owns any mutexes of value + * greater than or equal to this one. If so, the thread has violated + * the mutex ordering rule. This indicates a coding error somewhere in + * the ACPI subsystem code. + */ + for (i = mutex_id; i < MAX_MUTEX; i++) { + if (acpi_gbl_mutex_info[i].owner_id == this_thread_id) { + if (i == mutex_id) { + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, + "Mutex [%s] already acquired by this thread [%X]\n", + acpi_ut_get_mutex_name (mutex_id), this_thread_id)); + + return (AE_ALREADY_ACQUIRED); + } + + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, + "Invalid acquire order: Thread %X owns [%s], wants [%s]\n", + this_thread_id, acpi_ut_get_mutex_name (i), + acpi_ut_get_mutex_name (mutex_id))); + + return (AE_ACQUIRE_DEADLOCK); + } + } + } +#endif + + ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, + "Thread %X attempting to acquire Mutex [%s]\n", + this_thread_id, acpi_ut_get_mutex_name (mutex_id))); + + status = acpi_os_wait_semaphore (acpi_gbl_mutex_info[mutex_id].mutex, + 1, ACPI_WAIT_FOREVER); + if (ACPI_SUCCESS (status)) { + ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Thread %X acquired Mutex [%s]\n", + this_thread_id, acpi_ut_get_mutex_name (mutex_id))); + + acpi_gbl_mutex_info[mutex_id].use_count++; + acpi_gbl_mutex_info[mutex_id].owner_id = this_thread_id; + } + else { + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, + "Thread %X could not acquire Mutex [%s] %s\n", + this_thread_id, acpi_ut_get_mutex_name (mutex_id), + acpi_format_exception (status))); + } + + return (status); +} + + +/******************************************************************************* + * + * FUNCTION: acpi_ut_release_mutex + * + * PARAMETERS: mutex_iD - ID of the mutex to be released + * + * RETURN: Status + * + * DESCRIPTION: Release a mutex object. + * + ******************************************************************************/ + +acpi_status +acpi_ut_release_mutex ( + acpi_mutex_handle mutex_id) +{ + acpi_status status; + u32 this_thread_id; + + + ACPI_FUNCTION_NAME ("ut_release_mutex"); + + + this_thread_id = acpi_os_get_thread_id (); + ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, + "Thread %X releasing Mutex [%s]\n", this_thread_id, + acpi_ut_get_mutex_name (mutex_id))); + + if (mutex_id > MAX_MUTEX) { + return (AE_BAD_PARAMETER); + } + + /* + * Mutex must be acquired in order to release it! + */ + if (acpi_gbl_mutex_info[mutex_id].owner_id == ACPI_MUTEX_NOT_ACQUIRED) { + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, + "Mutex [%s] is not acquired, cannot release\n", + acpi_ut_get_mutex_name (mutex_id))); + + return (AE_NOT_ACQUIRED); + } + +#ifdef ACPI_MUTEX_DEBUG + { + u32 i; + /* + * Mutex debug code, for internal debugging only. + * + * Deadlock prevention. Check if this thread owns any mutexes of value + * greater than this one. If so, the thread has violated the mutex + * ordering rule. This indicates a coding error somewhere in + * the ACPI subsystem code. + */ + for (i = mutex_id; i < MAX_MUTEX; i++) { + if (acpi_gbl_mutex_info[i].owner_id == this_thread_id) { + if (i == mutex_id) { + continue; + } + + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, + "Invalid release order: owns [%s], releasing [%s]\n", + acpi_ut_get_mutex_name (i), acpi_ut_get_mutex_name (mutex_id))); + + return (AE_RELEASE_DEADLOCK); + } + } + } +#endif + + /* Mark unlocked FIRST */ + + acpi_gbl_mutex_info[mutex_id].owner_id = ACPI_MUTEX_NOT_ACQUIRED; + + status = acpi_os_signal_semaphore (acpi_gbl_mutex_info[mutex_id].mutex, 1); + + if (ACPI_FAILURE (status)) { + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, + "Thread %X could not release Mutex [%s] %s\n", + this_thread_id, acpi_ut_get_mutex_name (mutex_id), + acpi_format_exception (status))); + } + else { + ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Thread %X released Mutex [%s]\n", + this_thread_id, acpi_ut_get_mutex_name (mutex_id))); + } + + return (status); +} + + diff --git a/drivers/acpi/utilities/utobject.c b/drivers/acpi/utilities/utobject.c index cd3899b9cc5..19178e14295 100644 --- a/drivers/acpi/utilities/utobject.c +++ b/drivers/acpi/utilities/utobject.c @@ -338,7 +338,7 @@ acpi_ut_allocate_object_desc_dbg ( ACPI_FUNCTION_TRACE ("ut_allocate_object_desc_dbg"); - object = acpi_ut_acquire_from_cache (ACPI_MEM_LIST_OPERAND); + object = acpi_os_acquire_object (acpi_gbl_operand_cache); if (!object) { _ACPI_REPORT_ERROR (module_name, line_number, component_id, ("Could not allocate an object descriptor\n")); @@ -347,7 +347,7 @@ acpi_ut_allocate_object_desc_dbg ( } /* Mark the descriptor type */ - + memset(object, 0, sizeof(union acpi_operand_object)); ACPI_SET_DESCRIPTOR_TYPE (object, ACPI_DESC_TYPE_OPERAND); ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "%p Size %X\n", @@ -385,37 +385,9 @@ acpi_ut_delete_object_desc ( return_VOID; } - acpi_ut_release_to_cache (ACPI_MEM_LIST_OPERAND, object); - - return_VOID; -} - - -#ifdef ACPI_ENABLE_OBJECT_CACHE -/******************************************************************************* - * - * FUNCTION: acpi_ut_delete_object_cache - * - * PARAMETERS: None - * - * RETURN: None - * - * DESCRIPTION: Purge the global state object cache. Used during subsystem - * termination. - * - ******************************************************************************/ - -void -acpi_ut_delete_object_cache ( - void) -{ - ACPI_FUNCTION_TRACE ("ut_delete_object_cache"); - - - acpi_ut_delete_generic_cache (ACPI_MEM_LIST_OPERAND); + (void) acpi_os_release_object (acpi_gbl_operand_cache, object); return_VOID; } -#endif /******************************************************************************* diff --git a/drivers/acpi/utilities/utstate.c b/drivers/acpi/utilities/utstate.c new file mode 100644 index 00000000000..192e7ac9569 --- /dev/null +++ b/drivers/acpi/utilities/utstate.c @@ -0,0 +1,376 @@ +/******************************************************************************* + * + * Module Name: utstate - state object support procedures + * + ******************************************************************************/ + +/* + * Copyright (C) 2000 - 2005, R. Byron Moore + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer, + * without modification. + * 2. Redistributions in binary form must reproduce at minimum a disclaimer + * substantially similar to the "NO WARRANTY" disclaimer below + * ("Disclaimer") and any redistribution must be conditioned upon + * including a substantially similar Disclaimer requirement for further + * binary redistribution. + * 3. Neither the names of the above-listed copyright holders nor the names + * of any contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * Alternatively, this software may be distributed under the terms of the + * GNU General Public License ("GPL") version 2 as published by the Free + * Software Foundation. + * + * NO WARRANTY + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGES. + */ + + +#include + +#define _COMPONENT ACPI_UTILITIES + ACPI_MODULE_NAME ("utstate") + + +/******************************************************************************* + * + * FUNCTION: acpi_ut_create_pkg_state_and_push + * + * PARAMETERS: Object - Object to be added to the new state + * Action - Increment/Decrement + * state_list - List the state will be added to + * + * RETURN: Status + * + * DESCRIPTION: Create a new state and push it + * + ******************************************************************************/ + +acpi_status +acpi_ut_create_pkg_state_and_push ( + void *internal_object, + void *external_object, + u16 index, + union acpi_generic_state **state_list) +{ + union acpi_generic_state *state; + + + ACPI_FUNCTION_ENTRY (); + + + state = acpi_ut_create_pkg_state (internal_object, external_object, index); + if (!state) { + return (AE_NO_MEMORY); + } + + acpi_ut_push_generic_state (state_list, state); + return (AE_OK); +} + + +/******************************************************************************* + * + * FUNCTION: acpi_ut_push_generic_state + * + * PARAMETERS: list_head - Head of the state stack + * State - State object to push + * + * RETURN: None + * + * DESCRIPTION: Push a state object onto a state stack + * + ******************************************************************************/ + +void +acpi_ut_push_generic_state ( + union acpi_generic_state **list_head, + union acpi_generic_state *state) +{ + ACPI_FUNCTION_TRACE ("ut_push_generic_state"); + + + /* Push the state object onto the front of the list (stack) */ + + state->common.next = *list_head; + *list_head = state; + + return_VOID; +} + + +/******************************************************************************* + * + * FUNCTION: acpi_ut_pop_generic_state + * + * PARAMETERS: list_head - Head of the state stack + * + * RETURN: The popped state object + * + * DESCRIPTION: Pop a state object from a state stack + * + ******************************************************************************/ + +union acpi_generic_state * +acpi_ut_pop_generic_state ( + union acpi_generic_state **list_head) +{ + union acpi_generic_state *state; + + + ACPI_FUNCTION_TRACE ("ut_pop_generic_state"); + + + /* Remove the state object at the head of the list (stack) */ + + state = *list_head; + if (state) { + /* Update the list head */ + + *list_head = state->common.next; + } + + return_PTR (state); +} + + +/******************************************************************************* + * + * FUNCTION: acpi_ut_create_generic_state + * + * PARAMETERS: None + * + * RETURN: The new state object. NULL on failure. + * + * DESCRIPTION: Create a generic state object. Attempt to obtain one from + * the global state cache; If none available, create a new one. + * + ******************************************************************************/ + +union acpi_generic_state * +acpi_ut_create_generic_state ( + void) +{ + union acpi_generic_state *state; + + + ACPI_FUNCTION_ENTRY (); + + + state = acpi_os_acquire_object (acpi_gbl_state_cache); + if (state) { + /* Initialize */ + memset(state, 0, sizeof(union acpi_generic_state)); + state->common.data_type = ACPI_DESC_TYPE_STATE; + } + + return (state); +} + + +/******************************************************************************* + * + * FUNCTION: acpi_ut_create_thread_state + * + * PARAMETERS: None + * + * RETURN: New Thread State. NULL on failure + * + * DESCRIPTION: Create a "Thread State" - a flavor of the generic state used + * to track per-thread info during method execution + * + ******************************************************************************/ + +struct acpi_thread_state * +acpi_ut_create_thread_state ( + void) +{ + union acpi_generic_state *state; + + + ACPI_FUNCTION_TRACE ("ut_create_thread_state"); + + + /* Create the generic state object */ + + state = acpi_ut_create_generic_state (); + if (!state) { + return_PTR (NULL); + } + + /* Init fields specific to the update struct */ + + state->common.data_type = ACPI_DESC_TYPE_STATE_THREAD; + state->thread.thread_id = acpi_os_get_thread_id (); + + return_PTR ((struct acpi_thread_state *) state); +} + + +/******************************************************************************* + * + * FUNCTION: acpi_ut_create_update_state + * + * PARAMETERS: Object - Initial Object to be installed in the state + * Action - Update action to be performed + * + * RETURN: New state object, null on failure + * + * DESCRIPTION: Create an "Update State" - a flavor of the generic state used + * to update reference counts and delete complex objects such + * as packages. + * + ******************************************************************************/ + +union acpi_generic_state * +acpi_ut_create_update_state ( + union acpi_operand_object *object, + u16 action) +{ + union acpi_generic_state *state; + + + ACPI_FUNCTION_TRACE_PTR ("ut_create_update_state", object); + + + /* Create the generic state object */ + + state = acpi_ut_create_generic_state (); + if (!state) { + return_PTR (NULL); + } + + /* Init fields specific to the update struct */ + + state->common.data_type = ACPI_DESC_TYPE_STATE_UPDATE; + state->update.object = object; + state->update.value = action; + + return_PTR (state); +} + + +/******************************************************************************* + * + * FUNCTION: acpi_ut_create_pkg_state + * + * PARAMETERS: Object - Initial Object to be installed in the state + * Action - Update action to be performed + * + * RETURN: New state object, null on failure + * + * DESCRIPTION: Create a "Package State" + * + ******************************************************************************/ + +union acpi_generic_state * +acpi_ut_create_pkg_state ( + void *internal_object, + void *external_object, + u16 index) +{ + union acpi_generic_state *state; + + + ACPI_FUNCTION_TRACE_PTR ("ut_create_pkg_state", internal_object); + + + /* Create the generic state object */ + + state = acpi_ut_create_generic_state (); + if (!state) { + return_PTR (NULL); + } + + /* Init fields specific to the update struct */ + + state->common.data_type = ACPI_DESC_TYPE_STATE_PACKAGE; + state->pkg.source_object = (union acpi_operand_object *) internal_object; + state->pkg.dest_object = external_object; + state->pkg.index = index; + state->pkg.num_packages = 1; + + return_PTR (state); +} + + +/******************************************************************************* + * + * FUNCTION: acpi_ut_create_control_state + * + * PARAMETERS: None + * + * RETURN: New state object, null on failure + * + * DESCRIPTION: Create a "Control State" - a flavor of the generic state used + * to support nested IF/WHILE constructs in the AML. + * + ******************************************************************************/ + +union acpi_generic_state * +acpi_ut_create_control_state ( + void) +{ + union acpi_generic_state *state; + + + ACPI_FUNCTION_TRACE ("ut_create_control_state"); + + + /* Create the generic state object */ + + state = acpi_ut_create_generic_state (); + if (!state) { + return_PTR (NULL); + } + + /* Init fields specific to the control struct */ + + state->common.data_type = ACPI_DESC_TYPE_STATE_CONTROL; + state->common.state = ACPI_CONTROL_CONDITIONAL_EXECUTING; + + return_PTR (state); +} + + +/******************************************************************************* + * + * FUNCTION: acpi_ut_delete_generic_state + * + * PARAMETERS: State - The state object to be deleted + * + * RETURN: None + * + * DESCRIPTION: Put a state object back into the global state cache. The object + * is not actually freed at this time. + * + ******************************************************************************/ + +void +acpi_ut_delete_generic_state ( + union acpi_generic_state *state) +{ + ACPI_FUNCTION_TRACE ("ut_delete_generic_state"); + + + (void) acpi_os_release_object (acpi_gbl_state_cache, state); + return_VOID; +} + + diff --git a/drivers/acpi/utilities/utxface.c b/drivers/acpi/utilities/utxface.c index e8803d81065..850da681742 100644 --- a/drivers/acpi/utilities/utxface.c +++ b/drivers/acpi/utilities/utxface.c @@ -46,8 +46,6 @@ #include #include #include -#include -#include #include #define _COMPONENT ACPI_UTILITIES @@ -79,11 +77,6 @@ acpi_initialize_subsystem ( ACPI_DEBUG_EXEC (acpi_ut_init_stack_ptr_trace ()); - - /* Initialize all globals used by the subsystem */ - - acpi_ut_init_globals (); - /* Initialize the OS-Dependent layer */ status = acpi_os_initialize (); @@ -93,6 +86,10 @@ acpi_initialize_subsystem ( return_ACPI_STATUS (status); } + /* Initialize all globals used by the subsystem */ + + acpi_ut_init_globals (); + /* Create the default mutex objects */ status = acpi_ut_mutex_initialize (); @@ -522,13 +519,9 @@ acpi_purge_cached_objects ( { ACPI_FUNCTION_TRACE ("acpi_purge_cached_objects"); - -#ifdef ACPI_ENABLE_OBJECT_CACHE - acpi_ut_delete_generic_state_cache (); - acpi_ut_delete_object_cache (); - acpi_ds_delete_walk_state_cache (); - acpi_ps_delete_parse_cache (); -#endif - + (void) acpi_os_purge_cache (acpi_gbl_state_cache); + (void) acpi_os_purge_cache (acpi_gbl_operand_cache); + (void) acpi_os_purge_cache (acpi_gbl_ps_node_cache); + (void) acpi_os_purge_cache (acpi_gbl_ps_node_ext_cache); return_ACPI_STATUS (AE_OK); } diff --git a/include/acpi/acconfig.h b/include/acpi/acconfig.h index 6babcb10493..dd9b70cc963 100644 --- a/include/acpi/acconfig.h +++ b/include/acpi/acconfig.h @@ -64,7 +64,7 @@ /* Version string */ -#define ACPI_CA_VERSION 0x20050526 +#define ACPI_CA_VERSION 0x20050624 /* * OS name, used for the _OS object. The _OS object is essentially obsolete, @@ -78,11 +78,10 @@ /* Maximum objects in the various object caches */ -#define ACPI_MAX_STATE_CACHE_DEPTH 64 /* State objects */ +#define ACPI_MAX_STATE_CACHE_DEPTH 96 /* State objects */ #define ACPI_MAX_PARSE_CACHE_DEPTH 96 /* Parse tree objects */ -#define ACPI_MAX_EXTPARSE_CACHE_DEPTH 64 /* Parse tree objects */ -#define ACPI_MAX_OBJECT_CACHE_DEPTH 64 /* Interpreter operand objects */ -#define ACPI_MAX_WALK_CACHE_DEPTH 4 /* Objects for parse tree walks */ +#define ACPI_MAX_EXTPARSE_CACHE_DEPTH 96 /* Parse tree objects */ +#define ACPI_MAX_OBJECT_CACHE_DEPTH 96 /* Interpreter operand objects */ /* * Should the subystem abort the loading of an ACPI table if the diff --git a/include/acpi/acdebug.h b/include/acpi/acdebug.h index 8ba372b0f24..f8fa2227583 100644 --- a/include/acpi/acdebug.h +++ b/include/acpi/acdebug.h @@ -113,6 +113,10 @@ void acpi_db_set_method_call_breakpoint ( union acpi_parse_object *op); +void +acpi_db_get_bus_info ( + void); + void acpi_db_disassemble_aml ( char *statements, @@ -327,7 +331,7 @@ acpi_db_set_output_destination ( u32 where); void -acpi_db_dump_object ( +acpi_db_dump_external_object ( union acpi_object *obj_desc, u32 level); diff --git a/include/acpi/acdisasm.h b/include/acpi/acdisasm.h index dbfa877121b..fcc2d507fac 100644 --- a/include/acpi/acdisasm.h +++ b/include/acpi/acdisasm.h @@ -90,6 +90,7 @@ struct acpi_op_walk_info { u32 level; u32 bit_offset; + struct acpi_walk_state *walk_state; }; typedef diff --git a/include/acpi/acdispat.h b/include/acpi/acdispat.h index 8f5f2f71b1d..fde6aa9fcd0 100644 --- a/include/acpi/acdispat.h +++ b/include/acpi/acdispat.h @@ -450,10 +450,4 @@ acpi_ds_result_pop_from_bottom ( union acpi_operand_object **object, struct acpi_walk_state *walk_state); -#ifdef ACPI_ENABLE_OBJECT_CACHE -void -acpi_ds_delete_walk_state_cache ( - void); -#endif - #endif /* _ACDISPAT_H_ */ diff --git a/include/acpi/acevents.h b/include/acpi/acevents.h index 301c5cce666..33ae2ca997b 100644 --- a/include/acpi/acevents.h +++ b/include/acpi/acevents.h @@ -122,8 +122,7 @@ acpi_ev_valid_gpe_event ( acpi_status acpi_ev_walk_gpe_list ( - ACPI_GPE_CALLBACK gpe_walk_callback, - u32 flags); + ACPI_GPE_CALLBACK gpe_walk_callback); acpi_status acpi_ev_delete_gpe_handlers ( diff --git a/include/acpi/acglobal.h b/include/acpi/acglobal.h index 4946696088c..8d5a397abd6 100644 --- a/include/acpi/acglobal.h +++ b/include/acpi/acglobal.h @@ -151,6 +151,13 @@ ACPI_EXTERN struct acpi_common_facs acpi_gbl_common_fACS; */ +/* The root table can be either an RSDT or an XSDT */ + +ACPI_EXTERN u8 acpi_gbl_root_table_type; +#define ACPI_TABLE_TYPE_RSDT 'R' +#define ACPI_TABLE_TYPE_XSDT 'X' + + /* * Handle both ACPI 1.0 and ACPI 2.0 Integer widths: * If we are executing a method that exists in a 32-bit ACPI table, @@ -180,8 +187,23 @@ ACPI_EXTERN struct acpi_mutex_info acpi_gbl_mutex_info[NUM_MUTEX]; * ****************************************************************************/ +#ifdef ACPI_DBG_TRACK_ALLOCATIONS + +/* Lists for tracking memory allocations */ + +ACPI_EXTERN struct acpi_memory_list *acpi_gbl_global_list; +ACPI_EXTERN struct acpi_memory_list *acpi_gbl_ns_node_list; +#endif + +/* Object caches */ + +ACPI_EXTERN acpi_cache_t *acpi_gbl_state_cache; +ACPI_EXTERN acpi_cache_t *acpi_gbl_ps_node_cache; +ACPI_EXTERN acpi_cache_t *acpi_gbl_ps_node_ext_cache; +ACPI_EXTERN acpi_cache_t *acpi_gbl_operand_cache; + +/* Global handlers */ -ACPI_EXTERN struct acpi_memory_list acpi_gbl_memory_lists[ACPI_NUM_MEM_LISTS]; ACPI_EXTERN struct acpi_object_notify_handler acpi_gbl_device_notify; ACPI_EXTERN struct acpi_object_notify_handler acpi_gbl_system_notify; ACPI_EXTERN acpi_exception_handler acpi_gbl_exception_handler; @@ -189,6 +211,8 @@ ACPI_EXTERN acpi_init_handler acpi_gbl_init_handler; ACPI_EXTERN struct acpi_walk_state *acpi_gbl_breakpoint_walk; ACPI_EXTERN acpi_handle acpi_gbl_global_lock_semaphore; +/* Misc */ + ACPI_EXTERN u32 acpi_gbl_global_lock_thread_count; ACPI_EXTERN u32 acpi_gbl_original_mode; ACPI_EXTERN u32 acpi_gbl_rsdp_original_location; diff --git a/include/acpi/achware.h b/include/acpi/achware.h index 9d63641b8e7..cf5de4625a7 100644 --- a/include/acpi/achware.h +++ b/include/acpi/achware.h @@ -143,15 +143,15 @@ acpi_hw_get_gpe_status ( acpi_status acpi_hw_disable_all_gpes ( - u32 flags); + void); acpi_status acpi_hw_enable_all_runtime_gpes ( - u32 flags); + void); acpi_status acpi_hw_enable_all_wakeup_gpes ( - u32 flags); + void); acpi_status acpi_hw_enable_runtime_gpe_block ( diff --git a/include/acpi/aclocal.h b/include/acpi/aclocal.h index 52c6a202586..58f9ba1a34e 100644 --- a/include/acpi/aclocal.h +++ b/include/acpi/aclocal.h @@ -953,24 +953,18 @@ struct acpi_debug_mem_block #define ACPI_MEM_LIST_GLOBAL 0 #define ACPI_MEM_LIST_NSNODE 1 - -#define ACPI_MEM_LIST_FIRST_CACHE_LIST 2 -#define ACPI_MEM_LIST_STATE 2 -#define ACPI_MEM_LIST_PSNODE 3 -#define ACPI_MEM_LIST_PSNODE_EXT 4 -#define ACPI_MEM_LIST_OPERAND 5 -#define ACPI_MEM_LIST_WALK 6 -#define ACPI_MEM_LIST_MAX 6 -#define ACPI_NUM_MEM_LISTS 7 +#define ACPI_MEM_LIST_MAX 1 +#define ACPI_NUM_MEM_LISTS 2 struct acpi_memory_list { + char *list_name; void *list_head; - u16 link_offset; - u16 max_cache_depth; - u16 cache_depth; u16 object_size; + u16 max_depth; + u16 current_depth; + u16 link_offset; #ifdef ACPI_DBG_TRACK_ALLOCATIONS @@ -979,11 +973,9 @@ struct acpi_memory_list u32 total_allocated; u32 total_freed; u32 current_total_size; - u32 cache_requests; - u32 cache_hits; - char *list_name; + u32 requests; + u32 hits; #endif }; - #endif /* __ACLOCAL_H__ */ diff --git a/include/acpi/acparser.h b/include/acpi/acparser.h index 69827657181..ba9548f94de 100644 --- a/include/acpi/acparser.h +++ b/include/acpi/acparser.h @@ -63,6 +63,7 @@ #define ACPI_PARSE_MODE_MASK 0x0030 #define ACPI_PARSE_DEFERRED_OP 0x0100 +#define ACPI_PARSE_DISASSEMBLE 0x0200 /****************************************************************************** @@ -158,6 +159,25 @@ u16 acpi_ps_peek_opcode ( struct acpi_parse_state *state); +acpi_status +acpi_ps_complete_this_op ( + struct acpi_walk_state *walk_state, + union acpi_parse_object *op); + +acpi_status +acpi_ps_next_parse_state ( + struct acpi_walk_state *walk_state, + union acpi_parse_object *op, + acpi_status callback_status); + + +/* + * psloop - main parse loop + */ +acpi_status +acpi_ps_parse_loop ( + struct acpi_walk_state *walk_state); + /* * psscope - Scope stack management routines @@ -291,12 +311,6 @@ acpi_ps_set_name( union acpi_parse_object *op, u32 name); -#ifdef ACPI_ENABLE_OBJECT_CACHE -void -acpi_ps_delete_parse_cache ( - void); -#endif - /* * psdump - display parser tree diff --git a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h index ea489f23521..819a53f83cf 100644 --- a/include/acpi/acpiosxf.h +++ b/include/acpi/acpiosxf.h @@ -139,15 +139,14 @@ void acpi_os_delete_lock ( acpi_handle handle); -void +unsigned long acpi_os_acquire_lock ( - acpi_handle handle, - u32 flags); + acpi_handle handle); void acpi_os_release_lock ( acpi_handle handle, - u32 flags); + unsigned long flags); /* @@ -180,6 +179,34 @@ acpi_os_get_physical_address ( #endif + +/* + * Memory/Object Cache + */ +acpi_status +acpi_os_create_cache ( + char *cache_name, + u16 object_size, + u16 max_depth, + acpi_cache_t **return_cache); + +acpi_status +acpi_os_delete_cache ( + acpi_cache_t *cache); + +acpi_status +acpi_os_purge_cache ( + acpi_cache_t *cache); + +void * +acpi_os_acquire_object ( + acpi_cache_t *cache); + +acpi_status +acpi_os_release_object ( + acpi_cache_t *cache, + void *object); + /* * Interrupt handlers */ diff --git a/include/acpi/acstruct.h b/include/acpi/acstruct.h index 4e926457bd2..a2025a8da00 100644 --- a/include/acpi/acstruct.h +++ b/include/acpi/acstruct.h @@ -162,6 +162,9 @@ struct acpi_walk_info #define ACPI_DISPLAY_SUMMARY 0 #define ACPI_DISPLAY_OBJECTS 1 +#define ACPI_DISPLAY_MASK 1 + +#define ACPI_DISPLAY_SHORT 2 struct acpi_get_devices_info { diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h index 3a451dc48ac..8cd774a20c6 100644 --- a/include/acpi/actypes.h +++ b/include/acpi/actypes.h @@ -243,6 +243,11 @@ struct acpi_pointer #define ACPI_LOGMODE_PHYSPTR ACPI_LOGICAL_ADDRESSING | ACPI_PHYSICAL_POINTER #define ACPI_LOGMODE_LOGPTR ACPI_LOGICAL_ADDRESSING | ACPI_LOGICAL_POINTER +/* Types for the OS interface layer (OSL) */ + +#ifdef ACPI_USE_LOCAL_CACHE +#define acpi_cache_t struct acpi_memory_list +#endif /* * Useful defines diff --git a/include/acpi/acutils.h b/include/acpi/acutils.h index 192d0bea388..e9c1584dd78 100644 --- a/include/acpi/acutils.h +++ b/include/acpi/acutils.h @@ -557,16 +557,6 @@ void acpi_ut_delete_generic_state ( union acpi_generic_state *state); -#ifdef ACPI_ENABLE_OBJECT_CACHE -void -acpi_ut_delete_generic_state_cache ( - void); - -void -acpi_ut_delete_object_cache ( - void); -#endif - /* * utmath @@ -622,22 +612,6 @@ acpi_ut_strtoul64 ( #define ACPI_ANY_BASE 0 -acpi_status -acpi_ut_mutex_initialize ( - void); - -void -acpi_ut_mutex_terminate ( - void); - -acpi_status -acpi_ut_acquire_mutex ( - acpi_mutex_handle mutex_id); - -acpi_status -acpi_ut_release_mutex ( - acpi_mutex_handle mutex_id); - u8 * acpi_ut_get_resource_end_tag ( union acpi_operand_object *obj_desc); @@ -666,22 +640,35 @@ acpi_ut_display_init_pathname ( /* - * utalloc - memory allocation and object caching + * utmutex - mutex support */ -void * -acpi_ut_acquire_from_cache ( - u32 list_id); +acpi_status +acpi_ut_mutex_initialize ( + void); void -acpi_ut_release_to_cache ( - u32 list_id, - void *object); +acpi_ut_mutex_terminate ( + void); -#ifdef ACPI_ENABLE_OBJECT_CACHE -void -acpi_ut_delete_generic_cache ( - u32 list_id); -#endif +acpi_status +acpi_ut_acquire_mutex ( + acpi_mutex_handle mutex_id); + +acpi_status +acpi_ut_release_mutex ( + acpi_mutex_handle mutex_id); + + +/* + * utalloc - memory allocation and object caching + */ +acpi_status +acpi_ut_create_caches ( + void); + +acpi_status +acpi_ut_delete_caches ( + void); acpi_status acpi_ut_validate_buffer ( diff --git a/include/acpi/amlcode.h b/include/acpi/amlcode.h index 55e97ed2919..50a08890119 100644 --- a/include/acpi/amlcode.h +++ b/include/acpi/amlcode.h @@ -69,7 +69,7 @@ #define AML_MULTI_NAME_PREFIX_OP (u16) 0x2f #define AML_NAME_CHAR_SUBSEQ (u16) 0x30 #define AML_NAME_CHAR_FIRST (u16) 0x41 -#define AML_OP_PREFIX (u16) 0x5b +#define AML_EXTENDED_OP_PREFIX (u16) 0x5b #define AML_ROOT_PREFIX (u16) 0x5c #define AML_PARENT_PREFIX (u16) 0x5e #define AML_LOCAL_OP (u16) 0x60 @@ -146,7 +146,7 @@ /* prefixed opcodes */ -#define AML_EXTOP (u16) 0x005b /* prefix for 2-byte opcodes */ +#define AML_EXTENDED_OPCODE (u16) 0x5b00 /* prefix for 2-byte opcodes */ #define AML_MUTEX_OP (u16) 0x5b01 #define AML_EVENT_OP (u16) 0x5b02 diff --git a/include/acpi/platform/acenv.h b/include/acpi/platform/acenv.h index adf969efa51..aa63202e8d5 100644 --- a/include/acpi/platform/acenv.h +++ b/include/acpi/platform/acenv.h @@ -49,35 +49,38 @@ * Configuration for ACPI tools and utilities */ -#ifdef _ACPI_DUMP_APP +#ifdef ACPI_LIBRARY +#define ACPI_USE_LOCAL_CACHE +#endif + +#ifdef ACPI_DUMP_APP #ifndef MSDOS #define ACPI_DEBUG_OUTPUT #endif #define ACPI_APPLICATION #define ACPI_DISASSEMBLER #define ACPI_NO_METHOD_EXECUTION -#define ACPI_USE_SYSTEM_CLIBRARY -#define ACPI_ENABLE_OBJECT_CACHE #endif -#ifdef _ACPI_EXEC_APP +#ifdef ACPI_EXEC_APP #undef DEBUGGER_THREADING #define DEBUGGER_THREADING DEBUGGER_SINGLE_THREADED #define ACPI_DEBUG_OUTPUT #define ACPI_APPLICATION #define ACPI_DEBUGGER #define ACPI_DISASSEMBLER -#define ACPI_USE_SYSTEM_CLIBRARY -#define ACPI_ENABLE_OBJECT_CACHE #endif -#ifdef _ACPI_ASL_COMPILER +#ifdef ACPI_ASL_COMPILER #define ACPI_DEBUG_OUTPUT #define ACPI_APPLICATION #define ACPI_DISASSEMBLER #define ACPI_CONSTANT_EVAL_ONLY +#endif + +#ifdef ACPI_APPLICATION #define ACPI_USE_SYSTEM_CLIBRARY -#define ACPI_ENABLE_OBJECT_CACHE +#define ACPI_USE_LOCAL_CACHE #endif /* diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h index a3de0db8569..4fbc0fd52a2 100644 --- a/include/acpi/platform/aclinux.h +++ b/include/acpi/platform/aclinux.h @@ -62,6 +62,17 @@ #define ACPI_MACHINE_WIDTH BITS_PER_LONG +/* Type(s) for the OSL */ + +#ifdef ACPI_USE_LOCAL_CACHE +#define acpi_cache_t struct acpi_memory_list +#else +#include +#define acpi_cache_t kmem_cache_t +#endif + + + #else /* !__KERNEL__ */ #include -- cgit v1.2.3-70-g09d2 From f9f4601f331aa1226d7a798a01950efbb388f07f Mon Sep 17 00:00:00 2001 From: Robert Moore Date: Fri, 8 Jul 2005 00:00:00 -0400 Subject: ACPICA 20050708 from Bob Moore The use of the CPU stack in the debug version of the subsystem has been considerably reduced. Previously, a debug structure was declared in every function that used the debug macros. This structure has been removed in favor of declaring the individual elements as parameters to the debug functions. This reduces the cumulative stack use during nested execution of ACPI function calls at the cost of a small increase in the code size of the debug version of the subsystem. With assistance from Alexey Starikovskiy and Len Brown. Added the ACPI_GET_FUNCTION_NAME macro to enable the compiler-dependent headers to define a macro that will return the current function name at runtime (such as __FUNCTION__ or _func_, etc.) The function name is used by the debug trace output. If ACPI_GET_FUNCTION_NAME is not defined in the compiler-dependent header, the function name is saved on the CPU stack (one pointer per function.) This mechanism is used because apparently there exists no standard ANSI-C defined macro that that returns the function name. Alexey Starikovskiy redesigned and reimplemented the "Owner ID" mechanism used to track namespace objects created/deleted by ACPI tables and control method execution. A bitmap is now used to allocate and free the IDs, thus solving the wraparound problem present in the previous implementation. The size of the namespace node descriptor was reduced by 2 bytes as a result. Removed the UINT32_BIT and UINT16_BIT types that were used for the bitfield flag definitions within the headers for the predefined ACPI tables. These have been replaced by UINT8_BIT in order to increase the code portability of the subsystem. If the use of UINT8 remains a problem, we may be forced to eliminate bitfields entirely because of a lack of portability. Alexey Starikovksiy enhanced the performance of acpi_ut_update_object_reference. This is a frequently used function and this improvement increases the performance of the entire subsystem. Alexey Starikovskiy fixed several possible memory leaks and the inverse - premature object deletion. Signed-off-by: Len Brown --- drivers/acpi/dispatcher/dsinit.c | 6 +- drivers/acpi/dispatcher/dsmethod.c | 35 +++++--- drivers/acpi/executer/exconfig.c | 2 +- drivers/acpi/executer/exdump.c | 2 +- drivers/acpi/executer/exoparg1.c | 15 +--- drivers/acpi/executer/exresop.c | 16 ++++ drivers/acpi/namespace/nsaccess.c | 2 +- drivers/acpi/namespace/nsalloc.c | 5 +- drivers/acpi/namespace/nsdump.c | 8 +- drivers/acpi/namespace/nsparse.c | 2 +- drivers/acpi/parser/psloop.c | 9 +- drivers/acpi/parser/psxface.c | 7 +- drivers/acpi/tables/tbinstal.c | 12 ++- drivers/acpi/tables/tbrsdt.c | 25 +----- drivers/acpi/tables/tbxface.c | 3 +- drivers/acpi/tables/tbxfroot.c | 106 +++++++++++++---------- drivers/acpi/utilities/utcache.c | 12 ++- drivers/acpi/utilities/utdebug.c | 169 +++++++++++++++++++++---------------- drivers/acpi/utilities/utdelete.c | 98 +++++++-------------- drivers/acpi/utilities/utglobal.c | 72 +--------------- drivers/acpi/utilities/utmisc.c | 94 +++++++++++++++++++++ drivers/acpi/utilities/utmutex.c | 10 +-- include/acpi/acconfig.h | 2 +- include/acpi/acdisasm.h | 2 +- include/acpi/acexcep.h | 6 +- include/acpi/acglobal.h | 3 +- include/acpi/aclocal.h | 57 ++++++------- include/acpi/acmacros.h | 100 +++++++++++++--------- include/acpi/acnamesp.h | 4 +- include/acpi/acobject.h | 2 +- include/acpi/acoutput.h | 2 +- include/acpi/acstruct.h | 11 ++- include/acpi/actables.h | 4 + include/acpi/actbl.h | 58 +++++++------ include/acpi/actbl1.h | 52 +++++++----- include/acpi/actbl2.h | 109 +++++++++++++----------- include/acpi/actypes.h | 18 ++-- include/acpi/acutils.h | 56 ++++++++---- include/acpi/platform/acgcc.h | 8 +- 39 files changed, 664 insertions(+), 540 deletions(-) (limited to 'include') diff --git a/drivers/acpi/dispatcher/dsinit.c b/drivers/acpi/dispatcher/dsinit.c index d7790db5017..ebc07aab710 100644 --- a/drivers/acpi/dispatcher/dsinit.c +++ b/drivers/acpi/dispatcher/dsinit.c @@ -99,7 +99,7 @@ acpi_ds_init_one_object ( * was just loaded */ if (((struct acpi_namespace_node *) obj_handle)->owner_id != - info->table_desc->table_id) { + info->table_desc->owner_id) { return (AE_OK); } @@ -168,7 +168,7 @@ acpi_ds_init_one_object ( */ acpi_ns_delete_namespace_subtree (obj_handle); acpi_ns_delete_namespace_by_owner ( - ((struct acpi_namespace_node *) obj_handle)->object->method.owning_id); + ((struct acpi_namespace_node *) obj_handle)->object->method.owner_id); break; @@ -237,7 +237,7 @@ acpi_ds_initialize_objects ( ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, "\nTable [%4.4s](id %4.4X) - %hd Objects with %hd Devices %hd Methods %hd Regions\n", - table_desc->pointer->signature, table_desc->table_id, info.object_count, + table_desc->pointer->signature, table_desc->owner_id, info.object_count, info.device_count, info.method_count, info.op_region_count)); ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, diff --git a/drivers/acpi/dispatcher/dsmethod.c b/drivers/acpi/dispatcher/dsmethod.c index c9d9a6c45ae..1b90813cbde 100644 --- a/drivers/acpi/dispatcher/dsmethod.c +++ b/drivers/acpi/dispatcher/dsmethod.c @@ -77,7 +77,6 @@ acpi_ds_parse_method ( union acpi_operand_object *obj_desc; union acpi_parse_object *op; struct acpi_namespace_node *node; - acpi_owner_id owner_id; struct acpi_walk_state *walk_state; @@ -132,15 +131,18 @@ acpi_ds_parse_method ( * objects (such as Operation Regions) can be created during the * first pass parse. */ - owner_id = acpi_ut_allocate_owner_id (ACPI_OWNER_TYPE_METHOD); - obj_desc->method.owning_id = owner_id; + status = acpi_ut_allocate_owner_id (&obj_desc->method.owner_id); + if (ACPI_FAILURE (status)) { + goto cleanup; + } /* Create and initialize a new walk state */ - walk_state = acpi_ds_create_walk_state (owner_id, NULL, NULL, NULL); + walk_state = acpi_ds_create_walk_state ( + obj_desc->method.owner_id, NULL, NULL, NULL); if (!walk_state) { status = AE_NO_MEMORY; - goto cleanup; + goto cleanup2; } status = acpi_ds_init_aml_walk (walk_state, op, node, @@ -148,7 +150,7 @@ acpi_ds_parse_method ( obj_desc->method.aml_length, NULL, 1); if (ACPI_FAILURE (status)) { acpi_ds_delete_walk_state (walk_state); - goto cleanup; + goto cleanup2; } /* @@ -162,13 +164,16 @@ acpi_ds_parse_method ( */ status = acpi_ps_parse_aml (walk_state); if (ACPI_FAILURE (status)) { - goto cleanup; + goto cleanup2; } ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "**** [%4.4s] Parsed **** named_obj=%p Op=%p\n", acpi_ut_get_node_name (obj_handle), obj_handle, op)); +cleanup2: + (void) acpi_ut_release_owner_id (obj_desc->method.owner_id); + cleanup: acpi_ps_delete_parse_tree (op); return_ACPI_STATUS (status); @@ -265,7 +270,7 @@ acpi_ds_call_control_method ( { acpi_status status; struct acpi_namespace_node *method_node; - struct acpi_walk_state *next_walk_state; + struct acpi_walk_state *next_walk_state = NULL; union acpi_operand_object *obj_desc; struct acpi_parameter_info info; u32 i; @@ -289,20 +294,23 @@ acpi_ds_call_control_method ( return_ACPI_STATUS (AE_NULL_OBJECT); } - obj_desc->method.owning_id = acpi_ut_allocate_owner_id (ACPI_OWNER_TYPE_METHOD); + status = acpi_ut_allocate_owner_id (&obj_desc->method.owner_id); + if (ACPI_FAILURE (status)) { + return_ACPI_STATUS (status); + } /* Init for new method, wait on concurrency semaphore */ status = acpi_ds_begin_method_execution (method_node, obj_desc, this_walk_state->method_node); if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + goto cleanup; } if (!(obj_desc->method.method_flags & AML_METHOD_INTERNAL_ONLY)) { /* 1) Parse: Create a new walk state for the preempting walk */ - next_walk_state = acpi_ds_create_walk_state (obj_desc->method.owning_id, + next_walk_state = acpi_ds_create_walk_state (obj_desc->method.owner_id, op, obj_desc, NULL); if (!next_walk_state) { return_ACPI_STATUS (AE_NO_MEMORY); @@ -332,7 +340,7 @@ acpi_ds_call_control_method ( /* 2) Execute: Create a new state for the preempting walk */ - next_walk_state = acpi_ds_create_walk_state (obj_desc->method.owning_id, + next_walk_state = acpi_ds_create_walk_state (obj_desc->method.owner_id, NULL, obj_desc, thread); if (!next_walk_state) { status = AE_NO_MEMORY; @@ -383,6 +391,7 @@ acpi_ds_call_control_method ( /* On error, we must delete the new walk state */ cleanup: + (void) acpi_ut_release_owner_id (obj_desc->method.owner_id); if (next_walk_state && (next_walk_state->method_desc)) { /* Decrement the thread count on the method parse tree */ @@ -584,7 +593,7 @@ acpi_ds_terminate_control_method ( * Delete any namespace entries created anywhere else within * the namespace */ - acpi_ns_delete_namespace_by_owner (walk_state->method_desc->method.owning_id); + acpi_ns_delete_namespace_by_owner (walk_state->method_desc->method.owner_id); status = acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); if (ACPI_FAILURE (status)) { return_ACPI_STATUS (status); diff --git a/drivers/acpi/executer/exconfig.c b/drivers/acpi/executer/exconfig.c index 8bfa6effaa0..76c6ebd0231 100644 --- a/drivers/acpi/executer/exconfig.c +++ b/drivers/acpi/executer/exconfig.c @@ -487,7 +487,7 @@ acpi_ex_unload_table ( * Delete the entire namespace under this table Node * (Offset contains the table_id) */ - acpi_ns_delete_namespace_by_owner (table_info->table_id); + acpi_ns_delete_namespace_by_owner (table_info->owner_id); /* Delete the table itself */ diff --git a/drivers/acpi/executer/exdump.c b/drivers/acpi/executer/exdump.c index 7007abb6051..6158f5193f4 100644 --- a/drivers/acpi/executer/exdump.c +++ b/drivers/acpi/executer/exdump.c @@ -819,7 +819,7 @@ acpi_ex_dump_object_descriptor ( acpi_ex_out_integer ("param_count", obj_desc->method.param_count); acpi_ex_out_integer ("Concurrency", obj_desc->method.concurrency); acpi_ex_out_pointer ("Semaphore", obj_desc->method.semaphore); - acpi_ex_out_integer ("owning_id", obj_desc->method.owning_id); + acpi_ex_out_integer ("owner_id", obj_desc->method.owner_id); acpi_ex_out_integer ("aml_length", obj_desc->method.aml_length); acpi_ex_out_pointer ("aml_start", obj_desc->method.aml_start); break; diff --git a/drivers/acpi/executer/exoparg1.c b/drivers/acpi/executer/exoparg1.c index 131f49acb1d..c1ba8b48228 100644 --- a/drivers/acpi/executer/exoparg1.c +++ b/drivers/acpi/executer/exoparg1.c @@ -904,6 +904,7 @@ acpi_ex_opcode_1A_0T_1R ( */ return_desc = acpi_ns_get_attached_object ( (struct acpi_namespace_node *) operand[0]); + acpi_ut_add_reference (return_desc); } else { /* @@ -953,20 +954,10 @@ acpi_ex_opcode_1A_0T_1R ( * add another reference to the referenced object, however. */ return_desc = *(operand[0]->reference.where); - if (!return_desc) { - /* - * We can't return a NULL dereferenced value. This is - * an uninitialized package element and is thus a - * severe error. - */ - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "NULL package element obj %p\n", - operand[0])); - status = AE_AML_UNINITIALIZED_ELEMENT; - goto cleanup; + if (return_desc) { + acpi_ut_add_reference (return_desc); } - acpi_ut_add_reference (return_desc); break; diff --git a/drivers/acpi/executer/exresop.c b/drivers/acpi/executer/exresop.c index d8b470eefe7..aaba7abcb52 100644 --- a/drivers/acpi/executer/exresop.c +++ b/drivers/acpi/executer/exresop.c @@ -426,6 +426,10 @@ acpi_ex_resolve_operands ( return_ACPI_STATUS (status); } + + if (obj_desc != *stack_ptr) { + acpi_ut_remove_reference (obj_desc); + } goto next_operand; @@ -448,6 +452,10 @@ acpi_ex_resolve_operands ( return_ACPI_STATUS (status); } + + if (obj_desc != *stack_ptr) { + acpi_ut_remove_reference (obj_desc); + } goto next_operand; @@ -471,6 +479,10 @@ acpi_ex_resolve_operands ( return_ACPI_STATUS (status); } + + if (obj_desc != *stack_ptr) { + acpi_ut_remove_reference (obj_desc); + } goto next_operand; @@ -515,6 +527,10 @@ acpi_ex_resolve_operands ( if (ACPI_FAILURE (status)) { return_ACPI_STATUS (status); } + + if (obj_desc != *stack_ptr) { + acpi_ut_remove_reference (obj_desc); + } break; default: diff --git a/drivers/acpi/namespace/nsaccess.c b/drivers/acpi/namespace/nsaccess.c index 9df0a64ba9e..0bda88d1868 100644 --- a/drivers/acpi/namespace/nsaccess.c +++ b/drivers/acpi/namespace/nsaccess.c @@ -163,7 +163,7 @@ acpi_ns_root_initialize ( /* * i_aSL Compiler cheats by putting parameter count - * in the owner_iD + * in the owner_iD (param_count max is 7) */ new_node->owner_id = obj_desc->method.param_count; #else diff --git a/drivers/acpi/namespace/nsalloc.c b/drivers/acpi/namespace/nsalloc.c index 3f94b0806ec..edbf1db36b6 100644 --- a/drivers/acpi/namespace/nsalloc.c +++ b/drivers/acpi/namespace/nsalloc.c @@ -190,7 +190,7 @@ acpi_ns_install_node ( struct acpi_namespace_node *node, /* New Child*/ acpi_object_type type) { - u16 owner_id = 0; + acpi_owner_id owner_id = 0; struct acpi_namespace_node *child_node; #ifdef ACPI_ALPHABETIC_NAMESPACE @@ -559,7 +559,7 @@ acpi_ns_remove_reference ( void acpi_ns_delete_namespace_by_owner ( - u16 owner_id) + acpi_owner_id owner_id) { struct acpi_namespace_node *child_node; struct acpi_namespace_node *deletion_node; @@ -635,6 +635,7 @@ acpi_ns_delete_namespace_by_owner ( } } + (void) acpi_ut_release_owner_id (owner_id); return_VOID; } diff --git a/drivers/acpi/namespace/nsdump.c b/drivers/acpi/namespace/nsdump.c index c9f35dd7a43..d86ccbc8a13 100644 --- a/drivers/acpi/namespace/nsdump.c +++ b/drivers/acpi/namespace/nsdump.c @@ -203,7 +203,7 @@ acpi_ns_dump_one_object ( /* Check if the owner matches */ - if ((info->owner_id != ACPI_UINT32_MAX) && + if ((info->owner_id != ACPI_OWNER_ID_MAX) && (info->owner_id != this_node->owner_id)) { return (AE_OK); } @@ -598,7 +598,7 @@ acpi_ns_dump_objects ( acpi_object_type type, u8 display_type, u32 max_depth, - u32 owner_id, + acpi_owner_id owner_id, acpi_handle start_handle) { struct acpi_walk_info info; @@ -643,7 +643,7 @@ acpi_ns_dump_entry ( info.debug_level = debug_level; - info.owner_id = ACPI_UINT32_MAX; + info.owner_id = ACPI_OWNER_ID_MAX; info.display_type = ACPI_DISPLAY_SUMMARY; (void) acpi_ns_dump_one_object (handle, 1, &info, NULL); @@ -694,7 +694,7 @@ acpi_ns_dump_tables ( } acpi_ns_dump_objects (ACPI_TYPE_ANY, ACPI_DISPLAY_OBJECTS, max_depth, - ACPI_UINT32_MAX, search_handle); + ACPI_OWNER_ID_MAX, search_handle); return_VOID; } #endif /* _ACPI_ASL_COMPILER */ diff --git a/drivers/acpi/namespace/nsparse.c b/drivers/acpi/namespace/nsparse.c index f81b836e77f..64e0b2b9f55 100644 --- a/drivers/acpi/namespace/nsparse.c +++ b/drivers/acpi/namespace/nsparse.c @@ -87,7 +87,7 @@ acpi_ns_one_complete_parse ( /* Create and initialize a new walk state */ - walk_state = acpi_ds_create_walk_state (table_desc->table_id, + walk_state = acpi_ds_create_walk_state (table_desc->owner_id, NULL, NULL, NULL); if (!walk_state) { acpi_ps_free_op (parse_root); diff --git a/drivers/acpi/parser/psloop.c b/drivers/acpi/parser/psloop.c index decb2e9a049..095672a1a72 100644 --- a/drivers/acpi/parser/psloop.c +++ b/drivers/acpi/parser/psloop.c @@ -407,9 +407,14 @@ acpi_ps_parse_loop ( INCREMENT_ARG_LIST (walk_state->arg_types); } + /* Special processing for certain opcodes */ - if ((walk_state->pass_number <= ACPI_IMODE_LOAD_PASS1) && + /* TBD (remove): Temporary mechanism to disable this code if needed */ + +#ifndef ACPI_NO_MODULE_LEVEL_CODE + + if ((walk_state->pass_number <= ACPI_IMODE_LOAD_PASS1) && ((walk_state->parse_flags & ACPI_PARSE_DISASSEMBLE) == 0)) { /* * We want to skip If/Else/While constructs during Pass1 @@ -434,7 +439,7 @@ acpi_ps_parse_loop ( break; } } - +#endif switch (op->common.aml_opcode) { case AML_METHOD_OP: diff --git a/drivers/acpi/parser/psxface.c b/drivers/acpi/parser/psxface.c index dba893648e8..5279b51e778 100644 --- a/drivers/acpi/parser/psxface.c +++ b/drivers/acpi/parser/psxface.c @@ -138,11 +138,14 @@ acpi_psx_execute ( * objects (such as Operation Regions) can be created during the * first pass parse. */ - obj_desc->method.owning_id = acpi_ut_allocate_owner_id (ACPI_OWNER_TYPE_METHOD); + status = acpi_ut_allocate_owner_id (&obj_desc->method.owner_id); + if (ACPI_FAILURE (status)) { + goto cleanup2; + } /* Create and initialize a new walk state */ - walk_state = acpi_ds_create_walk_state (obj_desc->method.owning_id, + walk_state = acpi_ds_create_walk_state (obj_desc->method.owner_id, NULL, NULL, NULL); if (!walk_state) { status = AE_NO_MEMORY; diff --git a/drivers/acpi/tables/tbinstal.c b/drivers/acpi/tables/tbinstal.c index 629b64c8193..2ad72f20455 100644 --- a/drivers/acpi/tables/tbinstal.c +++ b/drivers/acpi/tables/tbinstal.c @@ -251,6 +251,7 @@ acpi_tb_init_table_descriptor ( { struct acpi_table_list *list_head; struct acpi_table_desc *table_desc; + acpi_status status; ACPI_FUNCTION_TRACE_U32 ("tb_init_table_descriptor", table_type); @@ -263,6 +264,13 @@ acpi_tb_init_table_descriptor ( return_ACPI_STATUS (AE_NO_MEMORY); } + /* Get a new owner ID for the table */ + + status = acpi_ut_allocate_owner_id (&table_desc->owner_id); + if (ACPI_FAILURE (status)) { + return_ACPI_STATUS (status); + } + /* Install the table into the global data structure */ list_head = &acpi_gbl_table_lists[table_type]; @@ -325,8 +333,6 @@ acpi_tb_init_table_descriptor ( table_desc->aml_start = (u8 *) (table_desc->pointer + 1), table_desc->aml_length = (u32) (table_desc->length - (u32) sizeof (struct acpi_table_header)); - table_desc->table_id = acpi_ut_allocate_owner_id ( - ACPI_OWNER_TYPE_TABLE); table_desc->loaded_into_namespace = FALSE; /* @@ -339,7 +345,7 @@ acpi_tb_init_table_descriptor ( /* Return Data */ - table_info->table_id = table_desc->table_id; + table_info->owner_id = table_desc->owner_id; table_info->installed_desc = table_desc; return_ACPI_STATUS (AE_OK); diff --git a/drivers/acpi/tables/tbrsdt.c b/drivers/acpi/tables/tbrsdt.c index 13c6ddb2f54..069d498465d 100644 --- a/drivers/acpi/tables/tbrsdt.c +++ b/drivers/acpi/tables/tbrsdt.c @@ -96,32 +96,13 @@ acpi_tb_verify_rsdp ( return_ACPI_STATUS (AE_BAD_PARAMETER); } - /* - * The signature and checksum must both be correct - */ - if (ACPI_STRNCMP ((char *) rsdp, RSDP_SIG, sizeof (RSDP_SIG)-1) != 0) { - /* Nope, BAD Signature */ - - status = AE_BAD_SIGNATURE; - goto cleanup; - } - - /* Check the standard checksum */ + /* Verify RSDP signature and checksum */ - if (acpi_tb_checksum (rsdp, ACPI_RSDP_CHECKSUM_LENGTH) != 0) { - status = AE_BAD_CHECKSUM; + status = acpi_tb_validate_rsdp (rsdp); + if (ACPI_FAILURE (status)) { goto cleanup; } - /* Check extended checksum if table version >= 2 */ - - if (rsdp->revision >= 2) { - if (acpi_tb_checksum (rsdp, ACPI_RSDP_XCHECKSUM_LENGTH) != 0) { - status = AE_BAD_CHECKSUM; - goto cleanup; - } - } - /* The RSDP supplied is OK */ table_info.pointer = ACPI_CAST_PTR (struct acpi_table_header, rsdp); diff --git a/drivers/acpi/tables/tbxface.c b/drivers/acpi/tables/tbxface.c index 0c0b9085dbe..ca2dbdd23ed 100644 --- a/drivers/acpi/tables/tbxface.c +++ b/drivers/acpi/tables/tbxface.c @@ -260,8 +260,7 @@ acpi_unload_table ( * "Scope" operator. Thus, we need to track ownership by an ID, not * simply a position within the hierarchy */ - acpi_ns_delete_namespace_by_owner (table_desc->table_id); - + acpi_ns_delete_namespace_by_owner (table_desc->owner_id); table_desc = table_desc->next; } diff --git a/drivers/acpi/tables/tbxfroot.c b/drivers/acpi/tables/tbxfroot.c index fe9c8317df4..abb4c934656 100644 --- a/drivers/acpi/tables/tbxfroot.c +++ b/drivers/acpi/tables/tbxfroot.c @@ -63,6 +63,51 @@ acpi_tb_scan_memory_for_rsdp ( u32 length); +/******************************************************************************* + * + * FUNCTION: acpi_tb_validate_rsdp + * + * PARAMETERS: Rsdp - Pointer to unvalidated RSDP + * + * RETURN: Status + * + * DESCRIPTION: Validate the RSDP (ptr) + * + ******************************************************************************/ + +acpi_status +acpi_tb_validate_rsdp ( + struct rsdp_descriptor *rsdp) +{ + ACPI_FUNCTION_ENTRY (); + + + /* + * The signature and checksum must both be correct + */ + if (ACPI_STRNCMP ((char *) rsdp, RSDP_SIG, sizeof (RSDP_SIG)-1) != 0) { + /* Nope, BAD Signature */ + + return (AE_BAD_SIGNATURE); + } + + /* Check the standard checksum */ + + if (acpi_tb_checksum (rsdp, ACPI_RSDP_CHECKSUM_LENGTH) != 0) { + return (AE_BAD_CHECKSUM); + } + + /* Check extended checksum if table version >= 2 */ + + if ((rsdp->revision >= 2) && + (acpi_tb_checksum (rsdp, ACPI_RSDP_XCHECKSUM_LENGTH) != 0)) { + return (AE_BAD_CHECKSUM); + } + + return (AE_OK); +} + + /******************************************************************************* * * FUNCTION: acpi_tb_find_table @@ -218,19 +263,11 @@ acpi_get_firmware_table ( acpi_gbl_RSDP = address.pointer.logical; } - /* The signature and checksum must both be correct */ - - if (ACPI_STRNCMP ((char *) acpi_gbl_RSDP, RSDP_SIG, - sizeof (RSDP_SIG)-1) != 0) { - /* Nope, BAD Signature */ + /* The RDSP signature and checksum must both be correct */ - return_ACPI_STATUS (AE_BAD_SIGNATURE); - } - - if (acpi_tb_checksum (acpi_gbl_RSDP, ACPI_RSDP_CHECKSUM_LENGTH) != 0) { - /* Nope, BAD Checksum */ - - return_ACPI_STATUS (AE_BAD_CHECKSUM); + status = acpi_tb_validate_rsdp (acpi_gbl_RSDP); + if (ACPI_FAILURE (status)) { + return_ACPI_STATUS (status); } } @@ -414,9 +451,9 @@ acpi_tb_scan_memory_for_rsdp ( u8 *start_address, u32 length) { + acpi_status status; u8 *mem_rover; u8 *end_address; - u8 checksum; ACPI_FUNCTION_TRACE ("tb_scan_memory_for_rsdp"); @@ -428,45 +465,25 @@ acpi_tb_scan_memory_for_rsdp ( for (mem_rover = start_address; mem_rover < end_address; mem_rover += ACPI_RSDP_SCAN_STEP) { - /* The signature and checksum must both be correct */ + /* The RSDP signature and checksum must both be correct */ - if (ACPI_STRNCMP ((char *) mem_rover, - RSDP_SIG, sizeof (RSDP_SIG) - 1) != 0) { - /* No signature match, keep looking */ - - continue; - } - - /* Signature matches, check the appropriate checksum */ - - if ((ACPI_CAST_PTR (struct rsdp_descriptor, mem_rover))->revision < 2) { - /* ACPI version 1.0 */ - - checksum = acpi_tb_checksum (mem_rover, ACPI_RSDP_CHECKSUM_LENGTH); - } - else { - /* Post ACPI 1.0, use extended_checksum */ - - checksum = acpi_tb_checksum (mem_rover, ACPI_RSDP_XCHECKSUM_LENGTH); - } - - if (checksum == 0) { - /* Checksum valid, we have found a valid RSDP */ + status = acpi_tb_validate_rsdp (ACPI_CAST_PTR (struct rsdp_descriptor, mem_rover)); + if (ACPI_SUCCESS (status)) { + /* Sig and checksum valid, we have found a real RSDP */ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "RSDP located at physical address %p\n", mem_rover)); return_PTR (mem_rover); } - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "Found an RSDP at physical address %p, but it has a bad checksum\n", - mem_rover)); + /* No sig match or bad checksum, keep searching */ } /* Searched entire block, no RSDP was found */ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "Searched entire block, no valid RSDP was found.\n")); + "Searched entire block from %p, valid RSDP was not found\n", + start_address)); return_PTR (NULL); } @@ -554,7 +571,7 @@ acpi_tb_find_rsdp ( acpi_os_unmap_memory (table_ptr, ACPI_EBDA_WINDOW_SIZE); if (mem_rover) { - /* Found it, return the physical address */ + /* Return the physical address */ physical_address += ACPI_PTR_DIFF (mem_rover, table_ptr); @@ -583,7 +600,7 @@ acpi_tb_find_rsdp ( acpi_os_unmap_memory (table_ptr, ACPI_HI_RSDP_WINDOW_SIZE); if (mem_rover) { - /* Found it, return the physical address */ + /* Return the physical address */ physical_address = ACPI_HI_RSDP_WINDOW_BASE + ACPI_PTR_DIFF (mem_rover, table_ptr); @@ -614,7 +631,7 @@ acpi_tb_find_rsdp ( ACPI_PHYSADDR_TO_PTR (physical_address), ACPI_EBDA_WINDOW_SIZE); if (mem_rover) { - /* Found it, return the physical address */ + /* Return the physical address */ table_info->physical_address = ACPI_TO_INTEGER (mem_rover); return_ACPI_STATUS (AE_OK); @@ -634,8 +651,9 @@ acpi_tb_find_rsdp ( } } - /* RSDP signature was not found */ + /* A valid RSDP was not found */ + ACPI_REPORT_ERROR (("No valid RSDP was found\n")); return_ACPI_STATUS (AE_NOT_FOUND); } diff --git a/drivers/acpi/utilities/utcache.c b/drivers/acpi/utilities/utcache.c index 07588812e72..c0df0585c68 100644 --- a/drivers/acpi/utilities/utcache.c +++ b/drivers/acpi/utilities/utcache.c @@ -74,6 +74,9 @@ acpi_os_create_cache ( struct acpi_memory_list *cache; + ACPI_FUNCTION_ENTRY (); + + if (!cache_name || !return_cache || (object_size < 16)) { return (AE_BAD_PARAMETER); } @@ -161,7 +164,10 @@ acpi_os_delete_cache ( acpi_status status; - /* Purge all objects in the cache */ + ACPI_FUNCTION_ENTRY (); + + + /* Purge all objects in the cache */ status = acpi_os_purge_cache (cache); if (ACPI_FAILURE (status)) { @@ -259,7 +265,7 @@ acpi_os_acquire_object ( void *object; - ACPI_FUNCTION_NAME ("ut_acquire_from_cache"); + ACPI_FUNCTION_NAME ("os_acquire_object"); if (!cache) { @@ -286,7 +292,7 @@ acpi_os_acquire_object ( ACPI_MEM_TRACKING (cache->hits++); ACPI_MEM_TRACKING (ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "Object %p from %s\n", object, cache->list_name))); + "Object %p from %s cache\n", object, cache->list_name))); status = acpi_ut_release_mutex (ACPI_MTX_CACHES); if (ACPI_FAILURE (status)) { diff --git a/drivers/acpi/utilities/utdebug.c b/drivers/acpi/utilities/utdebug.c index 08362f686ec..3d5fbc810b0 100644 --- a/drivers/acpi/utilities/utdebug.c +++ b/drivers/acpi/utilities/utdebug.c @@ -116,10 +116,9 @@ acpi_ut_track_stack_ptr ( * * PARAMETERS: requested_debug_level - Requested debug print level * line_number - Caller's line number (for error output) - * dbg_info - Contains: - * proc_name - Caller's procedure name - * module_name - Caller's module name - * component_id - Caller's component ID + * function_name - Caller's procedure name + * module_name - Caller's module name + * component_id - Caller's component ID * Format - Printf format field * ... - Optional printf arguments * @@ -134,7 +133,9 @@ void ACPI_INTERNAL_VAR_XFACE acpi_ut_debug_print ( u32 requested_debug_level, u32 line_number, - struct acpi_debug_print_info *dbg_info, + char *function_name, + char *module_name, + u32 component_id, char *format, ...) { @@ -146,7 +147,7 @@ acpi_ut_debug_print ( * Stay silent if the debug level or component ID is disabled */ if (!(requested_debug_level & acpi_dbg_level) || - !(dbg_info->component_id & acpi_dbg_layer)) { + !(component_id & acpi_dbg_layer)) { return; } @@ -169,14 +170,14 @@ acpi_ut_debug_print ( * Display the module name, current line number, thread ID (if requested), * current procedure nesting level, and the current procedure name */ - acpi_os_printf ("%8s-%04ld ", dbg_info->module_name, line_number); + acpi_os_printf ("%8s-%04ld ", module_name, line_number); if (ACPI_LV_THREADS & acpi_dbg_level) { acpi_os_printf ("[%04lX] ", thread_id); } acpi_os_printf ("[%02ld] %-22.22s: ", - acpi_gbl_nesting_level, dbg_info->proc_name); + acpi_gbl_nesting_level, function_name); va_start (args, format); acpi_os_vprintf (format, args); @@ -190,10 +191,9 @@ EXPORT_SYMBOL(acpi_ut_debug_print); * * PARAMETERS: requested_debug_level - Requested debug print level * line_number - Caller's line number - * dbg_info - Contains: - * proc_name - Caller's procedure name - * module_name - Caller's module name - * component_id - Caller's component ID + * function_name - Caller's procedure name + * module_name - Caller's module name + * component_id - Caller's component ID * Format - Printf format field * ... - Optional printf arguments * @@ -208,7 +208,9 @@ void ACPI_INTERNAL_VAR_XFACE acpi_ut_debug_print_raw ( u32 requested_debug_level, u32 line_number, - struct acpi_debug_print_info *dbg_info, + char *function_name, + char *module_name, + u32 component_id, char *format, ...) { @@ -216,7 +218,7 @@ acpi_ut_debug_print_raw ( if (!(requested_debug_level & acpi_dbg_level) || - !(dbg_info->component_id & acpi_dbg_layer)) { + !(component_id & acpi_dbg_layer)) { return; } @@ -231,10 +233,9 @@ EXPORT_SYMBOL(acpi_ut_debug_print_raw); * FUNCTION: acpi_ut_trace * * PARAMETERS: line_number - Caller's line number - * dbg_info - Contains: - * proc_name - Caller's procedure name - * module_name - Caller's module name - * component_id - Caller's component ID + * function_name - Caller's procedure name + * module_name - Caller's module name + * component_id - Caller's component ID * * RETURN: None * @@ -246,14 +247,17 @@ EXPORT_SYMBOL(acpi_ut_debug_print_raw); void acpi_ut_trace ( u32 line_number, - struct acpi_debug_print_info *dbg_info) + char *function_name, + char *module_name, + u32 component_id) { acpi_gbl_nesting_level++; acpi_ut_track_stack_ptr (); - acpi_ut_debug_print (ACPI_LV_FUNCTIONS, line_number, dbg_info, - "%s\n", acpi_gbl_fn_entry_str); + acpi_ut_debug_print (ACPI_LV_FUNCTIONS, + line_number, function_name, module_name, component_id, + "%s\n", acpi_gbl_fn_entry_str); } EXPORT_SYMBOL(acpi_ut_trace); @@ -263,10 +267,9 @@ EXPORT_SYMBOL(acpi_ut_trace); * FUNCTION: acpi_ut_trace_ptr * * PARAMETERS: line_number - Caller's line number - * dbg_info - Contains: - * proc_name - Caller's procedure name - * module_name - Caller's module name - * component_id - Caller's component ID + * function_name - Caller's procedure name + * module_name - Caller's module name + * component_id - Caller's component ID * Pointer - Pointer to display * * RETURN: None @@ -279,14 +282,17 @@ EXPORT_SYMBOL(acpi_ut_trace); void acpi_ut_trace_ptr ( u32 line_number, - struct acpi_debug_print_info *dbg_info, + char *function_name, + char *module_name, + u32 component_id, void *pointer) { acpi_gbl_nesting_level++; acpi_ut_track_stack_ptr (); - acpi_ut_debug_print (ACPI_LV_FUNCTIONS, line_number, dbg_info, - "%s %p\n", acpi_gbl_fn_entry_str, pointer); + acpi_ut_debug_print (ACPI_LV_FUNCTIONS, + line_number, function_name, module_name, component_id, + "%s %p\n", acpi_gbl_fn_entry_str, pointer); } @@ -295,10 +301,9 @@ acpi_ut_trace_ptr ( * FUNCTION: acpi_ut_trace_str * * PARAMETERS: line_number - Caller's line number - * dbg_info - Contains: - * proc_name - Caller's procedure name - * module_name - Caller's module name - * component_id - Caller's component ID + * function_name - Caller's procedure name + * module_name - Caller's module name + * component_id - Caller's component ID * String - Additional string to display * * RETURN: None @@ -311,15 +316,18 @@ acpi_ut_trace_ptr ( void acpi_ut_trace_str ( u32 line_number, - struct acpi_debug_print_info *dbg_info, + char *function_name, + char *module_name, + u32 component_id, char *string) { acpi_gbl_nesting_level++; acpi_ut_track_stack_ptr (); - acpi_ut_debug_print (ACPI_LV_FUNCTIONS, line_number, dbg_info, - "%s %s\n", acpi_gbl_fn_entry_str, string); + acpi_ut_debug_print (ACPI_LV_FUNCTIONS, + line_number, function_name, module_name, component_id, + "%s %s\n", acpi_gbl_fn_entry_str, string); } @@ -328,10 +336,9 @@ acpi_ut_trace_str ( * FUNCTION: acpi_ut_trace_u32 * * PARAMETERS: line_number - Caller's line number - * dbg_info - Contains: - * proc_name - Caller's procedure name - * module_name - Caller's module name - * component_id - Caller's component ID + * function_name - Caller's procedure name + * module_name - Caller's module name + * component_id - Caller's component ID * Integer - Integer to display * * RETURN: None @@ -344,15 +351,18 @@ acpi_ut_trace_str ( void acpi_ut_trace_u32 ( u32 line_number, - struct acpi_debug_print_info *dbg_info, + char *function_name, + char *module_name, + u32 component_id, u32 integer) { acpi_gbl_nesting_level++; acpi_ut_track_stack_ptr (); - acpi_ut_debug_print (ACPI_LV_FUNCTIONS, line_number, dbg_info, - "%s %08X\n", acpi_gbl_fn_entry_str, integer); + acpi_ut_debug_print (ACPI_LV_FUNCTIONS, + line_number, function_name, module_name, component_id, + "%s %08X\n", acpi_gbl_fn_entry_str, integer); } @@ -361,10 +371,9 @@ acpi_ut_trace_u32 ( * FUNCTION: acpi_ut_exit * * PARAMETERS: line_number - Caller's line number - * dbg_info - Contains: - * proc_name - Caller's procedure name - * module_name - Caller's module name - * component_id - Caller's component ID + * function_name - Caller's procedure name + * module_name - Caller's module name + * component_id - Caller's component ID * * RETURN: None * @@ -376,11 +385,14 @@ acpi_ut_trace_u32 ( void acpi_ut_exit ( u32 line_number, - struct acpi_debug_print_info *dbg_info) + char *function_name, + char *module_name, + u32 component_id) { - acpi_ut_debug_print (ACPI_LV_FUNCTIONS, line_number, dbg_info, - "%s\n", acpi_gbl_fn_exit_str); + acpi_ut_debug_print (ACPI_LV_FUNCTIONS, + line_number, function_name, module_name, component_id, + "%s\n", acpi_gbl_fn_exit_str); acpi_gbl_nesting_level--; } @@ -392,10 +404,9 @@ EXPORT_SYMBOL(acpi_ut_exit); * FUNCTION: acpi_ut_status_exit * * PARAMETERS: line_number - Caller's line number - * dbg_info - Contains: - * proc_name - Caller's procedure name - * module_name - Caller's module name - * component_id - Caller's component ID + * function_name - Caller's procedure name + * module_name - Caller's module name + * component_id - Caller's component ID * Status - Exit status code * * RETURN: None @@ -408,19 +419,23 @@ EXPORT_SYMBOL(acpi_ut_exit); void acpi_ut_status_exit ( u32 line_number, - struct acpi_debug_print_info *dbg_info, + char *function_name, + char *module_name, + u32 component_id, acpi_status status) { if (ACPI_SUCCESS (status)) { - acpi_ut_debug_print (ACPI_LV_FUNCTIONS, line_number, dbg_info, - "%s %s\n", acpi_gbl_fn_exit_str, - acpi_format_exception (status)); + acpi_ut_debug_print (ACPI_LV_FUNCTIONS, + line_number, function_name, module_name, component_id, + "%s %s\n", acpi_gbl_fn_exit_str, + acpi_format_exception (status)); } else { - acpi_ut_debug_print (ACPI_LV_FUNCTIONS, line_number, dbg_info, - "%s ****Exception****: %s\n", acpi_gbl_fn_exit_str, - acpi_format_exception (status)); + acpi_ut_debug_print (ACPI_LV_FUNCTIONS, + line_number, function_name, module_name, component_id, + "%s ****Exception****: %s\n", acpi_gbl_fn_exit_str, + acpi_format_exception (status)); } acpi_gbl_nesting_level--; @@ -433,10 +448,9 @@ EXPORT_SYMBOL(acpi_ut_status_exit); * FUNCTION: acpi_ut_value_exit * * PARAMETERS: line_number - Caller's line number - * dbg_info - Contains: - * proc_name - Caller's procedure name - * module_name - Caller's module name - * component_id - Caller's component ID + * function_name - Caller's procedure name + * module_name - Caller's module name + * component_id - Caller's component ID * Value - Value to be printed with exit msg * * RETURN: None @@ -449,13 +463,16 @@ EXPORT_SYMBOL(acpi_ut_status_exit); void acpi_ut_value_exit ( u32 line_number, - struct acpi_debug_print_info *dbg_info, + char *function_name, + char *module_name, + u32 component_id, acpi_integer value) { - acpi_ut_debug_print (ACPI_LV_FUNCTIONS, line_number, dbg_info, - "%s %8.8X%8.8X\n", acpi_gbl_fn_exit_str, - ACPI_FORMAT_UINT64 (value)); + acpi_ut_debug_print (ACPI_LV_FUNCTIONS, + line_number, function_name, module_name, component_id, + "%s %8.8X%8.8X\n", acpi_gbl_fn_exit_str, + ACPI_FORMAT_UINT64 (value)); acpi_gbl_nesting_level--; } @@ -467,10 +484,9 @@ EXPORT_SYMBOL(acpi_ut_value_exit); * FUNCTION: acpi_ut_ptr_exit * * PARAMETERS: line_number - Caller's line number - * dbg_info - Contains: - * proc_name - Caller's procedure name - * module_name - Caller's module name - * component_id - Caller's component ID + * function_name - Caller's procedure name + * module_name - Caller's module name + * component_id - Caller's component ID * Ptr - Pointer to display * * RETURN: None @@ -483,12 +499,15 @@ EXPORT_SYMBOL(acpi_ut_value_exit); void acpi_ut_ptr_exit ( u32 line_number, - struct acpi_debug_print_info *dbg_info, + char *function_name, + char *module_name, + u32 component_id, u8 *ptr) { - acpi_ut_debug_print (ACPI_LV_FUNCTIONS, line_number, dbg_info, - "%s %p\n", acpi_gbl_fn_exit_str, ptr); + acpi_ut_debug_print (ACPI_LV_FUNCTIONS, + line_number, function_name, module_name, component_id, + "%s %p\n", acpi_gbl_fn_exit_str, ptr); acpi_gbl_nesting_level--; } diff --git a/drivers/acpi/utilities/utdelete.c b/drivers/acpi/utilities/utdelete.c index be97ada23c3..eeafb324c50 100644 --- a/drivers/acpi/utilities/utdelete.c +++ b/drivers/acpi/utilities/utdelete.c @@ -435,35 +435,24 @@ acpi_ut_update_object_reference ( union acpi_operand_object *object, u16 action) { - acpi_status status; - u32 i; - union acpi_generic_state *state_list = NULL; - union acpi_generic_state *state; + acpi_status status = AE_OK; + union acpi_generic_state *state_list = NULL; + union acpi_operand_object *next_object = NULL; + union acpi_generic_state *state; + acpi_native_uint i; ACPI_FUNCTION_TRACE_PTR ("ut_update_object_reference", object); - /* Ignore a null object ptr */ + while (object) { + /* Make sure that this isn't a namespace handle */ - if (!object) { - return_ACPI_STATUS (AE_OK); - } - - /* Make sure that this isn't a namespace handle */ - - if (ACPI_GET_DESCRIPTOR_TYPE (object) == ACPI_DESC_TYPE_NAMED) { - ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, - "Object %p is NS handle\n", object)); - return_ACPI_STATUS (AE_OK); - } - - state = acpi_ut_create_update_state (object, action); - - while (state) { - object = state->update.object; - action = state->update.value; - acpi_ut_delete_generic_state (state); + if (ACPI_GET_DESCRIPTOR_TYPE (object) == ACPI_DESC_TYPE_NAMED) { + ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, + "Object %p is NS handle\n", object)); + return_ACPI_STATUS (AE_OK); + } /* * All sub-objects must have their reference count incremented also. @@ -476,12 +465,10 @@ acpi_ut_update_object_reference ( acpi_ut_update_ref_count (object->device.device_notify, action); break; - case ACPI_TYPE_PACKAGE: - /* - * We must update all the sub-objects of the package - * (Each of whom may have their own sub-objects, etc. + * We must update all the sub-objects of the package, + * each of whom may have their own sub-objects. */ for (i = 0; i < object->package.count; i++) { /* @@ -497,35 +484,19 @@ acpi_ut_update_object_reference ( } break; - case ACPI_TYPE_BUFFER_FIELD: - status = acpi_ut_create_update_state_and_push ( - object->buffer_field.buffer_obj, action, &state_list); - if (ACPI_FAILURE (status)) { - goto error_exit; - } + next_object = object->buffer_field.buffer_obj; break; - case ACPI_TYPE_LOCAL_REGION_FIELD: - status = acpi_ut_create_update_state_and_push ( - object->field.region_obj, action, &state_list); - if (ACPI_FAILURE (status)) { - goto error_exit; - } - break; - + next_object = object->field.region_obj; + break; case ACPI_TYPE_LOCAL_BANK_FIELD: - status = acpi_ut_create_update_state_and_push ( - object->bank_field.bank_obj, action, &state_list); - if (ACPI_FAILURE (status)) { - goto error_exit; - } - + next_object = object->bank_field.bank_obj; status = acpi_ut_create_update_state_and_push ( object->bank_field.region_obj, action, &state_list); if (ACPI_FAILURE (status)) { @@ -533,15 +504,9 @@ acpi_ut_update_object_reference ( } break; - case ACPI_TYPE_LOCAL_INDEX_FIELD: - status = acpi_ut_create_update_state_and_push ( - object->index_field.index_obj, action, &state_list); - if (ACPI_FAILURE (status)) { - goto error_exit; - } - + next_object = object->index_field.index_obj; status = acpi_ut_create_update_state_and_push ( object->index_field.data_obj, action, &state_list); if (ACPI_FAILURE (status)) { @@ -549,28 +514,19 @@ acpi_ut_update_object_reference ( } break; - case ACPI_TYPE_LOCAL_REFERENCE: - /* * The target of an Index (a package, string, or buffer) must track * changes to the ref count of the index. */ if (object->reference.opcode == AML_INDEX_OP) { - status = acpi_ut_create_update_state_and_push ( - object->reference.object, action, &state_list); - if (ACPI_FAILURE (status)) { - goto error_exit; - } + next_object = object->reference.object; } break; - case ACPI_TYPE_REGION: default: - - /* No subobjects */ - break; + break;/* No subobjects */ } /* @@ -579,15 +535,23 @@ acpi_ut_update_object_reference ( * main object to be deleted. */ acpi_ut_update_ref_count (object, action); + object = NULL; /* Move on to the next object to be updated */ - state = acpi_ut_pop_generic_state (&state_list); + if (next_object) { + object = next_object; + next_object = NULL; + } + else if (state_list) { + state = acpi_ut_pop_generic_state (&state_list); + object = state->update.object; + acpi_ut_delete_generic_state (state); + } } return_ACPI_STATUS (AE_OK); - error_exit: ACPI_REPORT_ERROR (("Could not update object reference count, %s\n", diff --git a/drivers/acpi/utilities/utglobal.c b/drivers/acpi/utilities/utglobal.c index 8653dda4f81..0e4161c8107 100644 --- a/drivers/acpi/utilities/utglobal.c +++ b/drivers/acpi/utilities/utglobal.c @@ -736,73 +736,6 @@ acpi_ut_valid_object_type ( } -/******************************************************************************* - * - * FUNCTION: acpi_ut_allocate_owner_id - * - * PARAMETERS: id_type - Type of ID (method or table) - * - * DESCRIPTION: Allocate a table or method owner id - * - * NOTE: this algorithm has a wraparound problem at 64_k method invocations, and - * should be revisited (TBD) - * - ******************************************************************************/ - -acpi_owner_id -acpi_ut_allocate_owner_id ( - u32 id_type) -{ - acpi_owner_id owner_id = 0xFFFF; - - - ACPI_FUNCTION_TRACE ("ut_allocate_owner_id"); - - - if (ACPI_FAILURE (acpi_ut_acquire_mutex (ACPI_MTX_CACHES))) - { - return (0); - } - - switch (id_type) - { - case ACPI_OWNER_TYPE_TABLE: - - owner_id = acpi_gbl_next_table_owner_id; - acpi_gbl_next_table_owner_id++; - - /* Check for wraparound */ - - if (acpi_gbl_next_table_owner_id == ACPI_FIRST_METHOD_ID) - { - acpi_gbl_next_table_owner_id = ACPI_FIRST_TABLE_ID; - ACPI_REPORT_WARNING (("Table owner ID wraparound\n")); - } - break; - - - case ACPI_OWNER_TYPE_METHOD: - - owner_id = acpi_gbl_next_method_owner_id; - acpi_gbl_next_method_owner_id++; - - if (acpi_gbl_next_method_owner_id == ACPI_FIRST_TABLE_ID) - { - /* Check for wraparound */ - - acpi_gbl_next_method_owner_id = ACPI_FIRST_METHOD_ID; - } - break; - - default: - break; - } - - (void) acpi_ut_release_mutex (ACPI_MTX_CACHES); - return_VALUE (owner_id); -} - - /******************************************************************************* * * FUNCTION: acpi_ut_init_globals @@ -848,7 +781,7 @@ acpi_ut_init_globals ( for (i = 0; i < NUM_MUTEX; i++) { acpi_gbl_mutex_info[i].mutex = NULL; - acpi_gbl_mutex_info[i].owner_id = ACPI_MUTEX_NOT_ACQUIRED; + acpi_gbl_mutex_info[i].thread_id = ACPI_MUTEX_NOT_ACQUIRED; acpi_gbl_mutex_info[i].use_count = 0; } @@ -889,8 +822,7 @@ acpi_ut_init_globals ( acpi_gbl_ns_lookup_count = 0; acpi_gbl_ps_find_count = 0; acpi_gbl_acpi_hardware_present = TRUE; - acpi_gbl_next_table_owner_id = ACPI_FIRST_TABLE_ID; - acpi_gbl_next_method_owner_id = ACPI_FIRST_METHOD_ID; + acpi_gbl_owner_id_mask = 0; acpi_gbl_debugger_configuration = DEBUGGER_THREADING; acpi_gbl_db_output_flags = ACPI_DB_CONSOLE_OUTPUT; diff --git a/drivers/acpi/utilities/utmisc.c b/drivers/acpi/utilities/utmisc.c index 207c836aec6..df715cd8910 100644 --- a/drivers/acpi/utilities/utmisc.c +++ b/drivers/acpi/utilities/utmisc.c @@ -50,6 +50,100 @@ ACPI_MODULE_NAME ("utmisc") +/******************************************************************************* + * + * FUNCTION: acpi_ut_allocate_owner_id + * + * PARAMETERS: owner_id - Where the new owner ID is returned + * + * DESCRIPTION: Allocate a table or method owner id + * + ******************************************************************************/ + +acpi_status +acpi_ut_allocate_owner_id ( + acpi_owner_id *owner_id) +{ + acpi_native_uint i; + acpi_status status; + + + ACPI_FUNCTION_TRACE ("ut_allocate_owner_id"); + + + status = acpi_ut_acquire_mutex (ACPI_MTX_CACHES); + if (ACPI_FAILURE (status)) { + return_ACPI_STATUS (status); + } + + /* Find a free owner ID */ + + for (i = 0; i < 32; i++) { + if (!(acpi_gbl_owner_id_mask & (1 << i))) { + acpi_gbl_owner_id_mask |= (1 << i); + *owner_id = (acpi_owner_id) i; + goto exit; + } + } + + /* + * If we are here, all owner_ids have been allocated. This probably should + * not happen since the IDs are reused after deallocation. The IDs are + * allocated upon table load (one per table) and method execution, and + * they are released when a table is unloaded or a method completes + * execution. + */ + status = AE_OWNER_ID_LIMIT; + ACPI_REPORT_ERROR (( + "Could not allocate new owner_id (32 max), AE_OWNER_ID_LIMIT\n")); + +exit: + (void) acpi_ut_release_mutex (ACPI_MTX_CACHES); + return_ACPI_STATUS (status); +} + + +/******************************************************************************* + * + * FUNCTION: acpi_ut_release_owner_id + * + * PARAMETERS: owner_id - A previously allocated owner ID + * + * DESCRIPTION: Release a table or method owner id + * + ******************************************************************************/ + +acpi_status +acpi_ut_release_owner_id ( + acpi_owner_id owner_id) +{ + acpi_status status; + + + ACPI_FUNCTION_TRACE ("ut_release_owner_id"); + + + status = acpi_ut_acquire_mutex (ACPI_MTX_CACHES); + if (ACPI_FAILURE (status)) { + return_ACPI_STATUS (status); + } + + /* Free the owner ID */ + + if (acpi_gbl_owner_id_mask & (1 << owner_id)) { + acpi_gbl_owner_id_mask ^= (1 << owner_id); + } + else { + /* This owner_id has not been allocated */ + + status = AE_NOT_EXIST; + } + + (void) acpi_ut_release_mutex (ACPI_MTX_CACHES); + return_ACPI_STATUS (status); +} + + /******************************************************************************* * * FUNCTION: acpi_ut_strupr (strupr) diff --git a/drivers/acpi/utilities/utmutex.c b/drivers/acpi/utilities/utmutex.c index a80b97cb2e5..0699b6be62b 100644 --- a/drivers/acpi/utilities/utmutex.c +++ b/drivers/acpi/utilities/utmutex.c @@ -159,7 +159,7 @@ acpi_ut_create_mutex ( if (!acpi_gbl_mutex_info[mutex_id].mutex) { status = acpi_os_create_semaphore (1, 1, &acpi_gbl_mutex_info[mutex_id].mutex); - acpi_gbl_mutex_info[mutex_id].owner_id = ACPI_MUTEX_NOT_ACQUIRED; + acpi_gbl_mutex_info[mutex_id].thread_id = ACPI_MUTEX_NOT_ACQUIRED; acpi_gbl_mutex_info[mutex_id].use_count = 0; } @@ -196,7 +196,7 @@ acpi_ut_delete_mutex ( status = acpi_os_delete_semaphore (acpi_gbl_mutex_info[mutex_id].mutex); acpi_gbl_mutex_info[mutex_id].mutex = NULL; - acpi_gbl_mutex_info[mutex_id].owner_id = ACPI_MUTEX_NOT_ACQUIRED; + acpi_gbl_mutex_info[mutex_id].thread_id = ACPI_MUTEX_NOT_ACQUIRED; return_ACPI_STATUS (status); } @@ -274,7 +274,7 @@ acpi_ut_acquire_mutex ( this_thread_id, acpi_ut_get_mutex_name (mutex_id))); acpi_gbl_mutex_info[mutex_id].use_count++; - acpi_gbl_mutex_info[mutex_id].owner_id = this_thread_id; + acpi_gbl_mutex_info[mutex_id].thread_id = this_thread_id; } else { ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, @@ -322,7 +322,7 @@ acpi_ut_release_mutex ( /* * Mutex must be acquired in order to release it! */ - if (acpi_gbl_mutex_info[mutex_id].owner_id == ACPI_MUTEX_NOT_ACQUIRED) { + if (acpi_gbl_mutex_info[mutex_id].thread_id == ACPI_MUTEX_NOT_ACQUIRED) { ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Mutex [%s] is not acquired, cannot release\n", acpi_ut_get_mutex_name (mutex_id))); @@ -359,7 +359,7 @@ acpi_ut_release_mutex ( /* Mark unlocked FIRST */ - acpi_gbl_mutex_info[mutex_id].owner_id = ACPI_MUTEX_NOT_ACQUIRED; + acpi_gbl_mutex_info[mutex_id].thread_id = ACPI_MUTEX_NOT_ACQUIRED; status = acpi_os_signal_semaphore (acpi_gbl_mutex_info[mutex_id].mutex, 1); diff --git a/include/acpi/acconfig.h b/include/acpi/acconfig.h index dd9b70cc963..aa3c08c6da4 100644 --- a/include/acpi/acconfig.h +++ b/include/acpi/acconfig.h @@ -64,7 +64,7 @@ /* Version string */ -#define ACPI_CA_VERSION 0x20050624 +#define ACPI_CA_VERSION 0x20050708 /* * OS name, used for the _OS object. The _OS object is essentially obsolete, diff --git a/include/acpi/acdisasm.h b/include/acpi/acdisasm.h index fcc2d507fac..26325430db8 100644 --- a/include/acpi/acdisasm.h +++ b/include/acpi/acdisasm.h @@ -211,7 +211,7 @@ acpi_dm_byte_list ( union acpi_parse_object *op); void -acpi_is_eisa_id ( +acpi_dm_is_eisa_id ( union acpi_parse_object *op); void diff --git a/include/acpi/acexcep.h b/include/acpi/acexcep.h index 60d737b2d70..0a6f492f3c8 100644 --- a/include/acpi/acexcep.h +++ b/include/acpi/acexcep.h @@ -95,8 +95,9 @@ #define AE_ABORT_METHOD (acpi_status) (0x001C | AE_CODE_ENVIRONMENTAL) #define AE_SAME_HANDLER (acpi_status) (0x001D | AE_CODE_ENVIRONMENTAL) #define AE_WAKE_ONLY_GPE (acpi_status) (0x001E | AE_CODE_ENVIRONMENTAL) +#define AE_OWNER_ID_LIMIT (acpi_status) (0x001F | AE_CODE_ENVIRONMENTAL) -#define AE_CODE_ENV_MAX 0x001E +#define AE_CODE_ENV_MAX 0x001F /* @@ -226,7 +227,8 @@ char const *acpi_gbl_exception_names_env[] = "AE_LOGICAL_ADDRESS", "AE_ABORT_METHOD", "AE_SAME_HANDLER", - "AE_WAKE_ONLY_GPE" + "AE_WAKE_ONLY_GPE", + "AE_OWNER_ID_LIMIT" }; char const *acpi_gbl_exception_names_pgm[] = diff --git a/include/acpi/acglobal.h b/include/acpi/acglobal.h index 8d5a397abd6..e3cf16eadbe 100644 --- a/include/acpi/acglobal.h +++ b/include/acpi/acglobal.h @@ -218,9 +218,8 @@ ACPI_EXTERN u32 acpi_gbl_original_mode; ACPI_EXTERN u32 acpi_gbl_rsdp_original_location; ACPI_EXTERN u32 acpi_gbl_ns_lookup_count; ACPI_EXTERN u32 acpi_gbl_ps_find_count; +ACPI_EXTERN u32 acpi_gbl_owner_id_mask; ACPI_EXTERN u16 acpi_gbl_pm1_enable_register_save; -ACPI_EXTERN u16 acpi_gbl_next_table_owner_id; -ACPI_EXTERN u16 acpi_gbl_next_method_owner_id; ACPI_EXTERN u16 acpi_gbl_global_lock_handle; ACPI_EXTERN u8 acpi_gbl_debugger_configuration; ACPI_EXTERN u8 acpi_gbl_global_lock_acquired; diff --git a/include/acpi/aclocal.h b/include/acpi/aclocal.h index 58f9ba1a34e..4d2635698e1 100644 --- a/include/acpi/aclocal.h +++ b/include/acpi/aclocal.h @@ -56,6 +56,13 @@ typedef u32 acpi_mutex_handle; #define AML_NUM_OPCODES 0x7F +/* Forward declarations */ + +struct acpi_walk_state ; +struct acpi_obj_mutex; +union acpi_parse_object ; + + /***************************************************************************** * * Mutex typedefs and structs @@ -116,19 +123,24 @@ static char *acpi_gbl_mutex_names[] = #endif +/* Owner IDs are used to track namespace nodes for selective deletion */ + +typedef u8 acpi_owner_id; +#define ACPI_OWNER_ID_MAX 0xFF + +/* This Thread ID means that the mutex is not in use (unlocked) */ + +#define ACPI_MUTEX_NOT_ACQUIRED (u32) -1 + /* Table for the global mutexes */ struct acpi_mutex_info { acpi_mutex mutex; u32 use_count; - u32 owner_id; + u32 thread_id; }; -/* This owner ID means that the mutex is not in use (unlocked) */ - -#define ACPI_MUTEX_NOT_ACQUIRED (u32) (-1) - /* Lock flag parameter for various interfaces */ @@ -136,13 +148,6 @@ struct acpi_mutex_info #define ACPI_MTX_LOCK 1 -typedef u16 acpi_owner_id; -#define ACPI_OWNER_TYPE_TABLE 0x0 -#define ACPI_OWNER_TYPE_METHOD 0x1 -#define ACPI_FIRST_METHOD_ID 0x0001 -#define ACPI_FIRST_TABLE_ID 0xF000 - - /* Field access granularities */ #define ACPI_FIELD_BYTE_GRANULARITY 1 @@ -185,13 +190,20 @@ struct acpi_namespace_node { u8 descriptor; /* Used to differentiate object descriptor types */ u8 type; /* Type associated with this name */ - u16 owner_id; + u16 reference_count; /* Current count of references and children */ union acpi_name_union name; /* ACPI Name, always 4 chars per ACPI spec */ union acpi_operand_object *object; /* Pointer to attached ACPI object (optional) */ struct acpi_namespace_node *child; /* First child */ struct acpi_namespace_node *peer; /* Next peer*/ - u16 reference_count; /* Current count of references and children */ + u8 owner_id; /* Who created this node */ u8 flags; + + /* Fields used by the ASL compiler only */ + +#ifdef ACPI_ASL_COMPILER + u32 value; + union acpi_parse_object *op; +#endif }; @@ -222,7 +234,7 @@ struct acpi_table_desc u64 physical_address; u32 aml_length; acpi_size length; - acpi_owner_id table_id; + acpi_owner_id owner_id; u8 type; u8 allocation; u8 loaded_into_namespace; @@ -420,13 +432,6 @@ struct acpi_field_info #define ACPI_CONTROL_PREDICATE_TRUE 0xC4 -/* Forward declarations */ - -struct acpi_walk_state ; -struct acpi_obj_mutex; -union acpi_parse_object ; - - #define ACPI_STATE_COMMON /* Two 32-bit fields and a pointer */\ u8 data_type; /* To differentiate various internal objs */\ u8 flags; \ @@ -916,14 +921,6 @@ struct acpi_integrity_info * ****************************************************************************/ -struct acpi_debug_print_info -{ - u32 component_id; - char *proc_name; - char *module_name; -}; - - /* Entry for a memory allocation (debug only) */ #define ACPI_MEM_MALLOC 0 diff --git a/include/acpi/acmacros.h b/include/acpi/acmacros.h index 09be937d2c3..5b100cef8df 100644 --- a/include/acpi/acmacros.h +++ b/include/acpi/acmacros.h @@ -437,21 +437,22 @@ #define ACPI_PARAM_LIST(pl) pl /* - * Error reporting. These versions add callers module and line#. Since - * _THIS_MODULE gets compiled out when ACPI_DEBUG_OUTPUT isn't defined, only - * use it in debug mode. + * Error reporting. These versions add callers module and line#. + * + * Since _acpi_module_name gets compiled out when ACPI_DEBUG_OUTPUT + * isn't defined, only use it in debug mode. */ #ifdef ACPI_DEBUG_OUTPUT -#define ACPI_REPORT_INFO(fp) {acpi_ut_report_info(_THIS_MODULE,__LINE__,_COMPONENT); \ +#define ACPI_REPORT_INFO(fp) {acpi_ut_report_info(_acpi_module_name,__LINE__,_COMPONENT); \ acpi_os_printf ACPI_PARAM_LIST(fp);} -#define ACPI_REPORT_ERROR(fp) {acpi_ut_report_error(_THIS_MODULE,__LINE__,_COMPONENT); \ +#define ACPI_REPORT_ERROR(fp) {acpi_ut_report_error(_acpi_module_name,__LINE__,_COMPONENT); \ acpi_os_printf ACPI_PARAM_LIST(fp);} -#define ACPI_REPORT_WARNING(fp) {acpi_ut_report_warning(_THIS_MODULE,__LINE__,_COMPONENT); \ +#define ACPI_REPORT_WARNING(fp) {acpi_ut_report_warning(_acpi_module_name,__LINE__,_COMPONENT); \ acpi_os_printf ACPI_PARAM_LIST(fp);} -#define ACPI_REPORT_NSERROR(s,e) acpi_ns_report_error(_THIS_MODULE,__LINE__,_COMPONENT, s, e); +#define ACPI_REPORT_NSERROR(s,e) acpi_ns_report_error(_acpi_module_name,__LINE__,_COMPONENT, s, e); -#define ACPI_REPORT_METHOD_ERROR(s,n,p,e) acpi_ns_report_method_error(_THIS_MODULE,__LINE__,_COMPONENT, s, n, p, e); +#define ACPI_REPORT_METHOD_ERROR(s,n,p,e) acpi_ns_report_method_error(_acpi_module_name,__LINE__,_COMPONENT, s, n, p, e); #else @@ -480,36 +481,56 @@ * Debug macros that are conditionally compiled */ #ifdef ACPI_DEBUG_OUTPUT +#define ACPI_MODULE_NAME(name) static char ACPI_UNUSED_VAR *_acpi_module_name = name; -#define ACPI_MODULE_NAME(name) static char ACPI_UNUSED_VAR *_THIS_MODULE = name; +/* + * Common parameters used for debug output functions: + * line number, function name, module(file) name, component ID + */ +#define ACPI_DEBUG_PARAMETERS __LINE__, ACPI_GET_FUNCTION_NAME, _acpi_module_name, _COMPONENT /* - * Function entry tracing. - * The first parameter should be the procedure name as a quoted string. This is declared - * as a local string ("_proc_name) so that it can be also used by the function exit macros below. + * Function entry tracing */ -#define ACPI_FUNCTION_NAME(a) struct acpi_debug_print_info _debug_info; \ - _debug_info.component_id = _COMPONENT; \ - _debug_info.proc_name = a; \ - _debug_info.module_name = _THIS_MODULE; - -#define ACPI_FUNCTION_TRACE(a) ACPI_FUNCTION_NAME(a) \ - acpi_ut_trace(__LINE__,&_debug_info) -#define ACPI_FUNCTION_TRACE_PTR(a,b) ACPI_FUNCTION_NAME(a) \ - acpi_ut_trace_ptr(__LINE__,&_debug_info,(void *)b) -#define ACPI_FUNCTION_TRACE_U32(a,b) ACPI_FUNCTION_NAME(a) \ - acpi_ut_trace_u32(__LINE__,&_debug_info,(u32)b) -#define ACPI_FUNCTION_TRACE_STR(a,b) ACPI_FUNCTION_NAME(a) \ - acpi_ut_trace_str(__LINE__,&_debug_info,(char *)b) - -#define ACPI_FUNCTION_ENTRY() acpi_ut_track_stack_ptr() + +/* + * If ACPI_GET_FUNCTION_NAME was not defined in the compiler-dependent header, + * define it now. This is the case where there the compiler does not support + * a __FUNCTION__ macro or equivalent. We save the function name on the + * local stack. + */ +#ifndef ACPI_GET_FUNCTION_NAME +#define ACPI_GET_FUNCTION_NAME _acpi_function_name +/* + * The Name parameter should be the procedure name as a quoted string. + * This is declared as a local string ("my_function_name") so that it can + * be also used by the function exit macros below. + */ +#define ACPI_FUNCTION_NAME(name) char *_acpi_function_name = name; + +#else +/* Compiler supports __FUNCTION__ (or equivalent) -- Ignore this macro */ + +#define ACPI_FUNCTION_NAME(name) +#endif + +#define ACPI_FUNCTION_TRACE(a) ACPI_FUNCTION_NAME(a) \ + acpi_ut_trace(ACPI_DEBUG_PARAMETERS) +#define ACPI_FUNCTION_TRACE_PTR(a,b) ACPI_FUNCTION_NAME(a) \ + acpi_ut_trace_ptr(ACPI_DEBUG_PARAMETERS,(void *)b) +#define ACPI_FUNCTION_TRACE_U32(a,b) ACPI_FUNCTION_NAME(a) \ + acpi_ut_trace_u32(ACPI_DEBUG_PARAMETERS,(u32)b) +#define ACPI_FUNCTION_TRACE_STR(a,b) ACPI_FUNCTION_NAME(a) \ + acpi_ut_trace_str(ACPI_DEBUG_PARAMETERS,(char *)b) + +#define ACPI_FUNCTION_ENTRY() acpi_ut_track_stack_ptr() /* * Function exit tracing. * WARNING: These macros include a return statement. This is usually considered * bad form, but having a separate exit macro is very ugly and difficult to maintain. * One of the FUNCTION_TRACE macros above must be used in conjunction with these macros - * so that "_proc_name" is defined. + * so that "_acpi_function_name" is defined. */ #ifdef ACPI_USE_DO_WHILE_0 #define ACPI_DO_WHILE0(a) do a while(0) @@ -517,10 +538,10 @@ #define ACPI_DO_WHILE0(a) a #endif -#define return_VOID ACPI_DO_WHILE0 ({acpi_ut_exit(__LINE__,&_debug_info);return;}) -#define return_ACPI_STATUS(s) ACPI_DO_WHILE0 ({acpi_ut_status_exit(__LINE__,&_debug_info,(s));return((s));}) -#define return_VALUE(s) ACPI_DO_WHILE0 ({acpi_ut_value_exit(__LINE__,&_debug_info,(acpi_integer)(s));return((s));}) -#define return_PTR(s) ACPI_DO_WHILE0 ({acpi_ut_ptr_exit(__LINE__,&_debug_info,(u8 *)(s));return((s));}) +#define return_VOID ACPI_DO_WHILE0 ({acpi_ut_exit(ACPI_DEBUG_PARAMETERS);return;}) +#define return_ACPI_STATUS(s) ACPI_DO_WHILE0 ({acpi_ut_status_exit(ACPI_DEBUG_PARAMETERS,(s));return((s));}) +#define return_VALUE(s) ACPI_DO_WHILE0 ({acpi_ut_value_exit(ACPI_DEBUG_PARAMETERS,(acpi_integer)(s));return((s));}) +#define return_PTR(s) ACPI_DO_WHILE0 ({acpi_ut_ptr_exit(ACPI_DEBUG_PARAMETERS,(u8 *)(s));return((s));}) /* Conditional execution */ @@ -535,7 +556,7 @@ /* Stack and buffer dumping */ #define ACPI_DUMP_STACK_ENTRY(a) acpi_ex_dump_operand((a),0) -#define ACPI_DUMP_OPERANDS(a,b,c,d,e) acpi_ex_dump_operands(a,b,c,d,e,_THIS_MODULE,__LINE__) +#define ACPI_DUMP_OPERANDS(a,b,c,d,e) acpi_ex_dump_operands(a,b,c,d,e,_acpi_module_name,__LINE__) #define ACPI_DUMP_ENTRY(a,b) acpi_ns_dump_entry (a,b) @@ -572,7 +593,7 @@ * leaving no executable debug code! */ #define ACPI_MODULE_NAME(name) -#define _THIS_MODULE "" +#define _acpi_module_name "" #define ACPI_DEBUG_EXEC(a) #define ACPI_NORMAL_EXEC(a) a; @@ -648,19 +669,18 @@ /* Memory allocation */ -#define ACPI_MEM_ALLOCATE(a) acpi_ut_allocate((acpi_size)(a),_COMPONENT,_THIS_MODULE,__LINE__) -#define ACPI_MEM_CALLOCATE(a) acpi_ut_callocate((acpi_size)(a), _COMPONENT,_THIS_MODULE,__LINE__) +#define ACPI_MEM_ALLOCATE(a) acpi_ut_allocate((acpi_size)(a),_COMPONENT,_acpi_module_name,__LINE__) +#define ACPI_MEM_CALLOCATE(a) acpi_ut_callocate((acpi_size)(a), _COMPONENT,_acpi_module_name,__LINE__) #define ACPI_MEM_FREE(a) acpi_os_free(a) #define ACPI_MEM_TRACKING(a) - #else /* Memory allocation */ -#define ACPI_MEM_ALLOCATE(a) acpi_ut_allocate_and_track((acpi_size)(a),_COMPONENT,_THIS_MODULE,__LINE__) -#define ACPI_MEM_CALLOCATE(a) acpi_ut_callocate_and_track((acpi_size)(a), _COMPONENT,_THIS_MODULE,__LINE__) -#define ACPI_MEM_FREE(a) acpi_ut_free_and_track(a,_COMPONENT,_THIS_MODULE,__LINE__) +#define ACPI_MEM_ALLOCATE(a) acpi_ut_allocate_and_track((acpi_size)(a),_COMPONENT,_acpi_module_name,__LINE__) +#define ACPI_MEM_CALLOCATE(a) acpi_ut_callocate_and_track((acpi_size)(a), _COMPONENT,_acpi_module_name,__LINE__) +#define ACPI_MEM_FREE(a) acpi_ut_free_and_track(a,_COMPONENT,_acpi_module_name,__LINE__) #define ACPI_MEM_TRACKING(a) a #endif /* ACPI_DBG_TRACK_ALLOCATIONS */ diff --git a/include/acpi/acnamesp.h b/include/acpi/acnamesp.h index d1b3ce80056..870e2544bd9 100644 --- a/include/acpi/acnamesp.h +++ b/include/acpi/acnamesp.h @@ -163,7 +163,7 @@ acpi_ns_delete_namespace_subtree ( void acpi_ns_delete_namespace_by_owner ( - u16 table_id); + acpi_owner_id owner_id); void acpi_ns_detach_object ( @@ -219,7 +219,7 @@ acpi_ns_dump_objects ( acpi_object_type type, u8 display_type, u32 max_depth, - u32 ownder_id, + acpi_owner_id owner_id, acpi_handle start_handle); #endif /* ACPI_FUTURE_USAGE */ diff --git a/include/acpi/acobject.h b/include/acpi/acobject.h index e079b94e4fc..34f9d1f1f79 100644 --- a/include/acpi/acobject.h +++ b/include/acpi/acobject.h @@ -199,7 +199,7 @@ struct acpi_object_method ACPI_INTERNAL_METHOD implementation; u8 concurrency; u8 thread_count; - acpi_owner_id owning_id; + acpi_owner_id owner_id; }; diff --git a/include/acpi/acoutput.h b/include/acpi/acoutput.h index 2fbe180fee6..d7e828cb84b 100644 --- a/include/acpi/acoutput.h +++ b/include/acpi/acoutput.h @@ -136,7 +136,7 @@ /* * Debug level macros that are used in the DEBUG_PRINT macros */ -#define ACPI_DEBUG_LEVEL(dl) (u32) dl,__LINE__,&_debug_info +#define ACPI_DEBUG_LEVEL(dl) (u32) dl,ACPI_DEBUG_PARAMETERS /* Exception level -- used in the global "debug_level" */ diff --git a/include/acpi/acstruct.h b/include/acpi/acstruct.h index a2025a8da00..f375c17ad0b 100644 --- a/include/acpi/acstruct.h +++ b/include/acpi/acstruct.h @@ -71,7 +71,6 @@ struct acpi_walk_state u8 walk_type; acpi_owner_id owner_id; /* Owner of objects created during the walk */ u8 last_predicate; /* Result of last predicate */ - u8 reserved; /* For alignment */ u8 current_result; /* */ u8 next_op_info; /* Info about next_op */ u8 num_operands; /* Stack pointer for Operands[] array */ @@ -154,17 +153,17 @@ struct acpi_device_walk_info struct acpi_walk_info { u32 debug_level; - u32 owner_id; + acpi_owner_id owner_id; u8 display_type; }; /* Display Types */ -#define ACPI_DISPLAY_SUMMARY 0 -#define ACPI_DISPLAY_OBJECTS 1 -#define ACPI_DISPLAY_MASK 1 +#define ACPI_DISPLAY_SUMMARY (u8) 0 +#define ACPI_DISPLAY_OBJECTS (u8) 1 +#define ACPI_DISPLAY_MASK (u8) 1 -#define ACPI_DISPLAY_SHORT 2 +#define ACPI_DISPLAY_SHORT (u8) 2 struct acpi_get_devices_info { diff --git a/include/acpi/actables.h b/include/acpi/actables.h index 39df92e21a0..97e6f12da52 100644 --- a/include/acpi/actables.h +++ b/include/acpi/actables.h @@ -169,6 +169,10 @@ acpi_status acpi_tb_get_table_rsdt ( void); +acpi_status +acpi_tb_validate_rsdp ( + struct rsdp_descriptor *rsdp); + /* * tbutils - common table utilities diff --git a/include/acpi/actbl.h b/include/acpi/actbl.h index b5cdcca444c..c1e9110c366 100644 --- a/include/acpi/actbl.h +++ b/include/acpi/actbl.h @@ -86,15 +86,15 @@ */ struct rsdp_descriptor /* Root System Descriptor Pointer */ { - char signature [8]; /* ACPI signature, contains "RSD PTR " */ - u8 checksum; /* To make sum of struct == 0 */ - char oem_id [6]; /* OEM identification */ - u8 revision; /* Must be 0 for 1.0, 2 for 2.0 */ - u32 rsdt_physical_address; /* 32-bit physical address of RSDT */ - u32 length; /* XSDT Length in bytes including hdr */ - u64 xsdt_physical_address; /* 64-bit physical address of XSDT */ - u8 extended_checksum; /* Checksum of entire table */ - char reserved [3]; /* Reserved field must be 0 */ + char signature[8]; /* ACPI signature, contains "RSD PTR " */ + u8 checksum; /* ACPI 1.0 checksum */ + char oem_id[6]; /* OEM identification */ + u8 revision; /* Must be (0) for ACPI 1.0 or (2) for ACPI 2.0+ */ + u32 rsdt_physical_address; /* 32-bit physical address of the RSDT */ + u32 length; /* XSDT Length in bytes, including header */ + u64 xsdt_physical_address; /* 64-bit physical address of the XSDT */ + u8 extended_checksum; /* Checksum of entire table (ACPI 2.0) */ + char reserved[3]; /* Reserved, must be zero */ }; @@ -107,15 +107,15 @@ struct acpi_common_facs /* Common FACS for internal use */ #define ACPI_TABLE_HEADER_DEF /* ACPI common table header */ \ - char signature [4]; /* ACPI signature (4 ASCII characters) */\ - u32 length; /* Length of table, in bytes, including header */\ + char signature[4]; /* ASCII table signature */\ + u32 length; /* Length of table in bytes, including this header */\ u8 revision; /* ACPI Specification minor version # */\ u8 checksum; /* To make sum of entire table == 0 */\ - char oem_id [6]; /* OEM identification */\ - char oem_table_id [8]; /* OEM table identification */\ + char oem_id[6]; /* ASCII OEM identification */\ + char oem_table_id[8]; /* ASCII OEM table identification */\ u32 oem_revision; /* OEM revision number */\ - char asl_compiler_id [4]; /* ASL compiler vendor ID */\ - u32 asl_compiler_revision; /* ASL compiler revision number */ + char asl_compiler_id [4]; /* ASCII ASL compiler vendor ID */\ + u32 asl_compiler_revision; /* ASL compiler version */ struct acpi_table_header /* ACPI common table header */ @@ -139,8 +139,12 @@ struct multiple_apic_table { ACPI_TABLE_HEADER_DEF /* ACPI common table header */ u32 local_apic_address; /* Physical address of local APIC */ - u32 PCATcompat : 1; /* A one indicates system also has dual 8259s */ - u32 reserved1 : 31; + + /* Flags (32 bits) */ + + u8 PCATcompat : 1; /* 00: System also has dual 8259s */ + u8 : 7; /* 01-07: Reserved, must be zero */ + u8 reserved1[3]; /* 08-31: Reserved, must be zero */ }; /* Values for Type in APIC_HEADER_DEF */ @@ -180,16 +184,18 @@ struct apic_header #define TRIGGER_RESERVED 2 #define TRIGGER_LEVEL 3 -/* Common flag definitions */ +/* Common flag definitions (16 bits each) */ #define MPS_INTI_FLAGS \ - u16 polarity : 2; /* Polarity of APIC I/O input signals */\ - u16 trigger_mode : 2; /* Trigger mode of APIC input signals */\ - u16 reserved1 : 12; /* Reserved, must be zero */ + u8 polarity : 2; /* 00-01: Polarity of APIC I/O input signals */\ + u8 trigger_mode : 2; /* 02-03: Trigger mode of APIC input signals */\ + u8 : 4; /* 04-07: Reserved, must be zero */\ + u8 reserved1; /* 08-15: Reserved, must be zero */ #define LOCAL_APIC_FLAGS \ - u32 processor_enabled: 1; /* Processor is usable if set */\ - u32 reserved2 : 31; /* Reserved, must be zero */ + u8 processor_enabled: 1; /* 00: Processor is usable if set */\ + u8 : 7; /* 01-07: Reserved, must be zero */\ + u8 reserved2; /* 08-15: Reserved, must be zero */ /* Sub-structures for MADT */ @@ -238,7 +244,7 @@ struct madt_local_apic_nmi struct madt_address_override { APIC_HEADER_DEF - u16 reserved; /* Reserved - must be zero */ + u16 reserved; /* Reserved, must be zero */ u64 address; /* APIC physical address */ }; @@ -246,7 +252,7 @@ struct madt_io_sapic { APIC_HEADER_DEF u8 io_sapic_id; /* I/O SAPIC ID */ - u8 reserved; /* Reserved - must be zero */ + u8 reserved; /* Reserved, must be zero */ u32 interrupt_base; /* Glocal interrupt for SAPIC start */ u64 address; /* SAPIC physical address */ }; @@ -257,7 +263,7 @@ struct madt_local_sapic u8 processor_id; /* ACPI processor id */ u8 local_sapic_id; /* SAPIC ID */ u8 local_sapic_eid; /* SAPIC EID */ - u8 reserved [3]; /* Reserved - must be zero */ + u8 reserved[3]; /* Reserved, must be zero */ LOCAL_APIC_FLAGS u32 processor_uID; /* Numeric UID - ACPI 3.0 */ char processor_uIDstring[1]; /* String UID - ACPI 3.0 */ diff --git a/include/acpi/actbl1.h b/include/acpi/actbl1.h index 33de5f4d2cc..93c175a4f44 100644 --- a/include/acpi/actbl1.h +++ b/include/acpi/actbl1.h @@ -52,8 +52,7 @@ struct rsdt_descriptor_rev1 { ACPI_TABLE_HEADER_DEF /* ACPI common table header */ - u32 table_offset_entry [1]; /* Array of pointers to other */ - /* ACPI tables */ + u32 table_offset_entry[1]; /* Array of pointers to ACPI tables */ }; @@ -62,14 +61,19 @@ struct rsdt_descriptor_rev1 */ struct facs_descriptor_rev1 { - char signature[4]; /* ACPI Signature */ - u32 length; /* Length of structure, in bytes */ + char signature[4]; /* ASCII table signature */ + u32 length; /* Length of structure in bytes */ u32 hardware_signature; /* Hardware configuration signature */ u32 firmware_waking_vector; /* ACPI OS waking vector */ u32 global_lock; /* Global Lock */ - u32 S4bios_f : 1; /* Indicates if S4BIOS support is present */ - u32 reserved1 : 31; /* Must be 0 */ - u8 resverved3 [40]; /* Reserved - must be zero */ + + /* Flags (32 bits) */ + + u8 S4bios_f : 1; /* 00: S4BIOS support is present */ + u8 : 7; /* 01-07: Reserved, must be zero */ + u8 reserved1[3]; /* 08-31: Reserved, must be zero */ + + u8 reserved2[40]; /* Reserved, must be zero */ }; @@ -82,13 +86,13 @@ struct fadt_descriptor_rev1 u32 firmware_ctrl; /* Physical address of FACS */ u32 dsdt; /* Physical address of DSDT */ u8 model; /* System Interrupt Model */ - u8 reserved1; /* Reserved */ + u8 reserved1; /* Reserved, must be zero */ u16 sci_int; /* System vector of SCI interrupt */ u32 smi_cmd; /* Port address of SMI command port */ u8 acpi_enable; /* Value to write to smi_cmd to enable ACPI */ u8 acpi_disable; /* Value to write to smi_cmd to disable ACPI */ u8 S4bios_req; /* Value to write to SMI CMD to enter S4BIOS state */ - u8 reserved2; /* Reserved - must be zero */ + u8 reserved2; /* Reserved, must be zero */ u32 pm1a_evt_blk; /* Port address of Power Mgt 1a acpi_event Reg Blk */ u32 pm1b_evt_blk; /* Port address of Power Mgt 1b acpi_event Reg Blk */ u32 pm1a_cnt_blk; /* Port address of Power Mgt 1a Control Reg Blk */ @@ -104,7 +108,7 @@ struct fadt_descriptor_rev1 u8 gpe0_blk_len; /* Byte Length of ports at gpe0_blk */ u8 gpe1_blk_len; /* Byte Length of ports at gpe1_blk */ u8 gpe1_base; /* Offset in gpe model where gpe1 events start */ - u8 reserved3; /* Reserved */ + u8 reserved3; /* Reserved, must be zero */ u16 plvl2_lat; /* Worst case HW latency to enter/exit C2 state */ u16 plvl3_lat; /* Worst case HW latency to enter/exit C3 state */ u16 flush_size; /* Size of area read to flush caches */ @@ -114,19 +118,21 @@ struct fadt_descriptor_rev1 u8 day_alrm; /* Index to day-of-month alarm in RTC CMOS RAM */ u8 mon_alrm; /* Index to month-of-year alarm in RTC CMOS RAM */ u8 century; /* Index to century in RTC CMOS RAM */ - u8 reserved4; /* Reserved */ - u8 reserved4a; /* Reserved */ - u8 reserved4b; /* Reserved */ - u32 wb_invd : 1; /* The wbinvd instruction works properly */ - u32 wb_invd_flush : 1; /* The wbinvd flushes but does not invalidate */ - u32 proc_c1 : 1; /* All processors support C1 state */ - u32 plvl2_up : 1; /* C2 state works on MP system */ - u32 pwr_button : 1; /* Power button is handled as a generic feature */ - u32 sleep_button : 1; /* Sleep button is handled as a generic feature, or not present */ - u32 fixed_rTC : 1; /* RTC wakeup stat not in fixed register space */ - u32 rtcs4 : 1; /* RTC wakeup stat not possible from S4 */ - u32 tmr_val_ext : 1; /* The tmr_val width is 32 bits (0 = 24 bits) */ - u32 reserved5 : 23; /* Reserved - must be zero */ + u8 reserved4[3]; /* Reserved, must be zero */ + + /* Flags (32 bits) */ + + u8 wb_invd : 1; /* 00: The wbinvd instruction works properly */ + u8 wb_invd_flush : 1; /* 01: The wbinvd flushes but does not invalidate */ + u8 proc_c1 : 1; /* 02: All processors support C1 state */ + u8 plvl2_up : 1; /* 03: C2 state works on MP system */ + u8 pwr_button : 1; /* 04: Power button is handled as a generic feature */ + u8 sleep_button : 1; /* 05: Sleep button is handled as a generic feature, or not present */ + u8 fixed_rTC : 1; /* 06: RTC wakeup stat not in fixed register space */ + u8 rtcs4 : 1; /* 07: RTC wakeup stat not possible from S4 */ + u8 tmr_val_ext : 1; /* 08: tmr_val width is 32 bits (0 = 24 bits) */ + u8 : 7; /* 09-15: Reserved, must be zero */ + u8 reserved5[2]; /* 16-31: Reserved, must be zero */ }; #pragma pack() diff --git a/include/acpi/actbl2.h b/include/acpi/actbl2.h index e1729c967e0..84ce5abbd6f 100644 --- a/include/acpi/actbl2.h +++ b/include/acpi/actbl2.h @@ -73,8 +73,7 @@ struct rsdt_descriptor_rev2 { ACPI_TABLE_HEADER_DEF /* ACPI common table header */ - u32 table_offset_entry [1]; /* Array of pointers to */ - /* ACPI table headers */ + u32 table_offset_entry[1]; /* Array of pointers to ACPI tables */ }; @@ -84,8 +83,7 @@ struct rsdt_descriptor_rev2 struct xsdt_descriptor_rev2 { ACPI_TABLE_HEADER_DEF /* ACPI common table header */ - u64 table_offset_entry [1]; /* Array of pointers to */ - /* ACPI table headers */ + u64 table_offset_entry[1]; /* Array of pointers to ACPI tables */ }; @@ -94,16 +92,21 @@ struct xsdt_descriptor_rev2 */ struct facs_descriptor_rev2 { - char signature[4]; /* ACPI signature */ + char signature[4]; /* ASCII table signature */ u32 length; /* Length of structure, in bytes */ u32 hardware_signature; /* Hardware configuration signature */ - u32 firmware_waking_vector; /* 32bit physical address of the Firmware Waking Vector. */ + u32 firmware_waking_vector; /* 32-bit physical address of the Firmware Waking Vector. */ u32 global_lock; /* Global Lock used to synchronize access to shared hardware resources */ - u32 S4bios_f : 1; /* S4Bios_f - Indicates if S4BIOS support is present */ - u32 reserved1 : 31; /* Must be 0 */ - u64 xfirmware_waking_vector; /* 64bit physical address of the Firmware Waking Vector. */ + + /* Flags (32 bits) */ + + u8 S4bios_f : 1; /* 00: S4BIOS support is present */ + u8 : 7; /* 01-07: Reserved, must be zero */ + u8 reserved1[3]; /* 08-31: Reserved, must be zero */ + + u64 xfirmware_waking_vector; /* 64-bit physical address of the Firmware Waking Vector. */ u8 version; /* Version of this table */ - u8 reserved3 [31]; /* Reserved - must be zero */ + u8 reserved3[31]; /* Reserved, must be zero */ }; @@ -165,35 +168,37 @@ struct fadt_descriptor_rev2 { ACPI_TABLE_HEADER_DEF /* ACPI common table header */ FADT_REV2_COMMON - u8 reserved2; /* Reserved */ - u32 wb_invd : 1; /* The wbinvd instruction works properly */ - u32 wb_invd_flush : 1; /* The wbinvd flushes but does not invalidate */ - u32 proc_c1 : 1; /* All processors support C1 state */ - u32 plvl2_up : 1; /* C2 state works on MP system */ - u32 pwr_button : 1; /* Power button is handled as a generic feature */ - u32 sleep_button : 1; /* Sleep button is handled as a generic feature, or not present */ - u32 fixed_rTC : 1; /* RTC wakeup stat not in fixed register space */ - u32 rtcs4 : 1; /* RTC wakeup stat not possible from S4 */ - u32 tmr_val_ext : 1; /* Indicates tmr_val is 32 bits 0=24-bits */ - u32 dock_cap : 1; /* Supports Docking */ - u32 reset_reg_sup : 1; /* Indicates system supports system reset via the FADT RESET_REG */ - u32 sealed_case : 1; /* Indicates system has no internal expansion capabilities and case is sealed */ - u32 headless : 1; /* Indicates system does not have local video capabilities or local input devices */ - u32 cpu_sw_sleep : 1; /* Indicates to OSPM that a processor native instruction */ - /* must be executed after writing the SLP_TYPx register */ - /* ACPI 3.0 flag bits */ - - u32 pci_exp_wak : 1; /* System supports PCIEXP_WAKE (STS/EN) bits */ - u32 use_platform_clock : 1; /* OSPM should use platform-provided timer */ - u32 S4rtc_sts_valid : 1; /* Contents of RTC_STS valid after S4 wake */ - u32 remote_power_on_capable : 1; /* System is compatible with remote power on */ - u32 force_apic_cluster_model : 1; /* All local APICs must use cluster model */ - u32 force_apic_physical_destination_mode : 1; /* all local x_aPICs must use physical dest mode */ - u32 reserved6 : 12;/* Reserved - must be zero */ + u8 reserved2; /* Reserved, must be zero */ + + /* Flags (32 bits) */ + + u8 wb_invd : 1; /* 00: The wbinvd instruction works properly */ + u8 wb_invd_flush : 1; /* 01: The wbinvd flushes but does not invalidate */ + u8 proc_c1 : 1; /* 02: All processors support C1 state */ + u8 plvl2_up : 1; /* 03: C2 state works on MP system */ + u8 pwr_button : 1; /* 04: Power button is handled as a generic feature */ + u8 sleep_button : 1; /* 05: Sleep button is handled as a generic feature, or not present */ + u8 fixed_rTC : 1; /* 06: RTC wakeup stat not in fixed register space */ + u8 rtcs4 : 1; /* 07: RTC wakeup stat not possible from S4 */ + u8 tmr_val_ext : 1; /* 08: tmr_val is 32 bits 0=24-bits */ + u8 dock_cap : 1; /* 09: Docking supported */ + u8 reset_reg_sup : 1; /* 10: System reset via the FADT RESET_REG supported */ + u8 sealed_case : 1; /* 11: No internal expansion capabilities and case is sealed */ + u8 headless : 1; /* 12: No local video capabilities or local input devices */ + u8 cpu_sw_sleep : 1; /* 13: Must execute native instruction after writing SLP_TYPx register */ + + u8 pci_exp_wak : 1; /* 14: System supports PCIEXP_WAKE (STS/EN) bits (ACPI 3.0) */ + u8 use_platform_clock : 1; /* 15: OSPM should use platform-provided timer (ACPI 3.0) */ + u8 S4rtc_sts_valid : 1; /* 16: Contents of RTC_STS valid after S4 wake (ACPI 3.0) */ + u8 remote_power_on_capable : 1; /* 17: System is compatible with remote power on (ACPI 3.0) */ + u8 force_apic_cluster_model : 1; /* 18: All local APICs must use cluster model (ACPI 3.0) */ + u8 force_apic_physical_destination_mode : 1; /* 19: all local x_aPICs must use physical dest mode (ACPI 3.0) */ + u8 : 4; /* 20-23: Reserved, must be zero */ + u8 reserved3; /* 24-31: Reserved, must be zero */ struct acpi_generic_address reset_register; /* Reset register address in GAS format */ u8 reset_value; /* Value to write to the reset_register port to reset the system */ - u8 reserved7[3]; /* These three bytes must be zero */ + u8 reserved4[3]; /* These three bytes must be zero */ u64 xfirmware_ctrl; /* 64-bit physical address of FACS */ u64 Xdsdt; /* 64-bit physical address of DSDT */ struct acpi_generic_address xpm1a_evt_blk; /* Extended Power Mgt 1a acpi_event Reg Blk address */ @@ -213,11 +218,11 @@ struct fadt_descriptor_rev2_minus { ACPI_TABLE_HEADER_DEF /* ACPI common table header */ FADT_REV2_COMMON - u8 reserved2; /* Reserved */ + u8 reserved2; /* Reserved, must be zero */ u32 flags; struct acpi_generic_address reset_register; /* Reset register address in GAS format */ u8 reset_value; /* Value to write to the reset_register port to reset the system. */ - u8 reserved7[3]; /* These three bytes must be zero */ + u8 reserved7[3]; /* Reserved, must be zero */ }; @@ -242,11 +247,16 @@ struct static_resource_alloc u8 length; u8 proximity_domain_lo; u8 apic_id; - u32 enabled :1; - u32 reserved3 :31; + + /* Flags (32 bits) */ + + u8 enabled :1; /* 00: Use affinity structure */ + u8 :7; /* 01-07: Reserved, must be zero */ + u8 reserved3[3]; /* 08-31: Reserved, must be zero */ + u8 local_sapic_eid; u8 proximity_domain_hi[3]; - u32 reserved4; + u32 reserved4; /* Reserved, must be zero */ }; struct memory_affinity @@ -258,18 +268,23 @@ struct memory_affinity u64 base_address; u64 address_length; u32 reserved4; - u32 enabled :1; - u32 hot_pluggable :1; - u32 non_volatile :1; - u32 reserved5 :29; - u64 reserved6; + + /* Flags (32 bits) */ + + u8 enabled :1; /* 00: Use affinity structure */ + u8 hot_pluggable :1; /* 01: Memory region is hot pluggable */ + u8 non_volatile :1; /* 02: Memory is non-volatile */ + u8 :5; /* 03-07: Reserved, must be zero */ + u8 reserved5[3]; /* 08-31: Reserved, must be zero */ + + u64 reserved6; /* Reserved, must be zero */ }; struct system_resource_affinity { ACPI_TABLE_HEADER_DEF u32 reserved1; /* Must be value '1' */ - u64 reserved2; + u64 reserved2; /* Reserved, must be zero */ }; diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h index 8cd774a20c6..1895b862ce0 100644 --- a/include/acpi/actypes.h +++ b/include/acpi/actypes.h @@ -205,10 +205,11 @@ typedef u32 acpi_size; /* - * Miscellaneous common types + * This type is used for bitfields in ACPI tables. The only type that is + * even remotely portable is u8. Anything else is not portable, so + * do not add any more bitfield types. */ -typedef u16 UINT16_BIT; -typedef u32 UINT32_BIT; +typedef u8 UINT8_BIT; typedef acpi_native_uint ACPI_PTRDIFF; /* @@ -243,10 +244,13 @@ struct acpi_pointer #define ACPI_LOGMODE_PHYSPTR ACPI_LOGICAL_ADDRESSING | ACPI_PHYSICAL_POINTER #define ACPI_LOGMODE_LOGPTR ACPI_LOGICAL_ADDRESSING | ACPI_LOGICAL_POINTER -/* Types for the OS interface layer (OSL) */ - -#ifdef ACPI_USE_LOCAL_CACHE -#define acpi_cache_t struct acpi_memory_list +/* + * If acpi_cache_t was not defined in the OS-dependent header, + * define it now. This is typically the case where the local cache + * manager implementation is to be used (ACPI_USE_LOCAL_CACHE) + */ +#ifndef acpi_cache_t +#define acpi_cache_t struct acpi_memory_list #endif /* diff --git a/include/acpi/acutils.h b/include/acpi/acutils.h index e9c1584dd78..9c05c10e379 100644 --- a/include/acpi/acutils.h +++ b/include/acpi/acutils.h @@ -120,10 +120,6 @@ u8 acpi_ut_valid_object_type ( acpi_object_type type); -acpi_owner_id -acpi_ut_allocate_owner_id ( - u32 id_type); - /* * utinit - miscellaneous initialization and shutdown @@ -306,47 +302,63 @@ acpi_ut_track_stack_ptr ( void acpi_ut_trace ( u32 line_number, - struct acpi_debug_print_info *dbg_info); + char *function_name, + char *module_name, + u32 component_id); void acpi_ut_trace_ptr ( u32 line_number, - struct acpi_debug_print_info *dbg_info, + char *function_name, + char *module_name, + u32 component_id, void *pointer); void acpi_ut_trace_u32 ( u32 line_number, - struct acpi_debug_print_info *dbg_info, + char *function_name, + char *module_name, + u32 component_id, u32 integer); void acpi_ut_trace_str ( u32 line_number, - struct acpi_debug_print_info *dbg_info, + char *function_name, + char *module_name, + u32 component_id, char *string); void acpi_ut_exit ( u32 line_number, - struct acpi_debug_print_info *dbg_info); + char *function_name, + char *module_name, + u32 component_id); void acpi_ut_status_exit ( u32 line_number, - struct acpi_debug_print_info *dbg_info, + char *function_name, + char *module_name, + u32 component_id, acpi_status status); void acpi_ut_value_exit ( u32 line_number, - struct acpi_debug_print_info *dbg_info, + char *function_name, + char *module_name, + u32 component_id, acpi_integer value); void acpi_ut_ptr_exit ( u32 line_number, - struct acpi_debug_print_info *dbg_info, + char *function_name, + char *module_name, + u32 component_id, u8 *ptr); void @@ -378,7 +390,9 @@ void ACPI_INTERNAL_VAR_XFACE acpi_ut_debug_print ( u32 requested_debug_level, u32 line_number, - struct acpi_debug_print_info *dbg_info, + char *function_name, + char *module_name, + u32 component_id, char *format, ...) ACPI_PRINTF_LIKE_FUNC; @@ -386,7 +400,9 @@ void ACPI_INTERNAL_VAR_XFACE acpi_ut_debug_print_raw ( u32 requested_debug_level, u32 line_number, - struct acpi_debug_print_info *dbg_info, + char *function_name, + char *module_name, + u32 component_id, char *format, ...) ACPI_PRINTF_LIKE_FUNC; @@ -477,8 +493,8 @@ acpi_ut_allocate_object_desc_dbg ( u32 line_number, u32 component_id); -#define acpi_ut_create_internal_object(t) acpi_ut_create_internal_object_dbg (_THIS_MODULE,__LINE__,_COMPONENT,t) -#define acpi_ut_allocate_object_desc() acpi_ut_allocate_object_desc_dbg (_THIS_MODULE,__LINE__,_COMPONENT) +#define acpi_ut_create_internal_object(t) acpi_ut_create_internal_object_dbg (_acpi_module_name,__LINE__,_COMPONENT,t) +#define acpi_ut_allocate_object_desc() acpi_ut_allocate_object_desc_dbg (_acpi_module_name,__LINE__,_COMPONENT) void acpi_ut_delete_object_desc ( @@ -579,6 +595,14 @@ acpi_ut_short_divide ( * utmisc */ acpi_status +acpi_ut_allocate_owner_id ( + acpi_owner_id *owner_id); + +acpi_status +acpi_ut_release_owner_id ( + acpi_owner_id owner_id); + +acpi_status acpi_ut_walk_package_tree ( union acpi_operand_object *source_object, void *target_object, diff --git a/include/acpi/platform/acgcc.h b/include/acpi/platform/acgcc.h index 91fda36b042..39264127574 100644 --- a/include/acpi/platform/acgcc.h +++ b/include/acpi/platform/acgcc.h @@ -44,13 +44,17 @@ #ifndef __ACGCC_H__ #define __ACGCC_H__ +/* Function name is used for debug output. Non-ANSI, compiler-dependent */ + +#define ACPI_GET_FUNCTION_NAME __FUNCTION__ + /* This macro is used to tag functions as "printf-like" because * some compilers (like GCC) can catch printf format string problems. */ -#define ACPI_PRINTF_LIKE_FUNC __attribute__ ((__format__ (__printf__, 4, 5))) +#define ACPI_PRINTF_LIKE_FUNC __attribute__ ((__format__ (__printf__, 6, 7))) /* Some compilers complain about unused variables. Sometimes we don't want to - * use all the variables (most specifically for _THIS_MODULE). This allow us + * use all the variables (for example, _acpi_module_name). This allows us * to to tell the compiler warning in a per-variable manner that a variable * is unused. */ -- cgit v1.2.3-70-g09d2 From 6d30e3a8995c9fa9e8471bb1dff8e070638df5ea Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Thu, 14 Jul 2005 20:15:44 +0000 Subject: kbuild: Avoid inconsistent kallsyms data Several reports on inconsistent kallsyms data has been caused by the aliased symbols __sched_text_start and __down to shift places in the output of nm. The root cause was that on second pass ld aligned __sched_text_start to a 4 byte boundary which is the function alignment on i386. sched.text and spinlock.text is now aligned to an 8 byte boundary to make sure they are aligned to a function alignemnt on most (all?) archs. Tested by: Paulo Marques Tested by: Alexander Stohr Signed-off-by: Sam Ravnborg --- include/asm-generic/vmlinux.lds.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'include') diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h index b3bb326ae5b..3fa94288aa9 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h @@ -6,6 +6,9 @@ #define VMLINUX_SYMBOL(_sym_) _sym_ #endif +/* Align . to a 8 byte boundary equals to maximum function alignment. */ +#define ALIGN_FUNCTION() . = ALIGN(8) + #define RODATA \ .rodata : AT(ADDR(.rodata) - LOAD_OFFSET) { \ *(.rodata) *(.rodata.*) \ @@ -79,12 +82,18 @@ VMLINUX_SYMBOL(__security_initcall_end) = .; \ } +/* sched.text is aling to function alignment to secure we have same + * address even at second ld pass when generating System.map */ #define SCHED_TEXT \ + ALIGN_FUNCTION(); \ VMLINUX_SYMBOL(__sched_text_start) = .; \ *(.sched.text) \ VMLINUX_SYMBOL(__sched_text_end) = .; +/* spinlock.text is aling to function alignment to secure we have same + * address even at second ld pass when generating System.map */ #define LOCK_TEXT \ + ALIGN_FUNCTION(); \ VMLINUX_SYMBOL(__lock_text_start) = .; \ *(.spinlock.text) \ VMLINUX_SYMBOL(__lock_text_end) = .; -- cgit v1.2.3-70-g09d2 From 5d75ab45594c78d2d976a3248ea1ca281c9d7056 Mon Sep 17 00:00:00 2001 From: Len Brown Date: Fri, 29 Jul 2005 00:03:55 -0400 Subject: [ACPI] handle const char * __FUNCTION__ in debug code build warning: discards qualifiers from pointer target type when mixing "const char *" and "char *" We should probably update the routines to expect const, but easier for now to shut up the warning with 1 cast. Signed-off-by: Len Brown --- include/acpi/platform/acgcc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/acpi/platform/acgcc.h b/include/acpi/platform/acgcc.h index 39264127574..e410e3b6141 100644 --- a/include/acpi/platform/acgcc.h +++ b/include/acpi/platform/acgcc.h @@ -46,7 +46,7 @@ /* Function name is used for debug output. Non-ANSI, compiler-dependent */ -#define ACPI_GET_FUNCTION_NAME __FUNCTION__ +#define ACPI_GET_FUNCTION_NAME (char *) __FUNCTION__ /* This macro is used to tag functions as "printf-like" because * some compilers (like GCC) can catch printf format string problems. -- cgit v1.2.3-70-g09d2 From 0c9938cc75057c0fca1af55a55dcfc2842436695 Mon Sep 17 00:00:00 2001 From: Robert Moore Date: Fri, 29 Jul 2005 15:15:00 -0700 Subject: [ACPI] ACPICA 20050729 from Bob Moore Implemented support to ignore an attempt to install/load a particular ACPI table more than once. Apparently there exists BIOS code that repeatedly attempts to load the same SSDT upon certain events. Thanks to Venkatesh Pallipadi. Restructured the main interface to the AML parser in order to correctly handle all exceptional conditions. This will prevent leakage of the OwnerId resource and should eliminate the AE_OWNER_ID_LIMIT exceptions seen on some machines. Thanks to Alexey Starikovskiy. Support for "module level code" has been disabled in this version due to a number of issues that have appeared on various machines. The support can be enabled by defining ACPI_ENABLE_MODULE_LEVEL_CODE during subsystem compilation. When the issues are fully resolved, the code will be enabled by default again. Modified the internal functions for debug print support to define the FunctionName parameter as a (const char *) for compatibility with compiler built-in macros such as __FUNCTION__, etc. Linted the entire ACPICA source tree for both 32-bit and 64-bit. Signed-off-by: Robert Moore Signed-off-by: Len Brown --- drivers/acpi/dispatcher/dsinit.c | 24 ++-- drivers/acpi/dispatcher/dsmethod.c | 34 +++--- drivers/acpi/dispatcher/dswstate.c | 4 +- drivers/acpi/events/evmisc.c | 3 + drivers/acpi/executer/exconfig.c | 19 ++- drivers/acpi/executer/exdump.c | 2 +- drivers/acpi/executer/exoparg1.c | 2 +- drivers/acpi/namespace/nsaccess.c | 13 +- drivers/acpi/namespace/nsalloc.c | 121 ++----------------- drivers/acpi/namespace/nsdump.c | 11 +- drivers/acpi/namespace/nseval.c | 10 +- drivers/acpi/namespace/nsload.c | 42 ++----- drivers/acpi/namespace/nsparse.c | 2 +- drivers/acpi/parser/psloop.c | 9 +- drivers/acpi/parser/psutils.c | 4 +- drivers/acpi/parser/psxface.c | 242 +++++++++++++++++++++---------------- drivers/acpi/tables/tbinstal.c | 22 +++- drivers/acpi/tables/tbutils.c | 67 +++++++++- drivers/acpi/tables/tbxface.c | 14 +++ drivers/acpi/tables/tbxfroot.c | 4 +- drivers/acpi/utilities/utalloc.c | 4 +- drivers/acpi/utilities/utdebug.c | 77 +++++++++--- drivers/acpi/utilities/utmisc.c | 58 ++++++--- include/acpi/acconfig.h | 2 +- include/acpi/acdispat.h | 4 +- include/acpi/acmacros.h | 4 +- include/acpi/acnames.h | 5 + include/acpi/acnamesp.h | 2 +- include/acpi/acparser.h | 7 +- include/acpi/acstruct.h | 3 + include/acpi/actables.h | 6 +- include/acpi/acutils.h | 26 ++-- include/acpi/platform/acenv.h | 18 +-- include/acpi/platform/acgcc.h | 2 +- 34 files changed, 470 insertions(+), 397 deletions(-) (limited to 'include') diff --git a/drivers/acpi/dispatcher/dsinit.c b/drivers/acpi/dispatcher/dsinit.c index ebc07aab710..bcd1d472b90 100644 --- a/drivers/acpi/dispatcher/dsinit.c +++ b/drivers/acpi/dispatcher/dsinit.c @@ -86,20 +86,20 @@ acpi_ds_init_one_object ( void *context, void **return_value) { + struct acpi_init_walk_info *info = (struct acpi_init_walk_info *) context; + struct acpi_namespace_node *node = (struct acpi_namespace_node *) obj_handle; acpi_object_type type; acpi_status status; - struct acpi_init_walk_info *info = (struct acpi_init_walk_info *) context; ACPI_FUNCTION_NAME ("ds_init_one_object"); /* - * We are only interested in objects owned by the table that + * We are only interested in NS nodes owned by the table that * was just loaded */ - if (((struct acpi_namespace_node *) obj_handle)->owner_id != - info->table_desc->owner_id) { + if (node->owner_id != info->table_desc->owner_id) { return (AE_OK); } @@ -126,8 +126,6 @@ acpi_ds_init_one_object ( case ACPI_TYPE_METHOD: - info->method_count++; - /* * Print a dot for each method unless we are going to print * the entire pathname @@ -143,7 +141,7 @@ acpi_ds_init_one_object ( * on a per-table basis. Currently, we just use a global for the width. */ if (info->table_desc->pointer->revision == 1) { - ((struct acpi_namespace_node *) obj_handle)->flags |= ANOBJ_DATA_WIDTH_32; + node->flags |= ANOBJ_DATA_WIDTH_32; } /* @@ -153,22 +151,14 @@ acpi_ds_init_one_object ( status = acpi_ds_parse_method (obj_handle); if (ACPI_FAILURE (status)) { ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Method %p [%4.4s] - parse failure, %s\n", + "\n+Method %p [%4.4s] - parse failure, %s\n", obj_handle, acpi_ut_get_node_name (obj_handle), acpi_format_exception (status))); /* This parse failed, but we will continue parsing more methods */ - - break; } - /* - * Delete the parse tree. We simply re-parse the method - * for every execution since there isn't much overhead - */ - acpi_ns_delete_namespace_subtree (obj_handle); - acpi_ns_delete_namespace_by_owner ( - ((struct acpi_namespace_node *) obj_handle)->object->method.owner_id); + info->method_count++; break; diff --git a/drivers/acpi/dispatcher/dsmethod.c b/drivers/acpi/dispatcher/dsmethod.c index 1b90813cbde..e344c06ed33 100644 --- a/drivers/acpi/dispatcher/dsmethod.c +++ b/drivers/acpi/dispatcher/dsmethod.c @@ -58,12 +58,11 @@ * * FUNCTION: acpi_ds_parse_method * - * PARAMETERS: obj_handle - Method node + * PARAMETERS: Node - Method node * * RETURN: Status * - * DESCRIPTION: Call the parser and parse the AML that is associated with the - * method. + * DESCRIPTION: Parse the AML that is associated with the method. * * MUTEX: Assumes parser is locked * @@ -71,30 +70,28 @@ acpi_status acpi_ds_parse_method ( - acpi_handle obj_handle) + struct acpi_namespace_node *node) { acpi_status status; union acpi_operand_object *obj_desc; union acpi_parse_object *op; - struct acpi_namespace_node *node; struct acpi_walk_state *walk_state; - ACPI_FUNCTION_TRACE_PTR ("ds_parse_method", obj_handle); + ACPI_FUNCTION_TRACE_PTR ("ds_parse_method", node); /* Parameter Validation */ - if (!obj_handle) { + if (!node) { return_ACPI_STATUS (AE_NULL_ENTRY); } ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "**** Parsing [%4.4s] **** named_obj=%p\n", - acpi_ut_get_node_name (obj_handle), obj_handle)); + acpi_ut_get_node_name (node), node)); /* Extract the method object from the method Node */ - node = (struct acpi_namespace_node *) obj_handle; obj_desc = acpi_ns_get_attached_object (node); if (!obj_desc) { return_ACPI_STATUS (AE_NULL_OBJECT); @@ -169,10 +166,18 @@ acpi_ds_parse_method ( ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "**** [%4.4s] Parsed **** named_obj=%p Op=%p\n", - acpi_ut_get_node_name (obj_handle), obj_handle, op)); + acpi_ut_get_node_name (node), node, op)); + + /* + * Delete the parse tree. We simply re-parse the method for every + * execution since there isn't much overhead (compared to keeping lots + * of parse trees around) + */ + acpi_ns_delete_namespace_subtree (node); + acpi_ns_delete_namespace_by_owner (obj_desc->method.owner_id); cleanup2: - (void) acpi_ut_release_owner_id (obj_desc->method.owner_id); + acpi_ut_release_owner_id (&obj_desc->method.owner_id); cleanup: acpi_ps_delete_parse_tree (op); @@ -391,7 +396,7 @@ acpi_ds_call_control_method ( /* On error, we must delete the new walk state */ cleanup: - (void) acpi_ut_release_owner_id (obj_desc->method.owner_id); + acpi_ut_release_owner_id (&obj_desc->method.owner_id); if (next_walk_state && (next_walk_state->method_desc)) { /* Decrement the thread count on the method parse tree */ @@ -563,8 +568,7 @@ acpi_ds_terminate_control_method ( */ if ((walk_state->method_desc->method.concurrency == 1) && (!walk_state->method_desc->method.semaphore)) { - status = acpi_os_create_semaphore (1, - 1, + status = acpi_os_create_semaphore (1, 1, &walk_state->method_desc->method.semaphore); } @@ -595,6 +599,8 @@ acpi_ds_terminate_control_method ( */ acpi_ns_delete_namespace_by_owner (walk_state->method_desc->method.owner_id); status = acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); + acpi_ut_release_owner_id (&walk_state->method_desc->method.owner_id); + if (ACPI_FAILURE (status)) { return_ACPI_STATUS (status); } diff --git a/drivers/acpi/dispatcher/dswstate.c b/drivers/acpi/dispatcher/dswstate.c index d360d8e8954..5621665991b 100644 --- a/drivers/acpi/dispatcher/dswstate.c +++ b/drivers/acpi/dispatcher/dswstate.c @@ -744,7 +744,7 @@ acpi_ds_init_aml_walk ( u8 *aml_start, u32 aml_length, struct acpi_parameter_info *info, - u32 pass_number) + u8 pass_number) { acpi_status status; struct acpi_parse_state *parser_state = &walk_state->parser_state; @@ -762,7 +762,7 @@ acpi_ds_init_aml_walk ( /* The next_op of the next_walk will be the beginning of the method */ walk_state->next_op = NULL; - walk_state->pass_number = (u8) pass_number; + walk_state->pass_number = pass_number; if (info) { if (info->parameter_type == ACPI_PARAM_GPE) { diff --git a/drivers/acpi/events/evmisc.c b/drivers/acpi/events/evmisc.c index 38d7ab8aef3..3df3ada4b9e 100644 --- a/drivers/acpi/events/evmisc.c +++ b/drivers/acpi/events/evmisc.c @@ -411,6 +411,9 @@ acpi_ev_init_global_lock_handler ( * with an error. */ if (status == AE_NO_HARDWARE_RESPONSE) { + ACPI_REPORT_ERROR (( + "No response from Global Lock hardware, disabling lock\n")); + acpi_gbl_global_lock_present = FALSE; status = AE_OK; } diff --git a/drivers/acpi/executer/exconfig.c b/drivers/acpi/executer/exconfig.c index 76c6ebd0231..d11e9ec827f 100644 --- a/drivers/acpi/executer/exconfig.c +++ b/drivers/acpi/executer/exconfig.c @@ -99,6 +99,11 @@ acpi_ex_add_table ( return_ACPI_STATUS (AE_NO_MEMORY); } + /* Init the table handle */ + + obj_desc->reference.opcode = AML_LOAD_OP; + *ddb_handle = obj_desc; + /* Install the new table into the local data structures */ ACPI_MEMSET (&table_info, 0, sizeof (struct acpi_table_desc)); @@ -109,7 +114,14 @@ acpi_ex_add_table ( table_info.allocation = ACPI_MEM_ALLOCATED; status = acpi_tb_install_table (&table_info); + obj_desc->reference.object = table_info.installed_desc; + if (ACPI_FAILURE (status)) { + if (status == AE_ALREADY_EXISTS) { + /* Table already exists, just return the handle */ + + return_ACPI_STATUS (AE_OK); + } goto cleanup; } @@ -123,16 +135,12 @@ acpi_ex_add_table ( goto cleanup; } - /* Init the table handle */ - - obj_desc->reference.opcode = AML_LOAD_OP; - obj_desc->reference.object = table_info.installed_desc; - *ddb_handle = obj_desc; return_ACPI_STATUS (AE_OK); cleanup: acpi_ut_remove_reference (obj_desc); + *ddb_handle = NULL; return_ACPI_STATUS (status); } @@ -488,6 +496,7 @@ acpi_ex_unload_table ( * (Offset contains the table_id) */ acpi_ns_delete_namespace_by_owner (table_info->owner_id); + acpi_ut_release_owner_id (&table_info->owner_id); /* Delete the table itself */ diff --git a/drivers/acpi/executer/exdump.c b/drivers/acpi/executer/exdump.c index fd13cc3db01..4f98dceed39 100644 --- a/drivers/acpi/executer/exdump.c +++ b/drivers/acpi/executer/exdump.c @@ -598,7 +598,7 @@ acpi_ex_dump_reference ( acpi_os_printf ("Could not convert name to pathname\n"); } else { - acpi_os_printf ("%s\n", ret_buf.pointer); + acpi_os_printf ("%s\n", (char *) ret_buf.pointer); ACPI_MEM_FREE (ret_buf.pointer); } } diff --git a/drivers/acpi/executer/exoparg1.c b/drivers/acpi/executer/exoparg1.c index c1ba8b48228..48c30f80008 100644 --- a/drivers/acpi/executer/exoparg1.c +++ b/drivers/acpi/executer/exoparg1.c @@ -955,7 +955,7 @@ acpi_ex_opcode_1A_0T_1R ( */ return_desc = *(operand[0]->reference.where); if (return_desc) { - acpi_ut_add_reference (return_desc); + acpi_ut_add_reference (return_desc); } break; diff --git a/drivers/acpi/namespace/nsaccess.c b/drivers/acpi/namespace/nsaccess.c index 0bda88d1868..7589e1fdf25 100644 --- a/drivers/acpi/namespace/nsaccess.c +++ b/drivers/acpi/namespace/nsaccess.c @@ -159,18 +159,19 @@ acpi_ns_root_initialize ( obj_desc->method.param_count = (u8) ACPI_TO_INTEGER (val); obj_desc->common.flags |= AOPOBJ_DATA_VALID; -#if defined (ACPI_ASL_COMPILER) || defined (ACPI_DUMP_App) +#if defined (ACPI_ASL_COMPILER) - /* - * i_aSL Compiler cheats by putting parameter count - * in the owner_iD (param_count max is 7) - */ - new_node->owner_id = obj_desc->method.param_count; + /* save the parameter count for the i_aSL compiler */ + + new_node->value = obj_desc->method.param_count; #else /* Mark this as a very SPECIAL method */ obj_desc->method.method_flags = AML_METHOD_INTERNAL_ONLY; + +#ifndef ACPI_DUMP_APP obj_desc->method.implementation = acpi_ut_osi_implementation; +#endif #endif break; diff --git a/drivers/acpi/namespace/nsalloc.c b/drivers/acpi/namespace/nsalloc.c index edbf1db36b6..21d560decbf 100644 --- a/drivers/acpi/namespace/nsalloc.c +++ b/drivers/acpi/namespace/nsalloc.c @@ -176,10 +176,9 @@ acpi_ns_delete_node ( * DESCRIPTION: Initialize a new namespace node and install it amongst * its peers. * - * Note: Current namespace lookup is linear search. However, the - * nodes are linked in alphabetical order to 1) put all reserved - * names (start with underscore) first, and to 2) make a readable - * namespace dump. + * Note: Current namespace lookup is linear search. This appears + * to be sufficient as namespace searches consume only a small + * fraction of the execution time of the ACPI subsystem. * ******************************************************************************/ @@ -192,10 +191,6 @@ acpi_ns_install_node ( { acpi_owner_id owner_id = 0; struct acpi_namespace_node *child_node; -#ifdef ACPI_ALPHABETIC_NAMESPACE - - struct acpi_namespace_node *previous_child_node; -#endif ACPI_FUNCTION_TRACE ("ns_install_node"); @@ -219,57 +214,6 @@ acpi_ns_install_node ( node->peer = parent_node; } else { -#ifdef ACPI_ALPHABETIC_NAMESPACE - /* - * Walk the list whilst searching for the correct - * alphabetic placement. - */ - previous_child_node = NULL; - while (acpi_ns_compare_names (acpi_ut_get_node_name (child_node), - acpi_ut_get_node_name (node)) < 0) { - if (child_node->flags & ANOBJ_END_OF_PEER_LIST) { - /* Last peer; Clear end-of-list flag */ - - child_node->flags &= ~ANOBJ_END_OF_PEER_LIST; - - /* This node is the new peer to the child node */ - - child_node->peer = node; - - /* This node is the new end-of-list */ - - node->flags |= ANOBJ_END_OF_PEER_LIST; - node->peer = parent_node; - break; - } - - /* Get next peer */ - - previous_child_node = child_node; - child_node = child_node->peer; - } - - /* Did the node get inserted at the end-of-list? */ - - if (!(node->flags & ANOBJ_END_OF_PEER_LIST)) { - /* - * Loop above terminated without reaching the end-of-list. - * Insert the new node at the current location - */ - if (previous_child_node) { - /* Insert node alphabetically */ - - node->peer = child_node; - previous_child_node->peer = node; - } - else { - /* Insert node alphabetically at start of list */ - - node->peer = child_node; - parent_node->child = node; - } - } -#else while (!(child_node->flags & ANOBJ_END_OF_PEER_LIST)) { child_node = child_node->peer; } @@ -279,9 +223,8 @@ acpi_ns_install_node ( /* Clear end-of-list flag */ child_node->flags &= ~ANOBJ_END_OF_PEER_LIST; - node->flags |= ANOBJ_END_OF_PEER_LIST; + node->flags |= ANOBJ_END_OF_PEER_LIST; node->peer = parent_node; -#endif } /* Init the new entry */ @@ -570,6 +513,10 @@ acpi_ns_delete_namespace_by_owner ( ACPI_FUNCTION_TRACE_U32 ("ns_delete_namespace_by_owner", owner_id); + if (owner_id == 0) { + return_VOID; + } + parent_node = acpi_gbl_root_node; child_node = NULL; deletion_node = NULL; @@ -635,59 +582,7 @@ acpi_ns_delete_namespace_by_owner ( } } - (void) acpi_ut_release_owner_id (owner_id); return_VOID; } -#ifdef ACPI_ALPHABETIC_NAMESPACE -/******************************************************************************* - * - * FUNCTION: acpi_ns_compare_names - * - * PARAMETERS: Name1 - First name to compare - * Name2 - Second name to compare - * - * RETURN: value from strncmp - * - * DESCRIPTION: Compare two ACPI names. Names that are prefixed with an - * underscore are forced to be alphabetically first. - * - ******************************************************************************/ - -int -acpi_ns_compare_names ( - char *name1, - char *name2) -{ - char reversed_name1[ACPI_NAME_SIZE]; - char reversed_name2[ACPI_NAME_SIZE]; - u32 i; - u32 j; - - - /* - * Replace all instances of "underscore" with a value that is smaller so - * that all names that are prefixed with underscore(s) are alphabetically - * first. - * - * Reverse the name bytewise so we can just do a 32-bit compare instead - * of a strncmp. - */ - for (i = 0, j= (ACPI_NAME_SIZE - 1); i < ACPI_NAME_SIZE; i++, j--) { - reversed_name1[j] = name1[i]; - if (name1[i] == '_') { - reversed_name1[j] = '*'; - } - - reversed_name2[j] = name2[i]; - if (name2[i] == '_') { - reversed_name2[j] = '*'; - } - } - - return (*(int *) reversed_name1 - *(int *) reversed_name2); -} -#endif - - diff --git a/drivers/acpi/namespace/nsdump.c b/drivers/acpi/namespace/nsdump.c index d86ccbc8a13..5d25add6b03 100644 --- a/drivers/acpi/namespace/nsdump.c +++ b/drivers/acpi/namespace/nsdump.c @@ -85,6 +85,9 @@ acpi_ns_print_pathname ( u32 num_segments, char *pathname) { + acpi_native_uint i; + + ACPI_FUNCTION_NAME ("ns_print_pathname"); @@ -97,9 +100,13 @@ acpi_ns_print_pathname ( ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "[")); while (num_segments) { - acpi_os_printf ("%4.4s", pathname); - pathname += ACPI_NAME_SIZE; + for (i = 0; i < 4; i++) { + ACPI_IS_PRINT (pathname[i]) ? + acpi_os_printf ("%c", pathname[i]) : + acpi_os_printf ("?"); + } + pathname += ACPI_NAME_SIZE; num_segments--; if (num_segments) { acpi_os_printf ("."); diff --git a/drivers/acpi/namespace/nseval.c b/drivers/acpi/namespace/nseval.c index 1ae89a1c882..908cffd5e72 100644 --- a/drivers/acpi/namespace/nseval.c +++ b/drivers/acpi/namespace/nseval.c @@ -365,6 +365,7 @@ acpi_ns_evaluate_by_handle ( * * PARAMETERS: Info - Method info block, contains: * Node - Method Node to execute + * obj_desc - Method object * Parameters - List of parameters to pass to the method, * terminated by NULL. Params itself may be * NULL if no parameters are being passed. @@ -387,7 +388,6 @@ acpi_ns_execute_control_method ( struct acpi_parameter_info *info) { acpi_status status; - union acpi_operand_object *obj_desc; ACPI_FUNCTION_TRACE ("ns_execute_control_method"); @@ -395,8 +395,8 @@ acpi_ns_execute_control_method ( /* Verify that there is a method associated with this object */ - obj_desc = acpi_ns_get_attached_object (info->node); - if (!obj_desc) { + info->obj_desc = acpi_ns_get_attached_object (info->node); + if (!info->obj_desc) { ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No attached method object\n")); (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); @@ -407,7 +407,7 @@ acpi_ns_execute_control_method ( ACPI_LV_INFO, _COMPONENT); ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Method at AML address %p Length %X\n", - obj_desc->method.aml_start + 1, obj_desc->method.aml_length - 1)); + info->obj_desc->method.aml_start + 1, info->obj_desc->method.aml_length - 1)); /* * Unlock the namespace before execution. This allows namespace access @@ -430,7 +430,7 @@ acpi_ns_execute_control_method ( return_ACPI_STATUS (status); } - status = acpi_psx_execute (info); + status = acpi_ps_execute_method (info); acpi_ex_exit_interpreter (); return_ACPI_STATUS (status); diff --git a/drivers/acpi/namespace/nsload.c b/drivers/acpi/namespace/nsload.c index 34e49701660..1428a84a31e 100644 --- a/drivers/acpi/namespace/nsload.c +++ b/drivers/acpi/namespace/nsload.c @@ -198,7 +198,7 @@ acpi_ns_load_table_by_type ( switch (table_type) { case ACPI_TABLE_DSDT: - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Loading DSDT\n")); + ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Namespace load: DSDT\n")); table_desc = acpi_gbl_table_lists[ACPI_TABLE_DSDT].next; @@ -218,17 +218,18 @@ acpi_ns_load_table_by_type ( case ACPI_TABLE_SSDT: + case ACPI_TABLE_PSDT: - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Loading %d SSDTs\n", - acpi_gbl_table_lists[ACPI_TABLE_SSDT].count)); + ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Namespace load: %d SSDT or PSDTs\n", + acpi_gbl_table_lists[table_type].count)); /* - * Traverse list of SSDT tables + * Traverse list of SSDT or PSDT tables */ - table_desc = acpi_gbl_table_lists[ACPI_TABLE_SSDT].next; - for (i = 0; i < acpi_gbl_table_lists[ACPI_TABLE_SSDT].count; i++) { + table_desc = acpi_gbl_table_lists[table_type].next; + for (i = 0; i < acpi_gbl_table_lists[table_type].count; i++) { /* - * Only attempt to load table if it is not + * Only attempt to load table into namespace if it is not * already loaded! */ if (!table_desc->loaded_into_namespace) { @@ -245,33 +246,6 @@ acpi_ns_load_table_by_type ( break; - case ACPI_TABLE_PSDT: - - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Loading %d PSDTs\n", - acpi_gbl_table_lists[ACPI_TABLE_PSDT].count)); - - /* - * Traverse list of PSDT tables - */ - table_desc = acpi_gbl_table_lists[ACPI_TABLE_PSDT].next; - - for (i = 0; i < acpi_gbl_table_lists[ACPI_TABLE_PSDT].count; i++) { - /* Only attempt to load table if it is not already loaded! */ - - if (!table_desc->loaded_into_namespace) { - status = acpi_ns_load_table (table_desc, acpi_gbl_root_node); - if (ACPI_FAILURE (status)) { - break; - } - - table_desc->loaded_into_namespace = TRUE; - } - - table_desc = table_desc->next; - } - break; - - default: status = AE_SUPPORT; break; diff --git a/drivers/acpi/namespace/nsparse.c b/drivers/acpi/namespace/nsparse.c index 64e0b2b9f55..24bed931d39 100644 --- a/drivers/acpi/namespace/nsparse.c +++ b/drivers/acpi/namespace/nsparse.c @@ -67,7 +67,7 @@ acpi_status acpi_ns_one_complete_parse ( - u32 pass_number, + u8 pass_number, struct acpi_table_desc *table_desc) { union acpi_parse_object *parse_root; diff --git a/drivers/acpi/parser/psloop.c b/drivers/acpi/parser/psloop.c index edf8aa5f86c..551d54bdbec 100644 --- a/drivers/acpi/parser/psloop.c +++ b/drivers/acpi/parser/psloop.c @@ -55,8 +55,6 @@ #include #include #include -#include -#include #define _COMPONENT ACPI_PARSER ACPI_MODULE_NAME ("psloop") @@ -410,11 +408,9 @@ acpi_ps_parse_loop ( /* Special processing for certain opcodes */ -#define ACPI_NO_MODULE_LEVEL_CODE - /* TBD (remove): Temporary mechanism to disable this code if needed */ -#ifndef ACPI_NO_MODULE_LEVEL_CODE +#ifdef ACPI_ENABLE_MODULE_LEVEL_CODE if ((walk_state->pass_number <= ACPI_IMODE_LOAD_PASS1) && ((walk_state->parse_flags & ACPI_PARSE_DISASSEMBLE) == 0)) { @@ -431,6 +427,9 @@ acpi_ps_parse_loop ( case AML_ELSE_OP: case AML_WHILE_OP: + ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, + "Pass1: Skipping an If/Else/While body\n")); + /* Skip body of if/else/while in pass 1 */ parser_state->aml = parser_state->pkg_end; diff --git a/drivers/acpi/parser/psutils.c b/drivers/acpi/parser/psutils.c index 19a27020eee..4221b41ae1a 100644 --- a/drivers/acpi/parser/psutils.c +++ b/drivers/acpi/parser/psutils.c @@ -200,10 +200,10 @@ acpi_ps_free_op ( } if (op->common.flags & ACPI_PARSEOP_GENERIC) { - acpi_os_release_object (acpi_gbl_ps_node_cache, op); + (void) acpi_os_release_object (acpi_gbl_ps_node_cache, op); } else { - acpi_os_release_object (acpi_gbl_ps_node_ext_cache, op); + (void) acpi_os_release_object (acpi_gbl_ps_node_ext_cache, op); } } diff --git a/drivers/acpi/parser/psxface.c b/drivers/acpi/parser/psxface.c index 5279b51e778..d1541fabaf0 100644 --- a/drivers/acpi/parser/psxface.c +++ b/drivers/acpi/parser/psxface.c @@ -46,19 +46,30 @@ #include #include #include -#include #define _COMPONENT ACPI_PARSER ACPI_MODULE_NAME ("psxface") +/* Local Prototypes */ + +static acpi_status +acpi_ps_execute_pass ( + struct acpi_parameter_info *info); + +static void +acpi_ps_update_parameter_list ( + struct acpi_parameter_info *info, + u16 action); + /******************************************************************************* * - * FUNCTION: acpi_psx_execute + * FUNCTION: acpi_ps_execute_method * * PARAMETERS: Info - Method info block, contains: * Node - Method Node to execute + * obj_desc - Method object * Parameters - List of parameters to pass to the method, * terminated by NULL. Params itself may be * NULL if no parameters are being passed. @@ -67,6 +78,7 @@ * parameter_type - Type of Parameter list * return_object - Where to put method's return value (if * any). If NULL, no value is returned. + * pass_number - Parse or execute pass * * RETURN: Status * @@ -75,174 +87,194 @@ ******************************************************************************/ acpi_status -acpi_psx_execute ( +acpi_ps_execute_method ( struct acpi_parameter_info *info) { acpi_status status; - union acpi_operand_object *obj_desc; - u32 i; - union acpi_parse_object *op; - struct acpi_walk_state *walk_state; - ACPI_FUNCTION_TRACE ("psx_execute"); + ACPI_FUNCTION_TRACE ("ps_execute_method"); - /* Validate the Node and get the attached object */ + /* Validate the Info and method Node */ if (!info || !info->node) { return_ACPI_STATUS (AE_NULL_ENTRY); } - obj_desc = acpi_ns_get_attached_object (info->node); - if (!obj_desc) { - return_ACPI_STATUS (AE_NULL_OBJECT); - } - /* Init for new method, wait on concurrency semaphore */ - status = acpi_ds_begin_method_execution (info->node, obj_desc, NULL); + status = acpi_ds_begin_method_execution (info->node, info->obj_desc, NULL); if (ACPI_FAILURE (status)) { return_ACPI_STATUS (status); } - if ((info->parameter_type == ACPI_PARAM_ARGS) && - (info->parameters)) { - /* - * The caller "owns" the parameters, so give each one an extra - * reference - */ - for (i = 0; info->parameters[i]; i++) { - acpi_ut_add_reference (info->parameters[i]); - } - } - - /* - * 1) Perform the first pass parse of the method to enter any - * named objects that it creates into the namespace - */ - ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, - "**** Begin Method Parse **** Entry=%p obj=%p\n", - info->node, obj_desc)); - - /* Create and init a Root Node */ - - op = acpi_ps_create_scope_op (); - if (!op) { - status = AE_NO_MEMORY; - goto cleanup1; - } - /* * Get a new owner_id for objects created by this method. Namespace * objects (such as Operation Regions) can be created during the * first pass parse. */ - status = acpi_ut_allocate_owner_id (&obj_desc->method.owner_id); + status = acpi_ut_allocate_owner_id (&info->obj_desc->method.owner_id); if (ACPI_FAILURE (status)) { - goto cleanup2; - } - - /* Create and initialize a new walk state */ - - walk_state = acpi_ds_create_walk_state (obj_desc->method.owner_id, - NULL, NULL, NULL); - if (!walk_state) { - status = AE_NO_MEMORY; - goto cleanup2; + return_ACPI_STATUS (status); } - status = acpi_ds_init_aml_walk (walk_state, op, info->node, - obj_desc->method.aml_start, - obj_desc->method.aml_length, NULL, 1); - if (ACPI_FAILURE (status)) { - goto cleanup3; - } + /* + * The caller "owns" the parameters, so give each one an extra + * reference + */ + acpi_ps_update_parameter_list (info, REF_INCREMENT); - /* Parse the AML */ + /* + * 1) Perform the first pass parse of the method to enter any + * named objects that it creates into the namespace + */ + ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, + "**** Begin Method Parse **** Entry=%p obj=%p\n", + info->node, info->obj_desc)); - status = acpi_ps_parse_aml (walk_state); - acpi_ps_delete_parse_tree (op); + info->pass_number = 1; + status = acpi_ps_execute_pass (info); if (ACPI_FAILURE (status)) { - goto cleanup1; /* Walk state is already deleted */ + goto cleanup; } /* - * 2) Execute the method. Performs second pass parse simultaneously + * 2) Execute the method. Performs second pass parse simultaneously */ ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "**** Begin Method Execution **** Entry=%p obj=%p\n", - info->node, obj_desc)); + info->node, info->obj_desc)); - /* Create and init a Root Node */ + info->pass_number = 3; + status = acpi_ps_execute_pass (info); - op = acpi_ps_create_scope_op (); - if (!op) { - status = AE_NO_MEMORY; - goto cleanup1; + +cleanup: + if (info->obj_desc->method.owner_id) { + acpi_ut_release_owner_id (&info->obj_desc->method.owner_id); } - /* Init new op with the method name and pointer back to the NS node */ + /* Take away the extra reference that we gave the parameters above */ - acpi_ps_set_name (op, info->node->name.integer); - op->common.node = info->node; + acpi_ps_update_parameter_list (info, REF_DECREMENT); - /* Create and initialize a new walk state */ + /* Exit now if error above */ - walk_state = acpi_ds_create_walk_state (0, NULL, NULL, NULL); - if (!walk_state) { - status = AE_NO_MEMORY; - goto cleanup2; + if (ACPI_FAILURE (status)) { + return_ACPI_STATUS (status); } - status = acpi_ds_init_aml_walk (walk_state, op, info->node, - obj_desc->method.aml_start, - obj_desc->method.aml_length, info, 3); - if (ACPI_FAILURE (status)) { - goto cleanup3; + /* + * If the method has returned an object, signal this to the caller with + * a control exception code + */ + if (info->return_object) { + ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Method returned obj_desc=%p\n", + info->return_object)); + ACPI_DUMP_STACK_ENTRY (info->return_object); + + status = AE_CTRL_RETURN_VALUE; } - /* The walk of the parse tree is where we actually execute the method */ + return_ACPI_STATUS (status); +} - status = acpi_ps_parse_aml (walk_state); - goto cleanup2; /* Walk state already deleted */ +/******************************************************************************* + * + * FUNCTION: acpi_ps_update_parameter_list + * + * PARAMETERS: Info - See struct acpi_parameter_info + * (Used: parameter_type and Parameters) + * Action - Add or Remove reference + * + * RETURN: Status + * + * DESCRIPTION: Update reference count on all method parameter objects + * + ******************************************************************************/ -cleanup3: - acpi_ds_delete_walk_state (walk_state); +static void +acpi_ps_update_parameter_list ( + struct acpi_parameter_info *info, + u16 action) +{ + acpi_native_uint i; -cleanup2: - acpi_ps_delete_parse_tree (op); -cleanup1: if ((info->parameter_type == ACPI_PARAM_ARGS) && (info->parameters)) { - /* Take away the extra reference that we gave the parameters above */ + /* Update reference count for each parameter */ for (i = 0; info->parameters[i]; i++) { /* Ignore errors, just do them all */ - (void) acpi_ut_update_object_reference ( - info->parameters[i], REF_DECREMENT); + (void) acpi_ut_update_object_reference (info->parameters[i], action); } } +} - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + +/******************************************************************************* + * + * FUNCTION: acpi_ps_execute_pass + * + * PARAMETERS: Info - See struct acpi_parameter_info + * (Used: pass_number, Node, and obj_desc) + * + * RETURN: Status + * + * DESCRIPTION: Single AML pass: Parse or Execute a control method + * + ******************************************************************************/ + +static acpi_status +acpi_ps_execute_pass ( + struct acpi_parameter_info *info) +{ + acpi_status status; + union acpi_parse_object *op; + struct acpi_walk_state *walk_state; + + + ACPI_FUNCTION_TRACE ("ps_execute_pass"); + + + /* Create and init a Root Node */ + + op = acpi_ps_create_scope_op (); + if (!op) { + return_ACPI_STATUS (AE_NO_MEMORY); } - /* - * If the method has returned an object, signal this to the caller with - * a control exception code - */ - if (info->return_object) { - ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Method returned obj_desc=%p\n", - info->return_object)); - ACPI_DUMP_STACK_ENTRY (info->return_object); + /* Create and initialize a new walk state */ - status = AE_CTRL_RETURN_VALUE; + walk_state = acpi_ds_create_walk_state ( + info->obj_desc->method.owner_id, NULL, NULL, NULL); + if (!walk_state) { + status = AE_NO_MEMORY; + goto cleanup; + } + + status = acpi_ds_init_aml_walk (walk_state, op, info->node, + info->obj_desc->method.aml_start, + info->obj_desc->method.aml_length, + info->pass_number == 1 ? NULL : info, + info->pass_number); + if (ACPI_FAILURE (status)) { + acpi_ds_delete_walk_state (walk_state); + goto cleanup; } + /* Parse the AML */ + + status = acpi_ps_parse_aml (walk_state); + + /* Walk state was deleted by parse_aml */ + +cleanup: + acpi_ps_delete_parse_tree (op); return_ACPI_STATUS (status); } diff --git a/drivers/acpi/tables/tbinstal.c b/drivers/acpi/tables/tbinstal.c index 2ad72f20455..698799901f5 100644 --- a/drivers/acpi/tables/tbinstal.c +++ b/drivers/acpi/tables/tbinstal.c @@ -124,9 +124,7 @@ acpi_tb_match_signature ( * * RETURN: Status * - * DESCRIPTION: Load and validate all tables other than the RSDT. The RSDT must - * already be loaded and validated. - * Install the table into the global data structs. + * DESCRIPTION: Install the table into the global data structures. * ******************************************************************************/ @@ -136,6 +134,7 @@ acpi_tb_install_table ( { acpi_status status; + ACPI_FUNCTION_TRACE ("tb_install_table"); @@ -143,22 +142,33 @@ acpi_tb_install_table ( status = acpi_ut_acquire_mutex (ACPI_MTX_TABLES); if (ACPI_FAILURE (status)) { - ACPI_REPORT_ERROR (("Could not acquire table mutex for [%4.4s], %s\n", - table_info->pointer->signature, acpi_format_exception (status))); + ACPI_REPORT_ERROR (("Could not acquire table mutex, %s\n", + acpi_format_exception (status))); return_ACPI_STATUS (status); } + /* + * Ignore a table that is already installed. For example, some BIOS + * ASL code will repeatedly attempt to load the same SSDT. + */ + status = acpi_tb_is_table_installed (table_info); + if (ACPI_FAILURE (status)) { + goto unlock_and_exit; + } + /* Install the table into the global data structure */ status = acpi_tb_init_table_descriptor (table_info->type, table_info); if (ACPI_FAILURE (status)) { - ACPI_REPORT_ERROR (("Could not install ACPI table [%4.4s], %s\n", + ACPI_REPORT_ERROR (("Could not install table [%4.4s], %s\n", table_info->pointer->signature, acpi_format_exception (status))); } ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "%s located at %p\n", acpi_gbl_table_data[table_info->type].name, table_info->pointer)); + +unlock_and_exit: (void) acpi_ut_release_mutex (ACPI_MTX_TABLES); return_ACPI_STATUS (status); } diff --git a/drivers/acpi/tables/tbutils.c b/drivers/acpi/tables/tbutils.c index e69d01d443d..6fc1e36e604 100644 --- a/drivers/acpi/tables/tbutils.c +++ b/drivers/acpi/tables/tbutils.c @@ -59,6 +59,67 @@ acpi_tb_handle_to_object ( #endif +/******************************************************************************* + * + * FUNCTION: acpi_tb_is_table_installed + * + * PARAMETERS: new_table_desc - Descriptor for new table being installed + * + * RETURN: Status - AE_ALREADY_EXISTS if the table is already installed + * + * DESCRIPTION: Determine if an ACPI table is already installed + * + * MUTEX: Table data structures should be locked + * + ******************************************************************************/ + +acpi_status +acpi_tb_is_table_installed ( + struct acpi_table_desc *new_table_desc) +{ + struct acpi_table_desc *table_desc; + + + ACPI_FUNCTION_TRACE ("tb_is_table_installed"); + + + /* Get the list descriptor and first table descriptor */ + + table_desc = acpi_gbl_table_lists[new_table_desc->type].next; + + /* Examine all installed tables of this type */ + + while (table_desc) { + /* Compare Revision and oem_table_id */ + + if ((table_desc->loaded_into_namespace) && + (table_desc->pointer->revision == + new_table_desc->pointer->revision) && + (!ACPI_MEMCMP (table_desc->pointer->oem_table_id, + new_table_desc->pointer->oem_table_id, 8))) { + /* This table is already installed */ + + ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, + "Table [%4.4s] already installed: Rev %X oem_table_id [%8.8s]\n", + new_table_desc->pointer->signature, + new_table_desc->pointer->revision, + new_table_desc->pointer->oem_table_id)); + + new_table_desc->owner_id = table_desc->owner_id; + new_table_desc->installed_desc = table_desc; + + return_ACPI_STATUS (AE_ALREADY_EXISTS); + } + + /* Get next table on the list */ + + table_desc = table_desc->next; + } + + return_ACPI_STATUS (AE_OK); +} + + /******************************************************************************* * * FUNCTION: acpi_tb_validate_table_header @@ -157,7 +218,7 @@ acpi_tb_verify_table_checksum ( /* Compute the checksum on the table */ - checksum = acpi_tb_checksum (table_header, table_header->length); + checksum = acpi_tb_generate_checksum (table_header, table_header->length); /* Return the appropriate exception */ @@ -175,7 +236,7 @@ acpi_tb_verify_table_checksum ( /******************************************************************************* * - * FUNCTION: acpi_tb_checksum + * FUNCTION: acpi_tb_generate_checksum * * PARAMETERS: Buffer - Buffer to checksum * Length - Size of the buffer @@ -187,7 +248,7 @@ acpi_tb_verify_table_checksum ( ******************************************************************************/ u8 -acpi_tb_checksum ( +acpi_tb_generate_checksum ( void *buffer, u32 length) { diff --git a/drivers/acpi/tables/tbxface.c b/drivers/acpi/tables/tbxface.c index ca2dbdd23ed..e18a05d1b9b 100644 --- a/drivers/acpi/tables/tbxface.c +++ b/drivers/acpi/tables/tbxface.c @@ -182,10 +182,23 @@ acpi_load_table ( return_ACPI_STATUS (status); } + /* Check signature for a valid table type */ + + status = acpi_tb_recognize_table (&table_info, ACPI_TABLE_ALL); + if (ACPI_FAILURE (status)) { + return_ACPI_STATUS (status); + } + /* Install the new table into the local data structures */ status = acpi_tb_install_table (&table_info); if (ACPI_FAILURE (status)) { + if (status == AE_ALREADY_EXISTS) { + /* Table already exists, no error */ + + status = AE_OK; + } + /* Free table allocated by acpi_tb_get_table_body */ acpi_tb_delete_single_table (&table_info); @@ -261,6 +274,7 @@ acpi_unload_table ( * simply a position within the hierarchy */ acpi_ns_delete_namespace_by_owner (table_desc->owner_id); + acpi_ut_release_owner_id (&table_desc->owner_id); table_desc = table_desc->next; } diff --git a/drivers/acpi/tables/tbxfroot.c b/drivers/acpi/tables/tbxfroot.c index abb4c934656..87dccdda9ae 100644 --- a/drivers/acpi/tables/tbxfroot.c +++ b/drivers/acpi/tables/tbxfroot.c @@ -93,14 +93,14 @@ acpi_tb_validate_rsdp ( /* Check the standard checksum */ - if (acpi_tb_checksum (rsdp, ACPI_RSDP_CHECKSUM_LENGTH) != 0) { + if (acpi_tb_generate_checksum (rsdp, ACPI_RSDP_CHECKSUM_LENGTH) != 0) { return (AE_BAD_CHECKSUM); } /* Check extended checksum if table version >= 2 */ if ((rsdp->revision >= 2) && - (acpi_tb_checksum (rsdp, ACPI_RSDP_XCHECKSUM_LENGTH) != 0)) { + (acpi_tb_generate_checksum (rsdp, ACPI_RSDP_XCHECKSUM_LENGTH) != 0)) { return (AE_BAD_CHECKSUM); } diff --git a/drivers/acpi/utilities/utalloc.c b/drivers/acpi/utilities/utalloc.c index 5061c6f0ee6..78270f50e62 100644 --- a/drivers/acpi/utilities/utalloc.c +++ b/drivers/acpi/utilities/utalloc.c @@ -76,7 +76,7 @@ static acpi_status acpi_ut_create_list ( char *list_name, u16 object_size, - acpi_handle *return_cache); + struct acpi_memory_list **return_cache); #endif @@ -428,7 +428,7 @@ static acpi_status acpi_ut_create_list ( char *list_name, u16 object_size, - acpi_handle *return_cache) + struct acpi_memory_list **return_cache) { struct acpi_memory_list *cache; diff --git a/drivers/acpi/utilities/utdebug.c b/drivers/acpi/utilities/utdebug.c index 3d5fbc810b0..c27cbb7f5c5 100644 --- a/drivers/acpi/utilities/utdebug.c +++ b/drivers/acpi/utilities/utdebug.c @@ -55,6 +55,12 @@ static u32 acpi_gbl_prev_thread_id = 0xFFFFFFFF; static char *acpi_gbl_fn_entry_str = "----Entry"; static char *acpi_gbl_fn_exit_str = "----Exit-"; +/* Local prototypes */ + +static const char * +acpi_ut_trim_function_name ( + const char *function_name); + /******************************************************************************* * @@ -72,7 +78,7 @@ void acpi_ut_init_stack_ptr_trace ( void) { - u32 current_sp; + u32 current_sp; acpi_gbl_entry_stack_pointer = ACPI_PTR_DIFF (¤t_sp, NULL); @@ -95,7 +101,7 @@ void acpi_ut_track_stack_ptr ( void) { - acpi_size current_sp; + acpi_size current_sp; current_sp = ACPI_PTR_DIFF (¤t_sp, NULL); @@ -110,6 +116,43 @@ acpi_ut_track_stack_ptr ( } +/******************************************************************************* + * + * FUNCTION: acpi_ut_trim_function_name + * + * PARAMETERS: function_name - Ascii string containing a procedure name + * + * RETURN: Updated pointer to the function name + * + * DESCRIPTION: Remove the "Acpi" prefix from the function name, if present. + * This allows compiler macros such as __FUNCTION__ to be used + * with no change to the debug output. + * + ******************************************************************************/ + +static const char * +acpi_ut_trim_function_name ( + const char *function_name) +{ + + /* All Function names are longer than 4 chars, check is safe */ + + if (*(ACPI_CAST_PTR (u32, function_name)) == ACPI_FUNCTION_PREFIX1) { + /* This is the case where the original source has not been modified */ + + return (function_name + 4); + } + + if (*(ACPI_CAST_PTR (u32, function_name)) == ACPI_FUNCTION_PREFIX2) { + /* This is the case where the source has been 'linuxized' */ + + return (function_name + 5); + } + + return (function_name); +} + + /******************************************************************************* * * FUNCTION: acpi_ut_debug_print @@ -133,7 +176,7 @@ void ACPI_INTERNAL_VAR_XFACE acpi_ut_debug_print ( u32 requested_debug_level, u32 line_number, - char *function_name, + const char *function_name, char *module_name, u32 component_id, char *format, @@ -177,7 +220,7 @@ acpi_ut_debug_print ( } acpi_os_printf ("[%02ld] %-22.22s: ", - acpi_gbl_nesting_level, function_name); + acpi_gbl_nesting_level, acpi_ut_trim_function_name (function_name)); va_start (args, format); acpi_os_vprintf (format, args); @@ -208,7 +251,7 @@ void ACPI_INTERNAL_VAR_XFACE acpi_ut_debug_print_raw ( u32 requested_debug_level, u32 line_number, - char *function_name, + const char *function_name, char *module_name, u32 component_id, char *format, @@ -247,7 +290,7 @@ EXPORT_SYMBOL(acpi_ut_debug_print_raw); void acpi_ut_trace ( u32 line_number, - char *function_name, + const char *function_name, char *module_name, u32 component_id) { @@ -282,7 +325,7 @@ EXPORT_SYMBOL(acpi_ut_trace); void acpi_ut_trace_ptr ( u32 line_number, - char *function_name, + const char *function_name, char *module_name, u32 component_id, void *pointer) @@ -316,7 +359,7 @@ acpi_ut_trace_ptr ( void acpi_ut_trace_str ( u32 line_number, - char *function_name, + const char *function_name, char *module_name, u32 component_id, char *string) @@ -351,7 +394,7 @@ acpi_ut_trace_str ( void acpi_ut_trace_u32 ( u32 line_number, - char *function_name, + const char *function_name, char *module_name, u32 component_id, u32 integer) @@ -385,7 +428,7 @@ acpi_ut_trace_u32 ( void acpi_ut_exit ( u32 line_number, - char *function_name, + const char *function_name, char *module_name, u32 component_id) { @@ -419,7 +462,7 @@ EXPORT_SYMBOL(acpi_ut_exit); void acpi_ut_status_exit ( u32 line_number, - char *function_name, + const char *function_name, char *module_name, u32 component_id, acpi_status status) @@ -463,7 +506,7 @@ EXPORT_SYMBOL(acpi_ut_status_exit); void acpi_ut_value_exit ( u32 line_number, - char *function_name, + const char *function_name, char *module_name, u32 component_id, acpi_integer value) @@ -499,7 +542,7 @@ EXPORT_SYMBOL(acpi_ut_value_exit); void acpi_ut_ptr_exit ( u32 line_number, - char *function_name, + const char *function_name, char *module_name, u32 component_id, u8 *ptr) @@ -607,8 +650,8 @@ acpi_ut_dump_buffer ( } /* - * Print the ASCII equivalent characters - * But watch out for the bad unprintable ones... + * Print the ASCII equivalent characters but watch out for the bad + * unprintable ones (printable chars are 0x20 through 0x7E) */ acpi_os_printf (" "); for (j = 0; j < 16; j++) { @@ -618,9 +661,7 @@ acpi_ut_dump_buffer ( } buf_char = buffer[i + j]; - if ((buf_char > 0x1F && buf_char < 0x2E) || - (buf_char > 0x2F && buf_char < 0x61) || - (buf_char > 0x60 && buf_char < 0x7F)) { + if (ACPI_IS_PRINT (buf_char)) { acpi_os_printf ("%c", buf_char); } else { diff --git a/drivers/acpi/utilities/utmisc.c b/drivers/acpi/utilities/utmisc.c index df715cd8910..1d350b302a3 100644 --- a/drivers/acpi/utilities/utmisc.c +++ b/drivers/acpi/utilities/utmisc.c @@ -56,7 +56,11 @@ * * PARAMETERS: owner_id - Where the new owner ID is returned * - * DESCRIPTION: Allocate a table or method owner id + * RETURN: Status + * + * DESCRIPTION: Allocate a table or method owner ID. The owner ID is used to + * track objects created by the table or method, to be deleted + * when the method exits or the table is unloaded. * ******************************************************************************/ @@ -71,6 +75,8 @@ acpi_ut_allocate_owner_id ( ACPI_FUNCTION_TRACE ("ut_allocate_owner_id"); + /* Mutex for the global ID mask */ + status = acpi_ut_acquire_mutex (ACPI_MTX_CACHES); if (ACPI_FAILURE (status)) { return_ACPI_STATUS (status); @@ -81,7 +87,7 @@ acpi_ut_allocate_owner_id ( for (i = 0; i < 32; i++) { if (!(acpi_gbl_owner_id_mask & (1 << i))) { acpi_gbl_owner_id_mask |= (1 << i); - *owner_id = (acpi_owner_id) i; + *owner_id = (acpi_owner_id) (i + 1); goto exit; } } @@ -93,6 +99,7 @@ acpi_ut_allocate_owner_id ( * they are released when a table is unloaded or a method completes * execution. */ + *owner_id = 0; status = AE_OWNER_ID_LIMIT; ACPI_REPORT_ERROR (( "Could not allocate new owner_id (32 max), AE_OWNER_ID_LIMIT\n")); @@ -107,40 +114,55 @@ exit: * * FUNCTION: acpi_ut_release_owner_id * - * PARAMETERS: owner_id - A previously allocated owner ID + * PARAMETERS: owner_id_ptr - Pointer to a previously allocated owner_iD * - * DESCRIPTION: Release a table or method owner id + * RETURN: None. No error is returned because we are either exiting a + * control method or unloading a table. Either way, we would + * ignore any error anyway. + * + * DESCRIPTION: Release a table or method owner ID. Valid IDs are 1 - 32 * ******************************************************************************/ -acpi_status +void acpi_ut_release_owner_id ( - acpi_owner_id owner_id) + acpi_owner_id *owner_id_ptr) { + acpi_owner_id owner_id = *owner_id_ptr; acpi_status status; ACPI_FUNCTION_TRACE ("ut_release_owner_id"); + /* Always clear the input owner_id (zero is an invalid ID) */ + + *owner_id_ptr = 0; + + /* Zero is not a valid owner_iD */ + + if ((owner_id == 0) || (owner_id > 32)) { + ACPI_REPORT_ERROR (("Invalid owner_id: %2.2X\n", owner_id)); + return_VOID; + } + + /* Mutex for the global ID mask */ + status = acpi_ut_acquire_mutex (ACPI_MTX_CACHES); if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + return_VOID; } - /* Free the owner ID */ + owner_id--; /* Normalize to zero */ + + /* Free the owner ID only if it is valid */ if (acpi_gbl_owner_id_mask & (1 << owner_id)) { acpi_gbl_owner_id_mask ^= (1 << owner_id); } - else { - /* This owner_id has not been allocated */ - - status = AE_NOT_EXIST; - } (void) acpi_ut_release_mutex (ACPI_MTX_CACHES); - return_ACPI_STATUS (status); + return_VOID; } @@ -150,7 +172,7 @@ acpi_ut_release_owner_id ( * * PARAMETERS: src_string - The source string to convert * - * RETURN: Converted src_string (same as input pointer) + * RETURN: None * * DESCRIPTION: Convert string to uppercase * @@ -158,7 +180,7 @@ acpi_ut_release_owner_id ( * ******************************************************************************/ -char * +void acpi_ut_strupr ( char *src_string) { @@ -169,7 +191,7 @@ acpi_ut_strupr ( if (!src_string) { - return (NULL); + return; } /* Walk entire string, uppercasing the letters */ @@ -178,7 +200,7 @@ acpi_ut_strupr ( *string = (char) ACPI_TOUPPER (*string); } - return (src_string); + return; } diff --git a/include/acpi/acconfig.h b/include/acpi/acconfig.h index aa3c08c6da4..d62af729392 100644 --- a/include/acpi/acconfig.h +++ b/include/acpi/acconfig.h @@ -64,7 +64,7 @@ /* Version string */ -#define ACPI_CA_VERSION 0x20050708 +#define ACPI_CA_VERSION 0x20050729 /* * OS name, used for the _OS object. The _OS object is essentially obsolete, diff --git a/include/acpi/acdispat.h b/include/acpi/acdispat.h index fde6aa9fcd0..90b7d30bd25 100644 --- a/include/acpi/acdispat.h +++ b/include/acpi/acdispat.h @@ -236,7 +236,7 @@ acpi_ds_method_data_init ( */ acpi_status acpi_ds_parse_method ( - acpi_handle obj_handle); + struct acpi_namespace_node *node); acpi_status acpi_ds_call_control_method ( @@ -391,7 +391,7 @@ acpi_ds_init_aml_walk ( u8 *aml_start, u32 aml_length, struct acpi_parameter_info *info, - u32 pass_number); + u8 pass_number); acpi_status acpi_ds_obj_stack_pop_and_delete ( diff --git a/include/acpi/acmacros.h b/include/acpi/acmacros.h index 5b100cef8df..fcdef0a4b01 100644 --- a/include/acpi/acmacros.h +++ b/include/acpi/acmacros.h @@ -505,8 +505,10 @@ * The Name parameter should be the procedure name as a quoted string. * This is declared as a local string ("my_function_name") so that it can * be also used by the function exit macros below. + * Note: (const char) is used to be compatible with the debug interfaces + * and macros such as __FUNCTION__. */ -#define ACPI_FUNCTION_NAME(name) char *_acpi_function_name = name; +#define ACPI_FUNCTION_NAME(name) const char *_acpi_function_name = name; #else /* Compiler supports __FUNCTION__ (or equivalent) -- Ignore this macro */ diff --git a/include/acpi/acnames.h b/include/acpi/acnames.h index deb7cb06f5f..280e9ed7667 100644 --- a/include/acpi/acnames.h +++ b/include/acpi/acnames.h @@ -78,6 +78,11 @@ #define ACPI_NS_ROOT_PATH "\\" #define ACPI_NS_SYSTEM_BUS "_SB_" +/*! [Begin] no source code translation (not handled by acpisrc) */ +#define ACPI_FUNCTION_PREFIX1 'ipcA' +#define ACPI_FUNCTION_PREFIX2 'ipca' +/*! [End] no source code translation !*/ + #endif /* __ACNAMES_H__ */ diff --git a/include/acpi/acnamesp.h b/include/acpi/acnamesp.h index 870e2544bd9..0c9ba707925 100644 --- a/include/acpi/acnamesp.h +++ b/include/acpi/acnamesp.h @@ -124,7 +124,7 @@ acpi_ns_parse_table ( acpi_status acpi_ns_one_complete_parse ( - u32 pass_number, + u8 pass_number, struct acpi_table_desc *table_desc); diff --git a/include/acpi/acparser.h b/include/acpi/acparser.h index ba9548f94de..f692ad56cd8 100644 --- a/include/acpi/acparser.h +++ b/include/acpi/acparser.h @@ -77,12 +77,7 @@ * psxface - Parser external interfaces */ acpi_status -acpi_psx_load_table ( - u8 *pcode_addr, - u32 pcode_length); - -acpi_status -acpi_psx_execute ( +acpi_ps_execute_method ( struct acpi_parameter_info *info); diff --git a/include/acpi/acstruct.h b/include/acpi/acstruct.h index f375c17ad0b..27b22bb3d22 100644 --- a/include/acpi/acstruct.h +++ b/include/acpi/acstruct.h @@ -153,6 +153,7 @@ struct acpi_device_walk_info struct acpi_walk_info { u32 debug_level; + u32 count; acpi_owner_id owner_id; u8 display_type; }; @@ -209,8 +210,10 @@ union acpi_aml_operands struct acpi_parameter_info { struct acpi_namespace_node *node; + union acpi_operand_object *obj_desc; union acpi_operand_object **parameters; union acpi_operand_object *return_object; + u8 pass_number; u8 parameter_type; u8 return_object_type; }; diff --git a/include/acpi/actables.h b/include/acpi/actables.h index 97e6f12da52..e6ceb181964 100644 --- a/include/acpi/actables.h +++ b/include/acpi/actables.h @@ -178,11 +178,15 @@ acpi_tb_validate_rsdp ( * tbutils - common table utilities */ acpi_status +acpi_tb_is_table_installed ( + struct acpi_table_desc *new_table_desc); + +acpi_status acpi_tb_verify_table_checksum ( struct acpi_table_header *table_header); u8 -acpi_tb_checksum ( +acpi_tb_generate_checksum ( void *buffer, u32 length); diff --git a/include/acpi/acutils.h b/include/acpi/acutils.h index 9c05c10e379..0e7b0a3e3b5 100644 --- a/include/acpi/acutils.h +++ b/include/acpi/acutils.h @@ -302,14 +302,14 @@ acpi_ut_track_stack_ptr ( void acpi_ut_trace ( u32 line_number, - char *function_name, + const char *function_name, char *module_name, u32 component_id); void acpi_ut_trace_ptr ( u32 line_number, - char *function_name, + const char *function_name, char *module_name, u32 component_id, void *pointer); @@ -317,7 +317,7 @@ acpi_ut_trace_ptr ( void acpi_ut_trace_u32 ( u32 line_number, - char *function_name, + const char *function_name, char *module_name, u32 component_id, u32 integer); @@ -325,7 +325,7 @@ acpi_ut_trace_u32 ( void acpi_ut_trace_str ( u32 line_number, - char *function_name, + const char *function_name, char *module_name, u32 component_id, char *string); @@ -333,14 +333,14 @@ acpi_ut_trace_str ( void acpi_ut_exit ( u32 line_number, - char *function_name, + const char *function_name, char *module_name, u32 component_id); void acpi_ut_status_exit ( u32 line_number, - char *function_name, + const char *function_name, char *module_name, u32 component_id, acpi_status status); @@ -348,7 +348,7 @@ acpi_ut_status_exit ( void acpi_ut_value_exit ( u32 line_number, - char *function_name, + const char *function_name, char *module_name, u32 component_id, acpi_integer value); @@ -356,7 +356,7 @@ acpi_ut_value_exit ( void acpi_ut_ptr_exit ( u32 line_number, - char *function_name, + const char *function_name, char *module_name, u32 component_id, u8 *ptr); @@ -390,7 +390,7 @@ void ACPI_INTERNAL_VAR_XFACE acpi_ut_debug_print ( u32 requested_debug_level, u32 line_number, - char *function_name, + const char *function_name, char *module_name, u32 component_id, char *format, @@ -400,7 +400,7 @@ void ACPI_INTERNAL_VAR_XFACE acpi_ut_debug_print_raw ( u32 requested_debug_level, u32 line_number, - char *function_name, + const char *function_name, char *module_name, u32 component_id, char *format, @@ -598,9 +598,9 @@ acpi_status acpi_ut_allocate_owner_id ( acpi_owner_id *owner_id); -acpi_status +void acpi_ut_release_owner_id ( - acpi_owner_id owner_id); + acpi_owner_id *owner_id); acpi_status acpi_ut_walk_package_tree ( @@ -609,7 +609,7 @@ acpi_ut_walk_package_tree ( acpi_pkg_callback walk_callback, void *context); -char * +void acpi_ut_strupr ( char *src_string); diff --git a/include/acpi/platform/acenv.h b/include/acpi/platform/acenv.h index aa63202e8d5..bae1fbed097 100644 --- a/include/acpi/platform/acenv.h +++ b/include/acpi/platform/acenv.h @@ -241,15 +241,15 @@ #define ACPI_MEMCPY(d,s,n) (void) memcpy((d), (s), (acpi_size)(n)) #define ACPI_MEMSET(d,s,n) (void) memset((d), (s), (acpi_size)(n)) -#define ACPI_TOUPPER toupper -#define ACPI_TOLOWER tolower -#define ACPI_IS_XDIGIT isxdigit -#define ACPI_IS_DIGIT isdigit -#define ACPI_IS_SPACE isspace -#define ACPI_IS_UPPER isupper -#define ACPI_IS_PRINT isprint -#define ACPI_IS_ALPHA isalpha -#define ACPI_IS_ASCII isascii +#define ACPI_TOUPPER(i) toupper((int) (i)) +#define ACPI_TOLOWER(i) tolower((int) (i)) +#define ACPI_IS_XDIGIT(i) isxdigit((int) (i)) +#define ACPI_IS_DIGIT(i) isdigit((int) (i)) +#define ACPI_IS_SPACE(i) isspace((int) (i)) +#define ACPI_IS_UPPER(i) isupper((int) (i)) +#define ACPI_IS_PRINT(i) isprint((int) (i)) +#define ACPI_IS_ALPHA(i) isalpha((int) (i)) +#define ACPI_IS_ASCII(i) isascii((int) (i)) #else diff --git a/include/acpi/platform/acgcc.h b/include/acpi/platform/acgcc.h index e410e3b6141..39264127574 100644 --- a/include/acpi/platform/acgcc.h +++ b/include/acpi/platform/acgcc.h @@ -46,7 +46,7 @@ /* Function name is used for debug output. Non-ANSI, compiler-dependent */ -#define ACPI_GET_FUNCTION_NAME (char *) __FUNCTION__ +#define ACPI_GET_FUNCTION_NAME __FUNCTION__ /* This macro is used to tag functions as "printf-like" because * some compilers (like GCC) can catch printf format string problems. -- cgit v1.2.3-70-g09d2 From d3301874083874f8a0ac88aa1bb7da6b62df34d2 Mon Sep 17 00:00:00 2001 From: Mike Anderson Date: Thu, 16 Jun 2005 11:12:38 -0700 Subject: [SCSI] host state model update: replace old host bitmap state Migrate the current SCSI host state model to a model like SCSI device is using. Signed-off-by: Mike Anderson Rejections fixed up and Signed-off-by: James Bottomley --- drivers/scsi/hosts.c | 88 +++++++++++++++++++++++++++++++++++++++++++---- drivers/scsi/scsi.c | 2 +- drivers/scsi/scsi_error.c | 7 ++-- drivers/scsi/scsi_ioctl.c | 3 +- drivers/scsi/scsi_lib.c | 4 +-- drivers/scsi/scsi_sysfs.c | 62 +++++++++++++++++++++++++++++++++ drivers/scsi/sg.c | 3 +- include/scsi/scsi_host.h | 14 +++++--- 8 files changed, 162 insertions(+), 21 deletions(-) (limited to 'include') diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c index 5feb886c339..6828ca305c2 100644 --- a/drivers/scsi/hosts.c +++ b/drivers/scsi/hosts.c @@ -51,6 +51,82 @@ static struct class shost_class = { .release = scsi_host_cls_release, }; +/** + * scsi_host_set_state - Take the given host through the host + * state model. + * @shost: scsi host to change the state of. + * @state: state to change to. + * + * Returns zero if unsuccessful or an error if the requested + * transition is illegal. + **/ +int scsi_host_set_state(struct Scsi_Host *shost, enum scsi_host_state state) +{ + enum scsi_host_state oldstate = shost->shost_state; + + if (state == oldstate) + return 0; + + switch (state) { + case SHOST_CREATED: + /* There are no legal states that come back to + * created. This is the manually initialised start + * state */ + goto illegal; + + case SHOST_RUNNING: + switch (oldstate) { + case SHOST_CREATED: + case SHOST_RECOVERY: + break; + default: + goto illegal; + } + break; + + case SHOST_RECOVERY: + switch (oldstate) { + case SHOST_RUNNING: + break; + default: + goto illegal; + } + break; + + case SHOST_CANCEL: + switch (oldstate) { + case SHOST_CREATED: + case SHOST_RUNNING: + break; + default: + goto illegal; + } + break; + + case SHOST_DEL: + switch (oldstate) { + case SHOST_CANCEL: + break; + default: + goto illegal; + } + break; + + } + shost->shost_state = state; + return 0; + + illegal: + SCSI_LOG_ERROR_RECOVERY(1, + dev_printk(KERN_ERR, &shost->shost_gendev, + "Illegal host state transition" + "%s->%s\n", + scsi_host_state_name(oldstate), + scsi_host_state_name(state))); + return -EINVAL; +} +EXPORT_SYMBOL(scsi_host_set_state); + /** * scsi_host_cancel - cancel outstanding IO to this host * @shost: pointer to struct Scsi_Host @@ -60,12 +136,11 @@ static void scsi_host_cancel(struct Scsi_Host *shost, int recovery) { struct scsi_device *sdev; - set_bit(SHOST_CANCEL, &shost->shost_state); + scsi_host_set_state(shost, SHOST_CANCEL); shost_for_each_device(sdev, shost) { scsi_device_cancel(sdev, recovery); } - wait_event(shost->host_wait, (!test_bit(SHOST_RECOVERY, - &shost->shost_state))); + wait_event(shost->host_wait, (shost->shost_state != SHOST_RECOVERY)); } /** @@ -78,7 +153,7 @@ void scsi_remove_host(struct Scsi_Host *shost) scsi_host_cancel(shost, 0); scsi_proc_host_rm(shost); - set_bit(SHOST_DEL, &shost->shost_state); + scsi_host_set_state(shost, SHOST_DEL); transport_unregister_device(&shost->shost_gendev); class_device_unregister(&shost->shost_classdev); @@ -115,7 +190,7 @@ int scsi_add_host(struct Scsi_Host *shost, struct device *dev) if (error) goto out; - set_bit(SHOST_ADD, &shost->shost_state); + scsi_host_set_state(shost, SHOST_RUNNING); get_device(shost->shost_gendev.parent); error = class_device_add(&shost->shost_classdev); @@ -226,6 +301,7 @@ struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize) spin_lock_init(&shost->default_lock); scsi_assign_lock(shost, &shost->default_lock); + shost->shost_state = SHOST_CREATED; INIT_LIST_HEAD(&shost->__devices); INIT_LIST_HEAD(&shost->__targets); INIT_LIST_HEAD(&shost->eh_cmd_q); @@ -382,7 +458,7 @@ EXPORT_SYMBOL(scsi_host_lookup); **/ struct Scsi_Host *scsi_host_get(struct Scsi_Host *shost) { - if (test_bit(SHOST_DEL, &shost->shost_state) || + if ((shost->shost_state == SHOST_DEL) || !get_device(&shost->shost_gendev)) return NULL; return shost; diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c index d14523d7e44..fb85b3ced7b 100644 --- a/drivers/scsi/scsi.c +++ b/drivers/scsi/scsi.c @@ -627,7 +627,7 @@ int scsi_dispatch_cmd(struct scsi_cmnd *cmd) spin_lock_irqsave(host->host_lock, flags); scsi_cmd_get_serial(host, cmd); - if (unlikely(test_bit(SHOST_CANCEL, &host->shost_state))) { + if (unlikely(host->shost_state == SHOST_CANCEL)) { cmd->result = (DID_NO_CONNECT << 16); scsi_done(cmd); } else { diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c index 0fc8b48f052..e9c451ba71f 100644 --- a/drivers/scsi/scsi_error.c +++ b/drivers/scsi/scsi_error.c @@ -75,7 +75,7 @@ int scsi_eh_scmd_add(struct scsi_cmnd *scmd, int eh_flag) scmd->eh_eflags |= eh_flag; list_add_tail(&scmd->eh_entry, &shost->eh_cmd_q); - set_bit(SHOST_RECOVERY, &shost->shost_state); + scsi_host_set_state(shost, SHOST_RECOVERY); shost->host_failed++; scsi_eh_wakeup(shost); spin_unlock_irqrestore(shost->host_lock, flags); @@ -197,7 +197,8 @@ int scsi_block_when_processing_errors(struct scsi_device *sdev) { int online; - wait_event(sdev->host->host_wait, (!test_bit(SHOST_RECOVERY, &sdev->host->shost_state))); + wait_event(sdev->host->host_wait, (sdev->host->shost_state != + SHOST_RECOVERY)); online = scsi_device_online(sdev); @@ -1458,7 +1459,7 @@ static void scsi_restart_operations(struct Scsi_Host *shost) SCSI_LOG_ERROR_RECOVERY(3, printk("%s: waking up host to restart\n", __FUNCTION__)); - clear_bit(SHOST_RECOVERY, &shost->shost_state); + scsi_host_set_state(shost, SHOST_RUNNING); wake_up(&shost->host_wait); diff --git a/drivers/scsi/scsi_ioctl.c b/drivers/scsi/scsi_ioctl.c index 7a6b530115a..f5bf5c07be9 100644 --- a/drivers/scsi/scsi_ioctl.c +++ b/drivers/scsi/scsi_ioctl.c @@ -475,8 +475,7 @@ int scsi_nonblockable_ioctl(struct scsi_device *sdev, int cmd, * error processing, as long as the device was opened * non-blocking */ if (filp && filp->f_flags & O_NONBLOCK) { - if (test_bit(SHOST_RECOVERY, - &sdev->host->shost_state)) + if (sdev->host->shost_state == SHOST_RECOVERY) return -ENODEV; } else if (!scsi_block_when_processing_errors(sdev)) return -ENODEV; diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 7a91ca3d32a..060010bccab 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -348,7 +348,7 @@ void scsi_device_unbusy(struct scsi_device *sdev) spin_lock_irqsave(shost->host_lock, flags); shost->host_busy--; - if (unlikely(test_bit(SHOST_RECOVERY, &shost->shost_state) && + if (unlikely((shost->shost_state == SHOST_RECOVERY) && shost->host_failed)) scsi_eh_wakeup(shost); spin_unlock(shost->host_lock); @@ -1207,7 +1207,7 @@ static inline int scsi_host_queue_ready(struct request_queue *q, struct Scsi_Host *shost, struct scsi_device *sdev) { - if (test_bit(SHOST_RECOVERY, &shost->shost_state)) + if (shost->shost_state == SHOST_RECOVERY) return 0; if (shost->host_busy == 0 && shost->host_blocked) { /* diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c index beed7fbe1cb..dae59d1da07 100644 --- a/drivers/scsi/scsi_sysfs.c +++ b/drivers/scsi/scsi_sysfs.c @@ -48,6 +48,30 @@ const char *scsi_device_state_name(enum scsi_device_state state) return name; } +static struct { + enum scsi_host_state value; + char *name; +} shost_states[] = { + { SHOST_CREATED, "created" }, + { SHOST_RUNNING, "running" }, + { SHOST_CANCEL, "cancel" }, + { SHOST_DEL, "deleted" }, + { SHOST_RECOVERY, "recovery" }, +}; +const char *scsi_host_state_name(enum scsi_host_state state) +{ + int i; + char *name = NULL; + + for (i = 0; i < sizeof(shost_states)/sizeof(shost_states[0]); i++) { + if (shost_states[i].value == state) { + name = shost_states[i].name; + break; + } + } + return name; +} + static int check_set(unsigned int *val, char *src) { char *last; @@ -124,6 +148,43 @@ static ssize_t store_scan(struct class_device *class_dev, const char *buf, }; static CLASS_DEVICE_ATTR(scan, S_IWUSR, NULL, store_scan); +static ssize_t +store_shost_state(struct class_device *class_dev, const char *buf, size_t count) +{ + int i; + struct Scsi_Host *shost = class_to_shost(class_dev); + enum scsi_host_state state = 0; + + for (i = 0; i < sizeof(shost_states)/sizeof(shost_states[0]); i++) { + const int len = strlen(shost_states[i].name); + if (strncmp(shost_states[i].name, buf, len) == 0 && + buf[len] == '\n') { + state = shost_states[i].value; + break; + } + } + if (!state) + return -EINVAL; + + if (scsi_host_set_state(shost, state)) + return -EINVAL; + return count; +} + +static ssize_t +show_shost_state(struct class_device *class_dev, char *buf) +{ + struct Scsi_Host *shost = class_to_shost(class_dev); + const char *name = scsi_host_state_name(shost->shost_state); + + if (!name) + return -EINVAL; + + return snprintf(buf, 20, "%s\n", name); +} + +static CLASS_DEVICE_ATTR(state, S_IRUGO | S_IWUSR, show_shost_state, store_shost_state); + shost_rd_attr(unique_id, "%u\n"); shost_rd_attr(host_busy, "%hu\n"); shost_rd_attr(cmd_per_lun, "%hd\n"); @@ -139,6 +200,7 @@ static struct class_device_attribute *scsi_sysfs_shost_attrs[] = { &class_device_attr_unchecked_isa_dma, &class_device_attr_proc_name, &class_device_attr_scan, + &class_device_attr_state, NULL }; diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index 51292f269ce..14fb179b384 100644 --- a/drivers/scsi/sg.c +++ b/drivers/scsi/sg.c @@ -1027,8 +1027,7 @@ sg_ioctl(struct inode *inode, struct file *filp, if (sdp->detached) return -ENODEV; if (filp->f_flags & O_NONBLOCK) { - if (test_bit(SHOST_RECOVERY, - &sdp->device->host->shost_state)) + if (sdp->device->host->shost_state == SHOST_RECOVERY) return -EBUSY; } else if (!scsi_block_when_processing_errors(sdp->device)) return -EBUSY; diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h index 81d5234f677..0b1e275b269 100644 --- a/include/scsi/scsi_host.h +++ b/include/scsi/scsi_host.h @@ -429,12 +429,15 @@ struct scsi_host_template { }; /* - * shost states + * shost state: If you alter this, you also need to alter scsi_sysfs.c + * (for the ascii descriptions) and the state model enforcer: + * scsi_host_set_state() */ -enum { - SHOST_ADD, - SHOST_DEL, +enum scsi_host_state { + SHOST_CREATED = 1, + SHOST_RUNNING, SHOST_CANCEL, + SHOST_DEL, SHOST_RECOVERY, }; @@ -575,7 +578,7 @@ struct Scsi_Host { unsigned int irq; - unsigned long shost_state; + enum scsi_host_state shost_state; /* ldm bits */ struct device shost_gendev; @@ -633,6 +636,7 @@ extern void scsi_remove_host(struct Scsi_Host *); extern struct Scsi_Host *scsi_host_get(struct Scsi_Host *); extern void scsi_host_put(struct Scsi_Host *t); extern struct Scsi_Host *scsi_host_lookup(unsigned short); +extern const char *scsi_host_state_name(enum scsi_host_state); extern u64 scsi_calculate_bounce_limit(struct Scsi_Host *); -- cgit v1.2.3-70-g09d2 From 82f29467a025f6a2192d281e97fca0be46e905cc Mon Sep 17 00:00:00 2001 From: Mike Anderson Date: Thu, 16 Jun 2005 11:14:33 -0700 Subject: [SCSI] host state model update: mediate host add/remove race Add support to not allow additions to a host when it is being removed. Signed-off-by: Mike Anderson Signed-off-by: James Bottomley --- drivers/scsi/hosts.c | 2 ++ drivers/scsi/scsi_scan.c | 21 ++++++++++++++------- include/scsi/scsi_host.h | 9 +++++++++ 3 files changed, 25 insertions(+), 7 deletions(-) (limited to 'include') diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c index 67c4c0c3aa5..8640ad1c17e 100644 --- a/drivers/scsi/hosts.c +++ b/drivers/scsi/hosts.c @@ -133,7 +133,9 @@ EXPORT_SYMBOL(scsi_host_set_state); **/ void scsi_remove_host(struct Scsi_Host *shost) { + down(&shost->scan_mutex); scsi_host_set_state(shost, SHOST_CANCEL); + up(&shost->scan_mutex); scsi_forget_host(shost); scsi_proc_host_rm(shost); diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c index 2d3c4ac475f..076cbe3b5a0 100644 --- a/drivers/scsi/scsi_scan.c +++ b/drivers/scsi/scsi_scan.c @@ -1251,9 +1251,12 @@ struct scsi_device *__scsi_add_device(struct Scsi_Host *shost, uint channel, get_device(&starget->dev); down(&shost->scan_mutex); - res = scsi_probe_and_add_lun(starget, lun, NULL, &sdev, 1, hostdata); - if (res != SCSI_SCAN_LUN_PRESENT) - sdev = ERR_PTR(-ENODEV); + if (scsi_host_scan_allowed(shost)) { + res = scsi_probe_and_add_lun(starget, lun, NULL, &sdev, 1, + hostdata); + if (res != SCSI_SCAN_LUN_PRESENT) + sdev = ERR_PTR(-ENODEV); + } up(&shost->scan_mutex); scsi_target_reap(starget); put_device(&starget->dev); @@ -1403,11 +1406,15 @@ int scsi_scan_host_selected(struct Scsi_Host *shost, unsigned int channel, return -EINVAL; down(&shost->scan_mutex); - if (channel == SCAN_WILD_CARD) - for (channel = 0; channel <= shost->max_channel; channel++) + if (scsi_host_scan_allowed(shost)) { + if (channel == SCAN_WILD_CARD) + for (channel = 0; channel <= shost->max_channel; + channel++) + scsi_scan_channel(shost, channel, id, lun, + rescan); + else scsi_scan_channel(shost, channel, id, lun, rescan); - else - scsi_scan_channel(shost, channel, id, lun, rescan); + } up(&shost->scan_mutex); return 0; diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h index 0b1e275b269..1ea5b51d174 100644 --- a/include/scsi/scsi_host.h +++ b/include/scsi/scsi_host.h @@ -650,6 +650,15 @@ static inline struct device *scsi_get_device(struct Scsi_Host *shost) return shost->shost_gendev.parent; } +/** + * scsi_host_scan_allowed - Is scanning of this host allowed + * @shost: Pointer to Scsi_Host. + **/ +static inline int scsi_host_scan_allowed(struct Scsi_Host *shost) +{ + return shost->shost_state == SHOST_RUNNING; +} + extern void scsi_unblock_requests(struct Scsi_Host *); extern void scsi_block_requests(struct Scsi_Host *); -- cgit v1.2.3-70-g09d2 From 47ba39eead9f4495cd6a3eca39d7c73d0f0d61c9 Mon Sep 17 00:00:00 2001 From: James Bottomley Date: Sat, 30 Jul 2005 11:39:53 -0500 Subject: [SCSI] add template for scsi_host_set_state() Fixes up some warnings in the tree. Signed-off-by: James Bottomley --- include/scsi/scsi_host.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h index 1ea5b51d174..ac1b6125e3a 100644 --- a/include/scsi/scsi_host.h +++ b/include/scsi/scsi_host.h @@ -676,5 +676,6 @@ extern struct scsi_device *scsi_get_host_dev(struct Scsi_Host *); /* legacy interfaces */ extern struct Scsi_Host *scsi_register(struct scsi_host_template *, int); extern void scsi_unregister(struct Scsi_Host *); +extern int scsi_host_set_state(struct Scsi_Host *, enum scsi_host_state); #endif /* _SCSI_SCSI_HOST_H */ -- cgit v1.2.3-70-g09d2 From d872ebe4549576e7aab60ed7c746193196381dd0 Mon Sep 17 00:00:00 2001 From: James Bottomley Date: Wed, 3 Aug 2005 15:43:52 -0500 Subject: [SCSI] add missing hold_mcs parameter to the spi transport class This parameter is important only to people who take the time to tune the margin control settings, otherwise it's completely irrelevant. However, just in case anyone should want to do this, it's appropriate to include the parameter. I don't do anything with it in DV by design, so the parameter will come up as off by default, so if anyone actually wants to play with the margin control settings they'll have to enable it under the spi_transport class first. I also updated the transfer settings display to report all of the PPR settings instead of only DT, IU and QAS Signed-off-by: James Bottomley --- drivers/scsi/scsi_transport_spi.c | 20 +++++++++++++++----- include/scsi/scsi_transport_spi.h | 5 +++++ 2 files changed, 20 insertions(+), 5 deletions(-) (limited to 'include') diff --git a/drivers/scsi/scsi_transport_spi.c b/drivers/scsi/scsi_transport_spi.c index 7670919a087..e7b9570c818 100644 --- a/drivers/scsi/scsi_transport_spi.c +++ b/drivers/scsi/scsi_transport_spi.c @@ -35,7 +35,7 @@ #define SPI_PRINTK(x, l, f, a...) dev_printk(l, &(x)->dev, f , ##a) -#define SPI_NUM_ATTRS 13 /* increase this if you add attributes */ +#define SPI_NUM_ATTRS 14 /* increase this if you add attributes */ #define SPI_OTHER_ATTRS 1 /* Increase this if you add "always * on" attributes */ #define SPI_HOST_ATTRS 1 @@ -231,6 +231,7 @@ static int spi_setup_transport_attrs(struct device *dev) spi_rd_strm(starget) = 0; spi_rti(starget) = 0; spi_pcomp_en(starget) = 0; + spi_hold_mcs(starget) = 0; spi_dv_pending(starget) = 0; spi_initial_dv(starget) = 0; init_MUTEX(&spi_dv_sem(starget)); @@ -347,6 +348,7 @@ spi_transport_rd_attr(wr_flow, "%d\n"); spi_transport_rd_attr(rd_strm, "%d\n"); spi_transport_rd_attr(rti, "%d\n"); spi_transport_rd_attr(pcomp_en, "%d\n"); +spi_transport_rd_attr(hold_mcs, "%d\n"); /* we only care about the first child device so we return 1 */ static int child_iter(struct device *dev, void *data) @@ -1028,10 +1030,17 @@ void spi_display_xfer_agreement(struct scsi_target *starget) sprint_frac(tmp, picosec, 1000); dev_info(&starget->dev, - "%s %sSCSI %d.%d MB/s %s%s%s (%s ns, offset %d)\n", - scsi, tp->width ? "WIDE " : "", kb100/10, kb100 % 10, - tp->dt ? "DT" : "ST", tp->iu ? " IU" : "", - tp->qas ? " QAS" : "", tmp, tp->offset); + "%s %sSCSI %d.%d MB/s %s%s%s%s%s%s%s%s (%s ns, offset %d)\n", + scsi, tp->width ? "WIDE " : "", kb100/10, kb100 % 10, + tp->dt ? "DT" : "ST", + tp->iu ? " IU" : "", + tp->qas ? " QAS" : "", + tp->rd_strm ? " RDSTRM" : "", + tp->rti ? " RTI" : "", + tp->wr_flow ? " WRFLOW" : "", + tp->pcomp_en ? " PCOMP" : "", + tp->hold_mcs ? " HMCS" : "", + tmp, tp->offset); } else { dev_info(&starget->dev, "%sasynchronous.\n", tp->width ? "wide " : ""); @@ -1154,6 +1163,7 @@ spi_attach_transport(struct spi_function_template *ft) SETUP_ATTRIBUTE(rd_strm); SETUP_ATTRIBUTE(rti); SETUP_ATTRIBUTE(pcomp_en); + SETUP_ATTRIBUTE(hold_mcs); /* if you add an attribute but forget to increase SPI_NUM_ATTRS * this bug will trigger */ diff --git a/include/scsi/scsi_transport_spi.h b/include/scsi/scsi_transport_spi.h index a30d6cd4c0e..d8ef86006e0 100644 --- a/include/scsi/scsi_transport_spi.h +++ b/include/scsi/scsi_transport_spi.h @@ -39,6 +39,7 @@ struct spi_transport_attrs { unsigned int rd_strm:1; /* Read streaming enabled */ unsigned int rti:1; /* Retain Training Information */ unsigned int pcomp_en:1;/* Precompensation enabled */ + unsigned int hold_mcs:1;/* Hold Margin Control Settings */ unsigned int initial_dv:1; /* DV done to this target yet */ unsigned long flags; /* flags field for drivers to use */ /* Device Properties fields */ @@ -78,6 +79,7 @@ struct spi_host_attrs { #define spi_rd_strm(x) (((struct spi_transport_attrs *)&(x)->starget_data)->rd_strm) #define spi_rti(x) (((struct spi_transport_attrs *)&(x)->starget_data)->rti) #define spi_pcomp_en(x) (((struct spi_transport_attrs *)&(x)->starget_data)->pcomp_en) +#define spi_hold_mcs(x) (((struct spi_transport_attrs *)&(x)->starget_data)->hold_mcs) #define spi_initial_dv(x) (((struct spi_transport_attrs *)&(x)->starget_data)->initial_dv) #define spi_support_sync(x) (((struct spi_transport_attrs *)&(x)->starget_data)->support_sync) @@ -114,6 +116,8 @@ struct spi_function_template { void (*set_rti)(struct scsi_target *, int); void (*get_pcomp_en)(struct scsi_target *); void (*set_pcomp_en)(struct scsi_target *, int); + void (*get_hold_mcs)(struct scsi_target *); + void (*set_hold_mcs)(struct scsi_target *, int); void (*get_signalling)(struct Scsi_Host *); void (*set_signalling)(struct Scsi_Host *, enum spi_signal_type); /* The driver sets these to tell the transport class it @@ -130,6 +134,7 @@ struct spi_function_template { unsigned long show_rd_strm:1; unsigned long show_rti:1; unsigned long show_pcomp_en:1; + unsigned long show_hold_mcs:1; }; struct scsi_transport_template *spi_attach_transport(struct spi_function_template *); -- cgit v1.2.3-70-g09d2 From 1f3a6a15771ed70d3b2581663dcc6b9bc134baa5 Mon Sep 17 00:00:00 2001 From: Kenji Kaneshige Date: Thu, 28 Jul 2005 14:42:00 -0400 Subject: [ACPI] acpi_register_gsi() can return error Current acpi_register_gsi() function has no way to indicate errors to its callers even though acpi_register_gsi() can fail to register gsi because of some reasons (out of memory, lack of interrupt vectors, incorrect BIOS, and so on). As a result, caller of acpi_register_gsi() cannot handle the case that acpi_register_gsi() fails. I think failure of acpi_register_gsi() should be handled properly. This series of patches changes acpi_register_gsi() to return negative value on error, and also changes callers of acpi_register_gsi() to handle failure of acpi_register_gsi(). This patch changes the type of return value of acpi_register_gsi() from "unsigned int" to "int" to indicate an error. If acpi_register_gsi() fails to register gsi, it returns negative value. Signed-off-by: Kenji Kaneshige Signed-off-by: Andrew Morton Signed-off-by: Len Brown --- arch/i386/kernel/acpi/boot.c | 6 +++++- arch/ia64/kernel/acpi.c | 6 +++++- include/linux/acpi.h | 2 +- 3 files changed, 11 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/arch/i386/kernel/acpi/boot.c b/arch/i386/kernel/acpi/boot.c index 848bb97af7c..364f4b7c4e3 100644 --- a/arch/i386/kernel/acpi/boot.c +++ b/arch/i386/kernel/acpi/boot.c @@ -457,7 +457,11 @@ int acpi_gsi_to_irq(u32 gsi, unsigned int *irq) return 0; } -unsigned int acpi_register_gsi(u32 gsi, int edge_level, int active_high_low) +/* + * success: return IRQ number (>=0) + * failure: return < 0 + */ +int acpi_register_gsi(u32 gsi, int edge_level, int active_high_low) { unsigned int irq; unsigned int plat_gsi = gsi; diff --git a/arch/ia64/kernel/acpi.c b/arch/ia64/kernel/acpi.c index 1c118b72df3..7513ff9361a 100644 --- a/arch/ia64/kernel/acpi.c +++ b/arch/ia64/kernel/acpi.c @@ -565,7 +565,11 @@ acpi_numa_arch_fixup (void) } #endif /* CONFIG_ACPI_NUMA */ -unsigned int +/* + * success: return IRQ number (>=0) + * failure: return < 0 + */ +int acpi_register_gsi (u32 gsi, int edge_level, int active_high_low) { if (has_8259 && gsi < 16) diff --git a/include/linux/acpi.h b/include/linux/acpi.h index ca0cd240cee..9378bcde73a 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h @@ -432,7 +432,7 @@ static inline int acpi_boot_table_init(void) #endif /*!CONFIG_ACPI_BOOT*/ -unsigned int acpi_register_gsi (u32 gsi, int edge_level, int active_high_low); +int acpi_register_gsi (u32 gsi, int edge_level, int active_high_low); int acpi_gsi_to_irq (u32 gsi, unsigned int *irq); /* -- cgit v1.2.3-70-g09d2 From 53de49f52e305e96143375d1741f15acff7bf34b Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Sat, 30 Jul 2005 04:18:00 -0400 Subject: [ACPI] CONFIG_ACPI=n build fix Signed-off-by: Andrew Morton Signed-off-by: Len Brown --- include/linux/acpi.h | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'include') diff --git a/include/linux/acpi.h b/include/linux/acpi.h index 9378bcde73a..bf96ae9d93a 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h @@ -420,16 +420,6 @@ extern int sbf_port ; #define acpi_mp_config 0 -static inline int acpi_boot_init(void) -{ - return 0; -} - -static inline int acpi_boot_table_init(void) -{ - return 0; -} - #endif /*!CONFIG_ACPI_BOOT*/ int acpi_register_gsi (u32 gsi, int edge_level, int active_high_low); @@ -536,5 +526,17 @@ static inline int acpi_get_pxm(acpi_handle handle) extern int pnpacpi_disabled; +#else /* CONFIG_ACPI */ + +static inline int acpi_boot_init(void) +{ + return 0; +} + +static inline int acpi_boot_table_init(void) +{ + return 0; +} + #endif /* CONFIG_ACPI */ #endif /*_LINUX_ACPI_H*/ -- cgit v1.2.3-70-g09d2 From e92310a930462c6e1611f35453f57357c42bde14 Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Sat, 30 Jul 2005 04:18:00 -0400 Subject: [ACPI] fix IA64 build warning Signed-off-by: Andrew Morton Signed-off-by: Len Brown --- include/asm-ia64/acpi-ext.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/asm-ia64/acpi-ext.h b/include/asm-ia64/acpi-ext.h index 9271d74c64c..56d2ddc97b3 100644 --- a/include/asm-ia64/acpi-ext.h +++ b/include/asm-ia64/acpi-ext.h @@ -11,6 +11,7 @@ #define _ASM_IA64_ACPI_EXT_H #include +#include extern acpi_status hp_acpi_csr_space (acpi_handle, u64 *base, u64 *length); -- cgit v1.2.3-70-g09d2 From 4be44fcd3bf648b782f4460fd06dfae6c42ded4b Mon Sep 17 00:00:00 2001 From: Len Brown Date: Fri, 5 Aug 2005 00:44:28 -0400 Subject: [ACPI] Lindent all ACPI files Signed-off-by: Len Brown --- arch/i386/kernel/acpi/boot.c | 530 +++++++++-------- arch/i386/kernel/acpi/earlyquirk.c | 40 +- arch/i386/kernel/acpi/sleep.c | 35 +- arch/ia64/kernel/acpi-ext.c | 37 +- arch/ia64/kernel/acpi.c | 324 ++++++----- arch/x86_64/kernel/acpi/sleep.c | 17 +- drivers/acpi/ac.c | 138 ++--- drivers/acpi/acpi_memhotplug.c | 176 +++--- drivers/acpi/asus_acpi.c | 690 +++++++++++----------- drivers/acpi/battery.c | 400 ++++++------- drivers/acpi/blacklist.c | 122 ++-- drivers/acpi/bus.c | 310 +++++----- drivers/acpi/button.c | 274 ++++----- drivers/acpi/container.c | 128 ++--- drivers/acpi/debug.c | 115 ++-- drivers/acpi/dispatcher/dsfield.c | 346 ++++++----- drivers/acpi/dispatcher/dsinit.c | 123 ++-- drivers/acpi/dispatcher/dsmethod.c | 354 ++++++------ drivers/acpi/dispatcher/dsmthdat.c | 413 +++++++------- drivers/acpi/dispatcher/dsobject.c | 329 +++++------ drivers/acpi/dispatcher/dsopcode.c | 710 +++++++++++------------ drivers/acpi/dispatcher/dsutils.c | 421 +++++++------- drivers/acpi/dispatcher/dswexec.c | 519 +++++++++-------- drivers/acpi/dispatcher/dswload.c | 488 ++++++++-------- drivers/acpi/dispatcher/dswscope.c | 139 ++--- drivers/acpi/dispatcher/dswstate.c | 640 ++++++++++----------- drivers/acpi/ec.c | 957 ++++++++++++++----------------- drivers/acpi/event.c | 62 +- drivers/acpi/events/evevent.c | 168 +++--- drivers/acpi/events/evgpe.c | 428 +++++++------- drivers/acpi/events/evgpeblk.c | 756 ++++++++++++------------- drivers/acpi/events/evmisc.c | 294 +++++----- drivers/acpi/events/evregion.c | 582 +++++++++---------- drivers/acpi/events/evrgnini.c | 311 +++++----- drivers/acpi/events/evsci.c | 77 +-- drivers/acpi/events/evxface.c | 446 +++++++-------- drivers/acpi/events/evxfevnt.c | 463 +++++++-------- drivers/acpi/events/evxfregn.c | 114 ++-- drivers/acpi/executer/exconfig.c | 319 +++++------ drivers/acpi/executer/exconvrt.c | 311 +++++----- drivers/acpi/executer/excreate.c | 342 +++++------ drivers/acpi/executer/exdump.c | 744 ++++++++++++------------ drivers/acpi/executer/exfield.c | 252 ++++----- drivers/acpi/executer/exfldio.c | 644 ++++++++++----------- drivers/acpi/executer/exmisc.c | 358 ++++++------ drivers/acpi/executer/exmutex.c | 160 +++--- drivers/acpi/executer/exnames.c | 235 ++++---- drivers/acpi/executer/exoparg1.c | 555 +++++++++--------- drivers/acpi/executer/exoparg2.c | 317 +++++------ drivers/acpi/executer/exoparg3.c | 116 ++-- drivers/acpi/executer/exoparg6.c | 127 ++--- drivers/acpi/executer/exprep.c | 381 ++++++------- drivers/acpi/executer/exregion.c | 280 ++++----- drivers/acpi/executer/exresnte.c | 172 +++--- drivers/acpi/executer/exresolv.c | 284 +++++----- drivers/acpi/executer/exresop.c | 390 ++++++------- drivers/acpi/executer/exstore.c | 415 +++++++------- drivers/acpi/executer/exstoren.c | 121 ++-- drivers/acpi/executer/exstorob.c | 86 ++- drivers/acpi/executer/exsystem.c | 183 +++--- drivers/acpi/executer/exutils.c | 171 ++---- drivers/acpi/fan.c | 125 ++-- drivers/acpi/glue.c | 6 +- drivers/acpi/hardware/hwacpi.c | 116 ++-- drivers/acpi/hardware/hwgpe.c | 197 +++---- drivers/acpi/hardware/hwregs.c | 600 ++++++++++---------- drivers/acpi/hardware/hwsleep.c | 415 +++++++------- drivers/acpi/hardware/hwtimer.c | 77 +-- drivers/acpi/hotkey.c | 233 ++++---- drivers/acpi/ibm_acpi.c | 322 +++++------ drivers/acpi/motherboard.c | 108 ++-- drivers/acpi/namespace/nsaccess.c | 342 +++++------ drivers/acpi/namespace/nsalloc.c | 232 +++----- drivers/acpi/namespace/nsdump.c | 429 +++++++------- drivers/acpi/namespace/nsdumpdv.c | 74 +-- drivers/acpi/namespace/nseval.c | 270 ++++----- drivers/acpi/namespace/nsinit.c | 257 ++++----- drivers/acpi/namespace/nsload.c | 228 ++++---- drivers/acpi/namespace/nsnames.c | 118 ++-- drivers/acpi/namespace/nsobject.c | 209 +++---- drivers/acpi/namespace/nsparse.c | 86 ++- drivers/acpi/namespace/nssearch.c | 205 ++++--- drivers/acpi/namespace/nsutils.c | 502 +++++++--------- drivers/acpi/namespace/nswalk.c | 105 ++-- drivers/acpi/namespace/nsxfeval.c | 430 +++++++------- drivers/acpi/namespace/nsxfname.c | 173 +++--- drivers/acpi/namespace/nsxfobj.c | 91 ++- drivers/acpi/numa.c | 125 ++-- drivers/acpi/osl.c | 567 ++++++++----------- drivers/acpi/parser/psargs.c | 376 ++++++------ drivers/acpi/parser/psloop.c | 511 ++++++++++------- drivers/acpi/parser/psopcode.c | 719 ++++++++++++++++------- drivers/acpi/parser/psparse.c | 362 ++++++------ drivers/acpi/parser/psscope.c | 130 ++--- drivers/acpi/parser/pstree.c | 92 +-- drivers/acpi/parser/psutils.c | 105 ++-- drivers/acpi/parser/pswalk.c | 26 +- drivers/acpi/parser/psxface.c | 142 ++--- drivers/acpi/pci_bind.c | 219 ++++--- drivers/acpi/pci_irq.c | 263 ++++----- drivers/acpi/pci_link.c | 477 ++++++++-------- drivers/acpi/pci_root.c | 130 ++--- drivers/acpi/power.c | 271 ++++----- drivers/acpi/processor_core.c | 437 +++++++------- drivers/acpi/processor_idle.c | 315 ++++++----- drivers/acpi/processor_perflib.c | 297 +++++----- drivers/acpi/processor_thermal.c | 153 +++-- drivers/acpi/processor_throttling.c | 133 ++--- drivers/acpi/resources/rsaddr.c | 503 ++++++++-------- drivers/acpi/resources/rscalc.c | 314 +++++----- drivers/acpi/resources/rscreate.c | 297 +++++----- drivers/acpi/resources/rsdump.c | 847 +++++++++++++-------------- drivers/acpi/resources/rsio.c | 172 +++--- drivers/acpi/resources/rsirq.c | 236 ++++---- drivers/acpi/resources/rslist.c | 279 ++++----- drivers/acpi/resources/rsmemory.c | 218 ++++--- drivers/acpi/resources/rsmisc.c | 230 +++----- drivers/acpi/resources/rsutils.c | 159 +++--- drivers/acpi/resources/rsxface.c | 182 +++--- drivers/acpi/scan.c | 437 +++++++------- drivers/acpi/sleep/poweroff.c | 2 +- drivers/acpi/sleep/proc.c | 243 ++++---- drivers/acpi/sleep/wakeup.c | 115 ++-- drivers/acpi/system.c | 76 ++- drivers/acpi/tables.c | 434 +++++++------- drivers/acpi/tables/tbconvrt.c | 402 ++++++------- drivers/acpi/tables/tbget.c | 275 ++++----- drivers/acpi/tables/tbgetall.c | 189 +++---- drivers/acpi/tables/tbinstal.c | 256 ++++----- drivers/acpi/tables/tbrsdt.c | 190 +++---- drivers/acpi/tables/tbutils.c | 147 ++--- drivers/acpi/tables/tbxface.c | 246 ++++---- drivers/acpi/tables/tbxfroot.c | 431 +++++++------- drivers/acpi/thermal.c | 801 +++++++++++++------------- drivers/acpi/toshiba_acpi.c | 174 +++--- drivers/acpi/utilities/utalloc.c | 505 +++++++---------- drivers/acpi/utilities/utcache.c | 149 +++-- drivers/acpi/utilities/utcopy.c | 556 +++++++++--------- drivers/acpi/utilities/utdebug.c | 330 +++++------ drivers/acpi/utilities/utdelete.c | 325 +++++------ drivers/acpi/utilities/uteval.c | 396 ++++++------- drivers/acpi/utilities/utglobal.c | 557 +++++++++--------- drivers/acpi/utilities/utinit.c | 135 ++--- drivers/acpi/utilities/utmath.c | 144 ++--- drivers/acpi/utilities/utmisc.c | 431 ++++++-------- drivers/acpi/utilities/utmutex.c | 220 ++++--- drivers/acpi/utilities/utobject.c | 324 +++++------ drivers/acpi/utilities/utstate.c | 159 ++---- drivers/acpi/utilities/utxface.c | 267 ++++----- drivers/acpi/utils.c | 195 ++++--- drivers/acpi/video.c | 1070 ++++++++++++++++------------------- include/acpi/acconfig.h | 26 +- include/acpi/acdebug.h | 263 +++------ include/acpi/acdisasm.h | 323 ++++------- include/acpi/acdispat.h | 398 +++++-------- include/acpi/acevents.h | 240 +++----- include/acpi/acexcep.h | 28 +- include/acpi/acglobal.h | 262 ++++----- include/acpi/achware.h | 107 +--- include/acpi/acinterp.h | 626 ++++++++------------ include/acpi/aclocal.h | 678 +++++++++------------- include/acpi/acmacros.h | 43 +- include/acpi/acnames.h | 11 +- include/acpi/acnamesp.h | 357 ++++-------- include/acpi/acobject.h | 390 +++++-------- include/acpi/acopcode.h | 4 +- include/acpi/acoutput.h | 8 +- include/acpi/acparser.h | 248 +++----- include/acpi/acpi.h | 35 +- include/acpi/acpi_bus.h | 332 ++++++----- include/acpi/acpi_drivers.h | 38 +- include/acpi/acpiosxf.h | 275 +++------ include/acpi/acpixf.h | 408 ++++--------- include/acpi/acresrc.h | 309 ++++------ include/acpi/acstruct.h | 216 ++++--- include/acpi/actables.h | 127 ++--- include/acpi/actbl.h | 260 ++++----- include/acpi/actbl1.h | 133 +++-- include/acpi/actbl2.h | 245 ++++---- include/acpi/actbl71.h | 148 +++-- include/acpi/actypes.h | 800 ++++++++++++-------------- include/acpi/acutils.h | 709 +++++++---------------- include/acpi/amlcode.h | 170 +++--- include/acpi/amlresrc.h | 380 ++++++------- include/acpi/container.h | 3 +- include/acpi/pdc_intel.h | 4 +- include/acpi/platform/acenv.h | 33 +- include/acpi/platform/acgcc.h | 2 +- include/acpi/platform/aclinux.h | 8 +- include/acpi/processor.h | 238 ++++---- 190 files changed, 24398 insertions(+), 29344 deletions(-) (limited to 'include') diff --git a/arch/i386/kernel/acpi/boot.c b/arch/i386/kernel/acpi/boot.c index 55c0fbd6895..98d119c6637 100644 --- a/arch/i386/kernel/acpi/boot.c +++ b/arch/i386/kernel/acpi/boot.c @@ -40,19 +40,25 @@ #ifdef CONFIG_X86_64 -static inline void acpi_madt_oem_check(char *oem_id, char *oem_table_id) { } +static inline void acpi_madt_oem_check(char *oem_id, char *oem_table_id) +{ +} extern void __init clustered_apic_check(void); -static inline int ioapic_setup_disabled(void) { return 0; } +static inline int ioapic_setup_disabled(void) +{ + return 0; +} + #include -#else /* X86 */ +#else /* X86 */ #ifdef CONFIG_X86_LOCAL_APIC #include #include -#endif /* CONFIG_X86_LOCAL_APIC */ +#endif /* CONFIG_X86_LOCAL_APIC */ -#endif /* X86 */ +#endif /* X86 */ #define BAD_MADT_ENTRY(entry, end) ( \ (!entry) || (unsigned long)entry + sizeof(*entry) > end || \ @@ -62,7 +68,7 @@ static inline int ioapic_setup_disabled(void) { return 0; } #ifdef CONFIG_ACPI_PCI int acpi_noirq __initdata; /* skip ACPI IRQ initialization */ -int acpi_pci_disabled __initdata; /* skip ACPI PCI scan and IRQ initialization */ +int acpi_pci_disabled __initdata; /* skip ACPI PCI scan and IRQ initialization */ #else int acpi_noirq __initdata = 1; int acpi_pci_disabled __initdata = 1; @@ -88,7 +94,7 @@ static u64 acpi_lapic_addr __initdata = APIC_DEFAULT_PHYS_BASE; #define MAX_MADT_ENTRIES 256 u8 x86_acpiid_to_apicid[MAX_MADT_ENTRIES] = - { [0 ... MAX_MADT_ENTRIES-1] = 0xff }; + {[0...MAX_MADT_ENTRIES - 1] = 0xff }; EXPORT_SYMBOL(x86_acpiid_to_apicid); /* -------------------------------------------------------------------------- @@ -99,7 +105,7 @@ EXPORT_SYMBOL(x86_acpiid_to_apicid); * The default interrupt routing model is PIC (8259). This gets * overriden if IOAPICs are enumerated (below). */ -enum acpi_irq_model_id acpi_irq_model = ACPI_IRQ_MODEL_PIC; +enum acpi_irq_model_id acpi_irq_model = ACPI_IRQ_MODEL_PIC; #ifdef CONFIG_X86_64 @@ -107,7 +113,7 @@ enum acpi_irq_model_id acpi_irq_model = ACPI_IRQ_MODEL_PIC; char *__acpi_map_table(unsigned long phys_addr, unsigned long size) { if (!phys_addr || !size) - return NULL; + return NULL; if (phys_addr < (end_pfn_map << PAGE_SHIFT)) return __va(phys_addr); @@ -134,8 +140,8 @@ char *__acpi_map_table(unsigned long phys, unsigned long size) unsigned long base, offset, mapped_size; int idx; - if (phys + size < 8*1024*1024) - return __va(phys); + if (phys + size < 8 * 1024 * 1024) + return __va(phys); offset = phys & (PAGE_SIZE - 1); mapped_size = PAGE_SIZE - offset; @@ -154,7 +160,7 @@ char *__acpi_map_table(unsigned long phys, unsigned long size) mapped_size += PAGE_SIZE; } - return ((unsigned char *) base + offset); + return ((unsigned char *)base + offset); } #endif @@ -172,7 +178,7 @@ int __init acpi_parse_mcfg(unsigned long phys_addr, unsigned long size) if (!phys_addr || !size) return -EINVAL; - mcfg = (struct acpi_table_mcfg *) __acpi_map_table(phys_addr, size); + mcfg = (struct acpi_table_mcfg *)__acpi_map_table(phys_addr, size); if (!mcfg) { printk(KERN_WARNING PREFIX "Unable to map MCFG\n"); return -ENODEV; @@ -209,20 +215,17 @@ int __init acpi_parse_mcfg(unsigned long phys_addr, unsigned long size) return 0; } -#endif /* CONFIG_PCI_MMCONFIG */ +#endif /* CONFIG_PCI_MMCONFIG */ #ifdef CONFIG_X86_LOCAL_APIC -static int __init -acpi_parse_madt ( - unsigned long phys_addr, - unsigned long size) +static int __init acpi_parse_madt(unsigned long phys_addr, unsigned long size) { - struct acpi_table_madt *madt = NULL; + struct acpi_table_madt *madt = NULL; if (!phys_addr || !size) return -EINVAL; - madt = (struct acpi_table_madt *) __acpi_map_table(phys_addr, size); + madt = (struct acpi_table_madt *)__acpi_map_table(phys_addr, size); if (!madt) { printk(KERN_WARNING PREFIX "Unable to map MADT\n"); return -ENODEV; @@ -232,22 +235,20 @@ acpi_parse_madt ( acpi_lapic_addr = (u64) madt->lapic_address; printk(KERN_DEBUG PREFIX "Local APIC address 0x%08x\n", - madt->lapic_address); + madt->lapic_address); } acpi_madt_oem_check(madt->header.oem_id, madt->header.oem_table_id); - + return 0; } - static int __init -acpi_parse_lapic ( - acpi_table_entry_header *header, const unsigned long end) +acpi_parse_lapic(acpi_table_entry_header * header, const unsigned long end) { - struct acpi_table_lapic *processor = NULL; + struct acpi_table_lapic *processor = NULL; - processor = (struct acpi_table_lapic*) header; + processor = (struct acpi_table_lapic *)header; if (BAD_MADT_ENTRY(processor, end)) return -EINVAL; @@ -260,20 +261,19 @@ acpi_parse_lapic ( x86_acpiid_to_apicid[processor->acpi_id] = processor->id; - mp_register_lapic ( - processor->id, /* APIC ID */ - processor->flags.enabled); /* Enabled? */ + mp_register_lapic(processor->id, /* APIC ID */ + processor->flags.enabled); /* Enabled? */ return 0; } static int __init -acpi_parse_lapic_addr_ovr ( - acpi_table_entry_header *header, const unsigned long end) +acpi_parse_lapic_addr_ovr(acpi_table_entry_header * header, + const unsigned long end) { struct acpi_table_lapic_addr_ovr *lapic_addr_ovr = NULL; - lapic_addr_ovr = (struct acpi_table_lapic_addr_ovr*) header; + lapic_addr_ovr = (struct acpi_table_lapic_addr_ovr *)header; if (BAD_MADT_ENTRY(lapic_addr_ovr, end)) return -EINVAL; @@ -284,12 +284,11 @@ acpi_parse_lapic_addr_ovr ( } static int __init -acpi_parse_lapic_nmi ( - acpi_table_entry_header *header, const unsigned long end) +acpi_parse_lapic_nmi(acpi_table_entry_header * header, const unsigned long end) { struct acpi_table_lapic_nmi *lapic_nmi = NULL; - lapic_nmi = (struct acpi_table_lapic_nmi*) header; + lapic_nmi = (struct acpi_table_lapic_nmi *)header; if (BAD_MADT_ENTRY(lapic_nmi, end)) return -EINVAL; @@ -302,37 +301,32 @@ acpi_parse_lapic_nmi ( return 0; } - -#endif /*CONFIG_X86_LOCAL_APIC*/ +#endif /*CONFIG_X86_LOCAL_APIC */ #if defined(CONFIG_X86_IO_APIC) && defined(CONFIG_ACPI_INTERPRETER) static int __init -acpi_parse_ioapic ( - acpi_table_entry_header *header, const unsigned long end) +acpi_parse_ioapic(acpi_table_entry_header * header, const unsigned long end) { struct acpi_table_ioapic *ioapic = NULL; - ioapic = (struct acpi_table_ioapic*) header; + ioapic = (struct acpi_table_ioapic *)header; if (BAD_MADT_ENTRY(ioapic, end)) return -EINVAL; - + acpi_table_print_madt_entry(header); - mp_register_ioapic ( - ioapic->id, - ioapic->address, - ioapic->global_irq_base); - + mp_register_ioapic(ioapic->id, + ioapic->address, ioapic->global_irq_base); + return 0; } /* * Parse Interrupt Source Override for the ACPI SCI */ -static void -acpi_sci_ioapic_setup(u32 gsi, u16 polarity, u16 trigger) +static void acpi_sci_ioapic_setup(u32 gsi, u16 polarity, u16 trigger) { if (trigger == 0) /* compatible SCI trigger is level */ trigger = 3; @@ -348,7 +342,7 @@ acpi_sci_ioapic_setup(u32 gsi, u16 polarity, u16 trigger) polarity = acpi_sci_flags.polarity; /* - * mp_config_acpi_legacy_irqs() already setup IRQs < 16 + * mp_config_acpi_legacy_irqs() already setup IRQs < 16 * If GSI is < 16, this will update its flags, * else it will create a new mp_irqs[] entry. */ @@ -363,12 +357,12 @@ acpi_sci_ioapic_setup(u32 gsi, u16 polarity, u16 trigger) } static int __init -acpi_parse_int_src_ovr ( - acpi_table_entry_header *header, const unsigned long end) +acpi_parse_int_src_ovr(acpi_table_entry_header * header, + const unsigned long end) { struct acpi_table_int_src_ovr *intsrc = NULL; - intsrc = (struct acpi_table_int_src_ovr*) header; + intsrc = (struct acpi_table_int_src_ovr *)header; if (BAD_MADT_ENTRY(intsrc, end)) return -EINVAL; @@ -377,33 +371,30 @@ acpi_parse_int_src_ovr ( if (intsrc->bus_irq == acpi_fadt.sci_int) { acpi_sci_ioapic_setup(intsrc->global_irq, - intsrc->flags.polarity, intsrc->flags.trigger); + intsrc->flags.polarity, + intsrc->flags.trigger); return 0; } if (acpi_skip_timer_override && - intsrc->bus_irq == 0 && intsrc->global_irq == 2) { - printk(PREFIX "BIOS IRQ0 pin2 override ignored.\n"); - return 0; + intsrc->bus_irq == 0 && intsrc->global_irq == 2) { + printk(PREFIX "BIOS IRQ0 pin2 override ignored.\n"); + return 0; } - mp_override_legacy_irq ( - intsrc->bus_irq, - intsrc->flags.polarity, - intsrc->flags.trigger, - intsrc->global_irq); + mp_override_legacy_irq(intsrc->bus_irq, + intsrc->flags.polarity, + intsrc->flags.trigger, intsrc->global_irq); return 0; } - static int __init -acpi_parse_nmi_src ( - acpi_table_entry_header *header, const unsigned long end) +acpi_parse_nmi_src(acpi_table_entry_header * header, const unsigned long end) { struct acpi_table_nmi_src *nmi_src = NULL; - nmi_src = (struct acpi_table_nmi_src*) header; + nmi_src = (struct acpi_table_nmi_src *)header; if (BAD_MADT_ENTRY(nmi_src, end)) return -EINVAL; @@ -415,7 +406,7 @@ acpi_parse_nmi_src ( return 0; } -#endif /* CONFIG_X86_IO_APIC */ +#endif /* CONFIG_X86_IO_APIC */ #ifdef CONFIG_ACPI_BUS @@ -433,8 +424,7 @@ acpi_parse_nmi_src ( * ECLR2 is IRQ's 8-15 (IRQ 8, 13 must be 0) */ -void __init -acpi_pic_sci_set_trigger(unsigned int irq, u16 trigger) +void __init acpi_pic_sci_set_trigger(unsigned int irq, u16 trigger) { unsigned int mask = 1 << irq; unsigned int old, new; @@ -454,10 +444,10 @@ acpi_pic_sci_set_trigger(unsigned int irq, u16 trigger) * routing tables.. */ switch (trigger) { - case 1: /* Edge - clear */ + case 1: /* Edge - clear */ new &= ~mask; break; - case 3: /* Level - set */ + case 3: /* Level - set */ new |= mask; break; } @@ -470,14 +460,13 @@ acpi_pic_sci_set_trigger(unsigned int irq, u16 trigger) outb(new >> 8, 0x4d1); } - -#endif /* CONFIG_ACPI_BUS */ +#endif /* CONFIG_ACPI_BUS */ int acpi_gsi_to_irq(u32 gsi, unsigned int *irq) { #ifdef CONFIG_X86_IO_APIC if (use_pci_vector() && !platform_legacy_irq(gsi)) - *irq = IO_APIC_VECTOR(gsi); + *irq = IO_APIC_VECTOR(gsi); else #endif *irq = gsi; @@ -501,7 +490,7 @@ int acpi_register_gsi(u32 gsi, int edge_level, int active_high_low) extern void eisa_set_level_irq(unsigned int irq); if (edge_level == ACPI_LEVEL_SENSITIVE) - eisa_set_level_irq(gsi); + eisa_set_level_irq(gsi); } #endif @@ -513,60 +502,58 @@ int acpi_register_gsi(u32 gsi, int edge_level, int active_high_low) acpi_gsi_to_irq(plat_gsi, &irq); return irq; } + EXPORT_SYMBOL(acpi_register_gsi); /* * ACPI based hotplug support for CPU */ #ifdef CONFIG_ACPI_HOTPLUG_CPU -int -acpi_map_lsapic(acpi_handle handle, int *pcpu) +int acpi_map_lsapic(acpi_handle handle, int *pcpu) { /* TBD */ return -EINVAL; } -EXPORT_SYMBOL(acpi_map_lsapic); +EXPORT_SYMBOL(acpi_map_lsapic); -int -acpi_unmap_lsapic(int cpu) +int acpi_unmap_lsapic(int cpu) { /* TBD */ return -EINVAL; } + EXPORT_SYMBOL(acpi_unmap_lsapic); -#endif /* CONFIG_ACPI_HOTPLUG_CPU */ +#endif /* CONFIG_ACPI_HOTPLUG_CPU */ -int -acpi_register_ioapic(acpi_handle handle, u64 phys_addr, u32 gsi_base) +int acpi_register_ioapic(acpi_handle handle, u64 phys_addr, u32 gsi_base) { /* TBD */ return -EINVAL; } + EXPORT_SYMBOL(acpi_register_ioapic); -int -acpi_unregister_ioapic(acpi_handle handle, u32 gsi_base) +int acpi_unregister_ioapic(acpi_handle handle, u32 gsi_base) { /* TBD */ return -EINVAL; } + EXPORT_SYMBOL(acpi_unregister_ioapic); static unsigned long __init -acpi_scan_rsdp ( - unsigned long start, - unsigned long length) +acpi_scan_rsdp(unsigned long start, unsigned long length) { - unsigned long offset = 0; - unsigned long sig_len = sizeof("RSD PTR ") - 1; + unsigned long offset = 0; + unsigned long sig_len = sizeof("RSD PTR ") - 1; /* * Scan all 16-byte boundaries of the physical memory region for the * RSDP signature. */ for (offset = 0; offset < length; offset += 16) { - if (strncmp((char *) (start + offset), "RSD PTR ", sig_len)) + if (strncmp((char *)(start + offset), "RSD PTR ", sig_len)) continue; return (start + offset); } @@ -579,20 +566,19 @@ static int __init acpi_parse_sbf(unsigned long phys_addr, unsigned long size) struct acpi_table_sbf *sb; if (!phys_addr || !size) - return -EINVAL; + return -EINVAL; - sb = (struct acpi_table_sbf *) __acpi_map_table(phys_addr, size); + sb = (struct acpi_table_sbf *)__acpi_map_table(phys_addr, size); if (!sb) { printk(KERN_WARNING PREFIX "Unable to map SBF\n"); return -ENODEV; } - sbf_port = sb->sbf_cmos; /* Save CMOS port */ + sbf_port = sb->sbf_cmos; /* Save CMOS port */ return 0; } - #ifdef CONFIG_HPET_TIMER static int __init acpi_parse_hpet(unsigned long phys, unsigned long size) @@ -602,7 +588,7 @@ static int __init acpi_parse_hpet(unsigned long phys, unsigned long size) if (!phys || !size) return -EINVAL; - hpet_tbl = (struct acpi_table_hpet *) __acpi_map_table(phys, size); + hpet_tbl = (struct acpi_table_hpet *)__acpi_map_table(phys, size); if (!hpet_tbl) { printk(KERN_WARNING PREFIX "Unable to map HPET\n"); return -ENODEV; @@ -613,22 +599,21 @@ static int __init acpi_parse_hpet(unsigned long phys, unsigned long size) "memory.\n"); return -1; } - #ifdef CONFIG_X86_64 - vxtime.hpet_address = hpet_tbl->addr.addrl | - ((long) hpet_tbl->addr.addrh << 32); + vxtime.hpet_address = hpet_tbl->addr.addrl | + ((long)hpet_tbl->addr.addrh << 32); - printk(KERN_INFO PREFIX "HPET id: %#x base: %#lx\n", - hpet_tbl->id, vxtime.hpet_address); -#else /* X86 */ + printk(KERN_INFO PREFIX "HPET id: %#x base: %#lx\n", + hpet_tbl->id, vxtime.hpet_address); +#else /* X86 */ { extern unsigned long hpet_address; hpet_address = hpet_tbl->addr.addrl; printk(KERN_INFO PREFIX "HPET id: %#x base: %#lx\n", - hpet_tbl->id, hpet_address); + hpet_tbl->id, hpet_address); } -#endif /* X86 */ +#endif /* X86 */ return 0; } @@ -644,12 +629,11 @@ static int __init acpi_parse_fadt(unsigned long phys, unsigned long size) { struct fadt_descriptor_rev2 *fadt = NULL; - fadt = (struct fadt_descriptor_rev2*) __acpi_map_table(phys,size); - if(!fadt) { + fadt = (struct fadt_descriptor_rev2 *)__acpi_map_table(phys, size); + if (!fadt) { printk(KERN_WARNING PREFIX "Unable to map FADT\n"); return 0; } - #ifdef CONFIG_ACPI_INTERPRETER /* initialize sci_int early for INT_SRC_OVR MADT parsing */ acpi_fadt.sci_int = fadt->sci_int; @@ -658,14 +642,16 @@ static int __init acpi_parse_fadt(unsigned long phys, unsigned long size) #ifdef CONFIG_ACPI_BUS /* initialize rev and apic_phys_dest_mode for x86_64 genapic */ acpi_fadt.revision = fadt->revision; - acpi_fadt.force_apic_physical_destination_mode = fadt->force_apic_physical_destination_mode; + acpi_fadt.force_apic_physical_destination_mode = + fadt->force_apic_physical_destination_mode; #endif #ifdef CONFIG_X86_PM_TIMER /* detect the location of the ACPI PM Timer */ if (fadt->revision >= FADT2_REVISION_ID) { /* FADT rev. 2 */ - if (fadt->xpm_tmr_blk.address_space_id != ACPI_ADR_SPACE_SYSTEM_IO) + if (fadt->xpm_tmr_blk.address_space_id != + ACPI_ADR_SPACE_SYSTEM_IO) return 0; pmtmr_ioport = fadt->xpm_tmr_blk.address; @@ -674,16 +660,15 @@ static int __init acpi_parse_fadt(unsigned long phys, unsigned long size) pmtmr_ioport = fadt->V1_pm_tmr_blk; } if (pmtmr_ioport) - printk(KERN_INFO PREFIX "PM-Timer IO Port: %#x\n", pmtmr_ioport); + printk(KERN_INFO PREFIX "PM-Timer IO Port: %#x\n", + pmtmr_ioport); #endif return 0; } - -unsigned long __init -acpi_find_rsdp (void) +unsigned long __init acpi_find_rsdp(void) { - unsigned long rsdp_phys = 0; + unsigned long rsdp_phys = 0; if (efi_enabled) { if (efi.acpi20) @@ -695,9 +680,9 @@ acpi_find_rsdp (void) * Scan memory looking for the RSDP signature. First search EBDA (low * memory) paragraphs and then search upper memory (E0000-FFFFF). */ - rsdp_phys = acpi_scan_rsdp (0, 0x400); + rsdp_phys = acpi_scan_rsdp(0, 0x400); if (!rsdp_phys) - rsdp_phys = acpi_scan_rsdp (0xE0000, 0x20000); + rsdp_phys = acpi_scan_rsdp(0xE0000, 0x20000); return rsdp_phys; } @@ -707,8 +692,7 @@ acpi_find_rsdp (void) * Parse LAPIC entries in MADT * returns 0 on success, < 0 on error */ -static int __init -acpi_parse_madt_lapic_entries(void) +static int __init acpi_parse_madt_lapic_entries(void) { int count; @@ -717,28 +701,31 @@ acpi_parse_madt_lapic_entries(void) * and (optionally) overriden by a LAPIC_ADDR_OVR entry (64-bit value). */ - count = acpi_table_parse_madt(ACPI_MADT_LAPIC_ADDR_OVR, acpi_parse_lapic_addr_ovr, 0); + count = + acpi_table_parse_madt(ACPI_MADT_LAPIC_ADDR_OVR, + acpi_parse_lapic_addr_ovr, 0); if (count < 0) { - printk(KERN_ERR PREFIX "Error parsing LAPIC address override entry\n"); + printk(KERN_ERR PREFIX + "Error parsing LAPIC address override entry\n"); return count; } mp_register_lapic_address(acpi_lapic_addr); count = acpi_table_parse_madt(ACPI_MADT_LAPIC, acpi_parse_lapic, - MAX_APICS); - if (!count) { + MAX_APICS); + if (!count) { printk(KERN_ERR PREFIX "No LAPIC entries present\n"); /* TBD: Cleanup to allow fallback to MPS */ return -ENODEV; - } - else if (count < 0) { + } else if (count < 0) { printk(KERN_ERR PREFIX "Error parsing LAPIC entry\n"); /* TBD: Cleanup to allow fallback to MPS */ return count; } - count = acpi_table_parse_madt(ACPI_MADT_LAPIC_NMI, acpi_parse_lapic_nmi, 0); + count = + acpi_table_parse_madt(ACPI_MADT_LAPIC_NMI, acpi_parse_lapic_nmi, 0); if (count < 0) { printk(KERN_ERR PREFIX "Error parsing LAPIC NMI entry\n"); /* TBD: Cleanup to allow fallback to MPS */ @@ -746,15 +733,14 @@ acpi_parse_madt_lapic_entries(void) } return 0; } -#endif /* CONFIG_X86_LOCAL_APIC */ +#endif /* CONFIG_X86_LOCAL_APIC */ #if defined(CONFIG_X86_IO_APIC) && defined(CONFIG_ACPI_INTERPRETER) /* * Parse IOAPIC related entries in MADT * returns 0 on success, < 0 on error */ -static int __init -acpi_parse_madt_ioapic_entries(void) +static int __init acpi_parse_madt_ioapic_entries(void) { int count; @@ -766,30 +752,34 @@ acpi_parse_madt_ioapic_entries(void) */ if (acpi_disabled || acpi_noirq) { return -ENODEV; - } + } /* - * if "noapic" boot option, don't look for IO-APICs + * if "noapic" boot option, don't look for IO-APICs */ if (skip_ioapic_setup) { printk(KERN_INFO PREFIX "Skipping IOAPIC probe " - "due to 'noapic' option.\n"); + "due to 'noapic' option.\n"); return -ENODEV; } - count = acpi_table_parse_madt(ACPI_MADT_IOAPIC, acpi_parse_ioapic, MAX_IO_APICS); + count = + acpi_table_parse_madt(ACPI_MADT_IOAPIC, acpi_parse_ioapic, + MAX_IO_APICS); if (!count) { printk(KERN_ERR PREFIX "No IOAPIC entries present\n"); return -ENODEV; - } - else if (count < 0) { + } else if (count < 0) { printk(KERN_ERR PREFIX "Error parsing IOAPIC entry\n"); return count; } - count = acpi_table_parse_madt(ACPI_MADT_INT_SRC_OVR, acpi_parse_int_src_ovr, NR_IRQ_VECTORS); + count = + acpi_table_parse_madt(ACPI_MADT_INT_SRC_OVR, acpi_parse_int_src_ovr, + NR_IRQ_VECTORS); if (count < 0) { - printk(KERN_ERR PREFIX "Error parsing interrupt source overrides entry\n"); + printk(KERN_ERR PREFIX + "Error parsing interrupt source overrides entry\n"); /* TBD: Cleanup to allow fallback to MPS */ return count; } @@ -804,7 +794,9 @@ acpi_parse_madt_ioapic_entries(void) /* Fill in identity legacy mapings where no override */ mp_config_acpi_legacy_irqs(); - count = acpi_table_parse_madt(ACPI_MADT_NMI_SRC, acpi_parse_nmi_src, NR_IRQ_VECTORS); + count = + acpi_table_parse_madt(ACPI_MADT_NMI_SRC, acpi_parse_nmi_src, + NR_IRQ_VECTORS); if (count < 0) { printk(KERN_ERR PREFIX "Error parsing NMI SRC entry\n"); /* TBD: Cleanup to allow fallback to MPS */ @@ -818,11 +810,9 @@ static inline int acpi_parse_madt_ioapic_entries(void) { return -1; } -#endif /* !(CONFIG_X86_IO_APIC && CONFIG_ACPI_INTERPRETER) */ - +#endif /* !(CONFIG_X86_IO_APIC && CONFIG_ACPI_INTERPRETER) */ -static void __init -acpi_process_madt(void) +static void __init acpi_process_madt(void) { #ifdef CONFIG_X86_LOCAL_APIC int count, error; @@ -854,7 +844,8 @@ acpi_process_madt(void) /* * Dell Precision Workstation 410, 610 come here. */ - printk(KERN_ERR PREFIX "Invalid BIOS MADT, disabling ACPI\n"); + printk(KERN_ERR PREFIX + "Invalid BIOS MADT, disabling ACPI\n"); disable_acpi(); } } @@ -891,7 +882,7 @@ static int __init disable_acpi_pci(struct dmi_system_id *d) static int __init dmi_disable_acpi(struct dmi_system_id *d) { if (!acpi_force) { - printk(KERN_NOTICE "%s detected: acpi off\n",d->ident); + printk(KERN_NOTICE "%s detected: acpi off\n", d->ident); disable_acpi(); } else { printk(KERN_NOTICE @@ -906,7 +897,8 @@ static int __init dmi_disable_acpi(struct dmi_system_id *d) static int __init force_acpi_ht(struct dmi_system_id *d) { if (!acpi_force) { - printk(KERN_NOTICE "%s detected: force use of acpi=ht\n", d->ident); + printk(KERN_NOTICE "%s detected: force use of acpi=ht\n", + d->ident); disable_acpi(); acpi_ht = 1; } else { @@ -925,155 +917,157 @@ static struct dmi_system_id __initdata acpi_dmi_table[] = { * Boxes that need ACPI disabled */ { - .callback = dmi_disable_acpi, - .ident = "IBM Thinkpad", - .matches = { - DMI_MATCH(DMI_BOARD_VENDOR, "IBM"), - DMI_MATCH(DMI_BOARD_NAME, "2629H1G"), - }, - }, + .callback = dmi_disable_acpi, + .ident = "IBM Thinkpad", + .matches = { + DMI_MATCH(DMI_BOARD_VENDOR, "IBM"), + DMI_MATCH(DMI_BOARD_NAME, "2629H1G"), + }, + }, /* * Boxes that need acpi=ht */ { - .callback = force_acpi_ht, - .ident = "FSC Primergy T850", - .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"), - DMI_MATCH(DMI_PRODUCT_NAME, "PRIMERGY T850"), - }, - }, + .callback = force_acpi_ht, + .ident = "FSC Primergy T850", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"), + DMI_MATCH(DMI_PRODUCT_NAME, "PRIMERGY T850"), + }, + }, { - .callback = force_acpi_ht, - .ident = "DELL GX240", - .matches = { - DMI_MATCH(DMI_BOARD_VENDOR, "Dell Computer Corporation"), - DMI_MATCH(DMI_BOARD_NAME, "OptiPlex GX240"), - }, - }, + .callback = force_acpi_ht, + .ident = "DELL GX240", + .matches = { + DMI_MATCH(DMI_BOARD_VENDOR, "Dell Computer Corporation"), + DMI_MATCH(DMI_BOARD_NAME, "OptiPlex GX240"), + }, + }, { - .callback = force_acpi_ht, - .ident = "HP VISUALIZE NT Workstation", - .matches = { - DMI_MATCH(DMI_BOARD_VENDOR, "Hewlett-Packard"), - DMI_MATCH(DMI_PRODUCT_NAME, "HP VISUALIZE NT Workstation"), - }, - }, + .callback = force_acpi_ht, + .ident = "HP VISUALIZE NT Workstation", + .matches = { + DMI_MATCH(DMI_BOARD_VENDOR, "Hewlett-Packard"), + DMI_MATCH(DMI_PRODUCT_NAME, "HP VISUALIZE NT Workstation"), + }, + }, { - .callback = force_acpi_ht, - .ident = "Compaq Workstation W8000", - .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "Compaq"), - DMI_MATCH(DMI_PRODUCT_NAME, "Workstation W8000"), - }, - }, + .callback = force_acpi_ht, + .ident = "Compaq Workstation W8000", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Compaq"), + DMI_MATCH(DMI_PRODUCT_NAME, "Workstation W8000"), + }, + }, { - .callback = force_acpi_ht, - .ident = "ASUS P4B266", - .matches = { - DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."), - DMI_MATCH(DMI_BOARD_NAME, "P4B266"), - }, - }, + .callback = force_acpi_ht, + .ident = "ASUS P4B266", + .matches = { + DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."), + DMI_MATCH(DMI_BOARD_NAME, "P4B266"), + }, + }, { - .callback = force_acpi_ht, - .ident = "ASUS P2B-DS", - .matches = { - DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."), - DMI_MATCH(DMI_BOARD_NAME, "P2B-DS"), - }, - }, + .callback = force_acpi_ht, + .ident = "ASUS P2B-DS", + .matches = { + DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."), + DMI_MATCH(DMI_BOARD_NAME, "P2B-DS"), + }, + }, { - .callback = force_acpi_ht, - .ident = "ASUS CUR-DLS", - .matches = { - DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."), - DMI_MATCH(DMI_BOARD_NAME, "CUR-DLS"), - }, - }, + .callback = force_acpi_ht, + .ident = "ASUS CUR-DLS", + .matches = { + DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."), + DMI_MATCH(DMI_BOARD_NAME, "CUR-DLS"), + }, + }, { - .callback = force_acpi_ht, - .ident = "ABIT i440BX-W83977", - .matches = { - DMI_MATCH(DMI_BOARD_VENDOR, "ABIT "), - DMI_MATCH(DMI_BOARD_NAME, "i440BX-W83977 (BP6)"), - }, - }, + .callback = force_acpi_ht, + .ident = "ABIT i440BX-W83977", + .matches = { + DMI_MATCH(DMI_BOARD_VENDOR, "ABIT "), + DMI_MATCH(DMI_BOARD_NAME, "i440BX-W83977 (BP6)"), + }, + }, { - .callback = force_acpi_ht, - .ident = "IBM Bladecenter", - .matches = { - DMI_MATCH(DMI_BOARD_VENDOR, "IBM"), - DMI_MATCH(DMI_BOARD_NAME, "IBM eServer BladeCenter HS20"), - }, - }, + .callback = force_acpi_ht, + .ident = "IBM Bladecenter", + .matches = { + DMI_MATCH(DMI_BOARD_VENDOR, "IBM"), + DMI_MATCH(DMI_BOARD_NAME, "IBM eServer BladeCenter HS20"), + }, + }, { - .callback = force_acpi_ht, - .ident = "IBM eServer xSeries 360", - .matches = { - DMI_MATCH(DMI_BOARD_VENDOR, "IBM"), - DMI_MATCH(DMI_BOARD_NAME, "eServer xSeries 360"), - }, - }, + .callback = force_acpi_ht, + .ident = "IBM eServer xSeries 360", + .matches = { + DMI_MATCH(DMI_BOARD_VENDOR, "IBM"), + DMI_MATCH(DMI_BOARD_NAME, "eServer xSeries 360"), + }, + }, { - .callback = force_acpi_ht, - .ident = "IBM eserver xSeries 330", - .matches = { - DMI_MATCH(DMI_BOARD_VENDOR, "IBM"), - DMI_MATCH(DMI_BOARD_NAME, "eserver xSeries 330"), - }, - }, + .callback = force_acpi_ht, + .ident = "IBM eserver xSeries 330", + .matches = { + DMI_MATCH(DMI_BOARD_VENDOR, "IBM"), + DMI_MATCH(DMI_BOARD_NAME, "eserver xSeries 330"), + }, + }, { - .callback = force_acpi_ht, - .ident = "IBM eserver xSeries 440", - .matches = { - DMI_MATCH(DMI_BOARD_VENDOR, "IBM"), - DMI_MATCH(DMI_PRODUCT_NAME, "eserver xSeries 440"), - }, - }, + .callback = force_acpi_ht, + .ident = "IBM eserver xSeries 440", + .matches = { + DMI_MATCH(DMI_BOARD_VENDOR, "IBM"), + DMI_MATCH(DMI_PRODUCT_NAME, "eserver xSeries 440"), + }, + }, #ifdef CONFIG_ACPI_PCI /* * Boxes that need ACPI PCI IRQ routing disabled */ { - .callback = disable_acpi_irq, - .ident = "ASUS A7V", - .matches = { - DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC"), - DMI_MATCH(DMI_BOARD_NAME, ""), - /* newer BIOS, Revision 1011, does work */ - DMI_MATCH(DMI_BIOS_VERSION, "ASUS A7V ACPI BIOS Revision 1007"), - }, - }, + .callback = disable_acpi_irq, + .ident = "ASUS A7V", + .matches = { + DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC"), + DMI_MATCH(DMI_BOARD_NAME, ""), + /* newer BIOS, Revision 1011, does work */ + DMI_MATCH(DMI_BIOS_VERSION, + "ASUS A7V ACPI BIOS Revision 1007"), + }, + }, /* * Boxes that need ACPI PCI IRQ routing and PCI scan disabled */ - { /* _BBN 0 bug */ - .callback = disable_acpi_pci, - .ident = "ASUS PR-DLS", - .matches = { - DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."), - DMI_MATCH(DMI_BOARD_NAME, "PR-DLS"), - DMI_MATCH(DMI_BIOS_VERSION, "ASUS PR-DLS ACPI BIOS Revision 1010"), - DMI_MATCH(DMI_BIOS_DATE, "03/21/2003") - }, - }, + { /* _BBN 0 bug */ + .callback = disable_acpi_pci, + .ident = "ASUS PR-DLS", + .matches = { + DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."), + DMI_MATCH(DMI_BOARD_NAME, "PR-DLS"), + DMI_MATCH(DMI_BIOS_VERSION, + "ASUS PR-DLS ACPI BIOS Revision 1010"), + DMI_MATCH(DMI_BIOS_DATE, "03/21/2003") + }, + }, { - .callback = disable_acpi_pci, - .ident = "Acer TravelMate 36x Laptop", - .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "Acer"), - DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 360"), - }, - }, + .callback = disable_acpi_pci, + .ident = "Acer TravelMate 36x Laptop", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Acer"), + DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 360"), + }, + }, #endif - { } + {} }; -#endif /* __i386__ */ +#endif /* __i386__ */ /* * acpi_boot_table_init() and acpi_boot_init() @@ -1098,8 +1092,7 @@ static struct dmi_system_id __initdata acpi_dmi_table[] = { * !0: failure */ -int __init -acpi_boot_table_init(void) +int __init acpi_boot_table_init(void) { int error; @@ -1112,7 +1105,7 @@ acpi_boot_table_init(void) * One exception: acpi=ht continues far enough to enumerate LAPICs */ if (acpi_disabled && !acpi_ht) - return 1; + return 1; /* * Initialize the ACPI boot-time table parser. @@ -1122,7 +1115,6 @@ acpi_boot_table_init(void) disable_acpi(); return error; } - #ifdef __i386__ check_acpi_pci(); #endif @@ -1146,7 +1138,6 @@ acpi_boot_table_init(void) return 0; } - int __init acpi_boot_init(void) { /* @@ -1154,7 +1145,7 @@ int __init acpi_boot_init(void) * One exception: acpi=ht continues far enough to enumerate LAPICs */ if (acpi_disabled && !acpi_ht) - return 1; + return 1; acpi_table_parse(ACPI_BOOT, acpi_parse_sbf); @@ -1172,4 +1163,3 @@ int __init acpi_boot_init(void) return 0; } - diff --git a/arch/i386/kernel/acpi/earlyquirk.c b/arch/i386/kernel/acpi/earlyquirk.c index 726a5ca4b16..f1b9d2a46da 100644 --- a/arch/i386/kernel/acpi/earlyquirk.c +++ b/arch/i386/kernel/acpi/earlyquirk.c @@ -8,44 +8,44 @@ #include #include -static int __init check_bridge(int vendor, int device) +static int __init check_bridge(int vendor, int device) { /* According to Nvidia all timer overrides are bogus. Just ignore them all. */ - if (vendor == PCI_VENDOR_ID_NVIDIA) { - acpi_skip_timer_override = 1; + if (vendor == PCI_VENDOR_ID_NVIDIA) { + acpi_skip_timer_override = 1; } return 0; } - -void __init check_acpi_pci(void) -{ - int num,slot,func; + +void __init check_acpi_pci(void) +{ + int num, slot, func; /* Assume the machine supports type 1. If not it will always read ffffffff and should not have any side effect. */ /* Poor man's PCI discovery */ - for (num = 0; num < 32; num++) { - for (slot = 0; slot < 32; slot++) { - for (func = 0; func < 8; func++) { + for (num = 0; num < 32; num++) { + for (slot = 0; slot < 32; slot++) { + for (func = 0; func < 8; func++) { u32 class; u32 vendor; - class = read_pci_config(num,slot,func, + class = read_pci_config(num, slot, func, PCI_CLASS_REVISION); if (class == 0xffffffff) - break; + break; if ((class >> 16) != PCI_CLASS_BRIDGE_PCI) - continue; - - vendor = read_pci_config(num, slot, func, + continue; + + vendor = read_pci_config(num, slot, func, PCI_VENDOR_ID); - - if (check_bridge(vendor&0xffff, vendor >> 16)) - return; - } - + + if (check_bridge(vendor & 0xffff, vendor >> 16)) + return; + } + } } } diff --git a/arch/i386/kernel/acpi/sleep.c b/arch/i386/kernel/acpi/sleep.c index c1af93032ff..1cb2b186a3a 100644 --- a/arch/i386/kernel/acpi/sleep.c +++ b/arch/i386/kernel/acpi/sleep.c @@ -20,12 +20,13 @@ extern void zap_low_mappings(void); extern unsigned long FASTCALL(acpi_copy_wakeup_routine(unsigned long)); -static void init_low_mapping(pgd_t *pgd, int pgd_limit) +static void init_low_mapping(pgd_t * pgd, int pgd_limit) { int pgd_ofs = 0; - while ((pgd_ofs < pgd_limit) && (pgd_ofs + USER_PTRS_PER_PGD < PTRS_PER_PGD)) { - set_pgd(pgd, *(pgd+USER_PTRS_PER_PGD)); + while ((pgd_ofs < pgd_limit) + && (pgd_ofs + USER_PTRS_PER_PGD < PTRS_PER_PGD)) { + set_pgd(pgd, *(pgd + USER_PTRS_PER_PGD)); pgd_ofs++, pgd++; } flush_tlb_all(); @@ -37,12 +38,13 @@ static void init_low_mapping(pgd_t *pgd, int pgd_limit) * Create an identity mapped page table and copy the wakeup routine to * low memory. */ -int acpi_save_state_mem (void) +int acpi_save_state_mem(void) { if (!acpi_wakeup_address) return 1; init_low_mapping(swapper_pg_dir, USER_PTRS_PER_PGD); - memcpy((void *) acpi_wakeup_address, &wakeup_start, &wakeup_end - &wakeup_start); + memcpy((void *)acpi_wakeup_address, &wakeup_start, + &wakeup_end - &wakeup_start); acpi_copy_wakeup_routine(acpi_wakeup_address); return 0; @@ -51,7 +53,7 @@ int acpi_save_state_mem (void) /* * acpi_restore_state - undo effects of acpi_save_state_mem */ -void acpi_restore_state_mem (void) +void acpi_restore_state_mem(void) { zap_low_mappings(); } @@ -67,7 +69,8 @@ void acpi_restore_state_mem (void) void __init acpi_reserve_bootmem(void) { if ((&wakeup_end - &wakeup_start) > PAGE_SIZE) { - printk(KERN_ERR "ACPI: Wakeup code way too big, S3 disabled.\n"); + printk(KERN_ERR + "ACPI: Wakeup code way too big, S3 disabled.\n"); return; } @@ -90,10 +93,8 @@ static int __init acpi_sleep_setup(char *str) return 1; } - __setup("acpi_sleep=", acpi_sleep_setup); - static __init int reset_videomode_after_s3(struct dmi_system_id *d) { acpi_video_flags |= 2; @@ -101,14 +102,14 @@ static __init int reset_videomode_after_s3(struct dmi_system_id *d) } static __initdata struct dmi_system_id acpisleep_dmi_table[] = { - { /* Reset video mode after returning from ACPI S3 sleep */ - .callback = reset_videomode_after_s3, - .ident = "Toshiba Satellite 4030cdt", - .matches = { - DMI_MATCH(DMI_PRODUCT_NAME, "S4030CDT/4.3"), - }, - }, - { } + { /* Reset video mode after returning from ACPI S3 sleep */ + .callback = reset_videomode_after_s3, + .ident = "Toshiba Satellite 4030cdt", + .matches = { + DMI_MATCH(DMI_PRODUCT_NAME, "S4030CDT/4.3"), + }, + }, + {} }; static int __init acpisleep_dmi_init(void) diff --git a/arch/ia64/kernel/acpi-ext.c b/arch/ia64/kernel/acpi-ext.c index 2623df5e263..13a5b3b49bf 100644 --- a/arch/ia64/kernel/acpi-ext.c +++ b/arch/ia64/kernel/acpi-ext.c @@ -17,20 +17,20 @@ #include struct acpi_vendor_descriptor { - u8 guid_id; - efi_guid_t guid; + u8 guid_id; + efi_guid_t guid; }; struct acpi_vendor_info { - struct acpi_vendor_descriptor *descriptor; - u8 *data; - u32 length; + struct acpi_vendor_descriptor *descriptor; + u8 *data; + u32 length; }; acpi_status acpi_vendor_resource_match(struct acpi_resource *resource, void *context) { - struct acpi_vendor_info *info = (struct acpi_vendor_info *) context; + struct acpi_vendor_info *info = (struct acpi_vendor_info *)context; struct acpi_resource_vendor *vendor; struct acpi_vendor_descriptor *descriptor; u32 length; @@ -38,8 +38,8 @@ acpi_vendor_resource_match(struct acpi_resource *resource, void *context) if (resource->id != ACPI_RSTYPE_VENDOR) return AE_OK; - vendor = (struct acpi_resource_vendor *) &resource->data; - descriptor = (struct acpi_vendor_descriptor *) vendor->reserved; + vendor = (struct acpi_resource_vendor *)&resource->data; + descriptor = (struct acpi_vendor_descriptor *)vendor->reserved; if (vendor->length <= sizeof(*info->descriptor) || descriptor->guid_id != info->descriptor->guid_id || efi_guidcmp(descriptor->guid, info->descriptor->guid)) @@ -50,21 +50,24 @@ acpi_vendor_resource_match(struct acpi_resource *resource, void *context) if (!info->data) return AE_NO_MEMORY; - memcpy(info->data, vendor->reserved + sizeof(struct acpi_vendor_descriptor), length); + memcpy(info->data, + vendor->reserved + sizeof(struct acpi_vendor_descriptor), + length); info->length = length; return AE_CTRL_TERMINATE; } acpi_status -acpi_find_vendor_resource(acpi_handle obj, struct acpi_vendor_descriptor *id, - u8 **data, u32 *length) +acpi_find_vendor_resource(acpi_handle obj, struct acpi_vendor_descriptor * id, + u8 ** data, u32 * length) { struct acpi_vendor_info info; info.descriptor = id; info.data = NULL; - acpi_walk_resources(obj, METHOD_NAME__CRS, acpi_vendor_resource_match, &info); + acpi_walk_resources(obj, METHOD_NAME__CRS, acpi_vendor_resource_match, + &info); if (!info.data) return AE_NOT_FOUND; @@ -75,17 +78,19 @@ acpi_find_vendor_resource(acpi_handle obj, struct acpi_vendor_descriptor *id, struct acpi_vendor_descriptor hp_ccsr_descriptor = { .guid_id = 2, - .guid = EFI_GUID(0x69e9adf9, 0x924f, 0xab5f, 0xf6, 0x4a, 0x24, 0xd2, 0x01, 0x37, 0x0e, 0xad) + .guid = + EFI_GUID(0x69e9adf9, 0x924f, 0xab5f, 0xf6, 0x4a, 0x24, 0xd2, 0x01, + 0x37, 0x0e, 0xad) }; -acpi_status -hp_acpi_csr_space(acpi_handle obj, u64 *csr_base, u64 *csr_length) +acpi_status hp_acpi_csr_space(acpi_handle obj, u64 * csr_base, u64 * csr_length) { acpi_status status; u8 *data; u32 length; - status = acpi_find_vendor_resource(obj, &hp_ccsr_descriptor, &data, &length); + status = + acpi_find_vendor_resource(obj, &hp_ccsr_descriptor, &data, &length); if (ACPI_FAILURE(status) || length != 16) return AE_NOT_FOUND; diff --git a/arch/ia64/kernel/acpi.c b/arch/ia64/kernel/acpi.c index d362ecf5381..f3046bdd4b1 100644 --- a/arch/ia64/kernel/acpi.c +++ b/arch/ia64/kernel/acpi.c @@ -74,12 +74,11 @@ unsigned int acpi_cpei_override; unsigned int acpi_cpei_phys_cpuid; #define MAX_SAPICS 256 -u16 ia64_acpiid_to_sapicid[MAX_SAPICS] = - { [0 ... MAX_SAPICS - 1] = -1 }; +u16 ia64_acpiid_to_sapicid[MAX_SAPICS] = {[0...MAX_SAPICS - 1] = -1 }; + EXPORT_SYMBOL(ia64_acpiid_to_sapicid); -const char * -acpi_get_sysname (void) +const char *acpi_get_sysname(void) { #ifdef CONFIG_IA64_GENERIC unsigned long rsdp_phys; @@ -89,27 +88,29 @@ acpi_get_sysname (void) rsdp_phys = acpi_find_rsdp(); if (!rsdp_phys) { - printk(KERN_ERR "ACPI 2.0 RSDP not found, default to \"dig\"\n"); + printk(KERN_ERR + "ACPI 2.0 RSDP not found, default to \"dig\"\n"); return "dig"; } - rsdp = (struct acpi20_table_rsdp *) __va(rsdp_phys); + rsdp = (struct acpi20_table_rsdp *)__va(rsdp_phys); if (strncmp(rsdp->signature, RSDP_SIG, sizeof(RSDP_SIG) - 1)) { - printk(KERN_ERR "ACPI 2.0 RSDP signature incorrect, default to \"dig\"\n"); + printk(KERN_ERR + "ACPI 2.0 RSDP signature incorrect, default to \"dig\"\n"); return "dig"; } - xsdt = (struct acpi_table_xsdt *) __va(rsdp->xsdt_address); + xsdt = (struct acpi_table_xsdt *)__va(rsdp->xsdt_address); hdr = &xsdt->header; if (strncmp(hdr->signature, XSDT_SIG, sizeof(XSDT_SIG) - 1)) { - printk(KERN_ERR "ACPI 2.0 XSDT signature incorrect, default to \"dig\"\n"); + printk(KERN_ERR + "ACPI 2.0 XSDT signature incorrect, default to \"dig\"\n"); return "dig"; } if (!strcmp(hdr->oem_id, "HP")) { return "hpzx1"; - } - else if (!strcmp(hdr->oem_id, "SGI")) { + } else if (!strcmp(hdr->oem_id, "SGI")) { return "sn2"; } @@ -137,7 +138,7 @@ acpi_get_sysname (void) /* Array to record platform interrupt vectors for generic interrupt routing. */ int platform_intr_list[ACPI_MAX_PLATFORM_INTERRUPTS] = { - [0 ... ACPI_MAX_PLATFORM_INTERRUPTS - 1] = -1 + [0...ACPI_MAX_PLATFORM_INTERRUPTS - 1] = -1 }; enum acpi_irq_model_id acpi_irq_model = ACPI_IRQ_MODEL_IOSAPIC; @@ -146,8 +147,7 @@ enum acpi_irq_model_id acpi_irq_model = ACPI_IRQ_MODEL_IOSAPIC; * Interrupt routing API for device drivers. Provides interrupt vector for * a generic platform event. Currently only CPEI is implemented. */ -int -acpi_request_vector (u32 int_type) +int acpi_request_vector(u32 int_type) { int vector = -1; @@ -155,12 +155,12 @@ acpi_request_vector (u32 int_type) /* corrected platform error interrupt */ vector = platform_intr_list[int_type]; } else - printk(KERN_ERR "acpi_request_vector(): invalid interrupt type\n"); + printk(KERN_ERR + "acpi_request_vector(): invalid interrupt type\n"); return vector; } -char * -__acpi_map_table (unsigned long phys_addr, unsigned long size) +char *__acpi_map_table(unsigned long phys_addr, unsigned long size) { return __va(phys_addr); } @@ -169,19 +169,18 @@ __acpi_map_table (unsigned long phys_addr, unsigned long size) Boot-time Table Parsing -------------------------------------------------------------------------- */ -static int total_cpus __initdata; -static int available_cpus __initdata; -struct acpi_table_madt * acpi_madt __initdata; -static u8 has_8259; - +static int total_cpus __initdata; +static int available_cpus __initdata; +struct acpi_table_madt *acpi_madt __initdata; +static u8 has_8259; static int __init -acpi_parse_lapic_addr_ovr ( - acpi_table_entry_header *header, const unsigned long end) +acpi_parse_lapic_addr_ovr(acpi_table_entry_header * header, + const unsigned long end) { struct acpi_table_lapic_addr_ovr *lapic; - lapic = (struct acpi_table_lapic_addr_ovr *) header; + lapic = (struct acpi_table_lapic_addr_ovr *)header; if (BAD_MADT_ENTRY(lapic, end)) return -EINVAL; @@ -193,22 +192,23 @@ acpi_parse_lapic_addr_ovr ( return 0; } - static int __init -acpi_parse_lsapic (acpi_table_entry_header *header, const unsigned long end) +acpi_parse_lsapic(acpi_table_entry_header * header, const unsigned long end) { struct acpi_table_lsapic *lsapic; - lsapic = (struct acpi_table_lsapic *) header; + lsapic = (struct acpi_table_lsapic *)header; if (BAD_MADT_ENTRY(lsapic, end)) return -EINVAL; if (lsapic->flags.enabled) { #ifdef CONFIG_SMP - smp_boot_data.cpu_phys_id[available_cpus] = (lsapic->id << 8) | lsapic->eid; + smp_boot_data.cpu_phys_id[available_cpus] = + (lsapic->id << 8) | lsapic->eid; #endif - ia64_acpiid_to_sapicid[lsapic->acpi_id] = (lsapic->id << 8) | lsapic->eid; + ia64_acpiid_to_sapicid[lsapic->acpi_id] = + (lsapic->id << 8) | lsapic->eid; ++available_cpus; } @@ -216,13 +216,12 @@ acpi_parse_lsapic (acpi_table_entry_header *header, const unsigned long end) return 0; } - static int __init -acpi_parse_lapic_nmi (acpi_table_entry_header *header, const unsigned long end) +acpi_parse_lapic_nmi(acpi_table_entry_header * header, const unsigned long end) { struct acpi_table_lapic_nmi *lacpi_nmi; - lacpi_nmi = (struct acpi_table_lapic_nmi*) header; + lacpi_nmi = (struct acpi_table_lapic_nmi *)header; if (BAD_MADT_ENTRY(lacpi_nmi, end)) return -EINVAL; @@ -231,13 +230,12 @@ acpi_parse_lapic_nmi (acpi_table_entry_header *header, const unsigned long end) return 0; } - static int __init -acpi_parse_iosapic (acpi_table_entry_header *header, const unsigned long end) +acpi_parse_iosapic(acpi_table_entry_header * header, const unsigned long end) { struct acpi_table_iosapic *iosapic; - iosapic = (struct acpi_table_iosapic *) header; + iosapic = (struct acpi_table_iosapic *)header; if (BAD_MADT_ENTRY(iosapic, end)) return -EINVAL; @@ -245,15 +243,14 @@ acpi_parse_iosapic (acpi_table_entry_header *header, const unsigned long end) return iosapic_init(iosapic->address, iosapic->global_irq_base); } - static int __init -acpi_parse_plat_int_src ( - acpi_table_entry_header *header, const unsigned long end) +acpi_parse_plat_int_src(acpi_table_entry_header * header, + const unsigned long end) { struct acpi_table_plat_int_src *plintsrc; int vector; - plintsrc = (struct acpi_table_plat_int_src *) header; + plintsrc = (struct acpi_table_plat_int_src *)header; if (BAD_MADT_ENTRY(plintsrc, end)) return -EINVAL; @@ -267,8 +264,12 @@ acpi_parse_plat_int_src ( plintsrc->iosapic_vector, plintsrc->eid, plintsrc->id, - (plintsrc->flags.polarity == 1) ? IOSAPIC_POL_HIGH : IOSAPIC_POL_LOW, - (plintsrc->flags.trigger == 1) ? IOSAPIC_EDGE : IOSAPIC_LEVEL); + (plintsrc->flags.polarity == + 1) ? IOSAPIC_POL_HIGH : + IOSAPIC_POL_LOW, + (plintsrc->flags.trigger == + 1) ? IOSAPIC_EDGE : + IOSAPIC_LEVEL); platform_intr_list[plintsrc->type] = vector; if (acpi_madt_rev > 1) { @@ -283,7 +284,6 @@ acpi_parse_plat_int_src ( return 0; } - unsigned int can_cpei_retarget(void) { extern int cpe_vector; @@ -322,29 +322,30 @@ unsigned int get_cpei_target_cpu(void) } static int __init -acpi_parse_int_src_ovr ( - acpi_table_entry_header *header, const unsigned long end) +acpi_parse_int_src_ovr(acpi_table_entry_header * header, + const unsigned long end) { struct acpi_table_int_src_ovr *p; - p = (struct acpi_table_int_src_ovr *) header; + p = (struct acpi_table_int_src_ovr *)header; if (BAD_MADT_ENTRY(p, end)) return -EINVAL; iosapic_override_isa_irq(p->bus_irq, p->global_irq, - (p->flags.polarity == 1) ? IOSAPIC_POL_HIGH : IOSAPIC_POL_LOW, - (p->flags.trigger == 1) ? IOSAPIC_EDGE : IOSAPIC_LEVEL); + (p->flags.polarity == + 1) ? IOSAPIC_POL_HIGH : IOSAPIC_POL_LOW, + (p->flags.trigger == + 1) ? IOSAPIC_EDGE : IOSAPIC_LEVEL); return 0; } - static int __init -acpi_parse_nmi_src (acpi_table_entry_header *header, const unsigned long end) +acpi_parse_nmi_src(acpi_table_entry_header * header, const unsigned long end) { struct acpi_table_nmi_src *nmi_src; - nmi_src = (struct acpi_table_nmi_src*) header; + nmi_src = (struct acpi_table_nmi_src *)header; if (BAD_MADT_ENTRY(nmi_src, end)) return -EINVAL; @@ -353,11 +354,9 @@ acpi_parse_nmi_src (acpi_table_entry_header *header, const unsigned long end) return 0; } -static void __init -acpi_madt_oem_check (char *oem_id, char *oem_table_id) +static void __init acpi_madt_oem_check(char *oem_id, char *oem_table_id) { - if (!strncmp(oem_id, "IBM", 3) && - (!strncmp(oem_table_id, "SERMOW", 6))) { + if (!strncmp(oem_id, "IBM", 3) && (!strncmp(oem_table_id, "SERMOW", 6))) { /* * Unfortunately ITC_DRIFT is not yet part of the @@ -370,19 +369,18 @@ acpi_madt_oem_check (char *oem_id, char *oem_table_id) } } -static int __init -acpi_parse_madt (unsigned long phys_addr, unsigned long size) +static int __init acpi_parse_madt(unsigned long phys_addr, unsigned long size) { if (!phys_addr || !size) return -EINVAL; - acpi_madt = (struct acpi_table_madt *) __va(phys_addr); + acpi_madt = (struct acpi_table_madt *)__va(phys_addr); acpi_madt_rev = acpi_madt->header.revision; /* remember the value for reference after free_initmem() */ #ifdef CONFIG_ITANIUM - has_8259 = 1; /* Firmware on old Itanium systems is broken */ + has_8259 = 1; /* Firmware on old Itanium systems is broken */ #else has_8259 = acpi_madt->flags.pcat_compat; #endif @@ -396,19 +394,18 @@ acpi_parse_madt (unsigned long phys_addr, unsigned long size) printk(KERN_INFO PREFIX "Local APIC address %p\n", ipi_base_addr); acpi_madt_oem_check(acpi_madt->header.oem_id, - acpi_madt->header.oem_table_id); + acpi_madt->header.oem_table_id); return 0; } - #ifdef CONFIG_ACPI_NUMA #undef SLIT_DEBUG #define PXM_FLAG_LEN ((MAX_PXM_DOMAINS + 1)/32) -static int __initdata srat_num_cpus; /* number of cpus */ +static int __initdata srat_num_cpus; /* number of cpus */ static u32 __devinitdata pxm_flag[PXM_FLAG_LEN]; #define pxm_bit_set(bit) (set_bit(bit,(void *)pxm_flag)) #define pxm_bit_test(bit) (test_bit(bit,(void *)pxm_flag)) @@ -421,15 +418,15 @@ static struct acpi_table_slit __initdata *slit_table; * ACPI 2.0 SLIT (System Locality Information Table) * http://devresource.hp.com/devresource/Docs/TechPapers/IA64/slit.pdf */ -void __init -acpi_numa_slit_init (struct acpi_table_slit *slit) +void __init acpi_numa_slit_init(struct acpi_table_slit *slit) { u32 len; len = sizeof(struct acpi_table_header) + 8 - + slit->localities * slit->localities; + + slit->localities * slit->localities; if (slit->header.length != len) { - printk(KERN_ERR "ACPI 2.0 SLIT: size mismatch: %d expected, %d actual\n", + printk(KERN_ERR + "ACPI 2.0 SLIT: size mismatch: %d expected, %d actual\n", len, slit->header.length); memset(numa_slit, 10, sizeof(numa_slit)); return; @@ -438,19 +435,20 @@ acpi_numa_slit_init (struct acpi_table_slit *slit) } void __init -acpi_numa_processor_affinity_init (struct acpi_table_processor_affinity *pa) +acpi_numa_processor_affinity_init(struct acpi_table_processor_affinity *pa) { /* record this node in proximity bitmap */ pxm_bit_set(pa->proximity_domain); - node_cpuid[srat_num_cpus].phys_id = (pa->apic_id << 8) | (pa->lsapic_eid); + node_cpuid[srat_num_cpus].phys_id = + (pa->apic_id << 8) | (pa->lsapic_eid); /* nid should be overridden as logical node id later */ node_cpuid[srat_num_cpus].nid = pa->proximity_domain; srat_num_cpus++; } void __init -acpi_numa_memory_affinity_init (struct acpi_table_memory_affinity *ma) +acpi_numa_memory_affinity_init(struct acpi_table_memory_affinity *ma) { unsigned long paddr, size; u8 pxm; @@ -487,8 +485,7 @@ acpi_numa_memory_affinity_init (struct acpi_table_memory_affinity *ma) num_node_memblks++; } -void __init -acpi_numa_arch_fixup (void) +void __init acpi_numa_arch_fixup(void) { int i, j, node_from, node_to; @@ -534,21 +531,24 @@ acpi_numa_arch_fixup (void) for (i = 0; i < srat_num_cpus; i++) node_cpuid[i].nid = pxm_to_nid_map[node_cpuid[i].nid]; - printk(KERN_INFO "Number of logical nodes in system = %d\n", num_online_nodes()); - printk(KERN_INFO "Number of memory chunks in system = %d\n", num_node_memblks); + printk(KERN_INFO "Number of logical nodes in system = %d\n", + num_online_nodes()); + printk(KERN_INFO "Number of memory chunks in system = %d\n", + num_node_memblks); - if (!slit_table) return; + if (!slit_table) + return; memset(numa_slit, -1, sizeof(numa_slit)); - for (i=0; ilocalities; i++) { + for (i = 0; i < slit_table->localities; i++) { if (!pxm_bit_test(i)) continue; node_from = pxm_to_nid_map[i]; - for (j=0; jlocalities; j++) { + for (j = 0; j < slit_table->localities; j++) { if (!pxm_bit_test(j)) continue; node_to = pxm_to_nid_map[j]; node_distance(node_from, node_to) = - slit_table->entry[i*slit_table->localities + j]; + slit_table->entry[i * slit_table->localities + j]; } } @@ -556,40 +556,43 @@ acpi_numa_arch_fixup (void) printk("ACPI 2.0 SLIT locality table:\n"); for_each_online_node(i) { for_each_online_node(j) - printk("%03d ", node_distance(i,j)); + printk("%03d ", node_distance(i, j)); printk("\n"); } #endif } -#endif /* CONFIG_ACPI_NUMA */ +#endif /* CONFIG_ACPI_NUMA */ /* * success: return IRQ number (>=0) * failure: return < 0 */ -int -acpi_register_gsi (u32 gsi, int edge_level, int active_high_low) +int acpi_register_gsi(u32 gsi, int edge_level, int active_high_low) { if (has_8259 && gsi < 16) return isa_irq_to_vector(gsi); return iosapic_register_intr(gsi, - (active_high_low == ACPI_ACTIVE_HIGH) ? IOSAPIC_POL_HIGH : IOSAPIC_POL_LOW, - (edge_level == ACPI_EDGE_SENSITIVE) ? IOSAPIC_EDGE : IOSAPIC_LEVEL); + (active_high_low == + ACPI_ACTIVE_HIGH) ? IOSAPIC_POL_HIGH : + IOSAPIC_POL_LOW, + (edge_level == + ACPI_EDGE_SENSITIVE) ? IOSAPIC_EDGE : + IOSAPIC_LEVEL); } + EXPORT_SYMBOL(acpi_register_gsi); #ifdef CONFIG_ACPI_DEALLOCATE_IRQ -void -acpi_unregister_gsi (u32 gsi) +void acpi_unregister_gsi(u32 gsi) { iosapic_unregister_intr(gsi); } + EXPORT_SYMBOL(acpi_unregister_gsi); -#endif /* CONFIG_ACPI_DEALLOCATE_IRQ */ +#endif /* CONFIG_ACPI_DEALLOCATE_IRQ */ -static int __init -acpi_parse_fadt (unsigned long phys_addr, unsigned long size) +static int __init acpi_parse_fadt(unsigned long phys_addr, unsigned long size) { struct acpi_table_header *fadt_header; struct fadt_descriptor_rev2 *fadt; @@ -597,11 +600,11 @@ acpi_parse_fadt (unsigned long phys_addr, unsigned long size) if (!phys_addr || !size) return -EINVAL; - fadt_header = (struct acpi_table_header *) __va(phys_addr); + fadt_header = (struct acpi_table_header *)__va(phys_addr); if (fadt_header->revision != 3) - return -ENODEV; /* Only deal with ACPI 2.0 FADT */ + return -ENODEV; /* Only deal with ACPI 2.0 FADT */ - fadt = (struct fadt_descriptor_rev2 *) fadt_header; + fadt = (struct fadt_descriptor_rev2 *)fadt_header; if (!(fadt->iapc_boot_arch & BAF_8042_KEYBOARD_CONTROLLER)) acpi_kbd_controller_present = 0; @@ -613,22 +616,19 @@ acpi_parse_fadt (unsigned long phys_addr, unsigned long size) return 0; } - -unsigned long __init -acpi_find_rsdp (void) +unsigned long __init acpi_find_rsdp(void) { unsigned long rsdp_phys = 0; if (efi.acpi20) rsdp_phys = __pa(efi.acpi20); else if (efi.acpi) - printk(KERN_WARNING PREFIX "v1.0/r0.71 tables no longer supported\n"); + printk(KERN_WARNING PREFIX + "v1.0/r0.71 tables no longer supported\n"); return rsdp_phys; } - -int __init -acpi_boot_init (void) +int __init acpi_boot_init(void) { /* @@ -646,31 +646,43 @@ acpi_boot_init (void) /* Local APIC */ - if (acpi_table_parse_madt(ACPI_MADT_LAPIC_ADDR_OVR, acpi_parse_lapic_addr_ovr, 0) < 0) - printk(KERN_ERR PREFIX "Error parsing LAPIC address override entry\n"); + if (acpi_table_parse_madt + (ACPI_MADT_LAPIC_ADDR_OVR, acpi_parse_lapic_addr_ovr, 0) < 0) + printk(KERN_ERR PREFIX + "Error parsing LAPIC address override entry\n"); - if (acpi_table_parse_madt(ACPI_MADT_LSAPIC, acpi_parse_lsapic, NR_CPUS) < 1) - printk(KERN_ERR PREFIX "Error parsing MADT - no LAPIC entries\n"); + if (acpi_table_parse_madt(ACPI_MADT_LSAPIC, acpi_parse_lsapic, NR_CPUS) + < 1) + printk(KERN_ERR PREFIX + "Error parsing MADT - no LAPIC entries\n"); - if (acpi_table_parse_madt(ACPI_MADT_LAPIC_NMI, acpi_parse_lapic_nmi, 0) < 0) + if (acpi_table_parse_madt(ACPI_MADT_LAPIC_NMI, acpi_parse_lapic_nmi, 0) + < 0) printk(KERN_ERR PREFIX "Error parsing LAPIC NMI entry\n"); /* I/O APIC */ - if (acpi_table_parse_madt(ACPI_MADT_IOSAPIC, acpi_parse_iosapic, NR_IOSAPICS) < 1) - printk(KERN_ERR PREFIX "Error parsing MADT - no IOSAPIC entries\n"); + if (acpi_table_parse_madt + (ACPI_MADT_IOSAPIC, acpi_parse_iosapic, NR_IOSAPICS) < 1) + printk(KERN_ERR PREFIX + "Error parsing MADT - no IOSAPIC entries\n"); /* System-Level Interrupt Routing */ - if (acpi_table_parse_madt(ACPI_MADT_PLAT_INT_SRC, acpi_parse_plat_int_src, ACPI_MAX_PLATFORM_INTERRUPTS) < 0) - printk(KERN_ERR PREFIX "Error parsing platform interrupt source entry\n"); + if (acpi_table_parse_madt + (ACPI_MADT_PLAT_INT_SRC, acpi_parse_plat_int_src, + ACPI_MAX_PLATFORM_INTERRUPTS) < 0) + printk(KERN_ERR PREFIX + "Error parsing platform interrupt source entry\n"); - if (acpi_table_parse_madt(ACPI_MADT_INT_SRC_OVR, acpi_parse_int_src_ovr, 0) < 0) - printk(KERN_ERR PREFIX "Error parsing interrupt source overrides entry\n"); + if (acpi_table_parse_madt + (ACPI_MADT_INT_SRC_OVR, acpi_parse_int_src_ovr, 0) < 0) + printk(KERN_ERR PREFIX + "Error parsing interrupt source overrides entry\n"); if (acpi_table_parse_madt(ACPI_MADT_NMI_SRC, acpi_parse_nmi_src, 0) < 0) printk(KERN_ERR PREFIX "Error parsing NMI SRC entry\n"); - skip_madt: + skip_madt: /* * FADT says whether a legacy keyboard controller is present. @@ -685,8 +697,9 @@ acpi_boot_init (void) if (available_cpus == 0) { printk(KERN_INFO "ACPI: Found 0 CPUS; assuming 1\n"); printk(KERN_INFO "CPU 0 (0x%04x)", hard_smp_processor_id()); - smp_boot_data.cpu_phys_id[available_cpus] = hard_smp_processor_id(); - available_cpus = 1; /* We've got at least one of these, no? */ + smp_boot_data.cpu_phys_id[available_cpus] = + hard_smp_processor_id(); + available_cpus = 1; /* We've got at least one of these, no? */ } smp_boot_data.cpu_count = available_cpus; @@ -695,8 +708,10 @@ acpi_boot_init (void) if (srat_num_cpus == 0) { int cpu, i = 1; for (cpu = 0; cpu < smp_boot_data.cpu_count; cpu++) - if (smp_boot_data.cpu_phys_id[cpu] != hard_smp_processor_id()) - node_cpuid[i++].phys_id = smp_boot_data.cpu_phys_id[cpu]; + if (smp_boot_data.cpu_phys_id[cpu] != + hard_smp_processor_id()) + node_cpuid[i++].phys_id = + smp_boot_data.cpu_phys_id[cpu]; } # endif #endif @@ -704,12 +719,12 @@ acpi_boot_init (void) build_cpu_to_node_map(); #endif /* Make boot-up look pretty */ - printk(KERN_INFO "%d CPUs available, %d CPUs total\n", available_cpus, total_cpus); + printk(KERN_INFO "%d CPUs available, %d CPUs total\n", available_cpus, + total_cpus); return 0; } -int -acpi_gsi_to_irq (u32 gsi, unsigned int *irq) +int acpi_gsi_to_irq(u32 gsi, unsigned int *irq) { int vector; @@ -730,11 +745,10 @@ acpi_gsi_to_irq (u32 gsi, unsigned int *irq) */ #ifdef CONFIG_ACPI_HOTPLUG_CPU static -int -acpi_map_cpu2node(acpi_handle handle, int cpu, long physid) +int acpi_map_cpu2node(acpi_handle handle, int cpu, long physid) { #ifdef CONFIG_ACPI_NUMA - int pxm_id; + int pxm_id; pxm_id = acpi_get_pxm(handle); @@ -742,31 +756,28 @@ acpi_map_cpu2node(acpi_handle handle, int cpu, long physid) * Assuming that the container driver would have set the proximity * domain and would have initialized pxm_to_nid_map[pxm_id] && pxm_flag */ - node_cpuid[cpu].nid = (pxm_id < 0) ? 0: - pxm_to_nid_map[pxm_id]; + node_cpuid[cpu].nid = (pxm_id < 0) ? 0 : pxm_to_nid_map[pxm_id]; - node_cpuid[cpu].phys_id = physid; + node_cpuid[cpu].phys_id = physid; #endif - return(0); + return (0); } - -int -acpi_map_lsapic(acpi_handle handle, int *pcpu) +int acpi_map_lsapic(acpi_handle handle, int *pcpu) { - struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL}; + struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; union acpi_object *obj; struct acpi_table_lsapic *lsapic; cpumask_t tmp_map; long physid; int cpu; - + if (ACPI_FAILURE(acpi_evaluate_object(handle, "_MAT", NULL, &buffer))) return -EINVAL; - if (!buffer.length || !buffer.pointer) + if (!buffer.length || !buffer.pointer) return -EINVAL; - + obj = buffer.pointer; if (obj->type != ACPI_TYPE_BUFFER || obj->buffer.length < sizeof(*lsapic)) { @@ -782,7 +793,7 @@ acpi_map_lsapic(acpi_handle handle, int *pcpu) return -EINVAL; } - physid = ((lsapic->id <<8) | (lsapic->eid)); + physid = ((lsapic->id << 8) | (lsapic->eid)); acpi_os_free(buffer.pointer); buffer.length = ACPI_ALLOCATE_BUFFER; @@ -790,50 +801,49 @@ acpi_map_lsapic(acpi_handle handle, int *pcpu) cpus_complement(tmp_map, cpu_present_map); cpu = first_cpu(tmp_map); - if(cpu >= NR_CPUS) + if (cpu >= NR_CPUS) return -EINVAL; acpi_map_cpu2node(handle, cpu, physid); - cpu_set(cpu, cpu_present_map); + cpu_set(cpu, cpu_present_map); ia64_cpu_to_sapicid[cpu] = physid; ia64_acpiid_to_sapicid[lsapic->acpi_id] = ia64_cpu_to_sapicid[cpu]; *pcpu = cpu; - return(0); + return (0); } -EXPORT_SYMBOL(acpi_map_lsapic); +EXPORT_SYMBOL(acpi_map_lsapic); -int -acpi_unmap_lsapic(int cpu) +int acpi_unmap_lsapic(int cpu) { int i; - for (i=0; i #include - /* -------------------------------------------------------------------------- Low-Level Sleep Support -------------------------------------------------------------------------- */ @@ -77,11 +76,12 @@ static void init_low_mapping(void) * Create an identity mapped page table and copy the wakeup routine to * low memory. */ -int acpi_save_state_mem (void) +int acpi_save_state_mem(void) { init_low_mapping(); - memcpy((void *) acpi_wakeup_address, &wakeup_start, &wakeup_end - &wakeup_start); + memcpy((void *)acpi_wakeup_address, &wakeup_start, + &wakeup_end - &wakeup_start); acpi_copy_wakeup_routine(acpi_wakeup_address); return 0; @@ -90,7 +90,7 @@ int acpi_save_state_mem (void) /* * acpi_restore_state */ -void acpi_restore_state_mem (void) +void acpi_restore_state_mem(void) { set_pgd(pgd_offset(current->mm, 0UL), low_ptr); flush_tlb_all(); @@ -108,7 +108,8 @@ void __init acpi_reserve_bootmem(void) { acpi_wakeup_address = (unsigned long)alloc_bootmem_low(PAGE_SIZE); if ((&wakeup_end - &wakeup_start) > PAGE_SIZE) - printk(KERN_CRIT "ACPI: Wakeup code way too big, will crash on attempt to suspend\n"); + printk(KERN_CRIT + "ACPI: Wakeup code way too big, will crash on attempt to suspend\n"); } static int __init acpi_sleep_setup(char *str) @@ -127,6 +128,8 @@ static int __init acpi_sleep_setup(char *str) __setup("acpi_sleep=", acpi_sleep_setup); -#endif /*CONFIG_ACPI_SLEEP*/ +#endif /*CONFIG_ACPI_SLEEP */ -void acpi_pci_link_exit(void) {} +void acpi_pci_link_exit(void) +{ +} diff --git a/drivers/acpi/ac.c b/drivers/acpi/ac.c index 23ab761dd72..7839b831df9 100644 --- a/drivers/acpi/ac.c +++ b/drivers/acpi/ac.c @@ -32,7 +32,6 @@ #include #include - #define ACPI_AC_COMPONENT 0x00020000 #define ACPI_AC_CLASS "ac_adapter" #define ACPI_AC_HID "ACPI0003" @@ -45,47 +44,45 @@ #define ACPI_AC_STATUS_UNKNOWN 0xFF #define _COMPONENT ACPI_AC_COMPONENT -ACPI_MODULE_NAME ("acpi_ac") +ACPI_MODULE_NAME("acpi_ac") -MODULE_AUTHOR("Paul Diefenbaugh"); + MODULE_AUTHOR("Paul Diefenbaugh"); MODULE_DESCRIPTION(ACPI_AC_DRIVER_NAME); MODULE_LICENSE("GPL"); -static int acpi_ac_add (struct acpi_device *device); -static int acpi_ac_remove (struct acpi_device *device, int type); +static int acpi_ac_add(struct acpi_device *device); +static int acpi_ac_remove(struct acpi_device *device, int type); static int acpi_ac_open_fs(struct inode *inode, struct file *file); static struct acpi_driver acpi_ac_driver = { - .name = ACPI_AC_DRIVER_NAME, - .class = ACPI_AC_CLASS, - .ids = ACPI_AC_HID, - .ops = { - .add = acpi_ac_add, - .remove = acpi_ac_remove, - }, + .name = ACPI_AC_DRIVER_NAME, + .class = ACPI_AC_CLASS, + .ids = ACPI_AC_HID, + .ops = { + .add = acpi_ac_add, + .remove = acpi_ac_remove, + }, }; struct acpi_ac { - acpi_handle handle; - unsigned long state; + acpi_handle handle; + unsigned long state; }; static struct file_operations acpi_ac_fops = { - .open = acpi_ac_open_fs, - .read = seq_read, - .llseek = seq_lseek, - .release = single_release, + .open = acpi_ac_open_fs, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, }; /* -------------------------------------------------------------------------- AC Adapter Management -------------------------------------------------------------------------- */ -static int -acpi_ac_get_state ( - struct acpi_ac *ac) +static int acpi_ac_get_state(struct acpi_ac *ac) { - acpi_status status = AE_OK; + acpi_status status = AE_OK; ACPI_FUNCTION_TRACE("acpi_ac_get_state"); @@ -95,24 +92,23 @@ acpi_ac_get_state ( status = acpi_evaluate_integer(ac->handle, "_PSR", NULL, &ac->state); if (ACPI_FAILURE(status)) { ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error reading AC Adapter state\n")); + "Error reading AC Adapter state\n")); ac->state = ACPI_AC_STATUS_UNKNOWN; return_VALUE(-ENODEV); } - + return_VALUE(0); } - /* -------------------------------------------------------------------------- FS Interface (/proc) -------------------------------------------------------------------------- */ -static struct proc_dir_entry *acpi_ac_dir; +static struct proc_dir_entry *acpi_ac_dir; static int acpi_ac_seq_show(struct seq_file *seq, void *offset) { - struct acpi_ac *ac = (struct acpi_ac *) seq->private; + struct acpi_ac *ac = (struct acpi_ac *)seq->private; ACPI_FUNCTION_TRACE("acpi_ac_seq_show"); @@ -139,23 +135,21 @@ static int acpi_ac_seq_show(struct seq_file *seq, void *offset) return_VALUE(0); } - + static int acpi_ac_open_fs(struct inode *inode, struct file *file) { return single_open(file, acpi_ac_seq_show, PDE(inode)->data); } -static int -acpi_ac_add_fs ( - struct acpi_device *device) +static int acpi_ac_add_fs(struct acpi_device *device) { - struct proc_dir_entry *entry = NULL; + struct proc_dir_entry *entry = NULL; ACPI_FUNCTION_TRACE("acpi_ac_add_fs"); if (!acpi_device_dir(device)) { acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), - acpi_ac_dir); + acpi_ac_dir); if (!acpi_device_dir(device)) return_VALUE(-ENODEV); acpi_device_dir(device)->owner = THIS_MODULE; @@ -163,11 +157,11 @@ acpi_ac_add_fs ( /* 'state' [R] */ entry = create_proc_entry(ACPI_AC_FILE_STATE, - S_IRUGO, acpi_device_dir(device)); + S_IRUGO, acpi_device_dir(device)); if (!entry) ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create '%s' fs entry\n", - ACPI_AC_FILE_STATE)); + "Unable to create '%s' fs entry\n", + ACPI_AC_FILE_STATE)); else { entry->proc_fops = &acpi_ac_fops; entry->data = acpi_driver_data(device); @@ -177,16 +171,12 @@ acpi_ac_add_fs ( return_VALUE(0); } - -static int -acpi_ac_remove_fs ( - struct acpi_device *device) +static int acpi_ac_remove_fs(struct acpi_device *device) { ACPI_FUNCTION_TRACE("acpi_ac_remove_fs"); if (acpi_device_dir(device)) { - remove_proc_entry(ACPI_AC_FILE_STATE, - acpi_device_dir(device)); + remove_proc_entry(ACPI_AC_FILE_STATE, acpi_device_dir(device)); remove_proc_entry(acpi_device_bid(device), acpi_ac_dir); acpi_device_dir(device) = NULL; @@ -195,19 +185,14 @@ acpi_ac_remove_fs ( return_VALUE(0); } - /* -------------------------------------------------------------------------- Driver Model -------------------------------------------------------------------------- */ -static void -acpi_ac_notify ( - acpi_handle handle, - u32 event, - void *data) +static void acpi_ac_notify(acpi_handle handle, u32 event, void *data) { - struct acpi_ac *ac = (struct acpi_ac *) data; - struct acpi_device *device = NULL; + struct acpi_ac *ac = (struct acpi_ac *)data; + struct acpi_device *device = NULL; ACPI_FUNCTION_TRACE("acpi_ac_notify"); @@ -224,21 +209,18 @@ acpi_ac_notify ( break; default: ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "Unsupported event [0x%x]\n", event)); + "Unsupported event [0x%x]\n", event)); break; } return_VOID; } - -static int -acpi_ac_add ( - struct acpi_device *device) +static int acpi_ac_add(struct acpi_device *device) { - int result = 0; - acpi_status status = AE_OK; - struct acpi_ac *ac = NULL; + int result = 0; + acpi_status status = AE_OK; + struct acpi_ac *ac = NULL; ACPI_FUNCTION_TRACE("acpi_ac_add"); @@ -264,19 +246,20 @@ acpi_ac_add ( goto end; status = acpi_install_notify_handler(ac->handle, - ACPI_DEVICE_NOTIFY, acpi_ac_notify, ac); + ACPI_DEVICE_NOTIFY, acpi_ac_notify, + ac); if (ACPI_FAILURE(status)) { ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error installing notify handler\n")); + "Error installing notify handler\n")); result = -ENODEV; goto end; } - printk(KERN_INFO PREFIX "%s [%s] (%s)\n", - acpi_device_name(device), acpi_device_bid(device), - ac->state?"on-line":"off-line"); + printk(KERN_INFO PREFIX "%s [%s] (%s)\n", + acpi_device_name(device), acpi_device_bid(device), + ac->state ? "on-line" : "off-line"); -end: + end: if (result) { acpi_ac_remove_fs(device); kfree(ac); @@ -285,27 +268,23 @@ end: return_VALUE(result); } - -static int -acpi_ac_remove ( - struct acpi_device *device, - int type) +static int acpi_ac_remove(struct acpi_device *device, int type) { - acpi_status status = AE_OK; - struct acpi_ac *ac = NULL; + acpi_status status = AE_OK; + struct acpi_ac *ac = NULL; ACPI_FUNCTION_TRACE("acpi_ac_remove"); if (!device || !acpi_driver_data(device)) return_VALUE(-EINVAL); - ac = (struct acpi_ac *) acpi_driver_data(device); + ac = (struct acpi_ac *)acpi_driver_data(device); status = acpi_remove_notify_handler(ac->handle, - ACPI_DEVICE_NOTIFY, acpi_ac_notify); + ACPI_DEVICE_NOTIFY, acpi_ac_notify); if (ACPI_FAILURE(status)) ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error removing notify handler\n")); + "Error removing notify handler\n")); acpi_ac_remove_fs(device); @@ -314,11 +293,9 @@ acpi_ac_remove ( return_VALUE(0); } - -static int __init -acpi_ac_init (void) +static int __init acpi_ac_init(void) { - int result = 0; + int result = 0; ACPI_FUNCTION_TRACE("acpi_ac_init"); @@ -336,9 +313,7 @@ acpi_ac_init (void) return_VALUE(0); } - -static void __exit -acpi_ac_exit (void) +static void __exit acpi_ac_exit(void) { ACPI_FUNCTION_TRACE("acpi_ac_exit"); @@ -349,6 +324,5 @@ acpi_ac_exit (void) return_VOID; } - module_init(acpi_ac_init); module_exit(acpi_ac_exit); diff --git a/drivers/acpi/acpi_memhotplug.c b/drivers/acpi/acpi_memhotplug.c index 77285ffe41c..01a1bd23926 100644 --- a/drivers/acpi/acpi_memhotplug.c +++ b/drivers/acpi/acpi_memhotplug.c @@ -32,7 +32,6 @@ #include #include - #define ACPI_MEMORY_DEVICE_COMPONENT 0x08000000UL #define ACPI_MEMORY_DEVICE_CLASS "memory" #define ACPI_MEMORY_DEVICE_HID "PNP0C80" @@ -41,8 +40,8 @@ #define _COMPONENT ACPI_MEMORY_DEVICE_COMPONENT -ACPI_MODULE_NAME ("acpi_memory") -MODULE_AUTHOR("Naveen B S "); +ACPI_MODULE_NAME("acpi_memory") + MODULE_AUTHOR("Naveen B S "); MODULE_DESCRIPTION(ACPI_MEMORY_DEVICE_DRIVER_NAME); MODULE_LICENSE("GPL"); @@ -56,34 +55,33 @@ MODULE_LICENSE("GPL"); #define MEMORY_POWER_ON_STATE 1 #define MEMORY_POWER_OFF_STATE 2 -static int acpi_memory_device_add (struct acpi_device *device); -static int acpi_memory_device_remove (struct acpi_device *device, int type); +static int acpi_memory_device_add(struct acpi_device *device); +static int acpi_memory_device_remove(struct acpi_device *device, int type); static struct acpi_driver acpi_memory_device_driver = { - .name = ACPI_MEMORY_DEVICE_DRIVER_NAME, - .class = ACPI_MEMORY_DEVICE_CLASS, - .ids = ACPI_MEMORY_DEVICE_HID, - .ops = { - .add = acpi_memory_device_add, - .remove = acpi_memory_device_remove, - }, + .name = ACPI_MEMORY_DEVICE_DRIVER_NAME, + .class = ACPI_MEMORY_DEVICE_CLASS, + .ids = ACPI_MEMORY_DEVICE_HID, + .ops = { + .add = acpi_memory_device_add, + .remove = acpi_memory_device_remove, + }, }; struct acpi_memory_device { acpi_handle handle; - unsigned int state; /* State of the memory device */ + unsigned int state; /* State of the memory device */ unsigned short cache_attribute; /* memory cache attribute */ - unsigned short read_write_attribute;/* memory read/write attribute */ - u64 start_addr; /* Memory Range start physical addr */ - u64 end_addr; /* Memory Range end physical addr */ + unsigned short read_write_attribute; /* memory read/write attribute */ + u64 start_addr; /* Memory Range start physical addr */ + u64 end_addr; /* Memory Range end physical addr */ }; - static int acpi_memory_get_device_resources(struct acpi_memory_device *mem_device) { acpi_status status; - struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL}; + struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; struct acpi_resource *resource = NULL; struct acpi_resource_address64 address64; @@ -94,15 +92,15 @@ acpi_memory_get_device_resources(struct acpi_memory_device *mem_device) if (ACPI_FAILURE(status)) return_VALUE(-EINVAL); - resource = (struct acpi_resource *) buffer.pointer; + resource = (struct acpi_resource *)buffer.pointer; status = acpi_resource_to_address64(resource, &address64); if (ACPI_SUCCESS(status)) { if (address64.resource_type == ACPI_MEMORY_RANGE) { /* Populate the structure */ mem_device->cache_attribute = - address64.attribute.memory.cache_attribute; + address64.attribute.memory.cache_attribute; mem_device->read_write_attribute = - address64.attribute.memory.read_write_attribute; + address64.attribute.memory.read_write_attribute; mem_device->start_addr = address64.min_address_range; mem_device->end_addr = address64.max_address_range; } @@ -114,7 +112,7 @@ acpi_memory_get_device_resources(struct acpi_memory_device *mem_device) static int acpi_memory_get_device(acpi_handle handle, - struct acpi_memory_device **mem_device) + struct acpi_memory_device **mem_device) { acpi_status status; acpi_handle phandle; @@ -128,8 +126,7 @@ acpi_memory_get_device(acpi_handle handle, status = acpi_get_parent(handle, &phandle); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error in acpi_get_parent\n")); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error in acpi_get_parent\n")); return_VALUE(-EINVAL); } @@ -137,7 +134,7 @@ acpi_memory_get_device(acpi_handle handle, status = acpi_bus_get_device(phandle, &pdevice); if (ACPI_FAILURE(status)) { ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error in acpi_bus_get_device\n")); + "Error in acpi_bus_get_device\n")); return_VALUE(-EINVAL); } @@ -147,23 +144,21 @@ acpi_memory_get_device(acpi_handle handle, */ status = acpi_bus_add(&device, pdevice, handle, ACPI_BUS_TYPE_DEVICE); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error in acpi_bus_add\n")); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error in acpi_bus_add\n")); return_VALUE(-EINVAL); } -end: + end: *mem_device = acpi_driver_data(device); if (!(*mem_device)) { - printk(KERN_ERR "\n driver data not found" ); + printk(KERN_ERR "\n driver data not found"); return_VALUE(-ENODEV); } return_VALUE(0); } -static int -acpi_memory_check_device(struct acpi_memory_device *mem_device) +static int acpi_memory_check_device(struct acpi_memory_device *mem_device) { unsigned long current_status; @@ -171,22 +166,21 @@ acpi_memory_check_device(struct acpi_memory_device *mem_device) /* Get device present/absent information from the _STA */ if (ACPI_FAILURE(acpi_evaluate_integer(mem_device->handle, "_STA", - NULL, ¤t_status))) + NULL, ¤t_status))) return_VALUE(-ENODEV); /* * Check for device status. Device should be * present/enabled/functioning. */ if (!((current_status & ACPI_MEMORY_STA_PRESENT) - && (current_status & ACPI_MEMORY_STA_ENABLED) - && (current_status & ACPI_MEMORY_STA_FUNCTIONAL))) + && (current_status & ACPI_MEMORY_STA_ENABLED) + && (current_status & ACPI_MEMORY_STA_FUNCTIONAL))) return_VALUE(-ENODEV); return_VALUE(0); } -static int -acpi_memory_enable_device(struct acpi_memory_device *mem_device) +static int acpi_memory_enable_device(struct acpi_memory_device *mem_device) { int result; @@ -196,7 +190,7 @@ acpi_memory_enable_device(struct acpi_memory_device *mem_device) result = acpi_memory_get_device_resources(mem_device); if (result) { ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "\nget_device_resources failed\n")); + "\nget_device_resources failed\n")); mem_device->state = MEMORY_INVALID_STATE; return result; } @@ -206,11 +200,10 @@ acpi_memory_enable_device(struct acpi_memory_device *mem_device) * Note: Assume that this function returns zero on success */ result = add_memory(mem_device->start_addr, - (mem_device->end_addr - mem_device->start_addr) + 1, - mem_device->read_write_attribute); + (mem_device->end_addr - mem_device->start_addr) + 1, + mem_device->read_write_attribute); if (result) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "\nadd_memory failed\n")); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "\nadd_memory failed\n")); mem_device->state = MEMORY_INVALID_STATE; return result; } @@ -218,11 +211,10 @@ acpi_memory_enable_device(struct acpi_memory_device *mem_device) return result; } -static int -acpi_memory_powerdown_device(struct acpi_memory_device *mem_device) +static int acpi_memory_powerdown_device(struct acpi_memory_device *mem_device) { acpi_status status; - struct acpi_object_list arg_list; + struct acpi_object_list arg_list; union acpi_object arg; unsigned long current_status; @@ -234,16 +226,16 @@ acpi_memory_powerdown_device(struct acpi_memory_device *mem_device) arg.type = ACPI_TYPE_INTEGER; arg.integer.value = 1; status = acpi_evaluate_object(mem_device->handle, - "_EJ0", &arg_list, NULL); + "_EJ0", &arg_list, NULL); /* Return on _EJ0 failure */ if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR,"_EJ0 failed.\n")); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "_EJ0 failed.\n")); return_VALUE(-ENODEV); } /* Evalute _STA to check if the device is disabled */ status = acpi_evaluate_integer(mem_device->handle, "_STA", - NULL, ¤t_status); + NULL, ¤t_status); if (ACPI_FAILURE(status)) return_VALUE(-ENODEV); @@ -254,8 +246,7 @@ acpi_memory_powerdown_device(struct acpi_memory_device *mem_device) return_VALUE(0); } -static int -acpi_memory_disable_device(struct acpi_memory_device *mem_device) +static int acpi_memory_disable_device(struct acpi_memory_device *mem_device) { int result; u64 start = mem_device->start_addr; @@ -278,7 +269,7 @@ acpi_memory_disable_device(struct acpi_memory_device *mem_device) result = acpi_memory_powerdown_device(mem_device); if (result) { ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Device Power Down failed.\n")); + "Device Power Down failed.\n")); /* Set the status of the device to invalid */ mem_device->state = MEMORY_INVALID_STATE; return result; @@ -288,8 +279,7 @@ acpi_memory_disable_device(struct acpi_memory_device *mem_device) return result; } -static void -acpi_memory_device_notify(acpi_handle handle, u32 event, void *data) +static void acpi_memory_device_notify(acpi_handle handle, u32 event, void *data) { struct acpi_memory_device *mem_device; struct acpi_device *device; @@ -299,37 +289,37 @@ acpi_memory_device_notify(acpi_handle handle, u32 event, void *data) switch (event) { case ACPI_NOTIFY_BUS_CHECK: ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "\nReceived BUS CHECK notification for device\n")); + "\nReceived BUS CHECK notification for device\n")); /* Fall Through */ case ACPI_NOTIFY_DEVICE_CHECK: if (event == ACPI_NOTIFY_DEVICE_CHECK) ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "\nReceived DEVICE CHECK notification for device\n")); + "\nReceived DEVICE CHECK notification for device\n")); if (acpi_memory_get_device(handle, &mem_device)) { ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error in finding driver data\n")); + "Error in finding driver data\n")); return_VOID; } if (!acpi_memory_check_device(mem_device)) { if (acpi_memory_enable_device(mem_device)) ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error in acpi_memory_enable_device\n")); + "Error in acpi_memory_enable_device\n")); } break; case ACPI_NOTIFY_EJECT_REQUEST: ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "\nReceived EJECT REQUEST notification for device\n")); + "\nReceived EJECT REQUEST notification for device\n")); if (acpi_bus_get_device(handle, &device)) { ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Device doesn't exist\n")); + "Device doesn't exist\n")); break; } mem_device = acpi_driver_data(device); if (!mem_device) { ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Driver Data is NULL\n")); + "Driver Data is NULL\n")); break; } @@ -337,26 +327,25 @@ acpi_memory_device_notify(acpi_handle handle, u32 event, void *data) * Currently disabling memory device from kernel mode * TBD: Can also be disabled from user mode scripts * TBD: Can also be disabled by Callback registration - * with generic sysfs driver + * with generic sysfs driver */ if (acpi_memory_disable_device(mem_device)) ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error in acpi_memory_disable_device\n")); + "Error in acpi_memory_disable_device\n")); /* * TBD: Invoke acpi_bus_remove to cleanup data structures */ break; default: ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "Unsupported event [0x%x]\n", event)); + "Unsupported event [0x%x]\n", event)); break; } return_VOID; } -static int -acpi_memory_device_add(struct acpi_device *device) +static int acpi_memory_device_add(struct acpi_device *device) { int result; struct acpi_memory_device *mem_device = NULL; @@ -391,8 +380,7 @@ acpi_memory_device_add(struct acpi_device *device) return_VALUE(result); } -static int -acpi_memory_device_remove (struct acpi_device *device, int type) +static int acpi_memory_device_remove(struct acpi_device *device, int type) { struct acpi_memory_device *mem_device = NULL; @@ -401,7 +389,7 @@ acpi_memory_device_remove (struct acpi_device *device, int type) if (!device || !acpi_driver_data(device)) return_VALUE(-EINVAL); - mem_device = (struct acpi_memory_device *) acpi_driver_data(device); + mem_device = (struct acpi_memory_device *)acpi_driver_data(device); kfree(mem_device); return_VALUE(0); @@ -410,12 +398,11 @@ acpi_memory_device_remove (struct acpi_device *device, int type) /* * Helper function to check for memory device */ -static acpi_status -is_memory_device(acpi_handle handle) +static acpi_status is_memory_device(acpi_handle handle) { char *hardware_id; acpi_status status; - struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL}; + struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; struct acpi_device_info *info; ACPI_FUNCTION_TRACE("is_memory_device"); @@ -432,7 +419,7 @@ is_memory_device(acpi_handle handle) hardware_id = info->hardware_id.value; if ((hardware_id == NULL) || - (strcmp(hardware_id, ACPI_MEMORY_DEVICE_HID))) + (strcmp(hardware_id, ACPI_MEMORY_DEVICE_HID))) status = AE_ERROR; acpi_os_free(buffer.pointer); @@ -440,8 +427,8 @@ is_memory_device(acpi_handle handle) } static acpi_status -acpi_memory_register_notify_handler (acpi_handle handle, - u32 level, void *ctxt, void **retv) +acpi_memory_register_notify_handler(acpi_handle handle, + u32 level, void *ctxt, void **retv) { acpi_status status; @@ -452,10 +439,10 @@ acpi_memory_register_notify_handler (acpi_handle handle, return_ACPI_STATUS(AE_OK); /* continue */ status = acpi_install_notify_handler(handle, ACPI_SYSTEM_NOTIFY, - acpi_memory_device_notify, NULL); + acpi_memory_device_notify, NULL); if (ACPI_FAILURE(status)) { ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error installing notify handler\n")); + "Error installing notify handler\n")); return_ACPI_STATUS(AE_OK); /* continue */ } @@ -463,8 +450,8 @@ acpi_memory_register_notify_handler (acpi_handle handle, } static acpi_status -acpi_memory_deregister_notify_handler (acpi_handle handle, - u32 level, void *ctxt, void **retv) +acpi_memory_deregister_notify_handler(acpi_handle handle, + u32 level, void *ctxt, void **retv) { acpi_status status; @@ -475,18 +462,18 @@ acpi_memory_deregister_notify_handler (acpi_handle handle, return_ACPI_STATUS(AE_OK); /* continue */ status = acpi_remove_notify_handler(handle, - ACPI_SYSTEM_NOTIFY, acpi_memory_device_notify); + ACPI_SYSTEM_NOTIFY, + acpi_memory_device_notify); if (ACPI_FAILURE(status)) { ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error removing notify handler\n")); + "Error removing notify handler\n")); return_ACPI_STATUS(AE_OK); /* continue */ } return_ACPI_STATUS(status); } -static int __init -acpi_memory_device_init (void) +static int __init acpi_memory_device_init(void) { int result; acpi_status status; @@ -499,21 +486,20 @@ acpi_memory_device_init (void) return_VALUE(-ENODEV); status = acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, - acpi_memory_register_notify_handler, - NULL, NULL); + ACPI_UINT32_MAX, + acpi_memory_register_notify_handler, + NULL, NULL); - if (ACPI_FAILURE (status)) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "walk_namespace failed\n")); + if (ACPI_FAILURE(status)) { + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "walk_namespace failed\n")); acpi_bus_unregister_driver(&acpi_memory_device_driver); return_VALUE(-ENODEV); - } + } return_VALUE(0); } -static void __exit -acpi_memory_device_exit (void) +static void __exit acpi_memory_device_exit(void) { acpi_status status; @@ -524,12 +510,12 @@ acpi_memory_device_exit (void) * handles. */ status = acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, - acpi_memory_deregister_notify_handler, - NULL, NULL); + ACPI_UINT32_MAX, + acpi_memory_deregister_notify_handler, + NULL, NULL); - if (ACPI_FAILURE (status)) - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "walk_namespace failed\n")); + if (ACPI_FAILURE(status)) + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "walk_namespace failed\n")); acpi_bus_unregister_driver(&acpi_memory_device_driver); @@ -538,5 +524,3 @@ acpi_memory_device_exit (void) module_init(acpi_memory_device_init); module_exit(acpi_memory_device_exit); - - diff --git a/drivers/acpi/asus_acpi.c b/drivers/acpi/asus_acpi.c index a560b1e2da7..fec895af6ae 100644 --- a/drivers/acpi/asus_acpi.c +++ b/drivers/acpi/asus_acpi.c @@ -61,7 +61,7 @@ /* * Some events we use, same for all Asus */ -#define BR_UP 0x10 +#define BR_UP 0x10 #define BR_DOWN 0x20 /* @@ -75,7 +75,6 @@ MODULE_AUTHOR("Julien Lerouge, Karol Kozimor"); MODULE_DESCRIPTION(ACPI_HOTK_NAME); MODULE_LICENSE("GPL"); - static uid_t asus_uid; static gid_t asus_gid; module_param(asus_uid, uint, 0); @@ -83,26 +82,25 @@ MODULE_PARM_DESC(uid, "UID for entries in /proc/acpi/asus.\n"); module_param(asus_gid, uint, 0); MODULE_PARM_DESC(gid, "GID for entries in /proc/acpi/asus.\n"); - /* For each model, all features implemented, * those marked with R are relative to HOTK, A for absolute */ struct model_data { - char *name; //name of the laptop________________A - char *mt_mled; //method to handle mled_____________R - char *mled_status; //node to handle mled reading_______A - char *mt_wled; //method to handle wled_____________R - char *wled_status; //node to handle wled reading_______A - char *mt_tled; //method to handle tled_____________R - char *tled_status; //node to handle tled reading_______A - char *mt_lcd_switch; //method to turn LCD ON/OFF_________A - char *lcd_status; //node to read LCD panel state______A - char *brightness_up; //method to set brightness up_______A - char *brightness_down; //guess what ?______________________A - char *brightness_set; //method to set absolute brightness_R - char *brightness_get; //method to get absolute brightness_R - char *brightness_status; //node to get brightness____________A - char *display_set; //method to set video output________R - char *display_get; //method to get video output________R + char *name; //name of the laptop________________A + char *mt_mled; //method to handle mled_____________R + char *mled_status; //node to handle mled reading_______A + char *mt_wled; //method to handle wled_____________R + char *wled_status; //node to handle wled reading_______A + char *mt_tled; //method to handle tled_____________R + char *tled_status; //node to handle tled reading_______A + char *mt_lcd_switch; //method to turn LCD ON/OFF_________A + char *lcd_status; //node to read LCD panel state______A + char *brightness_up; //method to set brightness up_______A + char *brightness_down; //guess what ?______________________A + char *brightness_set; //method to set absolute brightness_R + char *brightness_get; //method to get absolute brightness_R + char *brightness_status; //node to get brightness____________A + char *display_set; //method to set video output________R + char *display_get; //method to get video output________R }; /* @@ -110,34 +108,34 @@ struct model_data { * about the hotk device */ struct asus_hotk { - struct acpi_device *device; //the device we are in - acpi_handle handle; //the handle of the hotk device - char status; //status of the hotk, for LEDs, ... - struct model_data *methods; //methods available on the laptop - u8 brightness; //brightness level + struct acpi_device *device; //the device we are in + acpi_handle handle; //the handle of the hotk device + char status; //status of the hotk, for LEDs, ... + struct model_data *methods; //methods available on the laptop + u8 brightness; //brightness level enum { - A1x = 0, //A1340D, A1300F - A2x, //A2500H - D1x, //D1 - L2D, //L2000D - L3C, //L3800C - L3D, //L3400D - L3H, //L3H, but also L2000E - L4R, //L4500R - L5x, //L5800C - L8L, //L8400L - M1A, //M1300A - M2E, //M2400E, L4400L - M6N, //M6800N - M6R, //M6700R - P30, //Samsung P30 - S1x, //S1300A, but also L1400B and M2400A (L84F) - S2x, //S200 (J1 reported), Victor MP-XP7210 - xxN, //M2400N, M3700N, M5200N, S1300N, S5200N, W1OOON - //(Centrino) + A1x = 0, //A1340D, A1300F + A2x, //A2500H + D1x, //D1 + L2D, //L2000D + L3C, //L3800C + L3D, //L3400D + L3H, //L3H, but also L2000E + L4R, //L4500R + L5x, //L5800C + L8L, //L8400L + M1A, //M1300A + M2E, //M2400E, L4400L + M6N, //M6800N + M6R, //M6700R + P30, //Samsung P30 + S1x, //S1300A, but also L1400B and M2400A (L84F) + S2x, //S200 (J1 reported), Victor MP-XP7210 + xxN, //M2400N, M3700N, M5200N, S1300N, S5200N, W1OOON + //(Centrino) END_MODEL - } model; //Models currently supported - u16 event_count[128]; //count for each event TODO make this better + } model; //Models currently supported + u16 event_count[128]; //count for each event TODO make this better }; /* Here we go */ @@ -150,7 +148,7 @@ struct asus_hotk { #define xxN_PREFIX "\\_SB.PCI0.SBRG.EC0." static struct model_data model_conf[END_MODEL] = { - /* + /* * Those pathnames are relative to the HOTK / ATKD device : * - mt_mled * - mt_wled @@ -165,215 +163,197 @@ static struct model_data model_conf[END_MODEL] = { */ { - .name = "A1x", - .mt_mled = "MLED", - .mled_status = "\\MAIL", - .mt_lcd_switch = A1x_PREFIX "_Q10", - .lcd_status = "\\BKLI", - .brightness_up = A1x_PREFIX "_Q0E", - .brightness_down = A1x_PREFIX "_Q0F" - }, + .name = "A1x", + .mt_mled = "MLED", + .mled_status = "\\MAIL", + .mt_lcd_switch = A1x_PREFIX "_Q10", + .lcd_status = "\\BKLI", + .brightness_up = A1x_PREFIX "_Q0E", + .brightness_down = A1x_PREFIX "_Q0F"}, { - .name = "A2x", - .mt_mled = "MLED", - .mt_wled = "WLED", - .wled_status = "\\SG66", - .mt_lcd_switch = "\\Q10", - .lcd_status = "\\BAOF", - .brightness_set = "SPLV", - .brightness_get = "GPLV", - .display_set = "SDSP", - .display_get = "\\INFB" - }, + .name = "A2x", + .mt_mled = "MLED", + .mt_wled = "WLED", + .wled_status = "\\SG66", + .mt_lcd_switch = "\\Q10", + .lcd_status = "\\BAOF", + .brightness_set = "SPLV", + .brightness_get = "GPLV", + .display_set = "SDSP", + .display_get = "\\INFB"}, { - .name = "D1x", - .mt_mled = "MLED", - .mt_lcd_switch = "\\Q0D", - .lcd_status = "\\GP11", - .brightness_up = "\\Q0C", - .brightness_down = "\\Q0B", - .brightness_status = "\\BLVL", - .display_set = "SDSP", - .display_get = "\\INFB" - }, + .name = "D1x", + .mt_mled = "MLED", + .mt_lcd_switch = "\\Q0D", + .lcd_status = "\\GP11", + .brightness_up = "\\Q0C", + .brightness_down = "\\Q0B", + .brightness_status = "\\BLVL", + .display_set = "SDSP", + .display_get = "\\INFB"}, { - .name = "L2D", - .mt_mled = "MLED", - .mled_status = "\\SGP6", - .mt_wled = "WLED", - .wled_status = "\\RCP3", - .mt_lcd_switch = "\\Q10", - .lcd_status = "\\SGP0", - .brightness_up = "\\Q0E", - .brightness_down = "\\Q0F", - .display_set = "SDSP", - .display_get = "\\INFB" - }, + .name = "L2D", + .mt_mled = "MLED", + .mled_status = "\\SGP6", + .mt_wled = "WLED", + .wled_status = "\\RCP3", + .mt_lcd_switch = "\\Q10", + .lcd_status = "\\SGP0", + .brightness_up = "\\Q0E", + .brightness_down = "\\Q0F", + .display_set = "SDSP", + .display_get = "\\INFB"}, { - .name = "L3C", - .mt_mled = "MLED", - .mt_wled = "WLED", - .mt_lcd_switch = L3C_PREFIX "_Q10", - .lcd_status = "\\GL32", - .brightness_set = "SPLV", - .brightness_get = "GPLV", - .display_set = "SDSP", - .display_get = "\\_SB.PCI0.PCI1.VGAC.NMAP" - }, + .name = "L3C", + .mt_mled = "MLED", + .mt_wled = "WLED", + .mt_lcd_switch = L3C_PREFIX "_Q10", + .lcd_status = "\\GL32", + .brightness_set = "SPLV", + .brightness_get = "GPLV", + .display_set = "SDSP", + .display_get = "\\_SB.PCI0.PCI1.VGAC.NMAP"}, { - .name = "L3D", - .mt_mled = "MLED", - .mled_status = "\\MALD", - .mt_wled = "WLED", - .mt_lcd_switch = "\\Q10", - .lcd_status = "\\BKLG", - .brightness_set = "SPLV", - .brightness_get = "GPLV", - .display_set = "SDSP", - .display_get = "\\INFB" - }, + .name = "L3D", + .mt_mled = "MLED", + .mled_status = "\\MALD", + .mt_wled = "WLED", + .mt_lcd_switch = "\\Q10", + .lcd_status = "\\BKLG", + .brightness_set = "SPLV", + .brightness_get = "GPLV", + .display_set = "SDSP", + .display_get = "\\INFB"}, { - .name = "L3H", - .mt_mled = "MLED", - .mt_wled = "WLED", - .mt_lcd_switch = "EHK", - .lcd_status = "\\_SB.PCI0.PM.PBC", - .brightness_set = "SPLV", - .brightness_get = "GPLV", - .display_set = "SDSP", - .display_get = "\\INFB" - }, + .name = "L3H", + .mt_mled = "MLED", + .mt_wled = "WLED", + .mt_lcd_switch = "EHK", + .lcd_status = "\\_SB.PCI0.PM.PBC", + .brightness_set = "SPLV", + .brightness_get = "GPLV", + .display_set = "SDSP", + .display_get = "\\INFB"}, { - .name = "L4R", - .mt_mled = "MLED", - .mt_wled = "WLED", - .wled_status = "\\_SB.PCI0.SBRG.SG13", - .mt_lcd_switch = xxN_PREFIX "_Q10", - .lcd_status = "\\_SB.PCI0.SBSM.SEO4", - .brightness_set = "SPLV", - .brightness_get = "GPLV", - .display_set = "SDSP", - .display_get = "\\_SB.PCI0.P0P1.VGA.GETD" - }, + .name = "L4R", + .mt_mled = "MLED", + .mt_wled = "WLED", + .wled_status = "\\_SB.PCI0.SBRG.SG13", + .mt_lcd_switch = xxN_PREFIX "_Q10", + .lcd_status = "\\_SB.PCI0.SBSM.SEO4", + .brightness_set = "SPLV", + .brightness_get = "GPLV", + .display_set = "SDSP", + .display_get = "\\_SB.PCI0.P0P1.VGA.GETD"}, { - .name = "L5x", - .mt_mled = "MLED", + .name = "L5x", + .mt_mled = "MLED", /* WLED present, but not controlled by ACPI */ - .mt_tled = "TLED", - .mt_lcd_switch = "\\Q0D", - .lcd_status = "\\BAOF", - .brightness_set = "SPLV", - .brightness_get = "GPLV", - .display_set = "SDSP", - .display_get = "\\INFB" - }, + .mt_tled = "TLED", + .mt_lcd_switch = "\\Q0D", + .lcd_status = "\\BAOF", + .brightness_set = "SPLV", + .brightness_get = "GPLV", + .display_set = "SDSP", + .display_get = "\\INFB"}, { - .name = "L8L" + .name = "L8L" /* No features, but at least support the hotkeys */ - }, + }, { - .name = "M1A", - .mt_mled = "MLED", - .mt_lcd_switch = M1A_PREFIX "Q10", - .lcd_status = "\\PNOF", - .brightness_up = M1A_PREFIX "Q0E", - .brightness_down = M1A_PREFIX "Q0F", - .brightness_status = "\\BRIT", - .display_set = "SDSP", - .display_get = "\\INFB" - }, + .name = "M1A", + .mt_mled = "MLED", + .mt_lcd_switch = M1A_PREFIX "Q10", + .lcd_status = "\\PNOF", + .brightness_up = M1A_PREFIX "Q0E", + .brightness_down = M1A_PREFIX "Q0F", + .brightness_status = "\\BRIT", + .display_set = "SDSP", + .display_get = "\\INFB"}, { - .name = "M2E", - .mt_mled = "MLED", - .mt_wled = "WLED", - .mt_lcd_switch = "\\Q10", - .lcd_status = "\\GP06", - .brightness_set = "SPLV", - .brightness_get = "GPLV", - .display_set = "SDSP", - .display_get = "\\INFB" - }, + .name = "M2E", + .mt_mled = "MLED", + .mt_wled = "WLED", + .mt_lcd_switch = "\\Q10", + .lcd_status = "\\GP06", + .brightness_set = "SPLV", + .brightness_get = "GPLV", + .display_set = "SDSP", + .display_get = "\\INFB"}, { - .name = "M6N", - .mt_mled = "MLED", - .mt_wled = "WLED", - .wled_status = "\\_SB.PCI0.SBRG.SG13", - .mt_lcd_switch = xxN_PREFIX "_Q10", - .lcd_status = "\\_SB.BKLT", - .brightness_set = "SPLV", - .brightness_get = "GPLV", - .display_set = "SDSP", - .display_get = "\\SSTE" - }, + .name = "M6N", + .mt_mled = "MLED", + .mt_wled = "WLED", + .wled_status = "\\_SB.PCI0.SBRG.SG13", + .mt_lcd_switch = xxN_PREFIX "_Q10", + .lcd_status = "\\_SB.BKLT", + .brightness_set = "SPLV", + .brightness_get = "GPLV", + .display_set = "SDSP", + .display_get = "\\SSTE"}, { - .name = "M6R", - .mt_mled = "MLED", - .mt_wled = "WLED", - .mt_lcd_switch = xxN_PREFIX "_Q10", - .lcd_status = "\\_SB.PCI0.SBSM.SEO4", - .brightness_set = "SPLV", - .brightness_get = "GPLV", - .display_set = "SDSP", - .display_get = "\\SSTE" - }, - + .name = "M6R", + .mt_mled = "MLED", + .mt_wled = "WLED", + .mt_lcd_switch = xxN_PREFIX "_Q10", + .lcd_status = "\\_SB.PCI0.SBSM.SEO4", + .brightness_set = "SPLV", + .brightness_get = "GPLV", + .display_set = "SDSP", + .display_get = "\\SSTE"}, { - .name = "P30", - .mt_wled = "WLED", - .mt_lcd_switch = P30_PREFIX "_Q0E", - .lcd_status = "\\BKLT", - .brightness_up = P30_PREFIX "_Q68", - .brightness_down = P30_PREFIX "_Q69", - .brightness_get = "GPLV", - .display_set = "SDSP", - .display_get = "\\DNXT" - }, + .name = "P30", + .mt_wled = "WLED", + .mt_lcd_switch = P30_PREFIX "_Q0E", + .lcd_status = "\\BKLT", + .brightness_up = P30_PREFIX "_Q68", + .brightness_down = P30_PREFIX "_Q69", + .brightness_get = "GPLV", + .display_set = "SDSP", + .display_get = "\\DNXT"}, { - .name = "S1x", - .mt_mled = "MLED", - .mled_status = "\\EMLE", - .mt_wled = "WLED", - .mt_lcd_switch = S1x_PREFIX "Q10" , - .lcd_status = "\\PNOF", - .brightness_set = "SPLV", - .brightness_get = "GPLV" - }, + .name = "S1x", + .mt_mled = "MLED", + .mled_status = "\\EMLE", + .mt_wled = "WLED", + .mt_lcd_switch = S1x_PREFIX "Q10", + .lcd_status = "\\PNOF", + .brightness_set = "SPLV", + .brightness_get = "GPLV"}, { - .name = "S2x", - .mt_mled = "MLED", - .mled_status = "\\MAIL", - .mt_lcd_switch = S2x_PREFIX "_Q10", - .lcd_status = "\\BKLI", - .brightness_up = S2x_PREFIX "_Q0B", - .brightness_down = S2x_PREFIX "_Q0A" - }, + .name = "S2x", + .mt_mled = "MLED", + .mled_status = "\\MAIL", + .mt_lcd_switch = S2x_PREFIX "_Q10", + .lcd_status = "\\BKLI", + .brightness_up = S2x_PREFIX "_Q0B", + .brightness_down = S2x_PREFIX "_Q0A"}, { - .name = "xxN", - .mt_mled = "MLED", + .name = "xxN", + .mt_mled = "MLED", /* WLED present, but not controlled by ACPI */ - .mt_lcd_switch = xxN_PREFIX "_Q10", - .lcd_status = "\\BKLT", - .brightness_set = "SPLV", - .brightness_get = "GPLV", - .display_set = "SDSP", - .display_get = "\\ADVG" - } + .mt_lcd_switch = xxN_PREFIX "_Q10", + .lcd_status = "\\BKLT", + .brightness_set = "SPLV", + .brightness_get = "GPLV", + .display_set = "SDSP", + .display_get = "\\ADVG"} }; /* procdir we use */ @@ -395,13 +375,13 @@ static struct asus_hotk *hotk; static int asus_hotk_add(struct acpi_device *device); static int asus_hotk_remove(struct acpi_device *device, int type); static struct acpi_driver asus_hotk_driver = { - .name = ACPI_HOTK_NAME, - .class = ACPI_HOTK_CLASS, - .ids = ACPI_HOTK_HID, - .ops = { - .add = asus_hotk_add, - .remove = asus_hotk_remove, - }, + .name = ACPI_HOTK_NAME, + .class = ACPI_HOTK_CLASS, + .ids = ACPI_HOTK_HID, + .ops = { + .add = asus_hotk_add, + .remove = asus_hotk_remove, + }, }; /* @@ -423,11 +403,10 @@ static int write_acpi_int(acpi_handle handle, const char *method, int val, in_obj.type = ACPI_TYPE_INTEGER; in_obj.integer.value = val; - status = acpi_evaluate_object(handle, (char *) method, ¶ms, output); + status = acpi_evaluate_object(handle, (char *)method, ¶ms, output); return (status == AE_OK); } - static int read_acpi_int(acpi_handle handle, const char *method, int *val) { struct acpi_buffer output; @@ -437,7 +416,7 @@ static int read_acpi_int(acpi_handle handle, const char *method, int *val) output.length = sizeof(out_obj); output.pointer = &out_obj; - status = acpi_evaluate_object(handle, (char *) method, NULL, &output); + status = acpi_evaluate_object(handle, (char *)method, NULL, &output); *val = out_obj.integer.value; return (status == AE_OK) && (out_obj.type == ACPI_TYPE_INTEGER); } @@ -449,7 +428,7 @@ static int read_acpi_int(acpi_handle handle, const char *method, int *val) */ static int proc_read_info(char *page, char **start, off_t off, int count, int *eof, - void *data) + void *data) { int len = 0; int temp; @@ -460,7 +439,7 @@ proc_read_info(char *page, char **start, off_t off, int count, int *eof, */ len += sprintf(page, ACPI_HOTK_NAME " " ASUS_ACPI_VERSION "\n"); - len += sprintf(page + len, "Model reference : %s\n", + len += sprintf(page + len, "Model reference : %s\n", hotk->methods->name); /* * The SFUN method probably allows the original driver to get the list @@ -469,7 +448,8 @@ proc_read_info(char *page, char **start, off_t off, int count, int *eof, * The significance of others is yet to be found. */ if (read_acpi_int(hotk->handle, "SFUN", &temp)) - len += sprintf(page + len, "SFUN value : 0x%04x\n", temp); + len += + sprintf(page + len, "SFUN value : 0x%04x\n", temp); /* * Another value for userspace: the ASYM method returns 0x02 for * battery low and 0x04 for battery critical, its readings tend to be @@ -478,7 +458,8 @@ proc_read_info(char *page, char **start, off_t off, int count, int *eof, * silently ignored. */ if (read_acpi_int(hotk->handle, "ASYM", &temp)) - len += sprintf(page + len, "ASYM value : 0x%04x\n", temp); + len += + sprintf(page + len, "ASYM value : 0x%04x\n", temp); if (asus_info) { snprintf(buf, 16, "%d", asus_info->length); len += sprintf(page + len, "DSDT length : %s\n", buf); @@ -501,7 +482,6 @@ proc_read_info(char *page, char **start, off_t off, int count, int *eof, return len; } - /* * /proc handlers * We write our info in page, we begin at offset off and cannot write more @@ -510,8 +490,7 @@ proc_read_info(char *page, char **start, off_t off, int count, int *eof, */ /* Generic LED functions */ -static int -read_led(const char *ledname, int ledmask) +static int read_led(const char *ledname, int ledmask) { if (ledname) { int led_status; @@ -525,7 +504,7 @@ read_led(const char *ledname, int ledmask) return (hotk->status & ledmask) ? 1 : 0; } -static int parse_arg(const char __user *buf, unsigned long count, int *val) +static int parse_arg(const char __user * buf, unsigned long count, int *val) { char s[32]; if (!count) @@ -542,8 +521,8 @@ static int parse_arg(const char __user *buf, unsigned long count, int *val) /* FIXME: kill extraneous args so it can be called independently */ static int -write_led(const char __user *buffer, unsigned long count, - char *ledname, int ledmask, int invert) +write_led(const char __user * buffer, unsigned long count, + char *ledname, int ledmask, int invert) { int value; int led_out = 0; @@ -555,16 +534,16 @@ write_led(const char __user *buffer, unsigned long count, hotk->status = (led_out) ? (hotk->status | ledmask) : (hotk->status & ~ledmask); - if (invert) /* invert target value */ + if (invert) /* invert target value */ led_out = !led_out & 0x1; if (!write_acpi_int(hotk->handle, ledname, led_out, NULL)) - printk(KERN_WARNING "Asus ACPI: LED (%s) write failed\n", ledname); + printk(KERN_WARNING "Asus ACPI: LED (%s) write failed\n", + ledname); return count; } - /* * Proc handlers for MLED */ @@ -572,12 +551,12 @@ static int proc_read_mled(char *page, char **start, off_t off, int count, int *eof, void *data) { - return sprintf(page, "%d\n", read_led(hotk->methods->mled_status, MLED_ON)); + return sprintf(page, "%d\n", + read_led(hotk->methods->mled_status, MLED_ON)); } - static int -proc_write_mled(struct file *file, const char __user *buffer, +proc_write_mled(struct file *file, const char __user * buffer, unsigned long count, void *data) { return write_led(buffer, count, hotk->methods->mt_mled, MLED_ON, 1); @@ -590,11 +569,12 @@ static int proc_read_wled(char *page, char **start, off_t off, int count, int *eof, void *data) { - return sprintf(page, "%d\n", read_led(hotk->methods->wled_status, WLED_ON)); + return sprintf(page, "%d\n", + read_led(hotk->methods->wled_status, WLED_ON)); } static int -proc_write_wled(struct file *file, const char __user *buffer, +proc_write_wled(struct file *file, const char __user * buffer, unsigned long count, void *data) { return write_led(buffer, count, hotk->methods->mt_wled, WLED_ON, 0); @@ -607,35 +587,36 @@ static int proc_read_tled(char *page, char **start, off_t off, int count, int *eof, void *data) { - return sprintf(page, "%d\n", read_led(hotk->methods->tled_status, TLED_ON)); + return sprintf(page, "%d\n", + read_led(hotk->methods->tled_status, TLED_ON)); } static int -proc_write_tled(struct file *file, const char __user *buffer, +proc_write_tled(struct file *file, const char __user * buffer, unsigned long count, void *data) { return write_led(buffer, count, hotk->methods->mt_tled, TLED_ON, 0); } - static int get_lcd_state(void) { int lcd = 0; if (hotk->model != L3H) { - /* We don't have to check anything if we are here */ + /* We don't have to check anything if we are here */ if (!read_acpi_int(NULL, hotk->methods->lcd_status, &lcd)) - printk(KERN_WARNING "Asus ACPI: Error reading LCD status\n"); - + printk(KERN_WARNING + "Asus ACPI: Error reading LCD status\n"); + if (hotk->model == L2D) lcd = ~lcd; - } else { /* L3H and the like have to be handled differently */ + } else { /* L3H and the like have to be handled differently */ acpi_status status = 0; struct acpi_object_list input; union acpi_object mt_params[2]; struct acpi_buffer output; union acpi_object out_obj; - + input.count = 2; input.pointer = mt_params; /* Note: the following values are partly guessed up, but @@ -647,15 +628,17 @@ static int get_lcd_state(void) output.length = sizeof(out_obj); output.pointer = &out_obj; - - status = acpi_evaluate_object(NULL, hotk->methods->lcd_status, &input, &output); + + status = + acpi_evaluate_object(NULL, hotk->methods->lcd_status, + &input, &output); if (status != AE_OK) return -1; if (out_obj.type == ACPI_TYPE_INTEGER) /* That's what the AML code does */ lcd = out_obj.integer.value >> 8; } - + return (lcd & 1); } @@ -669,10 +652,13 @@ static int set_lcd_state(int value) /* switch */ if (hotk->model != L3H) { status = - acpi_evaluate_object(NULL, hotk->methods->mt_lcd_switch, + acpi_evaluate_object(NULL, + hotk->methods->mt_lcd_switch, NULL, NULL); - } else { /* L3H and the like have to be handled differently */ - if (!write_acpi_int(hotk->handle, hotk->methods->mt_lcd_switch, 0x07, NULL)) + } else { /* L3H and the like have to be handled differently */ + if (!write_acpi_int + (hotk->handle, hotk->methods->mt_lcd_switch, 0x07, + NULL)) status = AE_ERROR; /* L3H's AML executes EHK (0x07) upon Fn+F7 keypress, the exact behaviour is simulated here */ @@ -691,33 +677,33 @@ proc_read_lcd(char *page, char **start, off_t off, int count, int *eof, return sprintf(page, "%d\n", get_lcd_state()); } - static int -proc_write_lcd(struct file *file, const char __user *buffer, +proc_write_lcd(struct file *file, const char __user * buffer, unsigned long count, void *data) { int value; - + count = parse_arg(buffer, count, &value); if (count > 0) set_lcd_state(value); return count; } - static int read_brightness(void) { int value; - - if(hotk->methods->brightness_get) { /* SPLV/GPLV laptop */ - if (!read_acpi_int(hotk->handle, hotk->methods->brightness_get, + + if (hotk->methods->brightness_get) { /* SPLV/GPLV laptop */ + if (!read_acpi_int(hotk->handle, hotk->methods->brightness_get, &value)) - printk(KERN_WARNING "Asus ACPI: Error reading brightness\n"); - } else if (hotk->methods->brightness_status) { /* For D1 for example */ - if (!read_acpi_int(NULL, hotk->methods->brightness_status, + printk(KERN_WARNING + "Asus ACPI: Error reading brightness\n"); + } else if (hotk->methods->brightness_status) { /* For D1 for example */ + if (!read_acpi_int(NULL, hotk->methods->brightness_status, &value)) - printk(KERN_WARNING "Asus ACPI: Error reading brightness\n"); - } else /* No GPLV method */ + printk(KERN_WARNING + "Asus ACPI: Error reading brightness\n"); + } else /* No GPLV method */ value = hotk->brightness; return value; } @@ -730,23 +716,25 @@ static void set_brightness(int value) acpi_status status = 0; /* SPLV laptop */ - if(hotk->methods->brightness_set) { - if (!write_acpi_int(hotk->handle, hotk->methods->brightness_set, + if (hotk->methods->brightness_set) { + if (!write_acpi_int(hotk->handle, hotk->methods->brightness_set, value, NULL)) - printk(KERN_WARNING "Asus ACPI: Error changing brightness\n"); + printk(KERN_WARNING + "Asus ACPI: Error changing brightness\n"); return; } /* No SPLV method if we are here, act as appropriate */ value -= read_brightness(); while (value != 0) { - status = acpi_evaluate_object(NULL, (value > 0) ? - hotk->methods->brightness_up : + status = acpi_evaluate_object(NULL, (value > 0) ? + hotk->methods->brightness_up : hotk->methods->brightness_down, NULL, NULL); (value > 0) ? value-- : value++; if (ACPI_FAILURE(status)) - printk(KERN_WARNING "Asus ACPI: Error changing brightness\n"); + printk(KERN_WARNING + "Asus ACPI: Error changing brightness\n"); } return; } @@ -759,7 +747,7 @@ proc_read_brn(char *page, char **start, off_t off, int count, int *eof, } static int -proc_write_brn(struct file *file, const char __user *buffer, +proc_write_brn(struct file *file, const char __user * buffer, unsigned long count, void *data) { int value; @@ -767,7 +755,7 @@ proc_write_brn(struct file *file, const char __user *buffer, count = parse_arg(buffer, count, &value); if (count > 0) { value = (0 < value) ? ((15 < value) ? 15 : value) : 0; - /* 0 <= value <= 15 */ + /* 0 <= value <= 15 */ set_brightness(value); } else if (count < 0) { printk(KERN_WARNING "Asus ACPI: Error reading user input\n"); @@ -779,7 +767,7 @@ proc_write_brn(struct file *file, const char __user *buffer, static void set_display(int value) { /* no sanity check needed for now */ - if (!write_acpi_int(hotk->handle, hotk->methods->display_set, + if (!write_acpi_int(hotk->handle, hotk->methods->display_set, value, NULL)) printk(KERN_WARNING "Asus ACPI: Error setting display\n"); return; @@ -791,13 +779,14 @@ static void set_display(int value) */ static int proc_read_disp(char *page, char **start, off_t off, int count, int *eof, - void *data) + void *data) { int value = 0; - + if (!read_acpi_int(hotk->handle, hotk->methods->display_get, &value)) - printk(KERN_WARNING "Asus ACPI: Error reading display status\n"); - value &= 0x07; /* needed for some models, shouldn't hurt others */ + printk(KERN_WARNING + "Asus ACPI: Error reading display status\n"); + value &= 0x07; /* needed for some models, shouldn't hurt others */ return sprintf(page, "%d\n", value); } @@ -808,8 +797,8 @@ proc_read_disp(char *page, char **start, off_t off, int count, int *eof, * simultaneously, so be warned. See the acpi4asus README for more info. */ static int -proc_write_disp(struct file *file, const char __user *buffer, - unsigned long count, void *data) +proc_write_disp(struct file *file, const char __user * buffer, + unsigned long count, void *data) { int value; @@ -822,19 +811,19 @@ proc_write_disp(struct file *file, const char __user *buffer, return count; } - -typedef int (proc_readfunc)(char *page, char **start, off_t off, int count, - int *eof, void *data); -typedef int (proc_writefunc)(struct file *file, const char __user *buffer, - unsigned long count, void *data); +typedef int (proc_readfunc) (char *page, char **start, off_t off, int count, + int *eof, void *data); +typedef int (proc_writefunc) (struct file * file, const char __user * buffer, + unsigned long count, void *data); static int -__init asus_proc_add(char *name, proc_writefunc *writefunc, - proc_readfunc *readfunc, mode_t mode, - struct acpi_device *device) +__init asus_proc_add(char *name, proc_writefunc * writefunc, + proc_readfunc * readfunc, mode_t mode, + struct acpi_device *device) { - struct proc_dir_entry *proc = create_proc_entry(name, mode, acpi_device_dir(device)); - if(!proc) { + struct proc_dir_entry *proc = + create_proc_entry(name, mode, acpi_device_dir(device)); + if (!proc) { printk(KERN_WARNING " Unable to create %s fs entry\n", name); return -1; } @@ -851,14 +840,14 @@ static int __init asus_hotk_add_fs(struct acpi_device *device) { struct proc_dir_entry *proc; mode_t mode; - + /* * If parameter uid or gid is not changed, keep the default setting for * our proc entries (-rw-rw-rw-) else, it means we care about security, * and then set to -rw-rw---- */ - if ((asus_uid == 0) && (asus_gid == 0)){ + if ((asus_uid == 0) && (asus_gid == 0)) { mode = S_IFREG | S_IRUGO | S_IWUGO; } else { mode = S_IFREG | S_IRUSR | S_IRGRP | S_IWUSR | S_IWGRP; @@ -881,15 +870,18 @@ static int __init asus_hotk_add_fs(struct acpi_device *device) } if (hotk->methods->mt_wled) { - asus_proc_add(PROC_WLED, &proc_write_wled, &proc_read_wled, mode, device); + asus_proc_add(PROC_WLED, &proc_write_wled, &proc_read_wled, + mode, device); } if (hotk->methods->mt_mled) { - asus_proc_add(PROC_MLED, &proc_write_mled, &proc_read_mled, mode, device); + asus_proc_add(PROC_MLED, &proc_write_mled, &proc_read_mled, + mode, device); } if (hotk->methods->mt_tled) { - asus_proc_add(PROC_TLED, &proc_write_tled, &proc_read_tled, mode, device); + asus_proc_add(PROC_TLED, &proc_write_tled, &proc_read_tled, + mode, device); } /* @@ -897,35 +889,40 @@ static int __init asus_hotk_add_fs(struct acpi_device *device) * from keyboard */ if (hotk->methods->mt_lcd_switch && hotk->methods->lcd_status) { - asus_proc_add(PROC_LCD, &proc_write_lcd, &proc_read_lcd, mode, device); + asus_proc_add(PROC_LCD, &proc_write_lcd, &proc_read_lcd, mode, + device); } - + if ((hotk->methods->brightness_up && hotk->methods->brightness_down) || (hotk->methods->brightness_get && hotk->methods->brightness_set)) { - asus_proc_add(PROC_BRN, &proc_write_brn, &proc_read_brn, mode, device); + asus_proc_add(PROC_BRN, &proc_write_brn, &proc_read_brn, mode, + device); } if (hotk->methods->display_set) { - asus_proc_add(PROC_DISP, &proc_write_disp, &proc_read_disp, mode, device); + asus_proc_add(PROC_DISP, &proc_write_disp, &proc_read_disp, + mode, device); } return 0; } -static int asus_hotk_remove_fs(struct acpi_device* device) +static int asus_hotk_remove_fs(struct acpi_device *device) { - if(acpi_device_dir(device)) { - remove_proc_entry(PROC_INFO,acpi_device_dir(device)); + if (acpi_device_dir(device)) { + remove_proc_entry(PROC_INFO, acpi_device_dir(device)); if (hotk->methods->mt_wled) - remove_proc_entry(PROC_WLED,acpi_device_dir(device)); + remove_proc_entry(PROC_WLED, acpi_device_dir(device)); if (hotk->methods->mt_mled) - remove_proc_entry(PROC_MLED,acpi_device_dir(device)); + remove_proc_entry(PROC_MLED, acpi_device_dir(device)); if (hotk->methods->mt_tled) - remove_proc_entry(PROC_TLED,acpi_device_dir(device)); + remove_proc_entry(PROC_TLED, acpi_device_dir(device)); if (hotk->methods->mt_lcd_switch && hotk->methods->lcd_status) remove_proc_entry(PROC_LCD, acpi_device_dir(device)); - if ((hotk->methods->brightness_up && hotk->methods->brightness_down) || - (hotk->methods->brightness_get && hotk->methods->brightness_set)) + if ((hotk->methods->brightness_up + && hotk->methods->brightness_down) + || (hotk->methods->brightness_get + && hotk->methods->brightness_set)) remove_proc_entry(PROC_BRN, acpi_device_dir(device)); if (hotk->methods->display_set) remove_proc_entry(PROC_DISP, acpi_device_dir(device)); @@ -933,16 +930,15 @@ static int asus_hotk_remove_fs(struct acpi_device* device) return 0; } - static void asus_hotk_notify(acpi_handle handle, u32 event, void *data) { - /* TODO Find a better way to handle events count.*/ + /* TODO Find a better way to handle events count. */ if (!hotk) return; if ((event & ~((u32) BR_UP)) < 16) { hotk->brightness = (event & ~((u32) BR_UP)); - } else if ((event & ~((u32) BR_DOWN)) < 16 ) { + } else if ((event & ~((u32) BR_DOWN)) < 16) { hotk->brightness = (event & ~((u32) BR_DOWN)); } @@ -976,7 +972,7 @@ static int __init asus_hotk_get_info(void) if (ACPI_FAILURE(status)) printk(KERN_WARNING " Couldn't get the DSDT table header\n"); else - asus_info = (struct acpi_table_header *) dsdt.pointer; + asus_info = (struct acpi_table_header *)dsdt.pointer; /* We have to write 0 on init this far for all ASUS models */ if (!write_acpi_int(hotk->handle, "INIT", 0, &buffer)) { @@ -988,15 +984,17 @@ static int __init asus_hotk_get_info(void) if (!read_acpi_int(hotk->handle, "BSTS", &bsts_result)) printk(KERN_WARNING " Error calling BSTS\n"); else if (bsts_result) - printk(KERN_NOTICE " BSTS called, 0x%02x returned\n", bsts_result); + printk(KERN_NOTICE " BSTS called, 0x%02x returned\n", + bsts_result); /* Samsung P30 has a device with a valid _HID whose INIT does not * return anything. Catch this one and any similar here */ if (buffer.pointer == NULL) { - if (asus_info && /* Samsung P30 */ + if (asus_info && /* Samsung P30 */ strncmp(asus_info->oem_table_id, "ODEM", 4) == 0) { hotk->model = P30; - printk(KERN_NOTICE " Samsung P30 detected, supported\n"); + printk(KERN_NOTICE + " Samsung P30 detected, supported\n"); } else { hotk->model = M2E; printk(KERN_WARNING " no string returned by INIT\n"); @@ -1006,10 +1004,11 @@ static int __init asus_hotk_get_info(void) hotk->methods = &model_conf[hotk->model]; return AE_OK; } - - model = (union acpi_object *) buffer.pointer; + + model = (union acpi_object *)buffer.pointer; if (model->type == ACPI_TYPE_STRING) { - printk(KERN_NOTICE " %s model detected, ", model->string.pointer); + printk(KERN_NOTICE " %s model detected, ", + model->string.pointer); } hotk->model = END_MODEL; @@ -1035,7 +1034,7 @@ static int __init asus_hotk_get_info(void) strncmp(model->string.pointer, "M6N", 3) == 0 || strncmp(model->string.pointer, "S1N", 3) == 0 || strncmp(model->string.pointer, "S5N", 3) == 0 || - strncmp(model->string.pointer, "W1N", 3) == 0) + strncmp(model->string.pointer, "W1N", 3) == 0) hotk->model = xxN; else if (strncmp(model->string.pointer, "M1", 2) == 0) hotk->model = M1A; @@ -1069,21 +1068,21 @@ static int __init asus_hotk_get_info(void) /* Sort of per-model blacklist */ if (strncmp(model->string.pointer, "L2B", 3) == 0) - hotk->methods->lcd_status = NULL; + hotk->methods->lcd_status = NULL; /* L2B is similar enough to L3C to use its settings, with this only exception */ else if (strncmp(model->string.pointer, "S5N", 3) == 0 || strncmp(model->string.pointer, "M5N", 3) == 0) - hotk->methods->mt_mled = NULL; + hotk->methods->mt_mled = NULL; /* S5N and M5N have no MLED */ else if (strncmp(model->string.pointer, "M2N", 3) == 0 || strncmp(model->string.pointer, "W1N", 3) == 0) - hotk->methods->mt_wled = "WLED"; + hotk->methods->mt_wled = "WLED"; /* M2N and W1N have a usable WLED */ else if (asus_info) { if (strncmp(asus_info->oem_table_id, "L1", 2) == 0) hotk->methods->mled_status = NULL; - /* S1300A reports L84F, but L1400B too, account for that */ + /* S1300A reports L84F, but L1400B too, account for that */ } acpi_os_free(model); @@ -1091,7 +1090,6 @@ static int __init asus_hotk_get_info(void) return AE_OK; } - static int __init asus_hotk_check(void) { int result = 0; @@ -1110,7 +1108,6 @@ static int __init asus_hotk_check(void) return result; } - static int __init asus_hotk_add(struct acpi_device *device) { acpi_status status = AE_OK; @@ -1123,7 +1120,7 @@ static int __init asus_hotk_add(struct acpi_device *device) ASUS_ACPI_VERSION); hotk = - (struct asus_hotk *) kmalloc(sizeof(struct asus_hotk), GFP_KERNEL); + (struct asus_hotk *)kmalloc(sizeof(struct asus_hotk), GFP_KERNEL); if (!hotk) return -ENOMEM; memset(hotk, 0, sizeof(struct asus_hotk)); @@ -1134,7 +1131,6 @@ static int __init asus_hotk_add(struct acpi_device *device) acpi_driver_data(device) = hotk; hotk->device = device; - result = asus_hotk_check(); if (result) goto end; @@ -1153,17 +1149,22 @@ static int __init asus_hotk_add(struct acpi_device *device) printk(KERN_ERR " Error installing notify handler\n"); /* For laptops without GPLV: init the hotk->brightness value */ - if ((!hotk->methods->brightness_get) && (!hotk->methods->brightness_status) && - (hotk->methods->brightness_up && hotk->methods->brightness_down)) { - status = acpi_evaluate_object(NULL, hotk->methods->brightness_down, - NULL, NULL); + if ((!hotk->methods->brightness_get) + && (!hotk->methods->brightness_status) + && (hotk->methods->brightness_up + && hotk->methods->brightness_down)) { + status = + acpi_evaluate_object(NULL, hotk->methods->brightness_down, + NULL, NULL); if (ACPI_FAILURE(status)) printk(KERN_WARNING " Error changing brightness\n"); else { - status = acpi_evaluate_object(NULL, hotk->methods->brightness_up, - NULL, NULL); + status = + acpi_evaluate_object(NULL, + hotk->methods->brightness_up, + NULL, NULL); if (ACPI_FAILURE(status)) - printk(KERN_WARNING " Strange, error changing" + printk(KERN_WARNING " Strange, error changing" " brightness\n"); } } @@ -1176,7 +1177,6 @@ static int __init asus_hotk_add(struct acpi_device *device) return result; } - static int asus_hotk_remove(struct acpi_device *device, int type) { acpi_status status = 0; @@ -1196,7 +1196,6 @@ static int asus_hotk_remove(struct acpi_device *device, int type) return 0; } - static int __init asus_acpi_init(void) { int result; @@ -1204,9 +1203,9 @@ static int __init asus_acpi_init(void) if (acpi_disabled) return -ENODEV; - if (!acpi_specific_hotkey_enabled){ + if (!acpi_specific_hotkey_enabled) { printk(KERN_ERR "Using generic hotkey driver\n"); - return -ENODEV; + return -ENODEV; } asus_proc_dir = proc_mkdir(PROC_ASUS, acpi_root_dir); if (!asus_proc_dir) { @@ -1225,7 +1224,6 @@ static int __init asus_acpi_init(void) return 0; } - static void __exit asus_acpi_exit(void) { acpi_bus_unregister_driver(&asus_hotk_driver); diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c index c55feca9b7d..702e857e98c 100644 --- a/drivers/acpi/battery.c +++ b/drivers/acpi/battery.c @@ -34,7 +34,6 @@ #include #include - #define ACPI_BATTERY_VALUE_UNKNOWN 0xFFFFFFFF #define ACPI_BATTERY_FORMAT_BIF "NNNNNNNNNSSSS" @@ -53,87 +52,85 @@ #define ACPI_BATTERY_UNITS_WATTS "mW" #define ACPI_BATTERY_UNITS_AMPS "mA" - #define _COMPONENT ACPI_BATTERY_COMPONENT -ACPI_MODULE_NAME ("acpi_battery") +ACPI_MODULE_NAME("acpi_battery") -MODULE_AUTHOR("Paul Diefenbaugh"); + MODULE_AUTHOR("Paul Diefenbaugh"); MODULE_DESCRIPTION(ACPI_BATTERY_DRIVER_NAME); MODULE_LICENSE("GPL"); -static int acpi_battery_add (struct acpi_device *device); -static int acpi_battery_remove (struct acpi_device *device, int type); +static int acpi_battery_add(struct acpi_device *device); +static int acpi_battery_remove(struct acpi_device *device, int type); static struct acpi_driver acpi_battery_driver = { - .name = ACPI_BATTERY_DRIVER_NAME, - .class = ACPI_BATTERY_CLASS, - .ids = ACPI_BATTERY_HID, - .ops = { - .add = acpi_battery_add, - .remove = acpi_battery_remove, - }, + .name = ACPI_BATTERY_DRIVER_NAME, + .class = ACPI_BATTERY_CLASS, + .ids = ACPI_BATTERY_HID, + .ops = { + .add = acpi_battery_add, + .remove = acpi_battery_remove, + }, }; struct acpi_battery_status { - acpi_integer state; - acpi_integer present_rate; - acpi_integer remaining_capacity; - acpi_integer present_voltage; + acpi_integer state; + acpi_integer present_rate; + acpi_integer remaining_capacity; + acpi_integer present_voltage; }; struct acpi_battery_info { - acpi_integer power_unit; - acpi_integer design_capacity; - acpi_integer last_full_capacity; - acpi_integer battery_technology; - acpi_integer design_voltage; - acpi_integer design_capacity_warning; - acpi_integer design_capacity_low; - acpi_integer battery_capacity_granularity_1; - acpi_integer battery_capacity_granularity_2; - acpi_string model_number; - acpi_string serial_number; - acpi_string battery_type; - acpi_string oem_info; + acpi_integer power_unit; + acpi_integer design_capacity; + acpi_integer last_full_capacity; + acpi_integer battery_technology; + acpi_integer design_voltage; + acpi_integer design_capacity_warning; + acpi_integer design_capacity_low; + acpi_integer battery_capacity_granularity_1; + acpi_integer battery_capacity_granularity_2; + acpi_string model_number; + acpi_string serial_number; + acpi_string battery_type; + acpi_string oem_info; }; struct acpi_battery_flags { - u8 present:1; /* Bay occupied? */ - u8 power_unit:1; /* 0=watts, 1=apms */ - u8 alarm:1; /* _BTP present? */ - u8 reserved:5; + u8 present:1; /* Bay occupied? */ + u8 power_unit:1; /* 0=watts, 1=apms */ + u8 alarm:1; /* _BTP present? */ + u8 reserved:5; }; struct acpi_battery_trips { - unsigned long warning; - unsigned long low; + unsigned long warning; + unsigned long low; }; struct acpi_battery { - acpi_handle handle; + acpi_handle handle; struct acpi_battery_flags flags; struct acpi_battery_trips trips; - unsigned long alarm; + unsigned long alarm; struct acpi_battery_info *info; }; - /* -------------------------------------------------------------------------- Battery Management -------------------------------------------------------------------------- */ static int -acpi_battery_get_info ( - struct acpi_battery *battery, - struct acpi_battery_info **bif) +acpi_battery_get_info(struct acpi_battery *battery, + struct acpi_battery_info **bif) { - int result = 0; - acpi_status status = 0; - struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL}; - struct acpi_buffer format = {sizeof(ACPI_BATTERY_FORMAT_BIF), - ACPI_BATTERY_FORMAT_BIF}; - struct acpi_buffer data = {0, NULL}; - union acpi_object *package = NULL; + int result = 0; + acpi_status status = 0; + struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; + struct acpi_buffer format = { sizeof(ACPI_BATTERY_FORMAT_BIF), + ACPI_BATTERY_FORMAT_BIF + }; + struct acpi_buffer data = { 0, NULL }; + union acpi_object *package = NULL; ACPI_FUNCTION_TRACE("acpi_battery_get_info"); @@ -148,7 +145,7 @@ acpi_battery_get_info ( return_VALUE(-ENODEV); } - package = (union acpi_object *) buffer.pointer; + package = (union acpi_object *)buffer.pointer; /* Extract Package Data */ @@ -174,27 +171,27 @@ acpi_battery_get_info ( goto end; } -end: + end: acpi_os_free(buffer.pointer); if (!result) - (*bif) = (struct acpi_battery_info *) data.pointer; + (*bif) = (struct acpi_battery_info *)data.pointer; return_VALUE(result); } static int -acpi_battery_get_status ( - struct acpi_battery *battery, - struct acpi_battery_status **bst) +acpi_battery_get_status(struct acpi_battery *battery, + struct acpi_battery_status **bst) { - int result = 0; - acpi_status status = 0; - struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL}; - struct acpi_buffer format = {sizeof(ACPI_BATTERY_FORMAT_BST), - ACPI_BATTERY_FORMAT_BST}; - struct acpi_buffer data = {0, NULL}; - union acpi_object *package = NULL; + int result = 0; + acpi_status status = 0; + struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; + struct acpi_buffer format = { sizeof(ACPI_BATTERY_FORMAT_BST), + ACPI_BATTERY_FORMAT_BST + }; + struct acpi_buffer data = { 0, NULL }; + union acpi_object *package = NULL; ACPI_FUNCTION_TRACE("acpi_battery_get_status"); @@ -209,7 +206,7 @@ acpi_battery_get_status ( return_VALUE(-ENODEV); } - package = (union acpi_object *) buffer.pointer; + package = (union acpi_object *)buffer.pointer; /* Extract Package Data */ @@ -235,24 +232,21 @@ acpi_battery_get_status ( goto end; } -end: + end: acpi_os_free(buffer.pointer); if (!result) - (*bst) = (struct acpi_battery_status *) data.pointer; + (*bst) = (struct acpi_battery_status *)data.pointer; return_VALUE(result); } - static int -acpi_battery_set_alarm ( - struct acpi_battery *battery, - unsigned long alarm) +acpi_battery_set_alarm(struct acpi_battery *battery, unsigned long alarm) { - acpi_status status = 0; - union acpi_object arg0 = {ACPI_TYPE_INTEGER}; - struct acpi_object_list arg_list = {1, &arg0}; + acpi_status status = 0; + union acpi_object arg0 = { ACPI_TYPE_INTEGER }; + struct acpi_object_list arg_list = { 1, &arg0 }; ACPI_FUNCTION_TRACE("acpi_battery_set_alarm"); @@ -275,19 +269,16 @@ acpi_battery_set_alarm ( return_VALUE(0); } - -static int -acpi_battery_check ( - struct acpi_battery *battery) +static int acpi_battery_check(struct acpi_battery *battery) { - int result = 0; - acpi_status status = AE_OK; - acpi_handle handle = NULL; - struct acpi_device *device = NULL; + int result = 0; + acpi_status status = AE_OK; + acpi_handle handle = NULL; + struct acpi_device *device = NULL; struct acpi_battery_info *bif = NULL; ACPI_FUNCTION_TRACE("acpi_battery_check"); - + if (!battery) return_VALUE(-EINVAL); @@ -336,18 +327,17 @@ acpi_battery_check ( return_VALUE(result); } - /* -------------------------------------------------------------------------- FS Interface (/proc) -------------------------------------------------------------------------- */ -static struct proc_dir_entry *acpi_battery_dir; +static struct proc_dir_entry *acpi_battery_dir; static int acpi_battery_read_info(struct seq_file *seq, void *offset) { - int result = 0; - struct acpi_battery *battery = (struct acpi_battery *) seq->private; + int result = 0; + struct acpi_battery *battery = (struct acpi_battery *)seq->private; struct acpi_battery_info *bif = NULL; - char *units = "?"; + char *units = "?"; ACPI_FUNCTION_TRACE("acpi_battery_read_info"); @@ -369,19 +359,21 @@ static int acpi_battery_read_info(struct seq_file *seq, void *offset) goto end; } - units = bif->power_unit ? ACPI_BATTERY_UNITS_AMPS : ACPI_BATTERY_UNITS_WATTS; - + units = + bif-> + power_unit ? ACPI_BATTERY_UNITS_AMPS : ACPI_BATTERY_UNITS_WATTS; + if (bif->design_capacity == ACPI_BATTERY_VALUE_UNKNOWN) seq_printf(seq, "design capacity: unknown\n"); else seq_printf(seq, "design capacity: %d %sh\n", - (u32) bif->design_capacity, units); + (u32) bif->design_capacity, units); if (bif->last_full_capacity == ACPI_BATTERY_VALUE_UNKNOWN) seq_printf(seq, "last full capacity: unknown\n"); else seq_printf(seq, "last full capacity: %d %sh\n", - (u32) bif->last_full_capacity, units); + (u32) bif->last_full_capacity, units); switch ((u32) bif->battery_technology) { case 0: @@ -399,26 +391,22 @@ static int acpi_battery_read_info(struct seq_file *seq, void *offset) seq_printf(seq, "design voltage: unknown\n"); else seq_printf(seq, "design voltage: %d mV\n", - (u32) bif->design_voltage); - + (u32) bif->design_voltage); + seq_printf(seq, "design capacity warning: %d %sh\n", - (u32) bif->design_capacity_warning, units); + (u32) bif->design_capacity_warning, units); seq_printf(seq, "design capacity low: %d %sh\n", - (u32) bif->design_capacity_low, units); + (u32) bif->design_capacity_low, units); seq_printf(seq, "capacity granularity 1: %d %sh\n", - (u32) bif->battery_capacity_granularity_1, units); + (u32) bif->battery_capacity_granularity_1, units); seq_printf(seq, "capacity granularity 2: %d %sh\n", - (u32) bif->battery_capacity_granularity_2, units); - seq_printf(seq, "model number: %s\n", - bif->model_number); - seq_printf(seq, "serial number: %s\n", - bif->serial_number); - seq_printf(seq, "battery type: %s\n", - bif->battery_type); - seq_printf(seq, "OEM info: %s\n", - bif->oem_info); - -end: + (u32) bif->battery_capacity_granularity_2, units); + seq_printf(seq, "model number: %s\n", bif->model_number); + seq_printf(seq, "serial number: %s\n", bif->serial_number); + seq_printf(seq, "battery type: %s\n", bif->battery_type); + seq_printf(seq, "OEM info: %s\n", bif->oem_info); + + end: kfree(bif); return_VALUE(0); @@ -429,14 +417,12 @@ static int acpi_battery_info_open_fs(struct inode *inode, struct file *file) return single_open(file, acpi_battery_read_info, PDE(inode)->data); } - -static int -acpi_battery_read_state (struct seq_file *seq, void *offset) +static int acpi_battery_read_state(struct seq_file *seq, void *offset) { - int result = 0; - struct acpi_battery *battery = (struct acpi_battery *) seq->private; + int result = 0; + struct acpi_battery *battery = (struct acpi_battery *)seq->private; struct acpi_battery_status *bst = NULL; - char *units = "?"; + char *units = "?"; ACPI_FUNCTION_TRACE("acpi_battery_read_state"); @@ -452,7 +438,9 @@ acpi_battery_read_state (struct seq_file *seq, void *offset) /* Battery Units */ - units = battery->flags.power_unit ? ACPI_BATTERY_UNITS_AMPS : ACPI_BATTERY_UNITS_WATTS; + units = + battery->flags. + power_unit ? ACPI_BATTERY_UNITS_AMPS : ACPI_BATTERY_UNITS_WATTS; /* Battery Status (_BST) */ @@ -467,12 +455,12 @@ acpi_battery_read_state (struct seq_file *seq, void *offset) else seq_printf(seq, "capacity state: critical\n"); - if ((bst->state & 0x01) && (bst->state & 0x02)){ - seq_printf(seq, "charging state: charging/discharging\n"); - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Battery Charging and Discharging?\n")); - } - else if (bst->state & 0x01) + if ((bst->state & 0x01) && (bst->state & 0x02)) { + seq_printf(seq, + "charging state: charging/discharging\n"); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Battery Charging and Discharging?\n")); + } else if (bst->state & 0x01) seq_printf(seq, "charging state: discharging\n"); else if (bst->state & 0x02) seq_printf(seq, "charging state: charging\n"); @@ -484,21 +472,21 @@ acpi_battery_read_state (struct seq_file *seq, void *offset) seq_printf(seq, "present rate: unknown\n"); else seq_printf(seq, "present rate: %d %s\n", - (u32) bst->present_rate, units); + (u32) bst->present_rate, units); if (bst->remaining_capacity == ACPI_BATTERY_VALUE_UNKNOWN) seq_printf(seq, "remaining capacity: unknown\n"); else seq_printf(seq, "remaining capacity: %d %sh\n", - (u32) bst->remaining_capacity, units); + (u32) bst->remaining_capacity, units); if (bst->present_voltage == ACPI_BATTERY_VALUE_UNKNOWN) seq_printf(seq, "present voltage: unknown\n"); else seq_printf(seq, "present voltage: %d mV\n", - (u32) bst->present_voltage); + (u32) bst->present_voltage); -end: + end: kfree(bst); return_VALUE(0); @@ -509,12 +497,10 @@ static int acpi_battery_state_open_fs(struct inode *inode, struct file *file) return single_open(file, acpi_battery_read_state, PDE(inode)->data); } - -static int -acpi_battery_read_alarm (struct seq_file *seq, void *offset) +static int acpi_battery_read_alarm(struct seq_file *seq, void *offset) { - struct acpi_battery *battery = (struct acpi_battery *) seq->private; - char *units = "?"; + struct acpi_battery *battery = (struct acpi_battery *)seq->private; + char *units = "?"; ACPI_FUNCTION_TRACE("acpi_battery_read_alarm"); @@ -527,8 +513,10 @@ acpi_battery_read_alarm (struct seq_file *seq, void *offset) } /* Battery Units */ - - units = battery->flags.power_unit ? ACPI_BATTERY_UNITS_AMPS : ACPI_BATTERY_UNITS_WATTS; + + units = + battery->flags. + power_unit ? ACPI_BATTERY_UNITS_AMPS : ACPI_BATTERY_UNITS_WATTS; /* Battery Alarm */ @@ -538,22 +526,19 @@ acpi_battery_read_alarm (struct seq_file *seq, void *offset) else seq_printf(seq, "%d %sh\n", (u32) battery->alarm, units); -end: + end: return_VALUE(0); } - static ssize_t -acpi_battery_write_alarm ( - struct file *file, - const char __user *buffer, - size_t count, - loff_t *ppos) +acpi_battery_write_alarm(struct file *file, + const char __user * buffer, + size_t count, loff_t * ppos) { - int result = 0; - char alarm_string[12] = {'\0'}; - struct seq_file *m = (struct seq_file *)file->private_data; - struct acpi_battery *battery = (struct acpi_battery *)m->private; + int result = 0; + char alarm_string[12] = { '\0' }; + struct seq_file *m = (struct seq_file *)file->private_data; + struct acpi_battery *battery = (struct acpi_battery *)m->private; ACPI_FUNCTION_TRACE("acpi_battery_write_alarm"); @@ -565,11 +550,11 @@ acpi_battery_write_alarm ( if (copy_from_user(alarm_string, buffer, count)) return_VALUE(-EFAULT); - + alarm_string[count] = '\0'; - result = acpi_battery_set_alarm(battery, - simple_strtoul(alarm_string, NULL, 0)); + result = acpi_battery_set_alarm(battery, + simple_strtoul(alarm_string, NULL, 0)); if (result) return_VALUE(result); @@ -582,41 +567,39 @@ static int acpi_battery_alarm_open_fs(struct inode *inode, struct file *file) } static struct file_operations acpi_battery_info_ops = { - .open = acpi_battery_info_open_fs, - .read = seq_read, - .llseek = seq_lseek, - .release = single_release, + .open = acpi_battery_info_open_fs, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, .owner = THIS_MODULE, }; static struct file_operations acpi_battery_state_ops = { - .open = acpi_battery_state_open_fs, - .read = seq_read, - .llseek = seq_lseek, - .release = single_release, + .open = acpi_battery_state_open_fs, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, .owner = THIS_MODULE, }; static struct file_operations acpi_battery_alarm_ops = { - .open = acpi_battery_alarm_open_fs, - .read = seq_read, - .write = acpi_battery_write_alarm, - .llseek = seq_lseek, - .release = single_release, + .open = acpi_battery_alarm_open_fs, + .read = seq_read, + .write = acpi_battery_write_alarm, + .llseek = seq_lseek, + .release = single_release, .owner = THIS_MODULE, }; -static int -acpi_battery_add_fs ( - struct acpi_device *device) +static int acpi_battery_add_fs(struct acpi_device *device) { - struct proc_dir_entry *entry = NULL; + struct proc_dir_entry *entry = NULL; ACPI_FUNCTION_TRACE("acpi_battery_add_fs"); if (!acpi_device_dir(device)) { acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), - acpi_battery_dir); + acpi_battery_dir); if (!acpi_device_dir(device)) return_VALUE(-ENODEV); acpi_device_dir(device)->owner = THIS_MODULE; @@ -624,24 +607,24 @@ acpi_battery_add_fs ( /* 'info' [R] */ entry = create_proc_entry(ACPI_BATTERY_FILE_INFO, - S_IRUGO, acpi_device_dir(device)); + S_IRUGO, acpi_device_dir(device)); if (!entry) ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create '%s' fs entry\n", - ACPI_BATTERY_FILE_INFO)); + "Unable to create '%s' fs entry\n", + ACPI_BATTERY_FILE_INFO)); else { - entry->proc_fops = &acpi_battery_info_ops; + entry->proc_fops = &acpi_battery_info_ops; entry->data = acpi_driver_data(device); entry->owner = THIS_MODULE; } /* 'status' [R] */ entry = create_proc_entry(ACPI_BATTERY_FILE_STATUS, - S_IRUGO, acpi_device_dir(device)); + S_IRUGO, acpi_device_dir(device)); if (!entry) ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create '%s' fs entry\n", - ACPI_BATTERY_FILE_STATUS)); + "Unable to create '%s' fs entry\n", + ACPI_BATTERY_FILE_STATUS)); else { entry->proc_fops = &acpi_battery_state_ops; entry->data = acpi_driver_data(device); @@ -650,11 +633,12 @@ acpi_battery_add_fs ( /* 'alarm' [R/W] */ entry = create_proc_entry(ACPI_BATTERY_FILE_ALARM, - S_IFREG|S_IRUGO|S_IWUSR, acpi_device_dir(device)); + S_IFREG | S_IRUGO | S_IWUSR, + acpi_device_dir(device)); if (!entry) ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create '%s' fs entry\n", - ACPI_BATTERY_FILE_ALARM)); + "Unable to create '%s' fs entry\n", + ACPI_BATTERY_FILE_ALARM)); else { entry->proc_fops = &acpi_battery_alarm_ops; entry->data = acpi_driver_data(device); @@ -664,10 +648,7 @@ acpi_battery_add_fs ( return_VALUE(0); } - -static int -acpi_battery_remove_fs ( - struct acpi_device *device) +static int acpi_battery_remove_fs(struct acpi_device *device) { ACPI_FUNCTION_TRACE("acpi_battery_remove_fs"); @@ -686,19 +667,14 @@ acpi_battery_remove_fs ( return_VALUE(0); } - /* -------------------------------------------------------------------------- Driver Interface -------------------------------------------------------------------------- */ -static void -acpi_battery_notify ( - acpi_handle handle, - u32 event, - void *data) +static void acpi_battery_notify(acpi_handle handle, u32 event, void *data) { - struct acpi_battery *battery = (struct acpi_battery *) data; - struct acpi_device *device = NULL; + struct acpi_battery *battery = (struct acpi_battery *)data; + struct acpi_device *device = NULL; ACPI_FUNCTION_TRACE("acpi_battery_notify"); @@ -716,24 +692,21 @@ acpi_battery_notify ( break; default: ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "Unsupported event [0x%x]\n", event)); + "Unsupported event [0x%x]\n", event)); break; } return_VOID; } - -static int -acpi_battery_add ( - struct acpi_device *device) +static int acpi_battery_add(struct acpi_device *device) { - int result = 0; - acpi_status status = 0; - struct acpi_battery *battery = NULL; + int result = 0; + acpi_status status = 0; + struct acpi_battery *battery = NULL; ACPI_FUNCTION_TRACE("acpi_battery_add"); - + if (!device) return_VALUE(-EINVAL); @@ -756,19 +729,20 @@ acpi_battery_add ( goto end; status = acpi_install_notify_handler(battery->handle, - ACPI_DEVICE_NOTIFY, acpi_battery_notify, battery); + ACPI_DEVICE_NOTIFY, + acpi_battery_notify, battery); if (ACPI_FAILURE(status)) { ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error installing notify handler\n")); + "Error installing notify handler\n")); result = -ENODEV; goto end; } printk(KERN_INFO PREFIX "%s Slot [%s] (battery %s)\n", - ACPI_BATTERY_DEVICE_NAME, acpi_device_bid(device), - device->status.battery_present?"present":"absent"); - -end: + ACPI_BATTERY_DEVICE_NAME, acpi_device_bid(device), + device->status.battery_present ? "present" : "absent"); + + end: if (result) { acpi_battery_remove_fs(device); kfree(battery); @@ -777,27 +751,24 @@ end: return_VALUE(result); } - -static int -acpi_battery_remove ( - struct acpi_device *device, - int type) +static int acpi_battery_remove(struct acpi_device *device, int type) { - acpi_status status = 0; - struct acpi_battery *battery = NULL; + acpi_status status = 0; + struct acpi_battery *battery = NULL; ACPI_FUNCTION_TRACE("acpi_battery_remove"); if (!device || !acpi_driver_data(device)) return_VALUE(-EINVAL); - battery = (struct acpi_battery *) acpi_driver_data(device); + battery = (struct acpi_battery *)acpi_driver_data(device); status = acpi_remove_notify_handler(battery->handle, - ACPI_DEVICE_NOTIFY, acpi_battery_notify); + ACPI_DEVICE_NOTIFY, + acpi_battery_notify); if (ACPI_FAILURE(status)) ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error removing notify handler\n")); + "Error removing notify handler\n")); acpi_battery_remove_fs(device); @@ -806,11 +777,9 @@ acpi_battery_remove ( return_VALUE(0); } - -static int __init -acpi_battery_init (void) +static int __init acpi_battery_init(void) { - int result = 0; + int result = 0; ACPI_FUNCTION_TRACE("acpi_battery_init"); @@ -828,9 +797,7 @@ acpi_battery_init (void) return_VALUE(0); } - -static void __exit -acpi_battery_exit (void) +static void __exit acpi_battery_exit(void) { ACPI_FUNCTION_TRACE("acpi_battery_exit"); @@ -841,6 +808,5 @@ acpi_battery_exit (void) return_VOID; } - module_init(acpi_battery_init); module_exit(acpi_battery_exit); diff --git a/drivers/acpi/blacklist.c b/drivers/acpi/blacklist.c index 4c010e7f11b..9824f679a91 100644 --- a/drivers/acpi/blacklist.c +++ b/drivers/acpi/blacklist.c @@ -26,7 +26,6 @@ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ - #include #include #include @@ -34,49 +33,49 @@ #include #include -enum acpi_blacklist_predicates -{ - all_versions, - less_than_or_equal, - equal, - greater_than_or_equal, +enum acpi_blacklist_predicates { + all_versions, + less_than_or_equal, + equal, + greater_than_or_equal, }; -struct acpi_blacklist_item -{ - char oem_id[7]; - char oem_table_id[9]; - u32 oem_revision; - acpi_table_type table; - enum acpi_blacklist_predicates oem_revision_predicate; - char *reason; - u32 is_critical_error; +struct acpi_blacklist_item { + char oem_id[7]; + char oem_table_id[9]; + u32 oem_revision; + acpi_table_type table; + enum acpi_blacklist_predicates oem_revision_predicate; + char *reason; + u32 is_critical_error; }; /* * POLICY: If *anything* doesn't work, put it on the blacklist. * If they are critical errors, mark it critical, and abort driver load. */ -static struct acpi_blacklist_item acpi_blacklist[] __initdata = -{ +static struct acpi_blacklist_item acpi_blacklist[] __initdata = { /* Compaq Presario 1700 */ - {"PTLTD ", " DSDT ", 0x06040000, ACPI_DSDT, less_than_or_equal, "Multiple problems", 1}, + {"PTLTD ", " DSDT ", 0x06040000, ACPI_DSDT, less_than_or_equal, + "Multiple problems", 1}, /* Sony FX120, FX140, FX150? */ - {"SONY ", "U0 ", 0x20010313, ACPI_DSDT, less_than_or_equal, "ACPI driver problem", 1}, + {"SONY ", "U0 ", 0x20010313, ACPI_DSDT, less_than_or_equal, + "ACPI driver problem", 1}, /* Compaq Presario 800, Insyde BIOS */ - {"INT440", "SYSFexxx", 0x00001001, ACPI_DSDT, less_than_or_equal, "Does not use _REG to protect EC OpRegions", 1}, + {"INT440", "SYSFexxx", 0x00001001, ACPI_DSDT, less_than_or_equal, + "Does not use _REG to protect EC OpRegions", 1}, /* IBM 600E - _ADR should return 7, but it returns 1 */ - {"IBM ", "TP600E ", 0x00000105, ACPI_DSDT, less_than_or_equal, "Incorrect _ADR", 1}, - {"ASUS\0\0", "P2B-S ", 0, ACPI_DSDT, all_versions, "Bogus PCI routing", 1}, + {"IBM ", "TP600E ", 0x00000105, ACPI_DSDT, less_than_or_equal, + "Incorrect _ADR", 1}, + {"ASUS\0\0", "P2B-S ", 0, ACPI_DSDT, all_versions, + "Bogus PCI routing", 1}, {""} }; - #if CONFIG_ACPI_BLACKLIST_YEAR -static int __init -blacklist_by_year(void) +static int __init blacklist_by_year(void) { int year; char *s = dmi_get_system_info(DMI_BIOS_DATE); @@ -92,36 +91,38 @@ blacklist_by_year(void) s += 1; - year = simple_strtoul(s,NULL,0); + year = simple_strtoul(s, NULL, 0); - if (year < 100) { /* 2-digit year */ + if (year < 100) { /* 2-digit year */ year += 1900; if (year < 1996) /* no dates < spec 1.0 */ year += 100; } if (year < CONFIG_ACPI_BLACKLIST_YEAR) { - printk(KERN_ERR PREFIX "BIOS age (%d) fails cutoff (%d), " - "acpi=force is required to enable ACPI\n", - year, CONFIG_ACPI_BLACKLIST_YEAR); + printk(KERN_ERR PREFIX "BIOS age (%d) fails cutoff (%d), " + "acpi=force is required to enable ACPI\n", + year, CONFIG_ACPI_BLACKLIST_YEAR); return 1; } return 0; } #else -static inline int blacklist_by_year(void) { return 0; } +static inline int blacklist_by_year(void) +{ + return 0; +} #endif -int __init -acpi_blacklisted(void) +int __init acpi_blacklisted(void) { int i = 0; int blacklisted = 0; struct acpi_table_header *table_header; - while (acpi_blacklist[i].oem_id[0] != '\0') - { - if (acpi_get_table_header_early(acpi_blacklist[i].table, &table_header)) { + while (acpi_blacklist[i].oem_id[0] != '\0') { + if (acpi_get_table_header_early + (acpi_blacklist[i].table, &table_header)) { i++; continue; } @@ -131,33 +132,43 @@ acpi_blacklisted(void) continue; } - if (strncmp(acpi_blacklist[i].oem_table_id, table_header->oem_table_id, 8)) { + if (strncmp + (acpi_blacklist[i].oem_table_id, table_header->oem_table_id, + 8)) { i++; continue; } if ((acpi_blacklist[i].oem_revision_predicate == all_versions) - || (acpi_blacklist[i].oem_revision_predicate == less_than_or_equal - && table_header->oem_revision <= acpi_blacklist[i].oem_revision) - || (acpi_blacklist[i].oem_revision_predicate == greater_than_or_equal - && table_header->oem_revision >= acpi_blacklist[i].oem_revision) + || (acpi_blacklist[i].oem_revision_predicate == + less_than_or_equal + && table_header->oem_revision <= + acpi_blacklist[i].oem_revision) + || (acpi_blacklist[i].oem_revision_predicate == + greater_than_or_equal + && table_header->oem_revision >= + acpi_blacklist[i].oem_revision) || (acpi_blacklist[i].oem_revision_predicate == equal - && table_header->oem_revision == acpi_blacklist[i].oem_revision)) { - - printk(KERN_ERR PREFIX "Vendor \"%6.6s\" System \"%8.8s\" " - "Revision 0x%x has a known ACPI BIOS problem.\n", - acpi_blacklist[i].oem_id, - acpi_blacklist[i].oem_table_id, - acpi_blacklist[i].oem_revision); - - printk(KERN_ERR PREFIX "Reason: %s. This is a %s error\n", - acpi_blacklist[i].reason, - (acpi_blacklist[i].is_critical_error ? "non-recoverable" : "recoverable")); + && table_header->oem_revision == + acpi_blacklist[i].oem_revision)) { + + printk(KERN_ERR PREFIX + "Vendor \"%6.6s\" System \"%8.8s\" " + "Revision 0x%x has a known ACPI BIOS problem.\n", + acpi_blacklist[i].oem_id, + acpi_blacklist[i].oem_table_id, + acpi_blacklist[i].oem_revision); + + printk(KERN_ERR PREFIX + "Reason: %s. This is a %s error\n", + acpi_blacklist[i].reason, + (acpi_blacklist[i]. + is_critical_error ? "non-recoverable" : + "recoverable")); blacklisted = acpi_blacklist[i].is_critical_error; break; - } - else { + } else { i++; } } @@ -166,4 +177,3 @@ acpi_blacklisted(void) return blacklisted; } - diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index d77c2307883..6a4da417c16 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c @@ -36,19 +36,17 @@ #include #include - #define _COMPONENT ACPI_BUS_COMPONENT -ACPI_MODULE_NAME ("acpi_bus") - +ACPI_MODULE_NAME("acpi_bus") #ifdef CONFIG_X86 extern void __init acpi_pic_sci_set_trigger(unsigned int irq, u16 trigger); #endif -FADT_DESCRIPTOR acpi_fadt; +FADT_DESCRIPTOR acpi_fadt; EXPORT_SYMBOL(acpi_fadt); -struct acpi_device *acpi_root; -struct proc_dir_entry *acpi_root_dir; +struct acpi_device *acpi_root; +struct proc_dir_entry *acpi_root_dir; EXPORT_SYMBOL(acpi_root_dir); #define STRUCT_TO_INT(s) (*((int*)&s)) @@ -57,12 +55,9 @@ EXPORT_SYMBOL(acpi_root_dir); Device Management -------------------------------------------------------------------------- */ -int -acpi_bus_get_device ( - acpi_handle handle, - struct acpi_device **device) +int acpi_bus_get_device(acpi_handle handle, struct acpi_device **device) { - acpi_status status = AE_OK; + acpi_status status = AE_OK; ACPI_FUNCTION_TRACE("acpi_bus_get_device"); @@ -71,24 +66,23 @@ acpi_bus_get_device ( /* TBD: Support fixed-feature devices */ - status = acpi_get_data(handle, acpi_bus_data_handler, (void**) device); + status = acpi_get_data(handle, acpi_bus_data_handler, (void **)device); if (ACPI_FAILURE(status) || !*device) { ACPI_DEBUG_PRINT((ACPI_DB_WARN, "No context for object [%p]\n", - handle)); + handle)); return_VALUE(-ENODEV); } return_VALUE(0); } + EXPORT_SYMBOL(acpi_bus_get_device); -int -acpi_bus_get_status ( - struct acpi_device *device) +int acpi_bus_get_status(struct acpi_device *device) { - acpi_status status = AE_OK; - unsigned long sta = 0; - + acpi_status status = AE_OK; + unsigned long sta = 0; + ACPI_FUNCTION_TRACE("acpi_bus_get_status"); if (!device) @@ -98,10 +92,11 @@ acpi_bus_get_status ( * Evaluate _STA if present. */ if (device->flags.dynamic_status) { - status = acpi_evaluate_integer(device->handle, "_STA", NULL, &sta); + status = + acpi_evaluate_integer(device->handle, "_STA", NULL, &sta); if (ACPI_FAILURE(status)) return_VALUE(-ENODEV); - STRUCT_TO_INT(device->status) = (int) sta; + STRUCT_TO_INT(device->status) = (int)sta; } /* @@ -115,33 +110,30 @@ acpi_bus_get_status ( if (device->status.functional && !device->status.present) { printk(KERN_WARNING PREFIX "Device [%s] status [%08x]: " - "functional but not present; setting present\n", - device->pnp.bus_id, - (u32) STRUCT_TO_INT(device->status)); + "functional but not present; setting present\n", + device->pnp.bus_id, (u32) STRUCT_TO_INT(device->status)); device->status.present = 1; } - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device [%s] status [%08x]\n", - device->pnp.bus_id, (u32) STRUCT_TO_INT(device->status))); + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device [%s] status [%08x]\n", + device->pnp.bus_id, + (u32) STRUCT_TO_INT(device->status))); return_VALUE(0); } -EXPORT_SYMBOL(acpi_bus_get_status); +EXPORT_SYMBOL(acpi_bus_get_status); /* -------------------------------------------------------------------------- Power Management -------------------------------------------------------------------------- */ -int -acpi_bus_get_power ( - acpi_handle handle, - int *state) +int acpi_bus_get_power(acpi_handle handle, int *state) { - int result = 0; - acpi_status status = 0; - struct acpi_device *device = NULL; - unsigned long psc = 0; + int result = 0; + acpi_status status = 0; + struct acpi_device *device = NULL; + unsigned long psc = 0; ACPI_FUNCTION_TRACE("acpi_bus_get_power"); @@ -157,20 +149,18 @@ acpi_bus_get_power ( *state = device->parent->power.state; else *state = ACPI_STATE_D0; - } - else { + } else { /* * Get the device's power state either directly (via _PSC) or * indirectly (via power resources). */ if (device->power.flags.explicit_get) { - status = acpi_evaluate_integer(device->handle, "_PSC", - NULL, &psc); + status = acpi_evaluate_integer(device->handle, "_PSC", + NULL, &psc); if (ACPI_FAILURE(status)) return_VALUE(-ENODEV); - device->power.state = (int) psc; - } - else if (device->power.flags.power_resources) { + device->power.state = (int)psc; + } else if (device->power.flags.power_resources) { result = acpi_power_get_inferred_state(device); if (result) return_VALUE(result); @@ -180,22 +170,19 @@ acpi_bus_get_power ( } ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device [%s] power state is D%d\n", - device->pnp.bus_id, device->power.state)); + device->pnp.bus_id, device->power.state)); return_VALUE(0); } -EXPORT_SYMBOL(acpi_bus_get_power); +EXPORT_SYMBOL(acpi_bus_get_power); -int -acpi_bus_set_power ( - acpi_handle handle, - int state) +int acpi_bus_set_power(acpi_handle handle, int state) { - int result = 0; - acpi_status status = AE_OK; - struct acpi_device *device = NULL; - char object_name[5] = {'_','P','S','0'+state,'\0'}; + int result = 0; + acpi_status status = AE_OK; + struct acpi_device *device = NULL; + char object_name[5] = { '_', 'P', 'S', '0' + state, '\0' }; ACPI_FUNCTION_TRACE("acpi_bus_set_power"); @@ -209,7 +196,8 @@ acpi_bus_set_power ( /* Make sure this is a valid target state */ if (!device->flags.power_manageable) { - ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Device is not power manageable\n")); + ACPI_DEBUG_PRINT((ACPI_DB_WARN, + "Device is not power manageable\n")); return_VALUE(-ENODEV); } /* @@ -219,15 +207,18 @@ acpi_bus_set_power ( if (device->power.state == ACPI_STATE_UNKNOWN) acpi_bus_get_power(device->handle, &device->power.state); if (state == device->power.state) { - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device is already at D%d\n", state)); + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device is already at D%d\n", + state)); return_VALUE(0); } if (!device->power.states[state].flags.valid) { - ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Device does not support D%d\n", state)); + ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Device does not support D%d\n", + state)); return_VALUE(-ENODEV); } if (device->parent && (state < device->parent->power.state)) { - ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Cannot set device to a higher-powered state than parent\n")); + ACPI_DEBUG_PRINT((ACPI_DB_WARN, + "Cannot set device to a higher-powered state than parent\n")); return_VALUE(-ENODEV); } @@ -245,18 +236,17 @@ acpi_bus_set_power ( goto end; } if (device->power.states[state].flags.explicit_set) { - status = acpi_evaluate_object(device->handle, - object_name, NULL, NULL); + status = acpi_evaluate_object(device->handle, + object_name, NULL, NULL); if (ACPI_FAILURE(status)) { result = -ENODEV; goto end; } } - } - else { + } else { if (device->power.states[state].flags.explicit_set) { - status = acpi_evaluate_object(device->handle, - object_name, NULL, NULL); + status = acpi_evaluate_object(device->handle, + object_name, NULL, NULL); if (ACPI_FAILURE(status)) { result = -ENODEV; goto end; @@ -269,19 +259,20 @@ acpi_bus_set_power ( } } -end: + end: if (result) - ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Error transitioning device [%s] to D%d\n", - device->pnp.bus_id, state)); + ACPI_DEBUG_PRINT((ACPI_DB_WARN, + "Error transitioning device [%s] to D%d\n", + device->pnp.bus_id, state)); else - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device [%s] transitioned to D%d\n", - device->pnp.bus_id, state)); + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "Device [%s] transitioned to D%d\n", + device->pnp.bus_id, state)); return_VALUE(result); } -EXPORT_SYMBOL(acpi_bus_set_power); - +EXPORT_SYMBOL(acpi_bus_set_power); /* -------------------------------------------------------------------------- Event Management @@ -292,16 +283,12 @@ static DEFINE_SPINLOCK(acpi_bus_event_lock); LIST_HEAD(acpi_bus_event_list); DECLARE_WAIT_QUEUE_HEAD(acpi_bus_event_queue); -extern int event_is_open; +extern int event_is_open; -int -acpi_bus_generate_event ( - struct acpi_device *device, - u8 type, - int data) +int acpi_bus_generate_event(struct acpi_device *device, u8 type, int data) { - struct acpi_bus_event *event = NULL; - unsigned long flags = 0; + struct acpi_bus_event *event = NULL; + unsigned long flags = 0; ACPI_FUNCTION_TRACE("acpi_bus_generate_event"); @@ -329,14 +316,13 @@ acpi_bus_generate_event ( return_VALUE(0); } + EXPORT_SYMBOL(acpi_bus_generate_event); -int -acpi_bus_receive_event ( - struct acpi_bus_event *event) +int acpi_bus_receive_event(struct acpi_bus_event *event) { - unsigned long flags = 0; - struct acpi_bus_event *entry = NULL; + unsigned long flags = 0; + struct acpi_bus_event *entry = NULL; DECLARE_WAITQUEUE(wait, current); @@ -361,7 +347,8 @@ acpi_bus_receive_event ( } spin_lock_irqsave(&acpi_bus_event_lock, flags); - entry = list_entry(acpi_bus_event_list.next, struct acpi_bus_event, node); + entry = + list_entry(acpi_bus_event_list.next, struct acpi_bus_event, node); if (entry) list_del(&entry->node); spin_unlock_irqrestore(&acpi_bus_event_lock, flags); @@ -375,19 +362,17 @@ acpi_bus_receive_event ( return_VALUE(0); } -EXPORT_SYMBOL(acpi_bus_receive_event); +EXPORT_SYMBOL(acpi_bus_receive_event); /* -------------------------------------------------------------------------- Notification Handling -------------------------------------------------------------------------- */ static int -acpi_bus_check_device ( - struct acpi_device *device, - int *status_changed) +acpi_bus_check_device(struct acpi_device *device, int *status_changed) { - acpi_status status = 0; + acpi_status status = 0; struct acpi_device_status old_status; ACPI_FUNCTION_TRACE("acpi_bus_check_device"); @@ -422,15 +407,14 @@ acpi_bus_check_device ( if (status_changed) *status_changed = 1; - + /* * Device Insertion/Removal */ if ((device->status.present) && !(old_status.present)) { ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device insertion detected\n")); /* TBD: Handle device insertion */ - } - else if (!(device->status.present) && (old_status.present)) { + } else if (!(device->status.present) && (old_status.present)) { ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device removal detected\n")); /* TBD: Handle device removal */ } @@ -438,13 +422,10 @@ acpi_bus_check_device ( return_VALUE(0); } - -static int -acpi_bus_check_scope ( - struct acpi_device *device) +static int acpi_bus_check_scope(struct acpi_device *device) { - int result = 0; - int status_changed = 0; + int result = 0; + int status_changed = 0; ACPI_FUNCTION_TRACE("acpi_bus_check_scope"); @@ -467,20 +448,15 @@ acpi_bus_check_scope ( return_VALUE(0); } - /** * acpi_bus_notify * --------------- * Callback for all 'system-level' device notifications (values 0x00-0x7F). */ -static void -acpi_bus_notify ( - acpi_handle handle, - u32 type, - void *data) +static void acpi_bus_notify(acpi_handle handle, u32 type, void *data) { - int result = 0; - struct acpi_device *device = NULL; + int result = 0; + struct acpi_device *device = NULL; ACPI_FUNCTION_TRACE("acpi_bus_notify"); @@ -490,64 +466,73 @@ acpi_bus_notify ( switch (type) { case ACPI_NOTIFY_BUS_CHECK: - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Received BUS CHECK notification for device [%s]\n", - device->pnp.bus_id)); + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "Received BUS CHECK notification for device [%s]\n", + device->pnp.bus_id)); result = acpi_bus_check_scope(device); /* * TBD: We'll need to outsource certain events to non-ACPI - * drivers via the device manager (device.c). + * drivers via the device manager (device.c). */ break; case ACPI_NOTIFY_DEVICE_CHECK: - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Received DEVICE CHECK notification for device [%s]\n", - device->pnp.bus_id)); + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "Received DEVICE CHECK notification for device [%s]\n", + device->pnp.bus_id)); result = acpi_bus_check_device(device, NULL); /* * TBD: We'll need to outsource certain events to non-ACPI - * drivers via the device manager (device.c). + * drivers via the device manager (device.c). */ break; case ACPI_NOTIFY_DEVICE_WAKE: - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Received DEVICE WAKE notification for device [%s]\n", - device->pnp.bus_id)); + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "Received DEVICE WAKE notification for device [%s]\n", + device->pnp.bus_id)); /* TBD */ break; case ACPI_NOTIFY_EJECT_REQUEST: - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Received EJECT REQUEST notification for device [%s]\n", - device->pnp.bus_id)); + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "Received EJECT REQUEST notification for device [%s]\n", + device->pnp.bus_id)); /* TBD */ break; case ACPI_NOTIFY_DEVICE_CHECK_LIGHT: - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Received DEVICE CHECK LIGHT notification for device [%s]\n", - device->pnp.bus_id)); + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "Received DEVICE CHECK LIGHT notification for device [%s]\n", + device->pnp.bus_id)); /* TBD: Exactly what does 'light' mean? */ break; case ACPI_NOTIFY_FREQUENCY_MISMATCH: - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Received FREQUENCY MISMATCH notification for device [%s]\n", - device->pnp.bus_id)); + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "Received FREQUENCY MISMATCH notification for device [%s]\n", + device->pnp.bus_id)); /* TBD */ break; case ACPI_NOTIFY_BUS_MODE_MISMATCH: - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Received BUS MODE MISMATCH notification for device [%s]\n", - device->pnp.bus_id)); + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "Received BUS MODE MISMATCH notification for device [%s]\n", + device->pnp.bus_id)); /* TBD */ break; case ACPI_NOTIFY_POWER_FAULT: - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Received POWER FAULT notification for device [%s]\n", - device->pnp.bus_id)); + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "Received POWER FAULT notification for device [%s]\n", + device->pnp.bus_id)); /* TBD */ break; default: - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Received unknown/unsupported notification [%08x]\n", - type)); + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "Received unknown/unsupported notification [%08x]\n", + type)); break; } @@ -558,13 +543,12 @@ acpi_bus_notify ( Initialization/Cleanup -------------------------------------------------------------------------- */ -static int __init -acpi_bus_init_irq (void) +static int __init acpi_bus_init_irq(void) { - acpi_status status = AE_OK; - union acpi_object arg = {ACPI_TYPE_INTEGER}; - struct acpi_object_list arg_list = {1, &arg}; - char *message = NULL; + acpi_status status = AE_OK; + union acpi_object arg = { ACPI_TYPE_INTEGER }; + struct acpi_object_list arg_list = { 1, &arg }; + char *message = NULL; ACPI_FUNCTION_TRACE("acpi_bus_init_irq"); @@ -601,12 +585,10 @@ acpi_bus_init_irq (void) return_VALUE(0); } - -void __init -acpi_early_init (void) +void __init acpi_early_init(void) { - acpi_status status = AE_OK; - struct acpi_buffer buffer = {sizeof(acpi_fadt), &acpi_fadt}; + acpi_status status = AE_OK; + struct acpi_buffer buffer = { sizeof(acpi_fadt), &acpi_fadt }; ACPI_FUNCTION_TRACE("acpi_early_init"); @@ -619,13 +601,15 @@ acpi_early_init (void) status = acpi_initialize_subsystem(); if (ACPI_FAILURE(status)) { - printk(KERN_ERR PREFIX "Unable to initialize the ACPI Interpreter\n"); + printk(KERN_ERR PREFIX + "Unable to initialize the ACPI Interpreter\n"); goto error0; } status = acpi_load_tables(); if (ACPI_FAILURE(status)) { - printk(KERN_ERR PREFIX "Unable to load the System Description Tables\n"); + printk(KERN_ERR PREFIX + "Unable to load the System Description Tables\n"); goto error0; } @@ -637,7 +621,6 @@ acpi_early_init (void) printk(KERN_ERR PREFIX "Unable to get the FADT\n"); goto error0; } - #ifdef CONFIG_X86 if (!acpi_ioapic) { extern acpi_interrupt_flags acpi_sci_flags; @@ -647,7 +630,8 @@ acpi_early_init (void) acpi_sci_flags.trigger = 3; /* Set PIC-mode SCI trigger type */ - acpi_pic_sci_set_trigger(acpi_fadt.sci_int, acpi_sci_flags.trigger); + acpi_pic_sci_set_trigger(acpi_fadt.sci_int, + acpi_sci_flags.trigger); } else { extern int acpi_sci_override_gsi; /* @@ -658,7 +642,10 @@ acpi_early_init (void) } #endif - status = acpi_enable_subsystem(~(ACPI_NO_HARDWARE_INIT | ACPI_NO_ACPI_ENABLE)); + status = + acpi_enable_subsystem(~ + (ACPI_NO_HARDWARE_INIT | + ACPI_NO_ACPI_ENABLE)); if (ACPI_FAILURE(status)) { printk(KERN_ERR PREFIX "Unable to enable ACPI\n"); goto error0; @@ -666,30 +653,32 @@ acpi_early_init (void) return_VOID; -error0: + error0: disable_acpi(); return_VOID; } -static int __init -acpi_bus_init (void) +static int __init acpi_bus_init(void) { - int result = 0; - acpi_status status = AE_OK; - extern acpi_status acpi_os_initialize1(void); + int result = 0; + acpi_status status = AE_OK; + extern acpi_status acpi_os_initialize1(void); ACPI_FUNCTION_TRACE("acpi_bus_init"); status = acpi_os_initialize1(); - status = acpi_enable_subsystem(ACPI_NO_HARDWARE_INIT | ACPI_NO_ACPI_ENABLE); + status = + acpi_enable_subsystem(ACPI_NO_HARDWARE_INIT | ACPI_NO_ACPI_ENABLE); if (ACPI_FAILURE(status)) { - printk(KERN_ERR PREFIX "Unable to start the ACPI Interpreter\n"); + printk(KERN_ERR PREFIX + "Unable to start the ACPI Interpreter\n"); goto error1; } if (ACPI_FAILURE(status)) { - printk(KERN_ERR PREFIX "Unable to initialize ACPI OS objects\n"); + printk(KERN_ERR PREFIX + "Unable to initialize ACPI OS objects\n"); goto error1; } #ifdef CONFIG_ACPI_EC @@ -723,9 +712,12 @@ acpi_bus_init (void) /* * Register the for all standard device notifications. */ - status = acpi_install_notify_handler(ACPI_ROOT_OBJECT, ACPI_SYSTEM_NOTIFY, &acpi_bus_notify, NULL); + status = + acpi_install_notify_handler(ACPI_ROOT_OBJECT, ACPI_SYSTEM_NOTIFY, + &acpi_bus_notify, NULL); if (ACPI_FAILURE(status)) { - printk(KERN_ERR PREFIX "Unable to register for device notifications\n"); + printk(KERN_ERR PREFIX + "Unable to register for device notifications\n"); goto error1; } @@ -737,21 +729,20 @@ acpi_bus_init (void) return_VALUE(0); /* Mimic structured exception handling */ -error1: + error1: acpi_terminate(); return_VALUE(-ENODEV); } -decl_subsys(acpi,NULL,NULL); +decl_subsys(acpi, NULL, NULL); -static int __init acpi_init (void) +static int __init acpi_init(void) { - int result = 0; + int result = 0; ACPI_FUNCTION_TRACE("acpi_init"); - printk(KERN_INFO PREFIX "Subsystem revision %08x\n", - ACPI_CA_VERSION); + printk(KERN_INFO PREFIX "Subsystem revision %08x\n", ACPI_CA_VERSION); if (acpi_disabled) { printk(KERN_INFO PREFIX "Interpreter disabled.\n"); @@ -767,7 +758,8 @@ static int __init acpi_init (void) if (!PM_IS_ACTIVE()) pm_active = 1; else { - printk(KERN_INFO PREFIX "APM is already active, exiting\n"); + printk(KERN_INFO PREFIX + "APM is already active, exiting\n"); disable_acpi(); result = -ENODEV; } diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c index 8162fd0c21a..4b6d9f0096a 100644 --- a/drivers/acpi/button.c +++ b/drivers/acpi/button.c @@ -32,7 +32,6 @@ #include #include - #define ACPI_BUTTON_COMPONENT 0x00080000 #define ACPI_BUTTON_DRIVER_NAME "ACPI Button Driver" #define ACPI_BUTTON_CLASS "button" @@ -42,7 +41,7 @@ #define ACPI_BUTTON_NOTIFY_STATUS 0x80 #define ACPI_BUTTON_SUBCLASS_POWER "power" -#define ACPI_BUTTON_HID_POWER "PNP0C0C" +#define ACPI_BUTTON_HID_POWER "PNP0C0C" #define ACPI_BUTTON_DEVICE_NAME_POWER "Power Button (CM)" #define ACPI_BUTTON_DEVICE_NAME_POWERF "Power Button (FF)" #define ACPI_BUTTON_TYPE_POWER 0x01 @@ -61,65 +60,65 @@ #define ACPI_BUTTON_TYPE_LID 0x05 #define _COMPONENT ACPI_BUTTON_COMPONENT -ACPI_MODULE_NAME ("acpi_button") +ACPI_MODULE_NAME("acpi_button") -MODULE_AUTHOR("Paul Diefenbaugh"); + MODULE_AUTHOR("Paul Diefenbaugh"); MODULE_DESCRIPTION(ACPI_BUTTON_DRIVER_NAME); MODULE_LICENSE("GPL"); - -static int acpi_button_add (struct acpi_device *device); -static int acpi_button_remove (struct acpi_device *device, int type); +static int acpi_button_add(struct acpi_device *device); +static int acpi_button_remove(struct acpi_device *device, int type); static int acpi_button_info_open_fs(struct inode *inode, struct file *file); static int acpi_button_state_open_fs(struct inode *inode, struct file *file); static struct acpi_driver acpi_button_driver = { - .name = ACPI_BUTTON_DRIVER_NAME, - .class = ACPI_BUTTON_CLASS, - .ids = "ACPI_FPB,ACPI_FSB,PNP0C0D,PNP0C0C,PNP0C0E", - .ops = { - .add = acpi_button_add, - .remove = acpi_button_remove, - }, + .name = ACPI_BUTTON_DRIVER_NAME, + .class = ACPI_BUTTON_CLASS, + .ids = "ACPI_FPB,ACPI_FSB,PNP0C0D,PNP0C0C,PNP0C0E", + .ops = { + .add = acpi_button_add, + .remove = acpi_button_remove, + }, }; struct acpi_button { - acpi_handle handle; - struct acpi_device *device; /* Fixed button kludge */ - u8 type; - unsigned long pushed; + acpi_handle handle; + struct acpi_device *device; /* Fixed button kludge */ + u8 type; + unsigned long pushed; }; static struct file_operations acpi_button_info_fops = { - .open = acpi_button_info_open_fs, - .read = seq_read, - .llseek = seq_lseek, - .release = single_release, + .open = acpi_button_info_open_fs, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, }; static struct file_operations acpi_button_state_fops = { - .open = acpi_button_state_open_fs, - .read = seq_read, - .llseek = seq_lseek, - .release = single_release, + .open = acpi_button_state_open_fs, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, }; + /* -------------------------------------------------------------------------- FS Interface (/proc) -------------------------------------------------------------------------- */ -static struct proc_dir_entry *acpi_button_dir; +static struct proc_dir_entry *acpi_button_dir; static int acpi_button_info_seq_show(struct seq_file *seq, void *offset) { - struct acpi_button *button = (struct acpi_button *) seq->private; + struct acpi_button *button = (struct acpi_button *)seq->private; ACPI_FUNCTION_TRACE("acpi_button_info_seq_show"); if (!button || !button->device) return_VALUE(0); - seq_printf(seq, "type: %s\n", - acpi_device_name(button->device)); + seq_printf(seq, "type: %s\n", + acpi_device_name(button->device)); return_VALUE(0); } @@ -128,24 +127,24 @@ static int acpi_button_info_open_fs(struct inode *inode, struct file *file) { return single_open(file, acpi_button_info_seq_show, PDE(inode)->data); } - + static int acpi_button_state_seq_show(struct seq_file *seq, void *offset) { - struct acpi_button *button = (struct acpi_button *) seq->private; - acpi_status status; - unsigned long state; + struct acpi_button *button = (struct acpi_button *)seq->private; + acpi_status status; + unsigned long state; ACPI_FUNCTION_TRACE("acpi_button_state_seq_show"); if (!button || !button->device) return_VALUE(0); - status = acpi_evaluate_integer(button->handle,"_LID",NULL,&state); + status = acpi_evaluate_integer(button->handle, "_LID", NULL, &state); if (ACPI_FAILURE(status)) { seq_printf(seq, "state: unsupported\n"); - } - else{ - seq_printf(seq, "state: %s\n", (state ? "open" : "closed")); + } else { + seq_printf(seq, "state: %s\n", + (state ? "open" : "closed")); } return_VALUE(0); @@ -160,12 +159,10 @@ static struct proc_dir_entry *acpi_power_dir; static struct proc_dir_entry *acpi_sleep_dir; static struct proc_dir_entry *acpi_lid_dir; -static int -acpi_button_add_fs ( - struct acpi_device *device) +static int acpi_button_add_fs(struct acpi_device *device) { - struct proc_dir_entry *entry = NULL; - struct acpi_button *button = NULL; + struct proc_dir_entry *entry = NULL; + struct acpi_button *button = NULL; ACPI_FUNCTION_TRACE("acpi_button_add_fs"); @@ -178,21 +175,21 @@ acpi_button_add_fs ( case ACPI_BUTTON_TYPE_POWER: case ACPI_BUTTON_TYPE_POWERF: if (!acpi_power_dir) - acpi_power_dir = proc_mkdir(ACPI_BUTTON_SUBCLASS_POWER, - acpi_button_dir); + acpi_power_dir = proc_mkdir(ACPI_BUTTON_SUBCLASS_POWER, + acpi_button_dir); entry = acpi_power_dir; break; case ACPI_BUTTON_TYPE_SLEEP: case ACPI_BUTTON_TYPE_SLEEPF: if (!acpi_sleep_dir) - acpi_sleep_dir = proc_mkdir(ACPI_BUTTON_SUBCLASS_SLEEP, - acpi_button_dir); + acpi_sleep_dir = proc_mkdir(ACPI_BUTTON_SUBCLASS_SLEEP, + acpi_button_dir); entry = acpi_sleep_dir; break; case ACPI_BUTTON_TYPE_LID: if (!acpi_lid_dir) - acpi_lid_dir = proc_mkdir(ACPI_BUTTON_SUBCLASS_LID, - acpi_button_dir); + acpi_lid_dir = proc_mkdir(ACPI_BUTTON_SUBCLASS_LID, + acpi_button_dir); entry = acpi_lid_dir; break; } @@ -208,11 +205,11 @@ acpi_button_add_fs ( /* 'info' [R] */ entry = create_proc_entry(ACPI_BUTTON_FILE_INFO, - S_IRUGO, acpi_device_dir(device)); + S_IRUGO, acpi_device_dir(device)); if (!entry) ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create '%s' fs entry\n", - ACPI_BUTTON_FILE_INFO)); + "Unable to create '%s' fs entry\n", + ACPI_BUTTON_FILE_INFO)); else { entry->proc_fops = &acpi_button_info_fops; entry->data = acpi_driver_data(device); @@ -222,11 +219,11 @@ acpi_button_add_fs ( /* show lid state [R] */ if (button->type == ACPI_BUTTON_TYPE_LID) { entry = create_proc_entry(ACPI_BUTTON_FILE_STATE, - S_IRUGO, acpi_device_dir(device)); + S_IRUGO, acpi_device_dir(device)); if (!entry) ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create '%s' fs entry\n", - ACPI_BUTTON_FILE_INFO)); + "Unable to create '%s' fs entry\n", + ACPI_BUTTON_FILE_INFO)); else { entry->proc_fops = &acpi_button_state_fops; entry->data = acpi_driver_data(device); @@ -237,12 +234,9 @@ acpi_button_add_fs ( return_VALUE(0); } - -static int -acpi_button_remove_fs ( - struct acpi_device *device) +static int acpi_button_remove_fs(struct acpi_device *device) { - struct acpi_button *button = NULL; + struct acpi_button *button = NULL; ACPI_FUNCTION_TRACE("acpi_button_remove_fs"); @@ -250,30 +244,25 @@ acpi_button_remove_fs ( if (acpi_device_dir(device)) { if (button->type == ACPI_BUTTON_TYPE_LID) remove_proc_entry(ACPI_BUTTON_FILE_STATE, - acpi_device_dir(device)); + acpi_device_dir(device)); remove_proc_entry(ACPI_BUTTON_FILE_INFO, - acpi_device_dir(device)); + acpi_device_dir(device)); remove_proc_entry(acpi_device_bid(device), - acpi_device_dir(device)->parent); + acpi_device_dir(device)->parent); acpi_device_dir(device) = NULL; } return_VALUE(0); } - /* -------------------------------------------------------------------------- Driver Interface -------------------------------------------------------------------------- */ -static void -acpi_button_notify ( - acpi_handle handle, - u32 event, - void *data) +static void acpi_button_notify(acpi_handle handle, u32 event, void *data) { - struct acpi_button *button = (struct acpi_button *) data; + struct acpi_button *button = (struct acpi_button *)data; ACPI_FUNCTION_TRACE("acpi_button_notify"); @@ -282,24 +271,22 @@ acpi_button_notify ( switch (event) { case ACPI_BUTTON_NOTIFY_STATUS: - acpi_bus_generate_event(button->device, event, ++button->pushed); + acpi_bus_generate_event(button->device, event, + ++button->pushed); break; default: ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "Unsupported event [0x%x]\n", event)); + "Unsupported event [0x%x]\n", event)); break; } return_VOID; } - -static acpi_status -acpi_button_notify_fixed ( - void *data) +static acpi_status acpi_button_notify_fixed(void *data) { - struct acpi_button *button = (struct acpi_button *) data; - + struct acpi_button *button = (struct acpi_button *)data; + ACPI_FUNCTION_TRACE("acpi_button_notify_fixed"); if (!button) @@ -310,14 +297,11 @@ acpi_button_notify_fixed ( return_ACPI_STATUS(AE_OK); } - -static int -acpi_button_add ( - struct acpi_device *device) +static int acpi_button_add(struct acpi_device *device) { - int result = 0; - acpi_status status = AE_OK; - struct acpi_button *button = NULL; + int result = 0; + acpi_status status = AE_OK; + struct acpi_button *button = NULL; ACPI_FUNCTION_TRACE("acpi_button_add"); @@ -339,42 +323,34 @@ acpi_button_add ( */ if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_POWER)) { button->type = ACPI_BUTTON_TYPE_POWER; - strcpy(acpi_device_name(device), - ACPI_BUTTON_DEVICE_NAME_POWER); - sprintf(acpi_device_class(device), "%s/%s", + strcpy(acpi_device_name(device), ACPI_BUTTON_DEVICE_NAME_POWER); + sprintf(acpi_device_class(device), "%s/%s", ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_POWER); - } - else if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_POWERF)) { + } else if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_POWERF)) { button->type = ACPI_BUTTON_TYPE_POWERF; strcpy(acpi_device_name(device), - ACPI_BUTTON_DEVICE_NAME_POWERF); - sprintf(acpi_device_class(device), "%s/%s", + ACPI_BUTTON_DEVICE_NAME_POWERF); + sprintf(acpi_device_class(device), "%s/%s", ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_POWER); - } - else if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_SLEEP)) { + } else if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_SLEEP)) { button->type = ACPI_BUTTON_TYPE_SLEEP; - strcpy(acpi_device_name(device), - ACPI_BUTTON_DEVICE_NAME_SLEEP); - sprintf(acpi_device_class(device), "%s/%s", + strcpy(acpi_device_name(device), ACPI_BUTTON_DEVICE_NAME_SLEEP); + sprintf(acpi_device_class(device), "%s/%s", ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_SLEEP); - } - else if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_SLEEPF)) { + } else if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_SLEEPF)) { button->type = ACPI_BUTTON_TYPE_SLEEPF; strcpy(acpi_device_name(device), - ACPI_BUTTON_DEVICE_NAME_SLEEPF); - sprintf(acpi_device_class(device), "%s/%s", + ACPI_BUTTON_DEVICE_NAME_SLEEPF); + sprintf(acpi_device_class(device), "%s/%s", ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_SLEEP); - } - else if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_LID)) { + } else if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_LID)) { button->type = ACPI_BUTTON_TYPE_LID; - strcpy(acpi_device_name(device), - ACPI_BUTTON_DEVICE_NAME_LID); - sprintf(acpi_device_class(device), "%s/%s", + strcpy(acpi_device_name(device), ACPI_BUTTON_DEVICE_NAME_LID); + sprintf(acpi_device_class(device), "%s/%s", ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_LID); - } - else { + } else { ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unsupported hid [%s]\n", - acpi_device_hid(device))); + acpi_device_hid(device))); result = -ENODEV; goto end; } @@ -385,46 +361,46 @@ acpi_button_add ( switch (button->type) { case ACPI_BUTTON_TYPE_POWERF: - status = acpi_install_fixed_event_handler ( - ACPI_EVENT_POWER_BUTTON, - acpi_button_notify_fixed, - button); + status = + acpi_install_fixed_event_handler(ACPI_EVENT_POWER_BUTTON, + acpi_button_notify_fixed, + button); break; case ACPI_BUTTON_TYPE_SLEEPF: - status = acpi_install_fixed_event_handler ( - ACPI_EVENT_SLEEP_BUTTON, - acpi_button_notify_fixed, - button); + status = + acpi_install_fixed_event_handler(ACPI_EVENT_SLEEP_BUTTON, + acpi_button_notify_fixed, + button); break; default: - status = acpi_install_notify_handler ( - button->handle, - ACPI_DEVICE_NOTIFY, - acpi_button_notify, - button); + status = acpi_install_notify_handler(button->handle, + ACPI_DEVICE_NOTIFY, + acpi_button_notify, + button); break; } if (ACPI_FAILURE(status)) { ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error installing notify handler\n")); + "Error installing notify handler\n")); result = -ENODEV; goto end; } if (device->wakeup.flags.valid) { /* Button's GPE is run-wake GPE */ - acpi_set_gpe_type(device->wakeup.gpe_device, - device->wakeup.gpe_number, ACPI_GPE_TYPE_WAKE_RUN); - acpi_enable_gpe(device->wakeup.gpe_device, - device->wakeup.gpe_number, ACPI_NOT_ISR); + acpi_set_gpe_type(device->wakeup.gpe_device, + device->wakeup.gpe_number, + ACPI_GPE_TYPE_WAKE_RUN); + acpi_enable_gpe(device->wakeup.gpe_device, + device->wakeup.gpe_number, ACPI_NOT_ISR); device->wakeup.state.enabled = 1; } - printk(KERN_INFO PREFIX "%s [%s]\n", - acpi_device_name(device), acpi_device_bid(device)); + printk(KERN_INFO PREFIX "%s [%s]\n", + acpi_device_name(device), acpi_device_bid(device)); -end: + end: if (result) { acpi_button_remove_fs(device); kfree(button); @@ -433,12 +409,10 @@ end: return_VALUE(result); } - -static int -acpi_button_remove (struct acpi_device *device, int type) +static int acpi_button_remove(struct acpi_device *device, int type) { - acpi_status status = 0; - struct acpi_button *button = NULL; + acpi_status status = 0; + struct acpi_button *button = NULL; ACPI_FUNCTION_TRACE("acpi_button_remove"); @@ -450,35 +424,36 @@ acpi_button_remove (struct acpi_device *device, int type) /* Unregister for device notifications. */ switch (button->type) { case ACPI_BUTTON_TYPE_POWERF: - status = acpi_remove_fixed_event_handler( - ACPI_EVENT_POWER_BUTTON, acpi_button_notify_fixed); + status = + acpi_remove_fixed_event_handler(ACPI_EVENT_POWER_BUTTON, + acpi_button_notify_fixed); break; case ACPI_BUTTON_TYPE_SLEEPF: - status = acpi_remove_fixed_event_handler( - ACPI_EVENT_SLEEP_BUTTON, acpi_button_notify_fixed); + status = + acpi_remove_fixed_event_handler(ACPI_EVENT_SLEEP_BUTTON, + acpi_button_notify_fixed); break; default: status = acpi_remove_notify_handler(button->handle, - ACPI_DEVICE_NOTIFY, acpi_button_notify); + ACPI_DEVICE_NOTIFY, + acpi_button_notify); break; } if (ACPI_FAILURE(status)) ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error removing notify handler\n")); + "Error removing notify handler\n")); - acpi_button_remove_fs(device); + acpi_button_remove_fs(device); kfree(button); return_VALUE(0); } - -static int __init -acpi_button_init (void) +static int __init acpi_button_init(void) { - int result = 0; + int result = 0; ACPI_FUNCTION_TRACE("acpi_button_init"); @@ -495,15 +470,13 @@ acpi_button_init (void) return_VALUE(0); } - -static void __exit -acpi_button_exit (void) +static void __exit acpi_button_exit(void) { ACPI_FUNCTION_TRACE("acpi_button_exit"); acpi_bus_unregister_driver(&acpi_button_driver); - if (acpi_power_dir) + if (acpi_power_dir) remove_proc_entry(ACPI_BUTTON_SUBCLASS_POWER, acpi_button_dir); if (acpi_sleep_dir) remove_proc_entry(ACPI_BUTTON_SUBCLASS_SLEEP, acpi_button_dir); @@ -514,6 +487,5 @@ acpi_button_exit (void) return_VOID; } - module_init(acpi_button_init); module_exit(acpi_button_exit); diff --git a/drivers/acpi/container.c b/drivers/acpi/container.c index 97013ddfa20..10dd695a1dd 100644 --- a/drivers/acpi/container.c +++ b/drivers/acpi/container.c @@ -44,9 +44,9 @@ #define ACPI_CONTAINER_COMPONENT 0x01000000 #define _COMPONENT ACPI_CONTAINER_COMPONENT -ACPI_MODULE_NAME ("acpi_container") +ACPI_MODULE_NAME("acpi_container") -MODULE_AUTHOR("Anil S Keshavamurthy"); + MODULE_AUTHOR("Anil S Keshavamurthy"); MODULE_DESCRIPTION(ACPI_CONTAINER_DRIVER_NAME); MODULE_LICENSE("GPL"); @@ -56,41 +56,38 @@ static int acpi_container_add(struct acpi_device *device); static int acpi_container_remove(struct acpi_device *device, int type); static struct acpi_driver acpi_container_driver = { - .name = ACPI_CONTAINER_DRIVER_NAME, - .class = ACPI_CONTAINER_CLASS, - .ids = "ACPI0004,PNP0A05,PNP0A06", - .ops = { - .add = acpi_container_add, - .remove = acpi_container_remove, - }, + .name = ACPI_CONTAINER_DRIVER_NAME, + .class = ACPI_CONTAINER_CLASS, + .ids = "ACPI0004,PNP0A05,PNP0A06", + .ops = { + .add = acpi_container_add, + .remove = acpi_container_remove, + }, }; - /*******************************************************************/ -static int -is_device_present(acpi_handle handle) +static int is_device_present(acpi_handle handle) { - acpi_handle temp; - acpi_status status; - unsigned long sta; + acpi_handle temp; + acpi_status status; + unsigned long sta; ACPI_FUNCTION_TRACE("is_device_present"); status = acpi_get_handle(handle, "_STA", &temp); if (ACPI_FAILURE(status)) - return_VALUE(1); /* _STA not found, assmue device present */ + return_VALUE(1); /* _STA not found, assmue device present */ status = acpi_evaluate_integer(handle, "_STA", NULL, &sta); if (ACPI_FAILURE(status)) - return_VALUE(0); /* Firmware error */ + return_VALUE(0); /* Firmware error */ return_VALUE((sta & ACPI_STA_PRESENT) == ACPI_STA_PRESENT); } /*******************************************************************/ -static int -acpi_container_add(struct acpi_device *device) +static int acpi_container_add(struct acpi_device *device) { struct acpi_container *container; @@ -102,28 +99,26 @@ acpi_container_add(struct acpi_device *device) } container = kmalloc(sizeof(struct acpi_container), GFP_KERNEL); - if(!container) + if (!container) return_VALUE(-ENOMEM); - + memset(container, 0, sizeof(struct acpi_container)); container->handle = device->handle; strcpy(acpi_device_name(device), ACPI_CONTAINER_DEVICE_NAME); strcpy(acpi_device_class(device), ACPI_CONTAINER_CLASS); acpi_driver_data(device) = container; - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device <%s> bid <%s>\n", \ - acpi_device_name(device), acpi_device_bid(device))); - + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device <%s> bid <%s>\n", + acpi_device_name(device), acpi_device_bid(device))); return_VALUE(0); } -static int -acpi_container_remove(struct acpi_device *device, int type) +static int acpi_container_remove(struct acpi_device *device, int type) { - acpi_status status = AE_OK; - struct acpi_container *pc = NULL; - pc = (struct acpi_container*) acpi_driver_data(device); + acpi_status status = AE_OK; + struct acpi_container *pc = NULL; + pc = (struct acpi_container *)acpi_driver_data(device); if (pc) kfree(pc); @@ -131,9 +126,7 @@ acpi_container_remove(struct acpi_device *device, int type) return status; } - -static int -container_device_add(struct acpi_device **device, acpi_handle handle) +static int container_device_add(struct acpi_device **device, acpi_handle handle) { acpi_handle phandle; struct acpi_device *pdev; @@ -158,10 +151,9 @@ container_device_add(struct acpi_device **device, acpi_handle handle) return_VALUE(result); } -static void -container_notify_cb(acpi_handle handle, u32 type, void *context) +static void container_notify_cb(acpi_handle handle, u32 type, void *context) { - struct acpi_device *device = NULL; + struct acpi_device *device = NULL; int result; int present; acpi_status status; @@ -169,14 +161,14 @@ container_notify_cb(acpi_handle handle, u32 type, void *context) ACPI_FUNCTION_TRACE("container_notify_cb"); present = is_device_present(handle); - + switch (type) { case ACPI_NOTIFY_BUS_CHECK: /* Fall through */ case ACPI_NOTIFY_DEVICE_CHECK: printk("Container driver received %s event\n", - (type == ACPI_NOTIFY_BUS_CHECK)? - "ACPI_NOTIFY_BUS_CHECK":"ACPI_NOTIFY_DEVICE_CHECK"); + (type == ACPI_NOTIFY_BUS_CHECK) ? + "ACPI_NOTIFY_BUS_CHECK" : "ACPI_NOTIFY_DEVICE_CHECK"); status = acpi_bus_get_device(handle, &device); if (present) { if (ACPI_FAILURE(status) || !device) { @@ -207,15 +199,13 @@ container_notify_cb(acpi_handle handle, u32 type, void *context) static acpi_status container_walk_namespace_cb(acpi_handle handle, - u32 lvl, - void *context, - void **rv) + u32 lvl, void *context, void **rv) { - char *hid = NULL; - struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL}; - struct acpi_device_info *info; - acpi_status status; - int *action = context; + char *hid = NULL; + struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; + struct acpi_device_info *info; + acpi_status status; + int *action = context; ACPI_FUNCTION_TRACE("container_walk_namespace_cb"); @@ -233,66 +223,60 @@ container_walk_namespace_cb(acpi_handle handle, } if (strcmp(hid, "ACPI0004") && strcmp(hid, "PNP0A05") && - strcmp(hid, "PNP0A06")) { + strcmp(hid, "PNP0A06")) { goto end; } - switch(*action) { + switch (*action) { case INSTALL_NOTIFY_HANDLER: acpi_install_notify_handler(handle, - ACPI_SYSTEM_NOTIFY, - container_notify_cb, - NULL); + ACPI_SYSTEM_NOTIFY, + container_notify_cb, NULL); break; case UNINSTALL_NOTIFY_HANDLER: acpi_remove_notify_handler(handle, - ACPI_SYSTEM_NOTIFY, - container_notify_cb); + ACPI_SYSTEM_NOTIFY, + container_notify_cb); break; default: break; } -end: + end: acpi_os_free(buffer.pointer); return_ACPI_STATUS(AE_OK); } - -static int __init -acpi_container_init(void) +static int __init acpi_container_init(void) { - int result = 0; - int action = INSTALL_NOTIFY_HANDLER; + int result = 0; + int action = INSTALL_NOTIFY_HANDLER; result = acpi_bus_register_driver(&acpi_container_driver); if (result < 0) { - return(result); + return (result); } /* register notify handler to every container device */ acpi_walk_namespace(ACPI_TYPE_DEVICE, - ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, - container_walk_namespace_cb, - &action, NULL); + ACPI_ROOT_OBJECT, + ACPI_UINT32_MAX, + container_walk_namespace_cb, &action, NULL); - return(0); + return (0); } -static void __exit -acpi_container_exit(void) +static void __exit acpi_container_exit(void) { - int action = UNINSTALL_NOTIFY_HANDLER; + int action = UNINSTALL_NOTIFY_HANDLER; ACPI_FUNCTION_TRACE("acpi_container_exit"); acpi_walk_namespace(ACPI_TYPE_DEVICE, - ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, - container_walk_namespace_cb, - &action, NULL); + ACPI_ROOT_OBJECT, + ACPI_UINT32_MAX, + container_walk_namespace_cb, &action, NULL); acpi_bus_unregister_driver(&acpi_container_driver); diff --git a/drivers/acpi/debug.c b/drivers/acpi/debug.c index 2c0dac559f1..263322b7d11 100644 --- a/drivers/acpi/debug.c +++ b/drivers/acpi/debug.c @@ -12,17 +12,14 @@ #include #define _COMPONENT ACPI_SYSTEM_COMPONENT -ACPI_MODULE_NAME ("debug") - +ACPI_MODULE_NAME("debug") #define ACPI_SYSTEM_FILE_DEBUG_LAYER "debug_layer" #define ACPI_SYSTEM_FILE_DEBUG_LEVEL "debug_level" - #ifdef MODULE_PARAM_PREFIX #undef MODULE_PARAM_PREFIX #endif - #define MODULE_PARAM_PREFIX -module_param(acpi_dbg_layer, uint, 0400); + module_param(acpi_dbg_layer, uint, 0400); module_param(acpi_dbg_level, uint, 0400); struct acpi_dlayer { @@ -35,8 +32,7 @@ struct acpi_dlevel { }; #define ACPI_DEBUG_INIT(v) { .name = #v, .value = v } -static const struct acpi_dlayer acpi_debug_layers[] = -{ +static const struct acpi_dlayer acpi_debug_layers[] = { ACPI_DEBUG_INIT(ACPI_UTILITIES), ACPI_DEBUG_INIT(ACPI_HARDWARE), ACPI_DEBUG_INIT(ACPI_EVENTS), @@ -53,8 +49,7 @@ static const struct acpi_dlayer acpi_debug_layers[] = ACPI_DEBUG_INIT(ACPI_TOOLS), }; -static const struct acpi_dlevel acpi_debug_levels[] = -{ +static const struct acpi_dlevel acpi_debug_levels[] = { ACPI_DEBUG_INIT(ACPI_LV_ERROR), ACPI_DEBUG_INIT(ACPI_LV_WARN), ACPI_DEBUG_INIT(ACPI_LV_INIT), @@ -88,81 +83,77 @@ static const struct acpi_dlevel acpi_debug_levels[] = ACPI_DEBUG_INIT(ACPI_LV_AML_DISASSEMBLE), ACPI_DEBUG_INIT(ACPI_LV_VERBOSE_INFO), ACPI_DEBUG_INIT(ACPI_LV_FULL_TABLES), - ACPI_DEBUG_INIT(ACPI_LV_EVENTS), + ACPI_DEBUG_INIT(ACPI_LV_EVENTS), }; static int -acpi_system_read_debug ( - char *page, - char **start, - off_t off, - int count, - int *eof, - void *data) +acpi_system_read_debug(char *page, + char **start, off_t off, int count, int *eof, void *data) { - char *p = page; - int size = 0; - unsigned int i; + char *p = page; + int size = 0; + unsigned int i; if (off != 0) goto end; p += sprintf(p, "%-25s\tHex SET\n", "Description"); - switch ((unsigned long) data) { + switch ((unsigned long)data) { case 0: for (i = 0; i < ARRAY_SIZE(acpi_debug_layers); i++) { p += sprintf(p, "%-25s\t0x%08lX [%c]\n", - acpi_debug_layers[i].name, - acpi_debug_layers[i].value, - (acpi_dbg_layer & acpi_debug_layers[i].value) ? - '*' : ' '); + acpi_debug_layers[i].name, + acpi_debug_layers[i].value, + (acpi_dbg_layer & acpi_debug_layers[i]. + value) ? '*' : ' '); } p += sprintf(p, "%-25s\t0x%08X [%c]\n", "ACPI_ALL_DRIVERS", - ACPI_ALL_DRIVERS, - (acpi_dbg_layer & ACPI_ALL_DRIVERS) == ACPI_ALL_DRIVERS? - '*' : (acpi_dbg_layer & ACPI_ALL_DRIVERS) == 0 ? - ' ' : '-'); + ACPI_ALL_DRIVERS, + (acpi_dbg_layer & ACPI_ALL_DRIVERS) == + ACPI_ALL_DRIVERS ? '*' : (acpi_dbg_layer & + ACPI_ALL_DRIVERS) == + 0 ? ' ' : '-'); p += sprintf(p, - "--\ndebug_layer = 0x%08X (* = enabled, - = partial)\n", - acpi_dbg_layer); + "--\ndebug_layer = 0x%08X (* = enabled, - = partial)\n", + acpi_dbg_layer); break; case 1: for (i = 0; i < ARRAY_SIZE(acpi_debug_levels); i++) { p += sprintf(p, "%-25s\t0x%08lX [%c]\n", - acpi_debug_levels[i].name, - acpi_debug_levels[i].value, - (acpi_dbg_level & acpi_debug_levels[i].value) ? - '*' : ' '); + acpi_debug_levels[i].name, + acpi_debug_levels[i].value, + (acpi_dbg_level & acpi_debug_levels[i]. + value) ? '*' : ' '); } p += sprintf(p, "--\ndebug_level = 0x%08X (* = enabled)\n", - acpi_dbg_level); + acpi_dbg_level); break; default: p += sprintf(p, "Invalid debug option\n"); break; } - -end: + + end: size = (p - page); - if (size <= off+count) *eof = 1; + if (size <= off + count) + *eof = 1; *start = page + off; size -= off; - if (size>count) size = count; - if (size<0) size = 0; + if (size > count) + size = count; + if (size < 0) + size = 0; return size; } - static int -acpi_system_write_debug ( - struct file *file, - const char __user *buffer, - unsigned long count, - void *data) +acpi_system_write_debug(struct file *file, + const char __user * buffer, + unsigned long count, void *data) { - char debug_string[12] = {'\0'}; + char debug_string[12] = { '\0' }; ACPI_FUNCTION_TRACE("acpi_system_write_debug"); @@ -174,7 +165,7 @@ acpi_system_write_debug ( debug_string[count] = '\0'; - switch ((unsigned long) data) { + switch ((unsigned long)data) { case 0: acpi_dbg_layer = simple_strtoul(debug_string, NULL, 0); break; @@ -190,9 +181,9 @@ acpi_system_write_debug ( static int __init acpi_debug_init(void) { - struct proc_dir_entry *entry; + struct proc_dir_entry *entry; int error = 0; - char * name; + char *name; ACPI_FUNCTION_TRACE("acpi_debug_init"); @@ -201,8 +192,10 @@ static int __init acpi_debug_init(void) /* 'debug_layer' [R/W] */ name = ACPI_SYSTEM_FILE_DEBUG_LAYER; - entry = create_proc_read_entry(name, S_IFREG|S_IRUGO|S_IWUSR, acpi_root_dir, - acpi_system_read_debug,(void *)0); + entry = + create_proc_read_entry(name, S_IFREG | S_IRUGO | S_IWUSR, + acpi_root_dir, acpi_system_read_debug, + (void *)0); if (entry) entry->write_proc = acpi_system_write_debug; else @@ -210,19 +203,21 @@ static int __init acpi_debug_init(void) /* 'debug_level' [R/W] */ name = ACPI_SYSTEM_FILE_DEBUG_LEVEL; - entry = create_proc_read_entry(name, S_IFREG|S_IRUGO|S_IWUSR, acpi_root_dir, - acpi_system_read_debug, (void *)1); - if (entry) + entry = + create_proc_read_entry(name, S_IFREG | S_IRUGO | S_IWUSR, + acpi_root_dir, acpi_system_read_debug, + (void *)1); + if (entry) entry->write_proc = acpi_system_write_debug; else goto Error; - Done: + Done: return_VALUE(error); - Error: - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create '%s' proc fs entry\n", name)); + Error: + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Unable to create '%s' proc fs entry\n", name)); remove_proc_entry(ACPI_SYSTEM_FILE_DEBUG_LEVEL, acpi_root_dir); remove_proc_entry(ACPI_SYSTEM_FILE_DEBUG_LAYER, acpi_root_dir); diff --git a/drivers/acpi/dispatcher/dsfield.c b/drivers/acpi/dispatcher/dsfield.c index 84193983d6b..2022aeaecfb 100644 --- a/drivers/acpi/dispatcher/dsfield.c +++ b/drivers/acpi/dispatcher/dsfield.c @@ -41,7 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include #include #include @@ -49,18 +48,14 @@ #include #include - #define _COMPONENT ACPI_DISPATCHER - ACPI_MODULE_NAME ("dsfield") +ACPI_MODULE_NAME("dsfield") /* Local prototypes */ - static acpi_status -acpi_ds_get_field_names ( - struct acpi_create_field_info *info, - struct acpi_walk_state *walk_state, - union acpi_parse_object *arg); - +acpi_ds_get_field_names(struct acpi_create_field_info *info, + struct acpi_walk_state *walk_state, + union acpi_parse_object *arg); /******************************************************************************* * @@ -82,41 +77,36 @@ acpi_ds_get_field_names ( ******************************************************************************/ acpi_status -acpi_ds_create_buffer_field ( - union acpi_parse_object *op, - struct acpi_walk_state *walk_state) +acpi_ds_create_buffer_field(union acpi_parse_object *op, + struct acpi_walk_state *walk_state) { - union acpi_parse_object *arg; - struct acpi_namespace_node *node; - acpi_status status; - union acpi_operand_object *obj_desc; - union acpi_operand_object *second_desc = NULL; - u32 flags; - - - ACPI_FUNCTION_TRACE ("ds_create_buffer_field"); + union acpi_parse_object *arg; + struct acpi_namespace_node *node; + acpi_status status; + union acpi_operand_object *obj_desc; + union acpi_operand_object *second_desc = NULL; + u32 flags; + ACPI_FUNCTION_TRACE("ds_create_buffer_field"); /* Get the name_string argument */ if (op->common.aml_opcode == AML_CREATE_FIELD_OP) { - arg = acpi_ps_get_arg (op, 3); - } - else { + arg = acpi_ps_get_arg(op, 3); + } else { /* Create Bit/Byte/Word/Dword field */ - arg = acpi_ps_get_arg (op, 2); + arg = acpi_ps_get_arg(op, 2); } if (!arg) { - return_ACPI_STATUS (AE_AML_NO_OPERAND); + return_ACPI_STATUS(AE_AML_NO_OPERAND); } if (walk_state->deferred_node) { node = walk_state->deferred_node; status = AE_OK; - } - else { + } else { /* * During the load phase, we want to enter the name of the field into * the namespace. During the execute phase (when we evaluate the size @@ -124,21 +114,22 @@ acpi_ds_create_buffer_field ( */ if (walk_state->parse_flags & ACPI_PARSE_EXECUTE) { flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE; - } - else { + } else { flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE | - ACPI_NS_ERROR_IF_FOUND; + ACPI_NS_ERROR_IF_FOUND; } /* * Enter the name_string into the namespace */ - status = acpi_ns_lookup (walk_state->scope_info, arg->common.value.string, - ACPI_TYPE_ANY, ACPI_IMODE_LOAD_PASS1, - flags, walk_state, &(node)); - if (ACPI_FAILURE (status)) { - ACPI_REPORT_NSERROR (arg->common.value.string, status); - return_ACPI_STATUS (status); + status = + acpi_ns_lookup(walk_state->scope_info, + arg->common.value.string, ACPI_TYPE_ANY, + ACPI_IMODE_LOAD_PASS1, flags, walk_state, + &(node)); + if (ACPI_FAILURE(status)) { + ACPI_REPORT_NSERROR(arg->common.value.string, status); + return_ACPI_STATUS(status); } } @@ -153,9 +144,9 @@ acpi_ds_create_buffer_field ( * and we need to create the field object. Otherwise, this was a lookup * of an existing node and we don't want to create the field object again. */ - obj_desc = acpi_ns_get_attached_object (node); + obj_desc = acpi_ns_get_attached_object(node); if (obj_desc) { - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } /* @@ -165,7 +156,7 @@ acpi_ds_create_buffer_field ( /* Create the buffer field object */ - obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_BUFFER_FIELD); + obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_BUFFER_FIELD); if (!obj_desc) { status = AE_NO_MEMORY; goto cleanup; @@ -176,28 +167,26 @@ acpi_ds_create_buffer_field ( * opcode and operands -- since the buffer and index * operands must be evaluated. */ - second_desc = obj_desc->common.next_object; + second_desc = obj_desc->common.next_object; second_desc->extra.aml_start = op->named.data; second_desc->extra.aml_length = op->named.length; obj_desc->buffer_field.node = node; /* Attach constructed field descriptors to parent node */ - status = acpi_ns_attach_object (node, obj_desc, ACPI_TYPE_BUFFER_FIELD); - if (ACPI_FAILURE (status)) { + status = acpi_ns_attach_object(node, obj_desc, ACPI_TYPE_BUFFER_FIELD); + if (ACPI_FAILURE(status)) { goto cleanup; } - -cleanup: + cleanup: /* Remove local reference to the object */ - acpi_ut_remove_reference (obj_desc); - return_ACPI_STATUS (status); + acpi_ut_remove_reference(obj_desc); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_ds_get_field_names @@ -214,17 +203,14 @@ cleanup: ******************************************************************************/ static acpi_status -acpi_ds_get_field_names ( - struct acpi_create_field_info *info, - struct acpi_walk_state *walk_state, - union acpi_parse_object *arg) +acpi_ds_get_field_names(struct acpi_create_field_info *info, + struct acpi_walk_state *walk_state, + union acpi_parse_object *arg) { - acpi_status status; - acpi_integer position; - - - ACPI_FUNCTION_TRACE_PTR ("ds_get_field_names", info); + acpi_status status; + acpi_integer position; + ACPI_FUNCTION_TRACE_PTR("ds_get_field_names", info); /* First field starts at bit zero */ @@ -243,18 +229,16 @@ acpi_ds_get_field_names ( case AML_INT_RESERVEDFIELD_OP: position = (acpi_integer) info->field_bit_position - + (acpi_integer) arg->common.value.size; + + (acpi_integer) arg->common.value.size; if (position > ACPI_UINT32_MAX) { - ACPI_REPORT_ERROR (( - "Bit offset within field too large (> 0xFFFFFFFF)\n")); - return_ACPI_STATUS (AE_SUPPORT); + ACPI_REPORT_ERROR(("Bit offset within field too large (> 0xFFFFFFFF)\n")); + return_ACPI_STATUS(AE_SUPPORT); } info->field_bit_position = (u32) position; break; - case AML_INT_ACCESSFIELD_OP: /* @@ -266,73 +250,70 @@ acpi_ds_get_field_names ( * ACCESS_TYPE bits */ info->field_flags = (u8) - ((info->field_flags & ~(AML_FIELD_ACCESS_TYPE_MASK)) | - ((u8) ((u32) arg->common.value.integer >> 8))); + ((info-> + field_flags & ~(AML_FIELD_ACCESS_TYPE_MASK)) | + ((u8) ((u32) arg->common.value.integer >> 8))); info->attribute = (u8) (arg->common.value.integer); break; - case AML_INT_NAMEDFIELD_OP: /* Lookup the name */ - status = acpi_ns_lookup (walk_state->scope_info, - (char *) &arg->named.name, - info->field_type, ACPI_IMODE_EXECUTE, - ACPI_NS_DONT_OPEN_SCOPE, - walk_state, &info->field_node); - if (ACPI_FAILURE (status)) { - ACPI_REPORT_NSERROR ((char *) &arg->named.name, status); + status = acpi_ns_lookup(walk_state->scope_info, + (char *)&arg->named.name, + info->field_type, + ACPI_IMODE_EXECUTE, + ACPI_NS_DONT_OPEN_SCOPE, + walk_state, &info->field_node); + if (ACPI_FAILURE(status)) { + ACPI_REPORT_NSERROR((char *)&arg->named.name, + status); if (status != AE_ALREADY_EXISTS) { - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } /* Already exists, ignore error */ - } - else { + } else { arg->common.node = info->field_node; info->field_bit_length = arg->common.value.size; /* Create and initialize an object for the new Field Node */ - status = acpi_ex_prep_field_value (info); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ex_prep_field_value(info); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } } /* Keep track of bit position for the next field */ position = (acpi_integer) info->field_bit_position - + (acpi_integer) arg->common.value.size; + + (acpi_integer) arg->common.value.size; if (position > ACPI_UINT32_MAX) { - ACPI_REPORT_ERROR (( - "Field [%4.4s] bit offset too large (> 0xFFFFFFFF)\n", - (char *) &info->field_node->name)); - return_ACPI_STATUS (AE_SUPPORT); + ACPI_REPORT_ERROR(("Field [%4.4s] bit offset too large (> 0xFFFFFFFF)\n", (char *)&info->field_node->name)); + return_ACPI_STATUS(AE_SUPPORT); } info->field_bit_position += info->field_bit_length; break; - default: - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Invalid opcode in field list: %X\n", - arg->common.aml_opcode)); - return_ACPI_STATUS (AE_AML_BAD_OPCODE); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Invalid opcode in field list: %X\n", + arg->common.aml_opcode)); + return_ACPI_STATUS(AE_AML_BAD_OPCODE); } arg = arg->common.next; } - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_ds_create_field @@ -348,29 +329,28 @@ acpi_ds_get_field_names ( ******************************************************************************/ acpi_status -acpi_ds_create_field ( - union acpi_parse_object *op, - struct acpi_namespace_node *region_node, - struct acpi_walk_state *walk_state) +acpi_ds_create_field(union acpi_parse_object *op, + struct acpi_namespace_node *region_node, + struct acpi_walk_state *walk_state) { - acpi_status status; - union acpi_parse_object *arg; - struct acpi_create_field_info info; - - - ACPI_FUNCTION_TRACE_PTR ("ds_create_field", op); + acpi_status status; + union acpi_parse_object *arg; + struct acpi_create_field_info info; + ACPI_FUNCTION_TRACE_PTR("ds_create_field", op); /* First arg is the name of the parent op_region (must already exist) */ arg = op->common.value.arg; if (!region_node) { - status = acpi_ns_lookup (walk_state->scope_info, arg->common.value.name, - ACPI_TYPE_REGION, ACPI_IMODE_EXECUTE, - ACPI_NS_SEARCH_PARENT, walk_state, ®ion_node); - if (ACPI_FAILURE (status)) { - ACPI_REPORT_NSERROR (arg->common.value.name, status); - return_ACPI_STATUS (status); + status = + acpi_ns_lookup(walk_state->scope_info, + arg->common.value.name, ACPI_TYPE_REGION, + ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, + walk_state, ®ion_node); + if (ACPI_FAILURE(status)) { + ACPI_REPORT_NSERROR(arg->common.value.name, status); + return_ACPI_STATUS(status); } } @@ -385,12 +365,11 @@ acpi_ds_create_field ( info.field_type = ACPI_TYPE_LOCAL_REGION_FIELD; info.region_node = region_node; - status = acpi_ds_get_field_names (&info, walk_state, arg->common.next); + status = acpi_ds_get_field_names(&info, walk_state, arg->common.next); - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_ds_init_field_objects @@ -407,37 +386,34 @@ acpi_ds_create_field ( ******************************************************************************/ acpi_status -acpi_ds_init_field_objects ( - union acpi_parse_object *op, - struct acpi_walk_state *walk_state) +acpi_ds_init_field_objects(union acpi_parse_object *op, + struct acpi_walk_state *walk_state) { - acpi_status status; - union acpi_parse_object *arg = NULL; - struct acpi_namespace_node *node; - u8 type = 0; - - - ACPI_FUNCTION_TRACE_PTR ("ds_init_field_objects", op); + acpi_status status; + union acpi_parse_object *arg = NULL; + struct acpi_namespace_node *node; + u8 type = 0; + ACPI_FUNCTION_TRACE_PTR("ds_init_field_objects", op); switch (walk_state->opcode) { case AML_FIELD_OP: - arg = acpi_ps_get_arg (op, 2); + arg = acpi_ps_get_arg(op, 2); type = ACPI_TYPE_LOCAL_REGION_FIELD; break; case AML_BANK_FIELD_OP: - arg = acpi_ps_get_arg (op, 4); + arg = acpi_ps_get_arg(op, 4); type = ACPI_TYPE_LOCAL_BANK_FIELD; break; case AML_INDEX_FIELD_OP: - arg = acpi_ps_get_arg (op, 3); + arg = acpi_ps_get_arg(op, 3); type = ACPI_TYPE_LOCAL_INDEX_FIELD; break; default: - return_ACPI_STATUS (AE_BAD_PARAMETER); + return_ACPI_STATUS(AE_BAD_PARAMETER); } /* @@ -447,16 +423,18 @@ acpi_ds_init_field_objects ( /* Ignore OFFSET and ACCESSAS terms here */ if (arg->common.aml_opcode == AML_INT_NAMEDFIELD_OP) { - status = acpi_ns_lookup (walk_state->scope_info, - (char *) &arg->named.name, - type, ACPI_IMODE_LOAD_PASS1, - ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE | - ACPI_NS_ERROR_IF_FOUND, - walk_state, &node); - if (ACPI_FAILURE (status)) { - ACPI_REPORT_NSERROR ((char *) &arg->named.name, status); + status = acpi_ns_lookup(walk_state->scope_info, + (char *)&arg->named.name, + type, ACPI_IMODE_LOAD_PASS1, + ACPI_NS_NO_UPSEARCH | + ACPI_NS_DONT_OPEN_SCOPE | + ACPI_NS_ERROR_IF_FOUND, + walk_state, &node); + if (ACPI_FAILURE(status)) { + ACPI_REPORT_NSERROR((char *)&arg->named.name, + status); if (status != AE_ALREADY_EXISTS) { - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } /* Name already exists, just ignore this error */ @@ -472,10 +450,9 @@ acpi_ds_init_field_objects ( arg = arg->common.next; } - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_ds_create_bank_field @@ -491,41 +468,42 @@ acpi_ds_init_field_objects ( ******************************************************************************/ acpi_status -acpi_ds_create_bank_field ( - union acpi_parse_object *op, - struct acpi_namespace_node *region_node, - struct acpi_walk_state *walk_state) +acpi_ds_create_bank_field(union acpi_parse_object *op, + struct acpi_namespace_node *region_node, + struct acpi_walk_state *walk_state) { - acpi_status status; - union acpi_parse_object *arg; - struct acpi_create_field_info info; - - - ACPI_FUNCTION_TRACE_PTR ("ds_create_bank_field", op); + acpi_status status; + union acpi_parse_object *arg; + struct acpi_create_field_info info; + ACPI_FUNCTION_TRACE_PTR("ds_create_bank_field", op); /* First arg is the name of the parent op_region (must already exist) */ arg = op->common.value.arg; if (!region_node) { - status = acpi_ns_lookup (walk_state->scope_info, arg->common.value.name, - ACPI_TYPE_REGION, ACPI_IMODE_EXECUTE, - ACPI_NS_SEARCH_PARENT, walk_state, ®ion_node); - if (ACPI_FAILURE (status)) { - ACPI_REPORT_NSERROR (arg->common.value.name, status); - return_ACPI_STATUS (status); + status = + acpi_ns_lookup(walk_state->scope_info, + arg->common.value.name, ACPI_TYPE_REGION, + ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, + walk_state, ®ion_node); + if (ACPI_FAILURE(status)) { + ACPI_REPORT_NSERROR(arg->common.value.name, status); + return_ACPI_STATUS(status); } } /* Second arg is the Bank Register (Field) (must already exist) */ arg = arg->common.next; - status = acpi_ns_lookup (walk_state->scope_info, arg->common.value.string, - ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, - ACPI_NS_SEARCH_PARENT, walk_state, &info.register_node); - if (ACPI_FAILURE (status)) { - ACPI_REPORT_NSERROR (arg->common.value.string, status); - return_ACPI_STATUS (status); + status = + acpi_ns_lookup(walk_state->scope_info, arg->common.value.string, + ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, + ACPI_NS_SEARCH_PARENT, walk_state, + &info.register_node); + if (ACPI_FAILURE(status)) { + ACPI_REPORT_NSERROR(arg->common.value.string, status); + return_ACPI_STATUS(status); } /* Third arg is the bank_value */ @@ -543,12 +521,11 @@ acpi_ds_create_bank_field ( info.field_type = ACPI_TYPE_LOCAL_BANK_FIELD; info.region_node = region_node; - status = acpi_ds_get_field_names (&info, walk_state, arg->common.next); + status = acpi_ds_get_field_names(&info, walk_state, arg->common.next); - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_ds_create_index_field @@ -564,39 +541,40 @@ acpi_ds_create_bank_field ( ******************************************************************************/ acpi_status -acpi_ds_create_index_field ( - union acpi_parse_object *op, - struct acpi_namespace_node *region_node, - struct acpi_walk_state *walk_state) +acpi_ds_create_index_field(union acpi_parse_object *op, + struct acpi_namespace_node *region_node, + struct acpi_walk_state *walk_state) { - acpi_status status; - union acpi_parse_object *arg; - struct acpi_create_field_info info; - - - ACPI_FUNCTION_TRACE_PTR ("ds_create_index_field", op); + acpi_status status; + union acpi_parse_object *arg; + struct acpi_create_field_info info; + ACPI_FUNCTION_TRACE_PTR("ds_create_index_field", op); /* First arg is the name of the Index register (must already exist) */ arg = op->common.value.arg; - status = acpi_ns_lookup (walk_state->scope_info, arg->common.value.string, - ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, - ACPI_NS_SEARCH_PARENT, walk_state, &info.register_node); - if (ACPI_FAILURE (status)) { - ACPI_REPORT_NSERROR (arg->common.value.string, status); - return_ACPI_STATUS (status); + status = + acpi_ns_lookup(walk_state->scope_info, arg->common.value.string, + ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, + ACPI_NS_SEARCH_PARENT, walk_state, + &info.register_node); + if (ACPI_FAILURE(status)) { + ACPI_REPORT_NSERROR(arg->common.value.string, status); + return_ACPI_STATUS(status); } /* Second arg is the data register (must already exist) */ arg = arg->common.next; - status = acpi_ns_lookup (walk_state->scope_info, arg->common.value.string, - ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, - ACPI_NS_SEARCH_PARENT, walk_state, &info.data_register_node); - if (ACPI_FAILURE (status)) { - ACPI_REPORT_NSERROR (arg->common.value.string, status); - return_ACPI_STATUS (status); + status = + acpi_ns_lookup(walk_state->scope_info, arg->common.value.string, + ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, + ACPI_NS_SEARCH_PARENT, walk_state, + &info.data_register_node); + if (ACPI_FAILURE(status)) { + ACPI_REPORT_NSERROR(arg->common.value.string, status); + return_ACPI_STATUS(status); } /* Next arg is the field flags */ @@ -609,9 +587,7 @@ acpi_ds_create_index_field ( info.field_type = ACPI_TYPE_LOCAL_INDEX_FIELD; info.region_node = region_node; - status = acpi_ds_get_field_names (&info, walk_state, arg->common.next); + status = acpi_ds_get_field_names(&info, walk_state, arg->common.next); - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - - diff --git a/drivers/acpi/dispatcher/dsinit.c b/drivers/acpi/dispatcher/dsinit.c index bcd1d472b90..8693c704aea 100644 --- a/drivers/acpi/dispatcher/dsinit.c +++ b/drivers/acpi/dispatcher/dsinit.c @@ -41,23 +41,17 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include #include #include #define _COMPONENT ACPI_DISPATCHER - ACPI_MODULE_NAME ("dsinit") +ACPI_MODULE_NAME("dsinit") /* Local prototypes */ - static acpi_status -acpi_ds_init_one_object ( - acpi_handle obj_handle, - u32 level, - void *context, - void **return_value); - +acpi_ds_init_one_object(acpi_handle obj_handle, + u32 level, void *context, void **return_value); /******************************************************************************* * @@ -80,20 +74,17 @@ acpi_ds_init_one_object ( ******************************************************************************/ static acpi_status -acpi_ds_init_one_object ( - acpi_handle obj_handle, - u32 level, - void *context, - void **return_value) +acpi_ds_init_one_object(acpi_handle obj_handle, + u32 level, void *context, void **return_value) { - struct acpi_init_walk_info *info = (struct acpi_init_walk_info *) context; - struct acpi_namespace_node *node = (struct acpi_namespace_node *) obj_handle; - acpi_object_type type; - acpi_status status; - - - ACPI_FUNCTION_NAME ("ds_init_one_object"); + struct acpi_init_walk_info *info = + (struct acpi_init_walk_info *)context; + struct acpi_namespace_node *node = + (struct acpi_namespace_node *)obj_handle; + acpi_object_type type; + acpi_status status; + ACPI_FUNCTION_NAME("ds_init_one_object"); /* * We are only interested in NS nodes owned by the table that @@ -107,23 +98,23 @@ acpi_ds_init_one_object ( /* And even then, we are only interested in a few object types */ - type = acpi_ns_get_type (obj_handle); + type = acpi_ns_get_type(obj_handle); switch (type) { case ACPI_TYPE_REGION: - status = acpi_ds_initialize_region (obj_handle); - if (ACPI_FAILURE (status)) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Region %p [%4.4s] - Init failure, %s\n", - obj_handle, acpi_ut_get_node_name (obj_handle), - acpi_format_exception (status))); + status = acpi_ds_initialize_region(obj_handle); + if (ACPI_FAILURE(status)) { + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Region %p [%4.4s] - Init failure, %s\n", + obj_handle, + acpi_ut_get_node_name(obj_handle), + acpi_format_exception(status))); } info->op_region_count++; break; - case ACPI_TYPE_METHOD: /* @@ -131,7 +122,7 @@ acpi_ds_init_one_object ( * the entire pathname */ if (!(acpi_dbg_level & ACPI_LV_INIT_NAMES)) { - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, ".")); + ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, ".")); } /* @@ -148,12 +139,13 @@ acpi_ds_init_one_object ( * Always parse methods to detect errors, we will delete * the parse tree below */ - status = acpi_ds_parse_method (obj_handle); - if (ACPI_FAILURE (status)) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "\n+Method %p [%4.4s] - parse failure, %s\n", - obj_handle, acpi_ut_get_node_name (obj_handle), - acpi_format_exception (status))); + status = acpi_ds_parse_method(obj_handle); + if (ACPI_FAILURE(status)) { + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "\n+Method %p [%4.4s] - parse failure, %s\n", + obj_handle, + acpi_ut_get_node_name(obj_handle), + acpi_format_exception(status))); /* This parse failed, but we will continue parsing more methods */ } @@ -161,13 +153,11 @@ acpi_ds_init_one_object ( info->method_count++; break; - case ACPI_TYPE_DEVICE: info->device_count++; break; - default: break; } @@ -179,7 +169,6 @@ acpi_ds_init_one_object ( return (AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_ds_initialize_objects @@ -195,45 +184,43 @@ acpi_ds_init_one_object ( ******************************************************************************/ acpi_status -acpi_ds_initialize_objects ( - struct acpi_table_desc *table_desc, - struct acpi_namespace_node *start_node) +acpi_ds_initialize_objects(struct acpi_table_desc * table_desc, + struct acpi_namespace_node * start_node) { - acpi_status status; - struct acpi_init_walk_info info; - + acpi_status status; + struct acpi_init_walk_info info; - ACPI_FUNCTION_TRACE ("ds_initialize_objects"); + ACPI_FUNCTION_TRACE("ds_initialize_objects"); + ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, + "**** Starting initialization of namespace objects ****\n")); + ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, "Parsing all Control Methods:")); - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "**** Starting initialization of namespace objects ****\n")); - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, "Parsing all Control Methods:")); - - info.method_count = 0; + info.method_count = 0; info.op_region_count = 0; - info.object_count = 0; - info.device_count = 0; - info.table_desc = table_desc; + info.object_count = 0; + info.device_count = 0; + info.table_desc = table_desc; /* Walk entire namespace from the supplied root */ - status = acpi_walk_namespace (ACPI_TYPE_ANY, start_node, ACPI_UINT32_MAX, - acpi_ds_init_one_object, &info, NULL); - if (ACPI_FAILURE (status)) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "walk_namespace failed, %s\n", - acpi_format_exception (status))); + status = acpi_walk_namespace(ACPI_TYPE_ANY, start_node, ACPI_UINT32_MAX, + acpi_ds_init_one_object, &info, NULL); + if (ACPI_FAILURE(status)) { + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "walk_namespace failed, %s\n", + acpi_format_exception(status))); } - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, - "\nTable [%4.4s](id %4.4X) - %hd Objects with %hd Devices %hd Methods %hd Regions\n", - table_desc->pointer->signature, table_desc->owner_id, info.object_count, - info.device_count, info.method_count, info.op_region_count)); + ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, + "\nTable [%4.4s](id %4.4X) - %hd Objects with %hd Devices %hd Methods %hd Regions\n", + table_desc->pointer->signature, + table_desc->owner_id, info.object_count, + info.device_count, info.method_count, + info.op_region_count)); - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "%hd Methods, %hd Regions\n", info.method_count, info.op_region_count)); + ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, + "%hd Methods, %hd Regions\n", info.method_count, + info.op_region_count)); - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - - diff --git a/drivers/acpi/dispatcher/dsmethod.c b/drivers/acpi/dispatcher/dsmethod.c index e344c06ed33..77fcfc3070d 100644 --- a/drivers/acpi/dispatcher/dsmethod.c +++ b/drivers/acpi/dispatcher/dsmethod.c @@ -41,7 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include #include #include @@ -49,10 +48,8 @@ #include #include - #define _COMPONENT ACPI_DISPATCHER - ACPI_MODULE_NAME ("dsmethod") - +ACPI_MODULE_NAME("dsmethod") /******************************************************************************* * @@ -67,45 +64,41 @@ * MUTEX: Assumes parser is locked * ******************************************************************************/ - -acpi_status -acpi_ds_parse_method ( - struct acpi_namespace_node *node) +acpi_status acpi_ds_parse_method(struct acpi_namespace_node *node) { - acpi_status status; - union acpi_operand_object *obj_desc; - union acpi_parse_object *op; - struct acpi_walk_state *walk_state; - - - ACPI_FUNCTION_TRACE_PTR ("ds_parse_method", node); + acpi_status status; + union acpi_operand_object *obj_desc; + union acpi_parse_object *op; + struct acpi_walk_state *walk_state; + ACPI_FUNCTION_TRACE_PTR("ds_parse_method", node); /* Parameter Validation */ if (!node) { - return_ACPI_STATUS (AE_NULL_ENTRY); + return_ACPI_STATUS(AE_NULL_ENTRY); } - ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "**** Parsing [%4.4s] **** named_obj=%p\n", - acpi_ut_get_node_name (node), node)); + ACPI_DEBUG_PRINT((ACPI_DB_PARSE, + "**** Parsing [%4.4s] **** named_obj=%p\n", + acpi_ut_get_node_name(node), node)); /* Extract the method object from the method Node */ - obj_desc = acpi_ns_get_attached_object (node); + obj_desc = acpi_ns_get_attached_object(node); if (!obj_desc) { - return_ACPI_STATUS (AE_NULL_OBJECT); + return_ACPI_STATUS(AE_NULL_OBJECT); } /* Create a mutex for the method if there is a concurrency limit */ if ((obj_desc->method.concurrency != ACPI_INFINITE_CONCURRENCY) && - (!obj_desc->method.semaphore)) { - status = acpi_os_create_semaphore (obj_desc->method.concurrency, - obj_desc->method.concurrency, - &obj_desc->method.semaphore); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + (!obj_desc->method.semaphore)) { + status = acpi_os_create_semaphore(obj_desc->method.concurrency, + obj_desc->method.concurrency, + &obj_desc->method.semaphore); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } } @@ -113,14 +106,14 @@ acpi_ds_parse_method ( * Allocate a new parser op to be the root of the parsed * method tree */ - op = acpi_ps_alloc_op (AML_METHOD_OP); + op = acpi_ps_alloc_op(AML_METHOD_OP); if (!op) { - return_ACPI_STATUS (AE_NO_MEMORY); + return_ACPI_STATUS(AE_NO_MEMORY); } /* Init new op with the method name and pointer back to the Node */ - acpi_ps_set_name (op, node->name.integer); + acpi_ps_set_name(op, node->name.integer); op->common.node = node; /* @@ -128,25 +121,26 @@ acpi_ds_parse_method ( * objects (such as Operation Regions) can be created during the * first pass parse. */ - status = acpi_ut_allocate_owner_id (&obj_desc->method.owner_id); - if (ACPI_FAILURE (status)) { + status = acpi_ut_allocate_owner_id(&obj_desc->method.owner_id); + if (ACPI_FAILURE(status)) { goto cleanup; } /* Create and initialize a new walk state */ - walk_state = acpi_ds_create_walk_state ( - obj_desc->method.owner_id, NULL, NULL, NULL); + walk_state = + acpi_ds_create_walk_state(obj_desc->method.owner_id, NULL, NULL, + NULL); if (!walk_state) { status = AE_NO_MEMORY; goto cleanup2; } - status = acpi_ds_init_aml_walk (walk_state, op, node, - obj_desc->method.aml_start, - obj_desc->method.aml_length, NULL, 1); - if (ACPI_FAILURE (status)) { - acpi_ds_delete_walk_state (walk_state); + status = acpi_ds_init_aml_walk(walk_state, op, node, + obj_desc->method.aml_start, + obj_desc->method.aml_length, NULL, 1); + if (ACPI_FAILURE(status)) { + acpi_ds_delete_walk_state(walk_state); goto cleanup2; } @@ -159,32 +153,31 @@ acpi_ds_parse_method ( * method so that operands to the named objects can take on dynamic * run-time values. */ - status = acpi_ps_parse_aml (walk_state); - if (ACPI_FAILURE (status)) { + status = acpi_ps_parse_aml(walk_state); + if (ACPI_FAILURE(status)) { goto cleanup2; } - ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, - "**** [%4.4s] Parsed **** named_obj=%p Op=%p\n", - acpi_ut_get_node_name (node), node, op)); + ACPI_DEBUG_PRINT((ACPI_DB_PARSE, + "**** [%4.4s] Parsed **** named_obj=%p Op=%p\n", + acpi_ut_get_node_name(node), node, op)); /* * Delete the parse tree. We simply re-parse the method for every * execution since there isn't much overhead (compared to keeping lots * of parse trees around) */ - acpi_ns_delete_namespace_subtree (node); - acpi_ns_delete_namespace_by_owner (obj_desc->method.owner_id); + acpi_ns_delete_namespace_subtree(node); + acpi_ns_delete_namespace_by_owner(obj_desc->method.owner_id); -cleanup2: - acpi_ut_release_owner_id (&obj_desc->method.owner_id); + cleanup2: + acpi_ut_release_owner_id(&obj_desc->method.owner_id); -cleanup: - acpi_ps_delete_parse_tree (op); - return_ACPI_STATUS (status); + cleanup: + acpi_ps_delete_parse_tree(op); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_ds_begin_method_execution @@ -202,19 +195,16 @@ cleanup: ******************************************************************************/ acpi_status -acpi_ds_begin_method_execution ( - struct acpi_namespace_node *method_node, - union acpi_operand_object *obj_desc, - struct acpi_namespace_node *calling_method_node) +acpi_ds_begin_method_execution(struct acpi_namespace_node *method_node, + union acpi_operand_object *obj_desc, + struct acpi_namespace_node *calling_method_node) { - acpi_status status = AE_OK; - - - ACPI_FUNCTION_TRACE_PTR ("ds_begin_method_execution", method_node); + acpi_status status = AE_OK; + ACPI_FUNCTION_TRACE_PTR("ds_begin_method_execution", method_node); if (!method_node) { - return_ACPI_STATUS (AE_NULL_ENTRY); + return_ACPI_STATUS(AE_NULL_ENTRY); } /* @@ -231,8 +221,9 @@ acpi_ds_begin_method_execution ( * thread that is making recursive method calls. */ if (method_node == calling_method_node) { - if (obj_desc->method.thread_count >= obj_desc->method.concurrency) { - return_ACPI_STATUS (AE_AML_METHOD_LIMIT); + if (obj_desc->method.thread_count >= + obj_desc->method.concurrency) { + return_ACPI_STATUS(AE_AML_METHOD_LIMIT); } } @@ -240,8 +231,9 @@ acpi_ds_begin_method_execution ( * Get a unit from the method semaphore. This releases the * interpreter if we block */ - status = acpi_ex_system_wait_semaphore (obj_desc->method.semaphore, - ACPI_WAIT_FOREVER); + status = + acpi_ex_system_wait_semaphore(obj_desc->method.semaphore, + ACPI_WAIT_FOREVER); } /* @@ -249,10 +241,9 @@ acpi_ds_begin_method_execution ( * reentered one more time (even if it is the same thread) */ obj_desc->method.thread_count++; - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_ds_call_control_method @@ -268,85 +259,86 @@ acpi_ds_begin_method_execution ( ******************************************************************************/ acpi_status -acpi_ds_call_control_method ( - struct acpi_thread_state *thread, - struct acpi_walk_state *this_walk_state, - union acpi_parse_object *op) +acpi_ds_call_control_method(struct acpi_thread_state *thread, + struct acpi_walk_state *this_walk_state, + union acpi_parse_object *op) { - acpi_status status; - struct acpi_namespace_node *method_node; - struct acpi_walk_state *next_walk_state = NULL; - union acpi_operand_object *obj_desc; - struct acpi_parameter_info info; - u32 i; - + acpi_status status; + struct acpi_namespace_node *method_node; + struct acpi_walk_state *next_walk_state = NULL; + union acpi_operand_object *obj_desc; + struct acpi_parameter_info info; + u32 i; - ACPI_FUNCTION_TRACE_PTR ("ds_call_control_method", this_walk_state); + ACPI_FUNCTION_TRACE_PTR("ds_call_control_method", this_walk_state); - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Execute method %p, currentstate=%p\n", - this_walk_state->prev_op, this_walk_state)); + ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, + "Execute method %p, currentstate=%p\n", + this_walk_state->prev_op, this_walk_state)); /* * Get the namespace entry for the control method we are about to call */ method_node = this_walk_state->method_call_node; if (!method_node) { - return_ACPI_STATUS (AE_NULL_ENTRY); + return_ACPI_STATUS(AE_NULL_ENTRY); } - obj_desc = acpi_ns_get_attached_object (method_node); + obj_desc = acpi_ns_get_attached_object(method_node); if (!obj_desc) { - return_ACPI_STATUS (AE_NULL_OBJECT); + return_ACPI_STATUS(AE_NULL_OBJECT); } - status = acpi_ut_allocate_owner_id (&obj_desc->method.owner_id); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ut_allocate_owner_id(&obj_desc->method.owner_id); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* Init for new method, wait on concurrency semaphore */ - status = acpi_ds_begin_method_execution (method_node, obj_desc, - this_walk_state->method_node); - if (ACPI_FAILURE (status)) { + status = acpi_ds_begin_method_execution(method_node, obj_desc, + this_walk_state->method_node); + if (ACPI_FAILURE(status)) { goto cleanup; } if (!(obj_desc->method.method_flags & AML_METHOD_INTERNAL_ONLY)) { /* 1) Parse: Create a new walk state for the preempting walk */ - next_walk_state = acpi_ds_create_walk_state (obj_desc->method.owner_id, - op, obj_desc, NULL); + next_walk_state = + acpi_ds_create_walk_state(obj_desc->method.owner_id, op, + obj_desc, NULL); if (!next_walk_state) { - return_ACPI_STATUS (AE_NO_MEMORY); + return_ACPI_STATUS(AE_NO_MEMORY); } /* Create and init a Root Node */ - op = acpi_ps_create_scope_op (); + op = acpi_ps_create_scope_op(); if (!op) { status = AE_NO_MEMORY; goto cleanup; } - status = acpi_ds_init_aml_walk (next_walk_state, op, method_node, - obj_desc->method.aml_start, obj_desc->method.aml_length, - NULL, 1); - if (ACPI_FAILURE (status)) { - acpi_ds_delete_walk_state (next_walk_state); + status = acpi_ds_init_aml_walk(next_walk_state, op, method_node, + obj_desc->method.aml_start, + obj_desc->method.aml_length, + NULL, 1); + if (ACPI_FAILURE(status)) { + acpi_ds_delete_walk_state(next_walk_state); goto cleanup; } /* Begin AML parse */ - status = acpi_ps_parse_aml (next_walk_state); - acpi_ps_delete_parse_tree (op); + status = acpi_ps_parse_aml(next_walk_state); + acpi_ps_delete_parse_tree(op); } /* 2) Execute: Create a new state for the preempting walk */ - next_walk_state = acpi_ds_create_walk_state (obj_desc->method.owner_id, - NULL, obj_desc, thread); + next_walk_state = acpi_ds_create_walk_state(obj_desc->method.owner_id, + NULL, obj_desc, thread); if (!next_walk_state) { status = AE_NO_MEMORY; goto cleanup; @@ -357,15 +349,15 @@ acpi_ds_call_control_method ( * start at index 0. * Null terminate the list of arguments */ - this_walk_state->operands [this_walk_state->num_operands] = NULL; + this_walk_state->operands[this_walk_state->num_operands] = NULL; info.parameters = &this_walk_state->operands[0]; info.parameter_type = ACPI_PARAM_ARGS; - status = acpi_ds_init_aml_walk (next_walk_state, NULL, method_node, - obj_desc->method.aml_start, obj_desc->method.aml_length, - &info, 3); - if (ACPI_FAILURE (status)) { + status = acpi_ds_init_aml_walk(next_walk_state, NULL, method_node, + obj_desc->method.aml_start, + obj_desc->method.aml_length, &info, 3); + if (ACPI_FAILURE(status)) { goto cleanup; } @@ -374,40 +366,39 @@ acpi_ds_call_control_method ( * (they were copied to new objects) */ for (i = 0; i < obj_desc->method.param_count; i++) { - acpi_ut_remove_reference (this_walk_state->operands [i]); - this_walk_state->operands [i] = NULL; + acpi_ut_remove_reference(this_walk_state->operands[i]); + this_walk_state->operands[i] = NULL; } /* Clear the operand stack */ this_walk_state->num_operands = 0; - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "Starting nested execution, newstate=%p\n", next_walk_state)); + ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, + "Starting nested execution, newstate=%p\n", + next_walk_state)); if (obj_desc->method.method_flags & AML_METHOD_INTERNAL_ONLY) { - status = obj_desc->method.implementation (next_walk_state); - return_ACPI_STATUS (status); + status = obj_desc->method.implementation(next_walk_state); + return_ACPI_STATUS(status); } - return_ACPI_STATUS (AE_OK); - + return_ACPI_STATUS(AE_OK); /* On error, we must delete the new walk state */ -cleanup: - acpi_ut_release_owner_id (&obj_desc->method.owner_id); + cleanup: + acpi_ut_release_owner_id(&obj_desc->method.owner_id); if (next_walk_state && (next_walk_state->method_desc)) { /* Decrement the thread count on the method parse tree */ - next_walk_state->method_desc->method.thread_count--; + next_walk_state->method_desc->method.thread_count--; } - (void) acpi_ds_terminate_control_method (next_walk_state); - acpi_ds_delete_walk_state (next_walk_state); - return_ACPI_STATUS (status); + (void)acpi_ds_terminate_control_method(next_walk_state); + acpi_ds_delete_walk_state(next_walk_state); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_ds_restart_control_method @@ -423,25 +414,22 @@ cleanup: ******************************************************************************/ acpi_status -acpi_ds_restart_control_method ( - struct acpi_walk_state *walk_state, - union acpi_operand_object *return_desc) +acpi_ds_restart_control_method(struct acpi_walk_state *walk_state, + union acpi_operand_object *return_desc) { - acpi_status status; - + acpi_status status; - ACPI_FUNCTION_TRACE_PTR ("ds_restart_control_method", walk_state); + ACPI_FUNCTION_TRACE_PTR("ds_restart_control_method", walk_state); + ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, + "****Restart [%4.4s] Op %p return_value_from_callee %p\n", + (char *)&walk_state->method_node->name, + walk_state->method_call_op, return_desc)); - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "****Restart [%4.4s] Op %p return_value_from_callee %p\n", - (char *) &walk_state->method_node->name, walk_state->method_call_op, - return_desc)); - - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - " return_from_this_method_used?=%X res_stack %p Walk %p\n", - walk_state->return_used, - walk_state->results, walk_state)); + ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, + " return_from_this_method_used?=%X res_stack %p Walk %p\n", + walk_state->return_used, + walk_state->results, walk_state)); /* Did the called method return a value? */ @@ -451,10 +439,10 @@ acpi_ds_restart_control_method ( if (walk_state->return_used) { /* Save the return value from the previous method */ - status = acpi_ds_result_push (return_desc, walk_state); - if (ACPI_FAILURE (status)) { - acpi_ut_remove_reference (return_desc); - return_ACPI_STATUS (status); + status = acpi_ds_result_push(return_desc, walk_state); + if (ACPI_FAILURE(status)) { + acpi_ut_remove_reference(return_desc); + return_ACPI_STATUS(status); } /* @@ -472,19 +460,19 @@ acpi_ds_restart_control_method ( * NOTE: this is optional because the ASL language does not actually * support this behavior. */ - else if (!acpi_ds_do_implicit_return (return_desc, walk_state, FALSE)) { + else if (!acpi_ds_do_implicit_return + (return_desc, walk_state, FALSE)) { /* * Delete the return value if it will not be used by the * calling method */ - acpi_ut_remove_reference (return_desc); + acpi_ut_remove_reference(return_desc); } } - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_ds_terminate_control_method @@ -499,17 +487,13 @@ acpi_ds_restart_control_method ( * ******************************************************************************/ -acpi_status -acpi_ds_terminate_control_method ( - struct acpi_walk_state *walk_state) +acpi_status acpi_ds_terminate_control_method(struct acpi_walk_state *walk_state) { - union acpi_operand_object *obj_desc; - struct acpi_namespace_node *method_node; - acpi_status status; - - - ACPI_FUNCTION_TRACE_PTR ("ds_terminate_control_method", walk_state); + union acpi_operand_object *obj_desc; + struct acpi_namespace_node *method_node; + acpi_status status; + ACPI_FUNCTION_TRACE_PTR("ds_terminate_control_method", walk_state); if (!walk_state) { return (AE_BAD_PARAMETER); @@ -519,30 +503,31 @@ acpi_ds_terminate_control_method ( obj_desc = walk_state->method_desc; if (!obj_desc) { - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } /* Delete all arguments and locals */ - acpi_ds_method_data_delete_all (walk_state); + acpi_ds_method_data_delete_all(walk_state); /* * Lock the parser while we terminate this method. * If this is the last thread executing the method, * we have additional cleanup to perform */ - status = acpi_ut_acquire_mutex (ACPI_MTX_PARSER); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ut_acquire_mutex(ACPI_MTX_PARSER); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* Signal completion of the execution of this method if necessary */ if (walk_state->method_desc->method.semaphore) { - status = acpi_os_signal_semaphore ( - walk_state->method_desc->method.semaphore, 1); - if (ACPI_FAILURE (status)) { - ACPI_REPORT_ERROR (("Could not signal method semaphore\n")); + status = + acpi_os_signal_semaphore(walk_state->method_desc->method. + semaphore, 1); + if (ACPI_FAILURE(status)) { + ACPI_REPORT_ERROR(("Could not signal method semaphore\n")); status = AE_OK; /* Ignore error and continue cleanup */ @@ -550,9 +535,10 @@ acpi_ds_terminate_control_method ( } if (walk_state->method_desc->method.thread_count) { - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "*** Not deleting method namespace, there are still %d threads\n", - walk_state->method_desc->method.thread_count)); + ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, + "*** Not deleting method namespace, there are still %d threads\n", + walk_state->method_desc->method. + thread_count)); } if (!walk_state->method_desc->method.thread_count) { @@ -567,9 +553,11 @@ acpi_ds_terminate_control_method ( * before creating the synchronization semaphore. */ if ((walk_state->method_desc->method.concurrency == 1) && - (!walk_state->method_desc->method.semaphore)) { - status = acpi_os_create_semaphore (1, 1, - &walk_state->method_desc->method.semaphore); + (!walk_state->method_desc->method.semaphore)) { + status = acpi_os_create_semaphore(1, 1, + &walk_state-> + method_desc->method. + semaphore); } /* @@ -584,30 +572,30 @@ acpi_ds_terminate_control_method ( * Delete any namespace entries created immediately underneath * the method */ - status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } if (method_node->child) { - acpi_ns_delete_namespace_subtree (method_node); + acpi_ns_delete_namespace_subtree(method_node); } /* * Delete any namespace entries created anywhere else within * the namespace */ - acpi_ns_delete_namespace_by_owner (walk_state->method_desc->method.owner_id); - status = acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); - acpi_ut_release_owner_id (&walk_state->method_desc->method.owner_id); - - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + acpi_ns_delete_namespace_by_owner(walk_state->method_desc-> + method.owner_id); + status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); + acpi_ut_release_owner_id(&walk_state->method_desc->method. + owner_id); + + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } } - status = acpi_ut_release_mutex (ACPI_MTX_PARSER); - return_ACPI_STATUS (status); + status = acpi_ut_release_mutex(ACPI_MTX_PARSER); + return_ACPI_STATUS(status); } - - diff --git a/drivers/acpi/dispatcher/dsmthdat.c b/drivers/acpi/dispatcher/dsmthdat.c index c83d53fd639..4095ce70982 100644 --- a/drivers/acpi/dispatcher/dsmthdat.c +++ b/drivers/acpi/dispatcher/dsmthdat.c @@ -41,41 +41,32 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include #include #include #include #include - #define _COMPONENT ACPI_DISPATCHER - ACPI_MODULE_NAME ("dsmthdat") +ACPI_MODULE_NAME("dsmthdat") /* Local prototypes */ - static void -acpi_ds_method_data_delete_value ( - u16 opcode, - u32 index, - struct acpi_walk_state *walk_state); +acpi_ds_method_data_delete_value(u16 opcode, + u32 index, struct acpi_walk_state *walk_state); static acpi_status -acpi_ds_method_data_set_value ( - u16 opcode, - u32 index, - union acpi_operand_object *object, - struct acpi_walk_state *walk_state); +acpi_ds_method_data_set_value(u16 opcode, + u32 index, + union acpi_operand_object *object, + struct acpi_walk_state *walk_state); #ifdef ACPI_OBSOLETE_FUNCTIONS acpi_object_type -acpi_ds_method_data_get_type ( - u16 opcode, - u32 index, - struct acpi_walk_state *walk_state); +acpi_ds_method_data_get_type(u16 opcode, + u32 index, struct acpi_walk_state *walk_state); #endif - /******************************************************************************* * * FUNCTION: acpi_ds_method_data_init @@ -97,45 +88,41 @@ acpi_ds_method_data_get_type ( * ******************************************************************************/ -void -acpi_ds_method_data_init ( - struct acpi_walk_state *walk_state) +void acpi_ds_method_data_init(struct acpi_walk_state *walk_state) { - u32 i; - - - ACPI_FUNCTION_TRACE ("ds_method_data_init"); + u32 i; + ACPI_FUNCTION_TRACE("ds_method_data_init"); /* Init the method arguments */ for (i = 0; i < ACPI_METHOD_NUM_ARGS; i++) { - ACPI_MOVE_32_TO_32 (&walk_state->arguments[i].name, + ACPI_MOVE_32_TO_32(&walk_state->arguments[i].name, NAMEOF_ARG_NTE); walk_state->arguments[i].name.integer |= (i << 24); - walk_state->arguments[i].descriptor = ACPI_DESC_TYPE_NAMED; - walk_state->arguments[i].type = ACPI_TYPE_ANY; - walk_state->arguments[i].flags = ANOBJ_END_OF_PEER_LIST | - ANOBJ_METHOD_ARG; + walk_state->arguments[i].descriptor = ACPI_DESC_TYPE_NAMED; + walk_state->arguments[i].type = ACPI_TYPE_ANY; + walk_state->arguments[i].flags = ANOBJ_END_OF_PEER_LIST | + ANOBJ_METHOD_ARG; } /* Init the method locals */ for (i = 0; i < ACPI_METHOD_NUM_LOCALS; i++) { - ACPI_MOVE_32_TO_32 (&walk_state->local_variables[i].name, + ACPI_MOVE_32_TO_32(&walk_state->local_variables[i].name, NAMEOF_LOCAL_NTE); walk_state->local_variables[i].name.integer |= (i << 24); - walk_state->local_variables[i].descriptor = ACPI_DESC_TYPE_NAMED; - walk_state->local_variables[i].type = ACPI_TYPE_ANY; - walk_state->local_variables[i].flags = ANOBJ_END_OF_PEER_LIST | - ANOBJ_METHOD_LOCAL; + walk_state->local_variables[i].descriptor = + ACPI_DESC_TYPE_NAMED; + walk_state->local_variables[i].type = ACPI_TYPE_ANY; + walk_state->local_variables[i].flags = ANOBJ_END_OF_PEER_LIST | + ANOBJ_METHOD_LOCAL; } return_VOID; } - /******************************************************************************* * * FUNCTION: acpi_ds_method_data_delete_all @@ -149,26 +136,25 @@ acpi_ds_method_data_init ( * ******************************************************************************/ -void -acpi_ds_method_data_delete_all ( - struct acpi_walk_state *walk_state) +void acpi_ds_method_data_delete_all(struct acpi_walk_state *walk_state) { - u32 index; - - - ACPI_FUNCTION_TRACE ("ds_method_data_delete_all"); + u32 index; + ACPI_FUNCTION_TRACE("ds_method_data_delete_all"); /* Detach the locals */ for (index = 0; index < ACPI_METHOD_NUM_LOCALS; index++) { if (walk_state->local_variables[index].object) { - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Deleting Local%d=%p\n", - index, walk_state->local_variables[index].object)); + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Deleting Local%d=%p\n", + index, + walk_state->local_variables[index]. + object)); /* Detach object (if present) and remove a reference */ - acpi_ns_detach_object (&walk_state->local_variables[index]); + acpi_ns_detach_object(&walk_state-> + local_variables[index]); } } @@ -176,19 +162,19 @@ acpi_ds_method_data_delete_all ( for (index = 0; index < ACPI_METHOD_NUM_ARGS; index++) { if (walk_state->arguments[index].object) { - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Deleting Arg%d=%p\n", - index, walk_state->arguments[index].object)); + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Deleting Arg%d=%p\n", + index, + walk_state->arguments[index].object)); /* Detach object (if present) and remove a reference */ - acpi_ns_detach_object (&walk_state->arguments[index]); + acpi_ns_detach_object(&walk_state->arguments[index]); } } return_VOID; } - /******************************************************************************* * * FUNCTION: acpi_ds_method_data_init_args @@ -206,47 +192,44 @@ acpi_ds_method_data_delete_all ( ******************************************************************************/ acpi_status -acpi_ds_method_data_init_args ( - union acpi_operand_object **params, - u32 max_param_count, - struct acpi_walk_state *walk_state) +acpi_ds_method_data_init_args(union acpi_operand_object **params, + u32 max_param_count, + struct acpi_walk_state *walk_state) { - acpi_status status; - u32 index = 0; - - - ACPI_FUNCTION_TRACE_PTR ("ds_method_data_init_args", params); + acpi_status status; + u32 index = 0; + ACPI_FUNCTION_TRACE_PTR("ds_method_data_init_args", params); if (!params) { - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "No param list passed to method\n")); - return_ACPI_STATUS (AE_OK); + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, + "No param list passed to method\n")); + return_ACPI_STATUS(AE_OK); } /* Copy passed parameters into the new method stack frame */ while ((index < ACPI_METHOD_NUM_ARGS) && - (index < max_param_count) && - params[index]) { + (index < max_param_count) && params[index]) { /* * A valid parameter. * Store the argument in the method/walk descriptor. * Do not copy the arg in order to implement call by reference */ - status = acpi_ds_method_data_set_value (AML_ARG_OP, index, - params[index], walk_state); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ds_method_data_set_value(AML_ARG_OP, index, + params[index], + walk_state); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } index++; } - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%d args passed to method\n", index)); - return_ACPI_STATUS (AE_OK); + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "%d args passed to method\n", index)); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_ds_method_data_get_node @@ -263,14 +246,12 @@ acpi_ds_method_data_init_args ( ******************************************************************************/ acpi_status -acpi_ds_method_data_get_node ( - u16 opcode, - u32 index, - struct acpi_walk_state *walk_state, - struct acpi_namespace_node **node) +acpi_ds_method_data_get_node(u16 opcode, + u32 index, + struct acpi_walk_state *walk_state, + struct acpi_namespace_node **node) { - ACPI_FUNCTION_TRACE ("ds_method_data_get_node"); - + ACPI_FUNCTION_TRACE("ds_method_data_get_node"); /* * Method Locals and Arguments are supported @@ -279,10 +260,10 @@ acpi_ds_method_data_get_node ( case AML_LOCAL_OP: if (index > ACPI_METHOD_MAX_LOCAL) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Local index %d is invalid (max %d)\n", - index, ACPI_METHOD_MAX_LOCAL)); - return_ACPI_STATUS (AE_AML_INVALID_INDEX); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Local index %d is invalid (max %d)\n", + index, ACPI_METHOD_MAX_LOCAL)); + return_ACPI_STATUS(AE_AML_INVALID_INDEX); } /* Return a pointer to the pseudo-node */ @@ -293,10 +274,10 @@ acpi_ds_method_data_get_node ( case AML_ARG_OP: if (index > ACPI_METHOD_MAX_ARG) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Arg index %d is invalid (max %d)\n", - index, ACPI_METHOD_MAX_ARG)); - return_ACPI_STATUS (AE_AML_INVALID_INDEX); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Arg index %d is invalid (max %d)\n", + index, ACPI_METHOD_MAX_ARG)); + return_ACPI_STATUS(AE_AML_INVALID_INDEX); } /* Return a pointer to the pseudo-node */ @@ -305,14 +286,14 @@ acpi_ds_method_data_get_node ( break; default: - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Opcode %d is invalid\n", opcode)); - return_ACPI_STATUS (AE_AML_BAD_OPCODE); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Opcode %d is invalid\n", + opcode)); + return_ACPI_STATUS(AE_AML_BAD_OPCODE); } - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_ds_method_data_set_value @@ -330,29 +311,26 @@ acpi_ds_method_data_get_node ( ******************************************************************************/ static acpi_status -acpi_ds_method_data_set_value ( - u16 opcode, - u32 index, - union acpi_operand_object *object, - struct acpi_walk_state *walk_state) +acpi_ds_method_data_set_value(u16 opcode, + u32 index, + union acpi_operand_object *object, + struct acpi_walk_state *walk_state) { - acpi_status status; - struct acpi_namespace_node *node; - + acpi_status status; + struct acpi_namespace_node *node; - ACPI_FUNCTION_TRACE ("ds_method_data_set_value"); + ACPI_FUNCTION_TRACE("ds_method_data_set_value"); - - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "new_obj %p Opcode %X, Refs=%d [%s]\n", object, - opcode, object->common.reference_count, - acpi_ut_get_type_name (object->common.type))); + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, + "new_obj %p Opcode %X, Refs=%d [%s]\n", object, + opcode, object->common.reference_count, + acpi_ut_get_type_name(object->common.type))); /* Get the namespace node for the arg/local */ - status = acpi_ds_method_data_get_node (opcode, index, walk_state, &node); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ds_method_data_get_node(opcode, index, walk_state, &node); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* @@ -361,15 +339,14 @@ acpi_ds_method_data_set_value ( * reference semantics of ACPI Control Method invocation. * (See ACPI specification 2.0_c) */ - acpi_ut_add_reference (object); + acpi_ut_add_reference(object); /* Install the object */ node->object = object; - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_ds_method_data_get_value @@ -387,32 +364,30 @@ acpi_ds_method_data_set_value ( ******************************************************************************/ acpi_status -acpi_ds_method_data_get_value ( - u16 opcode, - u32 index, - struct acpi_walk_state *walk_state, - union acpi_operand_object **dest_desc) +acpi_ds_method_data_get_value(u16 opcode, + u32 index, + struct acpi_walk_state *walk_state, + union acpi_operand_object **dest_desc) { - acpi_status status; - struct acpi_namespace_node *node; - union acpi_operand_object *object; - - - ACPI_FUNCTION_TRACE ("ds_method_data_get_value"); + acpi_status status; + struct acpi_namespace_node *node; + union acpi_operand_object *object; + ACPI_FUNCTION_TRACE("ds_method_data_get_value"); /* Validate the object descriptor */ if (!dest_desc) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null object descriptor pointer\n")); - return_ACPI_STATUS (AE_BAD_PARAMETER); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Null object descriptor pointer\n")); + return_ACPI_STATUS(AE_BAD_PARAMETER); } /* Get the namespace node for the arg/local */ - status = acpi_ds_method_data_get_node (opcode, index, walk_state, &node); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ds_method_data_get_node(opcode, index, walk_state, &node); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* Get the object from the node */ @@ -433,9 +408,10 @@ acpi_ds_method_data_get_value ( /* If slack enabled, init the local_x/arg_x to an Integer of value zero */ if (acpi_gbl_enable_interpreter_slack) { - object = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER); + object = + acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); if (!object) { - return_ACPI_STATUS (AE_NO_MEMORY); + return_ACPI_STATUS(AE_NO_MEMORY); } object->integer.value = 0; @@ -444,27 +420,29 @@ acpi_ds_method_data_get_value ( /* Otherwise, return the error */ - else switch (opcode) { - case AML_ARG_OP: + else + switch (opcode) { + case AML_ARG_OP: - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Uninitialized Arg[%d] at node %p\n", - index, node)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Uninitialized Arg[%d] at node %p\n", + index, node)); - return_ACPI_STATUS (AE_AML_UNINITIALIZED_ARG); + return_ACPI_STATUS(AE_AML_UNINITIALIZED_ARG); - case AML_LOCAL_OP: + case AML_LOCAL_OP: - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Uninitialized Local[%d] at node %p\n", - index, node)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Uninitialized Local[%d] at node %p\n", + index, node)); - return_ACPI_STATUS (AE_AML_UNINITIALIZED_LOCAL); + return_ACPI_STATUS(AE_AML_UNINITIALIZED_LOCAL); - default: - ACPI_REPORT_ERROR (("Not Arg/Local opcode: %X\n", opcode)); - return_ACPI_STATUS (AE_AML_INTERNAL); - } + default: + ACPI_REPORT_ERROR(("Not Arg/Local opcode: %X\n", + opcode)); + return_ACPI_STATUS(AE_AML_INTERNAL); + } } /* @@ -472,12 +450,11 @@ acpi_ds_method_data_get_value ( * Return an additional reference to the object */ *dest_desc = object; - acpi_ut_add_reference (object); + acpi_ut_add_reference(object); - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_ds_method_data_delete_value @@ -494,29 +471,25 @@ acpi_ds_method_data_get_value ( ******************************************************************************/ static void -acpi_ds_method_data_delete_value ( - u16 opcode, - u32 index, - struct acpi_walk_state *walk_state) +acpi_ds_method_data_delete_value(u16 opcode, + u32 index, struct acpi_walk_state *walk_state) { - acpi_status status; - struct acpi_namespace_node *node; - union acpi_operand_object *object; - - - ACPI_FUNCTION_TRACE ("ds_method_data_delete_value"); + acpi_status status; + struct acpi_namespace_node *node; + union acpi_operand_object *object; + ACPI_FUNCTION_TRACE("ds_method_data_delete_value"); /* Get the namespace node for the arg/local */ - status = acpi_ds_method_data_get_node (opcode, index, walk_state, &node); - if (ACPI_FAILURE (status)) { + status = acpi_ds_method_data_get_node(opcode, index, walk_state, &node); + if (ACPI_FAILURE(status)) { return_VOID; } /* Get the associated object */ - object = acpi_ns_get_attached_object (node); + object = acpi_ns_get_attached_object(node); /* * Undefine the Arg or Local by setting its descriptor @@ -526,19 +499,18 @@ acpi_ds_method_data_delete_value ( node->object = NULL; if ((object) && - (ACPI_GET_DESCRIPTOR_TYPE (object) == ACPI_DESC_TYPE_OPERAND)) { + (ACPI_GET_DESCRIPTOR_TYPE(object) == ACPI_DESC_TYPE_OPERAND)) { /* * There is a valid object. * Decrement the reference count by one to balance the * increment when the object was stored. */ - acpi_ut_remove_reference (object); + acpi_ut_remove_reference(object); } return_VOID; } - /******************************************************************************* * * FUNCTION: acpi_ds_store_object_to_local @@ -557,40 +529,38 @@ acpi_ds_method_data_delete_value ( ******************************************************************************/ acpi_status -acpi_ds_store_object_to_local ( - u16 opcode, - u32 index, - union acpi_operand_object *obj_desc, - struct acpi_walk_state *walk_state) +acpi_ds_store_object_to_local(u16 opcode, + u32 index, + union acpi_operand_object *obj_desc, + struct acpi_walk_state *walk_state) { - acpi_status status; - struct acpi_namespace_node *node; - union acpi_operand_object *current_obj_desc; - union acpi_operand_object *new_obj_desc; + acpi_status status; + struct acpi_namespace_node *node; + union acpi_operand_object *current_obj_desc; + union acpi_operand_object *new_obj_desc; - - ACPI_FUNCTION_TRACE ("ds_store_object_to_local"); - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Opcode=%X Index=%d Obj=%p\n", - opcode, index, obj_desc)); + ACPI_FUNCTION_TRACE("ds_store_object_to_local"); + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Opcode=%X Index=%d Obj=%p\n", + opcode, index, obj_desc)); /* Parameter validation */ if (!obj_desc) { - return_ACPI_STATUS (AE_BAD_PARAMETER); + return_ACPI_STATUS(AE_BAD_PARAMETER); } /* Get the namespace node for the arg/local */ - status = acpi_ds_method_data_get_node (opcode, index, walk_state, &node); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ds_method_data_get_node(opcode, index, walk_state, &node); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } - current_obj_desc = acpi_ns_get_attached_object (node); + current_obj_desc = acpi_ns_get_attached_object(node); if (current_obj_desc == obj_desc) { - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p already installed!\n", - obj_desc)); - return_ACPI_STATUS (status); + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Obj=%p already installed!\n", + obj_desc)); + return_ACPI_STATUS(status); } /* @@ -602,9 +572,11 @@ acpi_ds_store_object_to_local ( */ new_obj_desc = obj_desc; if (obj_desc->common.reference_count > 1) { - status = acpi_ut_copy_iobject_to_iobject (obj_desc, &new_obj_desc, walk_state); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = + acpi_ut_copy_iobject_to_iobject(obj_desc, &new_obj_desc, + walk_state); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } } @@ -636,28 +608,36 @@ acpi_ds_store_object_to_local ( * If we have a valid reference object that came from ref_of(), * do the indirect store */ - if ((ACPI_GET_DESCRIPTOR_TYPE (current_obj_desc) == ACPI_DESC_TYPE_OPERAND) && - (current_obj_desc->common.type == ACPI_TYPE_LOCAL_REFERENCE) && - (current_obj_desc->reference.opcode == AML_REF_OF_OP)) { - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "Arg (%p) is an obj_ref(Node), storing in node %p\n", - new_obj_desc, current_obj_desc)); + if ((ACPI_GET_DESCRIPTOR_TYPE(current_obj_desc) == + ACPI_DESC_TYPE_OPERAND) + && (current_obj_desc->common.type == + ACPI_TYPE_LOCAL_REFERENCE) + && (current_obj_desc->reference.opcode == + AML_REF_OF_OP)) { + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, + "Arg (%p) is an obj_ref(Node), storing in node %p\n", + new_obj_desc, + current_obj_desc)); /* * Store this object to the Node (perform the indirect store) * NOTE: No implicit conversion is performed, as per the ACPI * specification rules on storing to Locals/Args. */ - status = acpi_ex_store_object_to_node (new_obj_desc, - current_obj_desc->reference.object, walk_state, - ACPI_NO_IMPLICIT_CONVERSION); + status = + acpi_ex_store_object_to_node(new_obj_desc, + current_obj_desc-> + reference. + object, + walk_state, + ACPI_NO_IMPLICIT_CONVERSION); /* Remove local reference if we copied the object above */ if (new_obj_desc != obj_desc) { - acpi_ut_remove_reference (new_obj_desc); + acpi_ut_remove_reference(new_obj_desc); } - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } } @@ -665,7 +645,7 @@ acpi_ds_store_object_to_local ( * Delete the existing object * before storing the new one */ - acpi_ds_method_data_delete_value (opcode, index, walk_state); + acpi_ds_method_data_delete_value(opcode, index, walk_state); } /* @@ -673,18 +653,19 @@ acpi_ds_store_object_to_local ( * the descriptor for the Arg or Local. * (increments the object reference count by one) */ - status = acpi_ds_method_data_set_value (opcode, index, new_obj_desc, walk_state); + status = + acpi_ds_method_data_set_value(opcode, index, new_obj_desc, + walk_state); /* Remove local reference if we copied the object above */ if (new_obj_desc != obj_desc) { - acpi_ut_remove_reference (new_obj_desc); + acpi_ut_remove_reference(new_obj_desc); } - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - #ifdef ACPI_OBSOLETE_FUNCTIONS /******************************************************************************* * @@ -701,39 +682,33 @@ acpi_ds_store_object_to_local ( ******************************************************************************/ acpi_object_type -acpi_ds_method_data_get_type ( - u16 opcode, - u32 index, - struct acpi_walk_state *walk_state) +acpi_ds_method_data_get_type(u16 opcode, + u32 index, struct acpi_walk_state *walk_state) { - acpi_status status; - struct acpi_namespace_node *node; - union acpi_operand_object *object; - - - ACPI_FUNCTION_TRACE ("ds_method_data_get_type"); + acpi_status status; + struct acpi_namespace_node *node; + union acpi_operand_object *object; + ACPI_FUNCTION_TRACE("ds_method_data_get_type"); /* Get the namespace node for the arg/local */ - status = acpi_ds_method_data_get_node (opcode, index, walk_state, &node); - if (ACPI_FAILURE (status)) { - return_VALUE ((ACPI_TYPE_NOT_FOUND)); + status = acpi_ds_method_data_get_node(opcode, index, walk_state, &node); + if (ACPI_FAILURE(status)) { + return_VALUE((ACPI_TYPE_NOT_FOUND)); } /* Get the object */ - object = acpi_ns_get_attached_object (node); + object = acpi_ns_get_attached_object(node); if (!object) { /* Uninitialized local/arg, return TYPE_ANY */ - return_VALUE (ACPI_TYPE_ANY); + return_VALUE(ACPI_TYPE_ANY); } /* Get the object type */ - return_VALUE (ACPI_GET_OBJECT_TYPE (object)); + return_VALUE(ACPI_GET_OBJECT_TYPE(object)); } #endif - - diff --git a/drivers/acpi/dispatcher/dsobject.c b/drivers/acpi/dispatcher/dsobject.c index 1eee2d54180..8ac0cd93adb 100644 --- a/drivers/acpi/dispatcher/dsobject.c +++ b/drivers/acpi/dispatcher/dsobject.c @@ -41,7 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include #include #include @@ -50,14 +49,12 @@ #include #define _COMPONENT ACPI_DISPATCHER - ACPI_MODULE_NAME ("dsobject") +ACPI_MODULE_NAME("dsobject") static acpi_status -acpi_ds_build_internal_object ( - struct acpi_walk_state *walk_state, - union acpi_parse_object *op, - union acpi_operand_object **obj_desc_ptr); - +acpi_ds_build_internal_object(struct acpi_walk_state *walk_state, + union acpi_parse_object *op, + union acpi_operand_object **obj_desc_ptr); #ifndef ACPI_NO_METHOD_EXECUTION /******************************************************************************* @@ -76,17 +73,14 @@ acpi_ds_build_internal_object ( ******************************************************************************/ static acpi_status -acpi_ds_build_internal_object ( - struct acpi_walk_state *walk_state, - union acpi_parse_object *op, - union acpi_operand_object **obj_desc_ptr) +acpi_ds_build_internal_object(struct acpi_walk_state *walk_state, + union acpi_parse_object *op, + union acpi_operand_object **obj_desc_ptr) { - union acpi_operand_object *obj_desc; - acpi_status status; - - - ACPI_FUNCTION_TRACE ("ds_build_internal_object"); + union acpi_operand_object *obj_desc; + acpi_status status; + ACPI_FUNCTION_TRACE("ds_build_internal_object"); *obj_desc_ptr = NULL; if (op->common.aml_opcode == AML_INT_NAMEPATH_OP) { @@ -96,40 +90,44 @@ acpi_ds_build_internal_object ( * Otherwise, go ahead and look it up now */ if (!op->common.node) { - status = acpi_ns_lookup (walk_state->scope_info, - op->common.value.string, - ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, - ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, - NULL, - (struct acpi_namespace_node **) &(op->common.node)); - - if (ACPI_FAILURE (status)) { - ACPI_REPORT_NSERROR (op->common.value.string, status); - return_ACPI_STATUS (status); + status = acpi_ns_lookup(walk_state->scope_info, + op->common.value.string, + ACPI_TYPE_ANY, + ACPI_IMODE_EXECUTE, + ACPI_NS_SEARCH_PARENT | + ACPI_NS_DONT_OPEN_SCOPE, NULL, + (struct acpi_namespace_node **) + &(op->common.node)); + + if (ACPI_FAILURE(status)) { + ACPI_REPORT_NSERROR(op->common.value.string, + status); + return_ACPI_STATUS(status); } } } /* Create and init the internal ACPI object */ - obj_desc = acpi_ut_create_internal_object ( - (acpi_ps_get_opcode_info (op->common.aml_opcode))->object_type); + obj_desc = acpi_ut_create_internal_object((acpi_ps_get_opcode_info + (op->common.aml_opcode))-> + object_type); if (!obj_desc) { - return_ACPI_STATUS (AE_NO_MEMORY); + return_ACPI_STATUS(AE_NO_MEMORY); } - status = acpi_ds_init_object_from_op (walk_state, op, op->common.aml_opcode, - &obj_desc); - if (ACPI_FAILURE (status)) { - acpi_ut_remove_reference (obj_desc); - return_ACPI_STATUS (status); + status = + acpi_ds_init_object_from_op(walk_state, op, op->common.aml_opcode, + &obj_desc); + if (ACPI_FAILURE(status)) { + acpi_ut_remove_reference(obj_desc); + return_ACPI_STATUS(status); } *obj_desc_ptr = obj_desc; - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_ds_build_internal_buffer_obj @@ -147,20 +145,17 @@ acpi_ds_build_internal_object ( ******************************************************************************/ acpi_status -acpi_ds_build_internal_buffer_obj ( - struct acpi_walk_state *walk_state, - union acpi_parse_object *op, - u32 buffer_length, - union acpi_operand_object **obj_desc_ptr) +acpi_ds_build_internal_buffer_obj(struct acpi_walk_state *walk_state, + union acpi_parse_object *op, + u32 buffer_length, + union acpi_operand_object **obj_desc_ptr) { - union acpi_parse_object *arg; - union acpi_operand_object *obj_desc; - union acpi_parse_object *byte_list; - u32 byte_list_length = 0; - - - ACPI_FUNCTION_TRACE ("ds_build_internal_buffer_obj"); + union acpi_parse_object *arg; + union acpi_operand_object *obj_desc; + union acpi_parse_object *byte_list; + u32 byte_list_length = 0; + ACPI_FUNCTION_TRACE("ds_build_internal_buffer_obj"); obj_desc = *obj_desc_ptr; if (obj_desc) { @@ -168,14 +163,13 @@ acpi_ds_build_internal_buffer_obj ( * We are evaluating a Named buffer object "Name (xxxx, Buffer)". * The buffer object already exists (from the NS node) */ - } - else { + } else { /* Create a new buffer object */ - obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_BUFFER); + obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_BUFFER); *obj_desc_ptr = obj_desc; if (!obj_desc) { - return_ACPI_STATUS (AE_NO_MEMORY); + return_ACPI_STATUS(AE_NO_MEMORY); } } @@ -184,16 +178,17 @@ acpi_ds_build_internal_buffer_obj ( * individual bytes or a string initializer. In either case, a * byte_list appears in the AML. */ - arg = op->common.value.arg; /* skip first arg */ + arg = op->common.value.arg; /* skip first arg */ byte_list = arg->named.next; if (byte_list) { if (byte_list->common.aml_opcode != AML_INT_BYTELIST_OP) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Expecting bytelist, got AML opcode %X in op %p\n", - byte_list->common.aml_opcode, byte_list)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Expecting bytelist, got AML opcode %X in op %p\n", + byte_list->common.aml_opcode, + byte_list)); - acpi_ut_remove_reference (obj_desc); + acpi_ut_remove_reference(obj_desc); return (AE_TYPE); } @@ -214,31 +209,29 @@ acpi_ds_build_internal_buffer_obj ( if (obj_desc->buffer.length == 0) { obj_desc->buffer.pointer = NULL; - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "Buffer defined with zero length in AML, creating\n")); - } - else { - obj_desc->buffer.pointer = ACPI_MEM_CALLOCATE ( - obj_desc->buffer.length); + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, + "Buffer defined with zero length in AML, creating\n")); + } else { + obj_desc->buffer.pointer = + ACPI_MEM_CALLOCATE(obj_desc->buffer.length); if (!obj_desc->buffer.pointer) { - acpi_ut_delete_object_desc (obj_desc); - return_ACPI_STATUS (AE_NO_MEMORY); + acpi_ut_delete_object_desc(obj_desc); + return_ACPI_STATUS(AE_NO_MEMORY); } /* Initialize buffer from the byte_list (if present) */ if (byte_list) { - ACPI_MEMCPY (obj_desc->buffer.pointer, byte_list->named.data, - byte_list_length); + ACPI_MEMCPY(obj_desc->buffer.pointer, + byte_list->named.data, byte_list_length); } } obj_desc->buffer.flags |= AOPOBJ_DATA_VALID; - op->common.node = (struct acpi_namespace_node *) obj_desc; - return_ACPI_STATUS (AE_OK); + op->common.node = (struct acpi_namespace_node *)obj_desc; + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_ds_build_internal_package_obj @@ -256,28 +249,25 @@ acpi_ds_build_internal_buffer_obj ( ******************************************************************************/ acpi_status -acpi_ds_build_internal_package_obj ( - struct acpi_walk_state *walk_state, - union acpi_parse_object *op, - u32 package_length, - union acpi_operand_object **obj_desc_ptr) +acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state, + union acpi_parse_object *op, + u32 package_length, + union acpi_operand_object **obj_desc_ptr) { - union acpi_parse_object *arg; - union acpi_parse_object *parent; - union acpi_operand_object *obj_desc = NULL; - u32 package_list_length; - acpi_status status = AE_OK; - u32 i; - - - ACPI_FUNCTION_TRACE ("ds_build_internal_package_obj"); + union acpi_parse_object *arg; + union acpi_parse_object *parent; + union acpi_operand_object *obj_desc = NULL; + u32 package_list_length; + acpi_status status = AE_OK; + u32 i; + ACPI_FUNCTION_TRACE("ds_build_internal_package_obj"); /* Find the parent of a possibly nested package */ parent = op->common.parent; - while ((parent->common.aml_opcode == AML_PACKAGE_OP) || - (parent->common.aml_opcode == AML_VAR_PACKAGE_OP)) { + while ((parent->common.aml_opcode == AML_PACKAGE_OP) || + (parent->common.aml_opcode == AML_VAR_PACKAGE_OP)) { parent = parent->common.parent; } @@ -287,12 +277,11 @@ acpi_ds_build_internal_package_obj ( * We are evaluating a Named package object "Name (xxxx, Package)". * Get the existing package object from the NS node */ - } - else { - obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_PACKAGE); + } else { + obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_PACKAGE); *obj_desc_ptr = obj_desc; if (!obj_desc) { - return_ACPI_STATUS (AE_NO_MEMORY); + return_ACPI_STATUS(AE_NO_MEMORY); } obj_desc->package.node = parent->common.node; @@ -323,12 +312,13 @@ acpi_ds_build_internal_package_obj ( * individual objects). Add an extra pointer slot so * that the list is always null terminated. */ - obj_desc->package.elements = ACPI_MEM_CALLOCATE ( - ((acpi_size) obj_desc->package.count + 1) * sizeof (void *)); + obj_desc->package.elements = ACPI_MEM_CALLOCATE(((acpi_size) obj_desc-> + package.count + + 1) * sizeof(void *)); if (!obj_desc->package.elements) { - acpi_ut_delete_object_desc (obj_desc); - return_ACPI_STATUS (AE_NO_MEMORY); + acpi_ut_delete_object_desc(obj_desc); + return_ACPI_STATUS(AE_NO_MEMORY); } /* @@ -342,11 +332,13 @@ acpi_ds_build_internal_package_obj ( /* Object (package or buffer) is already built */ obj_desc->package.elements[i] = - ACPI_CAST_PTR (union acpi_operand_object, arg->common.node); - } - else { - status = acpi_ds_build_internal_object (walk_state, arg, - &obj_desc->package.elements[i]); + ACPI_CAST_PTR(union acpi_operand_object, + arg->common.node); + } else { + status = acpi_ds_build_internal_object(walk_state, arg, + &obj_desc-> + package. + elements[i]); } i++; @@ -354,11 +346,10 @@ acpi_ds_build_internal_package_obj ( } obj_desc->package.flags |= AOPOBJ_DATA_VALID; - op->common.node = (struct acpi_namespace_node *) obj_desc; - return_ACPI_STATUS (status); + op->common.node = (struct acpi_namespace_node *)obj_desc; + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_ds_create_node @@ -374,57 +365,53 @@ acpi_ds_build_internal_package_obj ( ******************************************************************************/ acpi_status -acpi_ds_create_node ( - struct acpi_walk_state *walk_state, - struct acpi_namespace_node *node, - union acpi_parse_object *op) +acpi_ds_create_node(struct acpi_walk_state *walk_state, + struct acpi_namespace_node *node, + union acpi_parse_object *op) { - acpi_status status; - union acpi_operand_object *obj_desc; - - - ACPI_FUNCTION_TRACE_PTR ("ds_create_node", op); + acpi_status status; + union acpi_operand_object *obj_desc; + ACPI_FUNCTION_TRACE_PTR("ds_create_node", op); /* * Because of the execution pass through the non-control-method * parts of the table, we can arrive here twice. Only init * the named object node the first time through */ - if (acpi_ns_get_attached_object (node)) { - return_ACPI_STATUS (AE_OK); + if (acpi_ns_get_attached_object(node)) { + return_ACPI_STATUS(AE_OK); } if (!op->common.value.arg) { /* No arguments, there is nothing to do */ - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } /* Build an internal object for the argument(s) */ - status = acpi_ds_build_internal_object (walk_state, op->common.value.arg, - &obj_desc); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ds_build_internal_object(walk_state, op->common.value.arg, + &obj_desc); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* Re-type the object according to its argument */ - node->type = ACPI_GET_OBJECT_TYPE (obj_desc); + node->type = ACPI_GET_OBJECT_TYPE(obj_desc); /* Attach obj to node */ - status = acpi_ns_attach_object (node, obj_desc, node->type); + status = acpi_ns_attach_object(node, obj_desc, node->type); /* Remove local reference to the object */ - acpi_ut_remove_reference (obj_desc); - return_ACPI_STATUS (status); + acpi_ut_remove_reference(obj_desc); + return_ACPI_STATUS(status); } -#endif /* ACPI_NO_METHOD_EXECUTION */ - +#endif /* ACPI_NO_METHOD_EXECUTION */ /******************************************************************************* * @@ -444,55 +431,50 @@ acpi_ds_create_node ( ******************************************************************************/ acpi_status -acpi_ds_init_object_from_op ( - struct acpi_walk_state *walk_state, - union acpi_parse_object *op, - u16 opcode, - union acpi_operand_object **ret_obj_desc) +acpi_ds_init_object_from_op(struct acpi_walk_state *walk_state, + union acpi_parse_object *op, + u16 opcode, + union acpi_operand_object **ret_obj_desc) { - const struct acpi_opcode_info *op_info; - union acpi_operand_object *obj_desc; - acpi_status status = AE_OK; - - - ACPI_FUNCTION_TRACE ("ds_init_object_from_op"); + const struct acpi_opcode_info *op_info; + union acpi_operand_object *obj_desc; + acpi_status status = AE_OK; + ACPI_FUNCTION_TRACE("ds_init_object_from_op"); obj_desc = *ret_obj_desc; - op_info = acpi_ps_get_opcode_info (opcode); + op_info = acpi_ps_get_opcode_info(opcode); if (op_info->class == AML_CLASS_UNKNOWN) { /* Unknown opcode */ - return_ACPI_STATUS (AE_TYPE); + return_ACPI_STATUS(AE_TYPE); } /* Perform per-object initialization */ - switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { + switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { case ACPI_TYPE_BUFFER: /* * Defer evaluation of Buffer term_arg operand */ - obj_desc->buffer.node = (struct acpi_namespace_node *) - walk_state->operands[0]; + obj_desc->buffer.node = (struct acpi_namespace_node *) + walk_state->operands[0]; obj_desc->buffer.aml_start = op->named.data; obj_desc->buffer.aml_length = op->named.length; break; - case ACPI_TYPE_PACKAGE: /* * Defer evaluation of Package term_arg operand */ - obj_desc->package.node = (struct acpi_namespace_node *) - walk_state->operands[0]; + obj_desc->package.node = (struct acpi_namespace_node *) + walk_state->operands[0]; obj_desc->package.aml_start = op->named.data; obj_desc->package.aml_length = op->named.length; break; - case ACPI_TYPE_INTEGER: switch (op_info->type) { @@ -525,7 +507,7 @@ acpi_ds_init_object_from_op ( /* Truncate value if we are executing from a 32-bit ACPI table */ #ifndef ACPI_NO_METHOD_EXECUTION - acpi_ex_truncate_for32bit_table (obj_desc); + acpi_ex_truncate_for32bit_table(obj_desc); #endif break; @@ -536,36 +518,36 @@ acpi_ds_init_object_from_op ( default: - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Unknown constant opcode %X\n", opcode)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Unknown constant opcode %X\n", + opcode)); status = AE_AML_OPERAND_TYPE; break; } break; - case AML_TYPE_LITERAL: obj_desc->integer.value = op->common.value.integer; #ifndef ACPI_NO_METHOD_EXECUTION - acpi_ex_truncate_for32bit_table (obj_desc); + acpi_ex_truncate_for32bit_table(obj_desc); #endif break; - default: - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown Integer type %X\n", - op_info->type)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Unknown Integer type %X\n", + op_info->type)); status = AE_AML_OPERAND_TYPE; break; } break; - case ACPI_TYPE_STRING: obj_desc->string.pointer = op->common.value.string; - obj_desc->string.length = (u32) ACPI_STRLEN (op->common.value.string); + obj_desc->string.length = + (u32) ACPI_STRLEN(op->common.value.string); /* * The string is contained in the ACPI table, don't ever try @@ -574,11 +556,9 @@ acpi_ds_init_object_from_op ( obj_desc->common.flags |= AOPOBJ_STATIC_POINTER; break; - case ACPI_TYPE_METHOD: break; - case ACPI_TYPE_LOCAL_REFERENCE: switch (op_info->type) { @@ -590,14 +570,17 @@ acpi_ds_init_object_from_op ( obj_desc->reference.offset = opcode - AML_LOCAL_OP; #ifndef ACPI_NO_METHOD_EXECUTION - status = acpi_ds_method_data_get_node (AML_LOCAL_OP, - obj_desc->reference.offset, - walk_state, - (struct acpi_namespace_node **) &obj_desc->reference.object); + status = acpi_ds_method_data_get_node(AML_LOCAL_OP, + obj_desc-> + reference.offset, + walk_state, + (struct + acpi_namespace_node + **)&obj_desc-> + reference.object); #endif break; - case AML_TYPE_METHOD_ARGUMENT: /* Split the opcode into a base opcode + offset */ @@ -606,14 +589,18 @@ acpi_ds_init_object_from_op ( obj_desc->reference.offset = opcode - AML_ARG_OP; #ifndef ACPI_NO_METHOD_EXECUTION - status = acpi_ds_method_data_get_node (AML_ARG_OP, - obj_desc->reference.offset, - walk_state, - (struct acpi_namespace_node **) &obj_desc->reference.object); + status = acpi_ds_method_data_get_node(AML_ARG_OP, + obj_desc-> + reference.offset, + walk_state, + (struct + acpi_namespace_node + **)&obj_desc-> + reference.object); #endif break; - default: /* Other literals, etc.. */ + default: /* Other literals, etc.. */ if (op->common.aml_opcode == AML_INT_NAMEPATH_OP) { /* Node was saved in Op */ @@ -626,17 +613,15 @@ acpi_ds_init_object_from_op ( } break; - default: - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unimplemented data type: %X\n", - ACPI_GET_OBJECT_TYPE (obj_desc))); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Unimplemented data type: %X\n", + ACPI_GET_OBJECT_TYPE(obj_desc))); status = AE_AML_OPERAND_TYPE; break; } - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - - diff --git a/drivers/acpi/dispatcher/dsopcode.c b/drivers/acpi/dispatcher/dsopcode.c index 750bdb1ac34..939d167bf87 100644 --- a/drivers/acpi/dispatcher/dsopcode.c +++ b/drivers/acpi/dispatcher/dsopcode.c @@ -42,7 +42,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include #include #include @@ -52,26 +51,21 @@ #include #define _COMPONENT ACPI_DISPATCHER - ACPI_MODULE_NAME ("dsopcode") +ACPI_MODULE_NAME("dsopcode") /* Local prototypes */ - static acpi_status -acpi_ds_execute_arguments ( - struct acpi_namespace_node *node, - struct acpi_namespace_node *scope_node, - u32 aml_length, - u8 *aml_start); +acpi_ds_execute_arguments(struct acpi_namespace_node *node, + struct acpi_namespace_node *scope_node, + u32 aml_length, u8 * aml_start); static acpi_status -acpi_ds_init_buffer_field ( - u16 aml_opcode, - union acpi_operand_object *obj_desc, - union acpi_operand_object *buffer_desc, - union acpi_operand_object *offset_desc, - union acpi_operand_object *length_desc, - union acpi_operand_object *result_desc); - +acpi_ds_init_buffer_field(u16 aml_opcode, + union acpi_operand_object *obj_desc, + union acpi_operand_object *buffer_desc, + union acpi_operand_object *offset_desc, + union acpi_operand_object *length_desc, + union acpi_operand_object *result_desc); /******************************************************************************* * @@ -89,26 +83,22 @@ acpi_ds_init_buffer_field ( ******************************************************************************/ static acpi_status -acpi_ds_execute_arguments ( - struct acpi_namespace_node *node, - struct acpi_namespace_node *scope_node, - u32 aml_length, - u8 *aml_start) +acpi_ds_execute_arguments(struct acpi_namespace_node *node, + struct acpi_namespace_node *scope_node, + u32 aml_length, u8 * aml_start) { - acpi_status status; - union acpi_parse_object *op; - struct acpi_walk_state *walk_state; - - - ACPI_FUNCTION_TRACE ("ds_execute_arguments"); + acpi_status status; + union acpi_parse_object *op; + struct acpi_walk_state *walk_state; + ACPI_FUNCTION_TRACE("ds_execute_arguments"); /* * Allocate a new parser op to be the root of the parsed tree */ - op = acpi_ps_alloc_op (AML_INT_EVAL_SUBTREE_OP); + op = acpi_ps_alloc_op(AML_INT_EVAL_SUBTREE_OP); if (!op) { - return_ACPI_STATUS (AE_NO_MEMORY); + return_ACPI_STATUS(AE_NO_MEMORY); } /* Save the Node for use in acpi_ps_parse_aml */ @@ -117,16 +107,16 @@ acpi_ds_execute_arguments ( /* Create and initialize a new parser state */ - walk_state = acpi_ds_create_walk_state (0, NULL, NULL, NULL); + walk_state = acpi_ds_create_walk_state(0, NULL, NULL, NULL); if (!walk_state) { status = AE_NO_MEMORY; goto cleanup; } - status = acpi_ds_init_aml_walk (walk_state, op, NULL, aml_start, - aml_length, NULL, 1); - if (ACPI_FAILURE (status)) { - acpi_ds_delete_walk_state (walk_state); + status = acpi_ds_init_aml_walk(walk_state, op, NULL, aml_start, + aml_length, NULL, 1); + if (ACPI_FAILURE(status)) { + acpi_ds_delete_walk_state(walk_state); goto cleanup; } @@ -137,28 +127,28 @@ acpi_ds_execute_arguments ( /* Pass1: Parse the entire declaration */ - status = acpi_ps_parse_aml (walk_state); - if (ACPI_FAILURE (status)) { + status = acpi_ps_parse_aml(walk_state); + if (ACPI_FAILURE(status)) { goto cleanup; } /* Get and init the Op created above */ op->common.node = node; - acpi_ps_delete_parse_tree (op); + acpi_ps_delete_parse_tree(op); /* Evaluate the deferred arguments */ - op = acpi_ps_alloc_op (AML_INT_EVAL_SUBTREE_OP); + op = acpi_ps_alloc_op(AML_INT_EVAL_SUBTREE_OP); if (!op) { - return_ACPI_STATUS (AE_NO_MEMORY); + return_ACPI_STATUS(AE_NO_MEMORY); } op->common.node = scope_node; /* Create and initialize a new parser state */ - walk_state = acpi_ds_create_walk_state (0, NULL, NULL, NULL); + walk_state = acpi_ds_create_walk_state(0, NULL, NULL, NULL); if (!walk_state) { status = AE_NO_MEMORY; goto cleanup; @@ -166,24 +156,23 @@ acpi_ds_execute_arguments ( /* Execute the opcode and arguments */ - status = acpi_ds_init_aml_walk (walk_state, op, NULL, aml_start, - aml_length, NULL, 3); - if (ACPI_FAILURE (status)) { - acpi_ds_delete_walk_state (walk_state); + status = acpi_ds_init_aml_walk(walk_state, op, NULL, aml_start, + aml_length, NULL, 3); + if (ACPI_FAILURE(status)) { + acpi_ds_delete_walk_state(walk_state); goto cleanup; } /* Mark this execution as a deferred opcode */ walk_state->deferred_node = node; - status = acpi_ps_parse_aml (walk_state); + status = acpi_ps_parse_aml(walk_state); -cleanup: - acpi_ps_delete_parse_tree (op); - return_ACPI_STATUS (status); + cleanup: + acpi_ps_delete_parse_tree(op); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_ds_get_buffer_field_arguments @@ -198,38 +187,36 @@ cleanup: ******************************************************************************/ acpi_status -acpi_ds_get_buffer_field_arguments ( - union acpi_operand_object *obj_desc) +acpi_ds_get_buffer_field_arguments(union acpi_operand_object *obj_desc) { - union acpi_operand_object *extra_desc; - struct acpi_namespace_node *node; - acpi_status status; - - - ACPI_FUNCTION_TRACE_PTR ("ds_get_buffer_field_arguments", obj_desc); + union acpi_operand_object *extra_desc; + struct acpi_namespace_node *node; + acpi_status status; + ACPI_FUNCTION_TRACE_PTR("ds_get_buffer_field_arguments", obj_desc); if (obj_desc->common.flags & AOPOBJ_DATA_VALID) { - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } /* Get the AML pointer (method object) and buffer_field node */ - extra_desc = acpi_ns_get_secondary_object (obj_desc); + extra_desc = acpi_ns_get_secondary_object(obj_desc); node = obj_desc->buffer_field.node; - ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname (ACPI_TYPE_BUFFER_FIELD, node, NULL)); - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s] buffer_field Arg Init\n", - acpi_ut_get_node_name (node))); + ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname + (ACPI_TYPE_BUFFER_FIELD, node, NULL)); + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "[%4.4s] buffer_field Arg Init\n", + acpi_ut_get_node_name(node))); /* Execute the AML code for the term_arg arguments */ - status = acpi_ds_execute_arguments (node, acpi_ns_get_parent_node (node), - extra_desc->extra.aml_length, extra_desc->extra.aml_start); - return_ACPI_STATUS (status); + status = acpi_ds_execute_arguments(node, acpi_ns_get_parent_node(node), + extra_desc->extra.aml_length, + extra_desc->extra.aml_start); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_ds_get_buffer_arguments @@ -243,40 +230,35 @@ acpi_ds_get_buffer_field_arguments ( * ******************************************************************************/ -acpi_status -acpi_ds_get_buffer_arguments ( - union acpi_operand_object *obj_desc) +acpi_status acpi_ds_get_buffer_arguments(union acpi_operand_object *obj_desc) { - struct acpi_namespace_node *node; - acpi_status status; - - - ACPI_FUNCTION_TRACE_PTR ("ds_get_buffer_arguments", obj_desc); + struct acpi_namespace_node *node; + acpi_status status; + ACPI_FUNCTION_TRACE_PTR("ds_get_buffer_arguments", obj_desc); if (obj_desc->common.flags & AOPOBJ_DATA_VALID) { - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } /* Get the Buffer node */ node = obj_desc->buffer.node; if (!node) { - ACPI_REPORT_ERROR (( - "No pointer back to NS node in buffer obj %p\n", obj_desc)); - return_ACPI_STATUS (AE_AML_INTERNAL); + ACPI_REPORT_ERROR(("No pointer back to NS node in buffer obj %p\n", obj_desc)); + return_ACPI_STATUS(AE_AML_INTERNAL); } - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Buffer Arg Init\n")); + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Buffer Arg Init\n")); /* Execute the AML code for the term_arg arguments */ - status = acpi_ds_execute_arguments (node, node, - obj_desc->buffer.aml_length, obj_desc->buffer.aml_start); - return_ACPI_STATUS (status); + status = acpi_ds_execute_arguments(node, node, + obj_desc->buffer.aml_length, + obj_desc->buffer.aml_start); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_ds_get_package_arguments @@ -290,40 +272,36 @@ acpi_ds_get_buffer_arguments ( * ******************************************************************************/ -acpi_status -acpi_ds_get_package_arguments ( - union acpi_operand_object *obj_desc) +acpi_status acpi_ds_get_package_arguments(union acpi_operand_object *obj_desc) { - struct acpi_namespace_node *node; - acpi_status status; - - - ACPI_FUNCTION_TRACE_PTR ("ds_get_package_arguments", obj_desc); + struct acpi_namespace_node *node; + acpi_status status; + ACPI_FUNCTION_TRACE_PTR("ds_get_package_arguments", obj_desc); if (obj_desc->common.flags & AOPOBJ_DATA_VALID) { - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } /* Get the Package node */ node = obj_desc->package.node; if (!node) { - ACPI_REPORT_ERROR (( - "No pointer back to NS node in package %p\n", obj_desc)); - return_ACPI_STATUS (AE_AML_INTERNAL); + ACPI_REPORT_ERROR(("No pointer back to NS node in package %p\n", + obj_desc)); + return_ACPI_STATUS(AE_AML_INTERNAL); } - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Package Arg Init\n")); + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Package Arg Init\n")); /* Execute the AML code for the term_arg arguments */ - status = acpi_ds_execute_arguments (node, node, - obj_desc->package.aml_length, obj_desc->package.aml_start); - return_ACPI_STATUS (status); + status = acpi_ds_execute_arguments(node, node, + obj_desc->package.aml_length, + obj_desc->package.aml_start); + return_ACPI_STATUS(status); } - /***************************************************************************** * * FUNCTION: acpi_ds_get_region_arguments @@ -337,44 +315,43 @@ acpi_ds_get_package_arguments ( * ****************************************************************************/ -acpi_status -acpi_ds_get_region_arguments ( - union acpi_operand_object *obj_desc) +acpi_status acpi_ds_get_region_arguments(union acpi_operand_object *obj_desc) { - struct acpi_namespace_node *node; - acpi_status status; - union acpi_operand_object *extra_desc; - - - ACPI_FUNCTION_TRACE_PTR ("ds_get_region_arguments", obj_desc); + struct acpi_namespace_node *node; + acpi_status status; + union acpi_operand_object *extra_desc; + ACPI_FUNCTION_TRACE_PTR("ds_get_region_arguments", obj_desc); if (obj_desc->region.flags & AOPOBJ_DATA_VALID) { - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - extra_desc = acpi_ns_get_secondary_object (obj_desc); + extra_desc = acpi_ns_get_secondary_object(obj_desc); if (!extra_desc) { - return_ACPI_STATUS (AE_NOT_EXIST); + return_ACPI_STATUS(AE_NOT_EXIST); } /* Get the Region node */ node = obj_desc->region.node; - ACPI_DEBUG_EXEC (acpi_ut_display_init_pathname (ACPI_TYPE_REGION, node, NULL)); + ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname + (ACPI_TYPE_REGION, node, NULL)); - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s] op_region Arg Init at AML %p\n", - acpi_ut_get_node_name (node), extra_desc->extra.aml_start)); + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, + "[%4.4s] op_region Arg Init at AML %p\n", + acpi_ut_get_node_name(node), + extra_desc->extra.aml_start)); /* Execute the argument AML */ - status = acpi_ds_execute_arguments (node, acpi_ns_get_parent_node (node), - extra_desc->extra.aml_length, extra_desc->extra.aml_start); - return_ACPI_STATUS (status); + status = acpi_ds_execute_arguments(node, acpi_ns_get_parent_node(node), + extra_desc->extra.aml_length, + extra_desc->extra.aml_start); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_ds_initialize_region @@ -387,23 +364,19 @@ acpi_ds_get_region_arguments ( * ******************************************************************************/ -acpi_status -acpi_ds_initialize_region ( - acpi_handle obj_handle) +acpi_status acpi_ds_initialize_region(acpi_handle obj_handle) { - union acpi_operand_object *obj_desc; - acpi_status status; + union acpi_operand_object *obj_desc; + acpi_status status; - - obj_desc = acpi_ns_get_attached_object (obj_handle); + obj_desc = acpi_ns_get_attached_object(obj_handle); /* Namespace is NOT locked */ - status = acpi_ev_initialize_region (obj_desc, FALSE); + status = acpi_ev_initialize_region(obj_desc, FALSE); return (status); } - /******************************************************************************* * * FUNCTION: acpi_ds_init_buffer_field @@ -422,30 +395,27 @@ acpi_ds_initialize_region ( ******************************************************************************/ static acpi_status -acpi_ds_init_buffer_field ( - u16 aml_opcode, - union acpi_operand_object *obj_desc, - union acpi_operand_object *buffer_desc, - union acpi_operand_object *offset_desc, - union acpi_operand_object *length_desc, - union acpi_operand_object *result_desc) +acpi_ds_init_buffer_field(u16 aml_opcode, + union acpi_operand_object *obj_desc, + union acpi_operand_object *buffer_desc, + union acpi_operand_object *offset_desc, + union acpi_operand_object *length_desc, + union acpi_operand_object *result_desc) { - u32 offset; - u32 bit_offset; - u32 bit_count; - u8 field_flags; - acpi_status status; - - - ACPI_FUNCTION_TRACE_PTR ("ds_init_buffer_field", obj_desc); + u32 offset; + u32 bit_offset; + u32 bit_count; + u8 field_flags; + acpi_status status; + ACPI_FUNCTION_TRACE_PTR("ds_init_buffer_field", obj_desc); /* Host object must be a Buffer */ - if (ACPI_GET_OBJECT_TYPE (buffer_desc) != ACPI_TYPE_BUFFER) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Target of Create Field is not a Buffer object - %s\n", - acpi_ut_get_object_type_name (buffer_desc))); + if (ACPI_GET_OBJECT_TYPE(buffer_desc) != ACPI_TYPE_BUFFER) { + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Target of Create Field is not a Buffer object - %s\n", + acpi_ut_get_object_type_name(buffer_desc))); status = AE_AML_OPERAND_TYPE; goto cleanup; @@ -456,11 +426,11 @@ acpi_ds_init_buffer_field ( * out as a name_string, and should therefore now be a NS node * after resolution in acpi_ex_resolve_operands(). */ - if (ACPI_GET_DESCRIPTOR_TYPE (result_desc) != ACPI_DESC_TYPE_NAMED) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "(%s) destination not a NS Node [%s]\n", - acpi_ps_get_opcode_name (aml_opcode), - acpi_ut_get_descriptor_name (result_desc))); + if (ACPI_GET_DESCRIPTOR_TYPE(result_desc) != ACPI_DESC_TYPE_NAMED) { + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "(%s) destination not a NS Node [%s]\n", + acpi_ps_get_opcode_name(aml_opcode), + acpi_ut_get_descriptor_name(result_desc))); status = AE_AML_OPERAND_TYPE; goto cleanup; @@ -478,13 +448,13 @@ acpi_ds_init_buffer_field ( field_flags = AML_FIELD_ACCESS_BYTE; bit_offset = offset; - bit_count = (u32) length_desc->integer.value; + bit_count = (u32) length_desc->integer.value; /* Must have a valid (>0) bit count */ if (bit_count == 0) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Attempt to create_field of length 0\n")); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Attempt to create_field of length 0\n")); status = AE_AML_OPERAND_VALUE; goto cleanup; } @@ -495,7 +465,7 @@ acpi_ds_init_buffer_field ( /* Offset is in bits, Field is one bit */ bit_offset = offset; - bit_count = 1; + bit_count = 1; field_flags = AML_FIELD_ACCESS_BYTE; break; @@ -504,7 +474,7 @@ acpi_ds_init_buffer_field ( /* Offset is in bytes, field is one byte */ bit_offset = 8 * offset; - bit_count = 8; + bit_count = 8; field_flags = AML_FIELD_ACCESS_BYTE; break; @@ -513,7 +483,7 @@ acpi_ds_init_buffer_field ( /* Offset is in bytes, field is one word */ bit_offset = 8 * offset; - bit_count = 16; + bit_count = 16; field_flags = AML_FIELD_ACCESS_WORD; break; @@ -522,7 +492,7 @@ acpi_ds_init_buffer_field ( /* Offset is in bytes, field is one dword */ bit_offset = 8 * offset; - bit_count = 32; + bit_count = 32; field_flags = AML_FIELD_ACCESS_DWORD; break; @@ -531,29 +501,29 @@ acpi_ds_init_buffer_field ( /* Offset is in bytes, field is one qword */ bit_offset = 8 * offset; - bit_count = 64; + bit_count = 64; field_flags = AML_FIELD_ACCESS_QWORD; break; default: - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Unknown field creation opcode %02x\n", - aml_opcode)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Unknown field creation opcode %02x\n", + aml_opcode)); status = AE_AML_BAD_OPCODE; goto cleanup; } /* Entire field must fit within the current length of the buffer */ - if ((bit_offset + bit_count) > - (8 * (u32) buffer_desc->buffer.length)) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Field [%4.4s] size %d exceeds Buffer [%4.4s] size %d (bits)\n", - acpi_ut_get_node_name (result_desc), - bit_offset + bit_count, - acpi_ut_get_node_name (buffer_desc->buffer.node), - 8 * (u32) buffer_desc->buffer.length)); + if ((bit_offset + bit_count) > (8 * (u32) buffer_desc->buffer.length)) { + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Field [%4.4s] size %d exceeds Buffer [%4.4s] size %d (bits)\n", + acpi_ut_get_node_name(result_desc), + bit_offset + bit_count, + acpi_ut_get_node_name(buffer_desc->buffer. + node), + 8 * (u32) buffer_desc->buffer.length)); status = AE_AML_BUFFER_LIMIT; goto cleanup; } @@ -563,9 +533,9 @@ acpi_ds_init_buffer_field ( * For field_flags, use LOCK_RULE = 0 (NO_LOCK), * UPDATE_RULE = 0 (UPDATE_PRESERVE) */ - status = acpi_ex_prep_common_field_object (obj_desc, field_flags, 0, - bit_offset, bit_count); - if (ACPI_FAILURE (status)) { + status = acpi_ex_prep_common_field_object(obj_desc, field_flags, 0, + bit_offset, bit_count); + if (ACPI_FAILURE(status)) { goto cleanup; } @@ -574,35 +544,33 @@ acpi_ds_init_buffer_field ( /* Reference count for buffer_desc inherits obj_desc count */ buffer_desc->common.reference_count = (u16) - (buffer_desc->common.reference_count + obj_desc->common.reference_count); + (buffer_desc->common.reference_count + + obj_desc->common.reference_count); - -cleanup: + cleanup: /* Always delete the operands */ - acpi_ut_remove_reference (offset_desc); - acpi_ut_remove_reference (buffer_desc); + acpi_ut_remove_reference(offset_desc); + acpi_ut_remove_reference(buffer_desc); if (aml_opcode == AML_CREATE_FIELD_OP) { - acpi_ut_remove_reference (length_desc); + acpi_ut_remove_reference(length_desc); } /* On failure, delete the result descriptor */ - if (ACPI_FAILURE (status)) { - acpi_ut_remove_reference (result_desc); /* Result descriptor */ - } - else { + if (ACPI_FAILURE(status)) { + acpi_ut_remove_reference(result_desc); /* Result descriptor */ + } else { /* Now the address and length are valid for this buffer_field */ obj_desc->buffer_field.flags |= AOPOBJ_DATA_VALID; } - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_ds_eval_buffer_field_operands @@ -618,24 +586,21 @@ cleanup: ******************************************************************************/ acpi_status -acpi_ds_eval_buffer_field_operands ( - struct acpi_walk_state *walk_state, - union acpi_parse_object *op) +acpi_ds_eval_buffer_field_operands(struct acpi_walk_state *walk_state, + union acpi_parse_object *op) { - acpi_status status; - union acpi_operand_object *obj_desc; - struct acpi_namespace_node *node; - union acpi_parse_object *next_op; - - - ACPI_FUNCTION_TRACE_PTR ("ds_eval_buffer_field_operands", op); + acpi_status status; + union acpi_operand_object *obj_desc; + struct acpi_namespace_node *node; + union acpi_parse_object *next_op; + ACPI_FUNCTION_TRACE_PTR("ds_eval_buffer_field_operands", op); /* * This is where we evaluate the address and length fields of the * create_xxx_field declaration */ - node = op->common.node; + node = op->common.node; /* next_op points to the op that holds the Buffer */ @@ -643,30 +608,32 @@ acpi_ds_eval_buffer_field_operands ( /* Evaluate/create the address and length operands */ - status = acpi_ds_create_operands (walk_state, next_op); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ds_create_operands(walk_state, next_op); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } - obj_desc = acpi_ns_get_attached_object (node); + obj_desc = acpi_ns_get_attached_object(node); if (!obj_desc) { - return_ACPI_STATUS (AE_NOT_EXIST); + return_ACPI_STATUS(AE_NOT_EXIST); } /* Resolve the operands */ - status = acpi_ex_resolve_operands (op->common.aml_opcode, - ACPI_WALK_OPERANDS, walk_state); + status = acpi_ex_resolve_operands(op->common.aml_opcode, + ACPI_WALK_OPERANDS, walk_state); - ACPI_DUMP_OPERANDS (ACPI_WALK_OPERANDS, ACPI_IMODE_EXECUTE, - acpi_ps_get_opcode_name (op->common.aml_opcode), - walk_state->num_operands, "after acpi_ex_resolve_operands"); + ACPI_DUMP_OPERANDS(ACPI_WALK_OPERANDS, ACPI_IMODE_EXECUTE, + acpi_ps_get_opcode_name(op->common.aml_opcode), + walk_state->num_operands, + "after acpi_ex_resolve_operands"); - if (ACPI_FAILURE (status)) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "(%s) bad operand(s) (%X)\n", - acpi_ps_get_opcode_name (op->common.aml_opcode), status)); + if (ACPI_FAILURE(status)) { + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "(%s) bad operand(s) (%X)\n", + acpi_ps_get_opcode_name(op->common. + aml_opcode), status)); - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } /* Initialize the Buffer Field */ @@ -674,22 +641,25 @@ acpi_ds_eval_buffer_field_operands ( if (op->common.aml_opcode == AML_CREATE_FIELD_OP) { /* NOTE: Slightly different operands for this opcode */ - status = acpi_ds_init_buffer_field (op->common.aml_opcode, obj_desc, - walk_state->operands[0], walk_state->operands[1], - walk_state->operands[2], walk_state->operands[3]); - } - else { + status = + acpi_ds_init_buffer_field(op->common.aml_opcode, obj_desc, + walk_state->operands[0], + walk_state->operands[1], + walk_state->operands[2], + walk_state->operands[3]); + } else { /* All other, create_xxx_field opcodes */ - status = acpi_ds_init_buffer_field (op->common.aml_opcode, obj_desc, - walk_state->operands[0], walk_state->operands[1], - NULL, walk_state->operands[2]); + status = + acpi_ds_init_buffer_field(op->common.aml_opcode, obj_desc, + walk_state->operands[0], + walk_state->operands[1], NULL, + walk_state->operands[2]); } - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_ds_eval_region_operands @@ -705,25 +675,22 @@ acpi_ds_eval_buffer_field_operands ( ******************************************************************************/ acpi_status -acpi_ds_eval_region_operands ( - struct acpi_walk_state *walk_state, - union acpi_parse_object *op) +acpi_ds_eval_region_operands(struct acpi_walk_state *walk_state, + union acpi_parse_object *op) { - acpi_status status; - union acpi_operand_object *obj_desc; - union acpi_operand_object *operand_desc; - struct acpi_namespace_node *node; - union acpi_parse_object *next_op; - - - ACPI_FUNCTION_TRACE_PTR ("ds_eval_region_operands", op); + acpi_status status; + union acpi_operand_object *obj_desc; + union acpi_operand_object *operand_desc; + struct acpi_namespace_node *node; + union acpi_parse_object *next_op; + ACPI_FUNCTION_TRACE_PTR("ds_eval_region_operands", op); /* * This is where we evaluate the address and length fields of the * op_region declaration */ - node = op->common.node; + node = op->common.node; /* next_op points to the op that holds the space_iD */ @@ -735,26 +702,26 @@ acpi_ds_eval_region_operands ( /* Evaluate/create the address and length operands */ - status = acpi_ds_create_operands (walk_state, next_op); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ds_create_operands(walk_state, next_op); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* Resolve the length and address operands to numbers */ - status = acpi_ex_resolve_operands (op->common.aml_opcode, - ACPI_WALK_OPERANDS, walk_state); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ex_resolve_operands(op->common.aml_opcode, + ACPI_WALK_OPERANDS, walk_state); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } - ACPI_DUMP_OPERANDS (ACPI_WALK_OPERANDS, ACPI_IMODE_EXECUTE, - acpi_ps_get_opcode_name (op->common.aml_opcode), - 1, "after acpi_ex_resolve_operands"); + ACPI_DUMP_OPERANDS(ACPI_WALK_OPERANDS, ACPI_IMODE_EXECUTE, + acpi_ps_get_opcode_name(op->common.aml_opcode), + 1, "after acpi_ex_resolve_operands"); - obj_desc = acpi_ns_get_attached_object (node); + obj_desc = acpi_ns_get_attached_object(node); if (!obj_desc) { - return_ACPI_STATUS (AE_NOT_EXIST); + return_ACPI_STATUS(AE_NOT_EXIST); } /* @@ -764,7 +731,7 @@ acpi_ds_eval_region_operands ( operand_desc = walk_state->operands[walk_state->num_operands - 1]; obj_desc->region.length = (u32) operand_desc->integer.value; - acpi_ut_remove_reference (operand_desc); + acpi_ut_remove_reference(operand_desc); /* * Get the address and save it @@ -773,22 +740,21 @@ acpi_ds_eval_region_operands ( operand_desc = walk_state->operands[walk_state->num_operands - 2]; obj_desc->region.address = (acpi_physical_address) - operand_desc->integer.value; - acpi_ut_remove_reference (operand_desc); + operand_desc->integer.value; + acpi_ut_remove_reference(operand_desc); - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "rgn_obj %p Addr %8.8X%8.8X Len %X\n", - obj_desc, - ACPI_FORMAT_UINT64 (obj_desc->region.address), - obj_desc->region.length)); + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "rgn_obj %p Addr %8.8X%8.8X Len %X\n", + obj_desc, + ACPI_FORMAT_UINT64(obj_desc->region.address), + obj_desc->region.length)); /* Now the address and length are valid for this opregion */ obj_desc->region.flags |= AOPOBJ_DATA_VALID; - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_ds_eval_data_object_operands @@ -805,46 +771,44 @@ acpi_ds_eval_region_operands ( ******************************************************************************/ acpi_status -acpi_ds_eval_data_object_operands ( - struct acpi_walk_state *walk_state, - union acpi_parse_object *op, - union acpi_operand_object *obj_desc) +acpi_ds_eval_data_object_operands(struct acpi_walk_state *walk_state, + union acpi_parse_object *op, + union acpi_operand_object *obj_desc) { - acpi_status status; - union acpi_operand_object *arg_desc; - u32 length; - - - ACPI_FUNCTION_TRACE ("ds_eval_data_object_operands"); + acpi_status status; + union acpi_operand_object *arg_desc; + u32 length; + ACPI_FUNCTION_TRACE("ds_eval_data_object_operands"); /* The first operand (for all of these data objects) is the length */ - status = acpi_ds_create_operand (walk_state, op->common.value.arg, 1); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ds_create_operand(walk_state, op->common.value.arg, 1); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } - status = acpi_ex_resolve_operands (walk_state->opcode, - &(walk_state->operands [walk_state->num_operands -1]), - walk_state); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ex_resolve_operands(walk_state->opcode, + &(walk_state-> + operands[walk_state->num_operands - + 1]), walk_state); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* Extract length operand */ - arg_desc = walk_state->operands [walk_state->num_operands - 1]; + arg_desc = walk_state->operands[walk_state->num_operands - 1]; length = (u32) arg_desc->integer.value; /* Cleanup for length operand */ - status = acpi_ds_obj_stack_pop (1, walk_state); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ds_obj_stack_pop(1, walk_state); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } - acpi_ut_remove_reference (arg_desc); + acpi_ut_remove_reference(arg_desc); /* * Create the actual data object @@ -852,37 +816,42 @@ acpi_ds_eval_data_object_operands ( switch (op->common.aml_opcode) { case AML_BUFFER_OP: - status = acpi_ds_build_internal_buffer_obj (walk_state, op, length, &obj_desc); + status = + acpi_ds_build_internal_buffer_obj(walk_state, op, length, + &obj_desc); break; case AML_PACKAGE_OP: case AML_VAR_PACKAGE_OP: - status = acpi_ds_build_internal_package_obj (walk_state, op, length, &obj_desc); + status = + acpi_ds_build_internal_package_obj(walk_state, op, length, + &obj_desc); break; default: - return_ACPI_STATUS (AE_AML_BAD_OPCODE); + return_ACPI_STATUS(AE_AML_BAD_OPCODE); } - if (ACPI_SUCCESS (status)) { + if (ACPI_SUCCESS(status)) { /* * Return the object in the walk_state, unless the parent is a package - * in this case, the return object will be stored in the parse tree * for the package. */ if ((!op->common.parent) || - ((op->common.parent->common.aml_opcode != AML_PACKAGE_OP) && - (op->common.parent->common.aml_opcode != AML_VAR_PACKAGE_OP) && - (op->common.parent->common.aml_opcode != AML_NAME_OP))) { + ((op->common.parent->common.aml_opcode != AML_PACKAGE_OP) && + (op->common.parent->common.aml_opcode != + AML_VAR_PACKAGE_OP) + && (op->common.parent->common.aml_opcode != + AML_NAME_OP))) { walk_state->result_obj = obj_desc; } } - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_ds_exec_begin_control_op @@ -898,19 +867,16 @@ acpi_ds_eval_data_object_operands ( ******************************************************************************/ acpi_status -acpi_ds_exec_begin_control_op ( - struct acpi_walk_state *walk_state, - union acpi_parse_object *op) +acpi_ds_exec_begin_control_op(struct acpi_walk_state *walk_state, + union acpi_parse_object *op) { - acpi_status status = AE_OK; - union acpi_generic_state *control_state; - - - ACPI_FUNCTION_NAME ("ds_exec_begin_control_op"); + acpi_status status = AE_OK; + union acpi_generic_state *control_state; + ACPI_FUNCTION_NAME("ds_exec_begin_control_op"); - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p Opcode=%2.2X State=%p\n", op, - op->common.aml_opcode, walk_state)); + ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Op=%p Opcode=%2.2X State=%p\n", op, + op->common.aml_opcode, walk_state)); switch (op->common.aml_opcode) { case AML_IF_OP: @@ -921,7 +887,7 @@ acpi_ds_exec_begin_control_op ( * constructs. We need to manage these as a stack, in order * to handle nesting. */ - control_state = acpi_ut_create_control_state (); + control_state = acpi_ut_create_control_state(); if (!control_state) { status = AE_NO_MEMORY; break; @@ -930,14 +896,16 @@ acpi_ds_exec_begin_control_op ( * Save a pointer to the predicate for multiple executions * of a loop */ - control_state->control.aml_predicate_start = walk_state->parser_state.aml - 1; - control_state->control.package_end = walk_state->parser_state.pkg_end; + control_state->control.aml_predicate_start = + walk_state->parser_state.aml - 1; + control_state->control.package_end = + walk_state->parser_state.pkg_end; control_state->control.opcode = op->common.aml_opcode; - /* Push the control state on this walk's control stack */ - acpi_ut_push_generic_state (&walk_state->control_state, control_state); + acpi_ut_push_generic_state(&walk_state->control_state, + control_state); break; case AML_ELSE_OP: @@ -962,7 +930,6 @@ acpi_ds_exec_begin_control_op ( return (status); } - /******************************************************************************* * * FUNCTION: acpi_ds_exec_end_control_op @@ -978,46 +945,42 @@ acpi_ds_exec_begin_control_op ( ******************************************************************************/ acpi_status -acpi_ds_exec_end_control_op ( - struct acpi_walk_state *walk_state, - union acpi_parse_object *op) +acpi_ds_exec_end_control_op(struct acpi_walk_state * walk_state, + union acpi_parse_object * op) { - acpi_status status = AE_OK; - union acpi_generic_state *control_state; - - - ACPI_FUNCTION_NAME ("ds_exec_end_control_op"); + acpi_status status = AE_OK; + union acpi_generic_state *control_state; + ACPI_FUNCTION_NAME("ds_exec_end_control_op"); switch (op->common.aml_opcode) { case AML_IF_OP: - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "[IF_OP] Op=%p\n", op)); + ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "[IF_OP] Op=%p\n", op)); /* * Save the result of the predicate in case there is an * ELSE to come */ walk_state->last_predicate = - (u8) walk_state->control_state->common.value; + (u8) walk_state->control_state->common.value; /* * Pop the control state that was created at the start * of the IF and free it */ - control_state = acpi_ut_pop_generic_state (&walk_state->control_state); - acpi_ut_delete_generic_state (control_state); + control_state = + acpi_ut_pop_generic_state(&walk_state->control_state); + acpi_ut_delete_generic_state(control_state); break; - case AML_ELSE_OP: break; - case AML_WHILE_OP: - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "[WHILE_OP] Op=%p\n", op)); + ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "[WHILE_OP] Op=%p\n", op)); if (walk_state->control_state->common.value) { /* Predicate was true, go back and evaluate it again! */ @@ -1025,22 +988,24 @@ acpi_ds_exec_end_control_op ( status = AE_CTRL_PENDING; } - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "[WHILE_OP] termination! Op=%p\n",op)); + ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, + "[WHILE_OP] termination! Op=%p\n", op)); /* Pop this control state and free it */ - control_state = acpi_ut_pop_generic_state (&walk_state->control_state); + control_state = + acpi_ut_pop_generic_state(&walk_state->control_state); - walk_state->aml_last_while = control_state->control.aml_predicate_start; - acpi_ut_delete_generic_state (control_state); + walk_state->aml_last_while = + control_state->control.aml_predicate_start; + acpi_ut_delete_generic_state(control_state); break; - case AML_RETURN_OP: - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "[RETURN_OP] Op=%p Arg=%p\n",op, op->common.value.arg)); + ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, + "[RETURN_OP] Op=%p Arg=%p\n", op, + op->common.value.arg)); /* * One optional operand -- the return value @@ -1050,12 +1015,14 @@ acpi_ds_exec_end_control_op ( if (op->common.value.arg) { /* Since we have a real Return(), delete any implicit return */ - acpi_ds_clear_implicit_return (walk_state); + acpi_ds_clear_implicit_return(walk_state); /* Return statement has an immediate operand */ - status = acpi_ds_create_operands (walk_state, op->common.value.arg); - if (ACPI_FAILURE (status)) { + status = + acpi_ds_create_operands(walk_state, + op->common.value.arg); + if (ACPI_FAILURE(status)) { return (status); } @@ -1064,8 +1031,10 @@ acpi_ds_exec_end_control_op ( * an arg or local), resolve it now because it may * cease to exist at the end of the method. */ - status = acpi_ex_resolve_to_value (&walk_state->operands [0], walk_state); - if (ACPI_FAILURE (status)) { + status = + acpi_ex_resolve_to_value(&walk_state->operands[0], + walk_state); + if (ACPI_FAILURE(status)) { return (status); } @@ -1075,12 +1044,11 @@ acpi_ds_exec_end_control_op ( * is set to anything other than zero! */ walk_state->return_desc = walk_state->operands[0]; - } - else if ((walk_state->results) && - (walk_state->results->results.num_results > 0)) { + } else if ((walk_state->results) && + (walk_state->results->results.num_results > 0)) { /* Since we have a real Return(), delete any implicit return */ - acpi_ds_clear_implicit_return (walk_state); + acpi_ds_clear_implicit_return(walk_state); /* * The return value has come from a previous calculation. @@ -1091,67 +1059,78 @@ acpi_ds_exec_end_control_op ( * * Allow references created by the Index operator to return unchanged. */ - if ((ACPI_GET_DESCRIPTOR_TYPE (walk_state->results->results.obj_desc[0]) == ACPI_DESC_TYPE_OPERAND) && - (ACPI_GET_OBJECT_TYPE (walk_state->results->results.obj_desc [0]) == ACPI_TYPE_LOCAL_REFERENCE) && - ((walk_state->results->results.obj_desc [0])->reference.opcode != AML_INDEX_OP)) { - status = acpi_ex_resolve_to_value (&walk_state->results->results.obj_desc [0], walk_state); - if (ACPI_FAILURE (status)) { + if ((ACPI_GET_DESCRIPTOR_TYPE + (walk_state->results->results.obj_desc[0]) == + ACPI_DESC_TYPE_OPERAND) + && + (ACPI_GET_OBJECT_TYPE + (walk_state->results->results.obj_desc[0]) == + ACPI_TYPE_LOCAL_REFERENCE) + && ((walk_state->results->results.obj_desc[0])-> + reference.opcode != AML_INDEX_OP)) { + status = + acpi_ex_resolve_to_value(&walk_state-> + results->results. + obj_desc[0], + walk_state); + if (ACPI_FAILURE(status)) { return (status); } } - walk_state->return_desc = walk_state->results->results.obj_desc [0]; - } - else { + walk_state->return_desc = + walk_state->results->results.obj_desc[0]; + } else { /* No return operand */ if (walk_state->num_operands) { - acpi_ut_remove_reference (walk_state->operands [0]); + acpi_ut_remove_reference(walk_state-> + operands[0]); } - walk_state->operands [0] = NULL; - walk_state->num_operands = 0; - walk_state->return_desc = NULL; + walk_state->operands[0] = NULL; + walk_state->num_operands = 0; + walk_state->return_desc = NULL; } - - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "Completed RETURN_OP State=%p, ret_val=%p\n", - walk_state, walk_state->return_desc)); + ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, + "Completed RETURN_OP State=%p, ret_val=%p\n", + walk_state, walk_state->return_desc)); /* End the control method execution right now */ status = AE_CTRL_TERMINATE; break; - case AML_NOOP_OP: /* Just do nothing! */ break; - case AML_BREAK_POINT_OP: /* Call up to the OS service layer to handle this */ - status = acpi_os_signal (ACPI_SIGNAL_BREAKPOINT, "Executed AML Breakpoint opcode"); + status = + acpi_os_signal(ACPI_SIGNAL_BREAKPOINT, + "Executed AML Breakpoint opcode"); /* If and when it returns, all done. */ break; - case AML_BREAK_OP: - case AML_CONTINUE_OP: /* ACPI 2.0 */ - + case AML_CONTINUE_OP: /* ACPI 2.0 */ /* Pop and delete control states until we find a while */ while (walk_state->control_state && - (walk_state->control_state->control.opcode != AML_WHILE_OP)) { - control_state = acpi_ut_pop_generic_state (&walk_state->control_state); - acpi_ut_delete_generic_state (control_state); + (walk_state->control_state->control.opcode != + AML_WHILE_OP)) { + control_state = + acpi_ut_pop_generic_state(&walk_state-> + control_state); + acpi_ut_delete_generic_state(control_state); } /* No while found? */ @@ -1162,23 +1141,23 @@ acpi_ds_exec_end_control_op ( /* Was: walk_state->aml_last_while = walk_state->control_state->Control.aml_predicate_start; */ - walk_state->aml_last_while = walk_state->control_state->control.package_end; + walk_state->aml_last_while = + walk_state->control_state->control.package_end; /* Return status depending on opcode */ if (op->common.aml_opcode == AML_BREAK_OP) { status = AE_CTRL_BREAK; - } - else { + } else { status = AE_CTRL_CONTINUE; } break; - default: - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown control opcode=%X Op=%p\n", - op->common.aml_opcode, op)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Unknown control opcode=%X Op=%p\n", + op->common.aml_opcode, op)); status = AE_AML_BAD_OPCODE; break; @@ -1186,4 +1165,3 @@ acpi_ds_exec_end_control_op ( return (status); } - diff --git a/drivers/acpi/dispatcher/dsutils.c b/drivers/acpi/dispatcher/dsutils.c index 9613349ac31..83ae1c1aa28 100644 --- a/drivers/acpi/dispatcher/dsutils.c +++ b/drivers/acpi/dispatcher/dsutils.c @@ -41,7 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include #include #include @@ -51,8 +50,7 @@ #include #define _COMPONENT ACPI_DISPATCHER - ACPI_MODULE_NAME ("dsutils") - +ACPI_MODULE_NAME("dsutils") /******************************************************************************* * @@ -68,13 +66,9 @@ * parent method exits.) * ******************************************************************************/ - -void -acpi_ds_clear_implicit_return ( - struct acpi_walk_state *walk_state) +void acpi_ds_clear_implicit_return(struct acpi_walk_state *walk_state) { - ACPI_FUNCTION_NAME ("ds_clear_implicit_return"); - + ACPI_FUNCTION_NAME("ds_clear_implicit_return"); /* * Slack must be enabled for this feature @@ -89,16 +83,15 @@ acpi_ds_clear_implicit_return ( * complex statements, the implicit return value can be * bubbled up several levels. */ - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "Removing reference on stale implicit return obj %p\n", - walk_state->implicit_return_obj)); + ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, + "Removing reference on stale implicit return obj %p\n", + walk_state->implicit_return_obj)); - acpi_ut_remove_reference (walk_state->implicit_return_obj); + acpi_ut_remove_reference(walk_state->implicit_return_obj); walk_state->implicit_return_obj = NULL; } } - #ifndef ACPI_NO_METHOD_EXECUTION /******************************************************************************* * @@ -119,27 +112,22 @@ acpi_ds_clear_implicit_return ( ******************************************************************************/ u8 -acpi_ds_do_implicit_return ( - union acpi_operand_object *return_desc, - struct acpi_walk_state *walk_state, - u8 add_reference) +acpi_ds_do_implicit_return(union acpi_operand_object *return_desc, + struct acpi_walk_state *walk_state, u8 add_reference) { - ACPI_FUNCTION_NAME ("ds_do_implicit_return"); - + ACPI_FUNCTION_NAME("ds_do_implicit_return"); /* * Slack must be enabled for this feature, and we must * have a valid return object */ - if ((!acpi_gbl_enable_interpreter_slack) || - (!return_desc)) { + if ((!acpi_gbl_enable_interpreter_slack) || (!return_desc)) { return (FALSE); } - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "Result %p will be implicitly returned; Prev=%p\n", - return_desc, - walk_state->implicit_return_obj)); + ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, + "Result %p will be implicitly returned; Prev=%p\n", + return_desc, walk_state->implicit_return_obj)); /* * Delete any "stale" implicit return value first. However, in @@ -151,20 +139,19 @@ acpi_ds_do_implicit_return ( if (walk_state->implicit_return_obj == return_desc) { return (TRUE); } - acpi_ds_clear_implicit_return (walk_state); + acpi_ds_clear_implicit_return(walk_state); } /* Save the implicit return value, add a reference if requested */ walk_state->implicit_return_obj = return_desc; if (add_reference) { - acpi_ut_add_reference (return_desc); + acpi_ut_add_reference(return_desc); } return (TRUE); } - /******************************************************************************* * * FUNCTION: acpi_ds_is_result_used @@ -179,20 +166,18 @@ acpi_ds_do_implicit_return ( ******************************************************************************/ u8 -acpi_ds_is_result_used ( - union acpi_parse_object *op, - struct acpi_walk_state *walk_state) +acpi_ds_is_result_used(union acpi_parse_object * op, + struct acpi_walk_state * walk_state) { - const struct acpi_opcode_info *parent_info; - - ACPI_FUNCTION_TRACE_PTR ("ds_is_result_used", op); + const struct acpi_opcode_info *parent_info; + ACPI_FUNCTION_TRACE_PTR("ds_is_result_used", op); /* Must have both an Op and a Result Object */ if (!op) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null Op\n")); - return_VALUE (TRUE); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Null Op\n")); + return_VALUE(TRUE); } /* @@ -204,7 +189,8 @@ acpi_ds_is_result_used ( * NOTE: this is optional because the ASL language does not actually * support this behavior. */ - (void) acpi_ds_do_implicit_return (walk_state->result_obj, walk_state, TRUE); + (void)acpi_ds_do_implicit_return(walk_state->result_obj, walk_state, + TRUE); /* * Now determine if the parent will use the result @@ -215,22 +201,24 @@ acpi_ds_is_result_used ( * via execute_control_method has a scope_op as the parent. */ if ((!op->common.parent) || - (op->common.parent->common.aml_opcode == AML_SCOPE_OP)) { + (op->common.parent->common.aml_opcode == AML_SCOPE_OP)) { /* No parent, the return value cannot possibly be used */ - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "At Method level, result of [%s] not used\n", - acpi_ps_get_opcode_name (op->common.aml_opcode))); - return_VALUE (FALSE); + ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, + "At Method level, result of [%s] not used\n", + acpi_ps_get_opcode_name(op->common. + aml_opcode))); + return_VALUE(FALSE); } /* Get info on the parent. The root_op is AML_SCOPE */ - parent_info = acpi_ps_get_opcode_info (op->common.parent->common.aml_opcode); + parent_info = + acpi_ps_get_opcode_info(op->common.parent->common.aml_opcode); if (parent_info->class == AML_CLASS_UNKNOWN) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Unknown parent opcode. Op=%p\n", op)); - return_VALUE (FALSE); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Unknown parent opcode. Op=%p\n", op)); + return_VALUE(FALSE); } /* @@ -256,8 +244,10 @@ acpi_ds_is_result_used ( * If we are executing the predicate AND this is the predicate op, * we will use the return value */ - if ((walk_state->control_state->common.state == ACPI_CONTROL_PREDICATE_EXECUTING) && - (walk_state->control_state->control.predicate_op == op)) { + if ((walk_state->control_state->common.state == + ACPI_CONTROL_PREDICATE_EXECUTING) + && (walk_state->control_state->control. + predicate_op == op)) { goto result_used; } break; @@ -271,7 +261,6 @@ acpi_ds_is_result_used ( goto result_not_used; - case AML_CLASS_CREATE: /* @@ -280,15 +269,16 @@ acpi_ds_is_result_used ( */ goto result_used; - case AML_CLASS_NAMED_OBJECT: - if ((op->common.parent->common.aml_opcode == AML_REGION_OP) || - (op->common.parent->common.aml_opcode == AML_DATA_REGION_OP) || - (op->common.parent->common.aml_opcode == AML_PACKAGE_OP) || - (op->common.parent->common.aml_opcode == AML_VAR_PACKAGE_OP) || - (op->common.parent->common.aml_opcode == AML_BUFFER_OP) || - (op->common.parent->common.aml_opcode == AML_INT_EVAL_SUBTREE_OP)) { + if ((op->common.parent->common.aml_opcode == AML_REGION_OP) || + (op->common.parent->common.aml_opcode == AML_DATA_REGION_OP) + || (op->common.parent->common.aml_opcode == AML_PACKAGE_OP) + || (op->common.parent->common.aml_opcode == + AML_VAR_PACKAGE_OP) + || (op->common.parent->common.aml_opcode == AML_BUFFER_OP) + || (op->common.parent->common.aml_opcode == + AML_INT_EVAL_SUBTREE_OP)) { /* * These opcodes allow term_arg(s) as operands and therefore * the operands can be method calls. The result is used. @@ -298,7 +288,6 @@ acpi_ds_is_result_used ( goto result_not_used; - default: /* @@ -308,26 +297,25 @@ acpi_ds_is_result_used ( goto result_used; } + result_used: + ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, + "Result of [%s] used by Parent [%s] Op=%p\n", + acpi_ps_get_opcode_name(op->common.aml_opcode), + acpi_ps_get_opcode_name(op->common.parent->common. + aml_opcode), op)); -result_used: - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "Result of [%s] used by Parent [%s] Op=%p\n", - acpi_ps_get_opcode_name (op->common.aml_opcode), - acpi_ps_get_opcode_name (op->common.parent->common.aml_opcode), op)); - - return_VALUE (TRUE); - + return_VALUE(TRUE); -result_not_used: - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "Result of [%s] not used by Parent [%s] Op=%p\n", - acpi_ps_get_opcode_name (op->common.aml_opcode), - acpi_ps_get_opcode_name (op->common.parent->common.aml_opcode), op)); + result_not_used: + ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, + "Result of [%s] not used by Parent [%s] Op=%p\n", + acpi_ps_get_opcode_name(op->common.aml_opcode), + acpi_ps_get_opcode_name(op->common.parent->common. + aml_opcode), op)); - return_VALUE (FALSE); + return_VALUE(FALSE); } - /******************************************************************************* * * FUNCTION: acpi_ds_delete_result_if_not_used @@ -346,20 +334,17 @@ result_not_used: ******************************************************************************/ void -acpi_ds_delete_result_if_not_used ( - union acpi_parse_object *op, - union acpi_operand_object *result_obj, - struct acpi_walk_state *walk_state) +acpi_ds_delete_result_if_not_used(union acpi_parse_object *op, + union acpi_operand_object *result_obj, + struct acpi_walk_state *walk_state) { - union acpi_operand_object *obj_desc; - acpi_status status; - - - ACPI_FUNCTION_TRACE_PTR ("ds_delete_result_if_not_used", result_obj); + union acpi_operand_object *obj_desc; + acpi_status status; + ACPI_FUNCTION_TRACE_PTR("ds_delete_result_if_not_used", result_obj); if (!op) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null Op\n")); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Null Op\n")); return_VOID; } @@ -367,19 +352,18 @@ acpi_ds_delete_result_if_not_used ( return_VOID; } - if (!acpi_ds_is_result_used (op, walk_state)) { + if (!acpi_ds_is_result_used(op, walk_state)) { /* Must pop the result stack (obj_desc should be equal to result_obj) */ - status = acpi_ds_result_pop (&obj_desc, walk_state); - if (ACPI_SUCCESS (status)) { - acpi_ut_remove_reference (result_obj); + status = acpi_ds_result_pop(&obj_desc, walk_state); + if (ACPI_SUCCESS(status)) { + acpi_ut_remove_reference(result_obj); } } return_VOID; } - /******************************************************************************* * * FUNCTION: acpi_ds_resolve_operands @@ -394,16 +378,12 @@ acpi_ds_delete_result_if_not_used ( * ******************************************************************************/ -acpi_status -acpi_ds_resolve_operands ( - struct acpi_walk_state *walk_state) +acpi_status acpi_ds_resolve_operands(struct acpi_walk_state *walk_state) { - u32 i; - acpi_status status = AE_OK; - - - ACPI_FUNCTION_TRACE_PTR ("ds_resolve_operands", walk_state); + u32 i; + acpi_status status = AE_OK; + ACPI_FUNCTION_TRACE_PTR("ds_resolve_operands", walk_state); /* * Attempt to resolve each of the valid operands @@ -411,16 +391,17 @@ acpi_ds_resolve_operands ( * that the actual objects are passed, not copies of the objects. */ for (i = 0; i < walk_state->num_operands; i++) { - status = acpi_ex_resolve_to_value (&walk_state->operands[i], walk_state); - if (ACPI_FAILURE (status)) { + status = + acpi_ex_resolve_to_value(&walk_state->operands[i], + walk_state); + if (ACPI_FAILURE(status)) { break; } } - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_ds_clear_operands @@ -433,15 +414,11 @@ acpi_ds_resolve_operands ( * ******************************************************************************/ -void -acpi_ds_clear_operands ( - struct acpi_walk_state *walk_state) +void acpi_ds_clear_operands(struct acpi_walk_state *walk_state) { - u32 i; - - - ACPI_FUNCTION_TRACE_PTR ("ds_clear_operands", walk_state); + u32 i; + ACPI_FUNCTION_TRACE_PTR("ds_clear_operands", walk_state); /* Remove a reference on each operand on the stack */ @@ -450,7 +427,7 @@ acpi_ds_clear_operands ( * Remove a reference to all operands, including both * "Arguments" and "Targets". */ - acpi_ut_remove_reference (walk_state->operands[i]); + acpi_ut_remove_reference(walk_state->operands[i]); walk_state->operands[i] = NULL; } @@ -459,7 +436,6 @@ acpi_ds_clear_operands ( } #endif - /******************************************************************************* * * FUNCTION: acpi_ds_create_operand @@ -478,37 +454,36 @@ acpi_ds_clear_operands ( ******************************************************************************/ acpi_status -acpi_ds_create_operand ( - struct acpi_walk_state *walk_state, - union acpi_parse_object *arg, - u32 arg_index) +acpi_ds_create_operand(struct acpi_walk_state *walk_state, + union acpi_parse_object *arg, u32 arg_index) { - acpi_status status = AE_OK; - char *name_string; - u32 name_length; - union acpi_operand_object *obj_desc; - union acpi_parse_object *parent_op; - u16 opcode; - acpi_interpreter_mode interpreter_mode; - const struct acpi_opcode_info *op_info; - - - ACPI_FUNCTION_TRACE_PTR ("ds_create_operand", arg); + acpi_status status = AE_OK; + char *name_string; + u32 name_length; + union acpi_operand_object *obj_desc; + union acpi_parse_object *parent_op; + u16 opcode; + acpi_interpreter_mode interpreter_mode; + const struct acpi_opcode_info *op_info; + ACPI_FUNCTION_TRACE_PTR("ds_create_operand", arg); /* A valid name must be looked up in the namespace */ if ((arg->common.aml_opcode == AML_INT_NAMEPATH_OP) && - (arg->common.value.string)) { - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Getting a name: Arg=%p\n", arg)); + (arg->common.value.string)) { + ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Getting a name: Arg=%p\n", + arg)); /* Get the entire name string from the AML stream */ - status = acpi_ex_get_name_string (ACPI_TYPE_ANY, arg->common.value.buffer, - &name_string, &name_length); + status = + acpi_ex_get_name_string(ACPI_TYPE_ANY, + arg->common.value.buffer, + &name_string, &name_length); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* All prefixes have been handled, and the name is in name_string */ @@ -523,13 +498,14 @@ acpi_ds_create_operand ( * actual opcode exists. */ if ((walk_state->deferred_node) && - (walk_state->deferred_node->type == ACPI_TYPE_BUFFER_FIELD) && - (arg_index != 0)) { - obj_desc = ACPI_CAST_PTR ( - union acpi_operand_object, walk_state->deferred_node); + (walk_state->deferred_node->type == ACPI_TYPE_BUFFER_FIELD) + && (arg_index != 0)) { + obj_desc = + ACPI_CAST_PTR(union acpi_operand_object, + walk_state->deferred_node); status = AE_OK; - } - else /* All other opcodes */ { + } else { /* All other opcodes */ + /* * Differentiate between a namespace "create" operation * versus a "lookup" operation (IMODE_LOAD_PASS2 vs. @@ -537,43 +513,51 @@ acpi_ds_create_operand ( * namespace objects during the execution of control methods. */ parent_op = arg->common.parent; - op_info = acpi_ps_get_opcode_info (parent_op->common.aml_opcode); - if ((op_info->flags & AML_NSNODE) && - (parent_op->common.aml_opcode != AML_INT_METHODCALL_OP) && - (parent_op->common.aml_opcode != AML_REGION_OP) && - (parent_op->common.aml_opcode != AML_INT_NAMEPATH_OP)) { + op_info = + acpi_ps_get_opcode_info(parent_op->common. + aml_opcode); + if ((op_info->flags & AML_NSNODE) + && (parent_op->common.aml_opcode != + AML_INT_METHODCALL_OP) + && (parent_op->common.aml_opcode != AML_REGION_OP) + && (parent_op->common.aml_opcode != + AML_INT_NAMEPATH_OP)) { /* Enter name into namespace if not found */ interpreter_mode = ACPI_IMODE_LOAD_PASS2; - } - else { + } else { /* Return a failure if name not found */ interpreter_mode = ACPI_IMODE_EXECUTE; } - status = acpi_ns_lookup (walk_state->scope_info, name_string, - ACPI_TYPE_ANY, interpreter_mode, - ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, - walk_state, - ACPI_CAST_INDIRECT_PTR (struct acpi_namespace_node, &obj_desc)); + status = + acpi_ns_lookup(walk_state->scope_info, name_string, + ACPI_TYPE_ANY, interpreter_mode, + ACPI_NS_SEARCH_PARENT | + ACPI_NS_DONT_OPEN_SCOPE, walk_state, + ACPI_CAST_INDIRECT_PTR(struct + acpi_namespace_node, + &obj_desc)); /* * The only case where we pass through (ignore) a NOT_FOUND * error is for the cond_ref_of opcode. */ if (status == AE_NOT_FOUND) { - if (parent_op->common.aml_opcode == AML_COND_REF_OF_OP) { + if (parent_op->common.aml_opcode == + AML_COND_REF_OF_OP) { /* * For the Conditional Reference op, it's OK if * the name is not found; We just need a way to * indicate this to the interpreter, set the * object to the root */ - obj_desc = ACPI_CAST_PTR ( - union acpi_operand_object, acpi_gbl_root_node); + obj_desc = + ACPI_CAST_PTR(union + acpi_operand_object, + acpi_gbl_root_node); status = AE_OK; - } - else { + } else { /* * We just plain didn't find it -- which is a * very serious error at this point @@ -582,30 +566,30 @@ acpi_ds_create_operand ( } } - if (ACPI_FAILURE (status)) { - ACPI_REPORT_NSERROR (name_string, status); + if (ACPI_FAILURE(status)) { + ACPI_REPORT_NSERROR(name_string, status); } } /* Free the namestring created above */ - ACPI_MEM_FREE (name_string); + ACPI_MEM_FREE(name_string); /* Check status from the lookup */ - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* Put the resulting object onto the current object stack */ - status = acpi_ds_obj_stack_push (obj_desc, walk_state); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ds_obj_stack_push(obj_desc, walk_state); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } - ACPI_DEBUGGER_EXEC (acpi_db_display_argument_object (obj_desc, walk_state)); - } - else { + ACPI_DEBUGGER_EXEC(acpi_db_display_argument_object + (obj_desc, walk_state)); + } else { /* Check for null name case */ if (arg->common.aml_opcode == AML_INT_NAMEPATH_OP) { @@ -615,77 +599,83 @@ acpi_ds_create_operand ( * in the original ASL. Create a Zero Constant for a * placeholder. (Store to a constant is a Noop.) */ - opcode = AML_ZERO_OP; /* Has no arguments! */ + opcode = AML_ZERO_OP; /* Has no arguments! */ - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "Null namepath: Arg=%p\n", arg)); - } - else { + ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, + "Null namepath: Arg=%p\n", arg)); + } else { opcode = arg->common.aml_opcode; } /* Get the object type of the argument */ - op_info = acpi_ps_get_opcode_info (opcode); + op_info = acpi_ps_get_opcode_info(opcode); if (op_info->object_type == ACPI_TYPE_INVALID) { - return_ACPI_STATUS (AE_NOT_IMPLEMENTED); + return_ACPI_STATUS(AE_NOT_IMPLEMENTED); } if (op_info->flags & AML_HAS_RETVAL) { - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "Argument previously created, already stacked \n")); + ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, + "Argument previously created, already stacked \n")); - ACPI_DEBUGGER_EXEC (acpi_db_display_argument_object ( - walk_state->operands [walk_state->num_operands - 1], walk_state)); + ACPI_DEBUGGER_EXEC(acpi_db_display_argument_object + (walk_state-> + operands[walk_state->num_operands - + 1], walk_state)); /* * Use value that was already previously returned * by the evaluation of this argument */ - status = acpi_ds_result_pop_from_bottom (&obj_desc, walk_state); - if (ACPI_FAILURE (status)) { + status = + acpi_ds_result_pop_from_bottom(&obj_desc, + walk_state); + if (ACPI_FAILURE(status)) { /* * Only error is underflow, and this indicates * a missing or null operand! */ - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Missing or null operand, %s\n", - acpi_format_exception (status))); - return_ACPI_STATUS (status); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Missing or null operand, %s\n", + acpi_format_exception + (status))); + return_ACPI_STATUS(status); } - } - else { + } else { /* Create an ACPI_INTERNAL_OBJECT for the argument */ - obj_desc = acpi_ut_create_internal_object (op_info->object_type); + obj_desc = + acpi_ut_create_internal_object(op_info-> + object_type); if (!obj_desc) { - return_ACPI_STATUS (AE_NO_MEMORY); + return_ACPI_STATUS(AE_NO_MEMORY); } /* Initialize the new object */ - status = acpi_ds_init_object_from_op ( - walk_state, arg, opcode, &obj_desc); - if (ACPI_FAILURE (status)) { - acpi_ut_delete_object_desc (obj_desc); - return_ACPI_STATUS (status); + status = + acpi_ds_init_object_from_op(walk_state, arg, opcode, + &obj_desc); + if (ACPI_FAILURE(status)) { + acpi_ut_delete_object_desc(obj_desc); + return_ACPI_STATUS(status); } } /* Put the operand object on the object stack */ - status = acpi_ds_obj_stack_push (obj_desc, walk_state); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ds_obj_stack_push(obj_desc, walk_state); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } - ACPI_DEBUGGER_EXEC (acpi_db_display_argument_object (obj_desc, walk_state)); + ACPI_DEBUGGER_EXEC(acpi_db_display_argument_object + (obj_desc, walk_state)); } - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_ds_create_operands @@ -702,29 +692,27 @@ acpi_ds_create_operand ( ******************************************************************************/ acpi_status -acpi_ds_create_operands ( - struct acpi_walk_state *walk_state, - union acpi_parse_object *first_arg) +acpi_ds_create_operands(struct acpi_walk_state *walk_state, + union acpi_parse_object *first_arg) { - acpi_status status = AE_OK; - union acpi_parse_object *arg; - u32 arg_count = 0; - - - ACPI_FUNCTION_TRACE_PTR ("ds_create_operands", first_arg); + acpi_status status = AE_OK; + union acpi_parse_object *arg; + u32 arg_count = 0; + ACPI_FUNCTION_TRACE_PTR("ds_create_operands", first_arg); /* For all arguments in the list... */ arg = first_arg; while (arg) { - status = acpi_ds_create_operand (walk_state, arg, arg_count); - if (ACPI_FAILURE (status)) { + status = acpi_ds_create_operand(walk_state, arg, arg_count); + if (ACPI_FAILURE(status)) { goto cleanup; } - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Arg #%d (%p) done, Arg1=%p\n", - arg_count, arg, first_arg)); + ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, + "Arg #%d (%p) done, Arg1=%p\n", arg_count, + arg, first_arg)); /* Move on to next argument, if any */ @@ -732,20 +720,17 @@ acpi_ds_create_operands ( arg_count++; } - return_ACPI_STATUS (status); - + return_ACPI_STATUS(status); -cleanup: + cleanup: /* * We must undo everything done above; meaning that we must * pop everything off of the operand stack and delete those * objects */ - (void) acpi_ds_obj_stack_pop_and_delete (arg_count, walk_state); + (void)acpi_ds_obj_stack_pop_and_delete(arg_count, walk_state); - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "While creating Arg %d - %s\n", - (arg_count + 1), acpi_format_exception (status))); - return_ACPI_STATUS (status); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "While creating Arg %d - %s\n", + (arg_count + 1), acpi_format_exception(status))); + return_ACPI_STATUS(status); } - - diff --git a/drivers/acpi/dispatcher/dswexec.c b/drivers/acpi/dispatcher/dswexec.c index 10f71318e23..e522763bb69 100644 --- a/drivers/acpi/dispatcher/dswexec.c +++ b/drivers/acpi/dispatcher/dswexec.c @@ -42,7 +42,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include #include #include @@ -52,27 +51,26 @@ #include #include - #define _COMPONENT ACPI_DISPATCHER - ACPI_MODULE_NAME ("dswexec") +ACPI_MODULE_NAME("dswexec") /* * Dispatch table for opcode classes */ -static ACPI_EXECUTE_OP acpi_gbl_op_type_dispatch [] = { - acpi_ex_opcode_0A_0T_1R, - acpi_ex_opcode_1A_0T_0R, - acpi_ex_opcode_1A_0T_1R, - acpi_ex_opcode_1A_1T_0R, - acpi_ex_opcode_1A_1T_1R, - acpi_ex_opcode_2A_0T_0R, - acpi_ex_opcode_2A_0T_1R, - acpi_ex_opcode_2A_1T_1R, - acpi_ex_opcode_2A_2T_1R, - acpi_ex_opcode_3A_0T_0R, - acpi_ex_opcode_3A_1T_1R, - acpi_ex_opcode_6A_0T_1R}; - +static ACPI_EXECUTE_OP acpi_gbl_op_type_dispatch[] = { + acpi_ex_opcode_0A_0T_1R, + acpi_ex_opcode_1A_0T_0R, + acpi_ex_opcode_1A_0T_1R, + acpi_ex_opcode_1A_1T_0R, + acpi_ex_opcode_1A_1T_1R, + acpi_ex_opcode_2A_0T_0R, + acpi_ex_opcode_2A_0T_1R, + acpi_ex_opcode_2A_1T_1R, + acpi_ex_opcode_2A_2T_1R, + acpi_ex_opcode_3A_0T_0R, + acpi_ex_opcode_3A_1T_1R, + acpi_ex_opcode_6A_0T_1R +}; /***************************************************************************** * @@ -88,64 +86,64 @@ static ACPI_EXECUTE_OP acpi_gbl_op_type_dispatch [] = { ****************************************************************************/ acpi_status -acpi_ds_get_predicate_value ( - struct acpi_walk_state *walk_state, - union acpi_operand_object *result_obj) { - acpi_status status = AE_OK; - union acpi_operand_object *obj_desc; - union acpi_operand_object *local_obj_desc = NULL; - - - ACPI_FUNCTION_TRACE_PTR ("ds_get_predicate_value", walk_state); +acpi_ds_get_predicate_value(struct acpi_walk_state *walk_state, + union acpi_operand_object *result_obj) +{ + acpi_status status = AE_OK; + union acpi_operand_object *obj_desc; + union acpi_operand_object *local_obj_desc = NULL; + ACPI_FUNCTION_TRACE_PTR("ds_get_predicate_value", walk_state); walk_state->control_state->common.state = 0; if (result_obj) { - status = acpi_ds_result_pop (&obj_desc, walk_state); - if (ACPI_FAILURE (status)) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Could not get result from predicate evaluation, %s\n", - acpi_format_exception (status))); + status = acpi_ds_result_pop(&obj_desc, walk_state); + if (ACPI_FAILURE(status)) { + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Could not get result from predicate evaluation, %s\n", + acpi_format_exception(status))); - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - } - else { - status = acpi_ds_create_operand (walk_state, walk_state->op, 0); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + } else { + status = acpi_ds_create_operand(walk_state, walk_state->op, 0); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } - status = acpi_ex_resolve_to_value (&walk_state->operands [0], walk_state); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = + acpi_ex_resolve_to_value(&walk_state->operands[0], + walk_state); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } - obj_desc = walk_state->operands [0]; + obj_desc = walk_state->operands[0]; } if (!obj_desc) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "No predicate obj_desc=%p State=%p\n", - obj_desc, walk_state)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "No predicate obj_desc=%p State=%p\n", + obj_desc, walk_state)); - return_ACPI_STATUS (AE_AML_NO_OPERAND); + return_ACPI_STATUS(AE_AML_NO_OPERAND); } /* * Result of predicate evaluation must be an Integer * object. Implicitly convert the argument if necessary. */ - status = acpi_ex_convert_to_integer (obj_desc, &local_obj_desc, 16); - if (ACPI_FAILURE (status)) { + status = acpi_ex_convert_to_integer(obj_desc, &local_obj_desc, 16); + if (ACPI_FAILURE(status)) { goto cleanup; } - if (ACPI_GET_OBJECT_TYPE (local_obj_desc) != ACPI_TYPE_INTEGER) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Bad predicate (not an integer) obj_desc=%p State=%p Type=%X\n", - obj_desc, walk_state, ACPI_GET_OBJECT_TYPE (obj_desc))); + if (ACPI_GET_OBJECT_TYPE(local_obj_desc) != ACPI_TYPE_INTEGER) { + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Bad predicate (not an integer) obj_desc=%p State=%p Type=%X\n", + obj_desc, walk_state, + ACPI_GET_OBJECT_TYPE(obj_desc))); status = AE_AML_OPERAND_TYPE; goto cleanup; @@ -153,7 +151,7 @@ acpi_ds_get_predicate_value ( /* Truncate the predicate to 32-bits if necessary */ - acpi_ex_truncate_for32bit_table (local_obj_desc); + acpi_ex_truncate_for32bit_table(local_obj_desc); /* * Save the result of the predicate evaluation on @@ -161,8 +159,7 @@ acpi_ds_get_predicate_value ( */ if (local_obj_desc->integer.value) { walk_state->control_state->common.value = TRUE; - } - else { + } else { /* * Predicate is FALSE, we will just toss the * rest of the package @@ -171,30 +168,30 @@ acpi_ds_get_predicate_value ( status = AE_CTRL_FALSE; } + cleanup: -cleanup: + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Completed a predicate eval=%X Op=%p\n", + walk_state->control_state->common.value, + walk_state->op)); - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Completed a predicate eval=%X Op=%p\n", - walk_state->control_state->common.value, walk_state->op)); + /* Break to debugger to display result */ - /* Break to debugger to display result */ - - ACPI_DEBUGGER_EXEC (acpi_db_display_result_object (local_obj_desc, walk_state)); + ACPI_DEBUGGER_EXEC(acpi_db_display_result_object + (local_obj_desc, walk_state)); /* * Delete the predicate result object (we know that * we don't need it anymore) */ if (local_obj_desc != obj_desc) { - acpi_ut_remove_reference (local_obj_desc); + acpi_ut_remove_reference(local_obj_desc); } - acpi_ut_remove_reference (obj_desc); + acpi_ut_remove_reference(obj_desc); walk_state->control_state->common.state = ACPI_CONTROL_NORMAL; - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - /***************************************************************************** * * FUNCTION: acpi_ds_exec_begin_op @@ -211,38 +208,39 @@ cleanup: ****************************************************************************/ acpi_status -acpi_ds_exec_begin_op ( - struct acpi_walk_state *walk_state, - union acpi_parse_object **out_op) +acpi_ds_exec_begin_op(struct acpi_walk_state *walk_state, + union acpi_parse_object **out_op) { - union acpi_parse_object *op; - acpi_status status = AE_OK; - u32 opcode_class; - - - ACPI_FUNCTION_TRACE_PTR ("ds_exec_begin_op", walk_state); + union acpi_parse_object *op; + acpi_status status = AE_OK; + u32 opcode_class; + ACPI_FUNCTION_TRACE_PTR("ds_exec_begin_op", walk_state); op = walk_state->op; if (!op) { - status = acpi_ds_load2_begin_op (walk_state, out_op); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ds_load2_begin_op(walk_state, out_op); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } op = *out_op; walk_state->op = op; walk_state->opcode = op->common.aml_opcode; - walk_state->op_info = acpi_ps_get_opcode_info (op->common.aml_opcode); - - if (acpi_ns_opens_scope (walk_state->op_info->object_type)) { - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "(%s) Popping scope for Op %p\n", - acpi_ut_get_type_name (walk_state->op_info->object_type), op)); - - status = acpi_ds_scope_stack_pop (walk_state); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + walk_state->op_info = + acpi_ps_get_opcode_info(op->common.aml_opcode); + + if (acpi_ns_opens_scope(walk_state->op_info->object_type)) { + ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, + "(%s) Popping scope for Op %p\n", + acpi_ut_get_type_name(walk_state-> + op_info-> + object_type), + op)); + + status = acpi_ds_scope_stack_pop(walk_state); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } } } @@ -252,7 +250,7 @@ acpi_ds_exec_begin_op ( *out_op = op; } - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } /* @@ -261,19 +259,20 @@ acpi_ds_exec_begin_op ( * Save this knowledge in the current scope descriptor */ if ((walk_state->control_state) && - (walk_state->control_state->common.state == - ACPI_CONTROL_CONDITIONAL_EXECUTING)) { - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Exec predicate Op=%p State=%p\n", - op, walk_state)); + (walk_state->control_state->common.state == + ACPI_CONTROL_CONDITIONAL_EXECUTING)) { + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, + "Exec predicate Op=%p State=%p\n", op, + walk_state)); - walk_state->control_state->common.state = ACPI_CONTROL_PREDICATE_EXECUTING; + walk_state->control_state->common.state = + ACPI_CONTROL_PREDICATE_EXECUTING; /* Save start of predicate */ walk_state->control_state->control.predicate_op = op; } - opcode_class = walk_state->op_info->class; /* We want to send namepaths to the load code */ @@ -288,15 +287,14 @@ acpi_ds_exec_begin_op ( switch (opcode_class) { case AML_CLASS_CONTROL: - status = acpi_ds_result_stack_push (walk_state); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ds_result_stack_push(walk_state); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } - status = acpi_ds_exec_begin_control_op (walk_state, op); + status = acpi_ds_exec_begin_control_op(walk_state, op); break; - case AML_CLASS_NAMED_OBJECT: if (walk_state->walk_type == ACPI_WALK_METHOD) { @@ -306,15 +304,14 @@ acpi_ds_exec_begin_op ( * object is temporary and will be deleted upon completion of * the execution of this method. */ - status = acpi_ds_load2_begin_op (walk_state, NULL); + status = acpi_ds_load2_begin_op(walk_state, NULL); } if (op->common.aml_opcode == AML_REGION_OP) { - status = acpi_ds_result_stack_push (walk_state); + status = acpi_ds_result_stack_push(walk_state); } break; - case AML_CLASS_EXECUTE: case AML_CLASS_CREATE: @@ -322,20 +319,18 @@ acpi_ds_exec_begin_op ( * Most operators with arguments. * Start a new result/operand state */ - status = acpi_ds_result_stack_push (walk_state); + status = acpi_ds_result_stack_push(walk_state); break; - default: break; } /* Nothing to do here during method execution */ - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - /***************************************************************************** * * FUNCTION: acpi_ds_exec_end_op @@ -350,28 +345,25 @@ acpi_ds_exec_begin_op ( * ****************************************************************************/ -acpi_status -acpi_ds_exec_end_op ( - struct acpi_walk_state *walk_state) +acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) { - union acpi_parse_object *op; - acpi_status status = AE_OK; - u32 op_type; - u32 op_class; - union acpi_parse_object *next_op; - union acpi_parse_object *first_arg; + union acpi_parse_object *op; + acpi_status status = AE_OK; + u32 op_type; + u32 op_class; + union acpi_parse_object *next_op; + union acpi_parse_object *first_arg; + ACPI_FUNCTION_TRACE_PTR("ds_exec_end_op", walk_state); - ACPI_FUNCTION_TRACE_PTR ("ds_exec_end_op", walk_state); - - - op = walk_state->op; + op = walk_state->op; op_type = walk_state->op_info->type; op_class = walk_state->op_info->class; if (op_class == AML_CLASS_UNKNOWN) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown opcode %X\n", op->common.aml_opcode)); - return_ACPI_STATUS (AE_NOT_IMPLEMENTED); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unknown opcode %X\n", + op->common.aml_opcode)); + return_ACPI_STATUS(AE_NOT_IMPLEMENTED); } first_arg = op->common.value.arg; @@ -384,29 +376,31 @@ acpi_ds_exec_end_op ( /* Call debugger for single step support (DEBUG build only) */ - ACPI_DEBUGGER_EXEC (status = acpi_db_single_step (walk_state, op, op_class)); - ACPI_DEBUGGER_EXEC (if (ACPI_FAILURE (status)) {return_ACPI_STATUS (status);}); + ACPI_DEBUGGER_EXEC(status = + acpi_db_single_step(walk_state, op, op_class)); + ACPI_DEBUGGER_EXEC(if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status);} + ) ; /* Decode the Opcode Class */ switch (op_class) { - case AML_CLASS_ARGUMENT: /* constants, literals, etc. - do nothing */ + case AML_CLASS_ARGUMENT: /* constants, literals, etc. - do nothing */ break; - - case AML_CLASS_EXECUTE: /* most operators with arguments */ + case AML_CLASS_EXECUTE: /* most operators with arguments */ /* Build resolved operand stack */ - status = acpi_ds_create_operands (walk_state, first_arg); - if (ACPI_FAILURE (status)) { + status = acpi_ds_create_operands(walk_state, first_arg); + if (ACPI_FAILURE(status)) { goto cleanup; } /* Done with this result state (Now that operand stack is built) */ - status = acpi_ds_result_stack_pop (walk_state); - if (ACPI_FAILURE (status)) { + status = acpi_ds_result_stack_pop(walk_state); + if (ACPI_FAILURE(status)) { goto cleanup; } @@ -417,86 +411,93 @@ acpi_ds_exec_end_op ( if (!(walk_state->op_info->flags & AML_NO_OPERAND_RESOLVE)) { /* Resolve all operands */ - status = acpi_ex_resolve_operands (walk_state->opcode, - &(walk_state->operands [walk_state->num_operands -1]), - walk_state); - if (ACPI_SUCCESS (status)) { - ACPI_DUMP_OPERANDS (ACPI_WALK_OPERANDS, ACPI_IMODE_EXECUTE, - acpi_ps_get_opcode_name (walk_state->opcode), - walk_state->num_operands, "after ex_resolve_operands"); + status = acpi_ex_resolve_operands(walk_state->opcode, + &(walk_state-> + operands + [walk_state-> + num_operands - 1]), + walk_state); + if (ACPI_SUCCESS(status)) { + ACPI_DUMP_OPERANDS(ACPI_WALK_OPERANDS, + ACPI_IMODE_EXECUTE, + acpi_ps_get_opcode_name + (walk_state->opcode), + walk_state->num_operands, + "after ex_resolve_operands"); } } - if (ACPI_SUCCESS (status)) { + if (ACPI_SUCCESS(status)) { /* * Dispatch the request to the appropriate interpreter handler * routine. There is one routine per opcode "type" based upon the * number of opcode arguments and return type. */ - status = acpi_gbl_op_type_dispatch[op_type] (walk_state); - } - else { + status = + acpi_gbl_op_type_dispatch[op_type] (walk_state); + } else { /* * Treat constructs of the form "Store(local_x,local_x)" as noops when the * Local is uninitialized. */ - if ((status == AE_AML_UNINITIALIZED_LOCAL) && - (walk_state->opcode == AML_STORE_OP) && - (walk_state->operands[0]->common.type == ACPI_TYPE_LOCAL_REFERENCE) && - (walk_state->operands[1]->common.type == ACPI_TYPE_LOCAL_REFERENCE) && - (walk_state->operands[0]->reference.opcode == - walk_state->operands[1]->reference.opcode) && - (walk_state->operands[0]->reference.offset == - walk_state->operands[1]->reference.offset)) { + if ((status == AE_AML_UNINITIALIZED_LOCAL) && + (walk_state->opcode == AML_STORE_OP) && + (walk_state->operands[0]->common.type == + ACPI_TYPE_LOCAL_REFERENCE) + && (walk_state->operands[1]->common.type == + ACPI_TYPE_LOCAL_REFERENCE) + && (walk_state->operands[0]->reference.opcode == + walk_state->operands[1]->reference.opcode) + && (walk_state->operands[0]->reference.offset == + walk_state->operands[1]->reference.offset)) { status = AE_OK; - } - else { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "[%s]: Could not resolve operands, %s\n", - acpi_ps_get_opcode_name (walk_state->opcode), - acpi_format_exception (status))); + } else { + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "[%s]: Could not resolve operands, %s\n", + acpi_ps_get_opcode_name + (walk_state->opcode), + acpi_format_exception + (status))); } } /* Always delete the argument objects and clear the operand stack */ - acpi_ds_clear_operands (walk_state); + acpi_ds_clear_operands(walk_state); /* * If a result object was returned from above, push it on the * current result stack */ - if (ACPI_SUCCESS (status) && - walk_state->result_obj) { - status = acpi_ds_result_push (walk_state->result_obj, walk_state); + if (ACPI_SUCCESS(status) && walk_state->result_obj) { + status = + acpi_ds_result_push(walk_state->result_obj, + walk_state); } break; - default: switch (op_type) { - case AML_TYPE_CONTROL: /* Type 1 opcode, IF/ELSE/WHILE/NOOP */ + case AML_TYPE_CONTROL: /* Type 1 opcode, IF/ELSE/WHILE/NOOP */ /* 1 Operand, 0 external_result, 0 internal_result */ - status = acpi_ds_exec_end_control_op (walk_state, op); + status = acpi_ds_exec_end_control_op(walk_state, op); /* Make sure to properly pop the result stack */ - if (ACPI_SUCCESS (status)) { - status = acpi_ds_result_stack_pop (walk_state); - } - else if (status == AE_CTRL_PENDING) { - status = acpi_ds_result_stack_pop (walk_state); - if (ACPI_SUCCESS (status)) { + if (ACPI_SUCCESS(status)) { + status = acpi_ds_result_stack_pop(walk_state); + } else if (status == AE_CTRL_PENDING) { + status = acpi_ds_result_stack_pop(walk_state); + if (ACPI_SUCCESS(status)) { status = AE_CTRL_PENDING; } } break; - case AML_TYPE_METHOD_CALL: /* @@ -505,16 +506,22 @@ acpi_ds_exec_end_op ( * a reference to it. */ if ((op->asl.parent) && - ((op->asl.parent->asl.aml_opcode == AML_PACKAGE_OP) || - (op->asl.parent->asl.aml_opcode == AML_VAR_PACKAGE_OP))) { - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "Method Reference in a Package, Op=%p\n", op)); - op->common.node = (struct acpi_namespace_node *) op->asl.value.arg->asl.node->object; - acpi_ut_add_reference (op->asl.value.arg->asl.node->object); - return_ACPI_STATUS (AE_OK); + ((op->asl.parent->asl.aml_opcode == AML_PACKAGE_OP) + || (op->asl.parent->asl.aml_opcode == + AML_VAR_PACKAGE_OP))) { + ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, + "Method Reference in a Package, Op=%p\n", + op)); + op->common.node = + (struct acpi_namespace_node *)op->asl.value. + arg->asl.node->object; + acpi_ut_add_reference(op->asl.value.arg->asl. + node->object); + return_ACPI_STATUS(AE_OK); } - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Method invocation, Op=%p\n", op)); + ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, + "Method invocation, Op=%p\n", op)); /* * (AML_METHODCALL) Op->Asl.Value.Arg->Asl.Node contains @@ -531,8 +538,8 @@ acpi_ds_exec_end_op ( /* * Get the method's arguments and put them on the operand stack */ - status = acpi_ds_create_operands (walk_state, next_op); - if (ACPI_FAILURE (status)) { + status = acpi_ds_create_operands(walk_state, next_op); + if (ACPI_FAILURE(status)) { break; } @@ -541,11 +548,11 @@ acpi_ds_exec_end_op ( * we must resolve all local references here (Local variables, * arguments to *this* method, etc.) */ - status = acpi_ds_resolve_operands (walk_state); - if (ACPI_FAILURE (status)) { + status = acpi_ds_resolve_operands(walk_state); + if (ACPI_FAILURE(status)) { /* On error, clear all resolved operands */ - acpi_ds_clear_operands (walk_state); + acpi_ds_clear_operands(walk_state); break; } @@ -559,27 +566,28 @@ acpi_ds_exec_end_op ( * Return now; we don't want to disturb anything, * especially the operand count! */ - return_ACPI_STATUS (status); - + return_ACPI_STATUS(status); case AML_TYPE_CREATE_FIELD: - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "Executing create_field Buffer/Index Op=%p\n", op)); + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, + "Executing create_field Buffer/Index Op=%p\n", + op)); - status = acpi_ds_load2_end_op (walk_state); - if (ACPI_FAILURE (status)) { + status = acpi_ds_load2_end_op(walk_state); + if (ACPI_FAILURE(status)) { break; } - status = acpi_ds_eval_buffer_field_operands (walk_state, op); + status = + acpi_ds_eval_buffer_field_operands(walk_state, op); break; - case AML_TYPE_CREATE_OBJECT: - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "Executing create_object (Buffer/Package) Op=%p\n", op)); + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, + "Executing create_object (Buffer/Package) Op=%p\n", + op)); switch (op->common.parent->common.aml_opcode) { case AML_NAME_OP: @@ -588,13 +596,15 @@ acpi_ds_exec_end_op ( * Put the Node on the object stack (Contains the ACPI Name * of this object) */ - walk_state->operands[0] = (void *) op->common.parent->common.node; + walk_state->operands[0] = + (void *)op->common.parent->common.node; walk_state->num_operands = 1; - status = acpi_ds_create_node (walk_state, - op->common.parent->common.node, - op->common.parent); - if (ACPI_FAILURE (status)) { + status = acpi_ds_create_node(walk_state, + op->common.parent-> + common.node, + op->common.parent); + if (ACPI_FAILURE(status)) { break; } @@ -603,20 +613,26 @@ acpi_ds_exec_end_op ( case AML_INT_EVAL_SUBTREE_OP: - status = acpi_ds_eval_data_object_operands (walk_state, op, - acpi_ns_get_attached_object (op->common.parent->common.node)); + status = + acpi_ds_eval_data_object_operands + (walk_state, op, + acpi_ns_get_attached_object(op->common. + parent->common. + node)); break; default: - status = acpi_ds_eval_data_object_operands (walk_state, op, NULL); + status = + acpi_ds_eval_data_object_operands + (walk_state, op, NULL); break; } /* Done with result state (Now that operand stack is built) */ - status = acpi_ds_result_stack_pop (walk_state); - if (ACPI_FAILURE (status)) { + status = acpi_ds_result_stack_pop(walk_state); + if (ACPI_FAILURE(status)) { goto cleanup; } @@ -625,56 +641,58 @@ acpi_ds_exec_end_op ( * current result stack */ if (walk_state->result_obj) { - status = acpi_ds_result_push (walk_state->result_obj, walk_state); + status = + acpi_ds_result_push(walk_state->result_obj, + walk_state); } break; - case AML_TYPE_NAMED_FIELD: case AML_TYPE_NAMED_COMPLEX: case AML_TYPE_NAMED_SIMPLE: case AML_TYPE_NAMED_NO_OBJ: - status = acpi_ds_load2_end_op (walk_state); - if (ACPI_FAILURE (status)) { + status = acpi_ds_load2_end_op(walk_state); + if (ACPI_FAILURE(status)) { break; } if (op->common.aml_opcode == AML_REGION_OP) { - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "Executing op_region Address/Length Op=%p\n", op)); - - status = acpi_ds_eval_region_operands (walk_state, op); - if (ACPI_FAILURE (status)) { + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, + "Executing op_region Address/Length Op=%p\n", + op)); + + status = + acpi_ds_eval_region_operands(walk_state, + op); + if (ACPI_FAILURE(status)) { break; } - status = acpi_ds_result_stack_pop (walk_state); + status = acpi_ds_result_stack_pop(walk_state); } break; - case AML_TYPE_UNDEFINED: - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Undefined opcode type Op=%p\n", op)); - return_ACPI_STATUS (AE_NOT_IMPLEMENTED); - + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Undefined opcode type Op=%p\n", op)); + return_ACPI_STATUS(AE_NOT_IMPLEMENTED); case AML_TYPE_BOGUS: - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "Internal opcode=%X type Op=%p\n", - walk_state->opcode, op)); + ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, + "Internal opcode=%X type Op=%p\n", + walk_state->opcode, op)); break; - default: - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Unimplemented opcode, class=%X type=%X Opcode=%X Op=%p\n", - op_class, op_type, op->common.aml_opcode, op)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Unimplemented opcode, class=%X type=%X Opcode=%X Op=%p\n", + op_class, op_type, + op->common.aml_opcode, op)); status = AE_NOT_IMPLEMENTED; break; @@ -685,55 +703,58 @@ acpi_ds_exec_end_op ( * ACPI 2.0 support for 64-bit integers: Truncate numeric * result value if we are executing from a 32-bit ACPI table */ - acpi_ex_truncate_for32bit_table (walk_state->result_obj); + acpi_ex_truncate_for32bit_table(walk_state->result_obj); /* * Check if we just completed the evaluation of a * conditional predicate */ - if ((ACPI_SUCCESS (status)) && - (walk_state->control_state) && - (walk_state->control_state->common.state == - ACPI_CONTROL_PREDICATE_EXECUTING) && - (walk_state->control_state->control.predicate_op == op)) { - status = acpi_ds_get_predicate_value (walk_state, walk_state->result_obj); + if ((ACPI_SUCCESS(status)) && + (walk_state->control_state) && + (walk_state->control_state->common.state == + ACPI_CONTROL_PREDICATE_EXECUTING) && + (walk_state->control_state->control.predicate_op == op)) { + status = + acpi_ds_get_predicate_value(walk_state, + walk_state->result_obj); walk_state->result_obj = NULL; } - -cleanup: + cleanup: /* Invoke exception handler on error */ - if (ACPI_FAILURE (status) && - acpi_gbl_exception_handler && - !(status & AE_CODE_CONTROL)) { - acpi_ex_exit_interpreter (); - status = acpi_gbl_exception_handler (status, - walk_state->method_node->name.integer, walk_state->opcode, - walk_state->aml_offset, NULL); - (void) acpi_ex_enter_interpreter (); + if (ACPI_FAILURE(status) && + acpi_gbl_exception_handler && !(status & AE_CODE_CONTROL)) { + acpi_ex_exit_interpreter(); + status = acpi_gbl_exception_handler(status, + walk_state->method_node-> + name.integer, + walk_state->opcode, + walk_state->aml_offset, + NULL); + (void)acpi_ex_enter_interpreter(); } if (walk_state->result_obj) { /* Break to debugger to display result */ - ACPI_DEBUGGER_EXEC (acpi_db_display_result_object (walk_state->result_obj, - walk_state)); + ACPI_DEBUGGER_EXEC(acpi_db_display_result_object + (walk_state->result_obj, walk_state)); /* * Delete the result op if and only if: * Parent will not use the result -- such as any * non-nested type2 op in a method (parent will be method) */ - acpi_ds_delete_result_if_not_used (op, walk_state->result_obj, walk_state); + acpi_ds_delete_result_if_not_used(op, walk_state->result_obj, + walk_state); } - #ifdef _UNDER_DEVELOPMENT if (walk_state->parser_state.aml == walk_state->parser_state.aml_end) { - acpi_db_method_end (walk_state); + acpi_db_method_end(walk_state); } #endif @@ -745,12 +766,10 @@ cleanup: /* On error, display method locals/args */ - if (ACPI_FAILURE (status)) { - acpi_dm_dump_method_info (status, walk_state, op); + if (ACPI_FAILURE(status)) { + acpi_dm_dump_method_info(status, walk_state, op); } #endif - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - - diff --git a/drivers/acpi/dispatcher/dswload.c b/drivers/acpi/dispatcher/dswload.c index 9100c0bda47..362bbcfc171 100644 --- a/drivers/acpi/dispatcher/dswload.c +++ b/drivers/acpi/dispatcher/dswload.c @@ -41,7 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include #include #include @@ -55,8 +54,7 @@ #endif #define _COMPONENT ACPI_DISPATCHER - ACPI_MODULE_NAME ("dswload") - +ACPI_MODULE_NAME("dswload") /******************************************************************************* * @@ -70,32 +68,29 @@ * DESCRIPTION: Init walk state callbacks * ******************************************************************************/ - acpi_status -acpi_ds_init_callbacks ( - struct acpi_walk_state *walk_state, - u32 pass_number) +acpi_ds_init_callbacks(struct acpi_walk_state *walk_state, u32 pass_number) { switch (pass_number) { case 1: - walk_state->parse_flags = ACPI_PARSE_LOAD_PASS1 | - ACPI_PARSE_DELETE_TREE; + walk_state->parse_flags = ACPI_PARSE_LOAD_PASS1 | + ACPI_PARSE_DELETE_TREE; walk_state->descending_callback = acpi_ds_load1_begin_op; walk_state->ascending_callback = acpi_ds_load1_end_op; break; case 2: - walk_state->parse_flags = ACPI_PARSE_LOAD_PASS1 | - ACPI_PARSE_DELETE_TREE; + walk_state->parse_flags = ACPI_PARSE_LOAD_PASS1 | + ACPI_PARSE_DELETE_TREE; walk_state->descending_callback = acpi_ds_load2_begin_op; walk_state->ascending_callback = acpi_ds_load2_end_op; break; case 3: #ifndef ACPI_NO_METHOD_EXECUTION - walk_state->parse_flags |= ACPI_PARSE_EXECUTE | - ACPI_PARSE_DELETE_TREE; + walk_state->parse_flags |= ACPI_PARSE_EXECUTE | + ACPI_PARSE_DELETE_TREE; walk_state->descending_callback = acpi_ds_exec_begin_op; walk_state->ascending_callback = acpi_ds_exec_end_op; #endif @@ -108,7 +103,6 @@ acpi_ds_init_callbacks ( return (AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_ds_load1_begin_op @@ -123,23 +117,21 @@ acpi_ds_init_callbacks ( ******************************************************************************/ acpi_status -acpi_ds_load1_begin_op ( - struct acpi_walk_state *walk_state, - union acpi_parse_object **out_op) +acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state, + union acpi_parse_object ** out_op) { - union acpi_parse_object *op; - struct acpi_namespace_node *node; - acpi_status status; - acpi_object_type object_type; - char *path; - u32 flags; - - - ACPI_FUNCTION_NAME ("ds_load1_begin_op"); + union acpi_parse_object *op; + struct acpi_namespace_node *node; + acpi_status status; + acpi_object_type object_type; + char *path; + u32 flags; + ACPI_FUNCTION_NAME("ds_load1_begin_op"); op = walk_state->op; - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op, walk_state)); + ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op, + walk_state)); /* We are only interested in opcodes that have an associated name */ @@ -157,14 +149,15 @@ acpi_ds_load1_begin_op ( } } - path = acpi_ps_get_next_namestring (&walk_state->parser_state); + path = acpi_ps_get_next_namestring(&walk_state->parser_state); /* Map the raw opcode into an internal object type */ object_type = walk_state->op_info->object_type; - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "State=%p Op=%p [%s]\n", walk_state, op, acpi_ut_get_type_name (object_type))); + ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, + "State=%p Op=%p [%s]\n", walk_state, op, + acpi_ut_get_type_name(object_type))); switch (walk_state->opcode) { case AML_SCOPE_OP: @@ -174,8 +167,10 @@ acpi_ds_load1_begin_op ( * that we can actually open the scope to enter new names underneath it. * Allow search-to-root for single namesegs. */ - status = acpi_ns_lookup (walk_state->scope_info, path, object_type, - ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, walk_state, &(node)); + status = + acpi_ns_lookup(walk_state->scope_info, path, object_type, + ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, + walk_state, &(node)); #ifdef ACPI_ASL_COMPILER if (status == AE_NOT_FOUND) { /* @@ -183,14 +178,16 @@ acpi_ds_load1_begin_op ( * Target of Scope() not found. Generate an External for it, and * insert the name into the namespace. */ - acpi_dm_add_to_external_list (path); - status = acpi_ns_lookup (walk_state->scope_info, path, object_type, - ACPI_IMODE_LOAD_PASS1, ACPI_NS_SEARCH_PARENT, - walk_state, &(node)); + acpi_dm_add_to_external_list(path); + status = + acpi_ns_lookup(walk_state->scope_info, path, + object_type, ACPI_IMODE_LOAD_PASS1, + ACPI_NS_SEARCH_PARENT, walk_state, + &(node)); } #endif - if (ACPI_FAILURE (status)) { - ACPI_REPORT_NSERROR (path, status); + if (ACPI_FAILURE(status)) { + ACPI_REPORT_NSERROR(path, status); return (status); } @@ -199,7 +196,7 @@ acpi_ds_load1_begin_op ( * one of the opcodes that actually opens a scope */ switch (node->type) { - case ACPI_TYPE_LOCAL_SCOPE: /* Scope */ + case ACPI_TYPE_LOCAL_SCOPE: /* Scope */ case ACPI_TYPE_DEVICE: case ACPI_TYPE_POWER: case ACPI_TYPE_PROCESSOR: @@ -223,9 +220,10 @@ acpi_ds_load1_begin_op ( * a warning */ - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "Type override - [%4.4s] had invalid type (%s) for Scope operator, changed to (Scope)\n", - path, acpi_ut_get_type_name (node->type))); + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "Type override - [%4.4s] had invalid type (%s) for Scope operator, changed to (Scope)\n", + path, + acpi_ut_get_type_name(node->type))); node->type = ACPI_TYPE_ANY; walk_state->scope_info->common.value = ACPI_TYPE_ANY; @@ -235,15 +233,12 @@ acpi_ds_load1_begin_op ( /* All other types are an error */ - ACPI_REPORT_ERROR (( - "Invalid type (%s) for target of Scope operator [%4.4s] (Cannot override)\n", - acpi_ut_get_type_name (node->type), path)); + ACPI_REPORT_ERROR(("Invalid type (%s) for target of Scope operator [%4.4s] (Cannot override)\n", acpi_ut_get_type_name(node->type), path)); return (AE_AML_OPERAND_TYPE); } break; - default: /* @@ -272,15 +267,15 @@ acpi_ds_load1_begin_op ( flags = ACPI_NS_NO_UPSEARCH; if ((walk_state->opcode != AML_SCOPE_OP) && - (!(walk_state->parse_flags & ACPI_PARSE_DEFERRED_OP))) { + (!(walk_state->parse_flags & ACPI_PARSE_DEFERRED_OP))) { flags |= ACPI_NS_ERROR_IF_FOUND; - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "[%s] Cannot already exist\n", - acpi_ut_get_type_name (object_type))); - } - else { - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "[%s] Both Find or Create allowed\n", - acpi_ut_get_type_name (object_type))); + ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, + "[%s] Cannot already exist\n", + acpi_ut_get_type_name(object_type))); + } else { + ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, + "[%s] Both Find or Create allowed\n", + acpi_ut_get_type_name(object_type))); } /* @@ -289,22 +284,23 @@ acpi_ds_load1_begin_op ( * involve arguments to the opcode must be created as we go back up the * parse tree later. */ - status = acpi_ns_lookup (walk_state->scope_info, path, object_type, - ACPI_IMODE_LOAD_PASS1, flags, walk_state, &(node)); - if (ACPI_FAILURE (status)) { - ACPI_REPORT_NSERROR (path, status); + status = + acpi_ns_lookup(walk_state->scope_info, path, object_type, + ACPI_IMODE_LOAD_PASS1, flags, walk_state, + &(node)); + if (ACPI_FAILURE(status)) { + ACPI_REPORT_NSERROR(path, status); return (status); } break; } - /* Common exit */ if (!op) { /* Create a new op */ - op = acpi_ps_alloc_op (walk_state->opcode); + op = acpi_ps_alloc_op(walk_state->opcode); if (!op) { return (AE_NO_MEMORY); } @@ -318,19 +314,18 @@ acpi_ds_load1_begin_op ( op->named.path = (u8 *) path; #endif - /* * Put the Node in the "op" object that the parser uses, so we * can get it again quickly when this scope is closed */ op->common.node = node; - acpi_ps_append_arg (acpi_ps_get_parent_scope (&walk_state->parser_state), op); + acpi_ps_append_arg(acpi_ps_get_parent_scope(&walk_state->parser_state), + op); *out_op = op; return (status); } - /******************************************************************************* * * FUNCTION: acpi_ds_load1_end_op @@ -344,20 +339,17 @@ acpi_ds_load1_begin_op ( * ******************************************************************************/ -acpi_status -acpi_ds_load1_end_op ( - struct acpi_walk_state *walk_state) +acpi_status acpi_ds_load1_end_op(struct acpi_walk_state * walk_state) { - union acpi_parse_object *op; - acpi_object_type object_type; - acpi_status status = AE_OK; - - - ACPI_FUNCTION_NAME ("ds_load1_end_op"); + union acpi_parse_object *op; + acpi_object_type object_type; + acpi_status status = AE_OK; + ACPI_FUNCTION_NAME("ds_load1_end_op"); op = walk_state->op; - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op, walk_state)); + ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op, + walk_state)); /* We are only interested in opcodes that have an associated name */ @@ -371,21 +363,20 @@ acpi_ds_load1_end_op ( #ifndef ACPI_NO_METHOD_EXECUTION if (walk_state->op_info->flags & AML_FIELD) { - if (walk_state->opcode == AML_FIELD_OP || - walk_state->opcode == AML_BANK_FIELD_OP || - walk_state->opcode == AML_INDEX_FIELD_OP) { - status = acpi_ds_init_field_objects (op, walk_state); + if (walk_state->opcode == AML_FIELD_OP || + walk_state->opcode == AML_BANK_FIELD_OP || + walk_state->opcode == AML_INDEX_FIELD_OP) { + status = acpi_ds_init_field_objects(op, walk_state); } return (status); } - if (op->common.aml_opcode == AML_REGION_OP) { - status = acpi_ex_create_region (op->named.data, op->named.length, - (acpi_adr_space_type) - ((op->common.value.arg)->common.value.integer), - walk_state); - if (ACPI_FAILURE (status)) { + status = acpi_ex_create_region(op->named.data, op->named.length, + (acpi_adr_space_type) + ((op->common.value.arg)->common. + value.integer), walk_state); + if (ACPI_FAILURE(status)) { return (status); } } @@ -395,8 +386,11 @@ acpi_ds_load1_end_op ( /* For Name opcode, get the object type from the argument */ if (op->common.value.arg) { - object_type = (acpi_ps_get_opcode_info ( - (op->common.value.arg)->common.aml_opcode))->object_type; + object_type = (acpi_ps_get_opcode_info((op->common. + value.arg)-> + common. + aml_opcode))-> + object_type; op->common.node->type = (u8) object_type; } } @@ -410,23 +404,26 @@ acpi_ds_load1_end_op ( * of invocations of the method (need to know the number of * arguments.) */ - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "LOADING-Method: State=%p Op=%p named_obj=%p\n", - walk_state, op, op->named.node)); + ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, + "LOADING-Method: State=%p Op=%p named_obj=%p\n", + walk_state, op, op->named.node)); - if (!acpi_ns_get_attached_object (op->named.node)) { - walk_state->operands[0] = (void *) op->named.node; + if (!acpi_ns_get_attached_object(op->named.node)) { + walk_state->operands[0] = (void *)op->named.node; walk_state->num_operands = 1; - status = acpi_ds_create_operands (walk_state, op->common.value.arg); - if (ACPI_SUCCESS (status)) { - status = acpi_ex_create_method (op->named.data, - op->named.length, walk_state); + status = + acpi_ds_create_operands(walk_state, + op->common.value.arg); + if (ACPI_SUCCESS(status)) { + status = acpi_ex_create_method(op->named.data, + op->named.length, + walk_state); } walk_state->operands[0] = NULL; walk_state->num_operands = 0; - if (ACPI_FAILURE (status)) { + if (ACPI_FAILURE(status)) { return (status); } } @@ -434,17 +431,17 @@ acpi_ds_load1_end_op ( /* Pop the scope stack */ - if (acpi_ns_opens_scope (object_type)) { - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "(%s): Popping scope for Op %p\n", - acpi_ut_get_type_name (object_type), op)); + if (acpi_ns_opens_scope(object_type)) { + ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, + "(%s): Popping scope for Op %p\n", + acpi_ut_get_type_name(object_type), op)); - status = acpi_ds_scope_stack_pop (walk_state); + status = acpi_ds_scope_stack_pop(walk_state); } return (status); } - /******************************************************************************* * * FUNCTION: acpi_ds_load2_begin_op @@ -459,50 +456,50 @@ acpi_ds_load1_end_op ( ******************************************************************************/ acpi_status -acpi_ds_load2_begin_op ( - struct acpi_walk_state *walk_state, - union acpi_parse_object **out_op) +acpi_ds_load2_begin_op(struct acpi_walk_state * walk_state, + union acpi_parse_object ** out_op) { - union acpi_parse_object *op; - struct acpi_namespace_node *node; - acpi_status status; - acpi_object_type object_type; - char *buffer_ptr; - - - ACPI_FUNCTION_TRACE ("ds_load2_begin_op"); + union acpi_parse_object *op; + struct acpi_namespace_node *node; + acpi_status status; + acpi_object_type object_type; + char *buffer_ptr; + ACPI_FUNCTION_TRACE("ds_load2_begin_op"); op = walk_state->op; - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op, walk_state)); + ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op, + walk_state)); if (op) { if ((walk_state->control_state) && - (walk_state->control_state->common.state == - ACPI_CONTROL_CONDITIONAL_EXECUTING)) { + (walk_state->control_state->common.state == + ACPI_CONTROL_CONDITIONAL_EXECUTING)) { /* We are executing a while loop outside of a method */ - status = acpi_ds_exec_begin_op (walk_state, out_op); - return_ACPI_STATUS (status); + status = acpi_ds_exec_begin_op(walk_state, out_op); + return_ACPI_STATUS(status); } /* We only care about Namespace opcodes here */ if ((!(walk_state->op_info->flags & AML_NSOPCODE) && - (walk_state->opcode != AML_INT_NAMEPATH_OP)) || - (!(walk_state->op_info->flags & AML_NAMED))) { + (walk_state->opcode != AML_INT_NAMEPATH_OP)) || + (!(walk_state->op_info->flags & AML_NAMED))) { if ((walk_state->op_info->class == AML_CLASS_EXECUTE) || - (walk_state->op_info->class == AML_CLASS_CONTROL)) { - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "Begin/EXEC: %s (fl %8.8X)\n", walk_state->op_info->name, - walk_state->op_info->flags)); + (walk_state->op_info->class == AML_CLASS_CONTROL)) { + ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, + "Begin/EXEC: %s (fl %8.8X)\n", + walk_state->op_info->name, + walk_state->op_info->flags)); /* Executing a type1 or type2 opcode outside of a method */ - status = acpi_ds_exec_begin_op (walk_state, out_op); - return_ACPI_STATUS (status); + status = + acpi_ds_exec_begin_op(walk_state, out_op); + return_ACPI_STATUS(status); } - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } /* Get the name we are going to enter or lookup in the namespace */ @@ -514,28 +511,27 @@ acpi_ds_load2_begin_op ( if (!buffer_ptr) { /* No name, just exit */ - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - } - else { + } else { /* Get name from the op */ - buffer_ptr = (char *) &op->named.name; + buffer_ptr = (char *)&op->named.name; } - } - else { + } else { /* Get the namestring from the raw AML */ - buffer_ptr = acpi_ps_get_next_namestring (&walk_state->parser_state); + buffer_ptr = + acpi_ps_get_next_namestring(&walk_state->parser_state); } /* Map the opcode into an internal object type */ object_type = walk_state->op_info->object_type; - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "State=%p Op=%p Type=%X\n", walk_state, op, object_type)); - + ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, + "State=%p Op=%p Type=%X\n", walk_state, op, + object_type)); switch (walk_state->opcode) { case AML_FIELD_OP: @@ -553,9 +549,10 @@ acpi_ds_load2_begin_op ( * Don't enter the name into the namespace, but look it up * for use later. */ - status = acpi_ns_lookup (walk_state->scope_info, buffer_ptr, object_type, - ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, - walk_state, &(node)); + status = + acpi_ns_lookup(walk_state->scope_info, buffer_ptr, + object_type, ACPI_IMODE_EXECUTE, + ACPI_NS_SEARCH_PARENT, walk_state, &(node)); break; case AML_SCOPE_OP: @@ -565,28 +562,28 @@ acpi_ds_load2_begin_op ( * Don't enter the name into the namespace, but look it up * for use later. */ - status = acpi_ns_lookup (walk_state->scope_info, buffer_ptr, object_type, - ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, - walk_state, &(node)); - if (ACPI_FAILURE (status)) { + status = + acpi_ns_lookup(walk_state->scope_info, buffer_ptr, + object_type, ACPI_IMODE_EXECUTE, + ACPI_NS_SEARCH_PARENT, walk_state, &(node)); + if (ACPI_FAILURE(status)) { #ifdef ACPI_ASL_COMPILER if (status == AE_NOT_FOUND) { status = AE_OK; - } - else { - ACPI_REPORT_NSERROR (buffer_ptr, status); + } else { + ACPI_REPORT_NSERROR(buffer_ptr, status); } #else - ACPI_REPORT_NSERROR (buffer_ptr, status); + ACPI_REPORT_NSERROR(buffer_ptr, status); #endif - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } /* * We must check to make sure that the target is * one of the opcodes that actually opens a scope */ switch (node->type) { - case ACPI_TYPE_LOCAL_SCOPE: /* Scope */ + case ACPI_TYPE_LOCAL_SCOPE: /* Scope */ case ACPI_TYPE_DEVICE: case ACPI_TYPE_POWER: case ACPI_TYPE_PROCESSOR: @@ -607,9 +604,7 @@ acpi_ds_load2_begin_op ( * Scope (DEB) { ... } */ - ACPI_REPORT_WARNING (( - "Type override - [%4.4s] had invalid type (%s) for Scope operator, changed to (Scope)\n", - buffer_ptr, acpi_ut_get_type_name (node->type))); + ACPI_REPORT_WARNING(("Type override - [%4.4s] had invalid type (%s) for Scope operator, changed to (Scope)\n", buffer_ptr, acpi_ut_get_type_name(node->type))); node->type = ACPI_TYPE_ANY; walk_state->scope_info->common.value = ACPI_TYPE_ANY; @@ -619,9 +614,7 @@ acpi_ds_load2_begin_op ( /* All other types are an error */ - ACPI_REPORT_ERROR (( - "Invalid type (%s) for target of Scope operator [%4.4s]\n", - acpi_ut_get_type_name (node->type), buffer_ptr)); + ACPI_REPORT_ERROR(("Invalid type (%s) for target of Scope operator [%4.4s]\n", acpi_ut_get_type_name(node->type), buffer_ptr)); return (AE_AML_OPERAND_TYPE); } @@ -636,14 +629,16 @@ acpi_ds_load2_begin_op ( node = op->common.node; - if (acpi_ns_opens_scope (object_type)) { - status = acpi_ds_scope_stack_push (node, object_type, walk_state); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + if (acpi_ns_opens_scope(object_type)) { + status = + acpi_ds_scope_stack_push(node, object_type, + walk_state); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } } - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } /* @@ -664,23 +659,24 @@ acpi_ds_load2_begin_op ( /* Add new entry into namespace */ - status = acpi_ns_lookup (walk_state->scope_info, buffer_ptr, object_type, - ACPI_IMODE_LOAD_PASS2, ACPI_NS_NO_UPSEARCH, - walk_state, &(node)); + status = + acpi_ns_lookup(walk_state->scope_info, buffer_ptr, + object_type, ACPI_IMODE_LOAD_PASS2, + ACPI_NS_NO_UPSEARCH, walk_state, &(node)); break; } - if (ACPI_FAILURE (status)) { - ACPI_REPORT_NSERROR (buffer_ptr, status); - return_ACPI_STATUS (status); + if (ACPI_FAILURE(status)) { + ACPI_REPORT_NSERROR(buffer_ptr, status); + return_ACPI_STATUS(status); } if (!op) { /* Create a new op */ - op = acpi_ps_alloc_op (walk_state->opcode); + op = acpi_ps_alloc_op(walk_state->opcode); if (!op) { - return_ACPI_STATUS (AE_NO_MEMORY); + return_ACPI_STATUS(AE_NO_MEMORY); } /* Initialize the new op */ @@ -697,10 +693,9 @@ acpi_ds_load2_begin_op ( */ op->common.node = node; - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_ds_load2_end_op @@ -714,26 +709,23 @@ acpi_ds_load2_begin_op ( * ******************************************************************************/ -acpi_status -acpi_ds_load2_end_op ( - struct acpi_walk_state *walk_state) +acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state) { - union acpi_parse_object *op; - acpi_status status = AE_OK; - acpi_object_type object_type; - struct acpi_namespace_node *node; - union acpi_parse_object *arg; - struct acpi_namespace_node *new_node; + union acpi_parse_object *op; + acpi_status status = AE_OK; + acpi_object_type object_type; + struct acpi_namespace_node *node; + union acpi_parse_object *arg; + struct acpi_namespace_node *new_node; #ifndef ACPI_NO_METHOD_EXECUTION - u32 i; + u32 i; #endif - - ACPI_FUNCTION_TRACE ("ds_load2_end_op"); + ACPI_FUNCTION_TRACE("ds_load2_end_op"); op = walk_state->op; - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Opcode [%s] Op %p State %p\n", - walk_state->op_info->name, op, walk_state)); + ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Opcode [%s] Op %p State %p\n", + walk_state->op_info->name, op, walk_state)); /* Check if opcode had an associated namespace object */ @@ -742,23 +734,25 @@ acpi_ds_load2_end_op ( /* No namespace object. Executable opcode? */ if ((walk_state->op_info->class == AML_CLASS_EXECUTE) || - (walk_state->op_info->class == AML_CLASS_CONTROL)) { - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "End/EXEC: %s (fl %8.8X)\n", walk_state->op_info->name, - walk_state->op_info->flags)); + (walk_state->op_info->class == AML_CLASS_CONTROL)) { + ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, + "End/EXEC: %s (fl %8.8X)\n", + walk_state->op_info->name, + walk_state->op_info->flags)); /* Executing a type1 or type2 opcode outside of a method */ - status = acpi_ds_exec_end_op (walk_state); - return_ACPI_STATUS (status); + status = acpi_ds_exec_end_op(walk_state); + return_ACPI_STATUS(status); } #endif - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } if (op->common.aml_opcode == AML_SCOPE_OP) { - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "Ending scope Op=%p State=%p\n", op, walk_state)); + ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, + "Ending scope Op=%p State=%p\n", op, + walk_state)); } object_type = walk_state->op_info->object_type; @@ -773,18 +767,19 @@ acpi_ds_load2_end_op ( * Put the Node on the object stack (Contains the ACPI Name of * this object) */ - walk_state->operands[0] = (void *) node; + walk_state->operands[0] = (void *)node; walk_state->num_operands = 1; /* Pop the scope stack */ - if (acpi_ns_opens_scope (object_type) && - (op->common.aml_opcode != AML_INT_METHODCALL_OP)) { - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "(%s) Popping scope for Op %p\n", - acpi_ut_get_type_name (object_type), op)); + if (acpi_ns_opens_scope(object_type) && + (op->common.aml_opcode != AML_INT_METHODCALL_OP)) { + ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, + "(%s) Popping scope for Op %p\n", + acpi_ut_get_type_name(object_type), op)); - status = acpi_ds_scope_stack_pop (walk_state); - if (ACPI_FAILURE (status)) { + status = acpi_ds_scope_stack_pop(walk_state); + if (ACPI_FAILURE(status)) { goto cleanup; } } @@ -817,9 +812,10 @@ acpi_ds_load2_end_op ( * AML_THERMALZONE */ - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "Create-Load [%s] State=%p Op=%p named_obj=%p\n", - acpi_ps_get_opcode_name (op->common.aml_opcode), walk_state, op, node)); + ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, + "Create-Load [%s] State=%p Op=%p named_obj=%p\n", + acpi_ps_get_opcode_name(op->common.aml_opcode), + walk_state, op, node)); /* Decode the opcode */ @@ -834,27 +830,32 @@ acpi_ds_load2_end_op ( * Create the field object, but the field buffer and index must * be evaluated later during the execution phase */ - status = acpi_ds_create_buffer_field (op, walk_state); + status = acpi_ds_create_buffer_field(op, walk_state); break; - - case AML_TYPE_NAMED_FIELD: + case AML_TYPE_NAMED_FIELD: switch (op->common.aml_opcode) { case AML_INDEX_FIELD_OP: - status = acpi_ds_create_index_field (op, (acpi_handle) arg->common.node, - walk_state); + status = + acpi_ds_create_index_field(op, + (acpi_handle) arg-> + common.node, walk_state); break; case AML_BANK_FIELD_OP: - status = acpi_ds_create_bank_field (op, arg->common.node, walk_state); + status = + acpi_ds_create_bank_field(op, arg->common.node, + walk_state); break; case AML_FIELD_OP: - status = acpi_ds_create_field (op, arg->common.node, walk_state); + status = + acpi_ds_create_field(op, arg->common.node, + walk_state); break; default: @@ -863,43 +864,42 @@ acpi_ds_load2_end_op ( } break; + case AML_TYPE_NAMED_SIMPLE: - case AML_TYPE_NAMED_SIMPLE: - - status = acpi_ds_create_operands (walk_state, arg); - if (ACPI_FAILURE (status)) { + status = acpi_ds_create_operands(walk_state, arg); + if (ACPI_FAILURE(status)) { goto cleanup; } switch (op->common.aml_opcode) { case AML_PROCESSOR_OP: - status = acpi_ex_create_processor (walk_state); + status = acpi_ex_create_processor(walk_state); break; case AML_POWER_RES_OP: - status = acpi_ex_create_power_resource (walk_state); + status = acpi_ex_create_power_resource(walk_state); break; case AML_MUTEX_OP: - status = acpi_ex_create_mutex (walk_state); + status = acpi_ex_create_mutex(walk_state); break; case AML_EVENT_OP: - status = acpi_ex_create_event (walk_state); + status = acpi_ex_create_event(walk_state); break; case AML_DATA_REGION_OP: - status = acpi_ex_create_table_region (walk_state); + status = acpi_ex_create_table_region(walk_state); break; case AML_ALIAS_OP: - status = acpi_ex_create_alias (walk_state); + status = acpi_ex_create_alias(walk_state); break; default: @@ -912,12 +912,12 @@ acpi_ds_load2_end_op ( /* Delete operands */ for (i = 1; i < walk_state->num_operands; i++) { - acpi_ut_remove_reference (walk_state->operands[i]); + acpi_ut_remove_reference(walk_state->operands[i]); walk_state->operands[i] = NULL; } break; -#endif /* ACPI_NO_METHOD_EXECUTION */ +#endif /* ACPI_NO_METHOD_EXECUTION */ case AML_TYPE_NAMED_COMPLEX: @@ -933,9 +933,10 @@ acpi_ds_load2_end_op ( * If we have a valid region, initialize it * Namespace is NOT locked at this point. */ - status = acpi_ev_initialize_region (acpi_ns_get_attached_object (node), - FALSE); - if (ACPI_FAILURE (status)) { + status = + acpi_ev_initialize_region + (acpi_ns_get_attached_object(node), FALSE); + if (ACPI_FAILURE(status)) { /* * If AE_NOT_EXIST is returned, it is not fatal * because many regions get created before a handler @@ -947,13 +948,11 @@ acpi_ds_load2_end_op ( } break; - case AML_NAME_OP: - status = acpi_ds_create_node (walk_state, node, op); + status = acpi_ds_create_node(walk_state, node, op); break; -#endif /* ACPI_NO_METHOD_EXECUTION */ - +#endif /* ACPI_NO_METHOD_EXECUTION */ default: /* All NAMED_COMPLEX opcodes must be handled above */ @@ -962,27 +961,28 @@ acpi_ds_load2_end_op ( } break; - case AML_CLASS_INTERNAL: /* case AML_INT_NAMEPATH_OP: */ break; - case AML_CLASS_METHOD_CALL: - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "RESOLVING-method_call: State=%p Op=%p named_obj=%p\n", - walk_state, op, node)); + ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, + "RESOLVING-method_call: State=%p Op=%p named_obj=%p\n", + walk_state, op, node)); /* * Lookup the method name and save the Node */ - status = acpi_ns_lookup (walk_state->scope_info, arg->common.value.string, - ACPI_TYPE_ANY, ACPI_IMODE_LOAD_PASS2, - ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, - walk_state, &(new_node)); - if (ACPI_SUCCESS (status)) { + status = + acpi_ns_lookup(walk_state->scope_info, + arg->common.value.string, ACPI_TYPE_ANY, + ACPI_IMODE_LOAD_PASS2, + ACPI_NS_SEARCH_PARENT | + ACPI_NS_DONT_OPEN_SCOPE, walk_state, + &(new_node)); + if (ACPI_SUCCESS(status)) { /* * Make sure that what we found is indeed a method @@ -998,24 +998,20 @@ acpi_ds_load2_end_op ( * parser uses, so we can get it again at the end of this scope */ op->common.node = new_node; - } - else { - ACPI_REPORT_NSERROR (arg->common.value.string, status); + } else { + ACPI_REPORT_NSERROR(arg->common.value.string, status); } break; - default: break; } -cleanup: + cleanup: /* Remove the Node pushed at the very beginning */ walk_state->operands[0] = NULL; walk_state->num_operands = 0; - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - - diff --git a/drivers/acpi/dispatcher/dswscope.c b/drivers/acpi/dispatcher/dswscope.c index 21f4548ff32..defe956ef75 100644 --- a/drivers/acpi/dispatcher/dswscope.c +++ b/drivers/acpi/dispatcher/dswscope.c @@ -41,14 +41,11 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include #include - #define _COMPONENT ACPI_DISPATCHER - ACPI_MODULE_NAME ("dswscope") - +ACPI_MODULE_NAME("dswscope") /**************************************************************************** * @@ -62,15 +59,11 @@ * root scope object (which remains at the stack top.) * ***************************************************************************/ - -void -acpi_ds_scope_stack_clear ( - struct acpi_walk_state *walk_state) +void acpi_ds_scope_stack_clear(struct acpi_walk_state *walk_state) { - union acpi_generic_state *scope_info; - - ACPI_FUNCTION_NAME ("ds_scope_stack_clear"); + union acpi_generic_state *scope_info; + ACPI_FUNCTION_NAME("ds_scope_stack_clear"); while (walk_state->scope_info) { /* Pop a scope off the stack */ @@ -78,14 +71,14 @@ acpi_ds_scope_stack_clear ( scope_info = walk_state->scope_info; walk_state->scope_info = scope_info->scope.next; - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "Popped object type (%s)\n", - acpi_ut_get_type_name (scope_info->common.value))); - acpi_ut_delete_generic_state (scope_info); + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, + "Popped object type (%s)\n", + acpi_ut_get_type_name(scope_info->common. + value))); + acpi_ut_delete_generic_state(scope_info); } } - /**************************************************************************** * * FUNCTION: acpi_ds_scope_stack_push @@ -102,74 +95,70 @@ acpi_ds_scope_stack_clear ( ***************************************************************************/ acpi_status -acpi_ds_scope_stack_push ( - struct acpi_namespace_node *node, - acpi_object_type type, - struct acpi_walk_state *walk_state) +acpi_ds_scope_stack_push(struct acpi_namespace_node *node, + acpi_object_type type, + struct acpi_walk_state *walk_state) { - union acpi_generic_state *scope_info; - union acpi_generic_state *old_scope_info; - - - ACPI_FUNCTION_TRACE ("ds_scope_stack_push"); + union acpi_generic_state *scope_info; + union acpi_generic_state *old_scope_info; + ACPI_FUNCTION_TRACE("ds_scope_stack_push"); if (!node) { /* Invalid scope */ - ACPI_REPORT_ERROR (("ds_scope_stack_push: null scope passed\n")); - return_ACPI_STATUS (AE_BAD_PARAMETER); + ACPI_REPORT_ERROR(("ds_scope_stack_push: null scope passed\n")); + return_ACPI_STATUS(AE_BAD_PARAMETER); } /* Make sure object type is valid */ - if (!acpi_ut_valid_object_type (type)) { - ACPI_REPORT_WARNING (( - "ds_scope_stack_push: Invalid object type: 0x%X\n", type)); + if (!acpi_ut_valid_object_type(type)) { + ACPI_REPORT_WARNING(("ds_scope_stack_push: Invalid object type: 0x%X\n", type)); } /* Allocate a new scope object */ - scope_info = acpi_ut_create_generic_state (); + scope_info = acpi_ut_create_generic_state(); if (!scope_info) { - return_ACPI_STATUS (AE_NO_MEMORY); + return_ACPI_STATUS(AE_NO_MEMORY); } /* Init new scope object */ scope_info->common.data_type = ACPI_DESC_TYPE_STATE_WSCOPE; - scope_info->scope.node = node; - scope_info->common.value = (u16) type; + scope_info->scope.node = node; + scope_info->common.value = (u16) type; walk_state->scope_depth++; - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "[%.2d] Pushed scope ", (u32) walk_state->scope_depth)); + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, + "[%.2d] Pushed scope ", + (u32) walk_state->scope_depth)); old_scope_info = walk_state->scope_info; if (old_scope_info) { - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC, - "[%4.4s] (%s)", - acpi_ut_get_node_name (old_scope_info->scope.node), - acpi_ut_get_type_name (old_scope_info->common.value))); - } - else { - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC, - "[\\___] (%s)", "ROOT")); + ACPI_DEBUG_PRINT_RAW((ACPI_DB_EXEC, + "[%4.4s] (%s)", + acpi_ut_get_node_name(old_scope_info-> + scope.node), + acpi_ut_get_type_name(old_scope_info-> + common.value))); + } else { + ACPI_DEBUG_PRINT_RAW((ACPI_DB_EXEC, "[\\___] (%s)", "ROOT")); } - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC, - ", New scope -> [%4.4s] (%s)\n", - acpi_ut_get_node_name (scope_info->scope.node), - acpi_ut_get_type_name (scope_info->common.value))); + ACPI_DEBUG_PRINT_RAW((ACPI_DB_EXEC, + ", New scope -> [%4.4s] (%s)\n", + acpi_ut_get_node_name(scope_info->scope.node), + acpi_ut_get_type_name(scope_info->common.value))); /* Push new scope object onto stack */ - acpi_ut_push_generic_state (&walk_state->scope_info, scope_info); - return_ACPI_STATUS (AE_OK); + acpi_ut_push_generic_state(&walk_state->scope_info, scope_info); + return_ACPI_STATUS(AE_OK); } - /**************************************************************************** * * FUNCTION: acpi_ds_scope_stack_pop @@ -182,47 +171,41 @@ acpi_ds_scope_stack_push ( * ***************************************************************************/ -acpi_status -acpi_ds_scope_stack_pop ( - struct acpi_walk_state *walk_state) +acpi_status acpi_ds_scope_stack_pop(struct acpi_walk_state *walk_state) { - union acpi_generic_state *scope_info; - union acpi_generic_state *new_scope_info; - - - ACPI_FUNCTION_TRACE ("ds_scope_stack_pop"); + union acpi_generic_state *scope_info; + union acpi_generic_state *new_scope_info; + ACPI_FUNCTION_TRACE("ds_scope_stack_pop"); /* * Pop scope info object off the stack. */ - scope_info = acpi_ut_pop_generic_state (&walk_state->scope_info); + scope_info = acpi_ut_pop_generic_state(&walk_state->scope_info); if (!scope_info) { - return_ACPI_STATUS (AE_STACK_UNDERFLOW); + return_ACPI_STATUS(AE_STACK_UNDERFLOW); } walk_state->scope_depth--; - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "[%.2d] Popped scope [%4.4s] (%s), New scope -> ", - (u32) walk_state->scope_depth, - acpi_ut_get_node_name (scope_info->scope.node), - acpi_ut_get_type_name (scope_info->common.value))); + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, + "[%.2d] Popped scope [%4.4s] (%s), New scope -> ", + (u32) walk_state->scope_depth, + acpi_ut_get_node_name(scope_info->scope.node), + acpi_ut_get_type_name(scope_info->common.value))); new_scope_info = walk_state->scope_info; if (new_scope_info) { - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC, - "[%4.4s] (%s)\n", - acpi_ut_get_node_name (new_scope_info->scope.node), - acpi_ut_get_type_name (new_scope_info->common.value))); - } - else { - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC, - "[\\___] (ROOT)\n")); + ACPI_DEBUG_PRINT_RAW((ACPI_DB_EXEC, + "[%4.4s] (%s)\n", + acpi_ut_get_node_name(new_scope_info-> + scope.node), + acpi_ut_get_type_name(new_scope_info-> + common.value))); + } else { + ACPI_DEBUG_PRINT_RAW((ACPI_DB_EXEC, "[\\___] (ROOT)\n")); } - acpi_ut_delete_generic_state (scope_info); - return_ACPI_STATUS (AE_OK); + acpi_ut_delete_generic_state(scope_info); + return_ACPI_STATUS(AE_OK); } - - diff --git a/drivers/acpi/dispatcher/dswstate.c b/drivers/acpi/dispatcher/dswstate.c index 5621665991b..7d68a5aaf3c 100644 --- a/drivers/acpi/dispatcher/dswstate.c +++ b/drivers/acpi/dispatcher/dswstate.c @@ -41,37 +41,28 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include #include #include #include #define _COMPONENT ACPI_DISPATCHER - ACPI_MODULE_NAME ("dswstate") +ACPI_MODULE_NAME("dswstate") /* Local prototypes */ - #ifdef ACPI_OBSOLETE_FUNCTIONS acpi_status -acpi_ds_result_insert ( - void *object, - u32 index, - struct acpi_walk_state *walk_state); +acpi_ds_result_insert(void *object, + u32 index, struct acpi_walk_state *walk_state); -acpi_status -acpi_ds_obj_stack_delete_all ( - struct acpi_walk_state *walk_state); +acpi_status acpi_ds_obj_stack_delete_all(struct acpi_walk_state *walk_state); acpi_status -acpi_ds_obj_stack_pop_object ( - union acpi_operand_object **object, - struct acpi_walk_state *walk_state); - -void * -acpi_ds_obj_stack_get_value ( - u32 index, - struct acpi_walk_state *walk_state); +acpi_ds_obj_stack_pop_object(union acpi_operand_object **object, + struct acpi_walk_state *walk_state); + +void *acpi_ds_obj_stack_get_value(u32 index, + struct acpi_walk_state *walk_state); #endif #ifdef ACPI_FUTURE_USAGE @@ -92,36 +83,35 @@ acpi_ds_obj_stack_get_value ( ******************************************************************************/ acpi_status -acpi_ds_result_remove ( - union acpi_operand_object **object, - u32 index, - struct acpi_walk_state *walk_state) +acpi_ds_result_remove(union acpi_operand_object **object, + u32 index, struct acpi_walk_state *walk_state) { - union acpi_generic_state *state; - - - ACPI_FUNCTION_NAME ("ds_result_remove"); + union acpi_generic_state *state; + ACPI_FUNCTION_NAME("ds_result_remove"); state = walk_state->results; if (!state) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No result object pushed! State=%p\n", - walk_state)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "No result object pushed! State=%p\n", + walk_state)); return (AE_NOT_EXIST); } if (index >= ACPI_OBJ_MAX_OPERAND) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Index out of range: %X State=%p Num=%X\n", - index, walk_state, state->results.num_results)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Index out of range: %X State=%p Num=%X\n", + index, walk_state, + state->results.num_results)); } /* Check for a valid result object */ - if (!state->results.obj_desc [index]) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Null operand! State=%p #Ops=%X, Index=%X\n", - walk_state, state->results.num_results, index)); + if (!state->results.obj_desc[index]) { + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Null operand! State=%p #Ops=%X, Index=%X\n", + walk_state, state->results.num_results, + index)); return (AE_AML_NO_RETURN_VALUE); } @@ -129,18 +119,20 @@ acpi_ds_result_remove ( state->results.num_results--; - *object = state->results.obj_desc [index]; - state->results.obj_desc [index] = NULL; + *object = state->results.obj_desc[index]; + state->results.obj_desc[index] = NULL; - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "Obj=%p [%s] Index=%X State=%p Num=%X\n", - *object, (*object) ? acpi_ut_get_object_type_name (*object) : "NULL", - index, walk_state, state->results.num_results)); + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, + "Obj=%p [%s] Index=%X State=%p Num=%X\n", + *object, + (*object) ? acpi_ut_get_object_type_name(*object) : + "NULL", index, walk_state, + state->results.num_results)); return (AE_OK); } -#endif /* ACPI_FUTURE_USAGE */ +#endif /* ACPI_FUTURE_USAGE */ /******************************************************************************* * @@ -157,16 +149,13 @@ acpi_ds_result_remove ( ******************************************************************************/ acpi_status -acpi_ds_result_pop ( - union acpi_operand_object **object, - struct acpi_walk_state *walk_state) +acpi_ds_result_pop(union acpi_operand_object ** object, + struct acpi_walk_state * walk_state) { - acpi_native_uint index; - union acpi_generic_state *state; - - - ACPI_FUNCTION_NAME ("ds_result_pop"); + acpi_native_uint index; + union acpi_generic_state *state; + ACPI_FUNCTION_NAME("ds_result_pop"); state = walk_state->results; if (!state) { @@ -174,8 +163,9 @@ acpi_ds_result_pop ( } if (!state->results.num_results) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Result stack is empty! State=%p\n", - walk_state)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Result stack is empty! State=%p\n", + walk_state)); return (AE_AML_NO_RETURN_VALUE); } @@ -186,26 +176,27 @@ acpi_ds_result_pop ( for (index = ACPI_OBJ_NUM_OPERANDS; index; index--) { /* Check for a valid result object */ - if (state->results.obj_desc [index -1]) { - *object = state->results.obj_desc [index -1]; - state->results.obj_desc [index -1] = NULL; + if (state->results.obj_desc[index - 1]) { + *object = state->results.obj_desc[index - 1]; + state->results.obj_desc[index - 1] = NULL; - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "Obj=%p [%s] Index=%X State=%p Num=%X\n", - *object, - (*object) ? acpi_ut_get_object_type_name (*object) : "NULL", - (u32) index -1, walk_state, state->results.num_results)); + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, + "Obj=%p [%s] Index=%X State=%p Num=%X\n", + *object, + (*object) ? + acpi_ut_get_object_type_name(*object) + : "NULL", (u32) index - 1, walk_state, + state->results.num_results)); return (AE_OK); } } - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "No result objects! State=%p\n", walk_state)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "No result objects! State=%p\n", walk_state)); return (AE_AML_NO_RETURN_VALUE); } - /******************************************************************************* * * FUNCTION: acpi_ds_result_pop_from_bottom @@ -221,38 +212,37 @@ acpi_ds_result_pop ( ******************************************************************************/ acpi_status -acpi_ds_result_pop_from_bottom ( - union acpi_operand_object **object, - struct acpi_walk_state *walk_state) +acpi_ds_result_pop_from_bottom(union acpi_operand_object ** object, + struct acpi_walk_state * walk_state) { - acpi_native_uint index; - union acpi_generic_state *state; - - - ACPI_FUNCTION_NAME ("ds_result_pop_from_bottom"); + acpi_native_uint index; + union acpi_generic_state *state; + ACPI_FUNCTION_NAME("ds_result_pop_from_bottom"); state = walk_state->results; if (!state) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Warning: No result object pushed! State=%p\n", walk_state)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Warning: No result object pushed! State=%p\n", + walk_state)); return (AE_NOT_EXIST); } if (!state->results.num_results) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No result objects! State=%p\n", - walk_state)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "No result objects! State=%p\n", walk_state)); return (AE_AML_NO_RETURN_VALUE); } /* Remove Bottom element */ - *object = state->results.obj_desc [0]; + *object = state->results.obj_desc[0]; /* Push entire stack down one element */ for (index = 0; index < state->results.num_results; index++) { - state->results.obj_desc [index] = state->results.obj_desc [index + 1]; + state->results.obj_desc[index] = + state->results.obj_desc[index + 1]; } state->results.num_results--; @@ -260,20 +250,21 @@ acpi_ds_result_pop_from_bottom ( /* Check for a valid result object */ if (!*object) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Null operand! State=%p #Ops=%X Index=%X\n", - walk_state, state->results.num_results, (u32) index)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Null operand! State=%p #Ops=%X Index=%X\n", + walk_state, state->results.num_results, + (u32) index)); return (AE_AML_NO_RETURN_VALUE); } - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s] Results=%p State=%p\n", - *object, (*object) ? acpi_ut_get_object_type_name (*object) : "NULL", - state, walk_state)); + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Obj=%p [%s] Results=%p State=%p\n", + *object, + (*object) ? acpi_ut_get_object_type_name(*object) : + "NULL", state, walk_state)); return (AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_ds_result_push @@ -288,47 +279,50 @@ acpi_ds_result_pop_from_bottom ( ******************************************************************************/ acpi_status -acpi_ds_result_push ( - union acpi_operand_object *object, - struct acpi_walk_state *walk_state) +acpi_ds_result_push(union acpi_operand_object * object, + struct acpi_walk_state * walk_state) { - union acpi_generic_state *state; - - - ACPI_FUNCTION_NAME ("ds_result_push"); + union acpi_generic_state *state; + ACPI_FUNCTION_NAME("ds_result_push"); state = walk_state->results; if (!state) { - ACPI_REPORT_ERROR (("No result stack frame during push\n")); + ACPI_REPORT_ERROR(("No result stack frame during push\n")); return (AE_AML_INTERNAL); } if (state->results.num_results == ACPI_OBJ_NUM_OPERANDS) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Result stack overflow: Obj=%p State=%p Num=%X\n", - object, walk_state, state->results.num_results)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Result stack overflow: Obj=%p State=%p Num=%X\n", + object, walk_state, + state->results.num_results)); return (AE_STACK_OVERFLOW); } if (!object) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Null Object! Obj=%p State=%p Num=%X\n", - object, walk_state, state->results.num_results)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Null Object! Obj=%p State=%p Num=%X\n", + object, walk_state, + state->results.num_results)); return (AE_BAD_PARAMETER); } - state->results.obj_desc [state->results.num_results] = object; + state->results.obj_desc[state->results.num_results] = object; state->results.num_results++; - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s] State=%p Num=%X Cur=%X\n", - object, object ? acpi_ut_get_object_type_name ((union acpi_operand_object *) object) : "NULL", - walk_state, state->results.num_results, walk_state->current_result)); + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Obj=%p [%s] State=%p Num=%X Cur=%X\n", + object, + object ? + acpi_ut_get_object_type_name((union + acpi_operand_object *) + object) : "NULL", + walk_state, state->results.num_results, + walk_state->current_result)); return (AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_ds_result_stack_push @@ -341,30 +335,26 @@ acpi_ds_result_push ( * ******************************************************************************/ -acpi_status -acpi_ds_result_stack_push ( - struct acpi_walk_state *walk_state) +acpi_status acpi_ds_result_stack_push(struct acpi_walk_state * walk_state) { - union acpi_generic_state *state; + union acpi_generic_state *state; - ACPI_FUNCTION_NAME ("ds_result_stack_push"); + ACPI_FUNCTION_NAME("ds_result_stack_push"); - - state = acpi_ut_create_generic_state (); + state = acpi_ut_create_generic_state(); if (!state) { return (AE_NO_MEMORY); } state->common.data_type = ACPI_DESC_TYPE_STATE_RESULT; - acpi_ut_push_generic_state (&walk_state->results, state); + acpi_ut_push_generic_state(&walk_state->results, state); - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Results=%p State=%p\n", - state, walk_state)); + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Results=%p State=%p\n", + state, walk_state)); return (AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_ds_result_stack_pop @@ -377,35 +367,31 @@ acpi_ds_result_stack_push ( * ******************************************************************************/ -acpi_status -acpi_ds_result_stack_pop ( - struct acpi_walk_state *walk_state) +acpi_status acpi_ds_result_stack_pop(struct acpi_walk_state * walk_state) { - union acpi_generic_state *state; - - ACPI_FUNCTION_NAME ("ds_result_stack_pop"); + union acpi_generic_state *state; + ACPI_FUNCTION_NAME("ds_result_stack_pop"); /* Check for stack underflow */ if (walk_state->results == NULL) { - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Underflow - State=%p\n", - walk_state)); + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Underflow - State=%p\n", + walk_state)); return (AE_AML_NO_OPERAND); } - state = acpi_ut_pop_generic_state (&walk_state->results); + state = acpi_ut_pop_generic_state(&walk_state->results); - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "Result=%p remaining_results=%X State=%p\n", - state, state->results.num_results, walk_state)); + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, + "Result=%p remaining_results=%X State=%p\n", + state, state->results.num_results, walk_state)); - acpi_ut_delete_generic_state (state); + acpi_ut_delete_generic_state(state); return (AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_ds_obj_stack_push @@ -420,35 +406,35 @@ acpi_ds_result_stack_pop ( ******************************************************************************/ acpi_status -acpi_ds_obj_stack_push ( - void *object, - struct acpi_walk_state *walk_state) +acpi_ds_obj_stack_push(void *object, struct acpi_walk_state * walk_state) { - ACPI_FUNCTION_NAME ("ds_obj_stack_push"); - + ACPI_FUNCTION_NAME("ds_obj_stack_push"); /* Check for stack overflow */ if (walk_state->num_operands >= ACPI_OBJ_NUM_OPERANDS) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "overflow! Obj=%p State=%p #Ops=%X\n", - object, walk_state, walk_state->num_operands)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "overflow! Obj=%p State=%p #Ops=%X\n", + object, walk_state, + walk_state->num_operands)); return (AE_STACK_OVERFLOW); } /* Put the object onto the stack */ - walk_state->operands [walk_state->num_operands] = object; + walk_state->operands[walk_state->num_operands] = object; walk_state->num_operands++; - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s] State=%p #Ops=%X\n", - object, acpi_ut_get_object_type_name ((union acpi_operand_object *) object), - walk_state, walk_state->num_operands)); + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Obj=%p [%s] State=%p #Ops=%X\n", + object, + acpi_ut_get_object_type_name((union + acpi_operand_object *) + object), walk_state, + walk_state->num_operands)); return (AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_ds_obj_stack_pop @@ -464,38 +450,35 @@ acpi_ds_obj_stack_push ( ******************************************************************************/ acpi_status -acpi_ds_obj_stack_pop ( - u32 pop_count, - struct acpi_walk_state *walk_state) +acpi_ds_obj_stack_pop(u32 pop_count, struct acpi_walk_state * walk_state) { - u32 i; - - ACPI_FUNCTION_NAME ("ds_obj_stack_pop"); + u32 i; + ACPI_FUNCTION_NAME("ds_obj_stack_pop"); for (i = 0; i < pop_count; i++) { /* Check for stack underflow */ if (walk_state->num_operands == 0) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Underflow! Count=%X State=%p #Ops=%X\n", - pop_count, walk_state, walk_state->num_operands)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Underflow! Count=%X State=%p #Ops=%X\n", + pop_count, walk_state, + walk_state->num_operands)); return (AE_STACK_UNDERFLOW); } /* Just set the stack entry to null */ walk_state->num_operands--; - walk_state->operands [walk_state->num_operands] = NULL; + walk_state->operands[walk_state->num_operands] = NULL; } - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Count=%X State=%p #Ops=%X\n", + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Count=%X State=%p #Ops=%X\n", pop_count, walk_state, walk_state->num_operands)); return (AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_ds_obj_stack_pop_and_delete @@ -511,44 +494,43 @@ acpi_ds_obj_stack_pop ( ******************************************************************************/ acpi_status -acpi_ds_obj_stack_pop_and_delete ( - u32 pop_count, - struct acpi_walk_state *walk_state) +acpi_ds_obj_stack_pop_and_delete(u32 pop_count, + struct acpi_walk_state * walk_state) { - u32 i; - union acpi_operand_object *obj_desc; - - - ACPI_FUNCTION_NAME ("ds_obj_stack_pop_and_delete"); + u32 i; + union acpi_operand_object *obj_desc; + ACPI_FUNCTION_NAME("ds_obj_stack_pop_and_delete"); for (i = 0; i < pop_count; i++) { /* Check for stack underflow */ if (walk_state->num_operands == 0) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Underflow! Count=%X State=%p #Ops=%X\n", - pop_count, walk_state, walk_state->num_operands)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Underflow! Count=%X State=%p #Ops=%X\n", + pop_count, walk_state, + walk_state->num_operands)); return (AE_STACK_UNDERFLOW); } /* Pop the stack and delete an object if present in this stack entry */ walk_state->num_operands--; - obj_desc = walk_state->operands [walk_state->num_operands]; + obj_desc = walk_state->operands[walk_state->num_operands]; if (obj_desc) { - acpi_ut_remove_reference (walk_state->operands [walk_state->num_operands]); - walk_state->operands [walk_state->num_operands] = NULL; + acpi_ut_remove_reference(walk_state-> + operands[walk_state-> + num_operands]); + walk_state->operands[walk_state->num_operands] = NULL; } } - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Count=%X State=%p #Ops=%X\n", + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Count=%X State=%p #Ops=%X\n", pop_count, walk_state, walk_state->num_operands)); return (AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_ds_get_current_walk_state @@ -562,25 +544,21 @@ acpi_ds_obj_stack_pop_and_delete ( * ******************************************************************************/ -struct acpi_walk_state * -acpi_ds_get_current_walk_state ( - struct acpi_thread_state *thread) - +struct acpi_walk_state *acpi_ds_get_current_walk_state(struct acpi_thread_state + *thread) { - ACPI_FUNCTION_NAME ("ds_get_current_walk_state"); - + ACPI_FUNCTION_NAME("ds_get_current_walk_state"); if (!thread) { return (NULL); } - ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Current walk_state %p\n", - thread->walk_state_list)); + ACPI_DEBUG_PRINT((ACPI_DB_PARSE, "Current walk_state %p\n", + thread->walk_state_list)); return (thread->walk_state_list); } - /******************************************************************************* * * FUNCTION: acpi_ds_push_walk_state @@ -595,20 +573,17 @@ acpi_ds_get_current_walk_state ( ******************************************************************************/ void -acpi_ds_push_walk_state ( - struct acpi_walk_state *walk_state, - struct acpi_thread_state *thread) +acpi_ds_push_walk_state(struct acpi_walk_state *walk_state, + struct acpi_thread_state *thread) { - ACPI_FUNCTION_TRACE ("ds_push_walk_state"); - + ACPI_FUNCTION_TRACE("ds_push_walk_state"); - walk_state->next = thread->walk_state_list; + walk_state->next = thread->walk_state_list; thread->walk_state_list = walk_state; return_VOID; } - /******************************************************************************* * * FUNCTION: acpi_ds_pop_walk_state @@ -623,15 +598,11 @@ acpi_ds_push_walk_state ( * ******************************************************************************/ -struct acpi_walk_state * -acpi_ds_pop_walk_state ( - struct acpi_thread_state *thread) +struct acpi_walk_state *acpi_ds_pop_walk_state(struct acpi_thread_state *thread) { - struct acpi_walk_state *walk_state; - - - ACPI_FUNCTION_TRACE ("ds_pop_walk_state"); + struct acpi_walk_state *walk_state; + ACPI_FUNCTION_TRACE("ds_pop_walk_state"); walk_state = thread->walk_state_list; @@ -647,10 +618,9 @@ acpi_ds_pop_walk_state ( */ } - return_PTR (walk_state); + return_PTR(walk_state); } - /******************************************************************************* * * FUNCTION: acpi_ds_create_walk_state @@ -667,57 +637,55 @@ acpi_ds_pop_walk_state ( * ******************************************************************************/ -struct acpi_walk_state * -acpi_ds_create_walk_state ( - acpi_owner_id owner_id, - union acpi_parse_object *origin, - union acpi_operand_object *mth_desc, - struct acpi_thread_state *thread) +struct acpi_walk_state *acpi_ds_create_walk_state(acpi_owner_id owner_id, + union acpi_parse_object + *origin, + union acpi_operand_object + *mth_desc, + struct acpi_thread_state + *thread) { - struct acpi_walk_state *walk_state; - acpi_status status; - - - ACPI_FUNCTION_TRACE ("ds_create_walk_state"); + struct acpi_walk_state *walk_state; + acpi_status status; + ACPI_FUNCTION_TRACE("ds_create_walk_state"); - walk_state = ACPI_MEM_CALLOCATE (sizeof (struct acpi_walk_state)); + walk_state = ACPI_MEM_CALLOCATE(sizeof(struct acpi_walk_state)); if (!walk_state) { - return_PTR (NULL); + return_PTR(NULL); } - walk_state->data_type = ACPI_DESC_TYPE_WALK; - walk_state->owner_id = owner_id; - walk_state->origin = origin; - walk_state->method_desc = mth_desc; - walk_state->thread = thread; + walk_state->data_type = ACPI_DESC_TYPE_WALK; + walk_state->owner_id = owner_id; + walk_state->origin = origin; + walk_state->method_desc = mth_desc; + walk_state->thread = thread; walk_state->parser_state.start_op = origin; /* Init the method args/local */ #if (!defined (ACPI_NO_METHOD_EXECUTION) && !defined (ACPI_CONSTANT_EVAL_ONLY)) - acpi_ds_method_data_init (walk_state); + acpi_ds_method_data_init(walk_state); #endif /* Create an initial result stack entry */ - status = acpi_ds_result_stack_push (walk_state); - if (ACPI_FAILURE (status)) { - ACPI_MEM_FREE (walk_state); - return_PTR (NULL); + status = acpi_ds_result_stack_push(walk_state); + if (ACPI_FAILURE(status)) { + ACPI_MEM_FREE(walk_state); + return_PTR(NULL); } /* Put the new state at the head of the walk list */ if (thread) { - acpi_ds_push_walk_state (walk_state, thread); + acpi_ds_push_walk_state(walk_state, thread); } - return_PTR (walk_state); + return_PTR(walk_state); } - /******************************************************************************* * * FUNCTION: acpi_ds_init_aml_walk @@ -737,27 +705,23 @@ acpi_ds_create_walk_state ( ******************************************************************************/ acpi_status -acpi_ds_init_aml_walk ( - struct acpi_walk_state *walk_state, - union acpi_parse_object *op, - struct acpi_namespace_node *method_node, - u8 *aml_start, - u32 aml_length, - struct acpi_parameter_info *info, - u8 pass_number) +acpi_ds_init_aml_walk(struct acpi_walk_state *walk_state, + union acpi_parse_object *op, + struct acpi_namespace_node *method_node, + u8 * aml_start, + u32 aml_length, + struct acpi_parameter_info *info, u8 pass_number) { - acpi_status status; - struct acpi_parse_state *parser_state = &walk_state->parser_state; - union acpi_parse_object *extra_op; - + acpi_status status; + struct acpi_parse_state *parser_state = &walk_state->parser_state; + union acpi_parse_object *extra_op; - ACPI_FUNCTION_TRACE ("ds_init_aml_walk"); + ACPI_FUNCTION_TRACE("ds_init_aml_walk"); - - walk_state->parser_state.aml = - walk_state->parser_state.aml_start = aml_start; + walk_state->parser_state.aml = + walk_state->parser_state.aml_start = aml_start; walk_state->parser_state.aml_end = - walk_state->parser_state.pkg_end = aml_start + aml_length; + walk_state->parser_state.pkg_end = aml_start + aml_length; /* The next_op of the next_walk will be the beginning of the method */ @@ -766,42 +730,45 @@ acpi_ds_init_aml_walk ( if (info) { if (info->parameter_type == ACPI_PARAM_GPE) { - walk_state->gpe_event_info = ACPI_CAST_PTR (struct acpi_gpe_event_info, - info->parameters); - } - else { - walk_state->params = info->parameters; + walk_state->gpe_event_info = + ACPI_CAST_PTR(struct acpi_gpe_event_info, + info->parameters); + } else { + walk_state->params = info->parameters; walk_state->caller_return_desc = &info->return_object; } } - status = acpi_ps_init_scope (&walk_state->parser_state, op); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ps_init_scope(&walk_state->parser_state, op); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } if (method_node) { walk_state->parser_state.start_node = method_node; - walk_state->walk_type = ACPI_WALK_METHOD; - walk_state->method_node = method_node; - walk_state->method_desc = acpi_ns_get_attached_object (method_node); + walk_state->walk_type = ACPI_WALK_METHOD; + walk_state->method_node = method_node; + walk_state->method_desc = + acpi_ns_get_attached_object(method_node); /* Push start scope on scope stack and make it current */ - status = acpi_ds_scope_stack_push (method_node, ACPI_TYPE_METHOD, walk_state); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = + acpi_ds_scope_stack_push(method_node, ACPI_TYPE_METHOD, + walk_state); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* Init the method arguments */ - status = acpi_ds_method_data_init_args (walk_state->params, - ACPI_METHOD_NUM_ARGS, walk_state); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ds_method_data_init_args(walk_state->params, + ACPI_METHOD_NUM_ARGS, + walk_state); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } - } - else { + } else { /* * Setup the current scope. * Find a Named Op that has a namespace node associated with it. @@ -815,27 +782,27 @@ acpi_ds_init_aml_walk ( if (!extra_op) { parser_state->start_node = NULL; - } - else { + } else { parser_state->start_node = extra_op->common.node; } if (parser_state->start_node) { /* Push start scope on scope stack and make it current */ - status = acpi_ds_scope_stack_push (parser_state->start_node, - parser_state->start_node->type, walk_state); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = + acpi_ds_scope_stack_push(parser_state->start_node, + parser_state->start_node-> + type, walk_state); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } } } - status = acpi_ds_init_callbacks (walk_state, pass_number); - return_ACPI_STATUS (status); + status = acpi_ds_init_callbacks(walk_state, pass_number); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_ds_delete_walk_state @@ -848,29 +815,27 @@ acpi_ds_init_aml_walk ( * ******************************************************************************/ -void -acpi_ds_delete_walk_state ( - struct acpi_walk_state *walk_state) +void acpi_ds_delete_walk_state(struct acpi_walk_state *walk_state) { - union acpi_generic_state *state; - - - ACPI_FUNCTION_TRACE_PTR ("ds_delete_walk_state", walk_state); + union acpi_generic_state *state; + ACPI_FUNCTION_TRACE_PTR("ds_delete_walk_state", walk_state); if (!walk_state) { return; } if (walk_state->data_type != ACPI_DESC_TYPE_WALK) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%p is not a valid walk state\n", - walk_state)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "%p is not a valid walk state\n", + walk_state)); return; } if (walk_state->parser_state.scope) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%p walk still has a scope list\n", - walk_state)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "%p walk still has a scope list\n", + walk_state)); } /* Always must free any linked control states */ @@ -879,7 +844,7 @@ acpi_ds_delete_walk_state ( state = walk_state->control_state; walk_state->control_state = state->common.next; - acpi_ut_delete_generic_state (state); + acpi_ut_delete_generic_state(state); } /* Always must free any linked parse states */ @@ -888,7 +853,7 @@ acpi_ds_delete_walk_state ( state = walk_state->scope_info; walk_state->scope_info = state->common.next; - acpi_ut_delete_generic_state (state); + acpi_ut_delete_generic_state(state); } /* Always must free any stacked result states */ @@ -897,14 +862,13 @@ acpi_ds_delete_walk_state ( state = walk_state->results; walk_state->results = state->common.next; - acpi_ut_delete_generic_state (state); + acpi_ut_delete_generic_state(state); } - ACPI_MEM_FREE (walk_state); + ACPI_MEM_FREE(walk_state); return_VOID; } - #ifdef ACPI_OBSOLETE_FUNCTIONS /******************************************************************************* * @@ -921,50 +885,53 @@ acpi_ds_delete_walk_state ( ******************************************************************************/ acpi_status -acpi_ds_result_insert ( - void *object, - u32 index, - struct acpi_walk_state *walk_state) +acpi_ds_result_insert(void *object, + u32 index, struct acpi_walk_state *walk_state) { - union acpi_generic_state *state; - - - ACPI_FUNCTION_NAME ("ds_result_insert"); + union acpi_generic_state *state; + ACPI_FUNCTION_NAME("ds_result_insert"); state = walk_state->results; if (!state) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No result object pushed! State=%p\n", - walk_state)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "No result object pushed! State=%p\n", + walk_state)); return (AE_NOT_EXIST); } if (index >= ACPI_OBJ_NUM_OPERANDS) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Index out of range: %X Obj=%p State=%p Num=%X\n", - index, object, walk_state, state->results.num_results)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Index out of range: %X Obj=%p State=%p Num=%X\n", + index, object, walk_state, + state->results.num_results)); return (AE_BAD_PARAMETER); } if (!object) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Null Object! Index=%X Obj=%p State=%p Num=%X\n", - index, object, walk_state, state->results.num_results)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Null Object! Index=%X Obj=%p State=%p Num=%X\n", + index, object, walk_state, + state->results.num_results)); return (AE_BAD_PARAMETER); } - state->results.obj_desc [index] = object; + state->results.obj_desc[index] = object; state->results.num_results++; - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "Obj=%p [%s] State=%p Num=%X Cur=%X\n", - object, object ? acpi_ut_get_object_type_name ((union acpi_operand_object *) object) : "NULL", - walk_state, state->results.num_results, walk_state->current_result)); + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, + "Obj=%p [%s] State=%p Num=%X Cur=%X\n", + object, + object ? + acpi_ut_get_object_type_name((union + acpi_operand_object *) + object) : "NULL", + walk_state, state->results.num_results, + walk_state->current_result)); return (AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_ds_obj_stack_delete_all @@ -978,29 +945,24 @@ acpi_ds_result_insert ( * ******************************************************************************/ -acpi_status -acpi_ds_obj_stack_delete_all ( - struct acpi_walk_state *walk_state) +acpi_status acpi_ds_obj_stack_delete_all(struct acpi_walk_state * walk_state) { - u32 i; - - - ACPI_FUNCTION_TRACE_PTR ("ds_obj_stack_delete_all", walk_state); + u32 i; + ACPI_FUNCTION_TRACE_PTR("ds_obj_stack_delete_all", walk_state); /* The stack size is configurable, but fixed */ for (i = 0; i < ACPI_OBJ_NUM_OPERANDS; i++) { if (walk_state->operands[i]) { - acpi_ut_remove_reference (walk_state->operands[i]); + acpi_ut_remove_reference(walk_state->operands[i]); walk_state->operands[i] = NULL; } } - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_ds_obj_stack_pop_object @@ -1016,19 +978,17 @@ acpi_ds_obj_stack_delete_all ( ******************************************************************************/ acpi_status -acpi_ds_obj_stack_pop_object ( - union acpi_operand_object **object, - struct acpi_walk_state *walk_state) +acpi_ds_obj_stack_pop_object(union acpi_operand_object **object, + struct acpi_walk_state *walk_state) { - ACPI_FUNCTION_NAME ("ds_obj_stack_pop_object"); - + ACPI_FUNCTION_NAME("ds_obj_stack_pop_object"); /* Check for stack underflow */ if (walk_state->num_operands == 0) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Missing operand/stack empty! State=%p #Ops=%X\n", - walk_state, walk_state->num_operands)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Missing operand/stack empty! State=%p #Ops=%X\n", + walk_state, walk_state->num_operands)); *object = NULL; return (AE_AML_NO_OPERAND); } @@ -1039,27 +999,26 @@ acpi_ds_obj_stack_pop_object ( /* Check for a valid operand */ - if (!walk_state->operands [walk_state->num_operands]) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Null operand! State=%p #Ops=%X\n", - walk_state, walk_state->num_operands)); + if (!walk_state->operands[walk_state->num_operands]) { + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Null operand! State=%p #Ops=%X\n", + walk_state, walk_state->num_operands)); *object = NULL; return (AE_AML_NO_OPERAND); } /* Get operand and set stack entry to null */ - *object = walk_state->operands [walk_state->num_operands]; - walk_state->operands [walk_state->num_operands] = NULL; + *object = walk_state->operands[walk_state->num_operands]; + walk_state->operands[walk_state->num_operands] = NULL; - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s] State=%p #Ops=%X\n", - *object, acpi_ut_get_object_type_name (*object), + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Obj=%p [%s] State=%p #Ops=%X\n", + *object, acpi_ut_get_object_type_name(*object), walk_state, walk_state->num_operands)); return (AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_ds_obj_stack_get_value @@ -1075,30 +1034,25 @@ acpi_ds_obj_stack_pop_object ( * ******************************************************************************/ -void * -acpi_ds_obj_stack_get_value ( - u32 index, - struct acpi_walk_state *walk_state) +void *acpi_ds_obj_stack_get_value(u32 index, struct acpi_walk_state *walk_state) { - ACPI_FUNCTION_TRACE_PTR ("ds_obj_stack_get_value", walk_state); - + ACPI_FUNCTION_TRACE_PTR("ds_obj_stack_get_value", walk_state); /* Can't do it if the stack is empty */ if (walk_state->num_operands == 0) { - return_PTR (NULL); + return_PTR(NULL); } /* or if the index is past the top of the stack */ if (index > (walk_state->num_operands - (u32) 1)) { - return_PTR (NULL); + return_PTR(NULL); } - return_PTR (walk_state->operands[(acpi_native_uint)(walk_state->num_operands - 1) - - index]); + return_PTR(walk_state-> + operands[(acpi_native_uint) (walk_state->num_operands - 1) - + index]); } #endif - - diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index 1ac5731d45e..b15f5ec81d0 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c @@ -38,130 +38,112 @@ #include #define _COMPONENT ACPI_EC_COMPONENT -ACPI_MODULE_NAME ("acpi_ec") - +ACPI_MODULE_NAME("acpi_ec") #define ACPI_EC_COMPONENT 0x00100000 #define ACPI_EC_CLASS "embedded_controller" #define ACPI_EC_HID "PNP0C09" #define ACPI_EC_DRIVER_NAME "ACPI Embedded Controller Driver" #define ACPI_EC_DEVICE_NAME "Embedded Controller" #define ACPI_EC_FILE_INFO "info" - - #define ACPI_EC_FLAG_OBF 0x01 /* Output buffer full */ #define ACPI_EC_FLAG_IBF 0x02 /* Input buffer full */ #define ACPI_EC_FLAG_BURST 0x10 /* burst mode */ #define ACPI_EC_FLAG_SCI 0x20 /* EC-SCI occurred */ - #define ACPI_EC_EVENT_OBF 0x01 /* Output buffer full */ #define ACPI_EC_EVENT_IBE 0x02 /* Input buffer empty */ - #define ACPI_EC_DELAY 50 /* Wait 50ms max. during EC ops */ #define ACPI_EC_UDELAY_GLK 1000 /* Wait 1ms max. to get global lock */ - -#define ACPI_EC_UDELAY 100 /* Poll @ 100us increments */ -#define ACPI_EC_UDELAY_COUNT 1000 /* Wait 10ms max. during EC ops */ - +#define ACPI_EC_UDELAY 100 /* Poll @ 100us increments */ +#define ACPI_EC_UDELAY_COUNT 1000 /* Wait 10ms max. during EC ops */ #define ACPI_EC_COMMAND_READ 0x80 #define ACPI_EC_COMMAND_WRITE 0x81 #define ACPI_EC_BURST_ENABLE 0x82 #define ACPI_EC_BURST_DISABLE 0x83 #define ACPI_EC_COMMAND_QUERY 0x84 - #define EC_POLLING 0xFF #define EC_BURST 0x00 - - -static int acpi_ec_remove (struct acpi_device *device, int type); -static int acpi_ec_start (struct acpi_device *device); -static int acpi_ec_stop (struct acpi_device *device, int type); -static int acpi_ec_burst_add ( struct acpi_device *device); -static int acpi_ec_polling_add ( struct acpi_device *device); +static int acpi_ec_remove(struct acpi_device *device, int type); +static int acpi_ec_start(struct acpi_device *device); +static int acpi_ec_stop(struct acpi_device *device, int type); +static int acpi_ec_burst_add(struct acpi_device *device); +static int acpi_ec_polling_add(struct acpi_device *device); static struct acpi_driver acpi_ec_driver = { - .name = ACPI_EC_DRIVER_NAME, - .class = ACPI_EC_CLASS, - .ids = ACPI_EC_HID, - .ops = { - .add = acpi_ec_polling_add, - .remove = acpi_ec_remove, - .start = acpi_ec_start, - .stop = acpi_ec_stop, - }, + .name = ACPI_EC_DRIVER_NAME, + .class = ACPI_EC_CLASS, + .ids = ACPI_EC_HID, + .ops = { + .add = acpi_ec_polling_add, + .remove = acpi_ec_remove, + .start = acpi_ec_start, + .stop = acpi_ec_stop, + }, }; union acpi_ec { struct { - u32 mode; - acpi_handle handle; - unsigned long uid; - unsigned long gpe_bit; - struct acpi_generic_address status_addr; - struct acpi_generic_address command_addr; - struct acpi_generic_address data_addr; - unsigned long global_lock; + u32 mode; + acpi_handle handle; + unsigned long uid; + unsigned long gpe_bit; + struct acpi_generic_address status_addr; + struct acpi_generic_address command_addr; + struct acpi_generic_address data_addr; + unsigned long global_lock; } common; struct { - u32 mode; - acpi_handle handle; - unsigned long uid; - unsigned long gpe_bit; - struct acpi_generic_address status_addr; - struct acpi_generic_address command_addr; - struct acpi_generic_address data_addr; - unsigned long global_lock; - unsigned int expect_event; - atomic_t leaving_burst; /* 0 : No, 1 : Yes, 2: abort*/ - atomic_t pending_gpe; - struct semaphore sem; - wait_queue_head_t wait; - }burst; + u32 mode; + acpi_handle handle; + unsigned long uid; + unsigned long gpe_bit; + struct acpi_generic_address status_addr; + struct acpi_generic_address command_addr; + struct acpi_generic_address data_addr; + unsigned long global_lock; + unsigned int expect_event; + atomic_t leaving_burst; /* 0 : No, 1 : Yes, 2: abort */ + atomic_t pending_gpe; + struct semaphore sem; + wait_queue_head_t wait; + } burst; struct { - u32 mode; - acpi_handle handle; - unsigned long uid; - unsigned long gpe_bit; - struct acpi_generic_address status_addr; - struct acpi_generic_address command_addr; - struct acpi_generic_address data_addr; - unsigned long global_lock; - spinlock_t lock; - }polling; + u32 mode; + acpi_handle handle; + unsigned long uid; + unsigned long gpe_bit; + struct acpi_generic_address status_addr; + struct acpi_generic_address command_addr; + struct acpi_generic_address data_addr; + unsigned long global_lock; + spinlock_t lock; + } polling; }; -static int acpi_ec_polling_wait ( union acpi_ec *ec, u8 event); +static int acpi_ec_polling_wait(union acpi_ec *ec, u8 event); static int acpi_ec_burst_wait(union acpi_ec *ec, unsigned int event); -static int acpi_ec_polling_read ( union acpi_ec *ec, u8 address, u32 *data); -static int acpi_ec_burst_read( union acpi_ec *ec, u8 address, u32 *data); -static int acpi_ec_polling_write ( union acpi_ec *ec, u8 address, u8 data); -static int acpi_ec_burst_write ( union acpi_ec *ec, u8 address, u8 data); -static int acpi_ec_polling_query ( union acpi_ec *ec, u32 *data); -static int acpi_ec_burst_query ( union acpi_ec *ec, u32 *data); -static void acpi_ec_gpe_polling_query ( void *ec_cxt); -static void acpi_ec_gpe_burst_query ( void *ec_cxt); -static u32 acpi_ec_gpe_polling_handler ( void *data); -static u32 acpi_ec_gpe_burst_handler ( void *data); +static int acpi_ec_polling_read(union acpi_ec *ec, u8 address, u32 * data); +static int acpi_ec_burst_read(union acpi_ec *ec, u8 address, u32 * data); +static int acpi_ec_polling_write(union acpi_ec *ec, u8 address, u8 data); +static int acpi_ec_burst_write(union acpi_ec *ec, u8 address, u8 data); +static int acpi_ec_polling_query(union acpi_ec *ec, u32 * data); +static int acpi_ec_burst_query(union acpi_ec *ec, u32 * data); +static void acpi_ec_gpe_polling_query(void *ec_cxt); +static void acpi_ec_gpe_burst_query(void *ec_cxt); +static u32 acpi_ec_gpe_polling_handler(void *data); +static u32 acpi_ec_gpe_burst_handler(void *data); static acpi_status __init -acpi_fake_ecdt_polling_callback ( - acpi_handle handle, - u32 Level, - void *context, - void **retval); +acpi_fake_ecdt_polling_callback(acpi_handle handle, + u32 Level, void *context, void **retval); static acpi_status __init -acpi_fake_ecdt_burst_callback ( - acpi_handle handle, - u32 Level, - void *context, - void **retval); - -static int __init -acpi_ec_polling_get_real_ecdt(void); -static int __init -acpi_ec_burst_get_real_ecdt(void); +acpi_fake_ecdt_burst_callback(acpi_handle handle, + u32 Level, void *context, void **retval); + +static int __init acpi_ec_polling_get_real_ecdt(void); +static int __init acpi_ec_burst_get_real_ecdt(void); /* If we find an EC via the ECDT, we need to keep a ptr to its context */ -static union acpi_ec *ec_ecdt; +static union acpi_ec *ec_ecdt; /* External interfaces use first EC only, so remember */ static struct acpi_device *first_ec; @@ -173,30 +155,24 @@ static int acpi_ec_polling_mode = EC_POLLING; static inline u32 acpi_ec_read_status(union acpi_ec *ec) { - u32 status = 0; + u32 status = 0; acpi_hw_low_level_read(8, &status, &ec->common.status_addr); return status; } -static int -acpi_ec_wait ( - union acpi_ec *ec, - u8 event) +static int acpi_ec_wait(union acpi_ec *ec, u8 event) { - if (acpi_ec_polling_mode) - return acpi_ec_polling_wait (ec, event); + if (acpi_ec_polling_mode) + return acpi_ec_polling_wait(ec, event); else - return acpi_ec_burst_wait (ec, event); + return acpi_ec_burst_wait(ec, event); } -static int -acpi_ec_polling_wait ( - union acpi_ec *ec, - u8 event) +static int acpi_ec_polling_wait(union acpi_ec *ec, u8 event) { - u32 acpi_ec_status = 0; - u32 i = ACPI_EC_UDELAY_COUNT; + u32 acpi_ec_status = 0; + u32 i = ACPI_EC_UDELAY_COUNT; if (!ec) return -EINVAL; @@ -205,19 +181,21 @@ acpi_ec_polling_wait ( switch (event) { case ACPI_EC_EVENT_OBF: do { - acpi_hw_low_level_read(8, &acpi_ec_status, &ec->common.status_addr); + acpi_hw_low_level_read(8, &acpi_ec_status, + &ec->common.status_addr); if (acpi_ec_status & ACPI_EC_FLAG_OBF) return 0; udelay(ACPI_EC_UDELAY); - } while (--i>0); + } while (--i > 0); break; case ACPI_EC_EVENT_IBE: do { - acpi_hw_low_level_read(8, &acpi_ec_status, &ec->common.status_addr); + acpi_hw_low_level_read(8, &acpi_ec_status, + &ec->common.status_addr); if (!(acpi_ec_status & ACPI_EC_FLAG_IBF)) return 0; udelay(ACPI_EC_UDELAY); - } while (--i>0); + } while (--i > 0); break; default: return -EINVAL; @@ -227,7 +205,7 @@ acpi_ec_polling_wait ( } static int acpi_ec_burst_wait(union acpi_ec *ec, unsigned int event) { - int result = 0; + int result = 0; ACPI_FUNCTION_TRACE("acpi_ec_wait"); @@ -235,14 +213,15 @@ static int acpi_ec_burst_wait(union acpi_ec *ec, unsigned int event) smp_mb(); result = wait_event_interruptible_timeout(ec->burst.wait, - !ec->burst.expect_event, - msecs_to_jiffies(ACPI_EC_DELAY)); - + !ec->burst.expect_event, + msecs_to_jiffies + (ACPI_EC_DELAY)); + ec->burst.expect_event = 0; smp_mb(); - if (result < 0){ - ACPI_DEBUG_PRINT((ACPI_DB_ERROR," result = %d ", result)); + if (result < 0) { + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, " result = %d ", result)); return_VALUE(result); } @@ -266,54 +245,49 @@ static int acpi_ec_burst_wait(union acpi_ec *ec, unsigned int event) return_VALUE(-ETIME); } - - -static int -acpi_ec_enter_burst_mode ( - union acpi_ec *ec) +static int acpi_ec_enter_burst_mode(union acpi_ec *ec) { - u32 tmp = 0; - int status = 0; + u32 tmp = 0; + int status = 0; ACPI_FUNCTION_TRACE("acpi_ec_enter_burst_mode"); status = acpi_ec_read_status(ec); - if (status != -EINVAL && - !(status & ACPI_EC_FLAG_BURST)){ - acpi_hw_low_level_write(8, ACPI_EC_BURST_ENABLE, &ec->common.command_addr); + if (status != -EINVAL && !(status & ACPI_EC_FLAG_BURST)) { + acpi_hw_low_level_write(8, ACPI_EC_BURST_ENABLE, + &ec->common.command_addr); status = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF); - if (status){ + if (status) { acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR); return_VALUE(-EINVAL); } acpi_hw_low_level_read(8, &tmp, &ec->common.data_addr); acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR); - if(tmp != 0x90 ) {/* Burst ACK byte*/ + if (tmp != 0x90) { /* Burst ACK byte */ return_VALUE(-EINVAL); } } - atomic_set(&ec->burst.leaving_burst , 0); + atomic_set(&ec->burst.leaving_burst, 0); return_VALUE(0); } -static int -acpi_ec_leave_burst_mode ( - union acpi_ec *ec) +static int acpi_ec_leave_burst_mode(union acpi_ec *ec) { - int status =0; + int status = 0; ACPI_FUNCTION_TRACE("acpi_ec_leave_burst_mode"); - atomic_set(&ec->burst.leaving_burst , 1); + atomic_set(&ec->burst.leaving_burst, 1); status = acpi_ec_read_status(ec); - if (status != -EINVAL && - (status & ACPI_EC_FLAG_BURST)){ - acpi_hw_low_level_write(8, ACPI_EC_BURST_DISABLE, &ec->common.command_addr); + if (status != -EINVAL && (status & ACPI_EC_FLAG_BURST)) { + acpi_hw_low_level_write(8, ACPI_EC_BURST_DISABLE, + &ec->common.command_addr); status = acpi_ec_wait(ec, ACPI_EC_FLAG_IBF); - if (status){ + if (status) { acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR); - ACPI_DEBUG_PRINT((ACPI_DB_ERROR,"------->wait fail\n")); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "------->wait fail\n")); return_VALUE(-EINVAL); } acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR); @@ -323,38 +297,26 @@ acpi_ec_leave_burst_mode ( return_VALUE(0); } -static int -acpi_ec_read ( - union acpi_ec *ec, - u8 address, - u32 *data) +static int acpi_ec_read(union acpi_ec *ec, u8 address, u32 * data) { - if (acpi_ec_polling_mode) + if (acpi_ec_polling_mode) return acpi_ec_polling_read(ec, address, data); else return acpi_ec_burst_read(ec, address, data); } -static int -acpi_ec_write ( - union acpi_ec *ec, - u8 address, - u8 data) +static int acpi_ec_write(union acpi_ec *ec, u8 address, u8 data) { - if (acpi_ec_polling_mode) + if (acpi_ec_polling_mode) return acpi_ec_polling_write(ec, address, data); else return acpi_ec_burst_write(ec, address, data); } -static int -acpi_ec_polling_read ( - union acpi_ec *ec, - u8 address, - u32 *data) +static int acpi_ec_polling_read(union acpi_ec *ec, u8 address, u32 * data) { - acpi_status status = AE_OK; - int result = 0; - unsigned long flags = 0; - u32 glk = 0; + acpi_status status = AE_OK; + int result = 0; + unsigned long flags = 0; + u32 glk = 0; ACPI_FUNCTION_TRACE("acpi_ec_read"); @@ -371,7 +333,8 @@ acpi_ec_polling_read ( spin_lock_irqsave(&ec->polling.lock, flags); - acpi_hw_low_level_write(8, ACPI_EC_COMMAND_READ, &ec->common.command_addr); + acpi_hw_low_level_write(8, ACPI_EC_COMMAND_READ, + &ec->common.command_addr); result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); if (result) goto end; @@ -384,9 +347,9 @@ acpi_ec_polling_read ( acpi_hw_low_level_read(8, data, &ec->common.data_addr); ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Read [%02x] from address [%02x]\n", - *data, address)); - -end: + *data, address)); + + end: spin_unlock_irqrestore(&ec->polling.lock, flags); if (ec->common.global_lock) @@ -395,17 +358,12 @@ end: return_VALUE(result); } - -static int -acpi_ec_polling_write ( - union acpi_ec *ec, - u8 address, - u8 data) +static int acpi_ec_polling_write(union acpi_ec *ec, u8 address, u8 data) { - int result = 0; - acpi_status status = AE_OK; - unsigned long flags = 0; - u32 glk = 0; + int result = 0; + acpi_status status = AE_OK; + unsigned long flags = 0; + u32 glk = 0; ACPI_FUNCTION_TRACE("acpi_ec_write"); @@ -420,7 +378,8 @@ acpi_ec_polling_write ( spin_lock_irqsave(&ec->polling.lock, flags); - acpi_hw_low_level_write(8, ACPI_EC_COMMAND_WRITE, &ec->common.command_addr); + acpi_hw_low_level_write(8, ACPI_EC_COMMAND_WRITE, + &ec->common.command_addr); result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); if (result) goto end; @@ -436,9 +395,9 @@ acpi_ec_polling_write ( goto end; ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Wrote [%02x] to address [%02x]\n", - data, address)); + data, address)); -end: + end: spin_unlock_irqrestore(&ec->polling.lock, flags); if (ec->common.global_lock) @@ -447,21 +406,17 @@ end: return_VALUE(result); } -static int -acpi_ec_burst_read ( - union acpi_ec *ec, - u8 address, - u32 *data) +static int acpi_ec_burst_read(union acpi_ec *ec, u8 address, u32 * data) { - int status = 0; - u32 glk; + int status = 0; + u32 glk; ACPI_FUNCTION_TRACE("acpi_ec_read"); if (!ec || !data) return_VALUE(-EINVAL); -retry: + retry: *data = 0; if (ec->common.global_lock) { @@ -473,10 +428,11 @@ retry: WARN_ON(in_interrupt()); down(&ec->burst.sem); - if(acpi_ec_enter_burst_mode(ec)) + if (acpi_ec_enter_burst_mode(ec)) goto end; - acpi_hw_low_level_write(8, ACPI_EC_COMMAND_READ, &ec->common.command_addr); + acpi_hw_low_level_write(8, ACPI_EC_COMMAND_READ, + &ec->common.command_addr); status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR); if (status) { @@ -484,8 +440,8 @@ retry: } acpi_hw_low_level_write(8, address, &ec->common.data_addr); - status= acpi_ec_wait(ec, ACPI_EC_EVENT_OBF); - if (status){ + status = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF); + if (status) { acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR); goto end; } @@ -494,19 +450,19 @@ retry: acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR); ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Read [%02x] from address [%02x]\n", - *data, address)); - -end: + *data, address)); + + end: acpi_ec_leave_burst_mode(ec); up(&ec->burst.sem); if (ec->common.global_lock) acpi_release_global_lock(glk); - if(atomic_read(&ec->burst.leaving_burst) == 2){ - ACPI_DEBUG_PRINT((ACPI_DB_INFO,"aborted, retry ...\n")); - while(atomic_read(&ec->burst.pending_gpe)){ - msleep(1); + if (atomic_read(&ec->burst.leaving_burst) == 2) { + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "aborted, retry ...\n")); + while (atomic_read(&ec->burst.pending_gpe)) { + msleep(1); } acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR); goto retry; @@ -515,22 +471,17 @@ end: return_VALUE(status); } - -static int -acpi_ec_burst_write ( - union acpi_ec *ec, - u8 address, - u8 data) +static int acpi_ec_burst_write(union acpi_ec *ec, u8 address, u8 data) { - int status = 0; - u32 glk; - u32 tmp; + int status = 0; + u32 glk; + u32 tmp; ACPI_FUNCTION_TRACE("acpi_ec_write"); if (!ec) return_VALUE(-EINVAL); -retry: + retry: if (ec->common.global_lock) { status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk); if (ACPI_FAILURE(status)) @@ -540,32 +491,33 @@ retry: WARN_ON(in_interrupt()); down(&ec->burst.sem); - if(acpi_ec_enter_burst_mode(ec)) + if (acpi_ec_enter_burst_mode(ec)) goto end; status = acpi_ec_read_status(ec); - if (status != -EINVAL && - !(status & ACPI_EC_FLAG_BURST)){ - acpi_hw_low_level_write(8, ACPI_EC_BURST_ENABLE, &ec->common.command_addr); + if (status != -EINVAL && !(status & ACPI_EC_FLAG_BURST)) { + acpi_hw_low_level_write(8, ACPI_EC_BURST_ENABLE, + &ec->common.command_addr); status = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF); if (status) goto end; acpi_hw_low_level_read(8, &tmp, &ec->common.data_addr); - if(tmp != 0x90 ) /* Burst ACK byte*/ + if (tmp != 0x90) /* Burst ACK byte */ goto end; } - /*Now we are in burst mode*/ + /*Now we are in burst mode */ - acpi_hw_low_level_write(8, ACPI_EC_COMMAND_WRITE, &ec->common.command_addr); + acpi_hw_low_level_write(8, ACPI_EC_COMMAND_WRITE, + &ec->common.command_addr); status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR); - if (status){ + if (status) { goto end; } acpi_hw_low_level_write(8, address, &ec->common.data_addr); status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); - if (status){ + if (status) { acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR); goto end; } @@ -577,19 +529,19 @@ retry: goto end; ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Wrote [%02x] to address [%02x]\n", - data, address)); + data, address)); -end: + end: acpi_ec_leave_burst_mode(ec); up(&ec->burst.sem); if (ec->common.global_lock) acpi_release_global_lock(glk); - if(atomic_read(&ec->burst.leaving_burst) == 2){ - ACPI_DEBUG_PRINT((ACPI_DB_INFO,"aborted, retry ...\n")); - while(atomic_read(&ec->burst.pending_gpe)){ - msleep(1); + if (atomic_read(&ec->burst.leaving_burst) == 2) { + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "aborted, retry ...\n")); + while (atomic_read(&ec->burst.pending_gpe)) { + msleep(1); } acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR); goto retry; @@ -601,8 +553,7 @@ end: /* * Externally callable EC access functions. For now, assume 1 EC only */ -int -ec_read(u8 addr, u8 *val) +int ec_read(u8 addr, u8 * val) { union acpi_ec *ec; int err; @@ -618,14 +569,13 @@ ec_read(u8 addr, u8 *val) if (!err) { *val = temp_data; return 0; - } - else + } else return err; } + EXPORT_SYMBOL(ec_read); -int -ec_write(u8 addr, u8 val) +int ec_write(u8 addr, u8 val) { union acpi_ec *ec; int err; @@ -639,27 +589,22 @@ ec_write(u8 addr, u8 val) return err; } + EXPORT_SYMBOL(ec_write); -static int -acpi_ec_query ( - union acpi_ec *ec, - u32 *data) +static int acpi_ec_query(union acpi_ec *ec, u32 * data) { - if (acpi_ec_polling_mode) + if (acpi_ec_polling_mode) return acpi_ec_polling_query(ec, data); else return acpi_ec_burst_query(ec, data); } -static int -acpi_ec_polling_query ( - union acpi_ec *ec, - u32 *data) +static int acpi_ec_polling_query(union acpi_ec *ec, u32 * data) { - int result = 0; - acpi_status status = AE_OK; - unsigned long flags = 0; - u32 glk = 0; + int result = 0; + acpi_status status = AE_OK; + unsigned long flags = 0; + u32 glk = 0; ACPI_FUNCTION_TRACE("acpi_ec_query"); @@ -681,7 +626,8 @@ acpi_ec_polling_query ( */ spin_lock_irqsave(&ec->polling.lock, flags); - acpi_hw_low_level_write(8, ACPI_EC_COMMAND_QUERY, &ec->common.command_addr); + acpi_hw_low_level_write(8, ACPI_EC_COMMAND_QUERY, + &ec->common.command_addr); result = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF); if (result) goto end; @@ -690,7 +636,7 @@ acpi_ec_polling_query ( if (!*data) result = -ENODATA; -end: + end: spin_unlock_irqrestore(&ec->polling.lock, flags); if (ec->common.global_lock) @@ -698,13 +644,10 @@ end: return_VALUE(result); } -static int -acpi_ec_burst_query ( - union acpi_ec *ec, - u32 *data) +static int acpi_ec_burst_query(union acpi_ec *ec, u32 * data) { - int status = 0; - u32 glk; + int status = 0; + u32 glk; ACPI_FUNCTION_TRACE("acpi_ec_query"); @@ -719,16 +662,17 @@ acpi_ec_burst_query ( } down(&ec->burst.sem); - if(acpi_ec_enter_burst_mode(ec)) + if (acpi_ec_enter_burst_mode(ec)) goto end; /* * Query the EC to find out which _Qxx method we need to evaluate. * Note that successful completion of the query causes the ACPI_EC_SCI * bit to be cleared (and thus clearing the interrupt source). */ - acpi_hw_low_level_write(8, ACPI_EC_COMMAND_QUERY, &ec->common.command_addr); + acpi_hw_low_level_write(8, ACPI_EC_COMMAND_QUERY, + &ec->common.command_addr); status = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF); - if (status){ + if (status) { acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR); goto end; } @@ -738,51 +682,47 @@ acpi_ec_burst_query ( if (!*data) status = -ENODATA; -end: + end: acpi_ec_leave_burst_mode(ec); up(&ec->burst.sem); if (ec->common.global_lock) acpi_release_global_lock(glk); - if(atomic_read(&ec->burst.leaving_burst) == 2){ - ACPI_DEBUG_PRINT((ACPI_DB_INFO,"aborted, retry ...\n")); + if (atomic_read(&ec->burst.leaving_burst) == 2) { + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "aborted, retry ...\n")); acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR); status = -ENODATA; } return_VALUE(status); } - /* -------------------------------------------------------------------------- Event Management -------------------------------------------------------------------------- */ union acpi_ec_query_data { - acpi_handle handle; - u8 data; + acpi_handle handle; + u8 data; }; -static void -acpi_ec_gpe_query ( - void *ec_cxt) +static void acpi_ec_gpe_query(void *ec_cxt) { - if (acpi_ec_polling_mode) + if (acpi_ec_polling_mode) acpi_ec_gpe_polling_query(ec_cxt); else acpi_ec_gpe_burst_query(ec_cxt); } -static void -acpi_ec_gpe_polling_query ( - void *ec_cxt) +static void acpi_ec_gpe_polling_query(void *ec_cxt) { - union acpi_ec *ec = (union acpi_ec *) ec_cxt; - u32 value = 0; - unsigned long flags = 0; - static char object_name[5] = {'_','Q','0','0','\0'}; - const char hex[] = {'0','1','2','3','4','5','6','7', - '8','9','A','B','C','D','E','F'}; + union acpi_ec *ec = (union acpi_ec *)ec_cxt; + u32 value = 0; + unsigned long flags = 0; + static char object_name[5] = { '_', 'Q', '0', '0', '\0' }; + const char hex[] = { '0', '1', '2', '3', '4', '5', '6', '7', + '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' + }; ACPI_FUNCTION_TRACE("acpi_ec_gpe_query"); @@ -812,19 +752,18 @@ acpi_ec_gpe_polling_query ( acpi_evaluate_object(ec->common.handle, object_name, NULL, NULL); -end: + end: acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR); } -static void -acpi_ec_gpe_burst_query ( - void *ec_cxt) +static void acpi_ec_gpe_burst_query(void *ec_cxt) { - union acpi_ec *ec = (union acpi_ec *) ec_cxt; - u32 value; - int result = -ENODATA; - static char object_name[5] = {'_','Q','0','0','\0'}; - const char hex[] = {'0','1','2','3','4','5','6','7', - '8','9','A','B','C','D','E','F'}; + union acpi_ec *ec = (union acpi_ec *)ec_cxt; + u32 value; + int result = -ENODATA; + static char object_name[5] = { '_', 'Q', '0', '0', '\0' }; + const char hex[] = { '0', '1', '2', '3', '4', '5', '6', '7', + '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' + }; ACPI_FUNCTION_TRACE("acpi_ec_gpe_query"); @@ -840,26 +779,22 @@ acpi_ec_gpe_burst_query ( ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Evaluating %s\n", object_name)); acpi_evaluate_object(ec->common.handle, object_name, NULL, NULL); -end: + end: atomic_dec(&ec->burst.pending_gpe); return; } -static u32 -acpi_ec_gpe_handler ( - void *data) +static u32 acpi_ec_gpe_handler(void *data) { - if (acpi_ec_polling_mode) + if (acpi_ec_polling_mode) return acpi_ec_gpe_polling_handler(data); else - return acpi_ec_gpe_burst_handler(data); + return acpi_ec_gpe_burst_handler(data); } -static u32 -acpi_ec_gpe_polling_handler ( - void *data) +static u32 acpi_ec_gpe_polling_handler(void *data) { - acpi_status status = AE_OK; - union acpi_ec *ec = (union acpi_ec *) data; + acpi_status status = AE_OK; + union acpi_ec *ec = (union acpi_ec *)data; if (!ec) return ACPI_INTERRUPT_NOT_HANDLED; @@ -867,20 +802,18 @@ acpi_ec_gpe_polling_handler ( acpi_disable_gpe(NULL, ec->common.gpe_bit, ACPI_ISR); status = acpi_os_queue_for_execution(OSD_PRIORITY_GPE, - acpi_ec_gpe_query, ec); + acpi_ec_gpe_query, ec); if (status == AE_OK) return ACPI_INTERRUPT_HANDLED; else return ACPI_INTERRUPT_NOT_HANDLED; } -static u32 -acpi_ec_gpe_burst_handler ( - void *data) +static u32 acpi_ec_gpe_burst_handler(void *data) { - acpi_status status = AE_OK; - u32 value; - union acpi_ec *ec = (union acpi_ec *) data; + acpi_status status = AE_OK; + u32 value; + union acpi_ec *ec = (union acpi_ec *)data; if (!ec) return ACPI_INTERRUPT_NOT_HANDLED; @@ -889,39 +822,39 @@ acpi_ec_gpe_burst_handler ( value = acpi_ec_read_status(ec); - if((value & ACPI_EC_FLAG_IBF) && - !(value & ACPI_EC_FLAG_BURST) && - (atomic_read(&ec->burst.leaving_burst) == 0)) { - /* - * the embedded controller disables - * burst mode for any reason other - * than the burst disable command - * to process critical event. - */ - atomic_set(&ec->burst.leaving_burst , 2); /* block current pending transaction - and retry */ + if ((value & ACPI_EC_FLAG_IBF) && + !(value & ACPI_EC_FLAG_BURST) && + (atomic_read(&ec->burst.leaving_burst) == 0)) { + /* + * the embedded controller disables + * burst mode for any reason other + * than the burst disable command + * to process critical event. + */ + atomic_set(&ec->burst.leaving_burst, 2); /* block current pending transaction + and retry */ wake_up(&ec->burst.wait); - }else { + } else { if ((ec->burst.expect_event == ACPI_EC_EVENT_OBF && - (value & ACPI_EC_FLAG_OBF)) || - (ec->burst.expect_event == ACPI_EC_EVENT_IBE && - !(value & ACPI_EC_FLAG_IBF))) { + (value & ACPI_EC_FLAG_OBF)) || + (ec->burst.expect_event == ACPI_EC_EVENT_IBE && + !(value & ACPI_EC_FLAG_IBF))) { ec->burst.expect_event = 0; wake_up(&ec->burst.wait); return ACPI_INTERRUPT_HANDLED; } } - if (value & ACPI_EC_FLAG_SCI){ - atomic_add(1, &ec->burst.pending_gpe) ; + if (value & ACPI_EC_FLAG_SCI) { + atomic_add(1, &ec->burst.pending_gpe); status = acpi_os_queue_for_execution(OSD_PRIORITY_GPE, - acpi_ec_gpe_query, ec); + acpi_ec_gpe_query, ec); return status == AE_OK ? - ACPI_INTERRUPT_HANDLED : ACPI_INTERRUPT_NOT_HANDLED; - } + ACPI_INTERRUPT_HANDLED : ACPI_INTERRUPT_NOT_HANDLED; + } acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_ISR); return status == AE_OK ? - ACPI_INTERRUPT_HANDLED : ACPI_INTERRUPT_NOT_HANDLED; + ACPI_INTERRUPT_HANDLED : ACPI_INTERRUPT_NOT_HANDLED; } /* -------------------------------------------------------------------------- @@ -929,37 +862,31 @@ acpi_ec_gpe_burst_handler ( -------------------------------------------------------------------------- */ static acpi_status -acpi_ec_space_setup ( - acpi_handle region_handle, - u32 function, - void *handler_context, - void **return_context) +acpi_ec_space_setup(acpi_handle region_handle, + u32 function, void *handler_context, void **return_context) { /* * The EC object is in the handler context and is needed * when calling the acpi_ec_space_handler. */ - *return_context = (function != ACPI_REGION_DEACTIVATE) ? - handler_context : NULL; + *return_context = (function != ACPI_REGION_DEACTIVATE) ? + handler_context : NULL; return AE_OK; } - static acpi_status -acpi_ec_space_handler ( - u32 function, - acpi_physical_address address, - u32 bit_width, - acpi_integer *value, - void *handler_context, - void *region_context) +acpi_ec_space_handler(u32 function, + acpi_physical_address address, + u32 bit_width, + acpi_integer * value, + void *handler_context, void *region_context) { - int result = 0; - union acpi_ec *ec = NULL; - u64 temp = *value; - acpi_integer f_v = 0; - int i = 0; + int result = 0; + union acpi_ec *ec = NULL; + u64 temp = *value; + acpi_integer f_v = 0; + int i = 0; ACPI_FUNCTION_TRACE("acpi_ec_space_handler"); @@ -967,17 +894,18 @@ acpi_ec_space_handler ( return_VALUE(AE_BAD_PARAMETER); if (bit_width != 8 && acpi_strict) { - printk(KERN_WARNING PREFIX "acpi_ec_space_handler: bit_width should be 8\n"); + printk(KERN_WARNING PREFIX + "acpi_ec_space_handler: bit_width should be 8\n"); return_VALUE(AE_BAD_PARAMETER); } - ec = (union acpi_ec *) handler_context; + ec = (union acpi_ec *)handler_context; -next_byte: + next_byte: switch (function) { case ACPI_READ: temp = 0; - result = acpi_ec_read(ec, (u8) address, (u32 *)&temp); + result = acpi_ec_read(ec, (u8) address, (u32 *) & temp); break; case ACPI_WRITE: result = acpi_ec_write(ec, (u8) address, (u8) temp); @@ -1004,8 +932,7 @@ next_byte: *value = f_v; } - -out: + out: switch (result) { case -EINVAL: return_VALUE(AE_BAD_PARAMETER); @@ -1021,18 +948,15 @@ out: } } - /* -------------------------------------------------------------------------- FS Interface (/proc) -------------------------------------------------------------------------- */ -static struct proc_dir_entry *acpi_ec_dir; +static struct proc_dir_entry *acpi_ec_dir; - -static int -acpi_ec_read_info (struct seq_file *seq, void *offset) +static int acpi_ec_read_info(struct seq_file *seq, void *offset) { - union acpi_ec *ec = (union acpi_ec *) seq->private; + union acpi_ec *ec = (union acpi_ec *)seq->private; ACPI_FUNCTION_TRACE("acpi_ec_read_info"); @@ -1040,14 +964,15 @@ acpi_ec_read_info (struct seq_file *seq, void *offset) goto end; seq_printf(seq, "gpe bit: 0x%02x\n", - (u32) ec->common.gpe_bit); + (u32) ec->common.gpe_bit); seq_printf(seq, "ports: 0x%02x, 0x%02x\n", - (u32) ec->common.status_addr.address, (u32) ec->common.data_addr.address); + (u32) ec->common.status_addr.address, + (u32) ec->common.data_addr.address); seq_printf(seq, "use global lock: %s\n", - ec->common.global_lock?"yes":"no"); + ec->common.global_lock ? "yes" : "no"); acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR); -end: + end: return_VALUE(0); } @@ -1057,34 +982,32 @@ static int acpi_ec_info_open_fs(struct inode *inode, struct file *file) } static struct file_operations acpi_ec_info_ops = { - .open = acpi_ec_info_open_fs, - .read = seq_read, - .llseek = seq_lseek, - .release = single_release, + .open = acpi_ec_info_open_fs, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, .owner = THIS_MODULE, }; -static int -acpi_ec_add_fs ( - struct acpi_device *device) +static int acpi_ec_add_fs(struct acpi_device *device) { - struct proc_dir_entry *entry = NULL; + struct proc_dir_entry *entry = NULL; ACPI_FUNCTION_TRACE("acpi_ec_add_fs"); if (!acpi_device_dir(device)) { acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), - acpi_ec_dir); + acpi_ec_dir); if (!acpi_device_dir(device)) return_VALUE(-ENODEV); } entry = create_proc_entry(ACPI_EC_FILE_INFO, S_IRUGO, - acpi_device_dir(device)); + acpi_device_dir(device)); if (!entry) ACPI_DEBUG_PRINT((ACPI_DB_WARN, - "Unable to create '%s' fs entry\n", - ACPI_EC_FILE_INFO)); + "Unable to create '%s' fs entry\n", + ACPI_EC_FILE_INFO)); else { entry->proc_fops = &acpi_ec_info_ops; entry->data = acpi_driver_data(device); @@ -1094,10 +1017,7 @@ acpi_ec_add_fs ( return_VALUE(0); } - -static int -acpi_ec_remove_fs ( - struct acpi_device *device) +static int acpi_ec_remove_fs(struct acpi_device *device) { ACPI_FUNCTION_TRACE("acpi_ec_remove_fs"); @@ -1110,20 +1030,16 @@ acpi_ec_remove_fs ( return_VALUE(0); } - /* -------------------------------------------------------------------------- Driver Interface -------------------------------------------------------------------------- */ - -static int -acpi_ec_polling_add ( - struct acpi_device *device) +static int acpi_ec_polling_add(struct acpi_device *device) { - int result = 0; - acpi_status status = AE_OK; - union acpi_ec *ec = NULL; - unsigned long uid; + int result = 0; + acpi_status status = AE_OK; + union acpi_ec *ec = NULL; + unsigned long uid; ACPI_FUNCTION_TRACE("acpi_ec_add"); @@ -1143,26 +1059,31 @@ acpi_ec_polling_add ( acpi_driver_data(device) = ec; /* Use the global lock for all EC transactions? */ - acpi_evaluate_integer(ec->common.handle, "_GLK", NULL, &ec->common.global_lock); + acpi_evaluate_integer(ec->common.handle, "_GLK", NULL, + &ec->common.global_lock); /* If our UID matches the UID for the ECDT-enumerated EC, - we now have the *real* EC info, so kill the makeshift one.*/ + we now have the *real* EC info, so kill the makeshift one. */ acpi_evaluate_integer(ec->common.handle, "_UID", NULL, &uid); if (ec_ecdt && ec_ecdt->common.uid == uid) { acpi_remove_address_space_handler(ACPI_ROOT_OBJECT, - ACPI_ADR_SPACE_EC, &acpi_ec_space_handler); - - acpi_remove_gpe_handler(NULL, ec_ecdt->common.gpe_bit, &acpi_ec_gpe_handler); + ACPI_ADR_SPACE_EC, + &acpi_ec_space_handler); + + acpi_remove_gpe_handler(NULL, ec_ecdt->common.gpe_bit, + &acpi_ec_gpe_handler); kfree(ec_ecdt); } /* Get GPE bit assignment (EC events). */ /* TODO: Add support for _GPE returning a package */ - status = acpi_evaluate_integer(ec->common.handle, "_GPE", NULL, &ec->common.gpe_bit); + status = + acpi_evaluate_integer(ec->common.handle, "_GPE", NULL, + &ec->common.gpe_bit); if (ACPI_FAILURE(status)) { ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error obtaining GPE bit assignment\n")); + "Error obtaining GPE bit assignment\n")); result = -ENODEV; goto end; } @@ -1172,26 +1093,24 @@ acpi_ec_polling_add ( goto end; printk(KERN_INFO PREFIX "%s [%s] (gpe %d)\n", - acpi_device_name(device), acpi_device_bid(device), - (u32) ec->common.gpe_bit); + acpi_device_name(device), acpi_device_bid(device), + (u32) ec->common.gpe_bit); if (!first_ec) first_ec = device; -end: + end: if (result) kfree(ec); return_VALUE(result); } -static int -acpi_ec_burst_add ( - struct acpi_device *device) +static int acpi_ec_burst_add(struct acpi_device *device) { - int result = 0; - acpi_status status = AE_OK; - union acpi_ec *ec = NULL; - unsigned long uid; + int result = 0; + acpi_status status = AE_OK; + union acpi_ec *ec = NULL; + unsigned long uid; ACPI_FUNCTION_TRACE("acpi_ec_add"); @@ -1205,35 +1124,40 @@ acpi_ec_burst_add ( ec->common.handle = device->handle; ec->common.uid = -1; - atomic_set(&ec->burst.pending_gpe, 0); - atomic_set(&ec->burst.leaving_burst , 1); - init_MUTEX(&ec->burst.sem); - init_waitqueue_head(&ec->burst.wait); + atomic_set(&ec->burst.pending_gpe, 0); + atomic_set(&ec->burst.leaving_burst, 1); + init_MUTEX(&ec->burst.sem); + init_waitqueue_head(&ec->burst.wait); strcpy(acpi_device_name(device), ACPI_EC_DEVICE_NAME); strcpy(acpi_device_class(device), ACPI_EC_CLASS); acpi_driver_data(device) = ec; /* Use the global lock for all EC transactions? */ - acpi_evaluate_integer(ec->common.handle, "_GLK", NULL, &ec->common.global_lock); + acpi_evaluate_integer(ec->common.handle, "_GLK", NULL, + &ec->common.global_lock); /* If our UID matches the UID for the ECDT-enumerated EC, - we now have the *real* EC info, so kill the makeshift one.*/ + we now have the *real* EC info, so kill the makeshift one. */ acpi_evaluate_integer(ec->common.handle, "_UID", NULL, &uid); if (ec_ecdt && ec_ecdt->common.uid == uid) { acpi_remove_address_space_handler(ACPI_ROOT_OBJECT, - ACPI_ADR_SPACE_EC, &acpi_ec_space_handler); + ACPI_ADR_SPACE_EC, + &acpi_ec_space_handler); - acpi_remove_gpe_handler(NULL, ec_ecdt->common.gpe_bit, &acpi_ec_gpe_handler); + acpi_remove_gpe_handler(NULL, ec_ecdt->common.gpe_bit, + &acpi_ec_gpe_handler); kfree(ec_ecdt); } /* Get GPE bit assignment (EC events). */ /* TODO: Add support for _GPE returning a package */ - status = acpi_evaluate_integer(ec->common.handle, "_GPE", NULL, &ec->common.gpe_bit); + status = + acpi_evaluate_integer(ec->common.handle, "_GPE", NULL, + &ec->common.gpe_bit); if (ACPI_FAILURE(status)) { ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error obtaining GPE bit assignment\n")); + "Error obtaining GPE bit assignment\n")); result = -ENODEV; goto end; } @@ -1243,26 +1167,22 @@ acpi_ec_burst_add ( goto end; printk(KERN_INFO PREFIX "%s [%s] (gpe %d)\n", - acpi_device_name(device), acpi_device_bid(device), - (u32) ec->common.gpe_bit); + acpi_device_name(device), acpi_device_bid(device), + (u32) ec->common.gpe_bit); if (!first_ec) first_ec = device; -end: + end: if (result) kfree(ec); return_VALUE(result); } - -static int -acpi_ec_remove ( - struct acpi_device *device, - int type) +static int acpi_ec_remove(struct acpi_device *device, int type) { - union acpi_ec *ec = NULL; + union acpi_ec *ec = NULL; ACPI_FUNCTION_TRACE("acpi_ec_remove"); @@ -1278,13 +1198,10 @@ acpi_ec_remove ( return_VALUE(0); } - static acpi_status -acpi_ec_io_ports ( - struct acpi_resource *resource, - void *context) +acpi_ec_io_ports(struct acpi_resource *resource, void *context) { - union acpi_ec *ec = (union acpi_ec *) context; + union acpi_ec *ec = (union acpi_ec *)context; struct acpi_generic_address *addr; if (resource->id != ACPI_RSTYPE_IO) { @@ -1312,13 +1229,10 @@ acpi_ec_io_ports ( return AE_OK; } - -static int -acpi_ec_start ( - struct acpi_device *device) +static int acpi_ec_start(struct acpi_device *device) { - acpi_status status = AE_OK; - union acpi_ec *ec = NULL; + acpi_status status = AE_OK; + union acpi_ec *ec = NULL; ACPI_FUNCTION_TRACE("acpi_ec_start"); @@ -1334,49 +1248,50 @@ acpi_ec_start ( * Get I/O port addresses. Convert to GAS format. */ status = acpi_walk_resources(ec->common.handle, METHOD_NAME__CRS, - acpi_ec_io_ports, ec); - if (ACPI_FAILURE(status) || ec->common.command_addr.register_bit_width == 0) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error getting I/O port addresses")); + acpi_ec_io_ports, ec); + if (ACPI_FAILURE(status) + || ec->common.command_addr.register_bit_width == 0) { + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Error getting I/O port addresses")); return_VALUE(-ENODEV); } ec->common.status_addr = ec->common.command_addr; ACPI_DEBUG_PRINT((ACPI_DB_INFO, "gpe=0x%02x, ports=0x%2x,0x%2x\n", - (u32) ec->common.gpe_bit, (u32) ec->common.command_addr.address, - (u32) ec->common.data_addr.address)); - + (u32) ec->common.gpe_bit, + (u32) ec->common.command_addr.address, + (u32) ec->common.data_addr.address)); /* * Install GPE handler */ status = acpi_install_gpe_handler(NULL, ec->common.gpe_bit, - ACPI_GPE_EDGE_TRIGGERED, &acpi_ec_gpe_handler, ec); + ACPI_GPE_EDGE_TRIGGERED, + &acpi_ec_gpe_handler, ec); if (ACPI_FAILURE(status)) { return_VALUE(-ENODEV); } - acpi_set_gpe_type (NULL, ec->common.gpe_bit, ACPI_GPE_TYPE_RUNTIME); - acpi_enable_gpe (NULL, ec->common.gpe_bit, ACPI_NOT_ISR); + acpi_set_gpe_type(NULL, ec->common.gpe_bit, ACPI_GPE_TYPE_RUNTIME); + acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR); - status = acpi_install_address_space_handler (ec->common.handle, - ACPI_ADR_SPACE_EC, &acpi_ec_space_handler, - &acpi_ec_space_setup, ec); + status = acpi_install_address_space_handler(ec->common.handle, + ACPI_ADR_SPACE_EC, + &acpi_ec_space_handler, + &acpi_ec_space_setup, ec); if (ACPI_FAILURE(status)) { - acpi_remove_gpe_handler(NULL, ec->common.gpe_bit, &acpi_ec_gpe_handler); + acpi_remove_gpe_handler(NULL, ec->common.gpe_bit, + &acpi_ec_gpe_handler); return_VALUE(-ENODEV); } return_VALUE(AE_OK); } - -static int -acpi_ec_stop ( - struct acpi_device *device, - int type) +static int acpi_ec_stop(struct acpi_device *device, int type) { - acpi_status status = AE_OK; - union acpi_ec *ec = NULL; + acpi_status status = AE_OK; + union acpi_ec *ec = NULL; ACPI_FUNCTION_TRACE("acpi_ec_stop"); @@ -1386,11 +1301,14 @@ acpi_ec_stop ( ec = acpi_driver_data(device); status = acpi_remove_address_space_handler(ec->common.handle, - ACPI_ADR_SPACE_EC, &acpi_ec_space_handler); + ACPI_ADR_SPACE_EC, + &acpi_ec_space_handler); if (ACPI_FAILURE(status)) return_VALUE(-ENODEV); - status = acpi_remove_gpe_handler(NULL, ec->common.gpe_bit, &acpi_ec_gpe_handler); + status = + acpi_remove_gpe_handler(NULL, ec->common.gpe_bit, + &acpi_ec_gpe_handler); if (ACPI_FAILURE(status)) return_VALUE(-ENODEV); @@ -1398,32 +1316,26 @@ acpi_ec_stop ( } static acpi_status __init -acpi_fake_ecdt_callback ( - acpi_handle handle, - u32 Level, - void *context, - void **retval) +acpi_fake_ecdt_callback(acpi_handle handle, + u32 Level, void *context, void **retval) { if (acpi_ec_polling_mode) return acpi_fake_ecdt_polling_callback(handle, - Level, context, retval); + Level, context, retval); else return acpi_fake_ecdt_burst_callback(handle, - Level, context, retval); + Level, context, retval); } static acpi_status __init -acpi_fake_ecdt_polling_callback ( - acpi_handle handle, - u32 Level, - void *context, - void **retval) +acpi_fake_ecdt_polling_callback(acpi_handle handle, + u32 Level, void *context, void **retval) { - acpi_status status; + acpi_status status; status = acpi_walk_resources(handle, METHOD_NAME__CRS, - acpi_ec_io_ports, ec_ecdt); + acpi_ec_io_ports, ec_ecdt); if (ACPI_FAILURE(status)) return status; ec_ecdt->common.status_addr = ec_ecdt->common.command_addr; @@ -1431,33 +1343,33 @@ acpi_fake_ecdt_polling_callback ( ec_ecdt->common.uid = -1; acpi_evaluate_integer(handle, "_UID", NULL, &ec_ecdt->common.uid); - status = acpi_evaluate_integer(handle, "_GPE", NULL, &ec_ecdt->common.gpe_bit); + status = + acpi_evaluate_integer(handle, "_GPE", NULL, + &ec_ecdt->common.gpe_bit); if (ACPI_FAILURE(status)) return status; spin_lock_init(&ec_ecdt->polling.lock); ec_ecdt->common.global_lock = TRUE; ec_ecdt->common.handle = handle; - printk(KERN_INFO PREFIX "GPE=0x%02x, ports=0x%2x, 0x%2x\n", - (u32) ec_ecdt->common.gpe_bit, (u32) ec_ecdt->common.command_addr.address, - (u32) ec_ecdt->common.data_addr.address); + printk(KERN_INFO PREFIX "GPE=0x%02x, ports=0x%2x, 0x%2x\n", + (u32) ec_ecdt->common.gpe_bit, + (u32) ec_ecdt->common.command_addr.address, + (u32) ec_ecdt->common.data_addr.address); return AE_CTRL_TERMINATE; } static acpi_status __init -acpi_fake_ecdt_burst_callback ( - acpi_handle handle, - u32 Level, - void *context, - void **retval) +acpi_fake_ecdt_burst_callback(acpi_handle handle, + u32 Level, void *context, void **retval) { - acpi_status status; + acpi_status status; init_MUTEX(&ec_ecdt->burst.sem); init_waitqueue_head(&ec_ecdt->burst.wait); status = acpi_walk_resources(handle, METHOD_NAME__CRS, - acpi_ec_io_ports, ec_ecdt); + acpi_ec_io_ports, ec_ecdt); if (ACPI_FAILURE(status)) return status; ec_ecdt->common.status_addr = ec_ecdt->common.command_addr; @@ -1465,15 +1377,18 @@ acpi_fake_ecdt_burst_callback ( ec_ecdt->common.uid = -1; acpi_evaluate_integer(handle, "_UID", NULL, &ec_ecdt->common.uid); - status = acpi_evaluate_integer(handle, "_GPE", NULL, &ec_ecdt->common.gpe_bit); + status = + acpi_evaluate_integer(handle, "_GPE", NULL, + &ec_ecdt->common.gpe_bit); if (ACPI_FAILURE(status)) return status; ec_ecdt->common.global_lock = TRUE; ec_ecdt->common.handle = handle; - printk(KERN_INFO PREFIX "GPE=0x%02x, ports=0x%2x, 0x%2x\n", - (u32) ec_ecdt->common.gpe_bit, (u32) ec_ecdt->common.command_addr.address, - (u32) ec_ecdt->common.data_addr.address); + printk(KERN_INFO PREFIX "GPE=0x%02x, ports=0x%2x, 0x%2x\n", + (u32) ec_ecdt->common.gpe_bit, + (u32) ec_ecdt->common.command_addr.address, + (u32) ec_ecdt->common.data_addr.address); return AE_CTRL_TERMINATE; } @@ -1488,11 +1403,10 @@ acpi_fake_ecdt_burst_callback ( * op region (since _REG isn't invoked yet). The assumption is true for * all systems found. */ -static int __init -acpi_ec_fake_ecdt(void) +static int __init acpi_ec_fake_ecdt(void) { - acpi_status status; - int ret = 0; + acpi_status status; + int ret = 0; printk(KERN_INFO PREFIX "Try to make an fake ECDT\n"); @@ -1503,10 +1417,8 @@ acpi_ec_fake_ecdt(void) } memset(ec_ecdt, 0, sizeof(union acpi_ec)); - status = acpi_get_devices (ACPI_EC_HID, - acpi_fake_ecdt_callback, - NULL, - NULL); + status = acpi_get_devices(ACPI_EC_HID, + acpi_fake_ecdt_callback, NULL, NULL); if (ACPI_FAILURE(status)) { kfree(ec_ecdt); ec_ecdt = NULL; @@ -1514,13 +1426,12 @@ acpi_ec_fake_ecdt(void) goto error; } return 0; -error: + error: printk(KERN_ERR PREFIX "Can't make an fake ECDT\n"); return ret; } -static int __init -acpi_ec_get_real_ecdt(void) +static int __init acpi_ec_get_real_ecdt(void) { if (acpi_ec_polling_mode) return acpi_ec_polling_get_real_ecdt(); @@ -1528,14 +1439,14 @@ acpi_ec_get_real_ecdt(void) return acpi_ec_burst_get_real_ecdt(); } -static int __init -acpi_ec_polling_get_real_ecdt(void) +static int __init acpi_ec_polling_get_real_ecdt(void) { - acpi_status status; - struct acpi_table_ecdt *ecdt_ptr; + acpi_status status; + struct acpi_table_ecdt *ecdt_ptr; - status = acpi_get_firmware_table("ECDT", 1, ACPI_LOGICAL_ADDRESSING, - (struct acpi_table_header **) &ecdt_ptr); + status = acpi_get_firmware_table("ECDT", 1, ACPI_LOGICAL_ADDRESSING, + (struct acpi_table_header **) + &ecdt_ptr); if (ACPI_FAILURE(status)) return -ENODEV; @@ -1558,13 +1469,14 @@ acpi_ec_polling_get_real_ecdt(void) ec_ecdt->common.global_lock = TRUE; ec_ecdt->common.uid = ecdt_ptr->uid; - status = acpi_get_handle(NULL, ecdt_ptr->ec_id, &ec_ecdt->common.handle); + status = + acpi_get_handle(NULL, ecdt_ptr->ec_id, &ec_ecdt->common.handle); if (ACPI_FAILURE(status)) { goto error; } return 0; -error: + error: printk(KERN_ERR PREFIX "Could not use ECDT\n"); kfree(ec_ecdt); ec_ecdt = NULL; @@ -1572,15 +1484,14 @@ error: return -ENODEV; } - -static int __init -acpi_ec_burst_get_real_ecdt(void) +static int __init acpi_ec_burst_get_real_ecdt(void) { - acpi_status status; - struct acpi_table_ecdt *ecdt_ptr; + acpi_status status; + struct acpi_table_ecdt *ecdt_ptr; status = acpi_get_firmware_table("ECDT", 1, ACPI_LOGICAL_ADDRESSING, - (struct acpi_table_header **) &ecdt_ptr); + (struct acpi_table_header **) + &ecdt_ptr); if (ACPI_FAILURE(status)) return -ENODEV; @@ -1594,8 +1505,8 @@ acpi_ec_burst_get_real_ecdt(void) return -ENOMEM; memset(ec_ecdt, 0, sizeof(union acpi_ec)); - init_MUTEX(&ec_ecdt->burst.sem); - init_waitqueue_head(&ec_ecdt->burst.wait); + init_MUTEX(&ec_ecdt->burst.sem); + init_waitqueue_head(&ec_ecdt->burst.wait); ec_ecdt->common.command_addr = ecdt_ptr->ec_control; ec_ecdt->common.status_addr = ecdt_ptr->ec_control; ec_ecdt->common.data_addr = ecdt_ptr->ec_data; @@ -1604,13 +1515,14 @@ acpi_ec_burst_get_real_ecdt(void) ec_ecdt->common.global_lock = TRUE; ec_ecdt->common.uid = ecdt_ptr->uid; - status = acpi_get_handle(NULL, ecdt_ptr->ec_id, &ec_ecdt->common.handle); + status = + acpi_get_handle(NULL, ecdt_ptr->ec_id, &ec_ecdt->common.handle); if (ACPI_FAILURE(status)) { goto error; } return 0; -error: + error: printk(KERN_ERR PREFIX "Could not use ECDT\n"); kfree(ec_ecdt); ec_ecdt = NULL; @@ -1619,11 +1531,10 @@ error: } static int __initdata acpi_fake_ecdt_enabled; -int __init -acpi_ec_ecdt_probe (void) +int __init acpi_ec_ecdt_probe(void) { - acpi_status status; - int ret; + acpi_status status; + int ret; ret = acpi_ec_get_real_ecdt(); /* Try to make a fake ECDT */ @@ -1638,26 +1549,28 @@ acpi_ec_ecdt_probe (void) * Install GPE handler */ status = acpi_install_gpe_handler(NULL, ec_ecdt->common.gpe_bit, - ACPI_GPE_EDGE_TRIGGERED, &acpi_ec_gpe_handler, - ec_ecdt); + ACPI_GPE_EDGE_TRIGGERED, + &acpi_ec_gpe_handler, ec_ecdt); if (ACPI_FAILURE(status)) { goto error; } - acpi_set_gpe_type (NULL, ec_ecdt->common.gpe_bit, ACPI_GPE_TYPE_RUNTIME); - acpi_enable_gpe (NULL, ec_ecdt->common.gpe_bit, ACPI_NOT_ISR); - - status = acpi_install_address_space_handler (ACPI_ROOT_OBJECT, - ACPI_ADR_SPACE_EC, &acpi_ec_space_handler, - &acpi_ec_space_setup, ec_ecdt); + acpi_set_gpe_type(NULL, ec_ecdt->common.gpe_bit, ACPI_GPE_TYPE_RUNTIME); + acpi_enable_gpe(NULL, ec_ecdt->common.gpe_bit, ACPI_NOT_ISR); + + status = acpi_install_address_space_handler(ACPI_ROOT_OBJECT, + ACPI_ADR_SPACE_EC, + &acpi_ec_space_handler, + &acpi_ec_space_setup, + ec_ecdt); if (ACPI_FAILURE(status)) { acpi_remove_gpe_handler(NULL, ec_ecdt->common.gpe_bit, - &acpi_ec_gpe_handler); + &acpi_ec_gpe_handler); goto error; } return 0; -error: + error: printk(KERN_ERR PREFIX "Could not use ECDT\n"); kfree(ec_ecdt); ec_ecdt = NULL; @@ -1665,10 +1578,9 @@ error: return -ENODEV; } - -static int __init acpi_ec_init (void) +static int __init acpi_ec_init(void) { - int result = 0; + int result = 0; ACPI_FUNCTION_TRACE("acpi_ec_init"); @@ -1693,8 +1605,7 @@ subsys_initcall(acpi_ec_init); /* EC driver currently not unloadable */ #if 0 -static void __exit -acpi_ec_exit (void) +static void __exit acpi_ec_exit(void) { ACPI_FUNCTION_TRACE("acpi_ec_exit"); @@ -1704,7 +1615,7 @@ acpi_ec_exit (void) return_VOID; } -#endif /* 0 */ +#endif /* 0 */ static int __init acpi_fake_ecdt_setup(char *str) { @@ -1727,8 +1638,8 @@ static int __init acpi_ec_set_polling_mode(char *str) acpi_ec_polling_mode = EC_POLLING; acpi_ec_driver.ops.add = acpi_ec_polling_add; } - printk(KERN_INFO PREFIX "EC %s mode.\n", - burst ? "burst": "polling"); + printk(KERN_INFO PREFIX "EC %s mode.\n", burst ? "burst" : "polling"); return 0; } + __setup("ec_burst=", acpi_ec_set_polling_mode); diff --git a/drivers/acpi/event.c b/drivers/acpi/event.c index ce8d3eec391..bfa8b76de40 100644 --- a/drivers/acpi/event.c +++ b/drivers/acpi/event.c @@ -13,16 +13,15 @@ #include #define _COMPONENT ACPI_SYSTEM_COMPONENT -ACPI_MODULE_NAME ("event") +ACPI_MODULE_NAME("event") /* Global vars for handling event proc entry */ static DEFINE_SPINLOCK(acpi_system_event_lock); -int event_is_open = 0; -extern struct list_head acpi_bus_event_list; -extern wait_queue_head_t acpi_bus_event_queue; +int event_is_open = 0; +extern struct list_head acpi_bus_event_list; +extern wait_queue_head_t acpi_bus_event_queue; -static int -acpi_system_open_event(struct inode *inode, struct file *file) +static int acpi_system_open_event(struct inode *inode, struct file *file) { spin_lock_irq(&acpi_system_event_lock); @@ -34,20 +33,20 @@ acpi_system_open_event(struct inode *inode, struct file *file) spin_unlock_irq(&acpi_system_event_lock); return 0; -out_busy: + out_busy: spin_unlock_irq(&acpi_system_event_lock); return -EBUSY; } static ssize_t -acpi_system_read_event(struct file *file, char __user *buffer, size_t count, loff_t *ppos) +acpi_system_read_event(struct file *file, char __user * buffer, size_t count, + loff_t * ppos) { - int result = 0; - struct acpi_bus_event event; - static char str[ACPI_MAX_STRING]; - static int chars_remaining = 0; - static char *ptr; - + int result = 0; + struct acpi_bus_event event; + static char str[ACPI_MAX_STRING]; + static int chars_remaining = 0; + static char *ptr; ACPI_FUNCTION_TRACE("acpi_system_read_event"); @@ -63,10 +62,12 @@ acpi_system_read_event(struct file *file, char __user *buffer, size_t count, lof return_VALUE(-EIO); } - chars_remaining = sprintf(str, "%s %s %08x %08x\n", - event.device_class?event.device_class:"", - event.bus_id?event.bus_id:"", - event.type, event.data); + chars_remaining = sprintf(str, "%s %s %08x %08x\n", + event.device_class ? event. + device_class : "", + event.bus_id ? event. + bus_id : "", event.type, + event.data); ptr = str; } @@ -84,17 +85,15 @@ acpi_system_read_event(struct file *file, char __user *buffer, size_t count, lof return_VALUE(count); } -static int -acpi_system_close_event(struct inode *inode, struct file *file) +static int acpi_system_close_event(struct inode *inode, struct file *file) { - spin_lock_irq (&acpi_system_event_lock); + spin_lock_irq(&acpi_system_event_lock); event_is_open = 0; - spin_unlock_irq (&acpi_system_event_lock); + spin_unlock_irq(&acpi_system_event_lock); return 0; } -static unsigned int -acpi_system_poll_event(struct file *file, poll_table *wait) +static unsigned int acpi_system_poll_event(struct file *file, poll_table * wait) { poll_wait(file, &acpi_bus_event_queue, wait); if (!list_empty(&acpi_bus_event_list)) @@ -103,15 +102,15 @@ acpi_system_poll_event(struct file *file, poll_table *wait) } static struct file_operations acpi_system_event_ops = { - .open = acpi_system_open_event, - .read = acpi_system_read_event, - .release = acpi_system_close_event, - .poll = acpi_system_poll_event, + .open = acpi_system_open_event, + .read = acpi_system_read_event, + .release = acpi_system_close_event, + .poll = acpi_system_poll_event, }; static int __init acpi_event_init(void) { - struct proc_dir_entry *entry; + struct proc_dir_entry *entry; int error = 0; ACPI_FUNCTION_TRACE("acpi_event_init"); @@ -124,8 +123,9 @@ static int __init acpi_event_init(void) if (entry) entry->proc_fops = &acpi_system_event_ops; else { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create '%s' proc fs entry\n","event" )); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Unable to create '%s' proc fs entry\n", + "event")); error = -EFAULT; } return_VALUE(error); diff --git a/drivers/acpi/events/evevent.c b/drivers/acpi/events/evevent.c index dd3a72a869f..842d1e3fb37 100644 --- a/drivers/acpi/events/evevent.c +++ b/drivers/acpi/events/evevent.c @@ -45,18 +45,12 @@ #include #define _COMPONENT ACPI_EVENTS - ACPI_MODULE_NAME ("evevent") +ACPI_MODULE_NAME("evevent") /* Local prototypes */ +static acpi_status acpi_ev_fixed_event_initialize(void); -static acpi_status -acpi_ev_fixed_event_initialize ( - void); - -static u32 -acpi_ev_fixed_event_dispatch ( - u32 event); - +static u32 acpi_ev_fixed_event_dispatch(u32 event); /******************************************************************************* * @@ -70,21 +64,17 @@ acpi_ev_fixed_event_dispatch ( * ******************************************************************************/ -acpi_status -acpi_ev_initialize_events ( - void) +acpi_status acpi_ev_initialize_events(void) { - acpi_status status; - - - ACPI_FUNCTION_TRACE ("ev_initialize_events"); + acpi_status status; + ACPI_FUNCTION_TRACE("ev_initialize_events"); /* Make sure we have ACPI tables */ if (!acpi_gbl_DSDT) { - ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "No ACPI tables present!\n")); - return_ACPI_STATUS (AE_NO_ACPI_TABLES); + ACPI_DEBUG_PRINT((ACPI_DB_WARN, "No ACPI tables present!\n")); + return_ACPI_STATUS(AE_NO_ACPI_TABLES); } /* @@ -92,26 +82,22 @@ acpi_ev_initialize_events ( * enabling SCIs to prevent interrupts from occurring before the handlers are * installed. */ - status = acpi_ev_fixed_event_initialize (); - if (ACPI_FAILURE (status)) { - ACPI_REPORT_ERROR (( - "Unable to initialize fixed events, %s\n", - acpi_format_exception (status))); - return_ACPI_STATUS (status); + status = acpi_ev_fixed_event_initialize(); + if (ACPI_FAILURE(status)) { + ACPI_REPORT_ERROR(("Unable to initialize fixed events, %s\n", + acpi_format_exception(status))); + return_ACPI_STATUS(status); } - status = acpi_ev_gpe_initialize (); - if (ACPI_FAILURE (status)) { - ACPI_REPORT_ERROR (( - "Unable to initialize general purpose events, %s\n", - acpi_format_exception (status))); - return_ACPI_STATUS (status); + status = acpi_ev_gpe_initialize(); + if (ACPI_FAILURE(status)) { + ACPI_REPORT_ERROR(("Unable to initialize general purpose events, %s\n", acpi_format_exception(status))); + return_ACPI_STATUS(status); } - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_ev_install_xrupt_handlers @@ -124,41 +110,32 @@ acpi_ev_initialize_events ( * ******************************************************************************/ -acpi_status -acpi_ev_install_xrupt_handlers ( - void) +acpi_status acpi_ev_install_xrupt_handlers(void) { - acpi_status status; - - - ACPI_FUNCTION_TRACE ("ev_install_xrupt_handlers"); + acpi_status status; + ACPI_FUNCTION_TRACE("ev_install_xrupt_handlers"); /* Install the SCI handler */ - status = acpi_ev_install_sci_handler (); - if (ACPI_FAILURE (status)) { - ACPI_REPORT_ERROR (( - "Unable to install System Control Interrupt Handler, %s\n", - acpi_format_exception (status))); - return_ACPI_STATUS (status); + status = acpi_ev_install_sci_handler(); + if (ACPI_FAILURE(status)) { + ACPI_REPORT_ERROR(("Unable to install System Control Interrupt Handler, %s\n", acpi_format_exception(status))); + return_ACPI_STATUS(status); } /* Install the handler for the Global Lock */ - status = acpi_ev_init_global_lock_handler (); - if (ACPI_FAILURE (status)) { - ACPI_REPORT_ERROR (( - "Unable to initialize Global Lock handler, %s\n", - acpi_format_exception (status))); - return_ACPI_STATUS (status); + status = acpi_ev_init_global_lock_handler(); + if (ACPI_FAILURE(status)) { + ACPI_REPORT_ERROR(("Unable to initialize Global Lock handler, %s\n", acpi_format_exception(status))); + return_ACPI_STATUS(status); } acpi_gbl_events_initialized = TRUE; - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_ev_fixed_event_initialize @@ -171,13 +148,10 @@ acpi_ev_install_xrupt_handlers ( * ******************************************************************************/ -static acpi_status -acpi_ev_fixed_event_initialize ( - void) +static acpi_status acpi_ev_fixed_event_initialize(void) { - acpi_native_uint i; - acpi_status status; - + acpi_native_uint i; + acpi_status status; /* * Initialize the structure that keeps track of fixed event handlers @@ -190,10 +164,11 @@ acpi_ev_fixed_event_initialize ( /* Enable the fixed event */ if (acpi_gbl_fixed_event_info[i].enable_register_id != 0xFF) { - status = acpi_set_register ( - acpi_gbl_fixed_event_info[i].enable_register_id, - 0, ACPI_MTX_LOCK); - if (ACPI_FAILURE (status)) { + status = + acpi_set_register(acpi_gbl_fixed_event_info[i]. + enable_register_id, 0, + ACPI_MTX_LOCK); + if (ACPI_FAILURE(status)) { return (status); } } @@ -202,7 +177,6 @@ acpi_ev_fixed_event_initialize ( return (AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_ev_fixed_event_detect @@ -215,31 +189,27 @@ acpi_ev_fixed_event_initialize ( * ******************************************************************************/ -u32 -acpi_ev_fixed_event_detect ( - void) +u32 acpi_ev_fixed_event_detect(void) { - u32 int_status = ACPI_INTERRUPT_NOT_HANDLED; - u32 fixed_status; - u32 fixed_enable; - acpi_native_uint i; - - - ACPI_FUNCTION_NAME ("ev_fixed_event_detect"); + u32 int_status = ACPI_INTERRUPT_NOT_HANDLED; + u32 fixed_status; + u32 fixed_enable; + acpi_native_uint i; + ACPI_FUNCTION_NAME("ev_fixed_event_detect"); /* * Read the fixed feature status and enable registers, as all the cases * depend on their values. Ignore errors here. */ - (void) acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_STATUS, - &fixed_status); - (void) acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_ENABLE, - &fixed_enable); + (void)acpi_hw_register_read(ACPI_MTX_DO_NOT_LOCK, + ACPI_REGISTER_PM1_STATUS, &fixed_status); + (void)acpi_hw_register_read(ACPI_MTX_DO_NOT_LOCK, + ACPI_REGISTER_PM1_ENABLE, &fixed_enable); - ACPI_DEBUG_PRINT ((ACPI_DB_INTERRUPTS, - "Fixed Event Block: Enable %08X Status %08X\n", - fixed_enable, fixed_status)); + ACPI_DEBUG_PRINT((ACPI_DB_INTERRUPTS, + "Fixed Event Block: Enable %08X Status %08X\n", + fixed_enable, fixed_status)); /* * Check for all possible Fixed Events and dispatch those that are active @@ -247,18 +217,19 @@ acpi_ev_fixed_event_detect ( for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) { /* Both the status and enable bits must be on for this event */ - if ((fixed_status & acpi_gbl_fixed_event_info[i].status_bit_mask) && - (fixed_enable & acpi_gbl_fixed_event_info[i].enable_bit_mask)) { + if ((fixed_status & acpi_gbl_fixed_event_info[i]. + status_bit_mask) + && (fixed_enable & acpi_gbl_fixed_event_info[i]. + enable_bit_mask)) { /* Found an active (signalled) event */ - int_status |= acpi_ev_fixed_event_dispatch ((u32) i); + int_status |= acpi_ev_fixed_event_dispatch((u32) i); } } return (int_status); } - /******************************************************************************* * * FUNCTION: acpi_ev_fixed_event_dispatch @@ -272,39 +243,32 @@ acpi_ev_fixed_event_detect ( * ******************************************************************************/ -static u32 -acpi_ev_fixed_event_dispatch ( - u32 event) +static u32 acpi_ev_fixed_event_dispatch(u32 event) { - - ACPI_FUNCTION_ENTRY (); - + ACPI_FUNCTION_ENTRY(); /* Clear the status bit */ - (void) acpi_set_register (acpi_gbl_fixed_event_info[event].status_register_id, - 1, ACPI_MTX_DO_NOT_LOCK); + (void)acpi_set_register(acpi_gbl_fixed_event_info[event]. + status_register_id, 1, ACPI_MTX_DO_NOT_LOCK); /* * Make sure we've got a handler. If not, report an error. * The event is disabled to prevent further interrupts. */ if (NULL == acpi_gbl_fixed_event_handlers[event].handler) { - (void) acpi_set_register (acpi_gbl_fixed_event_info[event].enable_register_id, - 0, ACPI_MTX_DO_NOT_LOCK); + (void)acpi_set_register(acpi_gbl_fixed_event_info[event]. + enable_register_id, 0, + ACPI_MTX_DO_NOT_LOCK); - ACPI_REPORT_ERROR ( - ("No installed handler for fixed event [%08X]\n", - event)); + ACPI_REPORT_ERROR(("No installed handler for fixed event [%08X]\n", event)); return (ACPI_INTERRUPT_NOT_HANDLED); } /* Invoke the Fixed Event handler */ - return ((acpi_gbl_fixed_event_handlers[event].handler)( - acpi_gbl_fixed_event_handlers[event].context)); + return ((acpi_gbl_fixed_event_handlers[event]. + handler) (acpi_gbl_fixed_event_handlers[event].context)); } - - diff --git a/drivers/acpi/events/evgpe.c b/drivers/acpi/events/evgpe.c index ede834df4f6..b2f232df13d 100644 --- a/drivers/acpi/events/evgpe.c +++ b/drivers/acpi/events/evgpe.c @@ -46,14 +46,10 @@ #include #define _COMPONENT ACPI_EVENTS - ACPI_MODULE_NAME ("evgpe") +ACPI_MODULE_NAME("evgpe") /* Local prototypes */ - -static void ACPI_SYSTEM_XFACE -acpi_ev_asynch_execute_gpe_method ( - void *context); - +static void ACPI_SYSTEM_XFACE acpi_ev_asynch_execute_gpe_method(void *context); /******************************************************************************* * @@ -69,15 +65,11 @@ acpi_ev_asynch_execute_gpe_method ( ******************************************************************************/ acpi_status -acpi_ev_set_gpe_type ( - struct acpi_gpe_event_info *gpe_event_info, - u8 type) +acpi_ev_set_gpe_type(struct acpi_gpe_event_info *gpe_event_info, u8 type) { - acpi_status status; - - - ACPI_FUNCTION_TRACE ("ev_set_gpe_type"); + acpi_status status; + ACPI_FUNCTION_TRACE("ev_set_gpe_type"); /* Validate type and update register enable masks */ @@ -88,21 +80,20 @@ acpi_ev_set_gpe_type ( break; default: - return_ACPI_STATUS (AE_BAD_PARAMETER); + return_ACPI_STATUS(AE_BAD_PARAMETER); } /* Disable the GPE if currently enabled */ - status = acpi_ev_disable_gpe (gpe_event_info); + status = acpi_ev_disable_gpe(gpe_event_info); /* Type was validated above */ - gpe_event_info->flags &= ~ACPI_GPE_TYPE_MASK; /* Clear type bits */ - gpe_event_info->flags |= type; /* Insert type */ - return_ACPI_STATUS (status); + gpe_event_info->flags &= ~ACPI_GPE_TYPE_MASK; /* Clear type bits */ + gpe_event_info->flags |= type; /* Insert type */ + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_ev_update_gpe_enable_masks @@ -118,57 +109,55 @@ acpi_ev_set_gpe_type ( ******************************************************************************/ acpi_status -acpi_ev_update_gpe_enable_masks ( - struct acpi_gpe_event_info *gpe_event_info, - u8 type) +acpi_ev_update_gpe_enable_masks(struct acpi_gpe_event_info *gpe_event_info, + u8 type) { - struct acpi_gpe_register_info *gpe_register_info; - u8 register_bit; - - - ACPI_FUNCTION_TRACE ("ev_update_gpe_enable_masks"); + struct acpi_gpe_register_info *gpe_register_info; + u8 register_bit; + ACPI_FUNCTION_TRACE("ev_update_gpe_enable_masks"); gpe_register_info = gpe_event_info->register_info; if (!gpe_register_info) { - return_ACPI_STATUS (AE_NOT_EXIST); + return_ACPI_STATUS(AE_NOT_EXIST); } register_bit = gpe_event_info->register_bit; /* 1) Disable case. Simply clear all enable bits */ if (type == ACPI_GPE_DISABLE) { - ACPI_CLEAR_BIT (gpe_register_info->enable_for_wake, register_bit); - ACPI_CLEAR_BIT (gpe_register_info->enable_for_run, register_bit); - return_ACPI_STATUS (AE_OK); + ACPI_CLEAR_BIT(gpe_register_info->enable_for_wake, + register_bit); + ACPI_CLEAR_BIT(gpe_register_info->enable_for_run, register_bit); + return_ACPI_STATUS(AE_OK); } /* 2) Enable case. Set/Clear the appropriate enable bits */ switch (gpe_event_info->flags & ACPI_GPE_TYPE_MASK) { case ACPI_GPE_TYPE_WAKE: - ACPI_SET_BIT (gpe_register_info->enable_for_wake, register_bit); - ACPI_CLEAR_BIT (gpe_register_info->enable_for_run, register_bit); + ACPI_SET_BIT(gpe_register_info->enable_for_wake, register_bit); + ACPI_CLEAR_BIT(gpe_register_info->enable_for_run, register_bit); break; case ACPI_GPE_TYPE_RUNTIME: - ACPI_CLEAR_BIT (gpe_register_info->enable_for_wake, register_bit); - ACPI_SET_BIT (gpe_register_info->enable_for_run, register_bit); + ACPI_CLEAR_BIT(gpe_register_info->enable_for_wake, + register_bit); + ACPI_SET_BIT(gpe_register_info->enable_for_run, register_bit); break; case ACPI_GPE_TYPE_WAKE_RUN: - ACPI_SET_BIT (gpe_register_info->enable_for_wake, register_bit); - ACPI_SET_BIT (gpe_register_info->enable_for_run, register_bit); + ACPI_SET_BIT(gpe_register_info->enable_for_wake, register_bit); + ACPI_SET_BIT(gpe_register_info->enable_for_run, register_bit); break; default: - return_ACPI_STATUS (AE_BAD_PARAMETER); + return_ACPI_STATUS(AE_BAD_PARAMETER); } - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_ev_enable_gpe @@ -184,21 +173,19 @@ acpi_ev_update_gpe_enable_masks ( ******************************************************************************/ acpi_status -acpi_ev_enable_gpe ( - struct acpi_gpe_event_info *gpe_event_info, - u8 write_to_hardware) +acpi_ev_enable_gpe(struct acpi_gpe_event_info *gpe_event_info, + u8 write_to_hardware) { - acpi_status status; - - - ACPI_FUNCTION_TRACE ("ev_enable_gpe"); + acpi_status status; + ACPI_FUNCTION_TRACE("ev_enable_gpe"); /* Make sure HW enable masks are updated */ - status = acpi_ev_update_gpe_enable_masks (gpe_event_info, ACPI_GPE_ENABLE); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = + acpi_ev_update_gpe_enable_masks(gpe_event_info, ACPI_GPE_ENABLE); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* Mark wake-enabled or HW enable, or both */ @@ -206,41 +193,40 @@ acpi_ev_enable_gpe ( switch (gpe_event_info->flags & ACPI_GPE_TYPE_MASK) { case ACPI_GPE_TYPE_WAKE: - ACPI_SET_BIT (gpe_event_info->flags, ACPI_GPE_WAKE_ENABLED); + ACPI_SET_BIT(gpe_event_info->flags, ACPI_GPE_WAKE_ENABLED); break; case ACPI_GPE_TYPE_WAKE_RUN: - ACPI_SET_BIT (gpe_event_info->flags, ACPI_GPE_WAKE_ENABLED); + ACPI_SET_BIT(gpe_event_info->flags, ACPI_GPE_WAKE_ENABLED); /*lint -fallthrough */ case ACPI_GPE_TYPE_RUNTIME: - ACPI_SET_BIT (gpe_event_info->flags, ACPI_GPE_RUN_ENABLED); + ACPI_SET_BIT(gpe_event_info->flags, ACPI_GPE_RUN_ENABLED); if (write_to_hardware) { /* Clear the GPE (of stale events), then enable it */ - status = acpi_hw_clear_gpe (gpe_event_info); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_hw_clear_gpe(gpe_event_info); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* Enable the requested runtime GPE */ - status = acpi_hw_write_gpe_enable_reg (gpe_event_info); + status = acpi_hw_write_gpe_enable_reg(gpe_event_info); } break; default: - return_ACPI_STATUS (AE_BAD_PARAMETER); + return_ACPI_STATUS(AE_BAD_PARAMETER); } - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_ev_disable_gpe @@ -253,36 +239,33 @@ acpi_ev_enable_gpe ( * ******************************************************************************/ -acpi_status -acpi_ev_disable_gpe ( - struct acpi_gpe_event_info *gpe_event_info) +acpi_status acpi_ev_disable_gpe(struct acpi_gpe_event_info *gpe_event_info) { - acpi_status status; - - - ACPI_FUNCTION_TRACE ("ev_disable_gpe"); + acpi_status status; + ACPI_FUNCTION_TRACE("ev_disable_gpe"); if (!(gpe_event_info->flags & ACPI_GPE_ENABLE_MASK)) { - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } /* Make sure HW enable masks are updated */ - status = acpi_ev_update_gpe_enable_masks (gpe_event_info, ACPI_GPE_DISABLE); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = + acpi_ev_update_gpe_enable_masks(gpe_event_info, ACPI_GPE_DISABLE); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* Mark wake-disabled or HW disable, or both */ switch (gpe_event_info->flags & ACPI_GPE_TYPE_MASK) { case ACPI_GPE_TYPE_WAKE: - ACPI_CLEAR_BIT (gpe_event_info->flags, ACPI_GPE_WAKE_ENABLED); + ACPI_CLEAR_BIT(gpe_event_info->flags, ACPI_GPE_WAKE_ENABLED); break; case ACPI_GPE_TYPE_WAKE_RUN: - ACPI_CLEAR_BIT (gpe_event_info->flags, ACPI_GPE_WAKE_ENABLED); + ACPI_CLEAR_BIT(gpe_event_info->flags, ACPI_GPE_WAKE_ENABLED); /*lint -fallthrough */ @@ -290,18 +273,17 @@ acpi_ev_disable_gpe ( /* Disable the requested runtime GPE */ - ACPI_CLEAR_BIT (gpe_event_info->flags, ACPI_GPE_RUN_ENABLED); - status = acpi_hw_write_gpe_enable_reg (gpe_event_info); + ACPI_CLEAR_BIT(gpe_event_info->flags, ACPI_GPE_RUN_ENABLED); + status = acpi_hw_write_gpe_enable_reg(gpe_event_info); break; default: - return_ACPI_STATUS (AE_BAD_PARAMETER); + return_ACPI_STATUS(AE_BAD_PARAMETER); } - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_ev_get_gpe_event_info @@ -319,18 +301,14 @@ acpi_ev_disable_gpe ( * ******************************************************************************/ -struct acpi_gpe_event_info * -acpi_ev_get_gpe_event_info ( - acpi_handle gpe_device, - u32 gpe_number) +struct acpi_gpe_event_info *acpi_ev_get_gpe_event_info(acpi_handle gpe_device, + u32 gpe_number) { - union acpi_operand_object *obj_desc; - struct acpi_gpe_block_info *gpe_block; - acpi_native_uint i; - - - ACPI_FUNCTION_ENTRY (); + union acpi_operand_object *obj_desc; + struct acpi_gpe_block_info *gpe_block; + acpi_native_uint i; + ACPI_FUNCTION_ENTRY(); /* A NULL gpe_block means use the FADT-defined GPE block(s) */ @@ -340,11 +318,14 @@ acpi_ev_get_gpe_event_info ( for (i = 0; i < ACPI_MAX_GPE_BLOCKS; i++) { gpe_block = acpi_gbl_gpe_fadt_blocks[i]; if (gpe_block) { - if ((gpe_number >= gpe_block->block_base_number) && - (gpe_number < gpe_block->block_base_number + - (gpe_block->register_count * 8))) { - return (&gpe_block->event_info[gpe_number - - gpe_block->block_base_number]); + if ((gpe_number >= gpe_block->block_base_number) + && (gpe_number < + gpe_block->block_base_number + + (gpe_block->register_count * 8))) { + return (&gpe_block-> + event_info[gpe_number - + gpe_block-> + block_base_number]); } } } @@ -356,23 +337,25 @@ acpi_ev_get_gpe_event_info ( /* A Non-NULL gpe_device means this is a GPE Block Device */ - obj_desc = acpi_ns_get_attached_object ((struct acpi_namespace_node *) gpe_device); - if (!obj_desc || - !obj_desc->device.gpe_block) { + obj_desc = + acpi_ns_get_attached_object((struct acpi_namespace_node *) + gpe_device); + if (!obj_desc || !obj_desc->device.gpe_block) { return (NULL); } gpe_block = obj_desc->device.gpe_block; if ((gpe_number >= gpe_block->block_base_number) && - (gpe_number < gpe_block->block_base_number + (gpe_block->register_count * 8))) { - return (&gpe_block->event_info[gpe_number - gpe_block->block_base_number]); + (gpe_number < + gpe_block->block_base_number + (gpe_block->register_count * 8))) { + return (&gpe_block-> + event_info[gpe_number - gpe_block->block_base_number]); } return (NULL); } - /******************************************************************************* * * FUNCTION: acpi_ev_gpe_detect @@ -387,23 +370,20 @@ acpi_ev_get_gpe_event_info ( * ******************************************************************************/ -u32 -acpi_ev_gpe_detect ( - struct acpi_gpe_xrupt_info *gpe_xrupt_list) +u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list) { - u32 int_status = ACPI_INTERRUPT_NOT_HANDLED; - u8 enabled_status_byte; - struct acpi_gpe_register_info *gpe_register_info; - u32 status_reg; - u32 enable_reg; - u32 flags; - acpi_status status; - struct acpi_gpe_block_info *gpe_block; - acpi_native_uint i; - acpi_native_uint j; - - - ACPI_FUNCTION_NAME ("ev_gpe_detect"); + u32 int_status = ACPI_INTERRUPT_NOT_HANDLED; + u8 enabled_status_byte; + struct acpi_gpe_register_info *gpe_register_info; + u32 status_reg; + u32 enable_reg; + u32 flags; + acpi_status status; + struct acpi_gpe_block_info *gpe_block; + acpi_native_uint i; + acpi_native_uint j; + + ACPI_FUNCTION_NAME("ev_gpe_detect"); /* Check for the case where there are no GPEs */ @@ -413,7 +393,7 @@ acpi_ev_gpe_detect ( /* Examine all GPE blocks attached to this interrupt level */ - flags = acpi_os_acquire_lock (acpi_gbl_gpe_lock); + flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock); gpe_block = gpe_xrupt_list->gpe_block_list_head; while (gpe_block) { /* @@ -428,23 +408,30 @@ acpi_ev_gpe_detect ( /* Read the Status Register */ - status = acpi_hw_low_level_read (ACPI_GPE_REGISTER_WIDTH, &status_reg, - &gpe_register_info->status_address); - if (ACPI_FAILURE (status)) { + status = + acpi_hw_low_level_read(ACPI_GPE_REGISTER_WIDTH, + &status_reg, + &gpe_register_info-> + status_address); + if (ACPI_FAILURE(status)) { goto unlock_and_exit; } /* Read the Enable Register */ - status = acpi_hw_low_level_read (ACPI_GPE_REGISTER_WIDTH, &enable_reg, - &gpe_register_info->enable_address); - if (ACPI_FAILURE (status)) { + status = + acpi_hw_low_level_read(ACPI_GPE_REGISTER_WIDTH, + &enable_reg, + &gpe_register_info-> + enable_address); + if (ACPI_FAILURE(status)) { goto unlock_and_exit; } - ACPI_DEBUG_PRINT ((ACPI_DB_INTERRUPTS, - "Read GPE Register at GPE%X: Status=%02X, Enable=%02X\n", - gpe_register_info->base_gpe_number, status_reg, enable_reg)); + ACPI_DEBUG_PRINT((ACPI_DB_INTERRUPTS, + "Read GPE Register at GPE%X: Status=%02X, Enable=%02X\n", + gpe_register_info->base_gpe_number, + status_reg, enable_reg)); /* Check if there is anything active at all in this register */ @@ -460,14 +447,21 @@ acpi_ev_gpe_detect ( for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++) { /* Examine one GPE bit */ - if (enabled_status_byte & acpi_gbl_decode_to8bit[j]) { + if (enabled_status_byte & + acpi_gbl_decode_to8bit[j]) { /* * Found an active GPE. Dispatch the event to a handler * or method. */ - int_status |= acpi_ev_gpe_dispatch ( - &gpe_block->event_info[(i * ACPI_GPE_REGISTER_WIDTH) + j], - (u32) j + gpe_register_info->base_gpe_number); + int_status |= + acpi_ev_gpe_dispatch(&gpe_block-> + event_info[(i * + ACPI_GPE_REGISTER_WIDTH) + + + j], + (u32) j + + gpe_register_info-> + base_gpe_number); } } } @@ -475,13 +469,12 @@ acpi_ev_gpe_detect ( gpe_block = gpe_block->next; } -unlock_and_exit: + unlock_and_exit: - acpi_os_release_lock (acpi_gbl_gpe_lock, flags); + acpi_os_release_lock(acpi_gbl_gpe_lock, flags); return (int_status); } - /******************************************************************************* * * FUNCTION: acpi_ev_asynch_execute_gpe_method @@ -498,45 +491,41 @@ unlock_and_exit: * ******************************************************************************/ -static void ACPI_SYSTEM_XFACE -acpi_ev_asynch_execute_gpe_method ( - void *context) +static void ACPI_SYSTEM_XFACE acpi_ev_asynch_execute_gpe_method(void *context) { - struct acpi_gpe_event_info *gpe_event_info = (void *) context; - u32 gpe_number = 0; - acpi_status status; - struct acpi_gpe_event_info local_gpe_event_info; - struct acpi_parameter_info info; - + struct acpi_gpe_event_info *gpe_event_info = (void *)context; + u32 gpe_number = 0; + acpi_status status; + struct acpi_gpe_event_info local_gpe_event_info; + struct acpi_parameter_info info; - ACPI_FUNCTION_TRACE ("ev_asynch_execute_gpe_method"); + ACPI_FUNCTION_TRACE("ev_asynch_execute_gpe_method"); - - status = acpi_ut_acquire_mutex (ACPI_MTX_EVENTS); - if (ACPI_FAILURE (status)) { + status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS); + if (ACPI_FAILURE(status)) { return_VOID; } /* Must revalidate the gpe_number/gpe_block */ - if (!acpi_ev_valid_gpe_event (gpe_event_info)) { - status = acpi_ut_release_mutex (ACPI_MTX_EVENTS); + if (!acpi_ev_valid_gpe_event(gpe_event_info)) { + status = acpi_ut_release_mutex(ACPI_MTX_EVENTS); return_VOID; } /* Set the GPE flags for return to enabled state */ - (void) acpi_ev_enable_gpe (gpe_event_info, FALSE); + (void)acpi_ev_enable_gpe(gpe_event_info, FALSE); /* * Take a snapshot of the GPE info for this level - we copy the * info to prevent a race condition with remove_handler/remove_block. */ - ACPI_MEMCPY (&local_gpe_event_info, gpe_event_info, - sizeof (struct acpi_gpe_event_info)); + ACPI_MEMCPY(&local_gpe_event_info, gpe_event_info, + sizeof(struct acpi_gpe_event_info)); - status = acpi_ut_release_mutex (ACPI_MTX_EVENTS); - if (ACPI_FAILURE (status)) { + status = acpi_ut_release_mutex(ACPI_MTX_EVENTS); + if (ACPI_FAILURE(status)) { return_VOID; } @@ -545,44 +534,40 @@ acpi_ev_asynch_execute_gpe_method ( * time to avoid race with ev_gpe_install_handler */ if ((local_gpe_event_info.flags & ACPI_GPE_DISPATCH_MASK) == - ACPI_GPE_DISPATCH_METHOD) { + ACPI_GPE_DISPATCH_METHOD) { /* * Invoke the GPE Method (_Lxx, _Exx) i.e., evaluate the _Lxx/_Exx * control method that corresponds to this GPE */ info.node = local_gpe_event_info.dispatch.method_node; - info.parameters = ACPI_CAST_PTR (union acpi_operand_object *, gpe_event_info); + info.parameters = + ACPI_CAST_PTR(union acpi_operand_object *, gpe_event_info); info.parameter_type = ACPI_PARAM_GPE; - status = acpi_ns_evaluate_by_handle (&info); - if (ACPI_FAILURE (status)) { - ACPI_REPORT_ERROR (( - "%s while evaluating method [%4.4s] for GPE[%2X]\n", - acpi_format_exception (status), - acpi_ut_get_node_name (local_gpe_event_info.dispatch.method_node), - gpe_number)); + status = acpi_ns_evaluate_by_handle(&info); + if (ACPI_FAILURE(status)) { + ACPI_REPORT_ERROR(("%s while evaluating method [%4.4s] for GPE[%2X]\n", acpi_format_exception(status), acpi_ut_get_node_name(local_gpe_event_info.dispatch.method_node), gpe_number)); } } if ((local_gpe_event_info.flags & ACPI_GPE_XRUPT_TYPE_MASK) == - ACPI_GPE_LEVEL_TRIGGERED) { + ACPI_GPE_LEVEL_TRIGGERED) { /* * GPE is level-triggered, we clear the GPE status bit after * handling the event. */ - status = acpi_hw_clear_gpe (&local_gpe_event_info); - if (ACPI_FAILURE (status)) { + status = acpi_hw_clear_gpe(&local_gpe_event_info); + if (ACPI_FAILURE(status)) { return_VOID; } } /* Enable this GPE */ - (void) acpi_hw_write_gpe_enable_reg (&local_gpe_event_info); + (void)acpi_hw_write_gpe_enable_reg(&local_gpe_event_info); return_VOID; } - /******************************************************************************* * * FUNCTION: acpi_ev_gpe_dispatch @@ -600,38 +585,31 @@ acpi_ev_asynch_execute_gpe_method ( ******************************************************************************/ u32 -acpi_ev_gpe_dispatch ( - struct acpi_gpe_event_info *gpe_event_info, - u32 gpe_number) +acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number) { - acpi_status status; - - - ACPI_FUNCTION_TRACE ("ev_gpe_dispatch"); + acpi_status status; + ACPI_FUNCTION_TRACE("ev_gpe_dispatch"); /* * If edge-triggered, clear the GPE status bit now. Note that * level-triggered events are cleared after the GPE is serviced. */ if ((gpe_event_info->flags & ACPI_GPE_XRUPT_TYPE_MASK) == - ACPI_GPE_EDGE_TRIGGERED) { - status = acpi_hw_clear_gpe (gpe_event_info); - if (ACPI_FAILURE (status)) { - ACPI_REPORT_ERROR (( - "acpi_ev_gpe_dispatch: %s, Unable to clear GPE[%2X]\n", - acpi_format_exception (status), gpe_number)); - return_VALUE (ACPI_INTERRUPT_NOT_HANDLED); + ACPI_GPE_EDGE_TRIGGERED) { + status = acpi_hw_clear_gpe(gpe_event_info); + if (ACPI_FAILURE(status)) { + ACPI_REPORT_ERROR(("acpi_ev_gpe_dispatch: %s, Unable to clear GPE[%2X]\n", acpi_format_exception(status), gpe_number)); + return_VALUE(ACPI_INTERRUPT_NOT_HANDLED); } } /* Save current system state */ if (acpi_gbl_system_awake_and_running) { - ACPI_SET_BIT (gpe_event_info->flags, ACPI_GPE_SYSTEM_RUNNING); - } - else { - ACPI_CLEAR_BIT (gpe_event_info->flags, ACPI_GPE_SYSTEM_RUNNING); + ACPI_SET_BIT(gpe_event_info->flags, ACPI_GPE_SYSTEM_RUNNING); + } else { + ACPI_CLEAR_BIT(gpe_event_info->flags, ACPI_GPE_SYSTEM_RUNNING); } /* @@ -648,19 +626,19 @@ acpi_ev_gpe_dispatch ( * Invoke the installed handler (at interrupt level) * Ignore return status for now. TBD: leave GPE disabled on error? */ - (void) gpe_event_info->dispatch.handler->address ( - gpe_event_info->dispatch.handler->context); + (void)gpe_event_info->dispatch.handler->address(gpe_event_info-> + dispatch. + handler-> + context); /* It is now safe to clear level-triggered events. */ if ((gpe_event_info->flags & ACPI_GPE_XRUPT_TYPE_MASK) == - ACPI_GPE_LEVEL_TRIGGERED) { - status = acpi_hw_clear_gpe (gpe_event_info); - if (ACPI_FAILURE (status)) { - ACPI_REPORT_ERROR (( - "acpi_ev_gpe_dispatch: %s, Unable to clear GPE[%2X]\n", - acpi_format_exception (status), gpe_number)); - return_VALUE (ACPI_INTERRUPT_NOT_HANDLED); + ACPI_GPE_LEVEL_TRIGGERED) { + status = acpi_hw_clear_gpe(gpe_event_info); + if (ACPI_FAILURE(status)) { + ACPI_REPORT_ERROR(("acpi_ev_gpe_dispatch: %s, Unable to clear GPE[%2X]\n", acpi_format_exception(status), gpe_number)); + return_VALUE(ACPI_INTERRUPT_NOT_HANDLED); } } break; @@ -671,24 +649,21 @@ acpi_ev_gpe_dispatch ( * Disable GPE, so it doesn't keep firing before the method has a * chance to run. */ - status = acpi_ev_disable_gpe (gpe_event_info); - if (ACPI_FAILURE (status)) { - ACPI_REPORT_ERROR (( - "acpi_ev_gpe_dispatch: %s, Unable to disable GPE[%2X]\n", - acpi_format_exception (status), gpe_number)); - return_VALUE (ACPI_INTERRUPT_NOT_HANDLED); + status = acpi_ev_disable_gpe(gpe_event_info); + if (ACPI_FAILURE(status)) { + ACPI_REPORT_ERROR(("acpi_ev_gpe_dispatch: %s, Unable to disable GPE[%2X]\n", acpi_format_exception(status), gpe_number)); + return_VALUE(ACPI_INTERRUPT_NOT_HANDLED); } /* * Execute the method associated with the GPE * NOTE: Level-triggered GPEs are cleared after the method completes. */ - status = acpi_os_queue_for_execution (OSD_PRIORITY_GPE, - acpi_ev_asynch_execute_gpe_method, gpe_event_info); - if (ACPI_FAILURE (status)) { - ACPI_REPORT_ERROR (( - "acpi_ev_gpe_dispatch: %s, Unable to queue handler for GPE[%2X] - event disabled\n", - acpi_format_exception (status), gpe_number)); + status = acpi_os_queue_for_execution(OSD_PRIORITY_GPE, + acpi_ev_asynch_execute_gpe_method, + gpe_event_info); + if (ACPI_FAILURE(status)) { + ACPI_REPORT_ERROR(("acpi_ev_gpe_dispatch: %s, Unable to queue handler for GPE[%2X] - event disabled\n", acpi_format_exception(status), gpe_number)); } break; @@ -696,28 +671,23 @@ acpi_ev_gpe_dispatch ( /* No handler or method to run! */ - ACPI_REPORT_ERROR (( - "acpi_ev_gpe_dispatch: No handler or method for GPE[%2X], disabling event\n", - gpe_number)); + ACPI_REPORT_ERROR(("acpi_ev_gpe_dispatch: No handler or method for GPE[%2X], disabling event\n", gpe_number)); /* * Disable the GPE. The GPE will remain disabled until the ACPI * Core Subsystem is restarted, or a handler is installed. */ - status = acpi_ev_disable_gpe (gpe_event_info); - if (ACPI_FAILURE (status)) { - ACPI_REPORT_ERROR (( - "acpi_ev_gpe_dispatch: %s, Unable to disable GPE[%2X]\n", - acpi_format_exception (status), gpe_number)); - return_VALUE (ACPI_INTERRUPT_NOT_HANDLED); + status = acpi_ev_disable_gpe(gpe_event_info); + if (ACPI_FAILURE(status)) { + ACPI_REPORT_ERROR(("acpi_ev_gpe_dispatch: %s, Unable to disable GPE[%2X]\n", acpi_format_exception(status), gpe_number)); + return_VALUE(ACPI_INTERRUPT_NOT_HANDLED); } break; } - return_VALUE (ACPI_INTERRUPT_HANDLED); + return_VALUE(ACPI_INTERRUPT_HANDLED); } - #ifdef ACPI_GPE_NOTIFY_CHECK /******************************************************************************* * TBD: NOT USED, PROTOTYPE ONLY AND WILL PROBABLY BE REMOVED @@ -736,35 +706,29 @@ acpi_ev_gpe_dispatch ( ******************************************************************************/ acpi_status -acpi_ev_check_for_wake_only_gpe ( - struct acpi_gpe_event_info *gpe_event_info) +acpi_ev_check_for_wake_only_gpe(struct acpi_gpe_event_info *gpe_event_info) { - acpi_status status; + acpi_status status; + ACPI_FUNCTION_TRACE("ev_check_for_wake_only_gpe"); - ACPI_FUNCTION_TRACE ("ev_check_for_wake_only_gpe"); - - - if ((gpe_event_info) && /* Only >0 for _Lxx/_Exx */ - ((gpe_event_info->flags & ACPI_GPE_SYSTEM_MASK) == ACPI_GPE_SYSTEM_RUNNING)) /* System state at GPE time */ { + if ((gpe_event_info) && /* Only >0 for _Lxx/_Exx */ + ((gpe_event_info->flags & ACPI_GPE_SYSTEM_MASK) == ACPI_GPE_SYSTEM_RUNNING)) { /* System state at GPE time */ /* This must be a wake-only GPE, disable it */ - status = acpi_ev_disable_gpe (gpe_event_info); + status = acpi_ev_disable_gpe(gpe_event_info); /* Set GPE to wake-only. Do not change wake disabled/enabled status */ - acpi_ev_set_gpe_type (gpe_event_info, ACPI_GPE_TYPE_WAKE); + acpi_ev_set_gpe_type(gpe_event_info, ACPI_GPE_TYPE_WAKE); - ACPI_REPORT_INFO (("GPE %p was updated from wake/run to wake-only\n", - gpe_event_info)); + ACPI_REPORT_INFO(("GPE %p was updated from wake/run to wake-only\n", gpe_event_info)); /* This was a wake-only GPE */ - return_ACPI_STATUS (AE_WAKE_ONLY_GPE); + return_ACPI_STATUS(AE_WAKE_ONLY_GPE); } - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } #endif - - diff --git a/drivers/acpi/events/evgpeblk.c b/drivers/acpi/events/evgpeblk.c index dfc54692b12..b312eb33c43 100644 --- a/drivers/acpi/events/evgpeblk.c +++ b/drivers/acpi/events/evgpeblk.c @@ -46,41 +46,29 @@ #include #define _COMPONENT ACPI_EVENTS - ACPI_MODULE_NAME ("evgpeblk") +ACPI_MODULE_NAME("evgpeblk") /* Local prototypes */ - static acpi_status -acpi_ev_save_method_info ( - acpi_handle obj_handle, - u32 level, - void *obj_desc, - void **return_value); +acpi_ev_save_method_info(acpi_handle obj_handle, + u32 level, void *obj_desc, void **return_value); static acpi_status -acpi_ev_match_prw_and_gpe ( - acpi_handle obj_handle, - u32 level, - void *info, - void **return_value); +acpi_ev_match_prw_and_gpe(acpi_handle obj_handle, + u32 level, void *info, void **return_value); -static struct acpi_gpe_xrupt_info * -acpi_ev_get_gpe_xrupt_block ( - u32 interrupt_number); +static struct acpi_gpe_xrupt_info *acpi_ev_get_gpe_xrupt_block(u32 + interrupt_number); static acpi_status -acpi_ev_delete_gpe_xrupt ( - struct acpi_gpe_xrupt_info *gpe_xrupt); +acpi_ev_delete_gpe_xrupt(struct acpi_gpe_xrupt_info *gpe_xrupt); static acpi_status -acpi_ev_install_gpe_block ( - struct acpi_gpe_block_info *gpe_block, - u32 interrupt_number); +acpi_ev_install_gpe_block(struct acpi_gpe_block_info *gpe_block, + u32 interrupt_number); static acpi_status -acpi_ev_create_gpe_info_blocks ( - struct acpi_gpe_block_info *gpe_block); - +acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block); /******************************************************************************* * @@ -96,16 +84,12 @@ acpi_ev_create_gpe_info_blocks ( * ******************************************************************************/ -u8 -acpi_ev_valid_gpe_event ( - struct acpi_gpe_event_info *gpe_event_info) +u8 acpi_ev_valid_gpe_event(struct acpi_gpe_event_info *gpe_event_info) { - struct acpi_gpe_xrupt_info *gpe_xrupt_block; - struct acpi_gpe_block_info *gpe_block; - - - ACPI_FUNCTION_ENTRY (); + struct acpi_gpe_xrupt_info *gpe_xrupt_block; + struct acpi_gpe_block_info *gpe_block; + ACPI_FUNCTION_ENTRY(); /* No need for spin lock since we are not changing any list elements */ @@ -119,7 +103,10 @@ acpi_ev_valid_gpe_event ( while (gpe_block) { if ((&gpe_block->event_info[0] <= gpe_event_info) && - (&gpe_block->event_info[((acpi_size) gpe_block->register_count) * 8] > gpe_event_info)) { + (&gpe_block-> + event_info[((acpi_size) gpe_block-> + register_count) * 8] > + gpe_event_info)) { return (TRUE); } @@ -132,7 +119,6 @@ acpi_ev_valid_gpe_event ( return (FALSE); } - /******************************************************************************* * * FUNCTION: acpi_ev_walk_gpe_list @@ -145,20 +131,16 @@ acpi_ev_valid_gpe_event ( * ******************************************************************************/ -acpi_status -acpi_ev_walk_gpe_list ( - ACPI_GPE_CALLBACK gpe_walk_callback) +acpi_status acpi_ev_walk_gpe_list(ACPI_GPE_CALLBACK gpe_walk_callback) { - struct acpi_gpe_block_info *gpe_block; - struct acpi_gpe_xrupt_info *gpe_xrupt_info; - acpi_status status = AE_OK; - u32 flags; - + struct acpi_gpe_block_info *gpe_block; + struct acpi_gpe_xrupt_info *gpe_xrupt_info; + acpi_status status = AE_OK; + u32 flags; - ACPI_FUNCTION_TRACE ("ev_walk_gpe_list"); + ACPI_FUNCTION_TRACE("ev_walk_gpe_list"); - - flags = acpi_os_acquire_lock (acpi_gbl_gpe_lock); + flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock); /* Walk the interrupt level descriptor list */ @@ -170,8 +152,8 @@ acpi_ev_walk_gpe_list ( while (gpe_block) { /* One callback per GPE block */ - status = gpe_walk_callback (gpe_xrupt_info, gpe_block); - if (ACPI_FAILURE (status)) { + status = gpe_walk_callback(gpe_xrupt_info, gpe_block); + if (ACPI_FAILURE(status)) { goto unlock_and_exit; } @@ -181,12 +163,11 @@ acpi_ev_walk_gpe_list ( gpe_xrupt_info = gpe_xrupt_info->next; } -unlock_and_exit: - acpi_os_release_lock (acpi_gbl_gpe_lock, flags); - return_ACPI_STATUS (status); + unlock_and_exit: + acpi_os_release_lock(acpi_gbl_gpe_lock, flags); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_ev_delete_gpe_handlers @@ -202,17 +183,14 @@ unlock_and_exit: ******************************************************************************/ acpi_status -acpi_ev_delete_gpe_handlers ( - struct acpi_gpe_xrupt_info *gpe_xrupt_info, - struct acpi_gpe_block_info *gpe_block) +acpi_ev_delete_gpe_handlers(struct acpi_gpe_xrupt_info *gpe_xrupt_info, + struct acpi_gpe_block_info *gpe_block) { - struct acpi_gpe_event_info *gpe_event_info; - acpi_native_uint i; - acpi_native_uint j; - - - ACPI_FUNCTION_TRACE ("ev_delete_gpe_handlers"); + struct acpi_gpe_event_info *gpe_event_info; + acpi_native_uint i; + acpi_native_uint j; + ACPI_FUNCTION_TRACE("ev_delete_gpe_handlers"); /* Examine each GPE Register within the block */ @@ -220,21 +198,23 @@ acpi_ev_delete_gpe_handlers ( /* Now look at the individual GPEs in this byte register */ for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++) { - gpe_event_info = &gpe_block->event_info[(i * ACPI_GPE_REGISTER_WIDTH) + j]; + gpe_event_info = + &gpe_block-> + event_info[(i * ACPI_GPE_REGISTER_WIDTH) + j]; if ((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) == - ACPI_GPE_DISPATCH_HANDLER) { - ACPI_MEM_FREE (gpe_event_info->dispatch.handler); + ACPI_GPE_DISPATCH_HANDLER) { + ACPI_MEM_FREE(gpe_event_info->dispatch.handler); gpe_event_info->dispatch.handler = NULL; - gpe_event_info->flags &= ~ACPI_GPE_DISPATCH_MASK; + gpe_event_info->flags &= + ~ACPI_GPE_DISPATCH_MASK; } } } - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_ev_save_method_info @@ -258,30 +238,26 @@ acpi_ev_delete_gpe_handlers ( ******************************************************************************/ static acpi_status -acpi_ev_save_method_info ( - acpi_handle obj_handle, - u32 level, - void *obj_desc, - void **return_value) +acpi_ev_save_method_info(acpi_handle obj_handle, + u32 level, void *obj_desc, void **return_value) { - struct acpi_gpe_block_info *gpe_block = (void *) obj_desc; - struct acpi_gpe_event_info *gpe_event_info; - u32 gpe_number; - char name[ACPI_NAME_SIZE + 1]; - u8 type; - acpi_status status; - - - ACPI_FUNCTION_TRACE ("ev_save_method_info"); + struct acpi_gpe_block_info *gpe_block = (void *)obj_desc; + struct acpi_gpe_event_info *gpe_event_info; + u32 gpe_number; + char name[ACPI_NAME_SIZE + 1]; + u8 type; + acpi_status status; + ACPI_FUNCTION_TRACE("ev_save_method_info"); /* * _Lxx and _Exx GPE method support * * 1) Extract the name from the object and convert to a string */ - ACPI_MOVE_32_TO_32 (name, - &((struct acpi_namespace_node *) obj_handle)->name.integer); + ACPI_MOVE_32_TO_32(name, + &((struct acpi_namespace_node *)obj_handle)->name. + integer); name[ACPI_NAME_SIZE] = 0; /* @@ -303,34 +279,36 @@ acpi_ev_save_method_info ( default: /* Unknown method type, just ignore it! */ - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Unknown GPE method type: %s (name not of form _Lxx or _Exx)\n", - name)); - return_ACPI_STATUS (AE_OK); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Unknown GPE method type: %s (name not of form _Lxx or _Exx)\n", + name)); + return_ACPI_STATUS(AE_OK); } /* Convert the last two characters of the name to the GPE Number */ - gpe_number = ACPI_STRTOUL (&name[2], NULL, 16); + gpe_number = ACPI_STRTOUL(&name[2], NULL, 16); if (gpe_number == ACPI_UINT32_MAX) { /* Conversion failed; invalid method, just ignore it */ - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Could not extract GPE number from name: %s (name is not of form _Lxx or _Exx)\n", - name)); - return_ACPI_STATUS (AE_OK); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Could not extract GPE number from name: %s (name is not of form _Lxx or _Exx)\n", + name)); + return_ACPI_STATUS(AE_OK); } /* Ensure that we have a valid GPE number for this GPE block */ if ((gpe_number < gpe_block->block_base_number) || - (gpe_number >= (gpe_block->block_base_number + (gpe_block->register_count * 8)))) { + (gpe_number >= + (gpe_block->block_base_number + + (gpe_block->register_count * 8)))) { /* * Not valid for this GPE block, just ignore it * However, it may be valid for a different GPE block, since GPE0 and GPE1 * methods both appear under \_GPE. */ - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } /* @@ -338,24 +316,25 @@ acpi_ev_save_method_info ( * for use during dispatch of this GPE. Default type is RUNTIME, although * this may change when the _PRW methods are executed later. */ - gpe_event_info = &gpe_block->event_info[gpe_number - gpe_block->block_base_number]; + gpe_event_info = + &gpe_block->event_info[gpe_number - gpe_block->block_base_number]; gpe_event_info->flags = (u8) (type | ACPI_GPE_DISPATCH_METHOD | - ACPI_GPE_TYPE_RUNTIME); + ACPI_GPE_TYPE_RUNTIME); - gpe_event_info->dispatch.method_node = (struct acpi_namespace_node *) obj_handle; + gpe_event_info->dispatch.method_node = + (struct acpi_namespace_node *)obj_handle; /* Update enable mask, but don't enable the HW GPE as of yet */ - status = acpi_ev_enable_gpe (gpe_event_info, FALSE); + status = acpi_ev_enable_gpe(gpe_event_info, FALSE); - ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, - "Registered GPE method %s as GPE number 0x%.2X\n", - name, gpe_number)); - return_ACPI_STATUS (status); + ACPI_DEBUG_PRINT((ACPI_DB_LOAD, + "Registered GPE method %s as GPE number 0x%.2X\n", + name, gpe_number)); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_ev_match_prw_and_gpe @@ -372,34 +351,29 @@ acpi_ev_save_method_info ( ******************************************************************************/ static acpi_status -acpi_ev_match_prw_and_gpe ( - acpi_handle obj_handle, - u32 level, - void *info, - void **return_value) +acpi_ev_match_prw_and_gpe(acpi_handle obj_handle, + u32 level, void *info, void **return_value) { - struct acpi_gpe_walk_info *gpe_info = (void *) info; - struct acpi_namespace_node *gpe_device; - struct acpi_gpe_block_info *gpe_block; - struct acpi_namespace_node *target_gpe_device; - struct acpi_gpe_event_info *gpe_event_info; - union acpi_operand_object *pkg_desc; - union acpi_operand_object *obj_desc; - u32 gpe_number; - acpi_status status; - - - ACPI_FUNCTION_TRACE ("ev_match_prw_and_gpe"); - + struct acpi_gpe_walk_info *gpe_info = (void *)info; + struct acpi_namespace_node *gpe_device; + struct acpi_gpe_block_info *gpe_block; + struct acpi_namespace_node *target_gpe_device; + struct acpi_gpe_event_info *gpe_event_info; + union acpi_operand_object *pkg_desc; + union acpi_operand_object *obj_desc; + u32 gpe_number; + acpi_status status; + + ACPI_FUNCTION_TRACE("ev_match_prw_and_gpe"); /* Check for a _PRW method under this device */ - status = acpi_ut_evaluate_object (obj_handle, METHOD_NAME__PRW, - ACPI_BTYPE_PACKAGE, &pkg_desc); - if (ACPI_FAILURE (status)) { + status = acpi_ut_evaluate_object(obj_handle, METHOD_NAME__PRW, + ACPI_BTYPE_PACKAGE, &pkg_desc); + if (ACPI_FAILURE(status)) { /* Ignore all errors from _PRW, we don't want to abort the subsystem */ - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } /* The returned _PRW package must have at least two elements */ @@ -419,7 +393,7 @@ acpi_ev_match_prw_and_gpe ( */ obj_desc = pkg_desc->package.elements[0]; - if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_INTEGER) { + if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) { /* Use FADT-defined GPE device (from definition of _PRW) */ target_gpe_device = acpi_gbl_fadt_gpe_device; @@ -427,22 +401,23 @@ acpi_ev_match_prw_and_gpe ( /* Integer is the GPE number in the FADT described GPE blocks */ gpe_number = (u32) obj_desc->integer.value; - } - else if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_PACKAGE) { + } else if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_PACKAGE) { /* Package contains a GPE reference and GPE number within a GPE block */ if ((obj_desc->package.count < 2) || - (ACPI_GET_OBJECT_TYPE (obj_desc->package.elements[0]) != ACPI_TYPE_LOCAL_REFERENCE) || - (ACPI_GET_OBJECT_TYPE (obj_desc->package.elements[1]) != ACPI_TYPE_INTEGER)) { + (ACPI_GET_OBJECT_TYPE(obj_desc->package.elements[0]) != + ACPI_TYPE_LOCAL_REFERENCE) + || (ACPI_GET_OBJECT_TYPE(obj_desc->package.elements[1]) != + ACPI_TYPE_INTEGER)) { goto cleanup; } /* Get GPE block reference and decode */ - target_gpe_device = obj_desc->package.elements[0]->reference.node; + target_gpe_device = + obj_desc->package.elements[0]->reference.node; gpe_number = (u32) obj_desc->package.elements[1]->integer.value; - } - else { + } else { /* Unknown type, just ignore it */ goto cleanup; @@ -457,26 +432,32 @@ acpi_ev_match_prw_and_gpe ( * associated with the GPE device. */ if ((gpe_device == target_gpe_device) && - (gpe_number >= gpe_block->block_base_number) && - (gpe_number < gpe_block->block_base_number + (gpe_block->register_count * 8))) { - gpe_event_info = &gpe_block->event_info[gpe_number - gpe_block->block_base_number]; + (gpe_number >= gpe_block->block_base_number) && + (gpe_number < + gpe_block->block_base_number + (gpe_block->register_count * 8))) { + gpe_event_info = + &gpe_block->event_info[gpe_number - + gpe_block->block_base_number]; /* Mark GPE for WAKE-ONLY but WAKE_DISABLED */ - gpe_event_info->flags &= ~(ACPI_GPE_WAKE_ENABLED | ACPI_GPE_RUN_ENABLED); - status = acpi_ev_set_gpe_type (gpe_event_info, ACPI_GPE_TYPE_WAKE); - if (ACPI_FAILURE (status)) { + gpe_event_info->flags &= + ~(ACPI_GPE_WAKE_ENABLED | ACPI_GPE_RUN_ENABLED); + status = + acpi_ev_set_gpe_type(gpe_event_info, ACPI_GPE_TYPE_WAKE); + if (ACPI_FAILURE(status)) { goto cleanup; } - status = acpi_ev_update_gpe_enable_masks (gpe_event_info, ACPI_GPE_DISABLE); + status = + acpi_ev_update_gpe_enable_masks(gpe_event_info, + ACPI_GPE_DISABLE); } -cleanup: - acpi_ut_remove_reference (pkg_desc); - return_ACPI_STATUS (AE_OK); + cleanup: + acpi_ut_remove_reference(pkg_desc); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_ev_get_gpe_xrupt_block @@ -492,25 +473,22 @@ cleanup: * ******************************************************************************/ -static struct acpi_gpe_xrupt_info * -acpi_ev_get_gpe_xrupt_block ( - u32 interrupt_number) +static struct acpi_gpe_xrupt_info *acpi_ev_get_gpe_xrupt_block(u32 + interrupt_number) { - struct acpi_gpe_xrupt_info *next_gpe_xrupt; - struct acpi_gpe_xrupt_info *gpe_xrupt; - acpi_status status; - u32 flags; - - - ACPI_FUNCTION_TRACE ("ev_get_gpe_xrupt_block"); + struct acpi_gpe_xrupt_info *next_gpe_xrupt; + struct acpi_gpe_xrupt_info *gpe_xrupt; + acpi_status status; + u32 flags; + ACPI_FUNCTION_TRACE("ev_get_gpe_xrupt_block"); /* No need for lock since we are not changing any list elements here */ next_gpe_xrupt = acpi_gbl_gpe_xrupt_list_head; while (next_gpe_xrupt) { if (next_gpe_xrupt->interrupt_number == interrupt_number) { - return_PTR (next_gpe_xrupt); + return_PTR(next_gpe_xrupt); } next_gpe_xrupt = next_gpe_xrupt->next; @@ -518,16 +496,16 @@ acpi_ev_get_gpe_xrupt_block ( /* Not found, must allocate a new xrupt descriptor */ - gpe_xrupt = ACPI_MEM_CALLOCATE (sizeof (struct acpi_gpe_xrupt_info)); + gpe_xrupt = ACPI_MEM_CALLOCATE(sizeof(struct acpi_gpe_xrupt_info)); if (!gpe_xrupt) { - return_PTR (NULL); + return_PTR(NULL); } gpe_xrupt->interrupt_number = interrupt_number; /* Install new interrupt descriptor with spin lock */ - flags = acpi_os_acquire_lock (acpi_gbl_gpe_lock); + flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock); if (acpi_gbl_gpe_xrupt_list_head) { next_gpe_xrupt = acpi_gbl_gpe_xrupt_list_head; while (next_gpe_xrupt->next) { @@ -536,29 +514,28 @@ acpi_ev_get_gpe_xrupt_block ( next_gpe_xrupt->next = gpe_xrupt; gpe_xrupt->previous = next_gpe_xrupt; - } - else { + } else { acpi_gbl_gpe_xrupt_list_head = gpe_xrupt; } - acpi_os_release_lock (acpi_gbl_gpe_lock, flags); + acpi_os_release_lock(acpi_gbl_gpe_lock, flags); /* Install new interrupt handler if not SCI_INT */ if (interrupt_number != acpi_gbl_FADT->sci_int) { - status = acpi_os_install_interrupt_handler (interrupt_number, - acpi_ev_gpe_xrupt_handler, gpe_xrupt); - if (ACPI_FAILURE (status)) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Could not install GPE interrupt handler at level 0x%X\n", - interrupt_number)); - return_PTR (NULL); + status = acpi_os_install_interrupt_handler(interrupt_number, + acpi_ev_gpe_xrupt_handler, + gpe_xrupt); + if (ACPI_FAILURE(status)) { + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Could not install GPE interrupt handler at level 0x%X\n", + interrupt_number)); + return_PTR(NULL); } } - return_PTR (gpe_xrupt); + return_PTR(gpe_xrupt); } - /******************************************************************************* * * FUNCTION: acpi_ev_delete_gpe_xrupt @@ -573,34 +550,31 @@ acpi_ev_get_gpe_xrupt_block ( ******************************************************************************/ static acpi_status -acpi_ev_delete_gpe_xrupt ( - struct acpi_gpe_xrupt_info *gpe_xrupt) +acpi_ev_delete_gpe_xrupt(struct acpi_gpe_xrupt_info *gpe_xrupt) { - acpi_status status; - u32 flags; - - - ACPI_FUNCTION_TRACE ("ev_delete_gpe_xrupt"); + acpi_status status; + u32 flags; + ACPI_FUNCTION_TRACE("ev_delete_gpe_xrupt"); /* We never want to remove the SCI interrupt handler */ if (gpe_xrupt->interrupt_number == acpi_gbl_FADT->sci_int) { gpe_xrupt->gpe_block_list_head = NULL; - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } /* Disable this interrupt */ - status = acpi_os_remove_interrupt_handler (gpe_xrupt->interrupt_number, - acpi_ev_gpe_xrupt_handler); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_os_remove_interrupt_handler(gpe_xrupt->interrupt_number, + acpi_ev_gpe_xrupt_handler); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* Unlink the interrupt block with lock */ - flags = acpi_os_acquire_lock (acpi_gbl_gpe_lock); + flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock); if (gpe_xrupt->previous) { gpe_xrupt->previous->next = gpe_xrupt->next; } @@ -608,15 +582,14 @@ acpi_ev_delete_gpe_xrupt ( if (gpe_xrupt->next) { gpe_xrupt->next->previous = gpe_xrupt->previous; } - acpi_os_release_lock (acpi_gbl_gpe_lock, flags); + acpi_os_release_lock(acpi_gbl_gpe_lock, flags); /* Free the block */ - ACPI_MEM_FREE (gpe_xrupt); - return_ACPI_STATUS (AE_OK); + ACPI_MEM_FREE(gpe_xrupt); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_ev_install_gpe_block @@ -631,25 +604,22 @@ acpi_ev_delete_gpe_xrupt ( ******************************************************************************/ static acpi_status -acpi_ev_install_gpe_block ( - struct acpi_gpe_block_info *gpe_block, - u32 interrupt_number) +acpi_ev_install_gpe_block(struct acpi_gpe_block_info *gpe_block, + u32 interrupt_number) { - struct acpi_gpe_block_info *next_gpe_block; - struct acpi_gpe_xrupt_info *gpe_xrupt_block; - acpi_status status; - u32 flags; + struct acpi_gpe_block_info *next_gpe_block; + struct acpi_gpe_xrupt_info *gpe_xrupt_block; + acpi_status status; + u32 flags; + ACPI_FUNCTION_TRACE("ev_install_gpe_block"); - ACPI_FUNCTION_TRACE ("ev_install_gpe_block"); - - - status = acpi_ut_acquire_mutex (ACPI_MTX_EVENTS); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } - gpe_xrupt_block = acpi_ev_get_gpe_xrupt_block (interrupt_number); + gpe_xrupt_block = acpi_ev_get_gpe_xrupt_block(interrupt_number); if (!gpe_xrupt_block) { status = AE_NO_MEMORY; goto unlock_and_exit; @@ -657,7 +627,7 @@ acpi_ev_install_gpe_block ( /* Install the new block at the end of the list with lock */ - flags = acpi_os_acquire_lock (acpi_gbl_gpe_lock); + flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock); if (gpe_xrupt_block->gpe_block_list_head) { next_gpe_block = gpe_xrupt_block->gpe_block_list_head; while (next_gpe_block->next) { @@ -666,20 +636,18 @@ acpi_ev_install_gpe_block ( next_gpe_block->next = gpe_block; gpe_block->previous = next_gpe_block; - } - else { + } else { gpe_xrupt_block->gpe_block_list_head = gpe_block; } gpe_block->xrupt_block = gpe_xrupt_block; - acpi_os_release_lock (acpi_gbl_gpe_lock, flags); + acpi_os_release_lock(acpi_gbl_gpe_lock, flags); -unlock_and_exit: - status = acpi_ut_release_mutex (ACPI_MTX_EVENTS); - return_ACPI_STATUS (status); + unlock_and_exit: + status = acpi_ut_release_mutex(ACPI_MTX_EVENTS); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_ev_delete_gpe_block @@ -692,63 +660,57 @@ unlock_and_exit: * ******************************************************************************/ -acpi_status -acpi_ev_delete_gpe_block ( - struct acpi_gpe_block_info *gpe_block) +acpi_status acpi_ev_delete_gpe_block(struct acpi_gpe_block_info *gpe_block) { - acpi_status status; - u32 flags; - - - ACPI_FUNCTION_TRACE ("ev_install_gpe_block"); + acpi_status status; + u32 flags; + ACPI_FUNCTION_TRACE("ev_install_gpe_block"); - status = acpi_ut_acquire_mutex (ACPI_MTX_EVENTS); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* Disable all GPEs in this block */ - status = acpi_hw_disable_gpe_block (gpe_block->xrupt_block, gpe_block); + status = acpi_hw_disable_gpe_block(gpe_block->xrupt_block, gpe_block); if (!gpe_block->previous && !gpe_block->next) { /* This is the last gpe_block on this interrupt */ - status = acpi_ev_delete_gpe_xrupt (gpe_block->xrupt_block); - if (ACPI_FAILURE (status)) { + status = acpi_ev_delete_gpe_xrupt(gpe_block->xrupt_block); + if (ACPI_FAILURE(status)) { goto unlock_and_exit; } - } - else { + } else { /* Remove the block on this interrupt with lock */ - flags = acpi_os_acquire_lock (acpi_gbl_gpe_lock); + flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock); if (gpe_block->previous) { gpe_block->previous->next = gpe_block->next; - } - else { - gpe_block->xrupt_block->gpe_block_list_head = gpe_block->next; + } else { + gpe_block->xrupt_block->gpe_block_list_head = + gpe_block->next; } if (gpe_block->next) { gpe_block->next->previous = gpe_block->previous; } - acpi_os_release_lock (acpi_gbl_gpe_lock, flags); + acpi_os_release_lock(acpi_gbl_gpe_lock, flags); } /* Free the gpe_block */ - ACPI_MEM_FREE (gpe_block->register_info); - ACPI_MEM_FREE (gpe_block->event_info); - ACPI_MEM_FREE (gpe_block); + ACPI_MEM_FREE(gpe_block->register_info); + ACPI_MEM_FREE(gpe_block->event_info); + ACPI_MEM_FREE(gpe_block); -unlock_and_exit: - status = acpi_ut_release_mutex (ACPI_MTX_EVENTS); - return_ACPI_STATUS (status); + unlock_and_exit: + status = acpi_ut_release_mutex(ACPI_MTX_EVENTS); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_ev_create_gpe_info_blocks @@ -762,43 +724,41 @@ unlock_and_exit: ******************************************************************************/ static acpi_status -acpi_ev_create_gpe_info_blocks ( - struct acpi_gpe_block_info *gpe_block) +acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block) { - struct acpi_gpe_register_info *gpe_register_info = NULL; - struct acpi_gpe_event_info *gpe_event_info = NULL; - struct acpi_gpe_event_info *this_event; - struct acpi_gpe_register_info *this_register; - acpi_native_uint i; - acpi_native_uint j; - acpi_status status; - - - ACPI_FUNCTION_TRACE ("ev_create_gpe_info_blocks"); + struct acpi_gpe_register_info *gpe_register_info = NULL; + struct acpi_gpe_event_info *gpe_event_info = NULL; + struct acpi_gpe_event_info *this_event; + struct acpi_gpe_register_info *this_register; + acpi_native_uint i; + acpi_native_uint j; + acpi_status status; + ACPI_FUNCTION_TRACE("ev_create_gpe_info_blocks"); /* Allocate the GPE register information block */ - gpe_register_info = ACPI_MEM_CALLOCATE ( - (acpi_size) gpe_block->register_count * - sizeof (struct acpi_gpe_register_info)); + gpe_register_info = ACPI_MEM_CALLOCATE((acpi_size) gpe_block-> + register_count * + sizeof(struct + acpi_gpe_register_info)); if (!gpe_register_info) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Could not allocate the gpe_register_info table\n")); - return_ACPI_STATUS (AE_NO_MEMORY); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Could not allocate the gpe_register_info table\n")); + return_ACPI_STATUS(AE_NO_MEMORY); } /* * Allocate the GPE event_info block. There are eight distinct GPEs * per register. Initialization to zeros is sufficient. */ - gpe_event_info = ACPI_MEM_CALLOCATE ( - ((acpi_size) gpe_block->register_count * - ACPI_GPE_REGISTER_WIDTH) * - sizeof (struct acpi_gpe_event_info)); + gpe_event_info = ACPI_MEM_CALLOCATE(((acpi_size) gpe_block-> + register_count * + ACPI_GPE_REGISTER_WIDTH) * + sizeof(struct acpi_gpe_event_info)); if (!gpe_event_info) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Could not allocate the gpe_event_info table\n")); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Could not allocate the gpe_event_info table\n")); status = AE_NO_MEMORY; goto error_exit; } @@ -806,7 +766,7 @@ acpi_ev_create_gpe_info_blocks ( /* Save the new Info arrays in the GPE block */ gpe_block->register_info = gpe_register_info; - gpe_block->event_info = gpe_event_info; + gpe_block->event_info = gpe_event_info; /* * Initialize the GPE Register and Event structures. A goal of these @@ -815,29 +775,34 @@ acpi_ev_create_gpe_info_blocks ( * and the enable registers occupy the second half. */ this_register = gpe_register_info; - this_event = gpe_event_info; + this_event = gpe_event_info; for (i = 0; i < gpe_block->register_count; i++) { /* Init the register_info for this GPE register (8 GPEs) */ - this_register->base_gpe_number = (u8) (gpe_block->block_base_number + - (i * ACPI_GPE_REGISTER_WIDTH)); - - ACPI_STORE_ADDRESS (this_register->status_address.address, - (gpe_block->block_address.address - + i)); - - ACPI_STORE_ADDRESS (this_register->enable_address.address, - (gpe_block->block_address.address - + i - + gpe_block->register_count)); - - this_register->status_address.address_space_id = gpe_block->block_address.address_space_id; - this_register->enable_address.address_space_id = gpe_block->block_address.address_space_id; - this_register->status_address.register_bit_width = ACPI_GPE_REGISTER_WIDTH; - this_register->enable_address.register_bit_width = ACPI_GPE_REGISTER_WIDTH; - this_register->status_address.register_bit_offset = ACPI_GPE_REGISTER_WIDTH; - this_register->enable_address.register_bit_offset = ACPI_GPE_REGISTER_WIDTH; + this_register->base_gpe_number = + (u8) (gpe_block->block_base_number + + (i * ACPI_GPE_REGISTER_WIDTH)); + + ACPI_STORE_ADDRESS(this_register->status_address.address, + (gpe_block->block_address.address + i)); + + ACPI_STORE_ADDRESS(this_register->enable_address.address, + (gpe_block->block_address.address + + i + gpe_block->register_count)); + + this_register->status_address.address_space_id = + gpe_block->block_address.address_space_id; + this_register->enable_address.address_space_id = + gpe_block->block_address.address_space_id; + this_register->status_address.register_bit_width = + ACPI_GPE_REGISTER_WIDTH; + this_register->enable_address.register_bit_width = + ACPI_GPE_REGISTER_WIDTH; + this_register->status_address.register_bit_offset = + ACPI_GPE_REGISTER_WIDTH; + this_register->enable_address.register_bit_offset = + ACPI_GPE_REGISTER_WIDTH; /* Init the event_info for each GPE within this register */ @@ -852,36 +817,36 @@ acpi_ev_create_gpe_info_blocks ( * are cleared by writing a '1', while enable registers are cleared * by writing a '0'. */ - status = acpi_hw_low_level_write (ACPI_GPE_REGISTER_WIDTH, 0x00, - &this_register->enable_address); - if (ACPI_FAILURE (status)) { + status = acpi_hw_low_level_write(ACPI_GPE_REGISTER_WIDTH, 0x00, + &this_register-> + enable_address); + if (ACPI_FAILURE(status)) { goto error_exit; } - status = acpi_hw_low_level_write (ACPI_GPE_REGISTER_WIDTH, 0xFF, - &this_register->status_address); - if (ACPI_FAILURE (status)) { + status = acpi_hw_low_level_write(ACPI_GPE_REGISTER_WIDTH, 0xFF, + &this_register-> + status_address); + if (ACPI_FAILURE(status)) { goto error_exit; } this_register++; } - return_ACPI_STATUS (AE_OK); - + return_ACPI_STATUS(AE_OK); -error_exit: + error_exit: if (gpe_register_info) { - ACPI_MEM_FREE (gpe_register_info); + ACPI_MEM_FREE(gpe_register_info); } if (gpe_event_info) { - ACPI_MEM_FREE (gpe_event_info); + ACPI_MEM_FREE(gpe_event_info); } - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_ev_create_gpe_block @@ -900,68 +865,66 @@ error_exit: ******************************************************************************/ acpi_status -acpi_ev_create_gpe_block ( - struct acpi_namespace_node *gpe_device, - struct acpi_generic_address *gpe_block_address, - u32 register_count, - u8 gpe_block_base_number, - u32 interrupt_number, - struct acpi_gpe_block_info **return_gpe_block) +acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device, + struct acpi_generic_address *gpe_block_address, + u32 register_count, + u8 gpe_block_base_number, + u32 interrupt_number, + struct acpi_gpe_block_info **return_gpe_block) { - struct acpi_gpe_block_info *gpe_block; - struct acpi_gpe_event_info *gpe_event_info; - acpi_native_uint i; - acpi_native_uint j; - u32 wake_gpe_count; - u32 gpe_enabled_count; - acpi_status status; - struct acpi_gpe_walk_info gpe_info; - - - ACPI_FUNCTION_TRACE ("ev_create_gpe_block"); + struct acpi_gpe_block_info *gpe_block; + struct acpi_gpe_event_info *gpe_event_info; + acpi_native_uint i; + acpi_native_uint j; + u32 wake_gpe_count; + u32 gpe_enabled_count; + acpi_status status; + struct acpi_gpe_walk_info gpe_info; + ACPI_FUNCTION_TRACE("ev_create_gpe_block"); if (!register_count) { - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } /* Allocate a new GPE block */ - gpe_block = ACPI_MEM_CALLOCATE (sizeof (struct acpi_gpe_block_info)); + gpe_block = ACPI_MEM_CALLOCATE(sizeof(struct acpi_gpe_block_info)); if (!gpe_block) { - return_ACPI_STATUS (AE_NO_MEMORY); + return_ACPI_STATUS(AE_NO_MEMORY); } /* Initialize the new GPE block */ gpe_block->register_count = register_count; gpe_block->block_base_number = gpe_block_base_number; - gpe_block->node = gpe_device; + gpe_block->node = gpe_device; - ACPI_MEMCPY (&gpe_block->block_address, gpe_block_address, - sizeof (struct acpi_generic_address)); + ACPI_MEMCPY(&gpe_block->block_address, gpe_block_address, + sizeof(struct acpi_generic_address)); /* Create the register_info and event_info sub-structures */ - status = acpi_ev_create_gpe_info_blocks (gpe_block); - if (ACPI_FAILURE (status)) { - ACPI_MEM_FREE (gpe_block); - return_ACPI_STATUS (status); + status = acpi_ev_create_gpe_info_blocks(gpe_block); + if (ACPI_FAILURE(status)) { + ACPI_MEM_FREE(gpe_block); + return_ACPI_STATUS(status); } /* Install the new block in the global list(s) */ - status = acpi_ev_install_gpe_block (gpe_block, interrupt_number); - if (ACPI_FAILURE (status)) { - ACPI_MEM_FREE (gpe_block); - return_ACPI_STATUS (status); + status = acpi_ev_install_gpe_block(gpe_block, interrupt_number); + if (ACPI_FAILURE(status)) { + ACPI_MEM_FREE(gpe_block); + return_ACPI_STATUS(status); } /* Find all GPE methods (_Lxx, _Exx) for this block */ - status = acpi_ns_walk_namespace (ACPI_TYPE_METHOD, gpe_device, - ACPI_UINT32_MAX, ACPI_NS_WALK_NO_UNLOCK, acpi_ev_save_method_info, - gpe_block, NULL); + status = acpi_ns_walk_namespace(ACPI_TYPE_METHOD, gpe_device, + ACPI_UINT32_MAX, ACPI_NS_WALK_NO_UNLOCK, + acpi_ev_save_method_info, gpe_block, + NULL); /* * Runtime option: Should Wake GPEs be enabled at runtime? The default @@ -977,9 +940,11 @@ acpi_ev_create_gpe_block ( gpe_info.gpe_block = gpe_block; gpe_info.gpe_device = gpe_device; - status = acpi_ns_walk_namespace (ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, ACPI_NS_WALK_UNLOCK, acpi_ev_match_prw_and_gpe, - &gpe_info, NULL); + status = + acpi_ns_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, + ACPI_UINT32_MAX, ACPI_NS_WALK_UNLOCK, + acpi_ev_match_prw_and_gpe, &gpe_info, + NULL); } /* @@ -994,10 +959,14 @@ acpi_ev_create_gpe_block ( for (j = 0; j < 8; j++) { /* Get the info block for this particular GPE */ - gpe_event_info = &gpe_block->event_info[(i * ACPI_GPE_REGISTER_WIDTH) + j]; + gpe_event_info = + &gpe_block-> + event_info[(i * ACPI_GPE_REGISTER_WIDTH) + j]; - if (((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) == ACPI_GPE_DISPATCH_METHOD) && - (gpe_event_info->flags & ACPI_GPE_TYPE_RUNTIME)) { + if (((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) == + ACPI_GPE_DISPATCH_METHOD) + && (gpe_event_info-> + flags & ACPI_GPE_TYPE_RUNTIME)) { gpe_enabled_count++; } @@ -1009,22 +978,22 @@ acpi_ev_create_gpe_block ( /* Dump info about this GPE block */ - ACPI_DEBUG_PRINT ((ACPI_DB_INIT, - "GPE %02X to %02X [%4.4s] %u regs on int 0x%X\n", - (u32) gpe_block->block_base_number, - (u32) (gpe_block->block_base_number + - ((gpe_block->register_count * ACPI_GPE_REGISTER_WIDTH) -1)), - gpe_device->name.ascii, - gpe_block->register_count, - interrupt_number)); + ACPI_DEBUG_PRINT((ACPI_DB_INIT, + "GPE %02X to %02X [%4.4s] %u regs on int 0x%X\n", + (u32) gpe_block->block_base_number, + (u32) (gpe_block->block_base_number + + ((gpe_block->register_count * + ACPI_GPE_REGISTER_WIDTH) - 1)), + gpe_device->name.ascii, gpe_block->register_count, + interrupt_number)); /* Enable all valid GPEs found above */ - status = acpi_hw_enable_runtime_gpe_block (NULL, gpe_block); + status = acpi_hw_enable_runtime_gpe_block(NULL, gpe_block); - ACPI_DEBUG_PRINT ((ACPI_DB_INIT, - "Found %u Wake, Enabled %u Runtime GPEs in this block\n", - wake_gpe_count, gpe_enabled_count)); + ACPI_DEBUG_PRINT((ACPI_DB_INIT, + "Found %u Wake, Enabled %u Runtime GPEs in this block\n", + wake_gpe_count, gpe_enabled_count)); /* Return the new block */ @@ -1032,10 +1001,9 @@ acpi_ev_create_gpe_block ( (*return_gpe_block) = gpe_block; } - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_ev_gpe_initialize @@ -1048,22 +1016,18 @@ acpi_ev_create_gpe_block ( * ******************************************************************************/ -acpi_status -acpi_ev_gpe_initialize ( - void) +acpi_status acpi_ev_gpe_initialize(void) { - u32 register_count0 = 0; - u32 register_count1 = 0; - u32 gpe_number_max = 0; - acpi_status status; + u32 register_count0 = 0; + u32 register_count1 = 0; + u32 gpe_number_max = 0; + acpi_status status; + ACPI_FUNCTION_TRACE("ev_gpe_initialize"); - ACPI_FUNCTION_TRACE ("ev_gpe_initialize"); - - - status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* @@ -1091,29 +1055,29 @@ acpi_ev_gpe_initialize ( * If EITHER the register length OR the block address are zero, then that * particular block is not supported. */ - if (acpi_gbl_FADT->gpe0_blk_len && - acpi_gbl_FADT->xgpe0_blk.address) { + if (acpi_gbl_FADT->gpe0_blk_len && acpi_gbl_FADT->xgpe0_blk.address) { /* GPE block 0 exists (has both length and address > 0) */ register_count0 = (u16) (acpi_gbl_FADT->gpe0_blk_len / 2); - gpe_number_max = (register_count0 * ACPI_GPE_REGISTER_WIDTH) - 1; + gpe_number_max = + (register_count0 * ACPI_GPE_REGISTER_WIDTH) - 1; /* Install GPE Block 0 */ - status = acpi_ev_create_gpe_block (acpi_gbl_fadt_gpe_device, - &acpi_gbl_FADT->xgpe0_blk, register_count0, 0, - acpi_gbl_FADT->sci_int, &acpi_gbl_gpe_fadt_blocks[0]); + status = acpi_ev_create_gpe_block(acpi_gbl_fadt_gpe_device, + &acpi_gbl_FADT->xgpe0_blk, + register_count0, 0, + acpi_gbl_FADT->sci_int, + &acpi_gbl_gpe_fadt_blocks[0]); - if (ACPI_FAILURE (status)) { - ACPI_REPORT_ERROR (( - "Could not create GPE Block 0, %s\n", - acpi_format_exception (status))); + if (ACPI_FAILURE(status)) { + ACPI_REPORT_ERROR(("Could not create GPE Block 0, %s\n", + acpi_format_exception(status))); } } - if (acpi_gbl_FADT->gpe1_blk_len && - acpi_gbl_FADT->xgpe1_blk.address) { + if (acpi_gbl_FADT->gpe1_blk_len && acpi_gbl_FADT->xgpe1_blk.address) { /* GPE block 1 exists (has both length and address > 0) */ register_count1 = (u16) (acpi_gbl_FADT->gpe1_blk_len / 2); @@ -1121,29 +1085,26 @@ acpi_ev_gpe_initialize ( /* Check for GPE0/GPE1 overlap (if both banks exist) */ if ((register_count0) && - (gpe_number_max >= acpi_gbl_FADT->gpe1_base)) { - ACPI_REPORT_ERROR (( - "GPE0 block (GPE 0 to %d) overlaps the GPE1 block (GPE %d to %d) - Ignoring GPE1\n", - gpe_number_max, acpi_gbl_FADT->gpe1_base, - acpi_gbl_FADT->gpe1_base + - ((register_count1 * ACPI_GPE_REGISTER_WIDTH) - 1))); + (gpe_number_max >= acpi_gbl_FADT->gpe1_base)) { + ACPI_REPORT_ERROR(("GPE0 block (GPE 0 to %d) overlaps the GPE1 block (GPE %d to %d) - Ignoring GPE1\n", gpe_number_max, acpi_gbl_FADT->gpe1_base, acpi_gbl_FADT->gpe1_base + ((register_count1 * ACPI_GPE_REGISTER_WIDTH) - 1))); /* Ignore GPE1 block by setting the register count to zero */ register_count1 = 0; - } - else { + } else { /* Install GPE Block 1 */ - status = acpi_ev_create_gpe_block (acpi_gbl_fadt_gpe_device, - &acpi_gbl_FADT->xgpe1_blk, register_count1, - acpi_gbl_FADT->gpe1_base, - acpi_gbl_FADT->sci_int, &acpi_gbl_gpe_fadt_blocks[1]); - - if (ACPI_FAILURE (status)) { - ACPI_REPORT_ERROR (( - "Could not create GPE Block 1, %s\n", - acpi_format_exception (status))); + status = + acpi_ev_create_gpe_block(acpi_gbl_fadt_gpe_device, + &acpi_gbl_FADT->xgpe1_blk, + register_count1, + acpi_gbl_FADT->gpe1_base, + acpi_gbl_FADT->sci_int, + &acpi_gbl_gpe_fadt_blocks + [1]); + + if (ACPI_FAILURE(status)) { + ACPI_REPORT_ERROR(("Could not create GPE Block 1, %s\n", acpi_format_exception(status))); } /* @@ -1151,7 +1112,7 @@ acpi_ev_gpe_initialize ( * space. However, GPE0 always starts at GPE number zero. */ gpe_number_max = acpi_gbl_FADT->gpe1_base + - ((register_count1 * ACPI_GPE_REGISTER_WIDTH) - 1); + ((register_count1 * ACPI_GPE_REGISTER_WIDTH) - 1); } } @@ -1160,8 +1121,8 @@ acpi_ev_gpe_initialize ( if ((register_count0 + register_count1) == 0) { /* GPEs are not required by ACPI, this is OK */ - ACPI_DEBUG_PRINT ((ACPI_DB_INIT, - "There are no GPE blocks defined in the FADT\n")); + ACPI_DEBUG_PRINT((ACPI_DB_INIT, + "There are no GPE blocks defined in the FADT\n")); status = AE_OK; goto cleanup; } @@ -1169,15 +1130,12 @@ acpi_ev_gpe_initialize ( /* Check for Max GPE number out-of-range */ if (gpe_number_max > ACPI_GPE_MAX) { - ACPI_REPORT_ERROR (("Maximum GPE number from FADT is too large: 0x%X\n", - gpe_number_max)); + ACPI_REPORT_ERROR(("Maximum GPE number from FADT is too large: 0x%X\n", gpe_number_max)); status = AE_BAD_VALUE; goto cleanup; } -cleanup: - (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); - return_ACPI_STATUS (AE_OK); + cleanup: + (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); + return_ACPI_STATUS(AE_OK); } - - diff --git a/drivers/acpi/events/evmisc.c b/drivers/acpi/events/evmisc.c index 3df3ada4b9e..7e57b8470f5 100644 --- a/drivers/acpi/events/evmisc.c +++ b/drivers/acpi/events/evmisc.c @@ -47,12 +47,10 @@ #include #define _COMPONENT ACPI_EVENTS - ACPI_MODULE_NAME ("evmisc") - +ACPI_MODULE_NAME("evmisc") #ifdef ACPI_DEBUG_OUTPUT -static const char *acpi_notify_value_names[] = -{ +static const char *acpi_notify_value_names[] = { "Bus Check", "Device Check", "Device Wake", @@ -66,18 +64,11 @@ static const char *acpi_notify_value_names[] = /* Local prototypes */ -static void ACPI_SYSTEM_XFACE -acpi_ev_notify_dispatch ( - void *context); - -static void ACPI_SYSTEM_XFACE -acpi_ev_global_lock_thread ( - void *context); +static void ACPI_SYSTEM_XFACE acpi_ev_notify_dispatch(void *context); -static u32 -acpi_ev_global_lock_handler ( - void *context); +static void ACPI_SYSTEM_XFACE acpi_ev_global_lock_thread(void *context); +static u32 acpi_ev_global_lock_handler(void *context); /******************************************************************************* * @@ -93,9 +84,7 @@ acpi_ev_global_lock_handler ( * ******************************************************************************/ -u8 -acpi_ev_is_notify_object ( - struct acpi_namespace_node *node) +u8 acpi_ev_is_notify_object(struct acpi_namespace_node *node) { switch (node->type) { case ACPI_TYPE_DEVICE: @@ -112,7 +101,6 @@ acpi_ev_is_notify_object ( } } - /******************************************************************************* * * FUNCTION: acpi_ev_queue_notify_request @@ -128,18 +116,15 @@ acpi_ev_is_notify_object ( ******************************************************************************/ acpi_status -acpi_ev_queue_notify_request ( - struct acpi_namespace_node *node, - u32 notify_value) +acpi_ev_queue_notify_request(struct acpi_namespace_node * node, + u32 notify_value) { - union acpi_operand_object *obj_desc; - union acpi_operand_object *handler_obj = NULL; - union acpi_generic_state *notify_info; - acpi_status status = AE_OK; - - - ACPI_FUNCTION_NAME ("ev_queue_notify_request"); + union acpi_operand_object *obj_desc; + union acpi_operand_object *handler_obj = NULL; + union acpi_generic_state *notify_info; + acpi_status status = AE_OK; + ACPI_FUNCTION_NAME("ev_queue_notify_request"); /* * For value 3 (Ejection Request), some device method may need to be run. @@ -148,22 +133,22 @@ acpi_ev_queue_notify_request ( * For value 0x80 (Status Change) on the power button or sleep button, * initiate soft-off or sleep operation? */ - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "Dispatching Notify(%X) on node %p\n", notify_value, node)); + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "Dispatching Notify(%X) on node %p\n", notify_value, + node)); if (notify_value <= 7) { - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Notify value: %s\n", - acpi_notify_value_names[notify_value])); - } - else { - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "Notify value: 0x%2.2X **Device Specific**\n", - notify_value)); + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Notify value: %s\n", + acpi_notify_value_names[notify_value])); + } else { + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "Notify value: 0x%2.2X **Device Specific**\n", + notify_value)); } /* Get the notify object attached to the NS Node */ - obj_desc = acpi_ns_get_attached_object (node); + obj_desc = acpi_ns_get_attached_object(node); if (obj_desc) { /* We have the notify object, Get the right handler */ @@ -174,10 +159,11 @@ acpi_ev_queue_notify_request ( case ACPI_TYPE_POWER: if (notify_value <= ACPI_MAX_SYS_NOTIFY) { - handler_obj = obj_desc->common_notify.system_notify; - } - else { - handler_obj = obj_desc->common_notify.device_notify; + handler_obj = + obj_desc->common_notify.system_notify; + } else { + handler_obj = + obj_desc->common_notify.device_notify; } break; @@ -189,23 +175,25 @@ acpi_ev_queue_notify_request ( /* If there is any handler to run, schedule the dispatcher */ - if ((acpi_gbl_system_notify.handler && (notify_value <= ACPI_MAX_SYS_NOTIFY)) || - (acpi_gbl_device_notify.handler && (notify_value > ACPI_MAX_SYS_NOTIFY)) || - handler_obj) { - notify_info = acpi_ut_create_generic_state (); + if ((acpi_gbl_system_notify.handler + && (notify_value <= ACPI_MAX_SYS_NOTIFY)) + || (acpi_gbl_device_notify.handler + && (notify_value > ACPI_MAX_SYS_NOTIFY)) || handler_obj) { + notify_info = acpi_ut_create_generic_state(); if (!notify_info) { return (AE_NO_MEMORY); } notify_info->common.data_type = ACPI_DESC_TYPE_STATE_NOTIFY; - notify_info->notify.node = node; - notify_info->notify.value = (u16) notify_value; + notify_info->notify.node = node; + notify_info->notify.value = (u16) notify_value; notify_info->notify.handler_obj = handler_obj; - status = acpi_os_queue_for_execution (OSD_PRIORITY_HIGH, - acpi_ev_notify_dispatch, notify_info); - if (ACPI_FAILURE (status)) { - acpi_ut_delete_generic_state (notify_info); + status = acpi_os_queue_for_execution(OSD_PRIORITY_HIGH, + acpi_ev_notify_dispatch, + notify_info); + if (ACPI_FAILURE(status)) { + acpi_ut_delete_generic_state(notify_info); } } @@ -214,15 +202,15 @@ acpi_ev_queue_notify_request ( * There is no per-device notify handler for this device. * This may or may not be a problem. */ - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "No notify handler for Notify(%4.4s, %X) node %p\n", - acpi_ut_get_node_name (node), notify_value, node)); + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "No notify handler for Notify(%4.4s, %X) node %p\n", + acpi_ut_get_node_name(node), notify_value, + node)); } return (status); } - /******************************************************************************* * * FUNCTION: acpi_ev_notify_dispatch @@ -236,18 +224,15 @@ acpi_ev_queue_notify_request ( * ******************************************************************************/ -static void ACPI_SYSTEM_XFACE -acpi_ev_notify_dispatch ( - void *context) +static void ACPI_SYSTEM_XFACE acpi_ev_notify_dispatch(void *context) { - union acpi_generic_state *notify_info = (union acpi_generic_state *) context; - acpi_notify_handler global_handler = NULL; - void *global_context = NULL; - union acpi_operand_object *handler_obj; - - - ACPI_FUNCTION_ENTRY (); + union acpi_generic_state *notify_info = + (union acpi_generic_state *)context; + acpi_notify_handler global_handler = NULL; + void *global_context = NULL; + union acpi_operand_object *handler_obj; + ACPI_FUNCTION_ENTRY(); /* * We will invoke a global notify handler if installed. @@ -261,8 +246,7 @@ acpi_ev_notify_dispatch ( global_handler = acpi_gbl_system_notify.handler; global_context = acpi_gbl_system_notify.context; } - } - else { + } else { /* Global driver notification handler */ if (acpi_gbl_device_notify.handler) { @@ -274,25 +258,24 @@ acpi_ev_notify_dispatch ( /* Invoke the system handler first, if present */ if (global_handler) { - global_handler (notify_info->notify.node, notify_info->notify.value, - global_context); + global_handler(notify_info->notify.node, + notify_info->notify.value, global_context); } /* Now invoke the per-device handler, if present */ handler_obj = notify_info->notify.handler_obj; if (handler_obj) { - handler_obj->notify.handler (notify_info->notify.node, - notify_info->notify.value, - handler_obj->notify.context); + handler_obj->notify.handler(notify_info->notify.node, + notify_info->notify.value, + handler_obj->notify.context); } /* All done with the info object */ - acpi_ut_delete_generic_state (notify_info); + acpi_ut_delete_generic_state(notify_info); } - /******************************************************************************* * * FUNCTION: acpi_ev_global_lock_thread @@ -307,27 +290,24 @@ acpi_ev_notify_dispatch ( * ******************************************************************************/ -static void ACPI_SYSTEM_XFACE -acpi_ev_global_lock_thread ( - void *context) +static void ACPI_SYSTEM_XFACE acpi_ev_global_lock_thread(void *context) { - acpi_status status; - + acpi_status status; /* Signal threads that are waiting for the lock */ if (acpi_gbl_global_lock_thread_count) { /* Send sufficient units to the semaphore */ - status = acpi_os_signal_semaphore (acpi_gbl_global_lock_semaphore, - acpi_gbl_global_lock_thread_count); - if (ACPI_FAILURE (status)) { - ACPI_REPORT_ERROR (("Could not signal Global Lock semaphore\n")); + status = + acpi_os_signal_semaphore(acpi_gbl_global_lock_semaphore, + acpi_gbl_global_lock_thread_count); + if (ACPI_FAILURE(status)) { + ACPI_REPORT_ERROR(("Could not signal Global Lock semaphore\n")); } } } - /******************************************************************************* * * FUNCTION: acpi_ev_global_lock_handler @@ -342,20 +322,17 @@ acpi_ev_global_lock_thread ( * ******************************************************************************/ -static u32 -acpi_ev_global_lock_handler ( - void *context) +static u32 acpi_ev_global_lock_handler(void *context) { - u8 acquired = FALSE; - acpi_status status; - + u8 acquired = FALSE; + acpi_status status; /* * Attempt to get the lock * If we don't get it now, it will be marked pending and we will * take another interrupt when it becomes free. */ - ACPI_ACQUIRE_GLOBAL_LOCK (acpi_gbl_common_fACS.global_lock, acquired); + ACPI_ACQUIRE_GLOBAL_LOCK(acpi_gbl_common_fACS.global_lock, acquired); if (acquired) { /* Got the lock, now wake all threads waiting for it */ @@ -363,11 +340,11 @@ acpi_ev_global_lock_handler ( /* Run the Global Lock thread which will signal all waiting threads */ - status = acpi_os_queue_for_execution (OSD_PRIORITY_HIGH, - acpi_ev_global_lock_thread, context); - if (ACPI_FAILURE (status)) { - ACPI_REPORT_ERROR (("Could not queue Global Lock thread, %s\n", - acpi_format_exception (status))); + status = acpi_os_queue_for_execution(OSD_PRIORITY_HIGH, + acpi_ev_global_lock_thread, + context); + if (ACPI_FAILURE(status)) { + ACPI_REPORT_ERROR(("Could not queue Global Lock thread, %s\n", acpi_format_exception(status))); return (ACPI_INTERRUPT_NOT_HANDLED); } @@ -376,7 +353,6 @@ acpi_ev_global_lock_handler ( return (ACPI_INTERRUPT_HANDLED); } - /******************************************************************************* * * FUNCTION: acpi_ev_init_global_lock_handler @@ -389,19 +365,16 @@ acpi_ev_global_lock_handler ( * ******************************************************************************/ -acpi_status -acpi_ev_init_global_lock_handler ( - void) +acpi_status acpi_ev_init_global_lock_handler(void) { - acpi_status status; - - - ACPI_FUNCTION_TRACE ("ev_init_global_lock_handler"); + acpi_status status; + ACPI_FUNCTION_TRACE("ev_init_global_lock_handler"); acpi_gbl_global_lock_present = TRUE; - status = acpi_install_fixed_event_handler (ACPI_EVENT_GLOBAL, - acpi_ev_global_lock_handler, NULL); + status = acpi_install_fixed_event_handler(ACPI_EVENT_GLOBAL, + acpi_ev_global_lock_handler, + NULL); /* * If the global lock does not exist on this platform, the attempt @@ -411,17 +384,15 @@ acpi_ev_init_global_lock_handler ( * with an error. */ if (status == AE_NO_HARDWARE_RESPONSE) { - ACPI_REPORT_ERROR (( - "No response from Global Lock hardware, disabling lock\n")); + ACPI_REPORT_ERROR(("No response from Global Lock hardware, disabling lock\n")); acpi_gbl_global_lock_present = FALSE; status = AE_OK; } - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - /****************************************************************************** * * FUNCTION: acpi_ev_acquire_global_lock @@ -434,22 +405,18 @@ acpi_ev_init_global_lock_handler ( * *****************************************************************************/ -acpi_status -acpi_ev_acquire_global_lock ( - u16 timeout) +acpi_status acpi_ev_acquire_global_lock(u16 timeout) { - acpi_status status = AE_OK; - u8 acquired = FALSE; - - - ACPI_FUNCTION_TRACE ("ev_acquire_global_lock"); + acpi_status status = AE_OK; + u8 acquired = FALSE; + ACPI_FUNCTION_TRACE("ev_acquire_global_lock"); #ifndef ACPI_APPLICATION /* Make sure that we actually have a global lock */ if (!acpi_gbl_global_lock_present) { - return_ACPI_STATUS (AE_NO_GLOBAL_LOCK); + return_ACPI_STATUS(AE_NO_GLOBAL_LOCK); } #endif @@ -462,37 +429,37 @@ acpi_ev_acquire_global_lock ( * we are done */ if (acpi_gbl_global_lock_acquired) { - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } /* We must acquire the actual hardware lock */ - ACPI_ACQUIRE_GLOBAL_LOCK (acpi_gbl_common_fACS.global_lock, acquired); + ACPI_ACQUIRE_GLOBAL_LOCK(acpi_gbl_common_fACS.global_lock, acquired); if (acquired) { - /* We got the lock */ + /* We got the lock */ - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Acquired the HW Global Lock\n")); + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, + "Acquired the HW Global Lock\n")); acpi_gbl_global_lock_acquired = TRUE; - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } /* * Did not get the lock. The pending bit was set above, and we must now * wait until we get the global lock released interrupt. */ - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Waiting for the HW Global Lock\n")); + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Waiting for the HW Global Lock\n")); /* * Acquire the global lock semaphore first. * Since this wait will block, we must release the interpreter */ - status = acpi_ex_system_wait_semaphore (acpi_gbl_global_lock_semaphore, - timeout); - return_ACPI_STATUS (status); + status = acpi_ex_system_wait_semaphore(acpi_gbl_global_lock_semaphore, + timeout); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_ev_release_global_lock @@ -505,21 +472,16 @@ acpi_ev_acquire_global_lock ( * ******************************************************************************/ -acpi_status -acpi_ev_release_global_lock ( - void) +acpi_status acpi_ev_release_global_lock(void) { - u8 pending = FALSE; - acpi_status status = AE_OK; - - - ACPI_FUNCTION_TRACE ("ev_release_global_lock"); + u8 pending = FALSE; + acpi_status status = AE_OK; + ACPI_FUNCTION_TRACE("ev_release_global_lock"); if (!acpi_gbl_global_lock_thread_count) { - ACPI_REPORT_WARNING(( - "Cannot release HW Global Lock, it has not been acquired\n")); - return_ACPI_STATUS (AE_NOT_ACQUIRED); + ACPI_REPORT_WARNING(("Cannot release HW Global Lock, it has not been acquired\n")); + return_ACPI_STATUS(AE_NOT_ACQUIRED); } /* One fewer thread has the global lock */ @@ -528,14 +490,14 @@ acpi_ev_release_global_lock ( if (acpi_gbl_global_lock_thread_count) { /* There are still some threads holding the lock, cannot release */ - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } /* * No more threads holding lock, we can do the actual hardware * release */ - ACPI_RELEASE_GLOBAL_LOCK (acpi_gbl_common_fACS.global_lock, pending); + ACPI_RELEASE_GLOBAL_LOCK(acpi_gbl_common_fACS.global_lock, pending); acpi_gbl_global_lock_acquired = FALSE; /* @@ -543,14 +505,13 @@ acpi_ev_release_global_lock ( * register */ if (pending) { - status = acpi_set_register (ACPI_BITREG_GLOBAL_LOCK_RELEASE, - 1, ACPI_MTX_LOCK); + status = acpi_set_register(ACPI_BITREG_GLOBAL_LOCK_RELEASE, + 1, ACPI_MTX_LOCK); } - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - /****************************************************************************** * * FUNCTION: acpi_ev_terminate @@ -563,16 +524,12 @@ acpi_ev_release_global_lock ( * ******************************************************************************/ -void -acpi_ev_terminate ( - void) +void acpi_ev_terminate(void) { - acpi_native_uint i; - acpi_status status; - - - ACPI_FUNCTION_TRACE ("ev_terminate"); + acpi_native_uint i; + acpi_status status; + ACPI_FUNCTION_TRACE("ev_terminate"); if (acpi_gbl_events_initialized) { /* @@ -583,38 +540,39 @@ acpi_ev_terminate ( /* Disable all fixed events */ for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) { - status = acpi_disable_event ((u32) i, 0); - if (ACPI_FAILURE (status)) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Could not disable fixed event %d\n", (u32) i)); + status = acpi_disable_event((u32) i, 0); + if (ACPI_FAILURE(status)) { + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Could not disable fixed event %d\n", + (u32) i)); } } /* Disable all GPEs in all GPE blocks */ - status = acpi_ev_walk_gpe_list (acpi_hw_disable_gpe_block); + status = acpi_ev_walk_gpe_list(acpi_hw_disable_gpe_block); /* Remove SCI handler */ - status = acpi_ev_remove_sci_handler (); + status = acpi_ev_remove_sci_handler(); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Could not remove SCI handler\n")); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Could not remove SCI handler\n")); } } /* Deallocate all handler objects installed within GPE info structs */ - status = acpi_ev_walk_gpe_list (acpi_ev_delete_gpe_handlers); + status = acpi_ev_walk_gpe_list(acpi_ev_delete_gpe_handlers); /* Return to original mode if necessary */ if (acpi_gbl_original_mode == ACPI_SYS_MODE_LEGACY) { - status = acpi_disable (); - if (ACPI_FAILURE (status)) { - ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "acpi_disable failed\n")); + status = acpi_disable(); + if (ACPI_FAILURE(status)) { + ACPI_DEBUG_PRINT((ACPI_DB_WARN, + "acpi_disable failed\n")); } } return_VOID; } - diff --git a/drivers/acpi/events/evregion.c b/drivers/acpi/events/evregion.c index a1d7276c574..84fad082d80 100644 --- a/drivers/acpi/events/evregion.c +++ b/drivers/acpi/events/evregion.c @@ -41,39 +41,30 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include #include #include #include #define _COMPONENT ACPI_EVENTS - ACPI_MODULE_NAME ("evregion") - +ACPI_MODULE_NAME("evregion") #define ACPI_NUM_DEFAULT_SPACES 4 - -static u8 acpi_gbl_default_address_spaces[ACPI_NUM_DEFAULT_SPACES] = { - ACPI_ADR_SPACE_SYSTEM_MEMORY, - ACPI_ADR_SPACE_SYSTEM_IO, - ACPI_ADR_SPACE_PCI_CONFIG, - ACPI_ADR_SPACE_DATA_TABLE}; +static u8 acpi_gbl_default_address_spaces[ACPI_NUM_DEFAULT_SPACES] = { + ACPI_ADR_SPACE_SYSTEM_MEMORY, + ACPI_ADR_SPACE_SYSTEM_IO, + ACPI_ADR_SPACE_PCI_CONFIG, + ACPI_ADR_SPACE_DATA_TABLE +}; /* Local prototypes */ static acpi_status -acpi_ev_reg_run ( - acpi_handle obj_handle, - u32 level, - void *context, - void **return_value); +acpi_ev_reg_run(acpi_handle obj_handle, + u32 level, void *context, void **return_value); static acpi_status -acpi_ev_install_handler ( - acpi_handle obj_handle, - u32 level, - void *context, - void **return_value); - +acpi_ev_install_handler(acpi_handle obj_handle, + u32 level, void *context, void **return_value); /******************************************************************************* * @@ -87,19 +78,16 @@ acpi_ev_install_handler ( * ******************************************************************************/ -acpi_status -acpi_ev_install_region_handlers ( - void) { - acpi_status status; - acpi_native_uint i; - - - ACPI_FUNCTION_TRACE ("ev_install_region_handlers"); +acpi_status acpi_ev_install_region_handlers(void) +{ + acpi_status status; + acpi_native_uint i; + ACPI_FUNCTION_TRACE("ev_install_region_handlers"); - status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* @@ -121,9 +109,11 @@ acpi_ev_install_region_handlers ( * Similar for AE_SAME_HANDLER. */ for (i = 0; i < ACPI_NUM_DEFAULT_SPACES; i++) { - status = acpi_ev_install_space_handler (acpi_gbl_root_node, - acpi_gbl_default_address_spaces[i], - ACPI_DEFAULT_HANDLER, NULL, NULL); + status = acpi_ev_install_space_handler(acpi_gbl_root_node, + acpi_gbl_default_address_spaces + [i], + ACPI_DEFAULT_HANDLER, + NULL, NULL); switch (status) { case AE_OK: case AE_SAME_HANDLER: @@ -140,12 +130,11 @@ acpi_ev_install_region_handlers ( } } -unlock_and_exit: - (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); - return_ACPI_STATUS (status); + unlock_and_exit: + (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_ev_initialize_op_regions @@ -159,20 +148,16 @@ unlock_and_exit: * ******************************************************************************/ -acpi_status -acpi_ev_initialize_op_regions ( - void) +acpi_status acpi_ev_initialize_op_regions(void) { - acpi_status status; - acpi_native_uint i; - + acpi_status status; + acpi_native_uint i; - ACPI_FUNCTION_TRACE ("ev_initialize_op_regions"); + ACPI_FUNCTION_TRACE("ev_initialize_op_regions"); - - status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* @@ -182,15 +167,15 @@ acpi_ev_initialize_op_regions ( /* TBD: Make sure handler is the DEFAULT handler, otherwise * _REG will have already been run. */ - status = acpi_ev_execute_reg_methods (acpi_gbl_root_node, - acpi_gbl_default_address_spaces[i]); + status = acpi_ev_execute_reg_methods(acpi_gbl_root_node, + acpi_gbl_default_address_spaces + [i]); } - (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); - return_ACPI_STATUS (status); + (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_ev_execute_reg_method @@ -205,26 +190,22 @@ acpi_ev_initialize_op_regions ( ******************************************************************************/ acpi_status -acpi_ev_execute_reg_method ( - union acpi_operand_object *region_obj, - u32 function) +acpi_ev_execute_reg_method(union acpi_operand_object *region_obj, u32 function) { - struct acpi_parameter_info info; - union acpi_operand_object *params[3]; - union acpi_operand_object *region_obj2; - acpi_status status; - + struct acpi_parameter_info info; + union acpi_operand_object *params[3]; + union acpi_operand_object *region_obj2; + acpi_status status; - ACPI_FUNCTION_TRACE ("ev_execute_reg_method"); + ACPI_FUNCTION_TRACE("ev_execute_reg_method"); - - region_obj2 = acpi_ns_get_secondary_object (region_obj); + region_obj2 = acpi_ns_get_secondary_object(region_obj); if (!region_obj2) { - return_ACPI_STATUS (AE_NOT_EXIST); + return_ACPI_STATUS(AE_NOT_EXIST); } if (region_obj2->extra.method_REG == NULL) { - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } /* @@ -237,12 +218,12 @@ acpi_ev_execute_reg_method ( * 0 for disconnecting the handler * Passed as a parameter */ - params[0] = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER); + params[0] = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); if (!params[0]) { - return_ACPI_STATUS (AE_NO_MEMORY); + return_ACPI_STATUS(AE_NO_MEMORY); } - params[1] = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER); + params[1] = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); if (!params[1]) { status = AE_NO_MEMORY; goto cleanup; @@ -260,19 +241,18 @@ acpi_ev_execute_reg_method ( /* Execute the method, no return value */ - ACPI_DEBUG_EXEC (acpi_ut_display_init_pathname ( - ACPI_TYPE_METHOD, info.node, NULL)); - status = acpi_ns_evaluate_by_handle (&info); + ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname + (ACPI_TYPE_METHOD, info.node, NULL)); + status = acpi_ns_evaluate_by_handle(&info); - acpi_ut_remove_reference (params[1]); + acpi_ut_remove_reference(params[1]); -cleanup: - acpi_ut_remove_reference (params[0]); + cleanup: + acpi_ut_remove_reference(params[0]); - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_ev_address_space_dispatch @@ -291,40 +271,38 @@ cleanup: ******************************************************************************/ acpi_status -acpi_ev_address_space_dispatch ( - union acpi_operand_object *region_obj, - u32 function, - acpi_physical_address address, - u32 bit_width, - void *value) +acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, + u32 function, + acpi_physical_address address, + u32 bit_width, void *value) { - acpi_status status; - acpi_status status2; - acpi_adr_space_handler handler; - acpi_adr_space_setup region_setup; - union acpi_operand_object *handler_desc; - union acpi_operand_object *region_obj2; - void *region_context = NULL; + acpi_status status; + acpi_status status2; + acpi_adr_space_handler handler; + acpi_adr_space_setup region_setup; + union acpi_operand_object *handler_desc; + union acpi_operand_object *region_obj2; + void *region_context = NULL; + ACPI_FUNCTION_TRACE("ev_address_space_dispatch"); - ACPI_FUNCTION_TRACE ("ev_address_space_dispatch"); - - - region_obj2 = acpi_ns_get_secondary_object (region_obj); + region_obj2 = acpi_ns_get_secondary_object(region_obj); if (!region_obj2) { - return_ACPI_STATUS (AE_NOT_EXIST); + return_ACPI_STATUS(AE_NOT_EXIST); } /* Ensure that there is a handler associated with this region */ handler_desc = region_obj->region.handler; if (!handler_desc) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "No handler for Region [%4.4s] (%p) [%s]\n", - acpi_ut_get_node_name (region_obj->region.node), - region_obj, acpi_ut_get_region_name (region_obj->region.space_id))); - - return_ACPI_STATUS (AE_NOT_EXIST); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "No handler for Region [%4.4s] (%p) [%s]\n", + acpi_ut_get_node_name(region_obj->region. + node), region_obj, + acpi_ut_get_region_name(region_obj->region. + space_id))); + + return_ACPI_STATUS(AE_NOT_EXIST); } /* @@ -339,10 +317,13 @@ acpi_ev_address_space_dispatch ( if (!region_setup) { /* No initialization routine, exit with error */ - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "No init routine for region(%p) [%s]\n", - region_obj, acpi_ut_get_region_name (region_obj->region.space_id))); - return_ACPI_STATUS (AE_NOT_EXIST); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "No init routine for region(%p) [%s]\n", + region_obj, + acpi_ut_get_region_name(region_obj-> + region. + space_id))); + return_ACPI_STATUS(AE_NOT_EXIST); } /* @@ -350,25 +331,29 @@ acpi_ev_address_space_dispatch ( * setup will potentially execute control methods * (e.g., _REG method for this region) */ - acpi_ex_exit_interpreter (); + acpi_ex_exit_interpreter(); - status = region_setup (region_obj, ACPI_REGION_ACTIVATE, - handler_desc->address_space.context, ®ion_context); + status = region_setup(region_obj, ACPI_REGION_ACTIVATE, + handler_desc->address_space.context, + ®ion_context); /* Re-enter the interpreter */ - status2 = acpi_ex_enter_interpreter (); - if (ACPI_FAILURE (status2)) { - return_ACPI_STATUS (status2); + status2 = acpi_ex_enter_interpreter(); + if (ACPI_FAILURE(status2)) { + return_ACPI_STATUS(status2); } /* Check for failure of the Region Setup */ - if (ACPI_FAILURE (status)) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Region Init: %s [%s]\n", - acpi_format_exception (status), - acpi_ut_get_region_name (region_obj->region.space_id))); - return_ACPI_STATUS (status); + if (ACPI_FAILURE(status)) { + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Region Init: %s [%s]\n", + acpi_format_exception(status), + acpi_ut_get_region_name(region_obj-> + region. + space_id))); + return_ACPI_STATUS(status); } /* @@ -380,14 +365,14 @@ acpi_ev_address_space_dispatch ( if (region_obj2->extra.region_context) { /* The handler for this region was already installed */ - ACPI_MEM_FREE (region_context); - } - else { + ACPI_MEM_FREE(region_context); + } else { /* * Save the returned context for use in all accesses to * this particular region */ - region_obj2->extra.region_context = region_context; + region_obj2->extra.region_context = + region_context; } } } @@ -396,13 +381,16 @@ acpi_ev_address_space_dispatch ( handler = handler_desc->address_space.handler; - ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION, - "Handler %p (@%p) Address %8.8X%8.8X [%s]\n", - ®ion_obj->region.handler->address_space, handler, - ACPI_FORMAT_UINT64 (address), - acpi_ut_get_region_name (region_obj->region.space_id))); + ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, + "Handler %p (@%p) Address %8.8X%8.8X [%s]\n", + ®ion_obj->region.handler->address_space, handler, + ACPI_FORMAT_UINT64(address), + acpi_ut_get_region_name(region_obj->region. + space_id))); - if (!(handler_desc->address_space.hflags & ACPI_ADDR_HANDLER_DEFAULT_INSTALLED)) { + if (! + (handler_desc->address_space. + hflags & ACPI_ADDR_HANDLER_DEFAULT_INSTALLED)) { /* * For handlers other than the default (supplied) handlers, we must * exit the interpreter because the handler *might* block -- we don't @@ -413,31 +401,33 @@ acpi_ev_address_space_dispatch ( /* Call the handler */ - status = handler (function, address, bit_width, value, + status = handler(function, address, bit_width, value, handler_desc->address_space.context, region_obj2->extra.region_context); - if (ACPI_FAILURE (status)) { - ACPI_REPORT_ERROR (("Handler for [%s] returned %s\n", - acpi_ut_get_region_name (region_obj->region.space_id), - acpi_format_exception (status))); + if (ACPI_FAILURE(status)) { + ACPI_REPORT_ERROR(("Handler for [%s] returned %s\n", + acpi_ut_get_region_name(region_obj->region. + space_id), + acpi_format_exception(status))); } - if (!(handler_desc->address_space.hflags & ACPI_ADDR_HANDLER_DEFAULT_INSTALLED)) { + if (! + (handler_desc->address_space. + hflags & ACPI_ADDR_HANDLER_DEFAULT_INSTALLED)) { /* * We just returned from a non-default handler, we must re-enter the * interpreter */ - status2 = acpi_ex_enter_interpreter (); - if (ACPI_FAILURE (status2)) { - return_ACPI_STATUS (status2); + status2 = acpi_ex_enter_interpreter(); + if (ACPI_FAILURE(status2)) { + return_ACPI_STATUS(status2); } } - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_ev_detach_region @@ -453,23 +443,20 @@ acpi_ev_address_space_dispatch ( ******************************************************************************/ void -acpi_ev_detach_region( - union acpi_operand_object *region_obj, - u8 acpi_ns_is_locked) +acpi_ev_detach_region(union acpi_operand_object *region_obj, + u8 acpi_ns_is_locked) { - union acpi_operand_object *handler_obj; - union acpi_operand_object *obj_desc; - union acpi_operand_object **last_obj_ptr; - acpi_adr_space_setup region_setup; - void **region_context; - union acpi_operand_object *region_obj2; - acpi_status status; - - - ACPI_FUNCTION_TRACE ("ev_detach_region"); + union acpi_operand_object *handler_obj; + union acpi_operand_object *obj_desc; + union acpi_operand_object **last_obj_ptr; + acpi_adr_space_setup region_setup; + void **region_context; + union acpi_operand_object *region_obj2; + acpi_status status; + ACPI_FUNCTION_TRACE("ev_detach_region"); - region_obj2 = acpi_ns_get_secondary_object (region_obj); + region_obj2 = acpi_ns_get_secondary_object(region_obj); if (!region_obj2) { return_VOID; } @@ -493,34 +480,39 @@ acpi_ev_detach_region( /* Is this the correct Region? */ if (obj_desc == region_obj) { - ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION, - "Removing Region %p from address handler %p\n", - region_obj, handler_obj)); + ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, + "Removing Region %p from address handler %p\n", + region_obj, handler_obj)); /* This is it, remove it from the handler's list */ *last_obj_ptr = obj_desc->region.next; - obj_desc->region.next = NULL; /* Must clear field */ + obj_desc->region.next = NULL; /* Must clear field */ if (acpi_ns_is_locked) { - status = acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (status)) { + status = + acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE(status)) { return_VOID; } } /* Now stop region accesses by executing the _REG method */ - status = acpi_ev_execute_reg_method (region_obj, 0); - if (ACPI_FAILURE (status)) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%s from region _REG, [%s]\n", - acpi_format_exception (status), - acpi_ut_get_region_name (region_obj->region.space_id))); + status = acpi_ev_execute_reg_method(region_obj, 0); + if (ACPI_FAILURE(status)) { + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "%s from region _REG, [%s]\n", + acpi_format_exception(status), + acpi_ut_get_region_name + (region_obj->region. + space_id))); } if (acpi_ns_is_locked) { - status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (status)) { + status = + acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE(status)) { return_VOID; } } @@ -528,15 +520,20 @@ acpi_ev_detach_region( /* Call the setup handler with the deactivate notification */ region_setup = handler_obj->address_space.setup; - status = region_setup (region_obj, ACPI_REGION_DEACTIVATE, - handler_obj->address_space.context, region_context); + status = + region_setup(region_obj, ACPI_REGION_DEACTIVATE, + handler_obj->address_space.context, + region_context); /* Init routine may fail, Just ignore errors */ - if (ACPI_FAILURE (status)) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%s from region init, [%s]\n", - acpi_format_exception (status), - acpi_ut_get_region_name (region_obj->region.space_id))); + if (ACPI_FAILURE(status)) { + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "%s from region init, [%s]\n", + acpi_format_exception(status), + acpi_ut_get_region_name + (region_obj->region. + space_id))); } region_obj->region.flags &= ~(AOPOBJ_SETUP_COMPLETE); @@ -552,7 +549,7 @@ acpi_ev_detach_region( * this better be the region's handler */ region_obj->region.handler = NULL; - acpi_ut_remove_reference (handler_obj); + acpi_ut_remove_reference(handler_obj); return_VOID; } @@ -565,14 +562,13 @@ acpi_ev_detach_region( /* If we get here, the region was not in the handler's region list */ - ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION, - "Cannot remove region %p from address handler %p\n", - region_obj, handler_obj)); + ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, + "Cannot remove region %p from address handler %p\n", + region_obj, handler_obj)); return_VOID; } - /******************************************************************************* * * FUNCTION: acpi_ev_attach_region @@ -589,20 +585,19 @@ acpi_ev_detach_region( ******************************************************************************/ acpi_status -acpi_ev_attach_region ( - union acpi_operand_object *handler_obj, - union acpi_operand_object *region_obj, - u8 acpi_ns_is_locked) +acpi_ev_attach_region(union acpi_operand_object *handler_obj, + union acpi_operand_object *region_obj, + u8 acpi_ns_is_locked) { - ACPI_FUNCTION_TRACE ("ev_attach_region"); - + ACPI_FUNCTION_TRACE("ev_attach_region"); - ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION, - "Adding Region [%4.4s] %p to address handler %p [%s]\n", - acpi_ut_get_node_name (region_obj->region.node), - region_obj, handler_obj, - acpi_ut_get_region_name (region_obj->region.space_id))); + ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, + "Adding Region [%4.4s] %p to address handler %p [%s]\n", + acpi_ut_get_node_name(region_obj->region.node), + region_obj, handler_obj, + acpi_ut_get_region_name(region_obj->region. + space_id))); /* Link this region to the front of the handler's list */ @@ -612,16 +607,15 @@ acpi_ev_attach_region ( /* Install the region's handler */ if (region_obj->region.handler) { - return_ACPI_STATUS (AE_ALREADY_EXISTS); + return_ACPI_STATUS(AE_ALREADY_EXISTS); } region_obj->region.handler = handler_obj; - acpi_ut_add_reference (handler_obj); + acpi_ut_add_reference(handler_obj); - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_ev_install_handler @@ -640,23 +634,18 @@ acpi_ev_attach_region ( ******************************************************************************/ static acpi_status -acpi_ev_install_handler ( - acpi_handle obj_handle, - u32 level, - void *context, - void **return_value) +acpi_ev_install_handler(acpi_handle obj_handle, + u32 level, void *context, void **return_value) { - union acpi_operand_object *handler_obj; - union acpi_operand_object *next_handler_obj; - union acpi_operand_object *obj_desc; - struct acpi_namespace_node *node; - acpi_status status; + union acpi_operand_object *handler_obj; + union acpi_operand_object *next_handler_obj; + union acpi_operand_object *obj_desc; + struct acpi_namespace_node *node; + acpi_status status; + ACPI_FUNCTION_NAME("ev_install_handler"); - ACPI_FUNCTION_NAME ("ev_install_handler"); - - - handler_obj = (union acpi_operand_object *) context; + handler_obj = (union acpi_operand_object *)context; /* Parameter validation */ @@ -666,7 +655,7 @@ acpi_ev_install_handler ( /* Convert and validate the device handle */ - node = acpi_ns_map_handle_to_node (obj_handle); + node = acpi_ns_map_handle_to_node(obj_handle); if (!node) { return (AE_BAD_PARAMETER); } @@ -676,14 +665,13 @@ acpi_ev_install_handler ( * that are allowed to have address space handlers */ if ((node->type != ACPI_TYPE_DEVICE) && - (node->type != ACPI_TYPE_REGION) && - (node != acpi_gbl_root_node)) { + (node->type != ACPI_TYPE_REGION) && (node != acpi_gbl_root_node)) { return (AE_OK); } /* Check for an existing internal object */ - obj_desc = acpi_ns_get_attached_object (node); + obj_desc = acpi_ns_get_attached_object(node); if (!obj_desc) { /* No object, just exit */ @@ -692,18 +680,22 @@ acpi_ev_install_handler ( /* Devices are handled different than regions */ - if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_DEVICE) { + if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_DEVICE) { /* Check if this Device already has a handler for this address space */ next_handler_obj = obj_desc->device.handler; while (next_handler_obj) { /* Found a handler, is it for the same address space? */ - if (next_handler_obj->address_space.space_id == handler_obj->address_space.space_id) { - ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION, - "Found handler for region [%s] in device %p(%p) handler %p\n", - acpi_ut_get_region_name (handler_obj->address_space.space_id), - obj_desc, next_handler_obj, handler_obj)); + if (next_handler_obj->address_space.space_id == + handler_obj->address_space.space_id) { + ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, + "Found handler for region [%s] in device %p(%p) handler %p\n", + acpi_ut_get_region_name + (handler_obj->address_space. + space_id), obj_desc, + next_handler_obj, + handler_obj)); /* * Since the object we found it on was a device, then it @@ -744,15 +736,14 @@ acpi_ev_install_handler ( * * First disconnect region for any previous handler (if any) */ - acpi_ev_detach_region (obj_desc, FALSE); + acpi_ev_detach_region(obj_desc, FALSE); /* Connect the region to the new handler */ - status = acpi_ev_attach_region (handler_obj, obj_desc, FALSE); + status = acpi_ev_attach_region(handler_obj, obj_desc, FALSE); return (status); } - /******************************************************************************* * * FUNCTION: acpi_ev_install_space_handler @@ -771,32 +762,27 @@ acpi_ev_install_handler ( ******************************************************************************/ acpi_status -acpi_ev_install_space_handler ( - struct acpi_namespace_node *node, - acpi_adr_space_type space_id, - acpi_adr_space_handler handler, - acpi_adr_space_setup setup, - void *context) +acpi_ev_install_space_handler(struct acpi_namespace_node * node, + acpi_adr_space_type space_id, + acpi_adr_space_handler handler, + acpi_adr_space_setup setup, void *context) { - union acpi_operand_object *obj_desc; - union acpi_operand_object *handler_obj; - acpi_status status; - acpi_object_type type; - u16 flags = 0; - - - ACPI_FUNCTION_TRACE ("ev_install_space_handler"); + union acpi_operand_object *obj_desc; + union acpi_operand_object *handler_obj; + acpi_status status; + acpi_object_type type; + u16 flags = 0; + ACPI_FUNCTION_TRACE("ev_install_space_handler"); /* * This registration is valid for only the types below * and the root. This is where the default handlers * get placed. */ - if ((node->type != ACPI_TYPE_DEVICE) && - (node->type != ACPI_TYPE_PROCESSOR) && - (node->type != ACPI_TYPE_THERMAL) && - (node != acpi_gbl_root_node)) { + if ((node->type != ACPI_TYPE_DEVICE) && + (node->type != ACPI_TYPE_PROCESSOR) && + (node->type != ACPI_TYPE_THERMAL) && (node != acpi_gbl_root_node)) { status = AE_BAD_PARAMETER; goto unlock_and_exit; } @@ -807,32 +793,32 @@ acpi_ev_install_space_handler ( switch (space_id) { case ACPI_ADR_SPACE_SYSTEM_MEMORY: handler = acpi_ex_system_memory_space_handler; - setup = acpi_ev_system_memory_region_setup; + setup = acpi_ev_system_memory_region_setup; break; case ACPI_ADR_SPACE_SYSTEM_IO: handler = acpi_ex_system_io_space_handler; - setup = acpi_ev_io_space_region_setup; + setup = acpi_ev_io_space_region_setup; break; case ACPI_ADR_SPACE_PCI_CONFIG: handler = acpi_ex_pci_config_space_handler; - setup = acpi_ev_pci_config_region_setup; + setup = acpi_ev_pci_config_region_setup; break; case ACPI_ADR_SPACE_CMOS: handler = acpi_ex_cmos_space_handler; - setup = acpi_ev_cmos_region_setup; + setup = acpi_ev_cmos_region_setup; break; case ACPI_ADR_SPACE_PCI_BAR_TARGET: handler = acpi_ex_pci_bar_space_handler; - setup = acpi_ev_pci_bar_region_setup; + setup = acpi_ev_pci_bar_region_setup; break; case ACPI_ADR_SPACE_DATA_TABLE: handler = acpi_ex_data_table_space_handler; - setup = NULL; + setup = NULL; break; default: @@ -849,7 +835,7 @@ acpi_ev_install_space_handler ( /* Check for an existing internal object */ - obj_desc = acpi_ns_get_attached_object (node); + obj_desc = acpi_ns_get_attached_object(node); if (obj_desc) { /* * The attached device object already exists. @@ -863,7 +849,8 @@ acpi_ev_install_space_handler ( /* Same space_id indicates a handler already installed */ if (handler_obj->address_space.space_id == space_id) { - if (handler_obj->address_space.handler == handler) { + if (handler_obj->address_space.handler == + handler) { /* * It is (relatively) OK to attempt to install the SAME * handler twice. This can easily happen @@ -871,8 +858,7 @@ acpi_ev_install_space_handler ( */ status = AE_SAME_HANDLER; goto unlock_and_exit; - } - else { + } else { /* A handler is already installed */ status = AE_ALREADY_EXISTS; @@ -884,21 +870,20 @@ acpi_ev_install_space_handler ( handler_obj = handler_obj->address_space.next; } - } - else { - ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION, - "Creating object on Device %p while installing handler\n", node)); + } else { + ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, + "Creating object on Device %p while installing handler\n", + node)); /* obj_desc does not exist, create one */ if (node->type == ACPI_TYPE_ANY) { type = ACPI_TYPE_DEVICE; - } - else { + } else { type = node->type; } - obj_desc = acpi_ut_create_internal_object (type); + obj_desc = acpi_ut_create_internal_object(type); if (!obj_desc) { status = AE_NO_MEMORY; goto unlock_and_exit; @@ -910,21 +895,21 @@ acpi_ev_install_space_handler ( /* Attach the new object to the Node */ - status = acpi_ns_attach_object (node, obj_desc, type); + status = acpi_ns_attach_object(node, obj_desc, type); /* Remove local reference to the object */ - acpi_ut_remove_reference (obj_desc); + acpi_ut_remove_reference(obj_desc); - if (ACPI_FAILURE (status)) { + if (ACPI_FAILURE(status)) { goto unlock_and_exit; } } - ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION, - "Installing address handler for region %s(%X) on Device %4.4s %p(%p)\n", - acpi_ut_get_region_name (space_id), space_id, - acpi_ut_get_node_name (node), node, obj_desc)); + ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, + "Installing address handler for region %s(%X) on Device %4.4s %p(%p)\n", + acpi_ut_get_region_name(space_id), space_id, + acpi_ut_get_node_name(node), node, obj_desc)); /* * Install the handler @@ -933,7 +918,8 @@ acpi_ev_install_space_handler ( * Just allocate the object for the handler and link it * into the list. */ - handler_obj = acpi_ut_create_internal_object (ACPI_TYPE_LOCAL_ADDRESS_HANDLER); + handler_obj = + acpi_ut_create_internal_object(ACPI_TYPE_LOCAL_ADDRESS_HANDLER); if (!handler_obj) { status = AE_NO_MEMORY; goto unlock_and_exit; @@ -941,17 +927,17 @@ acpi_ev_install_space_handler ( /* Init handler obj */ - handler_obj->address_space.space_id = (u8) space_id; - handler_obj->address_space.hflags = flags; + handler_obj->address_space.space_id = (u8) space_id; + handler_obj->address_space.hflags = flags; handler_obj->address_space.region_list = NULL; - handler_obj->address_space.node = node; - handler_obj->address_space.handler = handler; - handler_obj->address_space.context = context; - handler_obj->address_space.setup = setup; + handler_obj->address_space.node = node; + handler_obj->address_space.handler = handler; + handler_obj->address_space.context = context; + handler_obj->address_space.setup = setup; /* Install at head of Device.address_space list */ - handler_obj->address_space.next = obj_desc->device.handler; + handler_obj->address_space.next = obj_desc->device.handler; /* * The Device object is the first reference on the handler_obj. @@ -971,15 +957,15 @@ acpi_ev_install_space_handler ( * In either case, back up and search down the remainder * of the branch */ - status = acpi_ns_walk_namespace (ACPI_TYPE_ANY, node, ACPI_UINT32_MAX, - ACPI_NS_WALK_UNLOCK, acpi_ev_install_handler, - handler_obj, NULL); + status = acpi_ns_walk_namespace(ACPI_TYPE_ANY, node, ACPI_UINT32_MAX, + ACPI_NS_WALK_UNLOCK, + acpi_ev_install_handler, handler_obj, + NULL); -unlock_and_exit: - return_ACPI_STATUS (status); + unlock_and_exit: + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_ev_execute_reg_methods @@ -995,15 +981,12 @@ unlock_and_exit: ******************************************************************************/ acpi_status -acpi_ev_execute_reg_methods ( - struct acpi_namespace_node *node, - acpi_adr_space_type space_id) +acpi_ev_execute_reg_methods(struct acpi_namespace_node *node, + acpi_adr_space_type space_id) { - acpi_status status; - - - ACPI_FUNCTION_TRACE ("ev_execute_reg_methods"); + acpi_status status; + ACPI_FUNCTION_TRACE("ev_execute_reg_methods"); /* * Run all _REG methods for all Operation Regions for this @@ -1012,14 +995,13 @@ acpi_ev_execute_reg_methods ( * must be installed for all regions of this Space ID before we * can run any _REG methods) */ - status = acpi_ns_walk_namespace (ACPI_TYPE_ANY, node, ACPI_UINT32_MAX, - ACPI_NS_WALK_UNLOCK, acpi_ev_reg_run, - &space_id, NULL); + status = acpi_ns_walk_namespace(ACPI_TYPE_ANY, node, ACPI_UINT32_MAX, + ACPI_NS_WALK_UNLOCK, acpi_ev_reg_run, + &space_id, NULL); - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_ev_reg_run @@ -1031,23 +1013,19 @@ acpi_ev_execute_reg_methods ( ******************************************************************************/ static acpi_status -acpi_ev_reg_run ( - acpi_handle obj_handle, - u32 level, - void *context, - void **return_value) +acpi_ev_reg_run(acpi_handle obj_handle, + u32 level, void *context, void **return_value) { - union acpi_operand_object *obj_desc; - struct acpi_namespace_node *node; - acpi_adr_space_type space_id; - acpi_status status; + union acpi_operand_object *obj_desc; + struct acpi_namespace_node *node; + acpi_adr_space_type space_id; + acpi_status status; - - space_id = *ACPI_CAST_PTR (acpi_adr_space_type, context); + space_id = *ACPI_CAST_PTR(acpi_adr_space_type, context); /* Convert and validate the device handle */ - node = acpi_ns_map_handle_to_node (obj_handle); + node = acpi_ns_map_handle_to_node(obj_handle); if (!node) { return (AE_BAD_PARAMETER); } @@ -1056,14 +1034,13 @@ acpi_ev_reg_run ( * We only care about regions.and objects * that are allowed to have address space handlers */ - if ((node->type != ACPI_TYPE_REGION) && - (node != acpi_gbl_root_node)) { + if ((node->type != ACPI_TYPE_REGION) && (node != acpi_gbl_root_node)) { return (AE_OK); } /* Check for an existing internal object */ - obj_desc = acpi_ns_get_attached_object (node); + obj_desc = acpi_ns_get_attached_object(node); if (!obj_desc) { /* No object, just exit */ @@ -1080,7 +1057,6 @@ acpi_ev_reg_run ( return (AE_OK); } - status = acpi_ev_execute_reg_method (obj_desc, 1); + status = acpi_ev_execute_reg_method(obj_desc, 1); return (status); } - diff --git a/drivers/acpi/events/evrgnini.c b/drivers/acpi/events/evrgnini.c index f2d53af9761..a1bd2da27c4 100644 --- a/drivers/acpi/events/evrgnini.c +++ b/drivers/acpi/events/evrgnini.c @@ -41,14 +41,12 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include #include #include #define _COMPONENT ACPI_EVENTS - ACPI_MODULE_NAME ("evrgnini") - +ACPI_MODULE_NAME("evrgnini") /******************************************************************************* * @@ -64,34 +62,31 @@ * DESCRIPTION: Setup a system_memory operation region * ******************************************************************************/ - acpi_status -acpi_ev_system_memory_region_setup ( - acpi_handle handle, - u32 function, - void *handler_context, - void **region_context) +acpi_ev_system_memory_region_setup(acpi_handle handle, + u32 function, + void *handler_context, void **region_context) { - union acpi_operand_object *region_desc = (union acpi_operand_object *) handle; - struct acpi_mem_space_context *local_region_context; - - - ACPI_FUNCTION_TRACE ("ev_system_memory_region_setup"); + union acpi_operand_object *region_desc = + (union acpi_operand_object *)handle; + struct acpi_mem_space_context *local_region_context; + ACPI_FUNCTION_TRACE("ev_system_memory_region_setup"); if (function == ACPI_REGION_DEACTIVATE) { if (*region_context) { - ACPI_MEM_FREE (*region_context); + ACPI_MEM_FREE(*region_context); *region_context = NULL; } - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } /* Create a new context */ - local_region_context = ACPI_MEM_CALLOCATE (sizeof (struct acpi_mem_space_context)); + local_region_context = + ACPI_MEM_CALLOCATE(sizeof(struct acpi_mem_space_context)); if (!(local_region_context)) { - return_ACPI_STATUS (AE_NO_MEMORY); + return_ACPI_STATUS(AE_NO_MEMORY); } /* Save the region length and address for use in the handler */ @@ -100,10 +95,9 @@ acpi_ev_system_memory_region_setup ( local_region_context->address = region_desc->region.address; *region_context = local_region_context; - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_ev_io_space_region_setup @@ -120,26 +114,21 @@ acpi_ev_system_memory_region_setup ( ******************************************************************************/ acpi_status -acpi_ev_io_space_region_setup ( - acpi_handle handle, - u32 function, - void *handler_context, - void **region_context) +acpi_ev_io_space_region_setup(acpi_handle handle, + u32 function, + void *handler_context, void **region_context) { - ACPI_FUNCTION_TRACE ("ev_io_space_region_setup"); - + ACPI_FUNCTION_TRACE("ev_io_space_region_setup"); if (function == ACPI_REGION_DEACTIVATE) { *region_context = NULL; - } - else { + } else { *region_context = handler_context; } - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_ev_pci_config_region_setup @@ -158,24 +147,21 @@ acpi_ev_io_space_region_setup ( ******************************************************************************/ acpi_status -acpi_ev_pci_config_region_setup ( - acpi_handle handle, - u32 function, - void *handler_context, - void **region_context) +acpi_ev_pci_config_region_setup(acpi_handle handle, + u32 function, + void *handler_context, void **region_context) { - acpi_status status = AE_OK; - acpi_integer pci_value; - struct acpi_pci_id *pci_id = *region_context; - union acpi_operand_object *handler_obj; - struct acpi_namespace_node *parent_node; - struct acpi_namespace_node *pci_root_node; - union acpi_operand_object *region_obj = (union acpi_operand_object *) handle; - struct acpi_device_id object_hID; - - - ACPI_FUNCTION_TRACE ("ev_pci_config_region_setup"); - + acpi_status status = AE_OK; + acpi_integer pci_value; + struct acpi_pci_id *pci_id = *region_context; + union acpi_operand_object *handler_obj; + struct acpi_namespace_node *parent_node; + struct acpi_namespace_node *pci_root_node; + union acpi_operand_object *region_obj = + (union acpi_operand_object *)handle; + struct acpi_device_id object_hID; + + ACPI_FUNCTION_TRACE("ev_pci_config_region_setup"); handler_obj = region_obj->region.handler; if (!handler_obj) { @@ -183,20 +169,21 @@ acpi_ev_pci_config_region_setup ( * No installed handler. This shouldn't happen because the dispatch * routine checks before we get here, but we check again just in case. */ - ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION, - "Attempting to init a region %p, with no handler\n", region_obj)); - return_ACPI_STATUS (AE_NOT_EXIST); + ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, + "Attempting to init a region %p, with no handler\n", + region_obj)); + return_ACPI_STATUS(AE_NOT_EXIST); } *region_context = NULL; if (function == ACPI_REGION_DEACTIVATE) { if (pci_id) { - ACPI_MEM_FREE (pci_id); + ACPI_MEM_FREE(pci_id); } - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - parent_node = acpi_ns_get_parent_node (region_obj->region.node); + parent_node = acpi_ns_get_parent_node(region_obj->region.node); /* * Get the _SEG and _BBN values from the device upon which the handler @@ -216,22 +203,28 @@ acpi_ev_pci_config_region_setup ( pci_root_node = parent_node; while (pci_root_node != acpi_gbl_root_node) { - status = acpi_ut_execute_HID (pci_root_node, &object_hID); - if (ACPI_SUCCESS (status)) { + status = + acpi_ut_execute_HID(pci_root_node, &object_hID); + if (ACPI_SUCCESS(status)) { /* * Got a valid _HID string, check if this is a PCI root. * New for ACPI 3.0: check for a PCI Express root also. */ - if (!(ACPI_STRNCMP (object_hID.value, PCI_ROOT_HID_STRING, - sizeof (PCI_ROOT_HID_STRING)) || - !(ACPI_STRNCMP (object_hID.value, PCI_EXPRESS_ROOT_HID_STRING, - sizeof (PCI_EXPRESS_ROOT_HID_STRING))))) { + if (! + (ACPI_STRNCMP + (object_hID.value, PCI_ROOT_HID_STRING, + sizeof(PCI_ROOT_HID_STRING)) + || + !(ACPI_STRNCMP + (object_hID.value, + PCI_EXPRESS_ROOT_HID_STRING, + sizeof(PCI_EXPRESS_ROOT_HID_STRING))))) + { /* Install a handler for this PCI root bridge */ - status = acpi_install_address_space_handler ((acpi_handle) pci_root_node, - ACPI_ADR_SPACE_PCI_CONFIG, - ACPI_DEFAULT_HANDLER, NULL, NULL); - if (ACPI_FAILURE (status)) { + status = + acpi_install_address_space_handler((acpi_handle) pci_root_node, ACPI_ADR_SPACE_PCI_CONFIG, ACPI_DEFAULT_HANDLER, NULL, NULL); + if (ACPI_FAILURE(status)) { if (status == AE_SAME_HANDLER) { /* * It is OK if the handler is already installed on the root @@ -239,23 +232,19 @@ acpi_ev_pci_config_region_setup ( * new PCI_Config operation region, however. */ status = AE_OK; - } - else { - ACPI_REPORT_ERROR (( - "Could not install pci_config handler for Root Bridge %4.4s, %s\n", - acpi_ut_get_node_name (pci_root_node), acpi_format_exception (status))); + } else { + ACPI_REPORT_ERROR(("Could not install pci_config handler for Root Bridge %4.4s, %s\n", acpi_ut_get_node_name(pci_root_node), acpi_format_exception(status))); } } break; } } - pci_root_node = acpi_ns_get_parent_node (pci_root_node); + pci_root_node = acpi_ns_get_parent_node(pci_root_node); } /* PCI root bridge not found, use namespace root node */ - } - else { + } else { pci_root_node = handler_obj->address_space.node; } @@ -264,14 +253,14 @@ acpi_ev_pci_config_region_setup ( * (install_address_space_handler could have initialized it) */ if (region_obj->region.flags & AOPOBJ_SETUP_COMPLETE) { - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } /* Region is still not initialized. Create a new context */ - pci_id = ACPI_MEM_CALLOCATE (sizeof (struct acpi_pci_id)); + pci_id = ACPI_MEM_CALLOCATE(sizeof(struct acpi_pci_id)); if (!pci_id) { - return_ACPI_STATUS (AE_NO_MEMORY); + return_ACPI_STATUS(AE_NO_MEMORY); } /* @@ -283,40 +272,45 @@ acpi_ev_pci_config_region_setup ( * Get the PCI device and function numbers from the _ADR object * contained in the parent's scope. */ - status = acpi_ut_evaluate_numeric_object (METHOD_NAME__ADR, parent_node, &pci_value); + status = + acpi_ut_evaluate_numeric_object(METHOD_NAME__ADR, parent_node, + &pci_value); /* * The default is zero, and since the allocation above zeroed * the data, just do nothing on failure. */ - if (ACPI_SUCCESS (status)) { - pci_id->device = ACPI_HIWORD (ACPI_LODWORD (pci_value)); - pci_id->function = ACPI_LOWORD (ACPI_LODWORD (pci_value)); + if (ACPI_SUCCESS(status)) { + pci_id->device = ACPI_HIWORD(ACPI_LODWORD(pci_value)); + pci_id->function = ACPI_LOWORD(ACPI_LODWORD(pci_value)); } /* The PCI segment number comes from the _SEG method */ - status = acpi_ut_evaluate_numeric_object (METHOD_NAME__SEG, pci_root_node, &pci_value); - if (ACPI_SUCCESS (status)) { - pci_id->segment = ACPI_LOWORD (pci_value); + status = + acpi_ut_evaluate_numeric_object(METHOD_NAME__SEG, pci_root_node, + &pci_value); + if (ACPI_SUCCESS(status)) { + pci_id->segment = ACPI_LOWORD(pci_value); } /* The PCI bus number comes from the _BBN method */ - status = acpi_ut_evaluate_numeric_object (METHOD_NAME__BBN, pci_root_node, &pci_value); - if (ACPI_SUCCESS (status)) { - pci_id->bus = ACPI_LOWORD (pci_value); + status = + acpi_ut_evaluate_numeric_object(METHOD_NAME__BBN, pci_root_node, + &pci_value); + if (ACPI_SUCCESS(status)) { + pci_id->bus = ACPI_LOWORD(pci_value); } /* Complete this device's pci_id */ - acpi_os_derive_pci_id (pci_root_node, region_obj->region.node, &pci_id); + acpi_os_derive_pci_id(pci_root_node, region_obj->region.node, &pci_id); *region_context = pci_id; - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_ev_pci_bar_region_setup @@ -335,19 +329,15 @@ acpi_ev_pci_config_region_setup ( ******************************************************************************/ acpi_status -acpi_ev_pci_bar_region_setup ( - acpi_handle handle, - u32 function, - void *handler_context, - void **region_context) +acpi_ev_pci_bar_region_setup(acpi_handle handle, + u32 function, + void *handler_context, void **region_context) { - ACPI_FUNCTION_TRACE ("ev_pci_bar_region_setup"); - + ACPI_FUNCTION_TRACE("ev_pci_bar_region_setup"); - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_ev_cmos_region_setup @@ -366,19 +356,15 @@ acpi_ev_pci_bar_region_setup ( ******************************************************************************/ acpi_status -acpi_ev_cmos_region_setup ( - acpi_handle handle, - u32 function, - void *handler_context, - void **region_context) +acpi_ev_cmos_region_setup(acpi_handle handle, + u32 function, + void *handler_context, void **region_context) { - ACPI_FUNCTION_TRACE ("ev_cmos_region_setup"); - + ACPI_FUNCTION_TRACE("ev_cmos_region_setup"); - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_ev_default_region_setup @@ -395,26 +381,21 @@ acpi_ev_cmos_region_setup ( ******************************************************************************/ acpi_status -acpi_ev_default_region_setup ( - acpi_handle handle, - u32 function, - void *handler_context, - void **region_context) +acpi_ev_default_region_setup(acpi_handle handle, + u32 function, + void *handler_context, void **region_context) { - ACPI_FUNCTION_TRACE ("ev_default_region_setup"); - + ACPI_FUNCTION_TRACE("ev_default_region_setup"); if (function == ACPI_REGION_DEACTIVATE) { *region_context = NULL; - } - else { + } else { *region_context = handler_context; } - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_ev_initialize_region @@ -438,37 +419,34 @@ acpi_ev_default_region_setup ( ******************************************************************************/ acpi_status -acpi_ev_initialize_region ( - union acpi_operand_object *region_obj, - u8 acpi_ns_locked) +acpi_ev_initialize_region(union acpi_operand_object *region_obj, + u8 acpi_ns_locked) { - union acpi_operand_object *handler_obj; - union acpi_operand_object *obj_desc; - acpi_adr_space_type space_id; - struct acpi_namespace_node *node; - acpi_status status; - struct acpi_namespace_node *method_node; - acpi_name *reg_name_ptr = (acpi_name *) METHOD_NAME__REG; - union acpi_operand_object *region_obj2; - - - ACPI_FUNCTION_TRACE_U32 ("ev_initialize_region", acpi_ns_locked); + union acpi_operand_object *handler_obj; + union acpi_operand_object *obj_desc; + acpi_adr_space_type space_id; + struct acpi_namespace_node *node; + acpi_status status; + struct acpi_namespace_node *method_node; + acpi_name *reg_name_ptr = (acpi_name *) METHOD_NAME__REG; + union acpi_operand_object *region_obj2; + ACPI_FUNCTION_TRACE_U32("ev_initialize_region", acpi_ns_locked); if (!region_obj) { - return_ACPI_STATUS (AE_BAD_PARAMETER); + return_ACPI_STATUS(AE_BAD_PARAMETER); } if (region_obj->common.flags & AOPOBJ_OBJECT_INITIALIZED) { - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - region_obj2 = acpi_ns_get_secondary_object (region_obj); + region_obj2 = acpi_ns_get_secondary_object(region_obj); if (!region_obj2) { - return_ACPI_STATUS (AE_NOT_EXIST); + return_ACPI_STATUS(AE_NOT_EXIST); } - node = acpi_ns_get_parent_node (region_obj->region.node); + node = acpi_ns_get_parent_node(region_obj->region.node); space_id = region_obj->region.space_id; /* Setup defaults */ @@ -480,9 +458,9 @@ acpi_ev_initialize_region ( /* Find any "_REG" method associated with this region definition */ - status = acpi_ns_search_node (*reg_name_ptr, node, - ACPI_TYPE_METHOD, &method_node); - if (ACPI_SUCCESS (status)) { + status = acpi_ns_search_node(*reg_name_ptr, node, + ACPI_TYPE_METHOD, &method_node); + if (ACPI_SUCCESS(status)) { /* * The _REG method is optional and there can be only one per region * definition. This will be executed when the handler is attached @@ -499,7 +477,7 @@ acpi_ev_initialize_region ( /* Check to see if a handler exists */ handler_obj = NULL; - obj_desc = acpi_ns_get_attached_object (node); + obj_desc = acpi_ns_get_attached_object(node); if (obj_desc) { /* Can only be a handler if the object exists */ @@ -527,37 +505,50 @@ acpi_ev_initialize_region ( while (handler_obj) { /* Is this handler of the correct type? */ - if (handler_obj->address_space.space_id == space_id) { + if (handler_obj->address_space.space_id == + space_id) { /* Found correct handler */ - ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION, - "Found handler %p for region %p in obj %p\n", - handler_obj, region_obj, obj_desc)); + ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, + "Found handler %p for region %p in obj %p\n", + handler_obj, + region_obj, + obj_desc)); - status = acpi_ev_attach_region (handler_obj, region_obj, - acpi_ns_locked); + status = + acpi_ev_attach_region(handler_obj, + region_obj, + acpi_ns_locked); /* * Tell all users that this region is usable by running the _REG * method */ if (acpi_ns_locked) { - status = acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = + acpi_ut_release_mutex + (ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS + (status); } } - status = acpi_ev_execute_reg_method (region_obj, 1); + status = + acpi_ev_execute_reg_method + (region_obj, 1); if (acpi_ns_locked) { - status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = + acpi_ut_acquire_mutex + (ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS + (status); } } - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } /* Try next handler in the list */ @@ -570,15 +561,15 @@ acpi_ev_initialize_region ( * This node does not have the handler we need; * Pop up one level */ - node = acpi_ns_get_parent_node (node); + node = acpi_ns_get_parent_node(node); } /* If we get here, there is no handler for this region */ - ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION, - "No handler for region_type %s(%X) (region_obj %p)\n", - acpi_ut_get_region_name (space_id), space_id, region_obj)); + ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, + "No handler for region_type %s(%X) (region_obj %p)\n", + acpi_ut_get_region_name(space_id), space_id, + region_obj)); - return_ACPI_STATUS (AE_NOT_EXIST); + return_ACPI_STATUS(AE_NOT_EXIST); } - diff --git a/drivers/acpi/events/evsci.c b/drivers/acpi/events/evsci.c index f3123c26ae9..14183597700 100644 --- a/drivers/acpi/events/evsci.c +++ b/drivers/acpi/events/evsci.c @@ -45,16 +45,11 @@ #include #include - #define _COMPONENT ACPI_EVENTS - ACPI_MODULE_NAME ("evsci") +ACPI_MODULE_NAME("evsci") /* Local prototypes */ - -static u32 ACPI_SYSTEM_XFACE -acpi_ev_sci_xrupt_handler ( - void *context); - +static u32 ACPI_SYSTEM_XFACE acpi_ev_sci_xrupt_handler(void *context); /******************************************************************************* * @@ -69,17 +64,13 @@ acpi_ev_sci_xrupt_handler ( * ******************************************************************************/ -static u32 ACPI_SYSTEM_XFACE -acpi_ev_sci_xrupt_handler ( - void *context) +static u32 ACPI_SYSTEM_XFACE acpi_ev_sci_xrupt_handler(void *context) { - struct acpi_gpe_xrupt_info *gpe_xrupt_list = context; - u32 interrupt_handled = ACPI_INTERRUPT_NOT_HANDLED; - + struct acpi_gpe_xrupt_info *gpe_xrupt_list = context; + u32 interrupt_handled = ACPI_INTERRUPT_NOT_HANDLED; ACPI_FUNCTION_TRACE("ev_sci_xrupt_handler"); - /* * We are guaranteed by the ACPI CA initialization/shutdown code that * if this interrupt handler is installed, ACPI is enabled. @@ -89,18 +80,17 @@ acpi_ev_sci_xrupt_handler ( * Fixed Events: * Check for and dispatch any Fixed Events that have occurred */ - interrupt_handled |= acpi_ev_fixed_event_detect (); + interrupt_handled |= acpi_ev_fixed_event_detect(); /* * General Purpose Events: * Check for and dispatch any GPEs that have occurred */ - interrupt_handled |= acpi_ev_gpe_detect (gpe_xrupt_list); + interrupt_handled |= acpi_ev_gpe_detect(gpe_xrupt_list); - return_VALUE (interrupt_handled); + return_VALUE(interrupt_handled); } - /******************************************************************************* * * FUNCTION: acpi_ev_gpe_xrupt_handler @@ -113,17 +103,13 @@ acpi_ev_sci_xrupt_handler ( * ******************************************************************************/ -u32 ACPI_SYSTEM_XFACE -acpi_ev_gpe_xrupt_handler ( - void *context) +u32 ACPI_SYSTEM_XFACE acpi_ev_gpe_xrupt_handler(void *context) { - struct acpi_gpe_xrupt_info *gpe_xrupt_list = context; - u32 interrupt_handled = ACPI_INTERRUPT_NOT_HANDLED; - + struct acpi_gpe_xrupt_info *gpe_xrupt_list = context; + u32 interrupt_handled = ACPI_INTERRUPT_NOT_HANDLED; ACPI_FUNCTION_TRACE("ev_gpe_xrupt_handler"); - /* * We are guaranteed by the ACPI CA initialization/shutdown code that * if this interrupt handler is installed, ACPI is enabled. @@ -133,12 +119,11 @@ acpi_ev_gpe_xrupt_handler ( * GPEs: * Check for and dispatch any GPEs that have occurred */ - interrupt_handled |= acpi_ev_gpe_detect (gpe_xrupt_list); + interrupt_handled |= acpi_ev_gpe_detect(gpe_xrupt_list); - return_VALUE (interrupt_handled); + return_VALUE(interrupt_handled); } - /****************************************************************************** * * FUNCTION: acpi_ev_install_sci_handler @@ -151,22 +136,18 @@ acpi_ev_gpe_xrupt_handler ( * ******************************************************************************/ -u32 -acpi_ev_install_sci_handler ( - void) +u32 acpi_ev_install_sci_handler(void) { - u32 status = AE_OK; - + u32 status = AE_OK; - ACPI_FUNCTION_TRACE ("ev_install_sci_handler"); + ACPI_FUNCTION_TRACE("ev_install_sci_handler"); - - status = acpi_os_install_interrupt_handler ((u32) acpi_gbl_FADT->sci_int, - acpi_ev_sci_xrupt_handler, acpi_gbl_gpe_xrupt_list_head); - return_ACPI_STATUS (status); + status = acpi_os_install_interrupt_handler((u32) acpi_gbl_FADT->sci_int, + acpi_ev_sci_xrupt_handler, + acpi_gbl_gpe_xrupt_list_head); + return_ACPI_STATUS(status); } - /****************************************************************************** * * FUNCTION: acpi_ev_remove_sci_handler @@ -186,22 +167,16 @@ acpi_ev_install_sci_handler ( * ******************************************************************************/ -acpi_status -acpi_ev_remove_sci_handler ( - void) +acpi_status acpi_ev_remove_sci_handler(void) { - acpi_status status; - - - ACPI_FUNCTION_TRACE ("ev_remove_sci_handler"); + acpi_status status; + ACPI_FUNCTION_TRACE("ev_remove_sci_handler"); /* Just let the OS remove the handler and disable the level */ - status = acpi_os_remove_interrupt_handler ((u32) acpi_gbl_FADT->sci_int, - acpi_ev_sci_xrupt_handler); + status = acpi_os_remove_interrupt_handler((u32) acpi_gbl_FADT->sci_int, + acpi_ev_sci_xrupt_handler); - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - - diff --git a/drivers/acpi/events/evxface.c b/drivers/acpi/events/evxface.c index 4c1c25e316a..43b33d19cdf 100644 --- a/drivers/acpi/events/evxface.c +++ b/drivers/acpi/events/evxface.c @@ -49,8 +49,7 @@ #include #define _COMPONENT ACPI_EVENTS - ACPI_MODULE_NAME ("evxface") - +ACPI_MODULE_NAME("evxface") /******************************************************************************* * @@ -64,21 +63,16 @@ * DESCRIPTION: Saves the pointer to the handler function * ******************************************************************************/ - #ifdef ACPI_FUTURE_USAGE -acpi_status -acpi_install_exception_handler ( - acpi_exception_handler handler) +acpi_status acpi_install_exception_handler(acpi_exception_handler handler) { - acpi_status status; - + acpi_status status; - ACPI_FUNCTION_TRACE ("acpi_install_exception_handler"); + ACPI_FUNCTION_TRACE("acpi_install_exception_handler"); - - status = acpi_ut_acquire_mutex (ACPI_MTX_EVENTS); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* Don't allow two handlers. */ @@ -92,12 +86,11 @@ acpi_install_exception_handler ( acpi_gbl_exception_handler = handler; -cleanup: - (void) acpi_ut_release_mutex (ACPI_MTX_EVENTS); - return_ACPI_STATUS (status); + cleanup: + (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS); + return_ACPI_STATUS(status); } -#endif /* ACPI_FUTURE_USAGE */ - +#endif /* ACPI_FUTURE_USAGE */ /******************************************************************************* * @@ -116,26 +109,22 @@ cleanup: ******************************************************************************/ acpi_status -acpi_install_fixed_event_handler ( - u32 event, - acpi_event_handler handler, - void *context) +acpi_install_fixed_event_handler(u32 event, + acpi_event_handler handler, void *context) { - acpi_status status; - - - ACPI_FUNCTION_TRACE ("acpi_install_fixed_event_handler"); + acpi_status status; + ACPI_FUNCTION_TRACE("acpi_install_fixed_event_handler"); /* Parameter validation */ if (event > ACPI_EVENT_MAX) { - return_ACPI_STATUS (AE_BAD_PARAMETER); + return_ACPI_STATUS(AE_BAD_PARAMETER); } - status = acpi_ut_acquire_mutex (ACPI_MTX_EVENTS); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* Don't allow two handlers. */ @@ -150,29 +139,29 @@ acpi_install_fixed_event_handler ( acpi_gbl_fixed_event_handlers[event].handler = handler; acpi_gbl_fixed_event_handlers[event].context = context; - status = acpi_clear_event (event); + status = acpi_clear_event(event); if (ACPI_SUCCESS(status)) - status = acpi_enable_event (event, 0); - if (ACPI_FAILURE (status)) { - ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Could not enable fixed event.\n")); + status = acpi_enable_event(event, 0); + if (ACPI_FAILURE(status)) { + ACPI_DEBUG_PRINT((ACPI_DB_WARN, + "Could not enable fixed event.\n")); /* Remove the handler */ acpi_gbl_fixed_event_handlers[event].handler = NULL; acpi_gbl_fixed_event_handlers[event].context = NULL; - } - else { - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "Enabled fixed event %X, Handler=%p\n", event, handler)); + } else { + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "Enabled fixed event %X, Handler=%p\n", event, + handler)); } - -cleanup: - (void) acpi_ut_release_mutex (ACPI_MTX_EVENTS); - return_ACPI_STATUS (status); + cleanup: + (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS); + return_ACPI_STATUS(status); } -EXPORT_SYMBOL(acpi_install_fixed_event_handler); +EXPORT_SYMBOL(acpi_install_fixed_event_handler); /******************************************************************************* * @@ -188,49 +177,45 @@ EXPORT_SYMBOL(acpi_install_fixed_event_handler); ******************************************************************************/ acpi_status -acpi_remove_fixed_event_handler ( - u32 event, - acpi_event_handler handler) +acpi_remove_fixed_event_handler(u32 event, acpi_event_handler handler) { - acpi_status status = AE_OK; - - - ACPI_FUNCTION_TRACE ("acpi_remove_fixed_event_handler"); + acpi_status status = AE_OK; + ACPI_FUNCTION_TRACE("acpi_remove_fixed_event_handler"); /* Parameter validation */ if (event > ACPI_EVENT_MAX) { - return_ACPI_STATUS (AE_BAD_PARAMETER); + return_ACPI_STATUS(AE_BAD_PARAMETER); } - status = acpi_ut_acquire_mutex (ACPI_MTX_EVENTS); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* Disable the event before removing the handler */ - status = acpi_disable_event (event, 0); + status = acpi_disable_event(event, 0); /* Always Remove the handler */ acpi_gbl_fixed_event_handlers[event].handler = NULL; acpi_gbl_fixed_event_handlers[event].context = NULL; - if (ACPI_FAILURE (status)) { - ACPI_DEBUG_PRINT ((ACPI_DB_WARN, - "Could not write to fixed event enable register.\n")); - } - else { - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Disabled fixed event %X.\n", event)); + if (ACPI_FAILURE(status)) { + ACPI_DEBUG_PRINT((ACPI_DB_WARN, + "Could not write to fixed event enable register.\n")); + } else { + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Disabled fixed event %X.\n", + event)); } - (void) acpi_ut_release_mutex (ACPI_MTX_EVENTS); - return_ACPI_STATUS (status); + (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS); + return_ACPI_STATUS(status); } -EXPORT_SYMBOL(acpi_remove_fixed_event_handler); +EXPORT_SYMBOL(acpi_remove_fixed_event_handler); /******************************************************************************* * @@ -251,37 +236,32 @@ EXPORT_SYMBOL(acpi_remove_fixed_event_handler); ******************************************************************************/ acpi_status -acpi_install_notify_handler ( - acpi_handle device, - u32 handler_type, - acpi_notify_handler handler, - void *context) +acpi_install_notify_handler(acpi_handle device, + u32 handler_type, + acpi_notify_handler handler, void *context) { - union acpi_operand_object *obj_desc; - union acpi_operand_object *notify_obj; - struct acpi_namespace_node *node; - acpi_status status; - - - ACPI_FUNCTION_TRACE ("acpi_install_notify_handler"); + union acpi_operand_object *obj_desc; + union acpi_operand_object *notify_obj; + struct acpi_namespace_node *node; + acpi_status status; + ACPI_FUNCTION_TRACE("acpi_install_notify_handler"); /* Parameter validation */ - if ((!device) || - (!handler) || - (handler_type > ACPI_MAX_NOTIFY_HANDLER_TYPE)) { - return_ACPI_STATUS (AE_BAD_PARAMETER); + if ((!device) || + (!handler) || (handler_type > ACPI_MAX_NOTIFY_HANDLER_TYPE)) { + return_ACPI_STATUS(AE_BAD_PARAMETER); } - status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* Convert and validate the device handle */ - node = acpi_ns_map_handle_to_node (device); + node = acpi_ns_map_handle_to_node(device); if (!node) { status = AE_BAD_PARAMETER; goto unlock_and_exit; @@ -297,21 +277,21 @@ acpi_install_notify_handler ( /* Make sure the handler is not already installed */ if (((handler_type & ACPI_SYSTEM_NOTIFY) && - acpi_gbl_system_notify.handler) || - ((handler_type & ACPI_DEVICE_NOTIFY) && - acpi_gbl_device_notify.handler)) { + acpi_gbl_system_notify.handler) || + ((handler_type & ACPI_DEVICE_NOTIFY) && + acpi_gbl_device_notify.handler)) { status = AE_ALREADY_EXISTS; goto unlock_and_exit; } if (handler_type & ACPI_SYSTEM_NOTIFY) { - acpi_gbl_system_notify.node = node; + acpi_gbl_system_notify.node = node; acpi_gbl_system_notify.handler = handler; acpi_gbl_system_notify.context = context; } if (handler_type & ACPI_DEVICE_NOTIFY) { - acpi_gbl_device_notify.node = node; + acpi_gbl_device_notify.node = node; acpi_gbl_device_notify.handler = handler; acpi_gbl_device_notify.context = context; } @@ -327,29 +307,28 @@ acpi_install_notify_handler ( else { /* Notifies allowed on this object? */ - if (!acpi_ev_is_notify_object (node)) { + if (!acpi_ev_is_notify_object(node)) { status = AE_TYPE; goto unlock_and_exit; } /* Check for an existing internal object */ - obj_desc = acpi_ns_get_attached_object (node); + obj_desc = acpi_ns_get_attached_object(node); if (obj_desc) { /* Object exists - make sure there's no handler */ if (((handler_type & ACPI_SYSTEM_NOTIFY) && - obj_desc->common_notify.system_notify) || - ((handler_type & ACPI_DEVICE_NOTIFY) && - obj_desc->common_notify.device_notify)) { + obj_desc->common_notify.system_notify) || + ((handler_type & ACPI_DEVICE_NOTIFY) && + obj_desc->common_notify.device_notify)) { status = AE_ALREADY_EXISTS; goto unlock_and_exit; } - } - else { + } else { /* Create a new object */ - obj_desc = acpi_ut_create_internal_object (node->type); + obj_desc = acpi_ut_create_internal_object(node->type); if (!obj_desc) { status = AE_NO_MEMORY; goto unlock_and_exit; @@ -357,25 +336,27 @@ acpi_install_notify_handler ( /* Attach new object to the Node */ - status = acpi_ns_attach_object (device, obj_desc, node->type); + status = + acpi_ns_attach_object(device, obj_desc, node->type); /* Remove local reference to the object */ - acpi_ut_remove_reference (obj_desc); - if (ACPI_FAILURE (status)) { + acpi_ut_remove_reference(obj_desc); + if (ACPI_FAILURE(status)) { goto unlock_and_exit; } } /* Install the handler */ - notify_obj = acpi_ut_create_internal_object (ACPI_TYPE_LOCAL_NOTIFY); + notify_obj = + acpi_ut_create_internal_object(ACPI_TYPE_LOCAL_NOTIFY); if (!notify_obj) { status = AE_NO_MEMORY; goto unlock_and_exit; } - notify_obj->notify.node = node; + notify_obj->notify.node = node; notify_obj->notify.handler = handler; notify_obj->notify.context = context; @@ -390,17 +371,16 @@ acpi_install_notify_handler ( if (handler_type == ACPI_ALL_NOTIFY) { /* Extra ref if installed in both */ - acpi_ut_add_reference (notify_obj); + acpi_ut_add_reference(notify_obj); } } - -unlock_and_exit: - (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); - return_ACPI_STATUS (status); + unlock_and_exit: + (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); + return_ACPI_STATUS(status); } -EXPORT_SYMBOL(acpi_install_notify_handler); +EXPORT_SYMBOL(acpi_install_notify_handler); /******************************************************************************* * @@ -420,36 +400,31 @@ EXPORT_SYMBOL(acpi_install_notify_handler); ******************************************************************************/ acpi_status -acpi_remove_notify_handler ( - acpi_handle device, - u32 handler_type, - acpi_notify_handler handler) +acpi_remove_notify_handler(acpi_handle device, + u32 handler_type, acpi_notify_handler handler) { - union acpi_operand_object *notify_obj; - union acpi_operand_object *obj_desc; - struct acpi_namespace_node *node; - acpi_status status; - - - ACPI_FUNCTION_TRACE ("acpi_remove_notify_handler"); + union acpi_operand_object *notify_obj; + union acpi_operand_object *obj_desc; + struct acpi_namespace_node *node; + acpi_status status; + ACPI_FUNCTION_TRACE("acpi_remove_notify_handler"); /* Parameter validation */ - if ((!device) || - (!handler) || - (handler_type > ACPI_MAX_NOTIFY_HANDLER_TYPE)) { - return_ACPI_STATUS (AE_BAD_PARAMETER); + if ((!device) || + (!handler) || (handler_type > ACPI_MAX_NOTIFY_HANDLER_TYPE)) { + return_ACPI_STATUS(AE_BAD_PARAMETER); } - status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* Convert and validate the device handle */ - node = acpi_ns_map_handle_to_node (device); + node = acpi_ns_map_handle_to_node(device); if (!node) { status = AE_BAD_PARAMETER; goto unlock_and_exit; @@ -458,34 +433,34 @@ acpi_remove_notify_handler ( /* Root Object */ if (device == ACPI_ROOT_OBJECT) { - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "Removing notify handler for ROOT object.\n")); + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "Removing notify handler for ROOT object.\n")); if (((handler_type & ACPI_SYSTEM_NOTIFY) && - !acpi_gbl_system_notify.handler) || - ((handler_type & ACPI_DEVICE_NOTIFY) && - !acpi_gbl_device_notify.handler)) { + !acpi_gbl_system_notify.handler) || + ((handler_type & ACPI_DEVICE_NOTIFY) && + !acpi_gbl_device_notify.handler)) { status = AE_NOT_EXIST; goto unlock_and_exit; } /* Make sure all deferred tasks are completed */ - (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); + (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); acpi_os_wait_events_complete(NULL); - status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); - } + status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); + } if (handler_type & ACPI_SYSTEM_NOTIFY) { - acpi_gbl_system_notify.node = NULL; + acpi_gbl_system_notify.node = NULL; acpi_gbl_system_notify.handler = NULL; acpi_gbl_system_notify.context = NULL; } if (handler_type & ACPI_DEVICE_NOTIFY) { - acpi_gbl_device_notify.node = NULL; + acpi_gbl_device_notify.node = NULL; acpi_gbl_device_notify.handler = NULL; acpi_gbl_device_notify.context = NULL; } @@ -496,14 +471,14 @@ acpi_remove_notify_handler ( else { /* Notifies allowed on this object? */ - if (!acpi_ev_is_notify_object (node)) { + if (!acpi_ev_is_notify_object(node)) { status = AE_TYPE; goto unlock_and_exit; } /* Check for an existing internal object */ - obj_desc = acpi_ns_get_attached_object (node); + obj_desc = acpi_ns_get_attached_object(node); if (!obj_desc) { status = AE_NOT_EXIST; goto unlock_and_exit; @@ -514,53 +489,52 @@ acpi_remove_notify_handler ( if (handler_type & ACPI_SYSTEM_NOTIFY) { notify_obj = obj_desc->common_notify.system_notify; if ((!notify_obj) || - (notify_obj->notify.handler != handler)) { + (notify_obj->notify.handler != handler)) { status = AE_BAD_PARAMETER; goto unlock_and_exit; } /* Make sure all deferred tasks are completed */ - (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); + (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); acpi_os_wait_events_complete(NULL); - status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); - } + status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); + } /* Remove the handler */ obj_desc->common_notify.system_notify = NULL; - acpi_ut_remove_reference (notify_obj); + acpi_ut_remove_reference(notify_obj); } if (handler_type & ACPI_DEVICE_NOTIFY) { notify_obj = obj_desc->common_notify.device_notify; if ((!notify_obj) || - (notify_obj->notify.handler != handler)) { + (notify_obj->notify.handler != handler)) { status = AE_BAD_PARAMETER; goto unlock_and_exit; } /* Make sure all deferred tasks are completed */ - (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); + (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); acpi_os_wait_events_complete(NULL); - status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); - } + status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); + } /* Remove the handler */ obj_desc->common_notify.device_notify = NULL; - acpi_ut_remove_reference (notify_obj); + acpi_ut_remove_reference(notify_obj); } } - -unlock_and_exit: - (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); - return_ACPI_STATUS (status); + unlock_and_exit: + (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); + return_ACPI_STATUS(status); } -EXPORT_SYMBOL(acpi_remove_notify_handler); +EXPORT_SYMBOL(acpi_remove_notify_handler); /******************************************************************************* * @@ -581,36 +555,31 @@ EXPORT_SYMBOL(acpi_remove_notify_handler); ******************************************************************************/ acpi_status -acpi_install_gpe_handler ( - acpi_handle gpe_device, - u32 gpe_number, - u32 type, - acpi_event_handler address, - void *context) +acpi_install_gpe_handler(acpi_handle gpe_device, + u32 gpe_number, + u32 type, acpi_event_handler address, void *context) { - struct acpi_gpe_event_info *gpe_event_info; - struct acpi_handler_info *handler; - acpi_status status; - u32 flags; - - - ACPI_FUNCTION_TRACE ("acpi_install_gpe_handler"); + struct acpi_gpe_event_info *gpe_event_info; + struct acpi_handler_info *handler; + acpi_status status; + u32 flags; + ACPI_FUNCTION_TRACE("acpi_install_gpe_handler"); /* Parameter validation */ if ((!address) || (type > ACPI_GPE_XRUPT_TYPE_MASK)) { - return_ACPI_STATUS (AE_BAD_PARAMETER); + return_ACPI_STATUS(AE_BAD_PARAMETER); } - status = acpi_ut_acquire_mutex (ACPI_MTX_EVENTS); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* Ensure that we have a valid GPE number */ - gpe_event_info = acpi_ev_get_gpe_event_info (gpe_device, gpe_number); + gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number); if (!gpe_event_info) { status = AE_BAD_PARAMETER; goto unlock_and_exit; @@ -618,49 +587,49 @@ acpi_install_gpe_handler ( /* Make sure that there isn't a handler there already */ - if ((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) == ACPI_GPE_DISPATCH_HANDLER) { + if ((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) == + ACPI_GPE_DISPATCH_HANDLER) { status = AE_ALREADY_EXISTS; goto unlock_and_exit; } /* Allocate and init handler object */ - handler = ACPI_MEM_CALLOCATE (sizeof (struct acpi_handler_info)); + handler = ACPI_MEM_CALLOCATE(sizeof(struct acpi_handler_info)); if (!handler) { status = AE_NO_MEMORY; goto unlock_and_exit; } - handler->address = address; - handler->context = context; + handler->address = address; + handler->context = context; handler->method_node = gpe_event_info->dispatch.method_node; /* Disable the GPE before installing the handler */ - status = acpi_ev_disable_gpe (gpe_event_info); - if (ACPI_FAILURE (status)) { + status = acpi_ev_disable_gpe(gpe_event_info); + if (ACPI_FAILURE(status)) { goto unlock_and_exit; } /* Install the handler */ - flags = acpi_os_acquire_lock (acpi_gbl_gpe_lock); + flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock); gpe_event_info->dispatch.handler = handler; /* Setup up dispatch flags to indicate handler (vs. method) */ - gpe_event_info->flags &= ~(ACPI_GPE_XRUPT_TYPE_MASK | ACPI_GPE_DISPATCH_MASK); /* Clear bits */ + gpe_event_info->flags &= ~(ACPI_GPE_XRUPT_TYPE_MASK | ACPI_GPE_DISPATCH_MASK); /* Clear bits */ gpe_event_info->flags |= (u8) (type | ACPI_GPE_DISPATCH_HANDLER); - acpi_os_release_lock (acpi_gbl_gpe_lock, flags); - + acpi_os_release_lock(acpi_gbl_gpe_lock, flags); -unlock_and_exit: - (void) acpi_ut_release_mutex (ACPI_MTX_EVENTS); - return_ACPI_STATUS (status); + unlock_and_exit: + (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS); + return_ACPI_STATUS(status); } -EXPORT_SYMBOL(acpi_install_gpe_handler); +EXPORT_SYMBOL(acpi_install_gpe_handler); /******************************************************************************* * @@ -678,34 +647,30 @@ EXPORT_SYMBOL(acpi_install_gpe_handler); ******************************************************************************/ acpi_status -acpi_remove_gpe_handler ( - acpi_handle gpe_device, - u32 gpe_number, - acpi_event_handler address) +acpi_remove_gpe_handler(acpi_handle gpe_device, + u32 gpe_number, acpi_event_handler address) { - struct acpi_gpe_event_info *gpe_event_info; - struct acpi_handler_info *handler; - acpi_status status; - u32 flags; - - - ACPI_FUNCTION_TRACE ("acpi_remove_gpe_handler"); + struct acpi_gpe_event_info *gpe_event_info; + struct acpi_handler_info *handler; + acpi_status status; + u32 flags; + ACPI_FUNCTION_TRACE("acpi_remove_gpe_handler"); /* Parameter validation */ if (!address) { - return_ACPI_STATUS (AE_BAD_PARAMETER); + return_ACPI_STATUS(AE_BAD_PARAMETER); } - status = acpi_ut_acquire_mutex (ACPI_MTX_EVENTS); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* Ensure that we have a valid GPE number */ - gpe_event_info = acpi_ev_get_gpe_event_info (gpe_device, gpe_number); + gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number); if (!gpe_event_info) { status = AE_BAD_PARAMETER; goto unlock_and_exit; @@ -713,7 +678,8 @@ acpi_remove_gpe_handler ( /* Make sure that a handler is indeed installed */ - if ((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) != ACPI_GPE_DISPATCH_HANDLER) { + if ((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) != + ACPI_GPE_DISPATCH_HANDLER) { status = AE_NOT_EXIST; goto unlock_and_exit; } @@ -727,45 +693,44 @@ acpi_remove_gpe_handler ( /* Disable the GPE before removing the handler */ - status = acpi_ev_disable_gpe (gpe_event_info); - if (ACPI_FAILURE (status)) { + status = acpi_ev_disable_gpe(gpe_event_info); + if (ACPI_FAILURE(status)) { goto unlock_and_exit; } /* Make sure all deferred tasks are completed */ - (void) acpi_ut_release_mutex (ACPI_MTX_EVENTS); + (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS); acpi_os_wait_events_complete(NULL); - status = acpi_ut_acquire_mutex (ACPI_MTX_EVENTS); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); - } + status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); + } /* Remove the handler */ - flags = acpi_os_acquire_lock (acpi_gbl_gpe_lock); + flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock); handler = gpe_event_info->dispatch.handler; /* Restore Method node (if any), set dispatch flags */ gpe_event_info->dispatch.method_node = handler->method_node; - gpe_event_info->flags &= ~ACPI_GPE_DISPATCH_MASK; /* Clear bits */ + gpe_event_info->flags &= ~ACPI_GPE_DISPATCH_MASK; /* Clear bits */ if (handler->method_node) { gpe_event_info->flags |= ACPI_GPE_DISPATCH_METHOD; } - acpi_os_release_lock (acpi_gbl_gpe_lock, flags); + acpi_os_release_lock(acpi_gbl_gpe_lock, flags); /* Now we can free the handler object */ - ACPI_MEM_FREE (handler); + ACPI_MEM_FREE(handler); - -unlock_and_exit: - (void) acpi_ut_release_mutex (ACPI_MTX_EVENTS); - return_ACPI_STATUS (status); + unlock_and_exit: + (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS); + return_ACPI_STATUS(status); } -EXPORT_SYMBOL(acpi_remove_gpe_handler); +EXPORT_SYMBOL(acpi_remove_gpe_handler); /******************************************************************************* * @@ -781,35 +746,31 @@ EXPORT_SYMBOL(acpi_remove_gpe_handler); * ******************************************************************************/ -acpi_status -acpi_acquire_global_lock ( - u16 timeout, - u32 *handle) +acpi_status acpi_acquire_global_lock(u16 timeout, u32 * handle) { - acpi_status status; - + acpi_status status; if (!handle) { return (AE_BAD_PARAMETER); } - status = acpi_ex_enter_interpreter (); - if (ACPI_FAILURE (status)) { + status = acpi_ex_enter_interpreter(); + if (ACPI_FAILURE(status)) { return (status); } - status = acpi_ev_acquire_global_lock (timeout); - acpi_ex_exit_interpreter (); + status = acpi_ev_acquire_global_lock(timeout); + acpi_ex_exit_interpreter(); - if (ACPI_SUCCESS (status)) { + if (ACPI_SUCCESS(status)) { acpi_gbl_global_lock_handle++; *handle = acpi_gbl_global_lock_handle; } return (status); } -EXPORT_SYMBOL(acpi_acquire_global_lock); +EXPORT_SYMBOL(acpi_acquire_global_lock); /******************************************************************************* * @@ -823,19 +784,16 @@ EXPORT_SYMBOL(acpi_acquire_global_lock); * ******************************************************************************/ -acpi_status -acpi_release_global_lock ( - u32 handle) +acpi_status acpi_release_global_lock(u32 handle) { - acpi_status status; - + acpi_status status; if (handle != acpi_gbl_global_lock_handle) { return (AE_NOT_ACQUIRED); } - status = acpi_ev_release_global_lock (); + status = acpi_ev_release_global_lock(); return (status); } -EXPORT_SYMBOL(acpi_release_global_lock); +EXPORT_SYMBOL(acpi_release_global_lock); diff --git a/drivers/acpi/events/evxfevnt.c b/drivers/acpi/events/evxfevnt.c index c5f74d7b64d..887ff9f28a0 100644 --- a/drivers/acpi/events/evxfevnt.c +++ b/drivers/acpi/events/evxfevnt.c @@ -48,8 +48,7 @@ #include #define _COMPONENT ACPI_EVENTS - ACPI_MODULE_NAME ("evxfevnt") - +ACPI_MODULE_NAME("evxfevnt") /******************************************************************************* * @@ -62,44 +61,39 @@ * DESCRIPTION: Transfers the system into ACPI mode. * ******************************************************************************/ - -acpi_status -acpi_enable ( - void) +acpi_status acpi_enable(void) { - acpi_status status = AE_OK; - + acpi_status status = AE_OK; - ACPI_FUNCTION_TRACE ("acpi_enable"); + ACPI_FUNCTION_TRACE("acpi_enable"); - - /* Make sure we have the FADT*/ + /* Make sure we have the FADT */ if (!acpi_gbl_FADT) { - ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "No FADT information present!\n")); - return_ACPI_STATUS (AE_NO_ACPI_TABLES); + ACPI_DEBUG_PRINT((ACPI_DB_WARN, + "No FADT information present!\n")); + return_ACPI_STATUS(AE_NO_ACPI_TABLES); } if (acpi_hw_get_mode() == ACPI_SYS_MODE_ACPI) { - ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "System is already in ACPI mode\n")); - } - else { + ACPI_DEBUG_PRINT((ACPI_DB_INIT, + "System is already in ACPI mode\n")); + } else { /* Transition to ACPI mode */ - status = acpi_hw_set_mode (ACPI_SYS_MODE_ACPI); - if (ACPI_FAILURE (status)) { - ACPI_REPORT_ERROR (("Could not transition to ACPI mode.\n")); - return_ACPI_STATUS (status); + status = acpi_hw_set_mode(ACPI_SYS_MODE_ACPI); + if (ACPI_FAILURE(status)) { + ACPI_REPORT_ERROR(("Could not transition to ACPI mode.\n")); + return_ACPI_STATUS(status); } - ACPI_DEBUG_PRINT ((ACPI_DB_INIT, - "Transition to ACPI mode successful\n")); + ACPI_DEBUG_PRINT((ACPI_DB_INIT, + "Transition to ACPI mode successful\n")); } - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_disable @@ -112,43 +106,38 @@ acpi_enable ( * ******************************************************************************/ -acpi_status -acpi_disable ( - void) +acpi_status acpi_disable(void) { - acpi_status status = AE_OK; - - - ACPI_FUNCTION_TRACE ("acpi_disable"); + acpi_status status = AE_OK; + ACPI_FUNCTION_TRACE("acpi_disable"); if (!acpi_gbl_FADT) { - ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "No FADT information present!\n")); - return_ACPI_STATUS (AE_NO_ACPI_TABLES); + ACPI_DEBUG_PRINT((ACPI_DB_WARN, + "No FADT information present!\n")); + return_ACPI_STATUS(AE_NO_ACPI_TABLES); } if (acpi_hw_get_mode() == ACPI_SYS_MODE_LEGACY) { - ACPI_DEBUG_PRINT ((ACPI_DB_INIT, - "System is already in legacy (non-ACPI) mode\n")); - } - else { + ACPI_DEBUG_PRINT((ACPI_DB_INIT, + "System is already in legacy (non-ACPI) mode\n")); + } else { /* Transition to LEGACY mode */ - status = acpi_hw_set_mode (ACPI_SYS_MODE_LEGACY); + status = acpi_hw_set_mode(ACPI_SYS_MODE_LEGACY); - if (ACPI_FAILURE (status)) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Could not exit ACPI mode to legacy mode")); - return_ACPI_STATUS (status); + if (ACPI_FAILURE(status)) { + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Could not exit ACPI mode to legacy mode")); + return_ACPI_STATUS(status); } - ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "ACPI mode disabled\n")); + ACPI_DEBUG_PRINT((ACPI_DB_INIT, "ACPI mode disabled\n")); } - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_enable_event @@ -162,52 +151,50 @@ acpi_disable ( * ******************************************************************************/ -acpi_status -acpi_enable_event ( - u32 event, - u32 flags) +acpi_status acpi_enable_event(u32 event, u32 flags) { - acpi_status status = AE_OK; - u32 value; - - - ACPI_FUNCTION_TRACE ("acpi_enable_event"); + acpi_status status = AE_OK; + u32 value; + ACPI_FUNCTION_TRACE("acpi_enable_event"); /* Decode the Fixed Event */ if (event > ACPI_EVENT_MAX) { - return_ACPI_STATUS (AE_BAD_PARAMETER); + return_ACPI_STATUS(AE_BAD_PARAMETER); } /* * Enable the requested fixed event (by writing a one to the * enable register bit) */ - status = acpi_set_register (acpi_gbl_fixed_event_info[event].enable_register_id, - 1, ACPI_MTX_LOCK); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = + acpi_set_register(acpi_gbl_fixed_event_info[event]. + enable_register_id, 1, ACPI_MTX_LOCK); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* Make sure that the hardware responded */ - status = acpi_get_register (acpi_gbl_fixed_event_info[event].enable_register_id, - &value, ACPI_MTX_LOCK); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = + acpi_get_register(acpi_gbl_fixed_event_info[event]. + enable_register_id, &value, ACPI_MTX_LOCK); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } if (value != 1) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Could not enable %s event\n", acpi_ut_get_event_name (event))); - return_ACPI_STATUS (AE_NO_HARDWARE_RESPONSE); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Could not enable %s event\n", + acpi_ut_get_event_name(event))); + return_ACPI_STATUS(AE_NO_HARDWARE_RESPONSE); } - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } -EXPORT_SYMBOL(acpi_enable_event); +EXPORT_SYMBOL(acpi_enable_event); /******************************************************************************* * @@ -223,40 +210,34 @@ EXPORT_SYMBOL(acpi_enable_event); * ******************************************************************************/ -acpi_status -acpi_set_gpe_type ( - acpi_handle gpe_device, - u32 gpe_number, - u8 type) +acpi_status acpi_set_gpe_type(acpi_handle gpe_device, u32 gpe_number, u8 type) { - acpi_status status = AE_OK; - struct acpi_gpe_event_info *gpe_event_info; - - - ACPI_FUNCTION_TRACE ("acpi_set_gpe_type"); + acpi_status status = AE_OK; + struct acpi_gpe_event_info *gpe_event_info; + ACPI_FUNCTION_TRACE("acpi_set_gpe_type"); /* Ensure that we have a valid GPE number */ - gpe_event_info = acpi_ev_get_gpe_event_info (gpe_device, gpe_number); + gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number); if (!gpe_event_info) { status = AE_BAD_PARAMETER; goto unlock_and_exit; } if ((gpe_event_info->flags & ACPI_GPE_TYPE_MASK) == type) { - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } /* Set the new type (will disable GPE if currently enabled) */ - status = acpi_ev_set_gpe_type (gpe_event_info, type); + status = acpi_ev_set_gpe_type(gpe_event_info, type); -unlock_and_exit: - return_ACPI_STATUS (status); + unlock_and_exit: + return_ACPI_STATUS(status); } -EXPORT_SYMBOL(acpi_set_gpe_type); +EXPORT_SYMBOL(acpi_set_gpe_type); /******************************************************************************* * @@ -273,31 +254,25 @@ EXPORT_SYMBOL(acpi_set_gpe_type); * ******************************************************************************/ -acpi_status -acpi_enable_gpe ( - acpi_handle gpe_device, - u32 gpe_number, - u32 flags) +acpi_status acpi_enable_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags) { - acpi_status status = AE_OK; - struct acpi_gpe_event_info *gpe_event_info; - - - ACPI_FUNCTION_TRACE ("acpi_enable_gpe"); + acpi_status status = AE_OK; + struct acpi_gpe_event_info *gpe_event_info; + ACPI_FUNCTION_TRACE("acpi_enable_gpe"); /* Use semaphore lock if not executing at interrupt level */ if (flags & ACPI_NOT_ISR) { - status = acpi_ut_acquire_mutex (ACPI_MTX_EVENTS); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } } /* Ensure that we have a valid GPE number */ - gpe_event_info = acpi_ev_get_gpe_event_info (gpe_device, gpe_number); + gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number); if (!gpe_event_info) { status = AE_BAD_PARAMETER; goto unlock_and_exit; @@ -305,16 +280,16 @@ acpi_enable_gpe ( /* Perform the enable */ - status = acpi_ev_enable_gpe (gpe_event_info, TRUE); + status = acpi_ev_enable_gpe(gpe_event_info, TRUE); -unlock_and_exit: + unlock_and_exit: if (flags & ACPI_NOT_ISR) { - (void) acpi_ut_release_mutex (ACPI_MTX_EVENTS); + (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS); } - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } -EXPORT_SYMBOL(acpi_enable_gpe); +EXPORT_SYMBOL(acpi_enable_gpe); /******************************************************************************* * @@ -331,46 +306,39 @@ EXPORT_SYMBOL(acpi_enable_gpe); * ******************************************************************************/ -acpi_status -acpi_disable_gpe ( - acpi_handle gpe_device, - u32 gpe_number, - u32 flags) +acpi_status acpi_disable_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags) { - acpi_status status = AE_OK; - struct acpi_gpe_event_info *gpe_event_info; - - - ACPI_FUNCTION_TRACE ("acpi_disable_gpe"); + acpi_status status = AE_OK; + struct acpi_gpe_event_info *gpe_event_info; + ACPI_FUNCTION_TRACE("acpi_disable_gpe"); /* Use semaphore lock if not executing at interrupt level */ if (flags & ACPI_NOT_ISR) { - status = acpi_ut_acquire_mutex (ACPI_MTX_EVENTS); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } } /* Ensure that we have a valid GPE number */ - gpe_event_info = acpi_ev_get_gpe_event_info (gpe_device, gpe_number); + gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number); if (!gpe_event_info) { status = AE_BAD_PARAMETER; goto unlock_and_exit; } - status = acpi_ev_disable_gpe (gpe_event_info); + status = acpi_ev_disable_gpe(gpe_event_info); -unlock_and_exit: + unlock_and_exit: if (flags & ACPI_NOT_ISR) { - (void) acpi_ut_release_mutex (ACPI_MTX_EVENTS); + (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS); } - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_disable_event @@ -384,50 +352,48 @@ unlock_and_exit: * ******************************************************************************/ -acpi_status -acpi_disable_event ( - u32 event, - u32 flags) +acpi_status acpi_disable_event(u32 event, u32 flags) { - acpi_status status = AE_OK; - u32 value; - - - ACPI_FUNCTION_TRACE ("acpi_disable_event"); + acpi_status status = AE_OK; + u32 value; + ACPI_FUNCTION_TRACE("acpi_disable_event"); /* Decode the Fixed Event */ if (event > ACPI_EVENT_MAX) { - return_ACPI_STATUS (AE_BAD_PARAMETER); + return_ACPI_STATUS(AE_BAD_PARAMETER); } /* * Disable the requested fixed event (by writing a zero to the * enable register bit) */ - status = acpi_set_register (acpi_gbl_fixed_event_info[event].enable_register_id, - 0, ACPI_MTX_LOCK); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = + acpi_set_register(acpi_gbl_fixed_event_info[event]. + enable_register_id, 0, ACPI_MTX_LOCK); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } - status = acpi_get_register (acpi_gbl_fixed_event_info[event].enable_register_id, - &value, ACPI_MTX_LOCK); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = + acpi_get_register(acpi_gbl_fixed_event_info[event]. + enable_register_id, &value, ACPI_MTX_LOCK); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } if (value != 0) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Could not disable %s events\n", acpi_ut_get_event_name (event))); - return_ACPI_STATUS (AE_NO_HARDWARE_RESPONSE); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Could not disable %s events\n", + acpi_ut_get_event_name(event))); + return_ACPI_STATUS(AE_NO_HARDWARE_RESPONSE); } - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } -EXPORT_SYMBOL(acpi_disable_event); +EXPORT_SYMBOL(acpi_disable_event); /******************************************************************************* * @@ -441,33 +407,30 @@ EXPORT_SYMBOL(acpi_disable_event); * ******************************************************************************/ -acpi_status -acpi_clear_event ( - u32 event) +acpi_status acpi_clear_event(u32 event) { - acpi_status status = AE_OK; - - - ACPI_FUNCTION_TRACE ("acpi_clear_event"); + acpi_status status = AE_OK; + ACPI_FUNCTION_TRACE("acpi_clear_event"); /* Decode the Fixed Event */ if (event > ACPI_EVENT_MAX) { - return_ACPI_STATUS (AE_BAD_PARAMETER); + return_ACPI_STATUS(AE_BAD_PARAMETER); } /* * Clear the requested fixed event (By writing a one to the * status register bit) */ - status = acpi_set_register (acpi_gbl_fixed_event_info[event].status_register_id, - 1, ACPI_MTX_LOCK); + status = + acpi_set_register(acpi_gbl_fixed_event_info[event]. + status_register_id, 1, ACPI_MTX_LOCK); - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } -EXPORT_SYMBOL(acpi_clear_event); +EXPORT_SYMBOL(acpi_clear_event); /******************************************************************************* * @@ -483,46 +446,39 @@ EXPORT_SYMBOL(acpi_clear_event); * ******************************************************************************/ -acpi_status -acpi_clear_gpe ( - acpi_handle gpe_device, - u32 gpe_number, - u32 flags) +acpi_status acpi_clear_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags) { - acpi_status status = AE_OK; - struct acpi_gpe_event_info *gpe_event_info; - - - ACPI_FUNCTION_TRACE ("acpi_clear_gpe"); + acpi_status status = AE_OK; + struct acpi_gpe_event_info *gpe_event_info; + ACPI_FUNCTION_TRACE("acpi_clear_gpe"); /* Use semaphore lock if not executing at interrupt level */ if (flags & ACPI_NOT_ISR) { - status = acpi_ut_acquire_mutex (ACPI_MTX_EVENTS); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } } /* Ensure that we have a valid GPE number */ - gpe_event_info = acpi_ev_get_gpe_event_info (gpe_device, gpe_number); + gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number); if (!gpe_event_info) { status = AE_BAD_PARAMETER; goto unlock_and_exit; } - status = acpi_hw_clear_gpe (gpe_event_info); + status = acpi_hw_clear_gpe(gpe_event_info); -unlock_and_exit: + unlock_and_exit: if (flags & ACPI_NOT_ISR) { - (void) acpi_ut_release_mutex (ACPI_MTX_EVENTS); + (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS); } - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - #ifdef ACPI_FUTURE_USAGE /******************************************************************************* * @@ -538,36 +494,31 @@ unlock_and_exit: * ******************************************************************************/ -acpi_status -acpi_get_event_status ( - u32 event, - acpi_event_status *event_status) +acpi_status acpi_get_event_status(u32 event, acpi_event_status * event_status) { - acpi_status status = AE_OK; - - - ACPI_FUNCTION_TRACE ("acpi_get_event_status"); + acpi_status status = AE_OK; + ACPI_FUNCTION_TRACE("acpi_get_event_status"); if (!event_status) { - return_ACPI_STATUS (AE_BAD_PARAMETER); + return_ACPI_STATUS(AE_BAD_PARAMETER); } /* Decode the Fixed Event */ if (event > ACPI_EVENT_MAX) { - return_ACPI_STATUS (AE_BAD_PARAMETER); + return_ACPI_STATUS(AE_BAD_PARAMETER); } /* Get the status of the requested fixed event */ - status = acpi_get_register (acpi_gbl_fixed_event_info[event].status_register_id, - event_status, ACPI_MTX_LOCK); + status = + acpi_get_register(acpi_gbl_fixed_event_info[event]. + status_register_id, event_status, ACPI_MTX_LOCK); - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_get_gpe_status @@ -585,31 +536,26 @@ acpi_get_event_status ( ******************************************************************************/ acpi_status -acpi_get_gpe_status ( - acpi_handle gpe_device, - u32 gpe_number, - u32 flags, - acpi_event_status *event_status) +acpi_get_gpe_status(acpi_handle gpe_device, + u32 gpe_number, u32 flags, acpi_event_status * event_status) { - acpi_status status = AE_OK; - struct acpi_gpe_event_info *gpe_event_info; - - - ACPI_FUNCTION_TRACE ("acpi_get_gpe_status"); + acpi_status status = AE_OK; + struct acpi_gpe_event_info *gpe_event_info; + ACPI_FUNCTION_TRACE("acpi_get_gpe_status"); /* Use semaphore lock if not executing at interrupt level */ if (flags & ACPI_NOT_ISR) { - status = acpi_ut_acquire_mutex (ACPI_MTX_EVENTS); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } } /* Ensure that we have a valid GPE number */ - gpe_event_info = acpi_ev_get_gpe_event_info (gpe_device, gpe_number); + gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number); if (!gpe_event_info) { status = AE_BAD_PARAMETER; goto unlock_and_exit; @@ -617,16 +563,15 @@ acpi_get_gpe_status ( /* Obtain status on the requested GPE number */ - status = acpi_hw_get_gpe_status (gpe_event_info, event_status); + status = acpi_hw_get_gpe_status(gpe_event_info, event_status); -unlock_and_exit: + unlock_and_exit: if (flags & ACPI_NOT_ISR) { - (void) acpi_ut_release_mutex (ACPI_MTX_EVENTS); + (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS); } - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } -#endif /* ACPI_FUTURE_USAGE */ - +#endif /* ACPI_FUTURE_USAGE */ /******************************************************************************* * @@ -644,33 +589,27 @@ unlock_and_exit: ******************************************************************************/ acpi_status -acpi_install_gpe_block ( - acpi_handle gpe_device, - struct acpi_generic_address *gpe_block_address, - u32 register_count, - u32 interrupt_number) +acpi_install_gpe_block(acpi_handle gpe_device, + struct acpi_generic_address *gpe_block_address, + u32 register_count, u32 interrupt_number) { - acpi_status status; - union acpi_operand_object *obj_desc; - struct acpi_namespace_node *node; - struct acpi_gpe_block_info *gpe_block; - + acpi_status status; + union acpi_operand_object *obj_desc; + struct acpi_namespace_node *node; + struct acpi_gpe_block_info *gpe_block; - ACPI_FUNCTION_TRACE ("acpi_install_gpe_block"); + ACPI_FUNCTION_TRACE("acpi_install_gpe_block"); - - if ((!gpe_device) || - (!gpe_block_address) || - (!register_count)) { - return_ACPI_STATUS (AE_BAD_PARAMETER); + if ((!gpe_device) || (!gpe_block_address) || (!register_count)) { + return_ACPI_STATUS(AE_BAD_PARAMETER); } - status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (status)) { + status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE(status)) { return (status); } - node = acpi_ns_map_handle_to_node (gpe_device); + node = acpi_ns_map_handle_to_node(gpe_device); if (!node) { status = AE_BAD_PARAMETER; goto unlock_and_exit; @@ -680,31 +619,33 @@ acpi_install_gpe_block ( * For user-installed GPE Block Devices, the gpe_block_base_number * is always zero */ - status = acpi_ev_create_gpe_block (node, gpe_block_address, register_count, - 0, interrupt_number, &gpe_block); - if (ACPI_FAILURE (status)) { + status = + acpi_ev_create_gpe_block(node, gpe_block_address, register_count, 0, + interrupt_number, &gpe_block); + if (ACPI_FAILURE(status)) { goto unlock_and_exit; } /* Get the device_object attached to the node */ - obj_desc = acpi_ns_get_attached_object (node); + obj_desc = acpi_ns_get_attached_object(node); if (!obj_desc) { /* No object, create a new one */ - obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_DEVICE); + obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_DEVICE); if (!obj_desc) { status = AE_NO_MEMORY; goto unlock_and_exit; } - status = acpi_ns_attach_object (node, obj_desc, ACPI_TYPE_DEVICE); + status = + acpi_ns_attach_object(node, obj_desc, ACPI_TYPE_DEVICE); /* Remove local reference to the object */ - acpi_ut_remove_reference (obj_desc); + acpi_ut_remove_reference(obj_desc); - if (ACPI_FAILURE (status)) { + if (ACPI_FAILURE(status)) { goto unlock_and_exit; } } @@ -713,13 +654,12 @@ acpi_install_gpe_block ( obj_desc->device.gpe_block = gpe_block; - -unlock_and_exit: - (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); - return_ACPI_STATUS (status); + unlock_and_exit: + (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); + return_ACPI_STATUS(status); } -EXPORT_SYMBOL(acpi_install_gpe_block); +EXPORT_SYMBOL(acpi_install_gpe_block); /******************************************************************************* * @@ -733,28 +673,24 @@ EXPORT_SYMBOL(acpi_install_gpe_block); * ******************************************************************************/ -acpi_status -acpi_remove_gpe_block ( - acpi_handle gpe_device) +acpi_status acpi_remove_gpe_block(acpi_handle gpe_device) { - union acpi_operand_object *obj_desc; - acpi_status status; - struct acpi_namespace_node *node; - - - ACPI_FUNCTION_TRACE ("acpi_remove_gpe_block"); + union acpi_operand_object *obj_desc; + acpi_status status; + struct acpi_namespace_node *node; + ACPI_FUNCTION_TRACE("acpi_remove_gpe_block"); if (!gpe_device) { - return_ACPI_STATUS (AE_BAD_PARAMETER); + return_ACPI_STATUS(AE_BAD_PARAMETER); } - status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (status)) { + status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE(status)) { return (status); } - node = acpi_ns_map_handle_to_node (gpe_device); + node = acpi_ns_map_handle_to_node(gpe_device); if (!node) { status = AE_BAD_PARAMETER; goto unlock_and_exit; @@ -762,22 +698,21 @@ acpi_remove_gpe_block ( /* Get the device_object attached to the node */ - obj_desc = acpi_ns_get_attached_object (node); - if (!obj_desc || - !obj_desc->device.gpe_block) { - return_ACPI_STATUS (AE_NULL_OBJECT); + obj_desc = acpi_ns_get_attached_object(node); + if (!obj_desc || !obj_desc->device.gpe_block) { + return_ACPI_STATUS(AE_NULL_OBJECT); } /* Delete the GPE block (but not the device_object) */ - status = acpi_ev_delete_gpe_block (obj_desc->device.gpe_block); - if (ACPI_SUCCESS (status)) { + status = acpi_ev_delete_gpe_block(obj_desc->device.gpe_block); + if (ACPI_SUCCESS(status)) { obj_desc->device.gpe_block = NULL; } -unlock_and_exit: - (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); - return_ACPI_STATUS (status); + unlock_and_exit: + (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); + return_ACPI_STATUS(status); } EXPORT_SYMBOL(acpi_remove_gpe_block); diff --git a/drivers/acpi/events/evxfregn.c b/drivers/acpi/events/evxfregn.c index d058587b342..6f28ea2db5b 100644 --- a/drivers/acpi/events/evxfregn.c +++ b/drivers/acpi/events/evxfregn.c @@ -49,8 +49,7 @@ #include #define _COMPONENT ACPI_EVENTS - ACPI_MODULE_NAME ("evxfregn") - +ACPI_MODULE_NAME("evxfregn") /******************************************************************************* * @@ -67,36 +66,31 @@ * DESCRIPTION: Install a handler for all op_regions of a given space_id. * ******************************************************************************/ - acpi_status -acpi_install_address_space_handler ( - acpi_handle device, - acpi_adr_space_type space_id, - acpi_adr_space_handler handler, - acpi_adr_space_setup setup, - void *context) +acpi_install_address_space_handler(acpi_handle device, + acpi_adr_space_type space_id, + acpi_adr_space_handler handler, + acpi_adr_space_setup setup, void *context) { - struct acpi_namespace_node *node; - acpi_status status; - - - ACPI_FUNCTION_TRACE ("acpi_install_address_space_handler"); + struct acpi_namespace_node *node; + acpi_status status; + ACPI_FUNCTION_TRACE("acpi_install_address_space_handler"); /* Parameter validation */ if (!device) { - return_ACPI_STATUS (AE_BAD_PARAMETER); + return_ACPI_STATUS(AE_BAD_PARAMETER); } - status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* Convert and validate the device handle */ - node = acpi_ns_map_handle_to_node (device); + node = acpi_ns_map_handle_to_node(device); if (!node) { status = AE_BAD_PARAMETER; goto unlock_and_exit; @@ -104,21 +98,23 @@ acpi_install_address_space_handler ( /* Install the handler for all Regions for this Space ID */ - status = acpi_ev_install_space_handler (node, space_id, handler, setup, context); - if (ACPI_FAILURE (status)) { + status = + acpi_ev_install_space_handler(node, space_id, handler, setup, + context); + if (ACPI_FAILURE(status)) { goto unlock_and_exit; } /* Run all _REG methods for this address space */ - status = acpi_ev_execute_reg_methods (node, space_id); + status = acpi_ev_execute_reg_methods(node, space_id); -unlock_and_exit: - (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); - return_ACPI_STATUS (status); + unlock_and_exit: + (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); + return_ACPI_STATUS(status); } -EXPORT_SYMBOL(acpi_install_address_space_handler); +EXPORT_SYMBOL(acpi_install_address_space_handler); /******************************************************************************* * @@ -135,36 +131,33 @@ EXPORT_SYMBOL(acpi_install_address_space_handler); ******************************************************************************/ acpi_status -acpi_remove_address_space_handler ( - acpi_handle device, - acpi_adr_space_type space_id, - acpi_adr_space_handler handler) +acpi_remove_address_space_handler(acpi_handle device, + acpi_adr_space_type space_id, + acpi_adr_space_handler handler) { - union acpi_operand_object *obj_desc; - union acpi_operand_object *handler_obj; - union acpi_operand_object *region_obj; - union acpi_operand_object **last_obj_ptr; - struct acpi_namespace_node *node; - acpi_status status; - - - ACPI_FUNCTION_TRACE ("acpi_remove_address_space_handler"); + union acpi_operand_object *obj_desc; + union acpi_operand_object *handler_obj; + union acpi_operand_object *region_obj; + union acpi_operand_object **last_obj_ptr; + struct acpi_namespace_node *node; + acpi_status status; + ACPI_FUNCTION_TRACE("acpi_remove_address_space_handler"); /* Parameter validation */ if (!device) { - return_ACPI_STATUS (AE_BAD_PARAMETER); + return_ACPI_STATUS(AE_BAD_PARAMETER); } - status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* Convert and validate the device handle */ - node = acpi_ns_map_handle_to_node (device); + node = acpi_ns_map_handle_to_node(device); if (!node) { status = AE_BAD_PARAMETER; goto unlock_and_exit; @@ -172,7 +165,7 @@ acpi_remove_address_space_handler ( /* Make sure the internal object exists */ - obj_desc = acpi_ns_get_attached_object (node); + obj_desc = acpi_ns_get_attached_object(node); if (!obj_desc) { status = AE_NOT_EXIST; goto unlock_and_exit; @@ -188,10 +181,11 @@ acpi_remove_address_space_handler ( if (handler_obj->address_space.space_id == space_id) { /* Matched space_id, first dereference this in the Regions */ - ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION, - "Removing address handler %p(%p) for region %s on Device %p(%p)\n", - handler_obj, handler, acpi_ut_get_region_name (space_id), - node, obj_desc)); + ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, + "Removing address handler %p(%p) for region %s on Device %p(%p)\n", + handler_obj, handler, + acpi_ut_get_region_name(space_id), + node, obj_desc)); region_obj = handler_obj->address_space.region_list; @@ -205,13 +199,14 @@ acpi_remove_address_space_handler ( * The region is just inaccessible as indicated to * the _REG method */ - acpi_ev_detach_region (region_obj, TRUE); + acpi_ev_detach_region(region_obj, TRUE); /* * Walk the list: Just grab the head because the * detach_region removed the previous head. */ - region_obj = handler_obj->address_space.region_list; + region_obj = + handler_obj->address_space.region_list; } @@ -221,7 +216,7 @@ acpi_remove_address_space_handler ( /* Now we can delete the handler object */ - acpi_ut_remove_reference (handler_obj); + acpi_ut_remove_reference(handler_obj); goto unlock_and_exit; } @@ -233,15 +228,16 @@ acpi_remove_address_space_handler ( /* The handler does not exist */ - ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION, - "Unable to remove address handler %p for %s(%X), dev_node %p, obj %p\n", - handler, acpi_ut_get_region_name (space_id), space_id, node, obj_desc)); + ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, + "Unable to remove address handler %p for %s(%X), dev_node %p, obj %p\n", + handler, acpi_ut_get_region_name(space_id), space_id, + node, obj_desc)); status = AE_NOT_EXIST; -unlock_and_exit: - (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); - return_ACPI_STATUS (status); + unlock_and_exit: + (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); + return_ACPI_STATUS(status); } -EXPORT_SYMBOL(acpi_remove_address_space_handler); +EXPORT_SYMBOL(acpi_remove_address_space_handler); diff --git a/drivers/acpi/executer/exconfig.c b/drivers/acpi/executer/exconfig.c index d11e9ec827f..1ce365d651d 100644 --- a/drivers/acpi/executer/exconfig.c +++ b/drivers/acpi/executer/exconfig.c @@ -41,7 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include #include #include @@ -50,18 +49,14 @@ #include #include - #define _COMPONENT ACPI_EXECUTER - ACPI_MODULE_NAME ("exconfig") +ACPI_MODULE_NAME("exconfig") /* Local prototypes */ - static acpi_status -acpi_ex_add_table ( - struct acpi_table_header *table, - struct acpi_namespace_node *parent_node, - union acpi_operand_object **ddb_handle); - +acpi_ex_add_table(struct acpi_table_header *table, + struct acpi_namespace_node *parent_node, + union acpi_operand_object **ddb_handle); /******************************************************************************* * @@ -79,24 +74,21 @@ acpi_ex_add_table ( ******************************************************************************/ static acpi_status -acpi_ex_add_table ( - struct acpi_table_header *table, - struct acpi_namespace_node *parent_node, - union acpi_operand_object **ddb_handle) +acpi_ex_add_table(struct acpi_table_header *table, + struct acpi_namespace_node *parent_node, + union acpi_operand_object **ddb_handle) { - acpi_status status; - struct acpi_table_desc table_info; - union acpi_operand_object *obj_desc; - - - ACPI_FUNCTION_TRACE ("ex_add_table"); + acpi_status status; + struct acpi_table_desc table_info; + union acpi_operand_object *obj_desc; + ACPI_FUNCTION_TRACE("ex_add_table"); /* Create an object to be the table handle */ - obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_LOCAL_REFERENCE); + obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_LOCAL_REFERENCE); if (!obj_desc) { - return_ACPI_STATUS (AE_NO_MEMORY); + return_ACPI_STATUS(AE_NO_MEMORY); } /* Init the table handle */ @@ -106,45 +98,43 @@ acpi_ex_add_table ( /* Install the new table into the local data structures */ - ACPI_MEMSET (&table_info, 0, sizeof (struct acpi_table_desc)); + ACPI_MEMSET(&table_info, 0, sizeof(struct acpi_table_desc)); - table_info.type = ACPI_TABLE_SSDT; - table_info.pointer = table; - table_info.length = (acpi_size) table->length; + table_info.type = ACPI_TABLE_SSDT; + table_info.pointer = table; + table_info.length = (acpi_size) table->length; table_info.allocation = ACPI_MEM_ALLOCATED; - status = acpi_tb_install_table (&table_info); + status = acpi_tb_install_table(&table_info); obj_desc->reference.object = table_info.installed_desc; - if (ACPI_FAILURE (status)) { + if (ACPI_FAILURE(status)) { if (status == AE_ALREADY_EXISTS) { /* Table already exists, just return the handle */ - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } goto cleanup; } /* Add the table to the namespace */ - status = acpi_ns_load_table (table_info.installed_desc, parent_node); - if (ACPI_FAILURE (status)) { + status = acpi_ns_load_table(table_info.installed_desc, parent_node); + if (ACPI_FAILURE(status)) { /* Uninstall table on error */ - (void) acpi_tb_uninstall_table (table_info.installed_desc); + (void)acpi_tb_uninstall_table(table_info.installed_desc); goto cleanup; } - return_ACPI_STATUS (AE_OK); - + return_ACPI_STATUS(AE_OK); -cleanup: - acpi_ut_remove_reference (obj_desc); + cleanup: + acpi_ut_remove_reference(obj_desc); *ddb_handle = NULL; - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_ex_load_table_op @@ -159,56 +149,53 @@ cleanup: ******************************************************************************/ acpi_status -acpi_ex_load_table_op ( - struct acpi_walk_state *walk_state, - union acpi_operand_object **return_desc) +acpi_ex_load_table_op(struct acpi_walk_state *walk_state, + union acpi_operand_object **return_desc) { - acpi_status status; - union acpi_operand_object **operand = &walk_state->operands[0]; - struct acpi_table_header *table; - struct acpi_namespace_node *parent_node; - struct acpi_namespace_node *start_node; - struct acpi_namespace_node *parameter_node = NULL; - union acpi_operand_object *ddb_handle; - - - ACPI_FUNCTION_TRACE ("ex_load_table_op"); + acpi_status status; + union acpi_operand_object **operand = &walk_state->operands[0]; + struct acpi_table_header *table; + struct acpi_namespace_node *parent_node; + struct acpi_namespace_node *start_node; + struct acpi_namespace_node *parameter_node = NULL; + union acpi_operand_object *ddb_handle; + ACPI_FUNCTION_TRACE("ex_load_table_op"); #if 0 /* * Make sure that the signature does not match one of the tables that * is already loaded. */ - status = acpi_tb_match_signature (operand[0]->string.pointer, NULL); + status = acpi_tb_match_signature(operand[0]->string.pointer, NULL); if (status == AE_OK) { /* Signature matched -- don't allow override */ - return_ACPI_STATUS (AE_ALREADY_EXISTS); + return_ACPI_STATUS(AE_ALREADY_EXISTS); } #endif /* Find the ACPI table */ - status = acpi_tb_find_table (operand[0]->string.pointer, - operand[1]->string.pointer, - operand[2]->string.pointer, &table); - if (ACPI_FAILURE (status)) { + status = acpi_tb_find_table(operand[0]->string.pointer, + operand[1]->string.pointer, + operand[2]->string.pointer, &table); + if (ACPI_FAILURE(status)) { if (status != AE_NOT_FOUND) { - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } /* Table not found, return an Integer=0 and AE_OK */ - ddb_handle = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER); + ddb_handle = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); if (!ddb_handle) { - return_ACPI_STATUS (AE_NO_MEMORY); + return_ACPI_STATUS(AE_NO_MEMORY); } ddb_handle->integer.value = 0; *return_desc = ddb_handle; - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } /* Default nodes */ @@ -223,10 +210,12 @@ acpi_ex_load_table_op ( * Find the node referenced by the root_path_string. This is the * location within the namespace where the table will be loaded. */ - status = acpi_ns_get_node_by_path (operand[3]->string.pointer, start_node, - ACPI_NS_SEARCH_PARENT, &parent_node); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = + acpi_ns_get_node_by_path(operand[3]->string.pointer, + start_node, ACPI_NS_SEARCH_PARENT, + &parent_node); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } } @@ -234,7 +223,7 @@ acpi_ex_load_table_op ( if (operand[4]->string.length > 0) { if ((operand[4]->string.pointer[0] != '\\') && - (operand[4]->string.pointer[0] != '^')) { + (operand[4]->string.pointer[0] != '^')) { /* * Path is not absolute, so it will be relative to the node * referenced by the root_path_string (or the NS root if omitted) @@ -244,18 +233,20 @@ acpi_ex_load_table_op ( /* Find the node referenced by the parameter_path_string */ - status = acpi_ns_get_node_by_path (operand[4]->string.pointer, start_node, - ACPI_NS_SEARCH_PARENT, ¶meter_node); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = + acpi_ns_get_node_by_path(operand[4]->string.pointer, + start_node, ACPI_NS_SEARCH_PARENT, + ¶meter_node); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } } /* Load the table into the namespace */ - status = acpi_ex_add_table (table, parent_node, &ddb_handle); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ex_add_table(table, parent_node, &ddb_handle); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* Parameter Data (optional) */ @@ -263,20 +254,20 @@ acpi_ex_load_table_op ( if (parameter_node) { /* Store the parameter data into the optional parameter object */ - status = acpi_ex_store (operand[5], - ACPI_CAST_PTR (union acpi_operand_object, parameter_node), - walk_state); - if (ACPI_FAILURE (status)) { - (void) acpi_ex_unload_table (ddb_handle); - return_ACPI_STATUS (status); + status = acpi_ex_store(operand[5], + ACPI_CAST_PTR(union acpi_operand_object, + parameter_node), + walk_state); + if (ACPI_FAILURE(status)) { + (void)acpi_ex_unload_table(ddb_handle); + return_ACPI_STATUS(status); } } *return_desc = ddb_handle; - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_ex_load_op @@ -293,38 +284,37 @@ acpi_ex_load_table_op ( ******************************************************************************/ acpi_status -acpi_ex_load_op ( - union acpi_operand_object *obj_desc, - union acpi_operand_object *target, - struct acpi_walk_state *walk_state) +acpi_ex_load_op(union acpi_operand_object *obj_desc, + union acpi_operand_object *target, + struct acpi_walk_state *walk_state) { - acpi_status status; - union acpi_operand_object *ddb_handle; - union acpi_operand_object *buffer_desc = NULL; - struct acpi_table_header *table_ptr = NULL; - acpi_physical_address address; - struct acpi_table_header table_header; - u32 i; - - ACPI_FUNCTION_TRACE ("ex_load_op"); + acpi_status status; + union acpi_operand_object *ddb_handle; + union acpi_operand_object *buffer_desc = NULL; + struct acpi_table_header *table_ptr = NULL; + acpi_physical_address address; + struct acpi_table_header table_header; + u32 i; + ACPI_FUNCTION_TRACE("ex_load_op"); /* Object can be either an op_region or a Field */ - switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { + switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { case ACPI_TYPE_REGION: - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Load from Region %p %s\n", - obj_desc, acpi_ut_get_object_type_name (obj_desc))); + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Load from Region %p %s\n", + obj_desc, + acpi_ut_get_object_type_name(obj_desc))); /* * If the Region Address and Length have not been previously evaluated, * evaluate them now and save the results. */ if (!(obj_desc->common.flags & AOPOBJ_DATA_VALID)) { - status = acpi_ds_get_region_arguments (obj_desc); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ds_get_region_arguments(obj_desc); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } } @@ -336,121 +326,127 @@ acpi_ex_load_op ( table_header.length = 0; for (i = 0; i < 8; i++) { - status = acpi_ev_address_space_dispatch (obj_desc, ACPI_READ, - (acpi_physical_address) (i + address), 8, - ((u8 *) &table_header) + i); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = + acpi_ev_address_space_dispatch(obj_desc, ACPI_READ, + (acpi_physical_address) + (i + address), 8, + ((u8 *) & + table_header) + i); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } } /* Sanity check the table length */ - if (table_header.length < sizeof (struct acpi_table_header)) { - return_ACPI_STATUS (AE_BAD_HEADER); + if (table_header.length < sizeof(struct acpi_table_header)) { + return_ACPI_STATUS(AE_BAD_HEADER); } /* Allocate a buffer for the entire table */ - table_ptr = ACPI_MEM_ALLOCATE (table_header.length); + table_ptr = ACPI_MEM_ALLOCATE(table_header.length); if (!table_ptr) { - return_ACPI_STATUS (AE_NO_MEMORY); + return_ACPI_STATUS(AE_NO_MEMORY); } /* Get the entire table from the op region */ for (i = 0; i < table_header.length; i++) { - status = acpi_ev_address_space_dispatch (obj_desc, ACPI_READ, - (acpi_physical_address) (i + address), 8, - ((u8 *) table_ptr + i)); - if (ACPI_FAILURE (status)) { + status = + acpi_ev_address_space_dispatch(obj_desc, ACPI_READ, + (acpi_physical_address) + (i + address), 8, + ((u8 *) table_ptr + + i)); + if (ACPI_FAILURE(status)) { goto cleanup; } } break; - case ACPI_TYPE_LOCAL_REGION_FIELD: case ACPI_TYPE_LOCAL_BANK_FIELD: case ACPI_TYPE_LOCAL_INDEX_FIELD: - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Load from Field %p %s\n", - obj_desc, acpi_ut_get_object_type_name (obj_desc))); + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Load from Field %p %s\n", + obj_desc, + acpi_ut_get_object_type_name(obj_desc))); /* * The length of the field must be at least as large as the table. * Read the entire field and thus the entire table. Buffer is * allocated during the read. */ - status = acpi_ex_read_data_from_field (walk_state, obj_desc, &buffer_desc); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = + acpi_ex_read_data_from_field(walk_state, obj_desc, + &buffer_desc); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } - table_ptr = ACPI_CAST_PTR (struct acpi_table_header, - buffer_desc->buffer.pointer); + table_ptr = ACPI_CAST_PTR(struct acpi_table_header, + buffer_desc->buffer.pointer); /* All done with the buffer_desc, delete it */ buffer_desc->buffer.pointer = NULL; - acpi_ut_remove_reference (buffer_desc); + acpi_ut_remove_reference(buffer_desc); /* Sanity check the table length */ - if (table_ptr->length < sizeof (struct acpi_table_header)) { + if (table_ptr->length < sizeof(struct acpi_table_header)) { status = AE_BAD_HEADER; goto cleanup; } break; - default: - return_ACPI_STATUS (AE_AML_OPERAND_TYPE); + return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } /* The table must be either an SSDT or a PSDT */ - if ((!ACPI_STRNCMP (table_ptr->signature, - acpi_gbl_table_data[ACPI_TABLE_PSDT].signature, - acpi_gbl_table_data[ACPI_TABLE_PSDT].sig_length)) && - (!ACPI_STRNCMP (table_ptr->signature, - acpi_gbl_table_data[ACPI_TABLE_SSDT].signature, - acpi_gbl_table_data[ACPI_TABLE_SSDT].sig_length))) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Table has invalid signature [%4.4s], must be SSDT or PSDT\n", - table_ptr->signature)); + if ((!ACPI_STRNCMP(table_ptr->signature, + acpi_gbl_table_data[ACPI_TABLE_PSDT].signature, + acpi_gbl_table_data[ACPI_TABLE_PSDT].sig_length)) && + (!ACPI_STRNCMP(table_ptr->signature, + acpi_gbl_table_data[ACPI_TABLE_SSDT].signature, + acpi_gbl_table_data[ACPI_TABLE_SSDT].sig_length))) { + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Table has invalid signature [%4.4s], must be SSDT or PSDT\n", + table_ptr->signature)); status = AE_BAD_SIGNATURE; goto cleanup; } /* Install the new table into the local data structures */ - status = acpi_ex_add_table (table_ptr, acpi_gbl_root_node, &ddb_handle); - if (ACPI_FAILURE (status)) { + status = acpi_ex_add_table(table_ptr, acpi_gbl_root_node, &ddb_handle); + if (ACPI_FAILURE(status)) { /* On error, table_ptr was deallocated above */ - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } /* Store the ddb_handle into the Target operand */ - status = acpi_ex_store (ddb_handle, target, walk_state); - if (ACPI_FAILURE (status)) { - (void) acpi_ex_unload_table (ddb_handle); + status = acpi_ex_store(ddb_handle, target, walk_state); + if (ACPI_FAILURE(status)) { + (void)acpi_ex_unload_table(ddb_handle); /* table_ptr was deallocated above */ - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } -cleanup: - if (ACPI_FAILURE (status)) { - ACPI_MEM_FREE (table_ptr); + cleanup: + if (ACPI_FAILURE(status)) { + ACPI_MEM_FREE(table_ptr); } - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_ex_unload_table @@ -463,17 +459,13 @@ cleanup: * ******************************************************************************/ -acpi_status -acpi_ex_unload_table ( - union acpi_operand_object *ddb_handle) +acpi_status acpi_ex_unload_table(union acpi_operand_object *ddb_handle) { - acpi_status status = AE_OK; - union acpi_operand_object *table_desc = ddb_handle; - struct acpi_table_desc *table_info; - - - ACPI_FUNCTION_TRACE ("ex_unload_table"); + acpi_status status = AE_OK; + union acpi_operand_object *table_desc = ddb_handle; + struct acpi_table_desc *table_info; + ACPI_FUNCTION_TRACE("ex_unload_table"); /* * Validate the handle @@ -482,29 +474,28 @@ acpi_ex_unload_table ( * validated here. */ if ((!ddb_handle) || - (ACPI_GET_DESCRIPTOR_TYPE (ddb_handle) != ACPI_DESC_TYPE_OPERAND) || - (ACPI_GET_OBJECT_TYPE (ddb_handle) != ACPI_TYPE_LOCAL_REFERENCE)) { - return_ACPI_STATUS (AE_BAD_PARAMETER); + (ACPI_GET_DESCRIPTOR_TYPE(ddb_handle) != ACPI_DESC_TYPE_OPERAND) || + (ACPI_GET_OBJECT_TYPE(ddb_handle) != ACPI_TYPE_LOCAL_REFERENCE)) { + return_ACPI_STATUS(AE_BAD_PARAMETER); } /* Get the actual table descriptor from the ddb_handle */ - table_info = (struct acpi_table_desc *) table_desc->reference.object; + table_info = (struct acpi_table_desc *)table_desc->reference.object; /* * Delete the entire namespace under this table Node * (Offset contains the table_id) */ - acpi_ns_delete_namespace_by_owner (table_info->owner_id); - acpi_ut_release_owner_id (&table_info->owner_id); + acpi_ns_delete_namespace_by_owner(table_info->owner_id); + acpi_ut_release_owner_id(&table_info->owner_id); /* Delete the table itself */ - (void) acpi_tb_uninstall_table (table_info->installed_desc); + (void)acpi_tb_uninstall_table(table_info->installed_desc); /* Delete the table descriptor (ddb_handle) */ - acpi_ut_remove_reference (table_desc); - return_ACPI_STATUS (status); + acpi_ut_remove_reference(table_desc); + return_ACPI_STATUS(status); } - diff --git a/drivers/acpi/executer/exconvrt.c b/drivers/acpi/executer/exconvrt.c index 21331625e66..04e5194989a 100644 --- a/drivers/acpi/executer/exconvrt.c +++ b/drivers/acpi/executer/exconvrt.c @@ -41,24 +41,17 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include #include #include - #define _COMPONENT ACPI_EXECUTER - ACPI_MODULE_NAME ("exconvrt") +ACPI_MODULE_NAME("exconvrt") /* Local prototypes */ - static u32 -acpi_ex_convert_to_ascii ( - acpi_integer integer, - u16 base, - u8 *string, - u8 max_length); - +acpi_ex_convert_to_ascii(acpi_integer integer, + u16 base, u8 * string, u8 max_length); /******************************************************************************* * @@ -76,29 +69,25 @@ acpi_ex_convert_to_ascii ( ******************************************************************************/ acpi_status -acpi_ex_convert_to_integer ( - union acpi_operand_object *obj_desc, - union acpi_operand_object **result_desc, - u32 flags) +acpi_ex_convert_to_integer(union acpi_operand_object *obj_desc, + union acpi_operand_object **result_desc, u32 flags) { - union acpi_operand_object *return_desc; - u8 *pointer; - acpi_integer result; - u32 i; - u32 count; - acpi_status status; - + union acpi_operand_object *return_desc; + u8 *pointer; + acpi_integer result; + u32 i; + u32 count; + acpi_status status; - ACPI_FUNCTION_TRACE_PTR ("ex_convert_to_integer", obj_desc); + ACPI_FUNCTION_TRACE_PTR("ex_convert_to_integer", obj_desc); - - switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { + switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { case ACPI_TYPE_INTEGER: /* No conversion necessary */ *result_desc = obj_desc; - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); case ACPI_TYPE_BUFFER: case ACPI_TYPE_STRING: @@ -106,11 +95,11 @@ acpi_ex_convert_to_integer ( /* Note: Takes advantage of common buffer/string fields */ pointer = obj_desc->buffer.pointer; - count = obj_desc->buffer.length; + count = obj_desc->buffer.length; break; default: - return_ACPI_STATUS (AE_TYPE); + return_ACPI_STATUS(AE_TYPE); } /* @@ -126,7 +115,7 @@ acpi_ex_convert_to_integer ( /* String conversion is different than Buffer conversion */ - switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { + switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { case ACPI_TYPE_STRING: /* @@ -135,19 +124,18 @@ acpi_ex_convert_to_integer ( * of ACPI 3.0) is that the to_integer() operator allows both decimal * and hexadecimal strings (hex prefixed with "0x"). */ - status = acpi_ut_strtoul64 ((char *) pointer, flags, &result); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ut_strtoul64((char *)pointer, flags, &result); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } break; - case ACPI_TYPE_BUFFER: /* Check for zero-length buffer */ if (!count) { - return_ACPI_STATUS (AE_AML_BUFFER_LIMIT); + return_ACPI_STATUS(AE_AML_BUFFER_LIMIT); } /* Transfer no more than an integer's worth of data */ @@ -170,7 +158,6 @@ acpi_ex_convert_to_integer ( } break; - default: /* No other types can get here */ break; @@ -178,20 +165,19 @@ acpi_ex_convert_to_integer ( /* Create a new integer */ - return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER); + return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); if (!return_desc) { - return_ACPI_STATUS (AE_NO_MEMORY); + return_ACPI_STATUS(AE_NO_MEMORY); } /* Save the Result */ return_desc->integer.value = result; - acpi_ex_truncate_for32bit_table (return_desc); + acpi_ex_truncate_for32bit_table(return_desc); *result_desc = return_desc; - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_ex_convert_to_buffer @@ -207,25 +193,21 @@ acpi_ex_convert_to_integer ( ******************************************************************************/ acpi_status -acpi_ex_convert_to_buffer ( - union acpi_operand_object *obj_desc, - union acpi_operand_object **result_desc) +acpi_ex_convert_to_buffer(union acpi_operand_object *obj_desc, + union acpi_operand_object **result_desc) { - union acpi_operand_object *return_desc; - u8 *new_buf; + union acpi_operand_object *return_desc; + u8 *new_buf; + ACPI_FUNCTION_TRACE_PTR("ex_convert_to_buffer", obj_desc); - ACPI_FUNCTION_TRACE_PTR ("ex_convert_to_buffer", obj_desc); - - - switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { + switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { case ACPI_TYPE_BUFFER: /* No conversion necessary */ *result_desc = obj_desc; - return_ACPI_STATUS (AE_OK); - + return_ACPI_STATUS(AE_OK); case ACPI_TYPE_INTEGER: @@ -233,20 +215,20 @@ acpi_ex_convert_to_buffer ( * Create a new Buffer object. * Need enough space for one integer */ - return_desc = acpi_ut_create_buffer_object (acpi_gbl_integer_byte_width); + return_desc = + acpi_ut_create_buffer_object(acpi_gbl_integer_byte_width); if (!return_desc) { - return_ACPI_STATUS (AE_NO_MEMORY); + return_ACPI_STATUS(AE_NO_MEMORY); } /* Copy the integer to the buffer, LSB first */ new_buf = return_desc->buffer.pointer; - ACPI_MEMCPY (new_buf, - &obj_desc->integer.value, - acpi_gbl_integer_byte_width); + ACPI_MEMCPY(new_buf, + &obj_desc->integer.value, + acpi_gbl_integer_byte_width); break; - case ACPI_TYPE_STRING: /* @@ -258,32 +240,31 @@ acpi_ex_convert_to_buffer ( * ASL/AML code that depends on the null being transferred to the new * buffer. */ - return_desc = acpi_ut_create_buffer_object ( - (acpi_size) obj_desc->string.length + 1); + return_desc = acpi_ut_create_buffer_object((acpi_size) + obj_desc->string. + length + 1); if (!return_desc) { - return_ACPI_STATUS (AE_NO_MEMORY); + return_ACPI_STATUS(AE_NO_MEMORY); } /* Copy the string to the buffer */ new_buf = return_desc->buffer.pointer; - ACPI_STRNCPY ((char *) new_buf, (char *) obj_desc->string.pointer, - obj_desc->string.length); + ACPI_STRNCPY((char *)new_buf, (char *)obj_desc->string.pointer, + obj_desc->string.length); break; - default: - return_ACPI_STATUS (AE_TYPE); + return_ACPI_STATUS(AE_TYPE); } /* Mark buffer initialized */ return_desc->common.flags |= AOPOBJ_DATA_VALID; *result_desc = return_desc; - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_ex_convert_to_ascii @@ -300,24 +281,19 @@ acpi_ex_convert_to_buffer ( ******************************************************************************/ static u32 -acpi_ex_convert_to_ascii ( - acpi_integer integer, - u16 base, - u8 *string, - u8 data_width) +acpi_ex_convert_to_ascii(acpi_integer integer, + u16 base, u8 * string, u8 data_width) { - acpi_integer digit; - acpi_native_uint i; - acpi_native_uint j; - acpi_native_uint k = 0; - acpi_native_uint hex_length; - acpi_native_uint decimal_length; - u32 remainder; - u8 supress_zeros; - - - ACPI_FUNCTION_ENTRY (); + acpi_integer digit; + acpi_native_uint i; + acpi_native_uint j; + acpi_native_uint k = 0; + acpi_native_uint hex_length; + acpi_native_uint decimal_length; + u32 remainder; + u8 supress_zeros; + ACPI_FUNCTION_ENTRY(); switch (base) { case 10: @@ -339,7 +315,7 @@ acpi_ex_convert_to_ascii ( break; } - supress_zeros = TRUE; /* No leading zeros */ + supress_zeros = TRUE; /* No leading zeros */ remainder = 0; for (i = decimal_length; i > 0; i--) { @@ -347,7 +323,8 @@ acpi_ex_convert_to_ascii ( digit = integer; for (j = 0; j < i; j++) { - (void) acpi_ut_short_divide (digit, 10, &digit, &remainder); + (void)acpi_ut_short_divide(digit, 10, &digit, + &remainder); } /* Handle leading zeros */ @@ -367,11 +344,13 @@ acpi_ex_convert_to_ascii ( /* hex_length: 2 ascii hex chars per data byte */ - hex_length = (acpi_native_uint) ACPI_MUL_2 (data_width); - for (i = 0, j = (hex_length-1); i < hex_length; i++, j--) { + hex_length = (acpi_native_uint) ACPI_MUL_2(data_width); + for (i = 0, j = (hex_length - 1); i < hex_length; i++, j--) { /* Get one hex digit, most significant digits first */ - string[k] = (u8) acpi_ut_hex_to_ascii_char (integer, ACPI_MUL_4 (j)); + string[k] = + (u8) acpi_ut_hex_to_ascii_char(integer, + ACPI_MUL_4(j)); k++; } break; @@ -387,15 +366,14 @@ acpi_ex_convert_to_ascii ( * Finally, null terminate the string and return the length */ if (!k) { - string [0] = ACPI_ASCII_ZERO; + string[0] = ACPI_ASCII_ZERO; k = 1; } - string [k] = 0; + string[k] = 0; return ((u32) k); } - /******************************************************************************* * * FUNCTION: acpi_ex_convert_to_string @@ -412,30 +390,25 @@ acpi_ex_convert_to_ascii ( ******************************************************************************/ acpi_status -acpi_ex_convert_to_string ( - union acpi_operand_object *obj_desc, - union acpi_operand_object **result_desc, - u32 type) +acpi_ex_convert_to_string(union acpi_operand_object * obj_desc, + union acpi_operand_object ** result_desc, u32 type) { - union acpi_operand_object *return_desc; - u8 *new_buf; - u32 i; - u32 string_length = 0; - u16 base = 16; - u8 separator = ','; + union acpi_operand_object *return_desc; + u8 *new_buf; + u32 i; + u32 string_length = 0; + u16 base = 16; + u8 separator = ','; + ACPI_FUNCTION_TRACE_PTR("ex_convert_to_string", obj_desc); - ACPI_FUNCTION_TRACE_PTR ("ex_convert_to_string", obj_desc); - - - switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { + switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { case ACPI_TYPE_STRING: /* No conversion necessary */ *result_desc = obj_desc; - return_ACPI_STATUS (AE_OK); - + return_ACPI_STATUS(AE_OK); case ACPI_TYPE_INTEGER: @@ -452,7 +425,7 @@ acpi_ex_convert_to_string ( /* Two hex string characters for each integer byte */ - string_length = ACPI_MUL_2 (acpi_gbl_integer_byte_width); + string_length = ACPI_MUL_2(acpi_gbl_integer_byte_width); break; } @@ -460,31 +433,33 @@ acpi_ex_convert_to_string ( * Create a new String * Need enough space for one ASCII integer (plus null terminator) */ - return_desc = acpi_ut_create_string_object ((acpi_size) string_length); + return_desc = + acpi_ut_create_string_object((acpi_size) string_length); if (!return_desc) { - return_ACPI_STATUS (AE_NO_MEMORY); + return_ACPI_STATUS(AE_NO_MEMORY); } new_buf = return_desc->buffer.pointer; /* Convert integer to string */ - string_length = acpi_ex_convert_to_ascii (obj_desc->integer.value, base, - new_buf, acpi_gbl_integer_byte_width); + string_length = + acpi_ex_convert_to_ascii(obj_desc->integer.value, base, + new_buf, + acpi_gbl_integer_byte_width); /* Null terminate at the correct place */ return_desc->string.length = string_length; - new_buf [string_length] = 0; + new_buf[string_length] = 0; break; - case ACPI_TYPE_BUFFER: /* Setup string length, base, and separator */ switch (type) { - case ACPI_EXPLICIT_CONVERT_DECIMAL: /* Used by to_decimal_string */ + case ACPI_EXPLICIT_CONVERT_DECIMAL: /* Used by to_decimal_string */ /* * From ACPI: "If Data is a buffer, it is converted to a string of * decimal values separated by commas." @@ -498,11 +473,9 @@ acpi_ex_convert_to_string ( for (i = 0; i < obj_desc->buffer.length; i++) { if (obj_desc->buffer.pointer[i] >= 100) { string_length += 4; - } - else if (obj_desc->buffer.pointer[i] >= 10) { + } else if (obj_desc->buffer.pointer[i] >= 10) { string_length += 3; - } - else { + } else { string_length += 2; } } @@ -518,7 +491,7 @@ acpi_ex_convert_to_string ( string_length = (obj_desc->buffer.length * 3); break; - case ACPI_EXPLICIT_CONVERT_HEX: /* Used by to_hex_string */ + case ACPI_EXPLICIT_CONVERT_HEX: /* Used by to_hex_string */ /* * From ACPI: "If Data is a buffer, it is converted to a string of * hexadecimal values separated by commas." @@ -527,7 +500,7 @@ acpi_ex_convert_to_string ( break; default: - return_ACPI_STATUS (AE_BAD_PARAMETER); + return_ACPI_STATUS(AE_BAD_PARAMETER); } /* @@ -535,15 +508,16 @@ acpi_ex_convert_to_string ( * (-1 because of extra separator included in string_length from above) */ string_length--; - if (string_length > ACPI_MAX_STRING_CONVERSION) /* ACPI limit */ { - return_ACPI_STATUS (AE_AML_STRING_LIMIT); + if (string_length > ACPI_MAX_STRING_CONVERSION) { /* ACPI limit */ + return_ACPI_STATUS(AE_AML_STRING_LIMIT); } /* Create a new string object and string buffer */ - return_desc = acpi_ut_create_string_object ((acpi_size) string_length); + return_desc = + acpi_ut_create_string_object((acpi_size) string_length); if (!return_desc) { - return_ACPI_STATUS (AE_NO_MEMORY); + return_ACPI_STATUS(AE_NO_MEMORY); } new_buf = return_desc->buffer.pointer; @@ -553,10 +527,11 @@ acpi_ex_convert_to_string ( * (separated by commas or spaces) */ for (i = 0; i < obj_desc->buffer.length; i++) { - new_buf += acpi_ex_convert_to_ascii ( - (acpi_integer) obj_desc->buffer.pointer[i], base, - new_buf, 1); - *new_buf++ = separator; /* each separated by a comma or space */ + new_buf += acpi_ex_convert_to_ascii((acpi_integer) + obj_desc->buffer. + pointer[i], base, + new_buf, 1); + *new_buf++ = separator; /* each separated by a comma or space */ } /* @@ -568,14 +543,13 @@ acpi_ex_convert_to_string ( break; default: - return_ACPI_STATUS (AE_TYPE); + return_ACPI_STATUS(AE_TYPE); } *result_desc = return_desc; - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_ex_convert_to_target_type @@ -592,17 +566,14 @@ acpi_ex_convert_to_string ( ******************************************************************************/ acpi_status -acpi_ex_convert_to_target_type ( - acpi_object_type destination_type, - union acpi_operand_object *source_desc, - union acpi_operand_object **result_desc, - struct acpi_walk_state *walk_state) +acpi_ex_convert_to_target_type(acpi_object_type destination_type, + union acpi_operand_object *source_desc, + union acpi_operand_object **result_desc, + struct acpi_walk_state *walk_state) { - acpi_status status = AE_OK; - - - ACPI_FUNCTION_TRACE ("ex_convert_to_target_type"); + acpi_status status = AE_OK; + ACPI_FUNCTION_TRACE("ex_convert_to_target_type"); /* Default behavior */ @@ -612,10 +583,10 @@ acpi_ex_convert_to_target_type ( * If required by the target, * perform implicit conversion on the source before we store it. */ - switch (GET_CURRENT_ARG_TYPE (walk_state->op_info->runtime_args)) { + switch (GET_CURRENT_ARG_TYPE(walk_state->op_info->runtime_args)) { case ARGI_SIMPLE_TARGET: case ARGI_FIXED_TARGET: - case ARGI_INTEGER_REF: /* Handles Increment, Decrement cases */ + case ARGI_INTEGER_REF: /* Handles Increment, Decrement cases */ switch (destination_type) { case ACPI_TYPE_LOCAL_REGION_FIELD: @@ -627,17 +598,19 @@ acpi_ex_convert_to_target_type ( default: /* No conversion allowed for these types */ - if (destination_type != ACPI_GET_OBJECT_TYPE (source_desc)) { - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "Explicit operator, will store (%s) over existing type (%s)\n", - acpi_ut_get_object_type_name (source_desc), - acpi_ut_get_type_name (destination_type))); + if (destination_type != + ACPI_GET_OBJECT_TYPE(source_desc)) { + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "Explicit operator, will store (%s) over existing type (%s)\n", + acpi_ut_get_object_type_name + (source_desc), + acpi_ut_get_type_name + (destination_type))); status = AE_TYPE; } } break; - case ARGI_TARGETREF: switch (destination_type) { @@ -649,55 +622,55 @@ acpi_ex_convert_to_target_type ( * These types require an Integer operand. We can convert * a Buffer or a String to an Integer if necessary. */ - status = acpi_ex_convert_to_integer (source_desc, result_desc, - 16); + status = + acpi_ex_convert_to_integer(source_desc, result_desc, + 16); break; - case ACPI_TYPE_STRING: /* * The operand must be a String. We can convert an * Integer or Buffer if necessary */ - status = acpi_ex_convert_to_string (source_desc, result_desc, - ACPI_IMPLICIT_CONVERT_HEX); + status = + acpi_ex_convert_to_string(source_desc, result_desc, + ACPI_IMPLICIT_CONVERT_HEX); break; - case ACPI_TYPE_BUFFER: /* * The operand must be a Buffer. We can convert an * Integer or String if necessary */ - status = acpi_ex_convert_to_buffer (source_desc, result_desc); + status = + acpi_ex_convert_to_buffer(source_desc, result_desc); break; - default: - ACPI_REPORT_ERROR (("Bad destination type during conversion: %X\n", - destination_type)); + ACPI_REPORT_ERROR(("Bad destination type during conversion: %X\n", destination_type)); status = AE_AML_INTERNAL; break; } break; - case ARGI_REFERENCE: /* * create_xxxx_field cases - we are storing the field object into the name */ break; - default: - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Unknown Target type ID 0x%X Op %s dest_type %s\n", - GET_CURRENT_ARG_TYPE (walk_state->op_info->runtime_args), - walk_state->op_info->name, acpi_ut_get_type_name (destination_type))); - - ACPI_REPORT_ERROR (("Bad Target Type (ARGI): %X\n", - GET_CURRENT_ARG_TYPE (walk_state->op_info->runtime_args))) - status = AE_AML_INTERNAL; + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Unknown Target type ID 0x%X Op %s dest_type %s\n", + GET_CURRENT_ARG_TYPE(walk_state->op_info-> + runtime_args), + walk_state->op_info->name, + acpi_ut_get_type_name(destination_type))); + + ACPI_REPORT_ERROR(("Bad Target Type (ARGI): %X\n", + GET_CURRENT_ARG_TYPE(walk_state->op_info-> + runtime_args))) + status = AE_AML_INTERNAL; } /* @@ -710,7 +683,5 @@ acpi_ex_convert_to_target_type ( status = AE_OK; } - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - - diff --git a/drivers/acpi/executer/excreate.c b/drivers/acpi/executer/excreate.c index 812cdcb2e37..91c49188fb0 100644 --- a/drivers/acpi/executer/excreate.c +++ b/drivers/acpi/executer/excreate.c @@ -41,7 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include #include #include @@ -49,10 +48,8 @@ #include #include - #define _COMPONENT ACPI_EXECUTER - ACPI_MODULE_NAME ("excreate") - +ACPI_MODULE_NAME("excreate") #ifndef ACPI_NO_METHOD_EXECUTION /******************************************************************************* @@ -66,33 +63,30 @@ * DESCRIPTION: Create a new named alias * ******************************************************************************/ - -acpi_status -acpi_ex_create_alias ( - struct acpi_walk_state *walk_state) +acpi_status acpi_ex_create_alias(struct acpi_walk_state *walk_state) { - struct acpi_namespace_node *target_node; - struct acpi_namespace_node *alias_node; - acpi_status status = AE_OK; - - - ACPI_FUNCTION_TRACE ("ex_create_alias"); + struct acpi_namespace_node *target_node; + struct acpi_namespace_node *alias_node; + acpi_status status = AE_OK; + ACPI_FUNCTION_TRACE("ex_create_alias"); /* Get the source/alias operands (both namespace nodes) */ - alias_node = (struct acpi_namespace_node *) walk_state->operands[0]; - target_node = (struct acpi_namespace_node *) walk_state->operands[1]; + alias_node = (struct acpi_namespace_node *)walk_state->operands[0]; + target_node = (struct acpi_namespace_node *)walk_state->operands[1]; if ((target_node->type == ACPI_TYPE_LOCAL_ALIAS) || - (target_node->type == ACPI_TYPE_LOCAL_METHOD_ALIAS)) { + (target_node->type == ACPI_TYPE_LOCAL_METHOD_ALIAS)) { /* * Dereference an existing alias so that we don't create a chain * of aliases. With this code, we guarantee that an alias is * always exactly one level of indirection away from the * actual aliased name. */ - target_node = ACPI_CAST_PTR (struct acpi_namespace_node, target_node->object); + target_node = + ACPI_CAST_PTR(struct acpi_namespace_node, + target_node->object); } /* @@ -115,7 +109,8 @@ acpi_ex_create_alias ( * types, the object can change dynamically via a Store. */ alias_node->type = ACPI_TYPE_LOCAL_ALIAS; - alias_node->object = ACPI_CAST_PTR (union acpi_operand_object, target_node); + alias_node->object = + ACPI_CAST_PTR(union acpi_operand_object, target_node); break; case ACPI_TYPE_METHOD: @@ -126,7 +121,8 @@ acpi_ex_create_alias ( * types, the object can change dynamically via a Store. */ alias_node->type = ACPI_TYPE_LOCAL_METHOD_ALIAS; - alias_node->object = ACPI_CAST_PTR (union acpi_operand_object, target_node); + alias_node->object = + ACPI_CAST_PTR(union acpi_operand_object, target_node); break; default: @@ -139,17 +135,18 @@ acpi_ex_create_alias ( * additional reference to prevent deletion out from under either the * target node or the alias Node */ - status = acpi_ns_attach_object (alias_node, - acpi_ns_get_attached_object (target_node), target_node->type); + status = acpi_ns_attach_object(alias_node, + acpi_ns_get_attached_object + (target_node), + target_node->type); break; } /* Since both operands are Nodes, we don't need to delete them */ - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_ex_create_event @@ -162,18 +159,14 @@ acpi_ex_create_alias ( * ******************************************************************************/ -acpi_status -acpi_ex_create_event ( - struct acpi_walk_state *walk_state) +acpi_status acpi_ex_create_event(struct acpi_walk_state *walk_state) { - acpi_status status; - union acpi_operand_object *obj_desc; - - - ACPI_FUNCTION_TRACE ("ex_create_event"); + acpi_status status; + union acpi_operand_object *obj_desc; + ACPI_FUNCTION_TRACE("ex_create_event"); - obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_EVENT); + obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_EVENT); if (!obj_desc) { status = AE_NO_MEMORY; goto cleanup; @@ -183,27 +176,27 @@ acpi_ex_create_event ( * Create the actual OS semaphore, with zero initial units -- meaning * that the event is created in an unsignalled state */ - status = acpi_os_create_semaphore (ACPI_NO_UNIT_LIMIT, 0, - &obj_desc->event.semaphore); - if (ACPI_FAILURE (status)) { + status = acpi_os_create_semaphore(ACPI_NO_UNIT_LIMIT, 0, + &obj_desc->event.semaphore); + if (ACPI_FAILURE(status)) { goto cleanup; } /* Attach object to the Node */ - status = acpi_ns_attach_object ((struct acpi_namespace_node *) walk_state->operands[0], - obj_desc, ACPI_TYPE_EVENT); + status = + acpi_ns_attach_object((struct acpi_namespace_node *)walk_state-> + operands[0], obj_desc, ACPI_TYPE_EVENT); -cleanup: + cleanup: /* * Remove local reference to the object (on error, will cause deletion * of both object and semaphore if present.) */ - acpi_ut_remove_reference (obj_desc); - return_ACPI_STATUS (status); + acpi_ut_remove_reference(obj_desc); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_ex_create_mutex @@ -218,20 +211,16 @@ cleanup: * ******************************************************************************/ -acpi_status -acpi_ex_create_mutex ( - struct acpi_walk_state *walk_state) +acpi_status acpi_ex_create_mutex(struct acpi_walk_state *walk_state) { - acpi_status status = AE_OK; - union acpi_operand_object *obj_desc; - - - ACPI_FUNCTION_TRACE_PTR ("ex_create_mutex", ACPI_WALK_OPERANDS); + acpi_status status = AE_OK; + union acpi_operand_object *obj_desc; + ACPI_FUNCTION_TRACE_PTR("ex_create_mutex", ACPI_WALK_OPERANDS); /* Create the new mutex object */ - obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_MUTEX); + obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_MUTEX); if (!obj_desc) { status = AE_NO_MEMORY; goto cleanup; @@ -242,30 +231,30 @@ acpi_ex_create_mutex ( * One unit max to make it a mutex, with one initial unit to allow * the mutex to be acquired. */ - status = acpi_os_create_semaphore (1, 1, &obj_desc->mutex.semaphore); - if (ACPI_FAILURE (status)) { + status = acpi_os_create_semaphore(1, 1, &obj_desc->mutex.semaphore); + if (ACPI_FAILURE(status)) { goto cleanup; } /* Init object and attach to NS node */ - obj_desc->mutex.sync_level = (u8) walk_state->operands[1]->integer.value; - obj_desc->mutex.node = (struct acpi_namespace_node *) walk_state->operands[0]; - - status = acpi_ns_attach_object (obj_desc->mutex.node, - obj_desc, ACPI_TYPE_MUTEX); + obj_desc->mutex.sync_level = + (u8) walk_state->operands[1]->integer.value; + obj_desc->mutex.node = + (struct acpi_namespace_node *)walk_state->operands[0]; + status = acpi_ns_attach_object(obj_desc->mutex.node, + obj_desc, ACPI_TYPE_MUTEX); -cleanup: + cleanup: /* * Remove local reference to the object (on error, will cause deletion * of both object and semaphore if present.) */ - acpi_ut_remove_reference (obj_desc); - return_ACPI_STATUS (status); + acpi_ut_remove_reference(obj_desc); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_ex_create_region @@ -282,20 +271,16 @@ cleanup: ******************************************************************************/ acpi_status -acpi_ex_create_region ( - u8 *aml_start, - u32 aml_length, - u8 region_space, - struct acpi_walk_state *walk_state) +acpi_ex_create_region(u8 * aml_start, + u32 aml_length, + u8 region_space, struct acpi_walk_state *walk_state) { - acpi_status status; - union acpi_operand_object *obj_desc; - struct acpi_namespace_node *node; - union acpi_operand_object *region_obj2; - - - ACPI_FUNCTION_TRACE ("ex_create_region"); + acpi_status status; + union acpi_operand_object *obj_desc; + struct acpi_namespace_node *node; + union acpi_operand_object *region_obj2; + ACPI_FUNCTION_TRACE("ex_create_region"); /* Get the Namespace Node */ @@ -305,8 +290,8 @@ acpi_ex_create_region ( * If the region object is already attached to this node, * just return */ - if (acpi_ns_get_attached_object (node)) { - return_ACPI_STATUS (AE_OK); + if (acpi_ns_get_attached_object(node)) { + return_ACPI_STATUS(AE_OK); } /* @@ -314,17 +299,18 @@ acpi_ex_create_region ( * range */ if ((region_space >= ACPI_NUM_PREDEFINED_REGIONS) && - (region_space < ACPI_USER_REGION_BEGIN)) { - ACPI_REPORT_ERROR (("Invalid address_space type %X\n", region_space)); - return_ACPI_STATUS (AE_AML_INVALID_SPACE_ID); + (region_space < ACPI_USER_REGION_BEGIN)) { + ACPI_REPORT_ERROR(("Invalid address_space type %X\n", + region_space)); + return_ACPI_STATUS(AE_AML_INVALID_SPACE_ID); } - ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "Region Type - %s (%X)\n", - acpi_ut_get_region_name (region_space), region_space)); + ACPI_DEBUG_PRINT((ACPI_DB_LOAD, "Region Type - %s (%X)\n", + acpi_ut_get_region_name(region_space), region_space)); /* Create the region descriptor */ - obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_REGION); + obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_REGION); if (!obj_desc) { status = AE_NO_MEMORY; goto cleanup; @@ -334,7 +320,7 @@ acpi_ex_create_region ( * Remember location in AML stream of address & length * operands since they need to be evaluated at run time. */ - region_obj2 = obj_desc->common.next_object; + region_obj2 = obj_desc->common.next_object; region_obj2->extra.aml_start = aml_start; region_obj2->extra.aml_length = aml_length; @@ -343,22 +329,20 @@ acpi_ex_create_region ( obj_desc->region.space_id = region_space; obj_desc->region.address = 0; obj_desc->region.length = 0; - obj_desc->region.node = node; + obj_desc->region.node = node; /* Install the new region object in the parent Node */ - status = acpi_ns_attach_object (node, obj_desc, ACPI_TYPE_REGION); + status = acpi_ns_attach_object(node, obj_desc, ACPI_TYPE_REGION); - -cleanup: + cleanup: /* Remove local reference to the object */ - acpi_ut_remove_reference (obj_desc); - return_ACPI_STATUS (status); + acpi_ut_remove_reference(obj_desc); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_ex_create_table_region @@ -371,20 +355,16 @@ cleanup: * ******************************************************************************/ -acpi_status -acpi_ex_create_table_region ( - struct acpi_walk_state *walk_state) +acpi_status acpi_ex_create_table_region(struct acpi_walk_state *walk_state) { - acpi_status status; - union acpi_operand_object **operand = &walk_state->operands[0]; - union acpi_operand_object *obj_desc; - struct acpi_namespace_node *node; - struct acpi_table_header *table; - union acpi_operand_object *region_obj2; - - - ACPI_FUNCTION_TRACE ("ex_create_table_region"); + acpi_status status; + union acpi_operand_object **operand = &walk_state->operands[0]; + union acpi_operand_object *obj_desc; + struct acpi_namespace_node *node; + struct acpi_table_header *table; + union acpi_operand_object *region_obj2; + ACPI_FUNCTION_TRACE("ex_create_table_region"); /* Get the Node from the object stack */ @@ -394,66 +374,64 @@ acpi_ex_create_table_region ( * If the region object is already attached to this node, * just return */ - if (acpi_ns_get_attached_object (node)) { - return_ACPI_STATUS (AE_OK); + if (acpi_ns_get_attached_object(node)) { + return_ACPI_STATUS(AE_OK); } /* Find the ACPI table */ - status = acpi_tb_find_table (operand[1]->string.pointer, - operand[2]->string.pointer, - operand[3]->string.pointer, &table); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_tb_find_table(operand[1]->string.pointer, + operand[2]->string.pointer, + operand[3]->string.pointer, &table); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* Create the region descriptor */ - obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_REGION); + obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_REGION); if (!obj_desc) { - return_ACPI_STATUS (AE_NO_MEMORY); + return_ACPI_STATUS(AE_NO_MEMORY); } - region_obj2 = obj_desc->common.next_object; + region_obj2 = obj_desc->common.next_object; region_obj2->extra.region_context = NULL; /* Init the region from the operands */ obj_desc->region.space_id = REGION_DATA_TABLE; - obj_desc->region.address = (acpi_physical_address) ACPI_TO_INTEGER (table); + obj_desc->region.address = + (acpi_physical_address) ACPI_TO_INTEGER(table); obj_desc->region.length = table->length; - obj_desc->region.node = node; - obj_desc->region.flags = AOPOBJ_DATA_VALID; + obj_desc->region.node = node; + obj_desc->region.flags = AOPOBJ_DATA_VALID; /* Install the new region object in the parent Node */ - status = acpi_ns_attach_object (node, obj_desc, ACPI_TYPE_REGION); - if (ACPI_FAILURE (status)) { + status = acpi_ns_attach_object(node, obj_desc, ACPI_TYPE_REGION); + if (ACPI_FAILURE(status)) { goto cleanup; } - status = acpi_ev_initialize_region (obj_desc, FALSE); - if (ACPI_FAILURE (status)) { + status = acpi_ev_initialize_region(obj_desc, FALSE); + if (ACPI_FAILURE(status)) { if (status == AE_NOT_EXIST) { status = AE_OK; - } - else { + } else { goto cleanup; } } obj_desc->region.flags |= AOPOBJ_SETUP_COMPLETE; - -cleanup: + cleanup: /* Remove local reference to the object */ - acpi_ut_remove_reference (obj_desc); - return_ACPI_STATUS (status); + acpi_ut_remove_reference(obj_desc); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_ex_create_processor @@ -468,43 +446,39 @@ cleanup: * ******************************************************************************/ -acpi_status -acpi_ex_create_processor ( - struct acpi_walk_state *walk_state) +acpi_status acpi_ex_create_processor(struct acpi_walk_state *walk_state) { - union acpi_operand_object **operand = &walk_state->operands[0]; - union acpi_operand_object *obj_desc; - acpi_status status; - - - ACPI_FUNCTION_TRACE_PTR ("ex_create_processor", walk_state); + union acpi_operand_object **operand = &walk_state->operands[0]; + union acpi_operand_object *obj_desc; + acpi_status status; + ACPI_FUNCTION_TRACE_PTR("ex_create_processor", walk_state); /* Create the processor object */ - obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_PROCESSOR); + obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_PROCESSOR); if (!obj_desc) { - return_ACPI_STATUS (AE_NO_MEMORY); + return_ACPI_STATUS(AE_NO_MEMORY); } /* Initialize the processor object from the operands */ - obj_desc->processor.proc_id = (u8) operand[1]->integer.value; - obj_desc->processor.address = (acpi_io_address) operand[2]->integer.value; - obj_desc->processor.length = (u8) operand[3]->integer.value; + obj_desc->processor.proc_id = (u8) operand[1]->integer.value; + obj_desc->processor.address = + (acpi_io_address) operand[2]->integer.value; + obj_desc->processor.length = (u8) operand[3]->integer.value; /* Install the processor object in the parent Node */ - status = acpi_ns_attach_object ((struct acpi_namespace_node *) operand[0], - obj_desc, ACPI_TYPE_PROCESSOR); + status = acpi_ns_attach_object((struct acpi_namespace_node *)operand[0], + obj_desc, ACPI_TYPE_PROCESSOR); /* Remove local reference to the object */ - acpi_ut_remove_reference (obj_desc); - return_ACPI_STATUS (status); + acpi_ut_remove_reference(obj_desc); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_ex_create_power_resource @@ -519,43 +493,39 @@ acpi_ex_create_processor ( * ******************************************************************************/ -acpi_status -acpi_ex_create_power_resource ( - struct acpi_walk_state *walk_state) +acpi_status acpi_ex_create_power_resource(struct acpi_walk_state *walk_state) { - union acpi_operand_object **operand = &walk_state->operands[0]; - acpi_status status; - union acpi_operand_object *obj_desc; - - - ACPI_FUNCTION_TRACE_PTR ("ex_create_power_resource", walk_state); + union acpi_operand_object **operand = &walk_state->operands[0]; + acpi_status status; + union acpi_operand_object *obj_desc; + ACPI_FUNCTION_TRACE_PTR("ex_create_power_resource", walk_state); /* Create the power resource object */ - obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_POWER); + obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_POWER); if (!obj_desc) { - return_ACPI_STATUS (AE_NO_MEMORY); + return_ACPI_STATUS(AE_NO_MEMORY); } /* Initialize the power object from the operands */ obj_desc->power_resource.system_level = (u8) operand[1]->integer.value; - obj_desc->power_resource.resource_order = (u16) operand[2]->integer.value; + obj_desc->power_resource.resource_order = + (u16) operand[2]->integer.value; /* Install the power resource object in the parent Node */ - status = acpi_ns_attach_object ((struct acpi_namespace_node *) operand[0], - obj_desc, ACPI_TYPE_POWER); + status = acpi_ns_attach_object((struct acpi_namespace_node *)operand[0], + obj_desc, ACPI_TYPE_POWER); /* Remove local reference to the object */ - acpi_ut_remove_reference (obj_desc); - return_ACPI_STATUS (status); + acpi_ut_remove_reference(obj_desc); + return_ACPI_STATUS(status); } #endif - /******************************************************************************* * * FUNCTION: acpi_ex_create_method @@ -571,25 +541,21 @@ acpi_ex_create_power_resource ( ******************************************************************************/ acpi_status -acpi_ex_create_method ( - u8 *aml_start, - u32 aml_length, - struct acpi_walk_state *walk_state) +acpi_ex_create_method(u8 * aml_start, + u32 aml_length, struct acpi_walk_state *walk_state) { - union acpi_operand_object **operand = &walk_state->operands[0]; - union acpi_operand_object *obj_desc; - acpi_status status; - u8 method_flags; - - - ACPI_FUNCTION_TRACE_PTR ("ex_create_method", walk_state); + union acpi_operand_object **operand = &walk_state->operands[0]; + union acpi_operand_object *obj_desc; + acpi_status status; + u8 method_flags; + ACPI_FUNCTION_TRACE_PTR("ex_create_method", walk_state); /* Create a new method object */ - obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_METHOD); + obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_METHOD); if (!obj_desc) { - return_ACPI_STATUS (AE_NO_MEMORY); + return_ACPI_STATUS(AE_NO_MEMORY); } /* Save the method's AML pointer and length */ @@ -603,8 +569,10 @@ acpi_ex_create_method ( */ method_flags = (u8) operand[1]->integer.value; - obj_desc->method.method_flags = (u8) (method_flags & ~AML_METHOD_ARG_COUNT); - obj_desc->method.param_count = (u8) (method_flags & AML_METHOD_ARG_COUNT); + obj_desc->method.method_flags = + (u8) (method_flags & ~AML_METHOD_ARG_COUNT); + obj_desc->method.param_count = + (u8) (method_flags & AML_METHOD_ARG_COUNT); /* * Get the concurrency count. If required, a semaphore will be @@ -613,32 +581,28 @@ acpi_ex_create_method ( if (acpi_gbl_all_methods_serialized) { obj_desc->method.concurrency = 1; obj_desc->method.method_flags |= AML_METHOD_SERIALIZED; - } - else if (method_flags & AML_METHOD_SERIALIZED) { + } else if (method_flags & AML_METHOD_SERIALIZED) { /* * ACPI 1.0: Concurrency = 1 * ACPI 2.0: Concurrency = (sync_level (in method declaration) + 1) */ obj_desc->method.concurrency = (u8) - (((method_flags & AML_METHOD_SYNCH_LEVEL) >> 4) + 1); - } - else { + (((method_flags & AML_METHOD_SYNCH_LEVEL) >> 4) + 1); + } else { obj_desc->method.concurrency = ACPI_INFINITE_CONCURRENCY; } /* Attach the new object to the method Node */ - status = acpi_ns_attach_object ((struct acpi_namespace_node *) operand[0], - obj_desc, ACPI_TYPE_METHOD); + status = acpi_ns_attach_object((struct acpi_namespace_node *)operand[0], + obj_desc, ACPI_TYPE_METHOD); /* Remove local reference to the object */ - acpi_ut_remove_reference (obj_desc); + acpi_ut_remove_reference(obj_desc); /* Remove a reference to the operand */ - acpi_ut_remove_reference (operand[1]); - return_ACPI_STATUS (status); + acpi_ut_remove_reference(operand[1]); + return_ACPI_STATUS(status); } - - diff --git a/drivers/acpi/executer/exdump.c b/drivers/acpi/executer/exdump.c index 4f98dceed39..bc2fa996047 100644 --- a/drivers/acpi/executer/exdump.c +++ b/drivers/acpi/executer/exdump.c @@ -41,7 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include #include #include @@ -49,46 +48,27 @@ #include #define _COMPONENT ACPI_EXECUTER - ACPI_MODULE_NAME ("exdump") +ACPI_MODULE_NAME("exdump") /* * The following routines are used for debug output only */ #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) - /* Local prototypes */ - #ifdef ACPI_FUTURE_USAGE -static void -acpi_ex_out_string ( - char *title, - char *value); +static void acpi_ex_out_string(char *title, char *value); -static void -acpi_ex_out_pointer ( - char *title, - void *value); +static void acpi_ex_out_pointer(char *title, void *value); -static void -acpi_ex_out_integer ( - char *title, - u32 value); +static void acpi_ex_out_integer(char *title, u32 value); -static void -acpi_ex_out_address ( - char *title, - acpi_physical_address value); +static void acpi_ex_out_address(char *title, acpi_physical_address value); -static void -acpi_ex_dump_reference ( - union acpi_operand_object *obj_desc); +static void acpi_ex_dump_reference(union acpi_operand_object *obj_desc); static void -acpi_ex_dump_package ( - union acpi_operand_object *obj_desc, - u32 level, - u32 index); -#endif /* ACPI_FUTURE_USAGE */ +acpi_ex_dump_package(union acpi_operand_object *obj_desc, u32 level, u32 index); +#endif /* ACPI_FUTURE_USAGE */ /******************************************************************************* * @@ -103,143 +83,140 @@ acpi_ex_dump_package ( * ******************************************************************************/ -void -acpi_ex_dump_operand ( - union acpi_operand_object *obj_desc, - u32 depth) +void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth) { - u32 length; - u32 index; - - - ACPI_FUNCTION_NAME ("ex_dump_operand") + u32 length; + u32 index; + ACPI_FUNCTION_NAME("ex_dump_operand") - if (!((ACPI_LV_EXEC & acpi_dbg_level) && (_COMPONENT & acpi_dbg_layer))) { + if (! + ((ACPI_LV_EXEC & acpi_dbg_level) + && (_COMPONENT & acpi_dbg_layer))) { return; } if (!obj_desc) { /* This could be a null element of a package */ - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Null Object Descriptor\n")); + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Null Object Descriptor\n")); return; } - if (ACPI_GET_DESCRIPTOR_TYPE (obj_desc) == ACPI_DESC_TYPE_NAMED) { - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%p Namespace Node: ", obj_desc)); - ACPI_DUMP_ENTRY (obj_desc, ACPI_LV_EXEC); + if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) == ACPI_DESC_TYPE_NAMED) { + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "%p Namespace Node: ", + obj_desc)); + ACPI_DUMP_ENTRY(obj_desc, ACPI_LV_EXEC); return; } - if (ACPI_GET_DESCRIPTOR_TYPE (obj_desc) != ACPI_DESC_TYPE_OPERAND) { - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "%p is not a node or operand object: [%s]\n", - obj_desc, acpi_ut_get_descriptor_name (obj_desc))); - ACPI_DUMP_BUFFER (obj_desc, sizeof (union acpi_operand_object)); + if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) != ACPI_DESC_TYPE_OPERAND) { + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, + "%p is not a node or operand object: [%s]\n", + obj_desc, + acpi_ut_get_descriptor_name(obj_desc))); + ACPI_DUMP_BUFFER(obj_desc, sizeof(union acpi_operand_object)); return; } /* obj_desc is a valid object */ if (depth > 0) { - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%*s[%u] %p ", - depth, " ", depth, obj_desc)); - } - else { - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%p ", obj_desc)); + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "%*s[%u] %p ", + depth, " ", depth, obj_desc)); + } else { + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "%p ", obj_desc)); } /* Decode object type */ - switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { + switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { case ACPI_TYPE_LOCAL_REFERENCE: switch (obj_desc->reference.opcode) { case AML_DEBUG_OP: - acpi_os_printf ("Reference: Debug\n"); + acpi_os_printf("Reference: Debug\n"); break; - case AML_NAME_OP: - ACPI_DUMP_PATHNAME (obj_desc->reference.object, - "Reference: Name: ", ACPI_LV_INFO, _COMPONENT); - ACPI_DUMP_ENTRY (obj_desc->reference.object, ACPI_LV_INFO); + ACPI_DUMP_PATHNAME(obj_desc->reference.object, + "Reference: Name: ", ACPI_LV_INFO, + _COMPONENT); + ACPI_DUMP_ENTRY(obj_desc->reference.object, + ACPI_LV_INFO); break; - case AML_INDEX_OP: - acpi_os_printf ("Reference: Index %p\n", - obj_desc->reference.object); + acpi_os_printf("Reference: Index %p\n", + obj_desc->reference.object); break; - case AML_REF_OF_OP: - acpi_os_printf ("Reference: (ref_of) %p\n", - obj_desc->reference.object); + acpi_os_printf("Reference: (ref_of) %p\n", + obj_desc->reference.object); break; - case AML_ARG_OP: - acpi_os_printf ("Reference: Arg%d", - obj_desc->reference.offset); + acpi_os_printf("Reference: Arg%d", + obj_desc->reference.offset); - if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_INTEGER) { + if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) { /* Value is an Integer */ - acpi_os_printf (" value is [%8.8X%8.8x]", - ACPI_FORMAT_UINT64 (obj_desc->integer.value)); + acpi_os_printf(" value is [%8.8X%8.8x]", + ACPI_FORMAT_UINT64(obj_desc-> + integer. + value)); } - acpi_os_printf ("\n"); + acpi_os_printf("\n"); break; - case AML_LOCAL_OP: - acpi_os_printf ("Reference: Local%d", - obj_desc->reference.offset); + acpi_os_printf("Reference: Local%d", + obj_desc->reference.offset); - if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_INTEGER) { + if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) { /* Value is an Integer */ - acpi_os_printf (" value is [%8.8X%8.8x]", - ACPI_FORMAT_UINT64 (obj_desc->integer.value)); + acpi_os_printf(" value is [%8.8X%8.8x]", + ACPI_FORMAT_UINT64(obj_desc-> + integer. + value)); } - acpi_os_printf ("\n"); + acpi_os_printf("\n"); break; - case AML_INT_NAMEPATH_OP: - acpi_os_printf ("Reference.Node->Name %X\n", - obj_desc->reference.node->name.integer); + acpi_os_printf("Reference.Node->Name %X\n", + obj_desc->reference.node->name.integer); break; - default: /* Unknown opcode */ - acpi_os_printf ("Unknown Reference opcode=%X\n", - obj_desc->reference.opcode); + acpi_os_printf("Unknown Reference opcode=%X\n", + obj_desc->reference.opcode); break; } break; - case ACPI_TYPE_BUFFER: - acpi_os_printf ("Buffer len %X @ %p \n", - obj_desc->buffer.length, obj_desc->buffer.pointer); + acpi_os_printf("Buffer len %X @ %p \n", + obj_desc->buffer.length, + obj_desc->buffer.pointer); length = obj_desc->buffer.length; if (length > 64) { @@ -249,178 +226,166 @@ acpi_ex_dump_operand ( /* Debug only -- dump the buffer contents */ if (obj_desc->buffer.pointer) { - acpi_os_printf ("Buffer Contents: "); + acpi_os_printf("Buffer Contents: "); for (index = 0; index < length; index++) { - acpi_os_printf (" %02x", obj_desc->buffer.pointer[index]); + acpi_os_printf(" %02x", + obj_desc->buffer.pointer[index]); } - acpi_os_printf ("\n"); + acpi_os_printf("\n"); } break; - case ACPI_TYPE_INTEGER: - acpi_os_printf ("Integer %8.8X%8.8X\n", - ACPI_FORMAT_UINT64 (obj_desc->integer.value)); + acpi_os_printf("Integer %8.8X%8.8X\n", + ACPI_FORMAT_UINT64(obj_desc->integer.value)); break; - case ACPI_TYPE_PACKAGE: - acpi_os_printf ("Package [Len %X] element_array %p\n", - obj_desc->package.count, obj_desc->package.elements); + acpi_os_printf("Package [Len %X] element_array %p\n", + obj_desc->package.count, + obj_desc->package.elements); /* * If elements exist, package element pointer is valid, * and debug_level exceeds 1, dump package's elements. */ if (obj_desc->package.count && - obj_desc->package.elements && - acpi_dbg_level > 1) { - for (index = 0; index < obj_desc->package.count; index++) { - acpi_ex_dump_operand (obj_desc->package.elements[index], depth+1); + obj_desc->package.elements && acpi_dbg_level > 1) { + for (index = 0; index < obj_desc->package.count; + index++) { + acpi_ex_dump_operand(obj_desc->package. + elements[index], + depth + 1); } } break; - case ACPI_TYPE_REGION: - acpi_os_printf ("Region %s (%X)", - acpi_ut_get_region_name (obj_desc->region.space_id), - obj_desc->region.space_id); + acpi_os_printf("Region %s (%X)", + acpi_ut_get_region_name(obj_desc->region. + space_id), + obj_desc->region.space_id); /* * If the address and length have not been evaluated, * don't print them. */ if (!(obj_desc->region.flags & AOPOBJ_DATA_VALID)) { - acpi_os_printf ("\n"); - } - else { - acpi_os_printf (" base %8.8X%8.8X Length %X\n", - ACPI_FORMAT_UINT64 (obj_desc->region.address), - obj_desc->region.length); + acpi_os_printf("\n"); + } else { + acpi_os_printf(" base %8.8X%8.8X Length %X\n", + ACPI_FORMAT_UINT64(obj_desc->region. + address), + obj_desc->region.length); } break; - case ACPI_TYPE_STRING: - acpi_os_printf ("String length %X @ %p ", - obj_desc->string.length, - obj_desc->string.pointer); + acpi_os_printf("String length %X @ %p ", + obj_desc->string.length, + obj_desc->string.pointer); - acpi_ut_print_string (obj_desc->string.pointer, ACPI_UINT8_MAX); - acpi_os_printf ("\n"); + acpi_ut_print_string(obj_desc->string.pointer, ACPI_UINT8_MAX); + acpi_os_printf("\n"); break; - case ACPI_TYPE_LOCAL_BANK_FIELD: - acpi_os_printf ("bank_field\n"); + acpi_os_printf("bank_field\n"); break; - case ACPI_TYPE_LOCAL_REGION_FIELD: - acpi_os_printf ( - "region_field: Bits=%X acc_width=%X Lock=%X Update=%X at byte=%X bit=%X of below:\n", - obj_desc->field.bit_length, - obj_desc->field.access_byte_width, - obj_desc->field.field_flags & AML_FIELD_LOCK_RULE_MASK, - obj_desc->field.field_flags & AML_FIELD_UPDATE_RULE_MASK, - obj_desc->field.base_byte_offset, - obj_desc->field.start_field_bit_offset); + acpi_os_printf + ("region_field: Bits=%X acc_width=%X Lock=%X Update=%X at byte=%X bit=%X of below:\n", + obj_desc->field.bit_length, + obj_desc->field.access_byte_width, + obj_desc->field.field_flags & AML_FIELD_LOCK_RULE_MASK, + obj_desc->field.field_flags & AML_FIELD_UPDATE_RULE_MASK, + obj_desc->field.base_byte_offset, + obj_desc->field.start_field_bit_offset); - acpi_ex_dump_operand (obj_desc->field.region_obj, depth+1); + acpi_ex_dump_operand(obj_desc->field.region_obj, depth + 1); break; - case ACPI_TYPE_LOCAL_INDEX_FIELD: - acpi_os_printf ("index_field\n"); + acpi_os_printf("index_field\n"); break; - case ACPI_TYPE_BUFFER_FIELD: - acpi_os_printf ( - "buffer_field: %X bits at byte %X bit %X of \n", - obj_desc->buffer_field.bit_length, - obj_desc->buffer_field.base_byte_offset, - obj_desc->buffer_field.start_field_bit_offset); + acpi_os_printf("buffer_field: %X bits at byte %X bit %X of \n", + obj_desc->buffer_field.bit_length, + obj_desc->buffer_field.base_byte_offset, + obj_desc->buffer_field.start_field_bit_offset); if (!obj_desc->buffer_field.buffer_obj) { - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "*NULL* \n")); - } - else if (ACPI_GET_OBJECT_TYPE (obj_desc->buffer_field.buffer_obj) != - ACPI_TYPE_BUFFER) { - acpi_os_printf ("*not a Buffer* \n"); - } - else { - acpi_ex_dump_operand (obj_desc->buffer_field.buffer_obj, depth+1); + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "*NULL* \n")); + } else + if (ACPI_GET_OBJECT_TYPE(obj_desc->buffer_field.buffer_obj) + != ACPI_TYPE_BUFFER) { + acpi_os_printf("*not a Buffer* \n"); + } else { + acpi_ex_dump_operand(obj_desc->buffer_field.buffer_obj, + depth + 1); } break; - case ACPI_TYPE_EVENT: - acpi_os_printf ("Event\n"); + acpi_os_printf("Event\n"); break; - case ACPI_TYPE_METHOD: - acpi_os_printf ("Method(%X) @ %p:%X\n", - obj_desc->method.param_count, - obj_desc->method.aml_start, - obj_desc->method.aml_length); + acpi_os_printf("Method(%X) @ %p:%X\n", + obj_desc->method.param_count, + obj_desc->method.aml_start, + obj_desc->method.aml_length); break; - case ACPI_TYPE_MUTEX: - acpi_os_printf ("Mutex\n"); + acpi_os_printf("Mutex\n"); break; - case ACPI_TYPE_DEVICE: - acpi_os_printf ("Device\n"); + acpi_os_printf("Device\n"); break; - case ACPI_TYPE_POWER: - acpi_os_printf ("Power\n"); + acpi_os_printf("Power\n"); break; - case ACPI_TYPE_PROCESSOR: - acpi_os_printf ("Processor\n"); + acpi_os_printf("Processor\n"); break; - case ACPI_TYPE_THERMAL: - acpi_os_printf ("Thermal\n"); + acpi_os_printf("Thermal\n"); break; - default: /* Unknown Type */ - acpi_os_printf ("Unknown Type %X\n", ACPI_GET_OBJECT_TYPE (obj_desc)); + acpi_os_printf("Unknown Type %X\n", + ACPI_GET_OBJECT_TYPE(obj_desc)); break; } return; } - /******************************************************************************* * * FUNCTION: acpi_ex_dump_operands @@ -438,20 +403,15 @@ acpi_ex_dump_operand ( ******************************************************************************/ void -acpi_ex_dump_operands ( - union acpi_operand_object **operands, - acpi_interpreter_mode interpreter_mode, - char *ident, - u32 num_levels, - char *note, - char *module_name, - u32 line_number) +acpi_ex_dump_operands(union acpi_operand_object **operands, + acpi_interpreter_mode interpreter_mode, + char *ident, + u32 num_levels, + char *note, char *module_name, u32 line_number) { - acpi_native_uint i; - - - ACPI_FUNCTION_NAME ("ex_dump_operands"); + acpi_native_uint i; + ACPI_FUNCTION_NAME("ex_dump_operands"); if (!ident) { ident = "?"; @@ -461,9 +421,9 @@ acpi_ex_dump_operands ( note = "?"; } - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "************* Operand Stack Contents (Opcode [%s], %d Operands)\n", - ident, num_levels)); + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, + "************* Operand Stack Contents (Opcode [%s], %d Operands)\n", + ident, num_levels)); if (num_levels == 0) { num_levels = 1; @@ -472,16 +432,15 @@ acpi_ex_dump_operands ( /* Dump the operand stack starting at the top */ for (i = 0; num_levels > 0; i--, num_levels--) { - acpi_ex_dump_operand (operands[i], 0); + acpi_ex_dump_operand(operands[i], 0); } - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "************* Operand Stack dump from %s(%d), %s\n", - module_name, line_number, note)); + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, + "************* Operand Stack dump from %s(%d), %s\n", + module_name, line_number, note)); return; } - #ifdef ACPI_FUTURE_USAGE /******************************************************************************* * @@ -496,44 +455,31 @@ acpi_ex_dump_operands ( * ******************************************************************************/ -static void -acpi_ex_out_string ( - char *title, - char *value) +static void acpi_ex_out_string(char *title, char *value) { - acpi_os_printf ("%20s : %s\n", title, value); + acpi_os_printf("%20s : %s\n", title, value); } -static void -acpi_ex_out_pointer ( - char *title, - void *value) +static void acpi_ex_out_pointer(char *title, void *value) { - acpi_os_printf ("%20s : %p\n", title, value); + acpi_os_printf("%20s : %p\n", title, value); } -static void -acpi_ex_out_integer ( - char *title, - u32 value) +static void acpi_ex_out_integer(char *title, u32 value) { - acpi_os_printf ("%20s : %.2X\n", title, value); + acpi_os_printf("%20s : %.2X\n", title, value); } -static void -acpi_ex_out_address ( - char *title, - acpi_physical_address value) +static void acpi_ex_out_address(char *title, acpi_physical_address value) { #if ACPI_MACHINE_WIDTH == 16 - acpi_os_printf ("%20s : %p\n", title, value); + acpi_os_printf("%20s : %p\n", title, value); #else - acpi_os_printf ("%20s : %8.8X%8.8X\n", title, ACPI_FORMAT_UINT64 (value)); + acpi_os_printf("%20s : %8.8X%8.8X\n", title, ACPI_FORMAT_UINT64(value)); #endif } - /******************************************************************************* * * FUNCTION: acpi_ex_dump_node @@ -545,33 +491,31 @@ acpi_ex_out_address ( * ******************************************************************************/ -void -acpi_ex_dump_node ( - struct acpi_namespace_node *node, - u32 flags) +void acpi_ex_dump_node(struct acpi_namespace_node *node, u32 flags) { - ACPI_FUNCTION_ENTRY (); - + ACPI_FUNCTION_ENTRY(); if (!flags) { - if (!((ACPI_LV_OBJECTS & acpi_dbg_level) && (_COMPONENT & acpi_dbg_layer))) { + if (! + ((ACPI_LV_OBJECTS & acpi_dbg_level) + && (_COMPONENT & acpi_dbg_layer))) { return; } } - acpi_os_printf ("%20s : %4.4s\n", "Name", acpi_ut_get_node_name (node)); - acpi_ex_out_string ("Type", acpi_ut_get_type_name (node->type)); - acpi_ex_out_integer ("Flags", node->flags); - acpi_ex_out_integer ("Owner Id", node->owner_id); - acpi_ex_out_integer ("Reference Count", node->reference_count); - acpi_ex_out_pointer ("Attached Object", acpi_ns_get_attached_object (node)); - acpi_ex_out_pointer ("child_list", node->child); - acpi_ex_out_pointer ("next_peer", node->peer); - acpi_ex_out_pointer ("Parent", acpi_ns_get_parent_node (node)); + acpi_os_printf("%20s : %4.4s\n", "Name", acpi_ut_get_node_name(node)); + acpi_ex_out_string("Type", acpi_ut_get_type_name(node->type)); + acpi_ex_out_integer("Flags", node->flags); + acpi_ex_out_integer("Owner Id", node->owner_id); + acpi_ex_out_integer("Reference Count", node->reference_count); + acpi_ex_out_pointer("Attached Object", + acpi_ns_get_attached_object(node)); + acpi_ex_out_pointer("child_list", node->child); + acpi_ex_out_pointer("next_peer", node->peer); + acpi_ex_out_pointer("Parent", acpi_ns_get_parent_node(node)); } - /******************************************************************************* * * FUNCTION: acpi_ex_dump_reference @@ -582,32 +526,29 @@ acpi_ex_dump_node ( * ******************************************************************************/ -static void -acpi_ex_dump_reference ( - union acpi_operand_object *obj_desc) +static void acpi_ex_dump_reference(union acpi_operand_object *obj_desc) { - struct acpi_buffer ret_buf; - acpi_status status; - + struct acpi_buffer ret_buf; + acpi_status status; if (obj_desc->reference.opcode == AML_INT_NAMEPATH_OP) { - acpi_os_printf ("Named Object %p ", obj_desc->reference.node); + acpi_os_printf("Named Object %p ", obj_desc->reference.node); ret_buf.length = ACPI_ALLOCATE_LOCAL_BUFFER; - status = acpi_ns_handle_to_pathname (obj_desc->reference.node, &ret_buf); - if (ACPI_FAILURE (status)) { - acpi_os_printf ("Could not convert name to pathname\n"); + status = + acpi_ns_handle_to_pathname(obj_desc->reference.node, + &ret_buf); + if (ACPI_FAILURE(status)) { + acpi_os_printf("Could not convert name to pathname\n"); + } else { + acpi_os_printf("%s\n", (char *)ret_buf.pointer); + ACPI_MEM_FREE(ret_buf.pointer); } - else { - acpi_os_printf ("%s\n", (char *) ret_buf.pointer); - ACPI_MEM_FREE (ret_buf.pointer); - } - } - else if (obj_desc->reference.object) { - acpi_os_printf ("\nReferenced Object: %p\n", obj_desc->reference.object); + } else if (obj_desc->reference.object) { + acpi_os_printf("\nReferenced Object: %p\n", + obj_desc->reference.object); } } - /******************************************************************************* * * FUNCTION: acpi_ex_dump_package @@ -621,92 +562,85 @@ acpi_ex_dump_reference ( ******************************************************************************/ static void -acpi_ex_dump_package ( - union acpi_operand_object *obj_desc, - u32 level, - u32 index) +acpi_ex_dump_package(union acpi_operand_object *obj_desc, u32 level, u32 index) { - u32 i; - + u32 i; /* Indentation and index output */ if (level > 0) { for (i = 0; i < level; i++) { - acpi_os_printf (" "); + acpi_os_printf(" "); } - acpi_os_printf ("[%.2d] ", index); + acpi_os_printf("[%.2d] ", index); } - acpi_os_printf ("%p ", obj_desc); + acpi_os_printf("%p ", obj_desc); /* Null package elements are allowed */ if (!obj_desc) { - acpi_os_printf ("[Null Object]\n"); + acpi_os_printf("[Null Object]\n"); return; } /* Packages may only contain a few object types */ - switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { + switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { case ACPI_TYPE_INTEGER: - acpi_os_printf ("[Integer] = %8.8X%8.8X\n", - ACPI_FORMAT_UINT64 (obj_desc->integer.value)); + acpi_os_printf("[Integer] = %8.8X%8.8X\n", + ACPI_FORMAT_UINT64(obj_desc->integer.value)); break; - case ACPI_TYPE_STRING: - acpi_os_printf ("[String] Value: "); + acpi_os_printf("[String] Value: "); for (i = 0; i < obj_desc->string.length; i++) { - acpi_os_printf ("%c", obj_desc->string.pointer[i]); + acpi_os_printf("%c", obj_desc->string.pointer[i]); } - acpi_os_printf ("\n"); + acpi_os_printf("\n"); break; - case ACPI_TYPE_BUFFER: - acpi_os_printf ("[Buffer] Length %.2X = ", obj_desc->buffer.length); + acpi_os_printf("[Buffer] Length %.2X = ", + obj_desc->buffer.length); if (obj_desc->buffer.length) { - acpi_ut_dump_buffer ((u8 *) obj_desc->buffer.pointer, - obj_desc->buffer.length, DB_DWORD_DISPLAY, _COMPONENT); - } - else { - acpi_os_printf ("\n"); + acpi_ut_dump_buffer((u8 *) obj_desc->buffer.pointer, + obj_desc->buffer.length, + DB_DWORD_DISPLAY, _COMPONENT); + } else { + acpi_os_printf("\n"); } break; - case ACPI_TYPE_PACKAGE: - acpi_os_printf ("[Package] Contains %d Elements: \n", - obj_desc->package.count); + acpi_os_printf("[Package] Contains %d Elements: \n", + obj_desc->package.count); for (i = 0; i < obj_desc->package.count; i++) { - acpi_ex_dump_package (obj_desc->package.elements[i], level+1, i); + acpi_ex_dump_package(obj_desc->package.elements[i], + level + 1, i); } break; - case ACPI_TYPE_LOCAL_REFERENCE: - acpi_os_printf ("[Object Reference] "); - acpi_ex_dump_reference (obj_desc); + acpi_os_printf("[Object Reference] "); + acpi_ex_dump_reference(obj_desc); break; - default: - acpi_os_printf ("[Unknown Type] %X\n", ACPI_GET_OBJECT_TYPE (obj_desc)); + acpi_os_printf("[Unknown Type] %X\n", + ACPI_GET_OBJECT_TYPE(obj_desc)); break; } } - /******************************************************************************* * * FUNCTION: acpi_ex_dump_object_descriptor @@ -719,190 +653,213 @@ acpi_ex_dump_package ( ******************************************************************************/ void -acpi_ex_dump_object_descriptor ( - union acpi_operand_object *obj_desc, - u32 flags) +acpi_ex_dump_object_descriptor(union acpi_operand_object *obj_desc, u32 flags) { - ACPI_FUNCTION_TRACE ("ex_dump_object_descriptor"); - + ACPI_FUNCTION_TRACE("ex_dump_object_descriptor"); if (!obj_desc) { return_VOID; } if (!flags) { - if (!((ACPI_LV_OBJECTS & acpi_dbg_level) && (_COMPONENT & acpi_dbg_layer))) { + if (! + ((ACPI_LV_OBJECTS & acpi_dbg_level) + && (_COMPONENT & acpi_dbg_layer))) { return_VOID; } } - if (ACPI_GET_DESCRIPTOR_TYPE (obj_desc) == ACPI_DESC_TYPE_NAMED) { - acpi_ex_dump_node ((struct acpi_namespace_node *) obj_desc, flags); - acpi_os_printf ("\nAttached Object (%p):\n", - ((struct acpi_namespace_node *) obj_desc)->object); - acpi_ex_dump_object_descriptor ( - ((struct acpi_namespace_node *) obj_desc)->object, flags); + if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) == ACPI_DESC_TYPE_NAMED) { + acpi_ex_dump_node((struct acpi_namespace_node *)obj_desc, + flags); + acpi_os_printf("\nAttached Object (%p):\n", + ((struct acpi_namespace_node *)obj_desc)-> + object); + acpi_ex_dump_object_descriptor(((struct acpi_namespace_node *) + obj_desc)->object, flags); return_VOID; } - if (ACPI_GET_DESCRIPTOR_TYPE (obj_desc) != ACPI_DESC_TYPE_OPERAND) { - acpi_os_printf ( - "ex_dump_object_descriptor: %p is not an ACPI operand object: [%s]\n", - obj_desc, acpi_ut_get_descriptor_name (obj_desc)); + if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) != ACPI_DESC_TYPE_OPERAND) { + acpi_os_printf + ("ex_dump_object_descriptor: %p is not an ACPI operand object: [%s]\n", + obj_desc, acpi_ut_get_descriptor_name(obj_desc)); return_VOID; } /* Common Fields */ - acpi_ex_out_string ("Type", acpi_ut_get_object_type_name (obj_desc)); - acpi_ex_out_integer ("Reference Count", obj_desc->common.reference_count); - acpi_ex_out_integer ("Flags", obj_desc->common.flags); + acpi_ex_out_string("Type", acpi_ut_get_object_type_name(obj_desc)); + acpi_ex_out_integer("Reference Count", + obj_desc->common.reference_count); + acpi_ex_out_integer("Flags", obj_desc->common.flags); /* Object-specific Fields */ - switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { + switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { case ACPI_TYPE_INTEGER: - acpi_os_printf ("%20s : %8.8X%8.8X\n", "Value", - ACPI_FORMAT_UINT64 (obj_desc->integer.value)); + acpi_os_printf("%20s : %8.8X%8.8X\n", "Value", + ACPI_FORMAT_UINT64(obj_desc->integer.value)); break; - case ACPI_TYPE_STRING: - acpi_ex_out_integer ("Length", obj_desc->string.length); + acpi_ex_out_integer("Length", obj_desc->string.length); - acpi_os_printf ("%20s : %p ", "Pointer", obj_desc->string.pointer); - acpi_ut_print_string (obj_desc->string.pointer, ACPI_UINT8_MAX); - acpi_os_printf ("\n"); + acpi_os_printf("%20s : %p ", "Pointer", + obj_desc->string.pointer); + acpi_ut_print_string(obj_desc->string.pointer, ACPI_UINT8_MAX); + acpi_os_printf("\n"); break; - case ACPI_TYPE_BUFFER: - acpi_ex_out_integer ("Length", obj_desc->buffer.length); - acpi_ex_out_pointer ("Pointer", obj_desc->buffer.pointer); - ACPI_DUMP_BUFFER (obj_desc->buffer.pointer, obj_desc->buffer.length); + acpi_ex_out_integer("Length", obj_desc->buffer.length); + acpi_ex_out_pointer("Pointer", obj_desc->buffer.pointer); + ACPI_DUMP_BUFFER(obj_desc->buffer.pointer, + obj_desc->buffer.length); break; - case ACPI_TYPE_PACKAGE: - acpi_ex_out_integer ("Flags", obj_desc->package.flags); - acpi_ex_out_integer ("Elements", obj_desc->package.count); - acpi_ex_out_pointer ("Element List", obj_desc->package.elements); + acpi_ex_out_integer("Flags", obj_desc->package.flags); + acpi_ex_out_integer("Elements", obj_desc->package.count); + acpi_ex_out_pointer("Element List", obj_desc->package.elements); /* Dump the package contents */ - acpi_os_printf ("\nPackage Contents:\n"); - acpi_ex_dump_package (obj_desc, 0, 0); + acpi_os_printf("\nPackage Contents:\n"); + acpi_ex_dump_package(obj_desc, 0, 0); break; - case ACPI_TYPE_DEVICE: - acpi_ex_out_pointer ("Handler", obj_desc->device.handler); - acpi_ex_out_pointer ("system_notify", obj_desc->device.system_notify); - acpi_ex_out_pointer ("device_notify", obj_desc->device.device_notify); + acpi_ex_out_pointer("Handler", obj_desc->device.handler); + acpi_ex_out_pointer("system_notify", + obj_desc->device.system_notify); + acpi_ex_out_pointer("device_notify", + obj_desc->device.device_notify); break; - case ACPI_TYPE_EVENT: - acpi_ex_out_pointer ("Semaphore", obj_desc->event.semaphore); + acpi_ex_out_pointer("Semaphore", obj_desc->event.semaphore); break; - case ACPI_TYPE_METHOD: - acpi_ex_out_integer ("param_count", obj_desc->method.param_count); - acpi_ex_out_integer ("Concurrency", obj_desc->method.concurrency); - acpi_ex_out_pointer ("Semaphore", obj_desc->method.semaphore); - acpi_ex_out_integer ("owner_id", obj_desc->method.owner_id); - acpi_ex_out_integer ("aml_length", obj_desc->method.aml_length); - acpi_ex_out_pointer ("aml_start", obj_desc->method.aml_start); + acpi_ex_out_integer("param_count", + obj_desc->method.param_count); + acpi_ex_out_integer("Concurrency", + obj_desc->method.concurrency); + acpi_ex_out_pointer("Semaphore", obj_desc->method.semaphore); + acpi_ex_out_integer("owner_id", obj_desc->method.owner_id); + acpi_ex_out_integer("aml_length", obj_desc->method.aml_length); + acpi_ex_out_pointer("aml_start", obj_desc->method.aml_start); break; - case ACPI_TYPE_MUTEX: - acpi_ex_out_integer ("sync_level", obj_desc->mutex.sync_level); - acpi_ex_out_pointer ("owner_thread", obj_desc->mutex.owner_thread); - acpi_ex_out_integer ("acquire_depth", obj_desc->mutex.acquisition_depth); - acpi_ex_out_pointer ("Semaphore", obj_desc->mutex.semaphore); + acpi_ex_out_integer("sync_level", obj_desc->mutex.sync_level); + acpi_ex_out_pointer("owner_thread", + obj_desc->mutex.owner_thread); + acpi_ex_out_integer("acquire_depth", + obj_desc->mutex.acquisition_depth); + acpi_ex_out_pointer("Semaphore", obj_desc->mutex.semaphore); break; - case ACPI_TYPE_REGION: - acpi_ex_out_integer ("space_id", obj_desc->region.space_id); - acpi_ex_out_integer ("Flags", obj_desc->region.flags); - acpi_ex_out_address ("Address", obj_desc->region.address); - acpi_ex_out_integer ("Length", obj_desc->region.length); - acpi_ex_out_pointer ("Handler", obj_desc->region.handler); - acpi_ex_out_pointer ("Next", obj_desc->region.next); + acpi_ex_out_integer("space_id", obj_desc->region.space_id); + acpi_ex_out_integer("Flags", obj_desc->region.flags); + acpi_ex_out_address("Address", obj_desc->region.address); + acpi_ex_out_integer("Length", obj_desc->region.length); + acpi_ex_out_pointer("Handler", obj_desc->region.handler); + acpi_ex_out_pointer("Next", obj_desc->region.next); break; - case ACPI_TYPE_POWER: - acpi_ex_out_integer ("system_level", obj_desc->power_resource.system_level); - acpi_ex_out_integer ("resource_order", obj_desc->power_resource.resource_order); - acpi_ex_out_pointer ("system_notify", obj_desc->power_resource.system_notify); - acpi_ex_out_pointer ("device_notify", obj_desc->power_resource.device_notify); + acpi_ex_out_integer("system_level", + obj_desc->power_resource.system_level); + acpi_ex_out_integer("resource_order", + obj_desc->power_resource.resource_order); + acpi_ex_out_pointer("system_notify", + obj_desc->power_resource.system_notify); + acpi_ex_out_pointer("device_notify", + obj_desc->power_resource.device_notify); break; - case ACPI_TYPE_PROCESSOR: - acpi_ex_out_integer ("Processor ID", obj_desc->processor.proc_id); - acpi_ex_out_integer ("Length", obj_desc->processor.length); - acpi_ex_out_address ("Address", (acpi_physical_address) obj_desc->processor.address); - acpi_ex_out_pointer ("system_notify", obj_desc->processor.system_notify); - acpi_ex_out_pointer ("device_notify", obj_desc->processor.device_notify); - acpi_ex_out_pointer ("Handler", obj_desc->processor.handler); + acpi_ex_out_integer("Processor ID", + obj_desc->processor.proc_id); + acpi_ex_out_integer("Length", obj_desc->processor.length); + acpi_ex_out_address("Address", + (acpi_physical_address) obj_desc->processor. + address); + acpi_ex_out_pointer("system_notify", + obj_desc->processor.system_notify); + acpi_ex_out_pointer("device_notify", + obj_desc->processor.device_notify); + acpi_ex_out_pointer("Handler", obj_desc->processor.handler); break; - case ACPI_TYPE_THERMAL: - acpi_ex_out_pointer ("system_notify", obj_desc->thermal_zone.system_notify); - acpi_ex_out_pointer ("device_notify", obj_desc->thermal_zone.device_notify); - acpi_ex_out_pointer ("Handler", obj_desc->thermal_zone.handler); + acpi_ex_out_pointer("system_notify", + obj_desc->thermal_zone.system_notify); + acpi_ex_out_pointer("device_notify", + obj_desc->thermal_zone.device_notify); + acpi_ex_out_pointer("Handler", obj_desc->thermal_zone.handler); break; - case ACPI_TYPE_BUFFER_FIELD: case ACPI_TYPE_LOCAL_REGION_FIELD: case ACPI_TYPE_LOCAL_BANK_FIELD: case ACPI_TYPE_LOCAL_INDEX_FIELD: - acpi_ex_out_integer ("field_flags", obj_desc->common_field.field_flags); - acpi_ex_out_integer ("access_byte_width",obj_desc->common_field.access_byte_width); - acpi_ex_out_integer ("bit_length", obj_desc->common_field.bit_length); - acpi_ex_out_integer ("fld_bit_offset", obj_desc->common_field.start_field_bit_offset); - acpi_ex_out_integer ("base_byte_offset", obj_desc->common_field.base_byte_offset); - acpi_ex_out_pointer ("parent_node", obj_desc->common_field.node); - - switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { + acpi_ex_out_integer("field_flags", + obj_desc->common_field.field_flags); + acpi_ex_out_integer("access_byte_width", + obj_desc->common_field.access_byte_width); + acpi_ex_out_integer("bit_length", + obj_desc->common_field.bit_length); + acpi_ex_out_integer("fld_bit_offset", + obj_desc->common_field. + start_field_bit_offset); + acpi_ex_out_integer("base_byte_offset", + obj_desc->common_field.base_byte_offset); + acpi_ex_out_pointer("parent_node", obj_desc->common_field.node); + + switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { case ACPI_TYPE_BUFFER_FIELD: - acpi_ex_out_pointer ("buffer_obj", obj_desc->buffer_field.buffer_obj); + acpi_ex_out_pointer("buffer_obj", + obj_desc->buffer_field.buffer_obj); break; case ACPI_TYPE_LOCAL_REGION_FIELD: - acpi_ex_out_pointer ("region_obj", obj_desc->field.region_obj); + acpi_ex_out_pointer("region_obj", + obj_desc->field.region_obj); break; case ACPI_TYPE_LOCAL_BANK_FIELD: - acpi_ex_out_integer ("Value", obj_desc->bank_field.value); - acpi_ex_out_pointer ("region_obj", obj_desc->bank_field.region_obj); - acpi_ex_out_pointer ("bank_obj", obj_desc->bank_field.bank_obj); + acpi_ex_out_integer("Value", + obj_desc->bank_field.value); + acpi_ex_out_pointer("region_obj", + obj_desc->bank_field.region_obj); + acpi_ex_out_pointer("bank_obj", + obj_desc->bank_field.bank_obj); break; case ACPI_TYPE_LOCAL_INDEX_FIELD: - acpi_ex_out_integer ("Value", obj_desc->index_field.value); - acpi_ex_out_pointer ("Index", obj_desc->index_field.index_obj); - acpi_ex_out_pointer ("Data", obj_desc->index_field.data_obj); + acpi_ex_out_integer("Value", + obj_desc->index_field.value); + acpi_ex_out_pointer("Index", + obj_desc->index_field.index_obj); + acpi_ex_out_pointer("Data", + obj_desc->index_field.data_obj); break; default: @@ -911,53 +868,52 @@ acpi_ex_dump_object_descriptor ( } break; - case ACPI_TYPE_LOCAL_REFERENCE: - acpi_ex_out_integer ("target_type", obj_desc->reference.target_type); - acpi_ex_out_string ("Opcode", (acpi_ps_get_opcode_info ( - obj_desc->reference.opcode))->name); - acpi_ex_out_integer ("Offset", obj_desc->reference.offset); - acpi_ex_out_pointer ("obj_desc", obj_desc->reference.object); - acpi_ex_out_pointer ("Node", obj_desc->reference.node); - acpi_ex_out_pointer ("Where", obj_desc->reference.where); + acpi_ex_out_integer("target_type", + obj_desc->reference.target_type); + acpi_ex_out_string("Opcode", + (acpi_ps_get_opcode_info + (obj_desc->reference.opcode))->name); + acpi_ex_out_integer("Offset", obj_desc->reference.offset); + acpi_ex_out_pointer("obj_desc", obj_desc->reference.object); + acpi_ex_out_pointer("Node", obj_desc->reference.node); + acpi_ex_out_pointer("Where", obj_desc->reference.where); - acpi_ex_dump_reference (obj_desc); + acpi_ex_dump_reference(obj_desc); break; - case ACPI_TYPE_LOCAL_ADDRESS_HANDLER: - acpi_ex_out_integer ("space_id", obj_desc->address_space.space_id); - acpi_ex_out_pointer ("Next", obj_desc->address_space.next); - acpi_ex_out_pointer ("region_list", obj_desc->address_space.region_list); - acpi_ex_out_pointer ("Node", obj_desc->address_space.node); - acpi_ex_out_pointer ("Context", obj_desc->address_space.context); + acpi_ex_out_integer("space_id", + obj_desc->address_space.space_id); + acpi_ex_out_pointer("Next", obj_desc->address_space.next); + acpi_ex_out_pointer("region_list", + obj_desc->address_space.region_list); + acpi_ex_out_pointer("Node", obj_desc->address_space.node); + acpi_ex_out_pointer("Context", obj_desc->address_space.context); break; - case ACPI_TYPE_LOCAL_NOTIFY: - acpi_ex_out_pointer ("Node", obj_desc->notify.node); - acpi_ex_out_pointer ("Context", obj_desc->notify.context); + acpi_ex_out_pointer("Node", obj_desc->notify.node); + acpi_ex_out_pointer("Context", obj_desc->notify.context); break; - case ACPI_TYPE_LOCAL_ALIAS: case ACPI_TYPE_LOCAL_METHOD_ALIAS: case ACPI_TYPE_LOCAL_EXTRA: case ACPI_TYPE_LOCAL_DATA: default: - acpi_os_printf ( - "ex_dump_object_descriptor: Display not implemented for object type %s\n", - acpi_ut_get_object_type_name (obj_desc)); + acpi_os_printf + ("ex_dump_object_descriptor: Display not implemented for object type %s\n", + acpi_ut_get_object_type_name(obj_desc)); break; } return_VOID; } -#endif /* ACPI_FUTURE_USAGE */ +#endif /* ACPI_FUTURE_USAGE */ #endif - diff --git a/drivers/acpi/executer/exfield.c b/drivers/acpi/executer/exfield.c index a690c925099..ab1ba399aa2 100644 --- a/drivers/acpi/executer/exfield.c +++ b/drivers/acpi/executer/exfield.c @@ -41,15 +41,12 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include #include #include - #define _COMPONENT ACPI_EXECUTER - ACPI_MODULE_NAME ("exfield") - +ACPI_MODULE_NAME("exfield") /******************************************************************************* * @@ -65,67 +62,70 @@ * Buffer, depending on the size of the field. * ******************************************************************************/ - acpi_status -acpi_ex_read_data_from_field ( - struct acpi_walk_state *walk_state, - union acpi_operand_object *obj_desc, - union acpi_operand_object **ret_buffer_desc) +acpi_ex_read_data_from_field(struct acpi_walk_state *walk_state, + union acpi_operand_object *obj_desc, + union acpi_operand_object **ret_buffer_desc) { - acpi_status status; - union acpi_operand_object *buffer_desc; - acpi_size length; - void *buffer; - u8 locked; - - - ACPI_FUNCTION_TRACE_PTR ("ex_read_data_from_field", obj_desc); + acpi_status status; + union acpi_operand_object *buffer_desc; + acpi_size length; + void *buffer; + u8 locked; + ACPI_FUNCTION_TRACE_PTR("ex_read_data_from_field", obj_desc); /* Parameter validation */ if (!obj_desc) { - return_ACPI_STATUS (AE_AML_NO_OPERAND); + return_ACPI_STATUS(AE_AML_NO_OPERAND); } if (!ret_buffer_desc) { - return_ACPI_STATUS (AE_BAD_PARAMETER); + return_ACPI_STATUS(AE_BAD_PARAMETER); } - if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_BUFFER_FIELD) { + if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_BUFFER_FIELD) { /* * If the buffer_field arguments have not been previously evaluated, * evaluate them now and save the results. */ if (!(obj_desc->common.flags & AOPOBJ_DATA_VALID)) { - status = acpi_ds_get_buffer_field_arguments (obj_desc); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ds_get_buffer_field_arguments(obj_desc); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } } - } - else if ((ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_LOCAL_REGION_FIELD) && - (obj_desc->field.region_obj->region.space_id == ACPI_ADR_SPACE_SMBUS)) { + } else + if ((ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_LOCAL_REGION_FIELD) + && (obj_desc->field.region_obj->region.space_id == + ACPI_ADR_SPACE_SMBUS)) { /* * This is an SMBus read. We must create a buffer to hold the data * and directly access the region handler. */ - buffer_desc = acpi_ut_create_buffer_object (ACPI_SMBUS_BUFFER_SIZE); + buffer_desc = + acpi_ut_create_buffer_object(ACPI_SMBUS_BUFFER_SIZE); if (!buffer_desc) { - return_ACPI_STATUS (AE_NO_MEMORY); + return_ACPI_STATUS(AE_NO_MEMORY); } /* Lock entire transaction if requested */ - locked = acpi_ex_acquire_global_lock (obj_desc->common_field.field_flags); + locked = + acpi_ex_acquire_global_lock(obj_desc->common_field. + field_flags); /* * Perform the read. * Note: Smbus protocol value is passed in upper 16-bits of Function */ - status = acpi_ex_access_region (obj_desc, 0, - ACPI_CAST_PTR (acpi_integer, buffer_desc->buffer.pointer), - ACPI_READ | (obj_desc->field.attribute << 16)); - acpi_ex_release_global_lock (locked); + status = acpi_ex_access_region(obj_desc, 0, + ACPI_CAST_PTR(acpi_integer, + buffer_desc-> + buffer.pointer), + ACPI_READ | (obj_desc->field. + attribute << 16)); + acpi_ex_release_global_lock(locked); goto exit; } @@ -139,22 +139,22 @@ acpi_ex_read_data_from_field ( * * Note: Field.length is in bits. */ - length = (acpi_size) ACPI_ROUND_BITS_UP_TO_BYTES (obj_desc->field.bit_length); + length = + (acpi_size) ACPI_ROUND_BITS_UP_TO_BYTES(obj_desc->field.bit_length); if (length > acpi_gbl_integer_byte_width) { /* Field is too large for an Integer, create a Buffer instead */ - buffer_desc = acpi_ut_create_buffer_object (length); + buffer_desc = acpi_ut_create_buffer_object(length); if (!buffer_desc) { - return_ACPI_STATUS (AE_NO_MEMORY); + return_ACPI_STATUS(AE_NO_MEMORY); } buffer = buffer_desc->buffer.pointer; - } - else { + } else { /* Field will fit within an Integer (normal case) */ - buffer_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER); + buffer_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); if (!buffer_desc) { - return_ACPI_STATUS (AE_NO_MEMORY); + return_ACPI_STATUS(AE_NO_MEMORY); } length = acpi_gbl_integer_byte_width; @@ -162,37 +162,36 @@ acpi_ex_read_data_from_field ( buffer = &buffer_desc->integer.value; } - ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, - "field_read [TO]: Obj %p, Type %X, Buf %p, byte_len %X\n", - obj_desc, ACPI_GET_OBJECT_TYPE (obj_desc), buffer, (u32) length)); - ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, - "field_read [FROM]: bit_len %X, bit_off %X, byte_off %X\n", - obj_desc->common_field.bit_length, - obj_desc->common_field.start_field_bit_offset, - obj_desc->common_field.base_byte_offset)); + ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, + "field_read [TO]: Obj %p, Type %X, Buf %p, byte_len %X\n", + obj_desc, ACPI_GET_OBJECT_TYPE(obj_desc), buffer, + (u32) length)); + ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, + "field_read [FROM]: bit_len %X, bit_off %X, byte_off %X\n", + obj_desc->common_field.bit_length, + obj_desc->common_field.start_field_bit_offset, + obj_desc->common_field.base_byte_offset)); /* Lock entire transaction if requested */ - locked = acpi_ex_acquire_global_lock (obj_desc->common_field.field_flags); + locked = + acpi_ex_acquire_global_lock(obj_desc->common_field.field_flags); /* Read from the field */ - status = acpi_ex_extract_from_field (obj_desc, buffer, (u32) length); - acpi_ex_release_global_lock (locked); - + status = acpi_ex_extract_from_field(obj_desc, buffer, (u32) length); + acpi_ex_release_global_lock(locked); -exit: - if (ACPI_FAILURE (status)) { - acpi_ut_remove_reference (buffer_desc); - } - else { + exit: + if (ACPI_FAILURE(status)) { + acpi_ut_remove_reference(buffer_desc); + } else { *ret_buffer_desc = buffer_desc; } - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_ex_write_data_to_field @@ -208,97 +207,96 @@ exit: ******************************************************************************/ acpi_status -acpi_ex_write_data_to_field ( - union acpi_operand_object *source_desc, - union acpi_operand_object *obj_desc, - union acpi_operand_object **result_desc) +acpi_ex_write_data_to_field(union acpi_operand_object *source_desc, + union acpi_operand_object *obj_desc, + union acpi_operand_object **result_desc) { - acpi_status status; - u32 length; - u32 required_length; - void *buffer; - void *new_buffer; - u8 locked; - union acpi_operand_object *buffer_desc; - - - ACPI_FUNCTION_TRACE_PTR ("ex_write_data_to_field", obj_desc); + acpi_status status; + u32 length; + u32 required_length; + void *buffer; + void *new_buffer; + u8 locked; + union acpi_operand_object *buffer_desc; + ACPI_FUNCTION_TRACE_PTR("ex_write_data_to_field", obj_desc); /* Parameter validation */ if (!source_desc || !obj_desc) { - return_ACPI_STATUS (AE_AML_NO_OPERAND); + return_ACPI_STATUS(AE_AML_NO_OPERAND); } - if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_BUFFER_FIELD) { + if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_BUFFER_FIELD) { /* * If the buffer_field arguments have not been previously evaluated, * evaluate them now and save the results. */ if (!(obj_desc->common.flags & AOPOBJ_DATA_VALID)) { - status = acpi_ds_get_buffer_field_arguments (obj_desc); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ds_get_buffer_field_arguments(obj_desc); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } } - } - else if ((ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_LOCAL_REGION_FIELD) && - (obj_desc->field.region_obj->region.space_id == ACPI_ADR_SPACE_SMBUS)) { + } else + if ((ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_LOCAL_REGION_FIELD) + && (obj_desc->field.region_obj->region.space_id == + ACPI_ADR_SPACE_SMBUS)) { /* * This is an SMBus write. We will bypass the entire field mechanism * and handoff the buffer directly to the handler. * * Source must be a buffer of sufficient size (ACPI_SMBUS_BUFFER_SIZE). */ - if (ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_BUFFER) { - ACPI_REPORT_ERROR (("SMBus write requires Buffer, found type %s\n", - acpi_ut_get_object_type_name (source_desc))); + if (ACPI_GET_OBJECT_TYPE(source_desc) != ACPI_TYPE_BUFFER) { + ACPI_REPORT_ERROR(("SMBus write requires Buffer, found type %s\n", acpi_ut_get_object_type_name(source_desc))); - return_ACPI_STATUS (AE_AML_OPERAND_TYPE); + return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } if (source_desc->buffer.length < ACPI_SMBUS_BUFFER_SIZE) { - ACPI_REPORT_ERROR (( - "SMBus write requires Buffer of length %X, found length %X\n", - ACPI_SMBUS_BUFFER_SIZE, source_desc->buffer.length)); + ACPI_REPORT_ERROR(("SMBus write requires Buffer of length %X, found length %X\n", ACPI_SMBUS_BUFFER_SIZE, source_desc->buffer.length)); - return_ACPI_STATUS (AE_AML_BUFFER_LIMIT); + return_ACPI_STATUS(AE_AML_BUFFER_LIMIT); } - buffer_desc = acpi_ut_create_buffer_object (ACPI_SMBUS_BUFFER_SIZE); + buffer_desc = + acpi_ut_create_buffer_object(ACPI_SMBUS_BUFFER_SIZE); if (!buffer_desc) { - return_ACPI_STATUS (AE_NO_MEMORY); + return_ACPI_STATUS(AE_NO_MEMORY); } buffer = buffer_desc->buffer.pointer; - ACPI_MEMCPY (buffer, source_desc->buffer.pointer, - ACPI_SMBUS_BUFFER_SIZE); + ACPI_MEMCPY(buffer, source_desc->buffer.pointer, + ACPI_SMBUS_BUFFER_SIZE); /* Lock entire transaction if requested */ - locked = acpi_ex_acquire_global_lock (obj_desc->common_field.field_flags); + locked = + acpi_ex_acquire_global_lock(obj_desc->common_field. + field_flags); /* * Perform the write (returns status and perhaps data in the * same buffer) * Note: SMBus protocol type is passed in upper 16-bits of Function. */ - status = acpi_ex_access_region (obj_desc, 0, - (acpi_integer *) buffer, - ACPI_WRITE | (obj_desc->field.attribute << 16)); - acpi_ex_release_global_lock (locked); + status = acpi_ex_access_region(obj_desc, 0, + (acpi_integer *) buffer, + ACPI_WRITE | (obj_desc->field. + attribute << 16)); + acpi_ex_release_global_lock(locked); *result_desc = buffer_desc; - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } /* Get a pointer to the data to be written */ - switch (ACPI_GET_OBJECT_TYPE (source_desc)) { + switch (ACPI_GET_OBJECT_TYPE(source_desc)) { case ACPI_TYPE_INTEGER: buffer = &source_desc->integer.value; - length = sizeof (source_desc->integer.value); + length = sizeof(source_desc->integer.value); break; case ACPI_TYPE_BUFFER: @@ -312,7 +310,7 @@ acpi_ex_write_data_to_field ( break; default: - return_ACPI_STATUS (AE_AML_OPERAND_TYPE); + return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } /* @@ -322,15 +320,15 @@ acpi_ex_write_data_to_field ( * the ACPI specification. */ new_buffer = NULL; - required_length = ACPI_ROUND_BITS_UP_TO_BYTES ( - obj_desc->common_field.bit_length); + required_length = + ACPI_ROUND_BITS_UP_TO_BYTES(obj_desc->common_field.bit_length); if (length < required_length) { /* We need to create a new buffer */ - new_buffer = ACPI_MEM_CALLOCATE (required_length); + new_buffer = ACPI_MEM_CALLOCATE(required_length); if (!new_buffer) { - return_ACPI_STATUS (AE_NO_MEMORY); + return_ACPI_STATUS(AE_NO_MEMORY); } /* @@ -338,40 +336,42 @@ acpi_ex_write_data_to_field ( * at Byte zero. All unused (upper) bytes of the * buffer will be 0. */ - ACPI_MEMCPY ((char *) new_buffer, (char *) buffer, length); + ACPI_MEMCPY((char *)new_buffer, (char *)buffer, length); buffer = new_buffer; length = required_length; } - ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, - "field_write [FROM]: Obj %p (%s:%X), Buf %p, byte_len %X\n", - source_desc, acpi_ut_get_type_name (ACPI_GET_OBJECT_TYPE (source_desc)), - ACPI_GET_OBJECT_TYPE (source_desc), buffer, length)); - - ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, - "field_write [TO]: Obj %p (%s:%X), bit_len %X, bit_off %X, byte_off %X\n", - obj_desc, acpi_ut_get_type_name (ACPI_GET_OBJECT_TYPE (obj_desc)), - ACPI_GET_OBJECT_TYPE (obj_desc), - obj_desc->common_field.bit_length, - obj_desc->common_field.start_field_bit_offset, - obj_desc->common_field.base_byte_offset)); + ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, + "field_write [FROM]: Obj %p (%s:%X), Buf %p, byte_len %X\n", + source_desc, + acpi_ut_get_type_name(ACPI_GET_OBJECT_TYPE + (source_desc)), + ACPI_GET_OBJECT_TYPE(source_desc), buffer, length)); + + ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, + "field_write [TO]: Obj %p (%s:%X), bit_len %X, bit_off %X, byte_off %X\n", + obj_desc, + acpi_ut_get_type_name(ACPI_GET_OBJECT_TYPE(obj_desc)), + ACPI_GET_OBJECT_TYPE(obj_desc), + obj_desc->common_field.bit_length, + obj_desc->common_field.start_field_bit_offset, + obj_desc->common_field.base_byte_offset)); /* Lock entire transaction if requested */ - locked = acpi_ex_acquire_global_lock (obj_desc->common_field.field_flags); + locked = + acpi_ex_acquire_global_lock(obj_desc->common_field.field_flags); /* Write to the field */ - status = acpi_ex_insert_into_field (obj_desc, buffer, length); - acpi_ex_release_global_lock (locked); + status = acpi_ex_insert_into_field(obj_desc, buffer, length); + acpi_ex_release_global_lock(locked); /* Free temporary buffer if we used one */ if (new_buffer) { - ACPI_MEM_FREE (new_buffer); + ACPI_MEM_FREE(new_buffer); } - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - - diff --git a/drivers/acpi/executer/exfldio.c b/drivers/acpi/executer/exfldio.c index 3c2f89e00f7..ba6e08843c2 100644 --- a/drivers/acpi/executer/exfldio.c +++ b/drivers/acpi/executer/exfldio.c @@ -41,36 +41,28 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include #include #include #include #include - #define _COMPONENT ACPI_EXECUTER - ACPI_MODULE_NAME ("exfldio") +ACPI_MODULE_NAME("exfldio") /* Local prototypes */ - static acpi_status -acpi_ex_field_datum_io ( - union acpi_operand_object *obj_desc, - u32 field_datum_byte_offset, - acpi_integer *value, - u32 read_write); +acpi_ex_field_datum_io(union acpi_operand_object *obj_desc, + u32 field_datum_byte_offset, + acpi_integer * value, u32 read_write); static u8 -acpi_ex_register_overflow ( - union acpi_operand_object *obj_desc, - acpi_integer value); +acpi_ex_register_overflow(union acpi_operand_object *obj_desc, + acpi_integer value); static acpi_status -acpi_ex_setup_region ( - union acpi_operand_object *obj_desc, - u32 field_datum_byte_offset); - +acpi_ex_setup_region(union acpi_operand_object *obj_desc, + u32 field_datum_byte_offset); /******************************************************************************* * @@ -89,27 +81,25 @@ acpi_ex_setup_region ( ******************************************************************************/ static acpi_status -acpi_ex_setup_region ( - union acpi_operand_object *obj_desc, - u32 field_datum_byte_offset) +acpi_ex_setup_region(union acpi_operand_object *obj_desc, + u32 field_datum_byte_offset) { - acpi_status status = AE_OK; - union acpi_operand_object *rgn_desc; - - - ACPI_FUNCTION_TRACE_U32 ("ex_setup_region", field_datum_byte_offset); + acpi_status status = AE_OK; + union acpi_operand_object *rgn_desc; + ACPI_FUNCTION_TRACE_U32("ex_setup_region", field_datum_byte_offset); rgn_desc = obj_desc->common_field.region_obj; /* We must have a valid region */ - if (ACPI_GET_OBJECT_TYPE (rgn_desc) != ACPI_TYPE_REGION) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Needed Region, found type %X (%s)\n", - ACPI_GET_OBJECT_TYPE (rgn_desc), - acpi_ut_get_object_type_name (rgn_desc))); + if (ACPI_GET_OBJECT_TYPE(rgn_desc) != ACPI_TYPE_REGION) { + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Needed Region, found type %X (%s)\n", + ACPI_GET_OBJECT_TYPE(rgn_desc), + acpi_ut_get_object_type_name(rgn_desc))); - return_ACPI_STATUS (AE_AML_OPERAND_TYPE); + return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } /* @@ -117,26 +107,25 @@ acpi_ex_setup_region ( * evaluate them now and save the results. */ if (!(rgn_desc->common.flags & AOPOBJ_DATA_VALID)) { - status = acpi_ds_get_region_arguments (rgn_desc); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ds_get_region_arguments(rgn_desc); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } } if (rgn_desc->region.space_id == ACPI_ADR_SPACE_SMBUS) { /* SMBus has a non-linear address space */ - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - #ifdef ACPI_UNDER_DEVELOPMENT /* * If the Field access is any_acc, we can now compute the optimal * access (because we know know the length of the parent region) */ if (!(obj_desc->common.flags & AOPOBJ_DATA_VALID)) { - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } } #endif @@ -147,56 +136,64 @@ acpi_ex_setup_region ( * (Region length is specified in bytes) */ if (rgn_desc->region.length < (obj_desc->common_field.base_byte_offset + - field_datum_byte_offset + - obj_desc->common_field.access_byte_width)) { + field_datum_byte_offset + + obj_desc->common_field. + access_byte_width)) { if (acpi_gbl_enable_interpreter_slack) { /* * Slack mode only: We will go ahead and allow access to this * field if it is within the region length rounded up to the next * access width boundary. */ - if (ACPI_ROUND_UP (rgn_desc->region.length, - obj_desc->common_field.access_byte_width) >= - (obj_desc->common_field.base_byte_offset + - (acpi_native_uint) obj_desc->common_field.access_byte_width + - field_datum_byte_offset)) { - return_ACPI_STATUS (AE_OK); + if (ACPI_ROUND_UP(rgn_desc->region.length, + obj_desc->common_field. + access_byte_width) >= + (obj_desc->common_field.base_byte_offset + + (acpi_native_uint) obj_desc->common_field. + access_byte_width + field_datum_byte_offset)) { + return_ACPI_STATUS(AE_OK); } } - if (rgn_desc->region.length < obj_desc->common_field.access_byte_width) { + if (rgn_desc->region.length < + obj_desc->common_field.access_byte_width) { /* * This is the case where the access_type (acc_word, etc.) is wider * than the region itself. For example, a region of length one * byte, and a field with Dword access specified. */ - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Field [%4.4s] access width (%d bytes) too large for region [%4.4s] (length %X)\n", - acpi_ut_get_node_name (obj_desc->common_field.node), - obj_desc->common_field.access_byte_width, - acpi_ut_get_node_name (rgn_desc->region.node), - rgn_desc->region.length)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Field [%4.4s] access width (%d bytes) too large for region [%4.4s] (length %X)\n", + acpi_ut_get_node_name(obj_desc-> + common_field. + node), + obj_desc->common_field. + access_byte_width, + acpi_ut_get_node_name(rgn_desc-> + region.node), + rgn_desc->region.length)); } /* * Offset rounded up to next multiple of field width * exceeds region length, indicate an error */ - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Field [%4.4s] Base+Offset+Width %X+%X+%X is beyond end of region [%4.4s] (length %X)\n", - acpi_ut_get_node_name (obj_desc->common_field.node), - obj_desc->common_field.base_byte_offset, - field_datum_byte_offset, obj_desc->common_field.access_byte_width, - acpi_ut_get_node_name (rgn_desc->region.node), - rgn_desc->region.length)); - - return_ACPI_STATUS (AE_AML_REGION_LIMIT); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Field [%4.4s] Base+Offset+Width %X+%X+%X is beyond end of region [%4.4s] (length %X)\n", + acpi_ut_get_node_name(obj_desc->common_field. + node), + obj_desc->common_field.base_byte_offset, + field_datum_byte_offset, + obj_desc->common_field.access_byte_width, + acpi_ut_get_node_name(rgn_desc->region.node), + rgn_desc->region.length)); + + return_ACPI_STATUS(AE_AML_REGION_LIMIT); } - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_ex_access_region @@ -216,27 +213,23 @@ acpi_ex_setup_region ( ******************************************************************************/ acpi_status -acpi_ex_access_region ( - union acpi_operand_object *obj_desc, - u32 field_datum_byte_offset, - acpi_integer *value, - u32 function) +acpi_ex_access_region(union acpi_operand_object *obj_desc, + u32 field_datum_byte_offset, + acpi_integer * value, u32 function) { - acpi_status status; - union acpi_operand_object *rgn_desc; - acpi_physical_address address; - - - ACPI_FUNCTION_TRACE ("ex_access_region"); + acpi_status status; + union acpi_operand_object *rgn_desc; + acpi_physical_address address; + ACPI_FUNCTION_TRACE("ex_access_region"); /* * Ensure that the region operands are fully evaluated and verify * the validity of the request */ - status = acpi_ex_setup_region (obj_desc, field_datum_byte_offset); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ex_setup_region(obj_desc, field_datum_byte_offset); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* @@ -248,50 +241,53 @@ acpi_ex_access_region ( */ rgn_desc = obj_desc->common_field.region_obj; address = rgn_desc->region.address + - obj_desc->common_field.base_byte_offset + - field_datum_byte_offset; + obj_desc->common_field.base_byte_offset + field_datum_byte_offset; if ((function & ACPI_IO_MASK) == ACPI_READ) { - ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "[READ]")); - } - else { - ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "[WRITE]")); + ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, "[READ]")); + } else { + ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, "[WRITE]")); } - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_BFIELD, - " Region [%s:%X], Width %X, byte_base %X, Offset %X at %8.8X%8.8X\n", - acpi_ut_get_region_name (rgn_desc->region.space_id), - rgn_desc->region.space_id, - obj_desc->common_field.access_byte_width, - obj_desc->common_field.base_byte_offset, - field_datum_byte_offset, - ACPI_FORMAT_UINT64 (address))); + ACPI_DEBUG_PRINT_RAW((ACPI_DB_BFIELD, + " Region [%s:%X], Width %X, byte_base %X, Offset %X at %8.8X%8.8X\n", + acpi_ut_get_region_name(rgn_desc->region. + space_id), + rgn_desc->region.space_id, + obj_desc->common_field.access_byte_width, + obj_desc->common_field.base_byte_offset, + field_datum_byte_offset, + ACPI_FORMAT_UINT64(address))); /* Invoke the appropriate address_space/op_region handler */ - status = acpi_ev_address_space_dispatch (rgn_desc, function, - address, - ACPI_MUL_8 (obj_desc->common_field.access_byte_width), value); + status = acpi_ev_address_space_dispatch(rgn_desc, function, + address, + ACPI_MUL_8(obj_desc-> + common_field. + access_byte_width), + value); - if (ACPI_FAILURE (status)) { + if (ACPI_FAILURE(status)) { if (status == AE_NOT_IMPLEMENTED) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Region %s(%X) not implemented\n", - acpi_ut_get_region_name (rgn_desc->region.space_id), - rgn_desc->region.space_id)); - } - else if (status == AE_NOT_EXIST) { - ACPI_REPORT_ERROR (( - "Region %s(%X) has no handler\n", - acpi_ut_get_region_name (rgn_desc->region.space_id), - rgn_desc->region.space_id)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Region %s(%X) not implemented\n", + acpi_ut_get_region_name(rgn_desc-> + region. + space_id), + rgn_desc->region.space_id)); + } else if (status == AE_NOT_EXIST) { + ACPI_REPORT_ERROR(("Region %s(%X) has no handler\n", + acpi_ut_get_region_name(rgn_desc-> + region. + space_id), + rgn_desc->region.space_id)); } } - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_ex_register_overflow @@ -310,9 +306,8 @@ acpi_ex_access_region ( ******************************************************************************/ static u8 -acpi_ex_register_overflow ( - union acpi_operand_object *obj_desc, - acpi_integer value) +acpi_ex_register_overflow(union acpi_operand_object *obj_desc, + acpi_integer value) { if (obj_desc->common_field.bit_length >= ACPI_INTEGER_BIT_SIZE) { @@ -336,7 +331,6 @@ acpi_ex_register_overflow ( return (FALSE); } - /******************************************************************************* * * FUNCTION: acpi_ex_field_datum_io @@ -356,18 +350,14 @@ acpi_ex_register_overflow ( ******************************************************************************/ static acpi_status -acpi_ex_field_datum_io ( - union acpi_operand_object *obj_desc, - u32 field_datum_byte_offset, - acpi_integer *value, - u32 read_write) +acpi_ex_field_datum_io(union acpi_operand_object *obj_desc, + u32 field_datum_byte_offset, + acpi_integer * value, u32 read_write) { - acpi_status status; - acpi_integer local_value; - - - ACPI_FUNCTION_TRACE_U32 ("ex_field_datum_io", field_datum_byte_offset); + acpi_status status; + acpi_integer local_value; + ACPI_FUNCTION_TRACE_U32("ex_field_datum_io", field_datum_byte_offset); if (read_write == ACPI_READ) { if (!value) { @@ -392,16 +382,16 @@ acpi_ex_field_datum_io ( * index_field - Write to an Index Register, then read/write from/to a * Data Register */ - switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { + switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { case ACPI_TYPE_BUFFER_FIELD: /* * If the buffer_field arguments have not been previously evaluated, * evaluate them now and save the results. */ if (!(obj_desc->common.flags & AOPOBJ_DATA_VALID)) { - status = acpi_ds_get_buffer_field_arguments (obj_desc); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ds_get_buffer_field_arguments(obj_desc); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } } @@ -410,47 +400,50 @@ acpi_ex_field_datum_io ( * Copy the data from the source buffer. * Length is the field width in bytes. */ - ACPI_MEMCPY (value, - (obj_desc->buffer_field.buffer_obj)->buffer.pointer + - obj_desc->buffer_field.base_byte_offset + - field_datum_byte_offset, - obj_desc->common_field.access_byte_width); - } - else { + ACPI_MEMCPY(value, + (obj_desc->buffer_field.buffer_obj)->buffer. + pointer + + obj_desc->buffer_field.base_byte_offset + + field_datum_byte_offset, + obj_desc->common_field.access_byte_width); + } else { /* * Copy the data to the target buffer. * Length is the field width in bytes. */ - ACPI_MEMCPY ((obj_desc->buffer_field.buffer_obj)->buffer.pointer + - obj_desc->buffer_field.base_byte_offset + - field_datum_byte_offset, - value, obj_desc->common_field.access_byte_width); + ACPI_MEMCPY((obj_desc->buffer_field.buffer_obj)->buffer. + pointer + + obj_desc->buffer_field.base_byte_offset + + field_datum_byte_offset, value, + obj_desc->common_field.access_byte_width); } status = AE_OK; break; - case ACPI_TYPE_LOCAL_BANK_FIELD: /* * Ensure that the bank_value is not beyond the capacity of * the register */ - if (acpi_ex_register_overflow (obj_desc->bank_field.bank_obj, - (acpi_integer) obj_desc->bank_field.value)) { - return_ACPI_STATUS (AE_AML_REGISTER_LIMIT); + if (acpi_ex_register_overflow(obj_desc->bank_field.bank_obj, + (acpi_integer) obj_desc-> + bank_field.value)) { + return_ACPI_STATUS(AE_AML_REGISTER_LIMIT); } /* * For bank_fields, we must write the bank_value to the bank_register * (itself a region_field) before we can access the data. */ - status = acpi_ex_insert_into_field (obj_desc->bank_field.bank_obj, - &obj_desc->bank_field.value, - sizeof (obj_desc->bank_field.value)); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = + acpi_ex_insert_into_field(obj_desc->bank_field.bank_obj, + &obj_desc->bank_field.value, + sizeof(obj_desc->bank_field. + value)); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* @@ -460,90 +453,92 @@ acpi_ex_field_datum_io ( /*lint -fallthrough */ - case ACPI_TYPE_LOCAL_REGION_FIELD: /* * For simple region_fields, we just directly access the owning * Operation Region. */ - status = acpi_ex_access_region (obj_desc, field_datum_byte_offset, value, - read_write); + status = + acpi_ex_access_region(obj_desc, field_datum_byte_offset, + value, read_write); break; - case ACPI_TYPE_LOCAL_INDEX_FIELD: - /* * Ensure that the index_value is not beyond the capacity of * the register */ - if (acpi_ex_register_overflow (obj_desc->index_field.index_obj, - (acpi_integer) obj_desc->index_field.value)) { - return_ACPI_STATUS (AE_AML_REGISTER_LIMIT); + if (acpi_ex_register_overflow(obj_desc->index_field.index_obj, + (acpi_integer) obj_desc-> + index_field.value)) { + return_ACPI_STATUS(AE_AML_REGISTER_LIMIT); } /* Write the index value to the index_register (itself a region_field) */ field_datum_byte_offset += obj_desc->index_field.value; - ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, - "Write to Index Register: Value %8.8X\n", - field_datum_byte_offset)); + ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, + "Write to Index Register: Value %8.8X\n", + field_datum_byte_offset)); - status = acpi_ex_insert_into_field (obj_desc->index_field.index_obj, - &field_datum_byte_offset, - sizeof (field_datum_byte_offset)); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = + acpi_ex_insert_into_field(obj_desc->index_field.index_obj, + &field_datum_byte_offset, + sizeof(field_datum_byte_offset)); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } - ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, - "I/O to Data Register: value_ptr %p\n", - value)); + ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, + "I/O to Data Register: value_ptr %p\n", + value)); if (read_write == ACPI_READ) { /* Read the datum from the data_register */ - status = acpi_ex_extract_from_field (obj_desc->index_field.data_obj, - value, sizeof (acpi_integer)); - } - else { + status = + acpi_ex_extract_from_field(obj_desc->index_field. + data_obj, value, + sizeof(acpi_integer)); + } else { /* Write the datum to the data_register */ - status = acpi_ex_insert_into_field (obj_desc->index_field.data_obj, - value, sizeof (acpi_integer)); + status = + acpi_ex_insert_into_field(obj_desc->index_field. + data_obj, value, + sizeof(acpi_integer)); } break; - default: - ACPI_REPORT_ERROR (("Wrong object type in field I/O %X\n", - ACPI_GET_OBJECT_TYPE (obj_desc))); + ACPI_REPORT_ERROR(("Wrong object type in field I/O %X\n", + ACPI_GET_OBJECT_TYPE(obj_desc))); status = AE_AML_INTERNAL; break; } - if (ACPI_SUCCESS (status)) { + if (ACPI_SUCCESS(status)) { if (read_write == ACPI_READ) { - ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, - "Value Read %8.8X%8.8X, Width %d\n", - ACPI_FORMAT_UINT64 (*value), - obj_desc->common_field.access_byte_width)); - } - else { - ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, - "Value Written %8.8X%8.8X, Width %d\n", - ACPI_FORMAT_UINT64 (*value), - obj_desc->common_field.access_byte_width)); + ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, + "Value Read %8.8X%8.8X, Width %d\n", + ACPI_FORMAT_UINT64(*value), + obj_desc->common_field. + access_byte_width)); + } else { + ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, + "Value Written %8.8X%8.8X, Width %d\n", + ACPI_FORMAT_UINT64(*value), + obj_desc->common_field. + access_byte_width)); } } - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_ex_write_with_update_rule @@ -560,19 +555,16 @@ acpi_ex_field_datum_io ( ******************************************************************************/ acpi_status -acpi_ex_write_with_update_rule ( - union acpi_operand_object *obj_desc, - acpi_integer mask, - acpi_integer field_value, - u32 field_datum_byte_offset) +acpi_ex_write_with_update_rule(union acpi_operand_object *obj_desc, + acpi_integer mask, + acpi_integer field_value, + u32 field_datum_byte_offset) { - acpi_status status = AE_OK; - acpi_integer merged_value; - acpi_integer current_value; - - - ACPI_FUNCTION_TRACE_U32 ("ex_write_with_update_rule", mask); + acpi_status status = AE_OK; + acpi_integer merged_value; + acpi_integer current_value; + ACPI_FUNCTION_TRACE_U32("ex_write_with_update_rule", mask); /* Start with the new bits */ @@ -583,22 +575,27 @@ acpi_ex_write_with_update_rule ( if (mask != ACPI_INTEGER_MAX) { /* Decode the update rule */ - switch (obj_desc->common_field.field_flags & AML_FIELD_UPDATE_RULE_MASK) { + switch (obj_desc->common_field. + field_flags & AML_FIELD_UPDATE_RULE_MASK) { case AML_FIELD_UPDATE_PRESERVE: /* * Check if update rule needs to be applied (not if mask is all * ones) The left shift drops the bits we want to ignore. */ - if ((~mask << (ACPI_MUL_8 (sizeof (mask)) - - ACPI_MUL_8 (obj_desc->common_field.access_byte_width))) != 0) { + if ((~mask << (ACPI_MUL_8(sizeof(mask)) - + ACPI_MUL_8(obj_desc->common_field. + access_byte_width))) != 0) { /* * Read the current contents of the byte/word/dword containing * the field, and merge with the new field value. */ - status = acpi_ex_field_datum_io (obj_desc, field_datum_byte_offset, - ¤t_value, ACPI_READ); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = + acpi_ex_field_datum_io(obj_desc, + field_datum_byte_offset, + ¤t_value, + ACPI_READ); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } merged_value |= (current_value & ~mask); @@ -621,30 +618,31 @@ acpi_ex_write_with_update_rule ( default: - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "write_with_update_rule: Unknown update_rule setting: %X\n", - (obj_desc->common_field.field_flags & AML_FIELD_UPDATE_RULE_MASK))); - return_ACPI_STATUS (AE_AML_OPERAND_VALUE); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "write_with_update_rule: Unknown update_rule setting: %X\n", + (obj_desc->common_field. + field_flags & + AML_FIELD_UPDATE_RULE_MASK))); + return_ACPI_STATUS(AE_AML_OPERAND_VALUE); } } - ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, - "Mask %8.8X%8.8X, datum_offset %X, Width %X, Value %8.8X%8.8X, merged_value %8.8X%8.8X\n", - ACPI_FORMAT_UINT64 (mask), - field_datum_byte_offset, - obj_desc->common_field.access_byte_width, - ACPI_FORMAT_UINT64 (field_value), - ACPI_FORMAT_UINT64 (merged_value))); + ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, + "Mask %8.8X%8.8X, datum_offset %X, Width %X, Value %8.8X%8.8X, merged_value %8.8X%8.8X\n", + ACPI_FORMAT_UINT64(mask), + field_datum_byte_offset, + obj_desc->common_field.access_byte_width, + ACPI_FORMAT_UINT64(field_value), + ACPI_FORMAT_UINT64(merged_value))); /* Write the merged value */ - status = acpi_ex_field_datum_io (obj_desc, field_datum_byte_offset, - &merged_value, ACPI_WRITE); + status = acpi_ex_field_datum_io(obj_desc, field_datum_byte_offset, + &merged_value, ACPI_WRITE); - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_ex_extract_from_field @@ -660,54 +658,54 @@ acpi_ex_write_with_update_rule ( ******************************************************************************/ acpi_status -acpi_ex_extract_from_field ( - union acpi_operand_object *obj_desc, - void *buffer, - u32 buffer_length) +acpi_ex_extract_from_field(union acpi_operand_object *obj_desc, + void *buffer, u32 buffer_length) { - acpi_status status; - acpi_integer raw_datum; - acpi_integer merged_datum; - u32 field_offset = 0; - u32 buffer_offset = 0; - u32 buffer_tail_bits; - u32 datum_count; - u32 field_datum_count; - u32 i; - - - ACPI_FUNCTION_TRACE ("ex_extract_from_field"); - + acpi_status status; + acpi_integer raw_datum; + acpi_integer merged_datum; + u32 field_offset = 0; + u32 buffer_offset = 0; + u32 buffer_tail_bits; + u32 datum_count; + u32 field_datum_count; + u32 i; + + ACPI_FUNCTION_TRACE("ex_extract_from_field"); /* Validate target buffer and clear it */ - if (buffer_length < ACPI_ROUND_BITS_UP_TO_BYTES ( - obj_desc->common_field.bit_length)) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Field size %X (bits) is too large for buffer (%X)\n", - obj_desc->common_field.bit_length, buffer_length)); + if (buffer_length < + ACPI_ROUND_BITS_UP_TO_BYTES(obj_desc->common_field.bit_length)) { + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Field size %X (bits) is too large for buffer (%X)\n", + obj_desc->common_field.bit_length, + buffer_length)); - return_ACPI_STATUS (AE_BUFFER_OVERFLOW); + return_ACPI_STATUS(AE_BUFFER_OVERFLOW); } - ACPI_MEMSET (buffer, 0, buffer_length); + ACPI_MEMSET(buffer, 0, buffer_length); /* Compute the number of datums (access width data items) */ - datum_count = ACPI_ROUND_UP_TO ( - obj_desc->common_field.bit_length, - obj_desc->common_field.access_bit_width); - field_datum_count = ACPI_ROUND_UP_TO ( - obj_desc->common_field.bit_length + - obj_desc->common_field.start_field_bit_offset, - obj_desc->common_field.access_bit_width); + datum_count = ACPI_ROUND_UP_TO(obj_desc->common_field.bit_length, + obj_desc->common_field.access_bit_width); + field_datum_count = ACPI_ROUND_UP_TO(obj_desc->common_field.bit_length + + obj_desc->common_field. + start_field_bit_offset, + obj_desc->common_field. + access_bit_width); /* Priming read from the field */ - status = acpi_ex_field_datum_io (obj_desc, field_offset, &raw_datum, ACPI_READ); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = + acpi_ex_field_datum_io(obj_desc, field_offset, &raw_datum, + ACPI_READ); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } - merged_datum = raw_datum >> obj_desc->common_field.start_field_bit_offset; + merged_datum = + raw_datum >> obj_desc->common_field.start_field_bit_offset; /* Read the rest of the field */ @@ -715,17 +713,17 @@ acpi_ex_extract_from_field ( /* Get next input datum from the field */ field_offset += obj_desc->common_field.access_byte_width; - status = acpi_ex_field_datum_io (obj_desc, field_offset, - &raw_datum, ACPI_READ); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ex_field_datum_io(obj_desc, field_offset, + &raw_datum, ACPI_READ); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* Merge with previous datum if necessary */ merged_datum |= raw_datum << - (obj_desc->common_field.access_bit_width - - obj_desc->common_field.start_field_bit_offset); + (obj_desc->common_field.access_bit_width - + obj_desc->common_field.start_field_bit_offset); if (i == datum_count) { break; @@ -733,32 +731,32 @@ acpi_ex_extract_from_field ( /* Write merged datum to target buffer */ - ACPI_MEMCPY (((char *) buffer) + buffer_offset, &merged_datum, - ACPI_MIN(obj_desc->common_field.access_byte_width, - buffer_length - buffer_offset)); + ACPI_MEMCPY(((char *)buffer) + buffer_offset, &merged_datum, + ACPI_MIN(obj_desc->common_field.access_byte_width, + buffer_length - buffer_offset)); buffer_offset += obj_desc->common_field.access_byte_width; - merged_datum = raw_datum >> obj_desc->common_field.start_field_bit_offset; + merged_datum = + raw_datum >> obj_desc->common_field.start_field_bit_offset; } /* Mask off any extra bits in the last datum */ buffer_tail_bits = obj_desc->common_field.bit_length % - obj_desc->common_field.access_bit_width; + obj_desc->common_field.access_bit_width; if (buffer_tail_bits) { - merged_datum &= ACPI_MASK_BITS_ABOVE (buffer_tail_bits); + merged_datum &= ACPI_MASK_BITS_ABOVE(buffer_tail_bits); } /* Write the last datum to the buffer */ - ACPI_MEMCPY (((char *) buffer) + buffer_offset, &merged_datum, - ACPI_MIN(obj_desc->common_field.access_byte_width, - buffer_length - buffer_offset)); + ACPI_MEMCPY(((char *)buffer) + buffer_offset, &merged_datum, + ACPI_MIN(obj_desc->common_field.access_byte_width, + buffer_length - buffer_offset)); - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_ex_insert_into_field @@ -774,53 +772,54 @@ acpi_ex_extract_from_field ( ******************************************************************************/ acpi_status -acpi_ex_insert_into_field ( - union acpi_operand_object *obj_desc, - void *buffer, - u32 buffer_length) +acpi_ex_insert_into_field(union acpi_operand_object *obj_desc, + void *buffer, u32 buffer_length) { - acpi_status status; - acpi_integer mask; - acpi_integer merged_datum; - acpi_integer raw_datum = 0; - u32 field_offset = 0; - u32 buffer_offset = 0; - u32 buffer_tail_bits; - u32 datum_count; - u32 field_datum_count; - u32 i; - - - ACPI_FUNCTION_TRACE ("ex_insert_into_field"); - + acpi_status status; + acpi_integer mask; + acpi_integer merged_datum; + acpi_integer raw_datum = 0; + u32 field_offset = 0; + u32 buffer_offset = 0; + u32 buffer_tail_bits; + u32 datum_count; + u32 field_datum_count; + u32 i; + + ACPI_FUNCTION_TRACE("ex_insert_into_field"); /* Validate input buffer */ - if (buffer_length < ACPI_ROUND_BITS_UP_TO_BYTES ( - obj_desc->common_field.bit_length)) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Field size %X (bits) is too large for buffer (%X)\n", - obj_desc->common_field.bit_length, buffer_length)); + if (buffer_length < + ACPI_ROUND_BITS_UP_TO_BYTES(obj_desc->common_field.bit_length)) { + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Field size %X (bits) is too large for buffer (%X)\n", + obj_desc->common_field.bit_length, + buffer_length)); - return_ACPI_STATUS (AE_BUFFER_OVERFLOW); + return_ACPI_STATUS(AE_BUFFER_OVERFLOW); } /* Compute the number of datums (access width data items) */ - mask = ACPI_MASK_BITS_BELOW (obj_desc->common_field.start_field_bit_offset); - datum_count = ACPI_ROUND_UP_TO (obj_desc->common_field.bit_length, - obj_desc->common_field.access_bit_width); - field_datum_count = ACPI_ROUND_UP_TO (obj_desc->common_field.bit_length + - obj_desc->common_field.start_field_bit_offset, - obj_desc->common_field.access_bit_width); + mask = + ACPI_MASK_BITS_BELOW(obj_desc->common_field.start_field_bit_offset); + datum_count = + ACPI_ROUND_UP_TO(obj_desc->common_field.bit_length, + obj_desc->common_field.access_bit_width); + field_datum_count = + ACPI_ROUND_UP_TO(obj_desc->common_field.bit_length + + obj_desc->common_field.start_field_bit_offset, + obj_desc->common_field.access_bit_width); /* Get initial Datum from the input buffer */ - ACPI_MEMCPY (&raw_datum, buffer, - ACPI_MIN(obj_desc->common_field.access_byte_width, - buffer_length - buffer_offset)); + ACPI_MEMCPY(&raw_datum, buffer, + ACPI_MIN(obj_desc->common_field.access_byte_width, + buffer_length - buffer_offset)); - merged_datum = raw_datum << obj_desc->common_field.start_field_bit_offset; + merged_datum = + raw_datum << obj_desc->common_field.start_field_bit_offset; /* Write the entire field */ @@ -828,18 +827,19 @@ acpi_ex_insert_into_field ( /* Write merged datum to the target field */ merged_datum &= mask; - status = acpi_ex_write_with_update_rule (obj_desc, mask, - merged_datum, field_offset); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ex_write_with_update_rule(obj_desc, mask, + merged_datum, + field_offset); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* Start new output datum by merging with previous input datum */ field_offset += obj_desc->common_field.access_byte_width; merged_datum = raw_datum >> - (obj_desc->common_field.access_bit_width - - obj_desc->common_field.start_field_bit_offset); + (obj_desc->common_field.access_bit_width - + obj_desc->common_field.start_field_bit_offset); mask = ACPI_INTEGER_MAX; if (i == datum_count) { @@ -849,28 +849,28 @@ acpi_ex_insert_into_field ( /* Get the next input datum from the buffer */ buffer_offset += obj_desc->common_field.access_byte_width; - ACPI_MEMCPY (&raw_datum, ((char *) buffer) + buffer_offset, - ACPI_MIN(obj_desc->common_field.access_byte_width, - buffer_length - buffer_offset)); - merged_datum |= raw_datum << obj_desc->common_field.start_field_bit_offset; + ACPI_MEMCPY(&raw_datum, ((char *)buffer) + buffer_offset, + ACPI_MIN(obj_desc->common_field.access_byte_width, + buffer_length - buffer_offset)); + merged_datum |= + raw_datum << obj_desc->common_field.start_field_bit_offset; } /* Mask off any extra bits in the last datum */ buffer_tail_bits = (obj_desc->common_field.bit_length + - obj_desc->common_field.start_field_bit_offset) % - obj_desc->common_field.access_bit_width; + obj_desc->common_field.start_field_bit_offset) % + obj_desc->common_field.access_bit_width; if (buffer_tail_bits) { - mask &= ACPI_MASK_BITS_ABOVE (buffer_tail_bits); + mask &= ACPI_MASK_BITS_ABOVE(buffer_tail_bits); } /* Write the last datum to the field */ merged_datum &= mask; - status = acpi_ex_write_with_update_rule (obj_desc, - mask, merged_datum, field_offset); + status = acpi_ex_write_with_update_rule(obj_desc, + mask, merged_datum, + field_offset); - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - - diff --git a/drivers/acpi/executer/exmisc.c b/drivers/acpi/executer/exmisc.c index 237ef28c813..a3f4d72bedc 100644 --- a/drivers/acpi/executer/exmisc.c +++ b/drivers/acpi/executer/exmisc.c @@ -42,15 +42,12 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include #include #include - #define _COMPONENT ACPI_EXECUTER - ACPI_MODULE_NAME ("exmisc") - +ACPI_MODULE_NAME("exmisc") /******************************************************************************* * @@ -66,27 +63,23 @@ * Common code for the ref_of_op and the cond_ref_of_op. * ******************************************************************************/ - acpi_status -acpi_ex_get_object_reference ( - union acpi_operand_object *obj_desc, - union acpi_operand_object **return_desc, - struct acpi_walk_state *walk_state) +acpi_ex_get_object_reference(union acpi_operand_object *obj_desc, + union acpi_operand_object **return_desc, + struct acpi_walk_state *walk_state) { - union acpi_operand_object *reference_obj; - union acpi_operand_object *referenced_obj; - - - ACPI_FUNCTION_TRACE_PTR ("ex_get_object_reference", obj_desc); + union acpi_operand_object *reference_obj; + union acpi_operand_object *referenced_obj; + ACPI_FUNCTION_TRACE_PTR("ex_get_object_reference", obj_desc); *return_desc = NULL; - switch (ACPI_GET_DESCRIPTOR_TYPE (obj_desc)) { + switch (ACPI_GET_DESCRIPTOR_TYPE(obj_desc)) { case ACPI_DESC_TYPE_OPERAND: - if (ACPI_GET_OBJECT_TYPE (obj_desc) != ACPI_TYPE_LOCAL_REFERENCE) { - return_ACPI_STATUS (AE_AML_OPERAND_TYPE); + if (ACPI_GET_OBJECT_TYPE(obj_desc) != ACPI_TYPE_LOCAL_REFERENCE) { + return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } /* @@ -104,13 +97,11 @@ acpi_ex_get_object_reference ( default: - ACPI_REPORT_ERROR (("Unknown Reference opcode in get_reference %X\n", - obj_desc->reference.opcode)); - return_ACPI_STATUS (AE_AML_INTERNAL); + ACPI_REPORT_ERROR(("Unknown Reference opcode in get_reference %X\n", obj_desc->reference.opcode)); + return_ACPI_STATUS(AE_AML_INTERNAL); } break; - case ACPI_DESC_TYPE_NAMED: /* @@ -119,34 +110,32 @@ acpi_ex_get_object_reference ( referenced_obj = obj_desc; break; - default: - ACPI_REPORT_ERROR (("Invalid descriptor type in get_reference: %X\n", - ACPI_GET_DESCRIPTOR_TYPE (obj_desc))); - return_ACPI_STATUS (AE_TYPE); + ACPI_REPORT_ERROR(("Invalid descriptor type in get_reference: %X\n", ACPI_GET_DESCRIPTOR_TYPE(obj_desc))); + return_ACPI_STATUS(AE_TYPE); } - /* Create a new reference object */ - reference_obj = acpi_ut_create_internal_object (ACPI_TYPE_LOCAL_REFERENCE); + reference_obj = + acpi_ut_create_internal_object(ACPI_TYPE_LOCAL_REFERENCE); if (!reference_obj) { - return_ACPI_STATUS (AE_NO_MEMORY); + return_ACPI_STATUS(AE_NO_MEMORY); } reference_obj->reference.opcode = AML_REF_OF_OP; reference_obj->reference.object = referenced_obj; *return_desc = reference_obj; - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "Object %p Type [%s], returning Reference %p\n", - obj_desc, acpi_ut_get_object_type_name (obj_desc), *return_desc)); + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, + "Object %p Type [%s], returning Reference %p\n", + obj_desc, acpi_ut_get_object_type_name(obj_desc), + *return_desc)); - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_ex_concat_template @@ -163,63 +152,58 @@ acpi_ex_get_object_reference ( ******************************************************************************/ acpi_status -acpi_ex_concat_template ( - union acpi_operand_object *operand0, - union acpi_operand_object *operand1, - union acpi_operand_object **actual_return_desc, - struct acpi_walk_state *walk_state) +acpi_ex_concat_template(union acpi_operand_object *operand0, + union acpi_operand_object *operand1, + union acpi_operand_object **actual_return_desc, + struct acpi_walk_state *walk_state) { - union acpi_operand_object *return_desc; - u8 *new_buf; - u8 *end_tag1; - u8 *end_tag2; - acpi_size length1; - acpi_size length2; - - - ACPI_FUNCTION_TRACE ("ex_concat_template"); + union acpi_operand_object *return_desc; + u8 *new_buf; + u8 *end_tag1; + u8 *end_tag2; + acpi_size length1; + acpi_size length2; + ACPI_FUNCTION_TRACE("ex_concat_template"); /* Find the end_tags in each resource template */ - end_tag1 = acpi_ut_get_resource_end_tag (operand0); - end_tag2 = acpi_ut_get_resource_end_tag (operand1); + end_tag1 = acpi_ut_get_resource_end_tag(operand0); + end_tag2 = acpi_ut_get_resource_end_tag(operand1); if (!end_tag1 || !end_tag2) { - return_ACPI_STATUS (AE_AML_OPERAND_TYPE); + return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } /* Compute the length of each part */ - length1 = ACPI_PTR_DIFF (end_tag1, operand0->buffer.pointer); - length2 = ACPI_PTR_DIFF (end_tag2, operand1->buffer.pointer) + - 2; /* Size of END_TAG */ + length1 = ACPI_PTR_DIFF(end_tag1, operand0->buffer.pointer); + length2 = ACPI_PTR_DIFF(end_tag2, operand1->buffer.pointer) + 2; /* Size of END_TAG */ /* Create a new buffer object for the result */ - return_desc = acpi_ut_create_buffer_object (length1 + length2); + return_desc = acpi_ut_create_buffer_object(length1 + length2); if (!return_desc) { - return_ACPI_STATUS (AE_NO_MEMORY); + return_ACPI_STATUS(AE_NO_MEMORY); } /* Copy the templates to the new descriptor */ new_buf = return_desc->buffer.pointer; - ACPI_MEMCPY (new_buf, operand0->buffer.pointer, length1); - ACPI_MEMCPY (new_buf + length1, operand1->buffer.pointer, length2); + ACPI_MEMCPY(new_buf, operand0->buffer.pointer, length1); + ACPI_MEMCPY(new_buf + length1, operand1->buffer.pointer, length2); /* Compute the new checksum */ new_buf[return_desc->buffer.length - 1] = - acpi_ut_generate_checksum (return_desc->buffer.pointer, - (return_desc->buffer.length - 1)); + acpi_ut_generate_checksum(return_desc->buffer.pointer, + (return_desc->buffer.length - 1)); /* Return the completed template descriptor */ *actual_return_desc = return_desc; - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_ex_do_concatenate @@ -236,21 +220,18 @@ acpi_ex_concat_template ( ******************************************************************************/ acpi_status -acpi_ex_do_concatenate ( - union acpi_operand_object *operand0, - union acpi_operand_object *operand1, - union acpi_operand_object **actual_return_desc, - struct acpi_walk_state *walk_state) +acpi_ex_do_concatenate(union acpi_operand_object *operand0, + union acpi_operand_object *operand1, + union acpi_operand_object **actual_return_desc, + struct acpi_walk_state *walk_state) { - union acpi_operand_object *local_operand1 = operand1; - union acpi_operand_object *return_desc; - char *new_buf; - acpi_status status; - acpi_size new_length; - - - ACPI_FUNCTION_TRACE ("ex_do_concatenate"); + union acpi_operand_object *local_operand1 = operand1; + union acpi_operand_object *return_desc; + char *new_buf; + acpi_status status; + acpi_size new_length; + ACPI_FUNCTION_TRACE("ex_do_concatenate"); /* * Convert the second operand if necessary. The first operand @@ -259,27 +240,28 @@ acpi_ex_do_concatenate ( * guaranteed to be either Integer/String/Buffer by the operand * resolution mechanism. */ - switch (ACPI_GET_OBJECT_TYPE (operand0)) { + switch (ACPI_GET_OBJECT_TYPE(operand0)) { case ACPI_TYPE_INTEGER: - status = acpi_ex_convert_to_integer (operand1, &local_operand1, 16); + status = + acpi_ex_convert_to_integer(operand1, &local_operand1, 16); break; case ACPI_TYPE_STRING: - status = acpi_ex_convert_to_string (operand1, &local_operand1, - ACPI_IMPLICIT_CONVERT_HEX); + status = acpi_ex_convert_to_string(operand1, &local_operand1, + ACPI_IMPLICIT_CONVERT_HEX); break; case ACPI_TYPE_BUFFER: - status = acpi_ex_convert_to_buffer (operand1, &local_operand1); + status = acpi_ex_convert_to_buffer(operand1, &local_operand1); break; default: - ACPI_REPORT_ERROR (("Concat - invalid obj type: %X\n", - ACPI_GET_OBJECT_TYPE (operand0))); + ACPI_REPORT_ERROR(("Concat - invalid obj type: %X\n", + ACPI_GET_OBJECT_TYPE(operand0))); status = AE_AML_INTERNAL; } - if (ACPI_FAILURE (status)) { + if (ACPI_FAILURE(status)) { goto cleanup; } @@ -296,32 +278,33 @@ acpi_ex_do_concatenate ( * 2) Two Strings concatenated to produce a new String * 3) Two Buffers concatenated to produce a new Buffer */ - switch (ACPI_GET_OBJECT_TYPE (operand0)) { + switch (ACPI_GET_OBJECT_TYPE(operand0)) { case ACPI_TYPE_INTEGER: /* Result of two Integers is a Buffer */ /* Need enough buffer space for two integers */ - return_desc = acpi_ut_create_buffer_object ((acpi_size) - ACPI_MUL_2 (acpi_gbl_integer_byte_width)); + return_desc = acpi_ut_create_buffer_object((acpi_size) + ACPI_MUL_2 + (acpi_gbl_integer_byte_width)); if (!return_desc) { status = AE_NO_MEMORY; goto cleanup; } - new_buf = (char *) return_desc->buffer.pointer; + new_buf = (char *)return_desc->buffer.pointer; /* Copy the first integer, LSB first */ - ACPI_MEMCPY (new_buf, - &operand0->integer.value, - acpi_gbl_integer_byte_width); + ACPI_MEMCPY(new_buf, + &operand0->integer.value, + acpi_gbl_integer_byte_width); /* Copy the second integer (LSB first) after the first */ - ACPI_MEMCPY (new_buf + acpi_gbl_integer_byte_width, - &local_operand1->integer.value, - acpi_gbl_integer_byte_width); + ACPI_MEMCPY(new_buf + acpi_gbl_integer_byte_width, + &local_operand1->integer.value, + acpi_gbl_integer_byte_width); break; case ACPI_TYPE_STRING: @@ -329,13 +312,13 @@ acpi_ex_do_concatenate ( /* Result of two Strings is a String */ new_length = (acpi_size) operand0->string.length + - (acpi_size) local_operand1->string.length; + (acpi_size) local_operand1->string.length; if (new_length > ACPI_MAX_STRING_CONVERSION) { status = AE_AML_STRING_LIMIT; goto cleanup; } - return_desc = acpi_ut_create_string_object (new_length); + return_desc = acpi_ut_create_string_object(new_length); if (!return_desc) { status = AE_NO_MEMORY; goto cleanup; @@ -345,56 +328,56 @@ acpi_ex_do_concatenate ( /* Concatenate the strings */ - ACPI_STRCPY (new_buf, - operand0->string.pointer); - ACPI_STRCPY (new_buf + operand0->string.length, - local_operand1->string.pointer); + ACPI_STRCPY(new_buf, operand0->string.pointer); + ACPI_STRCPY(new_buf + operand0->string.length, + local_operand1->string.pointer); break; case ACPI_TYPE_BUFFER: /* Result of two Buffers is a Buffer */ - return_desc = acpi_ut_create_buffer_object ( - (acpi_size) operand0->buffer.length + - (acpi_size) local_operand1->buffer.length); + return_desc = acpi_ut_create_buffer_object((acpi_size) + operand0->buffer. + length + + (acpi_size) + local_operand1-> + buffer.length); if (!return_desc) { status = AE_NO_MEMORY; goto cleanup; } - new_buf = (char *) return_desc->buffer.pointer; + new_buf = (char *)return_desc->buffer.pointer; /* Concatenate the buffers */ - ACPI_MEMCPY (new_buf, - operand0->buffer.pointer, - operand0->buffer.length); - ACPI_MEMCPY (new_buf + operand0->buffer.length, - local_operand1->buffer.pointer, - local_operand1->buffer.length); + ACPI_MEMCPY(new_buf, + operand0->buffer.pointer, operand0->buffer.length); + ACPI_MEMCPY(new_buf + operand0->buffer.length, + local_operand1->buffer.pointer, + local_operand1->buffer.length); break; default: /* Invalid object type, should not happen here */ - ACPI_REPORT_ERROR (("Concatenate - Invalid object type: %X\n", - ACPI_GET_OBJECT_TYPE (operand0))); - status =AE_AML_INTERNAL; + ACPI_REPORT_ERROR(("Concatenate - Invalid object type: %X\n", + ACPI_GET_OBJECT_TYPE(operand0))); + status = AE_AML_INTERNAL; goto cleanup; } *actual_return_desc = return_desc; -cleanup: + cleanup: if (local_operand1 != operand1) { - acpi_ut_remove_reference (local_operand1); + acpi_ut_remove_reference(local_operand1); } - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_ex_do_math_op @@ -412,62 +395,49 @@ cleanup: ******************************************************************************/ acpi_integer -acpi_ex_do_math_op ( - u16 opcode, - acpi_integer integer0, - acpi_integer integer1) +acpi_ex_do_math_op(u16 opcode, acpi_integer integer0, acpi_integer integer1) { - ACPI_FUNCTION_ENTRY (); - + ACPI_FUNCTION_ENTRY(); switch (opcode) { - case AML_ADD_OP: /* Add (Integer0, Integer1, Result) */ + case AML_ADD_OP: /* Add (Integer0, Integer1, Result) */ return (integer0 + integer1); - - case AML_BIT_AND_OP: /* And (Integer0, Integer1, Result) */ + case AML_BIT_AND_OP: /* And (Integer0, Integer1, Result) */ return (integer0 & integer1); - - case AML_BIT_NAND_OP: /* NAnd (Integer0, Integer1, Result) */ + case AML_BIT_NAND_OP: /* NAnd (Integer0, Integer1, Result) */ return (~(integer0 & integer1)); - - case AML_BIT_OR_OP: /* Or (Integer0, Integer1, Result) */ + case AML_BIT_OR_OP: /* Or (Integer0, Integer1, Result) */ return (integer0 | integer1); - - case AML_BIT_NOR_OP: /* NOr (Integer0, Integer1, Result) */ + case AML_BIT_NOR_OP: /* NOr (Integer0, Integer1, Result) */ return (~(integer0 | integer1)); - - case AML_BIT_XOR_OP: /* XOr (Integer0, Integer1, Result) */ + case AML_BIT_XOR_OP: /* XOr (Integer0, Integer1, Result) */ return (integer0 ^ integer1); - - case AML_MULTIPLY_OP: /* Multiply (Integer0, Integer1, Result) */ + case AML_MULTIPLY_OP: /* Multiply (Integer0, Integer1, Result) */ return (integer0 * integer1); - - case AML_SHIFT_LEFT_OP: /* shift_left (Operand, shift_count, Result)*/ + case AML_SHIFT_LEFT_OP: /* shift_left (Operand, shift_count, Result) */ return (integer0 << integer1); - - case AML_SHIFT_RIGHT_OP: /* shift_right (Operand, shift_count, Result) */ + case AML_SHIFT_RIGHT_OP: /* shift_right (Operand, shift_count, Result) */ return (integer0 >> integer1); - - case AML_SUBTRACT_OP: /* Subtract (Integer0, Integer1, Result) */ + case AML_SUBTRACT_OP: /* Subtract (Integer0, Integer1, Result) */ return (integer0 - integer1); @@ -477,7 +447,6 @@ acpi_ex_do_math_op ( } } - /******************************************************************************* * * FUNCTION: acpi_ex_do_logical_numeric_op @@ -499,28 +468,24 @@ acpi_ex_do_math_op ( ******************************************************************************/ acpi_status -acpi_ex_do_logical_numeric_op ( - u16 opcode, - acpi_integer integer0, - acpi_integer integer1, - u8 *logical_result) +acpi_ex_do_logical_numeric_op(u16 opcode, + acpi_integer integer0, + acpi_integer integer1, u8 * logical_result) { - acpi_status status = AE_OK; - u8 local_result = FALSE; - - - ACPI_FUNCTION_TRACE ("ex_do_logical_numeric_op"); + acpi_status status = AE_OK; + u8 local_result = FALSE; + ACPI_FUNCTION_TRACE("ex_do_logical_numeric_op"); switch (opcode) { - case AML_LAND_OP: /* LAnd (Integer0, Integer1) */ + case AML_LAND_OP: /* LAnd (Integer0, Integer1) */ if (integer0 && integer1) { local_result = TRUE; } break; - case AML_LOR_OP: /* LOr (Integer0, Integer1) */ + case AML_LOR_OP: /* LOr (Integer0, Integer1) */ if (integer0 || integer1) { local_result = TRUE; @@ -535,10 +500,9 @@ acpi_ex_do_logical_numeric_op ( /* Return the logical result and status */ *logical_result = local_result; - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_ex_do_logical_op @@ -566,24 +530,20 @@ acpi_ex_do_logical_numeric_op ( ******************************************************************************/ acpi_status -acpi_ex_do_logical_op ( - u16 opcode, - union acpi_operand_object *operand0, - union acpi_operand_object *operand1, - u8 *logical_result) +acpi_ex_do_logical_op(u16 opcode, + union acpi_operand_object *operand0, + union acpi_operand_object *operand1, u8 * logical_result) { - union acpi_operand_object *local_operand1 = operand1; - acpi_integer integer0; - acpi_integer integer1; - u32 length0; - u32 length1; - acpi_status status = AE_OK; - u8 local_result = FALSE; - int compare; - - - ACPI_FUNCTION_TRACE ("ex_do_logical_op"); + union acpi_operand_object *local_operand1 = operand1; + acpi_integer integer0; + acpi_integer integer1; + u32 length0; + u32 length1; + acpi_status status = AE_OK; + u8 local_result = FALSE; + int compare; + ACPI_FUNCTION_TRACE("ex_do_logical_op"); /* * Convert the second operand if necessary. The first operand @@ -592,18 +552,19 @@ acpi_ex_do_logical_op ( * guaranteed to be either Integer/String/Buffer by the operand * resolution mechanism. */ - switch (ACPI_GET_OBJECT_TYPE (operand0)) { + switch (ACPI_GET_OBJECT_TYPE(operand0)) { case ACPI_TYPE_INTEGER: - status = acpi_ex_convert_to_integer (operand1, &local_operand1, 16); + status = + acpi_ex_convert_to_integer(operand1, &local_operand1, 16); break; case ACPI_TYPE_STRING: - status = acpi_ex_convert_to_string (operand1, &local_operand1, - ACPI_IMPLICIT_CONVERT_HEX); + status = acpi_ex_convert_to_string(operand1, &local_operand1, + ACPI_IMPLICIT_CONVERT_HEX); break; case ACPI_TYPE_BUFFER: - status = acpi_ex_convert_to_buffer (operand1, &local_operand1); + status = acpi_ex_convert_to_buffer(operand1, &local_operand1); break; default: @@ -611,14 +572,14 @@ acpi_ex_do_logical_op ( break; } - if (ACPI_FAILURE (status)) { + if (ACPI_FAILURE(status)) { goto cleanup; } /* * Two cases: 1) Both Integers, 2) Both Strings or Buffers */ - if (ACPI_GET_OBJECT_TYPE (operand0) == ACPI_TYPE_INTEGER) { + if (ACPI_GET_OBJECT_TYPE(operand0) == ACPI_TYPE_INTEGER) { /* * 1) Both operands are of type integer * Note: local_operand1 may have changed above @@ -627,21 +588,21 @@ acpi_ex_do_logical_op ( integer1 = local_operand1->integer.value; switch (opcode) { - case AML_LEQUAL_OP: /* LEqual (Operand0, Operand1) */ + case AML_LEQUAL_OP: /* LEqual (Operand0, Operand1) */ if (integer0 == integer1) { local_result = TRUE; } break; - case AML_LGREATER_OP: /* LGreater (Operand0, Operand1) */ + case AML_LGREATER_OP: /* LGreater (Operand0, Operand1) */ if (integer0 > integer1) { local_result = TRUE; } break; - case AML_LLESS_OP: /* LLess (Operand0, Operand1) */ + case AML_LLESS_OP: /* LLess (Operand0, Operand1) */ if (integer0 < integer1) { local_result = TRUE; @@ -652,8 +613,7 @@ acpi_ex_do_logical_op ( status = AE_AML_INTERNAL; break; } - } - else { + } else { /* * 2) Both operands are Strings or both are Buffers * Note: Code below takes advantage of common Buffer/String @@ -665,31 +625,31 @@ acpi_ex_do_logical_op ( /* Lexicographic compare: compare the data bytes */ - compare = ACPI_MEMCMP ((const char * ) operand0->buffer.pointer, - (const char * ) local_operand1->buffer.pointer, - (length0 > length1) ? length1 : length0); + compare = ACPI_MEMCMP((const char *)operand0->buffer.pointer, + (const char *)local_operand1->buffer. + pointer, + (length0 > length1) ? length1 : length0); switch (opcode) { - case AML_LEQUAL_OP: /* LEqual (Operand0, Operand1) */ + case AML_LEQUAL_OP: /* LEqual (Operand0, Operand1) */ /* Length and all bytes must be equal */ - if ((length0 == length1) && - (compare == 0)) { + if ((length0 == length1) && (compare == 0)) { /* Length and all bytes match ==> TRUE */ local_result = TRUE; } break; - case AML_LGREATER_OP: /* LGreater (Operand0, Operand1) */ + case AML_LGREATER_OP: /* LGreater (Operand0, Operand1) */ if (compare > 0) { local_result = TRUE; - goto cleanup; /* TRUE */ + goto cleanup; /* TRUE */ } if (compare < 0) { - goto cleanup; /* FALSE */ + goto cleanup; /* FALSE */ } /* Bytes match (to shortest length), compare lengths */ @@ -699,14 +659,14 @@ acpi_ex_do_logical_op ( } break; - case AML_LLESS_OP: /* LLess (Operand0, Operand1) */ + case AML_LLESS_OP: /* LLess (Operand0, Operand1) */ if (compare > 0) { - goto cleanup; /* FALSE */ + goto cleanup; /* FALSE */ } if (compare < 0) { local_result = TRUE; - goto cleanup; /* TRUE */ + goto cleanup; /* TRUE */ } /* Bytes match (to shortest length), compare lengths */ @@ -722,18 +682,16 @@ acpi_ex_do_logical_op ( } } -cleanup: + cleanup: /* New object was created if implicit conversion performed - delete */ if (local_operand1 != operand1) { - acpi_ut_remove_reference (local_operand1); + acpi_ut_remove_reference(local_operand1); } /* Return the logical result and status */ *logical_result = local_result; - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - - diff --git a/drivers/acpi/executer/exmutex.c b/drivers/acpi/executer/exmutex.c index c3cb714d2cb..ab47f6d8b5c 100644 --- a/drivers/acpi/executer/exmutex.c +++ b/drivers/acpi/executer/exmutex.c @@ -42,20 +42,16 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include #include #define _COMPONENT ACPI_EXECUTER - ACPI_MODULE_NAME ("exmutex") +ACPI_MODULE_NAME("exmutex") /* Local prototypes */ - static void -acpi_ex_link_mutex ( - union acpi_operand_object *obj_desc, - struct acpi_thread_state *thread); - +acpi_ex_link_mutex(union acpi_operand_object *obj_desc, + struct acpi_thread_state *thread); /******************************************************************************* * @@ -69,12 +65,9 @@ acpi_ex_link_mutex ( * ******************************************************************************/ -void -acpi_ex_unlink_mutex ( - union acpi_operand_object *obj_desc) +void acpi_ex_unlink_mutex(union acpi_operand_object *obj_desc) { - struct acpi_thread_state *thread = obj_desc->mutex.owner_thread; - + struct acpi_thread_state *thread = obj_desc->mutex.owner_thread; if (!thread) { return; @@ -88,13 +81,11 @@ acpi_ex_unlink_mutex ( if (obj_desc->mutex.prev) { (obj_desc->mutex.prev)->mutex.next = obj_desc->mutex.next; - } - else { + } else { thread->acquired_mutex_list = obj_desc->mutex.next; } } - /******************************************************************************* * * FUNCTION: acpi_ex_link_mutex @@ -109,12 +100,10 @@ acpi_ex_unlink_mutex ( ******************************************************************************/ static void -acpi_ex_link_mutex ( - union acpi_operand_object *obj_desc, - struct acpi_thread_state *thread) +acpi_ex_link_mutex(union acpi_operand_object *obj_desc, + struct acpi_thread_state *thread) { - union acpi_operand_object *list_head; - + union acpi_operand_object *list_head; list_head = thread->acquired_mutex_list; @@ -134,7 +123,6 @@ acpi_ex_link_mutex ( thread->acquired_mutex_list = obj_desc; } - /******************************************************************************* * * FUNCTION: acpi_ex_acquire_mutex @@ -150,27 +138,23 @@ acpi_ex_link_mutex ( ******************************************************************************/ acpi_status -acpi_ex_acquire_mutex ( - union acpi_operand_object *time_desc, - union acpi_operand_object *obj_desc, - struct acpi_walk_state *walk_state) +acpi_ex_acquire_mutex(union acpi_operand_object *time_desc, + union acpi_operand_object *obj_desc, + struct acpi_walk_state *walk_state) { - acpi_status status; - - - ACPI_FUNCTION_TRACE_PTR ("ex_acquire_mutex", obj_desc); + acpi_status status; + ACPI_FUNCTION_TRACE_PTR("ex_acquire_mutex", obj_desc); if (!obj_desc) { - return_ACPI_STATUS (AE_BAD_PARAMETER); + return_ACPI_STATUS(AE_BAD_PARAMETER); } /* Sanity check -- we must have a valid thread ID */ if (!walk_state->thread) { - ACPI_REPORT_ERROR (("Cannot acquire Mutex [%4.4s], null thread info\n", - acpi_ut_get_node_name (obj_desc->mutex.node))); - return_ACPI_STATUS (AE_AML_INTERNAL); + ACPI_REPORT_ERROR(("Cannot acquire Mutex [%4.4s], null thread info\n", acpi_ut_get_node_name(obj_desc->mutex.node))); + return_ACPI_STATUS(AE_AML_INTERNAL); } /* @@ -178,10 +162,8 @@ acpi_ex_acquire_mutex ( * mutex. This mechanism provides some deadlock prevention */ if (walk_state->thread->current_sync_level > obj_desc->mutex.sync_level) { - ACPI_REPORT_ERROR (( - "Cannot acquire Mutex [%4.4s], incorrect sync_level\n", - acpi_ut_get_node_name (obj_desc->mutex.node))); - return_ACPI_STATUS (AE_AML_MUTEX_ORDER); + ACPI_REPORT_ERROR(("Cannot acquire Mutex [%4.4s], incorrect sync_level\n", acpi_ut_get_node_name(obj_desc->mutex.node))); + return_ACPI_STATUS(AE_AML_MUTEX_ORDER); } /* Support for multiple acquires by the owning thread */ @@ -190,43 +172,43 @@ acpi_ex_acquire_mutex ( /* Special case for Global Lock, allow all threads */ if ((obj_desc->mutex.owner_thread->thread_id == - walk_state->thread->thread_id) || - (obj_desc->mutex.semaphore == - acpi_gbl_global_lock_semaphore)) { + walk_state->thread->thread_id) || + (obj_desc->mutex.semaphore == + acpi_gbl_global_lock_semaphore)) { /* * The mutex is already owned by this thread, * just increment the acquisition depth */ obj_desc->mutex.acquisition_depth++; - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } } /* Acquire the mutex, wait if necessary */ - status = acpi_ex_system_acquire_mutex (time_desc, obj_desc); - if (ACPI_FAILURE (status)) { + status = acpi_ex_system_acquire_mutex(time_desc, obj_desc); + if (ACPI_FAILURE(status)) { /* Includes failure from a timeout on time_desc */ - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } /* Have the mutex: update mutex and walk info and save the sync_level */ - obj_desc->mutex.owner_thread = walk_state->thread; + obj_desc->mutex.owner_thread = walk_state->thread; obj_desc->mutex.acquisition_depth = 1; - obj_desc->mutex.original_sync_level = walk_state->thread->current_sync_level; + obj_desc->mutex.original_sync_level = + walk_state->thread->current_sync_level; walk_state->thread->current_sync_level = obj_desc->mutex.sync_level; /* Link the mutex to the current thread for force-unlock at method exit */ - acpi_ex_link_mutex (obj_desc, walk_state->thread); + acpi_ex_link_mutex(obj_desc, walk_state->thread); - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_ex_release_mutex @@ -241,48 +223,40 @@ acpi_ex_acquire_mutex ( ******************************************************************************/ acpi_status -acpi_ex_release_mutex ( - union acpi_operand_object *obj_desc, - struct acpi_walk_state *walk_state) +acpi_ex_release_mutex(union acpi_operand_object *obj_desc, + struct acpi_walk_state *walk_state) { - acpi_status status; - - - ACPI_FUNCTION_TRACE ("ex_release_mutex"); + acpi_status status; + ACPI_FUNCTION_TRACE("ex_release_mutex"); if (!obj_desc) { - return_ACPI_STATUS (AE_BAD_PARAMETER); + return_ACPI_STATUS(AE_BAD_PARAMETER); } /* The mutex must have been previously acquired in order to release it */ if (!obj_desc->mutex.owner_thread) { - ACPI_REPORT_ERROR (("Cannot release Mutex [%4.4s], not acquired\n", - acpi_ut_get_node_name (obj_desc->mutex.node))); - return_ACPI_STATUS (AE_AML_MUTEX_NOT_ACQUIRED); + ACPI_REPORT_ERROR(("Cannot release Mutex [%4.4s], not acquired\n", acpi_ut_get_node_name(obj_desc->mutex.node))); + return_ACPI_STATUS(AE_AML_MUTEX_NOT_ACQUIRED); } /* Sanity check -- we must have a valid thread ID */ if (!walk_state->thread) { - ACPI_REPORT_ERROR (("Cannot release Mutex [%4.4s], null thread info\n", - acpi_ut_get_node_name (obj_desc->mutex.node))); - return_ACPI_STATUS (AE_AML_INTERNAL); + ACPI_REPORT_ERROR(("Cannot release Mutex [%4.4s], null thread info\n", acpi_ut_get_node_name(obj_desc->mutex.node))); + return_ACPI_STATUS(AE_AML_INTERNAL); } /* * The Mutex is owned, but this thread must be the owner. * Special case for Global Lock, any thread can release */ - if ((obj_desc->mutex.owner_thread->thread_id != walk_state->thread->thread_id) && - (obj_desc->mutex.semaphore != acpi_gbl_global_lock_semaphore)) { - ACPI_REPORT_ERROR (( - "Thread %X cannot release Mutex [%4.4s] acquired by thread %X\n", - walk_state->thread->thread_id, - acpi_ut_get_node_name (obj_desc->mutex.node), - obj_desc->mutex.owner_thread->thread_id)); - return_ACPI_STATUS (AE_AML_NOT_OWNER); + if ((obj_desc->mutex.owner_thread->thread_id != + walk_state->thread->thread_id) + && (obj_desc->mutex.semaphore != acpi_gbl_global_lock_semaphore)) { + ACPI_REPORT_ERROR(("Thread %X cannot release Mutex [%4.4s] acquired by thread %X\n", walk_state->thread->thread_id, acpi_ut_get_node_name(obj_desc->mutex.node), obj_desc->mutex.owner_thread->thread_id)); + return_ACPI_STATUS(AE_AML_NOT_OWNER); } /* @@ -290,10 +264,8 @@ acpi_ex_release_mutex ( * equal to the current sync level */ if (obj_desc->mutex.sync_level > walk_state->thread->current_sync_level) { - ACPI_REPORT_ERROR (( - "Cannot release Mutex [%4.4s], incorrect sync_level\n", - acpi_ut_get_node_name (obj_desc->mutex.node))); - return_ACPI_STATUS (AE_AML_MUTEX_ORDER); + ACPI_REPORT_ERROR(("Cannot release Mutex [%4.4s], incorrect sync_level\n", acpi_ut_get_node_name(obj_desc->mutex.node))); + return_ACPI_STATUS(AE_AML_MUTEX_ORDER); } /* Match multiple Acquires with multiple Releases */ @@ -302,26 +274,26 @@ acpi_ex_release_mutex ( if (obj_desc->mutex.acquisition_depth != 0) { /* Just decrement the depth and return */ - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } /* Unlink the mutex from the owner's list */ - acpi_ex_unlink_mutex (obj_desc); + acpi_ex_unlink_mutex(obj_desc); /* Release the mutex */ - status = acpi_ex_system_release_mutex (obj_desc); + status = acpi_ex_system_release_mutex(obj_desc); /* Update the mutex and walk state, restore sync_level before acquire */ obj_desc->mutex.owner_thread = NULL; - walk_state->thread->current_sync_level = obj_desc->mutex.original_sync_level; + walk_state->thread->current_sync_level = + obj_desc->mutex.original_sync_level; - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_ex_release_all_mutexes @@ -334,17 +306,13 @@ acpi_ex_release_mutex ( * ******************************************************************************/ -void -acpi_ex_release_all_mutexes ( - struct acpi_thread_state *thread) +void acpi_ex_release_all_mutexes(struct acpi_thread_state *thread) { - union acpi_operand_object *next = thread->acquired_mutex_list; - union acpi_operand_object *this; - acpi_status status; - - - ACPI_FUNCTION_ENTRY (); + union acpi_operand_object *next = thread->acquired_mutex_list; + union acpi_operand_object *this; + acpi_status status; + ACPI_FUNCTION_ENTRY(); /* Traverse the list of owned mutexes, releasing each one */ @@ -353,13 +321,13 @@ acpi_ex_release_all_mutexes ( next = this->mutex.next; this->mutex.acquisition_depth = 1; - this->mutex.prev = NULL; - this->mutex.next = NULL; + this->mutex.prev = NULL; + this->mutex.next = NULL; - /* Release the mutex */ + /* Release the mutex */ - status = acpi_ex_system_release_mutex (this); - if (ACPI_FAILURE (status)) { + status = acpi_ex_system_release_mutex(this); + if (ACPI_FAILURE(status)) { continue; } @@ -372,5 +340,3 @@ acpi_ex_release_all_mutexes ( thread->current_sync_level = this->mutex.original_sync_level; } } - - diff --git a/drivers/acpi/executer/exnames.c b/drivers/acpi/executer/exnames.c index b6ba1a7a677..239d8473e9a 100644 --- a/drivers/acpi/executer/exnames.c +++ b/drivers/acpi/executer/exnames.c @@ -42,26 +42,18 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include #include #include #define _COMPONENT ACPI_EXECUTER - ACPI_MODULE_NAME ("exnames") +ACPI_MODULE_NAME("exnames") /* Local prototypes */ - -static char * -acpi_ex_allocate_name_string ( - u32 prefix_count, - u32 num_name_segs); +static char *acpi_ex_allocate_name_string(u32 prefix_count, u32 num_name_segs); static acpi_status -acpi_ex_name_segment ( - u8 **in_aml_address, - char *name_string); - +acpi_ex_name_segment(u8 ** in_aml_address, char *name_string); /******************************************************************************* * @@ -79,17 +71,13 @@ acpi_ex_name_segment ( * ******************************************************************************/ -static char * -acpi_ex_allocate_name_string ( - u32 prefix_count, - u32 num_name_segs) +static char *acpi_ex_allocate_name_string(u32 prefix_count, u32 num_name_segs) { - char *temp_ptr; - char *name_string; - u32 size_needed; - - ACPI_FUNCTION_TRACE ("ex_allocate_name_string"); + char *temp_ptr; + char *name_string; + u32 size_needed; + ACPI_FUNCTION_TRACE("ex_allocate_name_string"); /* * Allow room for all \ and ^ prefixes, all segments and a multi_name_prefix. @@ -100,20 +88,19 @@ acpi_ex_allocate_name_string ( /* Special case for root */ size_needed = 1 + (ACPI_NAME_SIZE * num_name_segs) + 2 + 1; - } - else { - size_needed = prefix_count + (ACPI_NAME_SIZE * num_name_segs) + 2 + 1; + } else { + size_needed = + prefix_count + (ACPI_NAME_SIZE * num_name_segs) + 2 + 1; } /* * Allocate a buffer for the name. * This buffer must be deleted by the caller! */ - name_string = ACPI_MEM_ALLOCATE (size_needed); + name_string = ACPI_MEM_ALLOCATE(size_needed); if (!name_string) { - ACPI_REPORT_ERROR (( - "ex_allocate_name_string: Could not allocate size %d\n", size_needed)); - return_PTR (NULL); + ACPI_REPORT_ERROR(("ex_allocate_name_string: Could not allocate size %d\n", size_needed)); + return_PTR(NULL); } temp_ptr = name_string; @@ -122,23 +109,20 @@ acpi_ex_allocate_name_string ( if (prefix_count == ACPI_UINT32_MAX) { *temp_ptr++ = AML_ROOT_PREFIX; - } - else { + } else { while (prefix_count--) { *temp_ptr++ = AML_PARENT_PREFIX; } } - /* Set up Dual or Multi prefixes if needed */ if (num_name_segs > 2) { /* Set up multi prefixes */ *temp_ptr++ = AML_MULTI_NAME_PREFIX_OP; - *temp_ptr++ = (char) num_name_segs; - } - else if (2 == num_name_segs) { + *temp_ptr++ = (char)num_name_segs; + } else if (2 == num_name_segs) { /* Set up dual prefixes */ *temp_ptr++ = AML_DUAL_NAME_PREFIX; @@ -150,7 +134,7 @@ acpi_ex_allocate_name_string ( */ *temp_ptr = 0; - return_PTR (name_string); + return_PTR(name_string); } /******************************************************************************* @@ -167,19 +151,14 @@ acpi_ex_allocate_name_string ( * ******************************************************************************/ -static acpi_status -acpi_ex_name_segment ( - u8 **in_aml_address, - char *name_string) +static acpi_status acpi_ex_name_segment(u8 ** in_aml_address, char *name_string) { - char *aml_address = (void *) *in_aml_address; - acpi_status status = AE_OK; - u32 index; - char char_buf[5]; - - - ACPI_FUNCTION_TRACE ("ex_name_segment"); + char *aml_address = (void *)*in_aml_address; + acpi_status status = AE_OK; + u32 index; + char char_buf[5]; + ACPI_FUNCTION_TRACE("ex_name_segment"); /* * If first character is a digit, then we know that we aren't looking at a @@ -188,20 +167,20 @@ acpi_ex_name_segment ( char_buf[0] = *aml_address; if ('0' <= char_buf[0] && char_buf[0] <= '9') { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "leading digit: %c\n", char_buf[0])); - return_ACPI_STATUS (AE_CTRL_PENDING); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "leading digit: %c\n", + char_buf[0])); + return_ACPI_STATUS(AE_CTRL_PENDING); } - ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "Bytes from stream:\n")); + ACPI_DEBUG_PRINT((ACPI_DB_LOAD, "Bytes from stream:\n")); for (index = 0; - (index < ACPI_NAME_SIZE) && (acpi_ut_valid_acpi_character (*aml_address)); - index++) { + (index < ACPI_NAME_SIZE) + && (acpi_ut_valid_acpi_character(*aml_address)); index++) { char_buf[index] = *aml_address++; - ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "%c\n", char_buf[index])); + ACPI_DEBUG_PRINT((ACPI_DB_LOAD, "%c\n", char_buf[index])); } - /* Valid name segment */ if (index == 4) { @@ -210,41 +189,37 @@ acpi_ex_name_segment ( char_buf[4] = '\0'; if (name_string) { - ACPI_STRCAT (name_string, char_buf); - ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, - "Appended to - %s \n", name_string)); + ACPI_STRCAT(name_string, char_buf); + ACPI_DEBUG_PRINT((ACPI_DB_NAMES, + "Appended to - %s \n", name_string)); + } else { + ACPI_DEBUG_PRINT((ACPI_DB_NAMES, + "No Name string - %s \n", char_buf)); } - else { - ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, - "No Name string - %s \n", char_buf)); - } - } - else if (index == 0) { + } else if (index == 0) { /* * First character was not a valid name character, * so we are looking at something other than a name. */ - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "Leading character is not alpha: %02Xh (not a name)\n", - char_buf[0])); + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "Leading character is not alpha: %02Xh (not a name)\n", + char_buf[0])); status = AE_CTRL_PENDING; - } - else { + } else { /* * Segment started with one or more valid characters, but fewer than * the required 4 */ status = AE_AML_BAD_NAME; - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Bad character %02x in name, at %p\n", - *aml_address, aml_address)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Bad character %02x in name, at %p\n", + *aml_address, aml_address)); } *in_aml_address = (u8 *) aml_address; - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_ex_get_name_string @@ -263,37 +238,32 @@ acpi_ex_name_segment ( ******************************************************************************/ acpi_status -acpi_ex_get_name_string ( - acpi_object_type data_type, - u8 *in_aml_address, - char **out_name_string, - u32 *out_name_length) +acpi_ex_get_name_string(acpi_object_type data_type, + u8 * in_aml_address, + char **out_name_string, u32 * out_name_length) { - acpi_status status = AE_OK; - u8 *aml_address = in_aml_address; - char *name_string = NULL; - u32 num_segments; - u32 prefix_count = 0; - u8 has_prefix = FALSE; - - - ACPI_FUNCTION_TRACE_PTR ("ex_get_name_string", aml_address); - - - if (ACPI_TYPE_LOCAL_REGION_FIELD == data_type || - ACPI_TYPE_LOCAL_BANK_FIELD == data_type || - ACPI_TYPE_LOCAL_INDEX_FIELD == data_type) { + acpi_status status = AE_OK; + u8 *aml_address = in_aml_address; + char *name_string = NULL; + u32 num_segments; + u32 prefix_count = 0; + u8 has_prefix = FALSE; + + ACPI_FUNCTION_TRACE_PTR("ex_get_name_string", aml_address); + + if (ACPI_TYPE_LOCAL_REGION_FIELD == data_type || + ACPI_TYPE_LOCAL_BANK_FIELD == data_type || + ACPI_TYPE_LOCAL_INDEX_FIELD == data_type) { /* Disallow prefixes for types associated with field_unit names */ - name_string = acpi_ex_allocate_name_string (0, 1); + name_string = acpi_ex_allocate_name_string(0, 1); if (!name_string) { status = AE_NO_MEMORY; + } else { + status = + acpi_ex_name_segment(&aml_address, name_string); } - else { - status = acpi_ex_name_segment (&aml_address, name_string); - } - } - else { + } else { /* * data_type is not a field name. * Examine first character of name for root or parent prefix operators @@ -301,8 +271,9 @@ acpi_ex_get_name_string ( switch (*aml_address) { case AML_ROOT_PREFIX: - ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "root_prefix(\\) at %p\n", - aml_address)); + ACPI_DEBUG_PRINT((ACPI_DB_LOAD, + "root_prefix(\\) at %p\n", + aml_address)); /* * Remember that we have a root_prefix -- @@ -313,14 +284,14 @@ acpi_ex_get_name_string ( has_prefix = TRUE; break; - case AML_PARENT_PREFIX: /* Increment past possibly multiple parent prefixes */ do { - ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "parent_prefix (^) at %p\n", - aml_address)); + ACPI_DEBUG_PRINT((ACPI_DB_LOAD, + "parent_prefix (^) at %p\n", + aml_address)); aml_address++; prefix_count++; @@ -330,7 +301,6 @@ acpi_ex_get_name_string ( has_prefix = TRUE; break; - default: /* Not a prefix character */ @@ -343,11 +313,13 @@ acpi_ex_get_name_string ( switch (*aml_address) { case AML_DUAL_NAME_PREFIX: - ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "dual_name_prefix at %p\n", - aml_address)); + ACPI_DEBUG_PRINT((ACPI_DB_LOAD, + "dual_name_prefix at %p\n", + aml_address)); aml_address++; - name_string = acpi_ex_allocate_name_string (prefix_count, 2); + name_string = + acpi_ex_allocate_name_string(prefix_count, 2); if (!name_string) { status = AE_NO_MEMORY; break; @@ -357,24 +329,29 @@ acpi_ex_get_name_string ( has_prefix = TRUE; - status = acpi_ex_name_segment (&aml_address, name_string); - if (ACPI_SUCCESS (status)) { - status = acpi_ex_name_segment (&aml_address, name_string); + status = + acpi_ex_name_segment(&aml_address, name_string); + if (ACPI_SUCCESS(status)) { + status = + acpi_ex_name_segment(&aml_address, + name_string); } break; - case AML_MULTI_NAME_PREFIX_OP: - ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "multi_name_prefix at %p\n", - aml_address)); + ACPI_DEBUG_PRINT((ACPI_DB_LOAD, + "multi_name_prefix at %p\n", + aml_address)); /* Fetch count of segments remaining in name path */ aml_address++; num_segments = *aml_address; - name_string = acpi_ex_allocate_name_string (prefix_count, num_segments); + name_string = + acpi_ex_allocate_name_string(prefix_count, + num_segments); if (!name_string) { status = AE_NO_MEMORY; break; @@ -386,27 +363,28 @@ acpi_ex_get_name_string ( has_prefix = TRUE; while (num_segments && - (status = acpi_ex_name_segment (&aml_address, name_string)) == - AE_OK) { + (status = + acpi_ex_name_segment(&aml_address, + name_string)) == AE_OK) { num_segments--; } break; - case 0: /* null_name valid as of 8-12-98 ASL/AML Grammar Update */ if (prefix_count == ACPI_UINT32_MAX) { - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "name_seg is \"\\\" followed by NULL\n")); + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, + "name_seg is \"\\\" followed by NULL\n")); } /* Consume the NULL byte */ aml_address++; - name_string = acpi_ex_allocate_name_string (prefix_count, 0); + name_string = + acpi_ex_allocate_name_string(prefix_count, 0); if (!name_string) { status = AE_NO_MEMORY; break; @@ -414,18 +392,19 @@ acpi_ex_get_name_string ( break; - default: /* Name segment string */ - name_string = acpi_ex_allocate_name_string (prefix_count, 1); + name_string = + acpi_ex_allocate_name_string(prefix_count, 1); if (!name_string) { status = AE_NO_MEMORY; break; } - status = acpi_ex_name_segment (&aml_address, name_string); + status = + acpi_ex_name_segment(&aml_address, name_string); break; } } @@ -433,22 +412,20 @@ acpi_ex_get_name_string ( if (AE_CTRL_PENDING == status && has_prefix) { /* Ran out of segments after processing a prefix */ - ACPI_REPORT_ERROR ( - ("ex_do_name: Malformed Name at %p\n", name_string)); + ACPI_REPORT_ERROR(("ex_do_name: Malformed Name at %p\n", + name_string)); status = AE_AML_BAD_NAME; } - if (ACPI_FAILURE (status)) { + if (ACPI_FAILURE(status)) { if (name_string) { - ACPI_MEM_FREE (name_string); + ACPI_MEM_FREE(name_string); } - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } *out_name_string = name_string; *out_name_length = (u32) (aml_address - in_aml_address); - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - - diff --git a/drivers/acpi/executer/exoparg1.c b/drivers/acpi/executer/exoparg1.c index 48c30f80008..97e34542f5e 100644 --- a/drivers/acpi/executer/exoparg1.c +++ b/drivers/acpi/executer/exoparg1.c @@ -42,7 +42,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include #include #include @@ -50,10 +49,8 @@ #include #include - #define _COMPONENT ACPI_EXECUTER - ACPI_MODULE_NAME ("exoparg1") - +ACPI_MODULE_NAME("exoparg1") /*! * Naming convention for AML interpreter execution routines. @@ -76,7 +73,6 @@ * The AcpiExOpcode* functions are called via the Dispatcher component with * fully resolved operands. !*/ - /******************************************************************************* * * FUNCTION: acpi_ex_opcode_0A_0T_1R @@ -88,61 +84,53 @@ * DESCRIPTION: Execute operator with no operands, one return value * ******************************************************************************/ - -acpi_status -acpi_ex_opcode_0A_0T_1R ( - struct acpi_walk_state *walk_state) +acpi_status acpi_ex_opcode_0A_0T_1R(struct acpi_walk_state *walk_state) { - acpi_status status = AE_OK; - union acpi_operand_object *return_desc = NULL; - - - ACPI_FUNCTION_TRACE_STR ("ex_opcode_0A_0T_1R", - acpi_ps_get_opcode_name (walk_state->opcode)); + acpi_status status = AE_OK; + union acpi_operand_object *return_desc = NULL; + ACPI_FUNCTION_TRACE_STR("ex_opcode_0A_0T_1R", + acpi_ps_get_opcode_name(walk_state->opcode)); /* Examine the AML opcode */ switch (walk_state->opcode) { - case AML_TIMER_OP: /* Timer () */ + case AML_TIMER_OP: /* Timer () */ /* Create a return object of type Integer */ - return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER); + return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); if (!return_desc) { status = AE_NO_MEMORY; goto cleanup; } #if ACPI_MACHINE_WIDTH != 16 - return_desc->integer.value = acpi_os_get_timer (); + return_desc->integer.value = acpi_os_get_timer(); #endif break; - default: /* Unknown opcode */ + default: /* Unknown opcode */ - ACPI_REPORT_ERROR (("acpi_ex_opcode_0A_0T_1R: Unknown opcode %X\n", - walk_state->opcode)); + ACPI_REPORT_ERROR(("acpi_ex_opcode_0A_0T_1R: Unknown opcode %X\n", walk_state->opcode)); status = AE_AML_BAD_OPCODE; break; } -cleanup: + cleanup: /* Delete return object on error */ - if ((ACPI_FAILURE (status)) || walk_state->result_obj) { - acpi_ut_remove_reference (return_desc); - } - else { + if ((ACPI_FAILURE(status)) || walk_state->result_obj) { + acpi_ut_remove_reference(return_desc); + } else { /* Save the return value */ walk_state->result_obj = return_desc; } - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_ex_opcode_1A_0T_0R @@ -156,69 +144,58 @@ cleanup: * ******************************************************************************/ -acpi_status -acpi_ex_opcode_1A_0T_0R ( - struct acpi_walk_state *walk_state) +acpi_status acpi_ex_opcode_1A_0T_0R(struct acpi_walk_state *walk_state) { - union acpi_operand_object **operand = &walk_state->operands[0]; - acpi_status status = AE_OK; - - - ACPI_FUNCTION_TRACE_STR ("ex_opcode_1A_0T_0R", - acpi_ps_get_opcode_name (walk_state->opcode)); + union acpi_operand_object **operand = &walk_state->operands[0]; + acpi_status status = AE_OK; + ACPI_FUNCTION_TRACE_STR("ex_opcode_1A_0T_0R", + acpi_ps_get_opcode_name(walk_state->opcode)); /* Examine the AML opcode */ switch (walk_state->opcode) { - case AML_RELEASE_OP: /* Release (mutex_object) */ + case AML_RELEASE_OP: /* Release (mutex_object) */ - status = acpi_ex_release_mutex (operand[0], walk_state); + status = acpi_ex_release_mutex(operand[0], walk_state); break; + case AML_RESET_OP: /* Reset (event_object) */ - case AML_RESET_OP: /* Reset (event_object) */ - - status = acpi_ex_system_reset_event (operand[0]); + status = acpi_ex_system_reset_event(operand[0]); break; + case AML_SIGNAL_OP: /* Signal (event_object) */ - case AML_SIGNAL_OP: /* Signal (event_object) */ - - status = acpi_ex_system_signal_event (operand[0]); + status = acpi_ex_system_signal_event(operand[0]); break; + case AML_SLEEP_OP: /* Sleep (msec_time) */ - case AML_SLEEP_OP: /* Sleep (msec_time) */ - - status = acpi_ex_system_do_suspend (operand[0]->integer.value); + status = acpi_ex_system_do_suspend(operand[0]->integer.value); break; + case AML_STALL_OP: /* Stall (usec_time) */ - case AML_STALL_OP: /* Stall (usec_time) */ - - status = acpi_ex_system_do_stall ((u32) operand[0]->integer.value); + status = + acpi_ex_system_do_stall((u32) operand[0]->integer.value); break; + case AML_UNLOAD_OP: /* Unload (Handle) */ - case AML_UNLOAD_OP: /* Unload (Handle) */ - - status = acpi_ex_unload_table (operand[0]); + status = acpi_ex_unload_table(operand[0]); break; + default: /* Unknown opcode */ - default: /* Unknown opcode */ - - ACPI_REPORT_ERROR (("acpi_ex_opcode_1A_0T_0R: Unknown opcode %X\n", - walk_state->opcode)); + ACPI_REPORT_ERROR(("acpi_ex_opcode_1A_0T_0R: Unknown opcode %X\n", walk_state->opcode)); status = AE_AML_BAD_OPCODE; break; } - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_ex_opcode_1A_1T_0R @@ -232,41 +209,34 @@ acpi_ex_opcode_1A_0T_0R ( * ******************************************************************************/ -acpi_status -acpi_ex_opcode_1A_1T_0R ( - struct acpi_walk_state *walk_state) +acpi_status acpi_ex_opcode_1A_1T_0R(struct acpi_walk_state *walk_state) { - acpi_status status = AE_OK; - union acpi_operand_object **operand = &walk_state->operands[0]; - - - ACPI_FUNCTION_TRACE_STR ("ex_opcode_1A_1T_0R", - acpi_ps_get_opcode_name (walk_state->opcode)); + acpi_status status = AE_OK; + union acpi_operand_object **operand = &walk_state->operands[0]; + ACPI_FUNCTION_TRACE_STR("ex_opcode_1A_1T_0R", + acpi_ps_get_opcode_name(walk_state->opcode)); /* Examine the AML opcode */ switch (walk_state->opcode) { case AML_LOAD_OP: - status = acpi_ex_load_op (operand[0], operand[1], walk_state); + status = acpi_ex_load_op(operand[0], operand[1], walk_state); break; - default: /* Unknown opcode */ + default: /* Unknown opcode */ - ACPI_REPORT_ERROR (("acpi_ex_opcode_1A_1T_0R: Unknown opcode %X\n", - walk_state->opcode)); + ACPI_REPORT_ERROR(("acpi_ex_opcode_1A_1T_0R: Unknown opcode %X\n", walk_state->opcode)); status = AE_AML_BAD_OPCODE; goto cleanup; } + cleanup: -cleanup: - - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_ex_opcode_1A_1T_1R @@ -280,23 +250,19 @@ cleanup: * ******************************************************************************/ -acpi_status -acpi_ex_opcode_1A_1T_1R ( - struct acpi_walk_state *walk_state) +acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state) { - acpi_status status = AE_OK; - union acpi_operand_object **operand = &walk_state->operands[0]; - union acpi_operand_object *return_desc = NULL; - union acpi_operand_object *return_desc2 = NULL; - u32 temp32; - u32 i; - acpi_integer power_of_ten; - acpi_integer digit; - - - ACPI_FUNCTION_TRACE_STR ("ex_opcode_1A_1T_1R", - acpi_ps_get_opcode_name (walk_state->opcode)); - + acpi_status status = AE_OK; + union acpi_operand_object **operand = &walk_state->operands[0]; + union acpi_operand_object *return_desc = NULL; + union acpi_operand_object *return_desc2 = NULL; + u32 temp32; + u32 i; + acpi_integer power_of_ten; + acpi_integer digit; + + ACPI_FUNCTION_TRACE_STR("ex_opcode_1A_1T_1R", + acpi_ps_get_opcode_name(walk_state->opcode)); /* Examine the AML opcode */ @@ -310,20 +276,19 @@ acpi_ex_opcode_1A_1T_1R ( /* Create a return object of type Integer for these opcodes */ - return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER); + return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); if (!return_desc) { status = AE_NO_MEMORY; goto cleanup; } switch (walk_state->opcode) { - case AML_BIT_NOT_OP: /* Not (Operand, Result) */ + case AML_BIT_NOT_OP: /* Not (Operand, Result) */ return_desc->integer.value = ~operand[0]->integer.value; break; - - case AML_FIND_SET_LEFT_BIT_OP: /* find_set_left_bit (Operand, Result) */ + case AML_FIND_SET_LEFT_BIT_OP: /* find_set_left_bit (Operand, Result) */ return_desc->integer.value = operand[0]->integer.value; @@ -332,15 +297,14 @@ acpi_ex_opcode_1A_1T_1R ( * endian unsigned value, so this boundary condition is valid. */ for (temp32 = 0; return_desc->integer.value && - temp32 < ACPI_INTEGER_BIT_SIZE; ++temp32) { + temp32 < ACPI_INTEGER_BIT_SIZE; ++temp32) { return_desc->integer.value >>= 1; } return_desc->integer.value = temp32; break; - - case AML_FIND_SET_RIGHT_BIT_OP: /* find_set_right_bit (Operand, Result) */ + case AML_FIND_SET_RIGHT_BIT_OP: /* find_set_right_bit (Operand, Result) */ return_desc->integer.value = operand[0]->integer.value; @@ -349,18 +313,17 @@ acpi_ex_opcode_1A_1T_1R ( * endian unsigned value, so this boundary condition is valid. */ for (temp32 = 0; return_desc->integer.value && - temp32 < ACPI_INTEGER_BIT_SIZE; ++temp32) { + temp32 < ACPI_INTEGER_BIT_SIZE; ++temp32) { return_desc->integer.value <<= 1; } /* Since the bit position is one-based, subtract from 33 (65) */ return_desc->integer.value = temp32 == 0 ? 0 : - (ACPI_INTEGER_BIT_SIZE + 1) - temp32; + (ACPI_INTEGER_BIT_SIZE + 1) - temp32; break; - - case AML_FROM_BCD_OP: /* from_bcd (BCDValue, Result) */ + case AML_FROM_BCD_OP: /* from_bcd (BCDValue, Result) */ /* * The 64-bit ACPI integer can hold 16 4-bit BCD characters @@ -373,7 +336,9 @@ acpi_ex_opcode_1A_1T_1R ( /* Convert each BCD digit (each is one nybble wide) */ - for (i = 0; (i < acpi_gbl_integer_nybble_width) && (digit > 0); i++) { + for (i = 0; + (i < acpi_gbl_integer_nybble_width) && (digit > 0); + i++) { /* Get the least significant 4-bit BCD digit */ temp32 = ((u32) digit) & 0xF; @@ -381,9 +346,9 @@ acpi_ex_opcode_1A_1T_1R ( /* Check the range of the digit */ if (temp32 > 9) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "BCD digit too large (not decimal): 0x%X\n", - temp32)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "BCD digit too large (not decimal): 0x%X\n", + temp32)); status = AE_AML_NUMERIC_OVERFLOW; goto cleanup; @@ -391,8 +356,8 @@ acpi_ex_opcode_1A_1T_1R ( /* Sum the digit into the result with the current power of 10 */ - return_desc->integer.value += (((acpi_integer) temp32) * - power_of_ten); + return_desc->integer.value += + (((acpi_integer) temp32) * power_of_ten); /* Shift to next BCD digit */ @@ -404,45 +369,50 @@ acpi_ex_opcode_1A_1T_1R ( } break; - - case AML_TO_BCD_OP: /* to_bcd (Operand, Result) */ + case AML_TO_BCD_OP: /* to_bcd (Operand, Result) */ return_desc->integer.value = 0; digit = operand[0]->integer.value; /* Each BCD digit is one nybble wide */ - for (i = 0; (i < acpi_gbl_integer_nybble_width) && (digit > 0); i++) { - (void) acpi_ut_short_divide (digit, 10, &digit, &temp32); + for (i = 0; + (i < acpi_gbl_integer_nybble_width) && (digit > 0); + i++) { + (void)acpi_ut_short_divide(digit, 10, &digit, + &temp32); /* * Insert the BCD digit that resides in the * remainder from above */ - return_desc->integer.value |= (((acpi_integer) temp32) << - ACPI_MUL_4 (i)); + return_desc->integer.value |= + (((acpi_integer) temp32) << ACPI_MUL_4(i)); } /* Overflow if there is any data left in Digit */ if (digit > 0) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Integer too large to convert to BCD: %8.8X%8.8X\n", - ACPI_FORMAT_UINT64 (operand[0]->integer.value))); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Integer too large to convert to BCD: %8.8X%8.8X\n", + ACPI_FORMAT_UINT64(operand + [0]-> + integer. + value))); status = AE_AML_NUMERIC_OVERFLOW; goto cleanup; } break; - - case AML_COND_REF_OF_OP: /* cond_ref_of (source_object, Result) */ + case AML_COND_REF_OF_OP: /* cond_ref_of (source_object, Result) */ /* * This op is a little strange because the internal return value is * different than the return value stored in the result descriptor * (There are really two return values) */ - if ((struct acpi_namespace_node *) operand[0] == acpi_gbl_root_node) { + if ((struct acpi_namespace_node *)operand[0] == + acpi_gbl_root_node) { /* * This means that the object does not exist in the namespace, * return FALSE @@ -453,38 +423,38 @@ acpi_ex_opcode_1A_1T_1R ( /* Get the object reference, store it, and remove our reference */ - status = acpi_ex_get_object_reference (operand[0], - &return_desc2, walk_state); - if (ACPI_FAILURE (status)) { + status = acpi_ex_get_object_reference(operand[0], + &return_desc2, + walk_state); + if (ACPI_FAILURE(status)) { goto cleanup; } - status = acpi_ex_store (return_desc2, operand[1], walk_state); - acpi_ut_remove_reference (return_desc2); + status = + acpi_ex_store(return_desc2, operand[1], walk_state); + acpi_ut_remove_reference(return_desc2); /* The object exists in the namespace, return TRUE */ return_desc->integer.value = ACPI_INTEGER_MAX; goto cleanup; - default: /* No other opcodes get here */ break; } break; - - case AML_STORE_OP: /* Store (Source, Target) */ + case AML_STORE_OP: /* Store (Source, Target) */ /* * A store operand is typically a number, string, buffer or lvalue * Be careful about deleting the source object, * since the object itself may have been stored. */ - status = acpi_ex_store (operand[0], operand[1], walk_state); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ex_store(operand[0], operand[1], walk_state); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* It is possible that the Store already produced a return object */ @@ -497,92 +467,84 @@ acpi_ex_opcode_1A_1T_1R ( * cancel out, and we simply don't do anything. */ walk_state->result_obj = operand[0]; - walk_state->operands[0] = NULL; /* Prevent deletion */ + walk_state->operands[0] = NULL; /* Prevent deletion */ } - return_ACPI_STATUS (status); - + return_ACPI_STATUS(status); - /* - * ACPI 2.0 Opcodes - */ - case AML_COPY_OP: /* Copy (Source, Target) */ + /* + * ACPI 2.0 Opcodes + */ + case AML_COPY_OP: /* Copy (Source, Target) */ - status = acpi_ut_copy_iobject_to_iobject (operand[0], &return_desc, - walk_state); + status = + acpi_ut_copy_iobject_to_iobject(operand[0], &return_desc, + walk_state); break; + case AML_TO_DECSTRING_OP: /* to_decimal_string (Data, Result) */ - case AML_TO_DECSTRING_OP: /* to_decimal_string (Data, Result) */ - - status = acpi_ex_convert_to_string (operand[0], &return_desc, - ACPI_EXPLICIT_CONVERT_DECIMAL); + status = acpi_ex_convert_to_string(operand[0], &return_desc, + ACPI_EXPLICIT_CONVERT_DECIMAL); if (return_desc == operand[0]) { /* No conversion performed, add ref to handle return value */ - acpi_ut_add_reference (return_desc); + acpi_ut_add_reference(return_desc); } break; + case AML_TO_HEXSTRING_OP: /* to_hex_string (Data, Result) */ - case AML_TO_HEXSTRING_OP: /* to_hex_string (Data, Result) */ - - status = acpi_ex_convert_to_string (operand[0], &return_desc, - ACPI_EXPLICIT_CONVERT_HEX); + status = acpi_ex_convert_to_string(operand[0], &return_desc, + ACPI_EXPLICIT_CONVERT_HEX); if (return_desc == operand[0]) { /* No conversion performed, add ref to handle return value */ - acpi_ut_add_reference (return_desc); + acpi_ut_add_reference(return_desc); } break; + case AML_TO_BUFFER_OP: /* to_buffer (Data, Result) */ - case AML_TO_BUFFER_OP: /* to_buffer (Data, Result) */ - - status = acpi_ex_convert_to_buffer (operand[0], &return_desc); + status = acpi_ex_convert_to_buffer(operand[0], &return_desc); if (return_desc == operand[0]) { /* No conversion performed, add ref to handle return value */ - acpi_ut_add_reference (return_desc); + acpi_ut_add_reference(return_desc); } break; + case AML_TO_INTEGER_OP: /* to_integer (Data, Result) */ - case AML_TO_INTEGER_OP: /* to_integer (Data, Result) */ - - status = acpi_ex_convert_to_integer (operand[0], &return_desc, - ACPI_ANY_BASE); + status = acpi_ex_convert_to_integer(operand[0], &return_desc, + ACPI_ANY_BASE); if (return_desc == operand[0]) { /* No conversion performed, add ref to handle return value */ - acpi_ut_add_reference (return_desc); + acpi_ut_add_reference(return_desc); } break; - - case AML_SHIFT_LEFT_BIT_OP: /* shift_left_bit (Source, bit_num) */ - case AML_SHIFT_RIGHT_BIT_OP: /* shift_right_bit (Source, bit_num) */ + case AML_SHIFT_LEFT_BIT_OP: /* shift_left_bit (Source, bit_num) */ + case AML_SHIFT_RIGHT_BIT_OP: /* shift_right_bit (Source, bit_num) */ /* These are two obsolete opcodes */ - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "%s is obsolete and not implemented\n", - acpi_ps_get_opcode_name (walk_state->opcode))); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "%s is obsolete and not implemented\n", + acpi_ps_get_opcode_name(walk_state->opcode))); status = AE_SUPPORT; goto cleanup; + default: /* Unknown opcode */ - default: /* Unknown opcode */ - - ACPI_REPORT_ERROR (("acpi_ex_opcode_1A_1T_1R: Unknown opcode %X\n", - walk_state->opcode)); + ACPI_REPORT_ERROR(("acpi_ex_opcode_1A_1T_1R: Unknown opcode %X\n", walk_state->opcode)); status = AE_AML_BAD_OPCODE; goto cleanup; } - if (ACPI_SUCCESS (status)) { + if (ACPI_SUCCESS(status)) { /* Store the return value computed above into the target object */ - status = acpi_ex_store (return_desc, operand[1], walk_state); + status = acpi_ex_store(return_desc, operand[1], walk_state); } - -cleanup: + cleanup: if (!walk_state->result_obj) { walk_state->result_obj = return_desc; @@ -590,14 +552,13 @@ cleanup: /* Delete return object on error */ - if (ACPI_FAILURE (status)) { - acpi_ut_remove_reference (return_desc); + if (ACPI_FAILURE(status)) { + acpi_ut_remove_reference(return_desc); } - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_ex_opcode_1A_0T_1R @@ -610,28 +571,24 @@ cleanup: * ******************************************************************************/ -acpi_status -acpi_ex_opcode_1A_0T_1R ( - struct acpi_walk_state *walk_state) +acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) { - union acpi_operand_object **operand = &walk_state->operands[0]; - union acpi_operand_object *temp_desc; - union acpi_operand_object *return_desc = NULL; - acpi_status status = AE_OK; - u32 type; - acpi_integer value; - - - ACPI_FUNCTION_TRACE_STR ("ex_opcode_1A_0T_1R", - acpi_ps_get_opcode_name (walk_state->opcode)); + union acpi_operand_object **operand = &walk_state->operands[0]; + union acpi_operand_object *temp_desc; + union acpi_operand_object *return_desc = NULL; + acpi_status status = AE_OK; + u32 type; + acpi_integer value; + ACPI_FUNCTION_TRACE_STR("ex_opcode_1A_0T_1R", + acpi_ps_get_opcode_name(walk_state->opcode)); /* Examine the AML opcode */ switch (walk_state->opcode) { - case AML_LNOT_OP: /* LNot (Operand) */ + case AML_LNOT_OP: /* LNot (Operand) */ - return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER); + return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); if (!return_desc) { status = AE_NO_MEMORY; goto cleanup; @@ -646,15 +603,14 @@ acpi_ex_opcode_1A_0T_1R ( } break; - - case AML_DECREMENT_OP: /* Decrement (Operand) */ - case AML_INCREMENT_OP: /* Increment (Operand) */ + case AML_DECREMENT_OP: /* Decrement (Operand) */ + case AML_INCREMENT_OP: /* Increment (Operand) */ /* * Create a new integer. Can't just get the base integer and * increment it because it may be an Arg or Field. */ - return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER); + return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); if (!return_desc) { status = AE_NO_MEMORY; goto cleanup; @@ -665,10 +621,11 @@ acpi_ex_opcode_1A_0T_1R ( * NS Node or an internal object. */ temp_desc = operand[0]; - if (ACPI_GET_DESCRIPTOR_TYPE (temp_desc) == ACPI_DESC_TYPE_OPERAND) { + if (ACPI_GET_DESCRIPTOR_TYPE(temp_desc) == + ACPI_DESC_TYPE_OPERAND) { /* Internal reference object - prevent deletion */ - acpi_ut_add_reference (temp_desc); + acpi_ut_add_reference(temp_desc); } /* @@ -678,11 +635,15 @@ acpi_ex_opcode_1A_0T_1R ( * NOTE: We use LNOT_OP here in order to force resolution of the * reference operand to an actual integer. */ - status = acpi_ex_resolve_operands (AML_LNOT_OP, &temp_desc, walk_state); - if (ACPI_FAILURE (status)) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%s: bad operand(s) %s\n", - acpi_ps_get_opcode_name (walk_state->opcode), - acpi_format_exception(status))); + status = + acpi_ex_resolve_operands(AML_LNOT_OP, &temp_desc, + walk_state); + if (ACPI_FAILURE(status)) { + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "%s: bad operand(s) %s\n", + acpi_ps_get_opcode_name(walk_state-> + opcode), + acpi_format_exception(status))); goto cleanup; } @@ -692,25 +653,25 @@ acpi_ex_opcode_1A_0T_1R ( * Perform the actual increment or decrement */ if (walk_state->opcode == AML_INCREMENT_OP) { - return_desc->integer.value = temp_desc->integer.value +1; - } - else { - return_desc->integer.value = temp_desc->integer.value -1; + return_desc->integer.value = + temp_desc->integer.value + 1; + } else { + return_desc->integer.value = + temp_desc->integer.value - 1; } /* Finished with this Integer object */ - acpi_ut_remove_reference (temp_desc); + acpi_ut_remove_reference(temp_desc); /* * Store the result back (indirectly) through the original * Reference object */ - status = acpi_ex_store (return_desc, operand[0], walk_state); + status = acpi_ex_store(return_desc, operand[0], walk_state); break; - - case AML_TYPE_OP: /* object_type (source_object) */ + case AML_TYPE_OP: /* object_type (source_object) */ /* * Note: The operand is not resolved at this point because we want to @@ -721,13 +682,15 @@ acpi_ex_opcode_1A_0T_1R ( /* Get the type of the base object */ - status = acpi_ex_resolve_multiple (walk_state, operand[0], &type, NULL); - if (ACPI_FAILURE (status)) { + status = + acpi_ex_resolve_multiple(walk_state, operand[0], &type, + NULL); + if (ACPI_FAILURE(status)) { goto cleanup; } /* Allocate a descriptor to hold the type. */ - return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER); + return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); if (!return_desc) { status = AE_NO_MEMORY; goto cleanup; @@ -736,8 +699,7 @@ acpi_ex_opcode_1A_0T_1R ( return_desc->integer.value = type; break; - - case AML_SIZE_OF_OP: /* size_of (source_object) */ + case AML_SIZE_OF_OP: /* size_of (source_object) */ /* * Note: The operand is not resolved at this point because we want to @@ -746,9 +708,10 @@ acpi_ex_opcode_1A_0T_1R ( /* Get the base object */ - status = acpi_ex_resolve_multiple (walk_state, - operand[0], &type, &temp_desc); - if (ACPI_FAILURE (status)) { + status = acpi_ex_resolve_multiple(walk_state, + operand[0], &type, + &temp_desc); + if (ACPI_FAILURE(status)) { goto cleanup; } @@ -779,9 +742,9 @@ acpi_ex_opcode_1A_0T_1R ( break; default: - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "size_of - Operand is not Buf/Int/Str/Pkg - found type %s\n", - acpi_ut_get_type_name (type))); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "size_of - Operand is not Buf/Int/Str/Pkg - found type %s\n", + acpi_ut_get_type_name(type))); status = AE_AML_OPERAND_TYPE; goto cleanup; } @@ -790,7 +753,7 @@ acpi_ex_opcode_1A_0T_1R ( * Now that we have the size of the object, create a result * object to hold the value */ - return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER); + return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); if (!return_desc) { status = AE_NO_MEMORY; goto cleanup; @@ -799,22 +762,23 @@ acpi_ex_opcode_1A_0T_1R ( return_desc->integer.value = value; break; + case AML_REF_OF_OP: /* ref_of (source_object) */ - case AML_REF_OF_OP: /* ref_of (source_object) */ - - status = acpi_ex_get_object_reference (operand[0], &return_desc, walk_state); - if (ACPI_FAILURE (status)) { + status = + acpi_ex_get_object_reference(operand[0], &return_desc, + walk_state); + if (ACPI_FAILURE(status)) { goto cleanup; } break; - - case AML_DEREF_OF_OP: /* deref_of (obj_reference | String) */ + case AML_DEREF_OF_OP: /* deref_of (obj_reference | String) */ /* Check for a method local or argument, or standalone String */ - if (ACPI_GET_DESCRIPTOR_TYPE (operand[0]) != ACPI_DESC_TYPE_NAMED) { - switch (ACPI_GET_OBJECT_TYPE (operand[0])) { + if (ACPI_GET_DESCRIPTOR_TYPE(operand[0]) != + ACPI_DESC_TYPE_NAMED) { + switch (ACPI_GET_OBJECT_TYPE(operand[0])) { case ACPI_TYPE_LOCAL_REFERENCE: /* * This is a deref_of (local_x | arg_x) @@ -827,11 +791,12 @@ acpi_ex_opcode_1A_0T_1R ( /* Set Operand[0] to the value of the local/arg */ - status = acpi_ds_method_data_get_value ( - operand[0]->reference.opcode, - operand[0]->reference.offset, - walk_state, &temp_desc); - if (ACPI_FAILURE (status)) { + status = + acpi_ds_method_data_get_value + (operand[0]->reference.opcode, + operand[0]->reference.offset, + walk_state, &temp_desc); + if (ACPI_FAILURE(status)) { goto cleanup; } @@ -839,7 +804,7 @@ acpi_ex_opcode_1A_0T_1R ( * Delete our reference to the input object and * point to the object just retrieved */ - acpi_ut_remove_reference (operand[0]); + acpi_ut_remove_reference(operand[0]); operand[0] = temp_desc; break; @@ -847,8 +812,9 @@ acpi_ex_opcode_1A_0T_1R ( /* Get the object to which the reference refers */ - temp_desc = operand[0]->reference.object; - acpi_ut_remove_reference (operand[0]); + temp_desc = + operand[0]->reference.object; + acpi_ut_remove_reference(operand[0]); operand[0] = temp_desc; break; @@ -859,7 +825,6 @@ acpi_ex_opcode_1A_0T_1R ( } break; - case ACPI_TYPE_STRING: /* @@ -870,22 +835,28 @@ acpi_ex_opcode_1A_0T_1R ( * 2) Dereference the node to an actual object. Could be a * Field, so we need to resolve the node to a value. */ - status = acpi_ns_get_node_by_path (operand[0]->string.pointer, - walk_state->scope_info->scope.node, - ACPI_NS_SEARCH_PARENT, - ACPI_CAST_INDIRECT_PTR ( - struct acpi_namespace_node, &return_desc)); - if (ACPI_FAILURE (status)) { + status = + acpi_ns_get_node_by_path(operand[0]->string. + pointer, + walk_state-> + scope_info->scope. + node, + ACPI_NS_SEARCH_PARENT, + ACPI_CAST_INDIRECT_PTR + (struct + acpi_namespace_node, + &return_desc)); + if (ACPI_FAILURE(status)) { goto cleanup; } - status = acpi_ex_resolve_node_to_value ( - ACPI_CAST_INDIRECT_PTR ( - struct acpi_namespace_node, &return_desc), - walk_state); + status = + acpi_ex_resolve_node_to_value + (ACPI_CAST_INDIRECT_PTR + (struct acpi_namespace_node, &return_desc), + walk_state); goto cleanup; - default: status = AE_AML_OPERAND_TYPE; @@ -895,18 +866,20 @@ acpi_ex_opcode_1A_0T_1R ( /* Operand[0] may have changed from the code above */ - if (ACPI_GET_DESCRIPTOR_TYPE (operand[0]) == ACPI_DESC_TYPE_NAMED) { + if (ACPI_GET_DESCRIPTOR_TYPE(operand[0]) == + ACPI_DESC_TYPE_NAMED) { /* * This is a deref_of (object_reference) * Get the actual object from the Node (This is the dereference). * This case may only happen when a local_x or arg_x is * dereferenced above. */ - return_desc = acpi_ns_get_attached_object ( - (struct acpi_namespace_node *) operand[0]); - acpi_ut_add_reference (return_desc); - } - else { + return_desc = acpi_ns_get_attached_object((struct + acpi_namespace_node + *) + operand[0]); + acpi_ut_add_reference(return_desc); + } else { /* * This must be a reference object produced by either the * Index() or ref_of() operator @@ -921,7 +894,8 @@ acpi_ex_opcode_1A_0T_1R ( switch (operand[0]->reference.target_type) { case ACPI_TYPE_BUFFER_FIELD: - temp_desc = operand[0]->reference.object; + temp_desc = + operand[0]->reference.object; /* * Create a new object that contains one element of the @@ -931,7 +905,9 @@ acpi_ex_opcode_1A_0T_1R ( * sub-buffer of the main buffer, it is only a pointer to a * single element (byte) of the buffer! */ - return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER); + return_desc = + acpi_ut_create_internal_object + (ACPI_TYPE_INTEGER); if (!return_desc) { status = AE_NO_MEMORY; goto cleanup; @@ -943,56 +919,63 @@ acpi_ex_opcode_1A_0T_1R ( * reference to the buffer itself. */ return_desc->integer.value = - temp_desc->buffer.pointer[operand[0]->reference.offset]; + temp_desc->buffer. + pointer[operand[0]->reference. + offset]; break; - case ACPI_TYPE_PACKAGE: /* * Return the referenced element of the package. We must * add another reference to the referenced object, however. */ - return_desc = *(operand[0]->reference.where); + return_desc = + *(operand[0]->reference.where); if (return_desc) { - acpi_ut_add_reference (return_desc); + acpi_ut_add_reference + (return_desc); } break; - default: - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Unknown Index target_type %X in obj %p\n", - operand[0]->reference.target_type, operand[0])); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Unknown Index target_type %X in obj %p\n", + operand[0]->reference. + target_type, + operand[0])); status = AE_AML_OPERAND_TYPE; goto cleanup; } break; - case AML_REF_OF_OP: return_desc = operand[0]->reference.object; - if (ACPI_GET_DESCRIPTOR_TYPE (return_desc) == - ACPI_DESC_TYPE_NAMED) { + if (ACPI_GET_DESCRIPTOR_TYPE(return_desc) == + ACPI_DESC_TYPE_NAMED) { - return_desc = acpi_ns_get_attached_object ( - (struct acpi_namespace_node *) return_desc); + return_desc = + acpi_ns_get_attached_object((struct + acpi_namespace_node + *) + return_desc); } /* Add another reference to the object! */ - acpi_ut_add_reference (return_desc); + acpi_ut_add_reference(return_desc); break; - default: - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Unknown opcode in ref(%p) - %X\n", - operand[0], operand[0]->reference.opcode)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Unknown opcode in ref(%p) - %X\n", + operand[0], + operand[0]->reference. + opcode)); status = AE_TYPE; goto cleanup; @@ -1000,25 +983,21 @@ acpi_ex_opcode_1A_0T_1R ( } break; - default: - ACPI_REPORT_ERROR (("acpi_ex_opcode_1A_0T_1R: Unknown opcode %X\n", - walk_state->opcode)); + ACPI_REPORT_ERROR(("acpi_ex_opcode_1A_0T_1R: Unknown opcode %X\n", walk_state->opcode)); status = AE_AML_BAD_OPCODE; goto cleanup; } - -cleanup: + cleanup: /* Delete return object on error */ - if (ACPI_FAILURE (status)) { - acpi_ut_remove_reference (return_desc); + if (ACPI_FAILURE(status)) { + acpi_ut_remove_reference(return_desc); } walk_state->result_obj = return_desc; - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - diff --git a/drivers/acpi/executer/exoparg2.c b/drivers/acpi/executer/exoparg2.c index 7429032c2b6..8d70c6beef0 100644 --- a/drivers/acpi/executer/exoparg2.c +++ b/drivers/acpi/executer/exoparg2.c @@ -41,17 +41,14 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include #include #include #include #include - #define _COMPONENT ACPI_EXECUTER - ACPI_MODULE_NAME ("exoparg2") - +ACPI_MODULE_NAME("exoparg2") /*! * Naming convention for AML interpreter execution routines. @@ -74,8 +71,6 @@ * The AcpiExOpcode* functions are called via the Dispatcher component with * fully resolved operands. !*/ - - /******************************************************************************* * * FUNCTION: acpi_ex_opcode_2A_0T_0R @@ -90,29 +85,24 @@ * ALLOCATION: Deletes both operands * ******************************************************************************/ - -acpi_status -acpi_ex_opcode_2A_0T_0R ( - struct acpi_walk_state *walk_state) +acpi_status acpi_ex_opcode_2A_0T_0R(struct acpi_walk_state *walk_state) { - union acpi_operand_object **operand = &walk_state->operands[0]; - struct acpi_namespace_node *node; - u32 value; - acpi_status status = AE_OK; - - - ACPI_FUNCTION_TRACE_STR ("ex_opcode_2A_0T_0R", - acpi_ps_get_opcode_name (walk_state->opcode)); + union acpi_operand_object **operand = &walk_state->operands[0]; + struct acpi_namespace_node *node; + u32 value; + acpi_status status = AE_OK; + ACPI_FUNCTION_TRACE_STR("ex_opcode_2A_0T_0R", + acpi_ps_get_opcode_name(walk_state->opcode)); /* Examine the opcode */ switch (walk_state->opcode) { - case AML_NOTIFY_OP: /* Notify (notify_object, notify_value) */ + case AML_NOTIFY_OP: /* Notify (notify_object, notify_value) */ /* The first operand is a namespace node */ - node = (struct acpi_namespace_node *) operand[0]; + node = (struct acpi_namespace_node *)operand[0]; /* Second value is the notify value */ @@ -120,15 +110,14 @@ acpi_ex_opcode_2A_0T_0R ( /* Are notifies allowed on this object? */ - if (!acpi_ev_is_notify_object (node)) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Unexpected notify object type [%s]\n", - acpi_ut_get_type_name (node->type))); + if (!acpi_ev_is_notify_object(node)) { + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Unexpected notify object type [%s]\n", + acpi_ut_get_type_name(node->type))); status = AE_AML_OPERAND_TYPE; break; } - #ifdef ACPI_GPE_NOTIFY_CHECK /* * GPE method wake/notify check. Here, we want to ensure that we @@ -144,12 +133,14 @@ acpi_ex_opcode_2A_0T_0R ( * If all three cases are true, this is a wake-only GPE that should * be disabled at runtime. */ - if (value == 2) /* device_wake */ { - status = acpi_ev_check_for_wake_only_gpe (walk_state->gpe_event_info); - if (ACPI_FAILURE (status)) { + if (value == 2) { /* device_wake */ + status = + acpi_ev_check_for_wake_only_gpe(walk_state-> + gpe_event_info); + if (ACPI_FAILURE(status)) { /* AE_WAKE_ONLY_GPE only error, means ignore this notify */ - return_ACPI_STATUS (AE_OK) + return_ACPI_STATUS(AE_OK) } } #endif @@ -161,21 +152,18 @@ acpi_ex_opcode_2A_0T_0R ( * from this thread -- because handlers may in turn run other * control methods. */ - status = acpi_ev_queue_notify_request (node, value); + status = acpi_ev_queue_notify_request(node, value); break; - default: - ACPI_REPORT_ERROR (("acpi_ex_opcode_2A_0T_0R: Unknown opcode %X\n", - walk_state->opcode)); + ACPI_REPORT_ERROR(("acpi_ex_opcode_2A_0T_0R: Unknown opcode %X\n", walk_state->opcode)); status = AE_AML_BAD_OPCODE; } - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_ex_opcode_2A_2T_1R @@ -189,19 +177,15 @@ acpi_ex_opcode_2A_0T_0R ( * ******************************************************************************/ -acpi_status -acpi_ex_opcode_2A_2T_1R ( - struct acpi_walk_state *walk_state) +acpi_status acpi_ex_opcode_2A_2T_1R(struct acpi_walk_state *walk_state) { - union acpi_operand_object **operand = &walk_state->operands[0]; - union acpi_operand_object *return_desc1 = NULL; - union acpi_operand_object *return_desc2 = NULL; - acpi_status status; - - - ACPI_FUNCTION_TRACE_STR ("ex_opcode_2A_2T_1R", - acpi_ps_get_opcode_name (walk_state->opcode)); + union acpi_operand_object **operand = &walk_state->operands[0]; + union acpi_operand_object *return_desc1 = NULL; + union acpi_operand_object *return_desc2 = NULL; + acpi_status status; + ACPI_FUNCTION_TRACE_STR("ex_opcode_2A_2T_1R", + acpi_ps_get_opcode_name(walk_state->opcode)); /* Execute the opcode */ @@ -210,13 +194,15 @@ acpi_ex_opcode_2A_2T_1R ( /* Divide (Dividend, Divisor, remainder_result quotient_result) */ - return_desc1 = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER); + return_desc1 = + acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); if (!return_desc1) { status = AE_NO_MEMORY; goto cleanup; } - return_desc2 = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER); + return_desc2 = + acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); if (!return_desc2) { status = AE_NO_MEMORY; goto cleanup; @@ -224,33 +210,31 @@ acpi_ex_opcode_2A_2T_1R ( /* Quotient to return_desc1, remainder to return_desc2 */ - status = acpi_ut_divide (operand[0]->integer.value, - operand[1]->integer.value, - &return_desc1->integer.value, - &return_desc2->integer.value); - if (ACPI_FAILURE (status)) { + status = acpi_ut_divide(operand[0]->integer.value, + operand[1]->integer.value, + &return_desc1->integer.value, + &return_desc2->integer.value); + if (ACPI_FAILURE(status)) { goto cleanup; } break; - default: - ACPI_REPORT_ERROR (("acpi_ex_opcode_2A_2T_1R: Unknown opcode %X\n", - walk_state->opcode)); + ACPI_REPORT_ERROR(("acpi_ex_opcode_2A_2T_1R: Unknown opcode %X\n", walk_state->opcode)); status = AE_AML_BAD_OPCODE; goto cleanup; } /* Store the results to the target reference operands */ - status = acpi_ex_store (return_desc2, operand[2], walk_state); - if (ACPI_FAILURE (status)) { + status = acpi_ex_store(return_desc2, operand[2], walk_state); + if (ACPI_FAILURE(status)) { goto cleanup; } - status = acpi_ex_store (return_desc1, operand[3], walk_state); - if (ACPI_FAILURE (status)) { + status = acpi_ex_store(return_desc1, operand[3], walk_state); + if (ACPI_FAILURE(status)) { goto cleanup; } @@ -258,24 +242,22 @@ acpi_ex_opcode_2A_2T_1R ( walk_state->result_obj = return_desc1; - -cleanup: + cleanup: /* * Since the remainder is not returned indirectly, remove a reference to * it. Only the quotient is returned indirectly. */ - acpi_ut_remove_reference (return_desc2); + acpi_ut_remove_reference(return_desc2); - if (ACPI_FAILURE (status)) { + if (ACPI_FAILURE(status)) { /* Delete the return object */ - acpi_ut_remove_reference (return_desc1); + acpi_ut_remove_reference(return_desc1); } - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_ex_opcode_2A_1T_1R @@ -289,42 +271,39 @@ cleanup: * ******************************************************************************/ -acpi_status -acpi_ex_opcode_2A_1T_1R ( - struct acpi_walk_state *walk_state) +acpi_status acpi_ex_opcode_2A_1T_1R(struct acpi_walk_state *walk_state) { - union acpi_operand_object **operand = &walk_state->operands[0]; - union acpi_operand_object *return_desc = NULL; - acpi_integer index; - acpi_status status = AE_OK; - acpi_size length; - - - ACPI_FUNCTION_TRACE_STR ("ex_opcode_2A_1T_1R", - acpi_ps_get_opcode_name (walk_state->opcode)); + union acpi_operand_object **operand = &walk_state->operands[0]; + union acpi_operand_object *return_desc = NULL; + acpi_integer index; + acpi_status status = AE_OK; + acpi_size length; + ACPI_FUNCTION_TRACE_STR("ex_opcode_2A_1T_1R", + acpi_ps_get_opcode_name(walk_state->opcode)); /* Execute the opcode */ if (walk_state->op_info->flags & AML_MATH) { /* All simple math opcodes (add, etc.) */ - return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER); + return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); if (!return_desc) { status = AE_NO_MEMORY; goto cleanup; } - return_desc->integer.value = acpi_ex_do_math_op (walk_state->opcode, - operand[0]->integer.value, - operand[1]->integer.value); + return_desc->integer.value = + acpi_ex_do_math_op(walk_state->opcode, + operand[0]->integer.value, + operand[1]->integer.value); goto store_result_to_target; } switch (walk_state->opcode) { - case AML_MOD_OP: /* Mod (Dividend, Divisor, remainder_result (ACPI 2.0) */ + case AML_MOD_OP: /* Mod (Dividend, Divisor, remainder_result (ACPI 2.0) */ - return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER); + return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); if (!return_desc) { status = AE_NO_MEMORY; goto cleanup; @@ -332,21 +311,18 @@ acpi_ex_opcode_2A_1T_1R ( /* return_desc will contain the remainder */ - status = acpi_ut_divide (operand[0]->integer.value, - operand[1]->integer.value, - NULL, - &return_desc->integer.value); + status = acpi_ut_divide(operand[0]->integer.value, + operand[1]->integer.value, + NULL, &return_desc->integer.value); break; + case AML_CONCAT_OP: /* Concatenate (Data1, Data2, Result) */ - case AML_CONCAT_OP: /* Concatenate (Data1, Data2, Result) */ - - status = acpi_ex_do_concatenate (operand[0], operand[1], - &return_desc, walk_state); + status = acpi_ex_do_concatenate(operand[0], operand[1], + &return_desc, walk_state); break; - - case AML_TO_STRING_OP: /* to_string (Buffer, Length, Result) (ACPI 2.0) */ + case AML_TO_STRING_OP: /* to_string (Buffer, Length, Result) (ACPI 2.0) */ /* * Input object is guaranteed to be a buffer at this point (it may have @@ -365,8 +341,8 @@ acpi_ex_opcode_2A_1T_1R ( */ length = 0; while ((length < operand[0]->buffer.length) && - (length < operand[1]->integer.value) && - (operand[0]->buffer.pointer[length])) { + (length < operand[1]->integer.value) && + (operand[0]->buffer.pointer[length])) { length++; if (length > ACPI_MAX_STRING_CONVERSION) { status = AE_AML_STRING_LIMIT; @@ -376,33 +352,32 @@ acpi_ex_opcode_2A_1T_1R ( /* Allocate a new string object */ - return_desc = acpi_ut_create_string_object (length); + return_desc = acpi_ut_create_string_object(length); if (!return_desc) { status = AE_NO_MEMORY; goto cleanup; } - /* Copy the raw buffer data with no transform. NULL terminated already*/ + /* Copy the raw buffer data with no transform. NULL terminated already */ - ACPI_MEMCPY (return_desc->string.pointer, - operand[0]->buffer.pointer, length); + ACPI_MEMCPY(return_desc->string.pointer, + operand[0]->buffer.pointer, length); break; - case AML_CONCAT_RES_OP: /* concatenate_res_template (Buffer, Buffer, Result) (ACPI 2.0) */ - status = acpi_ex_concat_template (operand[0], operand[1], - &return_desc, walk_state); + status = acpi_ex_concat_template(operand[0], operand[1], + &return_desc, walk_state); break; - - case AML_INDEX_OP: /* Index (Source Index Result) */ + case AML_INDEX_OP: /* Index (Source Index Result) */ /* Create the internal return object */ - return_desc = acpi_ut_create_internal_object (ACPI_TYPE_LOCAL_REFERENCE); + return_desc = + acpi_ut_create_internal_object(ACPI_TYPE_LOCAL_REFERENCE); if (!return_desc) { status = AE_NO_MEMORY; goto cleanup; @@ -412,76 +387,75 @@ acpi_ex_opcode_2A_1T_1R ( /* At this point, the Source operand is a Package, Buffer, or String */ - if (ACPI_GET_OBJECT_TYPE (operand[0]) == ACPI_TYPE_PACKAGE) { + if (ACPI_GET_OBJECT_TYPE(operand[0]) == ACPI_TYPE_PACKAGE) { /* Object to be indexed is a Package */ if (index >= operand[0]->package.count) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Index value (%X%8.8X) beyond package end (%X)\n", - ACPI_FORMAT_UINT64 (index), operand[0]->package.count)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Index value (%X%8.8X) beyond package end (%X)\n", + ACPI_FORMAT_UINT64(index), + operand[0]->package.count)); status = AE_AML_PACKAGE_LIMIT; goto cleanup; } return_desc->reference.target_type = ACPI_TYPE_PACKAGE; - return_desc->reference.object = operand[0]; - return_desc->reference.where = &operand[0]->package.elements [ - index]; - } - else { + return_desc->reference.object = operand[0]; + return_desc->reference.where = + &operand[0]->package.elements[index]; + } else { /* Object to be indexed is a Buffer/String */ if (index >= operand[0]->buffer.length) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Index value (%X%8.8X) beyond end of buffer (%X)\n", - ACPI_FORMAT_UINT64 (index), operand[0]->buffer.length)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Index value (%X%8.8X) beyond end of buffer (%X)\n", + ACPI_FORMAT_UINT64(index), + operand[0]->buffer.length)); status = AE_AML_BUFFER_LIMIT; goto cleanup; } - return_desc->reference.target_type = ACPI_TYPE_BUFFER_FIELD; - return_desc->reference.object = operand[0]; + return_desc->reference.target_type = + ACPI_TYPE_BUFFER_FIELD; + return_desc->reference.object = operand[0]; } /* * Add a reference to the target package/buffer/string for the life * of the index. */ - acpi_ut_add_reference (operand[0]); + acpi_ut_add_reference(operand[0]); /* Complete the Index reference object */ - return_desc->reference.opcode = AML_INDEX_OP; - return_desc->reference.offset = (u32) index; + return_desc->reference.opcode = AML_INDEX_OP; + return_desc->reference.offset = (u32) index; /* Store the reference to the Target */ - status = acpi_ex_store (return_desc, operand[2], walk_state); + status = acpi_ex_store(return_desc, operand[2], walk_state); /* Return the reference */ walk_state->result_obj = return_desc; goto cleanup; - default: - ACPI_REPORT_ERROR (("acpi_ex_opcode_2A_1T_1R: Unknown opcode %X\n", - walk_state->opcode)); + ACPI_REPORT_ERROR(("acpi_ex_opcode_2A_1T_1R: Unknown opcode %X\n", walk_state->opcode)); status = AE_AML_BAD_OPCODE; break; } + store_result_to_target: -store_result_to_target: - - if (ACPI_SUCCESS (status)) { + if (ACPI_SUCCESS(status)) { /* * Store the result of the operation (which is now in return_desc) into * the Target descriptor. */ - status = acpi_ex_store (return_desc, operand[2], walk_state); - if (ACPI_FAILURE (status)) { + status = acpi_ex_store(return_desc, operand[2], walk_state); + if (ACPI_FAILURE(status)) { goto cleanup; } @@ -490,19 +464,17 @@ store_result_to_target: } } - -cleanup: + cleanup: /* Delete return object on error */ - if (ACPI_FAILURE (status)) { - acpi_ut_remove_reference (return_desc); + if (ACPI_FAILURE(status)) { + acpi_ut_remove_reference(return_desc); } - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_ex_opcode_2A_0T_1R @@ -515,23 +487,19 @@ cleanup: * ******************************************************************************/ -acpi_status -acpi_ex_opcode_2A_0T_1R ( - struct acpi_walk_state *walk_state) +acpi_status acpi_ex_opcode_2A_0T_1R(struct acpi_walk_state *walk_state) { - union acpi_operand_object **operand = &walk_state->operands[0]; - union acpi_operand_object *return_desc = NULL; - acpi_status status = AE_OK; - u8 logical_result = FALSE; - - - ACPI_FUNCTION_TRACE_STR ("ex_opcode_2A_0T_1R", - acpi_ps_get_opcode_name (walk_state->opcode)); + union acpi_operand_object **operand = &walk_state->operands[0]; + union acpi_operand_object *return_desc = NULL; + acpi_status status = AE_OK; + u8 logical_result = FALSE; + ACPI_FUNCTION_TRACE_STR("ex_opcode_2A_0T_1R", + acpi_ps_get_opcode_name(walk_state->opcode)); /* Create the internal return object */ - return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER); + return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); if (!return_desc) { status = AE_NO_MEMORY; goto cleanup; @@ -542,50 +510,48 @@ acpi_ex_opcode_2A_0T_1R ( if (walk_state->op_info->flags & AML_LOGICAL_NUMERIC) { /* logical_op (Operand0, Operand1) */ - status = acpi_ex_do_logical_numeric_op (walk_state->opcode, - operand[0]->integer.value, operand[1]->integer.value, - &logical_result); + status = acpi_ex_do_logical_numeric_op(walk_state->opcode, + operand[0]->integer. + value, + operand[1]->integer. + value, &logical_result); goto store_logical_result; - } - else if (walk_state->op_info->flags & AML_LOGICAL) { + } else if (walk_state->op_info->flags & AML_LOGICAL) { /* logical_op (Operand0, Operand1) */ - status = acpi_ex_do_logical_op (walk_state->opcode, operand[0], - operand[1], &logical_result); + status = acpi_ex_do_logical_op(walk_state->opcode, operand[0], + operand[1], &logical_result); goto store_logical_result; } switch (walk_state->opcode) { - case AML_ACQUIRE_OP: /* Acquire (mutex_object, Timeout) */ + case AML_ACQUIRE_OP: /* Acquire (mutex_object, Timeout) */ - status = acpi_ex_acquire_mutex (operand[1], operand[0], walk_state); + status = + acpi_ex_acquire_mutex(operand[1], operand[0], walk_state); if (status == AE_TIME) { - logical_result = TRUE; /* TRUE = Acquire timed out */ + logical_result = TRUE; /* TRUE = Acquire timed out */ status = AE_OK; } break; + case AML_WAIT_OP: /* Wait (event_object, Timeout) */ - case AML_WAIT_OP: /* Wait (event_object, Timeout) */ - - status = acpi_ex_system_wait_event (operand[1], operand[0]); + status = acpi_ex_system_wait_event(operand[1], operand[0]); if (status == AE_TIME) { - logical_result = TRUE; /* TRUE, Wait timed out */ + logical_result = TRUE; /* TRUE, Wait timed out */ status = AE_OK; } break; - default: - ACPI_REPORT_ERROR (("acpi_ex_opcode_2A_0T_1R: Unknown opcode %X\n", - walk_state->opcode)); + ACPI_REPORT_ERROR(("acpi_ex_opcode_2A_0T_1R: Unknown opcode %X\n", walk_state->opcode)); status = AE_AML_BAD_OPCODE; goto cleanup; } - -store_logical_result: + store_logical_result: /* * Set return value to according to logical_result. logical TRUE (all ones) * Default is FALSE (zero) @@ -596,16 +562,13 @@ store_logical_result: walk_state->result_obj = return_desc; - -cleanup: + cleanup: /* Delete return object on error */ - if (ACPI_FAILURE (status)) { - acpi_ut_remove_reference (return_desc); + if (ACPI_FAILURE(status)) { + acpi_ut_remove_reference(return_desc); } - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - - diff --git a/drivers/acpi/executer/exoparg3.c b/drivers/acpi/executer/exoparg3.c index 197890f443b..48336577767 100644 --- a/drivers/acpi/executer/exoparg3.c +++ b/drivers/acpi/executer/exoparg3.c @@ -42,16 +42,13 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include #include #include #include - #define _COMPONENT ACPI_EXECUTER - ACPI_MODULE_NAME ("exoparg3") - +ACPI_MODULE_NAME("exoparg3") /*! * Naming convention for AML interpreter execution routines. @@ -74,8 +71,6 @@ * The AcpiExOpcode* functions are called via the Dispatcher component with * fully resolved operands. !*/ - - /******************************************************************************* * * FUNCTION: acpi_ex_opcode_3A_0T_0R @@ -87,61 +82,53 @@ * DESCRIPTION: Execute Triadic operator (3 operands) * ******************************************************************************/ - -acpi_status -acpi_ex_opcode_3A_0T_0R ( - struct acpi_walk_state *walk_state) +acpi_status acpi_ex_opcode_3A_0T_0R(struct acpi_walk_state *walk_state) { - union acpi_operand_object **operand = &walk_state->operands[0]; - struct acpi_signal_fatal_info *fatal; - acpi_status status = AE_OK; - - - ACPI_FUNCTION_TRACE_STR ("ex_opcode_3A_0T_0R", - acpi_ps_get_opcode_name (walk_state->opcode)); + union acpi_operand_object **operand = &walk_state->operands[0]; + struct acpi_signal_fatal_info *fatal; + acpi_status status = AE_OK; + ACPI_FUNCTION_TRACE_STR("ex_opcode_3A_0T_0R", + acpi_ps_get_opcode_name(walk_state->opcode)); switch (walk_state->opcode) { - case AML_FATAL_OP: /* Fatal (fatal_type fatal_code fatal_arg) */ + case AML_FATAL_OP: /* Fatal (fatal_type fatal_code fatal_arg) */ - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "fatal_op: Type %X Code %X Arg %X <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n", - (u32) operand[0]->integer.value, - (u32) operand[1]->integer.value, - (u32) operand[2]->integer.value)); + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "fatal_op: Type %X Code %X Arg %X <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n", + (u32) operand[0]->integer.value, + (u32) operand[1]->integer.value, + (u32) operand[2]->integer.value)); - fatal = ACPI_MEM_ALLOCATE (sizeof (struct acpi_signal_fatal_info)); + fatal = + ACPI_MEM_ALLOCATE(sizeof(struct acpi_signal_fatal_info)); if (fatal) { - fatal->type = (u32) operand[0]->integer.value; - fatal->code = (u32) operand[1]->integer.value; + fatal->type = (u32) operand[0]->integer.value; + fatal->code = (u32) operand[1]->integer.value; fatal->argument = (u32) operand[2]->integer.value; } /* Always signal the OS! */ - status = acpi_os_signal (ACPI_SIGNAL_FATAL, fatal); + status = acpi_os_signal(ACPI_SIGNAL_FATAL, fatal); /* Might return while OS is shutting down, just continue */ - ACPI_MEM_FREE (fatal); + ACPI_MEM_FREE(fatal); break; - default: - ACPI_REPORT_ERROR (("acpi_ex_opcode_3A_0T_0R: Unknown opcode %X\n", - walk_state->opcode)); + ACPI_REPORT_ERROR(("acpi_ex_opcode_3A_0T_0R: Unknown opcode %X\n", walk_state->opcode)); status = AE_AML_BAD_OPCODE; goto cleanup; } + cleanup: -cleanup: - - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_ex_opcode_3A_1T_1R @@ -154,31 +141,28 @@ cleanup: * ******************************************************************************/ -acpi_status -acpi_ex_opcode_3A_1T_1R ( - struct acpi_walk_state *walk_state) +acpi_status acpi_ex_opcode_3A_1T_1R(struct acpi_walk_state *walk_state) { - union acpi_operand_object **operand = &walk_state->operands[0]; - union acpi_operand_object *return_desc = NULL; - char *buffer = NULL; - acpi_status status = AE_OK; - acpi_integer index; - acpi_size length; - - - ACPI_FUNCTION_TRACE_STR ("ex_opcode_3A_1T_1R", - acpi_ps_get_opcode_name (walk_state->opcode)); + union acpi_operand_object **operand = &walk_state->operands[0]; + union acpi_operand_object *return_desc = NULL; + char *buffer = NULL; + acpi_status status = AE_OK; + acpi_integer index; + acpi_size length; + ACPI_FUNCTION_TRACE_STR("ex_opcode_3A_1T_1R", + acpi_ps_get_opcode_name(walk_state->opcode)); switch (walk_state->opcode) { - case AML_MID_OP: /* Mid (Source[0], Index[1], Length[2], Result[3]) */ + case AML_MID_OP: /* Mid (Source[0], Index[1], Length[2], Result[3]) */ /* * Create the return object. The Source operand is guaranteed to be * either a String or a Buffer, so just use its type. */ - return_desc = acpi_ut_create_internal_object ( - ACPI_GET_OBJECT_TYPE (operand[0])); + return_desc = + acpi_ut_create_internal_object(ACPI_GET_OBJECT_TYPE + (operand[0])); if (!return_desc) { status = AE_NO_MEMORY; goto cleanup; @@ -201,17 +185,17 @@ acpi_ex_opcode_3A_1T_1R ( else if ((index + length) > operand[0]->string.length) { length = (acpi_size) operand[0]->string.length - - (acpi_size) index; + (acpi_size) index; } /* Strings always have a sub-pointer, not so for buffers */ - switch (ACPI_GET_OBJECT_TYPE (operand[0])) { + switch (ACPI_GET_OBJECT_TYPE(operand[0])) { case ACPI_TYPE_STRING: /* Always allocate a new buffer for the String */ - buffer = ACPI_MEM_CALLOCATE ((acpi_size) length + 1); + buffer = ACPI_MEM_CALLOCATE((acpi_size) length + 1); if (!buffer) { status = AE_NO_MEMORY; goto cleanup; @@ -225,7 +209,7 @@ acpi_ex_opcode_3A_1T_1R ( if (length > 0) { /* Allocate a new buffer for the Buffer */ - buffer = ACPI_MEM_CALLOCATE (length); + buffer = ACPI_MEM_CALLOCATE(length); if (!buffer) { status = AE_NO_MEMORY; goto cleanup; @@ -233,7 +217,7 @@ acpi_ex_opcode_3A_1T_1R ( } break; - default: /* Should not happen */ + default: /* Should not happen */ status = AE_AML_OPERAND_TYPE; goto cleanup; @@ -242,8 +226,8 @@ acpi_ex_opcode_3A_1T_1R ( if (length > 0) { /* Copy the portion requested */ - ACPI_MEMCPY (buffer, operand[0]->string.pointer + index, - length); + ACPI_MEMCPY(buffer, operand[0]->string.pointer + index, + length); } /* Set the length of the new String/Buffer */ @@ -256,25 +240,23 @@ acpi_ex_opcode_3A_1T_1R ( return_desc->buffer.flags |= AOPOBJ_DATA_VALID; break; - default: - ACPI_REPORT_ERROR (("acpi_ex_opcode_3A_0T_0R: Unknown opcode %X\n", - walk_state->opcode)); + ACPI_REPORT_ERROR(("acpi_ex_opcode_3A_0T_0R: Unknown opcode %X\n", walk_state->opcode)); status = AE_AML_BAD_OPCODE; goto cleanup; } /* Store the result in the target */ - status = acpi_ex_store (return_desc, operand[3], walk_state); + status = acpi_ex_store(return_desc, operand[3], walk_state); -cleanup: + cleanup: /* Delete return object on error */ - if (ACPI_FAILURE (status) || walk_state->result_obj) { - acpi_ut_remove_reference (return_desc); + if (ACPI_FAILURE(status) || walk_state->result_obj) { + acpi_ut_remove_reference(return_desc); } /* Set the return object and exit */ @@ -282,7 +264,5 @@ cleanup: else { walk_state->result_obj = return_desc; } - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - - diff --git a/drivers/acpi/executer/exoparg6.c b/drivers/acpi/executer/exoparg6.c index 17f81d42ee4..5dee7713957 100644 --- a/drivers/acpi/executer/exoparg6.c +++ b/drivers/acpi/executer/exoparg6.c @@ -42,16 +42,13 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include #include #include #include - #define _COMPONENT ACPI_EXECUTER - ACPI_MODULE_NAME ("exoparg6") - +ACPI_MODULE_NAME("exoparg6") /*! * Naming convention for AML interpreter execution routines. @@ -74,15 +71,11 @@ * The AcpiExOpcode* functions are called via the Dispatcher component with * fully resolved operands. !*/ - /* Local prototypes */ - static u8 -acpi_ex_do_match ( - u32 match_op, - union acpi_operand_object *package_obj, - union acpi_operand_object *match_obj); - +acpi_ex_do_match(u32 match_op, + union acpi_operand_object *package_obj, + union acpi_operand_object *match_obj); /******************************************************************************* * @@ -101,14 +94,12 @@ acpi_ex_do_match ( ******************************************************************************/ static u8 -acpi_ex_do_match ( - u32 match_op, - union acpi_operand_object *package_obj, - union acpi_operand_object *match_obj) +acpi_ex_do_match(u32 match_op, + union acpi_operand_object *package_obj, + union acpi_operand_object *match_obj) { - u8 logical_result = TRUE; - acpi_status status; - + u8 logical_result = TRUE; + acpi_status status; /* * Note: Since the package_obj/match_obj ordering is opposite to that of @@ -133,9 +124,10 @@ acpi_ex_do_match ( * True if equal: (P[i] == M) * Change to: (M == P[i]) */ - status = acpi_ex_do_logical_op (AML_LEQUAL_OP, match_obj, package_obj, - &logical_result); - if (ACPI_FAILURE (status)) { + status = + acpi_ex_do_logical_op(AML_LEQUAL_OP, match_obj, package_obj, + &logical_result); + if (ACPI_FAILURE(status)) { return (FALSE); } break; @@ -146,12 +138,13 @@ acpi_ex_do_match ( * True if less than or equal: (P[i] <= M) (P[i] not_greater than M) * Change to: (M >= P[i]) (M not_less than P[i]) */ - status = acpi_ex_do_logical_op (AML_LLESS_OP, match_obj, package_obj, - &logical_result); - if (ACPI_FAILURE (status)) { + status = + acpi_ex_do_logical_op(AML_LLESS_OP, match_obj, package_obj, + &logical_result); + if (ACPI_FAILURE(status)) { return (FALSE); } - logical_result = (u8) !logical_result; + logical_result = (u8) ! logical_result; break; case MATCH_MLT: @@ -160,9 +153,10 @@ acpi_ex_do_match ( * True if less than: (P[i] < M) * Change to: (M > P[i]) */ - status = acpi_ex_do_logical_op (AML_LGREATER_OP, match_obj, package_obj, - &logical_result); - if (ACPI_FAILURE (status)) { + status = + acpi_ex_do_logical_op(AML_LGREATER_OP, match_obj, + package_obj, &logical_result); + if (ACPI_FAILURE(status)) { return (FALSE); } break; @@ -173,12 +167,13 @@ acpi_ex_do_match ( * True if greater than or equal: (P[i] >= M) (P[i] not_less than M) * Change to: (M <= P[i]) (M not_greater than P[i]) */ - status = acpi_ex_do_logical_op (AML_LGREATER_OP, match_obj, package_obj, - &logical_result); - if (ACPI_FAILURE (status)) { + status = + acpi_ex_do_logical_op(AML_LGREATER_OP, match_obj, + package_obj, &logical_result); + if (ACPI_FAILURE(status)) { return (FALSE); } - logical_result = (u8)!logical_result; + logical_result = (u8) ! logical_result; break; case MATCH_MGT: @@ -187,9 +182,10 @@ acpi_ex_do_match ( * True if greater than: (P[i] > M) * Change to: (M < P[i]) */ - status = acpi_ex_do_logical_op (AML_LLESS_OP, match_obj, package_obj, - &logical_result); - if (ACPI_FAILURE (status)) { + status = + acpi_ex_do_logical_op(AML_LLESS_OP, match_obj, package_obj, + &logical_result); + if (ACPI_FAILURE(status)) { return (FALSE); } break; @@ -204,7 +200,6 @@ acpi_ex_do_match ( return logical_result; } - /******************************************************************************* * * FUNCTION: acpi_ex_opcode_6A_0T_1R @@ -217,20 +212,16 @@ acpi_ex_do_match ( * ******************************************************************************/ -acpi_status -acpi_ex_opcode_6A_0T_1R ( - struct acpi_walk_state *walk_state) +acpi_status acpi_ex_opcode_6A_0T_1R(struct acpi_walk_state * walk_state) { - union acpi_operand_object **operand = &walk_state->operands[0]; - union acpi_operand_object *return_desc = NULL; - acpi_status status = AE_OK; - acpi_integer index; - union acpi_operand_object *this_element; - - - ACPI_FUNCTION_TRACE_STR ("ex_opcode_6A_0T_1R", - acpi_ps_get_opcode_name (walk_state->opcode)); + union acpi_operand_object **operand = &walk_state->operands[0]; + union acpi_operand_object *return_desc = NULL; + acpi_status status = AE_OK; + acpi_integer index; + union acpi_operand_object *this_element; + ACPI_FUNCTION_TRACE_STR("ex_opcode_6A_0T_1R", + acpi_ps_get_opcode_name(walk_state->opcode)); switch (walk_state->opcode) { case AML_MATCH_OP: @@ -242,8 +233,9 @@ acpi_ex_opcode_6A_0T_1R ( /* Validate both Match Term Operators (MTR, MEQ, etc.) */ if ((operand[1]->integer.value > MAX_MATCH_OPERATOR) || - (operand[3]->integer.value > MAX_MATCH_OPERATOR)) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Match operator out of range\n")); + (operand[3]->integer.value > MAX_MATCH_OPERATOR)) { + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Match operator out of range\n")); status = AE_AML_OPERAND_VALUE; goto cleanup; } @@ -252,16 +244,17 @@ acpi_ex_opcode_6A_0T_1R ( index = operand[5]->integer.value; if (index >= operand[0]->package.count) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Index (%X%8.8X) beyond package end (%X)\n", - ACPI_FORMAT_UINT64 (index), operand[0]->package.count)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Index (%X%8.8X) beyond package end (%X)\n", + ACPI_FORMAT_UINT64(index), + operand[0]->package.count)); status = AE_AML_PACKAGE_LIMIT; goto cleanup; } /* Create an integer for the return value */ - return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER); + return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); if (!return_desc) { status = AE_NO_MEMORY; goto cleanup; @@ -283,7 +276,7 @@ acpi_ex_opcode_6A_0T_1R ( * ACPI_INTEGER_MAX (Ones) (its initial value) indicating that no * match was found. */ - for ( ; index < operand[0]->package.count; index++) { + for (; index < operand[0]->package.count; index++) { /* Get the current package element */ this_element = operand[0]->package.elements[index]; @@ -299,13 +292,13 @@ acpi_ex_opcode_6A_0T_1R ( * (proceed to next iteration of enclosing for loop) signifies a * non-match. */ - if (!acpi_ex_do_match ((u32) operand[1]->integer.value, - this_element, operand[2])) { + if (!acpi_ex_do_match((u32) operand[1]->integer.value, + this_element, operand[2])) { continue; } - if (!acpi_ex_do_match ((u32) operand[3]->integer.value, - this_element, operand[4])) { + if (!acpi_ex_do_match((u32) operand[3]->integer.value, + this_element, operand[4])) { continue; } @@ -316,31 +309,27 @@ acpi_ex_opcode_6A_0T_1R ( } break; - case AML_LOAD_TABLE_OP: - status = acpi_ex_load_table_op (walk_state, &return_desc); + status = acpi_ex_load_table_op(walk_state, &return_desc); break; - default: - ACPI_REPORT_ERROR (("acpi_ex_opcode_6A_0T_1R: Unknown opcode %X\n", - walk_state->opcode)); + ACPI_REPORT_ERROR(("acpi_ex_opcode_6A_0T_1R: Unknown opcode %X\n", walk_state->opcode)); status = AE_AML_BAD_OPCODE; goto cleanup; } walk_state->result_obj = return_desc; - -cleanup: + cleanup: /* Delete return object on error */ - if (ACPI_FAILURE (status)) { - acpi_ut_remove_reference (return_desc); + if (ACPI_FAILURE(status)) { + acpi_ut_remove_reference(return_desc); } - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } diff --git a/drivers/acpi/executer/exprep.c b/drivers/acpi/executer/exprep.c index c9e3c68b554..7476c363e40 100644 --- a/drivers/acpi/executer/exprep.c +++ b/drivers/acpi/executer/exprep.c @@ -42,32 +42,24 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include #include #include #include - #define _COMPONENT ACPI_EXECUTER - ACPI_MODULE_NAME ("exprep") +ACPI_MODULE_NAME("exprep") /* Local prototypes */ - static u32 -acpi_ex_decode_field_access ( - union acpi_operand_object *obj_desc, - u8 field_flags, - u32 *return_byte_alignment); - +acpi_ex_decode_field_access(union acpi_operand_object *obj_desc, + u8 field_flags, u32 * return_byte_alignment); #ifdef ACPI_UNDER_DEVELOPMENT static u32 -acpi_ex_generate_access ( - u32 field_bit_offset, - u32 field_bit_length, - u32 region_length); +acpi_ex_generate_access(u32 field_bit_offset, + u32 field_bit_length, u32 region_length); /******************************************************************************* * @@ -92,39 +84,36 @@ acpi_ex_generate_access ( ******************************************************************************/ static u32 -acpi_ex_generate_access ( - u32 field_bit_offset, - u32 field_bit_length, - u32 region_length) +acpi_ex_generate_access(u32 field_bit_offset, + u32 field_bit_length, u32 region_length) { - u32 field_byte_length; - u32 field_byte_offset; - u32 field_byte_end_offset; - u32 access_byte_width; - u32 field_start_offset; - u32 field_end_offset; - u32 minimum_access_width = 0xFFFFFFFF; - u32 minimum_accesses = 0xFFFFFFFF; - u32 accesses; - - - ACPI_FUNCTION_TRACE ("ex_generate_access"); - + u32 field_byte_length; + u32 field_byte_offset; + u32 field_byte_end_offset; + u32 access_byte_width; + u32 field_start_offset; + u32 field_end_offset; + u32 minimum_access_width = 0xFFFFFFFF; + u32 minimum_accesses = 0xFFFFFFFF; + u32 accesses; + + ACPI_FUNCTION_TRACE("ex_generate_access"); /* Round Field start offset and length to "minimal" byte boundaries */ - field_byte_offset = ACPI_DIV_8 (ACPI_ROUND_DOWN (field_bit_offset, 8)); - field_byte_end_offset = ACPI_DIV_8 (ACPI_ROUND_UP (field_bit_length + - field_bit_offset, 8)); - field_byte_length = field_byte_end_offset - field_byte_offset; + field_byte_offset = ACPI_DIV_8(ACPI_ROUND_DOWN(field_bit_offset, 8)); + field_byte_end_offset = ACPI_DIV_8(ACPI_ROUND_UP(field_bit_length + + field_bit_offset, 8)); + field_byte_length = field_byte_end_offset - field_byte_offset; - ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, - "Bit length %d, Bit offset %d\n", - field_bit_length, field_bit_offset)); + ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, + "Bit length %d, Bit offset %d\n", + field_bit_length, field_bit_offset)); - ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, - "Byte Length %d, Byte Offset %d, End Offset %d\n", - field_byte_length, field_byte_offset, field_byte_end_offset)); + ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, + "Byte Length %d, Byte Offset %d, End Offset %d\n", + field_byte_length, field_byte_offset, + field_byte_end_offset)); /* * Iterative search for the maximum access width that is both aligned @@ -132,7 +121,8 @@ acpi_ex_generate_access ( * * Start at byte_acc and work upwards to qword_acc max. (1,2,4,8 bytes) */ - for (access_byte_width = 1; access_byte_width <= 8; access_byte_width <<= 1) { + for (access_byte_width = 1; access_byte_width <= 8; + access_byte_width <<= 1) { /* * 1) Round end offset up to next access boundary and make sure that * this does not go beyond the end of the parent region. @@ -140,31 +130,37 @@ acpi_ex_generate_access ( * are done. (This does not optimize for the perfectly aligned * case yet). */ - if (ACPI_ROUND_UP (field_byte_end_offset, access_byte_width) <= region_length) { + if (ACPI_ROUND_UP(field_byte_end_offset, access_byte_width) <= + region_length) { field_start_offset = - ACPI_ROUND_DOWN (field_byte_offset, access_byte_width) / - access_byte_width; + ACPI_ROUND_DOWN(field_byte_offset, + access_byte_width) / + access_byte_width; field_end_offset = - ACPI_ROUND_UP ((field_byte_length + field_byte_offset), - access_byte_width) / access_byte_width; + ACPI_ROUND_UP((field_byte_length + + field_byte_offset), + access_byte_width) / + access_byte_width; accesses = field_end_offset - field_start_offset; - ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, - "access_width %d end is within region\n", access_byte_width)); + ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, + "access_width %d end is within region\n", + access_byte_width)); - ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, - "Field Start %d, Field End %d -- requires %d accesses\n", - field_start_offset, field_end_offset, accesses)); + ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, + "Field Start %d, Field End %d -- requires %d accesses\n", + field_start_offset, field_end_offset, + accesses)); /* Single access is optimal */ if (accesses <= 1) { - ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, - "Entire field can be accessed with one operation of size %d\n", - access_byte_width)); - return_VALUE (access_byte_width); + ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, + "Entire field can be accessed with one operation of size %d\n", + access_byte_width)); + return_VALUE(access_byte_width); } /* @@ -172,30 +168,30 @@ acpi_ex_generate_access ( * try the next wider access on next iteration */ if (accesses < minimum_accesses) { - minimum_accesses = accesses; + minimum_accesses = accesses; minimum_access_width = access_byte_width; } - } - else { - ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, - "access_width %d end is NOT within region\n", access_byte_width)); + } else { + ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, + "access_width %d end is NOT within region\n", + access_byte_width)); if (access_byte_width == 1) { - ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, - "Field goes beyond end-of-region!\n")); + ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, + "Field goes beyond end-of-region!\n")); /* Field does not fit in the region at all */ - return_VALUE (0); + return_VALUE(0); } /* * This width goes beyond the end-of-region, back off to * previous access */ - ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, - "Backing off to previous optimal access width of %d\n", - minimum_access_width)); - return_VALUE (minimum_access_width); + ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, + "Backing off to previous optimal access width of %d\n", + minimum_access_width)); + return_VALUE(minimum_access_width); } } @@ -203,12 +199,11 @@ acpi_ex_generate_access ( * Could not read/write field with one operation, * just use max access width */ - ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, - "Cannot access field in one operation, using width 8\n")); - return_VALUE (8); + ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, + "Cannot access field in one operation, using width 8\n")); + return_VALUE(8); } -#endif /* ACPI_UNDER_DEVELOPMENT */ - +#endif /* ACPI_UNDER_DEVELOPMENT */ /******************************************************************************* * @@ -226,18 +221,14 @@ acpi_ex_generate_access ( ******************************************************************************/ static u32 -acpi_ex_decode_field_access ( - union acpi_operand_object *obj_desc, - u8 field_flags, - u32 *return_byte_alignment) +acpi_ex_decode_field_access(union acpi_operand_object *obj_desc, + u8 field_flags, u32 * return_byte_alignment) { - u32 access; - u32 byte_alignment; - u32 bit_length; - - - ACPI_FUNCTION_TRACE ("ex_decode_field_access"); + u32 access; + u32 byte_alignment; + u32 bit_length; + ACPI_FUNCTION_TRACE("ex_decode_field_access"); access = (field_flags & AML_FIELD_ACCESS_TYPE_MASK); @@ -246,9 +237,12 @@ acpi_ex_decode_field_access ( #ifdef ACPI_UNDER_DEVELOPMENT byte_alignment = - acpi_ex_generate_access (obj_desc->common_field.start_field_bit_offset, - obj_desc->common_field.bit_length, - 0xFFFFFFFF /* Temp until we pass region_length as parameter */); + acpi_ex_generate_access(obj_desc->common_field. + start_field_bit_offset, + obj_desc->common_field.bit_length, + 0xFFFFFFFF + /* Temp until we pass region_length as parameter */ + ); bit_length = byte_alignment * 8; #endif @@ -257,36 +251,35 @@ acpi_ex_decode_field_access ( break; case AML_FIELD_ACCESS_BYTE: - case AML_FIELD_ACCESS_BUFFER: /* ACPI 2.0 (SMBus Buffer) */ + case AML_FIELD_ACCESS_BUFFER: /* ACPI 2.0 (SMBus Buffer) */ byte_alignment = 1; - bit_length = 8; + bit_length = 8; break; case AML_FIELD_ACCESS_WORD: byte_alignment = 2; - bit_length = 16; + bit_length = 16; break; case AML_FIELD_ACCESS_DWORD: byte_alignment = 4; - bit_length = 32; + bit_length = 32; break; - case AML_FIELD_ACCESS_QWORD: /* ACPI 2.0 */ + case AML_FIELD_ACCESS_QWORD: /* ACPI 2.0 */ byte_alignment = 8; - bit_length = 64; + bit_length = 64; break; default: /* Invalid field access type */ - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Unknown field access type %X\n", - access)); - return_VALUE (0); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Unknown field access type %X\n", access)); + return_VALUE(0); } - if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_BUFFER_FIELD) { + if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_BUFFER_FIELD) { /* * buffer_field access can be on any byte boundary, so the * byte_alignment is always 1 byte -- regardless of any byte_alignment @@ -296,10 +289,9 @@ acpi_ex_decode_field_access ( } *return_byte_alignment = byte_alignment; - return_VALUE (bit_length); + return_VALUE(bit_length); } - /******************************************************************************* * * FUNCTION: acpi_ex_prep_common_field_object @@ -322,20 +314,16 @@ acpi_ex_decode_field_access ( ******************************************************************************/ acpi_status -acpi_ex_prep_common_field_object ( - union acpi_operand_object *obj_desc, - u8 field_flags, - u8 field_attribute, - u32 field_bit_position, - u32 field_bit_length) +acpi_ex_prep_common_field_object(union acpi_operand_object *obj_desc, + u8 field_flags, + u8 field_attribute, + u32 field_bit_position, u32 field_bit_length) { - u32 access_bit_width; - u32 byte_alignment; - u32 nearest_byte_address; - - - ACPI_FUNCTION_TRACE ("ex_prep_common_field_object"); + u32 access_bit_width; + u32 byte_alignment; + u32 nearest_byte_address; + ACPI_FUNCTION_TRACE("ex_prep_common_field_object"); /* * Note: the structure being initialized is the @@ -361,16 +349,16 @@ acpi_ex_prep_common_field_object ( * For all other access types (Byte, Word, Dword, Qword), the Bitwidth is * the same (equivalent) as the byte_alignment. */ - access_bit_width = acpi_ex_decode_field_access (obj_desc, field_flags, - &byte_alignment); + access_bit_width = acpi_ex_decode_field_access(obj_desc, field_flags, + &byte_alignment); if (!access_bit_width) { - return_ACPI_STATUS (AE_AML_OPERAND_VALUE); + return_ACPI_STATUS(AE_AML_OPERAND_VALUE); } /* Setup width (access granularity) fields */ obj_desc->common_field.access_byte_width = (u8) - ACPI_DIV_8 (access_bit_width); /* 1, 2, 4, 8 */ + ACPI_DIV_8(access_bit_width); /* 1, 2, 4, 8 */ obj_desc->common_field.access_bit_width = (u8) access_bit_width; @@ -385,30 +373,30 @@ acpi_ex_prep_common_field_object ( * region or buffer. */ nearest_byte_address = - ACPI_ROUND_BITS_DOWN_TO_BYTES (field_bit_position); + ACPI_ROUND_BITS_DOWN_TO_BYTES(field_bit_position); obj_desc->common_field.base_byte_offset = (u32) - ACPI_ROUND_DOWN (nearest_byte_address, byte_alignment); + ACPI_ROUND_DOWN(nearest_byte_address, byte_alignment); /* * start_field_bit_offset is the offset of the first bit of the field within * a field datum. */ obj_desc->common_field.start_field_bit_offset = (u8) - (field_bit_position - ACPI_MUL_8 (obj_desc->common_field.base_byte_offset)); + (field_bit_position - + ACPI_MUL_8(obj_desc->common_field.base_byte_offset)); /* * Does the entire field fit within a single field access element? (datum) * (i.e., without crossing a datum boundary) */ - if ((obj_desc->common_field.start_field_bit_offset + field_bit_length) <= - (u16) access_bit_width) { + if ((obj_desc->common_field.start_field_bit_offset + + field_bit_length) <= (u16) access_bit_width) { obj_desc->common.flags |= AOPOBJ_SINGLE_DATUM; } - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_ex_prep_field_value @@ -422,51 +410,49 @@ acpi_ex_prep_common_field_object ( * ******************************************************************************/ -acpi_status -acpi_ex_prep_field_value ( - struct acpi_create_field_info *info) +acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info) { - union acpi_operand_object *obj_desc; - u32 type; - acpi_status status; - - - ACPI_FUNCTION_TRACE ("ex_prep_field_value"); + union acpi_operand_object *obj_desc; + u32 type; + acpi_status status; + ACPI_FUNCTION_TRACE("ex_prep_field_value"); /* Parameter validation */ if (info->field_type != ACPI_TYPE_LOCAL_INDEX_FIELD) { if (!info->region_node) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null region_node\n")); - return_ACPI_STATUS (AE_AML_NO_OPERAND); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Null region_node\n")); + return_ACPI_STATUS(AE_AML_NO_OPERAND); } - type = acpi_ns_get_type (info->region_node); + type = acpi_ns_get_type(info->region_node); if (type != ACPI_TYPE_REGION) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Needed Region, found type %X (%s)\n", - type, acpi_ut_get_type_name (type))); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Needed Region, found type %X (%s)\n", + type, acpi_ut_get_type_name(type))); - return_ACPI_STATUS (AE_AML_OPERAND_TYPE); + return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } } /* Allocate a new field object */ - obj_desc = acpi_ut_create_internal_object (info->field_type); + obj_desc = acpi_ut_create_internal_object(info->field_type); if (!obj_desc) { - return_ACPI_STATUS (AE_NO_MEMORY); + return_ACPI_STATUS(AE_NO_MEMORY); } /* Initialize areas of the object that are common to all fields */ obj_desc->common_field.node = info->field_node; - status = acpi_ex_prep_common_field_object (obj_desc, info->field_flags, - info->attribute, info->field_bit_position, info->field_bit_length); - if (ACPI_FAILURE (status)) { - acpi_ut_delete_object_desc (obj_desc); - return_ACPI_STATUS (status); + status = acpi_ex_prep_common_field_object(obj_desc, info->field_flags, + info->attribute, + info->field_bit_position, + info->field_bit_length); + if (ACPI_FAILURE(status)) { + acpi_ut_delete_object_desc(obj_desc); + return_ACPI_STATUS(status); } /* Initialize areas of the object that are specific to the field type */ @@ -474,71 +460,73 @@ acpi_ex_prep_field_value ( switch (info->field_type) { case ACPI_TYPE_LOCAL_REGION_FIELD: - obj_desc->field.region_obj = acpi_ns_get_attached_object (info->region_node); + obj_desc->field.region_obj = + acpi_ns_get_attached_object(info->region_node); /* An additional reference for the container */ - acpi_ut_add_reference (obj_desc->field.region_obj); + acpi_ut_add_reference(obj_desc->field.region_obj); - ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, - "region_field: bit_off %X, Off %X, Gran %X, Region %p\n", - obj_desc->field.start_field_bit_offset, obj_desc->field.base_byte_offset, - obj_desc->field.access_byte_width, obj_desc->field.region_obj)); + ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, + "region_field: bit_off %X, Off %X, Gran %X, Region %p\n", + obj_desc->field.start_field_bit_offset, + obj_desc->field.base_byte_offset, + obj_desc->field.access_byte_width, + obj_desc->field.region_obj)); break; - case ACPI_TYPE_LOCAL_BANK_FIELD: - obj_desc->bank_field.value = info->bank_value; - obj_desc->bank_field.region_obj = acpi_ns_get_attached_object ( - info->region_node); - obj_desc->bank_field.bank_obj = acpi_ns_get_attached_object ( - info->register_node); + obj_desc->bank_field.value = info->bank_value; + obj_desc->bank_field.region_obj = + acpi_ns_get_attached_object(info->region_node); + obj_desc->bank_field.bank_obj = + acpi_ns_get_attached_object(info->register_node); /* An additional reference for the attached objects */ - acpi_ut_add_reference (obj_desc->bank_field.region_obj); - acpi_ut_add_reference (obj_desc->bank_field.bank_obj); + acpi_ut_add_reference(obj_desc->bank_field.region_obj); + acpi_ut_add_reference(obj_desc->bank_field.bank_obj); - ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, - "Bank Field: bit_off %X, Off %X, Gran %X, Region %p, bank_reg %p\n", - obj_desc->bank_field.start_field_bit_offset, - obj_desc->bank_field.base_byte_offset, - obj_desc->field.access_byte_width, - obj_desc->bank_field.region_obj, - obj_desc->bank_field.bank_obj)); + ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, + "Bank Field: bit_off %X, Off %X, Gran %X, Region %p, bank_reg %p\n", + obj_desc->bank_field.start_field_bit_offset, + obj_desc->bank_field.base_byte_offset, + obj_desc->field.access_byte_width, + obj_desc->bank_field.region_obj, + obj_desc->bank_field.bank_obj)); break; - case ACPI_TYPE_LOCAL_INDEX_FIELD: - obj_desc->index_field.index_obj = acpi_ns_get_attached_object ( - info->register_node); - obj_desc->index_field.data_obj = acpi_ns_get_attached_object ( - info->data_register_node); - obj_desc->index_field.value = (u32) - (info->field_bit_position / ACPI_MUL_8 ( - obj_desc->field.access_byte_width)); - - if (!obj_desc->index_field.data_obj || !obj_desc->index_field.index_obj) { - ACPI_REPORT_ERROR (("Null Index Object during field prep\n")); - acpi_ut_delete_object_desc (obj_desc); - return_ACPI_STATUS (AE_AML_INTERNAL); + obj_desc->index_field.index_obj = + acpi_ns_get_attached_object(info->register_node); + obj_desc->index_field.data_obj = + acpi_ns_get_attached_object(info->data_register_node); + obj_desc->index_field.value = (u32) + (info->field_bit_position / + ACPI_MUL_8(obj_desc->field.access_byte_width)); + + if (!obj_desc->index_field.data_obj + || !obj_desc->index_field.index_obj) { + ACPI_REPORT_ERROR(("Null Index Object during field prep\n")); + acpi_ut_delete_object_desc(obj_desc); + return_ACPI_STATUS(AE_AML_INTERNAL); } /* An additional reference for the attached objects */ - acpi_ut_add_reference (obj_desc->index_field.data_obj); - acpi_ut_add_reference (obj_desc->index_field.index_obj); - - ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, - "index_field: bit_off %X, Off %X, Value %X, Gran %X, Index %p, Data %p\n", - obj_desc->index_field.start_field_bit_offset, - obj_desc->index_field.base_byte_offset, - obj_desc->index_field.value, - obj_desc->field.access_byte_width, - obj_desc->index_field.index_obj, - obj_desc->index_field.data_obj)); + acpi_ut_add_reference(obj_desc->index_field.data_obj); + acpi_ut_add_reference(obj_desc->index_field.index_obj); + + ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, + "index_field: bit_off %X, Off %X, Value %X, Gran %X, Index %p, Data %p\n", + obj_desc->index_field.start_field_bit_offset, + obj_desc->index_field.base_byte_offset, + obj_desc->index_field.value, + obj_desc->field.access_byte_width, + obj_desc->index_field.index_obj, + obj_desc->index_field.data_obj)); break; default: @@ -550,15 +538,16 @@ acpi_ex_prep_field_value ( * Store the constructed descriptor (obj_desc) into the parent Node, * preserving the current type of that named_obj. */ - status = acpi_ns_attach_object (info->field_node, obj_desc, - acpi_ns_get_type (info->field_node)); + status = acpi_ns_attach_object(info->field_node, obj_desc, + acpi_ns_get_type(info->field_node)); - ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "Set named_obj %p [%4.4s], obj_desc %p\n", - info->field_node, acpi_ut_get_node_name (info->field_node), obj_desc)); + ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, + "Set named_obj %p [%4.4s], obj_desc %p\n", + info->field_node, + acpi_ut_get_node_name(info->field_node), obj_desc)); /* Remove local reference to the object */ - acpi_ut_remove_reference (obj_desc); - return_ACPI_STATUS (status); + acpi_ut_remove_reference(obj_desc); + return_ACPI_STATUS(status); } - diff --git a/drivers/acpi/executer/exregion.c b/drivers/acpi/executer/exregion.c index 723aaef4bb4..9a2f5bea3af 100644 --- a/drivers/acpi/executer/exregion.c +++ b/drivers/acpi/executer/exregion.c @@ -42,14 +42,11 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include #include - #define _COMPONENT ACPI_EXECUTER - ACPI_MODULE_NAME ("exregion") - +ACPI_MODULE_NAME("exregion") /******************************************************************************* * @@ -68,27 +65,23 @@ * DESCRIPTION: Handler for the System Memory address space (Op Region) * ******************************************************************************/ - acpi_status -acpi_ex_system_memory_space_handler ( - u32 function, - acpi_physical_address address, - u32 bit_width, - acpi_integer *value, - void *handler_context, - void *region_context) +acpi_ex_system_memory_space_handler(u32 function, + acpi_physical_address address, + u32 bit_width, + acpi_integer * value, + void *handler_context, void *region_context) { - acpi_status status = AE_OK; - void *logical_addr_ptr = NULL; - struct acpi_mem_space_context *mem_info = region_context; - u32 length; - acpi_size window_size; + acpi_status status = AE_OK; + void *logical_addr_ptr = NULL; + struct acpi_mem_space_context *mem_info = region_context; + u32 length; + acpi_size window_size; #ifndef ACPI_MISALIGNED_TRANSFERS - u32 remainder; + u32 remainder; #endif - ACPI_FUNCTION_TRACE ("ex_system_memory_space_handler"); - + ACPI_FUNCTION_TRACE("ex_system_memory_space_handler"); /* Validate and translate the bit width */ @@ -110,9 +103,10 @@ acpi_ex_system_memory_space_handler ( break; default: - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid system_memory width %d\n", - bit_width)); - return_ACPI_STATUS (AE_AML_OPERAND_VALUE); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Invalid system_memory width %d\n", + bit_width)); + return_ACPI_STATUS(AE_AML_OPERAND_VALUE); } #ifndef ACPI_MISALIGNED_TRANSFERS @@ -120,9 +114,10 @@ acpi_ex_system_memory_space_handler ( * Hardware does not support non-aligned data transfers, we must verify * the request. */ - (void) acpi_ut_short_divide ((acpi_integer) address, length, NULL, &remainder); + (void)acpi_ut_short_divide((acpi_integer) address, length, NULL, + &remainder); if (remainder != 0) { - return_ACPI_STATUS (AE_AML_ALIGNMENT); + return_ACPI_STATUS(AE_AML_ALIGNMENT); } #endif @@ -132,9 +127,10 @@ acpi_ex_system_memory_space_handler ( * 2) Address beyond the current mapping? */ if ((address < mem_info->mapped_physical_address) || - (((acpi_integer) address + length) > - ((acpi_integer) - mem_info->mapped_physical_address + mem_info->mapped_length))) { + (((acpi_integer) address + length) > ((acpi_integer) + mem_info-> + mapped_physical_address + + mem_info->mapped_length))) { /* * The request cannot be resolved by the current memory mapping; * Delete the existing mapping and create a new one. @@ -142,8 +138,8 @@ acpi_ex_system_memory_space_handler ( if (mem_info->mapped_length) { /* Valid mapping, delete it */ - acpi_os_unmap_memory (mem_info->mapped_logical_address, - mem_info->mapped_length); + acpi_os_unmap_memory(mem_info->mapped_logical_address, + mem_info->mapped_length); } /* @@ -151,7 +147,7 @@ acpi_ex_system_memory_space_handler ( * constrain the maximum mapping size to something reasonable. */ window_size = (acpi_size) - ((mem_info->address + mem_info->length) - address); + ((mem_info->address + mem_info->length) - address); if (window_size > ACPI_SYSMEM_REGION_WINDOW_SIZE) { window_size = ACPI_SYSMEM_REGION_WINDOW_SIZE; @@ -159,14 +155,16 @@ acpi_ex_system_memory_space_handler ( /* Create a new mapping starting at the address given */ - status = acpi_os_map_memory (address, window_size, - (void **) &mem_info->mapped_logical_address); - if (ACPI_FAILURE (status)) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Could not map memory at %8.8X%8.8X, size %X\n", - ACPI_FORMAT_UINT64 (address), (u32) window_size)); + status = acpi_os_map_memory(address, window_size, + (void **)&mem_info-> + mapped_logical_address); + if (ACPI_FAILURE(status)) { + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Could not map memory at %8.8X%8.8X, size %X\n", + ACPI_FORMAT_UINT64(address), + (u32) window_size)); mem_info->mapped_length = 0; - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } /* Save the physical address and mapping size */ @@ -180,42 +178,41 @@ acpi_ex_system_memory_space_handler ( * access */ logical_addr_ptr = mem_info->mapped_logical_address + - ((acpi_integer) address - - (acpi_integer) mem_info->mapped_physical_address); - - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "system_memory %d (%d width) Address=%8.8X%8.8X\n", - function, bit_width, - ACPI_FORMAT_UINT64 (address))); - - /* - * Perform the memory read or write - * - * Note: For machines that do not support non-aligned transfers, the target - * address was checked for alignment above. We do not attempt to break the - * transfer up into smaller (byte-size) chunks because the AML specifically - * asked for a transfer width that the hardware may require. - */ + ((acpi_integer) address - + (acpi_integer) mem_info->mapped_physical_address); + + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "system_memory %d (%d width) Address=%8.8X%8.8X\n", + function, bit_width, ACPI_FORMAT_UINT64(address))); + + /* + * Perform the memory read or write + * + * Note: For machines that do not support non-aligned transfers, the target + * address was checked for alignment above. We do not attempt to break the + * transfer up into smaller (byte-size) chunks because the AML specifically + * asked for a transfer width that the hardware may require. + */ switch (function) { case ACPI_READ: *value = 0; switch (bit_width) { case 8: - *value = (acpi_integer) *((u8 *) logical_addr_ptr); + *value = (acpi_integer) * ((u8 *) logical_addr_ptr); break; case 16: - *value = (acpi_integer) *((u16 *) logical_addr_ptr); + *value = (acpi_integer) * ((u16 *) logical_addr_ptr); break; case 32: - *value = (acpi_integer) *((u32 *) logical_addr_ptr); + *value = (acpi_integer) * ((u32 *) logical_addr_ptr); break; #if ACPI_MACHINE_WIDTH != 16 case 64: - *value = (acpi_integer) *((u64 *) logical_addr_ptr); + *value = (acpi_integer) * ((u64 *) logical_addr_ptr); break; #endif default: @@ -228,20 +225,20 @@ acpi_ex_system_memory_space_handler ( switch (bit_width) { case 8: - *(u8 *) logical_addr_ptr = (u8) *value; + *(u8 *) logical_addr_ptr = (u8) * value; break; case 16: - *(u16 *) logical_addr_ptr = (u16) *value; + *(u16 *) logical_addr_ptr = (u16) * value; break; case 32: - *(u32 *) logical_addr_ptr = (u32) *value; + *(u32 *) logical_addr_ptr = (u32) * value; break; #if ACPI_MACHINE_WIDTH != 16 case 64: - *(u64 *) logical_addr_ptr = (u64) *value; + *(u64 *) logical_addr_ptr = (u64) * value; break; #endif @@ -256,10 +253,9 @@ acpi_ex_system_memory_space_handler ( break; } - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_ex_system_io_space_handler @@ -279,39 +275,35 @@ acpi_ex_system_memory_space_handler ( ******************************************************************************/ acpi_status -acpi_ex_system_io_space_handler ( - u32 function, - acpi_physical_address address, - u32 bit_width, - acpi_integer *value, - void *handler_context, - void *region_context) +acpi_ex_system_io_space_handler(u32 function, + acpi_physical_address address, + u32 bit_width, + acpi_integer * value, + void *handler_context, void *region_context) { - acpi_status status = AE_OK; - u32 value32; + acpi_status status = AE_OK; + u32 value32; + ACPI_FUNCTION_TRACE("ex_system_io_space_handler"); - ACPI_FUNCTION_TRACE ("ex_system_io_space_handler"); - - - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "system_iO %d (%d width) Address=%8.8X%8.8X\n", function, bit_width, - ACPI_FORMAT_UINT64 (address))); + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "system_iO %d (%d width) Address=%8.8X%8.8X\n", + function, bit_width, ACPI_FORMAT_UINT64(address))); /* Decode the function parameter */ switch (function) { case ACPI_READ: - status = acpi_os_read_port ((acpi_io_address) address, - &value32, bit_width); + status = acpi_os_read_port((acpi_io_address) address, + &value32, bit_width); *value = value32; break; case ACPI_WRITE: - status = acpi_os_write_port ((acpi_io_address) address, - (u32) *value, bit_width); + status = acpi_os_write_port((acpi_io_address) address, + (u32) * value, bit_width); break; default: @@ -319,10 +311,9 @@ acpi_ex_system_io_space_handler ( break; } - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_ex_pci_config_space_handler @@ -342,21 +333,17 @@ acpi_ex_system_io_space_handler ( ******************************************************************************/ acpi_status -acpi_ex_pci_config_space_handler ( - u32 function, - acpi_physical_address address, - u32 bit_width, - acpi_integer *value, - void *handler_context, - void *region_context) +acpi_ex_pci_config_space_handler(u32 function, + acpi_physical_address address, + u32 bit_width, + acpi_integer * value, + void *handler_context, void *region_context) { - acpi_status status = AE_OK; - struct acpi_pci_id *pci_id; - u16 pci_register; - - - ACPI_FUNCTION_TRACE ("ex_pci_config_space_handler"); + acpi_status status = AE_OK; + struct acpi_pci_id *pci_id; + u16 pci_register; + ACPI_FUNCTION_TRACE("ex_pci_config_space_handler"); /* * The arguments to acpi_os(Read|Write)pci_configuration are: @@ -370,26 +357,26 @@ acpi_ex_pci_config_space_handler ( * Value - input value for write, output address for read * */ - pci_id = (struct acpi_pci_id *) region_context; + pci_id = (struct acpi_pci_id *)region_context; pci_register = (u16) (u32) address; - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "pci_config %d (%d) Seg(%04x) Bus(%04x) Dev(%04x) Func(%04x) Reg(%04x)\n", - function, bit_width, pci_id->segment, pci_id->bus, pci_id->device, - pci_id->function, pci_register)); + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "pci_config %d (%d) Seg(%04x) Bus(%04x) Dev(%04x) Func(%04x) Reg(%04x)\n", + function, bit_width, pci_id->segment, pci_id->bus, + pci_id->device, pci_id->function, pci_register)); switch (function) { case ACPI_READ: *value = 0; - status = acpi_os_read_pci_configuration (pci_id, pci_register, - value, bit_width); + status = acpi_os_read_pci_configuration(pci_id, pci_register, + value, bit_width); break; case ACPI_WRITE: - status = acpi_os_write_pci_configuration (pci_id, pci_register, - *value, bit_width); + status = acpi_os_write_pci_configuration(pci_id, pci_register, + *value, bit_width); break; default: @@ -398,10 +385,9 @@ acpi_ex_pci_config_space_handler ( break; } - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_ex_cmos_space_handler @@ -421,24 +407,19 @@ acpi_ex_pci_config_space_handler ( ******************************************************************************/ acpi_status -acpi_ex_cmos_space_handler ( - u32 function, - acpi_physical_address address, - u32 bit_width, - acpi_integer *value, - void *handler_context, - void *region_context) +acpi_ex_cmos_space_handler(u32 function, + acpi_physical_address address, + u32 bit_width, + acpi_integer * value, + void *handler_context, void *region_context) { - acpi_status status = AE_OK; - + acpi_status status = AE_OK; - ACPI_FUNCTION_TRACE ("ex_cmos_space_handler"); + ACPI_FUNCTION_TRACE("ex_cmos_space_handler"); - - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_ex_pci_bar_space_handler @@ -458,24 +439,19 @@ acpi_ex_cmos_space_handler ( ******************************************************************************/ acpi_status -acpi_ex_pci_bar_space_handler ( - u32 function, - acpi_physical_address address, - u32 bit_width, - acpi_integer *value, - void *handler_context, - void *region_context) +acpi_ex_pci_bar_space_handler(u32 function, + acpi_physical_address address, + u32 bit_width, + acpi_integer * value, + void *handler_context, void *region_context) { - acpi_status status = AE_OK; - + acpi_status status = AE_OK; - ACPI_FUNCTION_TRACE ("ex_pci_bar_space_handler"); + ACPI_FUNCTION_TRACE("ex_pci_bar_space_handler"); - - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_ex_data_table_space_handler @@ -495,24 +471,20 @@ acpi_ex_pci_bar_space_handler ( ******************************************************************************/ acpi_status -acpi_ex_data_table_space_handler ( - u32 function, - acpi_physical_address address, - u32 bit_width, - acpi_integer *value, - void *handler_context, - void *region_context) +acpi_ex_data_table_space_handler(u32 function, + acpi_physical_address address, + u32 bit_width, + acpi_integer * value, + void *handler_context, void *region_context) { - acpi_status status = AE_OK; - u32 byte_width = ACPI_DIV_8 (bit_width); - u32 i; - char *logical_addr_ptr; - + acpi_status status = AE_OK; + u32 byte_width = ACPI_DIV_8(bit_width); + u32 i; + char *logical_addr_ptr; - ACPI_FUNCTION_TRACE ("ex_data_table_space_handler"); + ACPI_FUNCTION_TRACE("ex_data_table_space_handler"); - - logical_addr_ptr = ACPI_PHYSADDR_TO_PTR (address); + logical_addr_ptr = ACPI_PHYSADDR_TO_PTR(address); /* Perform the memory read or write */ @@ -520,17 +492,15 @@ acpi_ex_data_table_space_handler ( case ACPI_READ: for (i = 0; i < byte_width; i++) { - ((char *) value) [i] = logical_addr_ptr[i]; + ((char *)value)[i] = logical_addr_ptr[i]; } break; case ACPI_WRITE: default: - return_ACPI_STATUS (AE_SUPPORT); + return_ACPI_STATUS(AE_SUPPORT); } - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - - diff --git a/drivers/acpi/executer/exresnte.c b/drivers/acpi/executer/exresnte.c index 21d5c74fa30..ff5d8f97e8e 100644 --- a/drivers/acpi/executer/exresnte.c +++ b/drivers/acpi/executer/exresnte.c @@ -42,7 +42,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include #include #include @@ -50,10 +49,8 @@ #include #include - #define _COMPONENT ACPI_EXECUTER - ACPI_MODULE_NAME ("exresnte") - +ACPI_MODULE_NAME("exresnte") /******************************************************************************* * @@ -80,41 +77,37 @@ * ACPI_TYPE_PACKAGE * ******************************************************************************/ - acpi_status -acpi_ex_resolve_node_to_value ( - struct acpi_namespace_node **object_ptr, - struct acpi_walk_state *walk_state) - +acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr, + struct acpi_walk_state *walk_state) { - acpi_status status = AE_OK; - union acpi_operand_object *source_desc; - union acpi_operand_object *obj_desc = NULL; - struct acpi_namespace_node *node; - acpi_object_type entry_type; - - - ACPI_FUNCTION_TRACE ("ex_resolve_node_to_value"); + acpi_status status = AE_OK; + union acpi_operand_object *source_desc; + union acpi_operand_object *obj_desc = NULL; + struct acpi_namespace_node *node; + acpi_object_type entry_type; + ACPI_FUNCTION_TRACE("ex_resolve_node_to_value"); /* * The stack pointer points to a struct acpi_namespace_node (Node). Get the * object that is attached to the Node. */ - node = *object_ptr; - source_desc = acpi_ns_get_attached_object (node); - entry_type = acpi_ns_get_type ((acpi_handle) node); + node = *object_ptr; + source_desc = acpi_ns_get_attached_object(node); + entry_type = acpi_ns_get_type((acpi_handle) node); - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Entry=%p source_desc=%p [%s]\n", - node, source_desc, acpi_ut_get_type_name (entry_type))); + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Entry=%p source_desc=%p [%s]\n", + node, source_desc, + acpi_ut_get_type_name(entry_type))); if ((entry_type == ACPI_TYPE_LOCAL_ALIAS) || - (entry_type == ACPI_TYPE_LOCAL_METHOD_ALIAS)) { + (entry_type == ACPI_TYPE_LOCAL_METHOD_ALIAS)) { /* There is always exactly one level of indirection */ - node = ACPI_CAST_PTR (struct acpi_namespace_node, node->object); - source_desc = acpi_ns_get_attached_object (node); - entry_type = acpi_ns_get_type ((acpi_handle) node); + node = ACPI_CAST_PTR(struct acpi_namespace_node, node->object); + source_desc = acpi_ns_get_attached_object(node); + entry_type = acpi_ns_get_type((acpi_handle) node); *object_ptr = node; } @@ -124,14 +117,14 @@ acpi_ex_resolve_node_to_value ( * 2) Method locals and arguments have a pseudo-Node */ if (entry_type == ACPI_TYPE_DEVICE || - (node->flags & (ANOBJ_METHOD_ARG | ANOBJ_METHOD_LOCAL))) { - return_ACPI_STATUS (AE_OK); + (node->flags & (ANOBJ_METHOD_ARG | ANOBJ_METHOD_LOCAL))) { + return_ACPI_STATUS(AE_OK); } if (!source_desc) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No object attached to node %p\n", - node)); - return_ACPI_STATUS (AE_AML_NO_OPERAND); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "No object attached to node %p\n", node)); + return_ACPI_STATUS(AE_AML_NO_OPERAND); } /* @@ -141,83 +134,89 @@ acpi_ex_resolve_node_to_value ( switch (entry_type) { case ACPI_TYPE_PACKAGE: - if (ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_PACKAGE) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Object not a Package, type %s\n", - acpi_ut_get_object_type_name (source_desc))); - return_ACPI_STATUS (AE_AML_OPERAND_TYPE); + if (ACPI_GET_OBJECT_TYPE(source_desc) != ACPI_TYPE_PACKAGE) { + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Object not a Package, type %s\n", + acpi_ut_get_object_type_name + (source_desc))); + return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } - status = acpi_ds_get_package_arguments (source_desc); - if (ACPI_SUCCESS (status)) { + status = acpi_ds_get_package_arguments(source_desc); + if (ACPI_SUCCESS(status)) { /* Return an additional reference to the object */ obj_desc = source_desc; - acpi_ut_add_reference (obj_desc); + acpi_ut_add_reference(obj_desc); } break; - case ACPI_TYPE_BUFFER: - if (ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_BUFFER) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Object not a Buffer, type %s\n", - acpi_ut_get_object_type_name (source_desc))); - return_ACPI_STATUS (AE_AML_OPERAND_TYPE); + if (ACPI_GET_OBJECT_TYPE(source_desc) != ACPI_TYPE_BUFFER) { + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Object not a Buffer, type %s\n", + acpi_ut_get_object_type_name + (source_desc))); + return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } - status = acpi_ds_get_buffer_arguments (source_desc); - if (ACPI_SUCCESS (status)) { + status = acpi_ds_get_buffer_arguments(source_desc); + if (ACPI_SUCCESS(status)) { /* Return an additional reference to the object */ obj_desc = source_desc; - acpi_ut_add_reference (obj_desc); + acpi_ut_add_reference(obj_desc); } break; - case ACPI_TYPE_STRING: - if (ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_STRING) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Object not a String, type %s\n", - acpi_ut_get_object_type_name (source_desc))); - return_ACPI_STATUS (AE_AML_OPERAND_TYPE); + if (ACPI_GET_OBJECT_TYPE(source_desc) != ACPI_TYPE_STRING) { + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Object not a String, type %s\n", + acpi_ut_get_object_type_name + (source_desc))); + return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } /* Return an additional reference to the object */ obj_desc = source_desc; - acpi_ut_add_reference (obj_desc); + acpi_ut_add_reference(obj_desc); break; - case ACPI_TYPE_INTEGER: - if (ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_INTEGER) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Object not a Integer, type %s\n", - acpi_ut_get_object_type_name (source_desc))); - return_ACPI_STATUS (AE_AML_OPERAND_TYPE); + if (ACPI_GET_OBJECT_TYPE(source_desc) != ACPI_TYPE_INTEGER) { + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Object not a Integer, type %s\n", + acpi_ut_get_object_type_name + (source_desc))); + return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } /* Return an additional reference to the object */ obj_desc = source_desc; - acpi_ut_add_reference (obj_desc); + acpi_ut_add_reference(obj_desc); break; - case ACPI_TYPE_BUFFER_FIELD: case ACPI_TYPE_LOCAL_REGION_FIELD: case ACPI_TYPE_LOCAL_BANK_FIELD: case ACPI_TYPE_LOCAL_INDEX_FIELD: - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "field_read Node=%p source_desc=%p Type=%X\n", - node, source_desc, entry_type)); + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, + "field_read Node=%p source_desc=%p Type=%X\n", + node, source_desc, entry_type)); - status = acpi_ex_read_data_from_field (walk_state, source_desc, &obj_desc); + status = + acpi_ex_read_data_from_field(walk_state, source_desc, + &obj_desc); break; - /* For these objects, just return the object attached to the Node */ + /* For these objects, just return the object attached to the Node */ case ACPI_TYPE_MUTEX: case ACPI_TYPE_METHOD: @@ -230,19 +229,18 @@ acpi_ex_resolve_node_to_value ( /* Return an additional reference to the object */ obj_desc = source_desc; - acpi_ut_add_reference (obj_desc); + acpi_ut_add_reference(obj_desc); break; - /* TYPE_ANY is untyped, and thus there is no object associated with it */ + /* TYPE_ANY is untyped, and thus there is no object associated with it */ case ACPI_TYPE_ANY: - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Untyped entry %p, no attached object!\n", - node)); - - return_ACPI_STATUS (AE_AML_OPERAND_TYPE); /* Cannot be AE_TYPE */ + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Untyped entry %p, no attached object!\n", + node)); + return_ACPI_STATUS(AE_AML_OPERAND_TYPE); /* Cannot be AE_TYPE */ case ACPI_TYPE_LOCAL_REFERENCE: @@ -253,39 +251,37 @@ acpi_ex_resolve_node_to_value ( /* Return an additional reference to the object */ obj_desc = source_desc; - acpi_ut_add_reference (obj_desc); + acpi_ut_add_reference(obj_desc); break; default: /* No named references are allowed here */ - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Unsupported Reference opcode %X (%s)\n", - source_desc->reference.opcode, - acpi_ps_get_opcode_name (source_desc->reference.opcode))); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Unsupported Reference opcode %X (%s)\n", + source_desc->reference.opcode, + acpi_ps_get_opcode_name(source_desc-> + reference. + opcode))); - return_ACPI_STATUS (AE_AML_OPERAND_TYPE); + return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } break; - default: /* Default case is for unknown types */ - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Node %p - Unknown object type %X\n", - node, entry_type)); - - return_ACPI_STATUS (AE_AML_OPERAND_TYPE); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Node %p - Unknown object type %X\n", + node, entry_type)); - } /* switch (entry_type) */ + return_ACPI_STATUS(AE_AML_OPERAND_TYPE); + } /* switch (entry_type) */ /* Return the object descriptor */ - *object_ptr = (void *) obj_desc; - return_ACPI_STATUS (status); + *object_ptr = (void *)obj_desc; + return_ACPI_STATUS(status); } - - diff --git a/drivers/acpi/executer/exresolv.c b/drivers/acpi/executer/exresolv.c index 3de45672379..97eecbd3242 100644 --- a/drivers/acpi/executer/exresolv.c +++ b/drivers/acpi/executer/exresolv.c @@ -42,7 +42,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include #include #include @@ -50,17 +49,13 @@ #include #include - #define _COMPONENT ACPI_EXECUTER - ACPI_MODULE_NAME ("exresolv") +ACPI_MODULE_NAME("exresolv") /* Local prototypes */ - static acpi_status -acpi_ex_resolve_object_to_value ( - union acpi_operand_object **stack_ptr, - struct acpi_walk_state *walk_state); - +acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr, + struct acpi_walk_state *walk_state); /******************************************************************************* * @@ -78,19 +73,16 @@ acpi_ex_resolve_object_to_value ( ******************************************************************************/ acpi_status -acpi_ex_resolve_to_value ( - union acpi_operand_object **stack_ptr, - struct acpi_walk_state *walk_state) +acpi_ex_resolve_to_value(union acpi_operand_object **stack_ptr, + struct acpi_walk_state *walk_state) { - acpi_status status; - - - ACPI_FUNCTION_TRACE_PTR ("ex_resolve_to_value", stack_ptr); + acpi_status status; + ACPI_FUNCTION_TRACE_PTR("ex_resolve_to_value", stack_ptr); if (!stack_ptr || !*stack_ptr) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Internal - null pointer\n")); - return_ACPI_STATUS (AE_AML_NO_OPERAND); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Internal - null pointer\n")); + return_ACPI_STATUS(AE_AML_NO_OPERAND); } /* @@ -98,15 +90,16 @@ acpi_ex_resolve_to_value ( * 1) A valid union acpi_operand_object, or * 2) A struct acpi_namespace_node (named_obj) */ - if (ACPI_GET_DESCRIPTOR_TYPE (*stack_ptr) == ACPI_DESC_TYPE_OPERAND) { - status = acpi_ex_resolve_object_to_value (stack_ptr, walk_state); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + if (ACPI_GET_DESCRIPTOR_TYPE(*stack_ptr) == ACPI_DESC_TYPE_OPERAND) { + status = acpi_ex_resolve_object_to_value(stack_ptr, walk_state); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } if (!*stack_ptr) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Internal - null pointer\n")); - return_ACPI_STATUS (AE_AML_NO_OPERAND); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Internal - null pointer\n")); + return_ACPI_STATUS(AE_AML_NO_OPERAND); } } @@ -114,20 +107,20 @@ acpi_ex_resolve_to_value ( * Object on the stack may have changed if acpi_ex_resolve_object_to_value() * was called (i.e., we can't use an _else_ here.) */ - if (ACPI_GET_DESCRIPTOR_TYPE (*stack_ptr) == ACPI_DESC_TYPE_NAMED) { - status = acpi_ex_resolve_node_to_value ( - ACPI_CAST_INDIRECT_PTR (struct acpi_namespace_node, stack_ptr), - walk_state); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + if (ACPI_GET_DESCRIPTOR_TYPE(*stack_ptr) == ACPI_DESC_TYPE_NAMED) { + status = + acpi_ex_resolve_node_to_value(ACPI_CAST_INDIRECT_PTR + (struct acpi_namespace_node, + stack_ptr), walk_state); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } } - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Resolved object %p\n", *stack_ptr)); - return_ACPI_STATUS (AE_OK); + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Resolved object %p\n", *stack_ptr)); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_ex_resolve_object_to_value @@ -143,25 +136,22 @@ acpi_ex_resolve_to_value ( ******************************************************************************/ static acpi_status -acpi_ex_resolve_object_to_value ( - union acpi_operand_object **stack_ptr, - struct acpi_walk_state *walk_state) +acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr, + struct acpi_walk_state *walk_state) { - acpi_status status = AE_OK; - union acpi_operand_object *stack_desc; - void *temp_node; - union acpi_operand_object *obj_desc; - u16 opcode; - - - ACPI_FUNCTION_TRACE ("ex_resolve_object_to_value"); + acpi_status status = AE_OK; + union acpi_operand_object *stack_desc; + void *temp_node; + union acpi_operand_object *obj_desc; + u16 opcode; + ACPI_FUNCTION_TRACE("ex_resolve_object_to_value"); stack_desc = *stack_ptr; /* This is an union acpi_operand_object */ - switch (ACPI_GET_OBJECT_TYPE (stack_desc)) { + switch (ACPI_GET_OBJECT_TYPE(stack_desc)) { case ACPI_TYPE_LOCAL_REFERENCE: opcode = stack_desc->reference.opcode; @@ -177,14 +167,13 @@ acpi_ex_resolve_object_to_value ( /* Delete the Reference Object */ - acpi_ut_remove_reference (stack_desc); + acpi_ut_remove_reference(stack_desc); /* Return the namespace node */ (*stack_ptr) = temp_node; break; - case AML_LOCAL_OP: case AML_ARG_OP: @@ -192,24 +181,28 @@ acpi_ex_resolve_object_to_value ( * Get the local from the method's state info * Note: this increments the local's object reference count */ - status = acpi_ds_method_data_get_value (opcode, - stack_desc->reference.offset, walk_state, &obj_desc); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ds_method_data_get_value(opcode, + stack_desc-> + reference.offset, + walk_state, + &obj_desc); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Arg/Local %X] value_obj is %p\n", - stack_desc->reference.offset, obj_desc)); + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, + "[Arg/Local %X] value_obj is %p\n", + stack_desc->reference.offset, + obj_desc)); /* * Now we can delete the original Reference Object and * replace it with the resolved value */ - acpi_ut_remove_reference (stack_desc); + acpi_ut_remove_reference(stack_desc); *stack_ptr = obj_desc; break; - case AML_INDEX_OP: switch (stack_desc->reference.target_type) { @@ -218,7 +211,6 @@ acpi_ex_resolve_object_to_value ( /* Just return - leave the Reference on the stack */ break; - case ACPI_TYPE_PACKAGE: obj_desc = *stack_desc->reference.where; @@ -228,36 +220,31 @@ acpi_ex_resolve_object_to_value ( * (i.e., dereference the package index) * Delete the ref object, increment the returned object */ - acpi_ut_remove_reference (stack_desc); - acpi_ut_add_reference (obj_desc); + acpi_ut_remove_reference(stack_desc); + acpi_ut_add_reference(obj_desc); *stack_ptr = obj_desc; - } - else { + } else { /* * A NULL object descriptor means an unitialized element of * the package, can't dereference it */ - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Attempt to deref an Index to NULL pkg element Idx=%p\n", - stack_desc)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Attempt to deref an Index to NULL pkg element Idx=%p\n", + stack_desc)); status = AE_AML_UNINITIALIZED_ELEMENT; } break; - default: /* Invalid reference object */ - ACPI_REPORT_ERROR (( - "During resolve, Unknown target_type %X in Index/Reference obj %p\n", - stack_desc->reference.target_type, stack_desc)); + ACPI_REPORT_ERROR(("During resolve, Unknown target_type %X in Index/Reference obj %p\n", stack_desc->reference.target_type, stack_desc)); status = AE_AML_INTERNAL; break; } break; - case AML_REF_OF_OP: case AML_DEBUG_OP: case AML_LOAD_OP: @@ -266,60 +253,58 @@ acpi_ex_resolve_object_to_value ( break; - case AML_INT_NAMEPATH_OP: /* Reference to a named object */ + case AML_INT_NAMEPATH_OP: /* Reference to a named object */ /* Get the object pointed to by the namespace node */ *stack_ptr = (stack_desc->reference.node)->object; - acpi_ut_add_reference (*stack_ptr); - acpi_ut_remove_reference (stack_desc); + acpi_ut_add_reference(*stack_ptr); + acpi_ut_remove_reference(stack_desc); break; default: - ACPI_REPORT_ERROR (( - "During resolve, Unknown Reference opcode %X (%s) in %p\n", - opcode, acpi_ps_get_opcode_name (opcode), stack_desc)); + ACPI_REPORT_ERROR(("During resolve, Unknown Reference opcode %X (%s) in %p\n", opcode, acpi_ps_get_opcode_name(opcode), stack_desc)); status = AE_AML_INTERNAL; break; } break; - case ACPI_TYPE_BUFFER: - status = acpi_ds_get_buffer_arguments (stack_desc); + status = acpi_ds_get_buffer_arguments(stack_desc); break; - case ACPI_TYPE_PACKAGE: - status = acpi_ds_get_package_arguments (stack_desc); + status = acpi_ds_get_package_arguments(stack_desc); break; - - /* These cases may never happen here, but just in case.. */ + /* These cases may never happen here, but just in case.. */ case ACPI_TYPE_BUFFER_FIELD: case ACPI_TYPE_LOCAL_REGION_FIELD: case ACPI_TYPE_LOCAL_BANK_FIELD: case ACPI_TYPE_LOCAL_INDEX_FIELD: - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "field_read source_desc=%p Type=%X\n", - stack_desc, ACPI_GET_OBJECT_TYPE (stack_desc))); + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, + "field_read source_desc=%p Type=%X\n", + stack_desc, + ACPI_GET_OBJECT_TYPE(stack_desc))); - status = acpi_ex_read_data_from_field (walk_state, stack_desc, &obj_desc); - *stack_ptr = (void *) obj_desc; + status = + acpi_ex_read_data_from_field(walk_state, stack_desc, + &obj_desc); + *stack_ptr = (void *)obj_desc; break; default: break; } - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_ex_resolve_multiple @@ -337,42 +322,44 @@ acpi_ex_resolve_object_to_value ( ******************************************************************************/ acpi_status -acpi_ex_resolve_multiple ( - struct acpi_walk_state *walk_state, - union acpi_operand_object *operand, - acpi_object_type *return_type, - union acpi_operand_object **return_desc) +acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state, + union acpi_operand_object *operand, + acpi_object_type * return_type, + union acpi_operand_object **return_desc) { - union acpi_operand_object *obj_desc = (void *) operand; - struct acpi_namespace_node *node; - acpi_object_type type; - acpi_status status; - - - ACPI_FUNCTION_TRACE ("acpi_ex_resolve_multiple"); + union acpi_operand_object *obj_desc = (void *)operand; + struct acpi_namespace_node *node; + acpi_object_type type; + acpi_status status; + ACPI_FUNCTION_TRACE("acpi_ex_resolve_multiple"); /* Operand can be either a namespace node or an operand descriptor */ - switch (ACPI_GET_DESCRIPTOR_TYPE (obj_desc)) { + switch (ACPI_GET_DESCRIPTOR_TYPE(obj_desc)) { case ACPI_DESC_TYPE_OPERAND: type = obj_desc->common.type; break; case ACPI_DESC_TYPE_NAMED: - type = ((struct acpi_namespace_node *) obj_desc)->type; - obj_desc = acpi_ns_get_attached_object ((struct acpi_namespace_node *) obj_desc); + type = ((struct acpi_namespace_node *)obj_desc)->type; + obj_desc = + acpi_ns_get_attached_object((struct acpi_namespace_node *) + obj_desc); /* If we had an Alias node, use the attached object for type info */ if (type == ACPI_TYPE_LOCAL_ALIAS) { - type = ((struct acpi_namespace_node *) obj_desc)->type; - obj_desc = acpi_ns_get_attached_object ((struct acpi_namespace_node *) obj_desc); + type = ((struct acpi_namespace_node *)obj_desc)->type; + obj_desc = + acpi_ns_get_attached_object((struct + acpi_namespace_node *) + obj_desc); } break; default: - return_ACPI_STATUS (AE_AML_OPERAND_TYPE); + return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } /* If type is anything other than a reference, we are done */ @@ -387,7 +374,7 @@ acpi_ex_resolve_multiple ( * of the object_type and size_of operators). This means traversing * the list of possibly many nested references. */ - while (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_LOCAL_REFERENCE) { + while (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_LOCAL_REFERENCE) { switch (obj_desc->reference.opcode) { case AML_REF_OF_OP: @@ -397,31 +384,29 @@ acpi_ex_resolve_multiple ( /* All "References" point to a NS node */ - if (ACPI_GET_DESCRIPTOR_TYPE (node) != ACPI_DESC_TYPE_NAMED) { - ACPI_REPORT_ERROR (( - "acpi_ex_resolve_multiple: Not a NS node %p [%s]\n", - node, acpi_ut_get_descriptor_name (node))); - return_ACPI_STATUS (AE_AML_INTERNAL); + if (ACPI_GET_DESCRIPTOR_TYPE(node) != + ACPI_DESC_TYPE_NAMED) { + ACPI_REPORT_ERROR(("acpi_ex_resolve_multiple: Not a NS node %p [%s]\n", node, acpi_ut_get_descriptor_name(node))); + return_ACPI_STATUS(AE_AML_INTERNAL); } /* Get the attached object */ - obj_desc = acpi_ns_get_attached_object (node); + obj_desc = acpi_ns_get_attached_object(node); if (!obj_desc) { /* No object, use the NS node type */ - type = acpi_ns_get_type (node); + type = acpi_ns_get_type(node); goto exit; } /* Check for circular references */ if (obj_desc == operand) { - return_ACPI_STATUS (AE_AML_CIRCULAR_REFERENCE); + return_ACPI_STATUS(AE_AML_CIRCULAR_REFERENCE); } break; - case AML_INDEX_OP: /* Get the type of this reference (index into another object) */ @@ -442,12 +427,11 @@ acpi_ex_resolve_multiple ( if (!obj_desc) { /* NULL package elements are allowed */ - type = 0; /* Uninitialized */ + type = 0; /* Uninitialized */ goto exit; } break; - case AML_INT_NAMEPATH_OP: /* Dereference the reference pointer */ @@ -456,50 +440,61 @@ acpi_ex_resolve_multiple ( /* All "References" point to a NS node */ - if (ACPI_GET_DESCRIPTOR_TYPE (node) != ACPI_DESC_TYPE_NAMED) { - ACPI_REPORT_ERROR (( - "acpi_ex_resolve_multiple: Not a NS node %p [%s]\n", - node, acpi_ut_get_descriptor_name (node))); - return_ACPI_STATUS (AE_AML_INTERNAL); + if (ACPI_GET_DESCRIPTOR_TYPE(node) != + ACPI_DESC_TYPE_NAMED) { + ACPI_REPORT_ERROR(("acpi_ex_resolve_multiple: Not a NS node %p [%s]\n", node, acpi_ut_get_descriptor_name(node))); + return_ACPI_STATUS(AE_AML_INTERNAL); } /* Get the attached object */ - obj_desc = acpi_ns_get_attached_object (node); + obj_desc = acpi_ns_get_attached_object(node); if (!obj_desc) { /* No object, use the NS node type */ - type = acpi_ns_get_type (node); + type = acpi_ns_get_type(node); goto exit; } /* Check for circular references */ if (obj_desc == operand) { - return_ACPI_STATUS (AE_AML_CIRCULAR_REFERENCE); + return_ACPI_STATUS(AE_AML_CIRCULAR_REFERENCE); } break; - case AML_LOCAL_OP: case AML_ARG_OP: if (return_desc) { - status = acpi_ds_method_data_get_value (obj_desc->reference.opcode, - obj_desc->reference.offset, walk_state, &obj_desc); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = + acpi_ds_method_data_get_value(obj_desc-> + reference. + opcode, + obj_desc-> + reference. + offset, + walk_state, + &obj_desc); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } - acpi_ut_remove_reference (obj_desc); - } - else { - status = acpi_ds_method_data_get_node (obj_desc->reference.opcode, - obj_desc->reference.offset, walk_state, &node); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + acpi_ut_remove_reference(obj_desc); + } else { + status = + acpi_ds_method_data_get_node(obj_desc-> + reference. + opcode, + obj_desc-> + reference. + offset, + walk_state, + &node); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } - obj_desc = acpi_ns_get_attached_object (node); + obj_desc = acpi_ns_get_attached_object(node); if (!obj_desc) { type = ACPI_TYPE_ANY; goto exit; @@ -507,7 +502,6 @@ acpi_ex_resolve_multiple ( } break; - case AML_DEBUG_OP: /* The Debug Object is of type "debug_object" */ @@ -515,13 +509,10 @@ acpi_ex_resolve_multiple ( type = ACPI_TYPE_DEBUG_OBJECT; goto exit; - default: - ACPI_REPORT_ERROR (( - "acpi_ex_resolve_multiple: Unknown Reference subtype %X\n", - obj_desc->reference.opcode)); - return_ACPI_STATUS (AE_AML_INTERNAL); + ACPI_REPORT_ERROR(("acpi_ex_resolve_multiple: Unknown Reference subtype %X\n", obj_desc->reference.opcode)); + return_ACPI_STATUS(AE_AML_INTERNAL); } } @@ -529,10 +520,9 @@ acpi_ex_resolve_multiple ( * Now we are guaranteed to have an object that has not been created * via the ref_of or Index operators. */ - type = ACPI_GET_OBJECT_TYPE (obj_desc); + type = ACPI_GET_OBJECT_TYPE(obj_desc); - -exit: + exit: /* Convert internal types to external types */ switch (type) { @@ -559,7 +549,5 @@ exit: if (return_desc) { *return_desc = obj_desc; } - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - - diff --git a/drivers/acpi/executer/exresop.c b/drivers/acpi/executer/exresop.c index aaba7abcb52..ff064e79ab9 100644 --- a/drivers/acpi/executer/exresop.c +++ b/drivers/acpi/executer/exresop.c @@ -42,24 +42,18 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include #include #include #include - #define _COMPONENT ACPI_EXECUTER - ACPI_MODULE_NAME ("exresop") +ACPI_MODULE_NAME("exresop") /* Local prototypes */ - static acpi_status -acpi_ex_check_object_type ( - acpi_object_type type_needed, - acpi_object_type this_type, - void *object); - +acpi_ex_check_object_type(acpi_object_type type_needed, + acpi_object_type this_type, void *object); /******************************************************************************* * @@ -76,13 +70,10 @@ acpi_ex_check_object_type ( ******************************************************************************/ static acpi_status -acpi_ex_check_object_type ( - acpi_object_type type_needed, - acpi_object_type this_type, - void *object) +acpi_ex_check_object_type(acpi_object_type type_needed, + acpi_object_type this_type, void *object) { - ACPI_FUNCTION_NAME ("ex_check_object_type"); - + ACPI_FUNCTION_NAME("ex_check_object_type"); if (type_needed == ACPI_TYPE_ANY) { /* All types OK, so we don't perform any typechecks */ @@ -97,16 +88,17 @@ acpi_ex_check_object_type ( * specification, a store to a constant is a noop.) */ if ((this_type == ACPI_TYPE_INTEGER) && - (((union acpi_operand_object *) object)->common.flags & AOPOBJ_AML_CONSTANT)) { + (((union acpi_operand_object *)object)->common. + flags & AOPOBJ_AML_CONSTANT)) { return (AE_OK); } } if (type_needed != this_type) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Needed [%s], found [%s] %p\n", - acpi_ut_get_type_name (type_needed), - acpi_ut_get_type_name (this_type), object)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Needed [%s], found [%s] %p\n", + acpi_ut_get_type_name(type_needed), + acpi_ut_get_type_name(this_type), object)); return (AE_AML_OPERAND_TYPE); } @@ -114,7 +106,6 @@ acpi_ex_check_object_type ( return (AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_ex_resolve_operands @@ -137,41 +128,37 @@ acpi_ex_check_object_type ( ******************************************************************************/ acpi_status -acpi_ex_resolve_operands ( - u16 opcode, - union acpi_operand_object **stack_ptr, - struct acpi_walk_state *walk_state) +acpi_ex_resolve_operands(u16 opcode, + union acpi_operand_object ** stack_ptr, + struct acpi_walk_state * walk_state) { - union acpi_operand_object *obj_desc; - acpi_status status = AE_OK; - u8 object_type; - void *temp_node; - u32 arg_types; - const struct acpi_opcode_info *op_info; - u32 this_arg_type; - acpi_object_type type_needed; - u16 target_op = 0; - - - ACPI_FUNCTION_TRACE_U32 ("ex_resolve_operands", opcode); - - - op_info = acpi_ps_get_opcode_info (opcode); + union acpi_operand_object *obj_desc; + acpi_status status = AE_OK; + u8 object_type; + void *temp_node; + u32 arg_types; + const struct acpi_opcode_info *op_info; + u32 this_arg_type; + acpi_object_type type_needed; + u16 target_op = 0; + + ACPI_FUNCTION_TRACE_U32("ex_resolve_operands", opcode); + + op_info = acpi_ps_get_opcode_info(opcode); if (op_info->class == AML_CLASS_UNKNOWN) { - return_ACPI_STATUS (AE_AML_BAD_OPCODE); + return_ACPI_STATUS(AE_AML_BAD_OPCODE); } arg_types = op_info->runtime_args; if (arg_types == ARGI_INVALID_OPCODE) { - ACPI_REPORT_ERROR (("resolve_operands: %X is not a valid AML opcode\n", - opcode)); + ACPI_REPORT_ERROR(("resolve_operands: %X is not a valid AML opcode\n", opcode)); - return_ACPI_STATUS (AE_AML_INTERNAL); + return_ACPI_STATUS(AE_AML_INTERNAL); } - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "Opcode %X [%s] required_operand_types=%8.8X \n", - opcode, op_info->name, arg_types)); + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, + "Opcode %X [%s] required_operand_types=%8.8X \n", + opcode, op_info->name, arg_types)); /* * Normal exit is with (arg_types == 0) at end of argument list. @@ -180,12 +167,11 @@ acpi_ex_resolve_operands ( * to) the required type; if stack underflows; or upon * finding a NULL stack entry (which should not happen). */ - while (GET_CURRENT_ARG_TYPE (arg_types)) { + while (GET_CURRENT_ARG_TYPE(arg_types)) { if (!stack_ptr || !*stack_ptr) { - ACPI_REPORT_ERROR (("resolve_operands: Null stack entry at %p\n", - stack_ptr)); + ACPI_REPORT_ERROR(("resolve_operands: Null stack entry at %p\n", stack_ptr)); - return_ACPI_STATUS (AE_AML_INTERNAL); + return_ACPI_STATUS(AE_AML_INTERNAL); } /* Extract useful items */ @@ -194,37 +180,37 @@ acpi_ex_resolve_operands ( /* Decode the descriptor type */ - switch (ACPI_GET_DESCRIPTOR_TYPE (obj_desc)) { + switch (ACPI_GET_DESCRIPTOR_TYPE(obj_desc)) { case ACPI_DESC_TYPE_NAMED: /* Namespace Node */ - object_type = ((struct acpi_namespace_node *) obj_desc)->type; + object_type = + ((struct acpi_namespace_node *)obj_desc)->type; break; - case ACPI_DESC_TYPE_OPERAND: /* ACPI internal object */ - object_type = ACPI_GET_OBJECT_TYPE (obj_desc); + object_type = ACPI_GET_OBJECT_TYPE(obj_desc); /* Check for bad acpi_object_type */ - if (!acpi_ut_valid_object_type (object_type)) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Bad operand object type [%X]\n", - object_type)); + if (!acpi_ut_valid_object_type(object_type)) { + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Bad operand object type [%X]\n", + object_type)); - return_ACPI_STATUS (AE_AML_OPERAND_TYPE); + return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } if (object_type == (u8) ACPI_TYPE_LOCAL_REFERENCE) { /* Decode the Reference */ - op_info = acpi_ps_get_opcode_info (opcode); + op_info = acpi_ps_get_opcode_info(opcode); if (op_info->class == AML_CLASS_UNKNOWN) { - return_ACPI_STATUS (AE_AML_BAD_OPCODE); + return_ACPI_STATUS(AE_AML_BAD_OPCODE); } switch (obj_desc->reference.opcode) { @@ -238,51 +224,62 @@ acpi_ex_resolve_operands ( case AML_REF_OF_OP: case AML_ARG_OP: case AML_LOCAL_OP: - case AML_LOAD_OP: /* ddb_handle from LOAD_OP or LOAD_TABLE_OP */ - case AML_INT_NAMEPATH_OP: /* Reference to a named object */ - - ACPI_DEBUG_ONLY_MEMBERS (ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "Operand is a Reference, ref_opcode [%s]\n", - (acpi_ps_get_opcode_info (obj_desc->reference.opcode))->name))); + case AML_LOAD_OP: /* ddb_handle from LOAD_OP or LOAD_TABLE_OP */ + case AML_INT_NAMEPATH_OP: /* Reference to a named object */ + + ACPI_DEBUG_ONLY_MEMBERS(ACPI_DEBUG_PRINT + ((ACPI_DB_EXEC, + "Operand is a Reference, ref_opcode [%s]\n", + (acpi_ps_get_opcode_info + (obj_desc-> + reference. + opcode))-> + name))); break; default: - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Operand is a Reference, Unknown Reference Opcode %X [%s]\n", - obj_desc->reference.opcode, - (acpi_ps_get_opcode_info (obj_desc->reference.opcode))->name)); - - return_ACPI_STATUS (AE_AML_OPERAND_TYPE); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Operand is a Reference, Unknown Reference Opcode %X [%s]\n", + obj_desc->reference. + opcode, + (acpi_ps_get_opcode_info + (obj_desc->reference. + opcode))->name)); + + return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } } break; - default: /* Invalid descriptor */ - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Invalid descriptor %p [%s]\n", - obj_desc, acpi_ut_get_descriptor_name (obj_desc))); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Invalid descriptor %p [%s]\n", + obj_desc, + acpi_ut_get_descriptor_name + (obj_desc))); - return_ACPI_STATUS (AE_AML_OPERAND_TYPE); + return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } /* Get one argument type, point to the next */ - this_arg_type = GET_CURRENT_ARG_TYPE (arg_types); - INCREMENT_ARG_LIST (arg_types); + this_arg_type = GET_CURRENT_ARG_TYPE(arg_types); + INCREMENT_ARG_LIST(arg_types); /* * Handle cases where the object does not need to be * resolved to a value */ switch (this_arg_type) { - case ARGI_REF_OR_STRING: /* Can be a String or Reference */ + case ARGI_REF_OR_STRING: /* Can be a String or Reference */ - if ((ACPI_GET_DESCRIPTOR_TYPE (obj_desc) == ACPI_DESC_TYPE_OPERAND) && - (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_STRING)) { + if ((ACPI_GET_DESCRIPTOR_TYPE(obj_desc) == + ACPI_DESC_TYPE_OPERAND) + && (ACPI_GET_OBJECT_TYPE(obj_desc) == + ACPI_TYPE_STRING)) { /* * String found - the string references a named object and * must be resolved to a node @@ -296,39 +293,40 @@ acpi_ex_resolve_operands ( */ /*lint -fallthrough */ - case ARGI_REFERENCE: /* References: */ + case ARGI_REFERENCE: /* References: */ case ARGI_INTEGER_REF: case ARGI_OBJECT_REF: case ARGI_DEVICE_REF: - case ARGI_TARGETREF: /* Allows implicit conversion rules before store */ - case ARGI_FIXED_TARGET: /* No implicit conversion before store to target */ - case ARGI_SIMPLE_TARGET: /* Name, Local, or Arg - no implicit conversion */ + case ARGI_TARGETREF: /* Allows implicit conversion rules before store */ + case ARGI_FIXED_TARGET: /* No implicit conversion before store to target */ + case ARGI_SIMPLE_TARGET: /* Name, Local, or Arg - no implicit conversion */ /* * Need an operand of type ACPI_TYPE_LOCAL_REFERENCE * A Namespace Node is OK as-is */ - if (ACPI_GET_DESCRIPTOR_TYPE (obj_desc) == ACPI_DESC_TYPE_NAMED) { + if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) == + ACPI_DESC_TYPE_NAMED) { goto next_operand; } - status = acpi_ex_check_object_type (ACPI_TYPE_LOCAL_REFERENCE, - object_type, obj_desc); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = + acpi_ex_check_object_type(ACPI_TYPE_LOCAL_REFERENCE, + object_type, obj_desc); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } if (obj_desc->reference.opcode == AML_NAME_OP) { /* Convert a named reference to the actual named object */ temp_node = obj_desc->reference.object; - acpi_ut_remove_reference (obj_desc); + acpi_ut_remove_reference(obj_desc); (*stack_ptr) = temp_node; } goto next_operand; - - case ARGI_DATAREFOBJ: /* Store operator only */ + case ARGI_DATAREFOBJ: /* Store operator only */ /* * We don't want to resolve index_op reference objects during @@ -337,8 +335,10 @@ acpi_ex_resolve_operands ( * -- All others must be resolved below. */ if ((opcode == AML_STORE_OP) && - (ACPI_GET_OBJECT_TYPE (*stack_ptr) == ACPI_TYPE_LOCAL_REFERENCE) && - ((*stack_ptr)->reference.opcode == AML_INDEX_OP)) { + (ACPI_GET_OBJECT_TYPE(*stack_ptr) == + ACPI_TYPE_LOCAL_REFERENCE) + && ((*stack_ptr)->reference.opcode == + AML_INDEX_OP)) { goto next_operand; } break; @@ -351,9 +351,9 @@ acpi_ex_resolve_operands ( /* * Resolve this object to a value */ - status = acpi_ex_resolve_to_value (stack_ptr, walk_state); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ex_resolve_to_value(stack_ptr, walk_state); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* Get the resolved object */ @@ -364,10 +364,10 @@ acpi_ex_resolve_operands ( * Check the resulting object (value) type */ switch (this_arg_type) { - /* - * For the simple cases, only one type of resolved object - * is allowed - */ + /* + * For the simple cases, only one type of resolved object + * is allowed + */ case ARGI_MUTEX: /* Need an operand of type ACPI_TYPE_MUTEX */ @@ -382,7 +382,7 @@ acpi_ex_resolve_operands ( type_needed = ACPI_TYPE_EVENT; break; - case ARGI_PACKAGE: /* Package */ + case ARGI_PACKAGE: /* Package */ /* Need an operand of type ACPI_TYPE_PACKAGE */ @@ -403,10 +403,9 @@ acpi_ex_resolve_operands ( type_needed = ACPI_TYPE_LOCAL_REFERENCE; break; - - /* - * The more complex cases allow multiple resolved object types - */ + /* + * The more complex cases allow multiple resolved object types + */ case ARGI_INTEGER: /* @@ -414,25 +413,27 @@ acpi_ex_resolve_operands ( * But we can implicitly convert from a STRING or BUFFER * Aka - "Implicit Source Operand Conversion" */ - status = acpi_ex_convert_to_integer (obj_desc, stack_ptr, 16); - if (ACPI_FAILURE (status)) { + status = + acpi_ex_convert_to_integer(obj_desc, stack_ptr, 16); + if (ACPI_FAILURE(status)) { if (status == AE_TYPE) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Needed [Integer/String/Buffer], found [%s] %p\n", - acpi_ut_get_object_type_name (obj_desc), obj_desc)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Needed [Integer/String/Buffer], found [%s] %p\n", + acpi_ut_get_object_type_name + (obj_desc), + obj_desc)); - return_ACPI_STATUS (AE_AML_OPERAND_TYPE); + return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } if (obj_desc != *stack_ptr) { - acpi_ut_remove_reference (obj_desc); + acpi_ut_remove_reference(obj_desc); } goto next_operand; - case ARGI_BUFFER: /* @@ -440,25 +441,26 @@ acpi_ex_resolve_operands ( * But we can implicitly convert from a STRING or INTEGER * Aka - "Implicit Source Operand Conversion" */ - status = acpi_ex_convert_to_buffer (obj_desc, stack_ptr); - if (ACPI_FAILURE (status)) { + status = acpi_ex_convert_to_buffer(obj_desc, stack_ptr); + if (ACPI_FAILURE(status)) { if (status == AE_TYPE) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Needed [Integer/String/Buffer], found [%s] %p\n", - acpi_ut_get_object_type_name (obj_desc), obj_desc)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Needed [Integer/String/Buffer], found [%s] %p\n", + acpi_ut_get_object_type_name + (obj_desc), + obj_desc)); - return_ACPI_STATUS (AE_AML_OPERAND_TYPE); + return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } if (obj_desc != *stack_ptr) { - acpi_ut_remove_reference (obj_desc); + acpi_ut_remove_reference(obj_desc); } goto next_operand; - case ARGI_STRING: /* @@ -466,83 +468,86 @@ acpi_ex_resolve_operands ( * But we can implicitly convert from a BUFFER or INTEGER * Aka - "Implicit Source Operand Conversion" */ - status = acpi_ex_convert_to_string (obj_desc, stack_ptr, - ACPI_IMPLICIT_CONVERT_HEX); - if (ACPI_FAILURE (status)) { + status = acpi_ex_convert_to_string(obj_desc, stack_ptr, + ACPI_IMPLICIT_CONVERT_HEX); + if (ACPI_FAILURE(status)) { if (status == AE_TYPE) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Needed [Integer/String/Buffer], found [%s] %p\n", - acpi_ut_get_object_type_name (obj_desc), obj_desc)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Needed [Integer/String/Buffer], found [%s] %p\n", + acpi_ut_get_object_type_name + (obj_desc), + obj_desc)); - return_ACPI_STATUS (AE_AML_OPERAND_TYPE); + return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } if (obj_desc != *stack_ptr) { - acpi_ut_remove_reference (obj_desc); + acpi_ut_remove_reference(obj_desc); } goto next_operand; - case ARGI_COMPUTEDATA: /* Need an operand of type INTEGER, STRING or BUFFER */ - switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { + switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { case ACPI_TYPE_INTEGER: case ACPI_TYPE_STRING: case ACPI_TYPE_BUFFER: /* Valid operand */ - break; + break; default: - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Needed [Integer/String/Buffer], found [%s] %p\n", - acpi_ut_get_object_type_name (obj_desc), obj_desc)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Needed [Integer/String/Buffer], found [%s] %p\n", + acpi_ut_get_object_type_name + (obj_desc), obj_desc)); - return_ACPI_STATUS (AE_AML_OPERAND_TYPE); + return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } goto next_operand; - case ARGI_BUFFER_OR_STRING: /* Need an operand of type STRING or BUFFER */ - switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { + switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { case ACPI_TYPE_STRING: case ACPI_TYPE_BUFFER: /* Valid operand */ - break; + break; case ACPI_TYPE_INTEGER: /* Highest priority conversion is to type Buffer */ - status = acpi_ex_convert_to_buffer (obj_desc, stack_ptr); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = + acpi_ex_convert_to_buffer(obj_desc, + stack_ptr); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } if (obj_desc != *stack_ptr) { - acpi_ut_remove_reference (obj_desc); + acpi_ut_remove_reference(obj_desc); } break; default: - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Needed [Integer/String/Buffer], found [%s] %p\n", - acpi_ut_get_object_type_name (obj_desc), obj_desc)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Needed [Integer/String/Buffer], found [%s] %p\n", + acpi_ut_get_object_type_name + (obj_desc), obj_desc)); - return_ACPI_STATUS (AE_AML_OPERAND_TYPE); + return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } goto next_operand; - case ARGI_DATAOBJECT: /* * ARGI_DATAOBJECT is only used by the size_of operator. @@ -551,7 +556,7 @@ acpi_ex_resolve_operands ( * The only reference allowed here is a direct reference to * a namespace node. */ - switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { + switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { case ACPI_TYPE_PACKAGE: case ACPI_TYPE_STRING: case ACPI_TYPE_BUFFER: @@ -561,20 +566,20 @@ acpi_ex_resolve_operands ( break; default: - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Needed [Buffer/String/Package/Reference], found [%s] %p\n", - acpi_ut_get_object_type_name (obj_desc), obj_desc)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Needed [Buffer/String/Package/Reference], found [%s] %p\n", + acpi_ut_get_object_type_name + (obj_desc), obj_desc)); - return_ACPI_STATUS (AE_AML_OPERAND_TYPE); + return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } goto next_operand; - case ARGI_COMPLEXOBJ: /* Need a buffer or package or (ACPI 2.0) String */ - switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { + switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { case ACPI_TYPE_PACKAGE: case ACPI_TYPE_STRING: case ACPI_TYPE_BUFFER: @@ -583,20 +588,20 @@ acpi_ex_resolve_operands ( break; default: - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Needed [Buffer/String/Package], found [%s] %p\n", - acpi_ut_get_object_type_name (obj_desc), obj_desc)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Needed [Buffer/String/Package], found [%s] %p\n", + acpi_ut_get_object_type_name + (obj_desc), obj_desc)); - return_ACPI_STATUS (AE_AML_OPERAND_TYPE); + return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } goto next_operand; - case ARGI_REGION_OR_FIELD: /* Need an operand of type REGION or a FIELD in a region */ - switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { + switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { case ACPI_TYPE_REGION: case ACPI_TYPE_LOCAL_REGION_FIELD: case ACPI_TYPE_LOCAL_BANK_FIELD: @@ -606,20 +611,20 @@ acpi_ex_resolve_operands ( break; default: - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Needed [Region/region_field], found [%s] %p\n", - acpi_ut_get_object_type_name (obj_desc), obj_desc)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Needed [Region/region_field], found [%s] %p\n", + acpi_ut_get_object_type_name + (obj_desc), obj_desc)); - return_ACPI_STATUS (AE_AML_OPERAND_TYPE); + return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } goto next_operand; - case ARGI_DATAREFOBJ: /* Used by the Store() operator only */ - switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { + switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { case ACPI_TYPE_INTEGER: case ACPI_TYPE_PACKAGE: case ACPI_TYPE_STRING: @@ -651,47 +656,46 @@ acpi_ex_resolve_operands ( break; } - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Needed Integer/Buffer/String/Package/Ref/Ddb], found [%s] %p\n", - acpi_ut_get_object_type_name (obj_desc), obj_desc)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Needed Integer/Buffer/String/Package/Ref/Ddb], found [%s] %p\n", + acpi_ut_get_object_type_name + (obj_desc), obj_desc)); - return_ACPI_STATUS (AE_AML_OPERAND_TYPE); + return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } goto next_operand; - default: /* Unknown type */ - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Internal - Unknown ARGI (required operand) type %X\n", - this_arg_type)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Internal - Unknown ARGI (required operand) type %X\n", + this_arg_type)); - return_ACPI_STATUS (AE_BAD_PARAMETER); + return_ACPI_STATUS(AE_BAD_PARAMETER); } /* * Make sure that the original object was resolved to the * required object type (Simple cases only). */ - status = acpi_ex_check_object_type (type_needed, - ACPI_GET_OBJECT_TYPE (*stack_ptr), *stack_ptr); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ex_check_object_type(type_needed, + ACPI_GET_OBJECT_TYPE + (*stack_ptr), *stack_ptr); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } -next_operand: + next_operand: /* * If more operands needed, decrement stack_ptr to point * to next operand on stack */ - if (GET_CURRENT_ARG_TYPE (arg_types)) { + if (GET_CURRENT_ARG_TYPE(arg_types)) { stack_ptr--; } } - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - - diff --git a/drivers/acpi/executer/exstore.c b/drivers/acpi/executer/exstore.c index 59dbfeaa54c..a7d8eea305c 100644 --- a/drivers/acpi/executer/exstore.c +++ b/drivers/acpi/executer/exstore.c @@ -42,7 +42,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include #include #include @@ -50,24 +49,18 @@ #include #include - #define _COMPONENT ACPI_EXECUTER - ACPI_MODULE_NAME ("exstore") +ACPI_MODULE_NAME("exstore") /* Local prototypes */ - static void -acpi_ex_do_debug_object ( - union acpi_operand_object *source_desc, - u32 level, - u32 index); +acpi_ex_do_debug_object(union acpi_operand_object *source_desc, + u32 level, u32 index); static acpi_status -acpi_ex_store_object_to_index ( - union acpi_operand_object *val_desc, - union acpi_operand_object *dest_desc, - struct acpi_walk_state *walk_state); - +acpi_ex_store_object_to_index(union acpi_operand_object *val_desc, + union acpi_operand_object *dest_desc, + struct acpi_walk_state *walk_state); /******************************************************************************* * @@ -84,136 +77,146 @@ acpi_ex_store_object_to_index ( ******************************************************************************/ static void -acpi_ex_do_debug_object ( - union acpi_operand_object *source_desc, - u32 level, - u32 index) +acpi_ex_do_debug_object(union acpi_operand_object *source_desc, + u32 level, u32 index) { - u32 i; - + u32 i; - ACPI_FUNCTION_TRACE_PTR ("ex_do_debug_object", source_desc); + ACPI_FUNCTION_TRACE_PTR("ex_do_debug_object", source_desc); - - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[ACPI Debug] %*s", - level, " ")); + ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "[ACPI Debug] %*s", + level, " ")); /* Display index for package output only */ if (index > 0) { - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, - "(%.2u) ", index -1)); + ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, + "(%.2u) ", index - 1)); } if (!source_desc) { - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "\n")); + ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "\n")); return_VOID; } - if (ACPI_GET_DESCRIPTOR_TYPE (source_desc) == ACPI_DESC_TYPE_OPERAND) { - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "%s: ", - acpi_ut_get_object_type_name (source_desc))); + if (ACPI_GET_DESCRIPTOR_TYPE(source_desc) == ACPI_DESC_TYPE_OPERAND) { + ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "%s: ", + acpi_ut_get_object_type_name + (source_desc))); - if (!acpi_ut_valid_internal_object (source_desc)) { - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, - "%p, Invalid Internal Object!\n", source_desc)); - return_VOID; + if (!acpi_ut_valid_internal_object(source_desc)) { + ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, + "%p, Invalid Internal Object!\n", + source_desc)); + return_VOID; } - } - else if (ACPI_GET_DESCRIPTOR_TYPE (source_desc) == ACPI_DESC_TYPE_NAMED) { - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "%s: %p\n", - acpi_ut_get_type_name (((struct acpi_namespace_node *) source_desc)->type), - source_desc)); + } else if (ACPI_GET_DESCRIPTOR_TYPE(source_desc) == + ACPI_DESC_TYPE_NAMED) { + ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "%s: %p\n", + acpi_ut_get_type_name(((struct + acpi_namespace_node + *)source_desc)-> + type), + source_desc)); return_VOID; - } - else { + } else { return_VOID; } - switch (ACPI_GET_OBJECT_TYPE (source_desc)) { + switch (ACPI_GET_OBJECT_TYPE(source_desc)) { case ACPI_TYPE_INTEGER: /* Output correct integer width */ if (acpi_gbl_integer_byte_width == 4) { - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "0x%8.8X\n", - (u32) source_desc->integer.value)); - } - else { - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "0x%8.8X%8.8X\n", - ACPI_FORMAT_UINT64 (source_desc->integer.value))); + ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "0x%8.8X\n", + (u32) source_desc->integer. + value)); + } else { + ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, + "0x%8.8X%8.8X\n", + ACPI_FORMAT_UINT64(source_desc-> + integer. + value))); } break; case ACPI_TYPE_BUFFER: - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[0x%.2X]\n", - (u32) source_desc->buffer.length)); - ACPI_DUMP_BUFFER (source_desc->buffer.pointer, - (source_desc->buffer.length < 32) ? source_desc->buffer.length : 32); + ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "[0x%.2X]\n", + (u32) source_desc->buffer.length)); + ACPI_DUMP_BUFFER(source_desc->buffer.pointer, + (source_desc->buffer.length < + 32) ? source_desc->buffer.length : 32); break; case ACPI_TYPE_STRING: - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[0x%.2X] \"%s\"\n", - source_desc->string.length, source_desc->string.pointer)); + ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "[0x%.2X] \"%s\"\n", + source_desc->string.length, + source_desc->string.pointer)); break; case ACPI_TYPE_PACKAGE: - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[0x%.2X Elements]\n", - source_desc->package.count)); + ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, + "[0x%.2X Elements]\n", + source_desc->package.count)); /* Output the entire contents of the package */ for (i = 0; i < source_desc->package.count; i++) { - acpi_ex_do_debug_object (source_desc->package.elements[i], - level+4, i+1); + acpi_ex_do_debug_object(source_desc->package. + elements[i], level + 4, i + 1); } break; case ACPI_TYPE_LOCAL_REFERENCE: if (source_desc->reference.opcode == AML_INDEX_OP) { - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[%s, 0x%X]\n", - acpi_ps_get_opcode_name (source_desc->reference.opcode), - source_desc->reference.offset)); + ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, + "[%s, 0x%X]\n", + acpi_ps_get_opcode_name + (source_desc->reference.opcode), + source_desc->reference.offset)); + } else { + ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "[%s]\n", + acpi_ps_get_opcode_name + (source_desc->reference.opcode))); } - else { - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[%s]\n", - acpi_ps_get_opcode_name (source_desc->reference.opcode))); - } - if (source_desc->reference.object) { - if (ACPI_GET_DESCRIPTOR_TYPE (source_desc->reference.object) == - ACPI_DESC_TYPE_NAMED) { - acpi_ex_do_debug_object (((struct acpi_namespace_node *) - source_desc->reference.object)->object, - level+4, 0); + if (ACPI_GET_DESCRIPTOR_TYPE + (source_desc->reference.object) == + ACPI_DESC_TYPE_NAMED) { + acpi_ex_do_debug_object(((struct + acpi_namespace_node *) + source_desc->reference. + object)->object, + level + 4, 0); + } else { + acpi_ex_do_debug_object(source_desc->reference. + object, level + 4, 0); } - else { - acpi_ex_do_debug_object (source_desc->reference.object, level+4, 0); - } - } - else if (source_desc->reference.node) { - acpi_ex_do_debug_object ((source_desc->reference.node)->object, - level+4, 0); + } else if (source_desc->reference.node) { + acpi_ex_do_debug_object((source_desc->reference.node)-> + object, level + 4, 0); } break; default: - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "%p %s\n", - source_desc, acpi_ut_get_object_type_name (source_desc))); + ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "%p %s\n", + source_desc, + acpi_ut_get_object_type_name + (source_desc))); break; } - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC, "\n")); + ACPI_DEBUG_PRINT_RAW((ACPI_DB_EXEC, "\n")); return_VOID; } - /******************************************************************************* * * FUNCTION: acpi_ex_store @@ -235,42 +238,41 @@ acpi_ex_do_debug_object ( ******************************************************************************/ acpi_status -acpi_ex_store ( - union acpi_operand_object *source_desc, - union acpi_operand_object *dest_desc, - struct acpi_walk_state *walk_state) +acpi_ex_store(union acpi_operand_object *source_desc, + union acpi_operand_object *dest_desc, + struct acpi_walk_state *walk_state) { - acpi_status status = AE_OK; - union acpi_operand_object *ref_desc = dest_desc; - - - ACPI_FUNCTION_TRACE_PTR ("ex_store", dest_desc); + acpi_status status = AE_OK; + union acpi_operand_object *ref_desc = dest_desc; + ACPI_FUNCTION_TRACE_PTR("ex_store", dest_desc); /* Validate parameters */ if (!source_desc || !dest_desc) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null parameter\n")); - return_ACPI_STATUS (AE_AML_NO_OPERAND); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Null parameter\n")); + return_ACPI_STATUS(AE_AML_NO_OPERAND); } /* dest_desc can be either a namespace node or an ACPI object */ - if (ACPI_GET_DESCRIPTOR_TYPE (dest_desc) == ACPI_DESC_TYPE_NAMED) { + if (ACPI_GET_DESCRIPTOR_TYPE(dest_desc) == ACPI_DESC_TYPE_NAMED) { /* * Dest is a namespace node, * Storing an object into a Named node. */ - status = acpi_ex_store_object_to_node (source_desc, - (struct acpi_namespace_node *) dest_desc, walk_state, - ACPI_IMPLICIT_CONVERSION); + status = acpi_ex_store_object_to_node(source_desc, + (struct + acpi_namespace_node *) + dest_desc, walk_state, + ACPI_IMPLICIT_CONVERSION); - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } /* Destination object must be a Reference or a Constant object */ - switch (ACPI_GET_OBJECT_TYPE (dest_desc)) { + switch (ACPI_GET_OBJECT_TYPE(dest_desc)) { case ACPI_TYPE_LOCAL_REFERENCE: break; @@ -279,7 +281,7 @@ acpi_ex_store ( /* Allow stores to Constants -- a Noop as per ACPI spec */ if (dest_desc->common.flags & AOPOBJ_AML_CONSTANT) { - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } /*lint -fallthrough */ @@ -288,16 +290,18 @@ acpi_ex_store ( /* Destination is not a Reference object */ - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Target is not a Reference or Constant object - %s [%p]\n", - acpi_ut_get_object_type_name (dest_desc), dest_desc)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Target is not a Reference or Constant object - %s [%p]\n", + acpi_ut_get_object_type_name(dest_desc), + dest_desc)); - ACPI_DUMP_STACK_ENTRY (source_desc); - ACPI_DUMP_STACK_ENTRY (dest_desc); - ACPI_DUMP_OPERANDS (&dest_desc, ACPI_IMODE_EXECUTE, "ex_store", - 2, "Target is not a Reference or Constant object"); + ACPI_DUMP_STACK_ENTRY(source_desc); + ACPI_DUMP_STACK_ENTRY(dest_desc); + ACPI_DUMP_OPERANDS(&dest_desc, ACPI_IMODE_EXECUTE, "ex_store", + 2, + "Target is not a Reference or Constant object"); - return_ACPI_STATUS (AE_AML_OPERAND_TYPE); + return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } /* @@ -314,58 +318,59 @@ acpi_ex_store ( /* Storing an object into a Name "container" */ - status = acpi_ex_store_object_to_node (source_desc, - ref_desc->reference.object, - walk_state, ACPI_IMPLICIT_CONVERSION); + status = acpi_ex_store_object_to_node(source_desc, + ref_desc->reference. + object, walk_state, + ACPI_IMPLICIT_CONVERSION); break; - case AML_INDEX_OP: /* Storing to an Index (pointer into a packager or buffer) */ - status = acpi_ex_store_object_to_index (source_desc, ref_desc, walk_state); + status = + acpi_ex_store_object_to_index(source_desc, ref_desc, + walk_state); break; - case AML_LOCAL_OP: case AML_ARG_OP: /* Store to a method local/arg */ - status = acpi_ds_store_object_to_local (ref_desc->reference.opcode, - ref_desc->reference.offset, source_desc, walk_state); + status = + acpi_ds_store_object_to_local(ref_desc->reference.opcode, + ref_desc->reference.offset, + source_desc, walk_state); break; - case AML_DEBUG_OP: /* * Storing to the Debug object causes the value stored to be * displayed and otherwise has no effect -- see ACPI Specification */ - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "**** Write to Debug Object: Object %p %s ****:\n\n", - source_desc, acpi_ut_get_object_type_name (source_desc))); + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, + "**** Write to Debug Object: Object %p %s ****:\n\n", + source_desc, + acpi_ut_get_object_type_name(source_desc))); - acpi_ex_do_debug_object (source_desc, 0, 0); + acpi_ex_do_debug_object(source_desc, 0, 0); break; - default: - ACPI_REPORT_ERROR (("ex_store: Unknown Reference opcode %X\n", - ref_desc->reference.opcode)); - ACPI_DUMP_ENTRY (ref_desc, ACPI_LV_ERROR); + ACPI_REPORT_ERROR(("ex_store: Unknown Reference opcode %X\n", + ref_desc->reference.opcode)); + ACPI_DUMP_ENTRY(ref_desc, ACPI_LV_ERROR); status = AE_AML_INTERNAL; break; } - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_ex_store_object_to_index @@ -381,20 +386,17 @@ acpi_ex_store ( ******************************************************************************/ static acpi_status -acpi_ex_store_object_to_index ( - union acpi_operand_object *source_desc, - union acpi_operand_object *index_desc, - struct acpi_walk_state *walk_state) +acpi_ex_store_object_to_index(union acpi_operand_object *source_desc, + union acpi_operand_object *index_desc, + struct acpi_walk_state *walk_state) { - acpi_status status = AE_OK; - union acpi_operand_object *obj_desc; - union acpi_operand_object *new_desc; - u8 value = 0; - u32 i; - - - ACPI_FUNCTION_TRACE ("ex_store_object_to_index"); + acpi_status status = AE_OK; + union acpi_operand_object *obj_desc; + union acpi_operand_object *new_desc; + u8 value = 0; + u32 i; + ACPI_FUNCTION_TRACE("ex_store_object_to_index"); /* * Destination must be a reference pointer, and @@ -413,19 +415,20 @@ acpi_ex_store_object_to_index ( */ obj_desc = *(index_desc->reference.where); - status = acpi_ut_copy_iobject_to_iobject (source_desc, &new_desc, walk_state); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = + acpi_ut_copy_iobject_to_iobject(source_desc, &new_desc, + walk_state); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } if (obj_desc) { /* Decrement reference count by the ref count of the parent package */ - for (i = 0; - i < ((union acpi_operand_object *) - index_desc->reference.object)->common.reference_count; - i++) { - acpi_ut_remove_reference (obj_desc); + for (i = 0; i < ((union acpi_operand_object *) + index_desc->reference.object)->common. + reference_count; i++) { + acpi_ut_remove_reference(obj_desc); } } @@ -433,16 +436,14 @@ acpi_ex_store_object_to_index ( /* Increment ref count by the ref count of the parent package-1 */ - for (i = 1; - i < ((union acpi_operand_object *) - index_desc->reference.object)->common.reference_count; - i++) { - acpi_ut_add_reference (new_desc); + for (i = 1; i < ((union acpi_operand_object *) + index_desc->reference.object)->common. + reference_count; i++) { + acpi_ut_add_reference(new_desc); } break; - case ACPI_TYPE_BUFFER_FIELD: /* @@ -460,16 +461,16 @@ acpi_ex_store_object_to_index ( * by the INDEX_OP code. */ obj_desc = index_desc->reference.object; - if ((ACPI_GET_OBJECT_TYPE (obj_desc) != ACPI_TYPE_BUFFER) && - (ACPI_GET_OBJECT_TYPE (obj_desc) != ACPI_TYPE_STRING)) { - return_ACPI_STATUS (AE_AML_OPERAND_TYPE); + if ((ACPI_GET_OBJECT_TYPE(obj_desc) != ACPI_TYPE_BUFFER) && + (ACPI_GET_OBJECT_TYPE(obj_desc) != ACPI_TYPE_STRING)) { + return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } /* * The assignment of the individual elements will be slightly * different for each source type. */ - switch (ACPI_GET_OBJECT_TYPE (source_desc)) { + switch (ACPI_GET_OBJECT_TYPE(source_desc)) { case ACPI_TYPE_INTEGER: /* Use the least-significant byte of the integer */ @@ -489,10 +490,11 @@ acpi_ex_store_object_to_index ( /* All other types are invalid */ - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Source must be Integer/Buffer/String type, not %s\n", - acpi_ut_get_object_type_name (source_desc))); - return_ACPI_STATUS (AE_AML_OPERAND_TYPE); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Source must be Integer/Buffer/String type, not %s\n", + acpi_ut_get_object_type_name + (source_desc))); + return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } /* Store the source value into the target buffer byte */ @@ -500,18 +502,16 @@ acpi_ex_store_object_to_index ( obj_desc->buffer.pointer[index_desc->reference.offset] = value; break; - default: - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Target is not a Package or buffer_field\n")); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Target is not a Package or buffer_field\n")); status = AE_AML_OPERAND_TYPE; break; } - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_ex_store_object_to_node @@ -539,37 +539,35 @@ acpi_ex_store_object_to_index ( ******************************************************************************/ acpi_status -acpi_ex_store_object_to_node ( - union acpi_operand_object *source_desc, - struct acpi_namespace_node *node, - struct acpi_walk_state *walk_state, - u8 implicit_conversion) +acpi_ex_store_object_to_node(union acpi_operand_object *source_desc, + struct acpi_namespace_node *node, + struct acpi_walk_state *walk_state, + u8 implicit_conversion) { - acpi_status status = AE_OK; - union acpi_operand_object *target_desc; - union acpi_operand_object *new_desc; - acpi_object_type target_type; - - - ACPI_FUNCTION_TRACE_PTR ("ex_store_object_to_node", source_desc); + acpi_status status = AE_OK; + union acpi_operand_object *target_desc; + union acpi_operand_object *new_desc; + acpi_object_type target_type; + ACPI_FUNCTION_TRACE_PTR("ex_store_object_to_node", source_desc); /* Get current type of the node, and object attached to Node */ - target_type = acpi_ns_get_type (node); - target_desc = acpi_ns_get_attached_object (node); + target_type = acpi_ns_get_type(node); + target_desc = acpi_ns_get_attached_object(node); - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Storing %p(%s) into node %p(%s)\n", - source_desc, acpi_ut_get_object_type_name (source_desc), - node, acpi_ut_get_type_name (target_type))); + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Storing %p(%s) into node %p(%s)\n", + source_desc, + acpi_ut_get_object_type_name(source_desc), node, + acpi_ut_get_type_name(target_type))); /* * Resolve the source object to an actual value * (If it is a reference object) */ - status = acpi_ex_resolve_object (&source_desc, target_type, walk_state); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ex_resolve_object(&source_desc, target_type, walk_state); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* If no implicit conversion, drop into the default case below */ @@ -590,11 +588,10 @@ acpi_ex_store_object_to_node ( /* For fields, copy the source data to the target field. */ - status = acpi_ex_write_data_to_field (source_desc, target_desc, - &walk_state->result_obj); + status = acpi_ex_write_data_to_field(source_desc, target_desc, + &walk_state->result_obj); break; - case ACPI_TYPE_INTEGER: case ACPI_TYPE_STRING: case ACPI_TYPE_BUFFER: @@ -605,10 +602,11 @@ acpi_ex_store_object_to_node ( * * Copy and/or convert the source object to a new target object */ - status = acpi_ex_store_object_to_object (source_desc, target_desc, - &new_desc, walk_state); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = + acpi_ex_store_object_to_object(source_desc, target_desc, + &new_desc, walk_state); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } if (new_desc != target_desc) { @@ -621,30 +619,33 @@ acpi_ex_store_object_to_node ( * has been performed such that the node/object type has been * changed. */ - status = acpi_ns_attach_object (node, new_desc, new_desc->common.type); - - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "Store %s into %s via Convert/Attach\n", - acpi_ut_get_object_type_name (source_desc), - acpi_ut_get_object_type_name (new_desc))); + status = + acpi_ns_attach_object(node, new_desc, + new_desc->common.type); + + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, + "Store %s into %s via Convert/Attach\n", + acpi_ut_get_object_type_name + (source_desc), + acpi_ut_get_object_type_name + (new_desc))); } break; - default: - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "Storing %s (%p) directly into node (%p) with no implicit conversion\n", - acpi_ut_get_object_type_name (source_desc), source_desc, node)); + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, + "Storing %s (%p) directly into node (%p) with no implicit conversion\n", + acpi_ut_get_object_type_name(source_desc), + source_desc, node)); /* No conversions for all other types. Just attach the source object */ - status = acpi_ns_attach_object (node, source_desc, - ACPI_GET_OBJECT_TYPE (source_desc)); + status = acpi_ns_attach_object(node, source_desc, + ACPI_GET_OBJECT_TYPE + (source_desc)); break; } - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - - diff --git a/drivers/acpi/executer/exstoren.c b/drivers/acpi/executer/exstoren.c index 433588ab432..382f63c14ea 100644 --- a/drivers/acpi/executer/exstoren.c +++ b/drivers/acpi/executer/exstoren.c @@ -43,15 +43,12 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include #include #include - #define _COMPONENT ACPI_EXECUTER - ACPI_MODULE_NAME ("exstoren") - +ACPI_MODULE_NAME("exstoren") /******************************************************************************* * @@ -67,19 +64,15 @@ * it and return the actual object in the source_desc_ptr. * ******************************************************************************/ - acpi_status -acpi_ex_resolve_object ( - union acpi_operand_object **source_desc_ptr, - acpi_object_type target_type, - struct acpi_walk_state *walk_state) +acpi_ex_resolve_object(union acpi_operand_object **source_desc_ptr, + acpi_object_type target_type, + struct acpi_walk_state *walk_state) { - union acpi_operand_object *source_desc = *source_desc_ptr; - acpi_status status = AE_OK; - - - ACPI_FUNCTION_TRACE ("ex_resolve_object"); + union acpi_operand_object *source_desc = *source_desc_ptr; + acpi_status status = AE_OK; + ACPI_FUNCTION_TRACE("ex_resolve_object"); /* Ensure we have a Target that can be stored to */ @@ -102,11 +95,14 @@ acpi_ex_resolve_object ( * are all essentially the same. This case handles the * "interchangeable" types Integer, String, and Buffer. */ - if (ACPI_GET_OBJECT_TYPE (source_desc) == ACPI_TYPE_LOCAL_REFERENCE) { + if (ACPI_GET_OBJECT_TYPE(source_desc) == + ACPI_TYPE_LOCAL_REFERENCE) { /* Resolve a reference object first */ - status = acpi_ex_resolve_to_value (source_desc_ptr, walk_state); - if (ACPI_FAILURE (status)) { + status = + acpi_ex_resolve_to_value(source_desc_ptr, + walk_state); + if (ACPI_FAILURE(status)) { break; } } @@ -119,31 +115,32 @@ acpi_ex_resolve_object ( /* Must have a Integer, Buffer, or String */ - if ((ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_INTEGER) && - (ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_BUFFER) && - (ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_STRING) && - !((ACPI_GET_OBJECT_TYPE (source_desc) == ACPI_TYPE_LOCAL_REFERENCE) && (source_desc->reference.opcode == AML_LOAD_OP))) { + if ((ACPI_GET_OBJECT_TYPE(source_desc) != ACPI_TYPE_INTEGER) && + (ACPI_GET_OBJECT_TYPE(source_desc) != ACPI_TYPE_BUFFER) && + (ACPI_GET_OBJECT_TYPE(source_desc) != ACPI_TYPE_STRING) && + !((ACPI_GET_OBJECT_TYPE(source_desc) == + ACPI_TYPE_LOCAL_REFERENCE) + && (source_desc->reference.opcode == AML_LOAD_OP))) { /* Conversion successful but still not a valid type */ - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Cannot assign type %s to %s (must be type Int/Str/Buf)\n", - acpi_ut_get_object_type_name (source_desc), - acpi_ut_get_type_name (target_type))); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Cannot assign type %s to %s (must be type Int/Str/Buf)\n", + acpi_ut_get_object_type_name + (source_desc), + acpi_ut_get_type_name(target_type))); status = AE_AML_OPERAND_TYPE; } break; - case ACPI_TYPE_LOCAL_ALIAS: case ACPI_TYPE_LOCAL_METHOD_ALIAS: /* Aliases are resolved by acpi_ex_prep_operands */ - ACPI_REPORT_ERROR (("Store into Alias - should never happen\n")); + ACPI_REPORT_ERROR(("Store into Alias - should never happen\n")); status = AE_AML_INTERNAL; break; - case ACPI_TYPE_PACKAGE: default: @@ -154,10 +151,9 @@ acpi_ex_resolve_object ( break; } - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_ex_store_object_to_object @@ -194,18 +190,15 @@ acpi_ex_resolve_object ( ******************************************************************************/ acpi_status -acpi_ex_store_object_to_object ( - union acpi_operand_object *source_desc, - union acpi_operand_object *dest_desc, - union acpi_operand_object **new_desc, - struct acpi_walk_state *walk_state) +acpi_ex_store_object_to_object(union acpi_operand_object *source_desc, + union acpi_operand_object *dest_desc, + union acpi_operand_object **new_desc, + struct acpi_walk_state *walk_state) { - union acpi_operand_object *actual_src_desc; - acpi_status status = AE_OK; - - - ACPI_FUNCTION_TRACE_PTR ("ex_store_object_to_object", source_desc); + union acpi_operand_object *actual_src_desc; + acpi_status status = AE_OK; + ACPI_FUNCTION_TRACE_PTR("ex_store_object_to_object", source_desc); actual_src_desc = source_desc; if (!dest_desc) { @@ -214,11 +207,14 @@ acpi_ex_store_object_to_object ( * package element), so we can simply copy the source object * creating a new destination object */ - status = acpi_ut_copy_iobject_to_iobject (actual_src_desc, new_desc, walk_state); - return_ACPI_STATUS (status); + status = + acpi_ut_copy_iobject_to_iobject(actual_src_desc, new_desc, + walk_state); + return_ACPI_STATUS(status); } - if (ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_GET_OBJECT_TYPE (dest_desc)) { + if (ACPI_GET_OBJECT_TYPE(source_desc) != + ACPI_GET_OBJECT_TYPE(dest_desc)) { /* * The source type does not match the type of the destination. * Perform the "implicit conversion" of the source to the current type @@ -228,10 +224,13 @@ acpi_ex_store_object_to_object ( * Otherwise, actual_src_desc is a temporary object to hold the * converted object. */ - status = acpi_ex_convert_to_target_type (ACPI_GET_OBJECT_TYPE (dest_desc), - source_desc, &actual_src_desc, walk_state); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = + acpi_ex_convert_to_target_type(ACPI_GET_OBJECT_TYPE + (dest_desc), source_desc, + &actual_src_desc, + walk_state); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } if (source_desc == actual_src_desc) { @@ -240,7 +239,7 @@ acpi_ex_store_object_to_object ( * new object. */ *new_desc = source_desc; - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } } @@ -248,38 +247,42 @@ acpi_ex_store_object_to_object ( * We now have two objects of identical types, and we can perform a * copy of the *value* of the source object. */ - switch (ACPI_GET_OBJECT_TYPE (dest_desc)) { + switch (ACPI_GET_OBJECT_TYPE(dest_desc)) { case ACPI_TYPE_INTEGER: dest_desc->integer.value = actual_src_desc->integer.value; /* Truncate value if we are executing from a 32-bit ACPI table */ - acpi_ex_truncate_for32bit_table (dest_desc); + acpi_ex_truncate_for32bit_table(dest_desc); break; case ACPI_TYPE_STRING: - status = acpi_ex_store_string_to_string (actual_src_desc, dest_desc); + status = + acpi_ex_store_string_to_string(actual_src_desc, dest_desc); break; case ACPI_TYPE_BUFFER: - status = acpi_ex_store_buffer_to_buffer (actual_src_desc, dest_desc); + status = + acpi_ex_store_buffer_to_buffer(actual_src_desc, dest_desc); break; case ACPI_TYPE_PACKAGE: - status = acpi_ut_copy_iobject_to_iobject (actual_src_desc, &dest_desc, - walk_state); + status = + acpi_ut_copy_iobject_to_iobject(actual_src_desc, &dest_desc, + walk_state); break; default: /* * All other types come here. */ - ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Store into type %s not implemented\n", - acpi_ut_get_object_type_name (dest_desc))); + ACPI_DEBUG_PRINT((ACPI_DB_WARN, + "Store into type %s not implemented\n", + acpi_ut_get_object_type_name(dest_desc))); status = AE_NOT_IMPLEMENTED; break; @@ -288,11 +291,9 @@ acpi_ex_store_object_to_object ( if (actual_src_desc != source_desc) { /* Delete the intermediate (temporary) source object */ - acpi_ut_remove_reference (actual_src_desc); + acpi_ut_remove_reference(actual_src_desc); } *new_desc = dest_desc; - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - - diff --git a/drivers/acpi/executer/exstorob.c b/drivers/acpi/executer/exstorob.c index 12d1527669c..c4ff654a669 100644 --- a/drivers/acpi/executer/exstorob.c +++ b/drivers/acpi/executer/exstorob.c @@ -42,14 +42,11 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include #include - #define _COMPONENT ACPI_EXECUTER - ACPI_MODULE_NAME ("exstorob") - +ACPI_MODULE_NAME("exstorob") /******************************************************************************* * @@ -63,18 +60,14 @@ * DESCRIPTION: Copy a buffer object to another buffer object. * ******************************************************************************/ - acpi_status -acpi_ex_store_buffer_to_buffer ( - union acpi_operand_object *source_desc, - union acpi_operand_object *target_desc) +acpi_ex_store_buffer_to_buffer(union acpi_operand_object *source_desc, + union acpi_operand_object *target_desc) { - u32 length; - u8 *buffer; - - - ACPI_FUNCTION_TRACE_PTR ("ex_store_buffer_to_buffer", source_desc); + u32 length; + u8 *buffer; + ACPI_FUNCTION_TRACE_PTR("ex_store_buffer_to_buffer", source_desc); /* We know that source_desc is a buffer by now */ @@ -86,10 +79,10 @@ acpi_ex_store_buffer_to_buffer ( * allocate a new buffer of the proper length */ if ((target_desc->buffer.length == 0) || - (target_desc->common.flags & AOPOBJ_STATIC_POINTER)) { - target_desc->buffer.pointer = ACPI_MEM_ALLOCATE (length); + (target_desc->common.flags & AOPOBJ_STATIC_POINTER)) { + target_desc->buffer.pointer = ACPI_MEM_ALLOCATE(length); if (!target_desc->buffer.pointer) { - return_ACPI_STATUS (AE_NO_MEMORY); + return_ACPI_STATUS(AE_NO_MEMORY); } target_desc->buffer.length = length; @@ -100,8 +93,9 @@ acpi_ex_store_buffer_to_buffer ( if (length <= target_desc->buffer.length) { /* Clear existing buffer and copy in the new one */ - ACPI_MEMSET (target_desc->buffer.pointer, 0, target_desc->buffer.length); - ACPI_MEMCPY (target_desc->buffer.pointer, buffer, length); + ACPI_MEMSET(target_desc->buffer.pointer, 0, + target_desc->buffer.length); + ACPI_MEMCPY(target_desc->buffer.pointer, buffer, length); #ifdef ACPI_OBSOLETE_BEHAVIOR /* @@ -124,26 +118,24 @@ acpi_ex_store_buffer_to_buffer ( target_desc->buffer.length = length; } #endif - } - else { + } else { /* Truncate the source, copy only what will fit */ - ACPI_MEMCPY (target_desc->buffer.pointer, buffer, - target_desc->buffer.length); + ACPI_MEMCPY(target_desc->buffer.pointer, buffer, + target_desc->buffer.length); - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "Truncating source buffer from %X to %X\n", - length, target_desc->buffer.length)); + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "Truncating source buffer from %X to %X\n", + length, target_desc->buffer.length)); } /* Copy flags */ target_desc->buffer.flags = source_desc->buffer.flags; target_desc->common.flags &= ~AOPOBJ_STATIC_POINTER; - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_ex_store_string_to_string @@ -158,16 +150,13 @@ acpi_ex_store_buffer_to_buffer ( ******************************************************************************/ acpi_status -acpi_ex_store_string_to_string ( - union acpi_operand_object *source_desc, - union acpi_operand_object *target_desc) +acpi_ex_store_string_to_string(union acpi_operand_object *source_desc, + union acpi_operand_object *target_desc) { - u32 length; - u8 *buffer; - - - ACPI_FUNCTION_TRACE_PTR ("ex_store_string_to_string", source_desc); + u32 length; + u8 *buffer; + ACPI_FUNCTION_TRACE_PTR("ex_store_string_to_string", source_desc); /* We know that source_desc is a string by now */ @@ -179,41 +168,38 @@ acpi_ex_store_string_to_string ( * pointer is not a static pointer (part of an ACPI table) */ if ((length < target_desc->string.length) && - (!(target_desc->common.flags & AOPOBJ_STATIC_POINTER))) { + (!(target_desc->common.flags & AOPOBJ_STATIC_POINTER))) { /* * String will fit in existing non-static buffer. * Clear old string and copy in the new one */ - ACPI_MEMSET (target_desc->string.pointer, 0, - (acpi_size) target_desc->string.length + 1); - ACPI_MEMCPY (target_desc->string.pointer, buffer, length); - } - else { + ACPI_MEMSET(target_desc->string.pointer, 0, + (acpi_size) target_desc->string.length + 1); + ACPI_MEMCPY(target_desc->string.pointer, buffer, length); + } else { /* * Free the current buffer, then allocate a new buffer * large enough to hold the value */ if (target_desc->string.pointer && - (!(target_desc->common.flags & AOPOBJ_STATIC_POINTER))) { + (!(target_desc->common.flags & AOPOBJ_STATIC_POINTER))) { /* Only free if not a pointer into the DSDT */ - ACPI_MEM_FREE (target_desc->string.pointer); + ACPI_MEM_FREE(target_desc->string.pointer); } - target_desc->string.pointer = ACPI_MEM_CALLOCATE ( - (acpi_size) length + 1); + target_desc->string.pointer = ACPI_MEM_CALLOCATE((acpi_size) + length + 1); if (!target_desc->string.pointer) { - return_ACPI_STATUS (AE_NO_MEMORY); + return_ACPI_STATUS(AE_NO_MEMORY); } target_desc->common.flags &= ~AOPOBJ_STATIC_POINTER; - ACPI_MEMCPY (target_desc->string.pointer, buffer, length); + ACPI_MEMCPY(target_desc->string.pointer, buffer, length); } /* Set the new target length */ target_desc->string.length = length; - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - - diff --git a/drivers/acpi/executer/exsystem.c b/drivers/acpi/executer/exsystem.c index cafa702108d..8a88b841237 100644 --- a/drivers/acpi/executer/exsystem.c +++ b/drivers/acpi/executer/exsystem.c @@ -42,14 +42,12 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include #include #include #define _COMPONENT ACPI_EXECUTER - ACPI_MODULE_NAME ("exsystem") - +ACPI_MODULE_NAME("exsystem") /******************************************************************************* * @@ -65,49 +63,42 @@ * interpreter is released. * ******************************************************************************/ - -acpi_status -acpi_ex_system_wait_semaphore ( - acpi_handle semaphore, - u16 timeout) +acpi_status acpi_ex_system_wait_semaphore(acpi_handle semaphore, u16 timeout) { - acpi_status status; - acpi_status status2; - + acpi_status status; + acpi_status status2; - ACPI_FUNCTION_TRACE ("ex_system_wait_semaphore"); + ACPI_FUNCTION_TRACE("ex_system_wait_semaphore"); - - status = acpi_os_wait_semaphore (semaphore, 1, 0); - if (ACPI_SUCCESS (status)) { - return_ACPI_STATUS (status); + status = acpi_os_wait_semaphore(semaphore, 1, 0); + if (ACPI_SUCCESS(status)) { + return_ACPI_STATUS(status); } if (status == AE_TIME) { /* We must wait, so unlock the interpreter */ - acpi_ex_exit_interpreter (); + acpi_ex_exit_interpreter(); - status = acpi_os_wait_semaphore (semaphore, 1, timeout); + status = acpi_os_wait_semaphore(semaphore, 1, timeout); - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "*** Thread awake after blocking, %s\n", - acpi_format_exception (status))); + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, + "*** Thread awake after blocking, %s\n", + acpi_format_exception(status))); /* Reacquire the interpreter */ - status2 = acpi_ex_enter_interpreter (); - if (ACPI_FAILURE (status2)) { + status2 = acpi_ex_enter_interpreter(); + if (ACPI_FAILURE(status2)) { /* Report fatal error, could not acquire interpreter */ - return_ACPI_STATUS (status2); + return_ACPI_STATUS(status2); } } - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_ex_system_do_stall @@ -125,35 +116,29 @@ acpi_ex_system_wait_semaphore ( * ******************************************************************************/ -acpi_status -acpi_ex_system_do_stall ( - u32 how_long) +acpi_status acpi_ex_system_do_stall(u32 how_long) { - acpi_status status = AE_OK; - + acpi_status status = AE_OK; - ACPI_FUNCTION_ENTRY (); + ACPI_FUNCTION_ENTRY(); - - if (how_long > 255) /* 255 microseconds */ { + if (how_long > 255) { /* 255 microseconds */ /* * Longer than 255 usec, this is an error * * (ACPI specifies 100 usec as max, but this gives some slack in * order to support existing BIOSs) */ - ACPI_REPORT_ERROR (("Stall: Time parameter is too large (%d)\n", - how_long)); + ACPI_REPORT_ERROR(("Stall: Time parameter is too large (%d)\n", + how_long)); status = AE_AML_OPERAND_VALUE; - } - else { - acpi_os_stall (how_long); + } else { + acpi_os_stall(how_long); } return (status); } - /******************************************************************************* * * FUNCTION: acpi_ex_system_do_suspend @@ -167,29 +152,24 @@ acpi_ex_system_do_stall ( * ******************************************************************************/ -acpi_status -acpi_ex_system_do_suspend ( - acpi_integer how_long) +acpi_status acpi_ex_system_do_suspend(acpi_integer how_long) { - acpi_status status; - - - ACPI_FUNCTION_ENTRY (); + acpi_status status; + ACPI_FUNCTION_ENTRY(); /* Since this thread will sleep, we must release the interpreter */ - acpi_ex_exit_interpreter (); + acpi_ex_exit_interpreter(); - acpi_os_sleep (how_long); + acpi_os_sleep(how_long); /* And now we must get the interpreter again */ - status = acpi_ex_enter_interpreter (); + status = acpi_ex_enter_interpreter(); return (status); } - /******************************************************************************* * * FUNCTION: acpi_ex_system_acquire_mutex @@ -206,33 +186,30 @@ acpi_ex_system_do_suspend ( ******************************************************************************/ acpi_status -acpi_ex_system_acquire_mutex ( - union acpi_operand_object *time_desc, - union acpi_operand_object *obj_desc) +acpi_ex_system_acquire_mutex(union acpi_operand_object * time_desc, + union acpi_operand_object * obj_desc) { - acpi_status status = AE_OK; - - - ACPI_FUNCTION_TRACE_PTR ("ex_system_acquire_mutex", obj_desc); + acpi_status status = AE_OK; + ACPI_FUNCTION_TRACE_PTR("ex_system_acquire_mutex", obj_desc); if (!obj_desc) { - return_ACPI_STATUS (AE_BAD_PARAMETER); + return_ACPI_STATUS(AE_BAD_PARAMETER); } /* Support for the _GL_ Mutex object -- go get the global lock */ if (obj_desc->mutex.semaphore == acpi_gbl_global_lock_semaphore) { - status = acpi_ev_acquire_global_lock ((u16) time_desc->integer.value); - return_ACPI_STATUS (status); + status = + acpi_ev_acquire_global_lock((u16) time_desc->integer.value); + return_ACPI_STATUS(status); } - status = acpi_ex_system_wait_semaphore (obj_desc->mutex.semaphore, - (u16) time_desc->integer.value); - return_ACPI_STATUS (status); + status = acpi_ex_system_wait_semaphore(obj_desc->mutex.semaphore, + (u16) time_desc->integer.value); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_ex_system_release_mutex @@ -248,32 +225,27 @@ acpi_ex_system_acquire_mutex ( * ******************************************************************************/ -acpi_status -acpi_ex_system_release_mutex ( - union acpi_operand_object *obj_desc) +acpi_status acpi_ex_system_release_mutex(union acpi_operand_object *obj_desc) { - acpi_status status = AE_OK; - - - ACPI_FUNCTION_TRACE ("ex_system_release_mutex"); + acpi_status status = AE_OK; + ACPI_FUNCTION_TRACE("ex_system_release_mutex"); if (!obj_desc) { - return_ACPI_STATUS (AE_BAD_PARAMETER); + return_ACPI_STATUS(AE_BAD_PARAMETER); } /* Support for the _GL_ Mutex object -- release the global lock */ if (obj_desc->mutex.semaphore == acpi_gbl_global_lock_semaphore) { - status = acpi_ev_release_global_lock (); - return_ACPI_STATUS (status); + status = acpi_ev_release_global_lock(); + return_ACPI_STATUS(status); } - status = acpi_os_signal_semaphore (obj_desc->mutex.semaphore, 1); - return_ACPI_STATUS (status); + status = acpi_os_signal_semaphore(obj_desc->mutex.semaphore, 1); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_ex_system_signal_event @@ -287,24 +259,19 @@ acpi_ex_system_release_mutex ( * ******************************************************************************/ -acpi_status -acpi_ex_system_signal_event ( - union acpi_operand_object *obj_desc) +acpi_status acpi_ex_system_signal_event(union acpi_operand_object *obj_desc) { - acpi_status status = AE_OK; - - - ACPI_FUNCTION_TRACE ("ex_system_signal_event"); + acpi_status status = AE_OK; + ACPI_FUNCTION_TRACE("ex_system_signal_event"); if (obj_desc) { - status = acpi_os_signal_semaphore (obj_desc->event.semaphore, 1); + status = acpi_os_signal_semaphore(obj_desc->event.semaphore, 1); } - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_ex_system_wait_event @@ -321,25 +288,23 @@ acpi_ex_system_signal_event ( ******************************************************************************/ acpi_status -acpi_ex_system_wait_event ( - union acpi_operand_object *time_desc, - union acpi_operand_object *obj_desc) +acpi_ex_system_wait_event(union acpi_operand_object *time_desc, + union acpi_operand_object *obj_desc) { - acpi_status status = AE_OK; - - - ACPI_FUNCTION_TRACE ("ex_system_wait_event"); + acpi_status status = AE_OK; + ACPI_FUNCTION_TRACE("ex_system_wait_event"); if (obj_desc) { - status = acpi_ex_system_wait_semaphore (obj_desc->event.semaphore, - (u16) time_desc->integer.value); + status = + acpi_ex_system_wait_semaphore(obj_desc->event.semaphore, + (u16) time_desc->integer. + value); } - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_ex_system_reset_event @@ -352,27 +317,23 @@ acpi_ex_system_wait_event ( * ******************************************************************************/ -acpi_status -acpi_ex_system_reset_event ( - union acpi_operand_object *obj_desc) +acpi_status acpi_ex_system_reset_event(union acpi_operand_object *obj_desc) { - acpi_status status = AE_OK; - void *temp_semaphore; - - - ACPI_FUNCTION_ENTRY (); + acpi_status status = AE_OK; + void *temp_semaphore; + ACPI_FUNCTION_ENTRY(); /* * We are going to simply delete the existing semaphore and * create a new one! */ - status = acpi_os_create_semaphore (ACPI_NO_UNIT_LIMIT, 0, &temp_semaphore); - if (ACPI_SUCCESS (status)) { - (void) acpi_os_delete_semaphore (obj_desc->event.semaphore); + status = + acpi_os_create_semaphore(ACPI_NO_UNIT_LIMIT, 0, &temp_semaphore); + if (ACPI_SUCCESS(status)) { + (void)acpi_os_delete_semaphore(obj_desc->event.semaphore); obj_desc->event.semaphore = temp_semaphore; } return (status); } - diff --git a/drivers/acpi/executer/exutils.c b/drivers/acpi/executer/exutils.c index d00b0dcba96..1ee79d8c8f8 100644 --- a/drivers/acpi/executer/exutils.c +++ b/drivers/acpi/executer/exutils.c @@ -42,7 +42,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ - /* * DEFINE_AML_GLOBALS is tested in amlcode.h * to determine whether certain global names should be "defined" or only @@ -65,15 +64,10 @@ #include #define _COMPONENT ACPI_EXECUTER - ACPI_MODULE_NAME ("exutils") +ACPI_MODULE_NAME("exutils") /* Local prototypes */ - -static u32 -acpi_ex_digits_needed ( - acpi_integer value, - u32 base); - +static u32 acpi_ex_digits_needed(acpi_integer value, u32 base); #ifndef ACPI_NO_METHOD_EXECUTION /******************************************************************************* @@ -89,24 +83,20 @@ acpi_ex_digits_needed ( * ******************************************************************************/ -acpi_status -acpi_ex_enter_interpreter ( - void) +acpi_status acpi_ex_enter_interpreter(void) { - acpi_status status; - - ACPI_FUNCTION_TRACE ("ex_enter_interpreter"); + acpi_status status; + ACPI_FUNCTION_TRACE("ex_enter_interpreter"); - status = acpi_ut_acquire_mutex (ACPI_MTX_EXECUTE); - if (ACPI_FAILURE (status)) { - ACPI_REPORT_ERROR (("Could not acquire interpreter mutex\n")); + status = acpi_ut_acquire_mutex(ACPI_MTX_EXECUTE); + if (ACPI_FAILURE(status)) { + ACPI_REPORT_ERROR(("Could not acquire interpreter mutex\n")); } - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_ex_exit_interpreter @@ -129,25 +119,20 @@ acpi_ex_enter_interpreter ( * ******************************************************************************/ -void -acpi_ex_exit_interpreter ( - void) +void acpi_ex_exit_interpreter(void) { - acpi_status status; - - - ACPI_FUNCTION_TRACE ("ex_exit_interpreter"); + acpi_status status; + ACPI_FUNCTION_TRACE("ex_exit_interpreter"); - status = acpi_ut_release_mutex (ACPI_MTX_EXECUTE); - if (ACPI_FAILURE (status)) { - ACPI_REPORT_ERROR (("Could not release interpreter mutex\n")); + status = acpi_ut_release_mutex(ACPI_MTX_EXECUTE); + if (ACPI_FAILURE(status)) { + ACPI_REPORT_ERROR(("Could not release interpreter mutex\n")); } return_VOID; } - /******************************************************************************* * * FUNCTION: acpi_ex_truncate_for32bit_table @@ -161,20 +146,17 @@ acpi_ex_exit_interpreter ( * ******************************************************************************/ -void -acpi_ex_truncate_for32bit_table ( - union acpi_operand_object *obj_desc) +void acpi_ex_truncate_for32bit_table(union acpi_operand_object *obj_desc) { - ACPI_FUNCTION_ENTRY (); - + ACPI_FUNCTION_ENTRY(); /* * Object must be a valid number and we must be executing * a control method */ if ((!obj_desc) || - (ACPI_GET_OBJECT_TYPE (obj_desc) != ACPI_TYPE_INTEGER)) { + (ACPI_GET_OBJECT_TYPE(obj_desc) != ACPI_TYPE_INTEGER)) { return; } @@ -187,7 +169,6 @@ acpi_ex_truncate_for32bit_table ( } } - /******************************************************************************* * * FUNCTION: acpi_ex_acquire_global_lock @@ -203,37 +184,31 @@ acpi_ex_truncate_for32bit_table ( * ******************************************************************************/ -u8 -acpi_ex_acquire_global_lock ( - u32 field_flags) +u8 acpi_ex_acquire_global_lock(u32 field_flags) { - u8 locked = FALSE; - acpi_status status; - - - ACPI_FUNCTION_TRACE ("ex_acquire_global_lock"); + u8 locked = FALSE; + acpi_status status; + ACPI_FUNCTION_TRACE("ex_acquire_global_lock"); /* Only attempt lock if the always_lock bit is set */ if (field_flags & AML_FIELD_LOCK_RULE_MASK) { /* We should attempt to get the lock, wait forever */ - status = acpi_ev_acquire_global_lock (ACPI_WAIT_FOREVER); - if (ACPI_SUCCESS (status)) { + status = acpi_ev_acquire_global_lock(ACPI_WAIT_FOREVER); + if (ACPI_SUCCESS(status)) { locked = TRUE; - } - else { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Could not acquire Global Lock, %s\n", - acpi_format_exception (status))); + } else { + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Could not acquire Global Lock, %s\n", + acpi_format_exception(status))); } } - return_VALUE (locked); + return_VALUE(locked); } - /******************************************************************************* * * FUNCTION: acpi_ex_release_global_lock @@ -247,34 +222,28 @@ acpi_ex_acquire_global_lock ( * ******************************************************************************/ -void -acpi_ex_release_global_lock ( - u8 locked_by_me) +void acpi_ex_release_global_lock(u8 locked_by_me) { - acpi_status status; - - - ACPI_FUNCTION_TRACE ("ex_release_global_lock"); + acpi_status status; + ACPI_FUNCTION_TRACE("ex_release_global_lock"); /* Only attempt unlock if the caller locked it */ if (locked_by_me) { /* OK, now release the lock */ - status = acpi_ev_release_global_lock (); - if (ACPI_FAILURE (status)) { + status = acpi_ev_release_global_lock(); + if (ACPI_FAILURE(status)) { /* Report the error, but there isn't much else we can do */ - ACPI_REPORT_ERROR (("Could not release ACPI Global Lock, %s\n", - acpi_format_exception (status))); + ACPI_REPORT_ERROR(("Could not release ACPI Global Lock, %s\n", acpi_format_exception(status))); } } return_VOID; } - /******************************************************************************* * * FUNCTION: acpi_ex_digits_needed @@ -289,22 +258,17 @@ acpi_ex_release_global_lock ( * ******************************************************************************/ -static u32 -acpi_ex_digits_needed ( - acpi_integer value, - u32 base) +static u32 acpi_ex_digits_needed(acpi_integer value, u32 base) { - u32 num_digits; - acpi_integer current_value; - - - ACPI_FUNCTION_TRACE ("ex_digits_needed"); + u32 num_digits; + acpi_integer current_value; + ACPI_FUNCTION_TRACE("ex_digits_needed"); /* acpi_integer is unsigned, so we don't worry about a '-' prefix */ if (value == 0) { - return_VALUE (1); + return_VALUE(1); } current_value = value; @@ -313,14 +277,14 @@ acpi_ex_digits_needed ( /* Count the digits in the requested base */ while (current_value) { - (void) acpi_ut_short_divide (current_value, base, ¤t_value, NULL); + (void)acpi_ut_short_divide(current_value, base, ¤t_value, + NULL); num_digits++; } - return_VALUE (num_digits); + return_VALUE(num_digits); } - /******************************************************************************* * * FUNCTION: acpi_ex_eisa_id_to_string @@ -334,32 +298,26 @@ acpi_ex_digits_needed ( * ******************************************************************************/ -void -acpi_ex_eisa_id_to_string ( - u32 numeric_id, - char *out_string) +void acpi_ex_eisa_id_to_string(u32 numeric_id, char *out_string) { - u32 eisa_id; - - - ACPI_FUNCTION_ENTRY (); + u32 eisa_id; + ACPI_FUNCTION_ENTRY(); /* Swap ID to big-endian to get contiguous bits */ - eisa_id = acpi_ut_dword_byte_swap (numeric_id); + eisa_id = acpi_ut_dword_byte_swap(numeric_id); - out_string[0] = (char) ('@' + (((unsigned long) eisa_id >> 26) & 0x1f)); - out_string[1] = (char) ('@' + ((eisa_id >> 21) & 0x1f)); - out_string[2] = (char) ('@' + ((eisa_id >> 16) & 0x1f)); - out_string[3] = acpi_ut_hex_to_ascii_char ((acpi_integer) eisa_id, 12); - out_string[4] = acpi_ut_hex_to_ascii_char ((acpi_integer) eisa_id, 8); - out_string[5] = acpi_ut_hex_to_ascii_char ((acpi_integer) eisa_id, 4); - out_string[6] = acpi_ut_hex_to_ascii_char ((acpi_integer) eisa_id, 0); + out_string[0] = (char)('@' + (((unsigned long)eisa_id >> 26) & 0x1f)); + out_string[1] = (char)('@' + ((eisa_id >> 21) & 0x1f)); + out_string[2] = (char)('@' + ((eisa_id >> 16) & 0x1f)); + out_string[3] = acpi_ut_hex_to_ascii_char((acpi_integer) eisa_id, 12); + out_string[4] = acpi_ut_hex_to_ascii_char((acpi_integer) eisa_id, 8); + out_string[5] = acpi_ut_hex_to_ascii_char((acpi_integer) eisa_id, 4); + out_string[6] = acpi_ut_hex_to_ascii_char((acpi_integer) eisa_id, 0); out_string[7] = 0; } - /******************************************************************************* * * FUNCTION: acpi_ex_unsigned_integer_to_string @@ -374,25 +332,20 @@ acpi_ex_eisa_id_to_string ( * ******************************************************************************/ -void -acpi_ex_unsigned_integer_to_string ( - acpi_integer value, - char *out_string) +void acpi_ex_unsigned_integer_to_string(acpi_integer value, char *out_string) { - u32 count; - u32 digits_needed; - u32 remainder; - - - ACPI_FUNCTION_ENTRY (); + u32 count; + u32 digits_needed; + u32 remainder; + ACPI_FUNCTION_ENTRY(); - digits_needed = acpi_ex_digits_needed (value, 10); + digits_needed = acpi_ex_digits_needed(value, 10); out_string[digits_needed] = 0; for (count = digits_needed; count > 0; count--) { - (void) acpi_ut_short_divide (value, 10, &value, &remainder); - out_string[count-1] = (char) ('0' + remainder);\ + (void)acpi_ut_short_divide(value, 10, &value, &remainder); + out_string[count - 1] = (char)('0' + remainder); } } diff --git a/drivers/acpi/fan.c b/drivers/acpi/fan.c index 2ee1d061013..e8165c4f162 100644 --- a/drivers/acpi/fan.c +++ b/drivers/acpi/fan.c @@ -34,49 +34,45 @@ #include #include - #define ACPI_FAN_COMPONENT 0x00200000 #define ACPI_FAN_CLASS "fan" #define ACPI_FAN_DRIVER_NAME "ACPI Fan Driver" #define ACPI_FAN_FILE_STATE "state" #define _COMPONENT ACPI_FAN_COMPONENT -ACPI_MODULE_NAME ("acpi_fan") +ACPI_MODULE_NAME("acpi_fan") -MODULE_AUTHOR("Paul Diefenbaugh"); + MODULE_AUTHOR("Paul Diefenbaugh"); MODULE_DESCRIPTION(ACPI_FAN_DRIVER_NAME); MODULE_LICENSE("GPL"); -static int acpi_fan_add (struct acpi_device *device); -static int acpi_fan_remove (struct acpi_device *device, int type); +static int acpi_fan_add(struct acpi_device *device); +static int acpi_fan_remove(struct acpi_device *device, int type); static struct acpi_driver acpi_fan_driver = { - .name = ACPI_FAN_DRIVER_NAME, - .class = ACPI_FAN_CLASS, - .ids = "PNP0C0B", - .ops = { - .add = acpi_fan_add, - .remove = acpi_fan_remove, - }, + .name = ACPI_FAN_DRIVER_NAME, + .class = ACPI_FAN_CLASS, + .ids = "PNP0C0B", + .ops = { + .add = acpi_fan_add, + .remove = acpi_fan_remove, + }, }; struct acpi_fan { - acpi_handle handle; + acpi_handle handle; }; - /* -------------------------------------------------------------------------- FS Interface (/proc) -------------------------------------------------------------------------- */ -static struct proc_dir_entry *acpi_fan_dir; - +static struct proc_dir_entry *acpi_fan_dir; -static int -acpi_fan_read_state(struct seq_file *seq, void *offset) +static int acpi_fan_read_state(struct seq_file *seq, void *offset) { - struct acpi_fan *fan = seq->private; - int state = 0; + struct acpi_fan *fan = seq->private; + int state = 0; ACPI_FUNCTION_TRACE("acpi_fan_read_state"); @@ -85,7 +81,7 @@ acpi_fan_read_state(struct seq_file *seq, void *offset) seq_printf(seq, "status: ERROR\n"); else seq_printf(seq, "status: %s\n", - !state?"on":"off"); + !state ? "on" : "off"); } return_VALUE(0); } @@ -96,26 +92,26 @@ static int acpi_fan_state_open_fs(struct inode *inode, struct file *file) } static ssize_t -acpi_fan_write_state(struct file *file, const char __user *buffer, - size_t count, loff_t *ppos) +acpi_fan_write_state(struct file *file, const char __user * buffer, + size_t count, loff_t * ppos) { - int result = 0; - struct seq_file *m = (struct seq_file *)file->private_data; - struct acpi_fan *fan = (struct acpi_fan *) m->private; - char state_string[12] = {'\0'}; + int result = 0; + struct seq_file *m = (struct seq_file *)file->private_data; + struct acpi_fan *fan = (struct acpi_fan *)m->private; + char state_string[12] = { '\0' }; ACPI_FUNCTION_TRACE("acpi_fan_write_state"); if (!fan || (count > sizeof(state_string) - 1)) return_VALUE(-EINVAL); - + if (copy_from_user(state_string, buffer, count)) return_VALUE(-EFAULT); - + state_string[count] = '\0'; - - result = acpi_bus_set_power(fan->handle, - simple_strtoul(state_string, NULL, 0)); + + result = acpi_bus_set_power(fan->handle, + simple_strtoul(state_string, NULL, 0)); if (result) return_VALUE(result); @@ -123,18 +119,17 @@ acpi_fan_write_state(struct file *file, const char __user *buffer, } static struct file_operations acpi_fan_state_ops = { - .open = acpi_fan_state_open_fs, - .read = seq_read, - .write = acpi_fan_write_state, - .llseek = seq_lseek, - .release = single_release, + .open = acpi_fan_state_open_fs, + .read = seq_read, + .write = acpi_fan_write_state, + .llseek = seq_lseek, + .release = single_release, .owner = THIS_MODULE, }; -static int -acpi_fan_add_fs(struct acpi_device *device) +static int acpi_fan_add_fs(struct acpi_device *device) { - struct proc_dir_entry *entry = NULL; + struct proc_dir_entry *entry = NULL; ACPI_FUNCTION_TRACE("acpi_fan_add_fs"); @@ -143,7 +138,7 @@ acpi_fan_add_fs(struct acpi_device *device) if (!acpi_device_dir(device)) { acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), - acpi_fan_dir); + acpi_fan_dir); if (!acpi_device_dir(device)) return_VALUE(-ENODEV); acpi_device_dir(device)->owner = THIS_MODULE; @@ -151,11 +146,12 @@ acpi_fan_add_fs(struct acpi_device *device) /* 'status' [R/W] */ entry = create_proc_entry(ACPI_FAN_FILE_STATE, - S_IFREG|S_IRUGO|S_IWUSR, acpi_device_dir(device)); + S_IFREG | S_IRUGO | S_IWUSR, + acpi_device_dir(device)); if (!entry) ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create '%s' fs entry\n", - ACPI_FAN_FILE_STATE)); + "Unable to create '%s' fs entry\n", + ACPI_FAN_FILE_STATE)); else { entry->proc_fops = &acpi_fan_state_ops; entry->data = acpi_driver_data(device); @@ -165,15 +161,12 @@ acpi_fan_add_fs(struct acpi_device *device) return_VALUE(0); } - -static int -acpi_fan_remove_fs(struct acpi_device *device) +static int acpi_fan_remove_fs(struct acpi_device *device) { ACPI_FUNCTION_TRACE("acpi_fan_remove_fs"); if (acpi_device_dir(device)) { - remove_proc_entry(ACPI_FAN_FILE_STATE, - acpi_device_dir(device)); + remove_proc_entry(ACPI_FAN_FILE_STATE, acpi_device_dir(device)); remove_proc_entry(acpi_device_bid(device), acpi_fan_dir); acpi_device_dir(device) = NULL; } @@ -181,17 +174,15 @@ acpi_fan_remove_fs(struct acpi_device *device) return_VALUE(0); } - /* -------------------------------------------------------------------------- Driver Interface -------------------------------------------------------------------------- */ -static int -acpi_fan_add(struct acpi_device *device) +static int acpi_fan_add(struct acpi_device *device) { - int result = 0; - struct acpi_fan *fan = NULL; - int state = 0; + int result = 0; + struct acpi_fan *fan = NULL; + int state = 0; ACPI_FUNCTION_TRACE("acpi_fan_add"); @@ -211,7 +202,7 @@ acpi_fan_add(struct acpi_device *device) result = acpi_bus_get_power(fan->handle, &state); if (result) { ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error reading power state\n")); + "Error reading power state\n")); goto end; } @@ -220,19 +211,17 @@ acpi_fan_add(struct acpi_device *device) goto end; printk(KERN_INFO PREFIX "%s [%s] (%s)\n", - acpi_device_name(device), acpi_device_bid(device), - !device->power.state?"on":"off"); + acpi_device_name(device), acpi_device_bid(device), + !device->power.state ? "on" : "off"); -end: + end: if (result) kfree(fan); return_VALUE(result); } - -static int -acpi_fan_remove(struct acpi_device *device, int type) +static int acpi_fan_remove(struct acpi_device *device, int type) { struct acpi_fan *fan = NULL; @@ -241,7 +230,7 @@ acpi_fan_remove(struct acpi_device *device, int type) if (!device || !acpi_driver_data(device)) return_VALUE(-EINVAL); - fan = (struct acpi_fan *) acpi_driver_data(device); + fan = (struct acpi_fan *)acpi_driver_data(device); acpi_fan_remove_fs(device); @@ -250,9 +239,7 @@ acpi_fan_remove(struct acpi_device *device, int type) return_VALUE(0); } - -static int __init -acpi_fan_init(void) +static int __init acpi_fan_init(void) { int result = 0; @@ -272,9 +259,7 @@ acpi_fan_init(void) return_VALUE(0); } - -static void __exit -acpi_fan_exit(void) +static void __exit acpi_fan_exit(void) { ACPI_FUNCTION_TRACE("acpi_fan_exit"); @@ -285,7 +270,5 @@ acpi_fan_exit(void) return_VOID; } - module_init(acpi_fan_init); module_exit(acpi_fan_exit); - diff --git a/drivers/acpi/glue.c b/drivers/acpi/glue.c index 770cfc8b17e..1943461489c 100644 --- a/drivers/acpi/glue.c +++ b/drivers/acpi/glue.c @@ -29,7 +29,8 @@ int register_acpi_bus_type(struct acpi_bus_type *type) down_write(&bus_type_sem); list_add_tail(&type->list, &bus_type_list); up_write(&bus_type_sem); - printk(KERN_INFO PREFIX "bus type %s registered\n", type->bus->name); + printk(KERN_INFO PREFIX "bus type %s registered\n", + type->bus->name); return 0; } return -ENODEV; @@ -45,7 +46,8 @@ int unregister_acpi_bus_type(struct acpi_bus_type *type) down_write(&bus_type_sem); list_del_init(&type->list); up_write(&bus_type_sem); - printk(KERN_INFO PREFIX "ACPI bus type %s unregistered\n", type->bus->name); + printk(KERN_INFO PREFIX "ACPI bus type %s unregistered\n", + type->bus->name); return 0; } return -ENODEV; diff --git a/drivers/acpi/hardware/hwacpi.c b/drivers/acpi/hardware/hwacpi.c index b51001e74ee..1bb3463d704 100644 --- a/drivers/acpi/hardware/hwacpi.c +++ b/drivers/acpi/hardware/hwacpi.c @@ -42,13 +42,10 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include - #define _COMPONENT ACPI_HARDWARE - ACPI_MODULE_NAME ("hwacpi") - +ACPI_MODULE_NAME("hwacpi") /****************************************************************************** * @@ -62,36 +59,30 @@ * the FADT. * ******************************************************************************/ - -acpi_status -acpi_hw_initialize ( - void) +acpi_status acpi_hw_initialize(void) { - acpi_status status; - - - ACPI_FUNCTION_TRACE ("hw_initialize"); + acpi_status status; + ACPI_FUNCTION_TRACE("hw_initialize"); /* We must have the ACPI tables by the time we get here */ if (!acpi_gbl_FADT) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No FADT is present\n")); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "No FADT is present\n")); - return_ACPI_STATUS (AE_NO_ACPI_TABLES); + return_ACPI_STATUS(AE_NO_ACPI_TABLES); } /* Sanity check the FADT for valid values */ - status = acpi_ut_validate_fadt (); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ut_validate_fadt(); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - /****************************************************************************** * * FUNCTION: acpi_hw_set_mode @@ -104,24 +95,21 @@ acpi_hw_initialize ( * ******************************************************************************/ -acpi_status -acpi_hw_set_mode ( - u32 mode) +acpi_status acpi_hw_set_mode(u32 mode) { - acpi_status status; - u32 retry; - + acpi_status status; + u32 retry; - ACPI_FUNCTION_TRACE ("hw_set_mode"); + ACPI_FUNCTION_TRACE("hw_set_mode"); /* * ACPI 2.0 clarified that if SMI_CMD in FADT is zero, * system does not support mode transition. */ if (!acpi_gbl_FADT->smi_cmd) { - ACPI_REPORT_ERROR (("No SMI_CMD in FADT, mode transition failed.\n")); - return_ACPI_STATUS (AE_NO_HARDWARE_RESPONSE); + ACPI_REPORT_ERROR(("No SMI_CMD in FADT, mode transition failed.\n")); + return_ACPI_STATUS(AE_NO_HARDWARE_RESPONSE); } /* @@ -132,9 +120,8 @@ acpi_hw_set_mode ( * transitions are not supported. */ if (!acpi_gbl_FADT->acpi_enable && !acpi_gbl_FADT->acpi_disable) { - ACPI_REPORT_ERROR (( - "No ACPI mode transition supported in this system (enable/disable both zero)\n")); - return_ACPI_STATUS (AE_OK); + ACPI_REPORT_ERROR(("No ACPI mode transition supported in this system (enable/disable both zero)\n")); + return_ACPI_STATUS(AE_OK); } switch (mode) { @@ -142,9 +129,11 @@ acpi_hw_set_mode ( /* BIOS should have disabled ALL fixed and GP events */ - status = acpi_os_write_port (acpi_gbl_FADT->smi_cmd, - (u32) acpi_gbl_FADT->acpi_enable, 8); - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Attempting to enable ACPI mode\n")); + status = acpi_os_write_port(acpi_gbl_FADT->smi_cmd, + (u32) acpi_gbl_FADT->acpi_enable, + 8); + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "Attempting to enable ACPI mode\n")); break; case ACPI_SYS_MODE_LEGACY: @@ -153,20 +142,21 @@ acpi_hw_set_mode ( * BIOS should clear all fixed status bits and restore fixed event * enable bits to default */ - status = acpi_os_write_port (acpi_gbl_FADT->smi_cmd, - (u32) acpi_gbl_FADT->acpi_disable, 8); - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "Attempting to enable Legacy (non-ACPI) mode\n")); + status = acpi_os_write_port(acpi_gbl_FADT->smi_cmd, + (u32) acpi_gbl_FADT->acpi_disable, + 8); + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "Attempting to enable Legacy (non-ACPI) mode\n")); break; default: - return_ACPI_STATUS (AE_BAD_PARAMETER); + return_ACPI_STATUS(AE_BAD_PARAMETER); } - if (ACPI_FAILURE (status)) { - ACPI_REPORT_ERROR (("Could not write mode change, %s\n", - acpi_format_exception (status))); - return_ACPI_STATUS (status); + if (ACPI_FAILURE(status)) { + ACPI_REPORT_ERROR(("Could not write mode change, %s\n", + acpi_format_exception(status))); + return_ACPI_STATUS(status); } /* @@ -176,19 +166,19 @@ acpi_hw_set_mode ( retry = 3000; while (retry) { if (acpi_hw_get_mode() == mode) { - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Mode %X successfully enabled\n", - mode)); - return_ACPI_STATUS (AE_OK); + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "Mode %X successfully enabled\n", + mode)); + return_ACPI_STATUS(AE_OK); } acpi_os_stall(1000); retry--; } - ACPI_REPORT_ERROR (("Hardware never changed modes\n")); - return_ACPI_STATUS (AE_NO_HARDWARE_RESPONSE); + ACPI_REPORT_ERROR(("Hardware never changed modes\n")); + return_ACPI_STATUS(AE_NO_HARDWARE_RESPONSE); } - /******************************************************************************* * * FUNCTION: acpi_hw_get_mode @@ -202,34 +192,30 @@ acpi_hw_set_mode ( * ******************************************************************************/ -u32 -acpi_hw_get_mode ( - void) +u32 acpi_hw_get_mode(void) { - acpi_status status; - u32 value; - - - ACPI_FUNCTION_TRACE ("hw_get_mode"); + acpi_status status; + u32 value; + ACPI_FUNCTION_TRACE("hw_get_mode"); /* * ACPI 2.0 clarified that if SMI_CMD in FADT is zero, * system does not support mode transition. */ if (!acpi_gbl_FADT->smi_cmd) { - return_VALUE (ACPI_SYS_MODE_ACPI); + return_VALUE(ACPI_SYS_MODE_ACPI); } - status = acpi_get_register (ACPI_BITREG_SCI_ENABLE, &value, ACPI_MTX_LOCK); - if (ACPI_FAILURE (status)) { - return_VALUE (ACPI_SYS_MODE_LEGACY); + status = + acpi_get_register(ACPI_BITREG_SCI_ENABLE, &value, ACPI_MTX_LOCK); + if (ACPI_FAILURE(status)) { + return_VALUE(ACPI_SYS_MODE_LEGACY); } if (value) { - return_VALUE (ACPI_SYS_MODE_ACPI); - } - else { - return_VALUE (ACPI_SYS_MODE_LEGACY); + return_VALUE(ACPI_SYS_MODE_ACPI); + } else { + return_VALUE(ACPI_SYS_MODE_LEGACY); } } diff --git a/drivers/acpi/hardware/hwgpe.c b/drivers/acpi/hardware/hwgpe.c index 3536bbb990c..5c8e5dfd024 100644 --- a/drivers/acpi/hardware/hwgpe.c +++ b/drivers/acpi/hardware/hwgpe.c @@ -46,15 +46,12 @@ #include #define _COMPONENT ACPI_HARDWARE - ACPI_MODULE_NAME ("hwgpe") +ACPI_MODULE_NAME("hwgpe") /* Local prototypes */ - static acpi_status -acpi_hw_enable_wakeup_gpe_block ( - struct acpi_gpe_xrupt_info *gpe_xrupt_info, - struct acpi_gpe_block_info *gpe_block); - +acpi_hw_enable_wakeup_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info, + struct acpi_gpe_block_info *gpe_block); /****************************************************************************** * @@ -71,15 +68,12 @@ acpi_hw_enable_wakeup_gpe_block ( ******************************************************************************/ acpi_status -acpi_hw_write_gpe_enable_reg ( - struct acpi_gpe_event_info *gpe_event_info) +acpi_hw_write_gpe_enable_reg(struct acpi_gpe_event_info *gpe_event_info) { - struct acpi_gpe_register_info *gpe_register_info; - acpi_status status; - - - ACPI_FUNCTION_ENTRY (); + struct acpi_gpe_register_info *gpe_register_info; + acpi_status status; + ACPI_FUNCTION_ENTRY(); /* Get the info block for the entire GPE register */ @@ -90,13 +84,12 @@ acpi_hw_write_gpe_enable_reg ( /* Write the entire GPE (runtime) enable register */ - status = acpi_hw_low_level_write (8, gpe_register_info->enable_for_run, - &gpe_register_info->enable_address); + status = acpi_hw_low_level_write(8, gpe_register_info->enable_for_run, + &gpe_register_info->enable_address); return (status); } - /****************************************************************************** * * FUNCTION: acpi_hw_clear_gpe @@ -109,27 +102,23 @@ acpi_hw_write_gpe_enable_reg ( * ******************************************************************************/ -acpi_status -acpi_hw_clear_gpe ( - struct acpi_gpe_event_info *gpe_event_info) +acpi_status acpi_hw_clear_gpe(struct acpi_gpe_event_info * gpe_event_info) { - acpi_status status; - - - ACPI_FUNCTION_ENTRY (); + acpi_status status; + ACPI_FUNCTION_ENTRY(); /* * Write a one to the appropriate bit in the status register to * clear this GPE. */ - status = acpi_hw_low_level_write (8, gpe_event_info->register_bit, - &gpe_event_info->register_info->status_address); + status = acpi_hw_low_level_write(8, gpe_event_info->register_bit, + &gpe_event_info->register_info-> + status_address); return (status); } - /****************************************************************************** * * FUNCTION: acpi_hw_get_gpe_status @@ -145,19 +134,16 @@ acpi_hw_clear_gpe ( #ifdef ACPI_FUTURE_USAGE acpi_status -acpi_hw_get_gpe_status ( - struct acpi_gpe_event_info *gpe_event_info, - acpi_event_status *event_status) +acpi_hw_get_gpe_status(struct acpi_gpe_event_info * gpe_event_info, + acpi_event_status * event_status) { - u32 in_byte; - u8 register_bit; - struct acpi_gpe_register_info *gpe_register_info; - acpi_status status; - acpi_event_status local_event_status = 0; - - - ACPI_FUNCTION_ENTRY (); + u32 in_byte; + u8 register_bit; + struct acpi_gpe_register_info *gpe_register_info; + acpi_status status; + acpi_event_status local_event_status = 0; + ACPI_FUNCTION_ENTRY(); if (!event_status) { return (AE_BAD_PARAMETER); @@ -185,8 +171,10 @@ acpi_hw_get_gpe_status ( /* GPE currently active (status bit == 1)? */ - status = acpi_hw_low_level_read (8, &in_byte, &gpe_register_info->status_address); - if (ACPI_FAILURE (status)) { + status = + acpi_hw_low_level_read(8, &in_byte, + &gpe_register_info->status_address); + if (ACPI_FAILURE(status)) { goto unlock_and_exit; } @@ -198,12 +186,10 @@ acpi_hw_get_gpe_status ( (*event_status) = local_event_status; - -unlock_and_exit: + unlock_and_exit: return (status); } -#endif /* ACPI_FUTURE_USAGE */ - +#endif /* ACPI_FUTURE_USAGE */ /****************************************************************************** * @@ -219,22 +205,21 @@ unlock_and_exit: ******************************************************************************/ acpi_status -acpi_hw_disable_gpe_block ( - struct acpi_gpe_xrupt_info *gpe_xrupt_info, - struct acpi_gpe_block_info *gpe_block) +acpi_hw_disable_gpe_block(struct acpi_gpe_xrupt_info * gpe_xrupt_info, + struct acpi_gpe_block_info * gpe_block) { - u32 i; - acpi_status status; - + u32 i; + acpi_status status; /* Examine each GPE Register within the block */ for (i = 0; i < gpe_block->register_count; i++) { /* Disable all GPEs in this register */ - status = acpi_hw_low_level_write (8, 0x00, - &gpe_block->register_info[i].enable_address); - if (ACPI_FAILURE (status)) { + status = acpi_hw_low_level_write(8, 0x00, + &gpe_block->register_info[i]. + enable_address); + if (ACPI_FAILURE(status)) { return (status); } } @@ -242,7 +227,6 @@ acpi_hw_disable_gpe_block ( return (AE_OK); } - /****************************************************************************** * * FUNCTION: acpi_hw_clear_gpe_block @@ -257,22 +241,21 @@ acpi_hw_disable_gpe_block ( ******************************************************************************/ acpi_status -acpi_hw_clear_gpe_block ( - struct acpi_gpe_xrupt_info *gpe_xrupt_info, - struct acpi_gpe_block_info *gpe_block) +acpi_hw_clear_gpe_block(struct acpi_gpe_xrupt_info * gpe_xrupt_info, + struct acpi_gpe_block_info * gpe_block) { - u32 i; - acpi_status status; - + u32 i; + acpi_status status; /* Examine each GPE Register within the block */ for (i = 0; i < gpe_block->register_count; i++) { /* Clear status on all GPEs in this register */ - status = acpi_hw_low_level_write (8, 0xFF, - &gpe_block->register_info[i].status_address); - if (ACPI_FAILURE (status)) { + status = acpi_hw_low_level_write(8, 0xFF, + &gpe_block->register_info[i]. + status_address); + if (ACPI_FAILURE(status)) { return (status); } } @@ -280,7 +263,6 @@ acpi_hw_clear_gpe_block ( return (AE_OK); } - /****************************************************************************** * * FUNCTION: acpi_hw_enable_runtime_gpe_block @@ -296,13 +278,11 @@ acpi_hw_clear_gpe_block ( ******************************************************************************/ acpi_status -acpi_hw_enable_runtime_gpe_block ( - struct acpi_gpe_xrupt_info *gpe_xrupt_info, - struct acpi_gpe_block_info *gpe_block) +acpi_hw_enable_runtime_gpe_block(struct acpi_gpe_xrupt_info * gpe_xrupt_info, + struct acpi_gpe_block_info * gpe_block) { - u32 i; - acpi_status status; - + u32 i; + acpi_status status; /* NOTE: assumes that all GPEs are currently disabled */ @@ -315,9 +295,13 @@ acpi_hw_enable_runtime_gpe_block ( /* Enable all "runtime" GPEs in this register */ - status = acpi_hw_low_level_write (8, gpe_block->register_info[i].enable_for_run, - &gpe_block->register_info[i].enable_address); - if (ACPI_FAILURE (status)) { + status = + acpi_hw_low_level_write(8, + gpe_block->register_info[i]. + enable_for_run, + &gpe_block->register_info[i]. + enable_address); + if (ACPI_FAILURE(status)) { return (status); } } @@ -325,7 +309,6 @@ acpi_hw_enable_runtime_gpe_block ( return (AE_OK); } - /****************************************************************************** * * FUNCTION: acpi_hw_enable_wakeup_gpe_block @@ -341,13 +324,11 @@ acpi_hw_enable_runtime_gpe_block ( ******************************************************************************/ static acpi_status -acpi_hw_enable_wakeup_gpe_block ( - struct acpi_gpe_xrupt_info *gpe_xrupt_info, - struct acpi_gpe_block_info *gpe_block) +acpi_hw_enable_wakeup_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info, + struct acpi_gpe_block_info *gpe_block) { - u32 i; - acpi_status status; - + u32 i; + acpi_status status; /* Examine each GPE Register within the block */ @@ -358,10 +339,12 @@ acpi_hw_enable_wakeup_gpe_block ( /* Enable all "wake" GPEs in this register */ - status = acpi_hw_low_level_write (8, - gpe_block->register_info[i].enable_for_wake, - &gpe_block->register_info[i].enable_address); - if (ACPI_FAILURE (status)) { + status = acpi_hw_low_level_write(8, + gpe_block->register_info[i]. + enable_for_wake, + &gpe_block->register_info[i]. + enable_address); + if (ACPI_FAILURE(status)) { return (status); } } @@ -369,7 +352,6 @@ acpi_hw_enable_wakeup_gpe_block ( return (AE_OK); } - /****************************************************************************** * * FUNCTION: acpi_hw_disable_all_gpes @@ -382,22 +364,17 @@ acpi_hw_enable_wakeup_gpe_block ( * ******************************************************************************/ -acpi_status -acpi_hw_disable_all_gpes ( - void) +acpi_status acpi_hw_disable_all_gpes(void) { - acpi_status status; - + acpi_status status; - ACPI_FUNCTION_TRACE ("hw_disable_all_gpes"); + ACPI_FUNCTION_TRACE("hw_disable_all_gpes"); - - status = acpi_ev_walk_gpe_list (acpi_hw_disable_gpe_block); - status = acpi_ev_walk_gpe_list (acpi_hw_clear_gpe_block); - return_ACPI_STATUS (status); + status = acpi_ev_walk_gpe_list(acpi_hw_disable_gpe_block); + status = acpi_ev_walk_gpe_list(acpi_hw_clear_gpe_block); + return_ACPI_STATUS(status); } - /****************************************************************************** * * FUNCTION: acpi_hw_enable_all_runtime_gpes @@ -410,21 +387,16 @@ acpi_hw_disable_all_gpes ( * ******************************************************************************/ -acpi_status -acpi_hw_enable_all_runtime_gpes ( - void) +acpi_status acpi_hw_enable_all_runtime_gpes(void) { - acpi_status status; - + acpi_status status; - ACPI_FUNCTION_TRACE ("hw_enable_all_runtime_gpes"); + ACPI_FUNCTION_TRACE("hw_enable_all_runtime_gpes"); - - status = acpi_ev_walk_gpe_list (acpi_hw_enable_runtime_gpe_block); - return_ACPI_STATUS (status); + status = acpi_ev_walk_gpe_list(acpi_hw_enable_runtime_gpe_block); + return_ACPI_STATUS(status); } - /****************************************************************************** * * FUNCTION: acpi_hw_enable_all_wakeup_gpes @@ -437,17 +409,12 @@ acpi_hw_enable_all_runtime_gpes ( * ******************************************************************************/ -acpi_status -acpi_hw_enable_all_wakeup_gpes ( - void) +acpi_status acpi_hw_enable_all_wakeup_gpes(void) { - acpi_status status; - + acpi_status status; - ACPI_FUNCTION_TRACE ("hw_enable_all_wakeup_gpes"); + ACPI_FUNCTION_TRACE("hw_enable_all_wakeup_gpes"); - - status = acpi_ev_walk_gpe_list (acpi_hw_enable_wakeup_gpe_block); - return_ACPI_STATUS (status); + status = acpi_ev_walk_gpe_list(acpi_hw_enable_wakeup_gpe_block); + return_ACPI_STATUS(status); } - diff --git a/drivers/acpi/hardware/hwregs.c b/drivers/acpi/hardware/hwregs.c index 04a058565d8..536a7aea80c 100644 --- a/drivers/acpi/hardware/hwregs.c +++ b/drivers/acpi/hardware/hwregs.c @@ -50,8 +50,7 @@ #include #define _COMPONENT ACPI_HARDWARE - ACPI_MODULE_NAME ("hwregs") - +ACPI_MODULE_NAME("hwregs") /******************************************************************************* * @@ -65,57 +64,52 @@ * THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED * ******************************************************************************/ - -acpi_status -acpi_hw_clear_acpi_status ( - u32 flags) +acpi_status acpi_hw_clear_acpi_status(u32 flags) { - acpi_status status; - + acpi_status status; - ACPI_FUNCTION_TRACE ("hw_clear_acpi_status"); + ACPI_FUNCTION_TRACE("hw_clear_acpi_status"); - - ACPI_DEBUG_PRINT ((ACPI_DB_IO, "About to write %04X to %04X\n", - ACPI_BITMASK_ALL_FIXED_STATUS, - (u16) acpi_gbl_FADT->xpm1a_evt_blk.address)); + ACPI_DEBUG_PRINT((ACPI_DB_IO, "About to write %04X to %04X\n", + ACPI_BITMASK_ALL_FIXED_STATUS, + (u16) acpi_gbl_FADT->xpm1a_evt_blk.address)); if (flags & ACPI_MTX_LOCK) { - status = acpi_ut_acquire_mutex (ACPI_MTX_HARDWARE); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ut_acquire_mutex(ACPI_MTX_HARDWARE); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } } - status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, - ACPI_REGISTER_PM1_STATUS, - ACPI_BITMASK_ALL_FIXED_STATUS); - if (ACPI_FAILURE (status)) { + status = acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK, + ACPI_REGISTER_PM1_STATUS, + ACPI_BITMASK_ALL_FIXED_STATUS); + if (ACPI_FAILURE(status)) { goto unlock_and_exit; } /* Clear the fixed events */ if (acpi_gbl_FADT->xpm1b_evt_blk.address) { - status = acpi_hw_low_level_write (16, ACPI_BITMASK_ALL_FIXED_STATUS, - &acpi_gbl_FADT->xpm1b_evt_blk); - if (ACPI_FAILURE (status)) { + status = + acpi_hw_low_level_write(16, ACPI_BITMASK_ALL_FIXED_STATUS, + &acpi_gbl_FADT->xpm1b_evt_blk); + if (ACPI_FAILURE(status)) { goto unlock_and_exit; } } /* Clear the GPE Bits in all GPE registers in all GPE blocks */ - status = acpi_ev_walk_gpe_list (acpi_hw_clear_gpe_block); + status = acpi_ev_walk_gpe_list(acpi_hw_clear_gpe_block); -unlock_and_exit: + unlock_and_exit: if (flags & ACPI_MTX_LOCK) { - (void) acpi_ut_release_mutex (ACPI_MTX_HARDWARE); + (void)acpi_ut_release_mutex(ACPI_MTX_HARDWARE); } - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_get_sleep_type_data @@ -132,53 +126,48 @@ unlock_and_exit: ******************************************************************************/ acpi_status -acpi_get_sleep_type_data ( - u8 sleep_state, - u8 *sleep_type_a, - u8 *sleep_type_b) +acpi_get_sleep_type_data(u8 sleep_state, u8 * sleep_type_a, u8 * sleep_type_b) { - acpi_status status = AE_OK; - struct acpi_parameter_info info; - char *sleep_state_name; - - - ACPI_FUNCTION_TRACE ("acpi_get_sleep_type_data"); + acpi_status status = AE_OK; + struct acpi_parameter_info info; + char *sleep_state_name; + ACPI_FUNCTION_TRACE("acpi_get_sleep_type_data"); /* Validate parameters */ - if ((sleep_state > ACPI_S_STATES_MAX) || - !sleep_type_a || !sleep_type_b) { - return_ACPI_STATUS (AE_BAD_PARAMETER); + if ((sleep_state > ACPI_S_STATES_MAX) || !sleep_type_a || !sleep_type_b) { + return_ACPI_STATUS(AE_BAD_PARAMETER); } /* Evaluate the namespace object containing the values for this state */ info.parameters = NULL; info.return_object = NULL; - sleep_state_name = (char *) acpi_gbl_sleep_state_names[sleep_state]; + sleep_state_name = (char *)acpi_gbl_sleep_state_names[sleep_state]; - status = acpi_ns_evaluate_by_name (sleep_state_name, &info); - if (ACPI_FAILURE (status)) { - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "%s while evaluating sleep_state [%s]\n", - acpi_format_exception (status), sleep_state_name)); + status = acpi_ns_evaluate_by_name(sleep_state_name, &info); + if (ACPI_FAILURE(status)) { + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, + "%s while evaluating sleep_state [%s]\n", + acpi_format_exception(status), + sleep_state_name)); - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } /* Must have a return object */ if (!info.return_object) { - ACPI_REPORT_ERROR (("No Sleep State object returned from [%s]\n", - sleep_state_name)); + ACPI_REPORT_ERROR(("No Sleep State object returned from [%s]\n", + sleep_state_name)); status = AE_NOT_EXIST; } /* It must be of type Package */ - else if (ACPI_GET_OBJECT_TYPE (info.return_object) != ACPI_TYPE_PACKAGE) { - ACPI_REPORT_ERROR (("Sleep State return object is not a Package\n")); + else if (ACPI_GET_OBJECT_TYPE(info.return_object) != ACPI_TYPE_PACKAGE) { + ACPI_REPORT_ERROR(("Sleep State return object is not a Package\n")); status = AE_AML_OPERAND_TYPE; } @@ -190,45 +179,41 @@ acpi_get_sleep_type_data ( * one per sleep type (A/B). */ else if (info.return_object->package.count < 2) { - ACPI_REPORT_ERROR (( - "Sleep State return package does not have at least two elements\n")); + ACPI_REPORT_ERROR(("Sleep State return package does not have at least two elements\n")); status = AE_AML_NO_OPERAND; } /* The first two elements must both be of type Integer */ - else if ((ACPI_GET_OBJECT_TYPE (info.return_object->package.elements[0]) - != ACPI_TYPE_INTEGER) || - (ACPI_GET_OBJECT_TYPE (info.return_object->package.elements[1]) - != ACPI_TYPE_INTEGER)) { - ACPI_REPORT_ERROR (( - "Sleep State return package elements are not both Integers (%s, %s)\n", - acpi_ut_get_object_type_name (info.return_object->package.elements[0]), - acpi_ut_get_object_type_name (info.return_object->package.elements[1]))); + else if ((ACPI_GET_OBJECT_TYPE(info.return_object->package.elements[0]) + != ACPI_TYPE_INTEGER) || + (ACPI_GET_OBJECT_TYPE(info.return_object->package.elements[1]) + != ACPI_TYPE_INTEGER)) { + ACPI_REPORT_ERROR(("Sleep State return package elements are not both Integers (%s, %s)\n", acpi_ut_get_object_type_name(info.return_object->package.elements[0]), acpi_ut_get_object_type_name(info.return_object->package.elements[1]))); status = AE_AML_OPERAND_TYPE; - } - else { + } else { /* Valid _Sx_ package size, type, and value */ *sleep_type_a = (u8) - (info.return_object->package.elements[0])->integer.value; + (info.return_object->package.elements[0])->integer.value; *sleep_type_b = (u8) - (info.return_object->package.elements[1])->integer.value; + (info.return_object->package.elements[1])->integer.value; } - if (ACPI_FAILURE (status)) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "%s While evaluating sleep_state [%s], bad Sleep object %p type %s\n", - acpi_format_exception (status), - sleep_state_name, info.return_object, - acpi_ut_get_object_type_name (info.return_object))); + if (ACPI_FAILURE(status)) { + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "%s While evaluating sleep_state [%s], bad Sleep object %p type %s\n", + acpi_format_exception(status), + sleep_state_name, info.return_object, + acpi_ut_get_object_type_name(info. + return_object))); } - acpi_ut_remove_reference (info.return_object); - return_ACPI_STATUS (status); + acpi_ut_remove_reference(info.return_object); + return_ACPI_STATUS(status); } -EXPORT_SYMBOL(acpi_get_sleep_type_data); +EXPORT_SYMBOL(acpi_get_sleep_type_data); /******************************************************************************* * @@ -242,22 +227,20 @@ EXPORT_SYMBOL(acpi_get_sleep_type_data); * ******************************************************************************/ -struct acpi_bit_register_info * -acpi_hw_get_bit_register_info ( - u32 register_id) +struct acpi_bit_register_info *acpi_hw_get_bit_register_info(u32 register_id) { - ACPI_FUNCTION_NAME ("hw_get_bit_register_info"); - + ACPI_FUNCTION_NAME("hw_get_bit_register_info"); if (register_id > ACPI_BITREG_MAX) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid bit_register ID: %X\n", register_id)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Invalid bit_register ID: %X\n", + register_id)); return (NULL); } return (&acpi_gbl_bit_register_info[register_id]); } - /******************************************************************************* * * FUNCTION: acpi_get_register @@ -273,59 +256,56 @@ acpi_hw_get_bit_register_info ( * ******************************************************************************/ -acpi_status -acpi_get_register ( - u32 register_id, - u32 *return_value, - u32 flags) +acpi_status acpi_get_register(u32 register_id, u32 * return_value, u32 flags) { - u32 register_value = 0; - struct acpi_bit_register_info *bit_reg_info; - acpi_status status; - - - ACPI_FUNCTION_TRACE ("acpi_get_register"); + u32 register_value = 0; + struct acpi_bit_register_info *bit_reg_info; + acpi_status status; + ACPI_FUNCTION_TRACE("acpi_get_register"); /* Get the info structure corresponding to the requested ACPI Register */ - bit_reg_info = acpi_hw_get_bit_register_info (register_id); + bit_reg_info = acpi_hw_get_bit_register_info(register_id); if (!bit_reg_info) { - return_ACPI_STATUS (AE_BAD_PARAMETER); + return_ACPI_STATUS(AE_BAD_PARAMETER); } if (flags & ACPI_MTX_LOCK) { - status = acpi_ut_acquire_mutex (ACPI_MTX_HARDWARE); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ut_acquire_mutex(ACPI_MTX_HARDWARE); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } } /* Read from the register */ - status = acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK, - bit_reg_info->parent_register, ®ister_value); + status = acpi_hw_register_read(ACPI_MTX_DO_NOT_LOCK, + bit_reg_info->parent_register, + ®ister_value); if (flags & ACPI_MTX_LOCK) { - (void) acpi_ut_release_mutex (ACPI_MTX_HARDWARE); + (void)acpi_ut_release_mutex(ACPI_MTX_HARDWARE); } - if (ACPI_SUCCESS (status)) { + if (ACPI_SUCCESS(status)) { /* Normalize the value that was read */ - register_value = ((register_value & bit_reg_info->access_bit_mask) - >> bit_reg_info->bit_position); + register_value = + ((register_value & bit_reg_info->access_bit_mask) + >> bit_reg_info->bit_position); *return_value = register_value; - ACPI_DEBUG_PRINT ((ACPI_DB_IO, "Read value %8.8X register %X\n", - register_value, bit_reg_info->parent_register)); + ACPI_DEBUG_PRINT((ACPI_DB_IO, "Read value %8.8X register %X\n", + register_value, + bit_reg_info->parent_register)); } - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } -EXPORT_SYMBOL(acpi_get_register); +EXPORT_SYMBOL(acpi_get_register); /******************************************************************************* * @@ -342,40 +322,36 @@ EXPORT_SYMBOL(acpi_get_register); * ******************************************************************************/ -acpi_status -acpi_set_register ( - u32 register_id, - u32 value, - u32 flags) +acpi_status acpi_set_register(u32 register_id, u32 value, u32 flags) { - u32 register_value = 0; - struct acpi_bit_register_info *bit_reg_info; - acpi_status status; - - - ACPI_FUNCTION_TRACE_U32 ("acpi_set_register", register_id); + u32 register_value = 0; + struct acpi_bit_register_info *bit_reg_info; + acpi_status status; + ACPI_FUNCTION_TRACE_U32("acpi_set_register", register_id); /* Get the info structure corresponding to the requested ACPI Register */ - bit_reg_info = acpi_hw_get_bit_register_info (register_id); + bit_reg_info = acpi_hw_get_bit_register_info(register_id); if (!bit_reg_info) { - ACPI_REPORT_ERROR (("Bad ACPI HW register_id: %X\n", register_id)); - return_ACPI_STATUS (AE_BAD_PARAMETER); + ACPI_REPORT_ERROR(("Bad ACPI HW register_id: %X\n", + register_id)); + return_ACPI_STATUS(AE_BAD_PARAMETER); } if (flags & ACPI_MTX_LOCK) { - status = acpi_ut_acquire_mutex (ACPI_MTX_HARDWARE); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ut_acquire_mutex(ACPI_MTX_HARDWARE); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } } /* Always do a register read first so we can insert the new bits */ - status = acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK, - bit_reg_info->parent_register, ®ister_value); - if (ACPI_FAILURE (status)) { + status = acpi_hw_register_read(ACPI_MTX_DO_NOT_LOCK, + bit_reg_info->parent_register, + ®ister_value); + if (ACPI_FAILURE(status)) { goto unlock_and_exit; } @@ -395,26 +371,30 @@ acpi_set_register ( * information is the single bit we're interested in, all others should * be written as 0 so they will be left unchanged. */ - value = ACPI_REGISTER_PREPARE_BITS (value, - bit_reg_info->bit_position, bit_reg_info->access_bit_mask); + value = ACPI_REGISTER_PREPARE_BITS(value, + bit_reg_info->bit_position, + bit_reg_info-> + access_bit_mask); if (value) { - status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, - ACPI_REGISTER_PM1_STATUS, (u16) value); + status = acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK, + ACPI_REGISTER_PM1_STATUS, + (u16) value); register_value = 0; } break; - case ACPI_REGISTER_PM1_ENABLE: - ACPI_REGISTER_INSERT_VALUE (register_value, bit_reg_info->bit_position, - bit_reg_info->access_bit_mask, value); + ACPI_REGISTER_INSERT_VALUE(register_value, + bit_reg_info->bit_position, + bit_reg_info->access_bit_mask, + value); - status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, - ACPI_REGISTER_PM1_ENABLE, (u16) register_value); + status = acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK, + ACPI_REGISTER_PM1_ENABLE, + (u16) register_value); break; - case ACPI_REGISTER_PM1_CONTROL: /* @@ -422,65 +402,73 @@ acpi_set_register ( * Note that at this level, the fact that there are actually TWO * registers (A and B - and B may not exist) is abstracted. */ - ACPI_DEBUG_PRINT ((ACPI_DB_IO, "PM1 control: Read %X\n", register_value)); + ACPI_DEBUG_PRINT((ACPI_DB_IO, "PM1 control: Read %X\n", + register_value)); - ACPI_REGISTER_INSERT_VALUE (register_value, bit_reg_info->bit_position, - bit_reg_info->access_bit_mask, value); + ACPI_REGISTER_INSERT_VALUE(register_value, + bit_reg_info->bit_position, + bit_reg_info->access_bit_mask, + value); - status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, - ACPI_REGISTER_PM1_CONTROL, (u16) register_value); + status = acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK, + ACPI_REGISTER_PM1_CONTROL, + (u16) register_value); break; - case ACPI_REGISTER_PM2_CONTROL: - status = acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK, - ACPI_REGISTER_PM2_CONTROL, ®ister_value); - if (ACPI_FAILURE (status)) { + status = acpi_hw_register_read(ACPI_MTX_DO_NOT_LOCK, + ACPI_REGISTER_PM2_CONTROL, + ®ister_value); + if (ACPI_FAILURE(status)) { goto unlock_and_exit; } - ACPI_DEBUG_PRINT ((ACPI_DB_IO, "PM2 control: Read %X from %8.8X%8.8X\n", - register_value, - ACPI_FORMAT_UINT64 ( - acpi_gbl_FADT->xpm2_cnt_blk.address))); - - ACPI_REGISTER_INSERT_VALUE (register_value, bit_reg_info->bit_position, - bit_reg_info->access_bit_mask, value); - - ACPI_DEBUG_PRINT ((ACPI_DB_IO, "About to write %4.4X to %8.8X%8.8X\n", - register_value, - ACPI_FORMAT_UINT64 ( - acpi_gbl_FADT->xpm2_cnt_blk.address))); - - status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, - ACPI_REGISTER_PM2_CONTROL, (u8) (register_value)); + ACPI_DEBUG_PRINT((ACPI_DB_IO, + "PM2 control: Read %X from %8.8X%8.8X\n", + register_value, + ACPI_FORMAT_UINT64(acpi_gbl_FADT-> + xpm2_cnt_blk.address))); + + ACPI_REGISTER_INSERT_VALUE(register_value, + bit_reg_info->bit_position, + bit_reg_info->access_bit_mask, + value); + + ACPI_DEBUG_PRINT((ACPI_DB_IO, + "About to write %4.4X to %8.8X%8.8X\n", + register_value, + ACPI_FORMAT_UINT64(acpi_gbl_FADT-> + xpm2_cnt_blk.address))); + + status = acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK, + ACPI_REGISTER_PM2_CONTROL, + (u8) (register_value)); break; - default: break; } - -unlock_and_exit: + unlock_and_exit: if (flags & ACPI_MTX_LOCK) { - (void) acpi_ut_release_mutex (ACPI_MTX_HARDWARE); + (void)acpi_ut_release_mutex(ACPI_MTX_HARDWARE); } /* Normalize the value that was read */ - ACPI_DEBUG_EXEC (register_value = - ((register_value & bit_reg_info->access_bit_mask) >> - bit_reg_info->bit_position)); + ACPI_DEBUG_EXEC(register_value = + ((register_value & bit_reg_info->access_bit_mask) >> + bit_reg_info->bit_position)); - ACPI_DEBUG_PRINT ((ACPI_DB_IO, "Set bits: %8.8X actual %8.8X register %X\n", - value, register_value, bit_reg_info->parent_register)); - return_ACPI_STATUS (status); + ACPI_DEBUG_PRINT((ACPI_DB_IO, + "Set bits: %8.8X actual %8.8X register %X\n", value, + register_value, bit_reg_info->parent_register)); + return_ACPI_STATUS(status); } -EXPORT_SYMBOL(acpi_set_register); +EXPORT_SYMBOL(acpi_set_register); /****************************************************************************** * @@ -498,103 +486,107 @@ EXPORT_SYMBOL(acpi_set_register); ******************************************************************************/ acpi_status -acpi_hw_register_read ( - u8 use_lock, - u32 register_id, - u32 *return_value) +acpi_hw_register_read(u8 use_lock, u32 register_id, u32 * return_value) { - u32 value1 = 0; - u32 value2 = 0; - acpi_status status; - - - ACPI_FUNCTION_TRACE ("hw_register_read"); + u32 value1 = 0; + u32 value2 = 0; + acpi_status status; + ACPI_FUNCTION_TRACE("hw_register_read"); if (ACPI_MTX_LOCK == use_lock) { - status = acpi_ut_acquire_mutex (ACPI_MTX_HARDWARE); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ut_acquire_mutex(ACPI_MTX_HARDWARE); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } } switch (register_id) { - case ACPI_REGISTER_PM1_STATUS: /* 16-bit access */ + case ACPI_REGISTER_PM1_STATUS: /* 16-bit access */ - status = acpi_hw_low_level_read (16, &value1, &acpi_gbl_FADT->xpm1a_evt_blk); - if (ACPI_FAILURE (status)) { + status = + acpi_hw_low_level_read(16, &value1, + &acpi_gbl_FADT->xpm1a_evt_blk); + if (ACPI_FAILURE(status)) { goto unlock_and_exit; } /* PM1B is optional */ - status = acpi_hw_low_level_read (16, &value2, &acpi_gbl_FADT->xpm1b_evt_blk); + status = + acpi_hw_low_level_read(16, &value2, + &acpi_gbl_FADT->xpm1b_evt_blk); value1 |= value2; break; + case ACPI_REGISTER_PM1_ENABLE: /* 16-bit access */ - case ACPI_REGISTER_PM1_ENABLE: /* 16-bit access */ - - status = acpi_hw_low_level_read (16, &value1, &acpi_gbl_xpm1a_enable); - if (ACPI_FAILURE (status)) { + status = + acpi_hw_low_level_read(16, &value1, &acpi_gbl_xpm1a_enable); + if (ACPI_FAILURE(status)) { goto unlock_and_exit; } /* PM1B is optional */ - status = acpi_hw_low_level_read (16, &value2, &acpi_gbl_xpm1b_enable); + status = + acpi_hw_low_level_read(16, &value2, &acpi_gbl_xpm1b_enable); value1 |= value2; break; + case ACPI_REGISTER_PM1_CONTROL: /* 16-bit access */ - case ACPI_REGISTER_PM1_CONTROL: /* 16-bit access */ - - status = acpi_hw_low_level_read (16, &value1, &acpi_gbl_FADT->xpm1a_cnt_blk); - if (ACPI_FAILURE (status)) { + status = + acpi_hw_low_level_read(16, &value1, + &acpi_gbl_FADT->xpm1a_cnt_blk); + if (ACPI_FAILURE(status)) { goto unlock_and_exit; } - status = acpi_hw_low_level_read (16, &value2, &acpi_gbl_FADT->xpm1b_cnt_blk); + status = + acpi_hw_low_level_read(16, &value2, + &acpi_gbl_FADT->xpm1b_cnt_blk); value1 |= value2; break; + case ACPI_REGISTER_PM2_CONTROL: /* 8-bit access */ - case ACPI_REGISTER_PM2_CONTROL: /* 8-bit access */ - - status = acpi_hw_low_level_read (8, &value1, &acpi_gbl_FADT->xpm2_cnt_blk); + status = + acpi_hw_low_level_read(8, &value1, + &acpi_gbl_FADT->xpm2_cnt_blk); break; + case ACPI_REGISTER_PM_TIMER: /* 32-bit access */ - case ACPI_REGISTER_PM_TIMER: /* 32-bit access */ - - status = acpi_hw_low_level_read (32, &value1, &acpi_gbl_FADT->xpm_tmr_blk); + status = + acpi_hw_low_level_read(32, &value1, + &acpi_gbl_FADT->xpm_tmr_blk); break; - case ACPI_REGISTER_SMI_COMMAND_BLOCK: /* 8-bit access */ + case ACPI_REGISTER_SMI_COMMAND_BLOCK: /* 8-bit access */ - status = acpi_os_read_port (acpi_gbl_FADT->smi_cmd, &value1, 8); + status = acpi_os_read_port(acpi_gbl_FADT->smi_cmd, &value1, 8); break; default: - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown Register ID: %X\n", - register_id)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unknown Register ID: %X\n", + register_id)); status = AE_BAD_PARAMETER; break; } -unlock_and_exit: + unlock_and_exit: if (ACPI_MTX_LOCK == use_lock) { - (void) acpi_ut_release_mutex (ACPI_MTX_HARDWARE); + (void)acpi_ut_release_mutex(ACPI_MTX_HARDWARE); } - if (ACPI_SUCCESS (status)) { + if (ACPI_SUCCESS(status)) { *return_value = value1; } - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - /****************************************************************************** * * FUNCTION: acpi_hw_register_write @@ -610,109 +602,112 @@ unlock_and_exit: * ******************************************************************************/ -acpi_status -acpi_hw_register_write ( - u8 use_lock, - u32 register_id, - u32 value) +acpi_status acpi_hw_register_write(u8 use_lock, u32 register_id, u32 value) { - acpi_status status; - - - ACPI_FUNCTION_TRACE ("hw_register_write"); + acpi_status status; + ACPI_FUNCTION_TRACE("hw_register_write"); if (ACPI_MTX_LOCK == use_lock) { - status = acpi_ut_acquire_mutex (ACPI_MTX_HARDWARE); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ut_acquire_mutex(ACPI_MTX_HARDWARE); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } } switch (register_id) { - case ACPI_REGISTER_PM1_STATUS: /* 16-bit access */ + case ACPI_REGISTER_PM1_STATUS: /* 16-bit access */ - status = acpi_hw_low_level_write (16, value, &acpi_gbl_FADT->xpm1a_evt_blk); - if (ACPI_FAILURE (status)) { + status = + acpi_hw_low_level_write(16, value, + &acpi_gbl_FADT->xpm1a_evt_blk); + if (ACPI_FAILURE(status)) { goto unlock_and_exit; } /* PM1B is optional */ - status = acpi_hw_low_level_write (16, value, &acpi_gbl_FADT->xpm1b_evt_blk); + status = + acpi_hw_low_level_write(16, value, + &acpi_gbl_FADT->xpm1b_evt_blk); break; + case ACPI_REGISTER_PM1_ENABLE: /* 16-bit access */ - case ACPI_REGISTER_PM1_ENABLE: /* 16-bit access*/ - - status = acpi_hw_low_level_write (16, value, &acpi_gbl_xpm1a_enable); - if (ACPI_FAILURE (status)) { + status = + acpi_hw_low_level_write(16, value, &acpi_gbl_xpm1a_enable); + if (ACPI_FAILURE(status)) { goto unlock_and_exit; } /* PM1B is optional */ - status = acpi_hw_low_level_write (16, value, &acpi_gbl_xpm1b_enable); + status = + acpi_hw_low_level_write(16, value, &acpi_gbl_xpm1b_enable); break; + case ACPI_REGISTER_PM1_CONTROL: /* 16-bit access */ - case ACPI_REGISTER_PM1_CONTROL: /* 16-bit access */ - - status = acpi_hw_low_level_write (16, value, &acpi_gbl_FADT->xpm1a_cnt_blk); - if (ACPI_FAILURE (status)) { + status = + acpi_hw_low_level_write(16, value, + &acpi_gbl_FADT->xpm1a_cnt_blk); + if (ACPI_FAILURE(status)) { goto unlock_and_exit; } - status = acpi_hw_low_level_write (16, value, &acpi_gbl_FADT->xpm1b_cnt_blk); + status = + acpi_hw_low_level_write(16, value, + &acpi_gbl_FADT->xpm1b_cnt_blk); break; + case ACPI_REGISTER_PM1A_CONTROL: /* 16-bit access */ - case ACPI_REGISTER_PM1A_CONTROL: /* 16-bit access */ - - status = acpi_hw_low_level_write (16, value, &acpi_gbl_FADT->xpm1a_cnt_blk); + status = + acpi_hw_low_level_write(16, value, + &acpi_gbl_FADT->xpm1a_cnt_blk); break; + case ACPI_REGISTER_PM1B_CONTROL: /* 16-bit access */ - case ACPI_REGISTER_PM1B_CONTROL: /* 16-bit access */ - - status = acpi_hw_low_level_write (16, value, &acpi_gbl_FADT->xpm1b_cnt_blk); + status = + acpi_hw_low_level_write(16, value, + &acpi_gbl_FADT->xpm1b_cnt_blk); break; + case ACPI_REGISTER_PM2_CONTROL: /* 8-bit access */ - case ACPI_REGISTER_PM2_CONTROL: /* 8-bit access */ - - status = acpi_hw_low_level_write (8, value, &acpi_gbl_FADT->xpm2_cnt_blk); + status = + acpi_hw_low_level_write(8, value, + &acpi_gbl_FADT->xpm2_cnt_blk); break; + case ACPI_REGISTER_PM_TIMER: /* 32-bit access */ - case ACPI_REGISTER_PM_TIMER: /* 32-bit access */ - - status = acpi_hw_low_level_write (32, value, &acpi_gbl_FADT->xpm_tmr_blk); + status = + acpi_hw_low_level_write(32, value, + &acpi_gbl_FADT->xpm_tmr_blk); break; - - case ACPI_REGISTER_SMI_COMMAND_BLOCK: /* 8-bit access */ + case ACPI_REGISTER_SMI_COMMAND_BLOCK: /* 8-bit access */ /* SMI_CMD is currently always in IO space */ - status = acpi_os_write_port (acpi_gbl_FADT->smi_cmd, value, 8); + status = acpi_os_write_port(acpi_gbl_FADT->smi_cmd, value, 8); break; - default: status = AE_BAD_PARAMETER; break; } -unlock_and_exit: + unlock_and_exit: if (ACPI_MTX_LOCK == use_lock) { - (void) acpi_ut_release_mutex (ACPI_MTX_HARDWARE); + (void)acpi_ut_release_mutex(ACPI_MTX_HARDWARE); } - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - /****************************************************************************** * * FUNCTION: acpi_hw_low_level_read @@ -728,17 +723,12 @@ unlock_and_exit: ******************************************************************************/ acpi_status -acpi_hw_low_level_read ( - u32 width, - u32 *value, - struct acpi_generic_address *reg) +acpi_hw_low_level_read(u32 width, u32 * value, struct acpi_generic_address *reg) { - u64 address; - acpi_status status; - - - ACPI_FUNCTION_NAME ("hw_low_level_read"); + u64 address; + acpi_status status; + ACPI_FUNCTION_NAME("hw_low_level_read"); /* * Must have a valid pointer to a GAS structure, and @@ -751,7 +741,7 @@ acpi_hw_low_level_read ( /* Get a local copy of the address. Handles possible alignment issues */ - ACPI_MOVE_64_TO_64 (&address, ®->address); + ACPI_MOVE_64_TO_64(&address, ®->address); if (!address) { return (AE_OK); } @@ -764,35 +754,32 @@ acpi_hw_low_level_read ( switch (reg->address_space_id) { case ACPI_ADR_SPACE_SYSTEM_MEMORY: - status = acpi_os_read_memory ( - (acpi_physical_address) address, - value, width); + status = acpi_os_read_memory((acpi_physical_address) address, + value, width); break; - case ACPI_ADR_SPACE_SYSTEM_IO: - status = acpi_os_read_port ((acpi_io_address) address, - value, width); + status = acpi_os_read_port((acpi_io_address) address, + value, width); break; - default: - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Unsupported address space: %X\n", reg->address_space_id)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Unsupported address space: %X\n", + reg->address_space_id)); return (AE_BAD_PARAMETER); } - ACPI_DEBUG_PRINT ((ACPI_DB_IO, - "Read: %8.8X width %2d from %8.8X%8.8X (%s)\n", - *value, width, - ACPI_FORMAT_UINT64 (address), - acpi_ut_get_region_name (reg->address_space_id))); + ACPI_DEBUG_PRINT((ACPI_DB_IO, + "Read: %8.8X width %2d from %8.8X%8.8X (%s)\n", + *value, width, + ACPI_FORMAT_UINT64(address), + acpi_ut_get_region_name(reg->address_space_id))); return (status); } - /****************************************************************************** * * FUNCTION: acpi_hw_low_level_write @@ -808,17 +795,12 @@ acpi_hw_low_level_read ( ******************************************************************************/ acpi_status -acpi_hw_low_level_write ( - u32 width, - u32 value, - struct acpi_generic_address *reg) +acpi_hw_low_level_write(u32 width, u32 value, struct acpi_generic_address * reg) { - u64 address; - acpi_status status; - - - ACPI_FUNCTION_NAME ("hw_low_level_write"); + u64 address; + acpi_status status; + ACPI_FUNCTION_NAME("hw_low_level_write"); /* * Must have a valid pointer to a GAS structure, and @@ -831,7 +813,7 @@ acpi_hw_low_level_write ( /* Get a local copy of the address. Handles possible alignment issues */ - ACPI_MOVE_64_TO_64 (&address, ®->address); + ACPI_MOVE_64_TO_64(&address, ®->address); if (!address) { return (AE_OK); } @@ -843,30 +825,28 @@ acpi_hw_low_level_write ( switch (reg->address_space_id) { case ACPI_ADR_SPACE_SYSTEM_MEMORY: - status = acpi_os_write_memory ( - (acpi_physical_address) address, - value, width); + status = acpi_os_write_memory((acpi_physical_address) address, + value, width); break; - case ACPI_ADR_SPACE_SYSTEM_IO: - status = acpi_os_write_port ((acpi_io_address) address, - value, width); + status = acpi_os_write_port((acpi_io_address) address, + value, width); break; - default: - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Unsupported address space: %X\n", reg->address_space_id)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Unsupported address space: %X\n", + reg->address_space_id)); return (AE_BAD_PARAMETER); } - ACPI_DEBUG_PRINT ((ACPI_DB_IO, - "Wrote: %8.8X width %2d to %8.8X%8.8X (%s)\n", - value, width, - ACPI_FORMAT_UINT64 (address), - acpi_ut_get_region_name (reg->address_space_id))); + ACPI_DEBUG_PRINT((ACPI_DB_IO, + "Wrote: %8.8X width %2d to %8.8X%8.8X (%s)\n", + value, width, + ACPI_FORMAT_UINT64(address), + acpi_ut_get_region_name(reg->address_space_id))); return (status); } diff --git a/drivers/acpi/hardware/hwsleep.c b/drivers/acpi/hardware/hwsleep.c index cedee0c43b5..34519069050 100644 --- a/drivers/acpi/hardware/hwsleep.c +++ b/drivers/acpi/hardware/hwsleep.c @@ -46,8 +46,7 @@ #include #define _COMPONENT ACPI_HARDWARE - ACPI_MODULE_NAME ("hwsleep") - +ACPI_MODULE_NAME("hwsleep") /******************************************************************************* * @@ -61,30 +60,25 @@ * DESCRIPTION: Access function for the firmware_waking_vector field in FACS * ******************************************************************************/ - acpi_status -acpi_set_firmware_waking_vector ( - acpi_physical_address physical_address) +acpi_set_firmware_waking_vector(acpi_physical_address physical_address) { - ACPI_FUNCTION_TRACE ("acpi_set_firmware_waking_vector"); - + ACPI_FUNCTION_TRACE("acpi_set_firmware_waking_vector"); /* Set the vector */ if (acpi_gbl_common_fACS.vector_width == 32) { - *(ACPI_CAST_PTR (u32, acpi_gbl_common_fACS.firmware_waking_vector)) - = (u32) physical_address; - } - else { - *acpi_gbl_common_fACS.firmware_waking_vector - = physical_address; + *(ACPI_CAST_PTR + (u32, acpi_gbl_common_fACS.firmware_waking_vector)) + = (u32) physical_address; + } else { + *acpi_gbl_common_fACS.firmware_waking_vector = physical_address; } - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_get_firmware_waking_vector @@ -101,33 +95,31 @@ acpi_set_firmware_waking_vector ( #ifdef ACPI_FUTURE_USAGE acpi_status -acpi_get_firmware_waking_vector ( - acpi_physical_address *physical_address) +acpi_get_firmware_waking_vector(acpi_physical_address * physical_address) { - ACPI_FUNCTION_TRACE ("acpi_get_firmware_waking_vector"); - + ACPI_FUNCTION_TRACE("acpi_get_firmware_waking_vector"); if (!physical_address) { - return_ACPI_STATUS (AE_BAD_PARAMETER); + return_ACPI_STATUS(AE_BAD_PARAMETER); } /* Get the vector */ if (acpi_gbl_common_fACS.vector_width == 32) { *physical_address = (acpi_physical_address) - *(ACPI_CAST_PTR (u32, acpi_gbl_common_fACS.firmware_waking_vector)); - } - else { + * + (ACPI_CAST_PTR + (u32, acpi_gbl_common_fACS.firmware_waking_vector)); + } else { *physical_address = - *acpi_gbl_common_fACS.firmware_waking_vector; + *acpi_gbl_common_fACS.firmware_waking_vector; } - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } #endif - /******************************************************************************* * * FUNCTION: acpi_enter_sleep_state_prep @@ -143,25 +135,22 @@ acpi_get_firmware_waking_vector ( * ******************************************************************************/ -acpi_status -acpi_enter_sleep_state_prep ( - u8 sleep_state) +acpi_status acpi_enter_sleep_state_prep(u8 sleep_state) { - acpi_status status; - struct acpi_object_list arg_list; - union acpi_object arg; - - - ACPI_FUNCTION_TRACE ("acpi_enter_sleep_state_prep"); + acpi_status status; + struct acpi_object_list arg_list; + union acpi_object arg; + ACPI_FUNCTION_TRACE("acpi_enter_sleep_state_prep"); /* * _PSW methods could be run here to enable wake-on keyboard, LAN, etc. */ - status = acpi_get_sleep_type_data (sleep_state, - &acpi_gbl_sleep_type_a, &acpi_gbl_sleep_type_b); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_get_sleep_type_data(sleep_state, + &acpi_gbl_sleep_type_a, + &acpi_gbl_sleep_type_b); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* Setup parameter object */ @@ -174,14 +163,14 @@ acpi_enter_sleep_state_prep ( /* Run the _PTS and _GTS methods */ - status = acpi_evaluate_object (NULL, METHOD_NAME__PTS, &arg_list, NULL); - if (ACPI_FAILURE (status) && status != AE_NOT_FOUND) { - return_ACPI_STATUS (status); + status = acpi_evaluate_object(NULL, METHOD_NAME__PTS, &arg_list, NULL); + if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) { + return_ACPI_STATUS(status); } - status = acpi_evaluate_object (NULL, METHOD_NAME__GTS, &arg_list, NULL); - if (ACPI_FAILURE (status) && status != AE_NOT_FOUND) { - return_ACPI_STATUS (status); + status = acpi_evaluate_object(NULL, METHOD_NAME__GTS, &arg_list, NULL); + if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) { + return_ACPI_STATUS(status); } /* Setup the argument to _SST */ @@ -202,22 +191,21 @@ acpi_enter_sleep_state_prep ( break; default: - arg.integer.value = ACPI_SST_INDICATOR_OFF; /* Default is off */ + arg.integer.value = ACPI_SST_INDICATOR_OFF; /* Default is off */ break; } /* Set the system indicators to show the desired sleep state. */ - status = acpi_evaluate_object (NULL, METHOD_NAME__SST, &arg_list, NULL); - if (ACPI_FAILURE (status) && status != AE_NOT_FOUND) { - ACPI_REPORT_ERROR (("Method _SST failed, %s\n", - acpi_format_exception (status))); + status = acpi_evaluate_object(NULL, METHOD_NAME__SST, &arg_list, NULL); + if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) { + ACPI_REPORT_ERROR(("Method _SST failed, %s\n", + acpi_format_exception(status))); } - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_enter_sleep_state @@ -231,80 +219,82 @@ acpi_enter_sleep_state_prep ( * ******************************************************************************/ -acpi_status asmlinkage -acpi_enter_sleep_state ( - u8 sleep_state) +acpi_status asmlinkage acpi_enter_sleep_state(u8 sleep_state) { - u32 PM1Acontrol; - u32 PM1Bcontrol; - struct acpi_bit_register_info *sleep_type_reg_info; - struct acpi_bit_register_info *sleep_enable_reg_info; - u32 in_value; - acpi_status status; - - - ACPI_FUNCTION_TRACE ("acpi_enter_sleep_state"); + u32 PM1Acontrol; + u32 PM1Bcontrol; + struct acpi_bit_register_info *sleep_type_reg_info; + struct acpi_bit_register_info *sleep_enable_reg_info; + u32 in_value; + acpi_status status; + ACPI_FUNCTION_TRACE("acpi_enter_sleep_state"); if ((acpi_gbl_sleep_type_a > ACPI_SLEEP_TYPE_MAX) || - (acpi_gbl_sleep_type_b > ACPI_SLEEP_TYPE_MAX)) { - ACPI_REPORT_ERROR (("Sleep values out of range: A=%X B=%X\n", - acpi_gbl_sleep_type_a, acpi_gbl_sleep_type_b)); - return_ACPI_STATUS (AE_AML_OPERAND_VALUE); + (acpi_gbl_sleep_type_b > ACPI_SLEEP_TYPE_MAX)) { + ACPI_REPORT_ERROR(("Sleep values out of range: A=%X B=%X\n", + acpi_gbl_sleep_type_a, + acpi_gbl_sleep_type_b)); + return_ACPI_STATUS(AE_AML_OPERAND_VALUE); } - sleep_type_reg_info = acpi_hw_get_bit_register_info (ACPI_BITREG_SLEEP_TYPE_A); - sleep_enable_reg_info = acpi_hw_get_bit_register_info (ACPI_BITREG_SLEEP_ENABLE); + sleep_type_reg_info = + acpi_hw_get_bit_register_info(ACPI_BITREG_SLEEP_TYPE_A); + sleep_enable_reg_info = + acpi_hw_get_bit_register_info(ACPI_BITREG_SLEEP_ENABLE); /* Clear wake status */ - status = acpi_set_register (ACPI_BITREG_WAKE_STATUS, 1, ACPI_MTX_DO_NOT_LOCK); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = + acpi_set_register(ACPI_BITREG_WAKE_STATUS, 1, ACPI_MTX_DO_NOT_LOCK); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* Clear all fixed and general purpose status bits */ - status = acpi_hw_clear_acpi_status (ACPI_MTX_DO_NOT_LOCK); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_hw_clear_acpi_status(ACPI_MTX_DO_NOT_LOCK); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* * 1) Disable/Clear all GPEs * 2) Enable all wakeup GPEs */ - status = acpi_hw_disable_all_gpes (); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_hw_disable_all_gpes(); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } acpi_gbl_system_awake_and_running = FALSE; - status = acpi_hw_enable_all_wakeup_gpes (); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_hw_enable_all_wakeup_gpes(); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* Get current value of PM1A control */ - status = acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK, - ACPI_REGISTER_PM1_CONTROL, &PM1Acontrol); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_hw_register_read(ACPI_MTX_DO_NOT_LOCK, + ACPI_REGISTER_PM1_CONTROL, &PM1Acontrol); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } - ACPI_DEBUG_PRINT ((ACPI_DB_INIT, - "Entering sleep state [S%d]\n", sleep_state)); + ACPI_DEBUG_PRINT((ACPI_DB_INIT, + "Entering sleep state [S%d]\n", sleep_state)); /* Clear SLP_EN and SLP_TYP fields */ PM1Acontrol &= ~(sleep_type_reg_info->access_bit_mask | - sleep_enable_reg_info->access_bit_mask); + sleep_enable_reg_info->access_bit_mask); PM1Bcontrol = PM1Acontrol; /* Insert SLP_TYP bits */ - PM1Acontrol |= (acpi_gbl_sleep_type_a << sleep_type_reg_info->bit_position); - PM1Bcontrol |= (acpi_gbl_sleep_type_b << sleep_type_reg_info->bit_position); + PM1Acontrol |= + (acpi_gbl_sleep_type_a << sleep_type_reg_info->bit_position); + PM1Bcontrol |= + (acpi_gbl_sleep_type_b << sleep_type_reg_info->bit_position); /* * We split the writes of SLP_TYP and SLP_EN to workaround @@ -313,16 +303,18 @@ acpi_enter_sleep_state ( /* Write #1: fill in SLP_TYP data */ - status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, - ACPI_REGISTER_PM1A_CONTROL, PM1Acontrol); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK, + ACPI_REGISTER_PM1A_CONTROL, + PM1Acontrol); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } - status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, - ACPI_REGISTER_PM1B_CONTROL, PM1Bcontrol); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK, + ACPI_REGISTER_PM1B_CONTROL, + PM1Bcontrol); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* Insert SLP_ENABLE bit */ @@ -332,18 +324,20 @@ acpi_enter_sleep_state ( /* Write #2: SLP_TYP + SLP_EN */ - ACPI_FLUSH_CPU_CACHE (); + ACPI_FLUSH_CPU_CACHE(); - status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, - ACPI_REGISTER_PM1A_CONTROL, PM1Acontrol); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK, + ACPI_REGISTER_PM1A_CONTROL, + PM1Acontrol); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } - status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, - ACPI_REGISTER_PM1B_CONTROL, PM1Bcontrol); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK, + ACPI_REGISTER_PM1B_CONTROL, + PM1Bcontrol); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } if (sleep_state > ACPI_STATE_S3) { @@ -358,33 +352,34 @@ acpi_enter_sleep_state ( * still read the right value. Ideally, this block would go * away entirely. */ - acpi_os_stall (10000000); - - status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, - ACPI_REGISTER_PM1_CONTROL, - sleep_enable_reg_info->access_bit_mask); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + acpi_os_stall(10000000); + + status = acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK, + ACPI_REGISTER_PM1_CONTROL, + sleep_enable_reg_info-> + access_bit_mask); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } } /* Wait until we enter sleep state */ do { - status = acpi_get_register (ACPI_BITREG_WAKE_STATUS, &in_value, - ACPI_MTX_DO_NOT_LOCK); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_get_register(ACPI_BITREG_WAKE_STATUS, &in_value, + ACPI_MTX_DO_NOT_LOCK); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* Spin until we wake */ } while (!in_value); - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } -EXPORT_SYMBOL(acpi_enter_sleep_state); +EXPORT_SYMBOL(acpi_enter_sleep_state); /******************************************************************************* * @@ -399,60 +394,57 @@ EXPORT_SYMBOL(acpi_enter_sleep_state); * ******************************************************************************/ -acpi_status asmlinkage -acpi_enter_sleep_state_s4bios ( - void) +acpi_status asmlinkage acpi_enter_sleep_state_s4bios(void) { - u32 in_value; - acpi_status status; - + u32 in_value; + acpi_status status; - ACPI_FUNCTION_TRACE ("acpi_enter_sleep_state_s4bios"); + ACPI_FUNCTION_TRACE("acpi_enter_sleep_state_s4bios"); - - status = acpi_set_register (ACPI_BITREG_WAKE_STATUS, 1, ACPI_MTX_DO_NOT_LOCK); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = + acpi_set_register(ACPI_BITREG_WAKE_STATUS, 1, ACPI_MTX_DO_NOT_LOCK); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } - status = acpi_hw_clear_acpi_status (ACPI_MTX_DO_NOT_LOCK); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_hw_clear_acpi_status(ACPI_MTX_DO_NOT_LOCK); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* * 1) Disable/Clear all GPEs * 2) Enable all wakeup GPEs */ - status = acpi_hw_disable_all_gpes (); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_hw_disable_all_gpes(); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } acpi_gbl_system_awake_and_running = FALSE; - status = acpi_hw_enable_all_wakeup_gpes (); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_hw_enable_all_wakeup_gpes(); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } - ACPI_FLUSH_CPU_CACHE (); + ACPI_FLUSH_CPU_CACHE(); - status = acpi_os_write_port (acpi_gbl_FADT->smi_cmd, - (u32) acpi_gbl_FADT->S4bios_req, 8); + status = acpi_os_write_port(acpi_gbl_FADT->smi_cmd, + (u32) acpi_gbl_FADT->S4bios_req, 8); do { acpi_os_stall(1000); - status = acpi_get_register (ACPI_BITREG_WAKE_STATUS, &in_value, - ACPI_MTX_DO_NOT_LOCK); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_get_register(ACPI_BITREG_WAKE_STATUS, &in_value, + ACPI_MTX_DO_NOT_LOCK); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } } while (!in_value); - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } -EXPORT_SYMBOL(acpi_enter_sleep_state_s4bios); +EXPORT_SYMBOL(acpi_enter_sleep_state_s4bios); /******************************************************************************* * @@ -467,55 +459,62 @@ EXPORT_SYMBOL(acpi_enter_sleep_state_s4bios); * ******************************************************************************/ -acpi_status -acpi_leave_sleep_state ( - u8 sleep_state) +acpi_status acpi_leave_sleep_state(u8 sleep_state) { - struct acpi_object_list arg_list; - union acpi_object arg; - acpi_status status; - struct acpi_bit_register_info *sleep_type_reg_info; - struct acpi_bit_register_info *sleep_enable_reg_info; - u32 PM1Acontrol; - u32 PM1Bcontrol; - - - ACPI_FUNCTION_TRACE ("acpi_leave_sleep_state"); + struct acpi_object_list arg_list; + union acpi_object arg; + acpi_status status; + struct acpi_bit_register_info *sleep_type_reg_info; + struct acpi_bit_register_info *sleep_enable_reg_info; + u32 PM1Acontrol; + u32 PM1Bcontrol; + ACPI_FUNCTION_TRACE("acpi_leave_sleep_state"); /* * Set SLP_TYPE and SLP_EN to state S0. * This is unclear from the ACPI Spec, but it is required * by some machines. */ - status = acpi_get_sleep_type_data (ACPI_STATE_S0, - &acpi_gbl_sleep_type_a, &acpi_gbl_sleep_type_b); - if (ACPI_SUCCESS (status)) { - sleep_type_reg_info = acpi_hw_get_bit_register_info (ACPI_BITREG_SLEEP_TYPE_A); - sleep_enable_reg_info = acpi_hw_get_bit_register_info (ACPI_BITREG_SLEEP_ENABLE); + status = acpi_get_sleep_type_data(ACPI_STATE_S0, + &acpi_gbl_sleep_type_a, + &acpi_gbl_sleep_type_b); + if (ACPI_SUCCESS(status)) { + sleep_type_reg_info = + acpi_hw_get_bit_register_info(ACPI_BITREG_SLEEP_TYPE_A); + sleep_enable_reg_info = + acpi_hw_get_bit_register_info(ACPI_BITREG_SLEEP_ENABLE); /* Get current value of PM1A control */ - status = acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK, - ACPI_REGISTER_PM1_CONTROL, &PM1Acontrol); - if (ACPI_SUCCESS (status)) { + status = acpi_hw_register_read(ACPI_MTX_DO_NOT_LOCK, + ACPI_REGISTER_PM1_CONTROL, + &PM1Acontrol); + if (ACPI_SUCCESS(status)) { /* Clear SLP_EN and SLP_TYP fields */ PM1Acontrol &= ~(sleep_type_reg_info->access_bit_mask | - sleep_enable_reg_info->access_bit_mask); + sleep_enable_reg_info-> + access_bit_mask); PM1Bcontrol = PM1Acontrol; /* Insert SLP_TYP bits */ - PM1Acontrol |= (acpi_gbl_sleep_type_a << sleep_type_reg_info->bit_position); - PM1Bcontrol |= (acpi_gbl_sleep_type_b << sleep_type_reg_info->bit_position); + PM1Acontrol |= + (acpi_gbl_sleep_type_a << sleep_type_reg_info-> + bit_position); + PM1Bcontrol |= + (acpi_gbl_sleep_type_b << sleep_type_reg_info-> + bit_position); /* Just ignore any errors */ - (void) acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, - ACPI_REGISTER_PM1A_CONTROL, PM1Acontrol); - (void) acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, - ACPI_REGISTER_PM1B_CONTROL, PM1Bcontrol); + (void)acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK, + ACPI_REGISTER_PM1A_CONTROL, + PM1Acontrol); + (void)acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK, + ACPI_REGISTER_PM1B_CONTROL, + PM1Bcontrol); } } @@ -532,23 +531,23 @@ acpi_leave_sleep_state ( /* Ignore any errors from these methods */ arg.integer.value = ACPI_SST_WAKING; - status = acpi_evaluate_object (NULL, METHOD_NAME__SST, &arg_list, NULL); - if (ACPI_FAILURE (status) && status != AE_NOT_FOUND) { - ACPI_REPORT_ERROR (("Method _SST failed, %s\n", - acpi_format_exception (status))); + status = acpi_evaluate_object(NULL, METHOD_NAME__SST, &arg_list, NULL); + if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) { + ACPI_REPORT_ERROR(("Method _SST failed, %s\n", + acpi_format_exception(status))); } arg.integer.value = sleep_state; - status = acpi_evaluate_object (NULL, METHOD_NAME__BFS, &arg_list, NULL); - if (ACPI_FAILURE (status) && status != AE_NOT_FOUND) { - ACPI_REPORT_ERROR (("Method _BFS failed, %s\n", - acpi_format_exception (status))); + status = acpi_evaluate_object(NULL, METHOD_NAME__BFS, &arg_list, NULL); + if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) { + ACPI_REPORT_ERROR(("Method _BFS failed, %s\n", + acpi_format_exception(status))); } - status = acpi_evaluate_object (NULL, METHOD_NAME__WAK, &arg_list, NULL); - if (ACPI_FAILURE (status) && status != AE_NOT_FOUND) { - ACPI_REPORT_ERROR (("Method _WAK failed, %s\n", - acpi_format_exception (status))); + status = acpi_evaluate_object(NULL, METHOD_NAME__WAK, &arg_list, NULL); + if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) { + ACPI_REPORT_ERROR(("Method _WAK failed, %s\n", + acpi_format_exception(status))); } /* TBD: _WAK "sometimes" returns stuff - do we want to look at it? */ @@ -557,33 +556,35 @@ acpi_leave_sleep_state ( * 1) Disable/Clear all GPEs * 2) Enable all runtime GPEs */ - status = acpi_hw_disable_all_gpes (); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_hw_disable_all_gpes(); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } acpi_gbl_system_awake_and_running = TRUE; - status = acpi_hw_enable_all_runtime_gpes (); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_hw_enable_all_runtime_gpes(); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* Enable power button */ - (void) acpi_set_register( - acpi_gbl_fixed_event_info[ACPI_EVENT_POWER_BUTTON].enable_register_id, - 1, ACPI_MTX_DO_NOT_LOCK); + (void) + acpi_set_register(acpi_gbl_fixed_event_info + [ACPI_EVENT_POWER_BUTTON].enable_register_id, 1, + ACPI_MTX_DO_NOT_LOCK); - (void) acpi_set_register( - acpi_gbl_fixed_event_info[ACPI_EVENT_POWER_BUTTON].status_register_id, - 1, ACPI_MTX_DO_NOT_LOCK); + (void) + acpi_set_register(acpi_gbl_fixed_event_info + [ACPI_EVENT_POWER_BUTTON].status_register_id, 1, + ACPI_MTX_DO_NOT_LOCK); arg.integer.value = ACPI_SST_WORKING; - status = acpi_evaluate_object (NULL, METHOD_NAME__SST, &arg_list, NULL); - if (ACPI_FAILURE (status) && status != AE_NOT_FOUND) { - ACPI_REPORT_ERROR (("Method _SST failed, %s\n", - acpi_format_exception (status))); + status = acpi_evaluate_object(NULL, METHOD_NAME__SST, &arg_list, NULL); + if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) { + ACPI_REPORT_ERROR(("Method _SST failed, %s\n", + acpi_format_exception(status))); } - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } diff --git a/drivers/acpi/hardware/hwtimer.c b/drivers/acpi/hardware/hwtimer.c index 49d7b395322..aff6dc14178 100644 --- a/drivers/acpi/hardware/hwtimer.c +++ b/drivers/acpi/hardware/hwtimer.c @@ -46,8 +46,7 @@ #include #define _COMPONENT ACPI_HARDWARE - ACPI_MODULE_NAME ("hwtimer") - +ACPI_MODULE_NAME("hwtimer") /****************************************************************************** * @@ -60,29 +59,23 @@ * DESCRIPTION: Obtains resolution of the ACPI PM Timer (24 or 32 bits). * ******************************************************************************/ - -acpi_status -acpi_get_timer_resolution ( - u32 *resolution) +acpi_status acpi_get_timer_resolution(u32 * resolution) { - ACPI_FUNCTION_TRACE ("acpi_get_timer_resolution"); - + ACPI_FUNCTION_TRACE("acpi_get_timer_resolution"); if (!resolution) { - return_ACPI_STATUS (AE_BAD_PARAMETER); + return_ACPI_STATUS(AE_BAD_PARAMETER); } if (0 == acpi_gbl_FADT->tmr_val_ext) { *resolution = 24; - } - else { + } else { *resolution = 32; } - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - /****************************************************************************** * * FUNCTION: acpi_get_timer @@ -95,26 +88,22 @@ acpi_get_timer_resolution ( * ******************************************************************************/ -acpi_status -acpi_get_timer ( - u32 *ticks) +acpi_status acpi_get_timer(u32 * ticks) { - acpi_status status; - - - ACPI_FUNCTION_TRACE ("acpi_get_timer"); + acpi_status status; + ACPI_FUNCTION_TRACE("acpi_get_timer"); if (!ticks) { - return_ACPI_STATUS (AE_BAD_PARAMETER); + return_ACPI_STATUS(AE_BAD_PARAMETER); } - status = acpi_hw_low_level_read (32, ticks, &acpi_gbl_FADT->xpm_tmr_blk); + status = acpi_hw_low_level_read(32, ticks, &acpi_gbl_FADT->xpm_tmr_blk); - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } -EXPORT_SYMBOL(acpi_get_timer); +EXPORT_SYMBOL(acpi_get_timer); /****************************************************************************** * @@ -146,21 +135,16 @@ EXPORT_SYMBOL(acpi_get_timer); ******************************************************************************/ acpi_status -acpi_get_timer_duration ( - u32 start_ticks, - u32 end_ticks, - u32 *time_elapsed) +acpi_get_timer_duration(u32 start_ticks, u32 end_ticks, u32 * time_elapsed) { - acpi_status status; - u32 delta_ticks; - acpi_integer quotient; - - - ACPI_FUNCTION_TRACE ("acpi_get_timer_duration"); + acpi_status status; + u32 delta_ticks; + acpi_integer quotient; + ACPI_FUNCTION_TRACE("acpi_get_timer_duration"); if (!time_elapsed) { - return_ACPI_STATUS (AE_BAD_PARAMETER); + return_ACPI_STATUS(AE_BAD_PARAMETER); } /* @@ -169,22 +153,22 @@ acpi_get_timer_duration ( */ if (start_ticks < end_ticks) { delta_ticks = end_ticks - start_ticks; - } - else if (start_ticks > end_ticks) { + } else if (start_ticks > end_ticks) { if (0 == acpi_gbl_FADT->tmr_val_ext) { /* 24-bit Timer */ - delta_ticks = (((0x00FFFFFF - start_ticks) + end_ticks) & 0x00FFFFFF); - } - else { + delta_ticks = + (((0x00FFFFFF - start_ticks) + + end_ticks) & 0x00FFFFFF); + } else { /* 32-bit Timer */ delta_ticks = (0xFFFFFFFF - start_ticks) + end_ticks; } - } - else /* start_ticks == end_ticks */ { + } else { /* start_ticks == end_ticks */ + *time_elapsed = 0; - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } /* @@ -192,12 +176,11 @@ acpi_get_timer_duration ( * * time_elapsed = (delta_ticks * 1000000) / PM_TIMER_FREQUENCY; */ - status = acpi_ut_short_divide (((u64) delta_ticks) * 1000000, - PM_TIMER_FREQUENCY, "ient, NULL); + status = acpi_ut_short_divide(((u64) delta_ticks) * 1000000, + PM_TIMER_FREQUENCY, "ient, NULL); *time_elapsed = (u32) quotient; - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } EXPORT_SYMBOL(acpi_get_timer_duration); - diff --git a/drivers/acpi/hotkey.c b/drivers/acpi/hotkey.c index 1f76a40bade..2e2e4051dfa 100644 --- a/drivers/acpi/hotkey.c +++ b/drivers/acpi/hotkey.c @@ -62,7 +62,7 @@ #define _COMPONENT ACPI_HOTKEY_COMPONENT ACPI_MODULE_NAME("acpi_hotkey") -MODULE_AUTHOR("luming.yu@intel.com"); + MODULE_AUTHOR("luming.yu@intel.com"); MODULE_DESCRIPTION(ACPI_HOTK_NAME); MODULE_LICENSE("GPL"); @@ -180,8 +180,8 @@ static int hotkey_config_seq_show(struct seq_file *seq, void *offset); static int hotkey_poll_config_seq_show(struct seq_file *seq, void *offset); static int hotkey_polling_open_fs(struct inode *inode, struct file *file); static union acpi_hotkey *get_hotkey_by_event(struct - acpi_hotkey_list - *hotkey_list, int event); + acpi_hotkey_list + *hotkey_list, int event); /* event based config */ static struct file_operations hotkey_config_fops = { @@ -246,7 +246,7 @@ static int hotkey_info_open_fs(struct inode *inode, struct file *file) static char *format_result(union acpi_object *object) { char *buf = NULL; - + buf = (char *)kmalloc(RESULT_STR_LEN, GFP_KERNEL); if (buf) memset(buf, 0, RESULT_STR_LEN); @@ -256,7 +256,7 @@ static char *format_result(union acpi_object *object) /* Now, just support integer type */ if (object->type == ACPI_TYPE_INTEGER) sprintf(buf, "%d\n", (u32) object->integer.value); -do_fail: + do_fail: return (buf); } @@ -268,9 +268,9 @@ static int hotkey_polling_seq_show(struct seq_file *seq, void *offset) ACPI_FUNCTION_TRACE("hotkey_polling_seq_show"); - if (poll_hotkey->poll_result){ + if (poll_hotkey->poll_result) { buf = format_result(poll_hotkey->poll_result); - if(buf) + if (buf) seq_printf(seq, "%s", buf); kfree(buf); } @@ -299,7 +299,7 @@ static int hotkey_get_internal_event(int event, struct acpi_hotkey_list *list) union acpi_hotkey *key = container_of(entries, union acpi_hotkey, entries); if (key->link.hotkey_type == ACPI_HOTKEY_EVENT - && key->event_hotkey.external_hotkey_num == event){ + && key->event_hotkey.external_hotkey_num == event) { val = key->link.hotkey_standard_num; break; } @@ -343,7 +343,7 @@ static int auto_hotkey_remove(struct acpi_device *device, int type) static int create_polling_proc(union acpi_hotkey *device) { struct proc_dir_entry *proc; - char proc_name[80]; + char proc_name[80]; mode_t mode; ACPI_FUNCTION_TRACE("create_polling_proc"); @@ -351,8 +351,8 @@ static int create_polling_proc(union acpi_hotkey *device) sprintf(proc_name, "%d", device->link.hotkey_standard_num); /* - strcat(proc_name, device->poll_hotkey.poll_method); - */ + strcat(proc_name, device->poll_hotkey.poll_method); + */ proc = create_proc_entry(proc_name, mode, hotkey_proc_dir); if (!proc) { @@ -415,50 +415,50 @@ static int hotkey_remove(union acpi_hotkey *device) return_VALUE(0); } -static int hotkey_update(union acpi_hotkey *key) +static int hotkey_update(union acpi_hotkey *key) { struct list_head *entries; ACPI_FUNCTION_TRACE("hotkey_update"); list_for_each(entries, global_hotkey_list.entries) { - union acpi_hotkey *tmp= + union acpi_hotkey *tmp = container_of(entries, union acpi_hotkey, entries); if (tmp->link.hotkey_standard_num == key->link.hotkey_standard_num) { if (key->link.hotkey_type == ACPI_HOTKEY_EVENT) { free_hotkey_buffer(tmp); tmp->event_hotkey.bus_handle = - key->event_hotkey.bus_handle; + key->event_hotkey.bus_handle; tmp->event_hotkey.external_hotkey_num = - key->event_hotkey.external_hotkey_num; + key->event_hotkey.external_hotkey_num; tmp->event_hotkey.action_handle = - key->event_hotkey.action_handle; + key->event_hotkey.action_handle; tmp->event_hotkey.action_method = - key->event_hotkey.action_method; + key->event_hotkey.action_method; kfree(key); } else { /* - char proc_name[80]; + char proc_name[80]; - sprintf(proc_name, "%d", tmp->link.hotkey_standard_num); - strcat(proc_name, tmp->poll_hotkey.poll_method); - remove_proc_entry(proc_name,hotkey_proc_dir); - */ + sprintf(proc_name, "%d", tmp->link.hotkey_standard_num); + strcat(proc_name, tmp->poll_hotkey.poll_method); + remove_proc_entry(proc_name,hotkey_proc_dir); + */ free_poll_hotkey_buffer(tmp); tmp->poll_hotkey.poll_handle = - key->poll_hotkey.poll_handle; + key->poll_hotkey.poll_handle; tmp->poll_hotkey.poll_method = - key->poll_hotkey.poll_method; + key->poll_hotkey.poll_method; tmp->poll_hotkey.action_handle = - key->poll_hotkey.action_handle; + key->poll_hotkey.action_handle; tmp->poll_hotkey.action_method = - key->poll_hotkey.action_method; + key->poll_hotkey.action_method; tmp->poll_hotkey.poll_result = - key->poll_hotkey.poll_result; + key->poll_hotkey.poll_result; /* - create_polling_proc(tmp); - */ + create_polling_proc(tmp); + */ kfree(key); } return_VALUE(0); @@ -483,27 +483,25 @@ static void free_hotkey_device(union acpi_hotkey *key) acpi_hotkey_notify_handler); free_hotkey_buffer(key); } else { - char proc_name[80]; + char proc_name[80]; sprintf(proc_name, "%d", key->link.hotkey_standard_num); /* - strcat(proc_name, key->poll_hotkey.poll_method); - */ - remove_proc_entry(proc_name,hotkey_proc_dir); + strcat(proc_name, key->poll_hotkey.poll_method); + */ + remove_proc_entry(proc_name, hotkey_proc_dir); free_poll_hotkey_buffer(key); } kfree(key); return_VOID; } -static void -free_hotkey_buffer(union acpi_hotkey *key) +static void free_hotkey_buffer(union acpi_hotkey *key) { kfree(key->event_hotkey.action_method); } -static void -free_poll_hotkey_buffer(union acpi_hotkey *key) +static void free_poll_hotkey_buffer(union acpi_hotkey *key) { kfree(key->poll_hotkey.action_method); kfree(key->poll_hotkey.poll_method); @@ -513,15 +511,15 @@ static int init_hotkey_device(union acpi_hotkey *key, char *bus_str, char *action_str, char *method, int std_num, int external_num) { - acpi_handle tmp_handle; + acpi_handle tmp_handle; acpi_status status = AE_OK; ACPI_FUNCTION_TRACE("init_hotkey_device"); - if(std_num < 0 || IS_POLL(std_num) || !key ) + if (std_num < 0 || IS_POLL(std_num) || !key) goto do_fail; - if(!bus_str || !action_str || !method) + if (!bus_str || !action_str || !method) goto do_fail; key->link.hotkey_type = ACPI_HOTKEY_EVENT; @@ -529,19 +527,22 @@ init_hotkey_device(union acpi_hotkey *key, char *bus_str, char *action_str, key->event_hotkey.flag = 0; key->event_hotkey.action_method = method; - status = acpi_get_handle(NULL,bus_str, &(key->event_hotkey.bus_handle)); - if(ACPI_FAILURE(status)) + status = + acpi_get_handle(NULL, bus_str, &(key->event_hotkey.bus_handle)); + if (ACPI_FAILURE(status)) goto do_fail; key->event_hotkey.external_hotkey_num = external_num; - status = acpi_get_handle(NULL,action_str, &(key->event_hotkey.action_handle)); - if(ACPI_FAILURE(status)) + status = + acpi_get_handle(NULL, action_str, + &(key->event_hotkey.action_handle)); + if (ACPI_FAILURE(status)) goto do_fail; status = acpi_get_handle(key->event_hotkey.action_handle, - method, &tmp_handle); + method, &tmp_handle); if (ACPI_FAILURE(status)) goto do_fail; return_VALUE(AE_OK); -do_fail: + do_fail: return_VALUE(-ENODEV); } @@ -552,14 +553,14 @@ init_poll_hotkey_device(union acpi_hotkey *key, char *action_str, char *action_method, int std_num) { acpi_status status = AE_OK; - acpi_handle tmp_handle; + acpi_handle tmp_handle; ACPI_FUNCTION_TRACE("init_poll_hotkey_device"); - if(std_num < 0 || IS_EVENT(std_num) || !key) + if (std_num < 0 || IS_EVENT(std_num) || !key) goto do_fail; - if(!poll_str || !poll_method || !action_str || !action_method) + if (!poll_str || !poll_method || !action_str || !action_method) goto do_fail; key->link.hotkey_type = ACPI_HOTKEY_POLLING; @@ -568,30 +569,32 @@ init_poll_hotkey_device(union acpi_hotkey *key, key->poll_hotkey.poll_method = poll_method; key->poll_hotkey.action_method = action_method; - status = acpi_get_handle(NULL,poll_str, &(key->poll_hotkey.poll_handle)); - if(ACPI_FAILURE(status)) + status = + acpi_get_handle(NULL, poll_str, &(key->poll_hotkey.poll_handle)); + if (ACPI_FAILURE(status)) goto do_fail; status = acpi_get_handle(key->poll_hotkey.poll_handle, - poll_method, &tmp_handle); - if (ACPI_FAILURE(status)) - goto do_fail; - status = acpi_get_handle(NULL,action_str, &(key->poll_hotkey.action_handle)); + poll_method, &tmp_handle); + if (ACPI_FAILURE(status)) + goto do_fail; + status = + acpi_get_handle(NULL, action_str, + &(key->poll_hotkey.action_handle)); if (ACPI_FAILURE(status)) goto do_fail; status = acpi_get_handle(key->poll_hotkey.action_handle, - action_method, &tmp_handle); + action_method, &tmp_handle); if (ACPI_FAILURE(status)) goto do_fail; key->poll_hotkey.poll_result = (union acpi_object *)kmalloc(sizeof(union acpi_object), GFP_KERNEL); - if(!key->poll_hotkey.poll_result) + if (!key->poll_hotkey.poll_result) goto do_fail; return_VALUE(AE_OK); -do_fail: + do_fail: return_VALUE(-ENODEV); } - static int hotkey_open_config(struct inode *inode, struct file *file) { ACPI_FUNCTION_TRACE("hotkey_open_config"); @@ -679,8 +682,9 @@ get_parms(char *config_record, sscanf(config_record, "%d", cmd); - if(*cmd == 1){ - if(sscanf(config_record, "%d:%d", cmd, internal_event_num)!=2) + if (*cmd == 1) { + if (sscanf(config_record, "%d:%d", cmd, internal_event_num) != + 2) goto do_fail; else return (6); @@ -694,8 +698,8 @@ get_parms(char *config_record, goto do_fail; count = tmp1 - tmp; - *bus_handle = (char *) kmalloc(count+1, GFP_KERNEL); - if(!*bus_handle) + *bus_handle = (char *)kmalloc(count + 1, GFP_KERNEL); + if (!*bus_handle) goto do_fail; strncpy(*bus_handle, tmp, count); *(*bus_handle + count) = 0; @@ -706,8 +710,8 @@ get_parms(char *config_record, if (!tmp1) goto do_fail; count = tmp1 - tmp; - *bus_method = (char *) kmalloc(count+1, GFP_KERNEL); - if(!*bus_method) + *bus_method = (char *)kmalloc(count + 1, GFP_KERNEL); + if (!*bus_method) goto do_fail; strncpy(*bus_method, tmp, count); *(*bus_method + count) = 0; @@ -718,7 +722,7 @@ get_parms(char *config_record, if (!tmp1) goto do_fail; count = tmp1 - tmp; - *action_handle = (char *) kmalloc(count+1, GFP_KERNEL); + *action_handle = (char *)kmalloc(count + 1, GFP_KERNEL); strncpy(*action_handle, tmp, count); *(*action_handle + count) = 0; @@ -728,17 +732,18 @@ get_parms(char *config_record, if (!tmp1) goto do_fail; count = tmp1 - tmp; - *method = (char *) kmalloc(count+1, GFP_KERNEL); - if(!*method) + *method = (char *)kmalloc(count + 1, GFP_KERNEL); + if (!*method) goto do_fail; strncpy(*method, tmp, count); *(*method + count) = 0; - if(sscanf(tmp1 + 1, "%d:%d", internal_event_num, external_event_num)<=0) + if (sscanf(tmp1 + 1, "%d:%d", internal_event_num, external_event_num) <= + 0) goto do_fail; return_VALUE(6); -do_fail: + do_fail: return_VALUE(-1); } @@ -758,8 +763,8 @@ static ssize_t hotkey_write_config(struct file *file, ACPI_FUNCTION_TRACE(("hotkey_write_config")); - config_record = (char *) kmalloc(count+1, GFP_KERNEL); - if(!config_record) + config_record = (char *)kmalloc(count + 1, GFP_KERNEL); + if (!config_record) return_VALUE(-ENOMEM); if (copy_from_user(config_record, buffer, count)) { @@ -777,10 +782,10 @@ static ssize_t hotkey_write_config(struct file *file, &method, &internal_event_num, &external_event_num); kfree(config_record); - if(IS_OTHERS(internal_event_num)) + if (IS_OTHERS(internal_event_num)) goto do_fail; if (ret != 6) { -do_fail: + do_fail: kfree(bus_handle); kfree(bus_method); kfree(action_handle); @@ -791,14 +796,14 @@ do_fail: } key = kmalloc(sizeof(union acpi_hotkey), GFP_KERNEL); - if(!key) + if (!key) goto do_fail; memset(key, 0, sizeof(union acpi_hotkey)); - if(cmd == 1) { + if (cmd == 1) { union acpi_hotkey *tmp = NULL; tmp = get_hotkey_by_event(&global_hotkey_list, - internal_event_num); - if(!tmp) + internal_event_num); + if (!tmp) ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid key")); else memcpy(key, tmp, sizeof(union acpi_hotkey)); @@ -807,15 +812,16 @@ do_fail: if (IS_EVENT(internal_event_num)) { kfree(bus_method); ret = init_hotkey_device(key, bus_handle, action_handle, method, - internal_event_num, external_event_num); + internal_event_num, + external_event_num); } else ret = init_poll_hotkey_device(key, bus_handle, bus_method, - action_handle, method, - internal_event_num); + action_handle, method, + internal_event_num); if (ret) { kfree(bus_handle); kfree(action_handle); - if(IS_EVENT(internal_event_num)) + if (IS_EVENT(internal_event_num)) free_hotkey_buffer(key); else free_poll_hotkey_buffer(key); @@ -824,13 +830,14 @@ do_fail: return_VALUE(-EINVAL); } -cont_cmd: + cont_cmd: kfree(bus_handle); kfree(action_handle); switch (cmd) { case 0: - if(get_hotkey_by_event(&global_hotkey_list,key->link.hotkey_standard_num)) + if (get_hotkey_by_event + (&global_hotkey_list, key->link.hotkey_standard_num)) goto fail_out; else hotkey_add(key); @@ -839,7 +846,7 @@ cont_cmd: hotkey_remove(key); break; case 2: - if(hotkey_update(key)) + if (hotkey_update(key)) goto fail_out; break; default: @@ -847,8 +854,8 @@ cont_cmd: break; } return_VALUE(count); -fail_out: - if(IS_EVENT(internal_event_num)) + fail_out: + if (IS_EVENT(internal_event_num)) free_hotkey_buffer(key); else free_poll_hotkey_buffer(key); @@ -882,7 +889,8 @@ static int write_acpi_int(acpi_handle handle, const char *method, int val, return_VALUE(status == AE_OK); } -static int read_acpi_int(acpi_handle handle, const char *method, union acpi_object *val) +static int read_acpi_int(acpi_handle handle, const char *method, + union acpi_object *val) { struct acpi_buffer output; union acpi_object out_obj; @@ -893,7 +901,7 @@ static int read_acpi_int(acpi_handle handle, const char *method, union acpi_obje output.pointer = &out_obj; status = acpi_evaluate_object(handle, (char *)method, NULL, &output); - if(val){ + if (val) { val->integer.value = out_obj.integer.value; val->type = out_obj.type; } else @@ -903,8 +911,8 @@ static int read_acpi_int(acpi_handle handle, const char *method, union acpi_obje } static union acpi_hotkey *get_hotkey_by_event(struct - acpi_hotkey_list - *hotkey_list, int event) + acpi_hotkey_list + *hotkey_list, int event) { struct list_head *entries; @@ -912,10 +920,10 @@ static union acpi_hotkey *get_hotkey_by_event(struct union acpi_hotkey *key = container_of(entries, union acpi_hotkey, entries); if (key->link.hotkey_standard_num == event) { - return(key); + return (key); } } - return(NULL); + return (NULL); } /* @@ -932,15 +940,15 @@ static ssize_t hotkey_execute_aml_method(struct file *file, { struct acpi_hotkey_list *hotkey_list = &global_hotkey_list; char *arg; - int event,method_type,type, value; + int event, method_type, type, value; union acpi_hotkey *key; ACPI_FUNCTION_TRACE("hotkey_execte_aml_method"); - arg = (char *) kmalloc(count+1, GFP_KERNEL); - if(!arg) + arg = (char *)kmalloc(count + 1, GFP_KERNEL); + if (!arg) return_VALUE(-ENOMEM); - arg[count]=0; + arg[count] = 0; if (copy_from_user(arg, buffer, count)) { kfree(arg); @@ -948,7 +956,8 @@ static ssize_t hotkey_execute_aml_method(struct file *file, return_VALUE(-EINVAL); } - if (sscanf(arg, "%d:%d:%d:%d", &event, &method_type, &type, &value) != 4) { + if (sscanf(arg, "%d:%d:%d:%d", &event, &method_type, &type, &value) != + 4) { kfree(arg); ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid argument 3")); return_VALUE(-EINVAL); @@ -956,19 +965,21 @@ static ssize_t hotkey_execute_aml_method(struct file *file, kfree(arg); if (type == ACPI_TYPE_INTEGER) { key = get_hotkey_by_event(hotkey_list, event); - if(!key) + if (!key) goto do_fail; if (IS_EVENT(event)) write_acpi_int(key->event_hotkey.action_handle, - key->event_hotkey.action_method, value, NULL); + key->event_hotkey.action_method, value, + NULL); else if (IS_POLL(event)) { - if ( method_type == POLL_METHOD ) + if (method_type == POLL_METHOD) read_acpi_int(key->poll_hotkey.poll_handle, - key->poll_hotkey.poll_method, - key->poll_hotkey.poll_result); - else if ( method_type == ACTION_METHOD ) + key->poll_hotkey.poll_method, + key->poll_hotkey.poll_result); + else if (method_type == ACTION_METHOD) write_acpi_int(key->poll_hotkey.action_handle, - key->poll_hotkey.action_method, value, NULL); + key->poll_hotkey.action_method, + value, NULL); else goto do_fail; @@ -978,7 +989,7 @@ static ssize_t hotkey_execute_aml_method(struct file *file, return_VALUE(-EINVAL); } return_VALUE(count); -do_fail: + do_fail: return_VALUE(-EINVAL); } @@ -1074,15 +1085,15 @@ static int __init hotkey_init(void) return (0); -do_fail5: + do_fail5: remove_proc_entry(HOTKEY_INFO, hotkey_proc_dir); -do_fail4: + do_fail4: remove_proc_entry(HOTKEY_ACTION, hotkey_proc_dir); -do_fail3: + do_fail3: remove_proc_entry(HOTKEY_PL_CONFIG, hotkey_proc_dir); -do_fail2: + do_fail2: remove_proc_entry(HOTKEY_EV_CONFIG, hotkey_proc_dir); -do_fail1: + do_fail1: remove_proc_entry(HOTKEY_PROC, acpi_root_dir); return (-ENODEV); } diff --git a/drivers/acpi/ibm_acpi.c b/drivers/acpi/ibm_acpi.c index ad85e10001f..62233bd7147 100644 --- a/drivers/acpi/ibm_acpi.c +++ b/drivers/acpi/ibm_acpi.c @@ -86,52 +86,46 @@ static acpi_handle root_handle = NULL; static acpi_handle *object##_parent = &parent##_handle; \ static char *object##_paths[] = { paths } -IBM_HANDLE(ec, root, - "\\_SB.PCI0.ISA.EC", /* A21e, A22p, T20, T21, X20 */ - "\\_SB.PCI0.LPC.EC", /* all others */ -); - -IBM_HANDLE(vid, root, - "\\_SB.PCI0.VID", /* A21e, G40, X30, X40 */ - "\\_SB.PCI0.AGP.VID", /* all others */ -); - -IBM_HANDLE(cmos, root, - "\\UCMS", /* R50, R50p, R51, T4x, X31, X40 */ - "\\CMOS", /* A3x, G40, R32, T23, T30, X22, X24, X30 */ - "\\CMS", /* R40, R40e */ -); /* A21e, A22p, T20, T21, X20 */ - -IBM_HANDLE(dock, root, - "\\_SB.GDCK", /* X30, X31, X40 */ - "\\_SB.PCI0.DOCK", /* A22p, T20, T21, X20 */ - "\\_SB.PCI0.PCI1.DOCK", /* all others */ -); /* A21e, G40, R32, R40, R40e */ - -IBM_HANDLE(bay, root, - "\\_SB.PCI0.IDE0.SCND.MSTR"); /* all except A21e */ -IBM_HANDLE(bayej, root, - "\\_SB.PCI0.IDE0.SCND.MSTR._EJ0"); /* all except A2x, A3x */ - -IBM_HANDLE(lght, root, "\\LGHT"); /* A21e, A22p, T20, T21, X20 */ -IBM_HANDLE(hkey, ec, "HKEY"); /* all */ -IBM_HANDLE(led, ec, "LED"); /* all except A21e, A22p, T20, T21, X20 */ -IBM_HANDLE(sysl, ec, "SYSL"); /* A21e, A22p, T20, T21, X20 */ -IBM_HANDLE(bled, ec, "BLED"); /* A22p, T20, T21, X20 */ -IBM_HANDLE(beep, ec, "BEEP"); /* all models */ +IBM_HANDLE(ec, root, "\\_SB.PCI0.ISA.EC", /* A21e, A22p, T20, T21, X20 */ + "\\_SB.PCI0.LPC.EC", /* all others */ + ); + +IBM_HANDLE(vid, root, "\\_SB.PCI0.VID", /* A21e, G40, X30, X40 */ + "\\_SB.PCI0.AGP.VID", /* all others */ + ); + +IBM_HANDLE(cmos, root, "\\UCMS", /* R50, R50p, R51, T4x, X31, X40 */ + "\\CMOS", /* A3x, G40, R32, T23, T30, X22, X24, X30 */ + "\\CMS", /* R40, R40e */ + ); /* A21e, A22p, T20, T21, X20 */ + +IBM_HANDLE(dock, root, "\\_SB.GDCK", /* X30, X31, X40 */ + "\\_SB.PCI0.DOCK", /* A22p, T20, T21, X20 */ + "\\_SB.PCI0.PCI1.DOCK", /* all others */ + ); /* A21e, G40, R32, R40, R40e */ + +IBM_HANDLE(bay, root, "\\_SB.PCI0.IDE0.SCND.MSTR"); /* all except A21e */ +IBM_HANDLE(bayej, root, "\\_SB.PCI0.IDE0.SCND.MSTR._EJ0"); /* all except A2x, A3x */ + +IBM_HANDLE(lght, root, "\\LGHT"); /* A21e, A22p, T20, T21, X20 */ +IBM_HANDLE(hkey, ec, "HKEY"); /* all */ +IBM_HANDLE(led, ec, "LED"); /* all except A21e, A22p, T20, T21, X20 */ +IBM_HANDLE(sysl, ec, "SYSL"); /* A21e, A22p, T20, T21, X20 */ +IBM_HANDLE(bled, ec, "BLED"); /* A22p, T20, T21, X20 */ +IBM_HANDLE(beep, ec, "BEEP"); /* all models */ struct ibm_struct { char *name; char *hid; struct acpi_driver *driver; - - int (*init) (struct ibm_struct *); - int (*read) (struct ibm_struct *, char *); - int (*write) (struct ibm_struct *, char *); - void (*exit) (struct ibm_struct *); - void (*notify) (struct ibm_struct *, u32); + int (*init) (struct ibm_struct *); + int (*read) (struct ibm_struct *, char *); + int (*write) (struct ibm_struct *, char *); + void (*exit) (struct ibm_struct *); + + void (*notify) (struct ibm_struct *, u32); acpi_handle *handle; int type; struct acpi_device *device; @@ -165,15 +159,15 @@ static int acpi_evalf(acpi_handle handle, void *res, char *method, char *fmt, ...) { char *fmt0 = fmt; - struct acpi_object_list params; - union acpi_object in_objs[IBM_MAX_ACPI_ARGS]; - struct acpi_buffer result; - union acpi_object out_obj; - acpi_status status; - va_list ap; - char res_type; - int success; - int quiet; + struct acpi_object_list params; + union acpi_object in_objs[IBM_MAX_ACPI_ARGS]; + struct acpi_buffer result; + union acpi_object out_obj; + acpi_status status; + va_list ap; + char res_type; + int success; + int quiet; if (!*fmt) { printk(IBM_ERR "acpi_evalf() called with empty format\n"); @@ -199,7 +193,7 @@ static int acpi_evalf(acpi_handle handle, in_objs[params.count].integer.value = va_arg(ap, int); in_objs[params.count++].type = ACPI_TYPE_INTEGER; break; - /* add more types as needed */ + /* add more types as needed */ default: printk(IBM_ERR "acpi_evalf() called " "with invalid format character '%c'\n", c); @@ -214,15 +208,15 @@ static int acpi_evalf(acpi_handle handle, status = acpi_evaluate_object(handle, method, ¶ms, &result); switch (res_type) { - case 'd': /* int */ + case 'd': /* int */ if (res) *(int *)res = out_obj.integer.value; success = status == AE_OK && out_obj.type == ACPI_TYPE_INTEGER; break; - case 'v': /* void */ + case 'v': /* void */ success = status == AE_OK; break; - /* add more types as needed */ + /* add more types as needed */ default: printk(IBM_ERR "acpi_evalf() called " "with invalid format character '%c'\n", res_type); @@ -303,9 +297,9 @@ static int hotkey_set(struct ibm_struct *ibm, int status, int mask) if (!ibm->supported) return 0; - for (i=0; i<32; i++) { + for (i = 0; i < 32; i++) { int bit = ((1 << i) & mask) != 0; - if (!acpi_evalf(hkey_handle, NULL, "MHKM", "vdd", i+1, bit)) + if (!acpi_evalf(hkey_handle, NULL, "MHKM", "vdd", i + 1, bit)) return -EIO; } @@ -318,8 +312,7 @@ static int hotkey_init(struct ibm_struct *ibm) ibm->supported = 1; ret = hotkey_get(ibm, - &ibm->state.hotkey.status, - &ibm->state.hotkey.mask); + &ibm->state.hotkey.status, &ibm->state.hotkey.mask); if (ret < 0) { /* mask not supported on A21e, A22p, T20, T21, X20, X22, X24 */ ibm->supported = 0; @@ -329,7 +322,7 @@ static int hotkey_init(struct ibm_struct *ibm) } return ret; -} +} static int hotkey_read(struct ibm_struct *ibm, char *p) { @@ -368,7 +361,7 @@ static int hotkey_write(struct ibm_struct *ibm, char *buf) status = 0; } else if (strlencmp(cmd, "reset") == 0) { status = ibm->state.hotkey.status; - mask = ibm->state.hotkey.mask; + mask = ibm->state.hotkey.mask; } else if (sscanf(cmd, "0x%x", &mask) == 1) { /* mask set */ } else if (sscanf(cmd, "%x", &mask) == 1) { @@ -382,7 +375,7 @@ static int hotkey_write(struct ibm_struct *ibm, char *buf) return -EIO; return 0; -} +} static void hotkey_exit(struct ibm_struct *ibm) { @@ -398,7 +391,7 @@ static void hotkey_notify(struct ibm_struct *ibm, u32 event) else { printk(IBM_ERR "unknown hotkey event %d\n", event); acpi_bus_generate_event(ibm->device, event, 0); - } + } } static int bluetooth_init(struct ibm_struct *ibm) @@ -456,15 +449,14 @@ static int bluetooth_write(struct ibm_struct *ibm, char *buf) } if (do_cmd && !acpi_evalf(hkey_handle, NULL, "SBDC", "vd", status)) - return -EIO; + return -EIO; return 0; } static int video_init(struct ibm_struct *ibm) { - if (!acpi_evalf(vid_handle, - &ibm->state.video.autoswitch, "^VDEE", "d")) + if (!acpi_evalf(vid_handle, &ibm->state.video.autoswitch, "^VDEE", "d")) return -ENODEV; return 0; @@ -566,8 +558,7 @@ static int video_write(struct ibm_struct *ibm, char *buf) static void video_exit(struct ibm_struct *ibm) { - acpi_evalf(vid_handle, NULL, "_DOS", "vd", - ibm->state.video.autoswitch); + acpi_evalf(vid_handle, NULL, "_DOS", "vd", ibm->state.video.autoswitch); } static int light_init(struct ibm_struct *ibm) @@ -600,7 +591,7 @@ static int light_write(struct ibm_struct *ibm, char *buf) int cmos_cmd, lght_cmd; char *cmd; int success; - + while ((cmd = next_cmd(&buf))) { if (strlencmp(cmd, "on") == 0) { cmos_cmd = 0x0c; @@ -610,10 +601,10 @@ static int light_write(struct ibm_struct *ibm, char *buf) lght_cmd = 0; } else return -EINVAL; - + success = cmos_handle ? - acpi_evalf(cmos_handle, NULL, NULL, "vd", cmos_cmd) : - acpi_evalf(lght_handle, NULL, NULL, "vd", lght_cmd); + acpi_evalf(cmos_handle, NULL, NULL, "vd", cmos_cmd) : + acpi_evalf(lght_handle, NULL, NULL, "vd", lght_cmd); if (!success) return -EIO; } @@ -671,22 +662,22 @@ static int dock_write(struct ibm_struct *ibm, char *buf) } return 0; -} +} static void dock_notify(struct ibm_struct *ibm, u32 event) { int docked = dock_docked(); if (event == 3 && docked) - acpi_bus_generate_event(ibm->device, event, 1); /* button */ + acpi_bus_generate_event(ibm->device, event, 1); /* button */ else if (event == 3 && !docked) - acpi_bus_generate_event(ibm->device, event, 2); /* undock */ + acpi_bus_generate_event(ibm->device, event, 2); /* undock */ else if (event == 0 && docked) - acpi_bus_generate_event(ibm->device, event, 3); /* dock */ + acpi_bus_generate_event(ibm->device, event, 3); /* dock */ else { printk(IBM_ERR "unknown dock event %d, status %d\n", event, _sta(dock_handle)); - acpi_bus_generate_event(ibm->device, event, 0); /* unknown */ + acpi_bus_generate_event(ibm->device, event, 0); /* unknown */ } } @@ -696,7 +687,7 @@ static int bay_init(struct ibm_struct *ibm) { /* bay not supported on A21e, A22p, A31, A31p, G40, R32, R40e */ ibm->supported = bay_handle && bayej_handle && - acpi_evalf(bay_handle, NULL, "_STA", "qv"); + acpi_evalf(bay_handle, NULL, "_STA", "qv"); return 0; } @@ -705,7 +696,7 @@ static int bay_read(struct ibm_struct *ibm, char *p) { int len = 0; int occupied = bay_occupied(); - + if (!ibm->supported) len += sprintf(p + len, "status:\t\tnot supported\n"); else if (!occupied) @@ -732,7 +723,7 @@ static int bay_write(struct ibm_struct *ibm, char *buf) } return 0; -} +} static void bay_notify(struct ibm_struct *ibm, u32 event) { @@ -773,8 +764,8 @@ static int cmos_write(struct ibm_struct *ibm, char *buf) } return 0; -} - +} + static int led_read(struct ibm_struct *ibm, char *p) { int len = 0; @@ -809,7 +800,7 @@ static int led_write(struct ibm_struct *ibm, char *buf) led_cmd = sysl_cmd = bled_a = bled_b = 0; } else return -EINVAL; - + if (led_handle) { if (!acpi_evalf(led_handle, NULL, NULL, "vdd", led, led_cmd)) @@ -827,8 +818,8 @@ static int led_write(struct ibm_struct *ibm, char *buf) } return 0; -} - +} + static int beep_read(struct ibm_struct *ibm, char *p) { int len = 0; @@ -854,80 +845,81 @@ static int beep_write(struct ibm_struct *ibm, char *buf) } return 0; -} - +} + static struct ibm_struct ibms[] = { { - .name = "driver", - .init = driver_init, - .read = driver_read, - }, + .name = "driver", + .init = driver_init, + .read = driver_read, + }, { - .name = "hotkey", - .hid = "IBM0068", - .init = hotkey_init, - .read = hotkey_read, - .write = hotkey_write, - .exit = hotkey_exit, - .notify = hotkey_notify, - .handle = &hkey_handle, - .type = ACPI_DEVICE_NOTIFY, - }, + .name = "hotkey", + .hid = "IBM0068", + .init = hotkey_init, + .read = hotkey_read, + .write = hotkey_write, + .exit = hotkey_exit, + .notify = hotkey_notify, + .handle = &hkey_handle, + .type = ACPI_DEVICE_NOTIFY, + }, { - .name = "bluetooth", - .init = bluetooth_init, - .read = bluetooth_read, - .write = bluetooth_write, - }, + .name = "bluetooth", + .init = bluetooth_init, + .read = bluetooth_read, + .write = bluetooth_write, + }, { - .name = "video", - .init = video_init, - .read = video_read, - .write = video_write, - .exit = video_exit, - }, + .name = "video", + .init = video_init, + .read = video_read, + .write = video_write, + .exit = video_exit, + }, { - .name = "light", - .init = light_init, - .read = light_read, - .write = light_write, - }, + .name = "light", + .init = light_init, + .read = light_read, + .write = light_write, + }, { - .name = "dock", - .read = dock_read, - .write = dock_write, - .notify = dock_notify, - .handle = &dock_handle, - .type = ACPI_SYSTEM_NOTIFY, - }, + .name = "dock", + .read = dock_read, + .write = dock_write, + .notify = dock_notify, + .handle = &dock_handle, + .type = ACPI_SYSTEM_NOTIFY, + }, { - .name = "bay", - .init = bay_init, - .read = bay_read, - .write = bay_write, - .notify = bay_notify, - .handle = &bay_handle, - .type = ACPI_SYSTEM_NOTIFY, - }, + .name = "bay", + .init = bay_init, + .read = bay_read, + .write = bay_write, + .notify = bay_notify, + .handle = &bay_handle, + .type = ACPI_SYSTEM_NOTIFY, + }, { - .name = "cmos", - .read = cmos_read, - .write = cmos_write, - .experimental = 1, - }, + .name = "cmos", + .read = cmos_read, + .write = cmos_write, + .experimental = 1, + }, { - .name = "led", - .read = led_read, - .write = led_write, - .experimental = 1, - }, + .name = "led", + .read = led_read, + .write = led_write, + .experimental = 1, + }, { - .name = "beep", - .read = beep_read, - .write = beep_write, - .experimental = 1, - }, + .name = "beep", + .read = beep_read, + .write = beep_write, + .experimental = 1, + }, }; + #define NUM_IBMS (sizeof(ibms)/sizeof(ibms[0])) static int dispatch_read(char *page, char **start, off_t off, int count, @@ -935,7 +927,7 @@ static int dispatch_read(char *page, char **start, off_t off, int count, { struct ibm_struct *ibm = (struct ibm_struct *)data; int len; - + if (!ibm || !ibm->read) return -EINVAL; @@ -955,7 +947,7 @@ static int dispatch_read(char *page, char **start, off_t off, int count, return len; } -static int dispatch_write(struct file *file, const char __user *userbuf, +static int dispatch_write(struct file *file, const char __user * userbuf, unsigned long count, void *data) { struct ibm_struct *ibm = (struct ibm_struct *)data; @@ -969,9 +961,9 @@ static int dispatch_write(struct file *file, const char __user *userbuf, if (!kernbuf) return -ENOMEM; - if (copy_from_user(kernbuf, userbuf, count)) { + if (copy_from_user(kernbuf, userbuf, count)) { kfree(kernbuf); - return -EFAULT; + return -EFAULT; } kernbuf[count] = 0; @@ -982,7 +974,7 @@ static int dispatch_write(struct file *file, const char __user *userbuf, kfree(kernbuf); - return ret; + return ret; } static void dispatch_notify(acpi_handle handle, u32 event, void *data) @@ -1085,7 +1077,7 @@ static int ibm_init(struct ibm_struct *ibm) } entry->owner = THIS_MODULE; ibm->proc_created = 1; - + entry->data = ibm; if (ibm->read) entry->read_proc = &dispatch_read; @@ -1120,18 +1112,18 @@ static void ibm_exit(struct ibm_struct *ibm) } static int ibm_handle_init(char *name, - acpi_handle *handle, acpi_handle parent, + acpi_handle * handle, acpi_handle parent, char **paths, int num_paths, int required) { int i; acpi_status status; - for (i=0; iname) == 0) return ibms[i].write(&ibms[i], arg_with_comma); BUG(); @@ -1172,7 +1163,7 @@ static void acpi_ibm_exit(void) { int i; - for (i=NUM_IBMS-1; i>=0; i--) + for (i = NUM_IBMS - 1; i >= 0; i--) ibm_exit(&ibms[i]); remove_proc_entry(IBM_DIR, acpi_root_dir); @@ -1185,15 +1176,14 @@ static int __init acpi_ibm_init(void) if (acpi_disabled) return -ENODEV; - if (!acpi_specific_hotkey_enabled){ + if (!acpi_specific_hotkey_enabled) { printk(IBM_ERR "Using generic hotkey driver\n"); - return -ENODEV; + return -ENODEV; } /* these handles are required */ - if (IBM_HANDLE_INIT(ec, 1) < 0 || + if (IBM_HANDLE_INIT(ec, 1) < 0 || IBM_HANDLE_INIT(hkey, 1) < 0 || - IBM_HANDLE_INIT(vid, 1) < 0 || - IBM_HANDLE_INIT(beep, 1) < 0) + IBM_HANDLE_INIT(vid, 1) < 0 || IBM_HANDLE_INIT(beep, 1) < 0) return -ENODEV; /* these handles have alternatives */ @@ -1205,10 +1195,10 @@ static int __init acpi_ibm_init(void) return -ENODEV; /* these handles are not required */ - IBM_HANDLE_INIT(dock, 0); - IBM_HANDLE_INIT(bay, 0); + IBM_HANDLE_INIT(dock, 0); + IBM_HANDLE_INIT(bay, 0); IBM_HANDLE_INIT(bayej, 0); - IBM_HANDLE_INIT(bled, 0); + IBM_HANDLE_INIT(bled, 0); proc_dir = proc_mkdir(IBM_DIR, acpi_root_dir); if (!proc_dir) { @@ -1216,8 +1206,8 @@ static int __init acpi_ibm_init(void) return -ENODEV; } proc_dir->owner = THIS_MODULE; - - for (i=0; i #define _COMPONENT ACPI_SYSTEM_COMPONENT -ACPI_MODULE_NAME ("acpi_motherboard") +ACPI_MODULE_NAME("acpi_motherboard") /* Dell use PNP0C01 instead of PNP0C02 */ #define ACPI_MB_HID1 "PNP0C01" #define ACPI_MB_HID2 "PNP0C02" - /** * Doesn't care about legacy IO ports, only IO ports beyond 0x1000 are reserved * Doesn't care about the failure of 'request_region', since other may reserve @@ -44,15 +43,12 @@ ACPI_MODULE_NAME ("acpi_motherboard") #define IS_RESERVED_ADDR(base, len) \ (((len) > 0) && ((base) > 0) && ((base) + (len) < IO_SPACE_LIMIT) \ && ((base) + (len) > 0x1000)) - /* * Clearing the flag (IORESOURCE_BUSY) allows drivers to use * the io ports if they really know they can use it, while * still preventing hotplug PCI devices from using it. */ - -static acpi_status -acpi_reserve_io_ranges (struct acpi_resource *res, void *data) +static acpi_status acpi_reserve_io_ranges(struct acpi_resource *res, void *data) { struct resource *requested_res = NULL; @@ -63,22 +59,32 @@ acpi_reserve_io_ranges (struct acpi_resource *res, void *data) if (io_res->min_base_address != io_res->max_base_address) return_VALUE(AE_OK); - if (IS_RESERVED_ADDR(io_res->min_base_address, io_res->range_length)) { - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Motherboard resources 0x%08x - 0x%08x\n", - io_res->min_base_address, - io_res->min_base_address + io_res->range_length)); - requested_res = request_region(io_res->min_base_address, - io_res->range_length, "motherboard"); + if (IS_RESERVED_ADDR + (io_res->min_base_address, io_res->range_length)) { + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "Motherboard resources 0x%08x - 0x%08x\n", + io_res->min_base_address, + io_res->min_base_address + + io_res->range_length)); + requested_res = + request_region(io_res->min_base_address, + io_res->range_length, "motherboard"); } } else if (res->id == ACPI_RSTYPE_FIXED_IO) { - struct acpi_resource_fixed_io *fixed_io_res = &res->data.fixed_io; - - if (IS_RESERVED_ADDR(fixed_io_res->base_address, fixed_io_res->range_length)) { - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Motherboard resources 0x%08x - 0x%08x\n", - fixed_io_res->base_address, - fixed_io_res->base_address + fixed_io_res->range_length)); - requested_res = request_region(fixed_io_res->base_address, - fixed_io_res->range_length, "motherboard"); + struct acpi_resource_fixed_io *fixed_io_res = + &res->data.fixed_io; + + if (IS_RESERVED_ADDR + (fixed_io_res->base_address, fixed_io_res->range_length)) { + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "Motherboard resources 0x%08x - 0x%08x\n", + fixed_io_res->base_address, + fixed_io_res->base_address + + fixed_io_res->range_length)); + requested_res = + request_region(fixed_io_res->base_address, + fixed_io_res->range_length, + "motherboard"); } } else { /* Memory mapped IO? */ @@ -89,72 +95,70 @@ acpi_reserve_io_ranges (struct acpi_resource *res, void *data) return_VALUE(AE_OK); } -static int acpi_motherboard_add (struct acpi_device *device) +static int acpi_motherboard_add(struct acpi_device *device) { if (!device) return -EINVAL; - acpi_walk_resources(device->handle, METHOD_NAME__CRS, - acpi_reserve_io_ranges, NULL); + acpi_walk_resources(device->handle, METHOD_NAME__CRS, + acpi_reserve_io_ranges, NULL); return 0; } static struct acpi_driver acpi_motherboard_driver1 = { - .name = "motherboard", - .class = "", - .ids = ACPI_MB_HID1, - .ops = { - .add = acpi_motherboard_add, - }, + .name = "motherboard", + .class = "", + .ids = ACPI_MB_HID1, + .ops = { + .add = acpi_motherboard_add, + }, }; static struct acpi_driver acpi_motherboard_driver2 = { - .name = "motherboard", - .class = "", - .ids = ACPI_MB_HID2, - .ops = { - .add = acpi_motherboard_add, - }, + .name = "motherboard", + .class = "", + .ids = ACPI_MB_HID2, + .ops = { + .add = acpi_motherboard_add, + }, }; -static void __init -acpi_reserve_resources (void) +static void __init acpi_reserve_resources(void) { if (acpi_gbl_FADT->xpm1a_evt_blk.address && acpi_gbl_FADT->pm1_evt_len) - request_region(acpi_gbl_FADT->xpm1a_evt_blk.address, - acpi_gbl_FADT->pm1_evt_len, "PM1a_EVT_BLK"); + request_region(acpi_gbl_FADT->xpm1a_evt_blk.address, + acpi_gbl_FADT->pm1_evt_len, "PM1a_EVT_BLK"); if (acpi_gbl_FADT->xpm1b_evt_blk.address && acpi_gbl_FADT->pm1_evt_len) request_region(acpi_gbl_FADT->xpm1b_evt_blk.address, - acpi_gbl_FADT->pm1_evt_len, "PM1b_EVT_BLK"); + acpi_gbl_FADT->pm1_evt_len, "PM1b_EVT_BLK"); if (acpi_gbl_FADT->xpm1a_cnt_blk.address && acpi_gbl_FADT->pm1_cnt_len) - request_region(acpi_gbl_FADT->xpm1a_cnt_blk.address, - acpi_gbl_FADT->pm1_cnt_len, "PM1a_CNT_BLK"); + request_region(acpi_gbl_FADT->xpm1a_cnt_blk.address, + acpi_gbl_FADT->pm1_cnt_len, "PM1a_CNT_BLK"); if (acpi_gbl_FADT->xpm1b_cnt_blk.address && acpi_gbl_FADT->pm1_cnt_len) - request_region(acpi_gbl_FADT->xpm1b_cnt_blk.address, - acpi_gbl_FADT->pm1_cnt_len, "PM1b_CNT_BLK"); + request_region(acpi_gbl_FADT->xpm1b_cnt_blk.address, + acpi_gbl_FADT->pm1_cnt_len, "PM1b_CNT_BLK"); if (acpi_gbl_FADT->xpm_tmr_blk.address && acpi_gbl_FADT->pm_tm_len == 4) - request_region(acpi_gbl_FADT->xpm_tmr_blk.address, - 4, "PM_TMR"); + request_region(acpi_gbl_FADT->xpm_tmr_blk.address, 4, "PM_TMR"); if (acpi_gbl_FADT->xpm2_cnt_blk.address && acpi_gbl_FADT->pm2_cnt_len) request_region(acpi_gbl_FADT->xpm2_cnt_blk.address, - acpi_gbl_FADT->pm2_cnt_len, "PM2_CNT_BLK"); + acpi_gbl_FADT->pm2_cnt_len, "PM2_CNT_BLK"); /* Length of GPE blocks must be a non-negative multiple of 2 */ if (acpi_gbl_FADT->xgpe0_blk.address && acpi_gbl_FADT->gpe0_blk_len && - !(acpi_gbl_FADT->gpe0_blk_len & 0x1)) + !(acpi_gbl_FADT->gpe0_blk_len & 0x1)) request_region(acpi_gbl_FADT->xgpe0_blk.address, - acpi_gbl_FADT->gpe0_blk_len, "GPE0_BLK"); + acpi_gbl_FADT->gpe0_blk_len, "GPE0_BLK"); if (acpi_gbl_FADT->xgpe1_blk.address && acpi_gbl_FADT->gpe1_blk_len && - !(acpi_gbl_FADT->gpe1_blk_len & 0x1)) + !(acpi_gbl_FADT->gpe1_blk_len & 0x1)) request_region(acpi_gbl_FADT->xgpe1_blk.address, - acpi_gbl_FADT->gpe1_blk_len, "GPE1_BLK"); + acpi_gbl_FADT->gpe1_blk_len, "GPE1_BLK"); } static int __init acpi_motherboard_init(void) @@ -166,7 +170,7 @@ static int __init acpi_motherboard_init(void) * This module must run after scan.c */ if (!acpi_disabled) - acpi_reserve_resources (); + acpi_reserve_resources(); return 0; } diff --git a/drivers/acpi/namespace/nsaccess.c b/drivers/acpi/namespace/nsaccess.c index 7589e1fdf25..edfbe34600f 100644 --- a/drivers/acpi/namespace/nsaccess.c +++ b/drivers/acpi/namespace/nsaccess.c @@ -41,16 +41,13 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include #include #include #include - #define _COMPONENT ACPI_NAMESPACE - ACPI_MODULE_NAME ("nsaccess") - +ACPI_MODULE_NAME("nsaccess") /******************************************************************************* * @@ -65,24 +62,19 @@ * MUTEX: Locks namespace for entire execution * ******************************************************************************/ - -acpi_status -acpi_ns_root_initialize ( - void) +acpi_status acpi_ns_root_initialize(void) { - acpi_status status; + acpi_status status; const struct acpi_predefined_names *init_val = NULL; - struct acpi_namespace_node *new_node; - union acpi_operand_object *obj_desc; - acpi_string val = NULL; - + struct acpi_namespace_node *new_node; + union acpi_operand_object *obj_desc; + acpi_string val = NULL; - ACPI_FUNCTION_TRACE ("ns_root_initialize"); + ACPI_FUNCTION_TRACE("ns_root_initialize"); - - status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* @@ -102,24 +94,26 @@ acpi_ns_root_initialize ( /* Enter the pre-defined names in the name table */ - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "Entering predefined entries into namespace\n")); + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "Entering predefined entries into namespace\n")); for (init_val = acpi_gbl_pre_defined_names; init_val->name; init_val++) { /* _OSI is optional for now, will be permanent later */ - if (!ACPI_STRCMP (init_val->name, "_OSI") && !acpi_gbl_create_osi_method) { + if (!ACPI_STRCMP(init_val->name, "_OSI") + && !acpi_gbl_create_osi_method) { continue; } - status = acpi_ns_lookup (NULL, init_val->name, init_val->type, - ACPI_IMODE_LOAD_PASS2, ACPI_NS_NO_UPSEARCH, - NULL, &new_node); + status = acpi_ns_lookup(NULL, init_val->name, init_val->type, + ACPI_IMODE_LOAD_PASS2, + ACPI_NS_NO_UPSEARCH, NULL, &new_node); - if (ACPI_FAILURE (status) || (!new_node)) /* Must be on same line for code converter */ { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Could not create predefined name %s, %s\n", - init_val->name, acpi_format_exception (status))); + if (ACPI_FAILURE(status) || (!new_node)) { /* Must be on same line for code converter */ + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Could not create predefined name %s, %s\n", + init_val->name, + acpi_format_exception(status))); } /* @@ -128,11 +122,11 @@ acpi_ns_root_initialize ( * initial value, create the initial value. */ if (init_val->val) { - status = acpi_os_predefined_override (init_val, &val); - if (ACPI_FAILURE (status)) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Could not override predefined %s\n", - init_val->name)); + status = acpi_os_predefined_override(init_val, &val); + if (ACPI_FAILURE(status)) { + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Could not override predefined %s\n", + init_val->name)); } if (!val) { @@ -143,7 +137,8 @@ acpi_ns_root_initialize ( * Entry requests an initial value, allocate a * descriptor for it. */ - obj_desc = acpi_ut_create_internal_object (init_val->type); + obj_desc = + acpi_ut_create_internal_object(init_val->type); if (!obj_desc) { status = AE_NO_MEMORY; goto unlock_and_exit; @@ -156,7 +151,8 @@ acpi_ns_root_initialize ( */ switch (init_val->type) { case ACPI_TYPE_METHOD: - obj_desc->method.param_count = (u8) ACPI_TO_INTEGER (val); + obj_desc->method.param_count = + (u8) ACPI_TO_INTEGER(val); obj_desc->common.flags |= AOPOBJ_DATA_VALID; #if defined (ACPI_ASL_COMPILER) @@ -167,45 +163,50 @@ acpi_ns_root_initialize ( #else /* Mark this as a very SPECIAL method */ - obj_desc->method.method_flags = AML_METHOD_INTERNAL_ONLY; + obj_desc->method.method_flags = + AML_METHOD_INTERNAL_ONLY; #ifndef ACPI_DUMP_APP - obj_desc->method.implementation = acpi_ut_osi_implementation; + obj_desc->method.implementation = + acpi_ut_osi_implementation; #endif #endif break; case ACPI_TYPE_INTEGER: - obj_desc->integer.value = ACPI_TO_INTEGER (val); + obj_desc->integer.value = ACPI_TO_INTEGER(val); break; - case ACPI_TYPE_STRING: /* * Build an object around the static string */ - obj_desc->string.length = (u32) ACPI_STRLEN (val); + obj_desc->string.length = + (u32) ACPI_STRLEN(val); obj_desc->string.pointer = val; obj_desc->common.flags |= AOPOBJ_STATIC_POINTER; break; - case ACPI_TYPE_MUTEX: obj_desc->mutex.node = new_node; - obj_desc->mutex.sync_level = (u8) (ACPI_TO_INTEGER (val) - 1); + obj_desc->mutex.sync_level = + (u8) (ACPI_TO_INTEGER(val) - 1); - if (ACPI_STRCMP (init_val->name, "_GL_") == 0) { + if (ACPI_STRCMP(init_val->name, "_GL_") == 0) { /* * Create a counting semaphore for the * global lock */ - status = acpi_os_create_semaphore (ACPI_NO_UNIT_LIMIT, - 1, &obj_desc->mutex.semaphore); - if (ACPI_FAILURE (status)) { - acpi_ut_remove_reference (obj_desc); + status = + acpi_os_create_semaphore + (ACPI_NO_UNIT_LIMIT, 1, + &obj_desc->mutex.semaphore); + if (ACPI_FAILURE(status)) { + acpi_ut_remove_reference + (obj_desc); goto unlock_and_exit; } @@ -213,56 +214,58 @@ acpi_ns_root_initialize ( * We just created the mutex for the * global lock, save it */ - acpi_gbl_global_lock_semaphore = obj_desc->mutex.semaphore; - } - else { + acpi_gbl_global_lock_semaphore = + obj_desc->mutex.semaphore; + } else { /* Create a mutex */ - status = acpi_os_create_semaphore (1, 1, - &obj_desc->mutex.semaphore); - if (ACPI_FAILURE (status)) { - acpi_ut_remove_reference (obj_desc); + status = acpi_os_create_semaphore(1, 1, + &obj_desc-> + mutex. + semaphore); + if (ACPI_FAILURE(status)) { + acpi_ut_remove_reference + (obj_desc); goto unlock_and_exit; } } break; - default: - ACPI_REPORT_ERROR (("Unsupported initial type value %X\n", - init_val->type)); - acpi_ut_remove_reference (obj_desc); + ACPI_REPORT_ERROR(("Unsupported initial type value %X\n", init_val->type)); + acpi_ut_remove_reference(obj_desc); obj_desc = NULL; continue; } /* Store pointer to value descriptor in the Node */ - status = acpi_ns_attach_object (new_node, obj_desc, - ACPI_GET_OBJECT_TYPE (obj_desc)); + status = acpi_ns_attach_object(new_node, obj_desc, + ACPI_GET_OBJECT_TYPE + (obj_desc)); /* Remove local reference to the object */ - acpi_ut_remove_reference (obj_desc); + acpi_ut_remove_reference(obj_desc); } } - -unlock_and_exit: - (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); + unlock_and_exit: + (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); /* Save a handle to "_GPE", it is always present */ - if (ACPI_SUCCESS (status)) { - status = acpi_ns_get_node_by_path ("\\_GPE", NULL, ACPI_NS_NO_UPSEARCH, - &acpi_gbl_fadt_gpe_device); + if (ACPI_SUCCESS(status)) { + status = + acpi_ns_get_node_by_path("\\_GPE", NULL, + ACPI_NS_NO_UPSEARCH, + &acpi_gbl_fadt_gpe_device); } - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_ns_lookup @@ -287,62 +290,57 @@ unlock_and_exit: ******************************************************************************/ acpi_status -acpi_ns_lookup ( - union acpi_generic_state *scope_info, - char *pathname, - acpi_object_type type, - acpi_interpreter_mode interpreter_mode, - u32 flags, - struct acpi_walk_state *walk_state, - struct acpi_namespace_node **return_node) +acpi_ns_lookup(union acpi_generic_state *scope_info, + char *pathname, + acpi_object_type type, + acpi_interpreter_mode interpreter_mode, + u32 flags, + struct acpi_walk_state *walk_state, + struct acpi_namespace_node **return_node) { - acpi_status status; - char *path = pathname; - struct acpi_namespace_node *prefix_node; - struct acpi_namespace_node *current_node = NULL; - struct acpi_namespace_node *this_node = NULL; - u32 num_segments; - u32 num_carats; - acpi_name simple_name; - acpi_object_type type_to_check_for; - acpi_object_type this_search_type; - u32 search_parent_flag = ACPI_NS_SEARCH_PARENT; - u32 local_flags = flags & ~(ACPI_NS_ERROR_IF_FOUND | - ACPI_NS_SEARCH_PARENT); - - - ACPI_FUNCTION_TRACE ("ns_lookup"); - + acpi_status status; + char *path = pathname; + struct acpi_namespace_node *prefix_node; + struct acpi_namespace_node *current_node = NULL; + struct acpi_namespace_node *this_node = NULL; + u32 num_segments; + u32 num_carats; + acpi_name simple_name; + acpi_object_type type_to_check_for; + acpi_object_type this_search_type; + u32 search_parent_flag = ACPI_NS_SEARCH_PARENT; + u32 local_flags = flags & ~(ACPI_NS_ERROR_IF_FOUND | + ACPI_NS_SEARCH_PARENT); + + ACPI_FUNCTION_TRACE("ns_lookup"); if (!return_node) { - return_ACPI_STATUS (AE_BAD_PARAMETER); + return_ACPI_STATUS(AE_BAD_PARAMETER); } acpi_gbl_ns_lookup_count++; *return_node = ACPI_ENTRY_NOT_FOUND; if (!acpi_gbl_root_node) { - return_ACPI_STATUS (AE_NO_NAMESPACE); + return_ACPI_STATUS(AE_NO_NAMESPACE); } /* * Get the prefix scope. * A null scope means use the root scope */ - if ((!scope_info) || - (!scope_info->scope.node)) { - ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, - "Null scope prefix, using root node (%p)\n", - acpi_gbl_root_node)); + if ((!scope_info) || (!scope_info->scope.node)) { + ACPI_DEBUG_PRINT((ACPI_DB_NAMES, + "Null scope prefix, using root node (%p)\n", + acpi_gbl_root_node)); prefix_node = acpi_gbl_root_node; - } - else { + } else { prefix_node = scope_info->scope.node; - if (ACPI_GET_DESCRIPTOR_TYPE (prefix_node) != ACPI_DESC_TYPE_NAMED) { - ACPI_REPORT_ERROR (("ns_lookup: %p is not a namespace node [%s]\n", - prefix_node, acpi_ut_get_descriptor_name (prefix_node))); - return_ACPI_STATUS (AE_AML_INTERNAL); + if (ACPI_GET_DESCRIPTOR_TYPE(prefix_node) != + ACPI_DESC_TYPE_NAMED) { + ACPI_REPORT_ERROR(("ns_lookup: %p is not a namespace node [%s]\n", prefix_node, acpi_ut_get_descriptor_name(prefix_node))); + return_ACPI_STATUS(AE_AML_INTERNAL); } /* @@ -350,9 +348,9 @@ acpi_ns_lookup ( * Device/Method, etc.) It could be a Package or other object node. * Backup up the tree to find the containing scope node. */ - while (!acpi_ns_opens_scope (prefix_node->type) && - prefix_node->type != ACPI_TYPE_ANY) { - prefix_node = acpi_ns_get_parent_node (prefix_node); + while (!acpi_ns_opens_scope(prefix_node->type) && + prefix_node->type != ACPI_TYPE_ANY) { + prefix_node = acpi_ns_get_parent_node(prefix_node); } } @@ -367,13 +365,13 @@ acpi_ns_lookup ( /* A Null name_path is allowed and refers to the root */ num_segments = 0; - this_node = acpi_gbl_root_node; - path = ""; + this_node = acpi_gbl_root_node; + path = ""; - ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, - "Null Pathname (Zero segments), Flags=%X\n", flags)); - } - else { + ACPI_DEBUG_PRINT((ACPI_DB_NAMES, + "Null Pathname (Zero segments), Flags=%X\n", + flags)); + } else { /* * Name pointer is valid (and must be in internal name format) * @@ -397,15 +395,16 @@ acpi_ns_lookup ( path++; - ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, - "Path is absolute from root [%p]\n", this_node)); - } - else { + ACPI_DEBUG_PRINT((ACPI_DB_NAMES, + "Path is absolute from root [%p]\n", + this_node)); + } else { /* Pathname is relative to current scope, start there */ - ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, - "Searching relative to prefix scope [%4.4s] (%p)\n", - acpi_ut_get_node_name (prefix_node), prefix_node)); + ACPI_DEBUG_PRINT((ACPI_DB_NAMES, + "Searching relative to prefix scope [%4.4s] (%p)\n", + acpi_ut_get_node_name(prefix_node), + prefix_node)); /* * Handle multiple Parent Prefixes (carat) by just getting @@ -426,20 +425,20 @@ acpi_ns_lookup ( /* Backup to the parent node */ num_carats++; - this_node = acpi_ns_get_parent_node (this_node); + this_node = acpi_ns_get_parent_node(this_node); if (!this_node) { /* Current scope has no parent scope */ - ACPI_REPORT_ERROR ( - ("ACPI path has too many parent prefixes (^) - reached beyond root node\n")); - return_ACPI_STATUS (AE_NOT_FOUND); + ACPI_REPORT_ERROR(("ACPI path has too many parent prefixes (^) - reached beyond root node\n")); + return_ACPI_STATUS(AE_NOT_FOUND); } } if (search_parent_flag == ACPI_NS_NO_UPSEARCH) { - ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, - "Search scope is [%4.4s], path has %d carat(s)\n", - acpi_ut_get_node_name (this_node), num_carats)); + ACPI_DEBUG_PRINT((ACPI_DB_NAMES, + "Search scope is [%4.4s], path has %d carat(s)\n", + acpi_ut_get_node_name + (this_node), num_carats)); } } @@ -465,9 +464,9 @@ acpi_ns_lookup ( num_segments = 0; type = this_node->type; - ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, - "Prefix-only Pathname (Zero name segments), Flags=%X\n", - flags)); + ACPI_DEBUG_PRINT((ACPI_DB_NAMES, + "Prefix-only Pathname (Zero name segments), Flags=%X\n", + flags)); break; case AML_DUAL_NAME_PREFIX: @@ -481,8 +480,9 @@ acpi_ns_lookup ( num_segments = 2; path++; - ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, - "Dual Pathname (2 segments, Flags=%X)\n", flags)); + ACPI_DEBUG_PRINT((ACPI_DB_NAMES, + "Dual Pathname (2 segments, Flags=%X)\n", + flags)); break; case AML_MULTI_NAME_PREFIX_OP: @@ -494,12 +494,12 @@ acpi_ns_lookup ( /* Extract segment count, point to first name segment */ path++; - num_segments = (u32) (u8) *path; + num_segments = (u32) (u8) * path; path++; - ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, - "Multi Pathname (%d Segments, Flags=%X) \n", - num_segments, flags)); + ACPI_DEBUG_PRINT((ACPI_DB_NAMES, + "Multi Pathname (%d Segments, Flags=%X) \n", + num_segments, flags)); break; default: @@ -509,15 +509,15 @@ acpi_ns_lookup ( */ num_segments = 1; - ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, - "Simple Pathname (1 segment, Flags=%X)\n", flags)); + ACPI_DEBUG_PRINT((ACPI_DB_NAMES, + "Simple Pathname (1 segment, Flags=%X)\n", + flags)); break; } - ACPI_DEBUG_EXEC (acpi_ns_print_pathname (num_segments, path)); + ACPI_DEBUG_EXEC(acpi_ns_print_pathname(num_segments, path)); } - /* * Search namespace for each segment of the name. Loop through and * verify (or add to the namespace) each name segment. @@ -541,7 +541,7 @@ acpi_ns_lookup ( * requested it AND we have a single, non-fully-qualified name_seg */ if ((search_parent_flag != ACPI_NS_NO_UPSEARCH) && - (flags & ACPI_NS_SEARCH_PARENT)) { + (flags & ACPI_NS_SEARCH_PARENT)) { local_flags |= ACPI_NS_SEARCH_PARENT; } @@ -554,24 +554,28 @@ acpi_ns_lookup ( /* Extract one ACPI name from the front of the pathname */ - ACPI_MOVE_32_TO_32 (&simple_name, path); + ACPI_MOVE_32_TO_32(&simple_name, path); /* Try to find the single (4 character) ACPI name */ - status = acpi_ns_search_and_enter (simple_name, walk_state, current_node, - interpreter_mode, this_search_type, local_flags, &this_node); - if (ACPI_FAILURE (status)) { + status = + acpi_ns_search_and_enter(simple_name, walk_state, + current_node, interpreter_mode, + this_search_type, local_flags, + &this_node); + if (ACPI_FAILURE(status)) { if (status == AE_NOT_FOUND) { /* Name not found in ACPI namespace */ - ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, - "Name [%4.4s] not found in scope [%4.4s] %p\n", - (char *) &simple_name, (char *) ¤t_node->name, - current_node)); + ACPI_DEBUG_PRINT((ACPI_DB_NAMES, + "Name [%4.4s] not found in scope [%4.4s] %p\n", + (char *)&simple_name, + (char *)¤t_node->name, + current_node)); } *return_node = this_node; - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } /* @@ -587,19 +591,16 @@ acpi_ns_lookup ( * * Then we have a type mismatch. Just warn and ignore it. */ - if ((num_segments == 0) && - (type_to_check_for != ACPI_TYPE_ANY) && - (type_to_check_for != ACPI_TYPE_LOCAL_ALIAS) && - (type_to_check_for != ACPI_TYPE_LOCAL_METHOD_ALIAS) && - (type_to_check_for != ACPI_TYPE_LOCAL_SCOPE) && - (this_node->type != ACPI_TYPE_ANY) && - (this_node->type != type_to_check_for)) { + if ((num_segments == 0) && + (type_to_check_for != ACPI_TYPE_ANY) && + (type_to_check_for != ACPI_TYPE_LOCAL_ALIAS) && + (type_to_check_for != ACPI_TYPE_LOCAL_METHOD_ALIAS) && + (type_to_check_for != ACPI_TYPE_LOCAL_SCOPE) && + (this_node->type != ACPI_TYPE_ANY) && + (this_node->type != type_to_check_for)) { /* Complain about a type mismatch */ - ACPI_REPORT_WARNING ( - ("ns_lookup: Type mismatch on %4.4s (%s), searching for (%s)\n", - (char *) &simple_name, acpi_ut_get_type_name (this_node->type), - acpi_ut_get_type_name (type_to_check_for))); + ACPI_REPORT_WARNING(("ns_lookup: Type mismatch on %4.4s (%s), searching for (%s)\n", (char *)&simple_name, acpi_ut_get_type_name(this_node->type), acpi_ut_get_type_name(type_to_check_for))); } /* @@ -625,15 +626,16 @@ acpi_ns_lookup ( * If entry is a type which opens a scope, push the new scope on the * scope stack. */ - if (acpi_ns_opens_scope (type)) { - status = acpi_ds_scope_stack_push (this_node, type, walk_state); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + if (acpi_ns_opens_scope(type)) { + status = + acpi_ds_scope_stack_push(this_node, type, + walk_state); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } } } *return_node = this_node; - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - diff --git a/drivers/acpi/namespace/nsalloc.c b/drivers/acpi/namespace/nsalloc.c index 21d560decbf..cc7a85f8cfe 100644 --- a/drivers/acpi/namespace/nsalloc.c +++ b/drivers/acpi/namespace/nsalloc.c @@ -41,20 +41,14 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include #include - #define _COMPONENT ACPI_NAMESPACE - ACPI_MODULE_NAME ("nsalloc") +ACPI_MODULE_NAME("nsalloc") /* Local prototypes */ - -static void -acpi_ns_remove_reference ( - struct acpi_namespace_node *node); - +static void acpi_ns_remove_reference(struct acpi_namespace_node *node); /******************************************************************************* * @@ -68,31 +62,26 @@ acpi_ns_remove_reference ( * ******************************************************************************/ -struct acpi_namespace_node * -acpi_ns_create_node ( - u32 name) +struct acpi_namespace_node *acpi_ns_create_node(u32 name) { - struct acpi_namespace_node *node; - + struct acpi_namespace_node *node; - ACPI_FUNCTION_TRACE ("ns_create_node"); + ACPI_FUNCTION_TRACE("ns_create_node"); - - node = ACPI_MEM_CALLOCATE (sizeof (struct acpi_namespace_node)); + node = ACPI_MEM_CALLOCATE(sizeof(struct acpi_namespace_node)); if (!node) { - return_PTR (NULL); + return_PTR(NULL); } - ACPI_MEM_TRACKING (acpi_gbl_ns_node_list->total_allocated++); + ACPI_MEM_TRACKING(acpi_gbl_ns_node_list->total_allocated++); - node->name.integer = name; + node->name.integer = name; node->reference_count = 1; - ACPI_SET_DESCRIPTOR_TYPE (node, ACPI_DESC_TYPE_NAMED); + ACPI_SET_DESCRIPTOR_TYPE(node, ACPI_DESC_TYPE_NAMED); - return_PTR (node); + return_PTR(node); } - /******************************************************************************* * * FUNCTION: acpi_ns_delete_node @@ -105,19 +94,15 @@ acpi_ns_create_node ( * ******************************************************************************/ -void -acpi_ns_delete_node ( - struct acpi_namespace_node *node) +void acpi_ns_delete_node(struct acpi_namespace_node *node) { - struct acpi_namespace_node *parent_node; - struct acpi_namespace_node *prev_node; - struct acpi_namespace_node *next_node; - - - ACPI_FUNCTION_TRACE_PTR ("ns_delete_node", node); + struct acpi_namespace_node *parent_node; + struct acpi_namespace_node *prev_node; + struct acpi_namespace_node *next_node; + ACPI_FUNCTION_TRACE_PTR("ns_delete_node", node); - parent_node = acpi_ns_get_parent_node (node); + parent_node = acpi_ns_get_parent_node(node); prev_node = NULL; next_node = parent_node->child; @@ -136,32 +121,29 @@ acpi_ns_delete_node ( if (next_node->flags & ANOBJ_END_OF_PEER_LIST) { prev_node->flags |= ANOBJ_END_OF_PEER_LIST; } - } - else { + } else { /* Node is first child (has no previous peer) */ if (next_node->flags & ANOBJ_END_OF_PEER_LIST) { /* No peers at all */ parent_node->child = NULL; - } - else { /* Link peer list to parent */ + } else { /* Link peer list to parent */ parent_node->child = next_node->peer; } } - ACPI_MEM_TRACKING (acpi_gbl_ns_node_list->total_freed++); + ACPI_MEM_TRACKING(acpi_gbl_ns_node_list->total_freed++); /* * Detach an object if there is one then delete the node */ - acpi_ns_detach_object (node); - ACPI_MEM_FREE (node); + acpi_ns_detach_object(node); + ACPI_MEM_FREE(node); return_VOID; } - /******************************************************************************* * * FUNCTION: acpi_ns_install_node @@ -182,19 +164,14 @@ acpi_ns_delete_node ( * ******************************************************************************/ -void -acpi_ns_install_node ( - struct acpi_walk_state *walk_state, - struct acpi_namespace_node *parent_node, /* Parent */ - struct acpi_namespace_node *node, /* New Child*/ - acpi_object_type type) +void acpi_ns_install_node(struct acpi_walk_state *walk_state, struct acpi_namespace_node *parent_node, /* Parent */ + struct acpi_namespace_node *node, /* New Child */ + acpi_object_type type) { - acpi_owner_id owner_id = 0; - struct acpi_namespace_node *child_node; - - - ACPI_FUNCTION_TRACE ("ns_install_node"); + acpi_owner_id owner_id = 0; + struct acpi_namespace_node *child_node; + ACPI_FUNCTION_TRACE("ns_install_node"); /* * Get the owner ID from the Walk state @@ -212,8 +189,7 @@ acpi_ns_install_node ( parent_node->child = node; node->flags |= ANOBJ_END_OF_PEER_LIST; node->peer = parent_node; - } - else { + } else { while (!(child_node->flags & ANOBJ_END_OF_PEER_LIST)) { child_node = child_node->peer; } @@ -232,24 +208,25 @@ acpi_ns_install_node ( node->owner_id = owner_id; node->type = (u8) type; - ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, - "%4.4s (%s) [Node %p Owner %X] added to %4.4s (%s) [Node %p]\n", - acpi_ut_get_node_name (node), acpi_ut_get_type_name (node->type), node, owner_id, - acpi_ut_get_node_name (parent_node), acpi_ut_get_type_name (parent_node->type), - parent_node)); + ACPI_DEBUG_PRINT((ACPI_DB_NAMES, + "%4.4s (%s) [Node %p Owner %X] added to %4.4s (%s) [Node %p]\n", + acpi_ut_get_node_name(node), + acpi_ut_get_type_name(node->type), node, owner_id, + acpi_ut_get_node_name(parent_node), + acpi_ut_get_type_name(parent_node->type), + parent_node)); /* * Increment the reference count(s) of all parents up to * the root! */ - while ((node = acpi_ns_get_parent_node (node)) != NULL) { + while ((node = acpi_ns_get_parent_node(node)) != NULL) { node->reference_count++; } return_VOID; } - /******************************************************************************* * * FUNCTION: acpi_ns_delete_children @@ -263,18 +240,14 @@ acpi_ns_install_node ( * ******************************************************************************/ -void -acpi_ns_delete_children ( - struct acpi_namespace_node *parent_node) +void acpi_ns_delete_children(struct acpi_namespace_node *parent_node) { - struct acpi_namespace_node *child_node; - struct acpi_namespace_node *next_node; - struct acpi_namespace_node *node; - u8 flags; - - - ACPI_FUNCTION_TRACE_PTR ("ns_delete_children", parent_node); + struct acpi_namespace_node *child_node; + struct acpi_namespace_node *next_node; + struct acpi_namespace_node *node; + u8 flags; + ACPI_FUNCTION_TRACE_PTR("ns_delete_children", parent_node); if (!parent_node) { return_VOID; @@ -293,48 +266,48 @@ acpi_ns_delete_children ( do { /* Get the things we need */ - next_node = child_node->peer; - flags = child_node->flags; + next_node = child_node->peer; + flags = child_node->flags; /* Grandchildren should have all been deleted already */ if (child_node->child) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Found a grandchild! P=%p C=%p\n", - parent_node, child_node)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Found a grandchild! P=%p C=%p\n", + parent_node, child_node)); } /* Now we can free this child object */ - ACPI_MEM_TRACKING (acpi_gbl_ns_node_list->total_freed++); + ACPI_MEM_TRACKING(acpi_gbl_ns_node_list->total_freed++); - ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Object %p, Remaining %X\n", - child_node, acpi_gbl_current_node_count)); + ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, + "Object %p, Remaining %X\n", child_node, + acpi_gbl_current_node_count)); /* * Detach an object if there is one, then free the child node */ - acpi_ns_detach_object (child_node); + acpi_ns_detach_object(child_node); /* * Decrement the reference count(s) of all parents up to * the root! (counts were incremented when the node was created) */ node = child_node; - while ((node = acpi_ns_get_parent_node (node)) != NULL) { + while ((node = acpi_ns_get_parent_node(node)) != NULL) { node->reference_count--; } /* There should be only one reference remaining on this node */ if (child_node->reference_count != 1) { - ACPI_REPORT_WARNING (( - "Existing references (%d) on node being deleted (%p)\n", - child_node->reference_count, child_node)); + ACPI_REPORT_WARNING(("Existing references (%d) on node being deleted (%p)\n", child_node->reference_count, child_node)); } /* Now we can delete the node */ - ACPI_MEM_FREE (child_node); + ACPI_MEM_FREE(child_node); /* And move on to the next child in the list */ @@ -342,7 +315,6 @@ acpi_ns_delete_children ( } while (!(flags & ANOBJ_END_OF_PEER_LIST)); - /* Clear the parent's child pointer */ parent_node->child = NULL; @@ -350,7 +322,6 @@ acpi_ns_delete_children ( return_VOID; } - /******************************************************************************* * * FUNCTION: acpi_ns_delete_namespace_subtree @@ -364,16 +335,12 @@ acpi_ns_delete_children ( * ******************************************************************************/ -void -acpi_ns_delete_namespace_subtree ( - struct acpi_namespace_node *parent_node) +void acpi_ns_delete_namespace_subtree(struct acpi_namespace_node *parent_node) { - struct acpi_namespace_node *child_node = NULL; - u32 level = 1; - - - ACPI_FUNCTION_TRACE ("ns_delete_namespace_subtree"); + struct acpi_namespace_node *child_node = NULL; + u32 level = 1; + ACPI_FUNCTION_TRACE("ns_delete_namespace_subtree"); if (!parent_node) { return_VOID; @@ -386,16 +353,17 @@ acpi_ns_delete_namespace_subtree ( while (level > 0) { /* Get the next node in this scope (NULL if none) */ - child_node = acpi_ns_get_next_node (ACPI_TYPE_ANY, parent_node, - child_node); + child_node = acpi_ns_get_next_node(ACPI_TYPE_ANY, parent_node, + child_node); if (child_node) { /* Found a child node - detach any attached object */ - acpi_ns_detach_object (child_node); + acpi_ns_detach_object(child_node); /* Check if this node has any children */ - if (acpi_ns_get_next_node (ACPI_TYPE_ANY, child_node, NULL)) { + if (acpi_ns_get_next_node + (ACPI_TYPE_ANY, child_node, NULL)) { /* * There is at least one child of this node, * visit the node @@ -404,8 +372,7 @@ acpi_ns_delete_namespace_subtree ( parent_node = child_node; child_node = NULL; } - } - else { + } else { /* * No more children of this parent node. * Move up to the grandparent. @@ -416,7 +383,7 @@ acpi_ns_delete_namespace_subtree ( * Now delete all of the children of this parent * all at the same time. */ - acpi_ns_delete_children (parent_node); + acpi_ns_delete_children(parent_node); /* New "last child" is this parent node */ @@ -424,14 +391,13 @@ acpi_ns_delete_namespace_subtree ( /* Move up the tree to the grandparent */ - parent_node = acpi_ns_get_parent_node (parent_node); + parent_node = acpi_ns_get_parent_node(parent_node); } } return_VOID; } - /******************************************************************************* * * FUNCTION: acpi_ns_remove_reference @@ -447,16 +413,12 @@ acpi_ns_delete_namespace_subtree ( * ******************************************************************************/ -static void -acpi_ns_remove_reference ( - struct acpi_namespace_node *node) +static void acpi_ns_remove_reference(struct acpi_namespace_node *node) { - struct acpi_namespace_node *parent_node; - struct acpi_namespace_node *this_node; - - - ACPI_FUNCTION_ENTRY (); + struct acpi_namespace_node *parent_node; + struct acpi_namespace_node *this_node; + ACPI_FUNCTION_ENTRY(); /* * Decrement the reference count(s) of this node and all @@ -466,7 +428,7 @@ acpi_ns_remove_reference ( while (this_node) { /* Prepare to move up to parent */ - parent_node = acpi_ns_get_parent_node (this_node); + parent_node = acpi_ns_get_parent_node(this_node); /* Decrement the reference count on this node */ @@ -477,15 +439,14 @@ acpi_ns_remove_reference ( if (!this_node->reference_count) { /* Delete all children and delete the node */ - acpi_ns_delete_children (this_node); - acpi_ns_delete_node (this_node); + acpi_ns_delete_children(this_node); + acpi_ns_delete_node(this_node); } this_node = parent_node; } } - /******************************************************************************* * * FUNCTION: acpi_ns_delete_namespace_by_owner @@ -500,27 +461,23 @@ acpi_ns_remove_reference ( * ******************************************************************************/ -void -acpi_ns_delete_namespace_by_owner ( - acpi_owner_id owner_id) +void acpi_ns_delete_namespace_by_owner(acpi_owner_id owner_id) { - struct acpi_namespace_node *child_node; - struct acpi_namespace_node *deletion_node; - u32 level; - struct acpi_namespace_node *parent_node; - - - ACPI_FUNCTION_TRACE_U32 ("ns_delete_namespace_by_owner", owner_id); + struct acpi_namespace_node *child_node; + struct acpi_namespace_node *deletion_node; + u32 level; + struct acpi_namespace_node *parent_node; + ACPI_FUNCTION_TRACE_U32("ns_delete_namespace_by_owner", owner_id); if (owner_id == 0) { return_VOID; } - parent_node = acpi_gbl_root_node; - child_node = NULL; + parent_node = acpi_gbl_root_node; + child_node = NULL; deletion_node = NULL; - level = 1; + level = 1; /* * Traverse the tree of nodes until we bubble back up @@ -531,10 +488,12 @@ acpi_ns_delete_namespace_by_owner ( * Get the next child of this parent node. When child_node is NULL, * the first child of the parent is returned */ - child_node = acpi_ns_get_next_node (ACPI_TYPE_ANY, parent_node, child_node); + child_node = + acpi_ns_get_next_node(ACPI_TYPE_ANY, parent_node, + child_node); if (deletion_node) { - acpi_ns_remove_reference (deletion_node); + acpi_ns_remove_reference(deletion_node); deletion_node = NULL; } @@ -542,12 +501,13 @@ acpi_ns_delete_namespace_by_owner ( if (child_node->owner_id == owner_id) { /* Found a matching child node - detach any attached object */ - acpi_ns_detach_object (child_node); + acpi_ns_detach_object(child_node); } /* Check if this node has any children */ - if (acpi_ns_get_next_node (ACPI_TYPE_ANY, child_node, NULL)) { + if (acpi_ns_get_next_node + (ACPI_TYPE_ANY, child_node, NULL)) { /* * There is at least one child of this node, * visit the node @@ -555,12 +515,10 @@ acpi_ns_delete_namespace_by_owner ( level++; parent_node = child_node; child_node = NULL; - } - else if (child_node->owner_id == owner_id) { + } else if (child_node->owner_id == owner_id) { deletion_node = child_node; } - } - else { + } else { /* * No more children of this parent node. * Move up to the grandparent. @@ -578,11 +536,9 @@ acpi_ns_delete_namespace_by_owner ( /* Move up the tree to the grandparent */ - parent_node = acpi_ns_get_parent_node (parent_node); + parent_node = acpi_ns_get_parent_node(parent_node); } } return_VOID; } - - diff --git a/drivers/acpi/namespace/nsdump.c b/drivers/acpi/namespace/nsdump.c index 5d25add6b03..9faf1d5c86e 100644 --- a/drivers/acpi/namespace/nsdump.c +++ b/drivers/acpi/namespace/nsdump.c @@ -41,31 +41,22 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include #include #include - #define _COMPONENT ACPI_NAMESPACE - ACPI_MODULE_NAME ("nsdump") +ACPI_MODULE_NAME("nsdump") /* Local prototypes */ - #ifdef ACPI_OBSOLETE_FUNCTIONS -void -acpi_ns_dump_root_devices ( - void); +void acpi_ns_dump_root_devices(void); static acpi_status -acpi_ns_dump_one_device ( - acpi_handle obj_handle, - u32 level, - void *context, - void **return_value); +acpi_ns_dump_one_device(acpi_handle obj_handle, + u32 level, void *context, void **return_value); #endif - #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) /******************************************************************************* * @@ -80,43 +71,38 @@ acpi_ns_dump_one_device ( * ******************************************************************************/ -void -acpi_ns_print_pathname ( - u32 num_segments, - char *pathname) +void acpi_ns_print_pathname(u32 num_segments, char *pathname) { - acpi_native_uint i; + acpi_native_uint i; + ACPI_FUNCTION_NAME("ns_print_pathname"); - ACPI_FUNCTION_NAME ("ns_print_pathname"); - - - if (!(acpi_dbg_level & ACPI_LV_NAMES) || !(acpi_dbg_layer & ACPI_NAMESPACE)) { + if (!(acpi_dbg_level & ACPI_LV_NAMES) + || !(acpi_dbg_layer & ACPI_NAMESPACE)) { return; } /* Print the entire name */ - ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "[")); + ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "[")); while (num_segments) { for (i = 0; i < 4; i++) { - ACPI_IS_PRINT (pathname[i]) ? - acpi_os_printf ("%c", pathname[i]) : - acpi_os_printf ("?"); + ACPI_IS_PRINT(pathname[i]) ? + acpi_os_printf("%c", pathname[i]) : + acpi_os_printf("?"); } pathname += ACPI_NAME_SIZE; num_segments--; if (num_segments) { - acpi_os_printf ("."); + acpi_os_printf("."); } } - acpi_os_printf ("]\n"); + acpi_os_printf("]\n"); } - /******************************************************************************* * * FUNCTION: acpi_ns_dump_pathname @@ -134,15 +120,10 @@ acpi_ns_print_pathname ( ******************************************************************************/ void -acpi_ns_dump_pathname ( - acpi_handle handle, - char *msg, - u32 level, - u32 component) +acpi_ns_dump_pathname(acpi_handle handle, char *msg, u32 level, u32 component) { - ACPI_FUNCTION_TRACE ("ns_dump_pathname"); - + ACPI_FUNCTION_TRACE("ns_dump_pathname"); /* Do this only if the requested debug level and component are enabled */ @@ -152,12 +133,11 @@ acpi_ns_dump_pathname ( /* Convert handle to a full pathname and print it (with supplied message) */ - acpi_ns_print_node_pathname (handle, msg); - acpi_os_printf ("\n"); + acpi_ns_print_node_pathname(handle, msg); + acpi_os_printf("\n"); return_VOID; } - /******************************************************************************* * * FUNCTION: acpi_ns_dump_one_object @@ -175,24 +155,19 @@ acpi_ns_dump_pathname ( ******************************************************************************/ acpi_status -acpi_ns_dump_one_object ( - acpi_handle obj_handle, - u32 level, - void *context, - void **return_value) +acpi_ns_dump_one_object(acpi_handle obj_handle, + u32 level, void *context, void **return_value) { - struct acpi_walk_info *info = (struct acpi_walk_info *) context; - struct acpi_namespace_node *this_node; - union acpi_operand_object *obj_desc = NULL; - acpi_object_type obj_type; - acpi_object_type type; - u32 bytes_to_dump; - u32 dbg_level; - u32 i; - - - ACPI_FUNCTION_NAME ("ns_dump_one_object"); + struct acpi_walk_info *info = (struct acpi_walk_info *)context; + struct acpi_namespace_node *this_node; + union acpi_operand_object *obj_desc = NULL; + acpi_object_type obj_type; + acpi_object_type type; + u32 bytes_to_dump; + u32 dbg_level; + u32 i; + ACPI_FUNCTION_NAME("ns_dump_one_object"); /* Is output enabled? */ @@ -201,48 +176,47 @@ acpi_ns_dump_one_object ( } if (!obj_handle) { - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Null object handle\n")); + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Null object handle\n")); return (AE_OK); } - this_node = acpi_ns_map_handle_to_node (obj_handle); + this_node = acpi_ns_map_handle_to_node(obj_handle); type = this_node->type; /* Check if the owner matches */ if ((info->owner_id != ACPI_OWNER_ID_MAX) && - (info->owner_id != this_node->owner_id)) { + (info->owner_id != this_node->owner_id)) { return (AE_OK); } if (!(info->display_type & ACPI_DISPLAY_SHORT)) { /* Indent the object according to the level */ - acpi_os_printf ("%2d%*s", (u32) level - 1, (int) level * 2, " "); + acpi_os_printf("%2d%*s", (u32) level - 1, (int)level * 2, " "); /* Check the node type and name */ if (type > ACPI_TYPE_LOCAL_MAX) { - ACPI_REPORT_WARNING (("Invalid ACPI Type %08X\n", type)); + ACPI_REPORT_WARNING(("Invalid ACPI Type %08X\n", type)); } - if (!acpi_ut_valid_acpi_name (this_node->name.integer)) { - ACPI_REPORT_WARNING (("Invalid ACPI Name %08X\n", - this_node->name.integer)); + if (!acpi_ut_valid_acpi_name(this_node->name.integer)) { + ACPI_REPORT_WARNING(("Invalid ACPI Name %08X\n", + this_node->name.integer)); } - acpi_os_printf ("%4.4s", acpi_ut_get_node_name (this_node)); + acpi_os_printf("%4.4s", acpi_ut_get_node_name(this_node)); } /* * Now we can print out the pertinent information */ - acpi_os_printf (" %-12s %p ", - acpi_ut_get_type_name (type), this_node); + acpi_os_printf(" %-12s %p ", acpi_ut_get_type_name(type), this_node); dbg_level = acpi_dbg_level; acpi_dbg_level = 0; - obj_desc = acpi_ns_get_attached_object (this_node); + obj_desc = acpi_ns_get_attached_object(this_node); acpi_dbg_level = dbg_level; switch (info->display_type & ACPI_DISPLAY_MASK) { @@ -251,147 +225,166 @@ acpi_ns_dump_one_object ( if (!obj_desc) { /* No attached object, we are done */ - acpi_os_printf ("\n"); + acpi_os_printf("\n"); return (AE_OK); } switch (type) { case ACPI_TYPE_PROCESSOR: - acpi_os_printf ("ID %X Len %.4X Addr %p\n", - obj_desc->processor.proc_id, obj_desc->processor.length, - (char *) obj_desc->processor.address); + acpi_os_printf("ID %X Len %.4X Addr %p\n", + obj_desc->processor.proc_id, + obj_desc->processor.length, + (char *)obj_desc->processor.address); break; - case ACPI_TYPE_DEVICE: - acpi_os_printf ("Notify Object: %p\n", obj_desc); + acpi_os_printf("Notify Object: %p\n", obj_desc); break; - case ACPI_TYPE_METHOD: - acpi_os_printf ("Args %X Len %.4X Aml %p\n", - (u32) obj_desc->method.param_count, - obj_desc->method.aml_length, obj_desc->method.aml_start); + acpi_os_printf("Args %X Len %.4X Aml %p\n", + (u32) obj_desc->method.param_count, + obj_desc->method.aml_length, + obj_desc->method.aml_start); break; - case ACPI_TYPE_INTEGER: - acpi_os_printf ("= %8.8X%8.8X\n", - ACPI_FORMAT_UINT64 (obj_desc->integer.value)); + acpi_os_printf("= %8.8X%8.8X\n", + ACPI_FORMAT_UINT64(obj_desc->integer. + value)); break; - case ACPI_TYPE_PACKAGE: if (obj_desc->common.flags & AOPOBJ_DATA_VALID) { - acpi_os_printf ("Elements %.2X\n", - obj_desc->package.count); - } - else { - acpi_os_printf ("[Length not yet evaluated]\n"); + acpi_os_printf("Elements %.2X\n", + obj_desc->package.count); + } else { + acpi_os_printf("[Length not yet evaluated]\n"); } break; - case ACPI_TYPE_BUFFER: if (obj_desc->common.flags & AOPOBJ_DATA_VALID) { - acpi_os_printf ("Len %.2X", - obj_desc->buffer.length); + acpi_os_printf("Len %.2X", + obj_desc->buffer.length); /* Dump some of the buffer */ if (obj_desc->buffer.length > 0) { - acpi_os_printf (" ="); - for (i = 0; (i < obj_desc->buffer.length && i < 12); i++) { - acpi_os_printf (" %.2hX", obj_desc->buffer.pointer[i]); + acpi_os_printf(" ="); + for (i = 0; + (i < obj_desc->buffer.length + && i < 12); i++) { + acpi_os_printf(" %.2hX", + obj_desc->buffer. + pointer[i]); } } - acpi_os_printf ("\n"); - } - else { - acpi_os_printf ("[Length not yet evaluated]\n"); + acpi_os_printf("\n"); + } else { + acpi_os_printf("[Length not yet evaluated]\n"); } break; - case ACPI_TYPE_STRING: - acpi_os_printf ("Len %.2X ", obj_desc->string.length); - acpi_ut_print_string (obj_desc->string.pointer, 32); - acpi_os_printf ("\n"); + acpi_os_printf("Len %.2X ", obj_desc->string.length); + acpi_ut_print_string(obj_desc->string.pointer, 32); + acpi_os_printf("\n"); break; - case ACPI_TYPE_REGION: - acpi_os_printf ("[%s]", - acpi_ut_get_region_name (obj_desc->region.space_id)); + acpi_os_printf("[%s]", + acpi_ut_get_region_name(obj_desc->region. + space_id)); if (obj_desc->region.flags & AOPOBJ_DATA_VALID) { - acpi_os_printf (" Addr %8.8X%8.8X Len %.4X\n", - ACPI_FORMAT_UINT64 (obj_desc->region.address), - obj_desc->region.length); - } - else { - acpi_os_printf (" [Address/Length not yet evaluated]\n"); + acpi_os_printf(" Addr %8.8X%8.8X Len %.4X\n", + ACPI_FORMAT_UINT64(obj_desc-> + region. + address), + obj_desc->region.length); + } else { + acpi_os_printf + (" [Address/Length not yet evaluated]\n"); } break; - case ACPI_TYPE_LOCAL_REFERENCE: - acpi_os_printf ("[%s]\n", - acpi_ps_get_opcode_name (obj_desc->reference.opcode)); + acpi_os_printf("[%s]\n", + acpi_ps_get_opcode_name(obj_desc-> + reference. + opcode)); break; - case ACPI_TYPE_BUFFER_FIELD: if (obj_desc->buffer_field.buffer_obj && - obj_desc->buffer_field.buffer_obj->buffer.node) { - acpi_os_printf ("Buf [%4.4s]", - acpi_ut_get_node_name (obj_desc->buffer_field.buffer_obj->buffer.node)); + obj_desc->buffer_field.buffer_obj->buffer.node) { + acpi_os_printf("Buf [%4.4s]", + acpi_ut_get_node_name(obj_desc-> + buffer_field. + buffer_obj-> + buffer. + node)); } break; - case ACPI_TYPE_LOCAL_REGION_FIELD: - acpi_os_printf ("Rgn [%4.4s]", - acpi_ut_get_node_name (obj_desc->common_field.region_obj->region.node)); + acpi_os_printf("Rgn [%4.4s]", + acpi_ut_get_node_name(obj_desc-> + common_field. + region_obj->region. + node)); break; - case ACPI_TYPE_LOCAL_BANK_FIELD: - acpi_os_printf ("Rgn [%4.4s] Bnk [%4.4s]", - acpi_ut_get_node_name (obj_desc->common_field.region_obj->region.node), - acpi_ut_get_node_name (obj_desc->bank_field.bank_obj->common_field.node)); + acpi_os_printf("Rgn [%4.4s] Bnk [%4.4s]", + acpi_ut_get_node_name(obj_desc-> + common_field. + region_obj->region. + node), + acpi_ut_get_node_name(obj_desc-> + bank_field. + bank_obj-> + common_field. + node)); break; - case ACPI_TYPE_LOCAL_INDEX_FIELD: - acpi_os_printf ("Idx [%4.4s] Dat [%4.4s]", - acpi_ut_get_node_name (obj_desc->index_field.index_obj->common_field.node), - acpi_ut_get_node_name (obj_desc->index_field.data_obj->common_field.node)); + acpi_os_printf("Idx [%4.4s] Dat [%4.4s]", + acpi_ut_get_node_name(obj_desc-> + index_field. + index_obj-> + common_field.node), + acpi_ut_get_node_name(obj_desc-> + index_field. + data_obj-> + common_field. + node)); break; - case ACPI_TYPE_LOCAL_ALIAS: case ACPI_TYPE_LOCAL_METHOD_ALIAS: - acpi_os_printf ("Target %4.4s (%p)\n", - acpi_ut_get_node_name (obj_desc), obj_desc); + acpi_os_printf("Target %4.4s (%p)\n", + acpi_ut_get_node_name(obj_desc), + obj_desc); break; default: - acpi_os_printf ("Object %p\n", obj_desc); + acpi_os_printf("Object %p\n", obj_desc); break; } @@ -403,11 +396,15 @@ acpi_ns_dump_one_object ( case ACPI_TYPE_LOCAL_BANK_FIELD: case ACPI_TYPE_LOCAL_INDEX_FIELD: - acpi_os_printf (" Off %.3X Len %.2X Acc %.2hd\n", - (obj_desc->common_field.base_byte_offset * 8) - + obj_desc->common_field.start_field_bit_offset, - obj_desc->common_field.bit_length, - obj_desc->common_field.access_byte_width); + acpi_os_printf(" Off %.3X Len %.2X Acc %.2hd\n", + (obj_desc->common_field. + base_byte_offset * 8) + + + obj_desc->common_field. + start_field_bit_offset, + obj_desc->common_field.bit_length, + obj_desc->common_field. + access_byte_width); break; default: @@ -415,56 +412,55 @@ acpi_ns_dump_one_object ( } break; - case ACPI_DISPLAY_OBJECTS: - acpi_os_printf ("O:%p", obj_desc); + acpi_os_printf("O:%p", obj_desc); if (!obj_desc) { /* No attached object, we are done */ - acpi_os_printf ("\n"); + acpi_os_printf("\n"); return (AE_OK); } - acpi_os_printf ("(R%d)", obj_desc->common.reference_count); + acpi_os_printf("(R%d)", obj_desc->common.reference_count); switch (type) { case ACPI_TYPE_METHOD: /* Name is a Method and its AML offset/length are set */ - acpi_os_printf (" M:%p-%X\n", obj_desc->method.aml_start, - obj_desc->method.aml_length); + acpi_os_printf(" M:%p-%X\n", obj_desc->method.aml_start, + obj_desc->method.aml_length); break; case ACPI_TYPE_INTEGER: - acpi_os_printf (" I:%8.8X8.8%X\n", - ACPI_FORMAT_UINT64 (obj_desc->integer.value)); + acpi_os_printf(" I:%8.8X8.8%X\n", + ACPI_FORMAT_UINT64(obj_desc->integer. + value)); break; case ACPI_TYPE_STRING: - acpi_os_printf (" S:%p-%X\n", obj_desc->string.pointer, - obj_desc->string.length); + acpi_os_printf(" S:%p-%X\n", obj_desc->string.pointer, + obj_desc->string.length); break; case ACPI_TYPE_BUFFER: - acpi_os_printf (" B:%p-%X\n", obj_desc->buffer.pointer, - obj_desc->buffer.length); + acpi_os_printf(" B:%p-%X\n", obj_desc->buffer.pointer, + obj_desc->buffer.length); break; default: - acpi_os_printf ("\n"); + acpi_os_printf("\n"); break; } break; - default: - acpi_os_printf ("\n"); + acpi_os_printf("\n"); break; } @@ -474,46 +470,47 @@ acpi_ns_dump_one_object ( return (AE_OK); } - /* If there is an attached object, display it */ - dbg_level = acpi_dbg_level; + dbg_level = acpi_dbg_level; acpi_dbg_level = 0; - obj_desc = acpi_ns_get_attached_object (this_node); + obj_desc = acpi_ns_get_attached_object(this_node); acpi_dbg_level = dbg_level; /* Dump attached objects */ while (obj_desc) { obj_type = ACPI_TYPE_INVALID; - acpi_os_printf ("Attached Object %p: ", obj_desc); + acpi_os_printf("Attached Object %p: ", obj_desc); /* Decode the type of attached object and dump the contents */ - switch (ACPI_GET_DESCRIPTOR_TYPE (obj_desc)) { + switch (ACPI_GET_DESCRIPTOR_TYPE(obj_desc)) { case ACPI_DESC_TYPE_NAMED: - acpi_os_printf ("(Ptr to Node)\n"); - bytes_to_dump = sizeof (struct acpi_namespace_node); - ACPI_DUMP_BUFFER (obj_desc, bytes_to_dump); + acpi_os_printf("(Ptr to Node)\n"); + bytes_to_dump = sizeof(struct acpi_namespace_node); + ACPI_DUMP_BUFFER(obj_desc, bytes_to_dump); break; case ACPI_DESC_TYPE_OPERAND: - obj_type = ACPI_GET_OBJECT_TYPE (obj_desc); + obj_type = ACPI_GET_OBJECT_TYPE(obj_desc); if (obj_type > ACPI_TYPE_LOCAL_MAX) { - acpi_os_printf ("(Ptr to ACPI Object type %X [UNKNOWN])\n", - obj_type); + acpi_os_printf + ("(Ptr to ACPI Object type %X [UNKNOWN])\n", + obj_type); bytes_to_dump = 32; - } - else { - acpi_os_printf ("(Ptr to ACPI Object type %X [%s])\n", - obj_type, acpi_ut_get_type_name (obj_type)); - bytes_to_dump = sizeof (union acpi_operand_object); + } else { + acpi_os_printf + ("(Ptr to ACPI Object type %X [%s])\n", + obj_type, acpi_ut_get_type_name(obj_type)); + bytes_to_dump = + sizeof(union acpi_operand_object); } - ACPI_DUMP_BUFFER (obj_desc, bytes_to_dump); + ACPI_DUMP_BUFFER(obj_desc, bytes_to_dump); break; default: @@ -523,7 +520,8 @@ acpi_ns_dump_one_object ( /* If value is NOT an internal object, we are done */ - if (ACPI_GET_DESCRIPTOR_TYPE (obj_desc) != ACPI_DESC_TYPE_OPERAND) { + if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) != + ACPI_DESC_TYPE_OPERAND) { goto cleanup; } @@ -537,49 +535,50 @@ acpi_ns_dump_one_object ( * NOTE: takes advantage of common fields between string/buffer */ bytes_to_dump = obj_desc->string.length; - obj_desc = (void *) obj_desc->string.pointer; - acpi_os_printf ( "(Buffer/String pointer %p length %X)\n", - obj_desc, bytes_to_dump); - ACPI_DUMP_BUFFER (obj_desc, bytes_to_dump); + obj_desc = (void *)obj_desc->string.pointer; + acpi_os_printf("(Buffer/String pointer %p length %X)\n", + obj_desc, bytes_to_dump); + ACPI_DUMP_BUFFER(obj_desc, bytes_to_dump); goto cleanup; case ACPI_TYPE_BUFFER_FIELD: - obj_desc = (union acpi_operand_object *) obj_desc->buffer_field.buffer_obj; + obj_desc = + (union acpi_operand_object *)obj_desc->buffer_field. + buffer_obj; break; case ACPI_TYPE_PACKAGE: - obj_desc = (void *) obj_desc->package.elements; + obj_desc = (void *)obj_desc->package.elements; break; case ACPI_TYPE_METHOD: - obj_desc = (void *) obj_desc->method.aml_start; + obj_desc = (void *)obj_desc->method.aml_start; break; case ACPI_TYPE_LOCAL_REGION_FIELD: - obj_desc = (void *) obj_desc->field.region_obj; + obj_desc = (void *)obj_desc->field.region_obj; break; case ACPI_TYPE_LOCAL_BANK_FIELD: - obj_desc = (void *) obj_desc->bank_field.region_obj; + obj_desc = (void *)obj_desc->bank_field.region_obj; break; case ACPI_TYPE_LOCAL_INDEX_FIELD: - obj_desc = (void *) obj_desc->index_field.index_obj; + obj_desc = (void *)obj_desc->index_field.index_obj; break; default: goto cleanup; } - obj_type = ACPI_TYPE_INVALID; /* Terminate loop after next pass */ + obj_type = ACPI_TYPE_INVALID; /* Terminate loop after next pass */ } -cleanup: - acpi_os_printf ("\n"); + cleanup: + acpi_os_printf("\n"); return (AE_OK); } - #ifdef ACPI_FUTURE_USAGE /******************************************************************************* * @@ -601,29 +600,25 @@ cleanup: ******************************************************************************/ void -acpi_ns_dump_objects ( - acpi_object_type type, - u8 display_type, - u32 max_depth, - acpi_owner_id owner_id, - acpi_handle start_handle) +acpi_ns_dump_objects(acpi_object_type type, + u8 display_type, + u32 max_depth, + acpi_owner_id owner_id, acpi_handle start_handle) { - struct acpi_walk_info info; - - - ACPI_FUNCTION_ENTRY (); + struct acpi_walk_info info; + ACPI_FUNCTION_ENTRY(); info.debug_level = ACPI_LV_TABLES; info.owner_id = owner_id; info.display_type = display_type; - (void) acpi_ns_walk_namespace (type, start_handle, max_depth, - ACPI_NS_WALK_NO_UNLOCK, acpi_ns_dump_one_object, - (void *) &info, NULL); + (void)acpi_ns_walk_namespace(type, start_handle, max_depth, + ACPI_NS_WALK_NO_UNLOCK, + acpi_ns_dump_one_object, (void *)&info, + NULL); } -#endif /* ACPI_FUTURE_USAGE */ - +#endif /* ACPI_FUTURE_USAGE */ /******************************************************************************* * @@ -638,25 +633,19 @@ acpi_ns_dump_objects ( * ******************************************************************************/ -void -acpi_ns_dump_entry ( - acpi_handle handle, - u32 debug_level) +void acpi_ns_dump_entry(acpi_handle handle, u32 debug_level) { - struct acpi_walk_info info; - - - ACPI_FUNCTION_ENTRY (); + struct acpi_walk_info info; + ACPI_FUNCTION_ENTRY(); info.debug_level = debug_level; info.owner_id = ACPI_OWNER_ID_MAX; info.display_type = ACPI_DISPLAY_SUMMARY; - (void) acpi_ns_dump_one_object (handle, 1, &info, NULL); + (void)acpi_ns_dump_one_object(handle, 1, &info, NULL); } - #ifdef ACPI_ASL_COMPILER /******************************************************************************* * @@ -673,23 +662,19 @@ acpi_ns_dump_entry ( * ******************************************************************************/ -void -acpi_ns_dump_tables ( - acpi_handle search_base, - u32 max_depth) +void acpi_ns_dump_tables(acpi_handle search_base, u32 max_depth) { - acpi_handle search_handle = search_base; - - - ACPI_FUNCTION_TRACE ("ns_dump_tables"); + acpi_handle search_handle = search_base; + ACPI_FUNCTION_TRACE("ns_dump_tables"); if (!acpi_gbl_root_node) { /* * If the name space has not been initialized, * there is nothing to dump. */ - ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "namespace not initialized!\n")); + ACPI_DEBUG_PRINT((ACPI_DB_TABLES, + "namespace not initialized!\n")); return_VOID; } @@ -697,12 +682,12 @@ acpi_ns_dump_tables ( /* Entire namespace */ search_handle = acpi_gbl_root_node; - ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "\\\n")); + ACPI_DEBUG_PRINT((ACPI_DB_TABLES, "\\\n")); } - acpi_ns_dump_objects (ACPI_TYPE_ANY, ACPI_DISPLAY_OBJECTS, max_depth, - ACPI_OWNER_ID_MAX, search_handle); + acpi_ns_dump_objects(ACPI_TYPE_ANY, ACPI_DISPLAY_OBJECTS, max_depth, + ACPI_OWNER_ID_MAX, search_handle); return_VOID; } -#endif /* _ACPI_ASL_COMPILER */ -#endif /* defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) */ +#endif /* _ACPI_ASL_COMPILER */ +#endif /* defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) */ diff --git a/drivers/acpi/namespace/nsdumpdv.c b/drivers/acpi/namespace/nsdumpdv.c index 27c4f7cd2a4..55de883943d 100644 --- a/drivers/acpi/namespace/nsdumpdv.c +++ b/drivers/acpi/namespace/nsdumpdv.c @@ -41,20 +41,15 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include - /* TBD: This entire module is apparently obsolete and should be removed */ #define _COMPONENT ACPI_NAMESPACE - ACPI_MODULE_NAME ("nsdumpdv") - +ACPI_MODULE_NAME("nsdumpdv") #ifdef ACPI_OBSOLETE_FUNCTIONS #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) - #include - /******************************************************************************* * * FUNCTION: acpi_ns_dump_one_device @@ -70,44 +65,39 @@ * This procedure is a user_function called by acpi_ns_walk_namespace. * ******************************************************************************/ - static acpi_status -acpi_ns_dump_one_device ( - acpi_handle obj_handle, - u32 level, - void *context, - void **return_value) +acpi_ns_dump_one_device(acpi_handle obj_handle, + u32 level, void *context, void **return_value) { - struct acpi_buffer buffer; - struct acpi_device_info *info; - acpi_status status; - u32 i; - + struct acpi_buffer buffer; + struct acpi_device_info *info; + acpi_status status; + u32 i; - ACPI_FUNCTION_NAME ("ns_dump_one_device"); + ACPI_FUNCTION_NAME("ns_dump_one_device"); - - status = acpi_ns_dump_one_object (obj_handle, level, context, return_value); + status = + acpi_ns_dump_one_object(obj_handle, level, context, return_value); buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER; - status = acpi_get_object_info (obj_handle, &buffer); - if (ACPI_SUCCESS (status)) { + status = acpi_get_object_info(obj_handle, &buffer); + if (ACPI_SUCCESS(status)) { info = buffer.pointer; for (i = 0; i < level; i++) { - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " ")); + ACPI_DEBUG_PRINT_RAW((ACPI_DB_TABLES, " ")); } - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, - " HID: %s, ADR: %8.8X%8.8X, Status: %X\n", - info->hardware_id.value, ACPI_FORMAT_UINT64 (info->address), - info->current_status)); - ACPI_MEM_FREE (info); + ACPI_DEBUG_PRINT_RAW((ACPI_DB_TABLES, + " HID: %s, ADR: %8.8X%8.8X, Status: %X\n", + info->hardware_id.value, + ACPI_FORMAT_UINT64(info->address), + info->current_status)); + ACPI_MEM_FREE(info); } return (status); } - /******************************************************************************* * * FUNCTION: acpi_ns_dump_root_devices @@ -120,16 +110,12 @@ acpi_ns_dump_one_device ( * ******************************************************************************/ -void -acpi_ns_dump_root_devices ( - void) +void acpi_ns_dump_root_devices(void) { - acpi_handle sys_bus_handle; - acpi_status status; - - - ACPI_FUNCTION_NAME ("ns_dump_root_devices"); + acpi_handle sys_bus_handle; + acpi_status status; + ACPI_FUNCTION_NAME("ns_dump_root_devices"); /* Only dump the table if tracing is enabled */ @@ -138,19 +124,17 @@ acpi_ns_dump_root_devices ( } status = acpi_get_handle(NULL, ACPI_NS_SYSTEM_BUS, &sys_bus_handle); - if (ACPI_FAILURE (status)) { + if (ACPI_FAILURE(status)) { return; } - ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, - "Display of all devices in the namespace:\n")); + ACPI_DEBUG_PRINT((ACPI_DB_TABLES, + "Display of all devices in the namespace:\n")); - status = acpi_ns_walk_namespace (ACPI_TYPE_DEVICE, sys_bus_handle, - ACPI_UINT32_MAX, ACPI_NS_WALK_NO_UNLOCK, - acpi_ns_dump_one_device, NULL, NULL); + status = acpi_ns_walk_namespace(ACPI_TYPE_DEVICE, sys_bus_handle, + ACPI_UINT32_MAX, ACPI_NS_WALK_NO_UNLOCK, + acpi_ns_dump_one_device, NULL, NULL); } #endif #endif - - diff --git a/drivers/acpi/namespace/nseval.c b/drivers/acpi/namespace/nseval.c index 908cffd5e72..0191c7d9282 100644 --- a/drivers/acpi/namespace/nseval.c +++ b/drivers/acpi/namespace/nseval.c @@ -42,26 +42,19 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include #include #include #include - #define _COMPONENT ACPI_NAMESPACE - ACPI_MODULE_NAME ("nseval") +ACPI_MODULE_NAME("nseval") /* Local prototypes */ - static acpi_status -acpi_ns_execute_control_method ( - struct acpi_parameter_info *info); - -static acpi_status -acpi_ns_get_object_value ( - struct acpi_parameter_info *info); +acpi_ns_execute_control_method(struct acpi_parameter_info *info); +static acpi_status acpi_ns_get_object_value(struct acpi_parameter_info *info); /******************************************************************************* * @@ -85,48 +78,44 @@ acpi_ns_get_object_value ( ******************************************************************************/ acpi_status -acpi_ns_evaluate_relative ( - char *pathname, - struct acpi_parameter_info *info) +acpi_ns_evaluate_relative(char *pathname, struct acpi_parameter_info *info) { - acpi_status status; - struct acpi_namespace_node *node = NULL; - union acpi_generic_state *scope_info; - char *internal_path = NULL; - - - ACPI_FUNCTION_TRACE ("ns_evaluate_relative"); + acpi_status status; + struct acpi_namespace_node *node = NULL; + union acpi_generic_state *scope_info; + char *internal_path = NULL; + ACPI_FUNCTION_TRACE("ns_evaluate_relative"); /* * Must have a valid object handle */ if (!info || !info->node) { - return_ACPI_STATUS (AE_BAD_PARAMETER); + return_ACPI_STATUS(AE_BAD_PARAMETER); } /* Build an internal name string for the method */ - status = acpi_ns_internalize_name (pathname, &internal_path); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ns_internalize_name(pathname, &internal_path); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } - scope_info = acpi_ut_create_generic_state (); + scope_info = acpi_ut_create_generic_state(); if (!scope_info) { goto cleanup1; } /* Get the prefix handle and Node */ - status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (status)) { + status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE(status)) { goto cleanup; } - info->node = acpi_ns_map_handle_to_node (info->node); + info->node = acpi_ns_map_handle_to_node(info->node); if (!info->node) { - (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); + (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); status = AE_BAD_PARAMETER; goto cleanup; } @@ -134,39 +123,38 @@ acpi_ns_evaluate_relative ( /* Lookup the name in the namespace */ scope_info->scope.node = info->node; - status = acpi_ns_lookup (scope_info, internal_path, ACPI_TYPE_ANY, - ACPI_IMODE_EXECUTE, ACPI_NS_NO_UPSEARCH, NULL, - &node); + status = acpi_ns_lookup(scope_info, internal_path, ACPI_TYPE_ANY, + ACPI_IMODE_EXECUTE, ACPI_NS_NO_UPSEARCH, NULL, + &node); - (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); + (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (status)) { - ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Object [%s] not found [%s]\n", - pathname, acpi_format_exception (status))); + if (ACPI_FAILURE(status)) { + ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "Object [%s] not found [%s]\n", + pathname, acpi_format_exception(status))); goto cleanup; } /* * Now that we have a handle to the object, we can attempt to evaluate it. */ - ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "%s [%p] Value %p\n", - pathname, node, acpi_ns_get_attached_object (node))); + ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "%s [%p] Value %p\n", + pathname, node, acpi_ns_get_attached_object(node))); info->node = node; - status = acpi_ns_evaluate_by_handle (info); + status = acpi_ns_evaluate_by_handle(info); - ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "*** Completed eval of object %s ***\n", - pathname)); + ACPI_DEBUG_PRINT((ACPI_DB_NAMES, + "*** Completed eval of object %s ***\n", pathname)); -cleanup: - acpi_ut_delete_generic_state (scope_info); + cleanup: + acpi_ut_delete_generic_state(scope_info); -cleanup1: - ACPI_MEM_FREE (internal_path); - return_ACPI_STATUS (status); + cleanup1: + ACPI_MEM_FREE(internal_path); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_ns_evaluate_by_name @@ -189,68 +177,63 @@ cleanup1: ******************************************************************************/ acpi_status -acpi_ns_evaluate_by_name ( - char *pathname, - struct acpi_parameter_info *info) +acpi_ns_evaluate_by_name(char *pathname, struct acpi_parameter_info *info) { - acpi_status status; - char *internal_path = NULL; - - - ACPI_FUNCTION_TRACE ("ns_evaluate_by_name"); + acpi_status status; + char *internal_path = NULL; + ACPI_FUNCTION_TRACE("ns_evaluate_by_name"); /* Build an internal name string for the method */ - status = acpi_ns_internalize_name (pathname, &internal_path); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ns_internalize_name(pathname, &internal_path); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } - status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (status)) { + status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE(status)) { goto cleanup; } /* Lookup the name in the namespace */ - status = acpi_ns_lookup (NULL, internal_path, ACPI_TYPE_ANY, - ACPI_IMODE_EXECUTE, ACPI_NS_NO_UPSEARCH, NULL, - &info->node); + status = acpi_ns_lookup(NULL, internal_path, ACPI_TYPE_ANY, + ACPI_IMODE_EXECUTE, ACPI_NS_NO_UPSEARCH, NULL, + &info->node); - (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); + (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (status)) { - ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, - "Object at [%s] was not found, status=%.4X\n", - pathname, status)); + if (ACPI_FAILURE(status)) { + ACPI_DEBUG_PRINT((ACPI_DB_NAMES, + "Object at [%s] was not found, status=%.4X\n", + pathname, status)); goto cleanup; } /* * Now that we have a handle to the object, we can attempt to evaluate it. */ - ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "%s [%p] Value %p\n", - pathname, info->node, acpi_ns_get_attached_object (info->node))); - - status = acpi_ns_evaluate_by_handle (info); + ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "%s [%p] Value %p\n", + pathname, info->node, + acpi_ns_get_attached_object(info->node))); - ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "*** Completed eval of object %s ***\n", - pathname)); + status = acpi_ns_evaluate_by_handle(info); + ACPI_DEBUG_PRINT((ACPI_DB_NAMES, + "*** Completed eval of object %s ***\n", pathname)); -cleanup: + cleanup: /* Cleanup */ if (internal_path) { - ACPI_MEM_FREE (internal_path); + ACPI_MEM_FREE(internal_path); } - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_ns_evaluate_by_handle @@ -275,26 +258,22 @@ cleanup: * ******************************************************************************/ -acpi_status -acpi_ns_evaluate_by_handle ( - struct acpi_parameter_info *info) +acpi_status acpi_ns_evaluate_by_handle(struct acpi_parameter_info *info) { - acpi_status status; - - - ACPI_FUNCTION_TRACE ("ns_evaluate_by_handle"); + acpi_status status; + ACPI_FUNCTION_TRACE("ns_evaluate_by_handle"); /* Check if namespace has been initialized */ if (!acpi_gbl_root_node) { - return_ACPI_STATUS (AE_NO_NAMESPACE); + return_ACPI_STATUS(AE_NO_NAMESPACE); } /* Parameter Validation */ if (!info) { - return_ACPI_STATUS (AE_BAD_PARAMETER); + return_ACPI_STATUS(AE_BAD_PARAMETER); } /* Initialize the return value to an invalid object */ @@ -303,23 +282,25 @@ acpi_ns_evaluate_by_handle ( /* Get the prefix handle and Node */ - status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } - info->node = acpi_ns_map_handle_to_node (info->node); + info->node = acpi_ns_map_handle_to_node(info->node); if (!info->node) { - (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); - return_ACPI_STATUS (AE_BAD_PARAMETER); + (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); + return_ACPI_STATUS(AE_BAD_PARAMETER); } /* * For a method alias, we must grab the actual method node so that proper * scoping context will be established before execution. */ - if (acpi_ns_get_type (info->node) == ACPI_TYPE_LOCAL_METHOD_ALIAS) { - info->node = ACPI_CAST_PTR (struct acpi_namespace_node, info->node->object); + if (acpi_ns_get_type(info->node) == ACPI_TYPE_LOCAL_METHOD_ALIAS) { + info->node = + ACPI_CAST_PTR(struct acpi_namespace_node, + info->node->object); } /* @@ -329,17 +310,16 @@ acpi_ns_evaluate_by_handle ( * * In both cases, the namespace is unlocked by the acpi_ns* procedure */ - if (acpi_ns_get_type (info->node) == ACPI_TYPE_METHOD) { + if (acpi_ns_get_type(info->node) == ACPI_TYPE_METHOD) { /* * Case 1) We have an actual control method to execute */ - status = acpi_ns_execute_control_method (info); - } - else { + status = acpi_ns_execute_control_method(info); + } else { /* * Case 2) Object is NOT a method, just return its current value */ - status = acpi_ns_get_object_value (info); + status = acpi_ns_get_object_value(info); } /* @@ -355,10 +335,9 @@ acpi_ns_evaluate_by_handle ( * Namespace was unlocked by the handling acpi_ns* function, so we * just return */ - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_ns_execute_control_method @@ -384,30 +363,29 @@ acpi_ns_evaluate_by_handle ( ******************************************************************************/ static acpi_status -acpi_ns_execute_control_method ( - struct acpi_parameter_info *info) +acpi_ns_execute_control_method(struct acpi_parameter_info *info) { - acpi_status status; - - - ACPI_FUNCTION_TRACE ("ns_execute_control_method"); + acpi_status status; + ACPI_FUNCTION_TRACE("ns_execute_control_method"); /* Verify that there is a method associated with this object */ - info->obj_desc = acpi_ns_get_attached_object (info->node); + info->obj_desc = acpi_ns_get_attached_object(info->node); if (!info->obj_desc) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No attached method object\n")); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "No attached method object\n")); - (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); - return_ACPI_STATUS (AE_NULL_OBJECT); + (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); + return_ACPI_STATUS(AE_NULL_OBJECT); } - ACPI_DUMP_PATHNAME (info->node, "Execute Method:", - ACPI_LV_INFO, _COMPONENT); + ACPI_DUMP_PATHNAME(info->node, "Execute Method:", + ACPI_LV_INFO, _COMPONENT); - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Method at AML address %p Length %X\n", - info->obj_desc->method.aml_start + 1, info->obj_desc->method.aml_length - 1)); + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Method at AML address %p Length %X\n", + info->obj_desc->method.aml_start + 1, + info->obj_desc->method.aml_length - 1)); /* * Unlock the namespace before execution. This allows namespace access @@ -416,27 +394,26 @@ acpi_ns_execute_control_method ( * interpreter locks to ensure that no thread is using the portion of the * namespace that is being deleted. */ - status = acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* * Execute the method via the interpreter. The interpreter is locked * here before calling into the AML parser */ - status = acpi_ex_enter_interpreter (); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ex_enter_interpreter(); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } - status = acpi_ps_execute_method (info); - acpi_ex_exit_interpreter (); + status = acpi_ps_execute_method(info); + acpi_ex_exit_interpreter(); - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_ns_get_object_value @@ -454,16 +431,12 @@ acpi_ns_execute_control_method ( * ******************************************************************************/ -static acpi_status -acpi_ns_get_object_value ( - struct acpi_parameter_info *info) +static acpi_status acpi_ns_get_object_value(struct acpi_parameter_info *info) { - acpi_status status = AE_OK; - struct acpi_namespace_node *resolved_node = info->node; - - - ACPI_FUNCTION_TRACE ("ns_get_object_value"); + acpi_status status = AE_OK; + struct acpi_namespace_node *resolved_node = info->node; + ACPI_FUNCTION_TRACE("ns_get_object_value"); /* * Objects require additional resolution steps (e.g., the Node may be a @@ -486,32 +459,33 @@ acpi_ns_get_object_value ( * * We must release the namespace lock before entering the intepreter. */ - status = acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } - status = acpi_ex_enter_interpreter (); - if (ACPI_SUCCESS (status)) { - status = acpi_ex_resolve_node_to_value (&resolved_node, NULL); + status = acpi_ex_enter_interpreter(); + if (ACPI_SUCCESS(status)) { + status = acpi_ex_resolve_node_to_value(&resolved_node, NULL); /* * If acpi_ex_resolve_node_to_value() succeeded, the return value was placed * in resolved_node. */ - acpi_ex_exit_interpreter (); + acpi_ex_exit_interpreter(); - if (ACPI_SUCCESS (status)) { + if (ACPI_SUCCESS(status)) { status = AE_CTRL_RETURN_VALUE; info->return_object = ACPI_CAST_PTR - (union acpi_operand_object, resolved_node); - ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Returning object %p [%s]\n", - info->return_object, - acpi_ut_get_object_type_name (info->return_object))); + (union acpi_operand_object, resolved_node); + ACPI_DEBUG_PRINT((ACPI_DB_NAMES, + "Returning object %p [%s]\n", + info->return_object, + acpi_ut_get_object_type_name(info-> + return_object))); } } /* Namespace is unlocked */ - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - diff --git a/drivers/acpi/namespace/nsinit.c b/drivers/acpi/namespace/nsinit.c index 362802ae29a..0a08d2f04a0 100644 --- a/drivers/acpi/namespace/nsinit.c +++ b/drivers/acpi/namespace/nsinit.c @@ -41,31 +41,22 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include #include #include #include #define _COMPONENT ACPI_NAMESPACE - ACPI_MODULE_NAME ("nsinit") +ACPI_MODULE_NAME("nsinit") /* Local prototypes */ - static acpi_status -acpi_ns_init_one_object ( - acpi_handle obj_handle, - u32 level, - void *context, - void **return_value); +acpi_ns_init_one_object(acpi_handle obj_handle, + u32 level, void *context, void **return_value); static acpi_status -acpi_ns_init_one_device ( - acpi_handle obj_handle, - u32 nesting_level, - void *context, - void **return_value); - +acpi_ns_init_one_device(acpi_handle obj_handle, + u32 nesting_level, void *context, void **return_value); /******************************************************************************* * @@ -80,52 +71,48 @@ acpi_ns_init_one_device ( * ******************************************************************************/ -acpi_status -acpi_ns_initialize_objects ( - void) +acpi_status acpi_ns_initialize_objects(void) { - acpi_status status; - struct acpi_init_walk_info info; - + acpi_status status; + struct acpi_init_walk_info info; - ACPI_FUNCTION_TRACE ("ns_initialize_objects"); + ACPI_FUNCTION_TRACE("ns_initialize_objects"); - - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "**** Starting initialization of namespace objects ****\n")); - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, - "Completing Region/Field/Buffer/Package initialization:")); + ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, + "**** Starting initialization of namespace objects ****\n")); + ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, + "Completing Region/Field/Buffer/Package initialization:")); /* Set all init info to zero */ - ACPI_MEMSET (&info, 0, sizeof (struct acpi_init_walk_info)); + ACPI_MEMSET(&info, 0, sizeof(struct acpi_init_walk_info)); /* Walk entire namespace from the supplied root */ - status = acpi_walk_namespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, acpi_ns_init_one_object, - &info, NULL); - if (ACPI_FAILURE (status)) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "walk_namespace failed! %s\n", - acpi_format_exception (status))); + status = acpi_walk_namespace(ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, + ACPI_UINT32_MAX, acpi_ns_init_one_object, + &info, NULL); + if (ACPI_FAILURE(status)) { + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "walk_namespace failed! %s\n", + acpi_format_exception(status))); } - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, - "\nInitialized %hd/%hd Regions %hd/%hd Fields %hd/%hd Buffers %hd/%hd Packages (%hd nodes)\n", - info.op_region_init, info.op_region_count, - info.field_init, info.field_count, - info.buffer_init, info.buffer_count, - info.package_init, info.package_count, info.object_count)); + ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, + "\nInitialized %hd/%hd Regions %hd/%hd Fields %hd/%hd Buffers %hd/%hd Packages (%hd nodes)\n", + info.op_region_init, info.op_region_count, + info.field_init, info.field_count, + info.buffer_init, info.buffer_count, + info.package_init, info.package_count, + info.object_count)); - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "%hd Control Methods found\n", info.method_count)); - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "%hd Op Regions found\n", info.op_region_count)); + ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, + "%hd Control Methods found\n", info.method_count)); + ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, + "%hd Op Regions found\n", info.op_region_count)); - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_ns_initialize_devices @@ -142,16 +129,12 @@ acpi_ns_initialize_objects ( * ******************************************************************************/ -acpi_status -acpi_ns_initialize_devices ( - void) +acpi_status acpi_ns_initialize_devices(void) { - acpi_status status; - struct acpi_device_walk_info info; - - - ACPI_FUNCTION_TRACE ("ns_initialize_devices"); + acpi_status status; + struct acpi_device_walk_info info; + ACPI_FUNCTION_TRACE("ns_initialize_devices"); /* Init counters */ @@ -159,34 +142,34 @@ acpi_ns_initialize_devices ( info.num_STA = 0; info.num_INI = 0; - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, - "Executing all Device _STA and_INI methods:")); + ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, + "Executing all Device _STA and_INI methods:")); - status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* Walk namespace for all objects */ - status = acpi_ns_walk_namespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, TRUE, acpi_ns_init_one_device, &info, NULL); + status = acpi_ns_walk_namespace(ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, + ACPI_UINT32_MAX, TRUE, + acpi_ns_init_one_device, &info, NULL); - (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); + (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (status)) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "walk_namespace failed! %s\n", - acpi_format_exception (status))); + if (ACPI_FAILURE(status)) { + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "walk_namespace failed! %s\n", + acpi_format_exception(status))); } - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, - "\n%hd Devices found containing: %hd _STA, %hd _INI methods\n", - info.device_count, info.num_STA, info.num_INI)); + ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, + "\n%hd Devices found containing: %hd _STA, %hd _INI methods\n", + info.device_count, info.num_STA, info.num_INI)); - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_ns_init_one_object @@ -208,28 +191,25 @@ acpi_ns_initialize_devices ( ******************************************************************************/ static acpi_status -acpi_ns_init_one_object ( - acpi_handle obj_handle, - u32 level, - void *context, - void **return_value) +acpi_ns_init_one_object(acpi_handle obj_handle, + u32 level, void *context, void **return_value) { - acpi_object_type type; - acpi_status status; - struct acpi_init_walk_info *info = (struct acpi_init_walk_info *) context; - struct acpi_namespace_node *node = (struct acpi_namespace_node *) obj_handle; - union acpi_operand_object *obj_desc; - - - ACPI_FUNCTION_NAME ("ns_init_one_object"); + acpi_object_type type; + acpi_status status; + struct acpi_init_walk_info *info = + (struct acpi_init_walk_info *)context; + struct acpi_namespace_node *node = + (struct acpi_namespace_node *)obj_handle; + union acpi_operand_object *obj_desc; + ACPI_FUNCTION_NAME("ns_init_one_object"); info->object_count++; /* And even then, we are only interested in a few object types */ - type = acpi_ns_get_type (obj_handle); - obj_desc = acpi_ns_get_attached_object (node); + type = acpi_ns_get_type(obj_handle); + obj_desc = acpi_ns_get_attached_object(node); if (!obj_desc) { return (AE_OK); } @@ -269,8 +249,8 @@ acpi_ns_init_one_object ( /* * Must lock the interpreter before executing AML code */ - status = acpi_ex_enter_interpreter (); - if (ACPI_FAILURE (status)) { + status = acpi_ex_enter_interpreter(); + if (ACPI_FAILURE(status)) { return (status); } @@ -282,25 +262,25 @@ acpi_ns_init_one_object ( case ACPI_TYPE_REGION: info->op_region_init++; - status = acpi_ds_get_region_arguments (obj_desc); + status = acpi_ds_get_region_arguments(obj_desc); break; case ACPI_TYPE_BUFFER_FIELD: info->field_init++; - status = acpi_ds_get_buffer_field_arguments (obj_desc); + status = acpi_ds_get_buffer_field_arguments(obj_desc); break; case ACPI_TYPE_BUFFER: info->buffer_init++; - status = acpi_ds_get_buffer_arguments (obj_desc); + status = acpi_ds_get_buffer_arguments(obj_desc); break; case ACPI_TYPE_PACKAGE: info->package_init++; - status = acpi_ds_get_package_arguments (obj_desc); + status = acpi_ds_get_package_arguments(obj_desc); break; default: @@ -308,12 +288,13 @@ acpi_ns_init_one_object ( break; } - if (ACPI_FAILURE (status)) { - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_ERROR, "\n")); - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Could not execute arguments for [%4.4s] (%s), %s\n", - acpi_ut_get_node_name (node), acpi_ut_get_type_name (type), - acpi_format_exception (status))); + if (ACPI_FAILURE(status)) { + ACPI_DEBUG_PRINT_RAW((ACPI_DB_ERROR, "\n")); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Could not execute arguments for [%4.4s] (%s), %s\n", + acpi_ut_get_node_name(node), + acpi_ut_get_type_name(type), + acpi_format_exception(status))); } /* @@ -321,18 +302,17 @@ acpi_ns_init_one_object ( * pathname */ if (!(acpi_dbg_level & ACPI_LV_INIT_NAMES)) { - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, ".")); + ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, ".")); } /* * We ignore errors from above, and always return OK, since we don't want * to abort the walk on any single error. */ - acpi_ex_exit_interpreter (); + acpi_ex_exit_interpreter(); return (AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_ns_init_one_device @@ -348,41 +328,37 @@ acpi_ns_init_one_object ( ******************************************************************************/ static acpi_status -acpi_ns_init_one_device ( - acpi_handle obj_handle, - u32 nesting_level, - void *context, - void **return_value) +acpi_ns_init_one_device(acpi_handle obj_handle, + u32 nesting_level, void *context, void **return_value) { - struct acpi_device_walk_info *info = (struct acpi_device_walk_info *) context; - struct acpi_parameter_info pinfo; - u32 flags; - acpi_status status; - - - ACPI_FUNCTION_TRACE ("ns_init_one_device"); + struct acpi_device_walk_info *info = + (struct acpi_device_walk_info *)context; + struct acpi_parameter_info pinfo; + u32 flags; + acpi_status status; + ACPI_FUNCTION_TRACE("ns_init_one_device"); pinfo.parameters = NULL; pinfo.parameter_type = ACPI_PARAM_ARGS; - pinfo.node = acpi_ns_map_handle_to_node (obj_handle); + pinfo.node = acpi_ns_map_handle_to_node(obj_handle); if (!pinfo.node) { - return_ACPI_STATUS (AE_BAD_PARAMETER); + return_ACPI_STATUS(AE_BAD_PARAMETER); } /* * We will run _STA/_INI on Devices, Processors and thermal_zones only */ - if ((pinfo.node->type != ACPI_TYPE_DEVICE) && - (pinfo.node->type != ACPI_TYPE_PROCESSOR) && - (pinfo.node->type != ACPI_TYPE_THERMAL)) { - return_ACPI_STATUS (AE_OK); + if ((pinfo.node->type != ACPI_TYPE_DEVICE) && + (pinfo.node->type != ACPI_TYPE_PROCESSOR) && + (pinfo.node->type != ACPI_TYPE_THERMAL)) { + return_ACPI_STATUS(AE_OK); } if ((acpi_dbg_level <= ACPI_LV_ALL_EXCEPTIONS) && - (!(acpi_dbg_level & ACPI_LV_INFO))) { - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, ".")); + (!(acpi_dbg_level & ACPI_LV_INFO))) { + ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, ".")); } info->device_count++; @@ -390,20 +366,20 @@ acpi_ns_init_one_device ( /* * Run _STA to determine if we can run _INI on the device. */ - ACPI_DEBUG_EXEC (acpi_ut_display_init_pathname (ACPI_TYPE_METHOD, - pinfo.node, METHOD_NAME__STA)); - status = acpi_ut_execute_STA (pinfo.node, &flags); + ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname(ACPI_TYPE_METHOD, + pinfo.node, + METHOD_NAME__STA)); + status = acpi_ut_execute_STA(pinfo.node, &flags); - if (ACPI_FAILURE (status)) { + if (ACPI_FAILURE(status)) { if (pinfo.node->type == ACPI_TYPE_DEVICE) { /* Ignore error and move on to next device */ - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } /* _STA is not required for Processor or thermal_zone objects */ - } - else { + } else { info->num_STA++; if (!(flags & 0x01)) { @@ -416,32 +392,34 @@ acpi_ns_init_one_device ( /* * The device is present. Run _INI. */ - ACPI_DEBUG_EXEC (acpi_ut_display_init_pathname (ACPI_TYPE_METHOD, - pinfo.node, METHOD_NAME__INI)); - status = acpi_ns_evaluate_relative (METHOD_NAME__INI, &pinfo); - if (ACPI_FAILURE (status)) { + ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname(ACPI_TYPE_METHOD, + pinfo.node, + METHOD_NAME__INI)); + status = acpi_ns_evaluate_relative(METHOD_NAME__INI, &pinfo); + if (ACPI_FAILURE(status)) { /* No _INI (AE_NOT_FOUND) means device requires no initialization */ if (status != AE_NOT_FOUND) { /* Ignore error and move on to next device */ #ifdef ACPI_DEBUG_OUTPUT - char *scope_name = acpi_ns_get_external_pathname (pinfo.node); + char *scope_name = + acpi_ns_get_external_pathname(pinfo.node); - ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "%s._INI failed: %s\n", - scope_name, acpi_format_exception (status))); + ACPI_DEBUG_PRINT((ACPI_DB_WARN, "%s._INI failed: %s\n", + scope_name, + acpi_format_exception(status))); - ACPI_MEM_FREE (scope_name); + ACPI_MEM_FREE(scope_name); #endif } status = AE_OK; - } - else { + } else { /* Delete any return object (especially if implicit_return is enabled) */ if (pinfo.return_object) { - acpi_ut_remove_reference (pinfo.return_object); + acpi_ut_remove_reference(pinfo.return_object); } /* Count of successful INIs */ @@ -452,8 +430,9 @@ acpi_ns_init_one_device ( if (acpi_gbl_init_handler) { /* External initialization handler is present, call it */ - status = acpi_gbl_init_handler (pinfo.node, ACPI_INIT_DEVICE_INI); + status = + acpi_gbl_init_handler(pinfo.node, ACPI_INIT_DEVICE_INI); } - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } diff --git a/drivers/acpi/namespace/nsload.c b/drivers/acpi/namespace/nsload.c index 1428a84a31e..c28849de465 100644 --- a/drivers/acpi/namespace/nsload.c +++ b/drivers/acpi/namespace/nsload.c @@ -41,32 +41,22 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include #include #include - #define _COMPONENT ACPI_NAMESPACE - ACPI_MODULE_NAME ("nsload") +ACPI_MODULE_NAME("nsload") /* Local prototypes */ - -static acpi_status -acpi_ns_load_table_by_type ( - acpi_table_type table_type); +static acpi_status acpi_ns_load_table_by_type(acpi_table_type table_type); #ifdef ACPI_FUTURE_IMPLEMENTATION -acpi_status -acpi_ns_unload_namespace ( - acpi_handle handle); +acpi_status acpi_ns_unload_namespace(acpi_handle handle); -static acpi_status -acpi_ns_delete_subtree ( - acpi_handle start_handle); +static acpi_status acpi_ns_delete_subtree(acpi_handle start_handle); #endif - #ifndef ACPI_NO_METHOD_EXECUTION /******************************************************************************* * @@ -82,40 +72,39 @@ acpi_ns_delete_subtree ( ******************************************************************************/ acpi_status -acpi_ns_load_table ( - struct acpi_table_desc *table_desc, - struct acpi_namespace_node *node) +acpi_ns_load_table(struct acpi_table_desc *table_desc, + struct acpi_namespace_node *node) { - acpi_status status; - - - ACPI_FUNCTION_TRACE ("ns_load_table"); + acpi_status status; + ACPI_FUNCTION_TRACE("ns_load_table"); /* Check if table contains valid AML (must be DSDT, PSDT, SSDT, etc.) */ - if (!(acpi_gbl_table_data[table_desc->type].flags & ACPI_TABLE_EXECUTABLE)) { + if (! + (acpi_gbl_table_data[table_desc->type]. + flags & ACPI_TABLE_EXECUTABLE)) { /* Just ignore this table */ - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } /* Check validity of the AML start and length */ if (!table_desc->aml_start) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null AML pointer\n")); - return_ACPI_STATUS (AE_BAD_PARAMETER); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Null AML pointer\n")); + return_ACPI_STATUS(AE_BAD_PARAMETER); } - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "AML block at %p\n", - table_desc->aml_start)); + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "AML block at %p\n", + table_desc->aml_start)); /* Ignore table if there is no AML contained within */ if (!table_desc->aml_length) { - ACPI_REPORT_WARNING (("Zero-length AML block in table [%4.4s]\n", - table_desc->pointer->signature)); - return_ACPI_STATUS (AE_OK); + ACPI_REPORT_WARNING(("Zero-length AML block in table [%4.4s]\n", + table_desc->pointer->signature)); + return_ACPI_STATUS(AE_OK); } /* @@ -127,19 +116,19 @@ acpi_ns_load_table ( * to another control method, we can't continue parsing * because we don't know how many arguments to parse next! */ - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "**** Loading table into namespace ****\n")); + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "**** Loading table into namespace ****\n")); - status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } - status = acpi_ns_parse_table (table_desc, node->child); - (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); + status = acpi_ns_parse_table(table_desc, node->child); + (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* @@ -148,18 +137,17 @@ acpi_ns_load_table ( * just-in-time parsing, we delete the control method * parse trees. */ - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "**** Begin Table Method Parsing and Object Initialization ****\n")); + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "**** Begin Table Method Parsing and Object Initialization ****\n")); - status = acpi_ds_initialize_objects (table_desc, node); + status = acpi_ds_initialize_objects(table_desc, node); - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "**** Completed Table Method Parsing and Object Initialization ****\n")); + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "**** Completed Table Method Parsing and Object Initialization ****\n")); - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_ns_load_table_by_type @@ -174,21 +162,17 @@ acpi_ns_load_table ( * ******************************************************************************/ -static acpi_status -acpi_ns_load_table_by_type ( - acpi_table_type table_type) +static acpi_status acpi_ns_load_table_by_type(acpi_table_type table_type) { - u32 i; - acpi_status status; - struct acpi_table_desc *table_desc; - - - ACPI_FUNCTION_TRACE ("ns_load_table_by_type"); + u32 i; + acpi_status status; + struct acpi_table_desc *table_desc; + ACPI_FUNCTION_TRACE("ns_load_table_by_type"); - status = acpi_ut_acquire_mutex (ACPI_MTX_TABLES); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ut_acquire_mutex(ACPI_MTX_TABLES); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* @@ -198,7 +182,7 @@ acpi_ns_load_table_by_type ( switch (table_type) { case ACPI_TABLE_DSDT: - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Namespace load: DSDT\n")); + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Namespace load: DSDT\n")); table_desc = acpi_gbl_table_lists[ACPI_TABLE_DSDT].next; @@ -210,18 +194,18 @@ acpi_ns_load_table_by_type ( /* Now load the single DSDT */ - status = acpi_ns_load_table (table_desc, acpi_gbl_root_node); - if (ACPI_SUCCESS (status)) { + status = acpi_ns_load_table(table_desc, acpi_gbl_root_node); + if (ACPI_SUCCESS(status)) { table_desc->loaded_into_namespace = TRUE; } break; - case ACPI_TABLE_SSDT: case ACPI_TABLE_PSDT: - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Namespace load: %d SSDT or PSDTs\n", - acpi_gbl_table_lists[table_type].count)); + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "Namespace load: %d SSDT or PSDTs\n", + acpi_gbl_table_lists[table_type].count)); /* * Traverse list of SSDT or PSDT tables @@ -233,8 +217,10 @@ acpi_ns_load_table_by_type ( * already loaded! */ if (!table_desc->loaded_into_namespace) { - status = acpi_ns_load_table (table_desc, acpi_gbl_root_node); - if (ACPI_FAILURE (status)) { + status = + acpi_ns_load_table(table_desc, + acpi_gbl_root_node); + if (ACPI_FAILURE(status)) { break; } @@ -245,19 +231,16 @@ acpi_ns_load_table_by_type ( } break; - default: status = AE_SUPPORT; break; } - -unlock_and_exit: - (void) acpi_ut_release_mutex (ACPI_MTX_TABLES); - return_ACPI_STATUS (status); + unlock_and_exit: + (void)acpi_ut_release_mutex(ACPI_MTX_TABLES); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_load_namespace @@ -271,45 +254,40 @@ unlock_and_exit: * ******************************************************************************/ -acpi_status -acpi_ns_load_namespace ( - void) +acpi_status acpi_ns_load_namespace(void) { - acpi_status status; - - - ACPI_FUNCTION_TRACE ("acpi_load_name_space"); + acpi_status status; + ACPI_FUNCTION_TRACE("acpi_load_name_space"); /* There must be at least a DSDT installed */ if (acpi_gbl_DSDT == NULL) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "DSDT is not in memory\n")); - return_ACPI_STATUS (AE_NO_ACPI_TABLES); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "DSDT is not in memory\n")); + return_ACPI_STATUS(AE_NO_ACPI_TABLES); } /* * Load the namespace. The DSDT is required, * but the SSDT and PSDT tables are optional. */ - status = acpi_ns_load_table_by_type (ACPI_TABLE_DSDT); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ns_load_table_by_type(ACPI_TABLE_DSDT); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* Ignore exceptions from these */ - (void) acpi_ns_load_table_by_type (ACPI_TABLE_SSDT); - (void) acpi_ns_load_table_by_type (ACPI_TABLE_PSDT); + (void)acpi_ns_load_table_by_type(ACPI_TABLE_SSDT); + (void)acpi_ns_load_table_by_type(ACPI_TABLE_PSDT); - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, - "ACPI Namespace successfully loaded at root %p\n", - acpi_gbl_root_node)); + ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, + "ACPI Namespace successfully loaded at root %p\n", + acpi_gbl_root_node)); - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - #ifdef ACPI_FUTURE_IMPLEMENTATION /******************************************************************************* * @@ -327,24 +305,20 @@ acpi_ns_load_namespace ( * ******************************************************************************/ -static acpi_status -acpi_ns_delete_subtree ( - acpi_handle start_handle) +static acpi_status acpi_ns_delete_subtree(acpi_handle start_handle) { - acpi_status status; - acpi_handle child_handle; - acpi_handle parent_handle; - acpi_handle next_child_handle; - acpi_handle dummy; - u32 level; - - - ACPI_FUNCTION_TRACE ("ns_delete_subtree"); + acpi_status status; + acpi_handle child_handle; + acpi_handle parent_handle; + acpi_handle next_child_handle; + acpi_handle dummy; + u32 level; + ACPI_FUNCTION_TRACE("ns_delete_subtree"); parent_handle = start_handle; child_handle = NULL; - level = 1; + level = 1; /* * Traverse the tree of objects until we bubble back up @@ -353,18 +327,19 @@ acpi_ns_delete_subtree ( while (level > 0) { /* Attempt to get the next object in this scope */ - status = acpi_get_next_object (ACPI_TYPE_ANY, parent_handle, - child_handle, &next_child_handle); + status = acpi_get_next_object(ACPI_TYPE_ANY, parent_handle, + child_handle, &next_child_handle); child_handle = next_child_handle; /* Did we get a new object? */ - if (ACPI_SUCCESS (status)) { + if (ACPI_SUCCESS(status)) { /* Check if this object has any children */ - if (ACPI_SUCCESS (acpi_get_next_object (ACPI_TYPE_ANY, child_handle, - NULL, &dummy))) { + if (ACPI_SUCCESS + (acpi_get_next_object + (ACPI_TYPE_ANY, child_handle, NULL, &dummy))) { /* * There is at least one child of this object, * visit the object @@ -373,8 +348,7 @@ acpi_ns_delete_subtree ( parent_handle = child_handle; child_handle = NULL; } - } - else { + } else { /* * No more children in this object, go back up to * the object's parent @@ -383,24 +357,23 @@ acpi_ns_delete_subtree ( /* Delete all children now */ - acpi_ns_delete_children (child_handle); + acpi_ns_delete_children(child_handle); child_handle = parent_handle; - status = acpi_get_parent (parent_handle, &parent_handle); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_get_parent(parent_handle, &parent_handle); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } } } /* Now delete the starting object, and we are done */ - acpi_ns_delete_node (child_handle); + acpi_ns_delete_node(child_handle); - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_ns_unload_name_space @@ -415,32 +388,27 @@ acpi_ns_delete_subtree ( * ******************************************************************************/ -acpi_status -acpi_ns_unload_namespace ( - acpi_handle handle) +acpi_status acpi_ns_unload_namespace(acpi_handle handle) { - acpi_status status; - - - ACPI_FUNCTION_TRACE ("ns_unload_name_space"); + acpi_status status; + ACPI_FUNCTION_TRACE("ns_unload_name_space"); /* Parameter validation */ if (!acpi_gbl_root_node) { - return_ACPI_STATUS (AE_NO_NAMESPACE); + return_ACPI_STATUS(AE_NO_NAMESPACE); } if (!handle) { - return_ACPI_STATUS (AE_BAD_PARAMETER); + return_ACPI_STATUS(AE_BAD_PARAMETER); } /* This function does the real work */ - status = acpi_ns_delete_subtree (handle); + status = acpi_ns_delete_subtree(handle); - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } #endif #endif - diff --git a/drivers/acpi/namespace/nsnames.c b/drivers/acpi/namespace/nsnames.c index d8ce7e39795..d5e8dea61c2 100644 --- a/drivers/acpi/namespace/nsnames.c +++ b/drivers/acpi/namespace/nsnames.c @@ -41,23 +41,17 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include #include #include - #define _COMPONENT ACPI_NAMESPACE - ACPI_MODULE_NAME ("nsnames") +ACPI_MODULE_NAME("nsnames") /* Local prototypes */ - static void -acpi_ns_build_external_path ( - struct acpi_namespace_node *node, - acpi_size size, - char *name_buffer); - +acpi_ns_build_external_path(struct acpi_namespace_node *node, + acpi_size size, char *name_buffer); /******************************************************************************* * @@ -75,17 +69,13 @@ acpi_ns_build_external_path ( ******************************************************************************/ static void -acpi_ns_build_external_path ( - struct acpi_namespace_node *node, - acpi_size size, - char *name_buffer) +acpi_ns_build_external_path(struct acpi_namespace_node *node, + acpi_size size, char *name_buffer) { - acpi_size index; - struct acpi_namespace_node *parent_node; - - - ACPI_FUNCTION_NAME ("ns_build_external_path"); + acpi_size index; + struct acpi_namespace_node *parent_node; + ACPI_FUNCTION_NAME("ns_build_external_path"); /* Special case for root */ @@ -106,8 +96,8 @@ acpi_ns_build_external_path ( /* Put the name into the buffer */ - ACPI_MOVE_32_TO_32 ((name_buffer + index), &parent_node->name); - parent_node = acpi_ns_get_parent_node (parent_node); + ACPI_MOVE_32_TO_32((name_buffer + index), &parent_node->name); + parent_node = acpi_ns_get_parent_node(parent_node); /* Prefix name with the path separator */ @@ -120,15 +110,14 @@ acpi_ns_build_external_path ( name_buffer[index] = AML_ROOT_PREFIX; if (index != 0) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Could not construct pathname; index=%X, size=%X, Path=%s\n", - (u32) index, (u32) size, &name_buffer[size])); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Could not construct pathname; index=%X, size=%X, Path=%s\n", + (u32) index, (u32) size, &name_buffer[size])); } return; } - #ifdef ACPI_DEBUG_OUTPUT /******************************************************************************* * @@ -144,37 +133,32 @@ acpi_ns_build_external_path ( * ******************************************************************************/ -char * -acpi_ns_get_external_pathname ( - struct acpi_namespace_node *node) +char *acpi_ns_get_external_pathname(struct acpi_namespace_node *node) { - char *name_buffer; - acpi_size size; - - - ACPI_FUNCTION_TRACE_PTR ("ns_get_external_pathname", node); + char *name_buffer; + acpi_size size; + ACPI_FUNCTION_TRACE_PTR("ns_get_external_pathname", node); /* Calculate required buffer size based on depth below root */ - size = acpi_ns_get_pathname_length (node); + size = acpi_ns_get_pathname_length(node); /* Allocate a buffer to be returned to caller */ - name_buffer = ACPI_MEM_CALLOCATE (size); + name_buffer = ACPI_MEM_CALLOCATE(size); if (!name_buffer) { - ACPI_REPORT_ERROR (("ns_get_table_pathname: allocation failure\n")); - return_PTR (NULL); + ACPI_REPORT_ERROR(("ns_get_table_pathname: allocation failure\n")); + return_PTR(NULL); } /* Build the path in the allocated buffer */ - acpi_ns_build_external_path (node, size, name_buffer); - return_PTR (name_buffer); + acpi_ns_build_external_path(node, size, name_buffer); + return_PTR(name_buffer); } #endif - /******************************************************************************* * * FUNCTION: acpi_ns_get_pathname_length @@ -187,16 +171,12 @@ acpi_ns_get_external_pathname ( * ******************************************************************************/ -acpi_size -acpi_ns_get_pathname_length ( - struct acpi_namespace_node *node) +acpi_size acpi_ns_get_pathname_length(struct acpi_namespace_node *node) { - acpi_size size; - struct acpi_namespace_node *next_node; - - - ACPI_FUNCTION_ENTRY (); + acpi_size size; + struct acpi_namespace_node *next_node; + ACPI_FUNCTION_ENTRY(); /* * Compute length of pathname as 5 * number of name segments. @@ -207,17 +187,16 @@ acpi_ns_get_pathname_length ( while (next_node && (next_node != acpi_gbl_root_node)) { size += ACPI_PATH_SEGMENT_LENGTH; - next_node = acpi_ns_get_parent_node (next_node); + next_node = acpi_ns_get_parent_node(next_node); } if (!size) { - size = 1; /* Root node case */ + size = 1; /* Root node case */ } - return (size + 1); /* +1 for null string terminator */ + return (size + 1); /* +1 for null string terminator */ } - /******************************************************************************* * * FUNCTION: acpi_ns_handle_to_pathname @@ -233,41 +212,36 @@ acpi_ns_get_pathname_length ( ******************************************************************************/ acpi_status -acpi_ns_handle_to_pathname ( - acpi_handle target_handle, - struct acpi_buffer *buffer) +acpi_ns_handle_to_pathname(acpi_handle target_handle, + struct acpi_buffer * buffer) { - acpi_status status; - struct acpi_namespace_node *node; - acpi_size required_size; + acpi_status status; + struct acpi_namespace_node *node; + acpi_size required_size; + ACPI_FUNCTION_TRACE_PTR("ns_handle_to_pathname", target_handle); - ACPI_FUNCTION_TRACE_PTR ("ns_handle_to_pathname", target_handle); - - - node = acpi_ns_map_handle_to_node (target_handle); + node = acpi_ns_map_handle_to_node(target_handle); if (!node) { - return_ACPI_STATUS (AE_BAD_PARAMETER); + return_ACPI_STATUS(AE_BAD_PARAMETER); } /* Determine size required for the caller buffer */ - required_size = acpi_ns_get_pathname_length (node); + required_size = acpi_ns_get_pathname_length(node); /* Validate/Allocate/Clear caller buffer */ - status = acpi_ut_initialize_buffer (buffer, required_size); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ut_initialize_buffer(buffer, required_size); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* Build the path in the caller buffer */ - acpi_ns_build_external_path (node, required_size, buffer->pointer); + acpi_ns_build_external_path(node, required_size, buffer->pointer); - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%s [%X] \n", - (char *) buffer->pointer, (u32) required_size)); - return_ACPI_STATUS (AE_OK); + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "%s [%X] \n", + (char *)buffer->pointer, (u32) required_size)); + return_ACPI_STATUS(AE_OK); } - - diff --git a/drivers/acpi/namespace/nsobject.c b/drivers/acpi/namespace/nsobject.c index 27258c1ca4f..fc9be946ebe 100644 --- a/drivers/acpi/namespace/nsobject.c +++ b/drivers/acpi/namespace/nsobject.c @@ -42,14 +42,11 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include #include - #define _COMPONENT ACPI_NAMESPACE - ACPI_MODULE_NAME ("nsobject") - +ACPI_MODULE_NAME("nsobject") /******************************************************************************* * @@ -71,20 +68,15 @@ * MUTEX: Assumes namespace is locked * ******************************************************************************/ - acpi_status -acpi_ns_attach_object ( - struct acpi_namespace_node *node, - union acpi_operand_object *object, - acpi_object_type type) +acpi_ns_attach_object(struct acpi_namespace_node *node, + union acpi_operand_object *object, acpi_object_type type) { - union acpi_operand_object *obj_desc; - union acpi_operand_object *last_obj_desc; - acpi_object_type object_type = ACPI_TYPE_ANY; - - - ACPI_FUNCTION_TRACE ("ns_attach_object"); + union acpi_operand_object *obj_desc; + union acpi_operand_object *last_obj_desc; + acpi_object_type object_type = ACPI_TYPE_ANY; + ACPI_FUNCTION_TRACE("ns_attach_object"); /* * Parameter validation @@ -92,40 +84,39 @@ acpi_ns_attach_object ( if (!node) { /* Invalid handle */ - ACPI_REPORT_ERROR (("ns_attach_object: Null named_obj handle\n")); - return_ACPI_STATUS (AE_BAD_PARAMETER); + ACPI_REPORT_ERROR(("ns_attach_object: Null named_obj handle\n")); + return_ACPI_STATUS(AE_BAD_PARAMETER); } if (!object && (ACPI_TYPE_ANY != type)) { /* Null object */ - ACPI_REPORT_ERROR (( - "ns_attach_object: Null object, but type not ACPI_TYPE_ANY\n")); - return_ACPI_STATUS (AE_BAD_PARAMETER); + ACPI_REPORT_ERROR(("ns_attach_object: Null object, but type not ACPI_TYPE_ANY\n")); + return_ACPI_STATUS(AE_BAD_PARAMETER); } - if (ACPI_GET_DESCRIPTOR_TYPE (node) != ACPI_DESC_TYPE_NAMED) { + if (ACPI_GET_DESCRIPTOR_TYPE(node) != ACPI_DESC_TYPE_NAMED) { /* Not a name handle */ - ACPI_REPORT_ERROR (("ns_attach_object: Invalid handle %p [%s]\n", - node, acpi_ut_get_descriptor_name (node))); - return_ACPI_STATUS (AE_BAD_PARAMETER); + ACPI_REPORT_ERROR(("ns_attach_object: Invalid handle %p [%s]\n", + node, acpi_ut_get_descriptor_name(node))); + return_ACPI_STATUS(AE_BAD_PARAMETER); } /* Check if this object is already attached */ if (node->object == object) { - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "Obj %p already installed in name_obj %p\n", - object, node)); + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, + "Obj %p already installed in name_obj %p\n", + object, node)); - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } /* If null object, we will just install it */ if (!object) { - obj_desc = NULL; + obj_desc = NULL; object_type = ACPI_TYPE_ANY; } @@ -133,14 +124,14 @@ acpi_ns_attach_object ( * If the source object is a namespace Node with an attached object, * we will use that (attached) object */ - else if ((ACPI_GET_DESCRIPTOR_TYPE (object) == ACPI_DESC_TYPE_NAMED) && - ((struct acpi_namespace_node *) object)->object) { + else if ((ACPI_GET_DESCRIPTOR_TYPE(object) == ACPI_DESC_TYPE_NAMED) && + ((struct acpi_namespace_node *)object)->object) { /* * Value passed is a name handle and that name has a * non-null value. Use that name's value and type. */ - obj_desc = ((struct acpi_namespace_node *) object)->object; - object_type = ((struct acpi_namespace_node *) object)->type; + obj_desc = ((struct acpi_namespace_node *)object)->object; + object_type = ((struct acpi_namespace_node *)object)->type; } /* @@ -148,20 +139,20 @@ acpi_ns_attach_object ( * it first */ else { - obj_desc = (union acpi_operand_object *) object; + obj_desc = (union acpi_operand_object *)object; /* Use the given type */ object_type = type; } - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Installing %p into Node %p [%4.4s]\n", - obj_desc, node, acpi_ut_get_node_name (node))); + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Installing %p into Node %p [%4.4s]\n", + obj_desc, node, acpi_ut_get_node_name(node))); /* Detach an existing attached object if present */ if (node->object) { - acpi_ns_detach_object (node); + acpi_ns_detach_object(node); } if (obj_desc) { @@ -169,7 +160,7 @@ acpi_ns_attach_object ( * Must increment the new value's reference count * (if it is an internal object) */ - acpi_ut_add_reference (obj_desc); + acpi_ut_add_reference(obj_desc); /* * Handle objects with multiple descriptors - walk @@ -185,13 +176,12 @@ acpi_ns_attach_object ( last_obj_desc->common.next_object = node->object; } - node->type = (u8) object_type; - node->object = obj_desc; + node->type = (u8) object_type; + node->object = obj_desc; - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_ns_detach_object @@ -206,30 +196,27 @@ acpi_ns_attach_object ( * ******************************************************************************/ -void -acpi_ns_detach_object ( - struct acpi_namespace_node *node) +void acpi_ns_detach_object(struct acpi_namespace_node *node) { - union acpi_operand_object *obj_desc; - - - ACPI_FUNCTION_TRACE ("ns_detach_object"); + union acpi_operand_object *obj_desc; + ACPI_FUNCTION_TRACE("ns_detach_object"); obj_desc = node->object; if (!obj_desc || - (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_LOCAL_DATA)) { + (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_LOCAL_DATA)) { return_VOID; } /* Clear the entry in all cases */ node->object = NULL; - if (ACPI_GET_DESCRIPTOR_TYPE (obj_desc) == ACPI_DESC_TYPE_OPERAND) { + if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) == ACPI_DESC_TYPE_OPERAND) { node->object = obj_desc->common.next_object; if (node->object && - (ACPI_GET_OBJECT_TYPE (node->object) != ACPI_TYPE_LOCAL_DATA)) { + (ACPI_GET_OBJECT_TYPE(node->object) != + ACPI_TYPE_LOCAL_DATA)) { node->object = node->object->common.next_object; } } @@ -238,16 +225,15 @@ acpi_ns_detach_object ( node->type = ACPI_TYPE_ANY; - ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Node %p [%4.4s] Object %p\n", - node, acpi_ut_get_node_name (node), obj_desc)); + ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "Node %p [%4.4s] Object %p\n", + node, acpi_ut_get_node_name(node), obj_desc)); /* Remove one reference on the object (and all subobjects) */ - acpi_ut_remove_reference (obj_desc); + acpi_ut_remove_reference(obj_desc); return_VOID; } - /******************************************************************************* * * FUNCTION: acpi_ns_get_attached_object @@ -261,29 +247,28 @@ acpi_ns_detach_object ( * ******************************************************************************/ -union acpi_operand_object * -acpi_ns_get_attached_object ( - struct acpi_namespace_node *node) +union acpi_operand_object *acpi_ns_get_attached_object(struct + acpi_namespace_node + *node) { - ACPI_FUNCTION_TRACE_PTR ("ns_get_attached_object", node); - + ACPI_FUNCTION_TRACE_PTR("ns_get_attached_object", node); if (!node) { - ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Null Node ptr\n")); - return_PTR (NULL); + ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Null Node ptr\n")); + return_PTR(NULL); } if (!node->object || - ((ACPI_GET_DESCRIPTOR_TYPE (node->object) != ACPI_DESC_TYPE_OPERAND) && - (ACPI_GET_DESCRIPTOR_TYPE (node->object) != ACPI_DESC_TYPE_NAMED)) || - (ACPI_GET_OBJECT_TYPE (node->object) == ACPI_TYPE_LOCAL_DATA)) { - return_PTR (NULL); + ((ACPI_GET_DESCRIPTOR_TYPE(node->object) != ACPI_DESC_TYPE_OPERAND) + && (ACPI_GET_DESCRIPTOR_TYPE(node->object) != + ACPI_DESC_TYPE_NAMED)) + || (ACPI_GET_OBJECT_TYPE(node->object) == ACPI_TYPE_LOCAL_DATA)) { + return_PTR(NULL); } - return_PTR (node->object); + return_PTR(node->object); } - /******************************************************************************* * * FUNCTION: acpi_ns_get_secondary_object @@ -297,24 +282,23 @@ acpi_ns_get_attached_object ( * ******************************************************************************/ -union acpi_operand_object * -acpi_ns_get_secondary_object ( - union acpi_operand_object *obj_desc) +union acpi_operand_object *acpi_ns_get_secondary_object(union + acpi_operand_object + *obj_desc) { - ACPI_FUNCTION_TRACE_PTR ("ns_get_secondary_object", obj_desc); - - - if ((!obj_desc) || - (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_LOCAL_DATA) || - (!obj_desc->common.next_object) || - (ACPI_GET_OBJECT_TYPE (obj_desc->common.next_object) == ACPI_TYPE_LOCAL_DATA)) { - return_PTR (NULL); + ACPI_FUNCTION_TRACE_PTR("ns_get_secondary_object", obj_desc); + + if ((!obj_desc) || + (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_LOCAL_DATA) || + (!obj_desc->common.next_object) || + (ACPI_GET_OBJECT_TYPE(obj_desc->common.next_object) == + ACPI_TYPE_LOCAL_DATA)) { + return_PTR(NULL); } - return_PTR (obj_desc->common.next_object); + return_PTR(obj_desc->common.next_object); } - /******************************************************************************* * * FUNCTION: acpi_ns_attach_data @@ -330,23 +314,20 @@ acpi_ns_get_secondary_object ( ******************************************************************************/ acpi_status -acpi_ns_attach_data ( - struct acpi_namespace_node *node, - acpi_object_handler handler, - void *data) +acpi_ns_attach_data(struct acpi_namespace_node *node, + acpi_object_handler handler, void *data) { - union acpi_operand_object *prev_obj_desc; - union acpi_operand_object *obj_desc; - union acpi_operand_object *data_desc; - + union acpi_operand_object *prev_obj_desc; + union acpi_operand_object *obj_desc; + union acpi_operand_object *data_desc; /* We only allow one attachment per handler */ prev_obj_desc = NULL; obj_desc = node->object; while (obj_desc) { - if ((ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_LOCAL_DATA) && - (obj_desc->data.handler == handler)) { + if ((ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_LOCAL_DATA) && + (obj_desc->data.handler == handler)) { return (AE_ALREADY_EXISTS); } @@ -356,7 +337,7 @@ acpi_ns_attach_data ( /* Create an internal object for the data */ - data_desc = acpi_ut_create_internal_object (ACPI_TYPE_LOCAL_DATA); + data_desc = acpi_ut_create_internal_object(ACPI_TYPE_LOCAL_DATA); if (!data_desc) { return (AE_NO_MEMORY); } @@ -368,15 +349,13 @@ acpi_ns_attach_data ( if (prev_obj_desc) { prev_obj_desc->common.next_object = data_desc; - } - else { + } else { node->object = data_desc; } return (AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_ns_detach_data @@ -392,27 +371,25 @@ acpi_ns_attach_data ( ******************************************************************************/ acpi_status -acpi_ns_detach_data ( - struct acpi_namespace_node *node, - acpi_object_handler handler) +acpi_ns_detach_data(struct acpi_namespace_node * node, + acpi_object_handler handler) { - union acpi_operand_object *obj_desc; - union acpi_operand_object *prev_obj_desc; - + union acpi_operand_object *obj_desc; + union acpi_operand_object *prev_obj_desc; prev_obj_desc = NULL; obj_desc = node->object; while (obj_desc) { - if ((ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_LOCAL_DATA) && - (obj_desc->data.handler == handler)) { + if ((ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_LOCAL_DATA) && + (obj_desc->data.handler == handler)) { if (prev_obj_desc) { - prev_obj_desc->common.next_object = obj_desc->common.next_object; - } - else { + prev_obj_desc->common.next_object = + obj_desc->common.next_object; + } else { node->object = obj_desc->common.next_object; } - acpi_ut_remove_reference (obj_desc); + acpi_ut_remove_reference(obj_desc); return (AE_OK); } @@ -423,7 +400,6 @@ acpi_ns_detach_data ( return (AE_NOT_FOUND); } - /******************************************************************************* * * FUNCTION: acpi_ns_get_attached_data @@ -440,18 +416,15 @@ acpi_ns_detach_data ( ******************************************************************************/ acpi_status -acpi_ns_get_attached_data ( - struct acpi_namespace_node *node, - acpi_object_handler handler, - void **data) +acpi_ns_get_attached_data(struct acpi_namespace_node * node, + acpi_object_handler handler, void **data) { - union acpi_operand_object *obj_desc; - + union acpi_operand_object *obj_desc; obj_desc = node->object; while (obj_desc) { - if ((ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_LOCAL_DATA) && - (obj_desc->data.handler == handler)) { + if ((ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_LOCAL_DATA) && + (obj_desc->data.handler == handler)) { *data = obj_desc->data.pointer; return (AE_OK); } @@ -461,5 +434,3 @@ acpi_ns_get_attached_data ( return (AE_NOT_FOUND); } - - diff --git a/drivers/acpi/namespace/nsparse.c b/drivers/acpi/namespace/nsparse.c index 24bed931d39..433442a9ec7 100644 --- a/drivers/acpi/namespace/nsparse.c +++ b/drivers/acpi/namespace/nsparse.c @@ -41,16 +41,13 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include #include #include #include - #define _COMPONENT ACPI_NAMESPACE - ACPI_MODULE_NAME ("nsparse") - +ACPI_MODULE_NAME("nsparse") /******************************************************************************* * @@ -64,54 +61,50 @@ * DESCRIPTION: Perform one complete parse of an ACPI/AML table. * ******************************************************************************/ - acpi_status -acpi_ns_one_complete_parse ( - u8 pass_number, - struct acpi_table_desc *table_desc) +acpi_ns_one_complete_parse(u8 pass_number, struct acpi_table_desc * table_desc) { - union acpi_parse_object *parse_root; - acpi_status status; - struct acpi_walk_state *walk_state; - - - ACPI_FUNCTION_TRACE ("ns_one_complete_parse"); + union acpi_parse_object *parse_root; + acpi_status status; + struct acpi_walk_state *walk_state; + ACPI_FUNCTION_TRACE("ns_one_complete_parse"); /* Create and init a Root Node */ - parse_root = acpi_ps_create_scope_op (); + parse_root = acpi_ps_create_scope_op(); if (!parse_root) { - return_ACPI_STATUS (AE_NO_MEMORY); + return_ACPI_STATUS(AE_NO_MEMORY); } /* Create and initialize a new walk state */ - walk_state = acpi_ds_create_walk_state (table_desc->owner_id, - NULL, NULL, NULL); + walk_state = acpi_ds_create_walk_state(table_desc->owner_id, + NULL, NULL, NULL); if (!walk_state) { - acpi_ps_free_op (parse_root); - return_ACPI_STATUS (AE_NO_MEMORY); + acpi_ps_free_op(parse_root); + return_ACPI_STATUS(AE_NO_MEMORY); } - status = acpi_ds_init_aml_walk (walk_state, parse_root, NULL, - table_desc->aml_start, table_desc->aml_length, - NULL, pass_number); - if (ACPI_FAILURE (status)) { - acpi_ds_delete_walk_state (walk_state); - return_ACPI_STATUS (status); + status = acpi_ds_init_aml_walk(walk_state, parse_root, NULL, + table_desc->aml_start, + table_desc->aml_length, NULL, + pass_number); + if (ACPI_FAILURE(status)) { + acpi_ds_delete_walk_state(walk_state); + return_ACPI_STATUS(status); } /* Parse the AML */ - ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "*PARSE* pass %d parse\n", pass_number)); - status = acpi_ps_parse_aml (walk_state); + ACPI_DEBUG_PRINT((ACPI_DB_PARSE, "*PARSE* pass %d parse\n", + pass_number)); + status = acpi_ps_parse_aml(walk_state); - acpi_ps_delete_parse_tree (parse_root); - return_ACPI_STATUS (status); + acpi_ps_delete_parse_tree(parse_root); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_ns_parse_table @@ -126,15 +119,12 @@ acpi_ns_one_complete_parse ( ******************************************************************************/ acpi_status -acpi_ns_parse_table ( - struct acpi_table_desc *table_desc, - struct acpi_namespace_node *start_node) +acpi_ns_parse_table(struct acpi_table_desc *table_desc, + struct acpi_namespace_node *start_node) { - acpi_status status; - - - ACPI_FUNCTION_TRACE ("ns_parse_table"); + acpi_status status; + ACPI_FUNCTION_TRACE("ns_parse_table"); /* * AML Parse, pass 1 @@ -146,10 +136,10 @@ acpi_ns_parse_table ( * to service the entire parse. The second pass of the parse then * performs another complete parse of the AML.. */ - ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "**** Start pass 1\n")); - status = acpi_ns_one_complete_parse (1, table_desc); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + ACPI_DEBUG_PRINT((ACPI_DB_PARSE, "**** Start pass 1\n")); + status = acpi_ns_one_complete_parse(1, table_desc); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* @@ -161,13 +151,11 @@ acpi_ns_parse_table ( * overhead of this is compensated for by the fact that the * parse objects are all cached. */ - ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "**** Start pass 2\n")); - status = acpi_ns_one_complete_parse (2, table_desc); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + ACPI_DEBUG_PRINT((ACPI_DB_PARSE, "**** Start pass 2\n")); + status = acpi_ns_one_complete_parse(2, table_desc); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - - diff --git a/drivers/acpi/namespace/nssearch.c b/drivers/acpi/namespace/nssearch.c index af8aaa9cc4f..50a3ca5470e 100644 --- a/drivers/acpi/namespace/nssearch.c +++ b/drivers/acpi/namespace/nssearch.c @@ -41,23 +41,18 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include #include - #define _COMPONENT ACPI_NAMESPACE - ACPI_MODULE_NAME ("nssearch") +ACPI_MODULE_NAME("nssearch") /* Local prototypes */ - static acpi_status -acpi_ns_search_parent_tree ( - u32 target_name, - struct acpi_namespace_node *node, - acpi_object_type type, - struct acpi_namespace_node **return_node); - +acpi_ns_search_parent_tree(u32 target_name, + struct acpi_namespace_node *node, + acpi_object_type type, + struct acpi_namespace_node **return_node); /******************************************************************************* * @@ -87,30 +82,28 @@ acpi_ns_search_parent_tree ( ******************************************************************************/ acpi_status -acpi_ns_search_node ( - u32 target_name, - struct acpi_namespace_node *node, - acpi_object_type type, - struct acpi_namespace_node **return_node) +acpi_ns_search_node(u32 target_name, + struct acpi_namespace_node *node, + acpi_object_type type, + struct acpi_namespace_node **return_node) { - struct acpi_namespace_node *next_node; - - - ACPI_FUNCTION_TRACE ("ns_search_node"); + struct acpi_namespace_node *next_node; + ACPI_FUNCTION_TRACE("ns_search_node"); #ifdef ACPI_DEBUG_OUTPUT if (ACPI_LV_NAMES & acpi_dbg_level) { - char *scope_name; + char *scope_name; - scope_name = acpi_ns_get_external_pathname (node); + scope_name = acpi_ns_get_external_pathname(node); if (scope_name) { - ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, - "Searching %s (%p) For [%4.4s] (%s)\n", - scope_name, node, (char *) &target_name, - acpi_ut_get_type_name (type))); + ACPI_DEBUG_PRINT((ACPI_DB_NAMES, + "Searching %s (%p) For [%4.4s] (%s)\n", + scope_name, node, + (char *)&target_name, + acpi_ut_get_type_name(type))); - ACPI_MEM_FREE (scope_name); + ACPI_MEM_FREE(scope_name); } } #endif @@ -126,20 +119,26 @@ acpi_ns_search_node ( if (next_node->name.integer == target_name) { /* Resolve a control method alias if any */ - if (acpi_ns_get_type (next_node) == ACPI_TYPE_LOCAL_METHOD_ALIAS) { - next_node = ACPI_CAST_PTR (struct acpi_namespace_node, next_node->object); + if (acpi_ns_get_type(next_node) == + ACPI_TYPE_LOCAL_METHOD_ALIAS) { + next_node = + ACPI_CAST_PTR(struct acpi_namespace_node, + next_node->object); } /* * Found matching entry. */ - ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, - "Name [%4.4s] (%s) %p found in scope [%4.4s] %p\n", - (char *) &target_name, acpi_ut_get_type_name (next_node->type), - next_node, acpi_ut_get_node_name (node), node)); + ACPI_DEBUG_PRINT((ACPI_DB_NAMES, + "Name [%4.4s] (%s) %p found in scope [%4.4s] %p\n", + (char *)&target_name, + acpi_ut_get_type_name(next_node-> + type), + next_node, + acpi_ut_get_node_name(node), node)); *return_node = next_node; - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } /* @@ -159,15 +158,14 @@ acpi_ns_search_node ( /* Searched entire namespace level, not found */ - ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, - "Name [%4.4s] (%s) not found in search in scope [%4.4s] %p first child %p\n", - (char *) &target_name, acpi_ut_get_type_name (type), - acpi_ut_get_node_name (node), node, node->child)); + ACPI_DEBUG_PRINT((ACPI_DB_NAMES, + "Name [%4.4s] (%s) not found in search in scope [%4.4s] %p first child %p\n", + (char *)&target_name, acpi_ut_get_type_name(type), + acpi_ut_get_node_name(node), node, node->child)); - return_ACPI_STATUS (AE_NOT_FOUND); + return_ACPI_STATUS(AE_NOT_FOUND); } - /******************************************************************************* * * FUNCTION: acpi_ns_search_parent_tree @@ -194,43 +192,42 @@ acpi_ns_search_node ( ******************************************************************************/ static acpi_status -acpi_ns_search_parent_tree ( - u32 target_name, - struct acpi_namespace_node *node, - acpi_object_type type, - struct acpi_namespace_node **return_node) +acpi_ns_search_parent_tree(u32 target_name, + struct acpi_namespace_node *node, + acpi_object_type type, + struct acpi_namespace_node **return_node) { - acpi_status status; - struct acpi_namespace_node *parent_node; + acpi_status status; + struct acpi_namespace_node *parent_node; + ACPI_FUNCTION_TRACE("ns_search_parent_tree"); - ACPI_FUNCTION_TRACE ("ns_search_parent_tree"); - - - parent_node = acpi_ns_get_parent_node (node); + parent_node = acpi_ns_get_parent_node(node); /* * If there is no parent (i.e., we are at the root) or type is "local", * we won't be searching the parent tree. */ if (!parent_node) { - ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "[%4.4s] has no parent\n", - (char *) &target_name)); - return_ACPI_STATUS (AE_NOT_FOUND); + ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "[%4.4s] has no parent\n", + (char *)&target_name)); + return_ACPI_STATUS(AE_NOT_FOUND); } - if (acpi_ns_local (type)) { - ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, - "[%4.4s] type [%s] must be local to this scope (no parent search)\n", - (char *) &target_name, acpi_ut_get_type_name (type))); - return_ACPI_STATUS (AE_NOT_FOUND); + if (acpi_ns_local(type)) { + ACPI_DEBUG_PRINT((ACPI_DB_NAMES, + "[%4.4s] type [%s] must be local to this scope (no parent search)\n", + (char *)&target_name, + acpi_ut_get_type_name(type))); + return_ACPI_STATUS(AE_NOT_FOUND); } /* Search the parent tree */ - ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, - "Searching parent [%4.4s] for [%4.4s]\n", - acpi_ut_get_node_name (parent_node), (char *) &target_name)); + ACPI_DEBUG_PRINT((ACPI_DB_NAMES, + "Searching parent [%4.4s] for [%4.4s]\n", + acpi_ut_get_node_name(parent_node), + (char *)&target_name)); /* * Search parents until target is found or we have backed up to the root @@ -241,25 +238,24 @@ acpi_ns_search_parent_tree ( * object type at this point, we only care about the existence of * the actual name we are searching for. Typechecking comes later. */ - status = acpi_ns_search_node (target_name, parent_node, - ACPI_TYPE_ANY, return_node); - if (ACPI_SUCCESS (status)) { - return_ACPI_STATUS (status); + status = acpi_ns_search_node(target_name, parent_node, + ACPI_TYPE_ANY, return_node); + if (ACPI_SUCCESS(status)) { + return_ACPI_STATUS(status); } /* * Not found here, go up another level * (until we reach the root) */ - parent_node = acpi_ns_get_parent_node (parent_node); + parent_node = acpi_ns_get_parent_node(parent_node); } /* Not found in parent tree */ - return_ACPI_STATUS (AE_NOT_FOUND); + return_ACPI_STATUS(AE_NOT_FOUND); } - /******************************************************************************* * * FUNCTION: acpi_ns_search_and_enter @@ -286,52 +282,46 @@ acpi_ns_search_parent_tree ( ******************************************************************************/ acpi_status -acpi_ns_search_and_enter ( - u32 target_name, - struct acpi_walk_state *walk_state, - struct acpi_namespace_node *node, - acpi_interpreter_mode interpreter_mode, - acpi_object_type type, - u32 flags, - struct acpi_namespace_node **return_node) +acpi_ns_search_and_enter(u32 target_name, + struct acpi_walk_state *walk_state, + struct acpi_namespace_node *node, + acpi_interpreter_mode interpreter_mode, + acpi_object_type type, + u32 flags, struct acpi_namespace_node **return_node) { - acpi_status status; - struct acpi_namespace_node *new_node; - - - ACPI_FUNCTION_TRACE ("ns_search_and_enter"); + acpi_status status; + struct acpi_namespace_node *new_node; + ACPI_FUNCTION_TRACE("ns_search_and_enter"); /* Parameter validation */ if (!node || !target_name || !return_node) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Null param: Node %p Name %X return_node %p\n", - node, target_name, return_node)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Null param: Node %p Name %X return_node %p\n", + node, target_name, return_node)); - ACPI_REPORT_ERROR (("ns_search_and_enter: Null parameter\n")); - return_ACPI_STATUS (AE_BAD_PARAMETER); + ACPI_REPORT_ERROR(("ns_search_and_enter: Null parameter\n")); + return_ACPI_STATUS(AE_BAD_PARAMETER); } /* Name must consist of printable characters */ - if (!acpi_ut_valid_acpi_name (target_name)) { - ACPI_REPORT_ERROR (("ns_search_and_enter: Bad character in ACPI Name: %X\n", - target_name)); - return_ACPI_STATUS (AE_BAD_CHARACTER); + if (!acpi_ut_valid_acpi_name(target_name)) { + ACPI_REPORT_ERROR(("ns_search_and_enter: Bad character in ACPI Name: %X\n", target_name)); + return_ACPI_STATUS(AE_BAD_CHARACTER); } /* Try to find the name in the namespace level specified by the caller */ *return_node = ACPI_ENTRY_NOT_FOUND; - status = acpi_ns_search_node (target_name, node, type, return_node); + status = acpi_ns_search_node(target_name, node, type, return_node); if (status != AE_NOT_FOUND) { /* * If we found it AND the request specifies that a find is an error, * return the error */ - if ((status == AE_OK) && - (flags & ACPI_NS_ERROR_IF_FOUND)) { + if ((status == AE_OK) && (flags & ACPI_NS_ERROR_IF_FOUND)) { status = AE_ALREADY_EXISTS; } @@ -339,7 +329,7 @@ acpi_ns_search_and_enter ( * Either found it or there was an error * -- finished either way */ - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } /* @@ -351,14 +341,16 @@ acpi_ns_search_and_enter ( * and during the execution phase. */ if ((interpreter_mode != ACPI_IMODE_LOAD_PASS1) && - (flags & ACPI_NS_SEARCH_PARENT)) { + (flags & ACPI_NS_SEARCH_PARENT)) { /* * Not found at this level - search parent tree according to the * ACPI specification */ - status = acpi_ns_search_parent_tree (target_name, node, type, return_node); - if (ACPI_SUCCESS (status)) { - return_ACPI_STATUS (status); + status = + acpi_ns_search_parent_tree(target_name, node, type, + return_node); + if (ACPI_SUCCESS(status)) { + return_ACPI_STATUS(status); } } @@ -366,25 +358,24 @@ acpi_ns_search_and_enter ( * In execute mode, just search, never add names. Exit now. */ if (interpreter_mode == ACPI_IMODE_EXECUTE) { - ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, - "%4.4s Not found in %p [Not adding]\n", - (char *) &target_name, node)); + ACPI_DEBUG_PRINT((ACPI_DB_NAMES, + "%4.4s Not found in %p [Not adding]\n", + (char *)&target_name, node)); - return_ACPI_STATUS (AE_NOT_FOUND); + return_ACPI_STATUS(AE_NOT_FOUND); } /* Create the new named object */ - new_node = acpi_ns_create_node (target_name); + new_node = acpi_ns_create_node(target_name); if (!new_node) { - return_ACPI_STATUS (AE_NO_MEMORY); + return_ACPI_STATUS(AE_NO_MEMORY); } /* Install the new object into the parent's list of children */ - acpi_ns_install_node (walk_state, node, new_node, type); + acpi_ns_install_node(walk_state, node, new_node, type); *return_node = new_node; - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - diff --git a/drivers/acpi/namespace/nsutils.c b/drivers/acpi/namespace/nsutils.c index c53b82e94ce..ebec036423c 100644 --- a/drivers/acpi/namespace/nsutils.c +++ b/drivers/acpi/namespace/nsutils.c @@ -42,28 +42,21 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include #include #include #include #define _COMPONENT ACPI_NAMESPACE - ACPI_MODULE_NAME ("nsutils") +ACPI_MODULE_NAME("nsutils") /* Local prototypes */ - -static u8 -acpi_ns_valid_path_separator ( - char sep); +static u8 acpi_ns_valid_path_separator(char sep); #ifdef ACPI_OBSOLETE_FUNCTIONS -acpi_name -acpi_ns_find_parent_name ( - struct acpi_namespace_node *node_to_search); +acpi_name acpi_ns_find_parent_name(struct acpi_namespace_node *node_to_search); #endif - /******************************************************************************* * * FUNCTION: acpi_ns_report_error @@ -81,51 +74,45 @@ acpi_ns_find_parent_name ( ******************************************************************************/ void -acpi_ns_report_error ( - char *module_name, - u32 line_number, - u32 component_id, - char *internal_name, - acpi_status lookup_status) +acpi_ns_report_error(char *module_name, + u32 line_number, + u32 component_id, + char *internal_name, acpi_status lookup_status) { - acpi_status status; - char *name = NULL; - + acpi_status status; + char *name = NULL; - acpi_os_printf ("%8s-%04d: *** Error: Looking up ", - module_name, line_number); + acpi_os_printf("%8s-%04d: *** Error: Looking up ", + module_name, line_number); if (lookup_status == AE_BAD_CHARACTER) { /* There is a non-ascii character in the name */ - acpi_os_printf ("[0x%4.4X] (NON-ASCII)\n", - *(ACPI_CAST_PTR (u32, internal_name))); - } - else { + acpi_os_printf("[0x%4.4X] (NON-ASCII)\n", + *(ACPI_CAST_PTR(u32, internal_name))); + } else { /* Convert path to external format */ - status = acpi_ns_externalize_name (ACPI_UINT32_MAX, - internal_name, NULL, &name); + status = acpi_ns_externalize_name(ACPI_UINT32_MAX, + internal_name, NULL, &name); /* Print target name */ - if (ACPI_SUCCESS (status)) { - acpi_os_printf ("[%s]", name); - } - else { - acpi_os_printf ("[COULD NOT EXTERNALIZE NAME]"); + if (ACPI_SUCCESS(status)) { + acpi_os_printf("[%s]", name); + } else { + acpi_os_printf("[COULD NOT EXTERNALIZE NAME]"); } if (name) { - ACPI_MEM_FREE (name); + ACPI_MEM_FREE(name); } } - acpi_os_printf (" in namespace, %s\n", - acpi_format_exception (lookup_status)); + acpi_os_printf(" in namespace, %s\n", + acpi_format_exception(lookup_status)); } - /******************************************************************************* * * FUNCTION: acpi_ns_report_method_error @@ -145,34 +132,31 @@ acpi_ns_report_error ( ******************************************************************************/ void -acpi_ns_report_method_error ( - char *module_name, - u32 line_number, - u32 component_id, - char *message, - struct acpi_namespace_node *prefix_node, - char *path, - acpi_status method_status) +acpi_ns_report_method_error(char *module_name, + u32 line_number, + u32 component_id, + char *message, + struct acpi_namespace_node *prefix_node, + char *path, acpi_status method_status) { - acpi_status status; - struct acpi_namespace_node *node = prefix_node; - + acpi_status status; + struct acpi_namespace_node *node = prefix_node; if (path) { - status = acpi_ns_get_node_by_path (path, prefix_node, - ACPI_NS_NO_UPSEARCH, &node); - if (ACPI_FAILURE (status)) { - acpi_os_printf ("report_method_error: Could not get node\n"); + status = acpi_ns_get_node_by_path(path, prefix_node, + ACPI_NS_NO_UPSEARCH, &node); + if (ACPI_FAILURE(status)) { + acpi_os_printf + ("report_method_error: Could not get node\n"); return; } } - acpi_os_printf ("%8s-%04d: *** Error: ", module_name, line_number); - acpi_ns_print_node_pathname (node, message); - acpi_os_printf (", %s\n", acpi_format_exception (method_status)); + acpi_os_printf("%8s-%04d: *** Error: ", module_name, line_number); + acpi_ns_print_node_pathname(node, message); + acpi_os_printf(", %s\n", acpi_format_exception(method_status)); } - /******************************************************************************* * * FUNCTION: acpi_ns_print_node_pathname @@ -186,16 +170,13 @@ acpi_ns_report_method_error ( ******************************************************************************/ void -acpi_ns_print_node_pathname ( - struct acpi_namespace_node *node, - char *message) +acpi_ns_print_node_pathname(struct acpi_namespace_node *node, char *message) { - struct acpi_buffer buffer; - acpi_status status; - + struct acpi_buffer buffer; + acpi_status status; if (!node) { - acpi_os_printf ("[NULL NAME]"); + acpi_os_printf("[NULL NAME]"); return; } @@ -203,18 +184,17 @@ acpi_ns_print_node_pathname ( buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER; - status = acpi_ns_handle_to_pathname (node, &buffer); - if (ACPI_SUCCESS (status)) { + status = acpi_ns_handle_to_pathname(node, &buffer); + if (ACPI_SUCCESS(status)) { if (message) { - acpi_os_printf ("%s ", message); + acpi_os_printf("%s ", message); } - acpi_os_printf ("[%s] (Node %p)", (char *) buffer.pointer, node); - ACPI_MEM_FREE (buffer.pointer); + acpi_os_printf("[%s] (Node %p)", (char *)buffer.pointer, node); + ACPI_MEM_FREE(buffer.pointer); } } - /******************************************************************************* * * FUNCTION: acpi_ns_valid_root_prefix @@ -227,15 +207,12 @@ acpi_ns_print_node_pathname ( * ******************************************************************************/ -u8 -acpi_ns_valid_root_prefix ( - char prefix) +u8 acpi_ns_valid_root_prefix(char prefix) { return ((u8) (prefix == '\\')); } - /******************************************************************************* * * FUNCTION: acpi_ns_valid_path_separator @@ -248,15 +225,12 @@ acpi_ns_valid_root_prefix ( * ******************************************************************************/ -static u8 -acpi_ns_valid_path_separator ( - char sep) +static u8 acpi_ns_valid_path_separator(char sep) { return ((u8) (sep == '.')); } - /******************************************************************************* * * FUNCTION: acpi_ns_get_type @@ -269,22 +243,18 @@ acpi_ns_valid_path_separator ( * ******************************************************************************/ -acpi_object_type -acpi_ns_get_type ( - struct acpi_namespace_node *node) +acpi_object_type acpi_ns_get_type(struct acpi_namespace_node * node) { - ACPI_FUNCTION_TRACE ("ns_get_type"); - + ACPI_FUNCTION_TRACE("ns_get_type"); if (!node) { - ACPI_REPORT_WARNING (("ns_get_type: Null Node input pointer\n")); - return_VALUE (ACPI_TYPE_ANY); + ACPI_REPORT_WARNING(("ns_get_type: Null Node input pointer\n")); + return_VALUE(ACPI_TYPE_ANY); } - return_VALUE ((acpi_object_type) node->type); + return_VALUE((acpi_object_type) node->type); } - /******************************************************************************* * * FUNCTION: acpi_ns_local @@ -298,24 +268,20 @@ acpi_ns_get_type ( * ******************************************************************************/ -u32 -acpi_ns_local ( - acpi_object_type type) +u32 acpi_ns_local(acpi_object_type type) { - ACPI_FUNCTION_TRACE ("ns_local"); - + ACPI_FUNCTION_TRACE("ns_local"); - if (!acpi_ut_valid_object_type (type)) { + if (!acpi_ut_valid_object_type(type)) { /* Type code out of range */ - ACPI_REPORT_WARNING (("ns_local: Invalid Object Type\n")); - return_VALUE (ACPI_NS_NORMAL); + ACPI_REPORT_WARNING(("ns_local: Invalid Object Type\n")); + return_VALUE(ACPI_NS_NORMAL); } - return_VALUE ((u32) acpi_gbl_ns_properties[type] & ACPI_NS_LOCAL); + return_VALUE((u32) acpi_gbl_ns_properties[type] & ACPI_NS_LOCAL); } - /******************************************************************************* * * FUNCTION: acpi_ns_get_internal_name_length @@ -330,16 +296,12 @@ acpi_ns_local ( * ******************************************************************************/ -void -acpi_ns_get_internal_name_length ( - struct acpi_namestring_info *info) +void acpi_ns_get_internal_name_length(struct acpi_namestring_info *info) { - char *next_external_char; - u32 i; - - - ACPI_FUNCTION_ENTRY (); + char *next_external_char; + u32 i; + ACPI_FUNCTION_ENTRY(); next_external_char = info->external_name; info->num_carats = 0; @@ -353,11 +315,10 @@ acpi_ns_get_internal_name_length ( * * strlen() + 1 covers the first name_seg, which has no path separator */ - if (acpi_ns_valid_root_prefix (next_external_char[0])) { + if (acpi_ns_valid_root_prefix(next_external_char[0])) { info->fully_qualified = TRUE; next_external_char++; - } - else { + } else { /* * Handle Carat prefixes */ @@ -375,19 +336,18 @@ acpi_ns_get_internal_name_length ( if (*next_external_char) { info->num_segments = 1; for (i = 0; next_external_char[i]; i++) { - if (acpi_ns_valid_path_separator (next_external_char[i])) { + if (acpi_ns_valid_path_separator(next_external_char[i])) { info->num_segments++; } } } info->length = (ACPI_NAME_SIZE * info->num_segments) + - 4 + info->num_carats; + 4 + info->num_carats; info->next_external_char = next_external_char; } - /******************************************************************************* * * FUNCTION: acpi_ns_build_internal_name @@ -401,19 +361,15 @@ acpi_ns_get_internal_name_length ( * ******************************************************************************/ -acpi_status -acpi_ns_build_internal_name ( - struct acpi_namestring_info *info) +acpi_status acpi_ns_build_internal_name(struct acpi_namestring_info *info) { - u32 num_segments = info->num_segments; - char *internal_name = info->internal_name; - char *external_name = info->next_external_char; - char *result = NULL; - acpi_native_uint i; - - - ACPI_FUNCTION_TRACE ("ns_build_internal_name"); + u32 num_segments = info->num_segments; + char *internal_name = info->internal_name; + char *external_name = info->next_external_char; + char *result = NULL; + acpi_native_uint i; + ACPI_FUNCTION_TRACE("ns_build_internal_name"); /* Setup the correct prefixes, counts, and pointers */ @@ -422,18 +378,15 @@ acpi_ns_build_internal_name ( if (num_segments <= 1) { result = &internal_name[1]; - } - else if (num_segments == 2) { + } else if (num_segments == 2) { internal_name[1] = AML_DUAL_NAME_PREFIX; result = &internal_name[2]; - } - else { + } else { internal_name[1] = AML_MULTI_NAME_PREFIX_OP; - internal_name[2] = (char) num_segments; + internal_name[2] = (char)num_segments; result = &internal_name[3]; } - } - else { + } else { /* * Not fully qualified. * Handle Carats first, then append the name segments @@ -447,15 +400,14 @@ acpi_ns_build_internal_name ( if (num_segments <= 1) { result = &internal_name[i]; - } - else if (num_segments == 2) { + } else if (num_segments == 2) { internal_name[i] = AML_DUAL_NAME_PREFIX; - result = &internal_name[(acpi_native_uint) (i+1)]; - } - else { + result = &internal_name[(acpi_native_uint) (i + 1)]; + } else { internal_name[i] = AML_MULTI_NAME_PREFIX_OP; - internal_name[(acpi_native_uint) (i+1)] = (char) num_segments; - result = &internal_name[(acpi_native_uint) (i+2)]; + internal_name[(acpi_native_uint) (i + 1)] = + (char)num_segments; + result = &internal_name[(acpi_native_uint) (i + 2)]; } } @@ -463,25 +415,25 @@ acpi_ns_build_internal_name ( for (; num_segments; num_segments--) { for (i = 0; i < ACPI_NAME_SIZE; i++) { - if (acpi_ns_valid_path_separator (*external_name) || - (*external_name == 0)) { + if (acpi_ns_valid_path_separator(*external_name) || + (*external_name == 0)) { /* Pad the segment with underscore(s) if segment is short */ result[i] = '_'; - } - else { + } else { /* Convert the character to uppercase and save it */ - result[i] = (char) ACPI_TOUPPER ((int) *external_name); + result[i] = + (char)ACPI_TOUPPER((int)*external_name); external_name++; } } /* Now we must have a path separator, or the pathname is bad */ - if (!acpi_ns_valid_path_separator (*external_name) && - (*external_name != 0)) { - return_ACPI_STATUS (AE_BAD_PARAMETER); + if (!acpi_ns_valid_path_separator(*external_name) && + (*external_name != 0)) { + return_ACPI_STATUS(AE_BAD_PARAMETER); } /* Move on the next segment */ @@ -495,18 +447,17 @@ acpi_ns_build_internal_name ( *result = 0; if (info->fully_qualified) { - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Returning [%p] (abs) \"\\%s\"\n", - internal_name, internal_name)); - } - else { - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Returning [%p] (rel) \"%s\"\n", - internal_name, internal_name)); + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, + "Returning [%p] (abs) \"\\%s\"\n", + internal_name, internal_name)); + } else { + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Returning [%p] (rel) \"%s\"\n", + internal_name, internal_name)); } - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_ns_internalize_name @@ -522,51 +473,43 @@ acpi_ns_build_internal_name ( * *******************************************************************************/ -acpi_status -acpi_ns_internalize_name ( - char *external_name, - char **converted_name) +acpi_status acpi_ns_internalize_name(char *external_name, char **converted_name) { - char *internal_name; - struct acpi_namestring_info info; - acpi_status status; - - - ACPI_FUNCTION_TRACE ("ns_internalize_name"); + char *internal_name; + struct acpi_namestring_info info; + acpi_status status; + ACPI_FUNCTION_TRACE("ns_internalize_name"); - if ((!external_name) || - (*external_name == 0) || - (!converted_name)) { - return_ACPI_STATUS (AE_BAD_PARAMETER); + if ((!external_name) || (*external_name == 0) || (!converted_name)) { + return_ACPI_STATUS(AE_BAD_PARAMETER); } /* Get the length of the new internal name */ info.external_name = external_name; - acpi_ns_get_internal_name_length (&info); + acpi_ns_get_internal_name_length(&info); /* We need a segment to store the internal name */ - internal_name = ACPI_MEM_CALLOCATE (info.length); + internal_name = ACPI_MEM_CALLOCATE(info.length); if (!internal_name) { - return_ACPI_STATUS (AE_NO_MEMORY); + return_ACPI_STATUS(AE_NO_MEMORY); } /* Build the name */ info.internal_name = internal_name; - status = acpi_ns_build_internal_name (&info); - if (ACPI_FAILURE (status)) { - ACPI_MEM_FREE (internal_name); - return_ACPI_STATUS (status); + status = acpi_ns_build_internal_name(&info); + if (ACPI_FAILURE(status)) { + ACPI_MEM_FREE(internal_name); + return_ACPI_STATUS(status); } *converted_name = internal_name; - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_ns_externalize_name @@ -585,27 +528,21 @@ acpi_ns_internalize_name ( ******************************************************************************/ acpi_status -acpi_ns_externalize_name ( - u32 internal_name_length, - char *internal_name, - u32 *converted_name_length, - char **converted_name) +acpi_ns_externalize_name(u32 internal_name_length, + char *internal_name, + u32 * converted_name_length, char **converted_name) { - acpi_native_uint names_index = 0; - acpi_native_uint num_segments = 0; - acpi_native_uint required_length; - acpi_native_uint prefix_length = 0; - acpi_native_uint i = 0; - acpi_native_uint j = 0; - + acpi_native_uint names_index = 0; + acpi_native_uint num_segments = 0; + acpi_native_uint required_length; + acpi_native_uint prefix_length = 0; + acpi_native_uint i = 0; + acpi_native_uint j = 0; - ACPI_FUNCTION_TRACE ("ns_externalize_name"); + ACPI_FUNCTION_TRACE("ns_externalize_name"); - - if (!internal_name_length || - !internal_name || - !converted_name) { - return_ACPI_STATUS (AE_BAD_PARAMETER); + if (!internal_name_length || !internal_name || !converted_name) { + return_ACPI_STATUS(AE_BAD_PARAMETER); } /* @@ -620,8 +557,7 @@ acpi_ns_externalize_name ( for (i = 0; i < internal_name_length; i++) { if (internal_name[i] == '^') { prefix_length = i + 1; - } - else { + } else { break; } } @@ -648,7 +584,8 @@ acpi_ns_externalize_name ( names_index = prefix_length + 2; num_segments = (acpi_native_uint) (u8) - internal_name[(acpi_native_uint) (prefix_length + 1)]; + internal_name[(acpi_native_uint) + (prefix_length + 1)]; break; case AML_DUAL_NAME_PREFIX: @@ -683,23 +620,23 @@ acpi_ns_externalize_name ( * punctuation ('.') between object names, plus the NULL terminator. */ required_length = prefix_length + (4 * num_segments) + - ((num_segments > 0) ? (num_segments - 1) : 0) + 1; + ((num_segments > 0) ? (num_segments - 1) : 0) + 1; /* * Check to see if we're still in bounds. If not, there's a problem * with internal_name (invalid format). */ if (required_length > internal_name_length) { - ACPI_REPORT_ERROR (("ns_externalize_name: Invalid internal name\n")); - return_ACPI_STATUS (AE_BAD_PATHNAME); + ACPI_REPORT_ERROR(("ns_externalize_name: Invalid internal name\n")); + return_ACPI_STATUS(AE_BAD_PATHNAME); } /* * Build converted_name */ - *converted_name = ACPI_MEM_CALLOCATE (required_length); + *converted_name = ACPI_MEM_CALLOCATE(required_length); if (!(*converted_name)) { - return_ACPI_STATUS (AE_NO_MEMORY); + return_ACPI_STATUS(AE_NO_MEMORY); } j = 0; @@ -725,10 +662,9 @@ acpi_ns_externalize_name ( *converted_name_length = (u32) required_length; } - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_ns_map_handle_to_node @@ -745,13 +681,10 @@ acpi_ns_externalize_name ( * ******************************************************************************/ -struct acpi_namespace_node * -acpi_ns_map_handle_to_node ( - acpi_handle handle) +struct acpi_namespace_node *acpi_ns_map_handle_to_node(acpi_handle handle) { - ACPI_FUNCTION_ENTRY (); - + ACPI_FUNCTION_ENTRY(); /* * Simple implementation. @@ -766,14 +699,13 @@ acpi_ns_map_handle_to_node ( /* We can at least attempt to verify the handle */ - if (ACPI_GET_DESCRIPTOR_TYPE (handle) != ACPI_DESC_TYPE_NAMED) { + if (ACPI_GET_DESCRIPTOR_TYPE(handle) != ACPI_DESC_TYPE_NAMED) { return (NULL); } - return ((struct acpi_namespace_node *) handle); + return ((struct acpi_namespace_node *)handle); } - /******************************************************************************* * * FUNCTION: acpi_ns_convert_entry_to_handle @@ -786,18 +718,14 @@ acpi_ns_map_handle_to_node ( * ******************************************************************************/ -acpi_handle -acpi_ns_convert_entry_to_handle ( - struct acpi_namespace_node *node) +acpi_handle acpi_ns_convert_entry_to_handle(struct acpi_namespace_node *node) { - /* * Simple implementation for now; */ return ((acpi_handle) node); - /* Example future implementation --------------------- if (!Node) @@ -810,12 +738,10 @@ acpi_ns_convert_entry_to_handle ( return (ACPI_ROOT_OBJECT); } - return ((acpi_handle) Node); ------------------------------------------------------*/ } - /******************************************************************************* * * FUNCTION: acpi_ns_terminate @@ -828,42 +754,37 @@ acpi_ns_convert_entry_to_handle ( * ******************************************************************************/ -void -acpi_ns_terminate ( - void) +void acpi_ns_terminate(void) { - union acpi_operand_object *obj_desc; - - - ACPI_FUNCTION_TRACE ("ns_terminate"); + union acpi_operand_object *obj_desc; + ACPI_FUNCTION_TRACE("ns_terminate"); /* * 1) Free the entire namespace -- all nodes and objects * * Delete all object descriptors attached to namepsace nodes */ - acpi_ns_delete_namespace_subtree (acpi_gbl_root_node); + acpi_ns_delete_namespace_subtree(acpi_gbl_root_node); /* Detach any objects attached to the root */ - obj_desc = acpi_ns_get_attached_object (acpi_gbl_root_node); + obj_desc = acpi_ns_get_attached_object(acpi_gbl_root_node); if (obj_desc) { - acpi_ns_detach_object (acpi_gbl_root_node); + acpi_ns_detach_object(acpi_gbl_root_node); } - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Namespace freed\n")); + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Namespace freed\n")); /* * 2) Now we can delete the ACPI tables */ - acpi_tb_delete_all_tables (); - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "ACPI Tables freed\n")); + acpi_tb_delete_all_tables(); + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "ACPI Tables freed\n")); return_VOID; } - /******************************************************************************* * * FUNCTION: acpi_ns_opens_scope @@ -875,24 +796,21 @@ acpi_ns_terminate ( * ******************************************************************************/ -u32 -acpi_ns_opens_scope ( - acpi_object_type type) +u32 acpi_ns_opens_scope(acpi_object_type type) { - ACPI_FUNCTION_TRACE_STR ("ns_opens_scope", acpi_ut_get_type_name (type)); - + ACPI_FUNCTION_TRACE_STR("ns_opens_scope", acpi_ut_get_type_name(type)); - if (!acpi_ut_valid_object_type (type)) { + if (!acpi_ut_valid_object_type(type)) { /* type code out of range */ - ACPI_REPORT_WARNING (("ns_opens_scope: Invalid Object Type %X\n", type)); - return_VALUE (ACPI_NS_NORMAL); + ACPI_REPORT_WARNING(("ns_opens_scope: Invalid Object Type %X\n", + type)); + return_VALUE(ACPI_NS_NORMAL); } - return_VALUE (((u32) acpi_gbl_ns_properties[type]) & ACPI_NS_NEWSCOPE); + return_VALUE(((u32) acpi_gbl_ns_properties[type]) & ACPI_NS_NEWSCOPE); } - /******************************************************************************* * * FUNCTION: acpi_ns_get_node_by_path @@ -916,33 +834,29 @@ acpi_ns_opens_scope ( ******************************************************************************/ acpi_status -acpi_ns_get_node_by_path ( - char *pathname, - struct acpi_namespace_node *start_node, - u32 flags, - struct acpi_namespace_node **return_node) +acpi_ns_get_node_by_path(char *pathname, + struct acpi_namespace_node *start_node, + u32 flags, struct acpi_namespace_node **return_node) { - union acpi_generic_state scope_info; - acpi_status status; - char *internal_path = NULL; - - - ACPI_FUNCTION_TRACE_PTR ("ns_get_node_by_path", pathname); + union acpi_generic_state scope_info; + acpi_status status; + char *internal_path = NULL; + ACPI_FUNCTION_TRACE_PTR("ns_get_node_by_path", pathname); if (pathname) { /* Convert path to internal representation */ - status = acpi_ns_internalize_name (pathname, &internal_path); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ns_internalize_name(pathname, &internal_path); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } } /* Must lock namespace during lookup */ - status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (status)) { + status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE(status)) { goto cleanup; } @@ -952,25 +866,25 @@ acpi_ns_get_node_by_path ( /* Lookup the name in the namespace */ - status = acpi_ns_lookup (&scope_info, internal_path, - ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, - (flags | ACPI_NS_DONT_OPEN_SCOPE), - NULL, return_node); - if (ACPI_FAILURE (status)) { - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "%s, %s\n", - internal_path, acpi_format_exception (status))); + status = acpi_ns_lookup(&scope_info, internal_path, + ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, + (flags | ACPI_NS_DONT_OPEN_SCOPE), + NULL, return_node); + if (ACPI_FAILURE(status)) { + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "%s, %s\n", + internal_path, + acpi_format_exception(status))); } - (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); + (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); -cleanup: + cleanup: if (internal_path) { - ACPI_MEM_FREE (internal_path); + ACPI_MEM_FREE(internal_path); } - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_ns_get_parent_node @@ -983,12 +897,10 @@ cleanup: * ******************************************************************************/ -struct acpi_namespace_node * -acpi_ns_get_parent_node ( - struct acpi_namespace_node *node) +struct acpi_namespace_node *acpi_ns_get_parent_node(struct acpi_namespace_node + *node) { - ACPI_FUNCTION_ENTRY (); - + ACPI_FUNCTION_ENTRY(); if (!node) { return (NULL); @@ -1006,7 +918,6 @@ acpi_ns_get_parent_node ( return (node->peer); } - /******************************************************************************* * * FUNCTION: acpi_ns_get_next_valid_node @@ -1021,9 +932,9 @@ acpi_ns_get_parent_node ( * ******************************************************************************/ -struct acpi_namespace_node * -acpi_ns_get_next_valid_node ( - struct acpi_namespace_node *node) +struct acpi_namespace_node *acpi_ns_get_next_valid_node(struct + acpi_namespace_node + *node) { /* If we are at the end of this peer list, return NULL */ @@ -1037,7 +948,6 @@ acpi_ns_get_next_valid_node ( return (node->peer); } - #ifdef ACPI_OBSOLETE_FUNCTIONS /******************************************************************************* * @@ -1053,38 +963,36 @@ acpi_ns_get_next_valid_node ( * ******************************************************************************/ -acpi_name -acpi_ns_find_parent_name ( - struct acpi_namespace_node *child_node) +acpi_name acpi_ns_find_parent_name(struct acpi_namespace_node * child_node) { - struct acpi_namespace_node *parent_node; - - - ACPI_FUNCTION_TRACE ("ns_find_parent_name"); + struct acpi_namespace_node *parent_node; + ACPI_FUNCTION_TRACE("ns_find_parent_name"); if (child_node) { /* Valid entry. Get the parent Node */ - parent_node = acpi_ns_get_parent_node (child_node); + parent_node = acpi_ns_get_parent_node(child_node); if (parent_node) { - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "Parent of %p [%4.4s] is %p [%4.4s]\n", - child_node, acpi_ut_get_node_name (child_node), - parent_node, acpi_ut_get_node_name (parent_node))); + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, + "Parent of %p [%4.4s] is %p [%4.4s]\n", + child_node, + acpi_ut_get_node_name(child_node), + parent_node, + acpi_ut_get_node_name(parent_node))); if (parent_node->name.integer) { - return_VALUE ((acpi_name) parent_node->name.integer); + return_VALUE((acpi_name) parent_node->name. + integer); } } - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "Unable to find parent of %p (%4.4s)\n", - child_node, acpi_ut_get_node_name (child_node))); + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, + "Unable to find parent of %p (%4.4s)\n", + child_node, + acpi_ut_get_node_name(child_node))); } - return_VALUE (ACPI_UNKNOWN_NAME); + return_VALUE(ACPI_UNKNOWN_NAME); } #endif - - diff --git a/drivers/acpi/namespace/nswalk.c b/drivers/acpi/namespace/nswalk.c index f9a7277dca6..5f164c0df33 100644 --- a/drivers/acpi/namespace/nswalk.c +++ b/drivers/acpi/namespace/nswalk.c @@ -41,14 +41,11 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include #include - #define _COMPONENT ACPI_NAMESPACE - ACPI_MODULE_NAME ("nswalk") - +ACPI_MODULE_NAME("nswalk") /******************************************************************************* * @@ -68,18 +65,15 @@ * within Scope is returned. * ******************************************************************************/ - -struct acpi_namespace_node * -acpi_ns_get_next_node ( - acpi_object_type type, - struct acpi_namespace_node *parent_node, - struct acpi_namespace_node *child_node) +struct acpi_namespace_node *acpi_ns_get_next_node(acpi_object_type type, + struct acpi_namespace_node + *parent_node, + struct acpi_namespace_node + *child_node) { - struct acpi_namespace_node *next_node = NULL; - - - ACPI_FUNCTION_ENTRY (); + struct acpi_namespace_node *next_node = NULL; + ACPI_FUNCTION_ENTRY(); if (!child_node) { /* It's really the parent's _scope_ that we want */ @@ -92,7 +86,7 @@ acpi_ns_get_next_node ( else { /* Start search at the NEXT node */ - next_node = acpi_ns_get_next_valid_node (child_node); + next_node = acpi_ns_get_next_valid_node(child_node); } /* If any type is OK, we are done */ @@ -114,7 +108,7 @@ acpi_ns_get_next_node ( /* Otherwise, move on to the next node */ - next_node = acpi_ns_get_next_valid_node (next_node); + next_node = acpi_ns_get_next_valid_node(next_node); } /* Not found */ @@ -122,7 +116,6 @@ acpi_ns_get_next_node ( return (NULL); } - /******************************************************************************* * * FUNCTION: acpi_ns_walk_namespace @@ -154,25 +147,21 @@ acpi_ns_get_next_node ( ******************************************************************************/ acpi_status -acpi_ns_walk_namespace ( - acpi_object_type type, - acpi_handle start_node, - u32 max_depth, - u8 unlock_before_callback, - acpi_walk_callback user_function, - void *context, - void **return_value) +acpi_ns_walk_namespace(acpi_object_type type, + acpi_handle start_node, + u32 max_depth, + u8 unlock_before_callback, + acpi_walk_callback user_function, + void *context, void **return_value) { - acpi_status status; - acpi_status mutex_status; - struct acpi_namespace_node *child_node; - struct acpi_namespace_node *parent_node; - acpi_object_type child_type; - u32 level; - - - ACPI_FUNCTION_TRACE ("ns_walk_namespace"); + acpi_status status; + acpi_status mutex_status; + struct acpi_namespace_node *child_node; + struct acpi_namespace_node *parent_node; + acpi_object_type child_type; + u32 level; + ACPI_FUNCTION_TRACE("ns_walk_namespace"); /* Special case for the namespace Root Node */ @@ -183,9 +172,9 @@ acpi_ns_walk_namespace ( /* Null child means "get first node" */ parent_node = start_node; - child_node = NULL; - child_type = ACPI_TYPE_ANY; - level = 1; + child_node = NULL; + child_type = ACPI_TYPE_ANY; + level = 1; /* * Traverse the tree of nodes until we bubble back up to where we @@ -196,7 +185,9 @@ acpi_ns_walk_namespace ( /* Get the next node in this scope. Null if not found */ status = AE_OK; - child_node = acpi_ns_get_next_node (ACPI_TYPE_ANY, parent_node, child_node); + child_node = + acpi_ns_get_next_node(ACPI_TYPE_ANY, parent_node, + child_node); if (child_node) { /* * Found node, Get the type if we are not @@ -212,19 +203,25 @@ acpi_ns_walk_namespace ( * callback function */ if (unlock_before_callback) { - mutex_status = acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (mutex_status)) { - return_ACPI_STATUS (mutex_status); + mutex_status = + acpi_ut_release_mutex + (ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE(mutex_status)) { + return_ACPI_STATUS + (mutex_status); } } - status = user_function (child_node, level, - context, return_value); + status = user_function(child_node, level, + context, return_value); if (unlock_before_callback) { - mutex_status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (mutex_status)) { - return_ACPI_STATUS (mutex_status); + mutex_status = + acpi_ut_acquire_mutex + (ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE(mutex_status)) { + return_ACPI_STATUS + (mutex_status); } } @@ -239,13 +236,13 @@ acpi_ns_walk_namespace ( /* Exit now, with OK status */ - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); default: /* All others are valid exceptions */ - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } } @@ -258,7 +255,8 @@ acpi_ns_walk_namespace ( * maximum depth has been reached. */ if ((level < max_depth) && (status != AE_CTRL_DEPTH)) { - if (acpi_ns_get_next_node (ACPI_TYPE_ANY, child_node, NULL)) { + if (acpi_ns_get_next_node + (ACPI_TYPE_ANY, child_node, NULL)) { /* * There is at least one child of this * node, visit the onde @@ -268,8 +266,7 @@ acpi_ns_walk_namespace ( child_node = NULL; } } - } - else { + } else { /* * No more children of this node (acpi_ns_get_next_node * failed), go back upwards in the namespace tree to @@ -277,13 +274,11 @@ acpi_ns_walk_namespace ( */ level--; child_node = parent_node; - parent_node = acpi_ns_get_parent_node (parent_node); + parent_node = acpi_ns_get_parent_node(parent_node); } } /* Complete walk, not terminated by user function */ - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - - diff --git a/drivers/acpi/namespace/nsxfeval.c b/drivers/acpi/namespace/nsxfeval.c index 12ea202257f..c07b046659f 100644 --- a/drivers/acpi/namespace/nsxfeval.c +++ b/drivers/acpi/namespace/nsxfeval.c @@ -48,10 +48,8 @@ #include #include - #define _COMPONENT ACPI_NAMESPACE - ACPI_MODULE_NAME ("nsxfeval") - +ACPI_MODULE_NAME("nsxfeval") /******************************************************************************* * @@ -73,27 +71,23 @@ * be valid (non-null) * ******************************************************************************/ - #ifdef ACPI_FUTURE_USAGE acpi_status -acpi_evaluate_object_typed ( - acpi_handle handle, - acpi_string pathname, - struct acpi_object_list *external_params, - struct acpi_buffer *return_buffer, - acpi_object_type return_type) +acpi_evaluate_object_typed(acpi_handle handle, + acpi_string pathname, + struct acpi_object_list *external_params, + struct acpi_buffer *return_buffer, + acpi_object_type return_type) { - acpi_status status; - u8 must_free = FALSE; - - - ACPI_FUNCTION_TRACE ("acpi_evaluate_object_typed"); + acpi_status status; + u8 must_free = FALSE; + ACPI_FUNCTION_TRACE("acpi_evaluate_object_typed"); /* Return buffer must be valid */ if (!return_buffer) { - return_ACPI_STATUS (AE_BAD_PARAMETER); + return_ACPI_STATUS(AE_BAD_PARAMETER); } if (return_buffer->length == ACPI_ALLOCATE_BUFFER) { @@ -102,51 +96,52 @@ acpi_evaluate_object_typed ( /* Evaluate the object */ - status = acpi_evaluate_object (handle, pathname, external_params, return_buffer); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = + acpi_evaluate_object(handle, pathname, external_params, + return_buffer); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* Type ANY means "don't care" */ if (return_type == ACPI_TYPE_ANY) { - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } if (return_buffer->length == 0) { /* Error because caller specifically asked for a return value */ - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "No return value\n")); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "No return value\n")); - return_ACPI_STATUS (AE_NULL_OBJECT); + return_ACPI_STATUS(AE_NULL_OBJECT); } /* Examine the object type returned from evaluate_object */ - if (((union acpi_object *) return_buffer->pointer)->type == return_type) { - return_ACPI_STATUS (AE_OK); + if (((union acpi_object *)return_buffer->pointer)->type == return_type) { + return_ACPI_STATUS(AE_OK); } /* Return object type does not match requested type */ - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Incorrect return type [%s] requested [%s]\n", - acpi_ut_get_type_name (((union acpi_object *) return_buffer->pointer)->type), - acpi_ut_get_type_name (return_type))); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Incorrect return type [%s] requested [%s]\n", + acpi_ut_get_type_name(((union acpi_object *) + return_buffer->pointer)->type), + acpi_ut_get_type_name(return_type))); if (must_free) { /* Caller used ACPI_ALLOCATE_BUFFER, free the return buffer */ - acpi_os_free (return_buffer->pointer); + acpi_os_free(return_buffer->pointer); return_buffer->pointer = NULL; } return_buffer->length = 0; - return_ACPI_STATUS (AE_TYPE); + return_ACPI_STATUS(AE_TYPE); } -#endif /* ACPI_FUTURE_USAGE */ - +#endif /* ACPI_FUTURE_USAGE */ /******************************************************************************* * @@ -169,21 +164,18 @@ acpi_evaluate_object_typed ( ******************************************************************************/ acpi_status -acpi_evaluate_object ( - acpi_handle handle, - acpi_string pathname, - struct acpi_object_list *external_params, - struct acpi_buffer *return_buffer) +acpi_evaluate_object(acpi_handle handle, + acpi_string pathname, + struct acpi_object_list *external_params, + struct acpi_buffer *return_buffer) { - acpi_status status; - acpi_status status2; - struct acpi_parameter_info info; - acpi_size buffer_space_needed; - u32 i; - - - ACPI_FUNCTION_TRACE ("acpi_evaluate_object"); + acpi_status status; + acpi_status status2; + struct acpi_parameter_info info; + acpi_size buffer_space_needed; + u32 i; + ACPI_FUNCTION_TRACE("acpi_evaluate_object"); info.node = handle; info.parameters = NULL; @@ -200,11 +192,11 @@ acpi_evaluate_object ( * Allocate a new parameter block for the internal objects * Add 1 to count to allow for null terminated internal list */ - info.parameters = ACPI_MEM_CALLOCATE ( - ((acpi_size) external_params->count + 1) * - sizeof (void *)); + info.parameters = ACPI_MEM_CALLOCATE(((acpi_size) + external_params->count + + 1) * sizeof(void *)); if (!info.parameters) { - return_ACPI_STATUS (AE_NO_MEMORY); + return_ACPI_STATUS(AE_NO_MEMORY); } /* @@ -212,48 +204,47 @@ acpi_evaluate_object ( * internal object */ for (i = 0; i < external_params->count; i++) { - status = acpi_ut_copy_eobject_to_iobject (&external_params->pointer[i], - &info.parameters[i]); - if (ACPI_FAILURE (status)) { - acpi_ut_delete_internal_object_list (info.parameters); - return_ACPI_STATUS (status); + status = + acpi_ut_copy_eobject_to_iobject(&external_params-> + pointer[i], + &info. + parameters[i]); + if (ACPI_FAILURE(status)) { + acpi_ut_delete_internal_object_list(info. + parameters); + return_ACPI_STATUS(status); } } info.parameters[external_params->count] = NULL; } - /* * Three major cases: * 1) Fully qualified pathname * 2) No handle, not fully qualified pathname (error) * 3) Valid handle */ - if ((pathname) && - (acpi_ns_valid_root_prefix (pathname[0]))) { + if ((pathname) && (acpi_ns_valid_root_prefix(pathname[0]))) { /* * The path is fully qualified, just evaluate by name */ - status = acpi_ns_evaluate_by_name (pathname, &info); - } - else if (!handle) { + status = acpi_ns_evaluate_by_name(pathname, &info); + } else if (!handle) { /* * A handle is optional iff a fully qualified pathname * is specified. Since we've already handled fully * qualified names above, this is an error */ if (!pathname) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Both Handle and Pathname are NULL\n")); - } - else { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Handle is NULL and Pathname is relative\n")); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Both Handle and Pathname are NULL\n")); + } else { + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Handle is NULL and Pathname is relative\n")); } status = AE_BAD_PARAMETER; - } - else { + } else { /* * We get here if we have a handle -- and if we have a * pathname it is relative. The handle will be validated @@ -264,17 +255,15 @@ acpi_evaluate_object ( * The null pathname case means the handle is for * the actual object to be evaluated */ - status = acpi_ns_evaluate_by_handle (&info); - } - else { - /* - * Both a Handle and a relative Pathname - */ - status = acpi_ns_evaluate_relative (pathname, &info); + status = acpi_ns_evaluate_by_handle(&info); + } else { + /* + * Both a Handle and a relative Pathname + */ + status = acpi_ns_evaluate_relative(pathname, &info); } } - /* * If we are expecting a return value, and all went well above, * copy the return value to an external object. @@ -282,9 +271,9 @@ acpi_evaluate_object ( if (return_buffer) { if (!info.return_object) { return_buffer->length = 0; - } - else { - if (ACPI_GET_DESCRIPTOR_TYPE (info.return_object) == ACPI_DESC_TYPE_NAMED) { + } else { + if (ACPI_GET_DESCRIPTOR_TYPE(info.return_object) == + ACPI_DESC_TYPE_NAMED) { /* * If we received a NS Node as a return object, this means that * the object we are evaluating has nothing interesting to @@ -294,37 +283,43 @@ acpi_evaluate_object ( * support for various types at a later date if necessary. */ status = AE_TYPE; - info.return_object = NULL; /* No need to delete a NS Node */ + info.return_object = NULL; /* No need to delete a NS Node */ return_buffer->length = 0; } - if (ACPI_SUCCESS (status)) { + if (ACPI_SUCCESS(status)) { /* * Find out how large a buffer is needed * to contain the returned object */ - status = acpi_ut_get_object_size (info.return_object, - &buffer_space_needed); - if (ACPI_SUCCESS (status)) { + status = + acpi_ut_get_object_size(info.return_object, + &buffer_space_needed); + if (ACPI_SUCCESS(status)) { /* Validate/Allocate/Clear caller buffer */ - status = acpi_ut_initialize_buffer (return_buffer, - buffer_space_needed); - if (ACPI_FAILURE (status)) { + status = + acpi_ut_initialize_buffer + (return_buffer, + buffer_space_needed); + if (ACPI_FAILURE(status)) { /* * Caller's buffer is too small or a new one can't be allocated */ - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "Needed buffer size %X, %s\n", - (u32) buffer_space_needed, - acpi_format_exception (status))); - } - else { + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "Needed buffer size %X, %s\n", + (u32) + buffer_space_needed, + acpi_format_exception + (status))); + } else { /* * We have enough space for the object, build it */ - status = acpi_ut_copy_iobject_to_eobject (info.return_object, - return_buffer); + status = + acpi_ut_copy_iobject_to_eobject + (info.return_object, + return_buffer); } } } @@ -336,14 +331,14 @@ acpi_evaluate_object ( * Delete the internal return object. NOTE: Interpreter * must be locked to avoid race condition. */ - status2 = acpi_ex_enter_interpreter (); - if (ACPI_SUCCESS (status2)) { + status2 = acpi_ex_enter_interpreter(); + if (ACPI_SUCCESS(status2)) { /* * Delete the internal return object. (Or at least * decrement the reference count by one) */ - acpi_ut_remove_reference (info.return_object); - acpi_ex_exit_interpreter (); + acpi_ut_remove_reference(info.return_object); + acpi_ex_exit_interpreter(); } } @@ -353,13 +348,13 @@ acpi_evaluate_object ( if (info.parameters) { /* Free the allocated parameter block */ - acpi_ut_delete_internal_object_list (info.parameters); + acpi_ut_delete_internal_object_list(info.parameters); } - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } -EXPORT_SYMBOL(acpi_evaluate_object); +EXPORT_SYMBOL(acpi_evaluate_object); /******************************************************************************* * @@ -392,26 +387,20 @@ EXPORT_SYMBOL(acpi_evaluate_object); ******************************************************************************/ acpi_status -acpi_walk_namespace ( - acpi_object_type type, - acpi_handle start_object, - u32 max_depth, - acpi_walk_callback user_function, - void *context, - void **return_value) +acpi_walk_namespace(acpi_object_type type, + acpi_handle start_object, + u32 max_depth, + acpi_walk_callback user_function, + void *context, void **return_value) { - acpi_status status; - - - ACPI_FUNCTION_TRACE ("acpi_walk_namespace"); + acpi_status status; + ACPI_FUNCTION_TRACE("acpi_walk_namespace"); /* Parameter validation */ - if ((type > ACPI_TYPE_EXTERNAL_MAX) || - (!max_depth) || - (!user_function)) { - return_ACPI_STATUS (AE_BAD_PARAMETER); + if ((type > ACPI_TYPE_EXTERNAL_MAX) || (!max_depth) || (!user_function)) { + return_ACPI_STATUS(AE_BAD_PARAMETER); } /* @@ -420,20 +409,20 @@ acpi_walk_namespace ( * to the user function - since this function * must be allowed to make Acpi calls itself. */ - status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } - status = acpi_ns_walk_namespace (type, start_object, max_depth, - ACPI_NS_WALK_UNLOCK, - user_function, context, return_value); + status = acpi_ns_walk_namespace(type, start_object, max_depth, + ACPI_NS_WALK_UNLOCK, + user_function, context, return_value); - (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); - return_ACPI_STATUS (status); + (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); + return_ACPI_STATUS(status); } -EXPORT_SYMBOL(acpi_walk_namespace); +EXPORT_SYMBOL(acpi_walk_namespace); /******************************************************************************* * @@ -450,29 +439,26 @@ EXPORT_SYMBOL(acpi_walk_namespace); ******************************************************************************/ static acpi_status -acpi_ns_get_device_callback ( - acpi_handle obj_handle, - u32 nesting_level, - void *context, - void **return_value) +acpi_ns_get_device_callback(acpi_handle obj_handle, + u32 nesting_level, + void *context, void **return_value) { - struct acpi_get_devices_info *info = context; - acpi_status status; - struct acpi_namespace_node *node; - u32 flags; - struct acpi_device_id hid; + struct acpi_get_devices_info *info = context; + acpi_status status; + struct acpi_namespace_node *node; + u32 flags; + struct acpi_device_id hid; struct acpi_compatible_id_list *cid; - acpi_native_uint i; - + acpi_native_uint i; - status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (status)) { + status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE(status)) { return (status); } - node = acpi_ns_map_handle_to_node (obj_handle); - status = acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (status)) { + node = acpi_ns_map_handle_to_node(obj_handle); + status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE(status)) { return (status); } @@ -482,8 +468,8 @@ acpi_ns_get_device_callback ( /* Run _STA to determine if device is present */ - status = acpi_ut_execute_STA (node, &flags); - if (ACPI_FAILURE (status)) { + status = acpi_ut_execute_STA(node, &flags); + if (ACPI_FAILURE(status)) { return (AE_CTRL_DEPTH); } @@ -496,44 +482,43 @@ acpi_ns_get_device_callback ( /* Filter based on device HID & CID */ if (info->hid != NULL) { - status = acpi_ut_execute_HID (node, &hid); + status = acpi_ut_execute_HID(node, &hid); if (status == AE_NOT_FOUND) { return (AE_OK); - } - else if (ACPI_FAILURE (status)) { + } else if (ACPI_FAILURE(status)) { return (AE_CTRL_DEPTH); } - if (ACPI_STRNCMP (hid.value, info->hid, sizeof (hid.value)) != 0) { + if (ACPI_STRNCMP(hid.value, info->hid, sizeof(hid.value)) != 0) { /* Get the list of Compatible IDs */ - status = acpi_ut_execute_CID (node, &cid); + status = acpi_ut_execute_CID(node, &cid); if (status == AE_NOT_FOUND) { return (AE_OK); - } - else if (ACPI_FAILURE (status)) { + } else if (ACPI_FAILURE(status)) { return (AE_CTRL_DEPTH); } /* Walk the CID list */ for (i = 0; i < cid->count; i++) { - if (ACPI_STRNCMP (cid->id[i].value, info->hid, - sizeof (struct acpi_compatible_id)) != 0) { - ACPI_MEM_FREE (cid); + if (ACPI_STRNCMP(cid->id[i].value, info->hid, + sizeof(struct + acpi_compatible_id)) != + 0) { + ACPI_MEM_FREE(cid); return (AE_OK); } } - ACPI_MEM_FREE (cid); + ACPI_MEM_FREE(cid); } } - status = info->user_function (obj_handle, nesting_level, info->context, - return_value); + status = info->user_function(obj_handle, nesting_level, info->context, + return_value); return (status); } - /******************************************************************************* * * FUNCTION: acpi_get_devices @@ -560,32 +545,28 @@ acpi_ns_get_device_callback ( ******************************************************************************/ acpi_status -acpi_get_devices ( - char *HID, - acpi_walk_callback user_function, - void *context, - void **return_value) +acpi_get_devices(char *HID, + acpi_walk_callback user_function, + void *context, void **return_value) { - acpi_status status; - struct acpi_get_devices_info info; - - - ACPI_FUNCTION_TRACE ("acpi_get_devices"); + acpi_status status; + struct acpi_get_devices_info info; + ACPI_FUNCTION_TRACE("acpi_get_devices"); /* Parameter validation */ if (!user_function) { - return_ACPI_STATUS (AE_BAD_PARAMETER); + return_ACPI_STATUS(AE_BAD_PARAMETER); } /* * We're going to call their callback from OUR callback, so we need * to know what it is, and their context parameter. */ - info.context = context; + info.context = context; info.user_function = user_function; - info.hid = HID; + info.hid = HID; /* * Lock the namespace around the walk. @@ -593,22 +574,22 @@ acpi_get_devices ( * to the user function - since this function * must be allowed to make Acpi calls itself. */ - status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } - status = acpi_ns_walk_namespace (ACPI_TYPE_DEVICE, - ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, - ACPI_NS_WALK_UNLOCK, - acpi_ns_get_device_callback, &info, - return_value); + status = acpi_ns_walk_namespace(ACPI_TYPE_DEVICE, + ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, + ACPI_NS_WALK_UNLOCK, + acpi_ns_get_device_callback, &info, + return_value); - (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); - return_ACPI_STATUS (status); + (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); + return_ACPI_STATUS(status); } -EXPORT_SYMBOL(acpi_get_devices); +EXPORT_SYMBOL(acpi_get_devices); /******************************************************************************* * @@ -625,44 +606,38 @@ EXPORT_SYMBOL(acpi_get_devices); ******************************************************************************/ acpi_status -acpi_attach_data ( - acpi_handle obj_handle, - acpi_object_handler handler, - void *data) +acpi_attach_data(acpi_handle obj_handle, + acpi_object_handler handler, void *data) { - struct acpi_namespace_node *node; - acpi_status status; - + struct acpi_namespace_node *node; + acpi_status status; /* Parameter validation */ - if (!obj_handle || - !handler || - !data) { + if (!obj_handle || !handler || !data) { return (AE_BAD_PARAMETER); } - status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (status)) { + status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE(status)) { return (status); } /* Convert and validate the handle */ - node = acpi_ns_map_handle_to_node (obj_handle); + node = acpi_ns_map_handle_to_node(obj_handle); if (!node) { status = AE_BAD_PARAMETER; goto unlock_and_exit; } - status = acpi_ns_attach_data (node, handler, data); + status = acpi_ns_attach_data(node, handler, data); -unlock_and_exit: - (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); + unlock_and_exit: + (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); return (status); } - /******************************************************************************* * * FUNCTION: acpi_detach_data @@ -677,42 +652,37 @@ unlock_and_exit: ******************************************************************************/ acpi_status -acpi_detach_data ( - acpi_handle obj_handle, - acpi_object_handler handler) +acpi_detach_data(acpi_handle obj_handle, acpi_object_handler handler) { - struct acpi_namespace_node *node; - acpi_status status; - + struct acpi_namespace_node *node; + acpi_status status; /* Parameter validation */ - if (!obj_handle || - !handler) { + if (!obj_handle || !handler) { return (AE_BAD_PARAMETER); } - status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (status)) { + status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE(status)) { return (status); } /* Convert and validate the handle */ - node = acpi_ns_map_handle_to_node (obj_handle); + node = acpi_ns_map_handle_to_node(obj_handle); if (!node) { status = AE_BAD_PARAMETER; goto unlock_and_exit; } - status = acpi_ns_detach_data (node, handler); + status = acpi_ns_detach_data(node, handler); -unlock_and_exit: - (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); + unlock_and_exit: + (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); return (status); } - /******************************************************************************* * * FUNCTION: acpi_get_data @@ -728,41 +698,33 @@ unlock_and_exit: ******************************************************************************/ acpi_status -acpi_get_data ( - acpi_handle obj_handle, - acpi_object_handler handler, - void **data) +acpi_get_data(acpi_handle obj_handle, acpi_object_handler handler, void **data) { - struct acpi_namespace_node *node; - acpi_status status; - + struct acpi_namespace_node *node; + acpi_status status; /* Parameter validation */ - if (!obj_handle || - !handler || - !data) { + if (!obj_handle || !handler || !data) { return (AE_BAD_PARAMETER); } - status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (status)) { + status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE(status)) { return (status); } /* Convert and validate the handle */ - node = acpi_ns_map_handle_to_node (obj_handle); + node = acpi_ns_map_handle_to_node(obj_handle); if (!node) { status = AE_BAD_PARAMETER; goto unlock_and_exit; } - status = acpi_ns_get_attached_data (node, handler, data); + status = acpi_ns_get_attached_data(node, handler, data); -unlock_and_exit: - (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); + unlock_and_exit: + (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); return (status); } - - diff --git a/drivers/acpi/namespace/nsxfname.c b/drivers/acpi/namespace/nsxfname.c index 8d097914c49..6b5f8d4481d 100644 --- a/drivers/acpi/namespace/nsxfname.c +++ b/drivers/acpi/namespace/nsxfname.c @@ -47,10 +47,8 @@ #include #include - #define _COMPONENT ACPI_NAMESPACE - ACPI_MODULE_NAME ("nsxfname") - +ACPI_MODULE_NAME("nsxfname") /****************************************************************************** * @@ -69,20 +67,15 @@ * namespace handle. * ******************************************************************************/ - acpi_status -acpi_get_handle ( - acpi_handle parent, - acpi_string pathname, - acpi_handle *ret_handle) +acpi_get_handle(acpi_handle parent, + acpi_string pathname, acpi_handle * ret_handle) { - acpi_status status; - struct acpi_namespace_node *node = NULL; - struct acpi_namespace_node *prefix_node = NULL; - - - ACPI_FUNCTION_ENTRY (); + acpi_status status; + struct acpi_namespace_node *node = NULL; + struct acpi_namespace_node *prefix_node = NULL; + ACPI_FUNCTION_ENTRY(); /* Parameter Validation */ @@ -93,45 +86,47 @@ acpi_get_handle ( /* Convert a parent handle to a prefix node */ if (parent) { - status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (status)) { + status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE(status)) { return (status); } - prefix_node = acpi_ns_map_handle_to_node (parent); + prefix_node = acpi_ns_map_handle_to_node(parent); if (!prefix_node) { - (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); + (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); return (AE_BAD_PARAMETER); } - status = acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (status)) { + status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE(status)) { return (status); } } /* Special case for root, since we can't search for it */ - if (ACPI_STRCMP (pathname, ACPI_NS_ROOT_PATH) == 0) { - *ret_handle = acpi_ns_convert_entry_to_handle (acpi_gbl_root_node); + if (ACPI_STRCMP(pathname, ACPI_NS_ROOT_PATH) == 0) { + *ret_handle = + acpi_ns_convert_entry_to_handle(acpi_gbl_root_node); return (AE_OK); } /* * Find the Node and convert to a handle */ - status = acpi_ns_get_node_by_path (pathname, prefix_node, ACPI_NS_NO_UPSEARCH, - &node); + status = + acpi_ns_get_node_by_path(pathname, prefix_node, ACPI_NS_NO_UPSEARCH, + &node); *ret_handle = NULL; - if (ACPI_SUCCESS (status)) { - *ret_handle = acpi_ns_convert_entry_to_handle (node); + if (ACPI_SUCCESS(status)) { + *ret_handle = acpi_ns_convert_entry_to_handle(node); } return (status); } -EXPORT_SYMBOL(acpi_get_handle); +EXPORT_SYMBOL(acpi_get_handle); /****************************************************************************** * @@ -150,14 +145,10 @@ EXPORT_SYMBOL(acpi_get_handle); ******************************************************************************/ acpi_status -acpi_get_name ( - acpi_handle handle, - u32 name_type, - struct acpi_buffer *buffer) +acpi_get_name(acpi_handle handle, u32 name_type, struct acpi_buffer * buffer) { - acpi_status status; - struct acpi_namespace_node *node; - + acpi_status status; + struct acpi_namespace_node *node; /* Parameter validation */ @@ -165,15 +156,15 @@ acpi_get_name ( return (AE_BAD_PARAMETER); } - status = acpi_ut_validate_buffer (buffer); - if (ACPI_FAILURE (status)) { + status = acpi_ut_validate_buffer(buffer); + if (ACPI_FAILURE(status)) { return (status); } if (name_type == ACPI_FULL_PATHNAME) { /* Get the full pathname (From the namespace root) */ - status = acpi_ns_handle_to_pathname (handle, buffer); + status = acpi_ns_handle_to_pathname(handle, buffer); return (status); } @@ -181,12 +172,12 @@ acpi_get_name ( * Wants the single segment ACPI name. * Validate handle and convert to a namespace Node */ - status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (status)) { + status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE(status)) { return (status); } - node = acpi_ns_map_handle_to_node (handle); + node = acpi_ns_map_handle_to_node(handle); if (!node) { status = AE_BAD_PARAMETER; goto unlock_and_exit; @@ -194,26 +185,25 @@ acpi_get_name ( /* Validate/Allocate/Clear caller buffer */ - status = acpi_ut_initialize_buffer (buffer, ACPI_PATH_SEGMENT_LENGTH); - if (ACPI_FAILURE (status)) { + status = acpi_ut_initialize_buffer(buffer, ACPI_PATH_SEGMENT_LENGTH); + if (ACPI_FAILURE(status)) { goto unlock_and_exit; } /* Just copy the ACPI name from the Node and zero terminate it */ - ACPI_STRNCPY (buffer->pointer, acpi_ut_get_node_name (node), - ACPI_NAME_SIZE); - ((char *) buffer->pointer) [ACPI_NAME_SIZE] = 0; + ACPI_STRNCPY(buffer->pointer, acpi_ut_get_node_name(node), + ACPI_NAME_SIZE); + ((char *)buffer->pointer)[ACPI_NAME_SIZE] = 0; status = AE_OK; + unlock_and_exit: -unlock_and_exit: - - (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); + (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); return (status); } -EXPORT_SYMBOL(acpi_get_name); +EXPORT_SYMBOL(acpi_get_name); /****************************************************************************** * @@ -231,17 +221,14 @@ EXPORT_SYMBOL(acpi_get_name); ******************************************************************************/ acpi_status -acpi_get_object_info ( - acpi_handle handle, - struct acpi_buffer *buffer) +acpi_get_object_info(acpi_handle handle, struct acpi_buffer * buffer) { - acpi_status status; - struct acpi_namespace_node *node; - struct acpi_device_info *info; - struct acpi_device_info *return_info; + acpi_status status; + struct acpi_namespace_node *node; + struct acpi_device_info *info; + struct acpi_device_info *return_info; struct acpi_compatible_id_list *cid_list = NULL; - acpi_size size; - + acpi_size size; /* Parameter validation */ @@ -249,37 +236,37 @@ acpi_get_object_info ( return (AE_BAD_PARAMETER); } - status = acpi_ut_validate_buffer (buffer); - if (ACPI_FAILURE (status)) { + status = acpi_ut_validate_buffer(buffer); + if (ACPI_FAILURE(status)) { return (status); } - info = ACPI_MEM_CALLOCATE (sizeof (struct acpi_device_info)); + info = ACPI_MEM_CALLOCATE(sizeof(struct acpi_device_info)); if (!info) { return (AE_NO_MEMORY); } - status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (status)) { + status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE(status)) { goto cleanup; } - node = acpi_ns_map_handle_to_node (handle); + node = acpi_ns_map_handle_to_node(handle); if (!node) { - (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); + (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); goto cleanup; } /* Init return structure */ - size = sizeof (struct acpi_device_info); + size = sizeof(struct acpi_device_info); - info->type = node->type; - info->name = node->name.integer; + info->type = node->type; + info->name = node->name.integer; info->valid = 0; - status = acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (status)) { + status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE(status)) { goto cleanup; } @@ -297,73 +284,73 @@ acpi_get_object_info ( /* Execute the Device._HID method */ - status = acpi_ut_execute_HID (node, &info->hardware_id); - if (ACPI_SUCCESS (status)) { + status = acpi_ut_execute_HID(node, &info->hardware_id); + if (ACPI_SUCCESS(status)) { info->valid |= ACPI_VALID_HID; } /* Execute the Device._UID method */ - status = acpi_ut_execute_UID (node, &info->unique_id); - if (ACPI_SUCCESS (status)) { + status = acpi_ut_execute_UID(node, &info->unique_id); + if (ACPI_SUCCESS(status)) { info->valid |= ACPI_VALID_UID; } /* Execute the Device._CID method */ - status = acpi_ut_execute_CID (node, &cid_list); - if (ACPI_SUCCESS (status)) { + status = acpi_ut_execute_CID(node, &cid_list); + if (ACPI_SUCCESS(status)) { size += ((acpi_size) cid_list->count - 1) * - sizeof (struct acpi_compatible_id); + sizeof(struct acpi_compatible_id); info->valid |= ACPI_VALID_CID; } /* Execute the Device._STA method */ - status = acpi_ut_execute_STA (node, &info->current_status); - if (ACPI_SUCCESS (status)) { + status = acpi_ut_execute_STA(node, &info->current_status); + if (ACPI_SUCCESS(status)) { info->valid |= ACPI_VALID_STA; } /* Execute the Device._ADR method */ - status = acpi_ut_evaluate_numeric_object (METHOD_NAME__ADR, node, - &info->address); - if (ACPI_SUCCESS (status)) { + status = acpi_ut_evaluate_numeric_object(METHOD_NAME__ADR, node, + &info->address); + if (ACPI_SUCCESS(status)) { info->valid |= ACPI_VALID_ADR; } /* Execute the Device._sx_d methods */ - status = acpi_ut_execute_sxds (node, info->highest_dstates); - if (ACPI_SUCCESS (status)) { + status = acpi_ut_execute_sxds(node, info->highest_dstates); + if (ACPI_SUCCESS(status)) { info->valid |= ACPI_VALID_SXDS; } } /* Validate/Allocate/Clear caller buffer */ - status = acpi_ut_initialize_buffer (buffer, size); - if (ACPI_FAILURE (status)) { + status = acpi_ut_initialize_buffer(buffer, size); + if (ACPI_FAILURE(status)) { goto cleanup; } /* Populate the return buffer */ return_info = buffer->pointer; - ACPI_MEMCPY (return_info, info, sizeof (struct acpi_device_info)); + ACPI_MEMCPY(return_info, info, sizeof(struct acpi_device_info)); if (cid_list) { - ACPI_MEMCPY (&return_info->compatibility_id, cid_list, cid_list->size); + ACPI_MEMCPY(&return_info->compatibility_id, cid_list, + cid_list->size); } - -cleanup: - ACPI_MEM_FREE (info); + cleanup: + ACPI_MEM_FREE(info); if (cid_list) { - ACPI_MEM_FREE (cid_list); + ACPI_MEM_FREE(cid_list); } return (status); } -EXPORT_SYMBOL(acpi_get_object_info); +EXPORT_SYMBOL(acpi_get_object_info); diff --git a/drivers/acpi/namespace/nsxfobj.c b/drivers/acpi/namespace/nsxfobj.c index 363e1f6cfb1..0856d42e690 100644 --- a/drivers/acpi/namespace/nsxfobj.c +++ b/drivers/acpi/namespace/nsxfobj.c @@ -47,9 +47,8 @@ #include #include - #define _COMPONENT ACPI_NAMESPACE - ACPI_MODULE_NAME ("nsxfobj") +ACPI_MODULE_NAME("nsxfobj") /******************************************************************************* * @@ -63,15 +62,10 @@ * DESCRIPTION: This routine returns the type associatd with a particular handle * ******************************************************************************/ - -acpi_status -acpi_get_type ( - acpi_handle handle, - acpi_object_type *ret_type) +acpi_status acpi_get_type(acpi_handle handle, acpi_object_type * ret_type) { - struct acpi_namespace_node *node; - acpi_status status; - + struct acpi_namespace_node *node; + acpi_status status; /* Parameter Validation */ @@ -88,27 +82,26 @@ acpi_get_type ( return (AE_OK); } - status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (status)) { + status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE(status)) { return (status); } /* Convert and validate the handle */ - node = acpi_ns_map_handle_to_node (handle); + node = acpi_ns_map_handle_to_node(handle); if (!node) { - (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); + (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); return (AE_BAD_PARAMETER); } *ret_type = node->type; - - status = acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); + status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); return (status); } -EXPORT_SYMBOL(acpi_get_type); +EXPORT_SYMBOL(acpi_get_type); /******************************************************************************* * @@ -124,14 +117,10 @@ EXPORT_SYMBOL(acpi_get_type); * ******************************************************************************/ -acpi_status -acpi_get_parent ( - acpi_handle handle, - acpi_handle *ret_handle) +acpi_status acpi_get_parent(acpi_handle handle, acpi_handle * ret_handle) { - struct acpi_namespace_node *node; - acpi_status status; - + struct acpi_namespace_node *node; + acpi_status status; if (!ret_handle) { return (AE_BAD_PARAMETER); @@ -143,14 +132,14 @@ acpi_get_parent ( return (AE_NULL_ENTRY); } - status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (status)) { + status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE(status)) { return (status); } /* Convert and validate the handle */ - node = acpi_ns_map_handle_to_node (handle); + node = acpi_ns_map_handle_to_node(handle); if (!node) { status = AE_BAD_PARAMETER; goto unlock_and_exit; @@ -159,22 +148,21 @@ acpi_get_parent ( /* Get the parent entry */ *ret_handle = - acpi_ns_convert_entry_to_handle (acpi_ns_get_parent_node (node)); + acpi_ns_convert_entry_to_handle(acpi_ns_get_parent_node(node)); /* Return exception if parent is null */ - if (!acpi_ns_get_parent_node (node)) { + if (!acpi_ns_get_parent_node(node)) { status = AE_NULL_ENTRY; } + unlock_and_exit: -unlock_and_exit: - - (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); + (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); return (status); } -EXPORT_SYMBOL(acpi_get_parent); +EXPORT_SYMBOL(acpi_get_parent); /******************************************************************************* * @@ -195,17 +183,14 @@ EXPORT_SYMBOL(acpi_get_parent); ******************************************************************************/ acpi_status -acpi_get_next_object ( - acpi_object_type type, - acpi_handle parent, - acpi_handle child, - acpi_handle *ret_handle) +acpi_get_next_object(acpi_object_type type, + acpi_handle parent, + acpi_handle child, acpi_handle * ret_handle) { - acpi_status status; - struct acpi_namespace_node *node; - struct acpi_namespace_node *parent_node = NULL; - struct acpi_namespace_node *child_node = NULL; - + acpi_status status; + struct acpi_namespace_node *node; + struct acpi_namespace_node *parent_node = NULL; + struct acpi_namespace_node *child_node = NULL; /* Parameter validation */ @@ -213,8 +198,8 @@ acpi_get_next_object ( return (AE_BAD_PARAMETER); } - status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (status)) { + status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE(status)) { return (status); } @@ -223,17 +208,16 @@ acpi_get_next_object ( if (!child) { /* Start search at the beginning of the specified scope */ - parent_node = acpi_ns_map_handle_to_node (parent); + parent_node = acpi_ns_map_handle_to_node(parent); if (!parent_node) { status = AE_BAD_PARAMETER; goto unlock_and_exit; } - } - else { + } else { /* Non-null handle, ignore the parent */ /* Convert and validate the handle */ - child_node = acpi_ns_map_handle_to_node (child); + child_node = acpi_ns_map_handle_to_node(child); if (!child_node) { status = AE_BAD_PARAMETER; goto unlock_and_exit; @@ -242,20 +226,19 @@ acpi_get_next_object ( /* Internal function does the real work */ - node = acpi_ns_get_next_node (type, parent_node, child_node); + node = acpi_ns_get_next_node(type, parent_node, child_node); if (!node) { status = AE_NOT_FOUND; goto unlock_and_exit; } if (ret_handle) { - *ret_handle = acpi_ns_convert_entry_to_handle (node); + *ret_handle = acpi_ns_convert_entry_to_handle(node); } + unlock_and_exit: -unlock_and_exit: - - (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); + (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); return (status); } diff --git a/drivers/acpi/numa.c b/drivers/acpi/numa.c index a82834b3275..64b98e82feb 100644 --- a/drivers/acpi/numa.c +++ b/drivers/acpi/numa.c @@ -34,16 +34,18 @@ #define ACPI_NUMA 0x80000000 #define _COMPONENT ACPI_NUMA - ACPI_MODULE_NAME ("numa") +ACPI_MODULE_NAME("numa") -extern int __init acpi_table_parse_madt_family (enum acpi_table_id id, unsigned long madt_size, int entry_id, acpi_madt_entry_handler handler, unsigned int max_entries); +extern int __init acpi_table_parse_madt_family(enum acpi_table_id id, + unsigned long madt_size, + int entry_id, + acpi_madt_entry_handler handler, + unsigned int max_entries); -void __init -acpi_table_print_srat_entry ( - acpi_table_entry_header *header) +void __init acpi_table_print_srat_entry(acpi_table_entry_header * header) { - ACPI_FUNCTION_NAME ("acpi_table_print_srat_entry"); + ACPI_FUNCTION_NAME("acpi_table_print_srat_entry"); if (!header) return; @@ -52,48 +54,55 @@ acpi_table_print_srat_entry ( case ACPI_SRAT_PROCESSOR_AFFINITY: #ifdef ACPI_DEBUG_OUTPUT - { - struct acpi_table_processor_affinity *p = - (struct acpi_table_processor_affinity*) header; - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "SRAT Processor (id[0x%02x] eid[0x%02x]) in proximity domain %d %s\n", - p->apic_id, p->lsapic_eid, p->proximity_domain, - p->flags.enabled?"enabled":"disabled")); - } -#endif /* ACPI_DEBUG_OUTPUT */ + { + struct acpi_table_processor_affinity *p = + (struct acpi_table_processor_affinity *)header; + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "SRAT Processor (id[0x%02x] eid[0x%02x]) in proximity domain %d %s\n", + p->apic_id, p->lsapic_eid, + p->proximity_domain, + p->flags. + enabled ? "enabled" : "disabled")); + } +#endif /* ACPI_DEBUG_OUTPUT */ break; case ACPI_SRAT_MEMORY_AFFINITY: #ifdef ACPI_DEBUG_OUTPUT - { - struct acpi_table_memory_affinity *p = - (struct acpi_table_memory_affinity*) header; - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "SRAT Memory (0x%08x%08x length 0x%08x%08x type 0x%x) in proximity domain %d %s%s\n", - p->base_addr_hi, p->base_addr_lo, p->length_hi, p->length_lo, - p->memory_type, p->proximity_domain, - p->flags.enabled ? "enabled" : "disabled", - p->flags.hot_pluggable ? " hot-pluggable" : "")); - } -#endif /* ACPI_DEBUG_OUTPUT */ + { + struct acpi_table_memory_affinity *p = + (struct acpi_table_memory_affinity *)header; + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "SRAT Memory (0x%08x%08x length 0x%08x%08x type 0x%x) in proximity domain %d %s%s\n", + p->base_addr_hi, p->base_addr_lo, + p->length_hi, p->length_lo, + p->memory_type, p->proximity_domain, + p->flags. + enabled ? "enabled" : "disabled", + p->flags. + hot_pluggable ? " hot-pluggable" : + "")); + } +#endif /* ACPI_DEBUG_OUTPUT */ break; default: - printk(KERN_WARNING PREFIX "Found unsupported SRAT entry (type = 0x%x)\n", - header->type); + printk(KERN_WARNING PREFIX + "Found unsupported SRAT entry (type = 0x%x)\n", + header->type); break; } } - -static int __init -acpi_parse_slit (unsigned long phys_addr, unsigned long size) +static int __init acpi_parse_slit(unsigned long phys_addr, unsigned long size) { - struct acpi_table_slit *slit; - u32 localities; + struct acpi_table_slit *slit; + u32 localities; if (!phys_addr || !size) return -EINVAL; - slit = (struct acpi_table_slit *) __va(phys_addr); + slit = (struct acpi_table_slit *)__va(phys_addr); /* downcast just for %llu vs %lu for i386/ia64 */ localities = (u32) slit->localities; @@ -103,15 +112,13 @@ acpi_parse_slit (unsigned long phys_addr, unsigned long size) return 0; } - static int __init -acpi_parse_processor_affinity ( - acpi_table_entry_header *header, - const unsigned long end) +acpi_parse_processor_affinity(acpi_table_entry_header * header, + const unsigned long end) { struct acpi_table_processor_affinity *processor_affinity; - processor_affinity = (struct acpi_table_processor_affinity*) header; + processor_affinity = (struct acpi_table_processor_affinity *)header; if (!processor_affinity) return -EINVAL; @@ -123,15 +130,13 @@ acpi_parse_processor_affinity ( return 0; } - static int __init -acpi_parse_memory_affinity ( - acpi_table_entry_header *header, - const unsigned long end) +acpi_parse_memory_affinity(acpi_table_entry_header * header, + const unsigned long end) { struct acpi_table_memory_affinity *memory_affinity; - memory_affinity = (struct acpi_table_memory_affinity*) header; + memory_affinity = (struct acpi_table_memory_affinity *)header; if (!memory_affinity) return -EINVAL; @@ -143,36 +148,30 @@ acpi_parse_memory_affinity ( return 0; } - -static int __init -acpi_parse_srat (unsigned long phys_addr, unsigned long size) +static int __init acpi_parse_srat(unsigned long phys_addr, unsigned long size) { - struct acpi_table_srat *srat; + struct acpi_table_srat *srat; if (!phys_addr || !size) return -EINVAL; - srat = (struct acpi_table_srat *) __va(phys_addr); + srat = (struct acpi_table_srat *)__va(phys_addr); return 0; } - int __init -acpi_table_parse_srat ( - enum acpi_srat_entry_id id, - acpi_madt_entry_handler handler, - unsigned int max_entries) +acpi_table_parse_srat(enum acpi_srat_entry_id id, + acpi_madt_entry_handler handler, unsigned int max_entries) { - return acpi_table_parse_madt_family(ACPI_SRAT, sizeof(struct acpi_table_srat), - id, handler, max_entries); + return acpi_table_parse_madt_family(ACPI_SRAT, + sizeof(struct acpi_table_srat), id, + handler, max_entries); } - -int __init -acpi_numa_init(void) +int __init acpi_numa_init(void) { - int result; + int result; /* SRAT: Static Resource Affinity Table */ result = acpi_table_parse(ACPI_SRAT, acpi_parse_srat); @@ -181,9 +180,7 @@ acpi_numa_init(void) result = acpi_table_parse_srat(ACPI_SRAT_PROCESSOR_AFFINITY, acpi_parse_processor_affinity, NR_CPUS); - result = acpi_table_parse_srat(ACPI_SRAT_MEMORY_AFFINITY, - acpi_parse_memory_affinity, - NR_NODE_MEMBLKS); // IA64 specific + result = acpi_table_parse_srat(ACPI_SRAT_MEMORY_AFFINITY, acpi_parse_memory_affinity, NR_NODE_MEMBLKS); // IA64 specific } /* SLIT: System Locality Information Table */ @@ -193,8 +190,7 @@ acpi_numa_init(void) return 0; } -int -acpi_get_pxm(acpi_handle h) +int acpi_get_pxm(acpi_handle h) { unsigned long pxm; acpi_status status; @@ -207,7 +203,8 @@ acpi_get_pxm(acpi_handle h) if (ACPI_SUCCESS(status)) return (int)pxm; status = acpi_get_parent(handle, &phandle); - } while(ACPI_SUCCESS(status)); + } while (ACPI_SUCCESS(status)); return -1; } + EXPORT_SYMBOL(acpi_get_pxm); diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index f3a807c342c..9127760d36c 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c @@ -45,16 +45,12 @@ #include - #define _COMPONENT ACPI_OS_SERVICES -ACPI_MODULE_NAME ("osl") - +ACPI_MODULE_NAME("osl") #define PREFIX "ACPI: " - -struct acpi_os_dpc -{ - acpi_osd_exec_callback function; - void *context; +struct acpi_os_dpc { + acpi_osd_exec_callback function; + void *context; }; #ifdef CONFIG_ACPI_CUSTOM_DSDT @@ -69,7 +65,7 @@ int acpi_in_debugger; EXPORT_SYMBOL(acpi_in_debugger); extern char line_buf[80]; -#endif /*ENABLE_DEBUGGER*/ +#endif /*ENABLE_DEBUGGER */ int acpi_specific_hotkey_enabled; EXPORT_SYMBOL(acpi_specific_hotkey_enabled); @@ -79,14 +75,12 @@ static acpi_osd_handler acpi_irq_handler; static void *acpi_irq_context; static struct workqueue_struct *kacpid_wq; -acpi_status -acpi_os_initialize(void) +acpi_status acpi_os_initialize(void) { return AE_OK; } -acpi_status -acpi_os_initialize1(void) +acpi_status acpi_os_initialize1(void) { /* * Initialize PCI configuration space access, as we'll need to access @@ -94,7 +88,8 @@ acpi_os_initialize1(void) */ #ifdef CONFIG_ACPI_PCI if (!raw_pci_ops) { - printk(KERN_ERR PREFIX "Access to PCI configuration space unavailable\n"); + printk(KERN_ERR PREFIX + "Access to PCI configuration space unavailable\n"); return AE_NULL_ENTRY; } #endif @@ -104,8 +99,7 @@ acpi_os_initialize1(void) return AE_OK; } -acpi_status -acpi_os_terminate(void) +acpi_status acpi_os_terminate(void) { if (acpi_irq_handler) { acpi_os_remove_interrupt_handler(acpi_irq_irq, @@ -117,21 +111,20 @@ acpi_os_terminate(void) return AE_OK; } -void -acpi_os_printf(const char *fmt,...) +void acpi_os_printf(const char *fmt, ...) { va_list args; va_start(args, fmt); acpi_os_vprintf(fmt, args); va_end(args); } + EXPORT_SYMBOL(acpi_os_printf); -void -acpi_os_vprintf(const char *fmt, va_list args) +void acpi_os_vprintf(const char *fmt, va_list args) { static char buffer[512]; - + vsprintf(buffer, fmt, args); #ifdef ENABLE_DEBUGGER @@ -146,8 +139,7 @@ acpi_os_vprintf(const char *fmt, va_list args) } extern int acpi_in_resume; -void * -acpi_os_allocate(acpi_size size) +void *acpi_os_allocate(acpi_size size) { if (acpi_in_resume) return kmalloc(size, GFP_ATOMIC); @@ -155,31 +147,32 @@ acpi_os_allocate(acpi_size size) return kmalloc(size, GFP_KERNEL); } -void -acpi_os_free(void *ptr) +void acpi_os_free(void *ptr) { kfree(ptr); } + EXPORT_SYMBOL(acpi_os_free); -acpi_status -acpi_os_get_root_pointer(u32 flags, struct acpi_pointer *addr) +acpi_status acpi_os_get_root_pointer(u32 flags, struct acpi_pointer *addr) { if (efi_enabled) { addr->pointer_type = ACPI_PHYSICAL_POINTER; if (efi.acpi20) addr->pointer.physical = - (acpi_physical_address) virt_to_phys(efi.acpi20); + (acpi_physical_address) virt_to_phys(efi.acpi20); else if (efi.acpi) addr->pointer.physical = - (acpi_physical_address) virt_to_phys(efi.acpi); + (acpi_physical_address) virt_to_phys(efi.acpi); else { - printk(KERN_ERR PREFIX "System description tables not found\n"); + printk(KERN_ERR PREFIX + "System description tables not found\n"); return AE_NOT_FOUND; } } else { if (ACPI_FAILURE(acpi_find_root_pointer(flags, addr))) { - printk(KERN_ERR PREFIX "System description tables not found\n"); + printk(KERN_ERR PREFIX + "System description tables not found\n"); return AE_NOT_FOUND; } } @@ -188,11 +181,12 @@ acpi_os_get_root_pointer(u32 flags, struct acpi_pointer *addr) } acpi_status -acpi_os_map_memory(acpi_physical_address phys, acpi_size size, void __iomem **virt) +acpi_os_map_memory(acpi_physical_address phys, acpi_size size, + void __iomem ** virt) { if (efi_enabled) { if (EFI_MEMORY_WB & efi_mem_attributes(phys)) { - *virt = (void __iomem *) phys_to_virt(phys); + *virt = (void __iomem *)phys_to_virt(phys); } else { *virt = ioremap(phys, size); } @@ -202,9 +196,9 @@ acpi_os_map_memory(acpi_physical_address phys, acpi_size size, void __iomem **vi return AE_BAD_PARAMETER; } /* - * ioremap checks to ensure this is in reserved space - */ - *virt = ioremap((unsigned long) phys, size); + * ioremap checks to ensure this is in reserved space + */ + *virt = ioremap((unsigned long)phys, size); } if (!*virt) @@ -213,17 +207,16 @@ acpi_os_map_memory(acpi_physical_address phys, acpi_size size, void __iomem **vi return AE_OK; } -void -acpi_os_unmap_memory(void __iomem *virt, acpi_size size) +void acpi_os_unmap_memory(void __iomem * virt, acpi_size size) { iounmap(virt); } #ifdef ACPI_FUTURE_USAGE acpi_status -acpi_os_get_physical_address(void *virt, acpi_physical_address *phys) +acpi_os_get_physical_address(void *virt, acpi_physical_address * phys) { - if(!phys || !virt) + if (!phys || !virt) return AE_BAD_PARAMETER; *phys = virt_to_phys(virt); @@ -237,16 +230,16 @@ acpi_os_get_physical_address(void *virt, acpi_physical_address *phys) static char acpi_os_name[ACPI_MAX_OVERRIDE_LEN]; acpi_status -acpi_os_predefined_override (const struct acpi_predefined_names *init_val, - acpi_string *new_val) +acpi_os_predefined_override(const struct acpi_predefined_names *init_val, + acpi_string * new_val) { if (!init_val || !new_val) return AE_BAD_PARAMETER; *new_val = NULL; - if (!memcmp (init_val->name, "_OS_", 4) && strlen(acpi_os_name)) { + if (!memcmp(init_val->name, "_OS_", 4) && strlen(acpi_os_name)) { printk(KERN_INFO PREFIX "Overriding _OS definition to '%s'\n", - acpi_os_name); + acpi_os_name); *new_val = acpi_os_name; } @@ -254,15 +247,15 @@ acpi_os_predefined_override (const struct acpi_predefined_names *init_val, } acpi_status -acpi_os_table_override (struct acpi_table_header *existing_table, - struct acpi_table_header **new_table) +acpi_os_table_override(struct acpi_table_header * existing_table, + struct acpi_table_header ** new_table) { if (!existing_table || !new_table) return AE_BAD_PARAMETER; #ifdef CONFIG_ACPI_CUSTOM_DSDT if (strncmp(existing_table->signature, "DSDT", 4) == 0) - *new_table = (struct acpi_table_header*)AmlCode; + *new_table = (struct acpi_table_header *)AmlCode; else *new_table = NULL; #else @@ -271,14 +264,14 @@ acpi_os_table_override (struct acpi_table_header *existing_table, return AE_OK; } -static irqreturn_t -acpi_irq(int irq, void *dev_id, struct pt_regs *regs) +static irqreturn_t acpi_irq(int irq, void *dev_id, struct pt_regs *regs) { - return (*acpi_irq_handler)(acpi_irq_context) ? IRQ_HANDLED : IRQ_NONE; + return (*acpi_irq_handler) (acpi_irq_context) ? IRQ_HANDLED : IRQ_NONE; } acpi_status -acpi_os_install_interrupt_handler(u32 gsi, acpi_osd_handler handler, void *context) +acpi_os_install_interrupt_handler(u32 gsi, acpi_osd_handler handler, + void *context) { unsigned int irq; @@ -305,8 +298,7 @@ acpi_os_install_interrupt_handler(u32 gsi, acpi_osd_handler handler, void *conte return AE_OK; } -acpi_status -acpi_os_remove_interrupt_handler(u32 irq, acpi_osd_handler handler) +acpi_status acpi_os_remove_interrupt_handler(u32 irq, acpi_osd_handler handler) { if (irq) { free_irq(irq, acpi_irq); @@ -321,16 +313,15 @@ acpi_os_remove_interrupt_handler(u32 irq, acpi_osd_handler handler) * Running in interpreter thread context, safe to sleep */ -void -acpi_os_sleep(acpi_integer ms) +void acpi_os_sleep(acpi_integer ms) { current->state = TASK_INTERRUPTIBLE; - schedule_timeout(((signed long) ms * HZ) / 1000); + schedule_timeout(((signed long)ms * HZ) / 1000); } + EXPORT_SYMBOL(acpi_os_sleep); -void -acpi_os_stall(u32 us) +void acpi_os_stall(u32 us) { while (us) { u32 delay = 1000; @@ -342,6 +333,7 @@ acpi_os_stall(u32 us) us -= delay; } } + EXPORT_SYMBOL(acpi_os_stall); /* @@ -349,8 +341,7 @@ EXPORT_SYMBOL(acpi_os_stall); * Returns 64-bit free-running, monotonically increasing timer * with 100ns granularity */ -u64 -acpi_os_get_timer (void) +u64 acpi_os_get_timer(void) { static u64 t; @@ -367,27 +358,22 @@ acpi_os_get_timer (void) return ++t; } -acpi_status -acpi_os_read_port( - acpi_io_address port, - u32 *value, - u32 width) +acpi_status acpi_os_read_port(acpi_io_address port, u32 * value, u32 width) { u32 dummy; if (!value) value = &dummy; - switch (width) - { + switch (width) { case 8: - *(u8*) value = inb(port); + *(u8 *) value = inb(port); break; case 16: - *(u16*) value = inw(port); + *(u16 *) value = inw(port); break; case 32: - *(u32*) value = inl(port); + *(u32 *) value = inl(port); break; default: BUG(); @@ -395,16 +381,12 @@ acpi_os_read_port( return AE_OK; } + EXPORT_SYMBOL(acpi_os_read_port); -acpi_status -acpi_os_write_port( - acpi_io_address port, - u32 value, - u32 width) +acpi_status acpi_os_write_port(acpi_io_address port, u32 value, u32 width) { - switch (width) - { + switch (width) { case 8: outb(value, port); break; @@ -420,40 +402,38 @@ acpi_os_write_port( return AE_OK; } + EXPORT_SYMBOL(acpi_os_write_port); acpi_status -acpi_os_read_memory( - acpi_physical_address phys_addr, - u32 *value, - u32 width) +acpi_os_read_memory(acpi_physical_address phys_addr, u32 * value, u32 width) { - u32 dummy; - void __iomem *virt_addr; - int iomem = 0; + u32 dummy; + void __iomem *virt_addr; + int iomem = 0; if (efi_enabled) { if (EFI_MEMORY_WB & efi_mem_attributes(phys_addr)) { /* HACK ALERT! We can use readb/w/l on real memory too.. */ - virt_addr = (void __iomem *) phys_to_virt(phys_addr); + virt_addr = (void __iomem *)phys_to_virt(phys_addr); } else { iomem = 1; virt_addr = ioremap(phys_addr, width); } } else - virt_addr = (void __iomem *) phys_to_virt(phys_addr); + virt_addr = (void __iomem *)phys_to_virt(phys_addr); if (!value) value = &dummy; switch (width) { case 8: - *(u8*) value = readb(virt_addr); + *(u8 *) value = readb(virt_addr); break; case 16: - *(u16*) value = readw(virt_addr); + *(u16 *) value = readw(virt_addr); break; case 32: - *(u32*) value = readl(virt_addr); + *(u32 *) value = readl(virt_addr); break; default: BUG(); @@ -468,24 +448,21 @@ acpi_os_read_memory( } acpi_status -acpi_os_write_memory( - acpi_physical_address phys_addr, - u32 value, - u32 width) +acpi_os_write_memory(acpi_physical_address phys_addr, u32 value, u32 width) { - void __iomem *virt_addr; - int iomem = 0; + void __iomem *virt_addr; + int iomem = 0; if (efi_enabled) { if (EFI_MEMORY_WB & efi_mem_attributes(phys_addr)) { /* HACK ALERT! We can use writeb/w/l on real memory too */ - virt_addr = (void __iomem *) phys_to_virt(phys_addr); + virt_addr = (void __iomem *)phys_to_virt(phys_addr); } else { iomem = 1; virt_addr = ioremap(phys_addr, width); } } else - virt_addr = (void __iomem *) phys_to_virt(phys_addr); + virt_addr = (void __iomem *)phys_to_virt(phys_addr); switch (width) { case 8: @@ -510,7 +487,8 @@ acpi_os_write_memory( #ifdef CONFIG_ACPI_PCI acpi_status -acpi_os_read_pci_configuration (struct acpi_pci_id *pci_id, u32 reg, void *value, u32 width) +acpi_os_read_pci_configuration(struct acpi_pci_id * pci_id, u32 reg, + void *value, u32 width) { int result, size; @@ -534,15 +512,17 @@ acpi_os_read_pci_configuration (struct acpi_pci_id *pci_id, u32 reg, void *value BUG_ON(!raw_pci_ops); result = raw_pci_ops->read(pci_id->segment, pci_id->bus, - PCI_DEVFN(pci_id->device, pci_id->function), - reg, size, value); + PCI_DEVFN(pci_id->device, pci_id->function), + reg, size, value); return (result ? AE_ERROR : AE_OK); } + EXPORT_SYMBOL(acpi_os_read_pci_configuration); acpi_status -acpi_os_write_pci_configuration (struct acpi_pci_id *pci_id, u32 reg, acpi_integer value, u32 width) +acpi_os_write_pci_configuration(struct acpi_pci_id * pci_id, u32 reg, + acpi_integer value, u32 width) { int result, size; @@ -563,56 +543,62 @@ acpi_os_write_pci_configuration (struct acpi_pci_id *pci_id, u32 reg, acpi_integ BUG_ON(!raw_pci_ops); result = raw_pci_ops->write(pci_id->segment, pci_id->bus, - PCI_DEVFN(pci_id->device, pci_id->function), - reg, size, value); + PCI_DEVFN(pci_id->device, pci_id->function), + reg, size, value); return (result ? AE_ERROR : AE_OK); } /* TODO: Change code to take advantage of driver model more */ -static void -acpi_os_derive_pci_id_2 ( - acpi_handle rhandle, /* upper bound */ - acpi_handle chandle, /* current node */ - struct acpi_pci_id **id, - int *is_bridge, - u8 *bus_number) +static void acpi_os_derive_pci_id_2(acpi_handle rhandle, /* upper bound */ + acpi_handle chandle, /* current node */ + struct acpi_pci_id **id, + int *is_bridge, u8 * bus_number) { - acpi_handle handle; - struct acpi_pci_id *pci_id = *id; - acpi_status status; - unsigned long temp; - acpi_object_type type; - u8 tu8; + acpi_handle handle; + struct acpi_pci_id *pci_id = *id; + acpi_status status; + unsigned long temp; + acpi_object_type type; + u8 tu8; acpi_get_parent(chandle, &handle); if (handle != rhandle) { - acpi_os_derive_pci_id_2(rhandle, handle, &pci_id, is_bridge, bus_number); + acpi_os_derive_pci_id_2(rhandle, handle, &pci_id, is_bridge, + bus_number); status = acpi_get_type(handle, &type); - if ( (ACPI_FAILURE(status)) || (type != ACPI_TYPE_DEVICE) ) + if ((ACPI_FAILURE(status)) || (type != ACPI_TYPE_DEVICE)) return; - status = acpi_evaluate_integer(handle, METHOD_NAME__ADR, NULL, &temp); + status = + acpi_evaluate_integer(handle, METHOD_NAME__ADR, NULL, + &temp); if (ACPI_SUCCESS(status)) { - pci_id->device = ACPI_HIWORD (ACPI_LODWORD (temp)); - pci_id->function = ACPI_LOWORD (ACPI_LODWORD (temp)); + pci_id->device = ACPI_HIWORD(ACPI_LODWORD(temp)); + pci_id->function = ACPI_LOWORD(ACPI_LODWORD(temp)); if (*is_bridge) pci_id->bus = *bus_number; /* any nicer way to get bus number of bridge ? */ - status = acpi_os_read_pci_configuration(pci_id, 0x0e, &tu8, 8); - if (ACPI_SUCCESS(status) && - ((tu8 & 0x7f) == 1 || (tu8 & 0x7f) == 2)) { - status = acpi_os_read_pci_configuration(pci_id, 0x18, &tu8, 8); + status = + acpi_os_read_pci_configuration(pci_id, 0x0e, &tu8, + 8); + if (ACPI_SUCCESS(status) + && ((tu8 & 0x7f) == 1 || (tu8 & 0x7f) == 2)) { + status = + acpi_os_read_pci_configuration(pci_id, 0x18, + &tu8, 8); if (!ACPI_SUCCESS(status)) { /* Certainly broken... FIX ME */ return; } *is_bridge = 1; pci_id->bus = tu8; - status = acpi_os_read_pci_configuration(pci_id, 0x19, &tu8, 8); + status = + acpi_os_read_pci_configuration(pci_id, 0x19, + &tu8, 8); if (ACPI_SUCCESS(status)) { *bus_number = tu8; } @@ -622,11 +608,9 @@ acpi_os_derive_pci_id_2 ( } } -void -acpi_os_derive_pci_id ( - acpi_handle rhandle, /* upper bound */ - acpi_handle chandle, /* current node */ - struct acpi_pci_id **id) +void acpi_os_derive_pci_id(acpi_handle rhandle, /* upper bound */ + acpi_handle chandle, /* current node */ + struct acpi_pci_id **id) { int is_bridge = 1; u8 bus_number = (*id)->bus; @@ -634,49 +618,39 @@ acpi_os_derive_pci_id ( acpi_os_derive_pci_id_2(rhandle, chandle, id, &is_bridge, &bus_number); } -#else /*!CONFIG_ACPI_PCI*/ +#else /*!CONFIG_ACPI_PCI */ acpi_status -acpi_os_write_pci_configuration ( - struct acpi_pci_id *pci_id, - u32 reg, - acpi_integer value, - u32 width) +acpi_os_write_pci_configuration(struct acpi_pci_id * pci_id, + u32 reg, acpi_integer value, u32 width) { return AE_SUPPORT; } acpi_status -acpi_os_read_pci_configuration ( - struct acpi_pci_id *pci_id, - u32 reg, - void *value, - u32 width) +acpi_os_read_pci_configuration(struct acpi_pci_id * pci_id, + u32 reg, void *value, u32 width) { return AE_SUPPORT; } -void -acpi_os_derive_pci_id ( - acpi_handle rhandle, /* upper bound */ - acpi_handle chandle, /* current node */ - struct acpi_pci_id **id) +void acpi_os_derive_pci_id(acpi_handle rhandle, /* upper bound */ + acpi_handle chandle, /* current node */ + struct acpi_pci_id **id) { } -#endif /*CONFIG_ACPI_PCI*/ +#endif /*CONFIG_ACPI_PCI */ -static void -acpi_os_execute_deferred ( - void *context) +static void acpi_os_execute_deferred(void *context) { - struct acpi_os_dpc *dpc = NULL; + struct acpi_os_dpc *dpc = NULL; - ACPI_FUNCTION_TRACE ("os_execute_deferred"); + ACPI_FUNCTION_TRACE("os_execute_deferred"); - dpc = (struct acpi_os_dpc *) context; + dpc = (struct acpi_os_dpc *)context; if (!dpc) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid (NULL) context.\n")); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid (NULL) context.\n")); return_VOID; } @@ -688,21 +662,21 @@ acpi_os_execute_deferred ( } acpi_status -acpi_os_queue_for_execution( - u32 priority, - acpi_osd_exec_callback function, - void *context) +acpi_os_queue_for_execution(u32 priority, + acpi_osd_exec_callback function, void *context) { - acpi_status status = AE_OK; - struct acpi_os_dpc *dpc; - struct work_struct *task; + acpi_status status = AE_OK; + struct acpi_os_dpc *dpc; + struct work_struct *task; - ACPI_FUNCTION_TRACE ("os_queue_for_execution"); + ACPI_FUNCTION_TRACE("os_queue_for_execution"); - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Scheduling function [%p(%p)] for deferred execution.\n", function, context)); + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, + "Scheduling function [%p(%p)] for deferred execution.\n", + function, context)); if (!function) - return_ACPI_STATUS (AE_BAD_PARAMETER); + return_ACPI_STATUS(AE_BAD_PARAMETER); /* * Allocate/initialize DPC structure. Note that this memory will be @@ -715,67 +689,65 @@ acpi_os_queue_for_execution( * from the same memory. */ - dpc = kmalloc(sizeof(struct acpi_os_dpc)+sizeof(struct work_struct), GFP_ATOMIC); + dpc = + kmalloc(sizeof(struct acpi_os_dpc) + sizeof(struct work_struct), + GFP_ATOMIC); if (!dpc) - return_ACPI_STATUS (AE_NO_MEMORY); + return_ACPI_STATUS(AE_NO_MEMORY); dpc->function = function; dpc->context = context; - task = (void *)(dpc+1); - INIT_WORK(task, acpi_os_execute_deferred, (void*)dpc); + task = (void *)(dpc + 1); + INIT_WORK(task, acpi_os_execute_deferred, (void *)dpc); if (!queue_work(kacpid_wq, task)) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Call to queue_work() failed.\n")); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Call to queue_work() failed.\n")); kfree(dpc); status = AE_ERROR; } - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } + EXPORT_SYMBOL(acpi_os_queue_for_execution); -void -acpi_os_wait_events_complete( - void *context) +void acpi_os_wait_events_complete(void *context) { flush_workqueue(kacpid_wq); } + EXPORT_SYMBOL(acpi_os_wait_events_complete); /* * Allocate the memory for a spinlock and initialize it. */ -acpi_status -acpi_os_create_lock ( - acpi_handle *out_handle) +acpi_status acpi_os_create_lock(acpi_handle * out_handle) { spinlock_t *lock_ptr; - ACPI_FUNCTION_TRACE ("os_create_lock"); + ACPI_FUNCTION_TRACE("os_create_lock"); lock_ptr = acpi_os_allocate(sizeof(spinlock_t)); spin_lock_init(lock_ptr); - ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Creating spinlock[%p].\n", lock_ptr)); + ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Creating spinlock[%p].\n", lock_ptr)); *out_handle = lock_ptr; - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - /* * Deallocate the memory for a spinlock. */ -void -acpi_os_delete_lock ( - acpi_handle handle) +void acpi_os_delete_lock(acpi_handle handle) { - ACPI_FUNCTION_TRACE ("os_create_lock"); + ACPI_FUNCTION_TRACE("os_create_lock"); - ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Deleting spinlock[%p].\n", handle)); + ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Deleting spinlock[%p].\n", handle)); acpi_os_free(handle); @@ -783,30 +755,28 @@ acpi_os_delete_lock ( } acpi_status -acpi_os_create_semaphore( - u32 max_units, - u32 initial_units, - acpi_handle *handle) +acpi_os_create_semaphore(u32 max_units, u32 initial_units, acpi_handle * handle) { - struct semaphore *sem = NULL; + struct semaphore *sem = NULL; - ACPI_FUNCTION_TRACE ("os_create_semaphore"); + ACPI_FUNCTION_TRACE("os_create_semaphore"); sem = acpi_os_allocate(sizeof(struct semaphore)); if (!sem) - return_ACPI_STATUS (AE_NO_MEMORY); + return_ACPI_STATUS(AE_NO_MEMORY); memset(sem, 0, sizeof(struct semaphore)); sema_init(sem, initial_units); - *handle = (acpi_handle*)sem; + *handle = (acpi_handle *) sem; - ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Creating semaphore[%p|%d].\n", *handle, initial_units)); + ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Creating semaphore[%p|%d].\n", + *handle, initial_units)); - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } -EXPORT_SYMBOL(acpi_os_create_semaphore); +EXPORT_SYMBOL(acpi_os_create_semaphore); /* * TODO: A better way to delete semaphores? Linux doesn't have a @@ -815,25 +785,24 @@ EXPORT_SYMBOL(acpi_os_create_semaphore); * we at least check for blocked threads and signal/cancel them? */ -acpi_status -acpi_os_delete_semaphore( - acpi_handle handle) +acpi_status acpi_os_delete_semaphore(acpi_handle handle) { - struct semaphore *sem = (struct semaphore*) handle; + struct semaphore *sem = (struct semaphore *)handle; - ACPI_FUNCTION_TRACE ("os_delete_semaphore"); + ACPI_FUNCTION_TRACE("os_delete_semaphore"); if (!sem) - return_ACPI_STATUS (AE_BAD_PARAMETER); + return_ACPI_STATUS(AE_BAD_PARAMETER); - ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Deleting semaphore[%p].\n", handle)); + ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Deleting semaphore[%p].\n", handle)); - acpi_os_free(sem); sem = NULL; + acpi_os_free(sem); + sem = NULL; - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } -EXPORT_SYMBOL(acpi_os_delete_semaphore); +EXPORT_SYMBOL(acpi_os_delete_semaphore); /* * TODO: The kernel doesn't have a 'down_timeout' function -- had to @@ -844,31 +813,27 @@ EXPORT_SYMBOL(acpi_os_delete_semaphore); * * TODO: Support for units > 1? */ -acpi_status -acpi_os_wait_semaphore( - acpi_handle handle, - u32 units, - u16 timeout) +acpi_status acpi_os_wait_semaphore(acpi_handle handle, u32 units, u16 timeout) { - acpi_status status = AE_OK; - struct semaphore *sem = (struct semaphore*)handle; - int ret = 0; + acpi_status status = AE_OK; + struct semaphore *sem = (struct semaphore *)handle; + int ret = 0; - ACPI_FUNCTION_TRACE ("os_wait_semaphore"); + ACPI_FUNCTION_TRACE("os_wait_semaphore"); if (!sem || (units < 1)) - return_ACPI_STATUS (AE_BAD_PARAMETER); + return_ACPI_STATUS(AE_BAD_PARAMETER); if (units > 1) - return_ACPI_STATUS (AE_SUPPORT); + return_ACPI_STATUS(AE_SUPPORT); - ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Waiting for semaphore[%p|%d|%d]\n", handle, units, timeout)); + ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Waiting for semaphore[%p|%d|%d]\n", + handle, units, timeout)); if (in_atomic()) timeout = 0; - switch (timeout) - { + switch (timeout) { /* * No Wait: * -------- @@ -876,8 +841,8 @@ acpi_os_wait_semaphore( * acquire the semaphore if available otherwise return AE_TIME * (a.k.a. 'would block'). */ - case 0: - if(down_trylock(sem)) + case 0: + if (down_trylock(sem)) status = AE_TIME; break; @@ -885,7 +850,7 @@ acpi_os_wait_semaphore( * Wait Indefinitely: * ------------------ */ - case ACPI_WAIT_FOREVER: + case ACPI_WAIT_FOREVER: down(sem); break; @@ -893,11 +858,11 @@ acpi_os_wait_semaphore( * Wait w/ Timeout: * ---------------- */ - default: + default: // TODO: A better timeout algorithm? { int i = 0; - static const int quantum_ms = 1000/HZ; + static const int quantum_ms = 1000 / HZ; ret = down_trylock(sem); for (i = timeout; (i > 0 && ret < 0); i -= quantum_ms) { @@ -905,7 +870,7 @@ acpi_os_wait_semaphore( schedule_timeout(1); ret = down_trylock(sem); } - + if (ret != 0) status = AE_TIME; } @@ -913,47 +878,48 @@ acpi_os_wait_semaphore( } if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Failed to acquire semaphore[%p|%d|%d], %s\n", - handle, units, timeout, acpi_format_exception(status))); - } - else { - ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Acquired semaphore[%p|%d|%d]\n", handle, units, timeout)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Failed to acquire semaphore[%p|%d|%d], %s\n", + handle, units, timeout, + acpi_format_exception(status))); + } else { + ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, + "Acquired semaphore[%p|%d|%d]\n", handle, + units, timeout)); } - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } -EXPORT_SYMBOL(acpi_os_wait_semaphore); +EXPORT_SYMBOL(acpi_os_wait_semaphore); /* * TODO: Support for units > 1? */ -acpi_status -acpi_os_signal_semaphore( - acpi_handle handle, - u32 units) +acpi_status acpi_os_signal_semaphore(acpi_handle handle, u32 units) { - struct semaphore *sem = (struct semaphore *) handle; + struct semaphore *sem = (struct semaphore *)handle; - ACPI_FUNCTION_TRACE ("os_signal_semaphore"); + ACPI_FUNCTION_TRACE("os_signal_semaphore"); if (!sem || (units < 1)) - return_ACPI_STATUS (AE_BAD_PARAMETER); + return_ACPI_STATUS(AE_BAD_PARAMETER); if (units > 1) - return_ACPI_STATUS (AE_SUPPORT); + return_ACPI_STATUS(AE_SUPPORT); - ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Signaling semaphore[%p|%d]\n", handle, units)); + ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Signaling semaphore[%p|%d]\n", handle, + units)); up(sem); - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } + EXPORT_SYMBOL(acpi_os_signal_semaphore); #ifdef ACPI_FUTURE_USAGE -u32 -acpi_os_get_line(char *buffer) +u32 acpi_os_get_line(char *buffer) { #ifdef ENABLE_DEBUGGER @@ -970,22 +936,21 @@ acpi_os_get_line(char *buffer) return 0; } -#endif /* ACPI_FUTURE_USAGE */ +#endif /* ACPI_FUTURE_USAGE */ /* Assumes no unreadable holes inbetween */ -u8 -acpi_os_readable(void *ptr, acpi_size len) +u8 acpi_os_readable(void *ptr, acpi_size len) { -#if defined(__i386__) || defined(__x86_64__) +#if defined(__i386__) || defined(__x86_64__) char tmp; - return !__get_user(tmp, (char __user *)ptr) && !__get_user(tmp, (char __user *)ptr + len - 1); + return !__get_user(tmp, (char __user *)ptr) + && !__get_user(tmp, (char __user *)ptr + len - 1); #endif return 1; } #ifdef ACPI_FUTURE_USAGE -u8 -acpi_os_writable(void *ptr, acpi_size len) +u8 acpi_os_writable(void *ptr, acpi_size len) { /* could do dummy write (racy) or a kernel page table lookup. The later may be difficult at early boot when kmap doesn't work yet. */ @@ -993,8 +958,7 @@ acpi_os_writable(void *ptr, acpi_size len) } #endif -u32 -acpi_os_get_thread_id (void) +u32 acpi_os_get_thread_id(void) { if (!in_atomic()) return current->pid; @@ -1002,13 +966,9 @@ acpi_os_get_thread_id (void) return 0; } -acpi_status -acpi_os_signal ( - u32 function, - void *info) +acpi_status acpi_os_signal(u32 function, void *info) { - switch (function) - { + switch (function) { case ACPI_SIGNAL_FATAL: printk(KERN_ERR PREFIX "Fatal opcode executed\n"); break; @@ -1028,13 +988,13 @@ acpi_os_signal ( return AE_OK; } + EXPORT_SYMBOL(acpi_os_signal); -static int __init -acpi_os_name_setup(char *str) +static int __init acpi_os_name_setup(char *str) { char *p = acpi_os_name; - int count = ACPI_MAX_OVERRIDE_LEN-1; + int count = ACPI_MAX_OVERRIDE_LEN - 1; if (!str || !*str) return 0; @@ -1050,7 +1010,7 @@ acpi_os_name_setup(char *str) *p = 0; return 1; - + } __setup("acpi_os_name=", acpi_os_name_setup); @@ -1060,16 +1020,15 @@ __setup("acpi_os_name=", acpi_os_name_setup); * empty string disables _OSI * TBD additional string adds to _OSI */ -static int __init -acpi_osi_setup(char *str) +static int __init acpi_osi_setup(char *str) { if (str == NULL || *str == '\0') { printk(KERN_INFO PREFIX "_OSI method disabled\n"); acpi_gbl_create_osi_method = FALSE; - } else - { + } else { /* TBD */ - printk(KERN_ERR PREFIX "_OSI additional string ignored -- %s\n", str); + printk(KERN_ERR PREFIX "_OSI additional string ignored -- %s\n", + str); } return 1; @@ -1078,8 +1037,7 @@ acpi_osi_setup(char *str) __setup("acpi_osi=", acpi_osi_setup); /* enable serialization to combat AE_ALREADY_EXISTS errors */ -static int __init -acpi_serialize_setup(char *str) +static int __init acpi_serialize_setup(char *str) { printk(KERN_INFO PREFIX "serialize enabled\n"); @@ -1099,8 +1057,7 @@ __setup("acpi_serialize", acpi_serialize_setup); * Run-time events on the same GPE this flag is available * to tell Linux to keep the wake-time GPEs enabled at run-time. */ -static int __init -acpi_wake_gpes_always_on_setup(char *str) +static int __init acpi_wake_gpes_always_on_setup(char *str) { printk(KERN_INFO PREFIX "wake GPEs not disabled\n"); @@ -1111,8 +1068,7 @@ acpi_wake_gpes_always_on_setup(char *str) __setup("acpi_wake_gpes_always_on", acpi_wake_gpes_always_on_setup); -int __init -acpi_hotkey_setup(char *str) +int __init acpi_hotkey_setup(char *str) { acpi_specific_hotkey_enabled = TRUE; return 1; @@ -1126,7 +1082,6 @@ __setup("acpi_specific_hotkey", acpi_hotkey_setup); */ unsigned int max_cstate = ACPI_PROCESSOR_MAX_POWER; - EXPORT_SYMBOL(max_cstate); /* @@ -1137,12 +1092,10 @@ EXPORT_SYMBOL(max_cstate); * that indicates whether we are at interrupt level. */ -unsigned long -acpi_os_acquire_lock ( - acpi_handle handle) +unsigned long acpi_os_acquire_lock(acpi_handle handle) { unsigned long flags; - spin_lock_irqsave((spinlock_t *)handle, flags); + spin_lock_irqsave((spinlock_t *) handle, flags); return flags; } @@ -1150,15 +1103,11 @@ acpi_os_acquire_lock ( * Release a spinlock. See above. */ -void -acpi_os_release_lock ( - acpi_handle handle, - unsigned long flags) +void acpi_os_release_lock(acpi_handle handle, unsigned long flags) { - spin_unlock_irqrestore((spinlock_t *)handle, flags); + spin_unlock_irqrestore((spinlock_t *) handle, flags); } - #ifndef ACPI_USE_LOCAL_CACHE /******************************************************************************* @@ -1177,13 +1126,9 @@ acpi_os_release_lock ( ******************************************************************************/ acpi_status -acpi_os_create_cache ( - char *name, - u16 size, - u16 depth, - acpi_cache_t **cache) +acpi_os_create_cache(char *name, u16 size, u16 depth, acpi_cache_t ** cache) { - *cache = kmem_cache_create (name, size, 0, 0, NULL, NULL); + *cache = kmem_cache_create(name, size, 0, 0, NULL, NULL); return AE_OK; } @@ -1199,12 +1144,10 @@ acpi_os_create_cache ( * ******************************************************************************/ -acpi_status -acpi_os_purge_cache ( - acpi_cache_t *cache) +acpi_status acpi_os_purge_cache(acpi_cache_t * cache) { - (void) kmem_cache_shrink(cache); - return (AE_OK); + (void)kmem_cache_shrink(cache); + return (AE_OK); } /******************************************************************************* @@ -1220,12 +1163,10 @@ acpi_os_purge_cache ( * ******************************************************************************/ -acpi_status -acpi_os_delete_cache ( - acpi_cache_t *cache) +acpi_status acpi_os_delete_cache(acpi_cache_t * cache) { - (void)kmem_cache_destroy(cache); - return (AE_OK); + (void)kmem_cache_destroy(cache); + return (AE_OK); } /******************************************************************************* @@ -1242,13 +1183,10 @@ acpi_os_delete_cache ( * ******************************************************************************/ -acpi_status -acpi_os_release_object ( - acpi_cache_t *cache, - void *object) +acpi_status acpi_os_release_object(acpi_cache_t * cache, void *object) { - kmem_cache_free(cache, object); - return (AE_OK); + kmem_cache_free(cache, object); + return (AE_OK); } /******************************************************************************* @@ -1265,14 +1203,11 @@ acpi_os_release_object ( * ******************************************************************************/ -void * -acpi_os_acquire_object ( - acpi_cache_t *cache) +void *acpi_os_acquire_object(acpi_cache_t * cache) { - void *object = kmem_cache_alloc(cache, GFP_KERNEL); - WARN_ON(!object); - return object; + void *object = kmem_cache_alloc(cache, GFP_KERNEL); + WARN_ON(!object); + return object; } #endif - diff --git a/drivers/acpi/parser/psargs.c b/drivers/acpi/parser/psargs.c index b7ac68cc9e1..5858188f94a 100644 --- a/drivers/acpi/parser/psargs.c +++ b/drivers/acpi/parser/psargs.c @@ -41,25 +41,20 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include #include #include #include #define _COMPONENT ACPI_PARSER - ACPI_MODULE_NAME ("psargs") +ACPI_MODULE_NAME("psargs") /* Local prototypes */ - static u32 -acpi_ps_get_next_package_length ( - struct acpi_parse_state *parser_state); - -static union acpi_parse_object * -acpi_ps_get_next_field ( - struct acpi_parse_state *parser_state); +acpi_ps_get_next_package_length(struct acpi_parse_state *parser_state); +static union acpi_parse_object *acpi_ps_get_next_field(struct acpi_parse_state + *parser_state); /******************************************************************************* * @@ -75,49 +70,43 @@ acpi_ps_get_next_field ( ******************************************************************************/ static u32 -acpi_ps_get_next_package_length ( - struct acpi_parse_state *parser_state) +acpi_ps_get_next_package_length(struct acpi_parse_state *parser_state) { - u32 encoded_length; - u32 length = 0; + u32 encoded_length; + u32 length = 0; + ACPI_FUNCTION_TRACE("ps_get_next_package_length"); - ACPI_FUNCTION_TRACE ("ps_get_next_package_length"); - - - encoded_length = (u32) ACPI_GET8 (parser_state->aml); + encoded_length = (u32) ACPI_GET8(parser_state->aml); parser_state->aml++; - switch (encoded_length >> 6) /* bits 6-7 contain encoding scheme */ { - case 0: /* 1-byte encoding (bits 0-5) */ + switch (encoded_length >> 6) { /* bits 6-7 contain encoding scheme */ + case 0: /* 1-byte encoding (bits 0-5) */ length = (encoded_length & 0x3F); break; + case 1: /* 2-byte encoding (next byte + bits 0-3) */ - case 1: /* 2-byte encoding (next byte + bits 0-3) */ - - length = ((ACPI_GET8 (parser_state->aml) << 04) | - (encoded_length & 0x0F)); + length = ((ACPI_GET8(parser_state->aml) << 04) | + (encoded_length & 0x0F)); parser_state->aml++; break; + case 2: /* 3-byte encoding (next 2 bytes + bits 0-3) */ - case 2: /* 3-byte encoding (next 2 bytes + bits 0-3) */ - - length = ((ACPI_GET8 (parser_state->aml + 1) << 12) | - (ACPI_GET8 (parser_state->aml) << 04) | - (encoded_length & 0x0F)); + length = ((ACPI_GET8(parser_state->aml + 1) << 12) | + (ACPI_GET8(parser_state->aml) << 04) | + (encoded_length & 0x0F)); parser_state->aml += 2; break; + case 3: /* 4-byte encoding (next 3 bytes + bits 0-3) */ - case 3: /* 4-byte encoding (next 3 bytes + bits 0-3) */ - - length = ((ACPI_GET8 (parser_state->aml + 2) << 20) | - (ACPI_GET8 (parser_state->aml + 1) << 12) | - (ACPI_GET8 (parser_state->aml) << 04) | - (encoded_length & 0x0F)); + length = ((ACPI_GET8(parser_state->aml + 2) << 20) | + (ACPI_GET8(parser_state->aml + 1) << 12) | + (ACPI_GET8(parser_state->aml) << 04) | + (encoded_length & 0x0F)); parser_state->aml += 3; break; @@ -127,10 +116,9 @@ acpi_ps_get_next_package_length ( break; } - return_VALUE (length); + return_VALUE(length); } - /******************************************************************************* * * FUNCTION: acpi_ps_get_next_package_end @@ -144,25 +132,21 @@ acpi_ps_get_next_package_length ( * ******************************************************************************/ -u8 * -acpi_ps_get_next_package_end ( - struct acpi_parse_state *parser_state) +u8 *acpi_ps_get_next_package_end(struct acpi_parse_state *parser_state) { - u8 *start = parser_state->aml; - acpi_native_uint length; - - - ACPI_FUNCTION_TRACE ("ps_get_next_package_end"); + u8 *start = parser_state->aml; + acpi_native_uint length; + ACPI_FUNCTION_TRACE("ps_get_next_package_end"); /* Function below changes parser_state->Aml */ - length = (acpi_native_uint) acpi_ps_get_next_package_length (parser_state); + length = + (acpi_native_uint) acpi_ps_get_next_package_length(parser_state); - return_PTR (start + length); /* end of package */ + return_PTR(start + length); /* end of package */ } - /******************************************************************************* * * FUNCTION: acpi_ps_get_next_namestring @@ -178,20 +162,16 @@ acpi_ps_get_next_package_end ( * ******************************************************************************/ -char * -acpi_ps_get_next_namestring ( - struct acpi_parse_state *parser_state) +char *acpi_ps_get_next_namestring(struct acpi_parse_state *parser_state) { - u8 *start = parser_state->aml; - u8 *end = parser_state->aml; - - - ACPI_FUNCTION_TRACE ("ps_get_next_namestring"); + u8 *start = parser_state->aml; + u8 *end = parser_state->aml; + ACPI_FUNCTION_TRACE("ps_get_next_namestring"); /* Handle multiple prefix characters */ - while (acpi_ps_is_prefix_char (ACPI_GET8 (end))) { + while (acpi_ps_is_prefix_char(ACPI_GET8(end))) { /* Include prefix '\\' or '^' */ end++; @@ -199,7 +179,7 @@ acpi_ps_get_next_namestring ( /* Decode the path */ - switch (ACPI_GET8 (end)) { + switch (ACPI_GET8(end)) { case 0: /* null_name */ @@ -221,7 +201,7 @@ acpi_ps_get_next_namestring ( /* Multiple name segments, 4 chars each */ - end += 2 + ((acpi_size) ACPI_GET8 (end + 1) * ACPI_NAME_SIZE); + end += 2 + ((acpi_size) ACPI_GET8(end + 1) * ACPI_NAME_SIZE); break; default: @@ -232,11 +212,10 @@ acpi_ps_get_next_namestring ( break; } - parser_state->aml = (u8*) end; - return_PTR ((char *) start); + parser_state->aml = (u8 *) end; + return_PTR((char *)start); } - /******************************************************************************* * * FUNCTION: acpi_ps_get_next_namepath @@ -259,24 +238,20 @@ acpi_ps_get_next_namestring ( ******************************************************************************/ acpi_status -acpi_ps_get_next_namepath ( - struct acpi_walk_state *walk_state, - struct acpi_parse_state *parser_state, - union acpi_parse_object *arg, - u8 method_call) +acpi_ps_get_next_namepath(struct acpi_walk_state *walk_state, + struct acpi_parse_state *parser_state, + union acpi_parse_object *arg, u8 method_call) { - char *path; - union acpi_parse_object *name_op; - acpi_status status = AE_OK; - union acpi_operand_object *method_desc; - struct acpi_namespace_node *node; - union acpi_generic_state scope_info; + char *path; + union acpi_parse_object *name_op; + acpi_status status = AE_OK; + union acpi_operand_object *method_desc; + struct acpi_namespace_node *node; + union acpi_generic_state scope_info; + ACPI_FUNCTION_TRACE("ps_get_next_namepath"); - ACPI_FUNCTION_TRACE ("ps_get_next_namepath"); - - - path = acpi_ps_get_next_namestring (parser_state); + path = acpi_ps_get_next_namestring(parser_state); /* Null path case is allowed */ @@ -296,49 +271,50 @@ acpi_ps_get_next_namepath ( * parent tree, but don't open a new scope -- we just want to lookup the * object (MUST BE mode EXECUTE to perform upsearch) */ - status = acpi_ns_lookup (&scope_info, path, ACPI_TYPE_ANY, - ACPI_IMODE_EXECUTE, - ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, - NULL, &node); - if (ACPI_SUCCESS (status) && method_call) { + status = acpi_ns_lookup(&scope_info, path, ACPI_TYPE_ANY, + ACPI_IMODE_EXECUTE, + ACPI_NS_SEARCH_PARENT | + ACPI_NS_DONT_OPEN_SCOPE, NULL, &node); + if (ACPI_SUCCESS(status) && method_call) { if (node->type == ACPI_TYPE_METHOD) { /* This name is actually a control method invocation */ - method_desc = acpi_ns_get_attached_object (node); - ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, - "Control Method - %p Desc %p Path=%p\n", - node, method_desc, path)); + method_desc = acpi_ns_get_attached_object(node); + ACPI_DEBUG_PRINT((ACPI_DB_PARSE, + "Control Method - %p Desc %p Path=%p\n", + node, method_desc, path)); - name_op = acpi_ps_alloc_op (AML_INT_NAMEPATH_OP); + name_op = acpi_ps_alloc_op(AML_INT_NAMEPATH_OP); if (!name_op) { - return_ACPI_STATUS (AE_NO_MEMORY); + return_ACPI_STATUS(AE_NO_MEMORY); } /* Change arg into a METHOD CALL and attach name to it */ - acpi_ps_init_op (arg, AML_INT_METHODCALL_OP); + acpi_ps_init_op(arg, AML_INT_METHODCALL_OP); name_op->common.value.name = path; /* Point METHODCALL/NAME to the METHOD Node */ name_op->common.node = node; - acpi_ps_append_arg (arg, name_op); + acpi_ps_append_arg(arg, name_op); if (!method_desc) { - ACPI_REPORT_ERROR (( - "ps_get_next_namepath: Control Method %p has no attached object\n", - node)); - return_ACPI_STATUS (AE_AML_INTERNAL); + ACPI_REPORT_ERROR(("ps_get_next_namepath: Control Method %p has no attached object\n", node)); + return_ACPI_STATUS(AE_AML_INTERNAL); } - ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, - "Control Method - %p Args %X\n", - node, method_desc->method.param_count)); + ACPI_DEBUG_PRINT((ACPI_DB_PARSE, + "Control Method - %p Args %X\n", + node, + method_desc->method. + param_count)); /* Get the number of arguments to expect */ - walk_state->arg_count = method_desc->method.param_count; - return_ACPI_STATUS (AE_OK); + walk_state->arg_count = + method_desc->method.param_count; + return_ACPI_STATUS(AE_OK); } /* @@ -348,25 +324,26 @@ acpi_ps_get_next_namepath ( */ } - if (ACPI_FAILURE (status)) { + if (ACPI_FAILURE(status)) { /* * 1) Any error other than NOT_FOUND is always severe * 2) NOT_FOUND is only important if we are executing a method. * 3) If executing a cond_ref_of opcode, NOT_FOUND is ok. */ - if ((((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) == ACPI_PARSE_EXECUTE) && - (status == AE_NOT_FOUND) && - (walk_state->op->common.aml_opcode != AML_COND_REF_OF_OP)) || - - (status != AE_NOT_FOUND)) { - ACPI_REPORT_NSERROR (path, status); - - acpi_os_printf ("search_node %p start_node %p return_node %p\n", - scope_info.scope.node, parser_state->start_node, node); - - - } - else { + if ((((walk_state-> + parse_flags & ACPI_PARSE_MODE_MASK) == + ACPI_PARSE_EXECUTE) && (status == AE_NOT_FOUND) + && (walk_state->op->common.aml_opcode != + AML_COND_REF_OF_OP)) + || (status != AE_NOT_FOUND)) { + ACPI_REPORT_NSERROR(path, status); + + acpi_os_printf + ("search_node %p start_node %p return_node %p\n", + scope_info.scope.node, + parser_state->start_node, node); + + } else { /* * We got a NOT_FOUND during table load or we encountered * a cond_ref_of(x) where the target does not exist. @@ -381,13 +358,12 @@ acpi_ps_get_next_namepath ( * Regardless of success/failure above, * Just initialize the Op with the pathname. */ - acpi_ps_init_op (arg, AML_INT_NAMEPATH_OP); + acpi_ps_init_op(arg, AML_INT_NAMEPATH_OP); arg->common.value.name = path; - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_ps_get_next_simple_arg @@ -403,87 +379,81 @@ acpi_ps_get_next_namepath ( ******************************************************************************/ void -acpi_ps_get_next_simple_arg ( - struct acpi_parse_state *parser_state, - u32 arg_type, - union acpi_parse_object *arg) +acpi_ps_get_next_simple_arg(struct acpi_parse_state *parser_state, + u32 arg_type, union acpi_parse_object *arg) { - ACPI_FUNCTION_TRACE_U32 ("ps_get_next_simple_arg", arg_type); - + ACPI_FUNCTION_TRACE_U32("ps_get_next_simple_arg", arg_type); switch (arg_type) { case ARGP_BYTEDATA: - acpi_ps_init_op (arg, AML_BYTE_OP); - arg->common.value.integer = (u32) ACPI_GET8 (parser_state->aml); + acpi_ps_init_op(arg, AML_BYTE_OP); + arg->common.value.integer = (u32) ACPI_GET8(parser_state->aml); parser_state->aml++; break; - case ARGP_WORDDATA: - acpi_ps_init_op (arg, AML_WORD_OP); + acpi_ps_init_op(arg, AML_WORD_OP); /* Get 2 bytes from the AML stream */ - ACPI_MOVE_16_TO_32 (&arg->common.value.integer, parser_state->aml); + ACPI_MOVE_16_TO_32(&arg->common.value.integer, + parser_state->aml); parser_state->aml += 2; break; - case ARGP_DWORDDATA: - acpi_ps_init_op (arg, AML_DWORD_OP); + acpi_ps_init_op(arg, AML_DWORD_OP); /* Get 4 bytes from the AML stream */ - ACPI_MOVE_32_TO_32 (&arg->common.value.integer, parser_state->aml); + ACPI_MOVE_32_TO_32(&arg->common.value.integer, + parser_state->aml); parser_state->aml += 4; break; - case ARGP_QWORDDATA: - acpi_ps_init_op (arg, AML_QWORD_OP); + acpi_ps_init_op(arg, AML_QWORD_OP); /* Get 8 bytes from the AML stream */ - ACPI_MOVE_64_TO_64 (&arg->common.value.integer, parser_state->aml); + ACPI_MOVE_64_TO_64(&arg->common.value.integer, + parser_state->aml); parser_state->aml += 8; break; - case ARGP_CHARLIST: - acpi_ps_init_op (arg, AML_STRING_OP); - arg->common.value.string = (char *) parser_state->aml; + acpi_ps_init_op(arg, AML_STRING_OP); + arg->common.value.string = (char *)parser_state->aml; - while (ACPI_GET8 (parser_state->aml) != '\0') { + while (ACPI_GET8(parser_state->aml) != '\0') { parser_state->aml++; } parser_state->aml++; break; - case ARGP_NAME: case ARGP_NAMESTRING: - acpi_ps_init_op (arg, AML_INT_NAMEPATH_OP); - arg->common.value.name = acpi_ps_get_next_namestring (parser_state); + acpi_ps_init_op(arg, AML_INT_NAMEPATH_OP); + arg->common.value.name = + acpi_ps_get_next_namestring(parser_state); break; - default: - ACPI_REPORT_ERROR (("Invalid arg_type %X\n", arg_type)); + ACPI_REPORT_ERROR(("Invalid arg_type %X\n", arg_type)); break; } return_VOID; } - /******************************************************************************* * * FUNCTION: acpi_ps_get_next_field @@ -496,24 +466,21 @@ acpi_ps_get_next_simple_arg ( * ******************************************************************************/ -static union acpi_parse_object * -acpi_ps_get_next_field ( - struct acpi_parse_state *parser_state) +static union acpi_parse_object *acpi_ps_get_next_field(struct acpi_parse_state + *parser_state) { - u32 aml_offset = (u32) - ACPI_PTR_DIFF (parser_state->aml, - parser_state->aml_start); - union acpi_parse_object *field; - u16 opcode; - u32 name; - - - ACPI_FUNCTION_TRACE ("ps_get_next_field"); + u32 aml_offset = (u32) + ACPI_PTR_DIFF(parser_state->aml, + parser_state->aml_start); + union acpi_parse_object *field; + u16 opcode; + u32 name; + ACPI_FUNCTION_TRACE("ps_get_next_field"); /* Determine field type */ - switch (ACPI_GET8 (parser_state->aml)) { + switch (ACPI_GET8(parser_state->aml)) { default: opcode = AML_INT_NAMEDFIELD_OP; @@ -534,9 +501,9 @@ acpi_ps_get_next_field ( /* Allocate a new field op */ - field = acpi_ps_alloc_op (opcode); + field = acpi_ps_alloc_op(opcode); if (!field) { - return_PTR (NULL); + return_PTR(NULL); } field->common.aml_offset = aml_offset; @@ -548,33 +515,34 @@ acpi_ps_get_next_field ( /* Get the 4-character name */ - ACPI_MOVE_32_TO_32 (&name, parser_state->aml); - acpi_ps_set_name (field, name); + ACPI_MOVE_32_TO_32(&name, parser_state->aml); + acpi_ps_set_name(field, name); parser_state->aml += ACPI_NAME_SIZE; /* Get the length which is encoded as a package length */ - field->common.value.size = acpi_ps_get_next_package_length (parser_state); + field->common.value.size = + acpi_ps_get_next_package_length(parser_state); break; - case AML_INT_RESERVEDFIELD_OP: /* Get the length which is encoded as a package length */ - field->common.value.size = acpi_ps_get_next_package_length (parser_state); + field->common.value.size = + acpi_ps_get_next_package_length(parser_state); break; - case AML_INT_ACCESSFIELD_OP: /* * Get access_type and access_attrib and merge into the field Op * access_type is first operand, access_attribute is second */ - field->common.value.integer = (ACPI_GET8 (parser_state->aml) << 8); + field->common.value.integer = + (ACPI_GET8(parser_state->aml) << 8); parser_state->aml++; - field->common.value.integer |= ACPI_GET8 (parser_state->aml); + field->common.value.integer |= ACPI_GET8(parser_state->aml); parser_state->aml++; break; @@ -584,10 +552,9 @@ acpi_ps_get_next_field ( break; } - return_PTR (field); + return_PTR(field); } - /******************************************************************************* * * FUNCTION: acpi_ps_get_next_arg @@ -605,21 +572,17 @@ acpi_ps_get_next_field ( ******************************************************************************/ acpi_status -acpi_ps_get_next_arg ( - struct acpi_walk_state *walk_state, - struct acpi_parse_state *parser_state, - u32 arg_type, - union acpi_parse_object **return_arg) +acpi_ps_get_next_arg(struct acpi_walk_state *walk_state, + struct acpi_parse_state *parser_state, + u32 arg_type, union acpi_parse_object **return_arg) { - union acpi_parse_object *arg = NULL; - union acpi_parse_object *prev = NULL; - union acpi_parse_object *field; - u32 subop; - acpi_status status = AE_OK; - - - ACPI_FUNCTION_TRACE_PTR ("ps_get_next_arg", parser_state); + union acpi_parse_object *arg = NULL; + union acpi_parse_object *prev = NULL; + union acpi_parse_object *field; + u32 subop; + acpi_status status = AE_OK; + ACPI_FUNCTION_TRACE_PTR("ps_get_next_arg", parser_state); switch (arg_type) { case ARGP_BYTEDATA: @@ -631,37 +594,35 @@ acpi_ps_get_next_arg ( /* Constants, strings, and namestrings are all the same size */ - arg = acpi_ps_alloc_op (AML_BYTE_OP); + arg = acpi_ps_alloc_op(AML_BYTE_OP); if (!arg) { - return_ACPI_STATUS (AE_NO_MEMORY); + return_ACPI_STATUS(AE_NO_MEMORY); } - acpi_ps_get_next_simple_arg (parser_state, arg_type, arg); + acpi_ps_get_next_simple_arg(parser_state, arg_type, arg); break; - case ARGP_PKGLENGTH: /* Package length, nothing returned */ - parser_state->pkg_end = acpi_ps_get_next_package_end (parser_state); + parser_state->pkg_end = + acpi_ps_get_next_package_end(parser_state); break; - case ARGP_FIELDLIST: if (parser_state->aml < parser_state->pkg_end) { /* Non-empty list */ while (parser_state->aml < parser_state->pkg_end) { - field = acpi_ps_get_next_field (parser_state); + field = acpi_ps_get_next_field(parser_state); if (!field) { - return_ACPI_STATUS (AE_NO_MEMORY); + return_ACPI_STATUS(AE_NO_MEMORY); } if (prev) { prev->common.next = field; - } - else { + } else { arg = field; } prev = field; @@ -673,21 +634,21 @@ acpi_ps_get_next_arg ( } break; - case ARGP_BYTELIST: if (parser_state->aml < parser_state->pkg_end) { /* Non-empty list */ - arg = acpi_ps_alloc_op (AML_INT_BYTELIST_OP); + arg = acpi_ps_alloc_op(AML_INT_BYTELIST_OP); if (!arg) { - return_ACPI_STATUS (AE_NO_MEMORY); + return_ACPI_STATUS(AE_NO_MEMORY); } /* Fill in bytelist data */ arg->common.value.size = (u32) - ACPI_PTR_DIFF (parser_state->pkg_end, parser_state->aml); + ACPI_PTR_DIFF(parser_state->pkg_end, + parser_state->aml); arg->named.data = parser_state->aml; /* Skip to End of byte data */ @@ -696,32 +657,31 @@ acpi_ps_get_next_arg ( } break; - case ARGP_TARGET: case ARGP_SUPERNAME: case ARGP_SIMPLENAME: - subop = acpi_ps_peek_opcode (parser_state); - if (subop == 0 || - acpi_ps_is_leading_char (subop) || - acpi_ps_is_prefix_char (subop)) { + subop = acpi_ps_peek_opcode(parser_state); + if (subop == 0 || + acpi_ps_is_leading_char(subop) || + acpi_ps_is_prefix_char(subop)) { /* null_name or name_string */ - arg = acpi_ps_alloc_op (AML_INT_NAMEPATH_OP); + arg = acpi_ps_alloc_op(AML_INT_NAMEPATH_OP); if (!arg) { - return_ACPI_STATUS (AE_NO_MEMORY); + return_ACPI_STATUS(AE_NO_MEMORY); } - status = acpi_ps_get_next_namepath (walk_state, parser_state, arg, 0); - } - else { + status = + acpi_ps_get_next_namepath(walk_state, parser_state, + arg, 0); + } else { /* Single complex argument, nothing returned */ walk_state->arg_count = 1; } break; - case ARGP_DATAOBJ: case ARGP_TERMARG: @@ -730,7 +690,6 @@ acpi_ps_get_next_arg ( walk_state->arg_count = 1; break; - case ARGP_DATAOBJLIST: case ARGP_TERMLIST: case ARGP_OBJLIST: @@ -742,14 +701,13 @@ acpi_ps_get_next_arg ( } break; - default: - ACPI_REPORT_ERROR (("Invalid arg_type: %X\n", arg_type)); + ACPI_REPORT_ERROR(("Invalid arg_type: %X\n", arg_type)); status = AE_AML_OPERAND_TYPE; break; } *return_arg = arg; - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } diff --git a/drivers/acpi/parser/psloop.c b/drivers/acpi/parser/psloop.c index 551d54bdbec..088d33999d9 100644 --- a/drivers/acpi/parser/psloop.c +++ b/drivers/acpi/parser/psloop.c @@ -41,7 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ - /* * Parse the AML and build an operation tree as most interpreters, * like Perl, do. Parsing is done by hand rather than with a YACC @@ -57,10 +56,9 @@ #include #define _COMPONENT ACPI_PARSER - ACPI_MODULE_NAME ("psloop") - -static u32 acpi_gbl_depth = 0; +ACPI_MODULE_NAME("psloop") +static u32 acpi_gbl_depth = 0; /******************************************************************************* * @@ -75,23 +73,20 @@ static u32 acpi_gbl_depth = 0; * ******************************************************************************/ -acpi_status -acpi_ps_parse_loop ( - struct acpi_walk_state *walk_state) +acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state) { - acpi_status status = AE_OK; - acpi_status status2; - union acpi_parse_object *op = NULL; /* current op */ - union acpi_parse_object *arg = NULL; - union acpi_parse_object *pre_op = NULL; - struct acpi_parse_state *parser_state; - u8 *aml_op_start = NULL; - + acpi_status status = AE_OK; + acpi_status status2; + union acpi_parse_object *op = NULL; /* current op */ + union acpi_parse_object *arg = NULL; + union acpi_parse_object *pre_op = NULL; + struct acpi_parse_state *parser_state; + u8 *aml_op_start = NULL; - ACPI_FUNCTION_TRACE_PTR ("ps_parse_loop", walk_state); + ACPI_FUNCTION_TRACE_PTR("ps_parse_loop", walk_state); if (walk_state->descending_callback == NULL) { - return_ACPI_STATUS (AE_BAD_PARAMETER); + return_ACPI_STATUS(AE_BAD_PARAMETER); } parser_state = &walk_state->parser_state; @@ -102,45 +97,56 @@ acpi_ps_parse_loop ( if (walk_state->walk_type & ACPI_WALK_METHOD_RESTART) { /* We are restarting a preempted control method */ - if (acpi_ps_has_completed_scope (parser_state)) { + if (acpi_ps_has_completed_scope(parser_state)) { /* * We must check if a predicate to an IF or WHILE statement * was just completed */ if ((parser_state->scope->parse_scope.op) && - ((parser_state->scope->parse_scope.op->common.aml_opcode == AML_IF_OP) || - (parser_state->scope->parse_scope.op->common.aml_opcode == AML_WHILE_OP)) && - (walk_state->control_state) && - (walk_state->control_state->common.state == - ACPI_CONTROL_PREDICATE_EXECUTING)) { + ((parser_state->scope->parse_scope.op->common. + aml_opcode == AML_IF_OP) + || (parser_state->scope->parse_scope.op->common. + aml_opcode == AML_WHILE_OP)) + && (walk_state->control_state) + && (walk_state->control_state->common.state == + ACPI_CONTROL_PREDICATE_EXECUTING)) { /* * A predicate was just completed, get the value of the * predicate and branch based on that value */ walk_state->op = NULL; - status = acpi_ds_get_predicate_value (walk_state, ACPI_TO_POINTER (TRUE)); - if (ACPI_FAILURE (status) && - ((status & AE_CODE_MASK) != AE_CODE_CONTROL)) { + status = + acpi_ds_get_predicate_value(walk_state, + ACPI_TO_POINTER + (TRUE)); + if (ACPI_FAILURE(status) + && ((status & AE_CODE_MASK) != + AE_CODE_CONTROL)) { if (status == AE_AML_NO_RETURN_VALUE) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Invoked method did not return a value, %s\n", - acpi_format_exception (status))); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Invoked method did not return a value, %s\n", + acpi_format_exception + (status))); } - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "get_predicate Failed, %s\n", - acpi_format_exception (status))); - return_ACPI_STATUS (status); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "get_predicate Failed, %s\n", + acpi_format_exception + (status))); + return_ACPI_STATUS(status); } - status = acpi_ps_next_parse_state (walk_state, op, status); + status = + acpi_ps_next_parse_state(walk_state, op, + status); } - acpi_ps_pop_scope (parser_state, &op, - &walk_state->arg_types, &walk_state->arg_count); - ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Popped scope, Op=%p\n", op)); - } - else if (walk_state->prev_op) { + acpi_ps_pop_scope(parser_state, &op, + &walk_state->arg_types, + &walk_state->arg_count); + ACPI_DEBUG_PRINT((ACPI_DB_PARSE, + "Popped scope, Op=%p\n", op)); + } else if (walk_state->prev_op) { /* We were in the middle of an op */ op = walk_state->prev_op; @@ -156,9 +162,10 @@ acpi_ps_parse_loop ( if (!op) { /* Get the next opcode from the AML stream */ - walk_state->aml_offset = (u32) ACPI_PTR_DIFF (parser_state->aml, - parser_state->aml_start); - walk_state->opcode = acpi_ps_peek_opcode (parser_state); + walk_state->aml_offset = + (u32) ACPI_PTR_DIFF(parser_state->aml, + parser_state->aml_start); + walk_state->opcode = acpi_ps_peek_opcode(parser_state); /* * First cut to determine what we have found: @@ -166,7 +173,8 @@ acpi_ps_parse_loop ( * 2) A name string * 3) An unknown/invalid opcode */ - walk_state->op_info = acpi_ps_get_opcode_info (walk_state->opcode); + walk_state->op_info = + acpi_ps_get_opcode_info(walk_state->opcode); switch (walk_state->op_info->class) { case AML_CLASS_ASCII: case AML_CLASS_PREFIX: @@ -182,11 +190,13 @@ acpi_ps_parse_loop ( /* The opcode is unrecognized. Just skip unknown opcodes */ - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Found unknown opcode %X at AML address %p offset %X, ignoring\n", - walk_state->opcode, parser_state->aml, walk_state->aml_offset)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Found unknown opcode %X at AML address %p offset %X, ignoring\n", + walk_state->opcode, + parser_state->aml, + walk_state->aml_offset)); - ACPI_DUMP_BUFFER (parser_state->aml, 128); + ACPI_DUMP_BUFFER(parser_state->aml, 128); /* Assume one-byte bad opcode */ @@ -197,8 +207,10 @@ acpi_ps_parse_loop ( /* Found opcode info, this is a normal opcode */ - parser_state->aml += acpi_ps_get_opcode_size (walk_state->opcode); - walk_state->arg_types = walk_state->op_info->parse_args; + parser_state->aml += + acpi_ps_get_opcode_size(walk_state->opcode); + walk_state->arg_types = + walk_state->op_info->parse_args; break; } @@ -208,7 +220,9 @@ acpi_ps_parse_loop ( /* Allocate a new pre_op if necessary */ if (!pre_op) { - pre_op = acpi_ps_alloc_op (walk_state->opcode); + pre_op = + acpi_ps_alloc_op(walk_state-> + opcode); if (!pre_op) { status = AE_NO_MEMORY; goto close_this_op; @@ -222,30 +236,40 @@ acpi_ps_parse_loop ( * Get and append arguments until we find the node that contains * the name (the type ARGP_NAME). */ - while (GET_CURRENT_ARG_TYPE (walk_state->arg_types) && - (GET_CURRENT_ARG_TYPE (walk_state->arg_types) != ARGP_NAME)) { - status = acpi_ps_get_next_arg (walk_state, parser_state, - GET_CURRENT_ARG_TYPE (walk_state->arg_types), &arg); - if (ACPI_FAILURE (status)) { + while (GET_CURRENT_ARG_TYPE + (walk_state->arg_types) + && + (GET_CURRENT_ARG_TYPE + (walk_state->arg_types) != ARGP_NAME)) { + status = + acpi_ps_get_next_arg(walk_state, + parser_state, + GET_CURRENT_ARG_TYPE + (walk_state-> + arg_types), + &arg); + if (ACPI_FAILURE(status)) { goto close_this_op; } - acpi_ps_append_arg (pre_op, arg); - INCREMENT_ARG_LIST (walk_state->arg_types); + acpi_ps_append_arg(pre_op, arg); + INCREMENT_ARG_LIST(walk_state-> + arg_types); } /* * Make sure that we found a NAME and didn't run out of * arguments */ - if (!GET_CURRENT_ARG_TYPE (walk_state->arg_types)) { + if (!GET_CURRENT_ARG_TYPE + (walk_state->arg_types)) { status = AE_AML_NO_OPERAND; goto close_this_op; } /* We know that this arg is a name, move to next arg */ - INCREMENT_ARG_LIST (walk_state->arg_types); + INCREMENT_ARG_LIST(walk_state->arg_types); /* * Find the object. This will either insert the object into @@ -253,11 +277,14 @@ acpi_ps_parse_loop ( */ walk_state->op = NULL; - status = walk_state->descending_callback (walk_state, &op); - if (ACPI_FAILURE (status)) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "During name lookup/catalog, %s\n", - acpi_format_exception (status))); + status = + walk_state->descending_callback(walk_state, + &op); + if (ACPI_FAILURE(status)) { + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "During name lookup/catalog, %s\n", + acpi_format_exception + (status))); goto close_this_op; } @@ -265,17 +292,20 @@ acpi_ps_parse_loop ( continue; } - status = acpi_ps_next_parse_state (walk_state, op, status); + status = + acpi_ps_next_parse_state(walk_state, op, + status); if (status == AE_CTRL_PENDING) { status = AE_OK; goto close_this_op; } - if (ACPI_FAILURE (status)) { + if (ACPI_FAILURE(status)) { goto close_this_op; } - acpi_ps_append_arg (op, pre_op->common.value.arg); + acpi_ps_append_arg(op, + pre_op->common.value.arg); acpi_gbl_depth++; if (op->common.aml_opcode == AML_REGION_OP) { @@ -291,15 +321,15 @@ acpi_ps_parse_loop ( * * (Length is unknown until parse of the body complete) */ - op->named.data = aml_op_start; - op->named.length = 0; + op->named.data = aml_op_start; + op->named.length = 0; } - } - else { + } else { /* Not a named opcode, just allocate Op and append to parent */ - walk_state->op_info = acpi_ps_get_opcode_info (walk_state->opcode); - op = acpi_ps_alloc_op (walk_state->opcode); + walk_state->op_info = + acpi_ps_get_opcode_info(walk_state->opcode); + op = acpi_ps_alloc_op(walk_state->opcode); if (!op) { status = AE_NO_MEMORY; goto close_this_op; @@ -310,11 +340,12 @@ acpi_ps_parse_loop ( * Backup to beginning of create_xXXfield declaration * body_length is unknown until we parse the body */ - op->named.data = aml_op_start; - op->named.length = 0; + op->named.data = aml_op_start; + op->named.length = 0; } - acpi_ps_append_arg (acpi_ps_get_parent_scope (parser_state), op); + acpi_ps_append_arg(acpi_ps_get_parent_scope + (parser_state), op); if ((walk_state->descending_callback != NULL)) { /* @@ -323,14 +354,20 @@ acpi_ps_parse_loop ( */ walk_state->op = op; - status = walk_state->descending_callback (walk_state, &op); - status = acpi_ps_next_parse_state (walk_state, op, status); + status = + walk_state-> + descending_callback(walk_state, + &op); + status = + acpi_ps_next_parse_state(walk_state, + op, + status); if (status == AE_CTRL_PENDING) { status = AE_OK; goto close_this_op; } - if (ACPI_FAILURE (status)) { + if (ACPI_FAILURE(status)) { goto close_this_op; } } @@ -339,14 +376,15 @@ acpi_ps_parse_loop ( op->common.aml_offset = walk_state->aml_offset; if (walk_state->op_info) { - ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, - "Opcode %4.4X [%s] Op %p Aml %p aml_offset %5.5X\n", - (u32) op->common.aml_opcode, walk_state->op_info->name, - op, parser_state->aml, op->common.aml_offset)); + ACPI_DEBUG_PRINT((ACPI_DB_PARSE, + "Opcode %4.4X [%s] Op %p Aml %p aml_offset %5.5X\n", + (u32) op->common.aml_opcode, + walk_state->op_info->name, op, + parser_state->aml, + op->common.aml_offset)); } } - /* * Start arg_count at zero because we don't know if there are * any args yet @@ -359,22 +397,27 @@ acpi_ps_parse_loop ( /* Get arguments */ switch (op->common.aml_opcode) { - case AML_BYTE_OP: /* AML_BYTEDATA_ARG */ - case AML_WORD_OP: /* AML_WORDDATA_ARG */ - case AML_DWORD_OP: /* AML_DWORDATA_ARG */ - case AML_QWORD_OP: /* AML_QWORDATA_ARG */ - case AML_STRING_OP: /* AML_ASCIICHARLIST_ARG */ + case AML_BYTE_OP: /* AML_BYTEDATA_ARG */ + case AML_WORD_OP: /* AML_WORDDATA_ARG */ + case AML_DWORD_OP: /* AML_DWORDATA_ARG */ + case AML_QWORD_OP: /* AML_QWORDATA_ARG */ + case AML_STRING_OP: /* AML_ASCIICHARLIST_ARG */ /* Fill in constant or string argument directly */ - acpi_ps_get_next_simple_arg (parser_state, - GET_CURRENT_ARG_TYPE (walk_state->arg_types), op); + acpi_ps_get_next_simple_arg(parser_state, + GET_CURRENT_ARG_TYPE + (walk_state-> + arg_types), op); break; - case AML_INT_NAMEPATH_OP: /* AML_NAMESTRING_ARG */ + case AML_INT_NAMEPATH_OP: /* AML_NAMESTRING_ARG */ - status = acpi_ps_get_next_namepath (walk_state, parser_state, op, 1); - if (ACPI_FAILURE (status)) { + status = + acpi_ps_get_next_namepath(walk_state, + parser_state, op, + 1); + if (ACPI_FAILURE(status)) { goto close_this_op; } @@ -386,34 +429,46 @@ acpi_ps_parse_loop ( * Op is not a constant or string, append each argument * to the Op */ - while (GET_CURRENT_ARG_TYPE (walk_state->arg_types) && - !walk_state->arg_count) { + while (GET_CURRENT_ARG_TYPE + (walk_state->arg_types) + && !walk_state->arg_count) { walk_state->aml_offset = (u32) - ACPI_PTR_DIFF (parser_state->aml, parser_state->aml_start); - - status = acpi_ps_get_next_arg (walk_state, parser_state, - GET_CURRENT_ARG_TYPE (walk_state->arg_types), - &arg); - if (ACPI_FAILURE (status)) { + ACPI_PTR_DIFF(parser_state->aml, + parser_state-> + aml_start); + + status = + acpi_ps_get_next_arg(walk_state, + parser_state, + GET_CURRENT_ARG_TYPE + (walk_state-> + arg_types), + &arg); + if (ACPI_FAILURE(status)) { goto close_this_op; } if (arg) { - arg->common.aml_offset = walk_state->aml_offset; - acpi_ps_append_arg (op, arg); + arg->common.aml_offset = + walk_state->aml_offset; + acpi_ps_append_arg(op, arg); } - INCREMENT_ARG_LIST (walk_state->arg_types); + INCREMENT_ARG_LIST(walk_state-> + arg_types); } - /* Special processing for certain opcodes */ - /* TBD (remove): Temporary mechanism to disable this code if needed */ + /* TBD (remove): Temporary mechanism to disable this code if needed */ #ifdef ACPI_ENABLE_MODULE_LEVEL_CODE - if ((walk_state->pass_number <= ACPI_IMODE_LOAD_PASS1) && - ((walk_state->parse_flags & ACPI_PARSE_DISASSEMBLE) == 0)) { + if ((walk_state->pass_number <= + ACPI_IMODE_LOAD_PASS1) + && + ((walk_state-> + parse_flags & ACPI_PARSE_DISASSEMBLE) == + 0)) { /* * We want to skip If/Else/While constructs during Pass1 * because we want to actually conditionally execute the @@ -427,12 +482,13 @@ acpi_ps_parse_loop ( case AML_ELSE_OP: case AML_WHILE_OP: - ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, - "Pass1: Skipping an If/Else/While body\n")); + ACPI_DEBUG_PRINT((ACPI_DB_PARSE, + "Pass1: Skipping an If/Else/While body\n")); /* Skip body of if/else/while in pass 1 */ - parser_state->aml = parser_state->pkg_end; + parser_state->aml = + parser_state->pkg_end; walk_state->arg_count = 0; break; @@ -451,13 +507,15 @@ acpi_ps_parse_loop ( * * Save the length and address of the body */ - op->named.data = parser_state->aml; - op->named.length = (u32) (parser_state->pkg_end - - parser_state->aml); + op->named.data = parser_state->aml; + op->named.length = + (u32) (parser_state->pkg_end - + parser_state->aml); /* Skip body of method */ - parser_state->aml = parser_state->pkg_end; + parser_state->aml = + parser_state->pkg_end; walk_state->arg_count = 0; break; @@ -466,20 +524,25 @@ acpi_ps_parse_loop ( case AML_VAR_PACKAGE_OP: if ((op->common.parent) && - (op->common.parent->common.aml_opcode == AML_NAME_OP) && - (walk_state->pass_number <= ACPI_IMODE_LOAD_PASS2)) { + (op->common.parent->common. + aml_opcode == AML_NAME_OP) + && (walk_state->pass_number <= + ACPI_IMODE_LOAD_PASS2)) { /* * Skip parsing of Buffers and Packages * because we don't have enough info in the first pass * to parse them correctly. */ - op->named.data = aml_op_start; - op->named.length = (u32) (parser_state->pkg_end - - aml_op_start); + op->named.data = aml_op_start; + op->named.length = + (u32) (parser_state-> + pkg_end - + aml_op_start); /* Skip body */ - parser_state->aml = parser_state->pkg_end; + parser_state->aml = + parser_state->pkg_end; walk_state->arg_count = 0; } break; @@ -487,8 +550,9 @@ acpi_ps_parse_loop ( case AML_WHILE_OP: if (walk_state->control_state) { - walk_state->control_state->control.package_end = - parser_state->pkg_end; + walk_state->control_state-> + control.package_end = + parser_state->pkg_end; } break; @@ -508,9 +572,10 @@ acpi_ps_parse_loop ( * There are arguments (complex ones), push Op and * prepare for argument */ - status = acpi_ps_push_scope (parser_state, op, - walk_state->arg_types, walk_state->arg_count); - if (ACPI_FAILURE (status)) { + status = acpi_ps_push_scope(parser_state, op, + walk_state->arg_types, + walk_state->arg_count); + if (ACPI_FAILURE(status)) { goto close_this_op; } op = NULL; @@ -521,7 +586,8 @@ acpi_ps_parse_loop ( * All arguments have been processed -- Op is complete, * prepare for next */ - walk_state->op_info = acpi_ps_get_opcode_info (op->common.aml_opcode); + walk_state->op_info = + acpi_ps_get_opcode_info(op->common.aml_opcode); if (walk_state->op_info->flags & AML_NAMED) { if (acpi_gbl_depth) { acpi_gbl_depth--; @@ -536,7 +602,8 @@ acpi_ps_parse_loop ( * Completed parsing an op_region declaration, we now * know the length. */ - op->named.length = (u32) (parser_state->aml - op->named.data); + op->named.length = + (u32) (parser_state->aml - op->named.data); } } @@ -547,25 +614,26 @@ acpi_ps_parse_loop ( * * body_length is unknown until we parse the body */ - op->named.length = (u32) (parser_state->aml - op->named.data); + op->named.length = + (u32) (parser_state->aml - op->named.data); } /* This op complete, notify the dispatcher */ if (walk_state->ascending_callback != NULL) { - walk_state->op = op; + walk_state->op = op; walk_state->opcode = op->common.aml_opcode; - status = walk_state->ascending_callback (walk_state); - status = acpi_ps_next_parse_state (walk_state, op, status); + status = walk_state->ascending_callback(walk_state); + status = + acpi_ps_next_parse_state(walk_state, op, status); if (status == AE_CTRL_PENDING) { status = AE_OK; goto close_this_op; } } - -close_this_op: + close_this_op: /* * Finished one argument of the containing scope */ @@ -574,15 +642,15 @@ close_this_op: /* Finished with pre_op */ if (pre_op) { - acpi_ps_free_op (pre_op); + acpi_ps_free_op(pre_op); pre_op = NULL; } /* Close this Op (will result in parse subtree deletion) */ - status2 = acpi_ps_complete_this_op (walk_state, op); - if (ACPI_FAILURE (status2)) { - return_ACPI_STATUS (status2); + status2 = acpi_ps_complete_this_op(walk_state, op); + if (ACPI_FAILURE(status2)) { + return_ACPI_STATUS(status2); } op = NULL; @@ -590,68 +658,74 @@ close_this_op: case AE_OK: break; - case AE_CTRL_TRANSFER: /* We are about to transfer to a called method. */ walk_state->prev_op = op; walk_state->prev_arg_types = walk_state->arg_types; - return_ACPI_STATUS (status); - + return_ACPI_STATUS(status); case AE_CTRL_END: - acpi_ps_pop_scope (parser_state, &op, - &walk_state->arg_types, &walk_state->arg_count); + acpi_ps_pop_scope(parser_state, &op, + &walk_state->arg_types, + &walk_state->arg_count); if (op) { - walk_state->op = op; - walk_state->op_info = acpi_ps_get_opcode_info (op->common.aml_opcode); + walk_state->op = op; + walk_state->op_info = + acpi_ps_get_opcode_info(op->common. + aml_opcode); walk_state->opcode = op->common.aml_opcode; - status = walk_state->ascending_callback (walk_state); - status = acpi_ps_next_parse_state (walk_state, op, status); + status = + walk_state->ascending_callback(walk_state); + status = + acpi_ps_next_parse_state(walk_state, op, + status); - status2 = acpi_ps_complete_this_op (walk_state, op); - if (ACPI_FAILURE (status2)) { - return_ACPI_STATUS (status2); + status2 = + acpi_ps_complete_this_op(walk_state, op); + if (ACPI_FAILURE(status2)) { + return_ACPI_STATUS(status2); } op = NULL; } status = AE_OK; break; - case AE_CTRL_BREAK: case AE_CTRL_CONTINUE: /* Pop off scopes until we find the While */ while (!op || (op->common.aml_opcode != AML_WHILE_OP)) { - acpi_ps_pop_scope (parser_state, &op, - &walk_state->arg_types, &walk_state->arg_count); + acpi_ps_pop_scope(parser_state, &op, + &walk_state->arg_types, + &walk_state->arg_count); } /* Close this iteration of the While loop */ - walk_state->op = op; - walk_state->op_info = acpi_ps_get_opcode_info (op->common.aml_opcode); + walk_state->op = op; + walk_state->op_info = + acpi_ps_get_opcode_info(op->common.aml_opcode); walk_state->opcode = op->common.aml_opcode; - status = walk_state->ascending_callback (walk_state); - status = acpi_ps_next_parse_state (walk_state, op, status); + status = walk_state->ascending_callback(walk_state); + status = + acpi_ps_next_parse_state(walk_state, op, status); - status2 = acpi_ps_complete_this_op (walk_state, op); - if (ACPI_FAILURE (status2)) { - return_ACPI_STATUS (status2); + status2 = acpi_ps_complete_this_op(walk_state, op); + if (ACPI_FAILURE(status2)) { + return_ACPI_STATUS(status2); } op = NULL; status = AE_OK; break; - case AE_CTRL_TERMINATE: status = AE_OK; @@ -659,61 +733,66 @@ close_this_op: /* Clean up */ do { if (op) { - status2 = acpi_ps_complete_this_op (walk_state, op); - if (ACPI_FAILURE (status2)) { - return_ACPI_STATUS (status2); + status2 = + acpi_ps_complete_this_op(walk_state, + op); + if (ACPI_FAILURE(status2)) { + return_ACPI_STATUS(status2); } } - acpi_ps_pop_scope (parser_state, &op, - &walk_state->arg_types, &walk_state->arg_count); + acpi_ps_pop_scope(parser_state, &op, + &walk_state->arg_types, + &walk_state->arg_count); } while (op); - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); - - default: /* All other non-AE_OK status */ + default: /* All other non-AE_OK status */ do { if (op) { - status2 = acpi_ps_complete_this_op (walk_state, op); - if (ACPI_FAILURE (status2)) { - return_ACPI_STATUS (status2); + status2 = + acpi_ps_complete_this_op(walk_state, + op); + if (ACPI_FAILURE(status2)) { + return_ACPI_STATUS(status2); } } - acpi_ps_pop_scope (parser_state, &op, - &walk_state->arg_types, &walk_state->arg_count); + acpi_ps_pop_scope(parser_state, &op, + &walk_state->arg_types, + &walk_state->arg_count); } while (op); - /* * TBD: Cleanup parse ops on error */ #if 0 if (op == NULL) { - acpi_ps_pop_scope (parser_state, &op, - &walk_state->arg_types, &walk_state->arg_count); + acpi_ps_pop_scope(parser_state, &op, + &walk_state->arg_types, + &walk_state->arg_count); } #endif walk_state->prev_op = op; walk_state->prev_arg_types = walk_state->arg_types; - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } /* This scope complete? */ - if (acpi_ps_has_completed_scope (parser_state)) { - acpi_ps_pop_scope (parser_state, &op, - &walk_state->arg_types, &walk_state->arg_count); - ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Popped scope, Op=%p\n", op)); - } - else { + if (acpi_ps_has_completed_scope(parser_state)) { + acpi_ps_pop_scope(parser_state, &op, + &walk_state->arg_types, + &walk_state->arg_count); + ACPI_DEBUG_PRINT((ACPI_DB_PARSE, + "Popped scope, Op=%p\n", op)); + } else { op = NULL; } - } /* while parser_state->Aml */ - + } /* while parser_state->Aml */ /* * Complete the last Op (if not completed), and clear the scope stack. @@ -721,16 +800,22 @@ close_this_op: * of open scopes (such as when several ASL blocks are closed with * sequential closing braces). We want to terminate each one cleanly. */ - ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "AML package complete at Op %p\n", op)); + ACPI_DEBUG_PRINT((ACPI_DB_PARSE, "AML package complete at Op %p\n", + op)); do { if (op) { if (walk_state->ascending_callback != NULL) { - walk_state->op = op; - walk_state->op_info = acpi_ps_get_opcode_info (op->common.aml_opcode); + walk_state->op = op; + walk_state->op_info = + acpi_ps_get_opcode_info(op->common. + aml_opcode); walk_state->opcode = op->common.aml_opcode; - status = walk_state->ascending_callback (walk_state); - status = acpi_ps_next_parse_state (walk_state, op, status); + status = + walk_state->ascending_callback(walk_state); + status = + acpi_ps_next_parse_state(walk_state, op, + status); if (status == AE_CTRL_PENDING) { status = AE_OK; goto close_this_op; @@ -742,40 +827,48 @@ close_this_op: /* Clean up */ do { if (op) { - status2 = acpi_ps_complete_this_op (walk_state, op); - if (ACPI_FAILURE (status2)) { - return_ACPI_STATUS (status2); + status2 = + acpi_ps_complete_this_op + (walk_state, op); + if (ACPI_FAILURE + (status2)) { + return_ACPI_STATUS + (status2); } } - acpi_ps_pop_scope (parser_state, &op, - &walk_state->arg_types, &walk_state->arg_count); + acpi_ps_pop_scope(parser_state, + &op, + &walk_state-> + arg_types, + &walk_state-> + arg_count); } while (op); - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - else if (ACPI_FAILURE (status)) { + else if (ACPI_FAILURE(status)) { /* First error is most important */ - (void) acpi_ps_complete_this_op (walk_state, op); - return_ACPI_STATUS (status); + (void) + acpi_ps_complete_this_op(walk_state, + op); + return_ACPI_STATUS(status); } } - status2 = acpi_ps_complete_this_op (walk_state, op); - if (ACPI_FAILURE (status2)) { - return_ACPI_STATUS (status2); + status2 = acpi_ps_complete_this_op(walk_state, op); + if (ACPI_FAILURE(status2)) { + return_ACPI_STATUS(status2); } } - acpi_ps_pop_scope (parser_state, &op, &walk_state->arg_types, - &walk_state->arg_count); + acpi_ps_pop_scope(parser_state, &op, &walk_state->arg_types, + &walk_state->arg_count); } while (op); - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - - diff --git a/drivers/acpi/parser/psopcode.c b/drivers/acpi/parser/psopcode.c index 6f7594a516d..229ae86afe8 100644 --- a/drivers/acpi/parser/psopcode.c +++ b/drivers/acpi/parser/psopcode.c @@ -41,16 +41,13 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include #include #include #include - #define _COMPONENT ACPI_PARSER - ACPI_MODULE_NAME ("psopcode") - +ACPI_MODULE_NAME("psopcode") /******************************************************************************* * @@ -62,7 +59,6 @@ * the operand type. * ******************************************************************************/ - /* * Summary of opcode types/flags * @@ -180,156 +176,468 @@ AML_CREATE_QWORD_FIELD_OP ******************************************************************************/ - - /* * Master Opcode information table. A summary of everything we know about each * opcode, all in one place. */ -const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES] = -{ +const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES] = { /*! [Begin] no source code translation */ /* Index Name Parser Args Interpreter Args ObjectType Class Type Flags */ -/* 00 */ ACPI_OP ("Zero", ARGP_ZERO_OP, ARGI_ZERO_OP, ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, AML_TYPE_CONSTANT, AML_CONSTANT), -/* 01 */ ACPI_OP ("One", ARGP_ONE_OP, ARGI_ONE_OP, ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, AML_TYPE_CONSTANT, AML_CONSTANT), -/* 02 */ ACPI_OP ("Alias", ARGP_ALIAS_OP, ARGI_ALIAS_OP, ACPI_TYPE_LOCAL_ALIAS, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_SIMPLE, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED), -/* 03 */ ACPI_OP ("Name", ARGP_NAME_OP, ARGI_NAME_OP, ACPI_TYPE_ANY, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_COMPLEX, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED), -/* 04 */ ACPI_OP ("ByteConst", ARGP_BYTE_OP, ARGI_BYTE_OP, ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, AML_CONSTANT), -/* 05 */ ACPI_OP ("WordConst", ARGP_WORD_OP, ARGI_WORD_OP, ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, AML_CONSTANT), -/* 06 */ ACPI_OP ("DwordConst", ARGP_DWORD_OP, ARGI_DWORD_OP, ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, AML_CONSTANT), -/* 07 */ ACPI_OP ("String", ARGP_STRING_OP, ARGI_STRING_OP, ACPI_TYPE_STRING, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, AML_CONSTANT), -/* 08 */ ACPI_OP ("Scope", ARGP_SCOPE_OP, ARGI_SCOPE_OP, ACPI_TYPE_LOCAL_SCOPE, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_NO_OBJ, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED), -/* 09 */ ACPI_OP ("Buffer", ARGP_BUFFER_OP, ARGI_BUFFER_OP, ACPI_TYPE_BUFFER, AML_CLASS_CREATE, AML_TYPE_CREATE_OBJECT, AML_HAS_ARGS | AML_DEFER | AML_CONSTANT), -/* 0A */ ACPI_OP ("Package", ARGP_PACKAGE_OP, ARGI_PACKAGE_OP, ACPI_TYPE_PACKAGE, AML_CLASS_CREATE, AML_TYPE_CREATE_OBJECT, AML_HAS_ARGS | AML_DEFER | AML_CONSTANT), -/* 0B */ ACPI_OP ("Method", ARGP_METHOD_OP, ARGI_METHOD_OP, ACPI_TYPE_METHOD, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_COMPLEX, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED | AML_DEFER), -/* 0C */ ACPI_OP ("Local0", ARGP_LOCAL0, ARGI_LOCAL0, ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_LOCAL_VARIABLE, 0), -/* 0D */ ACPI_OP ("Local1", ARGP_LOCAL1, ARGI_LOCAL1, ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_LOCAL_VARIABLE, 0), -/* 0E */ ACPI_OP ("Local2", ARGP_LOCAL2, ARGI_LOCAL2, ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_LOCAL_VARIABLE, 0), -/* 0F */ ACPI_OP ("Local3", ARGP_LOCAL3, ARGI_LOCAL3, ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_LOCAL_VARIABLE, 0), -/* 10 */ ACPI_OP ("Local4", ARGP_LOCAL4, ARGI_LOCAL4, ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_LOCAL_VARIABLE, 0), -/* 11 */ ACPI_OP ("Local5", ARGP_LOCAL5, ARGI_LOCAL5, ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_LOCAL_VARIABLE, 0), -/* 12 */ ACPI_OP ("Local6", ARGP_LOCAL6, ARGI_LOCAL6, ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_LOCAL_VARIABLE, 0), -/* 13 */ ACPI_OP ("Local7", ARGP_LOCAL7, ARGI_LOCAL7, ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_LOCAL_VARIABLE, 0), -/* 14 */ ACPI_OP ("Arg0", ARGP_ARG0, ARGI_ARG0, ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_METHOD_ARGUMENT, 0), -/* 15 */ ACPI_OP ("Arg1", ARGP_ARG1, ARGI_ARG1, ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_METHOD_ARGUMENT, 0), -/* 16 */ ACPI_OP ("Arg2", ARGP_ARG2, ARGI_ARG2, ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_METHOD_ARGUMENT, 0), -/* 17 */ ACPI_OP ("Arg3", ARGP_ARG3, ARGI_ARG3, ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_METHOD_ARGUMENT, 0), -/* 18 */ ACPI_OP ("Arg4", ARGP_ARG4, ARGI_ARG4, ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_METHOD_ARGUMENT, 0), -/* 19 */ ACPI_OP ("Arg5", ARGP_ARG5, ARGI_ARG5, ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_METHOD_ARGUMENT, 0), -/* 1A */ ACPI_OP ("Arg6", ARGP_ARG6, ARGI_ARG6, ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_METHOD_ARGUMENT, 0), -/* 1B */ ACPI_OP ("Store", ARGP_STORE_OP, ARGI_STORE_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R), -/* 1C */ ACPI_OP ("RefOf", ARGP_REF_OF_OP, ARGI_REF_OF_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R, AML_FLAGS_EXEC_1A_0T_1R), -/* 1D */ ACPI_OP ("Add", ARGP_ADD_OP, ARGI_ADD_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT), -/* 1E */ ACPI_OP ("Concatenate", ARGP_CONCAT_OP, ARGI_CONCAT_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_CONSTANT), -/* 1F */ ACPI_OP ("Subtract", ARGP_SUBTRACT_OP, ARGI_SUBTRACT_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT), -/* 20 */ ACPI_OP ("Increment", ARGP_INCREMENT_OP, ARGI_INCREMENT_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R, AML_FLAGS_EXEC_1A_0T_1R | AML_CONSTANT), -/* 21 */ ACPI_OP ("Decrement", ARGP_DECREMENT_OP, ARGI_DECREMENT_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R, AML_FLAGS_EXEC_1A_0T_1R | AML_CONSTANT), -/* 22 */ ACPI_OP ("Multiply", ARGP_MULTIPLY_OP, ARGI_MULTIPLY_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT), -/* 23 */ ACPI_OP ("Divide", ARGP_DIVIDE_OP, ARGI_DIVIDE_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_2T_1R, AML_FLAGS_EXEC_2A_2T_1R | AML_CONSTANT), -/* 24 */ ACPI_OP ("ShiftLeft", ARGP_SHIFT_LEFT_OP, ARGI_SHIFT_LEFT_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT), -/* 25 */ ACPI_OP ("ShiftRight", ARGP_SHIFT_RIGHT_OP, ARGI_SHIFT_RIGHT_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT), -/* 26 */ ACPI_OP ("And", ARGP_BIT_AND_OP, ARGI_BIT_AND_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT), -/* 27 */ ACPI_OP ("NAnd", ARGP_BIT_NAND_OP, ARGI_BIT_NAND_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT), -/* 28 */ ACPI_OP ("Or", ARGP_BIT_OR_OP, ARGI_BIT_OR_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT), -/* 29 */ ACPI_OP ("NOr", ARGP_BIT_NOR_OP, ARGI_BIT_NOR_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT), -/* 2A */ ACPI_OP ("XOr", ARGP_BIT_XOR_OP, ARGI_BIT_XOR_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT), -/* 2B */ ACPI_OP ("Not", ARGP_BIT_NOT_OP, ARGI_BIT_NOT_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT), -/* 2C */ ACPI_OP ("FindSetLeftBit", ARGP_FIND_SET_LEFT_BIT_OP, ARGI_FIND_SET_LEFT_BIT_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT), -/* 2D */ ACPI_OP ("FindSetRightBit", ARGP_FIND_SET_RIGHT_BIT_OP,ARGI_FIND_SET_RIGHT_BIT_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT), -/* 2E */ ACPI_OP ("DerefOf", ARGP_DEREF_OF_OP, ARGI_DEREF_OF_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R, AML_FLAGS_EXEC_1A_0T_1R), -/* 2F */ ACPI_OP ("Notify", ARGP_NOTIFY_OP, ARGI_NOTIFY_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_0R, AML_FLAGS_EXEC_2A_0T_0R), -/* 30 */ ACPI_OP ("SizeOf", ARGP_SIZE_OF_OP, ARGI_SIZE_OF_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R, AML_FLAGS_EXEC_1A_0T_1R | AML_NO_OPERAND_RESOLVE), -/* 31 */ ACPI_OP ("Index", ARGP_INDEX_OP, ARGI_INDEX_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R), -/* 32 */ ACPI_OP ("Match", ARGP_MATCH_OP, ARGI_MATCH_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_6A_0T_1R, AML_FLAGS_EXEC_6A_0T_1R | AML_CONSTANT), -/* 33 */ ACPI_OP ("CreateDWordField", ARGP_CREATE_DWORD_FIELD_OP,ARGI_CREATE_DWORD_FIELD_OP, ACPI_TYPE_BUFFER_FIELD, AML_CLASS_CREATE, AML_TYPE_CREATE_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | AML_DEFER | AML_CREATE), -/* 34 */ ACPI_OP ("CreateWordField", ARGP_CREATE_WORD_FIELD_OP, ARGI_CREATE_WORD_FIELD_OP, ACPI_TYPE_BUFFER_FIELD, AML_CLASS_CREATE, AML_TYPE_CREATE_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | AML_DEFER | AML_CREATE), -/* 35 */ ACPI_OP ("CreateByteField", ARGP_CREATE_BYTE_FIELD_OP, ARGI_CREATE_BYTE_FIELD_OP, ACPI_TYPE_BUFFER_FIELD, AML_CLASS_CREATE, AML_TYPE_CREATE_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | AML_DEFER | AML_CREATE), -/* 36 */ ACPI_OP ("CreateBitField", ARGP_CREATE_BIT_FIELD_OP, ARGI_CREATE_BIT_FIELD_OP, ACPI_TYPE_BUFFER_FIELD, AML_CLASS_CREATE, AML_TYPE_CREATE_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | AML_DEFER | AML_CREATE), -/* 37 */ ACPI_OP ("ObjectType", ARGP_TYPE_OP, ARGI_TYPE_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R, AML_FLAGS_EXEC_1A_0T_1R | AML_NO_OPERAND_RESOLVE), -/* 38 */ ACPI_OP ("LAnd", ARGP_LAND_OP, ARGI_LAND_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL_NUMERIC | AML_CONSTANT), -/* 39 */ ACPI_OP ("LOr", ARGP_LOR_OP, ARGI_LOR_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL_NUMERIC | AML_CONSTANT), -/* 3A */ ACPI_OP ("LNot", ARGP_LNOT_OP, ARGI_LNOT_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R, AML_FLAGS_EXEC_1A_0T_1R | AML_CONSTANT), -/* 3B */ ACPI_OP ("LEqual", ARGP_LEQUAL_OP, ARGI_LEQUAL_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL | AML_CONSTANT), -/* 3C */ ACPI_OP ("LGreater", ARGP_LGREATER_OP, ARGI_LGREATER_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL | AML_CONSTANT), -/* 3D */ ACPI_OP ("LLess", ARGP_LLESS_OP, ARGI_LLESS_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL | AML_CONSTANT), -/* 3E */ ACPI_OP ("If", ARGP_IF_OP, ARGI_IF_OP, ACPI_TYPE_ANY, AML_CLASS_CONTROL, AML_TYPE_CONTROL, AML_HAS_ARGS), -/* 3F */ ACPI_OP ("Else", ARGP_ELSE_OP, ARGI_ELSE_OP, ACPI_TYPE_ANY, AML_CLASS_CONTROL, AML_TYPE_CONTROL, AML_HAS_ARGS), -/* 40 */ ACPI_OP ("While", ARGP_WHILE_OP, ARGI_WHILE_OP, ACPI_TYPE_ANY, AML_CLASS_CONTROL, AML_TYPE_CONTROL, AML_HAS_ARGS), -/* 41 */ ACPI_OP ("Noop", ARGP_NOOP_OP, ARGI_NOOP_OP, ACPI_TYPE_ANY, AML_CLASS_CONTROL, AML_TYPE_CONTROL, 0), -/* 42 */ ACPI_OP ("Return", ARGP_RETURN_OP, ARGI_RETURN_OP, ACPI_TYPE_ANY, AML_CLASS_CONTROL, AML_TYPE_CONTROL, AML_HAS_ARGS), -/* 43 */ ACPI_OP ("Break", ARGP_BREAK_OP, ARGI_BREAK_OP, ACPI_TYPE_ANY, AML_CLASS_CONTROL, AML_TYPE_CONTROL, 0), -/* 44 */ ACPI_OP ("BreakPoint", ARGP_BREAK_POINT_OP, ARGI_BREAK_POINT_OP, ACPI_TYPE_ANY, AML_CLASS_CONTROL, AML_TYPE_CONTROL, 0), -/* 45 */ ACPI_OP ("Ones", ARGP_ONES_OP, ARGI_ONES_OP, ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, AML_TYPE_CONSTANT, AML_CONSTANT), +/* 00 */ ACPI_OP("Zero", ARGP_ZERO_OP, ARGI_ZERO_OP, ACPI_TYPE_INTEGER, + AML_CLASS_ARGUMENT, AML_TYPE_CONSTANT, AML_CONSTANT), +/* 01 */ ACPI_OP("One", ARGP_ONE_OP, ARGI_ONE_OP, ACPI_TYPE_INTEGER, + AML_CLASS_ARGUMENT, AML_TYPE_CONSTANT, AML_CONSTANT), +/* 02 */ ACPI_OP("Alias", ARGP_ALIAS_OP, ARGI_ALIAS_OP, + ACPI_TYPE_LOCAL_ALIAS, AML_CLASS_NAMED_OBJECT, + AML_TYPE_NAMED_SIMPLE, + AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | + AML_NSNODE | AML_NAMED), +/* 03 */ ACPI_OP("Name", ARGP_NAME_OP, ARGI_NAME_OP, ACPI_TYPE_ANY, + AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_COMPLEX, + AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | + AML_NSNODE | AML_NAMED), +/* 04 */ ACPI_OP("ByteConst", ARGP_BYTE_OP, ARGI_BYTE_OP, + ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, + AML_TYPE_LITERAL, AML_CONSTANT), +/* 05 */ ACPI_OP("WordConst", ARGP_WORD_OP, ARGI_WORD_OP, + ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, + AML_TYPE_LITERAL, AML_CONSTANT), +/* 06 */ ACPI_OP("DwordConst", ARGP_DWORD_OP, ARGI_DWORD_OP, + ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, + AML_TYPE_LITERAL, AML_CONSTANT), +/* 07 */ ACPI_OP("String", ARGP_STRING_OP, ARGI_STRING_OP, + ACPI_TYPE_STRING, AML_CLASS_ARGUMENT, + AML_TYPE_LITERAL, AML_CONSTANT), +/* 08 */ ACPI_OP("Scope", ARGP_SCOPE_OP, ARGI_SCOPE_OP, + ACPI_TYPE_LOCAL_SCOPE, AML_CLASS_NAMED_OBJECT, + AML_TYPE_NAMED_NO_OBJ, + AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | + AML_NSNODE | AML_NAMED), +/* 09 */ ACPI_OP("Buffer", ARGP_BUFFER_OP, ARGI_BUFFER_OP, + ACPI_TYPE_BUFFER, AML_CLASS_CREATE, + AML_TYPE_CREATE_OBJECT, + AML_HAS_ARGS | AML_DEFER | AML_CONSTANT), +/* 0A */ ACPI_OP("Package", ARGP_PACKAGE_OP, ARGI_PACKAGE_OP, + ACPI_TYPE_PACKAGE, AML_CLASS_CREATE, + AML_TYPE_CREATE_OBJECT, + AML_HAS_ARGS | AML_DEFER | AML_CONSTANT), +/* 0B */ ACPI_OP("Method", ARGP_METHOD_OP, ARGI_METHOD_OP, + ACPI_TYPE_METHOD, AML_CLASS_NAMED_OBJECT, + AML_TYPE_NAMED_COMPLEX, + AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | + AML_NSNODE | AML_NAMED | AML_DEFER), +/* 0C */ ACPI_OP("Local0", ARGP_LOCAL0, ARGI_LOCAL0, + ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, + AML_TYPE_LOCAL_VARIABLE, 0), +/* 0D */ ACPI_OP("Local1", ARGP_LOCAL1, ARGI_LOCAL1, + ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, + AML_TYPE_LOCAL_VARIABLE, 0), +/* 0E */ ACPI_OP("Local2", ARGP_LOCAL2, ARGI_LOCAL2, + ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, + AML_TYPE_LOCAL_VARIABLE, 0), +/* 0F */ ACPI_OP("Local3", ARGP_LOCAL3, ARGI_LOCAL3, + ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, + AML_TYPE_LOCAL_VARIABLE, 0), +/* 10 */ ACPI_OP("Local4", ARGP_LOCAL4, ARGI_LOCAL4, + ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, + AML_TYPE_LOCAL_VARIABLE, 0), +/* 11 */ ACPI_OP("Local5", ARGP_LOCAL5, ARGI_LOCAL5, + ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, + AML_TYPE_LOCAL_VARIABLE, 0), +/* 12 */ ACPI_OP("Local6", ARGP_LOCAL6, ARGI_LOCAL6, + ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, + AML_TYPE_LOCAL_VARIABLE, 0), +/* 13 */ ACPI_OP("Local7", ARGP_LOCAL7, ARGI_LOCAL7, + ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, + AML_TYPE_LOCAL_VARIABLE, 0), +/* 14 */ ACPI_OP("Arg0", ARGP_ARG0, ARGI_ARG0, + ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, + AML_TYPE_METHOD_ARGUMENT, 0), +/* 15 */ ACPI_OP("Arg1", ARGP_ARG1, ARGI_ARG1, + ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, + AML_TYPE_METHOD_ARGUMENT, 0), +/* 16 */ ACPI_OP("Arg2", ARGP_ARG2, ARGI_ARG2, + ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, + AML_TYPE_METHOD_ARGUMENT, 0), +/* 17 */ ACPI_OP("Arg3", ARGP_ARG3, ARGI_ARG3, + ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, + AML_TYPE_METHOD_ARGUMENT, 0), +/* 18 */ ACPI_OP("Arg4", ARGP_ARG4, ARGI_ARG4, + ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, + AML_TYPE_METHOD_ARGUMENT, 0), +/* 19 */ ACPI_OP("Arg5", ARGP_ARG5, ARGI_ARG5, + ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, + AML_TYPE_METHOD_ARGUMENT, 0), +/* 1A */ ACPI_OP("Arg6", ARGP_ARG6, ARGI_ARG6, + ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, + AML_TYPE_METHOD_ARGUMENT, 0), +/* 1B */ ACPI_OP("Store", ARGP_STORE_OP, ARGI_STORE_OP, ACPI_TYPE_ANY, + AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, + AML_FLAGS_EXEC_1A_1T_1R), +/* 1C */ ACPI_OP("RefOf", ARGP_REF_OF_OP, ARGI_REF_OF_OP, ACPI_TYPE_ANY, + AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R, + AML_FLAGS_EXEC_1A_0T_1R), +/* 1D */ ACPI_OP("Add", ARGP_ADD_OP, ARGI_ADD_OP, ACPI_TYPE_ANY, + AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, + AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT), +/* 1E */ ACPI_OP("Concatenate", ARGP_CONCAT_OP, ARGI_CONCAT_OP, + ACPI_TYPE_ANY, AML_CLASS_EXECUTE, + AML_TYPE_EXEC_2A_1T_1R, + AML_FLAGS_EXEC_2A_1T_1R | AML_CONSTANT), +/* 1F */ ACPI_OP("Subtract", ARGP_SUBTRACT_OP, ARGI_SUBTRACT_OP, + ACPI_TYPE_ANY, AML_CLASS_EXECUTE, + AML_TYPE_EXEC_2A_1T_1R, + AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT), +/* 20 */ ACPI_OP("Increment", ARGP_INCREMENT_OP, ARGI_INCREMENT_OP, + ACPI_TYPE_ANY, AML_CLASS_EXECUTE, + AML_TYPE_EXEC_1A_0T_1R, + AML_FLAGS_EXEC_1A_0T_1R | AML_CONSTANT), +/* 21 */ ACPI_OP("Decrement", ARGP_DECREMENT_OP, ARGI_DECREMENT_OP, + ACPI_TYPE_ANY, AML_CLASS_EXECUTE, + AML_TYPE_EXEC_1A_0T_1R, + AML_FLAGS_EXEC_1A_0T_1R | AML_CONSTANT), +/* 22 */ ACPI_OP("Multiply", ARGP_MULTIPLY_OP, ARGI_MULTIPLY_OP, + ACPI_TYPE_ANY, AML_CLASS_EXECUTE, + AML_TYPE_EXEC_2A_1T_1R, + AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT), +/* 23 */ ACPI_OP("Divide", ARGP_DIVIDE_OP, ARGI_DIVIDE_OP, + ACPI_TYPE_ANY, AML_CLASS_EXECUTE, + AML_TYPE_EXEC_2A_2T_1R, + AML_FLAGS_EXEC_2A_2T_1R | AML_CONSTANT), +/* 24 */ ACPI_OP("ShiftLeft", ARGP_SHIFT_LEFT_OP, ARGI_SHIFT_LEFT_OP, + ACPI_TYPE_ANY, AML_CLASS_EXECUTE, + AML_TYPE_EXEC_2A_1T_1R, + AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT), +/* 25 */ ACPI_OP("ShiftRight", ARGP_SHIFT_RIGHT_OP, ARGI_SHIFT_RIGHT_OP, + ACPI_TYPE_ANY, AML_CLASS_EXECUTE, + AML_TYPE_EXEC_2A_1T_1R, + AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT), +/* 26 */ ACPI_OP("And", ARGP_BIT_AND_OP, ARGI_BIT_AND_OP, ACPI_TYPE_ANY, + AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, + AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT), +/* 27 */ ACPI_OP("NAnd", ARGP_BIT_NAND_OP, ARGI_BIT_NAND_OP, + ACPI_TYPE_ANY, AML_CLASS_EXECUTE, + AML_TYPE_EXEC_2A_1T_1R, + AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT), +/* 28 */ ACPI_OP("Or", ARGP_BIT_OR_OP, ARGI_BIT_OR_OP, ACPI_TYPE_ANY, + AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, + AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT), +/* 29 */ ACPI_OP("NOr", ARGP_BIT_NOR_OP, ARGI_BIT_NOR_OP, ACPI_TYPE_ANY, + AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, + AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT), +/* 2A */ ACPI_OP("XOr", ARGP_BIT_XOR_OP, ARGI_BIT_XOR_OP, ACPI_TYPE_ANY, + AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, + AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT), +/* 2B */ ACPI_OP("Not", ARGP_BIT_NOT_OP, ARGI_BIT_NOT_OP, ACPI_TYPE_ANY, + AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, + AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT), +/* 2C */ ACPI_OP("FindSetLeftBit", ARGP_FIND_SET_LEFT_BIT_OP, + ARGI_FIND_SET_LEFT_BIT_OP, ACPI_TYPE_ANY, + AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, + AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT), +/* 2D */ ACPI_OP("FindSetRightBit", ARGP_FIND_SET_RIGHT_BIT_OP, + ARGI_FIND_SET_RIGHT_BIT_OP, ACPI_TYPE_ANY, + AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, + AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT), +/* 2E */ ACPI_OP("DerefOf", ARGP_DEREF_OF_OP, ARGI_DEREF_OF_OP, + ACPI_TYPE_ANY, AML_CLASS_EXECUTE, + AML_TYPE_EXEC_1A_0T_1R, AML_FLAGS_EXEC_1A_0T_1R), +/* 2F */ ACPI_OP("Notify", ARGP_NOTIFY_OP, ARGI_NOTIFY_OP, + ACPI_TYPE_ANY, AML_CLASS_EXECUTE, + AML_TYPE_EXEC_2A_0T_0R, AML_FLAGS_EXEC_2A_0T_0R), +/* 30 */ ACPI_OP("SizeOf", ARGP_SIZE_OF_OP, ARGI_SIZE_OF_OP, + ACPI_TYPE_ANY, AML_CLASS_EXECUTE, + AML_TYPE_EXEC_1A_0T_1R, + AML_FLAGS_EXEC_1A_0T_1R | AML_NO_OPERAND_RESOLVE), +/* 31 */ ACPI_OP("Index", ARGP_INDEX_OP, ARGI_INDEX_OP, ACPI_TYPE_ANY, + AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, + AML_FLAGS_EXEC_2A_1T_1R), +/* 32 */ ACPI_OP("Match", ARGP_MATCH_OP, ARGI_MATCH_OP, ACPI_TYPE_ANY, + AML_CLASS_EXECUTE, AML_TYPE_EXEC_6A_0T_1R, + AML_FLAGS_EXEC_6A_0T_1R | AML_CONSTANT), +/* 33 */ ACPI_OP("CreateDWordField", ARGP_CREATE_DWORD_FIELD_OP, + ARGI_CREATE_DWORD_FIELD_OP, + ACPI_TYPE_BUFFER_FIELD, AML_CLASS_CREATE, + AML_TYPE_CREATE_FIELD, + AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | + AML_DEFER | AML_CREATE), +/* 34 */ ACPI_OP("CreateWordField", ARGP_CREATE_WORD_FIELD_OP, + ARGI_CREATE_WORD_FIELD_OP, + ACPI_TYPE_BUFFER_FIELD, AML_CLASS_CREATE, + AML_TYPE_CREATE_FIELD, + AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | + AML_DEFER | AML_CREATE), +/* 35 */ ACPI_OP("CreateByteField", ARGP_CREATE_BYTE_FIELD_OP, + ARGI_CREATE_BYTE_FIELD_OP, + ACPI_TYPE_BUFFER_FIELD, AML_CLASS_CREATE, + AML_TYPE_CREATE_FIELD, + AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | + AML_DEFER | AML_CREATE), +/* 36 */ ACPI_OP("CreateBitField", ARGP_CREATE_BIT_FIELD_OP, + ARGI_CREATE_BIT_FIELD_OP, + ACPI_TYPE_BUFFER_FIELD, AML_CLASS_CREATE, + AML_TYPE_CREATE_FIELD, + AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | + AML_DEFER | AML_CREATE), +/* 37 */ ACPI_OP("ObjectType", ARGP_TYPE_OP, ARGI_TYPE_OP, + ACPI_TYPE_ANY, AML_CLASS_EXECUTE, + AML_TYPE_EXEC_1A_0T_1R, + AML_FLAGS_EXEC_1A_0T_1R | AML_NO_OPERAND_RESOLVE), +/* 38 */ ACPI_OP("LAnd", ARGP_LAND_OP, ARGI_LAND_OP, ACPI_TYPE_ANY, + AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, + AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL_NUMERIC | + AML_CONSTANT), +/* 39 */ ACPI_OP("LOr", ARGP_LOR_OP, ARGI_LOR_OP, ACPI_TYPE_ANY, + AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, + AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL_NUMERIC | + AML_CONSTANT), +/* 3A */ ACPI_OP("LNot", ARGP_LNOT_OP, ARGI_LNOT_OP, ACPI_TYPE_ANY, + AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R, + AML_FLAGS_EXEC_1A_0T_1R | AML_CONSTANT), +/* 3B */ ACPI_OP("LEqual", ARGP_LEQUAL_OP, ARGI_LEQUAL_OP, + ACPI_TYPE_ANY, AML_CLASS_EXECUTE, + AML_TYPE_EXEC_2A_0T_1R, + AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL | AML_CONSTANT), +/* 3C */ ACPI_OP("LGreater", ARGP_LGREATER_OP, ARGI_LGREATER_OP, + ACPI_TYPE_ANY, AML_CLASS_EXECUTE, + AML_TYPE_EXEC_2A_0T_1R, + AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL | AML_CONSTANT), +/* 3D */ ACPI_OP("LLess", ARGP_LLESS_OP, ARGI_LLESS_OP, ACPI_TYPE_ANY, + AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, + AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL | AML_CONSTANT), +/* 3E */ ACPI_OP("If", ARGP_IF_OP, ARGI_IF_OP, ACPI_TYPE_ANY, + AML_CLASS_CONTROL, AML_TYPE_CONTROL, AML_HAS_ARGS), +/* 3F */ ACPI_OP("Else", ARGP_ELSE_OP, ARGI_ELSE_OP, ACPI_TYPE_ANY, + AML_CLASS_CONTROL, AML_TYPE_CONTROL, AML_HAS_ARGS), +/* 40 */ ACPI_OP("While", ARGP_WHILE_OP, ARGI_WHILE_OP, ACPI_TYPE_ANY, + AML_CLASS_CONTROL, AML_TYPE_CONTROL, AML_HAS_ARGS), +/* 41 */ ACPI_OP("Noop", ARGP_NOOP_OP, ARGI_NOOP_OP, ACPI_TYPE_ANY, + AML_CLASS_CONTROL, AML_TYPE_CONTROL, 0), +/* 42 */ ACPI_OP("Return", ARGP_RETURN_OP, ARGI_RETURN_OP, + ACPI_TYPE_ANY, AML_CLASS_CONTROL, + AML_TYPE_CONTROL, AML_HAS_ARGS), +/* 43 */ ACPI_OP("Break", ARGP_BREAK_OP, ARGI_BREAK_OP, ACPI_TYPE_ANY, + AML_CLASS_CONTROL, AML_TYPE_CONTROL, 0), +/* 44 */ ACPI_OP("BreakPoint", ARGP_BREAK_POINT_OP, ARGI_BREAK_POINT_OP, + ACPI_TYPE_ANY, AML_CLASS_CONTROL, AML_TYPE_CONTROL, 0), +/* 45 */ ACPI_OP("Ones", ARGP_ONES_OP, ARGI_ONES_OP, ACPI_TYPE_INTEGER, + AML_CLASS_ARGUMENT, AML_TYPE_CONSTANT, AML_CONSTANT), /* Prefixed opcodes (Two-byte opcodes with a prefix op) */ -/* 46 */ ACPI_OP ("Mutex", ARGP_MUTEX_OP, ARGI_MUTEX_OP, ACPI_TYPE_MUTEX, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_SIMPLE, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED), -/* 47 */ ACPI_OP ("Event", ARGP_EVENT_OP, ARGI_EVENT_OP, ACPI_TYPE_EVENT, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_SIMPLE, AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED ), -/* 48 */ ACPI_OP ("CondRefOf", ARGP_COND_REF_OF_OP, ARGI_COND_REF_OF_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R), -/* 49 */ ACPI_OP ("CreateField", ARGP_CREATE_FIELD_OP, ARGI_CREATE_FIELD_OP, ACPI_TYPE_BUFFER_FIELD, AML_CLASS_CREATE, AML_TYPE_CREATE_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | AML_DEFER | AML_FIELD | AML_CREATE), -/* 4A */ ACPI_OP ("Load", ARGP_LOAD_OP, ARGI_LOAD_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_0R, AML_FLAGS_EXEC_1A_1T_0R), -/* 4B */ ACPI_OP ("Stall", ARGP_STALL_OP, ARGI_STALL_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_0R, AML_FLAGS_EXEC_1A_0T_0R), -/* 4C */ ACPI_OP ("Sleep", ARGP_SLEEP_OP, ARGI_SLEEP_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_0R, AML_FLAGS_EXEC_1A_0T_0R), -/* 4D */ ACPI_OP ("Acquire", ARGP_ACQUIRE_OP, ARGI_ACQUIRE_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, AML_FLAGS_EXEC_2A_0T_1R), -/* 4E */ ACPI_OP ("Signal", ARGP_SIGNAL_OP, ARGI_SIGNAL_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_0R, AML_FLAGS_EXEC_1A_0T_0R), -/* 4F */ ACPI_OP ("Wait", ARGP_WAIT_OP, ARGI_WAIT_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, AML_FLAGS_EXEC_2A_0T_1R), -/* 50 */ ACPI_OP ("Reset", ARGP_RESET_OP, ARGI_RESET_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_0R, AML_FLAGS_EXEC_1A_0T_0R), -/* 51 */ ACPI_OP ("Release", ARGP_RELEASE_OP, ARGI_RELEASE_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_0R, AML_FLAGS_EXEC_1A_0T_0R), -/* 52 */ ACPI_OP ("FromBCD", ARGP_FROM_BCD_OP, ARGI_FROM_BCD_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT), -/* 53 */ ACPI_OP ("ToBCD", ARGP_TO_BCD_OP, ARGI_TO_BCD_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT), -/* 54 */ ACPI_OP ("Unload", ARGP_UNLOAD_OP, ARGI_UNLOAD_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_0R, AML_FLAGS_EXEC_1A_0T_0R), -/* 55 */ ACPI_OP ("Revision", ARGP_REVISION_OP, ARGI_REVISION_OP, ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, AML_TYPE_CONSTANT, 0), -/* 56 */ ACPI_OP ("Debug", ARGP_DEBUG_OP, ARGI_DEBUG_OP, ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_CONSTANT, 0), -/* 57 */ ACPI_OP ("Fatal", ARGP_FATAL_OP, ARGI_FATAL_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_3A_0T_0R, AML_FLAGS_EXEC_3A_0T_0R), -/* 58 */ ACPI_OP ("OperationRegion", ARGP_REGION_OP, ARGI_REGION_OP, ACPI_TYPE_REGION, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_COMPLEX, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED | AML_DEFER), -/* 59 */ ACPI_OP ("Field", ARGP_FIELD_OP, ARGI_FIELD_OP, ACPI_TYPE_ANY, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_FIELD), -/* 5A */ ACPI_OP ("Device", ARGP_DEVICE_OP, ARGI_DEVICE_OP, ACPI_TYPE_DEVICE, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_NO_OBJ, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED), -/* 5B */ ACPI_OP ("Processor", ARGP_PROCESSOR_OP, ARGI_PROCESSOR_OP, ACPI_TYPE_PROCESSOR, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_SIMPLE, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED), -/* 5C */ ACPI_OP ("PowerResource", ARGP_POWER_RES_OP, ARGI_POWER_RES_OP, ACPI_TYPE_POWER, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_SIMPLE, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED), -/* 5D */ ACPI_OP ("ThermalZone", ARGP_THERMAL_ZONE_OP, ARGI_THERMAL_ZONE_OP, ACPI_TYPE_THERMAL, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_NO_OBJ, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED), -/* 5E */ ACPI_OP ("IndexField", ARGP_INDEX_FIELD_OP, ARGI_INDEX_FIELD_OP, ACPI_TYPE_ANY, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_FIELD), -/* 5F */ ACPI_OP ("BankField", ARGP_BANK_FIELD_OP, ARGI_BANK_FIELD_OP, ACPI_TYPE_ANY, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_FIELD), +/* 46 */ ACPI_OP("Mutex", ARGP_MUTEX_OP, ARGI_MUTEX_OP, ACPI_TYPE_MUTEX, + AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_SIMPLE, + AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | + AML_NSNODE | AML_NAMED), +/* 47 */ ACPI_OP("Event", ARGP_EVENT_OP, ARGI_EVENT_OP, ACPI_TYPE_EVENT, + AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_SIMPLE, + AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED), +/* 48 */ ACPI_OP("CondRefOf", ARGP_COND_REF_OF_OP, ARGI_COND_REF_OF_OP, + ACPI_TYPE_ANY, AML_CLASS_EXECUTE, + AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R), +/* 49 */ ACPI_OP("CreateField", ARGP_CREATE_FIELD_OP, + ARGI_CREATE_FIELD_OP, ACPI_TYPE_BUFFER_FIELD, + AML_CLASS_CREATE, AML_TYPE_CREATE_FIELD, + AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | + AML_DEFER | AML_FIELD | AML_CREATE), +/* 4A */ ACPI_OP("Load", ARGP_LOAD_OP, ARGI_LOAD_OP, ACPI_TYPE_ANY, + AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_0R, + AML_FLAGS_EXEC_1A_1T_0R), +/* 4B */ ACPI_OP("Stall", ARGP_STALL_OP, ARGI_STALL_OP, ACPI_TYPE_ANY, + AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_0R, + AML_FLAGS_EXEC_1A_0T_0R), +/* 4C */ ACPI_OP("Sleep", ARGP_SLEEP_OP, ARGI_SLEEP_OP, ACPI_TYPE_ANY, + AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_0R, + AML_FLAGS_EXEC_1A_0T_0R), +/* 4D */ ACPI_OP("Acquire", ARGP_ACQUIRE_OP, ARGI_ACQUIRE_OP, + ACPI_TYPE_ANY, AML_CLASS_EXECUTE, + AML_TYPE_EXEC_2A_0T_1R, AML_FLAGS_EXEC_2A_0T_1R), +/* 4E */ ACPI_OP("Signal", ARGP_SIGNAL_OP, ARGI_SIGNAL_OP, + ACPI_TYPE_ANY, AML_CLASS_EXECUTE, + AML_TYPE_EXEC_1A_0T_0R, AML_FLAGS_EXEC_1A_0T_0R), +/* 4F */ ACPI_OP("Wait", ARGP_WAIT_OP, ARGI_WAIT_OP, ACPI_TYPE_ANY, + AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, + AML_FLAGS_EXEC_2A_0T_1R), +/* 50 */ ACPI_OP("Reset", ARGP_RESET_OP, ARGI_RESET_OP, ACPI_TYPE_ANY, + AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_0R, + AML_FLAGS_EXEC_1A_0T_0R), +/* 51 */ ACPI_OP("Release", ARGP_RELEASE_OP, ARGI_RELEASE_OP, + ACPI_TYPE_ANY, AML_CLASS_EXECUTE, + AML_TYPE_EXEC_1A_0T_0R, AML_FLAGS_EXEC_1A_0T_0R), +/* 52 */ ACPI_OP("FromBCD", ARGP_FROM_BCD_OP, ARGI_FROM_BCD_OP, + ACPI_TYPE_ANY, AML_CLASS_EXECUTE, + AML_TYPE_EXEC_1A_1T_1R, + AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT), +/* 53 */ ACPI_OP("ToBCD", ARGP_TO_BCD_OP, ARGI_TO_BCD_OP, ACPI_TYPE_ANY, + AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, + AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT), +/* 54 */ ACPI_OP("Unload", ARGP_UNLOAD_OP, ARGI_UNLOAD_OP, + ACPI_TYPE_ANY, AML_CLASS_EXECUTE, + AML_TYPE_EXEC_1A_0T_0R, AML_FLAGS_EXEC_1A_0T_0R), +/* 55 */ ACPI_OP("Revision", ARGP_REVISION_OP, ARGI_REVISION_OP, + ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, + AML_TYPE_CONSTANT, 0), +/* 56 */ ACPI_OP("Debug", ARGP_DEBUG_OP, ARGI_DEBUG_OP, + ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, + AML_TYPE_CONSTANT, 0), +/* 57 */ ACPI_OP("Fatal", ARGP_FATAL_OP, ARGI_FATAL_OP, ACPI_TYPE_ANY, + AML_CLASS_EXECUTE, AML_TYPE_EXEC_3A_0T_0R, + AML_FLAGS_EXEC_3A_0T_0R), +/* 58 */ ACPI_OP("OperationRegion", ARGP_REGION_OP, ARGI_REGION_OP, + ACPI_TYPE_REGION, AML_CLASS_NAMED_OBJECT, + AML_TYPE_NAMED_COMPLEX, + AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | + AML_NSNODE | AML_NAMED | AML_DEFER), +/* 59 */ ACPI_OP("Field", ARGP_FIELD_OP, ARGI_FIELD_OP, ACPI_TYPE_ANY, + AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_FIELD, + AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | + AML_FIELD), +/* 5A */ ACPI_OP("Device", ARGP_DEVICE_OP, ARGI_DEVICE_OP, + ACPI_TYPE_DEVICE, AML_CLASS_NAMED_OBJECT, + AML_TYPE_NAMED_NO_OBJ, + AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | + AML_NSNODE | AML_NAMED), +/* 5B */ ACPI_OP("Processor", ARGP_PROCESSOR_OP, ARGI_PROCESSOR_OP, + ACPI_TYPE_PROCESSOR, AML_CLASS_NAMED_OBJECT, + AML_TYPE_NAMED_SIMPLE, + AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | + AML_NSNODE | AML_NAMED), +/* 5C */ ACPI_OP("PowerResource", ARGP_POWER_RES_OP, ARGI_POWER_RES_OP, + ACPI_TYPE_POWER, AML_CLASS_NAMED_OBJECT, + AML_TYPE_NAMED_SIMPLE, + AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | + AML_NSNODE | AML_NAMED), +/* 5D */ ACPI_OP("ThermalZone", ARGP_THERMAL_ZONE_OP, + ARGI_THERMAL_ZONE_OP, ACPI_TYPE_THERMAL, + AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_NO_OBJ, + AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | + AML_NSNODE | AML_NAMED), +/* 5E */ ACPI_OP("IndexField", ARGP_INDEX_FIELD_OP, ARGI_INDEX_FIELD_OP, + ACPI_TYPE_ANY, AML_CLASS_NAMED_OBJECT, + AML_TYPE_NAMED_FIELD, + AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | + AML_FIELD), +/* 5F */ ACPI_OP("BankField", ARGP_BANK_FIELD_OP, ARGI_BANK_FIELD_OP, + ACPI_TYPE_ANY, AML_CLASS_NAMED_OBJECT, + AML_TYPE_NAMED_FIELD, + AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | + AML_FIELD), /* Internal opcodes that map to invalid AML opcodes */ -/* 60 */ ACPI_OP ("LNotEqual", ARGP_LNOTEQUAL_OP, ARGI_LNOTEQUAL_OP, ACPI_TYPE_ANY, AML_CLASS_INTERNAL, AML_TYPE_BOGUS, AML_HAS_ARGS | AML_CONSTANT), -/* 61 */ ACPI_OP ("LLessEqual", ARGP_LLESSEQUAL_OP, ARGI_LLESSEQUAL_OP, ACPI_TYPE_ANY, AML_CLASS_INTERNAL, AML_TYPE_BOGUS, AML_HAS_ARGS | AML_CONSTANT), -/* 62 */ ACPI_OP ("LGreaterEqual", ARGP_LGREATEREQUAL_OP, ARGI_LGREATEREQUAL_OP, ACPI_TYPE_ANY, AML_CLASS_INTERNAL, AML_TYPE_BOGUS, AML_HAS_ARGS | AML_CONSTANT), -/* 63 */ ACPI_OP ("-NamePath-", ARGP_NAMEPATH_OP, ARGI_NAMEPATH_OP, ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, AML_NSOBJECT | AML_NSNODE ), -/* 64 */ ACPI_OP ("-MethodCall-", ARGP_METHODCALL_OP, ARGI_METHODCALL_OP, ACPI_TYPE_METHOD, AML_CLASS_METHOD_CALL, AML_TYPE_METHOD_CALL, AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE), -/* 65 */ ACPI_OP ("-ByteList-", ARGP_BYTELIST_OP, ARGI_BYTELIST_OP, ACPI_TYPE_ANY, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, 0), -/* 66 */ ACPI_OP ("-ReservedField-", ARGP_RESERVEDFIELD_OP, ARGI_RESERVEDFIELD_OP, ACPI_TYPE_ANY, AML_CLASS_INTERNAL, AML_TYPE_BOGUS, 0), -/* 67 */ ACPI_OP ("-NamedField-", ARGP_NAMEDFIELD_OP, ARGI_NAMEDFIELD_OP, ACPI_TYPE_ANY, AML_CLASS_INTERNAL, AML_TYPE_BOGUS, AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED ), -/* 68 */ ACPI_OP ("-AccessField-", ARGP_ACCESSFIELD_OP, ARGI_ACCESSFIELD_OP, ACPI_TYPE_ANY, AML_CLASS_INTERNAL, AML_TYPE_BOGUS, 0), -/* 69 */ ACPI_OP ("-StaticString", ARGP_STATICSTRING_OP, ARGI_STATICSTRING_OP, ACPI_TYPE_ANY, AML_CLASS_INTERNAL, AML_TYPE_BOGUS, 0), -/* 6A */ ACPI_OP ("-Return Value-", ARG_NONE, ARG_NONE, ACPI_TYPE_ANY, AML_CLASS_RETURN_VALUE, AML_TYPE_RETURN, AML_HAS_ARGS | AML_HAS_RETVAL), -/* 6B */ ACPI_OP ("-UNKNOWN_OP-", ARG_NONE, ARG_NONE, ACPI_TYPE_INVALID, AML_CLASS_UNKNOWN, AML_TYPE_BOGUS, AML_HAS_ARGS), -/* 6C */ ACPI_OP ("-ASCII_ONLY-", ARG_NONE, ARG_NONE, ACPI_TYPE_ANY, AML_CLASS_ASCII, AML_TYPE_BOGUS, AML_HAS_ARGS), -/* 6D */ ACPI_OP ("-PREFIX_ONLY-", ARG_NONE, ARG_NONE, ACPI_TYPE_ANY, AML_CLASS_PREFIX, AML_TYPE_BOGUS, AML_HAS_ARGS), +/* 60 */ ACPI_OP("LNotEqual", ARGP_LNOTEQUAL_OP, ARGI_LNOTEQUAL_OP, + ACPI_TYPE_ANY, AML_CLASS_INTERNAL, + AML_TYPE_BOGUS, AML_HAS_ARGS | AML_CONSTANT), +/* 61 */ ACPI_OP("LLessEqual", ARGP_LLESSEQUAL_OP, ARGI_LLESSEQUAL_OP, + ACPI_TYPE_ANY, AML_CLASS_INTERNAL, + AML_TYPE_BOGUS, AML_HAS_ARGS | AML_CONSTANT), +/* 62 */ ACPI_OP("LGreaterEqual", ARGP_LGREATEREQUAL_OP, + ARGI_LGREATEREQUAL_OP, ACPI_TYPE_ANY, + AML_CLASS_INTERNAL, AML_TYPE_BOGUS, + AML_HAS_ARGS | AML_CONSTANT), +/* 63 */ ACPI_OP("-NamePath-", ARGP_NAMEPATH_OP, ARGI_NAMEPATH_OP, + ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, + AML_TYPE_LITERAL, AML_NSOBJECT | AML_NSNODE), +/* 64 */ ACPI_OP("-MethodCall-", ARGP_METHODCALL_OP, ARGI_METHODCALL_OP, + ACPI_TYPE_METHOD, AML_CLASS_METHOD_CALL, + AML_TYPE_METHOD_CALL, + AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE), +/* 65 */ ACPI_OP("-ByteList-", ARGP_BYTELIST_OP, ARGI_BYTELIST_OP, + ACPI_TYPE_ANY, AML_CLASS_ARGUMENT, + AML_TYPE_LITERAL, 0), +/* 66 */ ACPI_OP("-ReservedField-", ARGP_RESERVEDFIELD_OP, + ARGI_RESERVEDFIELD_OP, ACPI_TYPE_ANY, + AML_CLASS_INTERNAL, AML_TYPE_BOGUS, 0), +/* 67 */ ACPI_OP("-NamedField-", ARGP_NAMEDFIELD_OP, ARGI_NAMEDFIELD_OP, + ACPI_TYPE_ANY, AML_CLASS_INTERNAL, + AML_TYPE_BOGUS, + AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED), +/* 68 */ ACPI_OP("-AccessField-", ARGP_ACCESSFIELD_OP, + ARGI_ACCESSFIELD_OP, ACPI_TYPE_ANY, + AML_CLASS_INTERNAL, AML_TYPE_BOGUS, 0), +/* 69 */ ACPI_OP("-StaticString", ARGP_STATICSTRING_OP, + ARGI_STATICSTRING_OP, ACPI_TYPE_ANY, + AML_CLASS_INTERNAL, AML_TYPE_BOGUS, 0), +/* 6A */ ACPI_OP("-Return Value-", ARG_NONE, ARG_NONE, ACPI_TYPE_ANY, + AML_CLASS_RETURN_VALUE, AML_TYPE_RETURN, + AML_HAS_ARGS | AML_HAS_RETVAL), +/* 6B */ ACPI_OP("-UNKNOWN_OP-", ARG_NONE, ARG_NONE, ACPI_TYPE_INVALID, + AML_CLASS_UNKNOWN, AML_TYPE_BOGUS, AML_HAS_ARGS), +/* 6C */ ACPI_OP("-ASCII_ONLY-", ARG_NONE, ARG_NONE, ACPI_TYPE_ANY, + AML_CLASS_ASCII, AML_TYPE_BOGUS, AML_HAS_ARGS), +/* 6D */ ACPI_OP("-PREFIX_ONLY-", ARG_NONE, ARG_NONE, ACPI_TYPE_ANY, + AML_CLASS_PREFIX, AML_TYPE_BOGUS, AML_HAS_ARGS), /* ACPI 2.0 opcodes */ -/* 6E */ ACPI_OP ("QwordConst", ARGP_QWORD_OP, ARGI_QWORD_OP, ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, AML_CONSTANT), -/* 6F */ ACPI_OP ("Package", /* Var */ ARGP_VAR_PACKAGE_OP, ARGI_VAR_PACKAGE_OP, ACPI_TYPE_PACKAGE, AML_CLASS_CREATE, AML_TYPE_CREATE_OBJECT, AML_HAS_ARGS | AML_DEFER), -/* 70 */ ACPI_OP ("ConcatenateResTemplate", ARGP_CONCAT_RES_OP, ARGI_CONCAT_RES_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_CONSTANT), -/* 71 */ ACPI_OP ("Mod", ARGP_MOD_OP, ARGI_MOD_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_CONSTANT), -/* 72 */ ACPI_OP ("CreateQWordField", ARGP_CREATE_QWORD_FIELD_OP,ARGI_CREATE_QWORD_FIELD_OP, ACPI_TYPE_BUFFER_FIELD, AML_CLASS_CREATE, AML_TYPE_CREATE_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | AML_DEFER | AML_CREATE), -/* 73 */ ACPI_OP ("ToBuffer", ARGP_TO_BUFFER_OP, ARGI_TO_BUFFER_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT), -/* 74 */ ACPI_OP ("ToDecimalString", ARGP_TO_DEC_STR_OP, ARGI_TO_DEC_STR_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT), -/* 75 */ ACPI_OP ("ToHexString", ARGP_TO_HEX_STR_OP, ARGI_TO_HEX_STR_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT), -/* 76 */ ACPI_OP ("ToInteger", ARGP_TO_INTEGER_OP, ARGI_TO_INTEGER_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT), -/* 77 */ ACPI_OP ("ToString", ARGP_TO_STRING_OP, ARGI_TO_STRING_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_CONSTANT), -/* 78 */ ACPI_OP ("CopyObject", ARGP_COPY_OP, ARGI_COPY_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R), -/* 79 */ ACPI_OP ("Mid", ARGP_MID_OP, ARGI_MID_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_3A_1T_1R, AML_FLAGS_EXEC_3A_1T_1R | AML_CONSTANT), -/* 7A */ ACPI_OP ("Continue", ARGP_CONTINUE_OP, ARGI_CONTINUE_OP, ACPI_TYPE_ANY, AML_CLASS_CONTROL, AML_TYPE_CONTROL, 0), -/* 7B */ ACPI_OP ("LoadTable", ARGP_LOAD_TABLE_OP, ARGI_LOAD_TABLE_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_6A_0T_1R, AML_FLAGS_EXEC_6A_0T_1R), -/* 7C */ ACPI_OP ("DataTableRegion", ARGP_DATA_REGION_OP, ARGI_DATA_REGION_OP, ACPI_TYPE_REGION, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_SIMPLE, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED), -/* 7D */ ACPI_OP ("[EvalSubTree]", ARGP_SCOPE_OP, ARGI_SCOPE_OP, ACPI_TYPE_ANY, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_NO_OBJ, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE), +/* 6E */ ACPI_OP("QwordConst", ARGP_QWORD_OP, ARGI_QWORD_OP, + ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, + AML_TYPE_LITERAL, AML_CONSTANT), + /* 6F */ ACPI_OP("Package", /* Var */ ARGP_VAR_PACKAGE_OP, + ARGI_VAR_PACKAGE_OP, ACPI_TYPE_PACKAGE, + AML_CLASS_CREATE, AML_TYPE_CREATE_OBJECT, + AML_HAS_ARGS | AML_DEFER), +/* 70 */ ACPI_OP("ConcatenateResTemplate", ARGP_CONCAT_RES_OP, + ARGI_CONCAT_RES_OP, ACPI_TYPE_ANY, + AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, + AML_FLAGS_EXEC_2A_1T_1R | AML_CONSTANT), +/* 71 */ ACPI_OP("Mod", ARGP_MOD_OP, ARGI_MOD_OP, ACPI_TYPE_ANY, + AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, + AML_FLAGS_EXEC_2A_1T_1R | AML_CONSTANT), +/* 72 */ ACPI_OP("CreateQWordField", ARGP_CREATE_QWORD_FIELD_OP, + ARGI_CREATE_QWORD_FIELD_OP, + ACPI_TYPE_BUFFER_FIELD, AML_CLASS_CREATE, + AML_TYPE_CREATE_FIELD, + AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | + AML_DEFER | AML_CREATE), +/* 73 */ ACPI_OP("ToBuffer", ARGP_TO_BUFFER_OP, ARGI_TO_BUFFER_OP, + ACPI_TYPE_ANY, AML_CLASS_EXECUTE, + AML_TYPE_EXEC_1A_1T_1R, + AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT), +/* 74 */ ACPI_OP("ToDecimalString", ARGP_TO_DEC_STR_OP, + ARGI_TO_DEC_STR_OP, ACPI_TYPE_ANY, + AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, + AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT), +/* 75 */ ACPI_OP("ToHexString", ARGP_TO_HEX_STR_OP, ARGI_TO_HEX_STR_OP, + ACPI_TYPE_ANY, AML_CLASS_EXECUTE, + AML_TYPE_EXEC_1A_1T_1R, + AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT), +/* 76 */ ACPI_OP("ToInteger", ARGP_TO_INTEGER_OP, ARGI_TO_INTEGER_OP, + ACPI_TYPE_ANY, AML_CLASS_EXECUTE, + AML_TYPE_EXEC_1A_1T_1R, + AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT), +/* 77 */ ACPI_OP("ToString", ARGP_TO_STRING_OP, ARGI_TO_STRING_OP, + ACPI_TYPE_ANY, AML_CLASS_EXECUTE, + AML_TYPE_EXEC_2A_1T_1R, + AML_FLAGS_EXEC_2A_1T_1R | AML_CONSTANT), +/* 78 */ ACPI_OP("CopyObject", ARGP_COPY_OP, ARGI_COPY_OP, + ACPI_TYPE_ANY, AML_CLASS_EXECUTE, + AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R), +/* 79 */ ACPI_OP("Mid", ARGP_MID_OP, ARGI_MID_OP, ACPI_TYPE_ANY, + AML_CLASS_EXECUTE, AML_TYPE_EXEC_3A_1T_1R, + AML_FLAGS_EXEC_3A_1T_1R | AML_CONSTANT), +/* 7A */ ACPI_OP("Continue", ARGP_CONTINUE_OP, ARGI_CONTINUE_OP, + ACPI_TYPE_ANY, AML_CLASS_CONTROL, AML_TYPE_CONTROL, 0), +/* 7B */ ACPI_OP("LoadTable", ARGP_LOAD_TABLE_OP, ARGI_LOAD_TABLE_OP, + ACPI_TYPE_ANY, AML_CLASS_EXECUTE, + AML_TYPE_EXEC_6A_0T_1R, AML_FLAGS_EXEC_6A_0T_1R), +/* 7C */ ACPI_OP("DataTableRegion", ARGP_DATA_REGION_OP, + ARGI_DATA_REGION_OP, ACPI_TYPE_REGION, + AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_SIMPLE, + AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | + AML_NSNODE | AML_NAMED), +/* 7D */ ACPI_OP("[EvalSubTree]", ARGP_SCOPE_OP, ARGI_SCOPE_OP, + ACPI_TYPE_ANY, AML_CLASS_NAMED_OBJECT, + AML_TYPE_NAMED_NO_OBJ, + AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | + AML_NSNODE), /* ACPI 3.0 opcodes */ -/* 7E */ ACPI_OP ("Timer", ARGP_TIMER_OP, ARGI_TIMER_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_0A_0T_1R, AML_FLAGS_EXEC_0A_0T_1R) +/* 7E */ ACPI_OP("Timer", ARGP_TIMER_OP, ARGI_TIMER_OP, ACPI_TYPE_ANY, + AML_CLASS_EXECUTE, AML_TYPE_EXEC_0A_0T_1R, + AML_FLAGS_EXEC_0A_0T_1R) /*! [End] no source code translation !*/ }; @@ -338,73 +646,70 @@ const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES] = * This table is directly indexed by the opcodes, and returns an * index into the table above */ -static const u8 acpi_gbl_short_op_index[256] = -{ +static const u8 acpi_gbl_short_op_index[256] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ -/* 0x00 */ 0x00, 0x01, _UNK, _UNK, _UNK, _UNK, 0x02, _UNK, -/* 0x08 */ 0x03, _UNK, 0x04, 0x05, 0x06, 0x07, 0x6E, _UNK, -/* 0x10 */ 0x08, 0x09, 0x0a, 0x6F, 0x0b, _UNK, _UNK, _UNK, -/* 0x18 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, -/* 0x20 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, -/* 0x28 */ _UNK, _UNK, _UNK, _UNK, _UNK, 0x63, _PFX, _PFX, -/* 0x30 */ 0x67, 0x66, 0x68, 0x65, 0x69, 0x64, 0x6A, 0x7D, -/* 0x38 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, -/* 0x40 */ _UNK, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, -/* 0x48 */ _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, -/* 0x50 */ _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, -/* 0x58 */ _ASC, _ASC, _ASC, _UNK, _PFX, _UNK, _PFX, _ASC, -/* 0x60 */ 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, -/* 0x68 */ 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, _UNK, -/* 0x70 */ 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, -/* 0x78 */ 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, -/* 0x80 */ 0x2b, 0x2c, 0x2d, 0x2e, 0x70, 0x71, 0x2f, 0x30, -/* 0x88 */ 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x72, -/* 0x90 */ 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x73, 0x74, -/* 0x98 */ 0x75, 0x76, _UNK, _UNK, 0x77, 0x78, 0x79, 0x7A, -/* 0xA0 */ 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43, 0x60, 0x61, -/* 0xA8 */ 0x62, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, -/* 0xB0 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, -/* 0xB8 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, -/* 0xC0 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, -/* 0xC8 */ _UNK, _UNK, _UNK, _UNK, 0x44, _UNK, _UNK, _UNK, -/* 0xD0 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, -/* 0xD8 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, -/* 0xE0 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, -/* 0xE8 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, -/* 0xF0 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, -/* 0xF8 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, 0x45, +/* 0x00 */ 0x00, 0x01, _UNK, _UNK, _UNK, _UNK, 0x02, _UNK, +/* 0x08 */ 0x03, _UNK, 0x04, 0x05, 0x06, 0x07, 0x6E, _UNK, +/* 0x10 */ 0x08, 0x09, 0x0a, 0x6F, 0x0b, _UNK, _UNK, _UNK, +/* 0x18 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, +/* 0x20 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, +/* 0x28 */ _UNK, _UNK, _UNK, _UNK, _UNK, 0x63, _PFX, _PFX, +/* 0x30 */ 0x67, 0x66, 0x68, 0x65, 0x69, 0x64, 0x6A, 0x7D, +/* 0x38 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, +/* 0x40 */ _UNK, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, +/* 0x48 */ _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, +/* 0x50 */ _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, +/* 0x58 */ _ASC, _ASC, _ASC, _UNK, _PFX, _UNK, _PFX, _ASC, +/* 0x60 */ 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, +/* 0x68 */ 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, _UNK, +/* 0x70 */ 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, +/* 0x78 */ 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, +/* 0x80 */ 0x2b, 0x2c, 0x2d, 0x2e, 0x70, 0x71, 0x2f, 0x30, +/* 0x88 */ 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x72, +/* 0x90 */ 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x73, 0x74, +/* 0x98 */ 0x75, 0x76, _UNK, _UNK, 0x77, 0x78, 0x79, 0x7A, +/* 0xA0 */ 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43, 0x60, 0x61, +/* 0xA8 */ 0x62, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, +/* 0xB0 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, +/* 0xB8 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, +/* 0xC0 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, +/* 0xC8 */ _UNK, _UNK, _UNK, _UNK, 0x44, _UNK, _UNK, _UNK, +/* 0xD0 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, +/* 0xD8 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, +/* 0xE0 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, +/* 0xE8 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, +/* 0xF0 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, +/* 0xF8 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, 0x45, }; /* * This table is indexed by the second opcode of the extended opcode * pair. It returns an index into the opcode table (acpi_gbl_aml_op_info) */ -static const u8 acpi_gbl_long_op_index[NUM_EXTENDED_OPCODE] = -{ +static const u8 acpi_gbl_long_op_index[NUM_EXTENDED_OPCODE] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ -/* 0x00 */ _UNK, 0x46, 0x47, _UNK, _UNK, _UNK, _UNK, _UNK, -/* 0x08 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, -/* 0x10 */ _UNK, _UNK, 0x48, 0x49, _UNK, _UNK, _UNK, _UNK, -/* 0x18 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, 0x7B, -/* 0x20 */ 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51, -/* 0x28 */ 0x52, 0x53, 0x54, _UNK, _UNK, _UNK, _UNK, _UNK, -/* 0x30 */ 0x55, 0x56, 0x57, 0x7e, _UNK, _UNK, _UNK, _UNK, -/* 0x38 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, -/* 0x40 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, -/* 0x48 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, -/* 0x50 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, -/* 0x58 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, -/* 0x60 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, -/* 0x68 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, -/* 0x70 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, -/* 0x78 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, -/* 0x80 */ 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, -/* 0x88 */ 0x7C, +/* 0x00 */ _UNK, 0x46, 0x47, _UNK, _UNK, _UNK, _UNK, _UNK, +/* 0x08 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, +/* 0x10 */ _UNK, _UNK, 0x48, 0x49, _UNK, _UNK, _UNK, _UNK, +/* 0x18 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, 0x7B, +/* 0x20 */ 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51, +/* 0x28 */ 0x52, 0x53, 0x54, _UNK, _UNK, _UNK, _UNK, _UNK, +/* 0x30 */ 0x55, 0x56, 0x57, 0x7e, _UNK, _UNK, _UNK, _UNK, +/* 0x38 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, +/* 0x40 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, +/* 0x48 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, +/* 0x50 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, +/* 0x58 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, +/* 0x60 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, +/* 0x68 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, +/* 0x70 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, +/* 0x78 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, +/* 0x80 */ 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, +/* 0x88 */ 0x7C, }; - /******************************************************************************* * * FUNCTION: acpi_ps_get_opcode_info @@ -418,12 +723,9 @@ static const u8 acpi_gbl_long_op_index[NUM_EXTENDED_OPCODE] = * ******************************************************************************/ -const struct acpi_opcode_info * -acpi_ps_get_opcode_info ( - u16 opcode) +const struct acpi_opcode_info *acpi_ps_get_opcode_info(u16 opcode) { - ACPI_FUNCTION_NAME ("ps_get_opcode_info"); - + ACPI_FUNCTION_NAME("ps_get_opcode_info"); /* * Detect normal 8-bit opcode or extended 16-bit opcode @@ -431,25 +733,26 @@ acpi_ps_get_opcode_info ( if (!(opcode & 0xFF00)) { /* Simple (8-bit) opcode: 0-255, can't index beyond table */ - return (&acpi_gbl_aml_op_info [acpi_gbl_short_op_index [(u8) opcode]]); + return (&acpi_gbl_aml_op_info + [acpi_gbl_short_op_index[(u8) opcode]]); } if (((opcode & 0xFF00) == AML_EXTENDED_OPCODE) && - (((u8) opcode) <= MAX_EXTENDED_OPCODE)) { + (((u8) opcode) <= MAX_EXTENDED_OPCODE)) { /* Valid extended (16-bit) opcode */ - return (&acpi_gbl_aml_op_info [acpi_gbl_long_op_index [(u8) opcode]]); + return (&acpi_gbl_aml_op_info + [acpi_gbl_long_op_index[(u8) opcode]]); } /* Unknown AML opcode */ - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Unknown AML opcode [%4.4X]\n", opcode)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Unknown AML opcode [%4.4X]\n", opcode)); - return (&acpi_gbl_aml_op_info [_UNK]); + return (&acpi_gbl_aml_op_info[_UNK]); } - /******************************************************************************* * * FUNCTION: acpi_ps_get_opcode_name @@ -463,16 +766,13 @@ acpi_ps_get_opcode_info ( * ******************************************************************************/ -char * -acpi_ps_get_opcode_name ( - u16 opcode) +char *acpi_ps_get_opcode_name(u16 opcode) { #if defined(ACPI_DISASSEMBLER) || defined (ACPI_DEBUG_OUTPUT) - const struct acpi_opcode_info *op; - + const struct acpi_opcode_info *op; - op = acpi_ps_get_opcode_info (opcode); + op = acpi_ps_get_opcode_info(opcode); /* Always guaranteed to return a valid pointer */ @@ -483,4 +783,3 @@ acpi_ps_get_opcode_name ( #endif } - diff --git a/drivers/acpi/parser/psparse.c b/drivers/acpi/parser/psparse.c index 16b84a3d043..3248051d77e 100644 --- a/drivers/acpi/parser/psparse.c +++ b/drivers/acpi/parser/psparse.c @@ -41,7 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ - /* * Parse the AML and build an operation tree as most interpreters, * like Perl, do. Parsing is done by hand rather than with a YACC @@ -59,8 +58,7 @@ #include #define _COMPONENT ACPI_PARSER - ACPI_MODULE_NAME ("psparse") - +ACPI_MODULE_NAME("psparse") /******************************************************************************* * @@ -73,10 +71,7 @@ * DESCRIPTION: Get the size of the current opcode. * ******************************************************************************/ - -u32 -acpi_ps_get_opcode_size ( - u32 opcode) +u32 acpi_ps_get_opcode_size(u32 opcode) { /* Extended (2-byte) opcode if > 255 */ @@ -90,7 +85,6 @@ acpi_ps_get_opcode_size ( return (1); } - /******************************************************************************* * * FUNCTION: acpi_ps_peek_opcode @@ -103,28 +97,24 @@ acpi_ps_get_opcode_size ( * ******************************************************************************/ -u16 -acpi_ps_peek_opcode ( - struct acpi_parse_state *parser_state) +u16 acpi_ps_peek_opcode(struct acpi_parse_state * parser_state) { - u8 *aml; - u16 opcode; - + u8 *aml; + u16 opcode; aml = parser_state->aml; - opcode = (u16) ACPI_GET8 (aml); + opcode = (u16) ACPI_GET8(aml); if (opcode == AML_EXTENDED_OP_PREFIX) { /* Extended opcode, get the second opcode byte */ aml++; - opcode = (u16) ((opcode << 8) | ACPI_GET8 (aml)); + opcode = (u16) ((opcode << 8) | ACPI_GET8(aml)); } return (opcode); } - /******************************************************************************* * * FUNCTION: acpi_ps_complete_this_op @@ -139,30 +129,28 @@ acpi_ps_peek_opcode ( ******************************************************************************/ acpi_status -acpi_ps_complete_this_op ( - struct acpi_walk_state *walk_state, - union acpi_parse_object *op) +acpi_ps_complete_this_op(struct acpi_walk_state * walk_state, + union acpi_parse_object * op) { - union acpi_parse_object *prev; - union acpi_parse_object *next; - const struct acpi_opcode_info *parent_info; - union acpi_parse_object *replacement_op = NULL; - - - ACPI_FUNCTION_TRACE_PTR ("ps_complete_this_op", op); + union acpi_parse_object *prev; + union acpi_parse_object *next; + const struct acpi_opcode_info *parent_info; + union acpi_parse_object *replacement_op = NULL; + ACPI_FUNCTION_TRACE_PTR("ps_complete_this_op", op); /* Check for null Op, can happen if AML code is corrupt */ if (!op) { - return_ACPI_STATUS (AE_OK); /* OK for now */ + return_ACPI_STATUS(AE_OK); /* OK for now */ } /* Delete this op and the subtree below it if asked to */ - if (((walk_state->parse_flags & ACPI_PARSE_TREE_MASK) != ACPI_PARSE_DELETE_TREE) || - (walk_state->op_info->class == AML_CLASS_ARGUMENT)) { - return_ACPI_STATUS (AE_OK); + if (((walk_state->parse_flags & ACPI_PARSE_TREE_MASK) != + ACPI_PARSE_DELETE_TREE) + || (walk_state->op_info->class == AML_CLASS_ARGUMENT)) { + return_ACPI_STATUS(AE_OK); } /* Make sure that we only delete this subtree */ @@ -179,7 +167,9 @@ acpi_ps_complete_this_op ( * Check if we need to replace the operator and its subtree * with a return value op (placeholder op) */ - parent_info = acpi_ps_get_opcode_info (op->common.parent->common.aml_opcode); + parent_info = + acpi_ps_get_opcode_info(op->common.parent->common. + aml_opcode); switch (parent_info->class) { case AML_CLASS_CONTROL: @@ -191,7 +181,8 @@ acpi_ps_complete_this_op ( * These opcodes contain term_arg operands. The current * op must be replaced by a placeholder return op */ - replacement_op = acpi_ps_alloc_op (AML_INT_RETURN_VALUE_OP); + replacement_op = + acpi_ps_alloc_op(AML_INT_RETURN_VALUE_OP); if (!replacement_op) { goto allocate_error; } @@ -203,35 +194,49 @@ acpi_ps_complete_this_op ( * These opcodes contain term_arg operands. The current * op must be replaced by a placeholder return op */ - if ((op->common.parent->common.aml_opcode == AML_REGION_OP) || - (op->common.parent->common.aml_opcode == AML_DATA_REGION_OP) || - (op->common.parent->common.aml_opcode == AML_BUFFER_OP) || - (op->common.parent->common.aml_opcode == AML_PACKAGE_OP) || - (op->common.parent->common.aml_opcode == AML_VAR_PACKAGE_OP)) { - replacement_op = acpi_ps_alloc_op (AML_INT_RETURN_VALUE_OP); + if ((op->common.parent->common.aml_opcode == + AML_REGION_OP) + || (op->common.parent->common.aml_opcode == + AML_DATA_REGION_OP) + || (op->common.parent->common.aml_opcode == + AML_BUFFER_OP) + || (op->common.parent->common.aml_opcode == + AML_PACKAGE_OP) + || (op->common.parent->common.aml_opcode == + AML_VAR_PACKAGE_OP)) { + replacement_op = + acpi_ps_alloc_op(AML_INT_RETURN_VALUE_OP); if (!replacement_op) { goto allocate_error; } - } - else if ((op->common.parent->common.aml_opcode == AML_NAME_OP) && - (walk_state->pass_number <= ACPI_IMODE_LOAD_PASS2)) { - if ((op->common.aml_opcode == AML_BUFFER_OP) || - (op->common.aml_opcode == AML_PACKAGE_OP) || - (op->common.aml_opcode == AML_VAR_PACKAGE_OP)) { - replacement_op = acpi_ps_alloc_op (op->common.aml_opcode); + } else + if ((op->common.parent->common.aml_opcode == + AML_NAME_OP) + && (walk_state->pass_number <= + ACPI_IMODE_LOAD_PASS2)) { + if ((op->common.aml_opcode == AML_BUFFER_OP) + || (op->common.aml_opcode == AML_PACKAGE_OP) + || (op->common.aml_opcode == + AML_VAR_PACKAGE_OP)) { + replacement_op = + acpi_ps_alloc_op(op->common. + aml_opcode); if (!replacement_op) { goto allocate_error; } - replacement_op->named.data = op->named.data; - replacement_op->named.length = op->named.length; + replacement_op->named.data = + op->named.data; + replacement_op->named.length = + op->named.length; } } break; default: - replacement_op = acpi_ps_alloc_op (AML_INT_RETURN_VALUE_OP); + replacement_op = + acpi_ps_alloc_op(AML_INT_RETURN_VALUE_OP); if (!replacement_op) { goto allocate_error; } @@ -243,59 +248,64 @@ acpi_ps_complete_this_op ( /* This op is the first in the list */ if (replacement_op) { - replacement_op->common.parent = op->common.parent; - replacement_op->common.value.arg = NULL; - replacement_op->common.node = op->common.node; - op->common.parent->common.value.arg = replacement_op; - replacement_op->common.next = op->common.next; - } - else { - op->common.parent->common.value.arg = op->common.next; + replacement_op->common.parent = + op->common.parent; + replacement_op->common.value.arg = NULL; + replacement_op->common.node = op->common.node; + op->common.parent->common.value.arg = + replacement_op; + replacement_op->common.next = op->common.next; + } else { + op->common.parent->common.value.arg = + op->common.next; } } /* Search the parent list */ - else while (prev) { - /* Traverse all siblings in the parent's argument list */ - - next = prev->common.next; - if (next == op) { - if (replacement_op) { - replacement_op->common.parent = op->common.parent; - replacement_op->common.value.arg = NULL; - replacement_op->common.node = op->common.node; - prev->common.next = replacement_op; - replacement_op->common.next = op->common.next; - next = NULL; - } - else { - prev->common.next = op->common.next; - next = NULL; + else + while (prev) { + /* Traverse all siblings in the parent's argument list */ + + next = prev->common.next; + if (next == op) { + if (replacement_op) { + replacement_op->common.parent = + op->common.parent; + replacement_op->common.value. + arg = NULL; + replacement_op->common.node = + op->common.node; + prev->common.next = + replacement_op; + replacement_op->common.next = + op->common.next; + next = NULL; + } else { + prev->common.next = + op->common.next; + next = NULL; + } } + prev = next; } - prev = next; - } } - -cleanup: + cleanup: /* Now we can actually delete the subtree rooted at Op */ - acpi_ps_delete_parse_tree (op); - return_ACPI_STATUS (AE_OK); + acpi_ps_delete_parse_tree(op); + return_ACPI_STATUS(AE_OK); - -allocate_error: + allocate_error: /* Always delete the subtree, even on error */ - acpi_ps_delete_parse_tree (op); - return_ACPI_STATUS (AE_NO_MEMORY); + acpi_ps_delete_parse_tree(op); + return_ACPI_STATUS(AE_NO_MEMORY); } - /******************************************************************************* * * FUNCTION: acpi_ps_next_parse_state @@ -312,17 +322,14 @@ allocate_error: ******************************************************************************/ acpi_status -acpi_ps_next_parse_state ( - struct acpi_walk_state *walk_state, - union acpi_parse_object *op, - acpi_status callback_status) +acpi_ps_next_parse_state(struct acpi_walk_state *walk_state, + union acpi_parse_object *op, + acpi_status callback_status) { - struct acpi_parse_state *parser_state = &walk_state->parser_state; - acpi_status status = AE_CTRL_PENDING; - - - ACPI_FUNCTION_TRACE_PTR ("ps_next_parse_state", op); + struct acpi_parse_state *parser_state = &walk_state->parser_state; + acpi_status status = AE_CTRL_PENDING; + ACPI_FUNCTION_TRACE_PTR("ps_next_parse_state", op); switch (callback_status) { case AE_CTRL_TERMINATE: @@ -335,7 +342,6 @@ acpi_ps_next_parse_state ( status = AE_CTRL_TERMINATE; break; - case AE_CTRL_BREAK: parser_state->aml = walk_state->aml_last_while; @@ -345,7 +351,6 @@ acpi_ps_next_parse_state ( case AE_CTRL_CONTINUE: - parser_state->aml = walk_state->aml_last_while; status = AE_CTRL_CONTINUE; break; @@ -369,10 +374,9 @@ acpi_ps_next_parse_state ( * Predicate of an IF was true, and we are at the matching ELSE. * Just close out this package */ - parser_state->aml = acpi_ps_get_next_package_end (parser_state); + parser_state->aml = acpi_ps_get_next_package_end(parser_state); break; - case AE_CTRL_FALSE: /* @@ -390,7 +394,6 @@ acpi_ps_next_parse_state ( status = AE_CTRL_END; break; - case AE_CTRL_TRANSFER: /* A method call (invocation) -- transfer control */ @@ -398,14 +401,15 @@ acpi_ps_next_parse_state ( status = AE_CTRL_TRANSFER; walk_state->prev_op = op; walk_state->method_call_op = op; - walk_state->method_call_node = (op->common.value.arg)->common.node; + walk_state->method_call_node = + (op->common.value.arg)->common.node; /* Will return value (if any) be used by the caller? */ - walk_state->return_used = acpi_ds_is_result_used (op, walk_state); + walk_state->return_used = + acpi_ds_is_result_used(op, walk_state); break; - default: status = callback_status; @@ -415,10 +419,9 @@ acpi_ps_next_parse_state ( break; } - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_ps_parse_aml @@ -432,34 +435,30 @@ acpi_ps_next_parse_state ( * ******************************************************************************/ -acpi_status -acpi_ps_parse_aml ( - struct acpi_walk_state *walk_state) +acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state) { - acpi_status status; - acpi_status terminate_status; - struct acpi_thread_state *thread; - struct acpi_thread_state *prev_walk_list = acpi_gbl_current_walk_list; - struct acpi_walk_state *previous_walk_state; - - - ACPI_FUNCTION_TRACE ("ps_parse_aml"); + acpi_status status; + acpi_status terminate_status; + struct acpi_thread_state *thread; + struct acpi_thread_state *prev_walk_list = acpi_gbl_current_walk_list; + struct acpi_walk_state *previous_walk_state; - ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, - "Entered with walk_state=%p Aml=%p size=%X\n", - walk_state, walk_state->parser_state.aml, - walk_state->parser_state.aml_size)); + ACPI_FUNCTION_TRACE("ps_parse_aml"); + ACPI_DEBUG_PRINT((ACPI_DB_PARSE, + "Entered with walk_state=%p Aml=%p size=%X\n", + walk_state, walk_state->parser_state.aml, + walk_state->parser_state.aml_size)); /* Create and initialize a new thread state */ - thread = acpi_ut_create_thread_state (); + thread = acpi_ut_create_thread_state(); if (!thread) { - return_ACPI_STATUS (AE_NO_MEMORY); + return_ACPI_STATUS(AE_NO_MEMORY); } walk_state->thread = thread; - acpi_ds_push_walk_state (walk_state, thread); + acpi_ds_push_walk_state(walk_state, thread); /* * This global allows the AML debugger to get a handle to the currently @@ -471,54 +470,56 @@ acpi_ps_parse_aml ( * Execute the walk loop as long as there is a valid Walk State. This * handles nested control method invocations without recursion. */ - ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "State=%p\n", walk_state)); + ACPI_DEBUG_PRINT((ACPI_DB_PARSE, "State=%p\n", walk_state)); status = AE_OK; while (walk_state) { - if (ACPI_SUCCESS (status)) { + if (ACPI_SUCCESS(status)) { /* * The parse_loop executes AML until the method terminates * or calls another method. */ - status = acpi_ps_parse_loop (walk_state); + status = acpi_ps_parse_loop(walk_state); } - ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, - "Completed one call to walk loop, %s State=%p\n", - acpi_format_exception (status), walk_state)); + ACPI_DEBUG_PRINT((ACPI_DB_PARSE, + "Completed one call to walk loop, %s State=%p\n", + acpi_format_exception(status), walk_state)); if (status == AE_CTRL_TRANSFER) { /* * A method call was detected. * Transfer control to the called control method */ - status = acpi_ds_call_control_method (thread, walk_state, NULL); + status = + acpi_ds_call_control_method(thread, walk_state, + NULL); /* * If the transfer to the new method method call worked, a new walk * state was created -- get it */ - walk_state = acpi_ds_get_current_walk_state (thread); + walk_state = acpi_ds_get_current_walk_state(thread); continue; - } - else if (status == AE_CTRL_TERMINATE) { + } else if (status == AE_CTRL_TERMINATE) { status = AE_OK; - } - else if ((status != AE_OK) && (walk_state->method_desc)) { - ACPI_REPORT_METHOD_ERROR ("Method execution failed", - walk_state->method_node, NULL, status); + } else if ((status != AE_OK) && (walk_state->method_desc)) { + ACPI_REPORT_METHOD_ERROR("Method execution failed", + walk_state->method_node, NULL, + status); /* Check for possible multi-thread reentrancy problem */ if ((status == AE_ALREADY_EXISTS) && - (!walk_state->method_desc->method.semaphore)) { + (!walk_state->method_desc->method.semaphore)) { /* * This method is marked not_serialized, but it tried to create * a named object, causing the second thread entrance to fail. * We will workaround this by marking the method permanently * as Serialized. */ - walk_state->method_desc->method.method_flags |= AML_METHOD_SERIALIZED; + walk_state->method_desc->method.method_flags |= + AML_METHOD_SERIALIZED; walk_state->method_desc->method.concurrency = 1; } } @@ -533,21 +534,22 @@ acpi_ps_parse_aml ( /* We are done with this walk, move on to the parent if any */ - walk_state = acpi_ds_pop_walk_state (thread); + walk_state = acpi_ds_pop_walk_state(thread); /* Reset the current scope to the beginning of scope stack */ - acpi_ds_scope_stack_clear (walk_state); + acpi_ds_scope_stack_clear(walk_state); /* * If we just returned from the execution of a control method, * there's lots of cleanup to do */ - if ((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) == ACPI_PARSE_EXECUTE) { - terminate_status = acpi_ds_terminate_control_method (walk_state); - if (ACPI_FAILURE (terminate_status)) { - ACPI_REPORT_ERROR (( - "Could not terminate control method properly\n")); + if ((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) == + ACPI_PARSE_EXECUTE) { + terminate_status = + acpi_ds_terminate_control_method(walk_state); + if (ACPI_FAILURE(terminate_status)) { + ACPI_REPORT_ERROR(("Could not terminate control method properly\n")); /* Ignore error and continue */ } @@ -555,46 +557,53 @@ acpi_ps_parse_aml ( /* Delete this walk state and all linked control states */ - acpi_ps_cleanup_scope (&walk_state->parser_state); + acpi_ps_cleanup_scope(&walk_state->parser_state); previous_walk_state = walk_state; - ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, - "return_value=%p, implicit_value=%p State=%p\n", - walk_state->return_desc, walk_state->implicit_return_obj, walk_state)); + ACPI_DEBUG_PRINT((ACPI_DB_PARSE, + "return_value=%p, implicit_value=%p State=%p\n", + walk_state->return_desc, + walk_state->implicit_return_obj, walk_state)); /* Check if we have restarted a preempted walk */ - walk_state = acpi_ds_get_current_walk_state (thread); + walk_state = acpi_ds_get_current_walk_state(thread); if (walk_state) { - if (ACPI_SUCCESS (status)) { + if (ACPI_SUCCESS(status)) { /* * There is another walk state, restart it. * If the method return value is not used by the parent, * The object is deleted */ if (!previous_walk_state->return_desc) { - status = acpi_ds_restart_control_method (walk_state, - previous_walk_state->implicit_return_obj); - } - else { + status = + acpi_ds_restart_control_method + (walk_state, + previous_walk_state-> + implicit_return_obj); + } else { /* * We have a valid return value, delete any implicit * return value. */ - acpi_ds_clear_implicit_return (previous_walk_state); + acpi_ds_clear_implicit_return + (previous_walk_state); - status = acpi_ds_restart_control_method (walk_state, - previous_walk_state->return_desc); + status = + acpi_ds_restart_control_method + (walk_state, + previous_walk_state->return_desc); } - if (ACPI_SUCCESS (status)) { - walk_state->walk_type |= ACPI_WALK_METHOD_RESTART; + if (ACPI_SUCCESS(status)) { + walk_state->walk_type |= + ACPI_WALK_METHOD_RESTART; } - } - else { + } else { /* On error, delete any return object */ - acpi_ut_remove_reference (previous_walk_state->return_desc); + acpi_ut_remove_reference(previous_walk_state-> + return_desc); } } @@ -605,37 +614,36 @@ acpi_ps_parse_aml ( else if (previous_walk_state->caller_return_desc) { if (previous_walk_state->implicit_return_obj) { *(previous_walk_state->caller_return_desc) = - previous_walk_state->implicit_return_obj; - } - else { - /* NULL if no return value */ + previous_walk_state->implicit_return_obj; + } else { + /* NULL if no return value */ *(previous_walk_state->caller_return_desc) = - previous_walk_state->return_desc; + previous_walk_state->return_desc; } - } - else { + } else { if (previous_walk_state->return_desc) { /* Caller doesn't want it, must delete it */ - acpi_ut_remove_reference (previous_walk_state->return_desc); + acpi_ut_remove_reference(previous_walk_state-> + return_desc); } if (previous_walk_state->implicit_return_obj) { /* Caller doesn't want it, must delete it */ - acpi_ut_remove_reference (previous_walk_state->implicit_return_obj); + acpi_ut_remove_reference(previous_walk_state-> + implicit_return_obj); } } - acpi_ds_delete_walk_state (previous_walk_state); + acpi_ds_delete_walk_state(previous_walk_state); } /* Normal exit */ - acpi_ex_release_all_mutexes (thread); - acpi_ut_delete_generic_state (ACPI_CAST_PTR (union acpi_generic_state, thread)); + acpi_ex_release_all_mutexes(thread); + acpi_ut_delete_generic_state(ACPI_CAST_PTR + (union acpi_generic_state, thread)); acpi_gbl_current_walk_list = prev_walk_list; - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - - diff --git a/drivers/acpi/parser/psscope.c b/drivers/acpi/parser/psscope.c index 8dcd1b1e713..1c953b6f1af 100644 --- a/drivers/acpi/parser/psscope.c +++ b/drivers/acpi/parser/psscope.c @@ -41,13 +41,11 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include #include #define _COMPONENT ACPI_PARSER - ACPI_MODULE_NAME ("psscope") - +ACPI_MODULE_NAME("psscope") /******************************************************************************* * @@ -60,16 +58,13 @@ * DESCRIPTION: Get parent of current op being parsed * ******************************************************************************/ - -union acpi_parse_object * -acpi_ps_get_parent_scope ( - struct acpi_parse_state *parser_state) +union acpi_parse_object *acpi_ps_get_parent_scope(struct acpi_parse_state + *parser_state) { return (parser_state->scope->parse_scope.op); } - /******************************************************************************* * * FUNCTION: acpi_ps_has_completed_scope @@ -84,17 +79,14 @@ acpi_ps_get_parent_scope ( * ******************************************************************************/ -u8 -acpi_ps_has_completed_scope ( - struct acpi_parse_state *parser_state) +u8 acpi_ps_has_completed_scope(struct acpi_parse_state * parser_state) { return ((u8) - ((parser_state->aml >= parser_state->scope->parse_scope.arg_end || - !parser_state->scope->parse_scope.arg_count))); + ((parser_state->aml >= parser_state->scope->parse_scope.arg_end + || !parser_state->scope->parse_scope.arg_count))); } - /******************************************************************************* * * FUNCTION: acpi_ps_init_scope @@ -109,34 +101,30 @@ acpi_ps_has_completed_scope ( ******************************************************************************/ acpi_status -acpi_ps_init_scope ( - struct acpi_parse_state *parser_state, - union acpi_parse_object *root_op) +acpi_ps_init_scope(struct acpi_parse_state * parser_state, + union acpi_parse_object * root_op) { - union acpi_generic_state *scope; + union acpi_generic_state *scope; + ACPI_FUNCTION_TRACE_PTR("ps_init_scope", root_op); - ACPI_FUNCTION_TRACE_PTR ("ps_init_scope", root_op); - - - scope = acpi_ut_create_generic_state (); + scope = acpi_ut_create_generic_state(); if (!scope) { - return_ACPI_STATUS (AE_NO_MEMORY); + return_ACPI_STATUS(AE_NO_MEMORY); } - scope->common.data_type = ACPI_DESC_TYPE_STATE_RPSCOPE; - scope->parse_scope.op = root_op; + scope->common.data_type = ACPI_DESC_TYPE_STATE_RPSCOPE; + scope->parse_scope.op = root_op; scope->parse_scope.arg_count = ACPI_VAR_ARGS; - scope->parse_scope.arg_end = parser_state->aml_end; - scope->parse_scope.pkg_end = parser_state->aml_end; + scope->parse_scope.arg_end = parser_state->aml_end; + scope->parse_scope.pkg_end = parser_state->aml_end; - parser_state->scope = scope; - parser_state->start_op = root_op; + parser_state->scope = scope; + parser_state->start_op = root_op; - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_ps_push_scope @@ -153,48 +141,42 @@ acpi_ps_init_scope ( ******************************************************************************/ acpi_status -acpi_ps_push_scope ( - struct acpi_parse_state *parser_state, - union acpi_parse_object *op, - u32 remaining_args, - u32 arg_count) +acpi_ps_push_scope(struct acpi_parse_state *parser_state, + union acpi_parse_object *op, + u32 remaining_args, u32 arg_count) { - union acpi_generic_state *scope; - - - ACPI_FUNCTION_TRACE_PTR ("ps_push_scope", op); + union acpi_generic_state *scope; + ACPI_FUNCTION_TRACE_PTR("ps_push_scope", op); - scope = acpi_ut_create_generic_state (); + scope = acpi_ut_create_generic_state(); if (!scope) { - return_ACPI_STATUS (AE_NO_MEMORY); + return_ACPI_STATUS(AE_NO_MEMORY); } - scope->common.data_type = ACPI_DESC_TYPE_STATE_PSCOPE; - scope->parse_scope.op = op; + scope->common.data_type = ACPI_DESC_TYPE_STATE_PSCOPE; + scope->parse_scope.op = op; scope->parse_scope.arg_list = remaining_args; scope->parse_scope.arg_count = arg_count; scope->parse_scope.pkg_end = parser_state->pkg_end; /* Push onto scope stack */ - acpi_ut_push_generic_state (&parser_state->scope, scope); + acpi_ut_push_generic_state(&parser_state->scope, scope); if (arg_count == ACPI_VAR_ARGS) { /* Multiple arguments */ scope->parse_scope.arg_end = parser_state->pkg_end; - } - else { + } else { /* Single argument */ - scope->parse_scope.arg_end = ACPI_TO_POINTER (ACPI_MAX_PTR); + scope->parse_scope.arg_end = ACPI_TO_POINTER(ACPI_MAX_PTR); } - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_ps_pop_scope @@ -212,48 +194,41 @@ acpi_ps_push_scope ( ******************************************************************************/ void -acpi_ps_pop_scope ( - struct acpi_parse_state *parser_state, - union acpi_parse_object **op, - u32 *arg_list, - u32 *arg_count) +acpi_ps_pop_scope(struct acpi_parse_state *parser_state, + union acpi_parse_object **op, u32 * arg_list, u32 * arg_count) { - union acpi_generic_state *scope = parser_state->scope; - - - ACPI_FUNCTION_TRACE ("ps_pop_scope"); + union acpi_generic_state *scope = parser_state->scope; + ACPI_FUNCTION_TRACE("ps_pop_scope"); /* Only pop the scope if there is in fact a next scope */ if (scope->common.next) { - scope = acpi_ut_pop_generic_state (&parser_state->scope); + scope = acpi_ut_pop_generic_state(&parser_state->scope); /* return to parsing previous op */ - *op = scope->parse_scope.op; - *arg_list = scope->parse_scope.arg_list; - *arg_count = scope->parse_scope.arg_count; + *op = scope->parse_scope.op; + *arg_list = scope->parse_scope.arg_list; + *arg_count = scope->parse_scope.arg_count; parser_state->pkg_end = scope->parse_scope.pkg_end; /* All done with this scope state structure */ - acpi_ut_delete_generic_state (scope); - } - else { + acpi_ut_delete_generic_state(scope); + } else { /* empty parse stack, prepare to fetch next opcode */ - *op = NULL; + *op = NULL; *arg_list = 0; *arg_count = 0; } - ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, - "Popped Op %p Args %X\n", *op, *arg_count)); + ACPI_DEBUG_PRINT((ACPI_DB_PARSE, + "Popped Op %p Args %X\n", *op, *arg_count)); return_VOID; } - /******************************************************************************* * * FUNCTION: acpi_ps_cleanup_scope @@ -267,15 +242,11 @@ acpi_ps_pop_scope ( * ******************************************************************************/ -void -acpi_ps_cleanup_scope ( - struct acpi_parse_state *parser_state) +void acpi_ps_cleanup_scope(struct acpi_parse_state *parser_state) { - union acpi_generic_state *scope; - - - ACPI_FUNCTION_TRACE_PTR ("ps_cleanup_scope", parser_state); + union acpi_generic_state *scope; + ACPI_FUNCTION_TRACE_PTR("ps_cleanup_scope", parser_state); if (!parser_state) { return_VOID; @@ -284,10 +255,9 @@ acpi_ps_cleanup_scope ( /* Delete anything on the scope stack */ while (parser_state->scope) { - scope = acpi_ut_pop_generic_state (&parser_state->scope); - acpi_ut_delete_generic_state (scope); + scope = acpi_ut_pop_generic_state(&parser_state->scope); + acpi_ut_delete_generic_state(scope); } return_VOID; } - diff --git a/drivers/acpi/parser/pstree.c b/drivers/acpi/parser/pstree.c index d5aafe73fca..f0e755884ee 100644 --- a/drivers/acpi/parser/pstree.c +++ b/drivers/acpi/parser/pstree.c @@ -41,23 +41,18 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include #include #include #define _COMPONENT ACPI_PARSER - ACPI_MODULE_NAME ("pstree") +ACPI_MODULE_NAME("pstree") /* Local prototypes */ - #ifdef ACPI_OBSOLETE_FUNCTIONS -union acpi_parse_object * -acpi_ps_get_child ( - union acpi_parse_object *op); +union acpi_parse_object *acpi_ps_get_child(union acpi_parse_object *op); #endif - /******************************************************************************* * * FUNCTION: acpi_ps_get_arg @@ -71,21 +66,16 @@ acpi_ps_get_child ( * ******************************************************************************/ -union acpi_parse_object * -acpi_ps_get_arg ( - union acpi_parse_object *op, - u32 argn) +union acpi_parse_object *acpi_ps_get_arg(union acpi_parse_object *op, u32 argn) { - union acpi_parse_object *arg = NULL; - const struct acpi_opcode_info *op_info; - - - ACPI_FUNCTION_ENTRY (); + union acpi_parse_object *arg = NULL; + const struct acpi_opcode_info *op_info; + ACPI_FUNCTION_ENTRY(); /* Get the info structure for this opcode */ - op_info = acpi_ps_get_opcode_info (op->common.aml_opcode); + op_info = acpi_ps_get_opcode_info(op->common.aml_opcode); if (op_info->class == AML_CLASS_UNKNOWN) { /* Invalid opcode or ASCII character */ @@ -111,7 +101,6 @@ acpi_ps_get_arg ( return (arg); } - /******************************************************************************* * * FUNCTION: acpi_ps_append_arg @@ -126,16 +115,12 @@ acpi_ps_get_arg ( ******************************************************************************/ void -acpi_ps_append_arg ( - union acpi_parse_object *op, - union acpi_parse_object *arg) +acpi_ps_append_arg(union acpi_parse_object *op, union acpi_parse_object *arg) { - union acpi_parse_object *prev_arg; - const struct acpi_opcode_info *op_info; - - - ACPI_FUNCTION_ENTRY (); + union acpi_parse_object *prev_arg; + const struct acpi_opcode_info *op_info; + ACPI_FUNCTION_ENTRY(); if (!op) { return; @@ -143,12 +128,11 @@ acpi_ps_append_arg ( /* Get the info structure for this opcode */ - op_info = acpi_ps_get_opcode_info (op->common.aml_opcode); + op_info = acpi_ps_get_opcode_info(op->common.aml_opcode); if (op_info->class == AML_CLASS_UNKNOWN) { /* Invalid opcode */ - ACPI_REPORT_ERROR (("ps_append_arg: Invalid AML Opcode: 0x%2.2X\n", - op->common.aml_opcode)); + ACPI_REPORT_ERROR(("ps_append_arg: Invalid AML Opcode: 0x%2.2X\n", op->common.aml_opcode)); return; } @@ -170,8 +154,7 @@ acpi_ps_append_arg ( prev_arg = prev_arg->common.next; } prev_arg->common.next = arg; - } - else { + } else { /* No argument list, this will be the first argument */ op->common.value.arg = arg; @@ -185,7 +168,6 @@ acpi_ps_append_arg ( } } - #ifdef ACPI_FUTURE_USAGE /******************************************************************************* * @@ -201,18 +183,14 @@ acpi_ps_append_arg ( * ******************************************************************************/ -union acpi_parse_object * -acpi_ps_get_depth_next ( - union acpi_parse_object *origin, - union acpi_parse_object *op) +union acpi_parse_object *acpi_ps_get_depth_next(union acpi_parse_object *origin, + union acpi_parse_object *op) { - union acpi_parse_object *next = NULL; - union acpi_parse_object *parent; - union acpi_parse_object *arg; - - - ACPI_FUNCTION_ENTRY (); + union acpi_parse_object *next = NULL; + union acpi_parse_object *parent; + union acpi_parse_object *arg; + ACPI_FUNCTION_ENTRY(); if (!op) { return (NULL); @@ -220,7 +198,7 @@ acpi_ps_get_depth_next ( /* Look for an argument or child */ - next = acpi_ps_get_arg (op, 0); + next = acpi_ps_get_arg(op, 0); if (next) { return (next); } @@ -237,7 +215,7 @@ acpi_ps_get_depth_next ( parent = op->common.parent; while (parent) { - arg = acpi_ps_get_arg (parent, 0); + arg = acpi_ps_get_arg(parent, 0); while (arg && (arg != origin) && (arg != op)) { arg = arg->common.next; } @@ -261,7 +239,6 @@ acpi_ps_get_depth_next ( return (next); } - #ifdef ACPI_OBSOLETE_FUNCTIONS /******************************************************************************* * @@ -275,15 +252,11 @@ acpi_ps_get_depth_next ( * ******************************************************************************/ -union acpi_parse_object * -acpi_ps_get_child ( - union acpi_parse_object *op) +union acpi_parse_object *acpi_ps_get_child(union acpi_parse_object *op) { - union acpi_parse_object *child = NULL; - - - ACPI_FUNCTION_ENTRY (); + union acpi_parse_object *child = NULL; + ACPI_FUNCTION_ENTRY(); switch (op->common.aml_opcode) { case AML_SCOPE_OP: @@ -292,10 +265,9 @@ acpi_ps_get_child ( case AML_THERMAL_ZONE_OP: case AML_INT_METHODCALL_OP: - child = acpi_ps_get_arg (op, 0); + child = acpi_ps_get_arg(op, 0); break; - case AML_BUFFER_OP: case AML_PACKAGE_OP: case AML_METHOD_OP: @@ -303,24 +275,21 @@ acpi_ps_get_child ( case AML_WHILE_OP: case AML_FIELD_OP: - child = acpi_ps_get_arg (op, 1); + child = acpi_ps_get_arg(op, 1); break; - case AML_POWER_RES_OP: case AML_INDEX_FIELD_OP: - child = acpi_ps_get_arg (op, 2); + child = acpi_ps_get_arg(op, 2); break; - case AML_PROCESSOR_OP: case AML_BANK_FIELD_OP: - child = acpi_ps_get_arg (op, 3); + child = acpi_ps_get_arg(op, 3); break; - default: /* All others have no children */ break; @@ -330,5 +299,4 @@ acpi_ps_get_child ( } #endif -#endif /* ACPI_FUTURE_USAGE */ - +#endif /* ACPI_FUTURE_USAGE */ diff --git a/drivers/acpi/parser/psutils.c b/drivers/acpi/parser/psutils.c index 4221b41ae1a..2075efbb432 100644 --- a/drivers/acpi/parser/psutils.c +++ b/drivers/acpi/parser/psutils.c @@ -41,14 +41,12 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include #include #include #define _COMPONENT ACPI_PARSER - ACPI_MODULE_NAME ("psutils") - +ACPI_MODULE_NAME("psutils") /******************************************************************************* * @@ -61,15 +59,11 @@ * DESCRIPTION: Create a Scope and associated namepath op with the root name * ******************************************************************************/ - -union acpi_parse_object * -acpi_ps_create_scope_op ( - void) +union acpi_parse_object *acpi_ps_create_scope_op(void) { - union acpi_parse_object *scope_op; + union acpi_parse_object *scope_op; - - scope_op = acpi_ps_alloc_op (AML_SCOPE_OP); + scope_op = acpi_ps_alloc_op(AML_SCOPE_OP); if (!scope_op) { return (NULL); } @@ -78,7 +72,6 @@ acpi_ps_create_scope_op ( return (scope_op); } - /******************************************************************************* * * FUNCTION: acpi_ps_init_op @@ -92,23 +85,19 @@ acpi_ps_create_scope_op ( * ******************************************************************************/ -void -acpi_ps_init_op ( - union acpi_parse_object *op, - u16 opcode) +void acpi_ps_init_op(union acpi_parse_object *op, u16 opcode) { - ACPI_FUNCTION_ENTRY (); - + ACPI_FUNCTION_ENTRY(); op->common.data_type = ACPI_DESC_TYPE_PARSER; op->common.aml_opcode = opcode; - ACPI_DISASM_ONLY_MEMBERS (ACPI_STRNCPY (op->common.aml_op_name, - (acpi_ps_get_opcode_info (opcode))->name, - sizeof (op->common.aml_op_name))); + ACPI_DISASM_ONLY_MEMBERS(ACPI_STRNCPY(op->common.aml_op_name, + (acpi_ps_get_opcode_info + (opcode))->name, + sizeof(op->common.aml_op_name))); } - /******************************************************************************* * * FUNCTION: acpi_ps_alloc_op @@ -123,29 +112,23 @@ acpi_ps_init_op ( * ******************************************************************************/ -union acpi_parse_object* -acpi_ps_alloc_op ( - u16 opcode) +union acpi_parse_object *acpi_ps_alloc_op(u16 opcode) { - union acpi_parse_object *op; - const struct acpi_opcode_info *op_info; - u8 flags = ACPI_PARSEOP_GENERIC; - - - ACPI_FUNCTION_ENTRY (); + union acpi_parse_object *op; + const struct acpi_opcode_info *op_info; + u8 flags = ACPI_PARSEOP_GENERIC; + ACPI_FUNCTION_ENTRY(); - op_info = acpi_ps_get_opcode_info (opcode); + op_info = acpi_ps_get_opcode_info(opcode); /* Determine type of parse_op required */ if (op_info->flags & AML_DEFER) { flags = ACPI_PARSEOP_DEFERRED; - } - else if (op_info->flags & AML_NAMED) { + } else if (op_info->flags & AML_NAMED) { flags = ACPI_PARSEOP_NAMED; - } - else if (opcode == AML_INT_BYTELIST_OP) { + } else if (opcode == AML_INT_BYTELIST_OP) { flags = ACPI_PARSEOP_BYTELIST; } @@ -154,27 +137,25 @@ acpi_ps_alloc_op ( if (flags == ACPI_PARSEOP_GENERIC) { /* The generic op (default) is by far the most common (16 to 1) */ - op = acpi_os_acquire_object (acpi_gbl_ps_node_cache); + op = acpi_os_acquire_object(acpi_gbl_ps_node_cache); memset(op, 0, sizeof(struct acpi_parse_obj_common)); - } - else { + } else { /* Extended parseop */ - op = acpi_os_acquire_object (acpi_gbl_ps_node_ext_cache); + op = acpi_os_acquire_object(acpi_gbl_ps_node_ext_cache); memset(op, 0, sizeof(struct acpi_parse_obj_named)); } /* Initialize the Op */ if (op) { - acpi_ps_init_op (op, opcode); + acpi_ps_init_op(op, opcode); op->common.flags = flags; } return (op); } - /******************************************************************************* * * FUNCTION: acpi_ps_free_op @@ -188,26 +169,22 @@ acpi_ps_alloc_op ( * ******************************************************************************/ -void -acpi_ps_free_op ( - union acpi_parse_object *op) +void acpi_ps_free_op(union acpi_parse_object *op) { - ACPI_FUNCTION_NAME ("ps_free_op"); - + ACPI_FUNCTION_NAME("ps_free_op"); if (op->common.aml_opcode == AML_INT_RETURN_VALUE_OP) { - ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Free retval op: %p\n", op)); + ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, "Free retval op: %p\n", + op)); } if (op->common.flags & ACPI_PARSEOP_GENERIC) { - (void) acpi_os_release_object (acpi_gbl_ps_node_cache, op); - } - else { - (void) acpi_os_release_object (acpi_gbl_ps_node_ext_cache, op); + (void)acpi_os_release_object(acpi_gbl_ps_node_cache, op); + } else { + (void)acpi_os_release_object(acpi_gbl_ps_node_ext_cache, op); } } - /******************************************************************************* * * FUNCTION: Utility functions @@ -216,36 +193,27 @@ acpi_ps_free_op ( * ******************************************************************************/ - /* * Is "c" a namestring lead character? */ -u8 -acpi_ps_is_leading_char ( - u32 c) +u8 acpi_ps_is_leading_char(u32 c) { return ((u8) (c == '_' || (c >= 'A' && c <= 'Z'))); } - /* * Is "c" a namestring prefix character? */ -u8 -acpi_ps_is_prefix_char ( - u32 c) +u8 acpi_ps_is_prefix_char(u32 c) { return ((u8) (c == '\\' || c == '^')); } - /* * Get op's name (4-byte name segment) or 0 if unnamed */ #ifdef ACPI_FUTURE_USAGE -u32 -acpi_ps_get_name ( - union acpi_parse_object *op) +u32 acpi_ps_get_name(union acpi_parse_object * op) { /* The "generic" object has no name associated with it */ @@ -258,16 +226,12 @@ acpi_ps_get_name ( return (op->named.name); } -#endif /* ACPI_FUTURE_USAGE */ - +#endif /* ACPI_FUTURE_USAGE */ /* * Set op's name */ -void -acpi_ps_set_name ( - union acpi_parse_object *op, - u32 name) +void acpi_ps_set_name(union acpi_parse_object *op, u32 name) { /* The "generic" object has no name associated with it */ @@ -278,4 +242,3 @@ acpi_ps_set_name ( op->named.name = name; } - diff --git a/drivers/acpi/parser/pswalk.c b/drivers/acpi/parser/pswalk.c index 9d20cb2ceb5..08f2321b6de 100644 --- a/drivers/acpi/parser/pswalk.c +++ b/drivers/acpi/parser/pswalk.c @@ -41,13 +41,11 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include #include #define _COMPONENT ACPI_PARSER - ACPI_MODULE_NAME ("pswalk") - +ACPI_MODULE_NAME("pswalk") /******************************************************************************* * @@ -60,18 +58,13 @@ * DESCRIPTION: Delete a portion of or an entire parse tree. * ******************************************************************************/ - -void -acpi_ps_delete_parse_tree ( - union acpi_parse_object *subtree_root) +void acpi_ps_delete_parse_tree(union acpi_parse_object *subtree_root) { - union acpi_parse_object *op = subtree_root; - union acpi_parse_object *next = NULL; - union acpi_parse_object *parent = NULL; - - - ACPI_FUNCTION_TRACE_PTR ("ps_delete_parse_tree", subtree_root); + union acpi_parse_object *op = subtree_root; + union acpi_parse_object *next = NULL; + union acpi_parse_object *parent = NULL; + ACPI_FUNCTION_TRACE_PTR("ps_delete_parse_tree", subtree_root); /* Visit all nodes in the subtree */ @@ -81,7 +74,7 @@ acpi_ps_delete_parse_tree ( if (op != parent) { /* Look for an argument or child of the current op */ - next = acpi_ps_get_arg (op, 0); + next = acpi_ps_get_arg(op, 0); if (next) { /* Still going downward in tree (Op is not completed yet) */ @@ -95,7 +88,7 @@ acpi_ps_delete_parse_tree ( next = op->common.next; parent = op->common.parent; - acpi_ps_free_op (op); + acpi_ps_free_op(op); /* If we are back to the starting point, the walk is complete. */ @@ -104,8 +97,7 @@ acpi_ps_delete_parse_tree ( } if (next) { op = next; - } - else { + } else { op = parent; } } diff --git a/drivers/acpi/parser/psxface.c b/drivers/acpi/parser/psxface.c index d1541fabaf0..80c67f2d3dd 100644 --- a/drivers/acpi/parser/psxface.c +++ b/drivers/acpi/parser/psxface.c @@ -41,27 +41,19 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include #include #include #include - #define _COMPONENT ACPI_PARSER - ACPI_MODULE_NAME ("psxface") +ACPI_MODULE_NAME("psxface") /* Local Prototypes */ - -static acpi_status -acpi_ps_execute_pass ( - struct acpi_parameter_info *info); +static acpi_status acpi_ps_execute_pass(struct acpi_parameter_info *info); static void -acpi_ps_update_parameter_list ( - struct acpi_parameter_info *info, - u16 action); - +acpi_ps_update_parameter_list(struct acpi_parameter_info *info, u16 action); /******************************************************************************* * @@ -86,27 +78,24 @@ acpi_ps_update_parameter_list ( * ******************************************************************************/ -acpi_status -acpi_ps_execute_method ( - struct acpi_parameter_info *info) +acpi_status acpi_ps_execute_method(struct acpi_parameter_info *info) { - acpi_status status; - - - ACPI_FUNCTION_TRACE ("ps_execute_method"); + acpi_status status; + ACPI_FUNCTION_TRACE("ps_execute_method"); /* Validate the Info and method Node */ if (!info || !info->node) { - return_ACPI_STATUS (AE_NULL_ENTRY); + return_ACPI_STATUS(AE_NULL_ENTRY); } /* Init for new method, wait on concurrency semaphore */ - status = acpi_ds_begin_method_execution (info->node, info->obj_desc, NULL); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = + acpi_ds_begin_method_execution(info->node, info->obj_desc, NULL); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* @@ -114,55 +103,54 @@ acpi_ps_execute_method ( * objects (such as Operation Regions) can be created during the * first pass parse. */ - status = acpi_ut_allocate_owner_id (&info->obj_desc->method.owner_id); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ut_allocate_owner_id(&info->obj_desc->method.owner_id); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* * The caller "owns" the parameters, so give each one an extra * reference */ - acpi_ps_update_parameter_list (info, REF_INCREMENT); + acpi_ps_update_parameter_list(info, REF_INCREMENT); /* * 1) Perform the first pass parse of the method to enter any * named objects that it creates into the namespace */ - ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, - "**** Begin Method Parse **** Entry=%p obj=%p\n", - info->node, info->obj_desc)); + ACPI_DEBUG_PRINT((ACPI_DB_PARSE, + "**** Begin Method Parse **** Entry=%p obj=%p\n", + info->node, info->obj_desc)); info->pass_number = 1; - status = acpi_ps_execute_pass (info); - if (ACPI_FAILURE (status)) { + status = acpi_ps_execute_pass(info); + if (ACPI_FAILURE(status)) { goto cleanup; } /* * 2) Execute the method. Performs second pass parse simultaneously */ - ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, - "**** Begin Method Execution **** Entry=%p obj=%p\n", - info->node, info->obj_desc)); + ACPI_DEBUG_PRINT((ACPI_DB_PARSE, + "**** Begin Method Execution **** Entry=%p obj=%p\n", + info->node, info->obj_desc)); info->pass_number = 3; - status = acpi_ps_execute_pass (info); - + status = acpi_ps_execute_pass(info); -cleanup: + cleanup: if (info->obj_desc->method.owner_id) { - acpi_ut_release_owner_id (&info->obj_desc->method.owner_id); + acpi_ut_release_owner_id(&info->obj_desc->method.owner_id); } /* Take away the extra reference that we gave the parameters above */ - acpi_ps_update_parameter_list (info, REF_DECREMENT); + acpi_ps_update_parameter_list(info, REF_DECREMENT); /* Exit now if error above */ - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* @@ -170,17 +158,17 @@ cleanup: * a control exception code */ if (info->return_object) { - ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Method returned obj_desc=%p\n", - info->return_object)); - ACPI_DUMP_STACK_ENTRY (info->return_object); + ACPI_DEBUG_PRINT((ACPI_DB_PARSE, + "Method returned obj_desc=%p\n", + info->return_object)); + ACPI_DUMP_STACK_ENTRY(info->return_object); status = AE_CTRL_RETURN_VALUE; } - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_ps_update_parameter_list @@ -196,26 +184,23 @@ cleanup: ******************************************************************************/ static void -acpi_ps_update_parameter_list ( - struct acpi_parameter_info *info, - u16 action) +acpi_ps_update_parameter_list(struct acpi_parameter_info *info, u16 action) { - acpi_native_uint i; - + acpi_native_uint i; - if ((info->parameter_type == ACPI_PARAM_ARGS) && - (info->parameters)) { + if ((info->parameter_type == ACPI_PARAM_ARGS) && (info->parameters)) { /* Update reference count for each parameter */ for (i = 0; info->parameters[i]; i++) { /* Ignore errors, just do them all */ - (void) acpi_ut_update_object_reference (info->parameters[i], action); + (void)acpi_ut_update_object_reference(info-> + parameters[i], + action); } } } - /******************************************************************************* * * FUNCTION: acpi_ps_execute_pass @@ -229,53 +214,48 @@ acpi_ps_update_parameter_list ( * ******************************************************************************/ -static acpi_status -acpi_ps_execute_pass ( - struct acpi_parameter_info *info) +static acpi_status acpi_ps_execute_pass(struct acpi_parameter_info *info) { - acpi_status status; - union acpi_parse_object *op; - struct acpi_walk_state *walk_state; - - - ACPI_FUNCTION_TRACE ("ps_execute_pass"); + acpi_status status; + union acpi_parse_object *op; + struct acpi_walk_state *walk_state; + ACPI_FUNCTION_TRACE("ps_execute_pass"); /* Create and init a Root Node */ - op = acpi_ps_create_scope_op (); + op = acpi_ps_create_scope_op(); if (!op) { - return_ACPI_STATUS (AE_NO_MEMORY); + return_ACPI_STATUS(AE_NO_MEMORY); } /* Create and initialize a new walk state */ - walk_state = acpi_ds_create_walk_state ( - info->obj_desc->method.owner_id, NULL, NULL, NULL); + walk_state = + acpi_ds_create_walk_state(info->obj_desc->method.owner_id, NULL, + NULL, NULL); if (!walk_state) { status = AE_NO_MEMORY; goto cleanup; } - status = acpi_ds_init_aml_walk (walk_state, op, info->node, - info->obj_desc->method.aml_start, - info->obj_desc->method.aml_length, - info->pass_number == 1 ? NULL : info, - info->pass_number); - if (ACPI_FAILURE (status)) { - acpi_ds_delete_walk_state (walk_state); + status = acpi_ds_init_aml_walk(walk_state, op, info->node, + info->obj_desc->method.aml_start, + info->obj_desc->method.aml_length, + info->pass_number == 1 ? NULL : info, + info->pass_number); + if (ACPI_FAILURE(status)) { + acpi_ds_delete_walk_state(walk_state); goto cleanup; } /* Parse the AML */ - status = acpi_ps_parse_aml (walk_state); + status = acpi_ps_parse_aml(walk_state); /* Walk state was deleted by parse_aml */ -cleanup: - acpi_ps_delete_parse_tree (op); - return_ACPI_STATUS (status); + cleanup: + acpi_ps_delete_parse_tree(op); + return_ACPI_STATUS(status); } - - diff --git a/drivers/acpi/pci_bind.c b/drivers/acpi/pci_bind.c index 5148f3c10b5..a4955685e4c 100644 --- a/drivers/acpi/pci_bind.c +++ b/drivers/acpi/pci_bind.c @@ -35,22 +35,16 @@ #include #include - #define _COMPONENT ACPI_PCI_COMPONENT -ACPI_MODULE_NAME ("pci_bind") +ACPI_MODULE_NAME("pci_bind") struct acpi_pci_data { - struct acpi_pci_id id; - struct pci_bus *bus; - struct pci_dev *dev; + struct acpi_pci_id id; + struct pci_bus *bus; + struct pci_dev *dev; }; - -void -acpi_pci_data_handler ( - acpi_handle handle, - u32 function, - void *context) +void acpi_pci_data_handler(acpi_handle handle, u32 function, void *context) { ACPI_FUNCTION_TRACE("acpi_pci_data_handler"); @@ -59,7 +53,6 @@ acpi_pci_data_handler ( return_VOID; } - /** * acpi_get_pci_id * ------------------ @@ -67,15 +60,12 @@ acpi_pci_data_handler ( * to resolve PCI information for ACPI-PCI devices defined in the namespace. * This typically occurs when resolving PCI operation region information. */ -acpi_status -acpi_get_pci_id ( - acpi_handle handle, - struct acpi_pci_id *id) +acpi_status acpi_get_pci_id(acpi_handle handle, struct acpi_pci_id *id) { - int result = 0; - acpi_status status = AE_OK; - struct acpi_device *device = NULL; - struct acpi_pci_data *data = NULL; + int result = 0; + acpi_status status = AE_OK; + struct acpi_device *device = NULL; + struct acpi_pci_data *data = NULL; ACPI_FUNCTION_TRACE("acpi_get_pci_id"); @@ -84,52 +74,50 @@ acpi_get_pci_id ( result = acpi_bus_get_device(handle, &device); if (result) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Invalid ACPI Bus context for device %s\n", - acpi_device_bid(device))); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Invalid ACPI Bus context for device %s\n", + acpi_device_bid(device))); return_ACPI_STATUS(AE_NOT_EXIST); } - status = acpi_get_data(handle, acpi_pci_data_handler, (void**) &data); + status = acpi_get_data(handle, acpi_pci_data_handler, (void **)&data); if (ACPI_FAILURE(status) || !data) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Invalid ACPI-PCI context for device %s\n", - acpi_device_bid(device))); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Invalid ACPI-PCI context for device %s\n", + acpi_device_bid(device))); return_ACPI_STATUS(status); } *id = data->id; - + /* - id->segment = data->id.segment; - id->bus = data->id.bus; - id->device = data->id.device; - id->function = data->id.function; - */ + id->segment = data->id.segment; + id->bus = data->id.bus; + id->device = data->id.device; + id->function = data->id.function; + */ - ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "Device %s has PCI address %02x:%02x:%02x.%02x\n", - acpi_device_bid(device), id->segment, id->bus, - id->device, id->function)); + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "Device %s has PCI address %02x:%02x:%02x.%02x\n", + acpi_device_bid(device), id->segment, id->bus, + id->device, id->function)); return_ACPI_STATUS(AE_OK); } + EXPORT_SYMBOL(acpi_get_pci_id); - -int -acpi_pci_bind ( - struct acpi_device *device) +int acpi_pci_bind(struct acpi_device *device) { - int result = 0; - acpi_status status = AE_OK; - struct acpi_pci_data *data = NULL; - struct acpi_pci_data *pdata = NULL; - char *pathname = NULL; - struct acpi_buffer buffer = {0, NULL}; - acpi_handle handle = NULL; - struct pci_dev *dev; - struct pci_bus *bus; + int result = 0; + acpi_status status = AE_OK; + struct acpi_pci_data *data = NULL; + struct acpi_pci_data *pdata = NULL; + char *pathname = NULL; + struct acpi_buffer buffer = { 0, NULL }; + acpi_handle handle = NULL; + struct pci_dev *dev; + struct pci_bus *bus; ACPI_FUNCTION_TRACE("acpi_pci_bind"); @@ -137,34 +125,34 @@ acpi_pci_bind ( return_VALUE(-EINVAL); pathname = kmalloc(ACPI_PATHNAME_MAX, GFP_KERNEL); - if(!pathname) + if (!pathname) return_VALUE(-ENOMEM); memset(pathname, 0, ACPI_PATHNAME_MAX); buffer.length = ACPI_PATHNAME_MAX; buffer.pointer = pathname; data = kmalloc(sizeof(struct acpi_pci_data), GFP_KERNEL); - if (!data){ - kfree (pathname); + if (!data) { + kfree(pathname); return_VALUE(-ENOMEM); } memset(data, 0, sizeof(struct acpi_pci_data)); acpi_get_name(device->handle, ACPI_FULL_PATHNAME, &buffer); - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Binding PCI device [%s]...\n", - pathname)); + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Binding PCI device [%s]...\n", + pathname)); /* * Segment & Bus * ------------- * These are obtained via the parent device's ACPI-PCI context. */ - status = acpi_get_data(device->parent->handle, acpi_pci_data_handler, - (void**) &pdata); + status = acpi_get_data(device->parent->handle, acpi_pci_data_handler, + (void **)&pdata); if (ACPI_FAILURE(status) || !pdata || !pdata->bus) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Invalid ACPI-PCI context for parent device %s\n", - acpi_device_bid(device->parent))); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Invalid ACPI-PCI context for parent device %s\n", + acpi_device_bid(device->parent))); result = -ENODEV; goto end; } @@ -181,8 +169,8 @@ acpi_pci_bind ( data->id.function = device->pnp.bus_address & 0xFFFF; ACPI_DEBUG_PRINT((ACPI_DB_INFO, "...to %02x:%02x:%02x.%02x\n", - data->id.segment, data->id.bus, data->id.device, - data->id.function)); + data->id.segment, data->id.bus, data->id.device, + data->id.function)); /* * TBD: Support slot devices (e.g. function=0xFFFF). @@ -202,25 +190,25 @@ acpi_pci_bind ( if (bus) { list_for_each_entry(dev, &bus->devices, bus_list) { if (dev->devfn == PCI_DEVFN(data->id.device, - data->id.function)) { + data->id.function)) { data->dev = dev; break; } } } if (!data->dev) { - ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "Device %02x:%02x:%02x.%02x not present in PCI namespace\n", - data->id.segment, data->id.bus, - data->id.device, data->id.function)); + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "Device %02x:%02x:%02x.%02x not present in PCI namespace\n", + data->id.segment, data->id.bus, + data->id.device, data->id.function)); result = -ENODEV; goto end; } if (!data->dev->bus) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Device %02x:%02x:%02x.%02x has invalid 'bus' field\n", - data->id.segment, data->id.bus, - data->id.device, data->id.function)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Device %02x:%02x:%02x.%02x has invalid 'bus' field\n", + data->id.segment, data->id.bus, + data->id.device, data->id.function)); result = -ENODEV; goto end; } @@ -232,10 +220,10 @@ acpi_pci_bind ( * facilitate callbacks for all of its children. */ if (data->dev->subordinate) { - ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "Device %02x:%02x:%02x.%02x is a PCI bridge\n", - data->id.segment, data->id.bus, - data->id.device, data->id.function)); + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "Device %02x:%02x:%02x.%02x is a PCI bridge\n", + data->id.segment, data->id.bus, + data->id.device, data->id.function)); data->bus = data->dev->subordinate; device->ops.bind = acpi_pci_bind; device->ops.unbind = acpi_pci_unbind; @@ -249,8 +237,8 @@ acpi_pci_bind ( status = acpi_attach_data(device->handle, acpi_pci_data_handler, data); if (ACPI_FAILURE(status)) { ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to attach ACPI-PCI context to device %s\n", - acpi_device_bid(device))); + "Unable to attach ACPI-PCI context to device %s\n", + acpi_device_bid(device))); result = -ENODEV; goto end; } @@ -267,15 +255,15 @@ acpi_pci_bind ( */ status = acpi_get_handle(device->handle, METHOD_NAME__PRT, &handle); if (ACPI_SUCCESS(status)) { - if (data->bus) /* PCI-PCI bridge */ - acpi_pci_irq_add_prt(device->handle, data->id.segment, - data->bus->number); - else /* non-bridge PCI device */ + if (data->bus) /* PCI-PCI bridge */ acpi_pci_irq_add_prt(device->handle, data->id.segment, - data->id.bus); + data->bus->number); + else /* non-bridge PCI device */ + acpi_pci_irq_add_prt(device->handle, data->id.segment, + data->id.bus); } -end: + end: kfree(pathname); if (result) kfree(data); @@ -283,22 +271,21 @@ end: return_VALUE(result); } -int acpi_pci_unbind( - struct acpi_device *device) +int acpi_pci_unbind(struct acpi_device *device) { - int result = 0; - acpi_status status = AE_OK; - struct acpi_pci_data *data = NULL; - char *pathname = NULL; - struct acpi_buffer buffer = {0, NULL}; + int result = 0; + acpi_status status = AE_OK; + struct acpi_pci_data *data = NULL; + char *pathname = NULL; + struct acpi_buffer buffer = { 0, NULL }; ACPI_FUNCTION_TRACE("acpi_pci_unbind"); if (!device || !device->parent) return_VALUE(-EINVAL); - pathname = (char *) kmalloc(ACPI_PATHNAME_MAX, GFP_KERNEL); - if(!pathname) + pathname = (char *)kmalloc(ACPI_PATHNAME_MAX, GFP_KERNEL); + if (!pathname) return_VALUE(-ENOMEM); memset(pathname, 0, ACPI_PATHNAME_MAX); @@ -306,14 +293,16 @@ int acpi_pci_unbind( buffer.pointer = pathname; acpi_get_name(device->handle, ACPI_FULL_PATHNAME, &buffer); ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Unbinding PCI device [%s]...\n", - pathname)); + pathname)); kfree(pathname); - status = acpi_get_data(device->handle, acpi_pci_data_handler, (void**)&data); + status = + acpi_get_data(device->handle, acpi_pci_data_handler, + (void **)&data); if (ACPI_FAILURE(status)) { ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to get data from device %s\n", - acpi_device_bid(device))); + "Unable to get data from device %s\n", + acpi_device_bid(device))); result = -ENODEV; goto end; } @@ -321,8 +310,8 @@ int acpi_pci_unbind( status = acpi_detach_data(device->handle, acpi_pci_data_handler); if (ACPI_FAILURE(status)) { ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to detach data from device %s\n", - acpi_device_bid(device))); + "Unable to detach data from device %s\n", + acpi_device_bid(device))); result = -ENODEV; goto end; } @@ -331,39 +320,37 @@ int acpi_pci_unbind( } kfree(data); -end: + end: return_VALUE(result); } -int -acpi_pci_bind_root ( - struct acpi_device *device, - struct acpi_pci_id *id, - struct pci_bus *bus) +int +acpi_pci_bind_root(struct acpi_device *device, + struct acpi_pci_id *id, struct pci_bus *bus) { - int result = 0; - acpi_status status = AE_OK; - struct acpi_pci_data *data = NULL; - char *pathname = NULL; - struct acpi_buffer buffer = {0, NULL}; + int result = 0; + acpi_status status = AE_OK; + struct acpi_pci_data *data = NULL; + char *pathname = NULL; + struct acpi_buffer buffer = { 0, NULL }; ACPI_FUNCTION_TRACE("acpi_pci_bind_root"); pathname = (char *)kmalloc(ACPI_PATHNAME_MAX, GFP_KERNEL); - if(!pathname) + if (!pathname) return_VALUE(-ENOMEM); memset(pathname, 0, ACPI_PATHNAME_MAX); buffer.length = ACPI_PATHNAME_MAX; buffer.pointer = pathname; - if (!device || !id || !bus){ + if (!device || !id || !bus) { kfree(pathname); return_VALUE(-EINVAL); } data = kmalloc(sizeof(struct acpi_pci_data), GFP_KERNEL); - if (!data){ + if (!data) { kfree(pathname); return_VALUE(-ENOMEM); } @@ -377,18 +364,18 @@ acpi_pci_bind_root ( acpi_get_name(device->handle, ACPI_FULL_PATHNAME, &buffer); ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Binding PCI root bridge [%s] to " - "%02x:%02x\n", pathname, id->segment, id->bus)); + "%02x:%02x\n", pathname, id->segment, id->bus)); status = acpi_attach_data(device->handle, acpi_pci_data_handler, data); if (ACPI_FAILURE(status)) { ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to attach ACPI-PCI context to device %s\n", - pathname)); + "Unable to attach ACPI-PCI context to device %s\n", + pathname)); result = -ENODEV; goto end; } -end: + end: kfree(pathname); if (result != 0) kfree(data); diff --git a/drivers/acpi/pci_irq.c b/drivers/acpi/pci_irq.c index c885300579e..2bbfba8e8c6 100644 --- a/drivers/acpi/pci_irq.c +++ b/drivers/acpi/pci_irq.c @@ -38,26 +38,22 @@ #include #include - #define _COMPONENT ACPI_PCI_COMPONENT -ACPI_MODULE_NAME ("pci_irq") +ACPI_MODULE_NAME("pci_irq") -static struct acpi_prt_list acpi_prt; +static struct acpi_prt_list acpi_prt; static DEFINE_SPINLOCK(acpi_prt_lock); /* -------------------------------------------------------------------------- PCI IRQ Routing Table (PRT) Support -------------------------------------------------------------------------- */ -static struct acpi_prt_entry * -acpi_pci_irq_find_prt_entry ( - int segment, - int bus, - int device, - int pin) +static struct acpi_prt_entry *acpi_pci_irq_find_prt_entry(int segment, + int bus, + int device, int pin) { - struct list_head *node = NULL; - struct acpi_prt_entry *entry = NULL; + struct list_head *node = NULL; + struct acpi_prt_entry *entry = NULL; ACPI_FUNCTION_TRACE("acpi_pci_irq_find_prt_entry"); @@ -72,10 +68,10 @@ acpi_pci_irq_find_prt_entry ( spin_lock(&acpi_prt_lock); list_for_each(node, &acpi_prt.entries) { entry = list_entry(node, struct acpi_prt_entry, node); - if ((segment == entry->id.segment) - && (bus == entry->id.bus) - && (device == entry->id.device) - && (pin == entry->pin)) { + if ((segment == entry->id.segment) + && (bus == entry->id.bus) + && (device == entry->id.device) + && (pin == entry->pin)) { spin_unlock(&acpi_prt_lock); return_PTR(entry); } @@ -85,15 +81,11 @@ acpi_pci_irq_find_prt_entry ( return_PTR(NULL); } - static int -acpi_pci_irq_add_entry ( - acpi_handle handle, - int segment, - int bus, - struct acpi_pci_routing_table *prt) +acpi_pci_irq_add_entry(acpi_handle handle, + int segment, int bus, struct acpi_pci_routing_table *prt) { - struct acpi_prt_entry *entry = NULL; + struct acpi_prt_entry *entry = NULL; ACPI_FUNCTION_TRACE("acpi_pci_irq_add_entry"); @@ -139,9 +131,10 @@ acpi_pci_irq_add_entry ( entry->link.index = prt->source_index; ACPI_DEBUG_PRINT_RAW((ACPI_DB_INFO, - " %02X:%02X:%02X[%c] -> %s[%d]\n", - entry->id.segment, entry->id.bus, entry->id.device, - ('A' + entry->pin), prt->source, entry->link.index)); + " %02X:%02X:%02X[%c] -> %s[%d]\n", + entry->id.segment, entry->id.bus, + entry->id.device, ('A' + entry->pin), prt->source, + entry->link.index)); spin_lock(&acpi_prt_lock); list_add_tail(&entry->node, &acpi_prt.entries); @@ -151,38 +144,29 @@ acpi_pci_irq_add_entry ( return_VALUE(0); } - static void -acpi_pci_irq_del_entry ( - int segment, - int bus, - struct acpi_prt_entry *entry) +acpi_pci_irq_del_entry(int segment, int bus, struct acpi_prt_entry *entry) { - if (segment == entry->id.segment && bus == entry->id.bus){ + if (segment == entry->id.segment && bus == entry->id.bus) { acpi_prt.count--; list_del(&entry->node); kfree(entry); } } - -int -acpi_pci_irq_add_prt ( - acpi_handle handle, - int segment, - int bus) +int acpi_pci_irq_add_prt(acpi_handle handle, int segment, int bus) { - acpi_status status = AE_OK; - char *pathname = NULL; - struct acpi_buffer buffer = {0, NULL}; - struct acpi_pci_routing_table *prt = NULL; - struct acpi_pci_routing_table *entry = NULL; - static int first_time = 1; + acpi_status status = AE_OK; + char *pathname = NULL; + struct acpi_buffer buffer = { 0, NULL }; + struct acpi_pci_routing_table *prt = NULL; + struct acpi_pci_routing_table *entry = NULL; + static int first_time = 1; ACPI_FUNCTION_TRACE("acpi_pci_irq_add_prt"); - pathname = (char *) kmalloc(ACPI_PATHNAME_MAX, GFP_KERNEL); - if(!pathname) + pathname = (char *)kmalloc(ACPI_PATHNAME_MAX, GFP_KERNEL); + if (!pathname) return_VALUE(-ENOMEM); memset(pathname, 0, ACPI_PATHNAME_MAX); @@ -202,7 +186,7 @@ acpi_pci_irq_add_prt ( acpi_get_name(handle, ACPI_FULL_PATHNAME, &buffer); printk(KERN_DEBUG "ACPI: PCI Interrupt Routing Table [%s._PRT]\n", - pathname); + pathname); /* * Evaluate this _PRT and add its entries to our global list (acpi_prt). @@ -214,12 +198,12 @@ acpi_pci_irq_add_prt ( status = acpi_get_irq_routing_table(handle, &buffer); if (status != AE_BUFFER_OVERFLOW) { ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluating _PRT [%s]\n", - acpi_format_exception(status))); + acpi_format_exception(status))); return_VALUE(-ENODEV); } prt = kmalloc(buffer.length, GFP_KERNEL); - if (!prt){ + if (!prt) { return_VALUE(-ENOMEM); } memset(prt, 0, buffer.length); @@ -228,7 +212,7 @@ acpi_pci_irq_add_prt ( status = acpi_get_irq_routing_table(handle, &buffer); if (ACPI_FAILURE(status)) { ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluating _PRT [%s]\n", - acpi_format_exception(status))); + acpi_format_exception(status))); kfree(buffer.pointer); return_VALUE(-ENODEV); } @@ -238,7 +222,7 @@ acpi_pci_irq_add_prt ( while (entry && (entry->length > 0)) { acpi_pci_irq_add_entry(handle, segment, bus, entry); entry = (struct acpi_pci_routing_table *) - ((unsigned long) entry + entry->length); + ((unsigned long)entry + entry->length); } kfree(prt); @@ -246,18 +230,18 @@ acpi_pci_irq_add_prt ( return_VALUE(0); } -void -acpi_pci_irq_del_prt (int segment, int bus) +void acpi_pci_irq_del_prt(int segment, int bus) { - struct list_head *node = NULL, *n = NULL; - struct acpi_prt_entry *entry = NULL; + struct list_head *node = NULL, *n = NULL; + struct acpi_prt_entry *entry = NULL; - if (!acpi_prt.count) { + if (!acpi_prt.count) { return; } - printk(KERN_DEBUG "ACPI: Delete PCI Interrupt Routing Table for %x:%x\n", - segment, bus); + printk(KERN_DEBUG + "ACPI: Delete PCI Interrupt Routing Table for %x:%x\n", segment, + bus); spin_lock(&acpi_prt_lock); list_for_each_safe(node, n, &acpi_prt.entries) { entry = list_entry(node, struct acpi_prt_entry, node); @@ -266,26 +250,27 @@ acpi_pci_irq_del_prt (int segment, int bus) } spin_unlock(&acpi_prt_lock); } + /* -------------------------------------------------------------------------- PCI Interrupt Routing Support -------------------------------------------------------------------------- */ -typedef int (*irq_lookup_func)(struct acpi_prt_entry *, int *, int *, char **); +typedef int (*irq_lookup_func) (struct acpi_prt_entry *, int *, int *, char **); static int acpi_pci_allocate_irq(struct acpi_prt_entry *entry, - int *edge_level, - int *active_high_low, - char **link) + int *edge_level, int *active_high_low, char **link) { - int irq; + int irq; ACPI_FUNCTION_TRACE("acpi_pci_allocate_irq"); if (entry->link.handle) { irq = acpi_pci_link_allocate_irq(entry->link.handle, - entry->link.index, edge_level, active_high_low, link); + entry->link.index, edge_level, + active_high_low, link); if (irq < 0) { - ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Invalid IRQ link routing entry\n")); + ACPI_DEBUG_PRINT((ACPI_DB_WARN, + "Invalid IRQ link routing entry\n")); return_VALUE(-1); } } else { @@ -300,11 +285,9 @@ acpi_pci_allocate_irq(struct acpi_prt_entry *entry, static int acpi_pci_free_irq(struct acpi_prt_entry *entry, - int *edge_level, - int *active_high_low, - char **link) + int *edge_level, int *active_high_low, char **link) { - int irq; + int irq; ACPI_FUNCTION_TRACE("acpi_pci_free_irq"); if (entry->link.handle) { @@ -314,38 +297,36 @@ acpi_pci_free_irq(struct acpi_prt_entry *entry, } return_VALUE(irq); } + /* * acpi_pci_irq_lookup * success: return IRQ >= 0 * failure: return -1 */ static int -acpi_pci_irq_lookup ( - struct pci_bus *bus, - int device, - int pin, - int *edge_level, - int *active_high_low, - char **link, - irq_lookup_func func) +acpi_pci_irq_lookup(struct pci_bus *bus, + int device, + int pin, + int *edge_level, + int *active_high_low, char **link, irq_lookup_func func) { - struct acpi_prt_entry *entry = NULL; + struct acpi_prt_entry *entry = NULL; int segment = pci_domain_nr(bus); int bus_nr = bus->number; int ret; ACPI_FUNCTION_TRACE("acpi_pci_irq_lookup"); - ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "Searching for PRT entry for %02x:%02x:%02x[%c]\n", - segment, bus_nr, device, ('A' + pin))); + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "Searching for PRT entry for %02x:%02x:%02x[%c]\n", + segment, bus_nr, device, ('A' + pin))); - entry = acpi_pci_irq_find_prt_entry(segment, bus_nr, device, pin); + entry = acpi_pci_irq_find_prt_entry(segment, bus_nr, device, pin); if (!entry) { ACPI_DEBUG_PRINT((ACPI_DB_INFO, "PRT entry not found\n")); return_VALUE(-1); } - + ret = func(entry, edge_level, active_high_low, link); return_VALUE(ret); } @@ -356,17 +337,14 @@ acpi_pci_irq_lookup ( * failure: return < 0 */ static int -acpi_pci_irq_derive ( - struct pci_dev *dev, - int pin, - int *edge_level, - int *active_high_low, - char **link, - irq_lookup_func func) +acpi_pci_irq_derive(struct pci_dev *dev, + int pin, + int *edge_level, + int *active_high_low, char **link, irq_lookup_func func) { - struct pci_dev *bridge = dev; - int irq = -1; - u8 bridge_pin = 0; + struct pci_dev *bridge = dev; + int irq = -1; + u8 bridge_pin = 0; ACPI_FUNCTION_TRACE("acpi_pci_irq_derive"); @@ -383,28 +361,33 @@ acpi_pci_irq_derive ( if ((bridge->class >> 8) == PCI_CLASS_BRIDGE_CARDBUS) { /* PC card has the same IRQ as its cardbridge */ - pci_read_config_byte(bridge, PCI_INTERRUPT_PIN, &bridge_pin); + pci_read_config_byte(bridge, PCI_INTERRUPT_PIN, + &bridge_pin); if (!bridge_pin) { - ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "No interrupt pin configured for device %s\n", pci_name(bridge))); + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "No interrupt pin configured for device %s\n", + pci_name(bridge))); return_VALUE(-1); } /* Pin is from 0 to 3 */ - bridge_pin --; + bridge_pin--; pin = bridge_pin; } irq = acpi_pci_irq_lookup(bridge->bus, PCI_SLOT(bridge->devfn), - pin, edge_level, active_high_low, link, func); + pin, edge_level, active_high_low, + link, func); } if (irq < 0) { - ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Unable to derive IRQ for device %s\n", pci_name(dev))); + ACPI_DEBUG_PRINT((ACPI_DB_WARN, + "Unable to derive IRQ for device %s\n", + pci_name(dev))); return_VALUE(-1); } ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Derive IRQ %d for device %s from %s\n", - irq, pci_name(dev), pci_name(bridge))); + irq, pci_name(dev), pci_name(bridge))); return_VALUE(irq); } @@ -415,31 +398,32 @@ acpi_pci_irq_derive ( * failure: return < 0 */ -int -acpi_pci_irq_enable ( - struct pci_dev *dev) +int acpi_pci_irq_enable(struct pci_dev *dev) { - int irq = 0; - u8 pin = 0; - int edge_level = ACPI_LEVEL_SENSITIVE; - int active_high_low = ACPI_ACTIVE_LOW; - char *link = NULL; - int rc; + int irq = 0; + u8 pin = 0; + int edge_level = ACPI_LEVEL_SENSITIVE; + int active_high_low = ACPI_ACTIVE_LOW; + char *link = NULL; + int rc; ACPI_FUNCTION_TRACE("acpi_pci_irq_enable"); if (!dev) return_VALUE(-EINVAL); - + pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &pin); if (!pin) { - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No interrupt pin configured for device %s\n", pci_name(dev))); + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "No interrupt pin configured for device %s\n", + pci_name(dev))); return_VALUE(0); } pin--; if (!dev->bus) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid (NULL) 'bus' field\n")); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Invalid (NULL) 'bus' field\n")); return_VALUE(-ENODEV); } @@ -447,35 +431,37 @@ acpi_pci_irq_enable ( * First we check the PCI IRQ routing table (PRT) for an IRQ. PRT * values override any BIOS-assigned IRQs set during boot. */ - irq = acpi_pci_irq_lookup(dev->bus, PCI_SLOT(dev->devfn), pin, - &edge_level, &active_high_low, &link, acpi_pci_allocate_irq); + irq = acpi_pci_irq_lookup(dev->bus, PCI_SLOT(dev->devfn), pin, + &edge_level, &active_high_low, &link, + acpi_pci_allocate_irq); /* * If no PRT entry was found, we'll try to derive an IRQ from the * device's parent bridge. */ if (irq < 0) - irq = acpi_pci_irq_derive(dev, pin, &edge_level, - &active_high_low, &link, acpi_pci_allocate_irq); - + irq = acpi_pci_irq_derive(dev, pin, &edge_level, + &active_high_low, &link, + acpi_pci_allocate_irq); + /* * No IRQ known to the ACPI subsystem - maybe the BIOS / * driver reported one, then use it. Exit in any case. */ if (irq < 0) { printk(KERN_WARNING PREFIX "PCI Interrupt %s[%c]: no GSI", - pci_name(dev), ('A' + pin)); + pci_name(dev), ('A' + pin)); /* Interrupt Line values above 0xF are forbidden */ if (dev->irq > 0 && (dev->irq <= 0xF)) { printk(" - using IRQ %d\n", dev->irq); - acpi_register_gsi(dev->irq, ACPI_LEVEL_SENSITIVE, ACPI_ACTIVE_LOW); + acpi_register_gsi(dev->irq, ACPI_LEVEL_SENSITIVE, + ACPI_ACTIVE_LOW); return_VALUE(0); - } - else { + } else { printk("\n"); return_VALUE(0); } - } + } rc = acpi_register_gsi(irq, edge_level, active_high_low); if (rc < 0) { @@ -486,32 +472,31 @@ acpi_pci_irq_enable ( dev->irq = rc; printk(KERN_INFO PREFIX "PCI Interrupt %s[%c] -> ", - pci_name(dev), 'A' + pin); + pci_name(dev), 'A' + pin); if (link) printk("Link [%s] -> ", link); printk("GSI %u (%s, %s) -> IRQ %d\n", irq, - (edge_level == ACPI_LEVEL_SENSITIVE) ? "level" : "edge", - (active_high_low == ACPI_ACTIVE_LOW) ? "low" : "high", - dev->irq); + (edge_level == ACPI_LEVEL_SENSITIVE) ? "level" : "edge", + (active_high_low == ACPI_ACTIVE_LOW) ? "low" : "high", dev->irq); return_VALUE(0); } -EXPORT_SYMBOL(acpi_pci_irq_enable); +EXPORT_SYMBOL(acpi_pci_irq_enable); /* FIXME: implement x86/x86_64 version */ -void __attribute__((weak)) acpi_unregister_gsi(u32 i) {} +void __attribute__ ((weak)) acpi_unregister_gsi(u32 i) +{ +} -void -acpi_pci_irq_disable ( - struct pci_dev *dev) +void acpi_pci_irq_disable(struct pci_dev *dev) { - int gsi = 0; - u8 pin = 0; - int edge_level = ACPI_LEVEL_SENSITIVE; - int active_high_low = ACPI_ACTIVE_LOW; + int gsi = 0; + u8 pin = 0; + int edge_level = ACPI_LEVEL_SENSITIVE; + int active_high_low = ACPI_ACTIVE_LOW; ACPI_FUNCTION_TRACE("acpi_pci_irq_disable"); @@ -529,15 +514,17 @@ acpi_pci_irq_disable ( /* * First we check the PCI IRQ routing table (PRT) for an IRQ. */ - gsi = acpi_pci_irq_lookup(dev->bus, PCI_SLOT(dev->devfn), pin, - &edge_level, &active_high_low, NULL, acpi_pci_free_irq); + gsi = acpi_pci_irq_lookup(dev->bus, PCI_SLOT(dev->devfn), pin, + &edge_level, &active_high_low, NULL, + acpi_pci_free_irq); /* * If no PRT entry was found, we'll try to derive an IRQ from the * device's parent bridge. */ if (gsi < 0) - gsi = acpi_pci_irq_derive(dev, pin, - &edge_level, &active_high_low, NULL, acpi_pci_free_irq); + gsi = acpi_pci_irq_derive(dev, pin, + &edge_level, &active_high_low, NULL, + acpi_pci_free_irq); if (gsi < 0) return_VOID; diff --git a/drivers/acpi/pci_link.c b/drivers/acpi/pci_link.c index e8334ce84d8..82292b77e5c 100644 --- a/drivers/acpi/pci_link.c +++ b/drivers/acpi/pci_link.c @@ -42,30 +42,26 @@ #include #include - #define _COMPONENT ACPI_PCI_COMPONENT -ACPI_MODULE_NAME ("pci_link") - +ACPI_MODULE_NAME("pci_link") #define ACPI_PCI_LINK_CLASS "pci_irq_routing" #define ACPI_PCI_LINK_HID "PNP0C0F" #define ACPI_PCI_LINK_DRIVER_NAME "ACPI PCI Interrupt Link Driver" #define ACPI_PCI_LINK_DEVICE_NAME "PCI Interrupt Link" #define ACPI_PCI_LINK_FILE_INFO "info" #define ACPI_PCI_LINK_FILE_STATUS "state" - #define ACPI_PCI_LINK_MAX_POSSIBLE 16 - -static int acpi_pci_link_add (struct acpi_device *device); -static int acpi_pci_link_remove (struct acpi_device *device, int type); +static int acpi_pci_link_add(struct acpi_device *device); +static int acpi_pci_link_remove(struct acpi_device *device, int type); static struct acpi_driver acpi_pci_link_driver = { - .name = ACPI_PCI_LINK_DRIVER_NAME, - .class = ACPI_PCI_LINK_CLASS, - .ids = ACPI_PCI_LINK_HID, - .ops = { - .add = acpi_pci_link_add, - .remove = acpi_pci_link_remove, - }, + .name = ACPI_PCI_LINK_DRIVER_NAME, + .class = ACPI_PCI_LINK_CLASS, + .ids = ACPI_PCI_LINK_HID, + .ops = { + .add = acpi_pci_link_add, + .remove = acpi_pci_link_remove, + }, }; /* @@ -73,31 +69,30 @@ static struct acpi_driver acpi_pci_link_driver = { * later even the link is disable. Instead, we just repick the active irq */ struct acpi_pci_link_irq { - u8 active; /* Current IRQ */ - u8 edge_level; /* All IRQs */ - u8 active_high_low; /* All IRQs */ - u8 resource_type; - u8 possible_count; - u8 possible[ACPI_PCI_LINK_MAX_POSSIBLE]; - u8 initialized:1; - u8 reserved:7; + u8 active; /* Current IRQ */ + u8 edge_level; /* All IRQs */ + u8 active_high_low; /* All IRQs */ + u8 resource_type; + u8 possible_count; + u8 possible[ACPI_PCI_LINK_MAX_POSSIBLE]; + u8 initialized:1; + u8 reserved:7; }; struct acpi_pci_link { - struct list_head node; - struct acpi_device *device; - acpi_handle handle; + struct list_head node; + struct acpi_device *device; + acpi_handle handle; struct acpi_pci_link_irq irq; - int refcnt; + int refcnt; }; static struct { - int count; - struct list_head entries; -} acpi_link; + int count; + struct list_head entries; +} acpi_link; DECLARE_MUTEX(acpi_link_lock); - /* -------------------------------------------------------------------------- PCI Link Device Management -------------------------------------------------------------------------- */ @@ -106,12 +101,10 @@ DECLARE_MUTEX(acpi_link_lock); * set context (link) possible list from resource list */ static acpi_status -acpi_pci_link_check_possible ( - struct acpi_resource *resource, - void *context) +acpi_pci_link_check_possible(struct acpi_resource *resource, void *context) { - struct acpi_pci_link *link = (struct acpi_pci_link *) context; - u32 i = 0; + struct acpi_pci_link *link = (struct acpi_pci_link *)context; + u32 i = 0; ACPI_FUNCTION_TRACE("acpi_pci_link_check_possible"); @@ -119,61 +112,68 @@ acpi_pci_link_check_possible ( case ACPI_RSTYPE_START_DPF: return_ACPI_STATUS(AE_OK); case ACPI_RSTYPE_IRQ: - { - struct acpi_resource_irq *p = &resource->data.irq; - if (!p || !p->number_of_interrupts) { - ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Blank IRQ resource\n")); - return_ACPI_STATUS(AE_OK); - } - for (i = 0; (inumber_of_interrupts && iinterrupts[i]) { - ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Invalid IRQ %d\n", p->interrupts[i])); - continue; + { + struct acpi_resource_irq *p = &resource->data.irq; + if (!p || !p->number_of_interrupts) { + ACPI_DEBUG_PRINT((ACPI_DB_WARN, + "Blank IRQ resource\n")); + return_ACPI_STATUS(AE_OK); } - link->irq.possible[i] = p->interrupts[i]; - link->irq.possible_count++; + for (i = 0; + (i < p->number_of_interrupts + && i < ACPI_PCI_LINK_MAX_POSSIBLE); i++) { + if (!p->interrupts[i]) { + ACPI_DEBUG_PRINT((ACPI_DB_WARN, + "Invalid IRQ %d\n", + p->interrupts[i])); + continue; + } + link->irq.possible[i] = p->interrupts[i]; + link->irq.possible_count++; + } + link->irq.edge_level = p->edge_level; + link->irq.active_high_low = p->active_high_low; + link->irq.resource_type = ACPI_RSTYPE_IRQ; + break; } - link->irq.edge_level = p->edge_level; - link->irq.active_high_low = p->active_high_low; - link->irq.resource_type = ACPI_RSTYPE_IRQ; - break; - } case ACPI_RSTYPE_EXT_IRQ: - { - struct acpi_resource_ext_irq *p = &resource->data.extended_irq; - if (!p || !p->number_of_interrupts) { - ACPI_DEBUG_PRINT((ACPI_DB_WARN, - "Blank EXT IRQ resource\n")); - return_ACPI_STATUS(AE_OK); - } - for (i = 0; (inumber_of_interrupts && iinterrupts[i]) { - ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Invalid IRQ %d\n", p->interrupts[i])); - continue; + { + struct acpi_resource_ext_irq *p = + &resource->data.extended_irq; + if (!p || !p->number_of_interrupts) { + ACPI_DEBUG_PRINT((ACPI_DB_WARN, + "Blank EXT IRQ resource\n")); + return_ACPI_STATUS(AE_OK); + } + for (i = 0; + (i < p->number_of_interrupts + && i < ACPI_PCI_LINK_MAX_POSSIBLE); i++) { + if (!p->interrupts[i]) { + ACPI_DEBUG_PRINT((ACPI_DB_WARN, + "Invalid IRQ %d\n", + p->interrupts[i])); + continue; + } + link->irq.possible[i] = p->interrupts[i]; + link->irq.possible_count++; } - link->irq.possible[i] = p->interrupts[i]; - link->irq.possible_count++; + link->irq.edge_level = p->edge_level; + link->irq.active_high_low = p->active_high_low; + link->irq.resource_type = ACPI_RSTYPE_EXT_IRQ; + break; } - link->irq.edge_level = p->edge_level; - link->irq.active_high_low = p->active_high_low; - link->irq.resource_type = ACPI_RSTYPE_EXT_IRQ; - break; - } default: - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Resource is not an IRQ entry\n")); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Resource is not an IRQ entry\n")); return_ACPI_STATUS(AE_OK); } return_ACPI_STATUS(AE_CTRL_TERMINATE); } - -static int -acpi_pci_link_get_possible ( - struct acpi_pci_link *link) +static int acpi_pci_link_get_possible(struct acpi_pci_link *link) { - acpi_status status; + acpi_status status; ACPI_FUNCTION_TRACE("acpi_pci_link_get_possible"); @@ -181,62 +181,60 @@ acpi_pci_link_get_possible ( return_VALUE(-EINVAL); status = acpi_walk_resources(link->handle, METHOD_NAME__PRS, - acpi_pci_link_check_possible, link); + acpi_pci_link_check_possible, link); if (ACPI_FAILURE(status)) { ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluating _PRS\n")); return_VALUE(-ENODEV); } - ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "Found %d possible IRQs\n", link->irq.possible_count)); + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "Found %d possible IRQs\n", + link->irq.possible_count)); return_VALUE(0); } - static acpi_status -acpi_pci_link_check_current ( - struct acpi_resource *resource, - void *context) +acpi_pci_link_check_current(struct acpi_resource *resource, void *context) { - int *irq = (int *) context; + int *irq = (int *)context; ACPI_FUNCTION_TRACE("acpi_pci_link_check_current"); switch (resource->id) { case ACPI_RSTYPE_IRQ: - { - struct acpi_resource_irq *p = &resource->data.irq; - if (!p || !p->number_of_interrupts) { - /* - * IRQ descriptors may have no IRQ# bits set, - * particularly those those w/ _STA disabled - */ - ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "Blank IRQ resource\n")); - return_ACPI_STATUS(AE_OK); + { + struct acpi_resource_irq *p = &resource->data.irq; + if (!p || !p->number_of_interrupts) { + /* + * IRQ descriptors may have no IRQ# bits set, + * particularly those those w/ _STA disabled + */ + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "Blank IRQ resource\n")); + return_ACPI_STATUS(AE_OK); + } + *irq = p->interrupts[0]; + break; } - *irq = p->interrupts[0]; - break; - } case ACPI_RSTYPE_EXT_IRQ: - { - struct acpi_resource_ext_irq *p = &resource->data.extended_irq; - if (!p || !p->number_of_interrupts) { - /* - * extended IRQ descriptors must - * return at least 1 IRQ - */ - ACPI_DEBUG_PRINT((ACPI_DB_WARN, - "Blank EXT IRQ resource\n")); - return_ACPI_STATUS(AE_OK); + { + struct acpi_resource_ext_irq *p = + &resource->data.extended_irq; + if (!p || !p->number_of_interrupts) { + /* + * extended IRQ descriptors must + * return at least 1 IRQ + */ + ACPI_DEBUG_PRINT((ACPI_DB_WARN, + "Blank EXT IRQ resource\n")); + return_ACPI_STATUS(AE_OK); + } + *irq = p->interrupts[0]; + break; } - *irq = p->interrupts[0]; - break; - } default: - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Resource isn't an IRQ\n")); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Resource isn't an IRQ\n")); return_ACPI_STATUS(AE_OK); } return_ACPI_STATUS(AE_CTRL_TERMINATE); @@ -249,13 +247,11 @@ acpi_pci_link_check_current ( * 0 - success * !0 - failure */ -static int -acpi_pci_link_get_current ( - struct acpi_pci_link *link) +static int acpi_pci_link_get_current(struct acpi_pci_link *link) { - int result = 0; - acpi_status status = AE_OK; - int irq = 0; + int result = 0; + acpi_status status = AE_OK; + int irq = 0; ACPI_FUNCTION_TRACE("acpi_pci_link_get_current"); @@ -269,7 +265,8 @@ acpi_pci_link_get_current ( /* Query _STA, set link->device->status */ result = acpi_bus_get_status(link->device); if (result) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unable to read status\n")); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Unable to read status\n")); goto end; } @@ -284,7 +281,7 @@ acpi_pci_link_get_current ( */ status = acpi_walk_resources(link->handle, METHOD_NAME__CRS, - acpi_pci_link_check_current, &irq); + acpi_pci_link_check_current, &irq); if (ACPI_FAILURE(status)) { ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluating _CRS\n")); result = -ENODEV; @@ -300,58 +297,61 @@ acpi_pci_link_get_current ( ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Link at IRQ %d \n", link->irq.active)); -end: + end: return_VALUE(result); } -static int -acpi_pci_link_set ( - struct acpi_pci_link *link, - int irq) +static int acpi_pci_link_set(struct acpi_pci_link *link, int irq) { - int result = 0; - acpi_status status = AE_OK; + int result = 0; + acpi_status status = AE_OK; struct { - struct acpi_resource res; - struct acpi_resource end; - } *resource; - struct acpi_buffer buffer = {0, NULL}; + struct acpi_resource res; + struct acpi_resource end; + } *resource; + struct acpi_buffer buffer = { 0, NULL }; ACPI_FUNCTION_TRACE("acpi_pci_link_set"); if (!link || !irq) return_VALUE(-EINVAL); - resource = kmalloc( sizeof(*resource)+1, GFP_KERNEL); - if(!resource) + resource = kmalloc(sizeof(*resource) + 1, GFP_KERNEL); + if (!resource) return_VALUE(-ENOMEM); - memset(resource, 0, sizeof(*resource)+1); - buffer.length = sizeof(*resource) +1; + memset(resource, 0, sizeof(*resource) + 1); + buffer.length = sizeof(*resource) + 1; buffer.pointer = resource; - switch(link->irq.resource_type) { + switch (link->irq.resource_type) { case ACPI_RSTYPE_IRQ: resource->res.id = ACPI_RSTYPE_IRQ; resource->res.length = sizeof(struct acpi_resource); resource->res.data.irq.edge_level = link->irq.edge_level; - resource->res.data.irq.active_high_low = link->irq.active_high_low; + resource->res.data.irq.active_high_low = + link->irq.active_high_low; if (link->irq.edge_level == ACPI_EDGE_SENSITIVE) - resource->res.data.irq.shared_exclusive = ACPI_EXCLUSIVE; + resource->res.data.irq.shared_exclusive = + ACPI_EXCLUSIVE; else resource->res.data.irq.shared_exclusive = ACPI_SHARED; resource->res.data.irq.number_of_interrupts = 1; resource->res.data.irq.interrupts[0] = irq; break; - + case ACPI_RSTYPE_EXT_IRQ: resource->res.id = ACPI_RSTYPE_EXT_IRQ; resource->res.length = sizeof(struct acpi_resource); - resource->res.data.extended_irq.producer_consumer = ACPI_CONSUMER; - resource->res.data.extended_irq.edge_level = link->irq.edge_level; - resource->res.data.extended_irq.active_high_low = link->irq.active_high_low; + resource->res.data.extended_irq.producer_consumer = + ACPI_CONSUMER; + resource->res.data.extended_irq.edge_level = + link->irq.edge_level; + resource->res.data.extended_irq.active_high_low = + link->irq.active_high_low; if (link->irq.edge_level == ACPI_EDGE_SENSITIVE) - resource->res.data.irq.shared_exclusive = ACPI_EXCLUSIVE; + resource->res.data.irq.shared_exclusive = + ACPI_EXCLUSIVE; else resource->res.data.irq.shared_exclusive = ACPI_SHARED; resource->res.data.extended_irq.number_of_interrupts = 1; @@ -384,9 +384,9 @@ acpi_pci_link_set ( } if (!link->device->status.enabled) { printk(KERN_WARNING PREFIX - "%s [%s] disabled and referenced, BIOS bug.\n", - acpi_device_name(link->device), - acpi_device_bid(link->device)); + "%s [%s] disabled and referenced, BIOS bug.\n", + acpi_device_name(link->device), + acpi_device_bid(link->device)); } /* Query _CRS, set link->irq.active */ @@ -404,22 +404,20 @@ acpi_pci_link_set ( * policy: when _CRS doesn't return what we just _SRS * assume _SRS worked and override _CRS value. */ - printk(KERN_WARNING PREFIX - "%s [%s] BIOS reported IRQ %d, using IRQ %d\n", - acpi_device_name(link->device), - acpi_device_bid(link->device), - link->irq.active, irq); + printk(KERN_WARNING PREFIX + "%s [%s] BIOS reported IRQ %d, using IRQ %d\n", + acpi_device_name(link->device), + acpi_device_bid(link->device), link->irq.active, irq); link->irq.active = irq; } ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Set IRQ %d\n", link->irq.active)); - -end: + + end: kfree(resource); return_VALUE(result); } - /* -------------------------------------------------------------------------- PCI Link IRQ Management -------------------------------------------------------------------------- */ @@ -469,8 +467,8 @@ static int acpi_irq_penalty[ACPI_MAX_IRQS] = { PIRQ_PENALTY_ISA_ALWAYS, /* IRQ0 timer */ PIRQ_PENALTY_ISA_ALWAYS, /* IRQ1 keyboard */ PIRQ_PENALTY_ISA_ALWAYS, /* IRQ2 cascade */ - PIRQ_PENALTY_ISA_TYPICAL, /* IRQ3 serial */ - PIRQ_PENALTY_ISA_TYPICAL, /* IRQ4 serial */ + PIRQ_PENALTY_ISA_TYPICAL, /* IRQ3 serial */ + PIRQ_PENALTY_ISA_TYPICAL, /* IRQ4 serial */ PIRQ_PENALTY_ISA_TYPICAL, /* IRQ5 sometimes SoundBlaster */ PIRQ_PENALTY_ISA_TYPICAL, /* IRQ6 */ PIRQ_PENALTY_ISA_TYPICAL, /* IRQ7 parallel, spurious */ @@ -482,15 +480,14 @@ static int acpi_irq_penalty[ACPI_MAX_IRQS] = { PIRQ_PENALTY_ISA_USED, /* IRQ13 fpe, sometimes */ PIRQ_PENALTY_ISA_USED, /* IRQ14 ide0 */ PIRQ_PENALTY_ISA_USED, /* IRQ15 ide1 */ - /* >IRQ15 */ + /* >IRQ15 */ }; -int __init -acpi_irq_penalty_init(void) +int __init acpi_irq_penalty_init(void) { - struct list_head *node = NULL; - struct acpi_pci_link *link = NULL; - int i = 0; + struct list_head *node = NULL; + struct acpi_pci_link *link = NULL; + int i = 0; ACPI_FUNCTION_TRACE("acpi_irq_penalty_init"); @@ -501,7 +498,8 @@ acpi_irq_penalty_init(void) link = list_entry(node, struct acpi_pci_link, node); if (!link) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid link context\n")); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Invalid link context\n")); continue; } @@ -510,15 +508,20 @@ acpi_irq_penalty_init(void) * useful for breaking ties. */ if (link->irq.possible_count) { - int penalty = PIRQ_PENALTY_PCI_POSSIBLE / link->irq.possible_count; + int penalty = + PIRQ_PENALTY_PCI_POSSIBLE / + link->irq.possible_count; for (i = 0; i < link->irq.possible_count; i++) { if (link->irq.possible[i] < ACPI_MAX_ISA_IRQ) - acpi_irq_penalty[link->irq.possible[i]] += penalty; + acpi_irq_penalty[link->irq. + possible[i]] += + penalty; } } else if (link->irq.active) { - acpi_irq_penalty[link->irq.active] += PIRQ_PENALTY_PCI_POSSIBLE; + acpi_irq_penalty[link->irq.active] += + PIRQ_PENALTY_PCI_POSSIBLE; } } /* Add a penalty for the SCI */ @@ -529,10 +532,10 @@ acpi_irq_penalty_init(void) static int acpi_irq_balance; /* 0: static, 1: balance */ -static int acpi_pci_link_allocate(struct acpi_pci_link *link) +static int acpi_pci_link_allocate(struct acpi_pci_link *link) { - int irq; - int i; + int irq; + int i; ACPI_FUNCTION_TRACE("acpi_pci_link_allocate"); @@ -556,7 +559,7 @@ static int acpi_pci_link_allocate(struct acpi_pci_link *link) if (i == link->irq.possible_count) { if (acpi_strict) printk(KERN_WARNING PREFIX "_CRS %d not found" - " in _PRS\n", link->irq.active); + " in _PRS\n", link->irq.active); link->irq.active = 0; } @@ -575,23 +578,25 @@ static int acpi_pci_link_allocate(struct acpi_pci_link *link) * the use of IRQs 9, 10, 11, and >15. */ for (i = (link->irq.possible_count - 1); i >= 0; i--) { - if (acpi_irq_penalty[irq] > acpi_irq_penalty[link->irq.possible[i]]) + if (acpi_irq_penalty[irq] > + acpi_irq_penalty[link->irq.possible[i]]) irq = link->irq.possible[i]; } } /* Attempt to enable the link device at this IRQ. */ if (acpi_pci_link_set(link, irq)) { - printk(PREFIX "Unable to set IRQ for %s [%s] (likely buggy ACPI BIOS).\n" - "Try pci=noacpi or acpi=off\n", - acpi_device_name(link->device), - acpi_device_bid(link->device)); + printk(PREFIX + "Unable to set IRQ for %s [%s] (likely buggy ACPI BIOS).\n" + "Try pci=noacpi or acpi=off\n", + acpi_device_name(link->device), + acpi_device_bid(link->device)); return_VALUE(-ENODEV); } else { acpi_irq_penalty[link->irq.active] += PIRQ_PENALTY_PCI_USING; - printk(PREFIX "%s [%s] enabled at IRQ %d\n", - acpi_device_name(link->device), - acpi_device_bid(link->device), link->irq.active); + printk(PREFIX "%s [%s] enabled at IRQ %d\n", + acpi_device_name(link->device), + acpi_device_bid(link->device), link->irq.active); } link->irq.initialized = 1; @@ -606,16 +611,13 @@ static int acpi_pci_link_allocate(struct acpi_pci_link *link) */ int -acpi_pci_link_allocate_irq ( - acpi_handle handle, - int index, - int *edge_level, - int *active_high_low, - char **name) +acpi_pci_link_allocate_irq(acpi_handle handle, + int index, + int *edge_level, int *active_high_low, char **name) { - int result = 0; - struct acpi_device *device = NULL; - struct acpi_pci_link *link = NULL; + int result = 0; + struct acpi_device *device = NULL; + struct acpi_pci_link *link = NULL; ACPI_FUNCTION_TRACE("acpi_pci_link_allocate_irq"); @@ -625,7 +627,7 @@ acpi_pci_link_allocate_irq ( return_VALUE(-1); } - link = (struct acpi_pci_link *) acpi_driver_data(device); + link = (struct acpi_pci_link *)acpi_driver_data(device); if (!link) { ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid link context\n")); return_VALUE(-1); @@ -642,20 +644,24 @@ acpi_pci_link_allocate_irq ( up(&acpi_link_lock); return_VALUE(-1); } - + if (!link->irq.active) { up(&acpi_link_lock); ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Link active IRQ is 0!\n")); return_VALUE(-1); } - link->refcnt ++; + link->refcnt++; up(&acpi_link_lock); - if (edge_level) *edge_level = link->irq.edge_level; - if (active_high_low) *active_high_low = link->irq.active_high_low; - if (name) *name = acpi_device_bid(link->device); + if (edge_level) + *edge_level = link->irq.edge_level; + if (active_high_low) + *active_high_low = link->irq.active_high_low; + if (name) + *name = acpi_device_bid(link->device); ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "Link %s is referenced\n", acpi_device_bid(link->device))); + "Link %s is referenced\n", + acpi_device_bid(link->device))); return_VALUE(link->irq.active); } @@ -663,12 +669,11 @@ acpi_pci_link_allocate_irq ( * We don't change link's irq information here. After it is reenabled, we * continue use the info */ -int -acpi_pci_link_free_irq(acpi_handle handle) +int acpi_pci_link_free_irq(acpi_handle handle) { - struct acpi_device *device = NULL; - struct acpi_pci_link *link = NULL; - acpi_status result; + struct acpi_device *device = NULL; + struct acpi_pci_link *link = NULL; + acpi_status result; ACPI_FUNCTION_TRACE("acpi_pci_link_free_irq"); @@ -678,7 +683,7 @@ acpi_pci_link_free_irq(acpi_handle handle) return_VALUE(-1); } - link = (struct acpi_pci_link *) acpi_driver_data(device); + link = (struct acpi_pci_link *)acpi_driver_data(device); if (!link) { ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid link context\n")); return_VALUE(-1); @@ -690,7 +695,6 @@ acpi_pci_link_free_irq(acpi_handle handle) ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Link isn't initialized\n")); return_VALUE(-1); } - #ifdef FUTURE_USE /* * The Link reference count allows us to _DISable an unused link @@ -701,10 +705,11 @@ acpi_pci_link_free_irq(acpi_handle handle) * to prevent duplicate acpi_pci_link_set() * which would harm some systems */ - link->refcnt --; + link->refcnt--; #endif ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "Link %s is dereferenced\n", acpi_device_bid(link->device))); + "Link %s is dereferenced\n", + acpi_device_bid(link->device))); if (link->refcnt == 0) { acpi_ut_evaluate_object(link->handle, "_DIS", 0, NULL); @@ -712,17 +717,17 @@ acpi_pci_link_free_irq(acpi_handle handle) up(&acpi_link_lock); return_VALUE(link->irq.active); } + /* -------------------------------------------------------------------------- Driver Interface -------------------------------------------------------------------------- */ -static int -acpi_pci_link_add(struct acpi_device *device) +static int acpi_pci_link_add(struct acpi_device *device) { - int result = 0; - struct acpi_pci_link *link = NULL; - int i = 0; - int found = 0; + int result = 0; + struct acpi_pci_link *link = NULL; + int i = 0; + int found = 0; ACPI_FUNCTION_TRACE("acpi_pci_link_add"); @@ -749,13 +754,12 @@ acpi_pci_link_add(struct acpi_device *device) acpi_pci_link_get_current(link); printk(PREFIX "%s [%s] (IRQs", acpi_device_name(device), - acpi_device_bid(device)); + acpi_device_bid(device)); for (i = 0; i < link->irq.possible_count; i++) { if (link->irq.active == link->irq.possible[i]) { printk(" *%d", link->irq.possible[i]); found = 1; - } - else + } else printk(" %d", link->irq.possible[i]); } @@ -764,7 +768,7 @@ acpi_pci_link_add(struct acpi_device *device) if (!found) printk(" *%d", link->irq.active); - if(!link->device->status.enabled) + if (!link->device->status.enabled) printk(", disabled."); printk("\n"); @@ -773,7 +777,7 @@ acpi_pci_link_add(struct acpi_device *device) list_add_tail(&link->node, &acpi_link.entries); acpi_link.count++; -end: + end: /* disable all links -- to be activated on use */ acpi_ut_evaluate_object(link->handle, "_DIS", 0, NULL); up(&acpi_link_lock); @@ -784,9 +788,7 @@ end: return_VALUE(result); } -static int -acpi_pci_link_resume( - struct acpi_pci_link *link) +static int acpi_pci_link_resume(struct acpi_pci_link *link) { ACPI_FUNCTION_TRACE("acpi_pci_link_resume"); @@ -801,11 +803,10 @@ acpi_pci_link_resume( * after every device calls pci_disable_device in .resume. */ int acpi_in_resume; -static int -irqrouter_resume(struct sys_device *dev) +static int irqrouter_resume(struct sys_device *dev) { - struct list_head *node = NULL; - struct acpi_pci_link *link = NULL; + struct list_head *node = NULL; + struct acpi_pci_link *link = NULL; ACPI_FUNCTION_TRACE("irqrouter_resume"); @@ -814,7 +815,7 @@ irqrouter_resume(struct sys_device *dev) link = list_entry(node, struct acpi_pci_link, node); if (!link) { ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Invalid link context\n")); + "Invalid link context\n")); continue; } acpi_pci_link_resume(link); @@ -823,9 +824,7 @@ irqrouter_resume(struct sys_device *dev) return_VALUE(0); } - -static int -acpi_pci_link_remove(struct acpi_device *device, int type) +static int acpi_pci_link_remove(struct acpi_device *device, int type) { struct acpi_pci_link *link = NULL; @@ -834,7 +833,7 @@ acpi_pci_link_remove(struct acpi_device *device, int type) if (!device || !acpi_driver_data(device)) return_VALUE(-EINVAL); - link = (struct acpi_pci_link *) acpi_driver_data(device); + link = (struct acpi_pci_link *)acpi_driver_data(device); down(&acpi_link_lock); list_del(&link->node); @@ -856,14 +855,14 @@ static int __init acpi_irq_penalty_update(char *str, int used) int retval; int irq; - retval = get_option(&str,&irq); + retval = get_option(&str, &irq); if (!retval) break; /* no number found */ if (irq < 0) continue; - + if (irq >= ACPI_MAX_IRQS) continue; @@ -902,6 +901,7 @@ static int __init acpi_irq_isa(char *str) { return acpi_irq_penalty_update(str, 1); } + __setup("acpi_irq_isa=", acpi_irq_isa); /* @@ -913,6 +913,7 @@ static int __init acpi_irq_pci(char *str) { return acpi_irq_penalty_update(str, 0); } + __setup("acpi_irq_pci=", acpi_irq_pci); static int __init acpi_irq_nobalance_set(char *str) @@ -920,6 +921,7 @@ static int __init acpi_irq_nobalance_set(char *str) acpi_irq_balance = 0; return 1; } + __setup("acpi_irq_nobalance", acpi_irq_nobalance_set); int __init acpi_irq_balance_set(char *str) @@ -927,22 +929,20 @@ int __init acpi_irq_balance_set(char *str) acpi_irq_balance = 1; return 1; } -__setup("acpi_irq_balance", acpi_irq_balance_set); +__setup("acpi_irq_balance", acpi_irq_balance_set); /* FIXME: we will remove this interface after all drivers call pci_disable_device */ static struct sysdev_class irqrouter_sysdev_class = { - set_kset_name("irqrouter"), - .resume = irqrouter_resume, + set_kset_name("irqrouter"), + .resume = irqrouter_resume, }; - static struct sys_device device_irqrouter = { - .id = 0, - .cls = &irqrouter_sysdev_class, + .id = 0, + .cls = &irqrouter_sysdev_class, }; - static int __init irqrouter_init_sysfs(void) { int error; @@ -957,12 +957,11 @@ static int __init irqrouter_init_sysfs(void) error = sysdev_register(&device_irqrouter); return_VALUE(error); -} +} device_initcall(irqrouter_init_sysfs); - -static int __init acpi_pci_link_init (void) +static int __init acpi_pci_link_init(void) { ACPI_FUNCTION_TRACE("acpi_pci_link_init"); diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c index 5d2f77fcd50..0fd9988c283 100644 --- a/drivers/acpi/pci_root.c +++ b/drivers/acpi/pci_root.c @@ -35,35 +35,32 @@ #include #include - #define _COMPONENT ACPI_PCI_COMPONENT -ACPI_MODULE_NAME ("pci_root") - +ACPI_MODULE_NAME("pci_root") #define ACPI_PCI_ROOT_CLASS "pci_bridge" #define ACPI_PCI_ROOT_HID "PNP0A03" #define ACPI_PCI_ROOT_DRIVER_NAME "ACPI PCI Root Bridge Driver" #define ACPI_PCI_ROOT_DEVICE_NAME "PCI Root Bridge" - -static int acpi_pci_root_add (struct acpi_device *device); -static int acpi_pci_root_remove (struct acpi_device *device, int type); -static int acpi_pci_root_start (struct acpi_device *device); +static int acpi_pci_root_add(struct acpi_device *device); +static int acpi_pci_root_remove(struct acpi_device *device, int type); +static int acpi_pci_root_start(struct acpi_device *device); static struct acpi_driver acpi_pci_root_driver = { - .name = ACPI_PCI_ROOT_DRIVER_NAME, - .class = ACPI_PCI_ROOT_CLASS, - .ids = ACPI_PCI_ROOT_HID, - .ops = { - .add = acpi_pci_root_add, - .remove = acpi_pci_root_remove, - .start = acpi_pci_root_start, - }, + .name = ACPI_PCI_ROOT_DRIVER_NAME, + .class = ACPI_PCI_ROOT_CLASS, + .ids = ACPI_PCI_ROOT_HID, + .ops = { + .add = acpi_pci_root_add, + .remove = acpi_pci_root_remove, + .start = acpi_pci_root_start, + }, }; struct acpi_pci_root { - struct list_head node; - acpi_handle handle; - struct acpi_pci_id id; - struct pci_bus *bus; + struct list_head node; + acpi_handle handle; + struct acpi_pci_id id; + struct pci_bus *bus; }; static LIST_HEAD(acpi_pci_roots); @@ -92,6 +89,7 @@ int acpi_pci_register_driver(struct acpi_pci_driver *driver) return n; } + EXPORT_SYMBOL(acpi_pci_register_driver); void acpi_pci_unregister_driver(struct acpi_pci_driver *driver) @@ -115,10 +113,11 @@ void acpi_pci_unregister_driver(struct acpi_pci_driver *driver) driver->remove(root->handle); } } + EXPORT_SYMBOL(acpi_pci_unregister_driver); static acpi_status -get_root_bridge_busnr_callback (struct acpi_resource *resource, void *data) +get_root_bridge_busnr_callback(struct acpi_resource *resource, void *data) { int *busnr = (int *)data; struct acpi_resource_address64 address; @@ -129,20 +128,21 @@ get_root_bridge_busnr_callback (struct acpi_resource *resource, void *data) return AE_OK; acpi_resource_to_address64(resource, &address); - if ((address.address_length > 0) && - (address.resource_type == ACPI_BUS_NUMBER_RANGE)) + if ((address.address_length > 0) && + (address.resource_type == ACPI_BUS_NUMBER_RANGE)) *busnr = address.min_address_range; return AE_OK; } -static acpi_status -try_get_root_bridge_busnr(acpi_handle handle, int *busnum) +static acpi_status try_get_root_bridge_busnr(acpi_handle handle, int *busnum) { acpi_status status; *busnum = -1; - status = acpi_walk_resources(handle, METHOD_NAME__CRS, get_root_bridge_busnr_callback, busnum); + status = + acpi_walk_resources(handle, METHOD_NAME__CRS, + get_root_bridge_busnr_callback, busnum); if (ACPI_FAILURE(status)) return status; /* Check if we really get a bus number from _CRS */ @@ -151,16 +151,14 @@ try_get_root_bridge_busnr(acpi_handle handle, int *busnum) return AE_OK; } -static int -acpi_pci_root_add ( - struct acpi_device *device) +static int acpi_pci_root_add(struct acpi_device *device) { - int result = 0; - struct acpi_pci_root *root = NULL; - struct acpi_pci_root *tmp; - acpi_status status = AE_OK; - unsigned long value = 0; - acpi_handle handle = NULL; + int result = 0; + struct acpi_pci_root *root = NULL; + struct acpi_pci_root *tmp; + acpi_status status = AE_OK; + unsigned long value = 0; + acpi_handle handle = NULL; ACPI_FUNCTION_TRACE("acpi_pci_root_add"); @@ -188,15 +186,15 @@ acpi_pci_root_add ( * ------- * Obtained via _SEG, if exists, otherwise assumed to be zero (0). */ - status = acpi_evaluate_integer(root->handle, METHOD_NAME__SEG, NULL, - &value); + status = acpi_evaluate_integer(root->handle, METHOD_NAME__SEG, NULL, + &value); switch (status) { case AE_OK: root->id.segment = (u16) value; break; case AE_NOT_FOUND: - ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "Assuming segment 0 (no _SEG)\n")); + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "Assuming segment 0 (no _SEG)\n")); root->id.segment = 0; break; default: @@ -210,8 +208,8 @@ acpi_pci_root_add ( * --- * Obtained via _BBN, if exists, otherwise assumed to be zero (0). */ - status = acpi_evaluate_integer(root->handle, METHOD_NAME__BBN, NULL, - &value); + status = acpi_evaluate_integer(root->handle, METHOD_NAME__BBN, NULL, + &value); switch (status) { case AE_OK: root->id.bus = (u16) value; @@ -229,18 +227,19 @@ acpi_pci_root_add ( /* Some systems have wrong _BBN */ list_for_each_entry(tmp, &acpi_pci_roots, node) { if ((tmp->id.segment == root->id.segment) - && (tmp->id.bus == root->id.bus)) { + && (tmp->id.bus == root->id.bus)) { int bus = 0; acpi_status status; - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Wrong _BBN value, please reboot and using option 'pci=noacpi'\n")); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Wrong _BBN value, please reboot and using option 'pci=noacpi'\n")); status = try_get_root_bridge_busnr(root->handle, &bus); if (ACPI_FAILURE(status)) break; if (bus != root->id.bus) { - printk(KERN_INFO PREFIX "PCI _CRS %d overrides _BBN 0\n", bus); + printk(KERN_INFO PREFIX + "PCI _CRS %d overrides _BBN 0\n", bus); root->id.bus = bus; } break; @@ -258,12 +257,12 @@ acpi_pci_root_add ( * TBD: Need PCI interface for enumeration/configuration of roots. */ - /* TBD: Locking */ - list_add_tail(&root->node, &acpi_pci_roots); + /* TBD: Locking */ + list_add_tail(&root->node, &acpi_pci_roots); - printk(KERN_INFO PREFIX "%s [%s] (%04x:%02x)\n", - acpi_device_name(device), acpi_device_bid(device), - root->id.segment, root->id.bus); + printk(KERN_INFO PREFIX "%s [%s] (%04x:%02x)\n", + acpi_device_name(device), acpi_device_bid(device), + root->id.segment, root->id.bus); /* * Scan the Root Bridge @@ -274,9 +273,9 @@ acpi_pci_root_add ( */ root->bus = pci_acpi_scan_root(device, root->id.segment, root->id.bus); if (!root->bus) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Bus %04x:%02x not present in PCI namespace\n", - root->id.segment, root->id.bus)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Bus %04x:%02x not present in PCI namespace\n", + root->id.segment, root->id.bus)); result = -ENODEV; goto end; } @@ -298,9 +297,9 @@ acpi_pci_root_add ( status = acpi_get_handle(root->handle, METHOD_NAME__PRT, &handle); if (ACPI_SUCCESS(status)) result = acpi_pci_irq_add_prt(root->handle, root->id.segment, - root->id.bus); + root->id.bus); -end: + end: if (result) { if (!list_empty(&root->node)) list_del(&root->node); @@ -310,11 +309,9 @@ end: return_VALUE(result); } -static int -acpi_pci_root_start ( - struct acpi_device *device) +static int acpi_pci_root_start(struct acpi_device *device) { - struct acpi_pci_root *root; + struct acpi_pci_root *root; ACPI_FUNCTION_TRACE("acpi_pci_root_start"); @@ -327,27 +324,23 @@ acpi_pci_root_start ( return_VALUE(-ENODEV); } -static int -acpi_pci_root_remove ( - struct acpi_device *device, - int type) +static int acpi_pci_root_remove(struct acpi_device *device, int type) { - struct acpi_pci_root *root = NULL; + struct acpi_pci_root *root = NULL; ACPI_FUNCTION_TRACE("acpi_pci_root_remove"); if (!device || !acpi_driver_data(device)) return_VALUE(-EINVAL); - root = (struct acpi_pci_root *) acpi_driver_data(device); + root = (struct acpi_pci_root *)acpi_driver_data(device); kfree(root); return_VALUE(0); } - -static int __init acpi_pci_root_init (void) +static int __init acpi_pci_root_init(void) { ACPI_FUNCTION_TRACE("acpi_pci_root_init"); @@ -355,8 +348,8 @@ static int __init acpi_pci_root_init (void) return_VALUE(0); /* DEBUG: - acpi_dbg_layer = ACPI_PCI_COMPONENT; - acpi_dbg_level = 0xFFFFFFFF; + acpi_dbg_layer = ACPI_PCI_COMPONENT; + acpi_dbg_level = 0xFFFFFFFF; */ if (acpi_bus_register_driver(&acpi_pci_root_driver) < 0) @@ -366,4 +359,3 @@ static int __init acpi_pci_root_init (void) } subsys_initcall(acpi_pci_root_init); - diff --git a/drivers/acpi/power.c b/drivers/acpi/power.c index 373a3a95bb4..62a5595ed8b 100644 --- a/drivers/acpi/power.c +++ b/drivers/acpi/power.c @@ -44,10 +44,8 @@ #include #include - #define _COMPONENT ACPI_POWER_COMPONENT -ACPI_MODULE_NAME ("acpi_power") - +ACPI_MODULE_NAME("acpi_power") #define ACPI_POWER_COMPONENT 0x00800000 #define ACPI_POWER_CLASS "power_resource" #define ACPI_POWER_DRIVER_NAME "ACPI Power Resource Driver" @@ -57,38 +55,36 @@ ACPI_MODULE_NAME ("acpi_power") #define ACPI_POWER_RESOURCE_STATE_OFF 0x00 #define ACPI_POWER_RESOURCE_STATE_ON 0x01 #define ACPI_POWER_RESOURCE_STATE_UNKNOWN 0xFF - -static int acpi_power_add (struct acpi_device *device); -static int acpi_power_remove (struct acpi_device *device, int type); +static int acpi_power_add(struct acpi_device *device); +static int acpi_power_remove(struct acpi_device *device, int type); static int acpi_power_open_fs(struct inode *inode, struct file *file); static struct acpi_driver acpi_power_driver = { - .name = ACPI_POWER_DRIVER_NAME, - .class = ACPI_POWER_CLASS, - .ids = ACPI_POWER_HID, - .ops = { - .add = acpi_power_add, - .remove = acpi_power_remove, - }, + .name = ACPI_POWER_DRIVER_NAME, + .class = ACPI_POWER_CLASS, + .ids = ACPI_POWER_HID, + .ops = { + .add = acpi_power_add, + .remove = acpi_power_remove, + }, }; -struct acpi_power_resource -{ - acpi_handle handle; - acpi_bus_id name; - u32 system_level; - u32 order; - int state; - int references; +struct acpi_power_resource { + acpi_handle handle; + acpi_bus_id name; + u32 system_level; + u32 order; + int state; + int references; }; -static struct list_head acpi_power_resource_list; +static struct list_head acpi_power_resource_list; static struct file_operations acpi_power_fops = { - .open = acpi_power_open_fs, - .read = seq_read, - .llseek = seq_lseek, - .release = single_release, + .open = acpi_power_open_fs, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, }; /* -------------------------------------------------------------------------- @@ -96,12 +92,11 @@ static struct file_operations acpi_power_fops = { -------------------------------------------------------------------------- */ static int -acpi_power_get_context ( - acpi_handle handle, - struct acpi_power_resource **resource) +acpi_power_get_context(acpi_handle handle, + struct acpi_power_resource **resource) { - int result = 0; - struct acpi_device *device = NULL; + int result = 0; + struct acpi_device *device = NULL; ACPI_FUNCTION_TRACE("acpi_power_get_context"); @@ -111,24 +106,21 @@ acpi_power_get_context ( result = acpi_bus_get_device(handle, &device); if (result) { ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Error getting context [%p]\n", - handle)); + handle)); return_VALUE(result); } - *resource = (struct acpi_power_resource *) acpi_driver_data(device); + *resource = (struct acpi_power_resource *)acpi_driver_data(device); if (!resource) return_VALUE(-ENODEV); return_VALUE(0); } - -static int -acpi_power_get_state ( - struct acpi_power_resource *resource) +static int acpi_power_get_state(struct acpi_power_resource *resource) { - acpi_status status = AE_OK; - unsigned long sta = 0; + acpi_status status = AE_OK; + unsigned long sta = 0; ACPI_FUNCTION_TRACE("acpi_power_get_state"); @@ -145,20 +137,16 @@ acpi_power_get_state ( resource->state = ACPI_POWER_RESOURCE_STATE_OFF; ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource [%s] is %s\n", - resource->name, resource->state?"on":"off")); + resource->name, resource->state ? "on" : "off")); return_VALUE(0); } - -static int -acpi_power_get_list_state ( - struct acpi_handle_list *list, - int *state) +static int acpi_power_get_list_state(struct acpi_handle_list *list, int *state) { - int result = 0; + int result = 0; struct acpi_power_resource *resource = NULL; - u32 i = 0; + u32 i = 0; ACPI_FUNCTION_TRACE("acpi_power_get_list_state"); @@ -167,7 +155,7 @@ acpi_power_get_list_state ( /* The state of the list is 'on' IFF all resources are 'on'. */ - for (i=0; icount; i++) { + for (i = 0; i < list->count; i++) { result = acpi_power_get_context(list->handles[i], &resource); if (result) return_VALUE(result); @@ -182,19 +170,16 @@ acpi_power_get_list_state ( } ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource list is %s\n", - *state?"on":"off")); + *state ? "on" : "off")); return_VALUE(result); } - -static int -acpi_power_on ( - acpi_handle handle) +static int acpi_power_on(acpi_handle handle) { - int result = 0; - acpi_status status = AE_OK; - struct acpi_device *device = NULL; + int result = 0; + acpi_status status = AE_OK; + struct acpi_device *device = NULL; struct acpi_power_resource *resource = NULL; ACPI_FUNCTION_TRACE("acpi_power_on"); @@ -205,10 +190,10 @@ acpi_power_on ( resource->references++; - if ((resource->references > 1) - || (resource->state == ACPI_POWER_RESOURCE_STATE_ON)) { + if ((resource->references > 1) + || (resource->state == ACPI_POWER_RESOURCE_STATE_ON)) { ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource [%s] already on\n", - resource->name)); + resource->name)); return_VALUE(0); } @@ -229,19 +214,16 @@ acpi_power_on ( device->power.state = ACPI_STATE_D0; ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource [%s] turned on\n", - resource->name)); + resource->name)); return_VALUE(0); } - -static int -acpi_power_off_device ( - acpi_handle handle) +static int acpi_power_off_device(acpi_handle handle) { - int result = 0; - acpi_status status = AE_OK; - struct acpi_device *device = NULL; + int result = 0; + acpi_status status = AE_OK; + struct acpi_device *device = NULL; struct acpi_power_resource *resource = NULL; ACPI_FUNCTION_TRACE("acpi_power_off_device"); @@ -254,15 +236,15 @@ acpi_power_off_device ( resource->references--; if (resource->references) { - ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "Resource [%s] is still in use, dereferencing\n", - device->pnp.bus_id)); + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "Resource [%s] is still in use, dereferencing\n", + device->pnp.bus_id)); return_VALUE(0); } if (resource->state == ACPI_POWER_RESOURCE_STATE_OFF) { ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource [%s] already off\n", - device->pnp.bus_id)); + device->pnp.bus_id)); return_VALUE(0); } @@ -283,7 +265,7 @@ acpi_power_off_device ( device->power.state = ACPI_STATE_D3; ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource [%s] turned off\n", - resource->name)); + resource->name)); return_VALUE(0); } @@ -293,13 +275,13 @@ acpi_power_off_device ( * 1. Power on the power resources required for the wakeup device * 2. Enable _PSW (power state wake) for the device if present */ -int acpi_enable_wakeup_device_power (struct acpi_device *dev) +int acpi_enable_wakeup_device_power(struct acpi_device *dev) { - union acpi_object arg = {ACPI_TYPE_INTEGER}; - struct acpi_object_list arg_list = {1, &arg}; - acpi_status status = AE_OK; - int i; - int ret = 0; + union acpi_object arg = { ACPI_TYPE_INTEGER }; + struct acpi_object_list arg_list = { 1, &arg }; + acpi_status status = AE_OK; + int i; + int ret = 0; ACPI_FUNCTION_TRACE("acpi_enable_wakeup_device_power"); if (!dev || !dev->wakeup.flags.valid) @@ -310,8 +292,8 @@ int acpi_enable_wakeup_device_power (struct acpi_device *dev) for (i = 0; i < dev->wakeup.resources.count; i++) { ret = acpi_power_on(dev->wakeup.resources.handles[i]); if (ret) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error transition power state\n")); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Error transition power state\n")); dev->wakeup.flags.valid = 0; return_VALUE(-1); } @@ -333,20 +315,20 @@ int acpi_enable_wakeup_device_power (struct acpi_device *dev) * 1. Disable _PSW (power state wake) * 2. Shutdown down the power resources */ -int acpi_disable_wakeup_device_power (struct acpi_device *dev) +int acpi_disable_wakeup_device_power(struct acpi_device *dev) { - union acpi_object arg = {ACPI_TYPE_INTEGER}; - struct acpi_object_list arg_list = {1, &arg}; - acpi_status status = AE_OK; - int i; - int ret = 0; + union acpi_object arg = { ACPI_TYPE_INTEGER }; + struct acpi_object_list arg_list = { 1, &arg }; + acpi_status status = AE_OK; + int i; + int ret = 0; ACPI_FUNCTION_TRACE("acpi_disable_wakeup_device_power"); if (!dev || !dev->wakeup.flags.valid) return_VALUE(-1); - arg.integer.value = 0; + arg.integer.value = 0; /* Execute PSW */ status = acpi_evaluate_object(dev->handle, "_PSW", &arg_list, NULL); if (ACPI_FAILURE(status) && (status != AE_NOT_FOUND)) { @@ -359,8 +341,8 @@ int acpi_disable_wakeup_device_power (struct acpi_device *dev) for (i = 0; i < dev->wakeup.resources.count; i++) { ret = acpi_power_off_device(dev->wakeup.resources.handles[i]); if (ret) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error transition power state\n")); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Error transition power state\n")); dev->wakeup.flags.valid = 0; return_VALUE(-1); } @@ -373,14 +355,12 @@ int acpi_disable_wakeup_device_power (struct acpi_device *dev) Device Power Management -------------------------------------------------------------------------- */ -int -acpi_power_get_inferred_state ( - struct acpi_device *device) +int acpi_power_get_inferred_state(struct acpi_device *device) { - int result = 0; - struct acpi_handle_list *list = NULL; - int list_state = 0; - int i = 0; + int result = 0; + struct acpi_handle_list *list = NULL; + int list_state = 0; + int i = 0; ACPI_FUNCTION_TRACE("acpi_power_get_inferred_state"); @@ -393,7 +373,7 @@ acpi_power_get_inferred_state ( * We know a device's inferred power state when all the resources * required for a given D-state are 'on'. */ - for (i=ACPI_STATE_D0; ipower.states[i].resources; if (list->count < 1) continue; @@ -413,23 +393,20 @@ acpi_power_get_inferred_state ( return_VALUE(0); } - -int -acpi_power_transition ( - struct acpi_device *device, - int state) +int acpi_power_transition(struct acpi_device *device, int state) { - int result = 0; - struct acpi_handle_list *cl = NULL; /* Current Resources */ - struct acpi_handle_list *tl = NULL; /* Target Resources */ - int i = 0; + int result = 0; + struct acpi_handle_list *cl = NULL; /* Current Resources */ + struct acpi_handle_list *tl = NULL; /* Target Resources */ + int i = 0; ACPI_FUNCTION_TRACE("acpi_power_transition"); if (!device || (state < ACPI_STATE_D0) || (state > ACPI_STATE_D3)) return_VALUE(-EINVAL); - if ((device->power.state < ACPI_STATE_D0) || (device->power.state > ACPI_STATE_D3)) + if ((device->power.state < ACPI_STATE_D0) + || (device->power.state > ACPI_STATE_D3)) return_VALUE(-ENODEV); cl = &device->power.states[device->power.state].resources; @@ -448,7 +425,7 @@ acpi_power_transition ( * First we reference all power resources required in the target list * (e.g. so the device doesn't lose power while transitioning). */ - for (i=0; icount; i++) { + for (i = 0; i < tl->count; i++) { result = acpi_power_on(tl->handles[i]); if (result) goto end; @@ -457,7 +434,7 @@ acpi_power_transition ( /* * Then we dereference all power resources used in the current list. */ - for (i=0; icount; i++) { + for (i = 0; i < cl->count; i++) { result = acpi_power_off_device(cl->handles[i]); if (result) goto end; @@ -465,21 +442,20 @@ acpi_power_transition ( /* We shouldn't change the state till all above operations succeed */ device->power.state = state; -end: + end: if (result) - ACPI_DEBUG_PRINT((ACPI_DB_WARN, - "Error transitioning device [%s] to D%d\n", - device->pnp.bus_id, state)); + ACPI_DEBUG_PRINT((ACPI_DB_WARN, + "Error transitioning device [%s] to D%d\n", + device->pnp.bus_id, state)); return_VALUE(result); } - /* -------------------------------------------------------------------------- FS Interface (/proc) -------------------------------------------------------------------------- */ -static struct proc_dir_entry *acpi_power_dir; +static struct proc_dir_entry *acpi_power_dir; static int acpi_power_seq_show(struct seq_file *seq, void *offset) { @@ -506,13 +482,12 @@ static int acpi_power_seq_show(struct seq_file *seq, void *offset) } seq_printf(seq, "system level: S%d\n" - "order: %d\n" - "reference count: %d\n", - resource->system_level, - resource->order, - resource->references); + "order: %d\n" + "reference count: %d\n", + resource->system_level, + resource->order, resource->references); -end: + end: return_VALUE(0); } @@ -521,11 +496,9 @@ static int acpi_power_open_fs(struct inode *inode, struct file *file) return single_open(file, acpi_power_seq_show, PDE(inode)->data); } -static int -acpi_power_add_fs ( - struct acpi_device *device) +static int acpi_power_add_fs(struct acpi_device *device) { - struct proc_dir_entry *entry = NULL; + struct proc_dir_entry *entry = NULL; ACPI_FUNCTION_TRACE("acpi_power_add_fs"); @@ -534,18 +507,18 @@ acpi_power_add_fs ( if (!acpi_device_dir(device)) { acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), - acpi_power_dir); + acpi_power_dir); if (!acpi_device_dir(device)) return_VALUE(-ENODEV); } /* 'status' [R] */ entry = create_proc_entry(ACPI_POWER_FILE_STATUS, - S_IRUGO, acpi_device_dir(device)); + S_IRUGO, acpi_device_dir(device)); if (!entry) ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create '%s' fs entry\n", - ACPI_POWER_FILE_STATUS)); + "Unable to create '%s' fs entry\n", + ACPI_POWER_FILE_STATUS)); else { entry->proc_fops = &acpi_power_fops; entry->data = acpi_driver_data(device); @@ -554,10 +527,7 @@ acpi_power_add_fs ( return_VALUE(0); } - -static int -acpi_power_remove_fs ( - struct acpi_device *device) +static int acpi_power_remove_fs(struct acpi_device *device) { ACPI_FUNCTION_TRACE("acpi_power_remove_fs"); @@ -571,20 +541,17 @@ acpi_power_remove_fs ( return_VALUE(0); } - /* -------------------------------------------------------------------------- Driver Interface -------------------------------------------------------------------------- */ -static int -acpi_power_add ( - struct acpi_device *device) +static int acpi_power_add(struct acpi_device *device) { - int result = 0; - acpi_status status = AE_OK; + int result = 0; + acpi_status status = AE_OK; struct acpi_power_resource *resource = NULL; - union acpi_object acpi_object; - struct acpi_buffer buffer = {sizeof(acpi_object), &acpi_object}; + union acpi_object acpi_object; + struct acpi_buffer buffer = { sizeof(acpi_object), &acpi_object }; ACPI_FUNCTION_TRACE("acpi_power_add"); @@ -630,22 +597,18 @@ acpi_power_add ( result = acpi_power_add_fs(device); if (result) goto end; - + printk(KERN_INFO PREFIX "%s [%s] (%s)\n", acpi_device_name(device), - acpi_device_bid(device), resource->state?"on":"off"); + acpi_device_bid(device), resource->state ? "on" : "off"); -end: + end: if (result) kfree(resource); - + return_VALUE(result); } - -static int -acpi_power_remove ( - struct acpi_device *device, - int type) +static int acpi_power_remove(struct acpi_device *device, int type) { struct acpi_power_resource *resource = NULL; @@ -654,7 +617,7 @@ acpi_power_remove ( if (!device || !acpi_driver_data(device)) return_VALUE(-EINVAL); - resource = (struct acpi_power_resource *) acpi_driver_data(device); + resource = (struct acpi_power_resource *)acpi_driver_data(device); acpi_power_remove_fs(device); @@ -663,10 +626,9 @@ acpi_power_remove ( return_VALUE(0); } - -static int __init acpi_power_init (void) +static int __init acpi_power_init(void) { - int result = 0; + int result = 0; ACPI_FUNCTION_TRACE("acpi_power_init"); @@ -689,4 +651,3 @@ static int __init acpi_power_init (void) } subsys_initcall(acpi_power_init); - diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c index d56a439ac61..819cb0b453f 100644 --- a/drivers/acpi/processor_core.c +++ b/drivers/acpi/processor_core.c @@ -58,7 +58,6 @@ #include #include - #define ACPI_PROCESSOR_COMPONENT 0x01000000 #define ACPI_PROCESSOR_CLASS "processor" #define ACPI_PROCESSOR_DRIVER_NAME "ACPI Processor Driver" @@ -75,59 +74,53 @@ #define ACPI_STA_PRESENT 0x00000001 #define _COMPONENT ACPI_PROCESSOR_COMPONENT -ACPI_MODULE_NAME ("acpi_processor") +ACPI_MODULE_NAME("acpi_processor") -MODULE_AUTHOR("Paul Diefenbaugh"); + MODULE_AUTHOR("Paul Diefenbaugh"); MODULE_DESCRIPTION(ACPI_PROCESSOR_DRIVER_NAME); MODULE_LICENSE("GPL"); - -static int acpi_processor_add (struct acpi_device *device); -static int acpi_processor_start (struct acpi_device *device); -static int acpi_processor_remove (struct acpi_device *device, int type); +static int acpi_processor_add(struct acpi_device *device); +static int acpi_processor_start(struct acpi_device *device); +static int acpi_processor_remove(struct acpi_device *device, int type); static int acpi_processor_info_open_fs(struct inode *inode, struct file *file); -static void acpi_processor_notify ( acpi_handle handle, u32 event, void *data); +static void acpi_processor_notify(acpi_handle handle, u32 event, void *data); static acpi_status acpi_processor_hotadd_init(acpi_handle handle, int *p_cpu); static int acpi_processor_handle_eject(struct acpi_processor *pr); static struct acpi_driver acpi_processor_driver = { - .name = ACPI_PROCESSOR_DRIVER_NAME, - .class = ACPI_PROCESSOR_CLASS, - .ids = ACPI_PROCESSOR_HID, - .ops = { - .add = acpi_processor_add, - .remove = acpi_processor_remove, - .start = acpi_processor_start, - }, + .name = ACPI_PROCESSOR_DRIVER_NAME, + .class = ACPI_PROCESSOR_CLASS, + .ids = ACPI_PROCESSOR_HID, + .ops = { + .add = acpi_processor_add, + .remove = acpi_processor_remove, + .start = acpi_processor_start, + }, }; #define INSTALL_NOTIFY_HANDLER 1 #define UNINSTALL_NOTIFY_HANDLER 2 - static struct file_operations acpi_processor_info_fops = { - .open = acpi_processor_info_open_fs, - .read = seq_read, - .llseek = seq_lseek, - .release = single_release, + .open = acpi_processor_info_open_fs, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, }; - -struct acpi_processor *processors[NR_CPUS]; +struct acpi_processor *processors[NR_CPUS]; struct acpi_processor_errata errata; - /* -------------------------------------------------------------------------- Errata Handling -------------------------------------------------------------------------- */ -static int -acpi_processor_errata_piix4 ( - struct pci_dev *dev) +static int acpi_processor_errata_piix4(struct pci_dev *dev) { - u8 rev = 0; - u8 value1 = 0; - u8 value2 = 0; + u8 rev = 0; + u8 value1 = 0; + u8 value2 = 0; ACPI_FUNCTION_TRACE("acpi_processor_errata_piix4"); @@ -188,8 +181,8 @@ acpi_processor_errata_piix4 ( * DMA activity. */ dev = pci_get_subsys(PCI_VENDOR_ID_INTEL, - PCI_DEVICE_ID_INTEL_82371AB, - PCI_ANY_ID, PCI_ANY_ID, NULL); + PCI_DEVICE_ID_INTEL_82371AB, + PCI_ANY_ID, PCI_ANY_ID, NULL); if (dev) { errata.piix4.bmisx = pci_resource_start(dev, 4); pci_dev_put(dev); @@ -205,8 +198,8 @@ acpi_processor_errata_piix4 ( * devices won't operate well if fast DMA is disabled. */ dev = pci_get_subsys(PCI_VENDOR_ID_INTEL, - PCI_DEVICE_ID_INTEL_82371AB_0, - PCI_ANY_ID, PCI_ANY_ID, NULL); + PCI_DEVICE_ID_INTEL_82371AB_0, + PCI_ANY_ID, PCI_ANY_ID, NULL); if (dev) { pci_read_config_byte(dev, 0x76, &value1); pci_read_config_byte(dev, 0x77, &value2); @@ -220,21 +213,18 @@ acpi_processor_errata_piix4 ( if (errata.piix4.bmisx) ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "Bus master activity detection (BM-IDE) erratum enabled\n")); + "Bus master activity detection (BM-IDE) erratum enabled\n")); if (errata.piix4.fdma) ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "Type-F DMA livelock erratum (C3 disabled)\n")); + "Type-F DMA livelock erratum (C3 disabled)\n")); return_VALUE(0); } - -int -acpi_processor_errata ( - struct acpi_processor *pr) +int acpi_processor_errata(struct acpi_processor *pr) { - int result = 0; - struct pci_dev *dev = NULL; + int result = 0; + struct pci_dev *dev = NULL; ACPI_FUNCTION_TRACE("acpi_processor_errata"); @@ -245,7 +235,8 @@ acpi_processor_errata ( * PIIX4 */ dev = pci_get_subsys(PCI_VENDOR_ID_INTEL, - PCI_DEVICE_ID_INTEL_82371AB_3, PCI_ANY_ID, PCI_ANY_ID, NULL); + PCI_DEVICE_ID_INTEL_82371AB_3, PCI_ANY_ID, + PCI_ANY_ID, NULL); if (dev) { result = acpi_processor_errata_piix4(dev); pci_dev_put(dev); @@ -254,7 +245,6 @@ acpi_processor_errata ( return_VALUE(result); } - /* -------------------------------------------------------------------------- Common ACPI processor fucntions -------------------------------------------------------------------------- */ @@ -265,13 +255,13 @@ acpi_processor_errata ( */ int acpi_processor_set_pdc(struct acpi_processor *pr, - struct acpi_object_list *pdc_in) + struct acpi_object_list *pdc_in) { - acpi_status status = AE_OK; - u32 arg0_buf[3]; - union acpi_object arg0 = {ACPI_TYPE_BUFFER}; - struct acpi_object_list no_object = {1, &arg0}; - struct acpi_object_list *pdc; + acpi_status status = AE_OK; + u32 arg0_buf[3]; + union acpi_object arg0 = { ACPI_TYPE_BUFFER }; + struct acpi_object_list no_object = { 1, &arg0 }; + struct acpi_object_list *pdc; ACPI_FUNCTION_TRACE("acpi_processor_set_pdc"); @@ -286,21 +276,21 @@ int acpi_processor_set_pdc(struct acpi_processor *pr, status = acpi_evaluate_object(pr->handle, "_PDC", pdc, NULL); if ((ACPI_FAILURE(status)) && (pdc_in)) - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Error evaluating _PDC, using legacy perf. control...\n")); + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "Error evaluating _PDC, using legacy perf. control...\n")); return_VALUE(status); } - /* -------------------------------------------------------------------------- FS Interface (/proc) -------------------------------------------------------------------------- */ -static struct proc_dir_entry *acpi_processor_dir = NULL; +static struct proc_dir_entry *acpi_processor_dir = NULL; static int acpi_processor_info_seq_show(struct seq_file *seq, void *offset) { - struct acpi_processor *pr = (struct acpi_processor *)seq->private; + struct acpi_processor *pr = (struct acpi_processor *)seq->private; ACPI_FUNCTION_TRACE("acpi_processor_info_seq_show"); @@ -308,40 +298,37 @@ static int acpi_processor_info_seq_show(struct seq_file *seq, void *offset) goto end; seq_printf(seq, "processor id: %d\n" - "acpi id: %d\n" - "bus mastering control: %s\n" - "power management: %s\n" - "throttling control: %s\n" - "limit interface: %s\n", - pr->id, - pr->acpi_id, - pr->flags.bm_control ? "yes" : "no", - pr->flags.power ? "yes" : "no", - pr->flags.throttling ? "yes" : "no", - pr->flags.limit ? "yes" : "no"); - -end: + "acpi id: %d\n" + "bus mastering control: %s\n" + "power management: %s\n" + "throttling control: %s\n" + "limit interface: %s\n", + pr->id, + pr->acpi_id, + pr->flags.bm_control ? "yes" : "no", + pr->flags.power ? "yes" : "no", + pr->flags.throttling ? "yes" : "no", + pr->flags.limit ? "yes" : "no"); + + end: return_VALUE(0); } static int acpi_processor_info_open_fs(struct inode *inode, struct file *file) { return single_open(file, acpi_processor_info_seq_show, - PDE(inode)->data); + PDE(inode)->data); } - -static int -acpi_processor_add_fs ( - struct acpi_device *device) +static int acpi_processor_add_fs(struct acpi_device *device) { - struct proc_dir_entry *entry = NULL; + struct proc_dir_entry *entry = NULL; ACPI_FUNCTION_TRACE("acpi_processor_add_fs"); if (!acpi_device_dir(device)) { acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), - acpi_processor_dir); + acpi_processor_dir); if (!acpi_device_dir(device)) return_VALUE(-ENODEV); } @@ -349,11 +336,11 @@ acpi_processor_add_fs ( /* 'info' [R] */ entry = create_proc_entry(ACPI_PROCESSOR_FILE_INFO, - S_IRUGO, acpi_device_dir(device)); + S_IRUGO, acpi_device_dir(device)); if (!entry) ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create '%s' fs entry\n", - ACPI_PROCESSOR_FILE_INFO)); + "Unable to create '%s' fs entry\n", + ACPI_PROCESSOR_FILE_INFO)); else { entry->proc_fops = &acpi_processor_info_fops; entry->data = acpi_driver_data(device); @@ -362,11 +349,12 @@ acpi_processor_add_fs ( /* 'throttling' [R/W] */ entry = create_proc_entry(ACPI_PROCESSOR_FILE_THROTTLING, - S_IFREG|S_IRUGO|S_IWUSR, acpi_device_dir(device)); + S_IFREG | S_IRUGO | S_IWUSR, + acpi_device_dir(device)); if (!entry) ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create '%s' fs entry\n", - ACPI_PROCESSOR_FILE_THROTTLING)); + "Unable to create '%s' fs entry\n", + ACPI_PROCESSOR_FILE_THROTTLING)); else { entry->proc_fops = &acpi_processor_throttling_fops; entry->proc_fops->write = acpi_processor_write_throttling; @@ -376,11 +364,12 @@ acpi_processor_add_fs ( /* 'limit' [R/W] */ entry = create_proc_entry(ACPI_PROCESSOR_FILE_LIMIT, - S_IFREG|S_IRUGO|S_IWUSR, acpi_device_dir(device)); + S_IFREG | S_IRUGO | S_IWUSR, + acpi_device_dir(device)); if (!entry) ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create '%s' fs entry\n", - ACPI_PROCESSOR_FILE_LIMIT)); + "Unable to create '%s' fs entry\n", + ACPI_PROCESSOR_FILE_LIMIT)); else { entry->proc_fops = &acpi_processor_limit_fops; entry->proc_fops->write = acpi_processor_write_limit; @@ -391,18 +380,17 @@ acpi_processor_add_fs ( return_VALUE(0); } - -static int -acpi_processor_remove_fs ( - struct acpi_device *device) +static int acpi_processor_remove_fs(struct acpi_device *device) { ACPI_FUNCTION_TRACE("acpi_processor_remove_fs"); if (acpi_device_dir(device)) { - remove_proc_entry(ACPI_PROCESSOR_FILE_INFO,acpi_device_dir(device)); + remove_proc_entry(ACPI_PROCESSOR_FILE_INFO, + acpi_device_dir(device)); remove_proc_entry(ACPI_PROCESSOR_FILE_THROTTLING, - acpi_device_dir(device)); - remove_proc_entry(ACPI_PROCESSOR_FILE_LIMIT,acpi_device_dir(device)); + acpi_device_dir(device)); + remove_proc_entry(ACPI_PROCESSOR_FILE_LIMIT, + acpi_device_dir(device)); remove_proc_entry(acpi_device_bid(device), acpi_processor_dir); acpi_device_dir(device) = NULL; } @@ -446,15 +434,13 @@ static u8 convert_acpiid_to_cpu(u8 acpi_id) Driver Interface -------------------------------------------------------------------------- */ -static int -acpi_processor_get_info ( - struct acpi_processor *pr) +static int acpi_processor_get_info(struct acpi_processor *pr) { - acpi_status status = 0; - union acpi_object object = {0}; - struct acpi_buffer buffer = {sizeof(union acpi_object), &object}; - u8 cpu_index; - static int cpu0_initialized; + acpi_status status = 0; + union acpi_object object = { 0 }; + struct acpi_buffer buffer = { sizeof(union acpi_object), &object }; + u8 cpu_index; + static int cpu0_initialized; ACPI_FUNCTION_TRACE("acpi_processor_get_info"); @@ -473,11 +459,10 @@ acpi_processor_get_info ( if (acpi_fadt.V1_pm2_cnt_blk && acpi_fadt.pm2_cnt_len) { pr->flags.bm_control = 1; ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "Bus mastering arbitration control present\n")); - } - else + "Bus mastering arbitration control present\n")); + } else ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "No bus mastering arbitration control\n")); + "No bus mastering arbitration control\n")); /* * Evalute the processor object. Note that it is common on SMP to @@ -487,50 +472,51 @@ acpi_processor_get_info ( status = acpi_evaluate_object(pr->handle, NULL, NULL, &buffer); if (ACPI_FAILURE(status)) { ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error evaluating processor object\n")); + "Error evaluating processor object\n")); return_VALUE(-ENODEV); } /* * TBD: Synch processor ID (via LAPIC/LSAPIC structures) on SMP. - * >>> 'acpi_get_processor_id(acpi_id, &id)' in arch/xxx/acpi.c + * >>> 'acpi_get_processor_id(acpi_id, &id)' in arch/xxx/acpi.c */ pr->acpi_id = object.processor.proc_id; cpu_index = convert_acpiid_to_cpu(pr->acpi_id); - /* Handle UP system running SMP kernel, with no LAPIC in MADT */ - if ( !cpu0_initialized && (cpu_index == 0xff) && - (num_online_cpus() == 1)) { - cpu_index = 0; - } - - cpu0_initialized = 1; - - pr->id = cpu_index; - - /* - * Extra Processor objects may be enumerated on MP systems with - * less than the max # of CPUs. They should be ignored _iff - * they are physically not present. - */ - if (cpu_index >= NR_CPUS) { - if (ACPI_FAILURE(acpi_processor_hotadd_init(pr->handle, &pr->id))) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error getting cpuindex for acpiid 0x%x\n", - pr->acpi_id)); - return_VALUE(-ENODEV); - } - } + /* Handle UP system running SMP kernel, with no LAPIC in MADT */ + if (!cpu0_initialized && (cpu_index == 0xff) && + (num_online_cpus() == 1)) { + cpu_index = 0; + } + + cpu0_initialized = 1; + + pr->id = cpu_index; + + /* + * Extra Processor objects may be enumerated on MP systems with + * less than the max # of CPUs. They should be ignored _iff + * they are physically not present. + */ + if (cpu_index >= NR_CPUS) { + if (ACPI_FAILURE + (acpi_processor_hotadd_init(pr->handle, &pr->id))) { + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Error getting cpuindex for acpiid 0x%x\n", + pr->acpi_id)); + return_VALUE(-ENODEV); + } + } ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Processor [%d:%d]\n", pr->id, - pr->acpi_id)); + pr->acpi_id)); if (!object.processor.pblk_address) ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No PBLK (NULL address)\n")); else if (object.processor.pblk_length != 6) ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid PBLK length [%d]\n", - object.processor.pblk_length)); + object.processor.pblk_length)); else { pr->throttling.address = object.processor.pblk_address; pr->throttling.duty_offset = acpi_fadt.duty_offset; @@ -557,13 +543,11 @@ acpi_processor_get_info ( return_VALUE(0); } -static int -acpi_processor_start( - struct acpi_device *device) +static int acpi_processor_start(struct acpi_device *device) { - int result = 0; - acpi_status status = AE_OK; - struct acpi_processor *pr; + int result = 0; + acpi_status status = AE_OK; + struct acpi_processor *pr; ACPI_FUNCTION_TRACE("acpi_processor_start"); @@ -584,36 +568,30 @@ acpi_processor_start( goto end; status = acpi_install_notify_handler(pr->handle, ACPI_DEVICE_NOTIFY, - acpi_processor_notify, pr); + acpi_processor_notify, pr); if (ACPI_FAILURE(status)) { ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error installing device notify handler\n")); + "Error installing device notify handler\n")); } acpi_processor_power_init(pr, device); if (pr->flags.throttling) { printk(KERN_INFO PREFIX "%s [%s] (supports", - acpi_device_name(device), acpi_device_bid(device)); + acpi_device_name(device), acpi_device_bid(device)); printk(" %d throttling states", pr->throttling.state_count); printk(")\n"); } -end: + end: return_VALUE(result); } - - -static void -acpi_processor_notify ( - acpi_handle handle, - u32 event, - void *data) +static void acpi_processor_notify(acpi_handle handle, u32 event, void *data) { - struct acpi_processor *pr = (struct acpi_processor *) data; - struct acpi_device *device = NULL; + struct acpi_processor *pr = (struct acpi_processor *)data; + struct acpi_device *device = NULL; ACPI_FUNCTION_TRACE("acpi_processor_notify"); @@ -627,7 +605,7 @@ acpi_processor_notify ( case ACPI_PROCESSOR_NOTIFY_PERFORMANCE: acpi_processor_ppc_has_changed(pr); acpi_bus_generate_event(device, event, - pr->performance_platform_limit); + pr->performance_platform_limit); break; case ACPI_PROCESSOR_NOTIFY_POWER: acpi_processor_cst_has_changed(pr); @@ -635,19 +613,16 @@ acpi_processor_notify ( break; default: ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "Unsupported event [0x%x]\n", event)); + "Unsupported event [0x%x]\n", event)); break; } return_VOID; } - -static int -acpi_processor_add ( - struct acpi_device *device) +static int acpi_processor_add(struct acpi_device *device) { - struct acpi_processor *pr = NULL; + struct acpi_processor *pr = NULL; ACPI_FUNCTION_TRACE("acpi_processor_add"); @@ -667,21 +642,17 @@ acpi_processor_add ( return_VALUE(0); } - -static int -acpi_processor_remove ( - struct acpi_device *device, - int type) +static int acpi_processor_remove(struct acpi_device *device, int type) { - acpi_status status = AE_OK; - struct acpi_processor *pr = NULL; + acpi_status status = AE_OK; + struct acpi_processor *pr = NULL; ACPI_FUNCTION_TRACE("acpi_processor_remove"); if (!device || !acpi_driver_data(device)) return_VALUE(-EINVAL); - pr = (struct acpi_processor *) acpi_driver_data(device); + pr = (struct acpi_processor *)acpi_driver_data(device); if (pr->id >= NR_CPUS) { kfree(pr); @@ -696,10 +667,10 @@ acpi_processor_remove ( acpi_processor_power_exit(pr, device); status = acpi_remove_notify_handler(pr->handle, ACPI_DEVICE_NOTIFY, - acpi_processor_notify); + acpi_processor_notify); if (ACPI_FAILURE(status)) { ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error removing notify handler\n")); + "Error removing notify handler\n")); } acpi_processor_remove_fs(device); @@ -718,33 +689,28 @@ acpi_processor_remove ( static int is_processor_present(acpi_handle handle); -static int -is_processor_present( - acpi_handle handle) +static int is_processor_present(acpi_handle handle) { - acpi_status status; - unsigned long sta = 0; + acpi_status status; + unsigned long sta = 0; ACPI_FUNCTION_TRACE("is_processor_present"); status = acpi_evaluate_integer(handle, "_STA", NULL, &sta); if (ACPI_FAILURE(status) || !(sta & ACPI_STA_PRESENT)) { ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Processor Device is not present\n")); + "Processor Device is not present\n")); return_VALUE(0); } return_VALUE(1); } - static -int acpi_processor_device_add( - acpi_handle handle, - struct acpi_device **device) +int acpi_processor_device_add(acpi_handle handle, struct acpi_device **device) { - acpi_handle phandle; - struct acpi_device *pdev; - struct acpi_processor *pr; + acpi_handle phandle; + struct acpi_device *pdev; + struct acpi_processor *pr; ACPI_FUNCTION_TRACE("acpi_processor_device_add"); @@ -766,21 +732,17 @@ int acpi_processor_device_add( if (!pr) return_VALUE(-ENODEV); - if ((pr->id >=0) && (pr->id < NR_CPUS)) { + if ((pr->id >= 0) && (pr->id < NR_CPUS)) { kobject_hotplug(&(*device)->kobj, KOBJ_ONLINE); } return_VALUE(0); } - static void -acpi_processor_hotplug_notify ( - acpi_handle handle, - u32 event, - void *data) +acpi_processor_hotplug_notify(acpi_handle handle, u32 event, void *data) { - struct acpi_processor *pr; - struct acpi_device *device = NULL; + struct acpi_processor *pr; + struct acpi_device *device = NULL; int result; ACPI_FUNCTION_TRACE("acpi_processor_hotplug_notify"); @@ -789,8 +751,8 @@ acpi_processor_hotplug_notify ( case ACPI_NOTIFY_BUS_CHECK: case ACPI_NOTIFY_DEVICE_CHECK: printk("Processor driver received %s event\n", - (event==ACPI_NOTIFY_BUS_CHECK)? - "ACPI_NOTIFY_BUS_CHECK":"ACPI_NOTIFY_DEVICE_CHECK"); + (event == ACPI_NOTIFY_BUS_CHECK) ? + "ACPI_NOTIFY_BUS_CHECK" : "ACPI_NOTIFY_DEVICE_CHECK"); if (!is_processor_present(handle)) break; @@ -799,14 +761,14 @@ acpi_processor_hotplug_notify ( result = acpi_processor_device_add(handle, &device); if (result) ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to add the device\n")); + "Unable to add the device\n")); break; } pr = acpi_driver_data(device); if (!pr) { ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Driver data is NULL\n")); + "Driver data is NULL\n")); break; } @@ -816,24 +778,27 @@ acpi_processor_hotplug_notify ( } result = acpi_processor_start(device); - if ((!result) && ((pr->id >=0) && (pr->id < NR_CPUS))) { + if ((!result) && ((pr->id >= 0) && (pr->id < NR_CPUS))) { kobject_hotplug(&device->kobj, KOBJ_ONLINE); } else { ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Device [%s] failed to start\n", - acpi_device_bid(device))); + "Device [%s] failed to start\n", + acpi_device_bid(device))); } - break; + break; case ACPI_NOTIFY_EJECT_REQUEST: - ACPI_DEBUG_PRINT((ACPI_DB_INFO,"received ACPI_NOTIFY_EJECT_REQUEST\n")); + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "received ACPI_NOTIFY_EJECT_REQUEST\n")); if (acpi_bus_get_device(handle, &device)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR,"Device don't exist, dropping EJECT\n")); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Device don't exist, dropping EJECT\n")); break; } pr = acpi_driver_data(device); if (!pr) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR,"Driver data is NULL, dropping EJECT\n")); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Driver data is NULL, dropping EJECT\n")); return_VOID; } @@ -842,7 +807,7 @@ acpi_processor_hotplug_notify ( break; default: ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "Unsupported event [0x%x]\n", event)); + "Unsupported event [0x%x]\n", event)); break; } @@ -851,45 +816,39 @@ acpi_processor_hotplug_notify ( static acpi_status processor_walk_namespace_cb(acpi_handle handle, - u32 lvl, - void *context, - void **rv) + u32 lvl, void *context, void **rv) { - acpi_status status; + acpi_status status; int *action = context; - acpi_object_type type = 0; + acpi_object_type type = 0; status = acpi_get_type(handle, &type); if (ACPI_FAILURE(status)) - return(AE_OK); + return (AE_OK); if (type != ACPI_TYPE_PROCESSOR) - return(AE_OK); + return (AE_OK); - switch(*action) { + switch (*action) { case INSTALL_NOTIFY_HANDLER: acpi_install_notify_handler(handle, - ACPI_SYSTEM_NOTIFY, - acpi_processor_hotplug_notify, - NULL); + ACPI_SYSTEM_NOTIFY, + acpi_processor_hotplug_notify, + NULL); break; case UNINSTALL_NOTIFY_HANDLER: acpi_remove_notify_handler(handle, - ACPI_SYSTEM_NOTIFY, - acpi_processor_hotplug_notify); + ACPI_SYSTEM_NOTIFY, + acpi_processor_hotplug_notify); break; default: break; } - return(AE_OK); + return (AE_OK); } - -static acpi_status -acpi_processor_hotadd_init( - acpi_handle handle, - int *p_cpu) +static acpi_status acpi_processor_hotadd_init(acpi_handle handle, int *p_cpu) { ACPI_FUNCTION_TRACE("acpi_processor_hotadd_init"); @@ -908,57 +867,47 @@ acpi_processor_hotadd_init( return_VALUE(AE_OK); } - -static int -acpi_processor_handle_eject(struct acpi_processor *pr) +static int acpi_processor_handle_eject(struct acpi_processor *pr) { if (cpu_online(pr->id)) { - return(-EINVAL); + return (-EINVAL); } arch_unregister_cpu(pr->id); acpi_unmap_lsapic(pr->id); - return(0); + return (0); } #else -static acpi_status -acpi_processor_hotadd_init( - acpi_handle handle, - int *p_cpu) +static acpi_status acpi_processor_hotadd_init(acpi_handle handle, int *p_cpu) { return AE_ERROR; } -static int -acpi_processor_handle_eject(struct acpi_processor *pr) +static int acpi_processor_handle_eject(struct acpi_processor *pr) { - return(-EINVAL); + return (-EINVAL); } #endif - static void acpi_processor_install_hotplug_notify(void) { #ifdef CONFIG_ACPI_HOTPLUG_CPU int action = INSTALL_NOTIFY_HANDLER; acpi_walk_namespace(ACPI_TYPE_PROCESSOR, - ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, - processor_walk_namespace_cb, - &action, NULL); + ACPI_ROOT_OBJECT, + ACPI_UINT32_MAX, + processor_walk_namespace_cb, &action, NULL); #endif } - static void acpi_processor_uninstall_hotplug_notify(void) { #ifdef CONFIG_ACPI_HOTPLUG_CPU int action = UNINSTALL_NOTIFY_HANDLER; acpi_walk_namespace(ACPI_TYPE_PROCESSOR, - ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, - processor_walk_namespace_cb, - &action, NULL); + ACPI_ROOT_OBJECT, + ACPI_UINT32_MAX, + processor_walk_namespace_cb, &action, NULL); #endif } @@ -968,10 +917,9 @@ void acpi_processor_uninstall_hotplug_notify(void) * ACPI, but needs symbols from this driver */ -static int __init -acpi_processor_init (void) +static int __init acpi_processor_init(void) { - int result = 0; + int result = 0; ACPI_FUNCTION_TRACE("acpi_processor_init"); @@ -998,9 +946,7 @@ acpi_processor_init (void) return_VALUE(0); } - -static void __exit -acpi_processor_exit (void) +static void __exit acpi_processor_exit(void) { ACPI_FUNCTION_TRACE("acpi_processor_exit"); @@ -1017,7 +963,6 @@ acpi_processor_exit (void) return_VOID; } - module_init(acpi_processor_init); module_exit(acpi_processor_exit); diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index 2c04740c654..26a3a401611 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c @@ -48,15 +48,12 @@ #define ACPI_PROCESSOR_CLASS "processor" #define ACPI_PROCESSOR_DRIVER_NAME "ACPI Processor Driver" #define _COMPONENT ACPI_PROCESSOR_COMPONENT -ACPI_MODULE_NAME ("acpi_processor") - +ACPI_MODULE_NAME("acpi_processor") #define ACPI_PROCESSOR_FILE_POWER "power" - #define US_TO_PM_TIMER_TICKS(t) ((t * (PM_TIMER_FREQUENCY/1000)) / 1000) #define C2_OVERHEAD 4 /* 1us (3.579 ticks per us) */ #define C3_OVERHEAD 4 /* 1us (3.579 ticks per us) */ - -static void (*pm_idle_save)(void); +static void (*pm_idle_save) (void); module_param(max_cstate, uint, 0644); static unsigned int nocst = 0; @@ -69,7 +66,8 @@ module_param(nocst, uint, 0000); * 100 HZ: 0x0000000F: 4 jiffies = 40ms * reduce history for more aggressive entry into C3 */ -static unsigned int bm_history = (HZ >= 800 ? 0xFFFFFFFF : ((1U << (HZ / 25)) - 1)); +static unsigned int bm_history = + (HZ >= 800 ? 0xFFFFFFFF : ((1U << (HZ / 25)) - 1)); module_param(bm_history, uint, 0644); /* -------------------------------------------------------------------------- Power Management @@ -87,34 +85,36 @@ static int set_max_cstate(struct dmi_system_id *id) return 0; printk(KERN_NOTICE PREFIX "%s detected - limiting to C%ld max_cstate." - " Override with \"processor.max_cstate=%d\"\n", id->ident, - (long)id->driver_data, ACPI_PROCESSOR_MAX_POWER + 1); + " Override with \"processor.max_cstate=%d\"\n", id->ident, + (long)id->driver_data, ACPI_PROCESSOR_MAX_POWER + 1); max_cstate = (long)id->driver_data; return 0; } - static struct dmi_system_id __initdata processor_power_dmi_table[] = { - { set_max_cstate, "IBM ThinkPad R40e", { - DMI_MATCH(DMI_BIOS_VENDOR,"IBM"), - DMI_MATCH(DMI_BIOS_VERSION,"1SET60WW") }, (void*)1}, - { set_max_cstate, "Medion 41700", { - DMI_MATCH(DMI_BIOS_VENDOR,"Phoenix Technologies LTD"), - DMI_MATCH(DMI_BIOS_VERSION,"R01-A1J") }, (void*)1}, - { set_max_cstate, "Clevo 5600D", { - DMI_MATCH(DMI_BIOS_VENDOR,"Phoenix Technologies LTD"), - DMI_MATCH(DMI_BIOS_VERSION,"SHE845M0.86C.0013.D.0302131307") }, - (void*)2}, + {set_max_cstate, "IBM ThinkPad R40e", { + DMI_MATCH(DMI_BIOS_VENDOR, + "IBM"), + DMI_MATCH(DMI_BIOS_VERSION, + "1SET60WW")}, + (void *)1}, + {set_max_cstate, "Medion 41700", { + DMI_MATCH(DMI_BIOS_VENDOR, + "Phoenix Technologies LTD"), + DMI_MATCH(DMI_BIOS_VERSION, + "R01-A1J")}, (void *)1}, + {set_max_cstate, "Clevo 5600D", { + DMI_MATCH(DMI_BIOS_VENDOR, + "Phoenix Technologies LTD"), + DMI_MATCH(DMI_BIOS_VERSION, + "SHE845M0.86C.0013.D.0302131307")}, + (void *)2}, {}, }; - -static inline u32 -ticks_elapsed ( - u32 t1, - u32 t2) +static inline u32 ticks_elapsed(u32 t1, u32 t2) { if (t2 >= t1) return (t2 - t1); @@ -124,13 +124,11 @@ ticks_elapsed ( return ((0xFFFFFFFF - t1) + t2); } - static void -acpi_processor_power_activate ( - struct acpi_processor *pr, - struct acpi_processor_cx *new) +acpi_processor_power_activate(struct acpi_processor *pr, + struct acpi_processor_cx *new) { - struct acpi_processor_cx *old; + struct acpi_processor_cx *old; if (!pr || !new) return; @@ -139,7 +137,7 @@ acpi_processor_power_activate ( if (old) old->promotion.count = 0; - new->demotion.count = 0; + new->demotion.count = 0; /* Cleanup from old state. */ if (old) { @@ -147,7 +145,8 @@ acpi_processor_power_activate ( case ACPI_STATE_C3: /* Disable bus master reload */ if (new->type != ACPI_STATE_C3 && pr->flags.bm_check) - acpi_set_register(ACPI_BITREG_BUS_MASTER_RLD, 0, ACPI_MTX_DO_NOT_LOCK); + acpi_set_register(ACPI_BITREG_BUS_MASTER_RLD, 0, + ACPI_MTX_DO_NOT_LOCK); break; } } @@ -157,7 +156,8 @@ acpi_processor_power_activate ( case ACPI_STATE_C3: /* Enable bus master reload */ if (old->type != ACPI_STATE_C3 && pr->flags.bm_check) - acpi_set_register(ACPI_BITREG_BUS_MASTER_RLD, 1, ACPI_MTX_DO_NOT_LOCK); + acpi_set_register(ACPI_BITREG_BUS_MASTER_RLD, 1, + ACPI_MTX_DO_NOT_LOCK); break; } @@ -166,17 +166,15 @@ acpi_processor_power_activate ( return; } +static atomic_t c3_cpu_count; -static atomic_t c3_cpu_count; - - -static void acpi_processor_idle (void) +static void acpi_processor_idle(void) { - struct acpi_processor *pr = NULL; + struct acpi_processor *pr = NULL; struct acpi_processor_cx *cx = NULL; struct acpi_processor_cx *next_state = NULL; - int sleep_ticks = 0; - u32 t1, t2 = 0; + int sleep_ticks = 0; + u32 t1, t2 = 0; pr = processors[raw_smp_processor_id()]; if (!pr) @@ -208,8 +206,8 @@ static void acpi_processor_idle (void) * for demotion. */ if (pr->flags.bm_check) { - u32 bm_status = 0; - unsigned long diff = jiffies - pr->power.bm_check_timestamp; + u32 bm_status = 0; + unsigned long diff = jiffies - pr->power.bm_check_timestamp; if (diff > 32) diff = 32; @@ -223,11 +221,11 @@ static void acpi_processor_idle (void) } acpi_get_register(ACPI_BITREG_BUS_MASTER_STATUS, - &bm_status, ACPI_MTX_DO_NOT_LOCK); + &bm_status, ACPI_MTX_DO_NOT_LOCK); if (bm_status) { pr->power.bm_activity++; acpi_set_register(ACPI_BITREG_BUS_MASTER_STATUS, - 1, ACPI_MTX_DO_NOT_LOCK); + 1, ACPI_MTX_DO_NOT_LOCK); } /* * PIIX4 Erratum #18: Note that BM_STS doesn't always reflect @@ -236,7 +234,7 @@ static void acpi_processor_idle (void) */ else if (errata.piix4.bmisx) { if ((inb_p(errata.piix4.bmisx + 0x02) & 0x01) - || (inb_p(errata.piix4.bmisx + 0x0A) & 0x01)) + || (inb_p(errata.piix4.bmisx + 0x0A) & 0x01)) pr->power.bm_activity++; } @@ -281,7 +279,7 @@ static void acpi_processor_idle (void) else safe_halt(); /* - * TBD: Can't get time duration while in C1, as resumes + * TBD: Can't get time duration while in C1, as resumes * go to an ISR rather than here. Need to instrument * base interrupt handler. */ @@ -300,26 +298,27 @@ static void acpi_processor_idle (void) /* Re-enable interrupts */ local_irq_enable(); /* Compute time (ticks) that we were actually asleep */ - sleep_ticks = ticks_elapsed(t1, t2) - cx->latency_ticks - C2_OVERHEAD; + sleep_ticks = + ticks_elapsed(t1, t2) - cx->latency_ticks - C2_OVERHEAD; break; case ACPI_STATE_C3: - + if (pr->flags.bm_check) { if (atomic_inc_return(&c3_cpu_count) == - num_online_cpus()) { + num_online_cpus()) { /* * All CPUs are trying to go to C3 * Disable bus master arbitration */ acpi_set_register(ACPI_BITREG_ARB_DISABLE, 1, - ACPI_MTX_DO_NOT_LOCK); + ACPI_MTX_DO_NOT_LOCK); } } else { /* SMP with no shared cache... Invalidate cache */ ACPI_FLUSH_CPU_CACHE(); } - + /* Get start time (ticks) */ t1 = inl(acpi_fadt.xpm_tmr_blk.address); /* Invoke C3 */ @@ -331,13 +330,15 @@ static void acpi_processor_idle (void) if (pr->flags.bm_check) { /* Enable bus master arbitration */ atomic_dec(&c3_cpu_count); - acpi_set_register(ACPI_BITREG_ARB_DISABLE, 0, ACPI_MTX_DO_NOT_LOCK); + acpi_set_register(ACPI_BITREG_ARB_DISABLE, 0, + ACPI_MTX_DO_NOT_LOCK); } /* Re-enable interrupts */ local_irq_enable(); /* Compute time (ticks) that we were actually asleep */ - sleep_ticks = ticks_elapsed(t1, t2) - cx->latency_ticks - C3_OVERHEAD; + sleep_ticks = + ticks_elapsed(t1, t2) - cx->latency_ticks - C3_OVERHEAD; break; default: @@ -359,15 +360,18 @@ static void acpi_processor_idle (void) ((cx->promotion.state - pr->power.states) <= max_cstate)) { if (sleep_ticks > cx->promotion.threshold.ticks) { cx->promotion.count++; - cx->demotion.count = 0; - if (cx->promotion.count >= cx->promotion.threshold.count) { + cx->demotion.count = 0; + if (cx->promotion.count >= + cx->promotion.threshold.count) { if (pr->flags.bm_check) { - if (!(pr->power.bm_activity & cx->promotion.threshold.bm)) { - next_state = cx->promotion.state; + if (! + (pr->power.bm_activity & cx-> + promotion.threshold.bm)) { + next_state = + cx->promotion.state; goto end; } - } - else { + } else { next_state = cx->promotion.state; goto end; } @@ -392,7 +396,7 @@ static void acpi_processor_idle (void) } } -end: + end: /* * Demote if current state exceeds max_cstate */ @@ -412,7 +416,7 @@ end: return; - easy_out: + easy_out: /* do C1 instead of busy loop */ if (pm_idle_save) pm_idle_save(); @@ -421,10 +425,7 @@ end: return; } - -static int -acpi_processor_set_power_policy ( - struct acpi_processor *pr) +static int acpi_processor_set_power_policy(struct acpi_processor *pr) { unsigned int i; unsigned int state_is_set = 0; @@ -432,7 +433,7 @@ acpi_processor_set_power_policy ( struct acpi_processor_cx *higher = NULL; struct acpi_processor_cx *cx; - ACPI_FUNCTION_TRACE("acpi_processor_set_power_policy"); + ACPI_FUNCTION_TRACE("acpi_processor_set_power_policy"); if (!pr) return_VALUE(-EINVAL); @@ -447,7 +448,7 @@ acpi_processor_set_power_policy ( */ /* startup state */ - for (i=1; i < ACPI_PROCESSOR_MAX_POWER; i++) { + for (i = 1; i < ACPI_PROCESSOR_MAX_POWER; i++) { cx = &pr->power.states[i]; if (!cx->valid) continue; @@ -456,13 +457,13 @@ acpi_processor_set_power_policy ( pr->power.state = cx; state_is_set++; break; - } + } if (!state_is_set) return_VALUE(-ENODEV); /* demotion */ - for (i=1; i < ACPI_PROCESSOR_MAX_POWER; i++) { + for (i = 1; i < ACPI_PROCESSOR_MAX_POWER; i++) { cx = &pr->power.states[i]; if (!cx->valid) continue; @@ -485,7 +486,7 @@ acpi_processor_set_power_policy ( continue; if (higher) { - cx->promotion.state = higher; + cx->promotion.state = higher; cx->promotion.threshold.ticks = cx->latency_ticks; if (cx->type >= ACPI_STATE_C2) cx->promotion.threshold.count = 4; @@ -498,11 +499,10 @@ acpi_processor_set_power_policy ( higher = cx; } - return_VALUE(0); + return_VALUE(0); } - -static int acpi_processor_get_power_info_fadt (struct acpi_processor *pr) +static int acpi_processor_get_power_info_fadt(struct acpi_processor *pr) { int i; @@ -543,15 +543,14 @@ static int acpi_processor_get_power_info_fadt (struct acpi_processor *pr) return_VALUE(0); } - -static int acpi_processor_get_power_info_default_c1 (struct acpi_processor *pr) +static int acpi_processor_get_power_info_default_c1(struct acpi_processor *pr) { int i; ACPI_FUNCTION_TRACE("acpi_processor_get_power_info_default_c1"); for (i = 0; i < ACPI_PROCESSOR_MAX_POWER; i++) - memset(&(pr->power.states[i]), 0, + memset(&(pr->power.states[i]), 0, sizeof(struct acpi_processor_cx)); /* if info is obtained from pblk/fadt, type equals state */ @@ -567,14 +566,13 @@ static int acpi_processor_get_power_info_default_c1 (struct acpi_processor *pr) return_VALUE(0); } - -static int acpi_processor_get_power_info_cst (struct acpi_processor *pr) +static int acpi_processor_get_power_info_cst(struct acpi_processor *pr) { - acpi_status status = 0; - acpi_integer count; - int i; - struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL}; - union acpi_object *cst; + acpi_status status = 0; + acpi_integer count; + int i; + struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; + union acpi_object *cst; ACPI_FUNCTION_TRACE("acpi_processor_get_power_info_cst"); @@ -583,20 +581,21 @@ static int acpi_processor_get_power_info_cst (struct acpi_processor *pr) pr->power.count = 0; for (i = 0; i < ACPI_PROCESSOR_MAX_POWER; i++) - memset(&(pr->power.states[i]), 0, + memset(&(pr->power.states[i]), 0, sizeof(struct acpi_processor_cx)); status = acpi_evaluate_object(pr->handle, "_CST", NULL, &buffer); if (ACPI_FAILURE(status)) { ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No _CST, giving up\n")); return_VALUE(-ENODEV); - } + } - cst = (union acpi_object *) buffer.pointer; + cst = (union acpi_object *)buffer.pointer; /* There must be at least 2 elements */ if (!cst || (cst->type != ACPI_TYPE_PACKAGE) || cst->package.count < 2) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "not enough elements in _CST\n")); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "not enough elements in _CST\n")); status = -EFAULT; goto end; } @@ -605,15 +604,19 @@ static int acpi_processor_get_power_info_cst (struct acpi_processor *pr) /* Validate number of power states. */ if (count < 1 || count != cst->package.count - 1) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "count given by _CST is not valid\n")); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "count given by _CST is not valid\n")); status = -EFAULT; goto end; } /* We support up to ACPI_PROCESSOR_MAX_POWER. */ if (count > ACPI_PROCESSOR_MAX_POWER) { - printk(KERN_WARNING "Limiting number of power states to max (%d)\n", ACPI_PROCESSOR_MAX_POWER); - printk(KERN_WARNING "Please increase ACPI_PROCESSOR_MAX_POWER if needed.\n"); + printk(KERN_WARNING + "Limiting number of power states to max (%d)\n", + ACPI_PROCESSOR_MAX_POWER); + printk(KERN_WARNING + "Please increase ACPI_PROCESSOR_MAX_POWER if needed.\n"); count = ACPI_PROCESSOR_MAX_POWER; } @@ -628,29 +631,29 @@ static int acpi_processor_get_power_info_cst (struct acpi_processor *pr) memset(&cx, 0, sizeof(cx)); - element = (union acpi_object *) &(cst->package.elements[i]); + element = (union acpi_object *)&(cst->package.elements[i]); if (element->type != ACPI_TYPE_PACKAGE) continue; if (element->package.count != 4) continue; - obj = (union acpi_object *) &(element->package.elements[0]); + obj = (union acpi_object *)&(element->package.elements[0]); if (obj->type != ACPI_TYPE_BUFFER) continue; - reg = (struct acpi_power_register *) obj->buffer.pointer; + reg = (struct acpi_power_register *)obj->buffer.pointer; if (reg->space_id != ACPI_ADR_SPACE_SYSTEM_IO && - (reg->space_id != ACPI_ADR_SPACE_FIXED_HARDWARE)) + (reg->space_id != ACPI_ADR_SPACE_FIXED_HARDWARE)) continue; cx.address = (reg->space_id == ACPI_ADR_SPACE_FIXED_HARDWARE) ? - 0 : reg->address; + 0 : reg->address; /* There should be an easy way to extract an integer... */ - obj = (union acpi_object *) &(element->package.elements[1]); + obj = (union acpi_object *)&(element->package.elements[1]); if (obj->type != ACPI_TYPE_INTEGER) continue; @@ -660,17 +663,16 @@ static int acpi_processor_get_power_info_cst (struct acpi_processor *pr) (reg->space_id != ACPI_ADR_SPACE_SYSTEM_IO)) continue; - if ((cx.type < ACPI_STATE_C1) || - (cx.type > ACPI_STATE_C3)) + if ((cx.type < ACPI_STATE_C1) || (cx.type > ACPI_STATE_C3)) continue; - obj = (union acpi_object *) &(element->package.elements[2]); + obj = (union acpi_object *)&(element->package.elements[2]); if (obj->type != ACPI_TYPE_INTEGER) continue; cx.latency = obj->integer.value; - obj = (union acpi_object *) &(element->package.elements[3]); + obj = (union acpi_object *)&(element->package.elements[3]); if (obj->type != ACPI_TYPE_INTEGER) continue; @@ -680,19 +682,19 @@ static int acpi_processor_get_power_info_cst (struct acpi_processor *pr) memcpy(&(pr->power.states[pr->power.count]), &cx, sizeof(cx)); } - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found %d power states\n", pr->power.count)); + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found %d power states\n", + pr->power.count)); /* Validate number of power states discovered */ if (pr->power.count < 2) status = -ENODEV; -end: + end: acpi_os_free(buffer.pointer); return_VALUE(status); } - static void acpi_processor_power_verify_c2(struct acpi_processor_cx *cx) { ACPI_FUNCTION_TRACE("acpi_processor_get_power_verify_c2"); @@ -706,8 +708,7 @@ static void acpi_processor_power_verify_c2(struct acpi_processor_cx *cx) */ else if (cx->latency > ACPI_PROCESSOR_MAX_C2_LATENCY) { ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "latency too large [%d]\n", - cx->latency)); + "latency too large [%d]\n", cx->latency)); return_VOID; } @@ -721,10 +722,8 @@ static void acpi_processor_power_verify_c2(struct acpi_processor_cx *cx) return_VOID; } - -static void acpi_processor_power_verify_c3( - struct acpi_processor *pr, - struct acpi_processor_cx *cx) +static void acpi_processor_power_verify_c3(struct acpi_processor *pr, + struct acpi_processor_cx *cx) { static int bm_check_flag; @@ -739,8 +738,7 @@ static void acpi_processor_power_verify_c3( */ else if (cx->latency > ACPI_PROCESSOR_MAX_C3_LATENCY) { ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "latency too large [%d]\n", - cx->latency)); + "latency too large [%d]\n", cx->latency)); return_VOID; } @@ -753,7 +751,7 @@ static void acpi_processor_power_verify_c3( */ else if (errata.piix4.fdma) { ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "C3 not supported on PIIX4 with Type-F DMA\n")); + "C3 not supported on PIIX4 with Type-F DMA\n")); return_VOID; } @@ -770,7 +768,7 @@ static void acpi_processor_power_verify_c3( /* bus mastering control is necessary */ if (!pr->flags.bm_control) { ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "C3 support requires bus mastering control\n")); + "C3 support requires bus mastering control\n")); return_VOID; } } else { @@ -780,12 +778,12 @@ static void acpi_processor_power_verify_c3( */ if (acpi_fadt.wb_invd != 1) { ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "Cache invalidation should work properly" - " for C3 to be enabled on SMP systems\n")); + "Cache invalidation should work properly" + " for C3 to be enabled on SMP systems\n")); return_VOID; } acpi_set_register(ACPI_BITREG_BUS_MASTER_RLD, - 0, ACPI_MTX_DO_NOT_LOCK); + 0, ACPI_MTX_DO_NOT_LOCK); } /* @@ -800,13 +798,12 @@ static void acpi_processor_power_verify_c3( return_VOID; } - static int acpi_processor_power_verify(struct acpi_processor *pr) { unsigned int i; unsigned int working = 0; - for (i=1; i < ACPI_PROCESSOR_MAX_POWER; i++) { + for (i = 1; i < ACPI_PROCESSOR_MAX_POWER; i++) { struct acpi_processor_cx *cx = &pr->power.states[i]; switch (cx->type) { @@ -830,8 +827,7 @@ static int acpi_processor_power_verify(struct acpi_processor *pr) return (working); } -static int acpi_processor_get_power_info ( - struct acpi_processor *pr) +static int acpi_processor_get_power_info(struct acpi_processor *pr) { unsigned int i; int result; @@ -874,16 +870,16 @@ static int acpi_processor_get_power_info ( return_VALUE(0); } -int acpi_processor_cst_has_changed (struct acpi_processor *pr) +int acpi_processor_cst_has_changed(struct acpi_processor *pr) { - int result = 0; + int result = 0; ACPI_FUNCTION_TRACE("acpi_processor_cst_has_changed"); if (!pr) - return_VALUE(-EINVAL); + return_VALUE(-EINVAL); - if ( nocst) { + if (nocst) { return_VALUE(-ENODEV); } @@ -892,7 +888,7 @@ int acpi_processor_cst_has_changed (struct acpi_processor *pr) /* Fall back to the default idle loop */ pm_idle = pm_idle_save; - synchronize_sched(); /* Relies on interrupts forcing exit from idle. */ + synchronize_sched(); /* Relies on interrupts forcing exit from idle. */ pr->flags.power = 0; result = acpi_processor_get_power_info(pr); @@ -906,8 +902,8 @@ int acpi_processor_cst_has_changed (struct acpi_processor *pr) static int acpi_processor_power_seq_show(struct seq_file *seq, void *offset) { - struct acpi_processor *pr = (struct acpi_processor *)seq->private; - unsigned int i; + struct acpi_processor *pr = (struct acpi_processor *)seq->private; + unsigned int i; ACPI_FUNCTION_TRACE("acpi_processor_power_seq_show"); @@ -915,17 +911,17 @@ static int acpi_processor_power_seq_show(struct seq_file *seq, void *offset) goto end; seq_printf(seq, "active state: C%zd\n" - "max_cstate: C%d\n" - "bus master activity: %08x\n", - pr->power.state ? pr->power.state - pr->power.states : 0, - max_cstate, - (unsigned)pr->power.bm_activity); + "max_cstate: C%d\n" + "bus master activity: %08x\n", + pr->power.state ? pr->power.state - pr->power.states : 0, + max_cstate, (unsigned)pr->power.bm_activity); seq_puts(seq, "states:\n"); for (i = 1; i <= pr->power.count; i++) { seq_printf(seq, " %cC%d: ", - (&pr->power.states[i] == pr->power.state?'*':' '), i); + (&pr->power.states[i] == + pr->power.state ? '*' : ' '), i); if (!pr->power.states[i].valid) { seq_puts(seq, "\n"); @@ -949,45 +945,46 @@ static int acpi_processor_power_seq_show(struct seq_file *seq, void *offset) if (pr->power.states[i].promotion.state) seq_printf(seq, "promotion[C%zd] ", - (pr->power.states[i].promotion.state - - pr->power.states)); + (pr->power.states[i].promotion.state - + pr->power.states)); else seq_puts(seq, "promotion[--] "); if (pr->power.states[i].demotion.state) seq_printf(seq, "demotion[C%zd] ", - (pr->power.states[i].demotion.state - - pr->power.states)); + (pr->power.states[i].demotion.state - + pr->power.states)); else seq_puts(seq, "demotion[--] "); seq_printf(seq, "latency[%03d] usage[%08d]\n", - pr->power.states[i].latency, - pr->power.states[i].usage); + pr->power.states[i].latency, + pr->power.states[i].usage); } -end: + end: return_VALUE(0); } static int acpi_processor_power_open_fs(struct inode *inode, struct file *file) { return single_open(file, acpi_processor_power_seq_show, - PDE(inode)->data); + PDE(inode)->data); } static struct file_operations acpi_processor_power_fops = { - .open = acpi_processor_power_open_fs, - .read = seq_read, - .llseek = seq_lseek, - .release = single_release, + .open = acpi_processor_power_open_fs, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, }; -int acpi_processor_power_init(struct acpi_processor *pr, struct acpi_device *device) +int acpi_processor_power_init(struct acpi_processor *pr, + struct acpi_device *device) { - acpi_status status = 0; - static int first_run = 0; - struct proc_dir_entry *entry = NULL; + acpi_status status = 0; + static int first_run = 0; + struct proc_dir_entry *entry = NULL; unsigned int i; ACPI_FUNCTION_TRACE("acpi_processor_power_init"); @@ -995,7 +992,9 @@ int acpi_processor_power_init(struct acpi_processor *pr, struct acpi_device *dev if (!first_run) { dmi_check_system(processor_power_dmi_table); if (max_cstate < ACPI_C_STATES_MAX) - printk(KERN_NOTICE "ACPI: processor limited to max C-state %d\n", max_cstate); + printk(KERN_NOTICE + "ACPI: processor limited to max C-state %d\n", + max_cstate); first_run++; } @@ -1003,7 +1002,8 @@ int acpi_processor_power_init(struct acpi_processor *pr, struct acpi_device *dev return_VALUE(-EINVAL); if (acpi_fadt.cst_cnt && !nocst) { - status = acpi_os_write_port(acpi_fadt.smi_cmd, acpi_fadt.cst_cnt, 8); + status = + acpi_os_write_port(acpi_fadt.smi_cmd, acpi_fadt.cst_cnt, 8); if (ACPI_FAILURE(status)) { ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Notifying BIOS of _CST ability failed\n")); @@ -1023,7 +1023,8 @@ int acpi_processor_power_init(struct acpi_processor *pr, struct acpi_device *dev printk(KERN_INFO PREFIX "CPU%d (power states:", pr->id); for (i = 1; i <= pr->power.count; i++) if (pr->power.states[i].valid) - printk(" C%d[C%d]", i, pr->power.states[i].type); + printk(" C%d[C%d]", i, + pr->power.states[i].type); printk(")\n"); if (pr->id == 0) { @@ -1034,11 +1035,11 @@ int acpi_processor_power_init(struct acpi_processor *pr, struct acpi_device *dev /* 'power' [R] */ entry = create_proc_entry(ACPI_PROCESSOR_FILE_POWER, - S_IRUGO, acpi_device_dir(device)); + S_IRUGO, acpi_device_dir(device)); if (!entry) ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create '%s' fs entry\n", - ACPI_PROCESSOR_FILE_POWER)); + "Unable to create '%s' fs entry\n", + ACPI_PROCESSOR_FILE_POWER)); else { entry->proc_fops = &acpi_processor_power_fops; entry->data = acpi_driver_data(device); @@ -1050,14 +1051,16 @@ int acpi_processor_power_init(struct acpi_processor *pr, struct acpi_device *dev return_VALUE(0); } -int acpi_processor_power_exit(struct acpi_processor *pr, struct acpi_device *device) +int acpi_processor_power_exit(struct acpi_processor *pr, + struct acpi_device *device) { ACPI_FUNCTION_TRACE("acpi_processor_power_exit"); pr->flags.power_setup_done = 0; if (acpi_device_dir(device)) - remove_proc_entry(ACPI_PROCESSOR_FILE_POWER,acpi_device_dir(device)); + remove_proc_entry(ACPI_PROCESSOR_FILE_POWER, + acpi_device_dir(device)); /* Unregister the idle handler when processor #0 is removed. */ if (pr->id == 0) { diff --git a/drivers/acpi/processor_perflib.c b/drivers/acpi/processor_perflib.c index 1f0d6256302..22c7bb66c20 100644 --- a/drivers/acpi/processor_perflib.c +++ b/drivers/acpi/processor_perflib.c @@ -26,7 +26,6 @@ * */ - #include #include #include @@ -42,14 +41,12 @@ #include #include - #define ACPI_PROCESSOR_COMPONENT 0x01000000 #define ACPI_PROCESSOR_CLASS "processor" #define ACPI_PROCESSOR_DRIVER_NAME "ACPI Processor Driver" #define ACPI_PROCESSOR_FILE_PERFORMANCE "performance" #define _COMPONENT ACPI_PROCESSOR_COMPONENT -ACPI_MODULE_NAME ("acpi_processor") - +ACPI_MODULE_NAME("acpi_processor") static DECLARE_MUTEX(performance_sem); @@ -69,8 +66,7 @@ static DECLARE_MUTEX(performance_sem); static int acpi_processor_ppc_status = 0; static int acpi_processor_ppc_notifier(struct notifier_block *nb, - unsigned long event, - void *data) + unsigned long event, void *data) { struct cpufreq_policy *policy = data; struct acpi_processor *pr; @@ -85,7 +81,7 @@ static int acpi_processor_ppc_notifier(struct notifier_block *nb, if (!pr || !pr->performance) goto out; - ppc = (unsigned int) pr->performance_platform_limit; + ppc = (unsigned int)pr->performance_platform_limit; if (!ppc) goto out; @@ -93,26 +89,23 @@ static int acpi_processor_ppc_notifier(struct notifier_block *nb, goto out; cpufreq_verify_within_limits(policy, 0, - pr->performance->states[ppc].core_frequency * 1000); + pr->performance->states[ppc]. + core_frequency * 1000); - out: + out: up(&performance_sem); return 0; } - static struct notifier_block acpi_ppc_notifier_block = { .notifier_call = acpi_processor_ppc_notifier, }; - -static int -acpi_processor_get_platform_limit ( - struct acpi_processor* pr) +static int acpi_processor_get_platform_limit(struct acpi_processor *pr) { - acpi_status status = 0; - unsigned long ppc = 0; + acpi_status status = 0; + unsigned long ppc = 0; ACPI_FUNCTION_TRACE("acpi_processor_get_platform_limit"); @@ -128,19 +121,17 @@ acpi_processor_get_platform_limit ( if (status != AE_NOT_FOUND) acpi_processor_ppc_status |= PPC_IN_USE; - if(ACPI_FAILURE(status) && status != AE_NOT_FOUND) { + if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) { ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluating _PPC\n")); return_VALUE(-ENODEV); } - pr->performance_platform_limit = (int) ppc; + pr->performance_platform_limit = (int)ppc; return_VALUE(0); } - -int acpi_processor_ppc_has_changed( - struct acpi_processor *pr) +int acpi_processor_ppc_has_changed(struct acpi_processor *pr) { int ret = acpi_processor_get_platform_limit(pr); if (ret < 0) @@ -149,44 +140,44 @@ int acpi_processor_ppc_has_changed( return cpufreq_update_policy(pr->id); } - -void acpi_processor_ppc_init(void) { - if (!cpufreq_register_notifier(&acpi_ppc_notifier_block, CPUFREQ_POLICY_NOTIFIER)) +void acpi_processor_ppc_init(void) +{ + if (!cpufreq_register_notifier + (&acpi_ppc_notifier_block, CPUFREQ_POLICY_NOTIFIER)) acpi_processor_ppc_status |= PPC_REGISTERED; else - printk(KERN_DEBUG "Warning: Processor Platform Limit not supported.\n"); + printk(KERN_DEBUG + "Warning: Processor Platform Limit not supported.\n"); } - -void acpi_processor_ppc_exit(void) { +void acpi_processor_ppc_exit(void) +{ if (acpi_processor_ppc_status & PPC_REGISTERED) - cpufreq_unregister_notifier(&acpi_ppc_notifier_block, CPUFREQ_POLICY_NOTIFIER); + cpufreq_unregister_notifier(&acpi_ppc_notifier_block, + CPUFREQ_POLICY_NOTIFIER); acpi_processor_ppc_status &= ~PPC_REGISTERED; } - -static int -acpi_processor_get_performance_control ( - struct acpi_processor *pr) +static int acpi_processor_get_performance_control(struct acpi_processor *pr) { - int result = 0; - acpi_status status = 0; - struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL}; - union acpi_object *pct = NULL; - union acpi_object obj = {0}; + int result = 0; + acpi_status status = 0; + struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; + union acpi_object *pct = NULL; + union acpi_object obj = { 0 }; ACPI_FUNCTION_TRACE("acpi_processor_get_performance_control"); status = acpi_evaluate_object(pr->handle, "_PCT", NULL, &buffer); - if(ACPI_FAILURE(status)) { + if (ACPI_FAILURE(status)) { ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluating _PCT\n")); return_VALUE(-ENODEV); } - pct = (union acpi_object *) buffer.pointer; + pct = (union acpi_object *)buffer.pointer; if (!pct || (pct->type != ACPI_TYPE_PACKAGE) - || (pct->package.count != 2)) { + || (pct->package.count != 2)) { ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid _PCT data\n")); result = -EFAULT; goto end; @@ -199,15 +190,15 @@ acpi_processor_get_performance_control ( obj = pct->package.elements[0]; if ((obj.type != ACPI_TYPE_BUFFER) - || (obj.buffer.length < sizeof(struct acpi_pct_register)) - || (obj.buffer.pointer == NULL)) { + || (obj.buffer.length < sizeof(struct acpi_pct_register)) + || (obj.buffer.pointer == NULL)) { ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Invalid _PCT data (control_register)\n")); + "Invalid _PCT data (control_register)\n")); result = -EFAULT; goto end; } - memcpy(&pr->performance->control_register, obj.buffer.pointer, sizeof(struct acpi_pct_register)); - + memcpy(&pr->performance->control_register, obj.buffer.pointer, + sizeof(struct acpi_pct_register)); /* * status_register @@ -216,44 +207,42 @@ acpi_processor_get_performance_control ( obj = pct->package.elements[1]; if ((obj.type != ACPI_TYPE_BUFFER) - || (obj.buffer.length < sizeof(struct acpi_pct_register)) - || (obj.buffer.pointer == NULL)) { + || (obj.buffer.length < sizeof(struct acpi_pct_register)) + || (obj.buffer.pointer == NULL)) { ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Invalid _PCT data (status_register)\n")); + "Invalid _PCT data (status_register)\n")); result = -EFAULT; goto end; } - memcpy(&pr->performance->status_register, obj.buffer.pointer, sizeof(struct acpi_pct_register)); + memcpy(&pr->performance->status_register, obj.buffer.pointer, + sizeof(struct acpi_pct_register)); -end: + end: acpi_os_free(buffer.pointer); return_VALUE(result); } - -static int -acpi_processor_get_performance_states ( - struct acpi_processor *pr) +static int acpi_processor_get_performance_states(struct acpi_processor *pr) { - int result = 0; - acpi_status status = AE_OK; - struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL}; - struct acpi_buffer format = {sizeof("NNNNNN"), "NNNNNN"}; - struct acpi_buffer state = {0, NULL}; - union acpi_object *pss = NULL; - int i; + int result = 0; + acpi_status status = AE_OK; + struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; + struct acpi_buffer format = { sizeof("NNNNNN"), "NNNNNN" }; + struct acpi_buffer state = { 0, NULL }; + union acpi_object *pss = NULL; + int i; ACPI_FUNCTION_TRACE("acpi_processor_get_performance_states"); status = acpi_evaluate_object(pr->handle, "_PSS", NULL, &buffer); - if(ACPI_FAILURE(status)) { + if (ACPI_FAILURE(status)) { ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluating _PSS\n")); return_VALUE(-ENODEV); } - pss = (union acpi_object *) buffer.pointer; + pss = (union acpi_object *)buffer.pointer; if (!pss || (pss->type != ACPI_TYPE_PACKAGE)) { ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid _PSS data\n")); result = -EFAULT; @@ -261,10 +250,12 @@ acpi_processor_get_performance_states ( } ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found %d performance states\n", - pss->package.count)); + pss->package.count)); pr->performance->state_count = pss->package.count; - pr->performance->states = kmalloc(sizeof(struct acpi_processor_px) * pss->package.count, GFP_KERNEL); + pr->performance->states = + kmalloc(sizeof(struct acpi_processor_px) * pss->package.count, + GFP_KERNEL); if (!pr->performance->states) { result = -ENOMEM; goto end; @@ -280,46 +271,44 @@ acpi_processor_get_performance_states ( ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Extracting state %d\n", i)); status = acpi_extract_package(&(pss->package.elements[i]), - &format, &state); + &format, &state); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid _PSS data\n")); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Invalid _PSS data\n")); result = -EFAULT; kfree(pr->performance->states); goto end; } ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "State [%d]: core_frequency[%d] power[%d] transition_latency[%d] bus_master_latency[%d] control[0x%x] status[0x%x]\n", - i, - (u32) px->core_frequency, - (u32) px->power, - (u32) px->transition_latency, - (u32) px->bus_master_latency, - (u32) px->control, - (u32) px->status)); + "State [%d]: core_frequency[%d] power[%d] transition_latency[%d] bus_master_latency[%d] control[0x%x] status[0x%x]\n", + i, + (u32) px->core_frequency, + (u32) px->power, + (u32) px->transition_latency, + (u32) px->bus_master_latency, + (u32) px->control, (u32) px->status)); if (!px->core_frequency) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid _PSS data: freq is zero\n")); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Invalid _PSS data: freq is zero\n")); result = -EFAULT; kfree(pr->performance->states); goto end; } } -end: + end: acpi_os_free(buffer.pointer); return_VALUE(result); } - -static int -acpi_processor_get_performance_info ( - struct acpi_processor *pr) +static int acpi_processor_get_performance_info(struct acpi_processor *pr) { - int result = 0; - acpi_status status = AE_OK; - acpi_handle handle = NULL; + int result = 0; + acpi_status status = AE_OK; + acpi_handle handle = NULL; ACPI_FUNCTION_TRACE("acpi_processor_get_performance_info"); @@ -331,7 +320,7 @@ acpi_processor_get_performance_info ( status = acpi_get_handle(pr->handle, "_PCT", &handle); if (ACPI_FAILURE(status)) { ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "ACPI-based processor performance control unavailable\n")); + "ACPI-based processor performance control unavailable\n")); return_VALUE(-ENODEV); } @@ -350,10 +339,10 @@ acpi_processor_get_performance_info ( return_VALUE(0); } - -int acpi_processor_notify_smm(struct module *calling_module) { - acpi_status status; - static int is_done = 0; +int acpi_processor_notify_smm(struct module *calling_module) +{ + acpi_status status; + static int is_done = 0; ACPI_FUNCTION_TRACE("acpi_processor_notify_smm"); @@ -371,8 +360,7 @@ int acpi_processor_notify_smm(struct module *calling_module) { if (is_done > 0) { module_put(calling_module); return_VALUE(0); - } - else if (is_done < 0) { + } else if (is_done < 0) { module_put(calling_module); return_VALUE(is_done); } @@ -380,28 +368,30 @@ int acpi_processor_notify_smm(struct module *calling_module) { is_done = -EIO; /* Can't write pstate_cnt to smi_cmd if either value is zero */ - if ((!acpi_fadt.smi_cmd) || - (!acpi_fadt.pstate_cnt)) { - ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "No SMI port or pstate_cnt\n")); + if ((!acpi_fadt.smi_cmd) || (!acpi_fadt.pstate_cnt)) { + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No SMI port or pstate_cnt\n")); module_put(calling_module); return_VALUE(0); } - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Writing pstate_cnt [0x%x] to smi_cmd [0x%x]\n", acpi_fadt.pstate_cnt, acpi_fadt.smi_cmd)); + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "Writing pstate_cnt [0x%x] to smi_cmd [0x%x]\n", + acpi_fadt.pstate_cnt, acpi_fadt.smi_cmd)); /* FADT v1 doesn't support pstate_cnt, many BIOS vendors use * it anyway, so we need to support it... */ if (acpi_fadt_is_v1) { - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Using v1.0 FADT reserved value for pstate_cnt\n")); + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "Using v1.0 FADT reserved value for pstate_cnt\n")); } - status = acpi_os_write_port (acpi_fadt.smi_cmd, - (u32) acpi_fadt.pstate_cnt, 8); - if (ACPI_FAILURE (status)) { + status = acpi_os_write_port(acpi_fadt.smi_cmd, + (u32) acpi_fadt.pstate_cnt, 8); + if (ACPI_FAILURE(status)) { ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Failed to write pstate_cnt [0x%x] to " - "smi_cmd [0x%x]\n", acpi_fadt.pstate_cnt, acpi_fadt.smi_cmd)); + "smi_cmd [0x%x]\n", acpi_fadt.pstate_cnt, + acpi_fadt.smi_cmd)); module_put(calling_module); return_VALUE(status); } @@ -415,24 +405,24 @@ int acpi_processor_notify_smm(struct module *calling_module) { return_VALUE(0); } -EXPORT_SYMBOL(acpi_processor_notify_smm); +EXPORT_SYMBOL(acpi_processor_notify_smm); #ifdef CONFIG_X86_ACPI_CPUFREQ_PROC_INTF /* /proc/acpi/processor/../performance interface (DEPRECATED) */ static int acpi_processor_perf_open_fs(struct inode *inode, struct file *file); static struct file_operations acpi_processor_perf_fops = { - .open = acpi_processor_perf_open_fs, - .read = seq_read, - .llseek = seq_lseek, - .release = single_release, + .open = acpi_processor_perf_open_fs, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, }; static int acpi_processor_perf_seq_show(struct seq_file *seq, void *offset) { - struct acpi_processor *pr = (struct acpi_processor *)seq->private; - int i; + struct acpi_processor *pr = (struct acpi_processor *)seq->private; + int i; ACPI_FUNCTION_TRACE("acpi_processor_perf_seq_show"); @@ -445,42 +435,40 @@ static int acpi_processor_perf_seq_show(struct seq_file *seq, void *offset) } seq_printf(seq, "state count: %d\n" - "active state: P%d\n", - pr->performance->state_count, - pr->performance->state); + "active state: P%d\n", + pr->performance->state_count, pr->performance->state); seq_puts(seq, "states:\n"); for (i = 0; i < pr->performance->state_count; i++) - seq_printf(seq, " %cP%d: %d MHz, %d mW, %d uS\n", - (i == pr->performance->state?'*':' '), i, - (u32) pr->performance->states[i].core_frequency, - (u32) pr->performance->states[i].power, - (u32) pr->performance->states[i].transition_latency); - -end: + seq_printf(seq, + " %cP%d: %d MHz, %d mW, %d uS\n", + (i == pr->performance->state ? '*' : ' '), i, + (u32) pr->performance->states[i].core_frequency, + (u32) pr->performance->states[i].power, + (u32) pr->performance->states[i].transition_latency); + + end: return_VALUE(0); } static int acpi_processor_perf_open_fs(struct inode *inode, struct file *file) { return single_open(file, acpi_processor_perf_seq_show, - PDE(inode)->data); + PDE(inode)->data); } static ssize_t -acpi_processor_write_performance ( - struct file *file, - const char __user *buffer, - size_t count, - loff_t *data) +acpi_processor_write_performance(struct file *file, + const char __user * buffer, + size_t count, loff_t * data) { - int result = 0; - struct seq_file *m = (struct seq_file *) file->private_data; - struct acpi_processor *pr = (struct acpi_processor *) m->private; + int result = 0; + struct seq_file *m = (struct seq_file *)file->private_data; + struct acpi_processor *pr = (struct acpi_processor *)m->private; struct acpi_processor_performance *perf; - char state_string[12] = {'\0'}; - unsigned int new_state = 0; - struct cpufreq_policy policy; + char state_string[12] = { '\0' }; + unsigned int new_state = 0; + struct cpufreq_policy policy; ACPI_FUNCTION_TRACE("acpi_processor_write_performance"); @@ -513,12 +501,10 @@ acpi_processor_write_performance ( return_VALUE(count); } -static void -acpi_cpufreq_add_file ( - struct acpi_processor *pr) +static void acpi_cpufreq_add_file(struct acpi_processor *pr) { - struct proc_dir_entry *entry = NULL; - struct acpi_device *device = NULL; + struct proc_dir_entry *entry = NULL; + struct acpi_device *device = NULL; ACPI_FUNCTION_TRACE("acpi_cpufreq_addfile"); @@ -527,11 +513,12 @@ acpi_cpufreq_add_file ( /* add file 'performance' [R/W] */ entry = create_proc_entry(ACPI_PROCESSOR_FILE_PERFORMANCE, - S_IFREG|S_IRUGO|S_IWUSR, acpi_device_dir(device)); + S_IFREG | S_IRUGO | S_IWUSR, + acpi_device_dir(device)); if (!entry) ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create '%s' fs entry\n", - ACPI_PROCESSOR_FILE_PERFORMANCE)); + "Unable to create '%s' fs entry\n", + ACPI_PROCESSOR_FILE_PERFORMANCE)); else { entry->proc_fops = &acpi_processor_perf_fops; entry->proc_fops->write = acpi_processor_write_performance; @@ -541,11 +528,9 @@ acpi_cpufreq_add_file ( return_VOID; } -static void -acpi_cpufreq_remove_file ( - struct acpi_processor *pr) +static void acpi_cpufreq_remove_file(struct acpi_processor *pr) { - struct acpi_device *device = NULL; + struct acpi_device *device = NULL; ACPI_FUNCTION_TRACE("acpi_cpufreq_addfile"); @@ -554,21 +539,25 @@ acpi_cpufreq_remove_file ( /* remove file 'performance' */ remove_proc_entry(ACPI_PROCESSOR_FILE_PERFORMANCE, - acpi_device_dir(device)); + acpi_device_dir(device)); return_VOID; } #else -static void acpi_cpufreq_add_file (struct acpi_processor *pr) { return; } -static void acpi_cpufreq_remove_file (struct acpi_processor *pr) { return; } -#endif /* CONFIG_X86_ACPI_CPUFREQ_PROC_INTF */ - +static void acpi_cpufreq_add_file(struct acpi_processor *pr) +{ + return; +} +static void acpi_cpufreq_remove_file(struct acpi_processor *pr) +{ + return; +} +#endif /* CONFIG_X86_ACPI_CPUFREQ_PROC_INTF */ int -acpi_processor_register_performance ( - struct acpi_processor_performance * performance, - unsigned int cpu) +acpi_processor_register_performance(struct acpi_processor_performance + *performance, unsigned int cpu) { struct acpi_processor *pr; @@ -603,13 +592,12 @@ acpi_processor_register_performance ( up(&performance_sem); return_VALUE(0); } -EXPORT_SYMBOL(acpi_processor_register_performance); +EXPORT_SYMBOL(acpi_processor_register_performance); void -acpi_processor_unregister_performance ( - struct acpi_processor_performance * performance, - unsigned int cpu) +acpi_processor_unregister_performance(struct acpi_processor_performance + *performance, unsigned int cpu) { struct acpi_processor *pr; @@ -632,4 +620,5 @@ acpi_processor_unregister_performance ( return_VOID; } + EXPORT_SYMBOL(acpi_processor_unregister_performance); diff --git a/drivers/acpi/processor_thermal.c b/drivers/acpi/processor_thermal.c index 12bd980a12e..37528c3b64b 100644 --- a/drivers/acpi/processor_thermal.c +++ b/drivers/acpi/processor_thermal.c @@ -43,20 +43,16 @@ #define ACPI_PROCESSOR_CLASS "processor" #define ACPI_PROCESSOR_DRIVER_NAME "ACPI Processor Driver" #define _COMPONENT ACPI_PROCESSOR_COMPONENT -ACPI_MODULE_NAME ("acpi_processor") - +ACPI_MODULE_NAME("acpi_processor") /* -------------------------------------------------------------------------- Limit Interface -------------------------------------------------------------------------- */ - -static int -acpi_processor_apply_limit ( - struct acpi_processor* pr) +static int acpi_processor_apply_limit(struct acpi_processor *pr) { - int result = 0; - u16 px = 0; - u16 tx = 0; + int result = 0; + u16 px = 0; + u16 tx = 0; ACPI_FUNCTION_TRACE("acpi_processor_apply_limit"); @@ -80,19 +76,17 @@ acpi_processor_apply_limit ( pr->limit.state.px = px; pr->limit.state.tx = tx; - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Processor [%d] limit set to (P%d:T%d)\n", - pr->id, - pr->limit.state.px, - pr->limit.state.tx)); + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "Processor [%d] limit set to (P%d:T%d)\n", pr->id, + pr->limit.state.px, pr->limit.state.tx)); -end: + end: if (result) ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unable to set limit\n")); return_VALUE(result); } - #ifdef CONFIG_CPU_FREQ /* If a passive cooling situation is detected, primarily CPUfreq is used, as it @@ -104,7 +98,6 @@ end: static unsigned int cpufreq_thermal_reduction_pctg[NR_CPUS]; static unsigned int acpi_thermal_cpufreq_is_init = 0; - static int cpu_has_cpufreq(unsigned int cpu) { struct cpufreq_policy policy; @@ -115,7 +108,6 @@ static int cpu_has_cpufreq(unsigned int cpu) return 0; } - static int acpi_thermal_cpufreq_increase(unsigned int cpu) { if (!cpu_has_cpufreq(cpu)) @@ -130,7 +122,6 @@ static int acpi_thermal_cpufreq_increase(unsigned int cpu) return -ERANGE; } - static int acpi_thermal_cpufreq_decrease(unsigned int cpu) { if (!cpu_has_cpufreq(cpu)) @@ -145,11 +136,8 @@ static int acpi_thermal_cpufreq_decrease(unsigned int cpu) return -ERANGE; } - -static int acpi_thermal_cpufreq_notifier( - struct notifier_block *nb, - unsigned long event, - void *data) +static int acpi_thermal_cpufreq_notifier(struct notifier_block *nb, + unsigned long event, void *data) { struct cpufreq_policy *policy = data; unsigned long max_freq = 0; @@ -157,68 +145,74 @@ static int acpi_thermal_cpufreq_notifier( if (event != CPUFREQ_ADJUST) goto out; - max_freq = (policy->cpuinfo.max_freq * (100 - cpufreq_thermal_reduction_pctg[policy->cpu])) / 100; + max_freq = + (policy->cpuinfo.max_freq * + (100 - cpufreq_thermal_reduction_pctg[policy->cpu])) / 100; cpufreq_verify_within_limits(policy, 0, max_freq); - out: + out: return 0; } - static struct notifier_block acpi_thermal_cpufreq_notifier_block = { .notifier_call = acpi_thermal_cpufreq_notifier, }; - -void acpi_thermal_cpufreq_init(void) { +void acpi_thermal_cpufreq_init(void) +{ int i; - for (i=0; i ACPI_PROCESSOR_LIMIT_DECREMENT)) + || (type > ACPI_PROCESSOR_LIMIT_DECREMENT)) return_VALUE(-EINVAL); result = acpi_bus_get_device(handle, &device); if (result) return_VALUE(result); - pr = (struct acpi_processor *) acpi_driver_data(device); + pr = (struct acpi_processor *)acpi_driver_data(device); if (!pr) return_VALUE(-ENODEV); @@ -250,12 +244,12 @@ acpi_processor_set_thermal_limit ( goto end; else if (result == -ERANGE) ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "At maximum performance state\n")); + "At maximum performance state\n")); if (pr->flags.throttling) { if (tx == (pr->throttling.state_count - 1)) ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "At maximum throttling state\n")); + "At maximum throttling state\n")); else tx++; } @@ -267,7 +261,7 @@ acpi_processor_set_thermal_limit ( if (pr->flags.throttling) { if (tx == 0) ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "At minimum throttling state\n")); + "At minimum throttling state\n")); else { tx--; goto end; @@ -277,12 +271,12 @@ acpi_processor_set_thermal_limit ( result = acpi_thermal_cpufreq_decrease(pr->id); if (result == -ERANGE) ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "At minimum performance state\n")); + "At minimum performance state\n")); break; } -end: + end: if (pr->flags.throttling) { pr->limit.thermal.px = 0; pr->limit.thermal.tx = tx; @@ -293,18 +287,14 @@ end: "Unable to set thermal limit\n")); ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Thermal limit now (P%d:T%d)\n", - pr->limit.thermal.px, - pr->limit.thermal.tx)); + pr->limit.thermal.px, pr->limit.thermal.tx)); } else result = 0; return_VALUE(result); } - -int -acpi_processor_get_limit_info ( - struct acpi_processor *pr) +int acpi_processor_get_limit_info(struct acpi_processor *pr) { ACPI_FUNCTION_TRACE("acpi_processor_get_limit_info"); @@ -317,12 +307,11 @@ acpi_processor_get_limit_info ( return_VALUE(0); } - /* /proc interface */ static int acpi_processor_limit_seq_show(struct seq_file *seq, void *offset) { - struct acpi_processor *pr = (struct acpi_processor *)seq->private; + struct acpi_processor *pr = (struct acpi_processor *)seq->private; ACPI_FUNCTION_TRACE("acpi_processor_limit_seq_show"); @@ -335,34 +324,32 @@ static int acpi_processor_limit_seq_show(struct seq_file *seq, void *offset) } seq_printf(seq, "active limit: P%d:T%d\n" - "user limit: P%d:T%d\n" - "thermal limit: P%d:T%d\n", - pr->limit.state.px, pr->limit.state.tx, - pr->limit.user.px, pr->limit.user.tx, - pr->limit.thermal.px, pr->limit.thermal.tx); + "user limit: P%d:T%d\n" + "thermal limit: P%d:T%d\n", + pr->limit.state.px, pr->limit.state.tx, + pr->limit.user.px, pr->limit.user.tx, + pr->limit.thermal.px, pr->limit.thermal.tx); -end: + end: return_VALUE(0); } static int acpi_processor_limit_open_fs(struct inode *inode, struct file *file) { return single_open(file, acpi_processor_limit_seq_show, - PDE(inode)->data); + PDE(inode)->data); } -ssize_t acpi_processor_write_limit ( - struct file *file, - const char __user *buffer, - size_t count, - loff_t *data) +ssize_t acpi_processor_write_limit(struct file * file, + const char __user * buffer, + size_t count, loff_t * data) { - int result = 0; - struct seq_file *m = (struct seq_file *)file->private_data; - struct acpi_processor *pr = (struct acpi_processor *)m->private; - char limit_string[25] = {'\0'}; - int px = 0; - int tx = 0; + int result = 0; + struct seq_file *m = (struct seq_file *)file->private_data; + struct acpi_processor *pr = (struct acpi_processor *)m->private; + char limit_string[25] = { '\0' }; + int px = 0; + int tx = 0; ACPI_FUNCTION_TRACE("acpi_processor_write_limit"); @@ -396,11 +383,9 @@ ssize_t acpi_processor_write_limit ( return_VALUE(count); } - struct file_operations acpi_processor_limit_fops = { - .open = acpi_processor_limit_open_fs, - .read = seq_read, - .llseek = seq_lseek, - .release = single_release, + .open = acpi_processor_limit_open_fs, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, }; - diff --git a/drivers/acpi/processor_throttling.c b/drivers/acpi/processor_throttling.c index be9f569d39d..74a52d4e79a 100644 --- a/drivers/acpi/processor_throttling.c +++ b/drivers/acpi/processor_throttling.c @@ -43,21 +43,17 @@ #define ACPI_PROCESSOR_CLASS "processor" #define ACPI_PROCESSOR_DRIVER_NAME "ACPI Processor Driver" #define _COMPONENT ACPI_PROCESSOR_COMPONENT -ACPI_MODULE_NAME ("acpi_processor") - +ACPI_MODULE_NAME("acpi_processor") /* -------------------------------------------------------------------------- Throttling Control -------------------------------------------------------------------------- */ - -static int -acpi_processor_get_throttling ( - struct acpi_processor *pr) +static int acpi_processor_get_throttling(struct acpi_processor *pr) { - int state = 0; - u32 value = 0; - u32 duty_mask = 0; - u32 duty_value = 0; + int state = 0; + u32 value = 0; + u32 duty_mask = 0; + u32 duty_value = 0; ACPI_FUNCTION_TRACE("acpi_processor_get_throttling"); @@ -86,7 +82,7 @@ acpi_processor_get_throttling ( duty_value >>= pr->throttling.duty_offset; if (duty_value) - state = pr->throttling.state_count-duty_value; + state = pr->throttling.state_count - duty_value; } pr->throttling.state = state; @@ -94,20 +90,17 @@ acpi_processor_get_throttling ( local_irq_enable(); ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "Throttling state is T%d (%d%% throttling applied)\n", - state, pr->throttling.states[state].performance)); + "Throttling state is T%d (%d%% throttling applied)\n", + state, pr->throttling.states[state].performance)); return_VALUE(0); } - -int acpi_processor_set_throttling ( - struct acpi_processor *pr, - int state) +int acpi_processor_set_throttling(struct acpi_processor *pr, int state) { - u32 value = 0; - u32 duty_mask = 0; - u32 duty_value = 0; + u32 value = 0; + u32 duty_mask = 0; + u32 duty_value = 0; ACPI_FUNCTION_TRACE("acpi_processor_set_throttling"); @@ -168,28 +161,26 @@ int acpi_processor_set_throttling ( local_irq_enable(); ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "Throttling state set to T%d (%d%%)\n", state, - (pr->throttling.states[state].performance?pr->throttling.states[state].performance/10:0))); + "Throttling state set to T%d (%d%%)\n", state, + (pr->throttling.states[state].performance ? pr-> + throttling.states[state].performance / 10 : 0))); return_VALUE(0); } - -int -acpi_processor_get_throttling_info ( - struct acpi_processor *pr) +int acpi_processor_get_throttling_info(struct acpi_processor *pr) { - int result = 0; - int step = 0; - int i = 0; + int result = 0; + int step = 0; + int i = 0; ACPI_FUNCTION_TRACE("acpi_processor_get_throttling_info"); ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "pblk_address[0x%08x] duty_offset[%d] duty_width[%d]\n", - pr->throttling.address, - pr->throttling.duty_offset, - pr->throttling.duty_width)); + "pblk_address[0x%08x] duty_offset[%d] duty_width[%d]\n", + pr->throttling.address, + pr->throttling.duty_offset, + pr->throttling.duty_width)); if (!pr) return_VALUE(-EINVAL); @@ -199,14 +190,12 @@ acpi_processor_get_throttling_info ( if (!pr->throttling.address) { ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No throttling register\n")); return_VALUE(0); - } - else if (!pr->throttling.duty_width) { + } else if (!pr->throttling.duty_width) { ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No throttling states\n")); return_VALUE(0); } /* TBD: Support duty_cycle values that span bit 4. */ - else if ((pr->throttling.duty_offset - + pr->throttling.duty_width) > 4) { + else if ((pr->throttling.duty_offset + pr->throttling.duty_width) > 4) { ACPI_DEBUG_PRINT((ACPI_DB_WARN, "duty_cycle spans bit 4\n")); return_VALUE(0); } @@ -218,7 +207,7 @@ acpi_processor_get_throttling_info ( */ if (errata.piix4.throttle) { ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "Throttling not supported on PIIX4 A- or B-step\n")); + "Throttling not supported on PIIX4 A- or B-step\n")); return_VALUE(0); } @@ -232,13 +221,13 @@ acpi_processor_get_throttling_info ( step = (1000 / pr->throttling.state_count); - for (i=0; ithrottling.state_count; i++) { + for (i = 0; i < pr->throttling.state_count; i++) { pr->throttling.states[i].performance = step * i; pr->throttling.states[i].power = step * i; } ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found %d throttling states\n", - pr->throttling.state_count)); + pr->throttling.state_count)); pr->flags.throttling = 1; @@ -253,28 +242,29 @@ acpi_processor_get_throttling_info ( goto end; if (pr->throttling.state) { - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Disabling throttling (was T%d)\n", - pr->throttling.state)); + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "Disabling throttling (was T%d)\n", + pr->throttling.state)); result = acpi_processor_set_throttling(pr, 0); if (result) goto end; } -end: + end: if (result) pr->flags.throttling = 0; return_VALUE(result); } - /* proc interface */ -static int acpi_processor_throttling_seq_show(struct seq_file *seq, void *offset) +static int acpi_processor_throttling_seq_show(struct seq_file *seq, + void *offset) { - struct acpi_processor *pr = (struct acpi_processor *)seq->private; - int i = 0; - int result = 0; + struct acpi_processor *pr = (struct acpi_processor *)seq->private; + int i = 0; + int result = 0; ACPI_FUNCTION_TRACE("acpi_processor_throttling_seq_show"); @@ -289,41 +279,41 @@ static int acpi_processor_throttling_seq_show(struct seq_file *seq, void *offset result = acpi_processor_get_throttling(pr); if (result) { - seq_puts(seq, "Could not determine current throttling state.\n"); + seq_puts(seq, + "Could not determine current throttling state.\n"); goto end; } seq_printf(seq, "state count: %d\n" - "active state: T%d\n", - pr->throttling.state_count, - pr->throttling.state); + "active state: T%d\n", + pr->throttling.state_count, pr->throttling.state); seq_puts(seq, "states:\n"); for (i = 0; i < pr->throttling.state_count; i++) seq_printf(seq, " %cT%d: %02d%%\n", - (i == pr->throttling.state?'*':' '), i, - (pr->throttling.states[i].performance?pr->throttling.states[i].performance/10:0)); + (i == pr->throttling.state ? '*' : ' '), i, + (pr->throttling.states[i].performance ? pr-> + throttling.states[i].performance / 10 : 0)); -end: + end: return_VALUE(0); } -static int acpi_processor_throttling_open_fs(struct inode *inode, struct file *file) +static int acpi_processor_throttling_open_fs(struct inode *inode, + struct file *file) { return single_open(file, acpi_processor_throttling_seq_show, - PDE(inode)->data); + PDE(inode)->data); } -ssize_t acpi_processor_write_throttling ( - struct file *file, - const char __user *buffer, - size_t count, - loff_t *data) +ssize_t acpi_processor_write_throttling(struct file * file, + const char __user * buffer, + size_t count, loff_t * data) { - int result = 0; - struct seq_file *m = (struct seq_file *)file->private_data; - struct acpi_processor *pr = (struct acpi_processor *)m->private; - char state_string[12] = {'\0'}; + int result = 0; + struct seq_file *m = (struct seq_file *)file->private_data; + struct acpi_processor *pr = (struct acpi_processor *)m->private; + char state_string[12] = { '\0' }; ACPI_FUNCTION_TRACE("acpi_processor_write_throttling"); @@ -336,7 +326,8 @@ ssize_t acpi_processor_write_throttling ( state_string[count] = '\0'; result = acpi_processor_set_throttling(pr, - simple_strtoul(state_string, NULL, 0)); + simple_strtoul(state_string, + NULL, 0)); if (result) return_VALUE(result); @@ -344,8 +335,8 @@ ssize_t acpi_processor_write_throttling ( } struct file_operations acpi_processor_throttling_fops = { - .open = acpi_processor_throttling_open_fs, - .read = seq_read, - .llseek = seq_lseek, - .release = single_release, + .open = acpi_processor_throttling_open_fs, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, }; diff --git a/drivers/acpi/resources/rsaddr.c b/drivers/acpi/resources/rsaddr.c index 55d264771c4..4cf46e1ee01 100644 --- a/drivers/acpi/resources/rsaddr.c +++ b/drivers/acpi/resources/rsaddr.c @@ -41,13 +41,11 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include #include #define _COMPONENT ACPI_RESOURCES - ACPI_MODULE_NAME ("rsaddr") - +ACPI_MODULE_NAME("rsaddr") /******************************************************************************* * @@ -69,36 +67,31 @@ * number of bytes consumed from the byte stream. * ******************************************************************************/ - acpi_status -acpi_rs_address16_resource ( - u8 *byte_stream_buffer, - acpi_size *bytes_consumed, - u8 **output_buffer, - acpi_size *structure_size) +acpi_rs_address16_resource(u8 * byte_stream_buffer, + acpi_size * bytes_consumed, + u8 ** output_buffer, acpi_size * structure_size) { - u32 index; - u16 temp16; - u8 temp8; - u8 *temp_ptr; - u8 *buffer = byte_stream_buffer; - struct acpi_resource *output_struct = (void *) *output_buffer; - acpi_size struct_size = ACPI_SIZEOF_RESOURCE ( - struct acpi_resource_address16); - - - ACPI_FUNCTION_TRACE ("rs_address16_resource"); + u32 index; + u16 temp16; + u8 temp8; + u8 *temp_ptr; + u8 *buffer = byte_stream_buffer; + struct acpi_resource *output_struct = (void *)*output_buffer; + acpi_size struct_size = + ACPI_SIZEOF_RESOURCE(struct acpi_resource_address16); + ACPI_FUNCTION_TRACE("rs_address16_resource"); /* Point past the Descriptor to get the number of bytes consumed */ buffer += 1; - ACPI_MOVE_16_TO_16 (&temp16, buffer); + ACPI_MOVE_16_TO_16(&temp16, buffer); /* Validate minimum descriptor length */ if (temp16 < 13) { - return_ACPI_STATUS (AE_AML_BAD_RESOURCE_LENGTH); + return_ACPI_STATUS(AE_AML_BAD_RESOURCE_LENGTH); } *bytes_consumed = temp16 + 3; @@ -112,7 +105,7 @@ acpi_rs_address16_resource ( /* Values 0-2 and 0xC0-0xFF are valid */ if ((temp8 > 2) && (temp8 < 0xC0)) { - return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE); + return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE); } output_struct->data.address16.resource_type = temp8; @@ -144,19 +137,18 @@ acpi_rs_address16_resource ( temp8 = *buffer; if (ACPI_MEMORY_RANGE == output_struct->data.address16.resource_type) { - output_struct->data.address16.attribute.memory.read_write_attribute = - (u16) (temp8 & 0x01); + output_struct->data.address16.attribute.memory. + read_write_attribute = (u16) (temp8 & 0x01); output_struct->data.address16.attribute.memory.cache_attribute = - (u16) ((temp8 >> 1) & 0x03); - } - else { - if (ACPI_IO_RANGE == output_struct->data.address16.resource_type) { - output_struct->data.address16.attribute.io.range_attribute = - (u16) (temp8 & 0x03); - output_struct->data.address16.attribute.io.translation_attribute = - (u16) ((temp8 >> 4) & 0x03); - } - else { + (u16) ((temp8 >> 1) & 0x03); + } else { + if (ACPI_IO_RANGE == + output_struct->data.address16.resource_type) { + output_struct->data.address16.attribute.io. + range_attribute = (u16) (temp8 & 0x03); + output_struct->data.address16.attribute.io. + translation_attribute = (u16) ((temp8 >> 4) & 0x03); + } else { /* BUS_NUMBER_RANGE == Address16.Data->resource_type */ /* Nothing needs to be filled in */ } @@ -165,28 +157,31 @@ acpi_rs_address16_resource ( /* Get Granularity (Bytes 6-7) */ buffer += 1; - ACPI_MOVE_16_TO_32 (&output_struct->data.address16.granularity, buffer); + ACPI_MOVE_16_TO_32(&output_struct->data.address16.granularity, buffer); /* Get min_address_range (Bytes 8-9) */ buffer += 2; - ACPI_MOVE_16_TO_32 (&output_struct->data.address16.min_address_range, buffer); + ACPI_MOVE_16_TO_32(&output_struct->data.address16.min_address_range, + buffer); /* Get max_address_range (Bytes 10-11) */ buffer += 2; - ACPI_MOVE_16_TO_32 (&output_struct->data.address16.max_address_range, buffer); + ACPI_MOVE_16_TO_32(&output_struct->data.address16.max_address_range, + buffer); /* Get address_translation_offset (Bytes 12-13) */ buffer += 2; - ACPI_MOVE_16_TO_32 (&output_struct->data.address16.address_translation_offset, - buffer); + ACPI_MOVE_16_TO_32(&output_struct->data.address16. + address_translation_offset, buffer); /* Get address_length (Bytes 14-15) */ buffer += 2; - ACPI_MOVE_16_TO_32 (&output_struct->data.address16.address_length, buffer); + ACPI_MOVE_16_TO_32(&output_struct->data.address16.address_length, + buffer); /* Resource Source Index (if present) */ @@ -206,7 +201,8 @@ acpi_rs_address16_resource ( /* Dereference the Index */ temp8 = *buffer; - output_struct->data.address16.resource_source.index = (u32) temp8; + output_struct->data.address16.resource_source.index = + (u32) temp8; /* Point to the String */ @@ -215,10 +211,10 @@ acpi_rs_address16_resource ( /* Point the String pointer to the end of this structure */ output_struct->data.address16.resource_source.string_ptr = - (char *)((u8 * )output_struct + struct_size); + (char *)((u8 *) output_struct + struct_size); temp_ptr = (u8 *) - output_struct->data.address16.resource_source.string_ptr; + output_struct->data.address16.resource_source.string_ptr; /* Copy the string into the buffer */ @@ -236,7 +232,8 @@ acpi_rs_address16_resource ( *temp_ptr = 0x00; - output_struct->data.address16.resource_source.string_length = index + 1; + output_struct->data.address16.resource_source.string_length = + index + 1; /* * In order for the struct_size to fall on a 32-bit boundary, @@ -244,9 +241,8 @@ acpi_rs_address16_resource ( * struct_size to the next 32-bit boundary. */ temp8 = (u8) (index + 1); - struct_size += ACPI_ROUND_UP_to_32_bITS (temp8); - } - else { + struct_size += ACPI_ROUND_UP_to_32_bITS(temp8); + } else { output_struct->data.address16.resource_source.index = 0x00; output_struct->data.address16.resource_source.string_length = 0; output_struct->data.address16.resource_source.string_ptr = NULL; @@ -259,10 +255,9 @@ acpi_rs_address16_resource ( /* Return the final size of the structure */ *structure_size = struct_size; - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_rs_address16_stream @@ -280,20 +275,16 @@ acpi_rs_address16_resource ( ******************************************************************************/ acpi_status -acpi_rs_address16_stream ( - struct acpi_resource *linked_list, - u8 **output_buffer, - acpi_size *bytes_consumed) +acpi_rs_address16_stream(struct acpi_resource *linked_list, + u8 ** output_buffer, acpi_size * bytes_consumed) { - u8 *buffer = *output_buffer; - u8 *length_field; - u8 temp8; - char *temp_pointer = NULL; - acpi_size actual_bytes; - - - ACPI_FUNCTION_TRACE ("rs_address16_stream"); + u8 *buffer = *output_buffer; + u8 *length_field; + u8 temp8; + char *temp_pointer = NULL; + acpi_size actual_bytes; + ACPI_FUNCTION_TRACE("rs_address16_stream"); /* The descriptor field is static */ @@ -328,20 +319,19 @@ acpi_rs_address16_stream ( if (ACPI_MEMORY_RANGE == linked_list->data.address16.resource_type) { temp8 = (u8) - (linked_list->data.address16.attribute.memory.read_write_attribute & - 0x01); + (linked_list->data.address16.attribute.memory. + read_write_attribute & 0x01); temp8 |= - (linked_list->data.address16.attribute.memory.cache_attribute & - 0x03) << 1; - } - else if (ACPI_IO_RANGE == linked_list->data.address16.resource_type) { + (linked_list->data.address16.attribute.memory. + cache_attribute & 0x03) << 1; + } else if (ACPI_IO_RANGE == linked_list->data.address16.resource_type) { temp8 = (u8) - (linked_list->data.address16.attribute.io.range_attribute & - 0x03); + (linked_list->data.address16.attribute.io.range_attribute & + 0x03); temp8 |= - (linked_list->data.address16.attribute.io.translation_attribute & - 0x03) << 4; + (linked_list->data.address16.attribute.io. + translation_attribute & 0x03) << 4; } *buffer = temp8; @@ -349,28 +339,31 @@ acpi_rs_address16_stream ( /* Set the address space granularity */ - ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.address16.granularity); + ACPI_MOVE_32_TO_16(buffer, &linked_list->data.address16.granularity); buffer += 2; /* Set the address range minimum */ - ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.address16.min_address_range); + ACPI_MOVE_32_TO_16(buffer, + &linked_list->data.address16.min_address_range); buffer += 2; /* Set the address range maximum */ - ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.address16.max_address_range); + ACPI_MOVE_32_TO_16(buffer, + &linked_list->data.address16.max_address_range); buffer += 2; /* Set the address translation offset */ - ACPI_MOVE_32_TO_16 (buffer, - &linked_list->data.address16.address_translation_offset); + ACPI_MOVE_32_TO_16(buffer, + &linked_list->data.address16. + address_translation_offset); buffer += 2; /* Set the address length */ - ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.address16.address_length); + ACPI_MOVE_32_TO_16(buffer, &linked_list->data.address16.address_length); buffer += 2; /* Resource Source Index and Resource Source are optional */ @@ -381,24 +374,27 @@ acpi_rs_address16_stream ( *buffer = temp8; buffer += 1; - temp_pointer = (char *) buffer; + temp_pointer = (char *)buffer; /* Copy the string */ - ACPI_STRCPY (temp_pointer, - linked_list->data.address16.resource_source.string_ptr); + ACPI_STRCPY(temp_pointer, + linked_list->data.address16.resource_source. + string_ptr); /* * Buffer needs to be set to the length of the sting + one for the * terminating null */ - buffer += (acpi_size)(ACPI_STRLEN ( - linked_list->data.address16.resource_source.string_ptr) + 1); + buffer += + (acpi_size) (ACPI_STRLEN + (linked_list->data.address16.resource_source. + string_ptr) + 1); } /* Return the number of bytes consumed in this operation */ - actual_bytes = ACPI_PTR_DIFF (buffer, *output_buffer); + actual_bytes = ACPI_PTR_DIFF(buffer, *output_buffer); *bytes_consumed = actual_bytes; /* @@ -406,11 +402,10 @@ acpi_rs_address16_stream ( * minus the header size (3 bytes) */ actual_bytes -= 3; - ACPI_MOVE_SIZE_TO_16 (length_field, &actual_bytes); - return_ACPI_STATUS (AE_OK); + ACPI_MOVE_SIZE_TO_16(length_field, &actual_bytes); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_rs_address32_resource @@ -433,36 +428,32 @@ acpi_rs_address16_stream ( ******************************************************************************/ acpi_status -acpi_rs_address32_resource ( - u8 *byte_stream_buffer, - acpi_size *bytes_consumed, - u8 **output_buffer, - acpi_size *structure_size) +acpi_rs_address32_resource(u8 * byte_stream_buffer, + acpi_size * bytes_consumed, + u8 ** output_buffer, acpi_size * structure_size) { - u8 *buffer; - struct acpi_resource *output_struct= (void *) *output_buffer; - u16 temp16; - u8 temp8; - u8 *temp_ptr; - acpi_size struct_size; - u32 index; - - - ACPI_FUNCTION_TRACE ("rs_address32_resource"); + u8 *buffer; + struct acpi_resource *output_struct = (void *)*output_buffer; + u16 temp16; + u8 temp8; + u8 *temp_ptr; + acpi_size struct_size; + u32 index; + ACPI_FUNCTION_TRACE("rs_address32_resource"); buffer = byte_stream_buffer; - struct_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_address32); + struct_size = ACPI_SIZEOF_RESOURCE(struct acpi_resource_address32); /* Point past the Descriptor to get the number of bytes consumed */ buffer += 1; - ACPI_MOVE_16_TO_16 (&temp16, buffer); + ACPI_MOVE_16_TO_16(&temp16, buffer); /* Validate minimum descriptor length */ if (temp16 < 23) { - return_ACPI_STATUS (AE_AML_BAD_RESOURCE_LENGTH); + return_ACPI_STATUS(AE_AML_BAD_RESOURCE_LENGTH); } *bytes_consumed = temp16 + 3; @@ -476,7 +467,7 @@ acpi_rs_address32_resource ( /* Values 0-2 and 0xC0-0xFF are valid */ if ((temp8 > 2) && (temp8 < 0xC0)) { - return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE); + return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE); } output_struct->data.address32.resource_type = temp8; @@ -508,20 +499,19 @@ acpi_rs_address32_resource ( temp8 = *buffer; if (ACPI_MEMORY_RANGE == output_struct->data.address32.resource_type) { - output_struct->data.address32.attribute.memory.read_write_attribute = - (u16) (temp8 & 0x01); + output_struct->data.address32.attribute.memory. + read_write_attribute = (u16) (temp8 & 0x01); output_struct->data.address32.attribute.memory.cache_attribute = - (u16) ((temp8 >> 1) & 0x03); - } - else { - if (ACPI_IO_RANGE == output_struct->data.address32.resource_type) { - output_struct->data.address32.attribute.io.range_attribute = - (u16) (temp8 & 0x03); - output_struct->data.address32.attribute.io.translation_attribute = - (u16) ((temp8 >> 4) & 0x03); - } - else { + (u16) ((temp8 >> 1) & 0x03); + } else { + if (ACPI_IO_RANGE == + output_struct->data.address32.resource_type) { + output_struct->data.address32.attribute.io. + range_attribute = (u16) (temp8 & 0x03); + output_struct->data.address32.attribute.io. + translation_attribute = (u16) ((temp8 >> 4) & 0x03); + } else { /* BUS_NUMBER_RANGE == output_struct->Data.Address32.resource_type */ /* Nothing needs to be filled in */ } @@ -530,28 +520,31 @@ acpi_rs_address32_resource ( /* Get Granularity (Bytes 6-9) */ buffer += 1; - ACPI_MOVE_32_TO_32 (&output_struct->data.address32.granularity, buffer); + ACPI_MOVE_32_TO_32(&output_struct->data.address32.granularity, buffer); /* Get min_address_range (Bytes 10-13) */ buffer += 4; - ACPI_MOVE_32_TO_32 (&output_struct->data.address32.min_address_range, buffer); + ACPI_MOVE_32_TO_32(&output_struct->data.address32.min_address_range, + buffer); /* Get max_address_range (Bytes 14-17) */ buffer += 4; - ACPI_MOVE_32_TO_32 (&output_struct->data.address32.max_address_range, buffer); + ACPI_MOVE_32_TO_32(&output_struct->data.address32.max_address_range, + buffer); /* Get address_translation_offset (Bytes 18-21) */ buffer += 4; - ACPI_MOVE_32_TO_32 (&output_struct->data.address32.address_translation_offset, - buffer); + ACPI_MOVE_32_TO_32(&output_struct->data.address32. + address_translation_offset, buffer); /* Get address_length (Bytes 22-25) */ buffer += 4; - ACPI_MOVE_32_TO_32 (&output_struct->data.address32.address_length, buffer); + ACPI_MOVE_32_TO_32(&output_struct->data.address32.address_length, + buffer); /* Resource Source Index (if present) */ @@ -570,7 +563,7 @@ acpi_rs_address32_resource ( temp8 = *buffer; output_struct->data.address32.resource_source.index = - (u32) temp8; + (u32) temp8; /* Point to the String */ @@ -579,10 +572,10 @@ acpi_rs_address32_resource ( /* Point the String pointer to the end of this structure */ output_struct->data.address32.resource_source.string_ptr = - (char *)((u8 *)output_struct + struct_size); + (char *)((u8 *) output_struct + struct_size); temp_ptr = (u8 *) - output_struct->data.address32.resource_source.string_ptr; + output_struct->data.address32.resource_source.string_ptr; /* Copy the string into the buffer */ @@ -598,7 +591,8 @@ acpi_rs_address32_resource ( /* Add the terminating null */ *temp_ptr = 0x00; - output_struct->data.address32.resource_source.string_length = index + 1; + output_struct->data.address32.resource_source.string_length = + index + 1; /* * In order for the struct_size to fall on a 32-bit boundary, @@ -606,9 +600,8 @@ acpi_rs_address32_resource ( * struct_size to the next 32-bit boundary. */ temp8 = (u8) (index + 1); - struct_size += ACPI_ROUND_UP_to_32_bITS (temp8); - } - else { + struct_size += ACPI_ROUND_UP_to_32_bITS(temp8); + } else { output_struct->data.address32.resource_source.index = 0x00; output_struct->data.address32.resource_source.string_length = 0; output_struct->data.address32.resource_source.string_ptr = NULL; @@ -621,10 +614,9 @@ acpi_rs_address32_resource ( /* Return the final size of the structure */ *structure_size = struct_size; - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_rs_address32_stream @@ -642,19 +634,15 @@ acpi_rs_address32_resource ( ******************************************************************************/ acpi_status -acpi_rs_address32_stream ( - struct acpi_resource *linked_list, - u8 **output_buffer, - acpi_size *bytes_consumed) +acpi_rs_address32_stream(struct acpi_resource *linked_list, + u8 ** output_buffer, acpi_size * bytes_consumed) { - u8 *buffer; - u16 *length_field; - u8 temp8; - char *temp_pointer; - - - ACPI_FUNCTION_TRACE ("rs_address32_stream"); + u8 *buffer; + u16 *length_field; + u8 temp8; + char *temp_pointer; + ACPI_FUNCTION_TRACE("rs_address32_stream"); buffer = *output_buffer; @@ -665,7 +653,7 @@ acpi_rs_address32_stream ( /* Set a pointer to the Length field - to be filled in later */ - length_field = ACPI_CAST_PTR (u16, buffer); + length_field = ACPI_CAST_PTR(u16, buffer); buffer += 2; /* Set the Resource Type (Memory, Io, bus_number) */ @@ -691,20 +679,19 @@ acpi_rs_address32_stream ( if (ACPI_MEMORY_RANGE == linked_list->data.address32.resource_type) { temp8 = (u8) - (linked_list->data.address32.attribute.memory.read_write_attribute & - 0x01); + (linked_list->data.address32.attribute.memory. + read_write_attribute & 0x01); temp8 |= - (linked_list->data.address32.attribute.memory.cache_attribute & - 0x03) << 1; - } - else if (ACPI_IO_RANGE == linked_list->data.address32.resource_type) { + (linked_list->data.address32.attribute.memory. + cache_attribute & 0x03) << 1; + } else if (ACPI_IO_RANGE == linked_list->data.address32.resource_type) { temp8 = (u8) - (linked_list->data.address32.attribute.io.range_attribute & - 0x03); + (linked_list->data.address32.attribute.io.range_attribute & + 0x03); temp8 |= - (linked_list->data.address32.attribute.io.translation_attribute & - 0x03) << 4; + (linked_list->data.address32.attribute.io. + translation_attribute & 0x03) << 4; } *buffer = temp8; @@ -712,28 +699,31 @@ acpi_rs_address32_stream ( /* Set the address space granularity */ - ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.address32.granularity); + ACPI_MOVE_32_TO_32(buffer, &linked_list->data.address32.granularity); buffer += 4; /* Set the address range minimum */ - ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.address32.min_address_range); + ACPI_MOVE_32_TO_32(buffer, + &linked_list->data.address32.min_address_range); buffer += 4; /* Set the address range maximum */ - ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.address32.max_address_range); + ACPI_MOVE_32_TO_32(buffer, + &linked_list->data.address32.max_address_range); buffer += 4; /* Set the address translation offset */ - ACPI_MOVE_32_TO_32 (buffer, - &linked_list->data.address32.address_translation_offset); + ACPI_MOVE_32_TO_32(buffer, + &linked_list->data.address32. + address_translation_offset); buffer += 4; /* Set the address length */ - ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.address32.address_length); + ACPI_MOVE_32_TO_32(buffer, &linked_list->data.address32.address_length); buffer += 4; /* Resource Source Index and Resource Source are optional */ @@ -744,34 +734,36 @@ acpi_rs_address32_stream ( *buffer = temp8; buffer += 1; - temp_pointer = (char *) buffer; + temp_pointer = (char *)buffer; /* Copy the string */ - ACPI_STRCPY (temp_pointer, - linked_list->data.address32.resource_source.string_ptr); + ACPI_STRCPY(temp_pointer, + linked_list->data.address32.resource_source. + string_ptr); /* * Buffer needs to be set to the length of the sting + one for the * terminating null */ - buffer += (acpi_size)(ACPI_STRLEN ( - linked_list->data.address32.resource_source.string_ptr) + 1); + buffer += + (acpi_size) (ACPI_STRLEN + (linked_list->data.address32.resource_source. + string_ptr) + 1); } /* Return the number of bytes consumed in this operation */ - *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); + *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer); /* * Set the length field to the number of bytes consumed * minus the header size (3 bytes) */ *length_field = (u16) (*bytes_consumed - 3); - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_rs_address64_resource @@ -794,38 +786,34 @@ acpi_rs_address32_stream ( ******************************************************************************/ acpi_status -acpi_rs_address64_resource ( - u8 *byte_stream_buffer, - acpi_size *bytes_consumed, - u8 **output_buffer, - acpi_size *structure_size) +acpi_rs_address64_resource(u8 * byte_stream_buffer, + acpi_size * bytes_consumed, + u8 ** output_buffer, acpi_size * structure_size) { - u8 *buffer; - struct acpi_resource *output_struct = (void *) *output_buffer; - u16 temp16; - u8 temp8; - u8 resource_type; - u8 *temp_ptr; - acpi_size struct_size; - u32 index; - - - ACPI_FUNCTION_TRACE ("rs_address64_resource"); + u8 *buffer; + struct acpi_resource *output_struct = (void *)*output_buffer; + u16 temp16; + u8 temp8; + u8 resource_type; + u8 *temp_ptr; + acpi_size struct_size; + u32 index; + ACPI_FUNCTION_TRACE("rs_address64_resource"); buffer = byte_stream_buffer; - struct_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_address64); + struct_size = ACPI_SIZEOF_RESOURCE(struct acpi_resource_address64); resource_type = *buffer; /* Point past the Descriptor to get the number of bytes consumed */ buffer += 1; - ACPI_MOVE_16_TO_16 (&temp16, buffer); + ACPI_MOVE_16_TO_16(&temp16, buffer); /* Validate minimum descriptor length */ if (temp16 < 43) { - return_ACPI_STATUS (AE_AML_BAD_RESOURCE_LENGTH); + return_ACPI_STATUS(AE_AML_BAD_RESOURCE_LENGTH); } *bytes_consumed = temp16 + 3; @@ -839,7 +827,7 @@ acpi_rs_address64_resource ( /* Values 0-2 and 0xC0-0xFF are valid */ if ((temp8 > 2) && (temp8 < 0xC0)) { - return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE); + return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE); } output_struct->data.address64.resource_type = temp8; @@ -871,20 +859,19 @@ acpi_rs_address64_resource ( temp8 = *buffer; if (ACPI_MEMORY_RANGE == output_struct->data.address64.resource_type) { - output_struct->data.address64.attribute.memory.read_write_attribute = - (u16) (temp8 & 0x01); + output_struct->data.address64.attribute.memory. + read_write_attribute = (u16) (temp8 & 0x01); output_struct->data.address64.attribute.memory.cache_attribute = - (u16) ((temp8 >> 1) & 0x03); - } - else { - if (ACPI_IO_RANGE == output_struct->data.address64.resource_type) { - output_struct->data.address64.attribute.io.range_attribute = - (u16) (temp8 & 0x03); - output_struct->data.address64.attribute.io.translation_attribute = - (u16) ((temp8 >> 4) & 0x03); - } - else { + (u16) ((temp8 >> 1) & 0x03); + } else { + if (ACPI_IO_RANGE == + output_struct->data.address64.resource_type) { + output_struct->data.address64.attribute.io. + range_attribute = (u16) (temp8 & 0x03); + output_struct->data.address64.attribute.io. + translation_attribute = (u16) ((temp8 >> 4) & 0x03); + } else { /* BUS_NUMBER_RANGE == output_struct->Data.Address64.resource_type */ /* Nothing needs to be filled in */ } @@ -899,28 +886,31 @@ acpi_rs_address64_resource ( /* Get Granularity (Bytes 6-13) or (Bytes 8-15) */ buffer += 1; - ACPI_MOVE_64_TO_64 (&output_struct->data.address64.granularity, buffer); + ACPI_MOVE_64_TO_64(&output_struct->data.address64.granularity, buffer); /* Get min_address_range (Bytes 14-21) or (Bytes 16-23) */ buffer += 8; - ACPI_MOVE_64_TO_64 (&output_struct->data.address64.min_address_range, buffer); + ACPI_MOVE_64_TO_64(&output_struct->data.address64.min_address_range, + buffer); /* Get max_address_range (Bytes 22-29) or (Bytes 24-31) */ buffer += 8; - ACPI_MOVE_64_TO_64 (&output_struct->data.address64.max_address_range, buffer); + ACPI_MOVE_64_TO_64(&output_struct->data.address64.max_address_range, + buffer); /* Get address_translation_offset (Bytes 30-37) or (Bytes 32-39) */ buffer += 8; - ACPI_MOVE_64_TO_64 (&output_struct->data.address64.address_translation_offset, - buffer); + ACPI_MOVE_64_TO_64(&output_struct->data.address64. + address_translation_offset, buffer); /* Get address_length (Bytes 38-45) or (Bytes 40-47) */ buffer += 8; - ACPI_MOVE_64_TO_64 (&output_struct->data.address64.address_length, buffer); + ACPI_MOVE_64_TO_64(&output_struct->data.address64.address_length, + buffer); output_struct->data.address64.resource_source.index = 0x00; output_struct->data.address64.resource_source.string_length = 0; @@ -930,11 +920,9 @@ acpi_rs_address64_resource ( /* Get type_specific_attribute (Bytes 48-55) */ buffer += 8; - ACPI_MOVE_64_TO_64 ( - &output_struct->data.address64.type_specific_attributes, - buffer); - } - else { + ACPI_MOVE_64_TO_64(&output_struct->data.address64. + type_specific_attributes, buffer); + } else { output_struct->data.address64.type_specific_attributes = 0; /* Resource Source Index (if present) */ @@ -956,7 +944,7 @@ acpi_rs_address64_resource ( temp8 = *buffer; output_struct->data.address64.resource_source.index = - (u32) temp8; + (u32) temp8; /* Point to the String */ @@ -964,11 +952,13 @@ acpi_rs_address64_resource ( /* Point the String pointer to the end of this structure */ - output_struct->data.address64.resource_source.string_ptr = - (char *)((u8 *)output_struct + struct_size); + output_struct->data.address64.resource_source. + string_ptr = + (char *)((u8 *) output_struct + struct_size); temp_ptr = (u8 *) - output_struct->data.address64.resource_source.string_ptr; + output_struct->data.address64.resource_source. + string_ptr; /* Copy the string into the buffer */ @@ -985,8 +975,8 @@ acpi_rs_address64_resource ( * Add the terminating null */ *temp_ptr = 0x00; - output_struct->data.address64.resource_source.string_length = - index + 1; + output_struct->data.address64.resource_source. + string_length = index + 1; /* * In order for the struct_size to fall on a 32-bit boundary, @@ -994,7 +984,7 @@ acpi_rs_address64_resource ( * struct_size to the next 32-bit boundary. */ temp8 = (u8) (index + 1); - struct_size += ACPI_ROUND_UP_to_32_bITS (temp8); + struct_size += ACPI_ROUND_UP_to_32_bITS(temp8); } } @@ -1005,10 +995,9 @@ acpi_rs_address64_resource ( /* Return the final size of the structure */ *structure_size = struct_size; - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_rs_address64_stream @@ -1026,19 +1015,15 @@ acpi_rs_address64_resource ( ******************************************************************************/ acpi_status -acpi_rs_address64_stream ( - struct acpi_resource *linked_list, - u8 **output_buffer, - acpi_size *bytes_consumed) +acpi_rs_address64_stream(struct acpi_resource *linked_list, + u8 ** output_buffer, acpi_size * bytes_consumed) { - u8 *buffer; - u16 *length_field; - u8 temp8; - char *temp_pointer; - - - ACPI_FUNCTION_TRACE ("rs_address64_stream"); + u8 *buffer; + u16 *length_field; + u8 temp8; + char *temp_pointer; + ACPI_FUNCTION_TRACE("rs_address64_stream"); buffer = *output_buffer; @@ -1049,7 +1034,7 @@ acpi_rs_address64_stream ( /* Set a pointer to the Length field - to be filled in later */ - length_field = ACPI_CAST_PTR (u16, buffer); + length_field = ACPI_CAST_PTR(u16, buffer); buffer += 2; /* Set the Resource Type (Memory, Io, bus_number) */ @@ -1075,20 +1060,19 @@ acpi_rs_address64_stream ( if (ACPI_MEMORY_RANGE == linked_list->data.address64.resource_type) { temp8 = (u8) - (linked_list->data.address64.attribute.memory.read_write_attribute & - 0x01); + (linked_list->data.address64.attribute.memory. + read_write_attribute & 0x01); temp8 |= - (linked_list->data.address64.attribute.memory.cache_attribute & - 0x03) << 1; - } - else if (ACPI_IO_RANGE == linked_list->data.address64.resource_type) { + (linked_list->data.address64.attribute.memory. + cache_attribute & 0x03) << 1; + } else if (ACPI_IO_RANGE == linked_list->data.address64.resource_type) { temp8 = (u8) - (linked_list->data.address64.attribute.io.range_attribute & - 0x03); + (linked_list->data.address64.attribute.io.range_attribute & + 0x03); temp8 |= - (linked_list->data.address64.attribute.io.range_attribute & - 0x03) << 4; + (linked_list->data.address64.attribute.io.range_attribute & + 0x03) << 4; } *buffer = temp8; @@ -1096,28 +1080,31 @@ acpi_rs_address64_stream ( /* Set the address space granularity */ - ACPI_MOVE_64_TO_64 (buffer, &linked_list->data.address64.granularity); + ACPI_MOVE_64_TO_64(buffer, &linked_list->data.address64.granularity); buffer += 8; /* Set the address range minimum */ - ACPI_MOVE_64_TO_64 (buffer, &linked_list->data.address64.min_address_range); + ACPI_MOVE_64_TO_64(buffer, + &linked_list->data.address64.min_address_range); buffer += 8; /* Set the address range maximum */ - ACPI_MOVE_64_TO_64 (buffer, &linked_list->data.address64.max_address_range); + ACPI_MOVE_64_TO_64(buffer, + &linked_list->data.address64.max_address_range); buffer += 8; /* Set the address translation offset */ - ACPI_MOVE_64_TO_64 (buffer, - &linked_list->data.address64.address_translation_offset); + ACPI_MOVE_64_TO_64(buffer, + &linked_list->data.address64. + address_translation_offset); buffer += 8; /* Set the address length */ - ACPI_MOVE_64_TO_64 (buffer, &linked_list->data.address64.address_length); + ACPI_MOVE_64_TO_64(buffer, &linked_list->data.address64.address_length); buffer += 8; /* Resource Source Index and Resource Source are optional */ @@ -1128,30 +1115,32 @@ acpi_rs_address64_stream ( *buffer = temp8; buffer += 1; - temp_pointer = (char *) buffer; + temp_pointer = (char *)buffer; /* Copy the string */ - ACPI_STRCPY (temp_pointer, - linked_list->data.address64.resource_source.string_ptr); + ACPI_STRCPY(temp_pointer, + linked_list->data.address64.resource_source. + string_ptr); /* * Buffer needs to be set to the length of the sting + one for the * terminating null */ - buffer += (acpi_size)(ACPI_STRLEN ( - linked_list->data.address64.resource_source.string_ptr) + 1); + buffer += + (acpi_size) (ACPI_STRLEN + (linked_list->data.address64.resource_source. + string_ptr) + 1); } /* Return the number of bytes consumed in this operation */ - *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); + *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer); /* * Set the length field to the number of bytes consumed * minus the header size (3 bytes) */ *length_field = (u16) (*bytes_consumed - 3); - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - diff --git a/drivers/acpi/resources/rscalc.c b/drivers/acpi/resources/rscalc.c index 98176f2fcb5..378f58390fc 100644 --- a/drivers/acpi/resources/rscalc.c +++ b/drivers/acpi/resources/rscalc.c @@ -41,15 +41,13 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include #include #include #include #define _COMPONENT ACPI_RESOURCES - ACPI_MODULE_NAME ("rscalc") - +ACPI_MODULE_NAME("rscalc") /******************************************************************************* * @@ -66,19 +64,15 @@ * the resource data. * ******************************************************************************/ - acpi_status -acpi_rs_get_byte_stream_length ( - struct acpi_resource *linked_list, - acpi_size *size_needed) +acpi_rs_get_byte_stream_length(struct acpi_resource *linked_list, + acpi_size * size_needed) { - acpi_size byte_stream_size_needed = 0; - acpi_size segment_size; - u8 done = FALSE; - - - ACPI_FUNCTION_TRACE ("rs_get_byte_stream_length"); + acpi_size byte_stream_size_needed = 0; + acpi_size segment_size; + u8 done = FALSE; + ACPI_FUNCTION_TRACE("rs_get_byte_stream_length"); while (!done) { /* Init the variable that will hold the size to add to the total. */ @@ -145,11 +139,11 @@ acpi_rs_get_byte_stream_length ( */ if (linked_list->data.vendor_specific.length > 7) { segment_size = 3; - } - else { + } else { segment_size = 1; } - segment_size += linked_list->data.vendor_specific.length; + segment_size += + linked_list->data.vendor_specific.length; break; case ACPI_RSTYPE_END_TAG: @@ -194,9 +188,11 @@ acpi_rs_get_byte_stream_length ( */ segment_size = 16; - if (linked_list->data.address16.resource_source.string_ptr) { + if (linked_list->data.address16.resource_source. + string_ptr) { segment_size += - linked_list->data.address16.resource_source.string_length; + linked_list->data.address16.resource_source. + string_length; segment_size++; } break; @@ -211,9 +207,11 @@ acpi_rs_get_byte_stream_length ( */ segment_size = 26; - if (linked_list->data.address32.resource_source.string_ptr) { + if (linked_list->data.address32.resource_source. + string_ptr) { segment_size += - linked_list->data.address32.resource_source.string_length; + linked_list->data.address32.resource_source. + string_length; segment_size++; } break; @@ -227,9 +225,11 @@ acpi_rs_get_byte_stream_length ( */ segment_size = 46; - if (linked_list->data.address64.resource_source.string_ptr) { + if (linked_list->data.address64.resource_source. + string_ptr) { segment_size += - linked_list->data.address64.resource_source.string_length; + linked_list->data.address64.resource_source. + string_length; segment_size++; } break; @@ -244,11 +244,14 @@ acpi_rs_get_byte_stream_length ( * Resource Source + 1 for the null. */ segment_size = 9 + (((acpi_size) - linked_list->data.extended_irq.number_of_interrupts - 1) * 4); + linked_list->data.extended_irq. + number_of_interrupts - 1) * 4); - if (linked_list->data.extended_irq.resource_source.string_ptr) { + if (linked_list->data.extended_irq.resource_source. + string_ptr) { segment_size += - linked_list->data.extended_irq.resource_source.string_length; + linked_list->data.extended_irq. + resource_source.string_length; segment_size++; } break; @@ -257,9 +260,9 @@ acpi_rs_get_byte_stream_length ( /* If we get here, everything is out of sync, exit with error */ - return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE); + return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE); - } /* switch (linked_list->Id) */ + } /* switch (linked_list->Id) */ /* Update the total */ @@ -267,17 +270,16 @@ acpi_rs_get_byte_stream_length ( /* Point to the next object */ - linked_list = ACPI_PTR_ADD (struct acpi_resource, - linked_list, linked_list->length); + linked_list = ACPI_PTR_ADD(struct acpi_resource, + linked_list, linked_list->length); } /* This is the data the caller needs */ *size_needed = byte_stream_size_needed; - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_rs_get_list_length @@ -297,32 +299,28 @@ acpi_rs_get_byte_stream_length ( ******************************************************************************/ acpi_status -acpi_rs_get_list_length ( - u8 *byte_stream_buffer, - u32 byte_stream_buffer_length, - acpi_size *size_needed) +acpi_rs_get_list_length(u8 * byte_stream_buffer, + u32 byte_stream_buffer_length, acpi_size * size_needed) { - u32 buffer_size = 0; - u32 bytes_parsed = 0; - u8 number_of_interrupts = 0; - u8 number_of_channels = 0; - u8 resource_type; - u32 structure_size; - u32 bytes_consumed; - u8 *buffer; - u8 temp8; - u16 temp16; - u8 index; - u8 additional_bytes; - - - ACPI_FUNCTION_TRACE ("rs_get_list_length"); - + u32 buffer_size = 0; + u32 bytes_parsed = 0; + u8 number_of_interrupts = 0; + u8 number_of_channels = 0; + u8 resource_type; + u32 structure_size; + u32 bytes_consumed; + u8 *buffer; + u8 temp8; + u16 temp16; + u8 index; + u8 additional_bytes; + + ACPI_FUNCTION_TRACE("rs_get_list_length"); while (bytes_parsed < byte_stream_buffer_length) { /* The next byte in the stream is the resource type */ - resource_type = acpi_rs_get_resource_type (*byte_stream_buffer); + resource_type = acpi_rs_get_resource_type(*byte_stream_buffer); switch (resource_type) { case ACPI_RDESC_TYPE_MEMORY_24: @@ -331,10 +329,10 @@ acpi_rs_get_list_length ( */ bytes_consumed = 12; - structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_mem24); + structure_size = + ACPI_SIZEOF_RESOURCE(struct acpi_resource_mem24); break; - case ACPI_RDESC_TYPE_LARGE_VENDOR: /* * Vendor Defined Resource @@ -342,38 +340,39 @@ acpi_rs_get_list_length ( buffer = byte_stream_buffer; ++buffer; - ACPI_MOVE_16_TO_16 (&temp16, buffer); + ACPI_MOVE_16_TO_16(&temp16, buffer); bytes_consumed = temp16 + 3; /* Ensure a 32-bit boundary for the structure */ - temp16 = (u16) ACPI_ROUND_UP_to_32_bITS (temp16); + temp16 = (u16) ACPI_ROUND_UP_to_32_bITS(temp16); - structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_vendor) + - (temp16 * sizeof (u8)); + structure_size = + ACPI_SIZEOF_RESOURCE(struct acpi_resource_vendor) + + (temp16 * sizeof(u8)); break; - case ACPI_RDESC_TYPE_MEMORY_32: /* * 32-Bit Memory Range Resource */ bytes_consumed = 20; - structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_mem32); + structure_size = + ACPI_SIZEOF_RESOURCE(struct acpi_resource_mem32); break; - case ACPI_RDESC_TYPE_FIXED_MEMORY_32: /* * 32-Bit Fixed Memory Resource */ bytes_consumed = 12; - structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_fixed_mem32); + structure_size = + ACPI_SIZEOF_RESOURCE(struct + acpi_resource_fixed_mem32); break; - case ACPI_RDESC_TYPE_EXTENDED_ADDRESS_SPACE: /* * 64-Bit Address Resource @@ -381,13 +380,14 @@ acpi_rs_get_list_length ( buffer = byte_stream_buffer; ++buffer; - ACPI_MOVE_16_TO_16 (&temp16, buffer); + ACPI_MOVE_16_TO_16(&temp16, buffer); bytes_consumed = temp16 + 3; - structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_address64); + structure_size = + ACPI_SIZEOF_RESOURCE(struct + acpi_resource_address64); break; - case ACPI_RDESC_TYPE_QWORD_ADDRESS_SPACE: /* * 64-Bit Address Resource @@ -395,7 +395,7 @@ acpi_rs_get_list_length ( buffer = byte_stream_buffer; ++buffer; - ACPI_MOVE_16_TO_16 (&temp16, buffer); + ACPI_MOVE_16_TO_16(&temp16, buffer); bytes_consumed = temp16 + 3; @@ -409,20 +409,19 @@ acpi_rs_get_list_length ( */ if (43 < temp16) { temp8 = (u8) (temp16 - 44); - } - else { + } else { temp8 = 0; } /* Ensure a 64-bit boundary for the structure */ - temp8 = (u8) ACPI_ROUND_UP_to_64_bITS (temp8); + temp8 = (u8) ACPI_ROUND_UP_to_64_bITS(temp8); - structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_address64) + - (temp8 * sizeof (u8)); + structure_size = + ACPI_SIZEOF_RESOURCE(struct acpi_resource_address64) + + (temp8 * sizeof(u8)); break; - case ACPI_RDESC_TYPE_DWORD_ADDRESS_SPACE: /* * 32-Bit Address Resource @@ -430,7 +429,7 @@ acpi_rs_get_list_length ( buffer = byte_stream_buffer; ++buffer; - ACPI_MOVE_16_TO_16 (&temp16, buffer); + ACPI_MOVE_16_TO_16(&temp16, buffer); bytes_consumed = temp16 + 3; @@ -444,20 +443,19 @@ acpi_rs_get_list_length ( */ if (23 < temp16) { temp8 = (u8) (temp16 - 24); - } - else { + } else { temp8 = 0; } /* Ensure a 32-bit boundary for the structure */ - temp8 = (u8) ACPI_ROUND_UP_to_32_bITS (temp8); + temp8 = (u8) ACPI_ROUND_UP_to_32_bITS(temp8); - structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_address32) + - (temp8 * sizeof (u8)); + structure_size = + ACPI_SIZEOF_RESOURCE(struct acpi_resource_address32) + + (temp8 * sizeof(u8)); break; - case ACPI_RDESC_TYPE_WORD_ADDRESS_SPACE: /* * 16-Bit Address Resource @@ -465,7 +463,7 @@ acpi_rs_get_list_length ( buffer = byte_stream_buffer; ++buffer; - ACPI_MOVE_16_TO_16 (&temp16, buffer); + ACPI_MOVE_16_TO_16(&temp16, buffer); bytes_consumed = temp16 + 3; @@ -479,20 +477,19 @@ acpi_rs_get_list_length ( */ if (13 < temp16) { temp8 = (u8) (temp16 - 14); - } - else { + } else { temp8 = 0; } /* Ensure a 32-bit boundary for the structure */ - temp8 = (u8) ACPI_ROUND_UP_to_32_bITS (temp8); + temp8 = (u8) ACPI_ROUND_UP_to_32_bITS(temp8); - structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_address16) + - (temp8 * sizeof (u8)); + structure_size = + ACPI_SIZEOF_RESOURCE(struct acpi_resource_address16) + + (temp8 * sizeof(u8)); break; - case ACPI_RDESC_TYPE_EXTENDED_XRUPT: /* * Extended IRQ @@ -500,7 +497,7 @@ acpi_rs_get_list_length ( buffer = byte_stream_buffer; ++buffer; - ACPI_MOVE_16_TO_16 (&temp16, buffer); + ACPI_MOVE_16_TO_16(&temp16, buffer); bytes_consumed = temp16 + 3; @@ -527,21 +524,20 @@ acpi_rs_get_list_length ( */ if (9 + additional_bytes < temp16) { temp8 = (u8) (temp16 - (9 + additional_bytes)); - } - else { + } else { temp8 = 0; } /* Ensure a 32-bit boundary for the structure */ - temp8 = (u8) ACPI_ROUND_UP_to_32_bITS (temp8); + temp8 = (u8) ACPI_ROUND_UP_to_32_bITS(temp8); - structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_ext_irq) + - (additional_bytes * sizeof (u8)) + - (temp8 * sizeof (u8)); + structure_size = + ACPI_SIZEOF_RESOURCE(struct acpi_resource_ext_irq) + + (additional_bytes * sizeof(u8)) + + (temp8 * sizeof(u8)); break; - case ACPI_RDESC_TYPE_IRQ_FORMAT: /* * IRQ Resource. @@ -550,10 +546,9 @@ acpi_rs_get_list_length ( buffer = byte_stream_buffer; temp8 = *buffer; - if(temp8 & 0x01) { + if (temp8 & 0x01) { bytes_consumed = 4; - } - else { + } else { bytes_consumed = 3; } @@ -563,7 +558,7 @@ acpi_rs_get_list_length ( /* Look at the number of bits set */ - ACPI_MOVE_16_TO_16 (&temp16, buffer); + ACPI_MOVE_16_TO_16(&temp16, buffer); for (index = 0; index < 16; index++) { if (temp16 & 0x1) { @@ -573,11 +568,11 @@ acpi_rs_get_list_length ( temp16 >>= 1; } - structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_io) + - (number_of_interrupts * sizeof (u32)); + structure_size = + ACPI_SIZEOF_RESOURCE(struct acpi_resource_io) + + (number_of_interrupts * sizeof(u32)); break; - case ACPI_RDESC_TYPE_DMA_FORMAT: /* * DMA Resource @@ -593,19 +588,19 @@ acpi_rs_get_list_length ( temp8 = *buffer; - for(index = 0; index < 8; index++) { - if(temp8 & 0x1) { + for (index = 0; index < 8; index++) { + if (temp8 & 0x1) { ++number_of_channels; } temp8 >>= 1; } - structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_dma) + - (number_of_channels * sizeof (u32)); + structure_size = + ACPI_SIZEOF_RESOURCE(struct acpi_resource_dma) + + (number_of_channels * sizeof(u32)); break; - case ACPI_RDESC_TYPE_START_DEPENDENT: /* * Start Dependent Functions Resource @@ -614,17 +609,17 @@ acpi_rs_get_list_length ( buffer = byte_stream_buffer; temp8 = *buffer; - if(temp8 & 0x01) { + if (temp8 & 0x01) { bytes_consumed = 2; - } - else { + } else { bytes_consumed = 1; } - structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_start_dpf); + structure_size = + ACPI_SIZEOF_RESOURCE(struct + acpi_resource_start_dpf); break; - case ACPI_RDESC_TYPE_END_DEPENDENT: /* * End Dependent Functions Resource @@ -633,25 +628,24 @@ acpi_rs_get_list_length ( structure_size = ACPI_RESOURCE_LENGTH; break; - case ACPI_RDESC_TYPE_IO_PORT: /* * IO Port Resource */ bytes_consumed = 8; - structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_io); + structure_size = + ACPI_SIZEOF_RESOURCE(struct acpi_resource_io); break; - case ACPI_RDESC_TYPE_FIXED_IO_PORT: /* * Fixed IO Port Resource */ bytes_consumed = 4; - structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_fixed_io); + structure_size = + ACPI_SIZEOF_RESOURCE(struct acpi_resource_fixed_io); break; - case ACPI_RDESC_TYPE_SMALL_VENDOR: /* * Vendor Specific Resource @@ -664,12 +658,12 @@ acpi_rs_get_list_length ( /* Ensure a 32-bit boundary for the structure */ - temp8 = (u8) ACPI_ROUND_UP_to_32_bITS (temp8); - structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_vendor) + - (temp8 * sizeof (u8)); + temp8 = (u8) ACPI_ROUND_UP_to_32_bITS(temp8); + structure_size = + ACPI_SIZEOF_RESOURCE(struct acpi_resource_vendor) + + (temp8 * sizeof(u8)); break; - case ACPI_RDESC_TYPE_END_TAG: /* * End Tag @@ -679,18 +673,17 @@ acpi_rs_get_list_length ( byte_stream_buffer_length = bytes_parsed; break; - default: /* * If we get here, everything is out of sync, * exit with an error */ - return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE); + return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE); } /* Update the return value and counter */ - buffer_size += (u32) ACPI_ALIGN_RESOURCE_SIZE (structure_size); + buffer_size += (u32) ACPI_ALIGN_RESOURCE_SIZE(structure_size); bytes_parsed += bytes_consumed; /* Set the byte stream to point to the next resource */ @@ -701,10 +694,9 @@ acpi_rs_get_list_length ( /* This is the data the caller needs */ *size_needed = buffer_size; - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_rs_get_pci_routing_table_length @@ -723,22 +715,19 @@ acpi_rs_get_list_length ( ******************************************************************************/ acpi_status -acpi_rs_get_pci_routing_table_length ( - union acpi_operand_object *package_object, - acpi_size *buffer_size_needed) +acpi_rs_get_pci_routing_table_length(union acpi_operand_object *package_object, + acpi_size * buffer_size_needed) { - u32 number_of_elements; - acpi_size temp_size_needed = 0; - union acpi_operand_object **top_object_list; - u32 index; - union acpi_operand_object *package_element; - union acpi_operand_object **sub_object_list; - u8 name_found; - u32 table_index; - - - ACPI_FUNCTION_TRACE ("rs_get_pci_routing_table_length"); + u32 number_of_elements; + acpi_size temp_size_needed = 0; + union acpi_operand_object **top_object_list; + u32 index; + union acpi_operand_object *package_element; + union acpi_operand_object **sub_object_list; + u8 name_found; + u32 table_index; + ACPI_FUNCTION_TRACE("rs_get_pci_routing_table_length"); number_of_elements = package_object->package.count; @@ -769,53 +758,51 @@ acpi_rs_get_pci_routing_table_length ( name_found = FALSE; - for (table_index = 0; table_index < 4 && !name_found; table_index++) { + for (table_index = 0; table_index < 4 && !name_found; + table_index++) { if ((ACPI_TYPE_STRING == - ACPI_GET_OBJECT_TYPE (*sub_object_list)) || - - ((ACPI_TYPE_LOCAL_REFERENCE == - ACPI_GET_OBJECT_TYPE (*sub_object_list)) && - - ((*sub_object_list)->reference.opcode == - AML_INT_NAMEPATH_OP))) { + ACPI_GET_OBJECT_TYPE(*sub_object_list)) + || + ((ACPI_TYPE_LOCAL_REFERENCE == + ACPI_GET_OBJECT_TYPE(*sub_object_list)) + && ((*sub_object_list)->reference.opcode == + AML_INT_NAMEPATH_OP))) { name_found = TRUE; - } - else { + } else { /* Look at the next element */ sub_object_list++; } } - temp_size_needed += (sizeof (struct acpi_pci_routing_table) - 4); + temp_size_needed += (sizeof(struct acpi_pci_routing_table) - 4); /* Was a String type found? */ if (name_found) { - if (ACPI_GET_OBJECT_TYPE (*sub_object_list) == ACPI_TYPE_STRING) { + if (ACPI_GET_OBJECT_TYPE(*sub_object_list) == + ACPI_TYPE_STRING) { /* * The length String.Length field does not include the * terminating NULL, add 1 */ temp_size_needed += ((acpi_size) - (*sub_object_list)->string.length + 1); + (*sub_object_list)->string. + length + 1); + } else { + temp_size_needed += acpi_ns_get_pathname_length((*sub_object_list)->reference.node); } - else { - temp_size_needed += acpi_ns_get_pathname_length ( - (*sub_object_list)->reference.node); - } - } - else { + } else { /* * If no name was found, then this is a NULL, which is * translated as a u32 zero. */ - temp_size_needed += sizeof (u32); + temp_size_needed += sizeof(u32); } /* Round up the size since each element must be aligned */ - temp_size_needed = ACPI_ROUND_UP_to_64_bITS (temp_size_needed); + temp_size_needed = ACPI_ROUND_UP_to_64_bITS(temp_size_needed); /* Point to the next union acpi_operand_object */ @@ -826,6 +813,7 @@ acpi_rs_get_pci_routing_table_length ( * Adding an extra element to the end of the list, essentially a * NULL terminator */ - *buffer_size_needed = temp_size_needed + sizeof (struct acpi_pci_routing_table); - return_ACPI_STATUS (AE_OK); + *buffer_size_needed = + temp_size_needed + sizeof(struct acpi_pci_routing_table); + return_ACPI_STATUS(AE_OK); } diff --git a/drivers/acpi/resources/rscreate.c b/drivers/acpi/resources/rscreate.c index 8e0eae0d50b..0911526b7ad 100644 --- a/drivers/acpi/resources/rscreate.c +++ b/drivers/acpi/resources/rscreate.c @@ -41,15 +41,13 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include #include #include #include #define _COMPONENT ACPI_RESOURCES - ACPI_MODULE_NAME ("rscreate") - +ACPI_MODULE_NAME("rscreate") /******************************************************************************* * @@ -68,24 +66,20 @@ * of device resources. * ******************************************************************************/ - acpi_status -acpi_rs_create_resource_list ( - union acpi_operand_object *byte_stream_buffer, - struct acpi_buffer *output_buffer) +acpi_rs_create_resource_list(union acpi_operand_object *byte_stream_buffer, + struct acpi_buffer *output_buffer) { - acpi_status status; - u8 *byte_stream_start; - acpi_size list_size_needed = 0; - u32 byte_stream_buffer_length; + acpi_status status; + u8 *byte_stream_start; + acpi_size list_size_needed = 0; + u32 byte_stream_buffer_length; + ACPI_FUNCTION_TRACE("rs_create_resource_list"); - ACPI_FUNCTION_TRACE ("rs_create_resource_list"); - - - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "byte_stream_buffer = %p\n", - byte_stream_buffer)); + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "byte_stream_buffer = %p\n", + byte_stream_buffer)); /* Params already validated, so we don't re-validate here */ @@ -96,36 +90,39 @@ acpi_rs_create_resource_list ( * Pass the byte_stream_buffer into a module that can calculate * the buffer size needed for the linked list */ - status = acpi_rs_get_list_length (byte_stream_start, byte_stream_buffer_length, - &list_size_needed); - - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Status=%X list_size_needed=%X\n", - status, (u32) list_size_needed)); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = + acpi_rs_get_list_length(byte_stream_start, + byte_stream_buffer_length, + &list_size_needed); + + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Status=%X list_size_needed=%X\n", + status, (u32) list_size_needed)); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* Validate/Allocate/Clear caller buffer */ - status = acpi_ut_initialize_buffer (output_buffer, list_size_needed); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ut_initialize_buffer(output_buffer, list_size_needed); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* Do the conversion */ - status = acpi_rs_byte_stream_to_list (byte_stream_start, byte_stream_buffer_length, - output_buffer->pointer); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = + acpi_rs_byte_stream_to_list(byte_stream_start, + byte_stream_buffer_length, + output_buffer->pointer); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "output_buffer %p Length %X\n", - output_buffer->pointer, (u32) output_buffer->length)); - return_ACPI_STATUS (AE_OK); + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "output_buffer %p Length %X\n", + output_buffer->pointer, (u32) output_buffer->length)); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_rs_create_pci_routing_table @@ -148,44 +145,41 @@ acpi_rs_create_resource_list ( ******************************************************************************/ acpi_status -acpi_rs_create_pci_routing_table ( - union acpi_operand_object *package_object, - struct acpi_buffer *output_buffer) +acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, + struct acpi_buffer *output_buffer) { - u8 *buffer; - union acpi_operand_object **top_object_list; - union acpi_operand_object **sub_object_list; - union acpi_operand_object *obj_desc; - acpi_size buffer_size_needed = 0; - u32 number_of_elements; - u32 index; - struct acpi_pci_routing_table *user_prt; - struct acpi_namespace_node *node; - acpi_status status; - struct acpi_buffer path_buffer; - - - ACPI_FUNCTION_TRACE ("rs_create_pci_routing_table"); - + u8 *buffer; + union acpi_operand_object **top_object_list; + union acpi_operand_object **sub_object_list; + union acpi_operand_object *obj_desc; + acpi_size buffer_size_needed = 0; + u32 number_of_elements; + u32 index; + struct acpi_pci_routing_table *user_prt; + struct acpi_namespace_node *node; + acpi_status status; + struct acpi_buffer path_buffer; + + ACPI_FUNCTION_TRACE("rs_create_pci_routing_table"); /* Params already validated, so we don't re-validate here */ /* Get the required buffer length */ - status = acpi_rs_get_pci_routing_table_length (package_object, - &buffer_size_needed); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_rs_get_pci_routing_table_length(package_object, + &buffer_size_needed); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "buffer_size_needed = %X\n", - (u32) buffer_size_needed)); + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "buffer_size_needed = %X\n", + (u32) buffer_size_needed)); /* Validate/Allocate/Clear caller buffer */ - status = acpi_ut_initialize_buffer (output_buffer, buffer_size_needed); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ut_initialize_buffer(output_buffer, buffer_size_needed); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* @@ -193,10 +187,10 @@ acpi_rs_create_pci_routing_table ( * should be a package that in turn contains an * acpi_integer Address, a u8 Pin, a Name and a u8 source_index. */ - top_object_list = package_object->package.elements; + top_object_list = package_object->package.elements; number_of_elements = package_object->package.count; - buffer = output_buffer->pointer; - user_prt = ACPI_CAST_PTR (struct acpi_pci_routing_table, buffer); + buffer = output_buffer->pointer; + user_prt = ACPI_CAST_PTR(struct acpi_pci_routing_table, buffer); for (index = 0; index < number_of_elements; index++) { /* @@ -206,31 +200,34 @@ acpi_rs_create_pci_routing_table ( * be zero because we cleared the return buffer earlier */ buffer += user_prt->length; - user_prt = ACPI_CAST_PTR (struct acpi_pci_routing_table, buffer); + user_prt = ACPI_CAST_PTR(struct acpi_pci_routing_table, buffer); /* * Fill in the Length field with the information we have at this point. * The minus four is to subtract the size of the u8 Source[4] member * because it is added below. */ - user_prt->length = (sizeof (struct acpi_pci_routing_table) - 4); + user_prt->length = (sizeof(struct acpi_pci_routing_table) - 4); /* Each element of the top-level package must also be a package */ - if (ACPI_GET_OBJECT_TYPE (*top_object_list) != ACPI_TYPE_PACKAGE) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "(PRT[%X]) Need sub-package, found %s\n", - index, acpi_ut_get_object_type_name (*top_object_list))); - return_ACPI_STATUS (AE_AML_OPERAND_TYPE); + if (ACPI_GET_OBJECT_TYPE(*top_object_list) != ACPI_TYPE_PACKAGE) { + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "(PRT[%X]) Need sub-package, found %s\n", + index, + acpi_ut_get_object_type_name + (*top_object_list))); + return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } /* Each sub-package must be of length 4 */ if ((*top_object_list)->package.count != 4) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "(PRT[%X]) Need package of length 4, found length %d\n", - index, (*top_object_list)->package.count)); - return_ACPI_STATUS (AE_AML_PACKAGE_LIMIT); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "(PRT[%X]) Need package of length 4, found length %d\n", + index, + (*top_object_list)->package.count)); + return_ACPI_STATUS(AE_AML_PACKAGE_LIMIT); } /* @@ -243,40 +240,43 @@ acpi_rs_create_pci_routing_table ( /* 1) First subobject: Dereference the PRT.Address */ obj_desc = sub_object_list[0]; - if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_INTEGER) { + if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) { user_prt->address = obj_desc->integer.value; - } - else { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "(PRT[%X].Address) Need Integer, found %s\n", - index, acpi_ut_get_object_type_name (obj_desc))); - return_ACPI_STATUS (AE_BAD_DATA); + } else { + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "(PRT[%X].Address) Need Integer, found %s\n", + index, + acpi_ut_get_object_type_name + (obj_desc))); + return_ACPI_STATUS(AE_BAD_DATA); } /* 2) Second subobject: Dereference the PRT.Pin */ obj_desc = sub_object_list[1]; - if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_INTEGER) { + if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) { user_prt->pin = (u32) obj_desc->integer.value; - } - else { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "(PRT[%X].Pin) Need Integer, found %s\n", - index, acpi_ut_get_object_type_name (obj_desc))); - return_ACPI_STATUS (AE_BAD_DATA); + } else { + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "(PRT[%X].Pin) Need Integer, found %s\n", + index, + acpi_ut_get_object_type_name + (obj_desc))); + return_ACPI_STATUS(AE_BAD_DATA); } /* 3) Third subobject: Dereference the PRT.source_name */ obj_desc = sub_object_list[2]; - switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { + switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { case ACPI_TYPE_LOCAL_REFERENCE: if (obj_desc->reference.opcode != AML_INT_NAMEPATH_OP) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "(PRT[%X].Source) Need name, found reference op %X\n", - index, obj_desc->reference.opcode)); - return_ACPI_STATUS (AE_BAD_DATA); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "(PRT[%X].Source) Need name, found reference op %X\n", + index, + obj_desc->reference.opcode)); + return_ACPI_STATUS(AE_BAD_DATA); } node = obj_desc->reference.node; @@ -284,21 +284,23 @@ acpi_rs_create_pci_routing_table ( /* Use *remaining* length of the buffer as max for pathname */ path_buffer.length = output_buffer->length - - (u32) ((u8 *) user_prt->source - - (u8 *) output_buffer->pointer); + (u32) ((u8 *) user_prt->source - + (u8 *) output_buffer->pointer); path_buffer.pointer = user_prt->source; - status = acpi_ns_handle_to_pathname ((acpi_handle) node, &path_buffer); + status = + acpi_ns_handle_to_pathname((acpi_handle) node, + &path_buffer); /* +1 to include null terminator */ - user_prt->length += (u32) ACPI_STRLEN (user_prt->source) + 1; + user_prt->length += + (u32) ACPI_STRLEN(user_prt->source) + 1; break; - case ACPI_TYPE_STRING: - ACPI_STRCPY (user_prt->source, obj_desc->string.pointer); + ACPI_STRCPY(user_prt->source, obj_desc->string.pointer); /* * Add to the Length field the length of the string @@ -307,7 +309,6 @@ acpi_rs_create_pci_routing_table ( user_prt->length += obj_desc->string.length + 1; break; - case ACPI_TYPE_INTEGER: /* * If this is a number, then the Source Name is NULL, since the @@ -315,33 +316,36 @@ acpi_rs_create_pci_routing_table ( * * Add to the Length field the length of the u32 NULL */ - user_prt->length += sizeof (u32); + user_prt->length += sizeof(u32); break; - default: - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "(PRT[%X].Source) Need Ref/String/Integer, found %s\n", - index, acpi_ut_get_object_type_name (obj_desc))); - return_ACPI_STATUS (AE_BAD_DATA); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "(PRT[%X].Source) Need Ref/String/Integer, found %s\n", + index, + acpi_ut_get_object_type_name + (obj_desc))); + return_ACPI_STATUS(AE_BAD_DATA); } /* Now align the current length */ - user_prt->length = (u32) ACPI_ROUND_UP_to_64_bITS (user_prt->length); + user_prt->length = + (u32) ACPI_ROUND_UP_to_64_bITS(user_prt->length); /* 4) Fourth subobject: Dereference the PRT.source_index */ obj_desc = sub_object_list[3]; - if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_INTEGER) { + if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) { user_prt->source_index = (u32) obj_desc->integer.value; - } - else { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "(PRT[%X].source_index) Need Integer, found %s\n", - index, acpi_ut_get_object_type_name (obj_desc))); - return_ACPI_STATUS (AE_BAD_DATA); + } else { + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "(PRT[%X].source_index) Need Integer, found %s\n", + index, + acpi_ut_get_object_type_name + (obj_desc))); + return_ACPI_STATUS(AE_BAD_DATA); } /* Point to the next union acpi_operand_object in the top level package */ @@ -349,12 +353,11 @@ acpi_rs_create_pci_routing_table ( top_object_list++; } - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "output_buffer %p Length %X\n", - output_buffer->pointer, (u32) output_buffer->length)); - return_ACPI_STATUS (AE_OK); + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "output_buffer %p Length %X\n", + output_buffer->pointer, (u32) output_buffer->length)); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_rs_create_byte_stream @@ -374,19 +377,16 @@ acpi_rs_create_pci_routing_table ( ******************************************************************************/ acpi_status -acpi_rs_create_byte_stream ( - struct acpi_resource *linked_list_buffer, - struct acpi_buffer *output_buffer) +acpi_rs_create_byte_stream(struct acpi_resource *linked_list_buffer, + struct acpi_buffer *output_buffer) { - acpi_status status; - acpi_size byte_stream_size_needed = 0; - - - ACPI_FUNCTION_TRACE ("rs_create_byte_stream"); + acpi_status status; + acpi_size byte_stream_size_needed = 0; + ACPI_FUNCTION_TRACE("rs_create_byte_stream"); - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "linked_list_buffer = %p\n", - linked_list_buffer)); + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "linked_list_buffer = %p\n", + linked_list_buffer)); /* * Params already validated, so we don't re-validate here @@ -394,32 +394,35 @@ acpi_rs_create_byte_stream ( * Pass the linked_list_buffer into a module that calculates * the buffer size needed for the byte stream. */ - status = acpi_rs_get_byte_stream_length (linked_list_buffer, - &byte_stream_size_needed); - - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "byte_stream_size_needed=%X, %s\n", - (u32) byte_stream_size_needed, acpi_format_exception (status))); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_rs_get_byte_stream_length(linked_list_buffer, + &byte_stream_size_needed); + + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "byte_stream_size_needed=%X, %s\n", + (u32) byte_stream_size_needed, + acpi_format_exception(status))); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* Validate/Allocate/Clear caller buffer */ - status = acpi_ut_initialize_buffer (output_buffer, byte_stream_size_needed); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = + acpi_ut_initialize_buffer(output_buffer, byte_stream_size_needed); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* Do the conversion */ - status = acpi_rs_list_to_byte_stream (linked_list_buffer, byte_stream_size_needed, - output_buffer->pointer); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = + acpi_rs_list_to_byte_stream(linked_list_buffer, + byte_stream_size_needed, + output_buffer->pointer); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "output_buffer %p Length %X\n", - output_buffer->pointer, (u32) output_buffer->length)); - return_ACPI_STATUS (AE_OK); + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "output_buffer %p Length %X\n", + output_buffer->pointer, (u32) output_buffer->length)); + return_ACPI_STATUS(AE_OK); } - diff --git a/drivers/acpi/resources/rsdump.c b/drivers/acpi/resources/rsdump.c index 2c3bb8c3574..75bd34d1783 100644 --- a/drivers/acpi/resources/rsdump.c +++ b/drivers/acpi/resources/rsdump.c @@ -41,70 +41,39 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include #include #define _COMPONENT ACPI_RESOURCES - ACPI_MODULE_NAME ("rsdump") - +ACPI_MODULE_NAME("rsdump") #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) - /* Local prototypes */ +static void acpi_rs_dump_irq(union acpi_resource_data *data); -static void -acpi_rs_dump_irq ( - union acpi_resource_data *data); - -static void -acpi_rs_dump_address16 ( - union acpi_resource_data *data); +static void acpi_rs_dump_address16(union acpi_resource_data *data); -static void -acpi_rs_dump_address32 ( - union acpi_resource_data *data); +static void acpi_rs_dump_address32(union acpi_resource_data *data); -static void -acpi_rs_dump_address64 ( - union acpi_resource_data *data); +static void acpi_rs_dump_address64(union acpi_resource_data *data); -static void -acpi_rs_dump_dma ( - union acpi_resource_data *data); +static void acpi_rs_dump_dma(union acpi_resource_data *data); -static void -acpi_rs_dump_io ( - union acpi_resource_data *data); +static void acpi_rs_dump_io(union acpi_resource_data *data); -static void -acpi_rs_dump_extended_irq ( - union acpi_resource_data *data); +static void acpi_rs_dump_extended_irq(union acpi_resource_data *data); -static void -acpi_rs_dump_fixed_io ( - union acpi_resource_data *data); +static void acpi_rs_dump_fixed_io(union acpi_resource_data *data); -static void -acpi_rs_dump_fixed_memory32 ( - union acpi_resource_data *data); +static void acpi_rs_dump_fixed_memory32(union acpi_resource_data *data); -static void -acpi_rs_dump_memory24 ( - union acpi_resource_data *data); +static void acpi_rs_dump_memory24(union acpi_resource_data *data); -static void -acpi_rs_dump_memory32 ( - union acpi_resource_data *data); +static void acpi_rs_dump_memory32(union acpi_resource_data *data); -static void -acpi_rs_dump_start_depend_fns ( - union acpi_resource_data *data); - -static void -acpi_rs_dump_vendor_specific ( - union acpi_resource_data *data); +static void acpi_rs_dump_start_depend_fns(union acpi_resource_data *data); +static void acpi_rs_dump_vendor_specific(union acpi_resource_data *data); /******************************************************************************* * @@ -118,39 +87,37 @@ acpi_rs_dump_vendor_specific ( * ******************************************************************************/ -static void -acpi_rs_dump_irq ( - union acpi_resource_data *data) +static void acpi_rs_dump_irq(union acpi_resource_data *data) { - struct acpi_resource_irq *irq_data = (struct acpi_resource_irq *) data; - u8 index = 0; - - - ACPI_FUNCTION_ENTRY (); + struct acpi_resource_irq *irq_data = (struct acpi_resource_irq *)data; + u8 index = 0; + ACPI_FUNCTION_ENTRY(); - acpi_os_printf ("IRQ Resource\n"); + acpi_os_printf("IRQ Resource\n"); - acpi_os_printf (" %s Triggered\n", - ACPI_LEVEL_SENSITIVE == irq_data->edge_level ? "Level" : "Edge"); + acpi_os_printf(" %s Triggered\n", + ACPI_LEVEL_SENSITIVE == + irq_data->edge_level ? "Level" : "Edge"); - acpi_os_printf (" Active %s\n", - ACPI_ACTIVE_LOW == irq_data->active_high_low ? "Low" : "High"); + acpi_os_printf(" Active %s\n", + ACPI_ACTIVE_LOW == + irq_data->active_high_low ? "Low" : "High"); - acpi_os_printf (" %s\n", - ACPI_SHARED == irq_data->shared_exclusive ? "Shared" : "Exclusive"); + acpi_os_printf(" %s\n", + ACPI_SHARED == + irq_data->shared_exclusive ? "Shared" : "Exclusive"); - acpi_os_printf (" %X Interrupts ( ", irq_data->number_of_interrupts); + acpi_os_printf(" %X Interrupts ( ", irq_data->number_of_interrupts); for (index = 0; index < irq_data->number_of_interrupts; index++) { - acpi_os_printf ("%X ", irq_data->interrupts[index]); + acpi_os_printf("%X ", irq_data->interrupts[index]); } - acpi_os_printf (")\n"); + acpi_os_printf(")\n"); return; } - /******************************************************************************* * * FUNCTION: acpi_rs_dump_dma @@ -163,75 +130,69 @@ acpi_rs_dump_irq ( * ******************************************************************************/ -static void -acpi_rs_dump_dma ( - union acpi_resource_data *data) +static void acpi_rs_dump_dma(union acpi_resource_data *data) { - struct acpi_resource_dma *dma_data = (struct acpi_resource_dma *) data; - u8 index = 0; - - - ACPI_FUNCTION_ENTRY (); + struct acpi_resource_dma *dma_data = (struct acpi_resource_dma *)data; + u8 index = 0; + ACPI_FUNCTION_ENTRY(); - acpi_os_printf ("DMA Resource\n"); + acpi_os_printf("DMA Resource\n"); switch (dma_data->type) { case ACPI_COMPATIBILITY: - acpi_os_printf (" Compatibility mode\n"); + acpi_os_printf(" Compatibility mode\n"); break; case ACPI_TYPE_A: - acpi_os_printf (" Type A\n"); + acpi_os_printf(" Type A\n"); break; case ACPI_TYPE_B: - acpi_os_printf (" Type B\n"); + acpi_os_printf(" Type B\n"); break; case ACPI_TYPE_F: - acpi_os_printf (" Type F\n"); + acpi_os_printf(" Type F\n"); break; default: - acpi_os_printf (" Invalid DMA type\n"); + acpi_os_printf(" Invalid DMA type\n"); break; } - acpi_os_printf (" %sBus Master\n", - ACPI_BUS_MASTER == dma_data->bus_master ? "" : "Not a "); - + acpi_os_printf(" %sBus Master\n", + ACPI_BUS_MASTER == dma_data->bus_master ? "" : "Not a "); switch (dma_data->transfer) { case ACPI_TRANSFER_8: - acpi_os_printf (" 8-bit only transfer\n"); + acpi_os_printf(" 8-bit only transfer\n"); break; case ACPI_TRANSFER_8_16: - acpi_os_printf (" 8 and 16-bit transfer\n"); + acpi_os_printf(" 8 and 16-bit transfer\n"); break; case ACPI_TRANSFER_16: - acpi_os_printf (" 16 bit only transfer\n"); + acpi_os_printf(" 16 bit only transfer\n"); break; default: - acpi_os_printf (" Invalid transfer preference\n"); + acpi_os_printf(" Invalid transfer preference\n"); break; } - acpi_os_printf (" Number of Channels: %X ( ", - dma_data->number_of_channels); + acpi_os_printf(" Number of Channels: %X ( ", + dma_data->number_of_channels); for (index = 0; index < dma_data->number_of_channels; index++) { - acpi_os_printf ("%X ", dma_data->channels[index]); + acpi_os_printf("%X ", dma_data->channels[index]); } - acpi_os_printf (")\n"); + acpi_os_printf(")\n"); return; } - /******************************************************************************* * * FUNCTION: acpi_rs_dump_start_depend_fns @@ -244,58 +205,54 @@ acpi_rs_dump_dma ( * ******************************************************************************/ -static void -acpi_rs_dump_start_depend_fns ( - union acpi_resource_data *data) +static void acpi_rs_dump_start_depend_fns(union acpi_resource_data *data) { - struct acpi_resource_start_dpf *sdf_data = (struct acpi_resource_start_dpf *) data; - + struct acpi_resource_start_dpf *sdf_data = + (struct acpi_resource_start_dpf *)data; - ACPI_FUNCTION_ENTRY (); + ACPI_FUNCTION_ENTRY(); - - acpi_os_printf ("Start Dependent Functions Resource\n"); + acpi_os_printf("Start Dependent Functions Resource\n"); switch (sdf_data->compatibility_priority) { case ACPI_GOOD_CONFIGURATION: - acpi_os_printf (" Good configuration\n"); + acpi_os_printf(" Good configuration\n"); break; case ACPI_ACCEPTABLE_CONFIGURATION: - acpi_os_printf (" Acceptable configuration\n"); + acpi_os_printf(" Acceptable configuration\n"); break; case ACPI_SUB_OPTIMAL_CONFIGURATION: - acpi_os_printf (" Sub-optimal configuration\n"); + acpi_os_printf(" Sub-optimal configuration\n"); break; default: - acpi_os_printf (" Invalid compatibility priority\n"); + acpi_os_printf(" Invalid compatibility priority\n"); break; } - switch(sdf_data->performance_robustness) { + switch (sdf_data->performance_robustness) { case ACPI_GOOD_CONFIGURATION: - acpi_os_printf (" Good configuration\n"); + acpi_os_printf(" Good configuration\n"); break; case ACPI_ACCEPTABLE_CONFIGURATION: - acpi_os_printf (" Acceptable configuration\n"); + acpi_os_printf(" Acceptable configuration\n"); break; case ACPI_SUB_OPTIMAL_CONFIGURATION: - acpi_os_printf (" Sub-optimal configuration\n"); + acpi_os_printf(" Sub-optimal configuration\n"); break; default: - acpi_os_printf (" Invalid performance robustness preference\n"); + acpi_os_printf(" Invalid performance robustness preference\n"); break; } return; } - /******************************************************************************* * * FUNCTION: acpi_rs_dump_io @@ -308,33 +265,30 @@ acpi_rs_dump_start_depend_fns ( * ******************************************************************************/ -static void -acpi_rs_dump_io ( - union acpi_resource_data *data) +static void acpi_rs_dump_io(union acpi_resource_data *data) { - struct acpi_resource_io *io_data = (struct acpi_resource_io *) data; - + struct acpi_resource_io *io_data = (struct acpi_resource_io *)data; - ACPI_FUNCTION_ENTRY (); + ACPI_FUNCTION_ENTRY(); + acpi_os_printf("Io Resource\n"); - acpi_os_printf ("Io Resource\n"); + acpi_os_printf(" %d bit decode\n", + ACPI_DECODE_16 == io_data->io_decode ? 16 : 10); - acpi_os_printf (" %d bit decode\n", - ACPI_DECODE_16 == io_data->io_decode ? 16 : 10); + acpi_os_printf(" Range minimum base: %08X\n", + io_data->min_base_address); - acpi_os_printf (" Range minimum base: %08X\n", io_data->min_base_address); + acpi_os_printf(" Range maximum base: %08X\n", + io_data->max_base_address); - acpi_os_printf (" Range maximum base: %08X\n", io_data->max_base_address); + acpi_os_printf(" Alignment: %08X\n", io_data->alignment); - acpi_os_printf (" Alignment: %08X\n", io_data->alignment); - - acpi_os_printf (" Range Length: %08X\n", io_data->range_length); + acpi_os_printf(" Range Length: %08X\n", io_data->range_length); return; } - /******************************************************************************* * * FUNCTION: acpi_rs_dump_fixed_io @@ -347,25 +301,22 @@ acpi_rs_dump_io ( * ******************************************************************************/ -static void -acpi_rs_dump_fixed_io ( - union acpi_resource_data *data) +static void acpi_rs_dump_fixed_io(union acpi_resource_data *data) { - struct acpi_resource_fixed_io *fixed_io_data = (struct acpi_resource_fixed_io *) data; - + struct acpi_resource_fixed_io *fixed_io_data = + (struct acpi_resource_fixed_io *)data; - ACPI_FUNCTION_ENTRY (); + ACPI_FUNCTION_ENTRY(); + acpi_os_printf("Fixed Io Resource\n"); + acpi_os_printf(" Range base address: %08X", + fixed_io_data->base_address); - acpi_os_printf ("Fixed Io Resource\n"); - acpi_os_printf (" Range base address: %08X", fixed_io_data->base_address); - - acpi_os_printf (" Range length: %08X", fixed_io_data->range_length); + acpi_os_printf(" Range length: %08X", fixed_io_data->range_length); return; } - /******************************************************************************* * * FUNCTION: acpi_rs_dump_vendor_specific @@ -378,30 +329,26 @@ acpi_rs_dump_fixed_io ( * ******************************************************************************/ -static void -acpi_rs_dump_vendor_specific ( - union acpi_resource_data *data) +static void acpi_rs_dump_vendor_specific(union acpi_resource_data *data) { - struct acpi_resource_vendor *vendor_data = (struct acpi_resource_vendor *) data; - u16 index = 0; - + struct acpi_resource_vendor *vendor_data = + (struct acpi_resource_vendor *)data; + u16 index = 0; - ACPI_FUNCTION_ENTRY (); + ACPI_FUNCTION_ENTRY(); + acpi_os_printf("Vendor Specific Resource\n"); - acpi_os_printf ("Vendor Specific Resource\n"); - - acpi_os_printf (" Length: %08X\n", vendor_data->length); + acpi_os_printf(" Length: %08X\n", vendor_data->length); for (index = 0; index < vendor_data->length; index++) { - acpi_os_printf (" Byte %X: %08X\n", - index, vendor_data->reserved[index]); + acpi_os_printf(" Byte %X: %08X\n", + index, vendor_data->reserved[index]); } return; } - /******************************************************************************* * * FUNCTION: acpi_rs_dump_memory24 @@ -414,37 +361,33 @@ acpi_rs_dump_vendor_specific ( * ******************************************************************************/ -static void -acpi_rs_dump_memory24 ( - union acpi_resource_data *data) +static void acpi_rs_dump_memory24(union acpi_resource_data *data) { - struct acpi_resource_mem24 *memory24_data = (struct acpi_resource_mem24 *) data; - + struct acpi_resource_mem24 *memory24_data = + (struct acpi_resource_mem24 *)data; - ACPI_FUNCTION_ENTRY (); + ACPI_FUNCTION_ENTRY(); + acpi_os_printf("24-Bit Memory Range Resource\n"); - acpi_os_printf ("24-Bit Memory Range Resource\n"); + acpi_os_printf(" Read%s\n", + ACPI_READ_WRITE_MEMORY == + memory24_data->read_write_attribute ? + "/Write" : " only"); - acpi_os_printf (" Read%s\n", - ACPI_READ_WRITE_MEMORY == - memory24_data->read_write_attribute ? - "/Write" : " only"); + acpi_os_printf(" Range minimum base: %08X\n", + memory24_data->min_base_address); - acpi_os_printf (" Range minimum base: %08X\n", - memory24_data->min_base_address); + acpi_os_printf(" Range maximum base: %08X\n", + memory24_data->max_base_address); - acpi_os_printf (" Range maximum base: %08X\n", - memory24_data->max_base_address); + acpi_os_printf(" Alignment: %08X\n", memory24_data->alignment); - acpi_os_printf (" Alignment: %08X\n", memory24_data->alignment); - - acpi_os_printf (" Range length: %08X\n", memory24_data->range_length); + acpi_os_printf(" Range length: %08X\n", memory24_data->range_length); return; } - /******************************************************************************* * * FUNCTION: acpi_rs_dump_memory32 @@ -457,37 +400,33 @@ acpi_rs_dump_memory24 ( * ******************************************************************************/ -static void -acpi_rs_dump_memory32 ( - union acpi_resource_data *data) +static void acpi_rs_dump_memory32(union acpi_resource_data *data) { - struct acpi_resource_mem32 *memory32_data = (struct acpi_resource_mem32 *) data; - - - ACPI_FUNCTION_ENTRY (); + struct acpi_resource_mem32 *memory32_data = + (struct acpi_resource_mem32 *)data; + ACPI_FUNCTION_ENTRY(); - acpi_os_printf ("32-Bit Memory Range Resource\n"); + acpi_os_printf("32-Bit Memory Range Resource\n"); - acpi_os_printf (" Read%s\n", - ACPI_READ_WRITE_MEMORY == - memory32_data->read_write_attribute ? - "/Write" : " only"); + acpi_os_printf(" Read%s\n", + ACPI_READ_WRITE_MEMORY == + memory32_data->read_write_attribute ? + "/Write" : " only"); - acpi_os_printf (" Range minimum base: %08X\n", - memory32_data->min_base_address); + acpi_os_printf(" Range minimum base: %08X\n", + memory32_data->min_base_address); - acpi_os_printf (" Range maximum base: %08X\n", - memory32_data->max_base_address); + acpi_os_printf(" Range maximum base: %08X\n", + memory32_data->max_base_address); - acpi_os_printf (" Alignment: %08X\n", memory32_data->alignment); + acpi_os_printf(" Alignment: %08X\n", memory32_data->alignment); - acpi_os_printf (" Range length: %08X\n", memory32_data->range_length); + acpi_os_printf(" Range length: %08X\n", memory32_data->range_length); return; } - /******************************************************************************* * * FUNCTION: acpi_rs_dump_fixed_memory32 @@ -500,33 +439,29 @@ acpi_rs_dump_memory32 ( * ******************************************************************************/ -static void -acpi_rs_dump_fixed_memory32 ( - union acpi_resource_data *data) +static void acpi_rs_dump_fixed_memory32(union acpi_resource_data *data) { - struct acpi_resource_fixed_mem32 *fixed_memory32_data = - (struct acpi_resource_fixed_mem32 *) data; - - - ACPI_FUNCTION_ENTRY (); + struct acpi_resource_fixed_mem32 *fixed_memory32_data = + (struct acpi_resource_fixed_mem32 *)data; + ACPI_FUNCTION_ENTRY(); - acpi_os_printf ("32-Bit Fixed Location Memory Range Resource\n"); + acpi_os_printf("32-Bit Fixed Location Memory Range Resource\n"); - acpi_os_printf (" Read%s\n", - ACPI_READ_WRITE_MEMORY == - fixed_memory32_data->read_write_attribute ? "/Write" : " Only"); + acpi_os_printf(" Read%s\n", + ACPI_READ_WRITE_MEMORY == + fixed_memory32_data-> + read_write_attribute ? "/Write" : " Only"); - acpi_os_printf (" Range base address: %08X\n", - fixed_memory32_data->range_base_address); + acpi_os_printf(" Range base address: %08X\n", + fixed_memory32_data->range_base_address); - acpi_os_printf (" Range length: %08X\n", - fixed_memory32_data->range_length); + acpi_os_printf(" Range length: %08X\n", + fixed_memory32_data->range_length); return; } - /******************************************************************************* * * FUNCTION: acpi_rs_dump_address16 @@ -539,134 +474,136 @@ acpi_rs_dump_fixed_memory32 ( * ******************************************************************************/ -static void -acpi_rs_dump_address16 ( - union acpi_resource_data *data) +static void acpi_rs_dump_address16(union acpi_resource_data *data) { - struct acpi_resource_address16 *address16_data = (struct acpi_resource_address16 *) data; - - - ACPI_FUNCTION_ENTRY (); + struct acpi_resource_address16 *address16_data = + (struct acpi_resource_address16 *)data; + ACPI_FUNCTION_ENTRY(); - acpi_os_printf ("16-Bit Address Space Resource\n"); - acpi_os_printf (" Resource Type: "); + acpi_os_printf("16-Bit Address Space Resource\n"); + acpi_os_printf(" Resource Type: "); switch (address16_data->resource_type) { case ACPI_MEMORY_RANGE: - acpi_os_printf ("Memory Range\n"); + acpi_os_printf("Memory Range\n"); switch (address16_data->attribute.memory.cache_attribute) { case ACPI_NON_CACHEABLE_MEMORY: - acpi_os_printf (" Type Specific: Noncacheable memory\n"); + acpi_os_printf + (" Type Specific: Noncacheable memory\n"); break; case ACPI_CACHABLE_MEMORY: - acpi_os_printf (" Type Specific: Cacheable memory\n"); + acpi_os_printf(" Type Specific: Cacheable memory\n"); break; case ACPI_WRITE_COMBINING_MEMORY: - acpi_os_printf (" Type Specific: Write-combining memory\n"); + acpi_os_printf + (" Type Specific: Write-combining memory\n"); break; case ACPI_PREFETCHABLE_MEMORY: - acpi_os_printf (" Type Specific: Prefetchable memory\n"); + acpi_os_printf + (" Type Specific: Prefetchable memory\n"); break; default: - acpi_os_printf (" Type Specific: Invalid cache attribute\n"); + acpi_os_printf + (" Type Specific: Invalid cache attribute\n"); break; } - acpi_os_printf (" Type Specific: Read%s\n", - ACPI_READ_WRITE_MEMORY == - address16_data->attribute.memory.read_write_attribute ? - "/Write" : " Only"); + acpi_os_printf(" Type Specific: Read%s\n", + ACPI_READ_WRITE_MEMORY == + address16_data->attribute.memory. + read_write_attribute ? "/Write" : " Only"); break; case ACPI_IO_RANGE: - acpi_os_printf ("I/O Range\n"); + acpi_os_printf("I/O Range\n"); switch (address16_data->attribute.io.range_attribute) { case ACPI_NON_ISA_ONLY_RANGES: - acpi_os_printf (" Type Specific: Non-ISA Io Addresses\n"); + acpi_os_printf + (" Type Specific: Non-ISA Io Addresses\n"); break; case ACPI_ISA_ONLY_RANGES: - acpi_os_printf (" Type Specific: ISA Io Addresses\n"); + acpi_os_printf(" Type Specific: ISA Io Addresses\n"); break; case ACPI_ENTIRE_RANGE: - acpi_os_printf (" Type Specific: ISA and non-ISA Io Addresses\n"); + acpi_os_printf + (" Type Specific: ISA and non-ISA Io Addresses\n"); break; default: - acpi_os_printf (" Type Specific: Invalid range attribute\n"); + acpi_os_printf + (" Type Specific: Invalid range attribute\n"); break; } - acpi_os_printf (" Type Specific: %s Translation\n", - ACPI_SPARSE_TRANSLATION == - address16_data->attribute.io.translation_attribute ? - "Sparse" : "Dense"); + acpi_os_printf(" Type Specific: %s Translation\n", + ACPI_SPARSE_TRANSLATION == + address16_data->attribute.io. + translation_attribute ? "Sparse" : "Dense"); break; case ACPI_BUS_NUMBER_RANGE: - acpi_os_printf ("Bus Number Range\n"); + acpi_os_printf("Bus Number Range\n"); break; default: - acpi_os_printf ("0x%2.2X\n", address16_data->resource_type); + acpi_os_printf("0x%2.2X\n", address16_data->resource_type); break; } - acpi_os_printf (" Resource %s\n", - ACPI_CONSUMER == address16_data->producer_consumer ? - "Consumer" : "Producer"); + acpi_os_printf(" Resource %s\n", + ACPI_CONSUMER == address16_data->producer_consumer ? + "Consumer" : "Producer"); - acpi_os_printf (" %s decode\n", - ACPI_SUB_DECODE == address16_data->decode ? - "Subtractive" : "Positive"); + acpi_os_printf(" %s decode\n", + ACPI_SUB_DECODE == address16_data->decode ? + "Subtractive" : "Positive"); - acpi_os_printf (" Min address is %s fixed\n", - ACPI_ADDRESS_FIXED == address16_data->min_address_fixed ? - "" : "not"); + acpi_os_printf(" Min address is %s fixed\n", + ACPI_ADDRESS_FIXED == address16_data->min_address_fixed ? + "" : "not"); - acpi_os_printf (" Max address is %s fixed\n", - ACPI_ADDRESS_FIXED == address16_data->max_address_fixed ? - "" : "not"); + acpi_os_printf(" Max address is %s fixed\n", + ACPI_ADDRESS_FIXED == address16_data->max_address_fixed ? + "" : "not"); - acpi_os_printf (" Granularity: %08X\n", - address16_data->granularity); + acpi_os_printf(" Granularity: %08X\n", address16_data->granularity); - acpi_os_printf (" Address range min: %08X\n", - address16_data->min_address_range); + acpi_os_printf(" Address range min: %08X\n", + address16_data->min_address_range); - acpi_os_printf (" Address range max: %08X\n", - address16_data->max_address_range); + acpi_os_printf(" Address range max: %08X\n", + address16_data->max_address_range); - acpi_os_printf (" Address translation offset: %08X\n", - address16_data->address_translation_offset); + acpi_os_printf(" Address translation offset: %08X\n", + address16_data->address_translation_offset); - acpi_os_printf (" Address Length: %08X\n", - address16_data->address_length); + acpi_os_printf(" Address Length: %08X\n", + address16_data->address_length); if (0xFF != address16_data->resource_source.index) { - acpi_os_printf (" Resource Source Index: %X\n", - address16_data->resource_source.index); + acpi_os_printf(" Resource Source Index: %X\n", + address16_data->resource_source.index); - acpi_os_printf (" Resource Source: %s\n", - address16_data->resource_source.string_ptr); + acpi_os_printf(" Resource Source: %s\n", + address16_data->resource_source.string_ptr); } return; } - /******************************************************************************* * * FUNCTION: acpi_rs_dump_address32 @@ -679,134 +616,136 @@ acpi_rs_dump_address16 ( * ******************************************************************************/ -static void -acpi_rs_dump_address32 ( - union acpi_resource_data *data) +static void acpi_rs_dump_address32(union acpi_resource_data *data) { - struct acpi_resource_address32 *address32_data = (struct acpi_resource_address32 *) data; - - - ACPI_FUNCTION_ENTRY (); + struct acpi_resource_address32 *address32_data = + (struct acpi_resource_address32 *)data; + ACPI_FUNCTION_ENTRY(); - acpi_os_printf ("32-Bit Address Space Resource\n"); + acpi_os_printf("32-Bit Address Space Resource\n"); switch (address32_data->resource_type) { case ACPI_MEMORY_RANGE: - acpi_os_printf (" Resource Type: Memory Range\n"); + acpi_os_printf(" Resource Type: Memory Range\n"); switch (address32_data->attribute.memory.cache_attribute) { case ACPI_NON_CACHEABLE_MEMORY: - acpi_os_printf (" Type Specific: Noncacheable memory\n"); + acpi_os_printf + (" Type Specific: Noncacheable memory\n"); break; case ACPI_CACHABLE_MEMORY: - acpi_os_printf (" Type Specific: Cacheable memory\n"); + acpi_os_printf(" Type Specific: Cacheable memory\n"); break; case ACPI_WRITE_COMBINING_MEMORY: - acpi_os_printf (" Type Specific: Write-combining memory\n"); + acpi_os_printf + (" Type Specific: Write-combining memory\n"); break; case ACPI_PREFETCHABLE_MEMORY: - acpi_os_printf (" Type Specific: Prefetchable memory\n"); + acpi_os_printf + (" Type Specific: Prefetchable memory\n"); break; default: - acpi_os_printf (" Type Specific: Invalid cache attribute\n"); + acpi_os_printf + (" Type Specific: Invalid cache attribute\n"); break; } - acpi_os_printf (" Type Specific: Read%s\n", - ACPI_READ_WRITE_MEMORY == - address32_data->attribute.memory.read_write_attribute ? - "/Write" : " Only"); + acpi_os_printf(" Type Specific: Read%s\n", + ACPI_READ_WRITE_MEMORY == + address32_data->attribute.memory. + read_write_attribute ? "/Write" : " Only"); break; case ACPI_IO_RANGE: - acpi_os_printf (" Resource Type: Io Range\n"); + acpi_os_printf(" Resource Type: Io Range\n"); switch (address32_data->attribute.io.range_attribute) { case ACPI_NON_ISA_ONLY_RANGES: - acpi_os_printf (" Type Specific: Non-ISA Io Addresses\n"); + acpi_os_printf + (" Type Specific: Non-ISA Io Addresses\n"); break; case ACPI_ISA_ONLY_RANGES: - acpi_os_printf (" Type Specific: ISA Io Addresses\n"); + acpi_os_printf(" Type Specific: ISA Io Addresses\n"); break; case ACPI_ENTIRE_RANGE: - acpi_os_printf (" Type Specific: ISA and non-ISA Io Addresses\n"); + acpi_os_printf + (" Type Specific: ISA and non-ISA Io Addresses\n"); break; default: - acpi_os_printf (" Type Specific: Invalid Range attribute"); + acpi_os_printf + (" Type Specific: Invalid Range attribute"); break; } - acpi_os_printf (" Type Specific: %s Translation\n", - ACPI_SPARSE_TRANSLATION == - address32_data->attribute.io.translation_attribute ? - "Sparse" : "Dense"); + acpi_os_printf(" Type Specific: %s Translation\n", + ACPI_SPARSE_TRANSLATION == + address32_data->attribute.io. + translation_attribute ? "Sparse" : "Dense"); break; case ACPI_BUS_NUMBER_RANGE: - acpi_os_printf (" Resource Type: Bus Number Range\n"); + acpi_os_printf(" Resource Type: Bus Number Range\n"); break; default: - acpi_os_printf (" Resource Type: 0x%2.2X\n", - address32_data->resource_type); + acpi_os_printf(" Resource Type: 0x%2.2X\n", + address32_data->resource_type); break; } - acpi_os_printf (" Resource %s\n", - ACPI_CONSUMER == address32_data->producer_consumer ? - "Consumer" : "Producer"); + acpi_os_printf(" Resource %s\n", + ACPI_CONSUMER == address32_data->producer_consumer ? + "Consumer" : "Producer"); - acpi_os_printf (" %s decode\n", - ACPI_SUB_DECODE == address32_data->decode ? - "Subtractive" : "Positive"); + acpi_os_printf(" %s decode\n", + ACPI_SUB_DECODE == address32_data->decode ? + "Subtractive" : "Positive"); - acpi_os_printf (" Min address is %s fixed\n", - ACPI_ADDRESS_FIXED == address32_data->min_address_fixed ? - "" : "not "); + acpi_os_printf(" Min address is %s fixed\n", + ACPI_ADDRESS_FIXED == address32_data->min_address_fixed ? + "" : "not "); - acpi_os_printf (" Max address is %s fixed\n", - ACPI_ADDRESS_FIXED == address32_data->max_address_fixed ? - "" : "not "); + acpi_os_printf(" Max address is %s fixed\n", + ACPI_ADDRESS_FIXED == address32_data->max_address_fixed ? + "" : "not "); - acpi_os_printf (" Granularity: %08X\n", - address32_data->granularity); + acpi_os_printf(" Granularity: %08X\n", address32_data->granularity); - acpi_os_printf (" Address range min: %08X\n", - address32_data->min_address_range); + acpi_os_printf(" Address range min: %08X\n", + address32_data->min_address_range); - acpi_os_printf (" Address range max: %08X\n", - address32_data->max_address_range); + acpi_os_printf(" Address range max: %08X\n", + address32_data->max_address_range); - acpi_os_printf (" Address translation offset: %08X\n", - address32_data->address_translation_offset); + acpi_os_printf(" Address translation offset: %08X\n", + address32_data->address_translation_offset); - acpi_os_printf (" Address Length: %08X\n", - address32_data->address_length); + acpi_os_printf(" Address Length: %08X\n", + address32_data->address_length); - if(0xFF != address32_data->resource_source.index) { - acpi_os_printf (" Resource Source Index: %X\n", - address32_data->resource_source.index); + if (0xFF != address32_data->resource_source.index) { + acpi_os_printf(" Resource Source Index: %X\n", + address32_data->resource_source.index); - acpi_os_printf (" Resource Source: %s\n", - address32_data->resource_source.string_ptr); + acpi_os_printf(" Resource Source: %s\n", + address32_data->resource_source.string_ptr); } return; } - /******************************************************************************* * * FUNCTION: acpi_rs_dump_address64 @@ -819,137 +758,142 @@ acpi_rs_dump_address32 ( * ******************************************************************************/ -static void -acpi_rs_dump_address64 ( - union acpi_resource_data *data) +static void acpi_rs_dump_address64(union acpi_resource_data *data) { - struct acpi_resource_address64 *address64_data = (struct acpi_resource_address64 *) data; - - - ACPI_FUNCTION_ENTRY (); + struct acpi_resource_address64 *address64_data = + (struct acpi_resource_address64 *)data; + ACPI_FUNCTION_ENTRY(); - acpi_os_printf ("64-Bit Address Space Resource\n"); + acpi_os_printf("64-Bit Address Space Resource\n"); switch (address64_data->resource_type) { case ACPI_MEMORY_RANGE: - acpi_os_printf (" Resource Type: Memory Range\n"); + acpi_os_printf(" Resource Type: Memory Range\n"); switch (address64_data->attribute.memory.cache_attribute) { case ACPI_NON_CACHEABLE_MEMORY: - acpi_os_printf (" Type Specific: Noncacheable memory\n"); + acpi_os_printf + (" Type Specific: Noncacheable memory\n"); break; case ACPI_CACHABLE_MEMORY: - acpi_os_printf (" Type Specific: Cacheable memory\n"); + acpi_os_printf(" Type Specific: Cacheable memory\n"); break; case ACPI_WRITE_COMBINING_MEMORY: - acpi_os_printf (" Type Specific: Write-combining memory\n"); + acpi_os_printf + (" Type Specific: Write-combining memory\n"); break; case ACPI_PREFETCHABLE_MEMORY: - acpi_os_printf (" Type Specific: Prefetchable memory\n"); + acpi_os_printf + (" Type Specific: Prefetchable memory\n"); break; default: - acpi_os_printf (" Type Specific: Invalid cache attribute\n"); + acpi_os_printf + (" Type Specific: Invalid cache attribute\n"); break; } - acpi_os_printf (" Type Specific: Read%s\n", - ACPI_READ_WRITE_MEMORY == - address64_data->attribute.memory.read_write_attribute ? - "/Write" : " Only"); + acpi_os_printf(" Type Specific: Read%s\n", + ACPI_READ_WRITE_MEMORY == + address64_data->attribute.memory. + read_write_attribute ? "/Write" : " Only"); break; case ACPI_IO_RANGE: - acpi_os_printf (" Resource Type: Io Range\n"); + acpi_os_printf(" Resource Type: Io Range\n"); switch (address64_data->attribute.io.range_attribute) { case ACPI_NON_ISA_ONLY_RANGES: - acpi_os_printf (" Type Specific: Non-ISA Io Addresses\n"); + acpi_os_printf + (" Type Specific: Non-ISA Io Addresses\n"); break; case ACPI_ISA_ONLY_RANGES: - acpi_os_printf (" Type Specific: ISA Io Addresses\n"); + acpi_os_printf(" Type Specific: ISA Io Addresses\n"); break; case ACPI_ENTIRE_RANGE: - acpi_os_printf (" Type Specific: ISA and non-ISA Io Addresses\n"); + acpi_os_printf + (" Type Specific: ISA and non-ISA Io Addresses\n"); break; default: - acpi_os_printf (" Type Specific: Invalid Range attribute"); + acpi_os_printf + (" Type Specific: Invalid Range attribute"); break; } - acpi_os_printf (" Type Specific: %s Translation\n", - ACPI_SPARSE_TRANSLATION == - address64_data->attribute.io.translation_attribute ? - "Sparse" : "Dense"); + acpi_os_printf(" Type Specific: %s Translation\n", + ACPI_SPARSE_TRANSLATION == + address64_data->attribute.io. + translation_attribute ? "Sparse" : "Dense"); break; case ACPI_BUS_NUMBER_RANGE: - acpi_os_printf (" Resource Type: Bus Number Range\n"); + acpi_os_printf(" Resource Type: Bus Number Range\n"); break; default: - acpi_os_printf (" Resource Type: 0x%2.2X\n", - address64_data->resource_type); + acpi_os_printf(" Resource Type: 0x%2.2X\n", + address64_data->resource_type); break; } - acpi_os_printf (" Resource %s\n", - ACPI_CONSUMER == address64_data->producer_consumer ? - "Consumer" : "Producer"); + acpi_os_printf(" Resource %s\n", + ACPI_CONSUMER == address64_data->producer_consumer ? + "Consumer" : "Producer"); - acpi_os_printf (" %s decode\n", - ACPI_SUB_DECODE == address64_data->decode ? - "Subtractive" : "Positive"); + acpi_os_printf(" %s decode\n", + ACPI_SUB_DECODE == address64_data->decode ? + "Subtractive" : "Positive"); - acpi_os_printf (" Min address is %s fixed\n", - ACPI_ADDRESS_FIXED == address64_data->min_address_fixed ? - "" : "not "); + acpi_os_printf(" Min address is %s fixed\n", + ACPI_ADDRESS_FIXED == address64_data->min_address_fixed ? + "" : "not "); - acpi_os_printf (" Max address is %s fixed\n", - ACPI_ADDRESS_FIXED == address64_data->max_address_fixed ? - "" : "not "); + acpi_os_printf(" Max address is %s fixed\n", + ACPI_ADDRESS_FIXED == address64_data->max_address_fixed ? + "" : "not "); - acpi_os_printf (" Granularity: %8.8X%8.8X\n", - ACPI_FORMAT_UINT64 (address64_data->granularity)); + acpi_os_printf(" Granularity: %8.8X%8.8X\n", + ACPI_FORMAT_UINT64(address64_data->granularity)); - acpi_os_printf (" Address range min: %8.8X%8.8X\n", - ACPI_FORMAT_UINT64 (address64_data->min_address_range)); + acpi_os_printf(" Address range min: %8.8X%8.8X\n", + ACPI_FORMAT_UINT64(address64_data->min_address_range)); - acpi_os_printf (" Address range max: %8.8X%8.8X\n", - ACPI_FORMAT_UINT64 (address64_data->max_address_range)); + acpi_os_printf(" Address range max: %8.8X%8.8X\n", + ACPI_FORMAT_UINT64(address64_data->max_address_range)); - acpi_os_printf (" Address translation offset: %8.8X%8.8X\n", - ACPI_FORMAT_UINT64 (address64_data->address_translation_offset)); + acpi_os_printf(" Address translation offset: %8.8X%8.8X\n", + ACPI_FORMAT_UINT64(address64_data-> + address_translation_offset)); - acpi_os_printf (" Address Length: %8.8X%8.8X\n", - ACPI_FORMAT_UINT64 (address64_data->address_length)); + acpi_os_printf(" Address Length: %8.8X%8.8X\n", + ACPI_FORMAT_UINT64(address64_data->address_length)); - acpi_os_printf (" Type Specific Attributes: %8.8X%8.8X\n", - ACPI_FORMAT_UINT64 (address64_data->type_specific_attributes)); + acpi_os_printf(" Type Specific Attributes: %8.8X%8.8X\n", + ACPI_FORMAT_UINT64(address64_data-> + type_specific_attributes)); if (0xFF != address64_data->resource_source.index) { - acpi_os_printf (" Resource Source Index: %X\n", - address64_data->resource_source.index); + acpi_os_printf(" Resource Source Index: %X\n", + address64_data->resource_source.index); - acpi_os_printf (" Resource Source: %s\n", - address64_data->resource_source.string_ptr); + acpi_os_printf(" Resource Source: %s\n", + address64_data->resource_source.string_ptr); } return; } - /******************************************************************************* * * FUNCTION: acpi_rs_dump_extended_irq @@ -962,55 +906,52 @@ acpi_rs_dump_address64 ( * ******************************************************************************/ -static void -acpi_rs_dump_extended_irq ( - union acpi_resource_data *data) +static void acpi_rs_dump_extended_irq(union acpi_resource_data *data) { - struct acpi_resource_ext_irq *ext_irq_data = (struct acpi_resource_ext_irq *) data; - u8 index = 0; - - - ACPI_FUNCTION_ENTRY (); + struct acpi_resource_ext_irq *ext_irq_data = + (struct acpi_resource_ext_irq *)data; + u8 index = 0; + ACPI_FUNCTION_ENTRY(); - acpi_os_printf ("Extended IRQ Resource\n"); + acpi_os_printf("Extended IRQ Resource\n"); - acpi_os_printf (" Resource %s\n", - ACPI_CONSUMER == ext_irq_data->producer_consumer ? - "Consumer" : "Producer"); + acpi_os_printf(" Resource %s\n", + ACPI_CONSUMER == ext_irq_data->producer_consumer ? + "Consumer" : "Producer"); - acpi_os_printf (" %s\n", - ACPI_LEVEL_SENSITIVE == ext_irq_data->edge_level ? - "Level" : "Edge"); + acpi_os_printf(" %s\n", + ACPI_LEVEL_SENSITIVE == ext_irq_data->edge_level ? + "Level" : "Edge"); - acpi_os_printf (" Active %s\n", - ACPI_ACTIVE_LOW == ext_irq_data->active_high_low ? - "low" : "high"); + acpi_os_printf(" Active %s\n", + ACPI_ACTIVE_LOW == ext_irq_data->active_high_low ? + "low" : "high"); - acpi_os_printf (" %s\n", - ACPI_SHARED == ext_irq_data->shared_exclusive ? - "Shared" : "Exclusive"); + acpi_os_printf(" %s\n", + ACPI_SHARED == ext_irq_data->shared_exclusive ? + "Shared" : "Exclusive"); - acpi_os_printf (" Interrupts : %X ( ", ext_irq_data->number_of_interrupts); + acpi_os_printf(" Interrupts : %X ( ", + ext_irq_data->number_of_interrupts); for (index = 0; index < ext_irq_data->number_of_interrupts; index++) { - acpi_os_printf ("%X ", ext_irq_data->interrupts[index]); + acpi_os_printf("%X ", ext_irq_data->interrupts[index]); } - acpi_os_printf (")\n"); + acpi_os_printf(")\n"); - if(0xFF != ext_irq_data->resource_source.index) { - acpi_os_printf (" Resource Source Index: %X", - ext_irq_data->resource_source.index); + if (0xFF != ext_irq_data->resource_source.index) { + acpi_os_printf(" Resource Source Index: %X", + ext_irq_data->resource_source.index); - acpi_os_printf (" Resource Source: %s", - ext_irq_data->resource_source.string_ptr); + acpi_os_printf(" Resource Source: %s", + ext_irq_data->resource_source.string_ptr); } return; } - /******************************************************************************* * * FUNCTION: acpi_rs_dump_resource_list @@ -1023,92 +964,91 @@ acpi_rs_dump_extended_irq ( * ******************************************************************************/ -void -acpi_rs_dump_resource_list ( - struct acpi_resource *resource) +void acpi_rs_dump_resource_list(struct acpi_resource *resource) { - u8 count = 0; - u8 done = FALSE; - - - ACPI_FUNCTION_ENTRY (); + u8 count = 0; + u8 done = FALSE; + ACPI_FUNCTION_ENTRY(); if (acpi_dbg_level & ACPI_LV_RESOURCES && _COMPONENT & acpi_dbg_layer) { while (!done) { - acpi_os_printf ("Resource structure %X.\n", count++); + acpi_os_printf("Resource structure %X.\n", count++); switch (resource->id) { case ACPI_RSTYPE_IRQ: - acpi_rs_dump_irq (&resource->data); + acpi_rs_dump_irq(&resource->data); break; case ACPI_RSTYPE_DMA: - acpi_rs_dump_dma (&resource->data); + acpi_rs_dump_dma(&resource->data); break; case ACPI_RSTYPE_START_DPF: - acpi_rs_dump_start_depend_fns (&resource->data); + acpi_rs_dump_start_depend_fns(&resource->data); break; case ACPI_RSTYPE_END_DPF: - acpi_os_printf ("end_dependent_functions Resource\n"); - /* acpi_rs_dump_end_dependent_functions (Resource->Data);*/ + acpi_os_printf + ("end_dependent_functions Resource\n"); + /* acpi_rs_dump_end_dependent_functions (Resource->Data); */ break; case ACPI_RSTYPE_IO: - acpi_rs_dump_io (&resource->data); + acpi_rs_dump_io(&resource->data); break; case ACPI_RSTYPE_FIXED_IO: - acpi_rs_dump_fixed_io (&resource->data); + acpi_rs_dump_fixed_io(&resource->data); break; case ACPI_RSTYPE_VENDOR: - acpi_rs_dump_vendor_specific (&resource->data); + acpi_rs_dump_vendor_specific(&resource->data); break; case ACPI_RSTYPE_END_TAG: - /*rs_dump_end_tag (Resource->Data);*/ - acpi_os_printf ("end_tag Resource\n"); + /*rs_dump_end_tag (Resource->Data); */ + acpi_os_printf("end_tag Resource\n"); done = TRUE; break; case ACPI_RSTYPE_MEM24: - acpi_rs_dump_memory24 (&resource->data); + acpi_rs_dump_memory24(&resource->data); break; case ACPI_RSTYPE_MEM32: - acpi_rs_dump_memory32 (&resource->data); + acpi_rs_dump_memory32(&resource->data); break; case ACPI_RSTYPE_FIXED_MEM32: - acpi_rs_dump_fixed_memory32 (&resource->data); + acpi_rs_dump_fixed_memory32(&resource->data); break; case ACPI_RSTYPE_ADDRESS16: - acpi_rs_dump_address16 (&resource->data); + acpi_rs_dump_address16(&resource->data); break; case ACPI_RSTYPE_ADDRESS32: - acpi_rs_dump_address32 (&resource->data); + acpi_rs_dump_address32(&resource->data); break; case ACPI_RSTYPE_ADDRESS64: - acpi_rs_dump_address64 (&resource->data); + acpi_rs_dump_address64(&resource->data); break; case ACPI_RSTYPE_EXT_IRQ: - acpi_rs_dump_extended_irq (&resource->data); + acpi_rs_dump_extended_irq(&resource->data); break; default: - acpi_os_printf ("Invalid resource type\n"); + acpi_os_printf("Invalid resource type\n"); break; } - resource = ACPI_PTR_ADD (struct acpi_resource, resource, resource->length); + resource = + ACPI_PTR_ADD(struct acpi_resource, resource, + resource->length); } } @@ -1127,36 +1067,38 @@ acpi_rs_dump_resource_list ( * ******************************************************************************/ -void -acpi_rs_dump_irq_list ( - u8 *route_table) +void acpi_rs_dump_irq_list(u8 * route_table) { - u8 *buffer = route_table; - u8 count = 0; - u8 done = FALSE; - struct acpi_pci_routing_table *prt_element; - - - ACPI_FUNCTION_ENTRY (); + u8 *buffer = route_table; + u8 count = 0; + u8 done = FALSE; + struct acpi_pci_routing_table *prt_element; + ACPI_FUNCTION_ENTRY(); if (acpi_dbg_level & ACPI_LV_RESOURCES && _COMPONENT & acpi_dbg_layer) { - prt_element = ACPI_CAST_PTR (struct acpi_pci_routing_table, buffer); + prt_element = + ACPI_CAST_PTR(struct acpi_pci_routing_table, buffer); while (!done) { - acpi_os_printf ("PCI IRQ Routing Table structure %X.\n", count++); + acpi_os_printf("PCI IRQ Routing Table structure %X.\n", + count++); - acpi_os_printf (" Address: %8.8X%8.8X\n", - ACPI_FORMAT_UINT64 (prt_element->address)); + acpi_os_printf(" Address: %8.8X%8.8X\n", + ACPI_FORMAT_UINT64(prt_element-> + address)); - acpi_os_printf (" Pin: %X\n", prt_element->pin); + acpi_os_printf(" Pin: %X\n", prt_element->pin); - acpi_os_printf (" Source: %s\n", prt_element->source); + acpi_os_printf(" Source: %s\n", prt_element->source); - acpi_os_printf (" source_index: %X\n", prt_element->source_index); + acpi_os_printf(" source_index: %X\n", + prt_element->source_index); buffer += prt_element->length; - prt_element = ACPI_CAST_PTR (struct acpi_pci_routing_table, buffer); + prt_element = + ACPI_CAST_PTR(struct acpi_pci_routing_table, + buffer); if (0 == prt_element->length) { done = TRUE; } @@ -1167,4 +1109,3 @@ acpi_rs_dump_irq_list ( } #endif - diff --git a/drivers/acpi/resources/rsio.c b/drivers/acpi/resources/rsio.c index 23a4d149fac..d53bbe89e85 100644 --- a/drivers/acpi/resources/rsio.c +++ b/drivers/acpi/resources/rsio.c @@ -41,13 +41,11 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include #include #define _COMPONENT ACPI_RESOURCES - ACPI_MODULE_NAME ("rsio") - +ACPI_MODULE_NAME("rsio") /******************************************************************************* * @@ -69,24 +67,18 @@ * number of bytes consumed from the byte stream. * ******************************************************************************/ - acpi_status -acpi_rs_io_resource ( - u8 *byte_stream_buffer, - acpi_size *bytes_consumed, - u8 **output_buffer, - acpi_size *structure_size) +acpi_rs_io_resource(u8 * byte_stream_buffer, + acpi_size * bytes_consumed, + u8 ** output_buffer, acpi_size * structure_size) { - u8 *buffer = byte_stream_buffer; - struct acpi_resource *output_struct = (void *) *output_buffer; - u16 temp16 = 0; - u8 temp8 = 0; - acpi_size struct_size = ACPI_SIZEOF_RESOURCE ( - struct acpi_resource_io); - - - ACPI_FUNCTION_TRACE ("rs_io_resource"); + u8 *buffer = byte_stream_buffer; + struct acpi_resource *output_struct = (void *)*output_buffer; + u16 temp16 = 0; + u8 temp8 = 0; + acpi_size struct_size = ACPI_SIZEOF_RESOURCE(struct acpi_resource_io); + ACPI_FUNCTION_TRACE("rs_io_resource"); /* The number of bytes consumed are Constant */ @@ -104,14 +96,14 @@ acpi_rs_io_resource ( /* Check min_base Address */ buffer += 1; - ACPI_MOVE_16_TO_16 (&temp16, buffer); + ACPI_MOVE_16_TO_16(&temp16, buffer); output_struct->data.io.min_base_address = temp16; /* Check max_base Address */ buffer += 2; - ACPI_MOVE_16_TO_16 (&temp16, buffer); + ACPI_MOVE_16_TO_16(&temp16, buffer); output_struct->data.io.max_base_address = temp16; @@ -136,10 +128,9 @@ acpi_rs_io_resource ( /* Return the final size of the structure */ *structure_size = struct_size; - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_rs_fixed_io_resource @@ -162,22 +153,18 @@ acpi_rs_io_resource ( ******************************************************************************/ acpi_status -acpi_rs_fixed_io_resource ( - u8 *byte_stream_buffer, - acpi_size *bytes_consumed, - u8 **output_buffer, - acpi_size *structure_size) +acpi_rs_fixed_io_resource(u8 * byte_stream_buffer, + acpi_size * bytes_consumed, + u8 ** output_buffer, acpi_size * structure_size) { - u8 *buffer = byte_stream_buffer; - struct acpi_resource *output_struct = (void *) *output_buffer; - u16 temp16 = 0; - u8 temp8 = 0; - acpi_size struct_size = ACPI_SIZEOF_RESOURCE ( - struct acpi_resource_fixed_io); - - - ACPI_FUNCTION_TRACE ("rs_fixed_io_resource"); + u8 *buffer = byte_stream_buffer; + struct acpi_resource *output_struct = (void *)*output_buffer; + u16 temp16 = 0; + u8 temp8 = 0; + acpi_size struct_size = + ACPI_SIZEOF_RESOURCE(struct acpi_resource_fixed_io); + ACPI_FUNCTION_TRACE("rs_fixed_io_resource"); /* The number of bytes consumed are Constant */ @@ -188,7 +175,7 @@ acpi_rs_fixed_io_resource ( /* Check Range Base Address */ buffer += 1; - ACPI_MOVE_16_TO_16 (&temp16, buffer); + ACPI_MOVE_16_TO_16(&temp16, buffer); output_struct->data.fixed_io.base_address = temp16; @@ -206,10 +193,9 @@ acpi_rs_fixed_io_resource ( /* Return the final size of the structure */ *structure_size = struct_size; - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_rs_io_stream @@ -227,18 +213,14 @@ acpi_rs_fixed_io_resource ( ******************************************************************************/ acpi_status -acpi_rs_io_stream ( - struct acpi_resource *linked_list, - u8 **output_buffer, - acpi_size *bytes_consumed) +acpi_rs_io_stream(struct acpi_resource *linked_list, + u8 ** output_buffer, acpi_size * bytes_consumed) { - u8 *buffer = *output_buffer; - u16 temp16 = 0; - u8 temp8 = 0; - - - ACPI_FUNCTION_TRACE ("rs_io_stream"); + u8 *buffer = *output_buffer; + u16 temp16 = 0; + u8 temp8 = 0; + ACPI_FUNCTION_TRACE("rs_io_stream"); /* The descriptor field is static */ @@ -256,14 +238,14 @@ acpi_rs_io_stream ( temp16 = (u16) linked_list->data.io.min_base_address; - ACPI_MOVE_16_TO_16 (buffer, &temp16); + ACPI_MOVE_16_TO_16(buffer, &temp16); buffer += 2; /* Set the Range maximum base address */ temp16 = (u16) linked_list->data.io.max_base_address; - ACPI_MOVE_16_TO_16 (buffer, &temp16); + ACPI_MOVE_16_TO_16(buffer, &temp16); buffer += 2; /* Set the base alignment */ @@ -282,11 +264,10 @@ acpi_rs_io_stream ( /* Return the number of bytes consumed in this operation */ - *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); - return_ACPI_STATUS (AE_OK); + *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_rs_fixed_io_stream @@ -304,18 +285,14 @@ acpi_rs_io_stream ( ******************************************************************************/ acpi_status -acpi_rs_fixed_io_stream ( - struct acpi_resource *linked_list, - u8 **output_buffer, - acpi_size *bytes_consumed) +acpi_rs_fixed_io_stream(struct acpi_resource *linked_list, + u8 ** output_buffer, acpi_size * bytes_consumed) { - u8 *buffer = *output_buffer; - u16 temp16 = 0; - u8 temp8 = 0; - - - ACPI_FUNCTION_TRACE ("rs_fixed_io_stream"); + u8 *buffer = *output_buffer; + u16 temp16 = 0; + u8 temp8 = 0; + ACPI_FUNCTION_TRACE("rs_fixed_io_stream"); /* The descriptor field is static */ @@ -327,7 +304,7 @@ acpi_rs_fixed_io_stream ( temp16 = (u16) linked_list->data.fixed_io.base_address; - ACPI_MOVE_16_TO_16 (buffer, &temp16); + ACPI_MOVE_16_TO_16(buffer, &temp16); buffer += 2; /* Set the range length */ @@ -339,11 +316,10 @@ acpi_rs_fixed_io_stream ( /* Return the number of bytes consumed in this operation */ - *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); - return_ACPI_STATUS (AE_OK); + *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_rs_dma_resource @@ -366,23 +342,18 @@ acpi_rs_fixed_io_stream ( ******************************************************************************/ acpi_status -acpi_rs_dma_resource ( - u8 *byte_stream_buffer, - acpi_size *bytes_consumed, - u8 **output_buffer, - acpi_size *structure_size) +acpi_rs_dma_resource(u8 * byte_stream_buffer, + acpi_size * bytes_consumed, + u8 ** output_buffer, acpi_size * structure_size) { - u8 *buffer = byte_stream_buffer; - struct acpi_resource *output_struct = (void *) *output_buffer; - u8 temp8 = 0; - u8 index; - u8 i; - acpi_size struct_size = ACPI_SIZEOF_RESOURCE ( - struct acpi_resource_dma); - - - ACPI_FUNCTION_TRACE ("rs_dma_resource"); + u8 *buffer = byte_stream_buffer; + struct acpi_resource *output_struct = (void *)*output_buffer; + u8 temp8 = 0; + u8 index; + u8 i; + acpi_size struct_size = ACPI_SIZEOF_RESOURCE(struct acpi_resource_dma); + ACPI_FUNCTION_TRACE("rs_dma_resource"); /* The number of bytes consumed are Constant */ @@ -422,9 +393,9 @@ acpi_rs_dma_resource ( output_struct->data.dma.transfer = temp8 & 0x03; if (0x03 == output_struct->data.dma.transfer) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Invalid DMA.Transfer preference (3)\n")); - return_ACPI_STATUS (AE_BAD_DATA); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Invalid DMA.Transfer preference (3)\n")); + return_ACPI_STATUS(AE_BAD_DATA); } /* Get bus master preference (Bit[2]) */ @@ -442,10 +413,9 @@ acpi_rs_dma_resource ( /* Return the final size of the structure */ *structure_size = struct_size; - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_rs_dma_stream @@ -463,19 +433,15 @@ acpi_rs_dma_resource ( ******************************************************************************/ acpi_status -acpi_rs_dma_stream ( - struct acpi_resource *linked_list, - u8 **output_buffer, - acpi_size *bytes_consumed) +acpi_rs_dma_stream(struct acpi_resource *linked_list, + u8 ** output_buffer, acpi_size * bytes_consumed) { - u8 *buffer = *output_buffer; - u16 temp16 = 0; - u8 temp8 = 0; - u8 index; - - - ACPI_FUNCTION_TRACE ("rs_dma_stream"); + u8 *buffer = *output_buffer; + u16 temp16 = 0; + u8 temp8 = 0; + u8 index; + ACPI_FUNCTION_TRACE("rs_dma_stream"); /* The descriptor field is static */ @@ -486,8 +452,7 @@ acpi_rs_dma_stream ( /* Loop through all of the Channels and set the mask bits */ for (index = 0; - index < linked_list->data.dma.number_of_channels; - index++) { + index < linked_list->data.dma.number_of_channels; index++) { temp16 = (u16) linked_list->data.dma.channels[index]; temp8 |= 0x1 << temp16; } @@ -506,7 +471,6 @@ acpi_rs_dma_stream ( /* Return the number of bytes consumed in this operation */ - *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); - return_ACPI_STATUS (AE_OK); + *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer); + return_ACPI_STATUS(AE_OK); } - diff --git a/drivers/acpi/resources/rsirq.c b/drivers/acpi/resources/rsirq.c index 8a2b630be45..7179b6243f5 100644 --- a/drivers/acpi/resources/rsirq.c +++ b/drivers/acpi/resources/rsirq.c @@ -41,13 +41,11 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include #include #define _COMPONENT ACPI_RESOURCES - ACPI_MODULE_NAME ("rsirq") - +ACPI_MODULE_NAME("rsirq") /******************************************************************************* * @@ -69,26 +67,20 @@ * number of bytes consumed from the byte stream. * ******************************************************************************/ - acpi_status -acpi_rs_irq_resource ( - u8 *byte_stream_buffer, - acpi_size *bytes_consumed, - u8 **output_buffer, - acpi_size *structure_size) +acpi_rs_irq_resource(u8 * byte_stream_buffer, + acpi_size * bytes_consumed, + u8 ** output_buffer, acpi_size * structure_size) { - u8 *buffer = byte_stream_buffer; - struct acpi_resource *output_struct = (void *) *output_buffer; - u16 temp16 = 0; - u8 temp8 = 0; - u8 index; - u8 i; - acpi_size struct_size = ACPI_SIZEOF_RESOURCE ( - struct acpi_resource_irq); - - - ACPI_FUNCTION_TRACE ("rs_irq_resource"); + u8 *buffer = byte_stream_buffer; + struct acpi_resource *output_struct = (void *)*output_buffer; + u16 temp16 = 0; + u8 temp8 = 0; + u8 index; + u8 i; + acpi_size struct_size = ACPI_SIZEOF_RESOURCE(struct acpi_resource_irq); + ACPI_FUNCTION_TRACE("rs_irq_resource"); /* * The number of bytes consumed are contained in the descriptor @@ -101,7 +93,7 @@ acpi_rs_irq_resource ( /* Point to the 16-bits of Bytes 1 and 2 */ buffer += 1; - ACPI_MOVE_16_TO_16 (&temp16, buffer); + ACPI_MOVE_16_TO_16(&temp16, buffer); output_struct->data.irq.number_of_interrupts = 0; @@ -132,14 +124,18 @@ acpi_rs_irq_resource ( /* Check for HE, LL interrupts */ switch (temp8 & 0x09) { - case 0x01: /* HE */ - output_struct->data.irq.edge_level = ACPI_EDGE_SENSITIVE; - output_struct->data.irq.active_high_low = ACPI_ACTIVE_HIGH; + case 0x01: /* HE */ + output_struct->data.irq.edge_level = + ACPI_EDGE_SENSITIVE; + output_struct->data.irq.active_high_low = + ACPI_ACTIVE_HIGH; break; - case 0x08: /* LL */ - output_struct->data.irq.edge_level = ACPI_LEVEL_SENSITIVE; - output_struct->data.irq.active_high_low = ACPI_ACTIVE_LOW; + case 0x08: /* LL */ + output_struct->data.irq.edge_level = + ACPI_LEVEL_SENSITIVE; + output_struct->data.irq.active_high_low = + ACPI_ACTIVE_LOW; break; default: @@ -148,17 +144,16 @@ acpi_rs_irq_resource ( * are allowed (ACPI spec, section "IRQ Format") * so 0x00 and 0x09 are illegal. */ - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Invalid interrupt polarity/trigger in resource list, %X\n", - temp8)); - return_ACPI_STATUS (AE_BAD_DATA); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Invalid interrupt polarity/trigger in resource list, %X\n", + temp8)); + return_ACPI_STATUS(AE_BAD_DATA); } /* Check for sharable */ output_struct->data.irq.shared_exclusive = (temp8 >> 3) & 0x01; - } - else { + } else { /* * Assume Edge Sensitive, Active High, Non-Sharable * per ACPI Specification @@ -175,10 +170,9 @@ acpi_rs_irq_resource ( /* Return the final size of the structure */ *structure_size = struct_size; - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_rs_irq_stream @@ -196,32 +190,27 @@ acpi_rs_irq_resource ( ******************************************************************************/ acpi_status -acpi_rs_irq_stream ( - struct acpi_resource *linked_list, - u8 **output_buffer, - acpi_size *bytes_consumed) +acpi_rs_irq_stream(struct acpi_resource *linked_list, + u8 ** output_buffer, acpi_size * bytes_consumed) { - u8 *buffer = *output_buffer; - u16 temp16 = 0; - u8 temp8 = 0; - u8 index; - u8 IRqinfo_byte_needed; - - - ACPI_FUNCTION_TRACE ("rs_irq_stream"); + u8 *buffer = *output_buffer; + u16 temp16 = 0; + u8 temp8 = 0; + u8 index; + u8 IRqinfo_byte_needed; + ACPI_FUNCTION_TRACE("rs_irq_stream"); /* * The descriptor field is set based upon whether a third byte is * needed to contain the IRQ Information. */ if (ACPI_EDGE_SENSITIVE == linked_list->data.irq.edge_level && - ACPI_ACTIVE_HIGH == linked_list->data.irq.active_high_low && - ACPI_EXCLUSIVE == linked_list->data.irq.shared_exclusive) { + ACPI_ACTIVE_HIGH == linked_list->data.irq.active_high_low && + ACPI_EXCLUSIVE == linked_list->data.irq.shared_exclusive) { *buffer = 0x22; IRqinfo_byte_needed = FALSE; - } - else { + } else { *buffer = 0x23; IRqinfo_byte_needed = TRUE; } @@ -231,14 +220,13 @@ acpi_rs_irq_stream ( /* Loop through all of the interrupts and set the mask bits */ - for(index = 0; - index < linked_list->data.irq.number_of_interrupts; - index++) { + for (index = 0; + index < linked_list->data.irq.number_of_interrupts; index++) { temp8 = (u8) linked_list->data.irq.interrupts[index]; temp16 |= 0x1 << temp8; } - ACPI_MOVE_16_TO_16 (buffer, &temp16); + ACPI_MOVE_16_TO_16(buffer, &temp16); buffer += 2; /* Set the IRQ Info byte if needed. */ @@ -246,13 +234,12 @@ acpi_rs_irq_stream ( if (IRqinfo_byte_needed) { temp8 = 0; temp8 = (u8) ((linked_list->data.irq.shared_exclusive & - 0x01) << 4); + 0x01) << 4); if (ACPI_LEVEL_SENSITIVE == linked_list->data.irq.edge_level && - ACPI_ACTIVE_LOW == linked_list->data.irq.active_high_low) { + ACPI_ACTIVE_LOW == linked_list->data.irq.active_high_low) { temp8 |= 0x08; - } - else { + } else { temp8 |= 0x01; } @@ -262,11 +249,10 @@ acpi_rs_irq_stream ( /* Return the number of bytes consumed in this operation */ - *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); - return_ACPI_STATUS (AE_OK); + *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_rs_extended_irq_resource @@ -289,34 +275,30 @@ acpi_rs_irq_stream ( ******************************************************************************/ acpi_status -acpi_rs_extended_irq_resource ( - u8 *byte_stream_buffer, - acpi_size *bytes_consumed, - u8 **output_buffer, - acpi_size *structure_size) +acpi_rs_extended_irq_resource(u8 * byte_stream_buffer, + acpi_size * bytes_consumed, + u8 ** output_buffer, acpi_size * structure_size) { - u8 *buffer = byte_stream_buffer; - struct acpi_resource *output_struct = (void *) *output_buffer; - u16 temp16 = 0; - u8 temp8 = 0; - u8 *temp_ptr; - u8 index; - acpi_size struct_size = ACPI_SIZEOF_RESOURCE ( - struct acpi_resource_ext_irq); - - - ACPI_FUNCTION_TRACE ("rs_extended_irq_resource"); + u8 *buffer = byte_stream_buffer; + struct acpi_resource *output_struct = (void *)*output_buffer; + u16 temp16 = 0; + u8 temp8 = 0; + u8 *temp_ptr; + u8 index; + acpi_size struct_size = + ACPI_SIZEOF_RESOURCE(struct acpi_resource_ext_irq); + ACPI_FUNCTION_TRACE("rs_extended_irq_resource"); /* Point past the Descriptor to get the number of bytes consumed */ buffer += 1; - ACPI_MOVE_16_TO_16 (&temp16, buffer); + ACPI_MOVE_16_TO_16(&temp16, buffer); /* Validate minimum descriptor length */ if (temp16 < 6) { - return_ACPI_STATUS (AE_AML_BAD_RESOURCE_LENGTH); + return_ACPI_STATUS(AE_AML_BAD_RESOURCE_LENGTH); } *bytes_consumed = temp16 + 3; @@ -338,7 +320,7 @@ acpi_rs_extended_irq_resource ( * - Edge/Level are defined opposite in the table vs the headers */ output_struct->data.extended_irq.edge_level = - (temp8 & 0x2) ? ACPI_EDGE_SENSITIVE : ACPI_LEVEL_SENSITIVE; + (temp8 & 0x2) ? ACPI_EDGE_SENSITIVE : ACPI_LEVEL_SENSITIVE; /* Check Interrupt Polarity */ @@ -356,7 +338,7 @@ acpi_rs_extended_irq_resource ( /* Must have at least one IRQ */ if (temp8 < 1) { - return_ACPI_STATUS (AE_AML_BAD_RESOURCE_LENGTH); + return_ACPI_STATUS(AE_AML_BAD_RESOURCE_LENGTH); } output_struct->data.extended_irq.number_of_interrupts = temp8; @@ -374,8 +356,8 @@ acpi_rs_extended_irq_resource ( /* Cycle through every IRQ in the table */ for (index = 0; index < temp8; index++) { - ACPI_MOVE_32_TO_32 ( - &output_struct->data.extended_irq.interrupts[index], buffer); + ACPI_MOVE_32_TO_32(&output_struct->data.extended_irq. + interrupts[index], buffer); /* Point to the next IRQ */ @@ -393,12 +375,13 @@ acpi_rs_extended_irq_resource ( * we add 1 to the length. */ if (*bytes_consumed > - ((acpi_size) output_struct->data.extended_irq.number_of_interrupts * 4) + - (5 + 1)) { + ((acpi_size) output_struct->data.extended_irq.number_of_interrupts * + 4) + (5 + 1)) { /* Dereference the Index */ temp8 = *buffer; - output_struct->data.extended_irq.resource_source.index = (u32) temp8; + output_struct->data.extended_irq.resource_source.index = + (u32) temp8; /* Point to the String */ @@ -407,10 +390,10 @@ acpi_rs_extended_irq_resource ( /* Point the String pointer to the end of this structure. */ output_struct->data.extended_irq.resource_source.string_ptr = - (char *)((char *) output_struct + struct_size); + (char *)((char *)output_struct + struct_size); temp_ptr = (u8 *) - output_struct->data.extended_irq.resource_source.string_ptr; + output_struct->data.extended_irq.resource_source.string_ptr; /* Copy the string into the buffer */ @@ -426,7 +409,8 @@ acpi_rs_extended_irq_resource ( /* Add the terminating null */ *temp_ptr = 0x00; - output_struct->data.extended_irq.resource_source.string_length = index + 1; + output_struct->data.extended_irq.resource_source.string_length = + index + 1; /* * In order for the struct_size to fall on a 32-bit boundary, @@ -434,12 +418,13 @@ acpi_rs_extended_irq_resource ( * struct_size to the next 32-bit boundary. */ temp8 = (u8) (index + 1); - struct_size += ACPI_ROUND_UP_to_32_bITS (temp8); - } - else { + struct_size += ACPI_ROUND_UP_to_32_bITS(temp8); + } else { output_struct->data.extended_irq.resource_source.index = 0x00; - output_struct->data.extended_irq.resource_source.string_length = 0; - output_struct->data.extended_irq.resource_source.string_ptr = NULL; + output_struct->data.extended_irq.resource_source.string_length = + 0; + output_struct->data.extended_irq.resource_source.string_ptr = + NULL; } /* Set the Length parameter */ @@ -449,10 +434,9 @@ acpi_rs_extended_irq_resource ( /* Return the final size of the structure */ *structure_size = struct_size; - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_rs_extended_irq_stream @@ -470,20 +454,16 @@ acpi_rs_extended_irq_resource ( ******************************************************************************/ acpi_status -acpi_rs_extended_irq_stream ( - struct acpi_resource *linked_list, - u8 **output_buffer, - acpi_size *bytes_consumed) +acpi_rs_extended_irq_stream(struct acpi_resource *linked_list, + u8 ** output_buffer, acpi_size * bytes_consumed) { - u8 *buffer = *output_buffer; - u16 *length_field; - u8 temp8 = 0; - u8 index; - char *temp_pointer = NULL; - - - ACPI_FUNCTION_TRACE ("rs_extended_irq_stream"); + u8 *buffer = *output_buffer; + u16 *length_field; + u8 temp8 = 0; + u8 index; + char *temp_pointer = NULL; + ACPI_FUNCTION_TRACE("rs_extended_irq_stream"); /* The descriptor field is static */ @@ -492,13 +472,14 @@ acpi_rs_extended_irq_stream ( /* Set a pointer to the Length field - to be filled in later */ - length_field = ACPI_CAST_PTR (u16, buffer); + length_field = ACPI_CAST_PTR(u16, buffer); buffer += 2; /* Set the Interrupt vector flags */ - temp8 = (u8)(linked_list->data.extended_irq.producer_consumer & 0x01); - temp8 |= ((linked_list->data.extended_irq.shared_exclusive & 0x01) << 3); + temp8 = (u8) (linked_list->data.extended_irq.producer_consumer & 0x01); + temp8 |= + ((linked_list->data.extended_irq.shared_exclusive & 0x01) << 3); /* * Set the Interrupt Mode @@ -527,43 +508,48 @@ acpi_rs_extended_irq_stream ( *buffer = temp8; buffer += 1; - for (index = 0; index < linked_list->data.extended_irq.number_of_interrupts; - index++) { - ACPI_MOVE_32_TO_32 (buffer, - &linked_list->data.extended_irq.interrupts[index]); + for (index = 0; + index < linked_list->data.extended_irq.number_of_interrupts; + index++) { + ACPI_MOVE_32_TO_32(buffer, + &linked_list->data.extended_irq. + interrupts[index]); buffer += 4; } /* Resource Source Index and Resource Source are optional */ if (0 != linked_list->data.extended_irq.resource_source.string_length) { - *buffer = (u8) linked_list->data.extended_irq.resource_source.index; + *buffer = + (u8) linked_list->data.extended_irq.resource_source.index; buffer += 1; - temp_pointer = (char *) buffer; + temp_pointer = (char *)buffer; /* Copy the string */ - ACPI_STRCPY (temp_pointer, - linked_list->data.extended_irq.resource_source.string_ptr); + ACPI_STRCPY(temp_pointer, + linked_list->data.extended_irq.resource_source. + string_ptr); /* * Buffer needs to be set to the length of the sting + one for the * terminating null */ - buffer += (acpi_size) (ACPI_STRLEN ( - linked_list->data.extended_irq.resource_source.string_ptr) + 1); + buffer += + (acpi_size) (ACPI_STRLEN + (linked_list->data.extended_irq. + resource_source.string_ptr) + 1); } /* Return the number of bytes consumed in this operation */ - *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); + *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer); /* * Set the length field to the number of bytes consumed * minus the header size (3 bytes) */ *length_field = (u16) (*bytes_consumed - 3); - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - diff --git a/drivers/acpi/resources/rslist.c b/drivers/acpi/resources/rslist.c index db7bcb4e60e..103eb31c284 100644 --- a/drivers/acpi/resources/rslist.c +++ b/drivers/acpi/resources/rslist.c @@ -41,13 +41,11 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include #include #define _COMPONENT ACPI_RESOURCES - ACPI_MODULE_NAME ("rslist") - +ACPI_MODULE_NAME("rslist") /******************************************************************************* * @@ -61,14 +59,10 @@ * a resource descriptor. * ******************************************************************************/ - -u8 -acpi_rs_get_resource_type ( - u8 resource_start_byte) +u8 acpi_rs_get_resource_type(u8 resource_start_byte) { - ACPI_FUNCTION_ENTRY (); - + ACPI_FUNCTION_ENTRY(); /* Determine if this is a small or large resource */ @@ -79,14 +73,12 @@ acpi_rs_get_resource_type ( return ((u8) (resource_start_byte & ACPI_RDESC_SMALL_MASK)); - case ACPI_RDESC_TYPE_LARGE: /* Large Resource Type -- All bits are valid */ return (resource_start_byte); - default: /* Invalid type */ break; @@ -95,7 +87,6 @@ acpi_rs_get_resource_type ( return (0xFF); } - /******************************************************************************* * * FUNCTION: acpi_rs_byte_stream_to_list @@ -113,176 +104,189 @@ acpi_rs_get_resource_type ( ******************************************************************************/ acpi_status -acpi_rs_byte_stream_to_list ( - u8 *byte_stream_buffer, - u32 byte_stream_buffer_length, - u8 *output_buffer) +acpi_rs_byte_stream_to_list(u8 * byte_stream_buffer, + u32 byte_stream_buffer_length, u8 * output_buffer) { - acpi_status status; - acpi_size bytes_parsed = 0; - u8 resource_type = 0; - acpi_size bytes_consumed = 0; - u8 *buffer = output_buffer; - acpi_size structure_size = 0; - u8 end_tag_processed = FALSE; - struct acpi_resource *resource; - - ACPI_FUNCTION_TRACE ("rs_byte_stream_to_list"); - - - while (bytes_parsed < byte_stream_buffer_length && - !end_tag_processed) { + acpi_status status; + acpi_size bytes_parsed = 0; + u8 resource_type = 0; + acpi_size bytes_consumed = 0; + u8 *buffer = output_buffer; + acpi_size structure_size = 0; + u8 end_tag_processed = FALSE; + struct acpi_resource *resource; + + ACPI_FUNCTION_TRACE("rs_byte_stream_to_list"); + + while (bytes_parsed < byte_stream_buffer_length && !end_tag_processed) { /* The next byte in the stream is the resource type */ - resource_type = acpi_rs_get_resource_type (*byte_stream_buffer); + resource_type = acpi_rs_get_resource_type(*byte_stream_buffer); switch (resource_type) { case ACPI_RDESC_TYPE_MEMORY_24: /* * 24-Bit Memory Resource */ - status = acpi_rs_memory24_resource (byte_stream_buffer, - &bytes_consumed, &buffer, &structure_size); + status = acpi_rs_memory24_resource(byte_stream_buffer, + &bytes_consumed, + &buffer, + &structure_size); break; - case ACPI_RDESC_TYPE_LARGE_VENDOR: /* * Vendor Defined Resource */ - status = acpi_rs_vendor_resource (byte_stream_buffer, - &bytes_consumed, &buffer, &structure_size); + status = acpi_rs_vendor_resource(byte_stream_buffer, + &bytes_consumed, + &buffer, + &structure_size); break; - case ACPI_RDESC_TYPE_MEMORY_32: /* * 32-Bit Memory Range Resource */ - status = acpi_rs_memory32_range_resource (byte_stream_buffer, - &bytes_consumed, &buffer, &structure_size); + status = + acpi_rs_memory32_range_resource(byte_stream_buffer, + &bytes_consumed, + &buffer, + &structure_size); break; - case ACPI_RDESC_TYPE_FIXED_MEMORY_32: /* * 32-Bit Fixed Memory Resource */ - status = acpi_rs_fixed_memory32_resource (byte_stream_buffer, - &bytes_consumed, &buffer, &structure_size); + status = + acpi_rs_fixed_memory32_resource(byte_stream_buffer, + &bytes_consumed, + &buffer, + &structure_size); break; - case ACPI_RDESC_TYPE_QWORD_ADDRESS_SPACE: case ACPI_RDESC_TYPE_EXTENDED_ADDRESS_SPACE: /* * 64-Bit Address Resource */ - status = acpi_rs_address64_resource (byte_stream_buffer, - &bytes_consumed, &buffer, &structure_size); + status = acpi_rs_address64_resource(byte_stream_buffer, + &bytes_consumed, + &buffer, + &structure_size); break; - case ACPI_RDESC_TYPE_DWORD_ADDRESS_SPACE: /* * 32-Bit Address Resource */ - status = acpi_rs_address32_resource (byte_stream_buffer, - &bytes_consumed, &buffer, &structure_size); + status = acpi_rs_address32_resource(byte_stream_buffer, + &bytes_consumed, + &buffer, + &structure_size); break; - case ACPI_RDESC_TYPE_WORD_ADDRESS_SPACE: /* * 16-Bit Address Resource */ - status = acpi_rs_address16_resource (byte_stream_buffer, - &bytes_consumed, &buffer, &structure_size); + status = acpi_rs_address16_resource(byte_stream_buffer, + &bytes_consumed, + &buffer, + &structure_size); break; - case ACPI_RDESC_TYPE_EXTENDED_XRUPT: /* * Extended IRQ */ - status = acpi_rs_extended_irq_resource (byte_stream_buffer, - &bytes_consumed, &buffer, &structure_size); + status = + acpi_rs_extended_irq_resource(byte_stream_buffer, + &bytes_consumed, + &buffer, + &structure_size); break; - case ACPI_RDESC_TYPE_IRQ_FORMAT: /* * IRQ Resource */ - status = acpi_rs_irq_resource (byte_stream_buffer, - &bytes_consumed, &buffer, &structure_size); + status = acpi_rs_irq_resource(byte_stream_buffer, + &bytes_consumed, &buffer, + &structure_size); break; - case ACPI_RDESC_TYPE_DMA_FORMAT: /* * DMA Resource */ - status = acpi_rs_dma_resource (byte_stream_buffer, - &bytes_consumed, &buffer, &structure_size); + status = acpi_rs_dma_resource(byte_stream_buffer, + &bytes_consumed, &buffer, + &structure_size); break; - case ACPI_RDESC_TYPE_START_DEPENDENT: /* * Start Dependent Functions Resource */ - status = acpi_rs_start_depend_fns_resource (byte_stream_buffer, - &bytes_consumed, &buffer, &structure_size); + status = + acpi_rs_start_depend_fns_resource + (byte_stream_buffer, &bytes_consumed, &buffer, + &structure_size); break; - case ACPI_RDESC_TYPE_END_DEPENDENT: /* * End Dependent Functions Resource */ - status = acpi_rs_end_depend_fns_resource (byte_stream_buffer, - &bytes_consumed, &buffer, &structure_size); + status = + acpi_rs_end_depend_fns_resource(byte_stream_buffer, + &bytes_consumed, + &buffer, + &structure_size); break; - case ACPI_RDESC_TYPE_IO_PORT: /* * IO Port Resource */ - status = acpi_rs_io_resource (byte_stream_buffer, - &bytes_consumed, &buffer, &structure_size); + status = acpi_rs_io_resource(byte_stream_buffer, + &bytes_consumed, &buffer, + &structure_size); break; - case ACPI_RDESC_TYPE_FIXED_IO_PORT: /* * Fixed IO Port Resource */ - status = acpi_rs_fixed_io_resource (byte_stream_buffer, - &bytes_consumed, &buffer, &structure_size); + status = acpi_rs_fixed_io_resource(byte_stream_buffer, + &bytes_consumed, + &buffer, + &structure_size); break; - case ACPI_RDESC_TYPE_SMALL_VENDOR: /* * Vendor Specific Resource */ - status = acpi_rs_vendor_resource (byte_stream_buffer, - &bytes_consumed, &buffer, &structure_size); + status = acpi_rs_vendor_resource(byte_stream_buffer, + &bytes_consumed, + &buffer, + &structure_size); break; - case ACPI_RDESC_TYPE_END_TAG: /* * End Tag */ end_tag_processed = TRUE; - status = acpi_rs_end_tag_resource (byte_stream_buffer, - &bytes_consumed, &buffer, &structure_size); + status = acpi_rs_end_tag_resource(byte_stream_buffer, + &bytes_consumed, + &buffer, + &structure_size); break; - default: /* * Invalid/Unknown resource type @@ -291,8 +295,8 @@ acpi_rs_byte_stream_to_list ( break; } - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* Update the return value and counter */ @@ -305,21 +309,21 @@ acpi_rs_byte_stream_to_list ( /* Set the Buffer to the next structure */ - resource = ACPI_CAST_PTR (struct acpi_resource, buffer); - resource->length = (u32) ACPI_ALIGN_RESOURCE_SIZE (resource->length); - buffer += ACPI_ALIGN_RESOURCE_SIZE (structure_size); + resource = ACPI_CAST_PTR(struct acpi_resource, buffer); + resource->length = + (u32) ACPI_ALIGN_RESOURCE_SIZE(resource->length); + buffer += ACPI_ALIGN_RESOURCE_SIZE(structure_size); } /* Check the reason for exiting the while loop */ if (!end_tag_processed) { - return_ACPI_STATUS (AE_AML_NO_RESOURCE_END_TAG); + return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG); } - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_rs_list_to_byte_stream @@ -342,19 +346,16 @@ acpi_rs_byte_stream_to_list ( ******************************************************************************/ acpi_status -acpi_rs_list_to_byte_stream ( - struct acpi_resource *linked_list, - acpi_size byte_stream_size_needed, - u8 *output_buffer) +acpi_rs_list_to_byte_stream(struct acpi_resource *linked_list, + acpi_size byte_stream_size_needed, + u8 * output_buffer) { - acpi_status status; - u8 *buffer = output_buffer; - acpi_size bytes_consumed = 0; - u8 done = FALSE; - - - ACPI_FUNCTION_TRACE ("rs_list_to_byte_stream"); + acpi_status status; + u8 *buffer = output_buffer; + acpi_size bytes_consumed = 0; + u8 done = FALSE; + ACPI_FUNCTION_TRACE("rs_list_to_byte_stream"); while (!done) { switch (linked_list->id) { @@ -362,58 +363,72 @@ acpi_rs_list_to_byte_stream ( /* * IRQ Resource */ - status = acpi_rs_irq_stream (linked_list, &buffer, &bytes_consumed); + status = + acpi_rs_irq_stream(linked_list, &buffer, + &bytes_consumed); break; case ACPI_RSTYPE_DMA: /* * DMA Resource */ - status = acpi_rs_dma_stream (linked_list, &buffer, &bytes_consumed); + status = + acpi_rs_dma_stream(linked_list, &buffer, + &bytes_consumed); break; case ACPI_RSTYPE_START_DPF: /* * Start Dependent Functions Resource */ - status = acpi_rs_start_depend_fns_stream (linked_list, - &buffer, &bytes_consumed); + status = acpi_rs_start_depend_fns_stream(linked_list, + &buffer, + &bytes_consumed); break; case ACPI_RSTYPE_END_DPF: /* * End Dependent Functions Resource */ - status = acpi_rs_end_depend_fns_stream (linked_list, - &buffer, &bytes_consumed); + status = acpi_rs_end_depend_fns_stream(linked_list, + &buffer, + &bytes_consumed); break; case ACPI_RSTYPE_IO: /* * IO Port Resource */ - status = acpi_rs_io_stream (linked_list, &buffer, &bytes_consumed); + status = + acpi_rs_io_stream(linked_list, &buffer, + &bytes_consumed); break; case ACPI_RSTYPE_FIXED_IO: /* * Fixed IO Port Resource */ - status = acpi_rs_fixed_io_stream (linked_list, &buffer, &bytes_consumed); + status = + acpi_rs_fixed_io_stream(linked_list, &buffer, + &bytes_consumed); break; case ACPI_RSTYPE_VENDOR: /* * Vendor Defined Resource */ - status = acpi_rs_vendor_stream (linked_list, &buffer, &bytes_consumed); + status = + acpi_rs_vendor_stream(linked_list, &buffer, + &bytes_consumed); break; case ACPI_RSTYPE_END_TAG: /* * End Tag */ - status = acpi_rs_end_tag_stream (linked_list, &buffer, &bytes_consumed); + status = + acpi_rs_end_tag_stream(linked_list, &buffer, + &bytes_consumed); /* An End Tag indicates the end of the Resource Template */ @@ -424,55 +439,60 @@ acpi_rs_list_to_byte_stream ( /* * 24-Bit Memory Resource */ - status = acpi_rs_memory24_stream (linked_list, &buffer, &bytes_consumed); + status = + acpi_rs_memory24_stream(linked_list, &buffer, + &bytes_consumed); break; case ACPI_RSTYPE_MEM32: /* * 32-Bit Memory Range Resource */ - status = acpi_rs_memory32_range_stream (linked_list, &buffer, - &bytes_consumed); + status = + acpi_rs_memory32_range_stream(linked_list, &buffer, + &bytes_consumed); break; case ACPI_RSTYPE_FIXED_MEM32: /* * 32-Bit Fixed Memory Resource */ - status = acpi_rs_fixed_memory32_stream (linked_list, &buffer, - &bytes_consumed); + status = + acpi_rs_fixed_memory32_stream(linked_list, &buffer, + &bytes_consumed); break; case ACPI_RSTYPE_ADDRESS16: /* * 16-Bit Address Descriptor Resource */ - status = acpi_rs_address16_stream (linked_list, &buffer, - &bytes_consumed); + status = acpi_rs_address16_stream(linked_list, &buffer, + &bytes_consumed); break; case ACPI_RSTYPE_ADDRESS32: /* * 32-Bit Address Descriptor Resource */ - status = acpi_rs_address32_stream (linked_list, &buffer, - &bytes_consumed); + status = acpi_rs_address32_stream(linked_list, &buffer, + &bytes_consumed); break; case ACPI_RSTYPE_ADDRESS64: /* * 64-Bit Address Descriptor Resource */ - status = acpi_rs_address64_stream (linked_list, &buffer, - &bytes_consumed); + status = acpi_rs_address64_stream(linked_list, &buffer, + &bytes_consumed); break; case ACPI_RSTYPE_EXT_IRQ: /* * Extended IRQ Resource */ - status = acpi_rs_extended_irq_stream (linked_list, &buffer, - &bytes_consumed); + status = + acpi_rs_extended_irq_stream(linked_list, &buffer, + &bytes_consumed); break; default: @@ -480,15 +500,15 @@ acpi_rs_list_to_byte_stream ( * If we get here, everything is out of sync, * so exit with an error */ - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Invalid descriptor type (%X) in resource list\n", - linked_list->id)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Invalid descriptor type (%X) in resource list\n", + linked_list->id)); status = AE_BAD_DATA; break; } - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* Set the Buffer to point to the open byte */ @@ -497,10 +517,9 @@ acpi_rs_list_to_byte_stream ( /* Point to the next object */ - linked_list = ACPI_PTR_ADD (struct acpi_resource, - linked_list, linked_list->length); + linked_list = ACPI_PTR_ADD(struct acpi_resource, + linked_list, linked_list->length); } - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - diff --git a/drivers/acpi/resources/rsmemory.c b/drivers/acpi/resources/rsmemory.c index 91d0207f01a..daba1a1ed46 100644 --- a/drivers/acpi/resources/rsmemory.c +++ b/drivers/acpi/resources/rsmemory.c @@ -41,13 +41,11 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include #include #define _COMPONENT ACPI_RESOURCES - ACPI_MODULE_NAME ("rsmemory") - +ACPI_MODULE_NAME("rsmemory") /******************************************************************************* * @@ -69,30 +67,25 @@ * number of bytes consumed from the byte stream. * ******************************************************************************/ - acpi_status -acpi_rs_memory24_resource ( - u8 *byte_stream_buffer, - acpi_size *bytes_consumed, - u8 **output_buffer, - acpi_size *structure_size) +acpi_rs_memory24_resource(u8 * byte_stream_buffer, + acpi_size * bytes_consumed, + u8 ** output_buffer, acpi_size * structure_size) { - u8 *buffer = byte_stream_buffer; - struct acpi_resource *output_struct = (void *) *output_buffer; - u16 temp16 = 0; - u8 temp8 = 0; - acpi_size struct_size = ACPI_SIZEOF_RESOURCE ( - struct acpi_resource_mem24); - - - ACPI_FUNCTION_TRACE ("rs_memory24_resource"); + u8 *buffer = byte_stream_buffer; + struct acpi_resource *output_struct = (void *)*output_buffer; + u16 temp16 = 0; + u8 temp8 = 0; + acpi_size struct_size = + ACPI_SIZEOF_RESOURCE(struct acpi_resource_mem24); + ACPI_FUNCTION_TRACE("rs_memory24_resource"); /* Point past the Descriptor to get the number of bytes consumed */ buffer += 1; - ACPI_MOVE_16_TO_16 (&temp16, buffer); + ACPI_MOVE_16_TO_16(&temp16, buffer); buffer += 2; *bytes_consumed = (acpi_size) temp16 + 3; output_struct->id = ACPI_RSTYPE_MEM24; @@ -105,25 +98,25 @@ acpi_rs_memory24_resource ( /* Get min_base_address (Bytes 4-5) */ - ACPI_MOVE_16_TO_16 (&temp16, buffer); + ACPI_MOVE_16_TO_16(&temp16, buffer); buffer += 2; output_struct->data.memory24.min_base_address = temp16; /* Get max_base_address (Bytes 6-7) */ - ACPI_MOVE_16_TO_16 (&temp16, buffer); + ACPI_MOVE_16_TO_16(&temp16, buffer); buffer += 2; output_struct->data.memory24.max_base_address = temp16; /* Get Alignment (Bytes 8-9) */ - ACPI_MOVE_16_TO_16 (&temp16, buffer); + ACPI_MOVE_16_TO_16(&temp16, buffer); buffer += 2; output_struct->data.memory24.alignment = temp16; /* Get range_length (Bytes 10-11) */ - ACPI_MOVE_16_TO_16 (&temp16, buffer); + ACPI_MOVE_16_TO_16(&temp16, buffer); output_struct->data.memory24.range_length = temp16; /* Set the Length parameter */ @@ -133,10 +126,9 @@ acpi_rs_memory24_resource ( /* Return the final size of the structure */ *structure_size = struct_size; - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_rs_memory24_stream @@ -154,18 +146,14 @@ acpi_rs_memory24_resource ( ******************************************************************************/ acpi_status -acpi_rs_memory24_stream ( - struct acpi_resource *linked_list, - u8 **output_buffer, - acpi_size *bytes_consumed) +acpi_rs_memory24_stream(struct acpi_resource *linked_list, + u8 ** output_buffer, acpi_size * bytes_consumed) { - u8 *buffer = *output_buffer; - u16 temp16 = 0; - u8 temp8 = 0; - - - ACPI_FUNCTION_TRACE ("rs_memory24_stream"); + u8 *buffer = *output_buffer; + u16 temp16 = 0; + u8 temp8 = 0; + ACPI_FUNCTION_TRACE("rs_memory24_stream"); /* The descriptor field is static */ @@ -175,7 +163,7 @@ acpi_rs_memory24_stream ( /* The length field is static */ temp16 = 0x09; - ACPI_MOVE_16_TO_16 (buffer, &temp16); + ACPI_MOVE_16_TO_16(buffer, &temp16); buffer += 2; /* Set the Information Byte */ @@ -186,31 +174,32 @@ acpi_rs_memory24_stream ( /* Set the Range minimum base address */ - ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.memory24.min_base_address); + ACPI_MOVE_32_TO_16(buffer, + &linked_list->data.memory24.min_base_address); buffer += 2; /* Set the Range maximum base address */ - ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.memory24.max_base_address); + ACPI_MOVE_32_TO_16(buffer, + &linked_list->data.memory24.max_base_address); buffer += 2; /* Set the base alignment */ - ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.memory24.alignment); + ACPI_MOVE_32_TO_16(buffer, &linked_list->data.memory24.alignment); buffer += 2; /* Set the range length */ - ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.memory24.range_length); + ACPI_MOVE_32_TO_16(buffer, &linked_list->data.memory24.range_length); buffer += 2; /* Return the number of bytes consumed in this operation */ - *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); - return_ACPI_STATUS (AE_OK); + *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_rs_memory32_range_resource @@ -233,28 +222,24 @@ acpi_rs_memory24_stream ( ******************************************************************************/ acpi_status -acpi_rs_memory32_range_resource ( - u8 *byte_stream_buffer, - acpi_size *bytes_consumed, - u8 **output_buffer, - acpi_size *structure_size) +acpi_rs_memory32_range_resource(u8 * byte_stream_buffer, + acpi_size * bytes_consumed, + u8 ** output_buffer, acpi_size * structure_size) { - u8 *buffer = byte_stream_buffer; - struct acpi_resource *output_struct = (void *) *output_buffer; - u16 temp16 = 0; - u8 temp8 = 0; - acpi_size struct_size = ACPI_SIZEOF_RESOURCE ( - struct acpi_resource_mem32); - - - ACPI_FUNCTION_TRACE ("rs_memory32_range_resource"); + u8 *buffer = byte_stream_buffer; + struct acpi_resource *output_struct = (void *)*output_buffer; + u16 temp16 = 0; + u8 temp8 = 0; + acpi_size struct_size = + ACPI_SIZEOF_RESOURCE(struct acpi_resource_mem32); + ACPI_FUNCTION_TRACE("rs_memory32_range_resource"); /* Point past the Descriptor to get the number of bytes consumed */ buffer += 1; - ACPI_MOVE_16_TO_16 (&temp16, buffer); + ACPI_MOVE_16_TO_16(&temp16, buffer); buffer += 2; *bytes_consumed = (acpi_size) temp16 + 3; @@ -279,22 +264,24 @@ acpi_rs_memory32_range_resource ( /* Get min_base_address (Bytes 4-7) */ - ACPI_MOVE_32_TO_32 (&output_struct->data.memory32.min_base_address, buffer); + ACPI_MOVE_32_TO_32(&output_struct->data.memory32.min_base_address, + buffer); buffer += 4; /* Get max_base_address (Bytes 8-11) */ - ACPI_MOVE_32_TO_32 (&output_struct->data.memory32.max_base_address, buffer); + ACPI_MOVE_32_TO_32(&output_struct->data.memory32.max_base_address, + buffer); buffer += 4; /* Get Alignment (Bytes 12-15) */ - ACPI_MOVE_32_TO_32 (&output_struct->data.memory32.alignment, buffer); + ACPI_MOVE_32_TO_32(&output_struct->data.memory32.alignment, buffer); buffer += 4; /* Get range_length (Bytes 16-19) */ - ACPI_MOVE_32_TO_32 (&output_struct->data.memory32.range_length, buffer); + ACPI_MOVE_32_TO_32(&output_struct->data.memory32.range_length, buffer); /* Set the Length parameter */ @@ -303,10 +290,9 @@ acpi_rs_memory32_range_resource ( /* Return the final size of the structure */ *structure_size = struct_size; - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_rs_fixed_memory32_resource @@ -329,27 +315,23 @@ acpi_rs_memory32_range_resource ( ******************************************************************************/ acpi_status -acpi_rs_fixed_memory32_resource ( - u8 *byte_stream_buffer, - acpi_size *bytes_consumed, - u8 **output_buffer, - acpi_size *structure_size) +acpi_rs_fixed_memory32_resource(u8 * byte_stream_buffer, + acpi_size * bytes_consumed, + u8 ** output_buffer, acpi_size * structure_size) { - u8 *buffer = byte_stream_buffer; - struct acpi_resource *output_struct = (void *) *output_buffer; - u16 temp16 = 0; - u8 temp8 = 0; - acpi_size struct_size = ACPI_SIZEOF_RESOURCE ( - struct acpi_resource_fixed_mem32); - - - ACPI_FUNCTION_TRACE ("rs_fixed_memory32_resource"); + u8 *buffer = byte_stream_buffer; + struct acpi_resource *output_struct = (void *)*output_buffer; + u16 temp16 = 0; + u8 temp8 = 0; + acpi_size struct_size = + ACPI_SIZEOF_RESOURCE(struct acpi_resource_fixed_mem32); + ACPI_FUNCTION_TRACE("rs_fixed_memory32_resource"); /* Point past the Descriptor to get the number of bytes consumed */ buffer += 1; - ACPI_MOVE_16_TO_16 (&temp16, buffer); + ACPI_MOVE_16_TO_16(&temp16, buffer); buffer += 2; *bytes_consumed = (acpi_size) temp16 + 3; @@ -364,13 +346,14 @@ acpi_rs_fixed_memory32_resource ( /* Get range_base_address (Bytes 4-7) */ - ACPI_MOVE_32_TO_32 (&output_struct->data.fixed_memory32.range_base_address, - buffer); + ACPI_MOVE_32_TO_32(&output_struct->data.fixed_memory32. + range_base_address, buffer); buffer += 4; /* Get range_length (Bytes 8-11) */ - ACPI_MOVE_32_TO_32 (&output_struct->data.fixed_memory32.range_length, buffer); + ACPI_MOVE_32_TO_32(&output_struct->data.fixed_memory32.range_length, + buffer); /* Set the Length parameter */ @@ -379,10 +362,9 @@ acpi_rs_fixed_memory32_resource ( /* Return the final size of the structure */ *structure_size = struct_size; - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_rs_memory32_range_stream @@ -400,18 +382,14 @@ acpi_rs_fixed_memory32_resource ( ******************************************************************************/ acpi_status -acpi_rs_memory32_range_stream ( - struct acpi_resource *linked_list, - u8 **output_buffer, - acpi_size *bytes_consumed) +acpi_rs_memory32_range_stream(struct acpi_resource *linked_list, + u8 ** output_buffer, acpi_size * bytes_consumed) { - u8 *buffer = *output_buffer; - u16 temp16 = 0; - u8 temp8 = 0; - - - ACPI_FUNCTION_TRACE ("rs_memory32_range_stream"); + u8 *buffer = *output_buffer; + u16 temp16 = 0; + u8 temp8 = 0; + ACPI_FUNCTION_TRACE("rs_memory32_range_stream"); /* The descriptor field is static */ @@ -422,7 +400,7 @@ acpi_rs_memory32_range_stream ( temp16 = 0x11; - ACPI_MOVE_16_TO_16 (buffer, &temp16); + ACPI_MOVE_16_TO_16(buffer, &temp16); buffer += 2; /* Set the Information Byte */ @@ -433,31 +411,32 @@ acpi_rs_memory32_range_stream ( /* Set the Range minimum base address */ - ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.memory32.min_base_address); + ACPI_MOVE_32_TO_32(buffer, + &linked_list->data.memory32.min_base_address); buffer += 4; /* Set the Range maximum base address */ - ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.memory32.max_base_address); + ACPI_MOVE_32_TO_32(buffer, + &linked_list->data.memory32.max_base_address); buffer += 4; /* Set the base alignment */ - ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.memory32.alignment); + ACPI_MOVE_32_TO_32(buffer, &linked_list->data.memory32.alignment); buffer += 4; /* Set the range length */ - ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.memory32.range_length); + ACPI_MOVE_32_TO_32(buffer, &linked_list->data.memory32.range_length); buffer += 4; /* Return the number of bytes consumed in this operation */ - *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); - return_ACPI_STATUS (AE_OK); + *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_rs_fixed_memory32_stream @@ -475,18 +454,14 @@ acpi_rs_memory32_range_stream ( ******************************************************************************/ acpi_status -acpi_rs_fixed_memory32_stream ( - struct acpi_resource *linked_list, - u8 **output_buffer, - acpi_size *bytes_consumed) +acpi_rs_fixed_memory32_stream(struct acpi_resource *linked_list, + u8 ** output_buffer, acpi_size * bytes_consumed) { - u8 *buffer = *output_buffer; - u16 temp16 = 0; - u8 temp8 = 0; - - - ACPI_FUNCTION_TRACE ("rs_fixed_memory32_stream"); + u8 *buffer = *output_buffer; + u16 temp16 = 0; + u8 temp8 = 0; + ACPI_FUNCTION_TRACE("rs_fixed_memory32_stream"); /* The descriptor field is static */ @@ -497,30 +472,31 @@ acpi_rs_fixed_memory32_stream ( temp16 = 0x09; - ACPI_MOVE_16_TO_16 (buffer, &temp16); + ACPI_MOVE_16_TO_16(buffer, &temp16); buffer += 2; /* Set the Information Byte */ - temp8 = (u8) (linked_list->data.fixed_memory32.read_write_attribute & 0x01); + temp8 = + (u8) (linked_list->data.fixed_memory32.read_write_attribute & 0x01); *buffer = temp8; buffer += 1; /* Set the Range base address */ - ACPI_MOVE_32_TO_32 (buffer, - &linked_list->data.fixed_memory32.range_base_address); + ACPI_MOVE_32_TO_32(buffer, + &linked_list->data.fixed_memory32. + range_base_address); buffer += 4; /* Set the range length */ - ACPI_MOVE_32_TO_32 (buffer, - &linked_list->data.fixed_memory32.range_length); + ACPI_MOVE_32_TO_32(buffer, + &linked_list->data.fixed_memory32.range_length); buffer += 4; /* Return the number of bytes consumed in this operation */ - *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); - return_ACPI_STATUS (AE_OK); + *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer); + return_ACPI_STATUS(AE_OK); } - diff --git a/drivers/acpi/resources/rsmisc.c b/drivers/acpi/resources/rsmisc.c index a1f1741f0d8..7a8a34e757f 100644 --- a/drivers/acpi/resources/rsmisc.c +++ b/drivers/acpi/resources/rsmisc.c @@ -41,13 +41,11 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include #include #define _COMPONENT ACPI_RESOURCES - ACPI_MODULE_NAME ("rsmisc") - +ACPI_MODULE_NAME("rsmisc") /******************************************************************************* * @@ -69,20 +67,15 @@ * number of bytes consumed from the byte stream. * ******************************************************************************/ - acpi_status -acpi_rs_end_tag_resource ( - u8 *byte_stream_buffer, - acpi_size *bytes_consumed, - u8 **output_buffer, - acpi_size *structure_size) +acpi_rs_end_tag_resource(u8 * byte_stream_buffer, + acpi_size * bytes_consumed, + u8 ** output_buffer, acpi_size * structure_size) { - struct acpi_resource *output_struct = (void *) *output_buffer; - acpi_size struct_size = ACPI_RESOURCE_LENGTH; - - - ACPI_FUNCTION_TRACE ("rs_end_tag_resource"); + struct acpi_resource *output_struct = (void *)*output_buffer; + acpi_size struct_size = ACPI_RESOURCE_LENGTH; + ACPI_FUNCTION_TRACE("rs_end_tag_resource"); /* The number of bytes consumed is static */ @@ -99,10 +92,9 @@ acpi_rs_end_tag_resource ( /* Return the final size of the structure */ *structure_size = struct_size; - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_rs_end_tag_stream @@ -120,17 +112,13 @@ acpi_rs_end_tag_resource ( ******************************************************************************/ acpi_status -acpi_rs_end_tag_stream ( - struct acpi_resource *linked_list, - u8 **output_buffer, - acpi_size *bytes_consumed) +acpi_rs_end_tag_stream(struct acpi_resource *linked_list, + u8 ** output_buffer, acpi_size * bytes_consumed) { - u8 *buffer = *output_buffer; - u8 temp8 = 0; - - - ACPI_FUNCTION_TRACE ("rs_end_tag_stream"); + u8 *buffer = *output_buffer; + u8 temp8 = 0; + ACPI_FUNCTION_TRACE("rs_end_tag_stream"); /* The descriptor field is static */ @@ -148,11 +136,10 @@ acpi_rs_end_tag_stream ( /* Return the number of bytes consumed in this operation */ - *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); - return_ACPI_STATUS (AE_OK); + *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_rs_vendor_resource @@ -175,23 +162,19 @@ acpi_rs_end_tag_stream ( ******************************************************************************/ acpi_status -acpi_rs_vendor_resource ( - u8 *byte_stream_buffer, - acpi_size *bytes_consumed, - u8 **output_buffer, - acpi_size *structure_size) +acpi_rs_vendor_resource(u8 * byte_stream_buffer, + acpi_size * bytes_consumed, + u8 ** output_buffer, acpi_size * structure_size) { - u8 *buffer = byte_stream_buffer; - struct acpi_resource *output_struct = (void *) *output_buffer; - u16 temp16 = 0; - u8 temp8 = 0; - u8 index; - acpi_size struct_size = ACPI_SIZEOF_RESOURCE ( - struct acpi_resource_vendor); - - - ACPI_FUNCTION_TRACE ("rs_vendor_resource"); + u8 *buffer = byte_stream_buffer; + struct acpi_resource *output_struct = (void *)*output_buffer; + u16 temp16 = 0; + u8 temp8 = 0; + u8 index; + acpi_size struct_size = + ACPI_SIZEOF_RESOURCE(struct acpi_resource_vendor); + ACPI_FUNCTION_TRACE("rs_vendor_resource"); /* Dereference the Descriptor to find if this is a large or small item. */ @@ -204,7 +187,7 @@ acpi_rs_vendor_resource ( /* Dereference */ - ACPI_MOVE_16_TO_16 (&temp16, buffer); + ACPI_MOVE_16_TO_16(&temp16, buffer); /* Calculate bytes consumed */ @@ -213,11 +196,10 @@ acpi_rs_vendor_resource ( /* Point to the first vendor byte */ buffer += 2; - } - else { + } else { /* Small Item, dereference the size */ - temp16 = (u8)(*buffer & 0x07); + temp16 = (u8) (*buffer & 0x07); /* Calculate bytes consumed */ @@ -241,7 +223,7 @@ acpi_rs_vendor_resource ( * calculate the length of the vendor string and expand the * struct_size to the next 32-bit boundary. */ - struct_size += ACPI_ROUND_UP_to_32_bITS (temp16); + struct_size += ACPI_ROUND_UP_to_32_bITS(temp16); /* Set the Length parameter */ @@ -250,10 +232,9 @@ acpi_rs_vendor_resource ( /* Return the final size of the structure */ *structure_size = struct_size; - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_rs_vendor_stream @@ -271,23 +252,19 @@ acpi_rs_vendor_resource ( ******************************************************************************/ acpi_status -acpi_rs_vendor_stream ( - struct acpi_resource *linked_list, - u8 **output_buffer, - acpi_size *bytes_consumed) +acpi_rs_vendor_stream(struct acpi_resource *linked_list, + u8 ** output_buffer, acpi_size * bytes_consumed) { - u8 *buffer = *output_buffer; - u16 temp16 = 0; - u8 temp8 = 0; - u8 index; - - - ACPI_FUNCTION_TRACE ("rs_vendor_stream"); + u8 *buffer = *output_buffer; + u16 temp16 = 0; + u8 temp8 = 0; + u8 index; + ACPI_FUNCTION_TRACE("rs_vendor_stream"); /* Dereference the length to find if this is a large or small item. */ - if(linked_list->data.vendor_specific.length > 7) { + if (linked_list->data.vendor_specific.length > 7) { /* Large Item, Set the descriptor field and length bytes */ *buffer = 0x84; @@ -295,10 +272,9 @@ acpi_rs_vendor_stream ( temp16 = (u16) linked_list->data.vendor_specific.length; - ACPI_MOVE_16_TO_16 (buffer, &temp16); + ACPI_MOVE_16_TO_16(buffer, &temp16); buffer += 2; - } - else { + } else { /* Small Item, Set the descriptor field */ temp8 = 0x70; @@ -310,7 +286,8 @@ acpi_rs_vendor_stream ( /* Loop through all of the Vendor Specific fields */ - for (index = 0; index < linked_list->data.vendor_specific.length; index++) { + for (index = 0; index < linked_list->data.vendor_specific.length; + index++) { temp8 = linked_list->data.vendor_specific.reserved[index]; *buffer = temp8; @@ -319,11 +296,10 @@ acpi_rs_vendor_stream ( /* Return the number of bytes consumed in this operation */ - *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); - return_ACPI_STATUS (AE_OK); + *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_rs_start_depend_fns_resource @@ -346,21 +322,18 @@ acpi_rs_vendor_stream ( ******************************************************************************/ acpi_status -acpi_rs_start_depend_fns_resource ( - u8 *byte_stream_buffer, - acpi_size *bytes_consumed, - u8 **output_buffer, - acpi_size *structure_size) +acpi_rs_start_depend_fns_resource(u8 * byte_stream_buffer, + acpi_size * bytes_consumed, + u8 ** output_buffer, + acpi_size * structure_size) { - u8 *buffer = byte_stream_buffer; - struct acpi_resource *output_struct = (void *) *output_buffer; - u8 temp8 = 0; - acpi_size struct_size = ACPI_SIZEOF_RESOURCE ( - struct acpi_resource_start_dpf); - - - ACPI_FUNCTION_TRACE ("rs_start_depend_fns_resource"); + u8 *buffer = byte_stream_buffer; + struct acpi_resource *output_struct = (void *)*output_buffer; + u8 temp8 = 0; + acpi_size struct_size = + ACPI_SIZEOF_RESOURCE(struct acpi_resource_start_dpf); + ACPI_FUNCTION_TRACE("rs_start_depend_fns_resource"); /* The number of bytes consumed are found in the descriptor (Bits:0-1) */ @@ -378,26 +351,27 @@ acpi_rs_start_depend_fns_resource ( /* Check Compatibility priority */ - output_struct->data.start_dpf.compatibility_priority = temp8 & 0x03; + output_struct->data.start_dpf.compatibility_priority = + temp8 & 0x03; if (3 == output_struct->data.start_dpf.compatibility_priority) { - return_ACPI_STATUS (AE_AML_BAD_RESOURCE_VALUE); + return_ACPI_STATUS(AE_AML_BAD_RESOURCE_VALUE); } /* Check Performance/Robustness preference */ - output_struct->data.start_dpf.performance_robustness = (temp8 >> 2) & 0x03; + output_struct->data.start_dpf.performance_robustness = + (temp8 >> 2) & 0x03; if (3 == output_struct->data.start_dpf.performance_robustness) { - return_ACPI_STATUS (AE_AML_BAD_RESOURCE_VALUE); + return_ACPI_STATUS(AE_AML_BAD_RESOURCE_VALUE); } - } - else { + } else { output_struct->data.start_dpf.compatibility_priority = - ACPI_ACCEPTABLE_CONFIGURATION; + ACPI_ACCEPTABLE_CONFIGURATION; output_struct->data.start_dpf.performance_robustness = - ACPI_ACCEPTABLE_CONFIGURATION; + ACPI_ACCEPTABLE_CONFIGURATION; } /* Set the Length parameter */ @@ -407,10 +381,9 @@ acpi_rs_start_depend_fns_resource ( /* Return the final size of the structure */ *structure_size = struct_size; - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_rs_end_depend_fns_resource @@ -433,18 +406,14 @@ acpi_rs_start_depend_fns_resource ( ******************************************************************************/ acpi_status -acpi_rs_end_depend_fns_resource ( - u8 *byte_stream_buffer, - acpi_size *bytes_consumed, - u8 **output_buffer, - acpi_size *structure_size) +acpi_rs_end_depend_fns_resource(u8 * byte_stream_buffer, + acpi_size * bytes_consumed, + u8 ** output_buffer, acpi_size * structure_size) { - struct acpi_resource *output_struct = (void *) *output_buffer; - acpi_size struct_size = ACPI_RESOURCE_LENGTH; - - - ACPI_FUNCTION_TRACE ("rs_end_depend_fns_resource"); + struct acpi_resource *output_struct = (void *)*output_buffer; + acpi_size struct_size = ACPI_RESOURCE_LENGTH; + ACPI_FUNCTION_TRACE("rs_end_depend_fns_resource"); /* The number of bytes consumed is static */ @@ -461,10 +430,9 @@ acpi_rs_end_depend_fns_resource ( /* Return the final size of the structure */ *structure_size = struct_size; - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_rs_start_depend_fns_stream @@ -483,39 +451,35 @@ acpi_rs_end_depend_fns_resource ( ******************************************************************************/ acpi_status -acpi_rs_start_depend_fns_stream ( - struct acpi_resource *linked_list, - u8 **output_buffer, - acpi_size *bytes_consumed) +acpi_rs_start_depend_fns_stream(struct acpi_resource *linked_list, + u8 ** output_buffer, acpi_size * bytes_consumed) { - u8 *buffer = *output_buffer; - u8 temp8 = 0; - - - ACPI_FUNCTION_TRACE ("rs_start_depend_fns_stream"); + u8 *buffer = *output_buffer; + u8 temp8 = 0; + ACPI_FUNCTION_TRACE("rs_start_depend_fns_stream"); /* * The descriptor field is set based upon whether a byte is needed * to contain Priority data. */ if (ACPI_ACCEPTABLE_CONFIGURATION == - linked_list->data.start_dpf.compatibility_priority && - ACPI_ACCEPTABLE_CONFIGURATION == - linked_list->data.start_dpf.performance_robustness) { + linked_list->data.start_dpf.compatibility_priority && + ACPI_ACCEPTABLE_CONFIGURATION == + linked_list->data.start_dpf.performance_robustness) { *buffer = 0x30; - } - else { + } else { *buffer = 0x31; buffer += 1; /* Set the Priority Byte Definition */ temp8 = 0; - temp8 = (u8) ((linked_list->data.start_dpf.performance_robustness & - 0x03) << 2); - temp8 |= (linked_list->data.start_dpf.compatibility_priority & - 0x03); + temp8 = + (u8) ((linked_list->data.start_dpf. + performance_robustness & 0x03) << 2); + temp8 |= + (linked_list->data.start_dpf.compatibility_priority & 0x03); *buffer = temp8; } @@ -523,11 +487,10 @@ acpi_rs_start_depend_fns_stream ( /* Return the number of bytes consumed in this operation */ - *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); - return_ACPI_STATUS (AE_OK); + *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_rs_end_depend_fns_stream @@ -545,16 +508,12 @@ acpi_rs_start_depend_fns_stream ( ******************************************************************************/ acpi_status -acpi_rs_end_depend_fns_stream ( - struct acpi_resource *linked_list, - u8 **output_buffer, - acpi_size *bytes_consumed) +acpi_rs_end_depend_fns_stream(struct acpi_resource *linked_list, + u8 ** output_buffer, acpi_size * bytes_consumed) { - u8 *buffer = *output_buffer; - - - ACPI_FUNCTION_TRACE ("rs_end_depend_fns_stream"); + u8 *buffer = *output_buffer; + ACPI_FUNCTION_TRACE("rs_end_depend_fns_stream"); /* The descriptor field is static */ @@ -563,7 +522,6 @@ acpi_rs_end_depend_fns_stream ( /* Return the number of bytes consumed in this operation */ - *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); - return_ACPI_STATUS (AE_OK); + *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer); + return_ACPI_STATUS(AE_OK); } - diff --git a/drivers/acpi/resources/rsutils.c b/drivers/acpi/resources/rsutils.c index 700cf7d65d7..4446778eaf7 100644 --- a/drivers/acpi/resources/rsutils.c +++ b/drivers/acpi/resources/rsutils.c @@ -41,15 +41,12 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include #include #include - #define _COMPONENT ACPI_RESOURCES - ACPI_MODULE_NAME ("rsutils") - +ACPI_MODULE_NAME("rsutils") /******************************************************************************* * @@ -68,42 +65,36 @@ * and the contents of the callers buffer is undefined. * ******************************************************************************/ - acpi_status -acpi_rs_get_prt_method_data ( - acpi_handle handle, - struct acpi_buffer *ret_buffer) +acpi_rs_get_prt_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer) { - union acpi_operand_object *obj_desc; - acpi_status status; - - - ACPI_FUNCTION_TRACE ("rs_get_prt_method_data"); + union acpi_operand_object *obj_desc; + acpi_status status; + ACPI_FUNCTION_TRACE("rs_get_prt_method_data"); /* Parameters guaranteed valid by caller */ /* Execute the method, no parameters */ - status = acpi_ut_evaluate_object (handle, METHOD_NAME__PRT, - ACPI_BTYPE_PACKAGE, &obj_desc); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ut_evaluate_object(handle, METHOD_NAME__PRT, + ACPI_BTYPE_PACKAGE, &obj_desc); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* * Create a resource linked list from the byte stream buffer that comes * back from the _CRS method execution. */ - status = acpi_rs_create_pci_routing_table (obj_desc, ret_buffer); + status = acpi_rs_create_pci_routing_table(obj_desc, ret_buffer); /* On exit, we must delete the object returned by evaluate_object */ - acpi_ut_remove_reference (obj_desc); - return_ACPI_STATUS (status); + acpi_ut_remove_reference(obj_desc); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_rs_get_crs_method_data @@ -123,25 +114,21 @@ acpi_rs_get_prt_method_data ( ******************************************************************************/ acpi_status -acpi_rs_get_crs_method_data ( - acpi_handle handle, - struct acpi_buffer *ret_buffer) +acpi_rs_get_crs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer) { - union acpi_operand_object *obj_desc; - acpi_status status; - - - ACPI_FUNCTION_TRACE ("rs_get_crs_method_data"); + union acpi_operand_object *obj_desc; + acpi_status status; + ACPI_FUNCTION_TRACE("rs_get_crs_method_data"); /* Parameters guaranteed valid by caller */ /* Execute the method, no parameters */ - status = acpi_ut_evaluate_object (handle, METHOD_NAME__CRS, - ACPI_BTYPE_BUFFER, &obj_desc); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ut_evaluate_object(handle, METHOD_NAME__CRS, + ACPI_BTYPE_BUFFER, &obj_desc); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* @@ -149,15 +136,14 @@ acpi_rs_get_crs_method_data ( * byte stream buffer that comes back from the _CRS method * execution. */ - status = acpi_rs_create_resource_list (obj_desc, ret_buffer); + status = acpi_rs_create_resource_list(obj_desc, ret_buffer); /* on exit, we must delete the object returned by evaluate_object */ - acpi_ut_remove_reference (obj_desc); - return_ACPI_STATUS (status); + acpi_ut_remove_reference(obj_desc); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_rs_get_prs_method_data @@ -178,25 +164,21 @@ acpi_rs_get_crs_method_data ( #ifdef ACPI_FUTURE_USAGE acpi_status -acpi_rs_get_prs_method_data ( - acpi_handle handle, - struct acpi_buffer *ret_buffer) +acpi_rs_get_prs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer) { - union acpi_operand_object *obj_desc; - acpi_status status; - - - ACPI_FUNCTION_TRACE ("rs_get_prs_method_data"); + union acpi_operand_object *obj_desc; + acpi_status status; + ACPI_FUNCTION_TRACE("rs_get_prs_method_data"); /* Parameters guaranteed valid by caller */ /* Execute the method, no parameters */ - status = acpi_ut_evaluate_object (handle, METHOD_NAME__PRS, - ACPI_BTYPE_BUFFER, &obj_desc); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ut_evaluate_object(handle, METHOD_NAME__PRS, + ACPI_BTYPE_BUFFER, &obj_desc); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* @@ -204,15 +186,14 @@ acpi_rs_get_prs_method_data ( * byte stream buffer that comes back from the _CRS method * execution. */ - status = acpi_rs_create_resource_list (obj_desc, ret_buffer); + status = acpi_rs_create_resource_list(obj_desc, ret_buffer); /* on exit, we must delete the object returned by evaluate_object */ - acpi_ut_remove_reference (obj_desc); - return_ACPI_STATUS (status); + acpi_ut_remove_reference(obj_desc); + return_ACPI_STATUS(status); } -#endif /* ACPI_FUTURE_USAGE */ - +#endif /* ACPI_FUTURE_USAGE */ /******************************************************************************* * @@ -234,25 +215,22 @@ acpi_rs_get_prs_method_data ( ******************************************************************************/ acpi_status -acpi_rs_get_method_data ( - acpi_handle handle, - char *path, - struct acpi_buffer *ret_buffer) +acpi_rs_get_method_data(acpi_handle handle, + char *path, struct acpi_buffer *ret_buffer) { - union acpi_operand_object *obj_desc; - acpi_status status; - - - ACPI_FUNCTION_TRACE ("rs_get_method_data"); + union acpi_operand_object *obj_desc; + acpi_status status; + ACPI_FUNCTION_TRACE("rs_get_method_data"); /* Parameters guaranteed valid by caller */ /* Execute the method, no parameters */ - status = acpi_ut_evaluate_object (handle, path, ACPI_BTYPE_BUFFER, &obj_desc); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = + acpi_ut_evaluate_object(handle, path, ACPI_BTYPE_BUFFER, &obj_desc); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* @@ -260,12 +238,12 @@ acpi_rs_get_method_data ( * byte stream buffer that comes back from the method * execution. */ - status = acpi_rs_create_resource_list (obj_desc, ret_buffer); + status = acpi_rs_create_resource_list(obj_desc, ret_buffer); /* On exit, we must delete the object returned by evaluate_object */ - acpi_ut_remove_reference (obj_desc); - return_ACPI_STATUS (status); + acpi_ut_remove_reference(obj_desc); + return_ACPI_STATUS(status); } /******************************************************************************* @@ -287,18 +265,14 @@ acpi_rs_get_method_data ( ******************************************************************************/ acpi_status -acpi_rs_set_srs_method_data ( - acpi_handle handle, - struct acpi_buffer *in_buffer) +acpi_rs_set_srs_method_data(acpi_handle handle, struct acpi_buffer *in_buffer) { - struct acpi_parameter_info info; - union acpi_operand_object *params[2]; - acpi_status status; - struct acpi_buffer buffer; - - - ACPI_FUNCTION_TRACE ("rs_set_srs_method_data"); + struct acpi_parameter_info info; + union acpi_operand_object *params[2]; + acpi_status status; + struct acpi_buffer buffer; + ACPI_FUNCTION_TRACE("rs_set_srs_method_data"); /* Parameters guaranteed valid by caller */ @@ -310,24 +284,24 @@ acpi_rs_set_srs_method_data ( * Convert the linked list into a byte stream */ buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER; - status = acpi_rs_create_byte_stream (in_buffer->pointer, &buffer); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_rs_create_byte_stream(in_buffer->pointer, &buffer); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* Init the param object */ - params[0] = acpi_ut_create_internal_object (ACPI_TYPE_BUFFER); + params[0] = acpi_ut_create_internal_object(ACPI_TYPE_BUFFER); if (!params[0]) { - acpi_os_free (buffer.pointer); - return_ACPI_STATUS (AE_NO_MEMORY); + acpi_os_free(buffer.pointer); + return_ACPI_STATUS(AE_NO_MEMORY); } /* Set up the parameter object */ - params[0]->buffer.length = (u32) buffer.length; + params[0]->buffer.length = (u32) buffer.length; params[0]->buffer.pointer = buffer.pointer; - params[0]->common.flags = AOPOBJ_DATA_VALID; + params[0]->common.flags = AOPOBJ_DATA_VALID; params[1] = NULL; info.node = handle; @@ -336,18 +310,17 @@ acpi_rs_set_srs_method_data ( /* Execute the method, no return value */ - status = acpi_ns_evaluate_relative (METHOD_NAME__SRS, &info); - if (ACPI_SUCCESS (status)) { + status = acpi_ns_evaluate_relative(METHOD_NAME__SRS, &info); + if (ACPI_SUCCESS(status)) { /* Delete any return object (especially if implicit_return is enabled) */ if (info.return_object) { - acpi_ut_remove_reference (info.return_object); + acpi_ut_remove_reference(info.return_object); } } /* Clean up and return the status from acpi_ns_evaluate_relative */ - acpi_ut_remove_reference (params[0]); - return_ACPI_STATUS (status); + acpi_ut_remove_reference(params[0]); + return_ACPI_STATUS(status); } - diff --git a/drivers/acpi/resources/rsxface.c b/drivers/acpi/resources/rsxface.c index 83c944b8b09..ee5a5c50919 100644 --- a/drivers/acpi/resources/rsxface.c +++ b/drivers/acpi/resources/rsxface.c @@ -47,10 +47,9 @@ #include #define _COMPONENT ACPI_RESOURCES - ACPI_MODULE_NAME ("rsxface") +ACPI_MODULE_NAME("rsxface") /* Local macros for 16,32-bit to 64-bit conversion */ - #define ACPI_COPY_FIELD(out, in, field) ((out)->field = (in)->field) #define ACPI_COPY_ADDRESS(out, in) \ ACPI_COPY_FIELD(out, in, resource_type); \ @@ -65,8 +64,6 @@ ACPI_COPY_FIELD(out, in, address_translation_offset); \ ACPI_COPY_FIELD(out, in, address_length); \ ACPI_COPY_FIELD(out, in, resource_source); - - /******************************************************************************* * * FUNCTION: acpi_get_irq_routing_table @@ -89,17 +86,13 @@ * the object indicated by the passed device_handle. * ******************************************************************************/ - acpi_status -acpi_get_irq_routing_table ( - acpi_handle device_handle, - struct acpi_buffer *ret_buffer) +acpi_get_irq_routing_table(acpi_handle device_handle, + struct acpi_buffer *ret_buffer) { - acpi_status status; - - - ACPI_FUNCTION_TRACE ("acpi_get_irq_routing_table "); + acpi_status status; + ACPI_FUNCTION_TRACE("acpi_get_irq_routing_table "); /* * Must have a valid handle and buffer, So we have to have a handle @@ -108,19 +101,18 @@ acpi_get_irq_routing_table ( * we'll be returning the needed buffer size, so keep going. */ if (!device_handle) { - return_ACPI_STATUS (AE_BAD_PARAMETER); + return_ACPI_STATUS(AE_BAD_PARAMETER); } - status = acpi_ut_validate_buffer (ret_buffer); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ut_validate_buffer(ret_buffer); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } - status = acpi_rs_get_prt_method_data (device_handle, ret_buffer); - return_ACPI_STATUS (status); + status = acpi_rs_get_prt_method_data(device_handle, ret_buffer); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_get_current_resources @@ -146,15 +138,12 @@ acpi_get_irq_routing_table ( ******************************************************************************/ acpi_status -acpi_get_current_resources ( - acpi_handle device_handle, - struct acpi_buffer *ret_buffer) +acpi_get_current_resources(acpi_handle device_handle, + struct acpi_buffer *ret_buffer) { - acpi_status status; - - - ACPI_FUNCTION_TRACE ("acpi_get_current_resources"); + acpi_status status; + ACPI_FUNCTION_TRACE("acpi_get_current_resources"); /* * Must have a valid handle and buffer, So we have to have a handle @@ -163,19 +152,19 @@ acpi_get_current_resources ( * we'll be returning the needed buffer size, so keep going. */ if (!device_handle) { - return_ACPI_STATUS (AE_BAD_PARAMETER); + return_ACPI_STATUS(AE_BAD_PARAMETER); } - status = acpi_ut_validate_buffer (ret_buffer); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ut_validate_buffer(ret_buffer); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } - status = acpi_rs_get_crs_method_data (device_handle, ret_buffer); - return_ACPI_STATUS (status); + status = acpi_rs_get_crs_method_data(device_handle, ret_buffer); + return_ACPI_STATUS(status); } -EXPORT_SYMBOL(acpi_get_current_resources); +EXPORT_SYMBOL(acpi_get_current_resources); /******************************************************************************* * @@ -200,15 +189,12 @@ EXPORT_SYMBOL(acpi_get_current_resources); #ifdef ACPI_FUTURE_USAGE acpi_status -acpi_get_possible_resources ( - acpi_handle device_handle, - struct acpi_buffer *ret_buffer) +acpi_get_possible_resources(acpi_handle device_handle, + struct acpi_buffer *ret_buffer) { - acpi_status status; - - - ACPI_FUNCTION_TRACE ("acpi_get_possible_resources"); + acpi_status status; + ACPI_FUNCTION_TRACE("acpi_get_possible_resources"); /* * Must have a valid handle and buffer, So we have to have a handle @@ -217,20 +203,20 @@ acpi_get_possible_resources ( * we'll be returning the needed buffer size, so keep going. */ if (!device_handle) { - return_ACPI_STATUS (AE_BAD_PARAMETER); + return_ACPI_STATUS(AE_BAD_PARAMETER); } - status = acpi_ut_validate_buffer (ret_buffer); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ut_validate_buffer(ret_buffer); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } - status = acpi_rs_get_prs_method_data (device_handle, ret_buffer); - return_ACPI_STATUS (status); + status = acpi_rs_get_prs_method_data(device_handle, ret_buffer); + return_ACPI_STATUS(status); } -EXPORT_SYMBOL(acpi_get_possible_resources); -#endif /* ACPI_FUTURE_USAGE */ +EXPORT_SYMBOL(acpi_get_possible_resources); +#endif /* ACPI_FUTURE_USAGE */ /******************************************************************************* * @@ -252,37 +238,33 @@ EXPORT_SYMBOL(acpi_get_possible_resources); ******************************************************************************/ acpi_status -acpi_walk_resources ( - acpi_handle device_handle, - char *path, - ACPI_WALK_RESOURCE_CALLBACK user_function, - void *context) +acpi_walk_resources(acpi_handle device_handle, + char *path, + ACPI_WALK_RESOURCE_CALLBACK user_function, void *context) { - acpi_status status; - struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL}; - struct acpi_resource *resource; - struct acpi_resource *buffer_end; - - - ACPI_FUNCTION_TRACE ("acpi_walk_resources"); + acpi_status status; + struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; + struct acpi_resource *resource; + struct acpi_resource *buffer_end; + ACPI_FUNCTION_TRACE("acpi_walk_resources"); if (!device_handle || - (ACPI_STRNCMP (path, METHOD_NAME__CRS, sizeof (METHOD_NAME__CRS)) && - ACPI_STRNCMP (path, METHOD_NAME__PRS, sizeof (METHOD_NAME__PRS)))) { - return_ACPI_STATUS (AE_BAD_PARAMETER); + (ACPI_STRNCMP(path, METHOD_NAME__CRS, sizeof(METHOD_NAME__CRS)) && + ACPI_STRNCMP(path, METHOD_NAME__PRS, sizeof(METHOD_NAME__PRS)))) { + return_ACPI_STATUS(AE_BAD_PARAMETER); } - status = acpi_rs_get_method_data (device_handle, path, &buffer); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_rs_get_method_data(device_handle, path, &buffer); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* Setup pointers */ - resource = (struct acpi_resource *) buffer.pointer; - buffer_end = ACPI_CAST_PTR (struct acpi_resource, - ((u8 *) buffer.pointer + buffer.length)); + resource = (struct acpi_resource *)buffer.pointer; + buffer_end = ACPI_CAST_PTR(struct acpi_resource, + ((u8 *) buffer.pointer + buffer.length)); /* Walk the resource list */ @@ -291,7 +273,7 @@ acpi_walk_resources ( break; } - status = user_function (resource, context); + status = user_function(resource, context); switch (status) { case AE_OK: @@ -318,7 +300,7 @@ acpi_walk_resources ( /* Get the next resource descriptor */ - resource = ACPI_NEXT_RESOURCE (resource); + resource = ACPI_NEXT_RESOURCE(resource); /* Check for end-of-buffer */ @@ -327,13 +309,13 @@ acpi_walk_resources ( } } -cleanup: + cleanup: - acpi_os_free (buffer.pointer); - return_ACPI_STATUS (status); + acpi_os_free(buffer.pointer); + return_ACPI_STATUS(status); } -EXPORT_SYMBOL(acpi_walk_resources); +EXPORT_SYMBOL(acpi_walk_resources); /******************************************************************************* * @@ -354,30 +336,25 @@ EXPORT_SYMBOL(acpi_walk_resources); ******************************************************************************/ acpi_status -acpi_set_current_resources ( - acpi_handle device_handle, - struct acpi_buffer *in_buffer) +acpi_set_current_resources(acpi_handle device_handle, + struct acpi_buffer *in_buffer) { - acpi_status status; - - - ACPI_FUNCTION_TRACE ("acpi_set_current_resources"); + acpi_status status; + ACPI_FUNCTION_TRACE("acpi_set_current_resources"); /* Must have a valid handle and buffer */ - if ((!device_handle) || - (!in_buffer) || - (!in_buffer->pointer) || - (!in_buffer->length)) { - return_ACPI_STATUS (AE_BAD_PARAMETER); + if ((!device_handle) || + (!in_buffer) || (!in_buffer->pointer) || (!in_buffer->length)) { + return_ACPI_STATUS(AE_BAD_PARAMETER); } - status = acpi_rs_set_srs_method_data (device_handle, in_buffer); - return_ACPI_STATUS (status); + status = acpi_rs_set_srs_method_data(device_handle, in_buffer); + return_ACPI_STATUS(status); } -EXPORT_SYMBOL(acpi_set_current_resources); +EXPORT_SYMBOL(acpi_set_current_resources); /****************************************************************************** * @@ -398,41 +375,38 @@ EXPORT_SYMBOL(acpi_set_current_resources); ******************************************************************************/ acpi_status -acpi_resource_to_address64 ( - struct acpi_resource *resource, - struct acpi_resource_address64 *out) +acpi_resource_to_address64(struct acpi_resource *resource, + struct acpi_resource_address64 *out) { - struct acpi_resource_address16 *address16; - struct acpi_resource_address32 *address32; - + struct acpi_resource_address16 *address16; + struct acpi_resource_address32 *address32; switch (resource->id) { case ACPI_RSTYPE_ADDRESS16: - address16 = (struct acpi_resource_address16 *) &resource->data; - ACPI_COPY_ADDRESS (out, address16); + address16 = (struct acpi_resource_address16 *)&resource->data; + ACPI_COPY_ADDRESS(out, address16); break; - case ACPI_RSTYPE_ADDRESS32: - address32 = (struct acpi_resource_address32 *) &resource->data; - ACPI_COPY_ADDRESS (out, address32); + address32 = (struct acpi_resource_address32 *)&resource->data; + ACPI_COPY_ADDRESS(out, address32); break; - case ACPI_RSTYPE_ADDRESS64: /* Simple copy for 64 bit source */ - ACPI_MEMCPY (out, &resource->data, sizeof (struct acpi_resource_address64)); + ACPI_MEMCPY(out, &resource->data, + sizeof(struct acpi_resource_address64)); break; - default: return (AE_BAD_PARAMETER); } return (AE_OK); } + EXPORT_SYMBOL(acpi_resource_to_address64); diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index cbcda30c172..8a3ea41063e 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c @@ -9,14 +9,10 @@ #include #include /* for acpi_ex_eisa_id_to_string() */ - #define _COMPONENT ACPI_BUS_COMPONENT -ACPI_MODULE_NAME ("scan") - +ACPI_MODULE_NAME("scan") #define STRUCT_TO_INT(s) (*((int*)&s)) - -extern struct acpi_device *acpi_root; - +extern struct acpi_device *acpi_root; #define ACPI_BUS_CLASS "system_bus" #define ACPI_BUS_HID "ACPI_BUS" @@ -27,13 +23,11 @@ static LIST_HEAD(acpi_device_list); DEFINE_SPINLOCK(acpi_device_lock); LIST_HEAD(acpi_wakeup_device_list); -static int -acpi_bus_trim(struct acpi_device *start, - int rmdevice); +static int acpi_bus_trim(struct acpi_device *start, int rmdevice); -static void acpi_device_release(struct kobject * kobj) +static void acpi_device_release(struct kobject *kobj) { - struct acpi_device * dev = container_of(kobj,struct acpi_device,kobj); + struct acpi_device *dev = container_of(kobj, struct acpi_device, kobj); if (dev->pnp.cid_list) kfree(dev->pnp.cid_list); kfree(dev); @@ -41,34 +35,34 @@ static void acpi_device_release(struct kobject * kobj) struct acpi_device_attribute { struct attribute attr; - ssize_t (*show)(struct acpi_device *, char *); - ssize_t (*store)(struct acpi_device *, const char *, size_t); + ssize_t(*show) (struct acpi_device *, char *); + ssize_t(*store) (struct acpi_device *, const char *, size_t); }; typedef void acpi_device_sysfs_files(struct kobject *, - const struct attribute *); + const struct attribute *); static void setup_sys_fs_device_files(struct acpi_device *dev, - acpi_device_sysfs_files *func); + acpi_device_sysfs_files * func); #define create_sysfs_device_files(dev) \ setup_sys_fs_device_files(dev, (acpi_device_sysfs_files *)&sysfs_create_file) #define remove_sysfs_device_files(dev) \ setup_sys_fs_device_files(dev, (acpi_device_sysfs_files *)&sysfs_remove_file) - #define to_acpi_device(n) container_of(n, struct acpi_device, kobj) #define to_handle_attr(n) container_of(n, struct acpi_device_attribute, attr); static ssize_t acpi_device_attr_show(struct kobject *kobj, - struct attribute *attr, char *buf) + struct attribute *attr, char *buf) { struct acpi_device *device = to_acpi_device(kobj); struct acpi_device_attribute *attribute = to_handle_attr(attr); return attribute->show ? attribute->show(device, buf) : -EIO; } static ssize_t acpi_device_attr_store(struct kobject *kobj, - struct attribute *attr, const char *buf, size_t len) + struct attribute *attr, const char *buf, + size_t len) { struct acpi_device *device = to_acpi_device(kobj); struct acpi_device_attribute *attribute = to_handle_attr(attr); @@ -76,13 +70,13 @@ static ssize_t acpi_device_attr_store(struct kobject *kobj, } static struct sysfs_ops acpi_device_sysfs_ops = { - .show = acpi_device_attr_show, - .store = acpi_device_attr_store, + .show = acpi_device_attr_show, + .store = acpi_device_attr_store, }; static struct kobj_type ktype_acpi_ns = { - .sysfs_ops = &acpi_device_sysfs_ops, - .release = acpi_device_release, + .sysfs_ops = &acpi_device_sysfs_ops, + .release = acpi_device_release, }; static int namespace_hotplug(struct kset *kset, struct kobject *kobj, @@ -110,16 +104,16 @@ static struct kset_hotplug_ops namespace_hotplug_ops = { }; static struct kset acpi_namespace_kset = { - .kobj = { - .name = "namespace", - }, + .kobj = { + .name = "namespace", + }, .subsys = &acpi_subsys, - .ktype = &ktype_acpi_ns, + .ktype = &ktype_acpi_ns, .hotplug_ops = &namespace_hotplug_ops, }; - -static void acpi_device_register(struct acpi_device * device, struct acpi_device * parent) +static void acpi_device_register(struct acpi_device *device, + struct acpi_device *parent) { /* * Linkage @@ -134,14 +128,14 @@ static void acpi_device_register(struct acpi_device * device, struct acpi_device spin_lock(&acpi_device_lock); if (device->parent) { list_add_tail(&device->node, &device->parent->children); - list_add_tail(&device->g_list,&device->parent->g_list); + list_add_tail(&device->g_list, &device->parent->g_list); } else - list_add_tail(&device->g_list,&acpi_device_list); + list_add_tail(&device->g_list, &acpi_device_list); if (device->wakeup.flags.valid) - list_add_tail(&device->wakeup_list,&acpi_wakeup_device_list); + list_add_tail(&device->wakeup_list, &acpi_wakeup_device_list); spin_unlock(&acpi_device_lock); - strlcpy(device->kobj.name,device->pnp.bus_id,KOBJ_NAME_LEN); + strlcpy(device->kobj.name, device->pnp.bus_id, KOBJ_NAME_LEN); if (parent) device->kobj.parent = &parent->kobj; device->kobj.ktype = &ktype_acpi_ns; @@ -150,10 +144,7 @@ static void acpi_device_register(struct acpi_device * device, struct acpi_device create_sysfs_device_files(device); } -static int -acpi_device_unregister ( - struct acpi_device *device, - int type) +static int acpi_device_unregister(struct acpi_device *device, int type) { spin_lock(&acpi_device_lock); if (device->parent) { @@ -172,11 +163,7 @@ acpi_device_unregister ( return 0; } -void -acpi_bus_data_handler ( - acpi_handle handle, - u32 function, - void *context) +void acpi_bus_data_handler(acpi_handle handle, u32 function, void *context) { ACPI_FUNCTION_TRACE("acpi_bus_data_handler"); @@ -185,13 +172,11 @@ acpi_bus_data_handler ( return_VOID; } -static int -acpi_bus_get_power_flags ( - struct acpi_device *device) +static int acpi_bus_get_power_flags(struct acpi_device *device) { - acpi_status status = 0; - acpi_handle handle = NULL; - u32 i = 0; + acpi_status status = 0; + acpi_handle handle = NULL; + u32 i = 0; ACPI_FUNCTION_TRACE("acpi_bus_get_power_flags"); @@ -210,11 +195,11 @@ acpi_bus_get_power_flags ( */ for (i = ACPI_STATE_D0; i <= ACPI_STATE_D3; i++) { struct acpi_device_power_state *ps = &device->power.states[i]; - char object_name[5] = {'_','P','R','0'+i,'\0'}; + char object_name[5] = { '_', 'P', 'R', '0' + i, '\0' }; /* Evaluate "_PRx" to se if power resources are referenced */ acpi_evaluate_reference(device->handle, object_name, NULL, - &ps->resources); + &ps->resources); if (ps->resources.count) { device->power.flags.power_resources = 1; ps->flags.valid = 1; @@ -232,7 +217,7 @@ acpi_bus_get_power_flags ( if (ps->resources.count || ps->flags.explicit_set) ps->flags.valid = 1; - ps->power = -1; /* Unknown - driver assigned */ + ps->power = -1; /* Unknown - driver assigned */ ps->latency = -1; /* Unknown - driver assigned */ } @@ -249,13 +234,10 @@ acpi_bus_get_power_flags ( return_VALUE(0); } -int -acpi_match_ids ( - struct acpi_device *device, - char *ids) +int acpi_match_ids(struct acpi_device *device, char *ids) { int error = 0; - struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL}; + struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; if (device->flags.hardware_id) if (strstr(ids, device->pnp.hardware_id)) @@ -266,27 +248,25 @@ acpi_match_ids ( int i; /* compare multiple _CID entries against driver ids */ - for (i = 0; i < cid_list->count; i++) - { + for (i = 0; i < cid_list->count; i++) { if (strstr(ids, cid_list->id[i].value)) goto Done; } } error = -ENOENT; - Done: + Done: if (buffer.pointer) acpi_os_free(buffer.pointer); return error; } static acpi_status -acpi_bus_extract_wakeup_device_power_package ( - struct acpi_device *device, - union acpi_object *package) +acpi_bus_extract_wakeup_device_power_package(struct acpi_device *device, + union acpi_object *package) { - int i = 0; - union acpi_object *element = NULL; + int i = 0; + union acpi_object *element = NULL; if (!device || !package || (package->package.count < 2)) return AE_BAD_PARAMETER; @@ -296,14 +276,17 @@ acpi_bus_extract_wakeup_device_power_package ( return AE_BAD_PARAMETER; if (element->type == ACPI_TYPE_PACKAGE) { if ((element->package.count < 2) || - (element->package.elements[0].type != ACPI_TYPE_LOCAL_REFERENCE) || - (element->package.elements[1].type != ACPI_TYPE_INTEGER)) + (element->package.elements[0].type != + ACPI_TYPE_LOCAL_REFERENCE) + || (element->package.elements[1].type != ACPI_TYPE_INTEGER)) return AE_BAD_DATA; - device->wakeup.gpe_device = element->package.elements[0].reference.handle; - device->wakeup.gpe_number = (u32)element->package.elements[1].integer.value; - }else if (element->type == ACPI_TYPE_INTEGER) { + device->wakeup.gpe_device = + element->package.elements[0].reference.handle; + device->wakeup.gpe_number = + (u32) element->package.elements[1].integer.value; + } else if (element->type == ACPI_TYPE_INTEGER) { device->wakeup.gpe_number = element->integer.value; - }else + } else return AE_BAD_DATA; element = &(package->package.elements[1]); @@ -316,9 +299,9 @@ acpi_bus_extract_wakeup_device_power_package ( return AE_NO_MEMORY; } device->wakeup.resources.count = package->package.count - 2; - for (i=0; i < device->wakeup.resources.count; i++) { + for (i = 0; i < device->wakeup.resources.count; i++) { element = &(package->package.elements[i + 2]); - if (element->type != ACPI_TYPE_ANY ) { + if (element->type != ACPI_TYPE_ANY) { return AE_BAD_DATA; } @@ -328,13 +311,11 @@ acpi_bus_extract_wakeup_device_power_package ( return AE_OK; } -static int -acpi_bus_get_wakeup_device_flags ( - struct acpi_device *device) +static int acpi_bus_get_wakeup_device_flags(struct acpi_device *device) { - acpi_status status = 0; - struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL}; - union acpi_object *package = NULL; + acpi_status status = 0; + struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; + union acpi_object *package = NULL; ACPI_FUNCTION_TRACE("acpi_bus_get_wakeup_flags"); @@ -345,21 +326,22 @@ acpi_bus_get_wakeup_device_flags ( goto end; } - package = (union acpi_object *) buffer.pointer; + package = (union acpi_object *)buffer.pointer; status = acpi_bus_extract_wakeup_device_power_package(device, package); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error extracting _PRW package\n")); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Error extracting _PRW package\n")); goto end; } acpi_os_free(buffer.pointer); device->wakeup.flags.valid = 1; - /* Power button, Lid switch always enable wakeup*/ + /* Power button, Lid switch always enable wakeup */ if (!acpi_match_ids(device, "PNP0C0D,PNP0C0C,PNP0C0E")) device->wakeup.flags.run_wake = 1; -end: + end: if (ACPI_FAILURE(status)) device->flags.wake_capable = 0; return_VALUE(0); @@ -368,8 +350,8 @@ end: /* -------------------------------------------------------------------------- ACPI hotplug sysfs device file support -------------------------------------------------------------------------- */ -static ssize_t acpi_eject_store(struct acpi_device *device, - const char *buf, size_t count); +static ssize_t acpi_eject_store(struct acpi_device *device, + const char *buf, size_t count); #define ACPI_DEVICE_ATTR(_name,_mode,_show,_store) \ static struct acpi_device_attribute acpi_device_attr_##_name = \ @@ -383,12 +365,11 @@ ACPI_DEVICE_ATTR(eject, 0200, NULL, acpi_eject_store); * @func: function pointer to create or destroy the device file */ static void -setup_sys_fs_device_files ( - struct acpi_device *dev, - acpi_device_sysfs_files *func) +setup_sys_fs_device_files(struct acpi_device *dev, + acpi_device_sysfs_files * func) { - acpi_status status; - acpi_handle temp = NULL; + acpi_status status; + acpi_handle temp = NULL; /* * If device has _EJ0, 'eject' file is created that is used to trigger @@ -396,11 +377,10 @@ setup_sys_fs_device_files ( */ status = acpi_get_handle(dev->handle, "_EJ0", &temp); if (ACPI_SUCCESS(status)) - (*(func))(&dev->kobj,&acpi_device_attr_eject.attr); + (*(func)) (&dev->kobj, &acpi_device_attr_eject.attr); } -static int -acpi_eject_operation(acpi_handle handle, int lockable) +static int acpi_eject_operation(acpi_handle handle, int lockable) { struct acpi_object_list arg_list; union acpi_object arg; @@ -429,27 +409,25 @@ acpi_eject_operation(acpi_handle handle, int lockable) status = acpi_evaluate_object(handle, "_EJ0", &arg_list, NULL); if (ACPI_FAILURE(status)) { - return(-ENODEV); + return (-ENODEV); } - return(0); + return (0); } - static ssize_t acpi_eject_store(struct acpi_device *device, const char *buf, size_t count) { - int result; - int ret = count; - int islockable; - acpi_status status; - acpi_handle handle; - acpi_object_type type = 0; + int result; + int ret = count; + int islockable; + acpi_status status; + acpi_handle handle; + acpi_object_type type = 0; if ((!count) || (buf[0] != '1')) { return -EINVAL; } - #ifndef FORCE_EJECT if (device->driver == NULL) { ret = -ENODEV; @@ -457,7 +435,7 @@ acpi_eject_store(struct acpi_device *device, const char *buf, size_t count) } #endif status = acpi_get_type(device->handle, &type); - if (ACPI_FAILURE(status) || (!device->flags.ejectable) ) { + if (ACPI_FAILURE(status) || (!device->flags.ejectable)) { ret = -ENODEV; goto err; } @@ -476,18 +454,15 @@ acpi_eject_store(struct acpi_device *device, const char *buf, size_t count) if (result) { ret = -EBUSY; } -err: + err: return ret; } - /* -------------------------------------------------------------------------- Performance Management -------------------------------------------------------------------------- */ -static int -acpi_bus_get_perf_flags ( - struct acpi_device *device) +static int acpi_bus_get_perf_flags(struct acpi_device *device) { device->performance.state = ACPI_STATE_UNKNOWN; return 0; @@ -500,7 +475,6 @@ acpi_bus_get_perf_flags ( static LIST_HEAD(acpi_bus_drivers); static DECLARE_MUTEX(acpi_bus_drivers_lock); - /** * acpi_bus_match * -------------- @@ -508,16 +482,13 @@ static DECLARE_MUTEX(acpi_bus_drivers_lock); * matches the specified driver's criteria. */ static int -acpi_bus_match ( - struct acpi_device *device, - struct acpi_driver *driver) +acpi_bus_match(struct acpi_device *device, struct acpi_driver *driver) { if (driver && driver->ops.match) return driver->ops.match(device, driver); return acpi_match_ids(device, driver->ids); } - /** * acpi_bus_driver_init * -------------------- @@ -525,11 +496,9 @@ acpi_bus_match ( * driver is bound to a device. Invokes the driver's add() and start() ops. */ static int -acpi_bus_driver_init ( - struct acpi_device *device, - struct acpi_driver *driver) +acpi_bus_driver_init(struct acpi_device *device, struct acpi_driver *driver) { - int result = 0; + int result = 0; ACPI_FUNCTION_TRACE("acpi_bus_driver_init"); @@ -553,13 +522,12 @@ acpi_bus_driver_init ( * upon possible configuration and currently allocated resources. */ - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Driver successfully bound to device\n")); + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "Driver successfully bound to device\n")); return_VALUE(0); } -int -acpi_start_single_object ( - struct acpi_device *device) +int acpi_start_single_object(struct acpi_device *device) { int result = 0; struct acpi_driver *driver; @@ -578,16 +546,17 @@ acpi_start_single_object ( return_VALUE(result); } -static int acpi_driver_attach(struct acpi_driver * drv) +static int acpi_driver_attach(struct acpi_driver *drv) { - struct list_head * node, * next; + struct list_head *node, *next; int count = 0; ACPI_FUNCTION_TRACE("acpi_driver_attach"); spin_lock(&acpi_device_lock); list_for_each_safe(node, next, &acpi_device_list) { - struct acpi_device * dev = container_of(node, struct acpi_device, g_list); + struct acpi_device *dev = + container_of(node, struct acpi_device, g_list); if (dev->driver || !dev->status.present) continue; @@ -598,7 +567,8 @@ static int acpi_driver_attach(struct acpi_driver * drv) acpi_start_single_object(dev); atomic_inc(&drv->references); count++; - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found driver [%s] for device [%s]\n", + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "Found driver [%s] for device [%s]\n", drv->name, dev->pnp.bus_id)); } } @@ -608,20 +578,21 @@ static int acpi_driver_attach(struct acpi_driver * drv) return_VALUE(count); } -static int acpi_driver_detach(struct acpi_driver * drv) +static int acpi_driver_detach(struct acpi_driver *drv) { - struct list_head * node, * next; + struct list_head *node, *next; ACPI_FUNCTION_TRACE("acpi_driver_detach"); spin_lock(&acpi_device_lock); - list_for_each_safe(node,next,&acpi_device_list) { - struct acpi_device * dev = container_of(node,struct acpi_device,g_list); + list_for_each_safe(node, next, &acpi_device_list) { + struct acpi_device *dev = + container_of(node, struct acpi_device, g_list); if (dev->driver == drv) { spin_unlock(&acpi_device_lock); if (drv->ops.remove) - drv->ops.remove(dev,ACPI_BUS_REMOVAL_NORMAL); + drv->ops.remove(dev, ACPI_BUS_REMOVAL_NORMAL); spin_lock(&acpi_device_lock); dev->driver = NULL; dev->driver_data = NULL; @@ -640,9 +611,7 @@ static int acpi_driver_detach(struct acpi_driver * drv) * number of devices that were claimed by the driver, or a negative * error status for failure. */ -int -acpi_bus_register_driver ( - struct acpi_driver *driver) +int acpi_bus_register_driver(struct acpi_driver *driver) { int count; @@ -661,8 +630,8 @@ acpi_bus_register_driver ( return_VALUE(count); } -EXPORT_SYMBOL(acpi_bus_register_driver); +EXPORT_SYMBOL(acpi_bus_register_driver); /** * acpi_bus_unregister_driver @@ -670,9 +639,7 @@ EXPORT_SYMBOL(acpi_bus_register_driver); * Unregisters a driver with the ACPI bus. Searches the namespace for all * devices that match the driver's criteria and unbinds. */ -int -acpi_bus_unregister_driver ( - struct acpi_driver *driver) +int acpi_bus_unregister_driver(struct acpi_driver *driver) { int error = 0; @@ -685,11 +652,12 @@ acpi_bus_unregister_driver ( spin_lock(&acpi_device_lock); list_del_init(&driver->node); spin_unlock(&acpi_device_lock); - } - } else + } + } else error = -EINVAL; return_VALUE(error); } + EXPORT_SYMBOL(acpi_bus_unregister_driver); /** @@ -698,18 +666,17 @@ EXPORT_SYMBOL(acpi_bus_unregister_driver); * Parses the list of registered drivers looking for a driver applicable for * the specified device. */ -static int -acpi_bus_find_driver ( - struct acpi_device *device) +static int acpi_bus_find_driver(struct acpi_device *device) { - int result = 0; - struct list_head * node, *next; + int result = 0; + struct list_head *node, *next; ACPI_FUNCTION_TRACE("acpi_bus_find_driver"); spin_lock(&acpi_device_lock); - list_for_each_safe(node,next,&acpi_bus_drivers) { - struct acpi_driver * driver = container_of(node,struct acpi_driver,node); + list_for_each_safe(node, next, &acpi_bus_drivers) { + struct acpi_driver *driver = + container_of(node, struct acpi_driver, node); atomic_inc(&driver->references); spin_unlock(&acpi_device_lock); @@ -723,21 +690,18 @@ acpi_bus_find_driver ( } spin_unlock(&acpi_device_lock); - Done: + Done: return_VALUE(result); } - /* -------------------------------------------------------------------------- Device Enumeration -------------------------------------------------------------------------- */ -static int -acpi_bus_get_flags ( - struct acpi_device *device) +static int acpi_bus_get_flags(struct acpi_device *device) { - acpi_status status = AE_OK; - acpi_handle temp = NULL; + acpi_status status = AE_OK; + acpi_handle temp = NULL; ACPI_FUNCTION_TRACE("acpi_bus_get_flags"); @@ -788,11 +752,12 @@ acpi_bus_get_flags ( return_VALUE(0); } -static void acpi_device_get_busid(struct acpi_device * device, acpi_handle handle, int type) +static void acpi_device_get_busid(struct acpi_device *device, + acpi_handle handle, int type) { - char bus_id[5] = {'?',0}; - struct acpi_buffer buffer = {sizeof(bus_id), bus_id}; - int i = 0; + char bus_id[5] = { '?', 0 }; + struct acpi_buffer buffer = { sizeof(bus_id), bus_id }; + int i = 0; /* * Bus ID @@ -824,21 +789,22 @@ static void acpi_device_get_busid(struct acpi_device * device, acpi_handle handl } } -static void acpi_device_set_id(struct acpi_device * device, struct acpi_device * parent, - acpi_handle handle, int type) +static void acpi_device_set_id(struct acpi_device *device, + struct acpi_device *parent, acpi_handle handle, + int type) { - struct acpi_device_info *info; - struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL}; - char *hid = NULL; - char *uid = NULL; + struct acpi_device_info *info; + struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; + char *hid = NULL; + char *uid = NULL; struct acpi_compatible_id_list *cid_list = NULL; - acpi_status status; + acpi_status status; switch (type) { case ACPI_BUS_TYPE_DEVICE: status = acpi_get_object_info(handle, &buffer); if (ACPI_FAILURE(status)) { - printk("%s: Error reading device info\n",__FUNCTION__); + printk("%s: Error reading device info\n", __FUNCTION__); return; } @@ -904,7 +870,7 @@ static void acpi_device_set_id(struct acpi_device * device, struct acpi_device * acpi_os_free(buffer.pointer); } -static int acpi_device_set_context(struct acpi_device * device, int type) +static int acpi_device_set_context(struct acpi_device *device, int type) { acpi_status status = AE_OK; int result = 0; @@ -916,10 +882,10 @@ static int acpi_device_set_context(struct acpi_device * device, int type) * to be careful with fixed-feature devices as they all attach to the * root object. */ - if (type != ACPI_BUS_TYPE_POWER_BUTTON && + if (type != ACPI_BUS_TYPE_POWER_BUTTON && type != ACPI_BUS_TYPE_SLEEP_BUTTON) { status = acpi_attach_data(device->handle, - acpi_bus_data_handler, device); + acpi_bus_data_handler, device); if (ACPI_FAILURE(status)) { printk("Error attaching device data\n"); @@ -929,12 +895,13 @@ static int acpi_device_set_context(struct acpi_device * device, int type) return result; } -static void acpi_device_get_debug_info(struct acpi_device * device, acpi_handle handle, int type) +static void acpi_device_get_debug_info(struct acpi_device *device, + acpi_handle handle, int type) { #ifdef CONFIG_ACPI_DEBUG_OUTPUT - char *type_string = NULL; - char name[80] = {'?','\0'}; - struct acpi_buffer buffer = {sizeof(name), name}; + char *type_string = NULL; + char name[80] = { '?', '\0' }; + struct acpi_buffer buffer = { sizeof(name), name }; switch (type) { case ACPI_BUS_TYPE_DEVICE: @@ -968,18 +935,14 @@ static void acpi_device_get_debug_info(struct acpi_device * device, acpi_handle } printk(KERN_DEBUG "Found %s %s [%p]\n", type_string, name, handle); -#endif /*CONFIG_ACPI_DEBUG_OUTPUT*/ +#endif /*CONFIG_ACPI_DEBUG_OUTPUT */ } - -static int -acpi_bus_remove ( - struct acpi_device *dev, - int rmdevice) +static int acpi_bus_remove(struct acpi_device *dev, int rmdevice) { - int result = 0; - struct acpi_driver *driver; - + int result = 0; + struct acpi_driver *driver; + ACPI_FUNCTION_TRACE("acpi_bus_remove"); if (!dev) @@ -1012,22 +975,18 @@ acpi_bus_remove ( if ((dev->parent) && (dev->parent->ops.unbind)) dev->parent->ops.unbind(dev); } - + acpi_device_unregister(dev, ACPI_BUS_REMOVAL_EJECT); return_VALUE(0); } - static int -acpi_add_single_object ( - struct acpi_device **child, - struct acpi_device *parent, - acpi_handle handle, - int type) +acpi_add_single_object(struct acpi_device **child, + struct acpi_device *parent, acpi_handle handle, int type) { - int result = 0; - struct acpi_device *device = NULL; + int result = 0; + struct acpi_device *device = NULL; ACPI_FUNCTION_TRACE("acpi_add_single_object"); @@ -1044,7 +1003,7 @@ acpi_add_single_object ( device->handle = handle; device->parent = parent; - acpi_device_get_busid(device,handle,type); + acpi_device_get_busid(device, handle, type); /* * Flags @@ -1092,7 +1051,7 @@ acpi_add_single_object ( * Hardware ID, Unique ID, & Bus Address * ------------------------------------- */ - acpi_device_set_id(device,parent,handle,type); + acpi_device_set_id(device, parent, handle, type); /* * Power Management @@ -1104,7 +1063,7 @@ acpi_add_single_object ( goto end; } - /* + /* * Wakeup device management *----------------------- */ @@ -1124,12 +1083,12 @@ acpi_add_single_object ( goto end; } - if ((result = acpi_device_set_context(device,type))) + if ((result = acpi_device_set_context(device, type))) goto end; - acpi_device_get_debug_info(device,handle,type); + acpi_device_get_debug_info(device, handle, type); - acpi_device_register(device,parent); + acpi_device_register(device, parent); /* * Bind _ADR-Based Devices @@ -1154,7 +1113,7 @@ acpi_add_single_object ( */ result = acpi_bus_find_driver(device); -end: + end: if (!result) *child = device; else { @@ -1166,17 +1125,15 @@ end: return_VALUE(result); } - -static int acpi_bus_scan (struct acpi_device *start, - struct acpi_bus_ops *ops) +static int acpi_bus_scan(struct acpi_device *start, struct acpi_bus_ops *ops) { - acpi_status status = AE_OK; - struct acpi_device *parent = NULL; - struct acpi_device *child = NULL; - acpi_handle phandle = NULL; - acpi_handle chandle = NULL; - acpi_object_type type = 0; - u32 level = 1; + acpi_status status = AE_OK; + struct acpi_device *parent = NULL; + struct acpi_device *child = NULL; + acpi_handle phandle = NULL; + acpi_handle chandle = NULL; + acpi_object_type type = 0; + u32 level = 1; ACPI_FUNCTION_TRACE("acpi_bus_scan"); @@ -1185,7 +1142,7 @@ static int acpi_bus_scan (struct acpi_device *start, parent = start; phandle = start->handle; - + /* * Parse through the ACPI namespace, identify all 'devices', and * create a new 'struct acpi_device' for each. @@ -1193,7 +1150,7 @@ static int acpi_bus_scan (struct acpi_device *start, while ((level > 0) && parent) { status = acpi_get_next_object(ACPI_TYPE_ANY, phandle, - chandle, &chandle); + chandle, &chandle); /* * If this scope is exhausted then move our way back up. @@ -1243,12 +1200,12 @@ static int acpi_bus_scan (struct acpi_device *start, if (ops->acpi_op_add) status = acpi_add_single_object(&child, parent, - chandle, type); - else + chandle, type); + else status = acpi_bus_get_device(chandle, &child); - if (ACPI_FAILURE(status)) - continue; + if (ACPI_FAILURE(status)) + continue; if (ops->acpi_op_start) { status = acpi_start_single_object(child); @@ -1264,7 +1221,7 @@ static int acpi_bus_scan (struct acpi_device *start, * which will be enumerated when the parent is inserted). * * TBD: Need notifications and other detection mechanisms - * in place before we can fully implement this. + * in place before we can fully implement this. */ if (child->status.present) { status = acpi_get_next_object(ACPI_TYPE_ANY, chandle, @@ -1282,11 +1239,8 @@ static int acpi_bus_scan (struct acpi_device *start, } int -acpi_bus_add ( - struct acpi_device **child, - struct acpi_device *parent, - acpi_handle handle, - int type) +acpi_bus_add(struct acpi_device **child, + struct acpi_device *parent, acpi_handle handle, int type) { int result; struct acpi_bus_ops ops; @@ -1301,11 +1255,10 @@ acpi_bus_add ( } return_VALUE(result); } + EXPORT_SYMBOL(acpi_bus_add); -int -acpi_bus_start ( - struct acpi_device *device) +int acpi_bus_start(struct acpi_device *device) { int result; struct acpi_bus_ops ops; @@ -1323,26 +1276,25 @@ acpi_bus_start ( } return_VALUE(result); } + EXPORT_SYMBOL(acpi_bus_start); -static int -acpi_bus_trim(struct acpi_device *start, - int rmdevice) +static int acpi_bus_trim(struct acpi_device *start, int rmdevice) { - acpi_status status; - struct acpi_device *parent, *child; - acpi_handle phandle, chandle; - acpi_object_type type; - u32 level = 1; - int err = 0; - - parent = start; + acpi_status status; + struct acpi_device *parent, *child; + acpi_handle phandle, chandle; + acpi_object_type type; + u32 level = 1; + int err = 0; + + parent = start; phandle = start->handle; child = chandle = NULL; while ((level > 0) && parent && (!err)) { status = acpi_get_next_object(ACPI_TYPE_ANY, phandle, - chandle, &chandle); + chandle, &chandle); /* * If this scope is exhausted then move our way back up. @@ -1381,12 +1333,10 @@ acpi_bus_trim(struct acpi_device *start, return err; } -static int -acpi_bus_scan_fixed ( - struct acpi_device *root) +static int acpi_bus_scan_fixed(struct acpi_device *root) { - int result = 0; - struct acpi_device *device = NULL; + int result = 0; + struct acpi_device *device = NULL; ACPI_FUNCTION_TRACE("acpi_bus_scan_fixed"); @@ -1398,14 +1348,16 @@ acpi_bus_scan_fixed ( */ if (acpi_fadt.pwr_button == 0) { result = acpi_add_single_object(&device, acpi_root, - NULL, ACPI_BUS_TYPE_POWER_BUTTON); + NULL, + ACPI_BUS_TYPE_POWER_BUTTON); if (!result) result = acpi_start_single_object(device); } if (acpi_fadt.sleep_button == 0) { result = acpi_add_single_object(&device, acpi_root, - NULL, ACPI_BUS_TYPE_SLEEP_BUTTON); + NULL, + ACPI_BUS_TYPE_SLEEP_BUTTON); if (!result) result = acpi_start_single_object(device); } @@ -1413,7 +1365,6 @@ acpi_bus_scan_fixed ( return_VALUE(result); } - static int __init acpi_scan_init(void) { int result; @@ -1430,7 +1381,7 @@ static int __init acpi_scan_init(void) * Create the root device in the bus's device tree */ result = acpi_add_single_object(&acpi_root, NULL, ACPI_ROOT_OBJECT, - ACPI_BUS_TYPE_SYSTEM); + ACPI_BUS_TYPE_SYSTEM); if (result) goto Done; @@ -1450,7 +1401,7 @@ static int __init acpi_scan_init(void) if (result) acpi_device_unregister(acpi_root, ACPI_BUS_REMOVAL_NORMAL); - Done: + Done: return_VALUE(result); } diff --git a/drivers/acpi/sleep/poweroff.c b/drivers/acpi/sleep/poweroff.c index 186b182c582..f8538b5b893 100644 --- a/drivers/acpi/sleep/poweroff.c +++ b/drivers/acpi/sleep/poweroff.c @@ -91,4 +91,4 @@ static int acpi_poweroff_init(void) late_initcall(acpi_poweroff_init); -#endif /* CONFIG_PM */ +#endif /* CONFIG_PM */ diff --git a/drivers/acpi/sleep/proc.c b/drivers/acpi/sleep/proc.c index a962fc24f70..09a603f3523 100644 --- a/drivers/acpi/sleep/proc.c +++ b/drivers/acpi/sleep/proc.c @@ -14,19 +14,17 @@ #include "sleep.h" #define _COMPONENT ACPI_SYSTEM_COMPONENT -ACPI_MODULE_NAME ("sleep") - +ACPI_MODULE_NAME("sleep") #ifdef CONFIG_ACPI_SLEEP_PROC_SLEEP - static int acpi_system_sleep_seq_show(struct seq_file *seq, void *offset) { - int i; + int i; ACPI_FUNCTION_TRACE("acpi_system_sleep_seq_show"); for (i = 0; i <= ACPI_STATE_S5; i++) { if (sleep_states[i]) { - seq_printf(seq,"S%d ", i); + seq_printf(seq, "S%d ", i); if (i == ACPI_STATE_S4 && acpi_gbl_FACS->S4bios_f) seq_printf(seq, "S4bios "); } @@ -43,24 +41,21 @@ static int acpi_system_sleep_open_fs(struct inode *inode, struct file *file) } static ssize_t -acpi_system_write_sleep ( - struct file *file, - const char __user *buffer, - size_t count, - loff_t *ppos) +acpi_system_write_sleep(struct file *file, + const char __user * buffer, size_t count, loff_t * ppos) { - char str[12]; - u32 state = 0; - int error = 0; + char str[12]; + u32 state = 0; + int error = 0; if (count > sizeof(str) - 1) goto Done; - memset(str,0,sizeof(str)); + memset(str, 0, sizeof(str)); if (copy_from_user(str, buffer, count)) return -EFAULT; /* Check for S4 bios request */ - if (!strcmp(str,"4b")) { + if (!strcmp(str, "4b")) { error = acpi_suspend(4); goto Done; } @@ -72,17 +67,17 @@ acpi_system_write_sleep ( } #endif error = acpi_suspend(state); - Done: + Done: return error ? error : count; } -#endif /* CONFIG_ACPI_SLEEP_PROC_SLEEP */ +#endif /* CONFIG_ACPI_SLEEP_PROC_SLEEP */ static int acpi_system_alarm_seq_show(struct seq_file *seq, void *offset) { - u32 sec, min, hr; - u32 day, mo, yr; - unsigned char rtc_control = 0; - unsigned long flags; + u32 sec, min, hr; + u32 day, mo, yr; + unsigned char rtc_control = 0; + unsigned long flags; ACPI_FUNCTION_TRACE("acpi_system_alarm_seq_show"); @@ -98,13 +93,14 @@ static int acpi_system_alarm_seq_show(struct seq_file *seq, void *offset) /* ACPI spec: only low 6 its should be cared */ day = CMOS_READ(acpi_gbl_FADT->day_alrm) & 0x3F; else - day = CMOS_READ(RTC_DAY_OF_MONTH); + 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); + yr = CMOS_READ(acpi_gbl_FADT->century) * 100 + + CMOS_READ(RTC_YEAR); else yr = CMOS_READ(RTC_YEAR); @@ -119,33 +115,33 @@ static int acpi_system_alarm_seq_show(struct seq_file *seq, void *offset) BCD_TO_BIN(yr); } - /* we're trusting the FADT (see above)*/ + /* we're trusting the FADT (see above) */ if (!acpi_gbl_FADT->century) - /* If we're not trusting the FADT, we should at least make it - * right for _this_ century... ehm, what is _this_ century? - * - * TBD: - * ASAP: find piece of code in the kernel, e.g. star tracker driver, - * which we can trust to determine the century correctly. Atom - * watch driver would be nice, too... - * - * if that has not happened, change for first release in 2050: - * if (yr<50) - * yr += 2100; - * else - * yr += 2000; // current line of code - * - * if that has not happened either, please do on 2099/12/31:23:59:59 - * s/2000/2100 - * - */ + /* If we're not trusting the FADT, we should at least make it + * right for _this_ century... ehm, what is _this_ century? + * + * TBD: + * ASAP: find piece of code in the kernel, e.g. star tracker driver, + * which we can trust to determine the century correctly. Atom + * watch driver would be nice, too... + * + * if that has not happened, change for first release in 2050: + * if (yr<50) + * yr += 2100; + * else + * yr += 2000; // current line of code + * + * if that has not happened either, please do on 2099/12/31:23:59:59 + * s/2000/2100 + * + */ yr += 2000; - seq_printf(seq,"%4.4u-", yr); - (mo > 12) ? seq_puts(seq, "**-") : seq_printf(seq, "%2.2u-", mo); - (day > 31) ? seq_puts(seq, "** ") : seq_printf(seq, "%2.2u ", day); - (hr > 23) ? seq_puts(seq, "**:") : seq_printf(seq, "%2.2u:", hr); - (min > 59) ? seq_puts(seq, "**:") : seq_printf(seq, "%2.2u:", min); + seq_printf(seq, "%4.4u-", yr); + (mo > 12) ? seq_puts(seq, "**-") : seq_printf(seq, "%2.2u-", mo); + (day > 31) ? seq_puts(seq, "** ") : seq_printf(seq, "%2.2u ", day); + (hr > 23) ? seq_puts(seq, "**:") : seq_printf(seq, "%2.2u:", hr); + (min > 59) ? seq_puts(seq, "**:") : seq_printf(seq, "%2.2u:", min); (sec > 59) ? seq_puts(seq, "**\n") : seq_printf(seq, "%2.2u\n", sec); return 0; @@ -156,15 +152,11 @@ static int acpi_system_alarm_open_fs(struct inode *inode, struct file *file) return single_open(file, acpi_system_alarm_seq_show, PDE(inode)->data); } - -static int -get_date_field ( - char **p, - u32 *value) +static int get_date_field(char **p, u32 * value) { - char *next = NULL; - char *string_end = NULL; - int result = -EINVAL; + char *next = NULL; + char *string_end = NULL; + int result = -EINVAL; /* * Try to find delimeter, only to insert null. The end of the @@ -186,26 +178,22 @@ get_date_field ( return result; } - static ssize_t -acpi_system_write_alarm ( - struct file *file, - const char __user *buffer, - size_t count, - loff_t *ppos) +acpi_system_write_alarm(struct file *file, + const char __user * buffer, size_t count, loff_t * ppos) { - int result = 0; - char alarm_string[30] = {'\0'}; - char *p = alarm_string; - u32 sec, min, hr, day, mo, yr; - int adjust = 0; - unsigned char rtc_control = 0; + int result = 0; + char alarm_string[30] = { '\0' }; + char *p = alarm_string; + u32 sec, min, hr, day, mo, yr; + int adjust = 0; + unsigned char rtc_control = 0; ACPI_FUNCTION_TRACE("acpi_system_write_alarm"); if (count > sizeof(alarm_string) - 1) return_VALUE(-EINVAL); - + if (copy_from_user(alarm_string, buffer, count)) return_VALUE(-EFAULT); @@ -264,10 +252,10 @@ acpi_system_write_alarm ( } if (adjust) { - yr += CMOS_READ(RTC_YEAR); - mo += CMOS_READ(RTC_MONTH); + yr += CMOS_READ(RTC_YEAR); + mo += CMOS_READ(RTC_MONTH); day += CMOS_READ(RTC_DAY_OF_MONTH); - hr += CMOS_READ(RTC_HOURS); + hr += CMOS_READ(RTC_HOURS); min += CMOS_READ(RTC_MINUTES); sec += CMOS_READ(RTC_SECONDS); } @@ -336,7 +324,7 @@ acpi_system_write_alarm ( 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); + CMOS_WRITE(yr / 100, acpi_gbl_FADT->century); /* enable the rtc alarm interrupt */ rtc_control |= RTC_AIE; CMOS_WRITE(rtc_control, RTC_CONTROL); @@ -350,29 +338,31 @@ acpi_system_write_alarm ( *ppos += count; result = 0; -end: + end: return_VALUE(result ? result : count); } -extern struct list_head acpi_wakeup_device_list; +extern struct list_head acpi_wakeup_device_list; extern spinlock_t acpi_device_lock; static int acpi_system_wakeup_device_seq_show(struct seq_file *seq, void *offset) { - struct list_head * node, * next; + struct list_head *node, *next; seq_printf(seq, "Device Sleep state Status\n"); spin_lock(&acpi_device_lock); list_for_each_safe(node, next, &acpi_wakeup_device_list) { - struct acpi_device * dev = container_of(node, struct acpi_device, wakeup_list); + struct acpi_device *dev = + container_of(node, struct acpi_device, wakeup_list); if (!dev->wakeup.flags.valid) continue; spin_unlock(&acpi_device_lock); seq_printf(seq, "%4s %4d %s%8s\n", - dev->pnp.bus_id, (u32) dev->wakeup.sleep_state, + dev->pnp.bus_id, + (u32) dev->wakeup.sleep_state, dev->wakeup.flags.run_wake ? "*" : "", dev->wakeup.state.enabled ? "enabled" : "disabled"); spin_lock(&acpi_device_lock); @@ -382,19 +372,18 @@ acpi_system_wakeup_device_seq_show(struct seq_file *seq, void *offset) } static ssize_t -acpi_system_write_wakeup_device ( - struct file *file, - const char __user *buffer, - size_t count, - loff_t *ppos) +acpi_system_write_wakeup_device(struct file *file, + const char __user * buffer, + size_t count, loff_t * ppos) { - struct list_head * node, * next; - char strbuf[5]; - char str[5] = ""; - int len = count; + struct list_head *node, *next; + char strbuf[5]; + char str[5] = ""; + int len = count; struct acpi_device *found_dev = NULL; - if (len > 4) len = 4; + if (len > 4) + len = 4; if (copy_from_user(strbuf, buffer, len)) return -EFAULT; @@ -403,28 +392,36 @@ acpi_system_write_wakeup_device ( spin_lock(&acpi_device_lock); list_for_each_safe(node, next, &acpi_wakeup_device_list) { - struct acpi_device * dev = container_of(node, struct acpi_device, wakeup_list); + struct acpi_device *dev = + container_of(node, struct acpi_device, wakeup_list); if (!dev->wakeup.flags.valid) continue; if (!strncmp(dev->pnp.bus_id, str, 4)) { - dev->wakeup.state.enabled = dev->wakeup.state.enabled ? 0:1; + dev->wakeup.state.enabled = + dev->wakeup.state.enabled ? 0 : 1; found_dev = dev; break; } } if (found_dev) { list_for_each_safe(node, next, &acpi_wakeup_device_list) { - struct acpi_device * dev = container_of(node, - struct acpi_device, wakeup_list); + struct acpi_device *dev = container_of(node, + struct + acpi_device, + wakeup_list); if ((dev != found_dev) && - (dev->wakeup.gpe_number == found_dev->wakeup.gpe_number) && - (dev->wakeup.gpe_device == found_dev->wakeup.gpe_device)) { - printk(KERN_WARNING "ACPI: '%s' and '%s' have the same GPE, " - "can't disable/enable one seperately\n", - dev->pnp.bus_id, found_dev->pnp.bus_id); - dev->wakeup.state.enabled = found_dev->wakeup.state.enabled; + (dev->wakeup.gpe_number == + found_dev->wakeup.gpe_number) + && (dev->wakeup.gpe_device == + found_dev->wakeup.gpe_device)) { + printk(KERN_WARNING + "ACPI: '%s' and '%s' have the same GPE, " + "can't disable/enable one seperately\n", + dev->pnp.bus_id, found_dev->pnp.bus_id); + dev->wakeup.state.enabled = + found_dev->wakeup.state.enabled; } } } @@ -435,37 +432,37 @@ acpi_system_write_wakeup_device ( static int acpi_system_wakeup_device_open_fs(struct inode *inode, struct file *file) { - return single_open(file, acpi_system_wakeup_device_seq_show, PDE(inode)->data); + return single_open(file, acpi_system_wakeup_device_seq_show, + PDE(inode)->data); } static struct file_operations acpi_system_wakeup_device_fops = { - .open = acpi_system_wakeup_device_open_fs, - .read = seq_read, - .write = acpi_system_write_wakeup_device, - .llseek = seq_lseek, - .release = single_release, + .open = acpi_system_wakeup_device_open_fs, + .read = seq_read, + .write = acpi_system_write_wakeup_device, + .llseek = seq_lseek, + .release = single_release, }; #ifdef CONFIG_ACPI_SLEEP_PROC_SLEEP static struct file_operations acpi_system_sleep_fops = { - .open = acpi_system_sleep_open_fs, - .read = seq_read, - .write = acpi_system_write_sleep, - .llseek = seq_lseek, - .release = single_release, + .open = acpi_system_sleep_open_fs, + .read = seq_read, + .write = acpi_system_write_sleep, + .llseek = seq_lseek, + .release = single_release, }; -#endif /* CONFIG_ACPI_SLEEP_PROC_SLEEP */ +#endif /* CONFIG_ACPI_SLEEP_PROC_SLEEP */ static struct file_operations acpi_system_alarm_fops = { - .open = acpi_system_alarm_open_fs, - .read = seq_read, - .write = acpi_system_write_alarm, - .llseek = seq_lseek, - .release = single_release, + .open = acpi_system_alarm_open_fs, + .read = seq_read, + .write = acpi_system_write_alarm, + .llseek = seq_lseek, + .release = single_release, }; - -static u32 rtc_handler(void * context) +static u32 rtc_handler(void *context) { acpi_clear_event(ACPI_EVENT_RTC); acpi_disable_event(ACPI_EVENT_RTC, 0); @@ -479,21 +476,27 @@ static int acpi_sleep_proc_init(void) if (acpi_disabled) return 0; - + #ifdef CONFIG_ACPI_SLEEP_PROC_SLEEP /* 'sleep' [R/W] */ - entry = create_proc_entry("sleep", S_IFREG|S_IRUGO|S_IWUSR, acpi_root_dir); + entry = + create_proc_entry("sleep", S_IFREG | S_IRUGO | S_IWUSR, + acpi_root_dir); if (entry) entry->proc_fops = &acpi_system_sleep_fops; #endif /* 'alarm' [R/W] */ - entry = create_proc_entry("alarm", S_IFREG|S_IRUGO|S_IWUSR, acpi_root_dir); + entry = + create_proc_entry("alarm", S_IFREG | S_IRUGO | S_IWUSR, + acpi_root_dir); if (entry) entry->proc_fops = &acpi_system_alarm_fops; /* 'wakeup device' [R/W] */ - entry = create_proc_entry("wakeup", S_IFREG|S_IRUGO|S_IWUSR, acpi_root_dir); + entry = + create_proc_entry("wakeup", S_IFREG | S_IRUGO | S_IWUSR, + acpi_root_dir); if (entry) entry->proc_fops = &acpi_system_wakeup_device_fops; diff --git a/drivers/acpi/sleep/wakeup.c b/drivers/acpi/sleep/wakeup.c index d9b199969d5..4134ed43d02 100644 --- a/drivers/acpi/sleep/wakeup.c +++ b/drivers/acpi/sleep/wakeup.c @@ -12,9 +12,9 @@ #include "sleep.h" #define _COMPONENT ACPI_SYSTEM_COMPONENT -ACPI_MODULE_NAME ("wakeup_devices") +ACPI_MODULE_NAME("wakeup_devices") -extern struct list_head acpi_wakeup_device_list; +extern struct list_head acpi_wakeup_device_list; extern spinlock_t acpi_device_lock; #ifdef CONFIG_ACPI_SLEEP @@ -25,22 +25,21 @@ extern spinlock_t acpi_device_lock; * is higher than requested sleep level */ -void -acpi_enable_wakeup_device_prep( - u8 sleep_state) +void acpi_enable_wakeup_device_prep(u8 sleep_state) { - struct list_head * node, * next; + struct list_head *node, *next; ACPI_FUNCTION_TRACE("acpi_enable_wakeup_device_prep"); spin_lock(&acpi_device_lock); list_for_each_safe(node, next, &acpi_wakeup_device_list) { - struct acpi_device * dev = container_of(node, - struct acpi_device, wakeup_list); - - if (!dev->wakeup.flags.valid || - !dev->wakeup.state.enabled || - (sleep_state > (u32) dev->wakeup.sleep_state)) + struct acpi_device *dev = container_of(node, + struct acpi_device, + wakeup_list); + + if (!dev->wakeup.flags.valid || + !dev->wakeup.state.enabled || + (sleep_state > (u32) dev->wakeup.sleep_state)) continue; spin_unlock(&acpi_device_lock); @@ -55,11 +54,9 @@ acpi_enable_wakeup_device_prep( * @sleep_state: ACPI state * Enable all wakup devices's GPE */ -void -acpi_enable_wakeup_device( - u8 sleep_state) +void acpi_enable_wakeup_device(u8 sleep_state) { - struct list_head * node, * next; + struct list_head *node, *next; /* * Caution: this routine must be invoked when interrupt is disabled @@ -68,33 +65,35 @@ acpi_enable_wakeup_device( ACPI_FUNCTION_TRACE("acpi_enable_wakeup_device"); spin_lock(&acpi_device_lock); list_for_each_safe(node, next, &acpi_wakeup_device_list) { - struct acpi_device * dev = container_of(node, - struct acpi_device, wakeup_list); + struct acpi_device *dev = container_of(node, + struct acpi_device, + wakeup_list); /* If users want to disable run-wake GPE, * we only disable it for wake and leave it for runtime */ if (dev->wakeup.flags.run_wake && !dev->wakeup.state.enabled) { spin_unlock(&acpi_device_lock); - acpi_set_gpe_type(dev->wakeup.gpe_device, - dev->wakeup.gpe_number, ACPI_GPE_TYPE_RUNTIME); + acpi_set_gpe_type(dev->wakeup.gpe_device, + dev->wakeup.gpe_number, + ACPI_GPE_TYPE_RUNTIME); /* Re-enable it, since set_gpe_type will disable it */ - acpi_enable_gpe(dev->wakeup.gpe_device, - dev->wakeup.gpe_number, ACPI_ISR); + acpi_enable_gpe(dev->wakeup.gpe_device, + dev->wakeup.gpe_number, ACPI_ISR); spin_lock(&acpi_device_lock); continue; } if (!dev->wakeup.flags.valid || - !dev->wakeup.state.enabled || - (sleep_state > (u32) dev->wakeup.sleep_state)) + !dev->wakeup.state.enabled || + (sleep_state > (u32) dev->wakeup.sleep_state)) continue; spin_unlock(&acpi_device_lock); /* run-wake GPE has been enabled */ if (!dev->wakeup.flags.run_wake) - acpi_enable_gpe(dev->wakeup.gpe_device, - dev->wakeup.gpe_number, ACPI_ISR); + acpi_enable_gpe(dev->wakeup.gpe_device, + dev->wakeup.gpe_number, ACPI_ISR); dev->wakeup.state.active = 1; spin_lock(&acpi_device_lock); } @@ -106,43 +105,43 @@ acpi_enable_wakeup_device( * @sleep_state: ACPI state * Disable all wakup devices's GPE and wakeup capability */ -void -acpi_disable_wakeup_device ( - u8 sleep_state) +void acpi_disable_wakeup_device(u8 sleep_state) { - struct list_head * node, * next; + struct list_head *node, *next; ACPI_FUNCTION_TRACE("acpi_disable_wakeup_device"); spin_lock(&acpi_device_lock); list_for_each_safe(node, next, &acpi_wakeup_device_list) { - struct acpi_device * dev = container_of(node, - struct acpi_device, wakeup_list); + struct acpi_device *dev = container_of(node, + struct acpi_device, + wakeup_list); if (dev->wakeup.flags.run_wake && !dev->wakeup.state.enabled) { spin_unlock(&acpi_device_lock); - acpi_set_gpe_type(dev->wakeup.gpe_device, - dev->wakeup.gpe_number, ACPI_GPE_TYPE_WAKE_RUN); + acpi_set_gpe_type(dev->wakeup.gpe_device, + dev->wakeup.gpe_number, + ACPI_GPE_TYPE_WAKE_RUN); /* Re-enable it, since set_gpe_type will disable it */ - acpi_enable_gpe(dev->wakeup.gpe_device, - dev->wakeup.gpe_number, ACPI_NOT_ISR); + acpi_enable_gpe(dev->wakeup.gpe_device, + dev->wakeup.gpe_number, ACPI_NOT_ISR); spin_lock(&acpi_device_lock); continue; } - if (!dev->wakeup.flags.valid || - !dev->wakeup.state.active || - (sleep_state > (u32) dev->wakeup.sleep_state)) + if (!dev->wakeup.flags.valid || + !dev->wakeup.state.active || + (sleep_state > (u32) dev->wakeup.sleep_state)) continue; spin_unlock(&acpi_device_lock); acpi_disable_wakeup_device_power(dev); /* Never disable run-wake GPE */ if (!dev->wakeup.flags.run_wake) { - acpi_disable_gpe(dev->wakeup.gpe_device, - dev->wakeup.gpe_number, ACPI_NOT_ISR); - acpi_clear_gpe(dev->wakeup.gpe_device, - dev->wakeup.gpe_number, ACPI_NOT_ISR); + acpi_disable_gpe(dev->wakeup.gpe_device, + dev->wakeup.gpe_number, ACPI_NOT_ISR); + acpi_clear_gpe(dev->wakeup.gpe_device, + dev->wakeup.gpe_number, ACPI_NOT_ISR); } dev->wakeup.state.active = 0; spin_lock(&acpi_device_lock); @@ -152,7 +151,7 @@ acpi_disable_wakeup_device ( static int __init acpi_wakeup_device_init(void) { - struct list_head * node, * next; + struct list_head *node, *next; if (acpi_disabled) return 0; @@ -160,16 +159,18 @@ static int __init acpi_wakeup_device_init(void) spin_lock(&acpi_device_lock); list_for_each_safe(node, next, &acpi_wakeup_device_list) { - struct acpi_device * dev = container_of(node, - struct acpi_device, wakeup_list); - + struct acpi_device *dev = container_of(node, + struct acpi_device, + wakeup_list); + /* In case user doesn't load button driver */ if (dev->wakeup.flags.run_wake && !dev->wakeup.state.enabled) { spin_unlock(&acpi_device_lock); - acpi_set_gpe_type(dev->wakeup.gpe_device, - dev->wakeup.gpe_number, ACPI_GPE_TYPE_WAKE_RUN); - acpi_enable_gpe(dev->wakeup.gpe_device, - dev->wakeup.gpe_number, ACPI_NOT_ISR); + acpi_set_gpe_type(dev->wakeup.gpe_device, + dev->wakeup.gpe_number, + ACPI_GPE_TYPE_WAKE_RUN); + acpi_enable_gpe(dev->wakeup.gpe_device, + dev->wakeup.gpe_number, ACPI_NOT_ISR); dev->wakeup.state.enabled = 1; spin_lock(&acpi_device_lock); } @@ -193,17 +194,19 @@ late_initcall(acpi_wakeup_device_init); */ void acpi_wakeup_gpe_poweroff_prepare(void) { - struct list_head * node, * next; + struct list_head *node, *next; list_for_each_safe(node, next, &acpi_wakeup_device_list) { - struct acpi_device * dev = container_of(node, - struct acpi_device, wakeup_list); + struct acpi_device *dev = container_of(node, + struct acpi_device, + wakeup_list); /* The GPE can wakeup system from S5, don't touch it */ - if ((u32)dev->wakeup.sleep_state == ACPI_STATE_S5) + if ((u32) dev->wakeup.sleep_state == ACPI_STATE_S5) continue; /* acpi_set_gpe_type will automatically disable GPE */ acpi_set_gpe_type(dev->wakeup.gpe_device, - dev->wakeup.gpe_number, ACPI_GPE_TYPE_RUNTIME); + dev->wakeup.gpe_number, + ACPI_GPE_TYPE_RUNTIME); } } diff --git a/drivers/acpi/system.c b/drivers/acpi/system.c index 8925a6ca5f8..e4308c7a674 100644 --- a/drivers/acpi/system.c +++ b/drivers/acpi/system.c @@ -30,10 +30,8 @@ #include - #define _COMPONENT ACPI_SYSTEM_COMPONENT -ACPI_MODULE_NAME ("acpi_system") - +ACPI_MODULE_NAME("acpi_system") #define ACPI_SYSTEM_CLASS "system" #define ACPI_SYSTEM_DRIVER_NAME "ACPI System Driver" #define ACPI_SYSTEM_DEVICE_NAME "System" @@ -41,15 +39,13 @@ ACPI_MODULE_NAME ("acpi_system") #define ACPI_SYSTEM_FILE_EVENT "event" #define ACPI_SYSTEM_FILE_DSDT "dsdt" #define ACPI_SYSTEM_FILE_FADT "fadt" - -extern FADT_DESCRIPTOR acpi_fadt; +extern FADT_DESCRIPTOR acpi_fadt; /* -------------------------------------------------------------------------- FS Interface (/proc) -------------------------------------------------------------------------- */ -static int -acpi_system_read_info (struct seq_file *seq, void *offset) +static int acpi_system_read_info(struct seq_file *seq, void *offset) { ACPI_FUNCTION_TRACE("acpi_system_read_info"); @@ -63,28 +59,26 @@ static int acpi_system_info_open_fs(struct inode *inode, struct file *file) } static struct file_operations acpi_system_info_ops = { - .open = acpi_system_info_open_fs, - .read = seq_read, - .llseek = seq_lseek, - .release = single_release, + .open = acpi_system_info_open_fs, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, }; -static ssize_t acpi_system_read_dsdt (struct file*, char __user *, size_t, loff_t*); +static ssize_t acpi_system_read_dsdt(struct file *, char __user *, size_t, + loff_t *); static struct file_operations acpi_system_dsdt_ops = { - .read = acpi_system_read_dsdt, + .read = acpi_system_read_dsdt, }; static ssize_t -acpi_system_read_dsdt ( - struct file *file, - char __user *buffer, - size_t count, - loff_t *ppos) +acpi_system_read_dsdt(struct file *file, + char __user * buffer, size_t count, loff_t * ppos) { - acpi_status status = AE_OK; - struct acpi_buffer dsdt = {ACPI_ALLOCATE_BUFFER, NULL}; - ssize_t res; + acpi_status status = AE_OK; + struct acpi_buffer dsdt = { ACPI_ALLOCATE_BUFFER, NULL }; + ssize_t res; ACPI_FUNCTION_TRACE("acpi_system_read_dsdt"); @@ -99,23 +93,20 @@ acpi_system_read_dsdt ( return_VALUE(res); } - -static ssize_t acpi_system_read_fadt (struct file*, char __user *, size_t, loff_t*); +static ssize_t acpi_system_read_fadt(struct file *, char __user *, size_t, + loff_t *); static struct file_operations acpi_system_fadt_ops = { - .read = acpi_system_read_fadt, + .read = acpi_system_read_fadt, }; static ssize_t -acpi_system_read_fadt ( - struct file *file, - char __user *buffer, - size_t count, - loff_t *ppos) +acpi_system_read_fadt(struct file *file, + char __user * buffer, size_t count, loff_t * ppos) { - acpi_status status = AE_OK; - struct acpi_buffer fadt = {ACPI_ALLOCATE_BUFFER, NULL}; - ssize_t res; + acpi_status status = AE_OK; + struct acpi_buffer fadt = { ACPI_ALLOCATE_BUFFER, NULL }; + ssize_t res; ACPI_FUNCTION_TRACE("acpi_system_read_fadt"); @@ -130,12 +121,11 @@ acpi_system_read_fadt ( return_VALUE(res); } - -static int __init acpi_system_init (void) +static int __init acpi_system_init(void) { - struct proc_dir_entry *entry; + struct proc_dir_entry *entry; int error = 0; - char * name; + char *name; ACPI_FUNCTION_TRACE("acpi_system_init"); @@ -144,8 +134,7 @@ static int __init acpi_system_init (void) /* 'info' [R] */ name = ACPI_SYSTEM_FILE_INFO; - entry = create_proc_entry(name, - S_IRUGO, acpi_root_dir); + entry = create_proc_entry(name, S_IRUGO, acpi_root_dir); if (!entry) goto Error; else { @@ -157,7 +146,7 @@ static int __init acpi_system_init (void) entry = create_proc_entry(name, S_IRUSR, acpi_root_dir); if (entry) entry->proc_fops = &acpi_system_dsdt_ops; - else + else goto Error; /* 'fadt' [R] */ @@ -168,12 +157,12 @@ static int __init acpi_system_init (void) else goto Error; - Done: + Done: return_VALUE(error); - Error: - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create '%s' proc fs entry\n", name)); + Error: + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Unable to create '%s' proc fs entry\n", name)); remove_proc_entry(ACPI_SYSTEM_FILE_FADT, acpi_root_dir); remove_proc_entry(ACPI_SYSTEM_FILE_DSDT, acpi_root_dir); @@ -183,5 +172,4 @@ static int __init acpi_system_init (void) goto Done; } - subsys_initcall(acpi_system_init); diff --git a/drivers/acpi/tables.c b/drivers/acpi/tables.c index fb64bd5d2e1..a2bf25b05e1 100644 --- a/drivers/acpi/tables.c +++ b/drivers/acpi/tables.c @@ -40,25 +40,25 @@ #define ACPI_MAX_TABLES 256 static char *acpi_table_signatures[ACPI_TABLE_COUNT] = { - [ACPI_TABLE_UNKNOWN] = "????", - [ACPI_APIC] = "APIC", - [ACPI_BOOT] = "BOOT", - [ACPI_DBGP] = "DBGP", - [ACPI_DSDT] = "DSDT", - [ACPI_ECDT] = "ECDT", - [ACPI_ETDT] = "ETDT", - [ACPI_FADT] = "FACP", - [ACPI_FACS] = "FACS", - [ACPI_OEMX] = "OEM", - [ACPI_PSDT] = "PSDT", - [ACPI_SBST] = "SBST", - [ACPI_SLIT] = "SLIT", - [ACPI_SPCR] = "SPCR", - [ACPI_SRAT] = "SRAT", - [ACPI_SSDT] = "SSDT", - [ACPI_SPMI] = "SPMI", - [ACPI_HPET] = "HPET", - [ACPI_MCFG] = "MCFG", + [ACPI_TABLE_UNKNOWN] = "????", + [ACPI_APIC] = "APIC", + [ACPI_BOOT] = "BOOT", + [ACPI_DBGP] = "DBGP", + [ACPI_DSDT] = "DSDT", + [ACPI_ECDT] = "ECDT", + [ACPI_ETDT] = "ETDT", + [ACPI_FADT] = "FACP", + [ACPI_FACS] = "FACS", + [ACPI_OEMX] = "OEM", + [ACPI_PSDT] = "PSDT", + [ACPI_SBST] = "SBST", + [ACPI_SLIT] = "SLIT", + [ACPI_SPCR] = "SPCR", + [ACPI_SRAT] = "SRAT", + [ACPI_SSDT] = "SSDT", + [ACPI_SPMI] = "SPMI", + [ACPI_HPET] = "HPET", + [ACPI_MCFG] = "MCFG", }; static char *mps_inti_flags_polarity[] = { "dfl", "high", "res", "low" }; @@ -66,52 +66,44 @@ static char *mps_inti_flags_trigger[] = { "dfl", "edge", "res", "level" }; /* System Description Table (RSDT/XSDT) */ struct acpi_table_sdt { - unsigned long pa; - enum acpi_table_id id; - unsigned long size; + unsigned long pa; + enum acpi_table_id id; + unsigned long size; } __attribute__ ((packed)); -static unsigned long sdt_pa; /* Physical Address */ -static unsigned long sdt_count; /* Table count */ +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]; -void -acpi_table_print ( - struct acpi_table_header *header, - unsigned long phys_addr) +void acpi_table_print(struct acpi_table_header *header, unsigned long phys_addr) { - char *name = NULL; + char *name = NULL; if (!header) return; /* Some table signatures aren't good table names */ - if (!strncmp((char *) &header->signature, - acpi_table_signatures[ACPI_APIC], - sizeof(header->signature))) { + if (!strncmp((char *)&header->signature, + acpi_table_signatures[ACPI_APIC], + sizeof(header->signature))) { name = "MADT"; - } - else if (!strncmp((char *) &header->signature, - acpi_table_signatures[ACPI_FADT], - sizeof(header->signature))) { + } else if (!strncmp((char *)&header->signature, + acpi_table_signatures[ACPI_FADT], + sizeof(header->signature))) { name = "FADT"; - } - else + } else name = header->signature; - printk(KERN_DEBUG PREFIX "%.4s (v%3.3d %6.6s %8.8s 0x%08x %.4s 0x%08x) @ 0x%p\n", - name, header->revision, header->oem_id, - header->oem_table_id, header->oem_revision, - header->asl_compiler_id, header->asl_compiler_revision, - (void *) phys_addr); + printk(KERN_DEBUG PREFIX + "%.4s (v%3.3d %6.6s %8.8s 0x%08x %.4s 0x%08x) @ 0x%p\n", name, + header->revision, header->oem_id, header->oem_table_id, + header->oem_revision, header->asl_compiler_id, + header->asl_compiler_revision, (void *)phys_addr); } - -void -acpi_table_print_madt_entry ( - acpi_table_entry_header *header) +void acpi_table_print_madt_entry(acpi_table_entry_header * header) { if (!header) return; @@ -119,113 +111,127 @@ acpi_table_print_madt_entry ( switch (header->type) { case ACPI_MADT_LAPIC: - { - struct acpi_table_lapic *p = - (struct acpi_table_lapic*) header; - printk(KERN_INFO PREFIX "LAPIC (acpi_id[0x%02x] lapic_id[0x%02x] %s)\n", - p->acpi_id, p->id, p->flags.enabled?"enabled":"disabled"); - } + { + struct acpi_table_lapic *p = + (struct acpi_table_lapic *)header; + printk(KERN_INFO PREFIX + "LAPIC (acpi_id[0x%02x] lapic_id[0x%02x] %s)\n", + p->acpi_id, p->id, + p->flags.enabled ? "enabled" : "disabled"); + } break; case ACPI_MADT_IOAPIC: - { - struct acpi_table_ioapic *p = - (struct acpi_table_ioapic*) header; - printk(KERN_INFO PREFIX "IOAPIC (id[0x%02x] address[0x%08x] gsi_base[%d])\n", - p->id, p->address, p->global_irq_base); - } + { + struct acpi_table_ioapic *p = + (struct acpi_table_ioapic *)header; + printk(KERN_INFO PREFIX + "IOAPIC (id[0x%02x] address[0x%08x] gsi_base[%d])\n", + p->id, p->address, p->global_irq_base); + } break; case ACPI_MADT_INT_SRC_OVR: - { - struct acpi_table_int_src_ovr *p = - (struct acpi_table_int_src_ovr*) header; - printk(KERN_INFO PREFIX "INT_SRC_OVR (bus %d bus_irq %d global_irq %d %s %s)\n", - p->bus, p->bus_irq, p->global_irq, - mps_inti_flags_polarity[p->flags.polarity], - mps_inti_flags_trigger[p->flags.trigger]); - if(p->flags.reserved) - printk(KERN_INFO PREFIX "INT_SRC_OVR unexpected reserved flags: 0x%x\n", - p->flags.reserved); + { + struct acpi_table_int_src_ovr *p = + (struct acpi_table_int_src_ovr *)header; + printk(KERN_INFO PREFIX + "INT_SRC_OVR (bus %d bus_irq %d global_irq %d %s %s)\n", + p->bus, p->bus_irq, p->global_irq, + mps_inti_flags_polarity[p->flags.polarity], + mps_inti_flags_trigger[p->flags.trigger]); + if (p->flags.reserved) + printk(KERN_INFO PREFIX + "INT_SRC_OVR unexpected reserved flags: 0x%x\n", + p->flags.reserved); - } + } break; case ACPI_MADT_NMI_SRC: - { - struct acpi_table_nmi_src *p = - (struct acpi_table_nmi_src*) header; - printk(KERN_INFO PREFIX "NMI_SRC (%s %s global_irq %d)\n", - mps_inti_flags_polarity[p->flags.polarity], - mps_inti_flags_trigger[p->flags.trigger], p->global_irq); - } + { + struct acpi_table_nmi_src *p = + (struct acpi_table_nmi_src *)header; + printk(KERN_INFO PREFIX + "NMI_SRC (%s %s global_irq %d)\n", + mps_inti_flags_polarity[p->flags.polarity], + mps_inti_flags_trigger[p->flags.trigger], + p->global_irq); + } break; case ACPI_MADT_LAPIC_NMI: - { - struct acpi_table_lapic_nmi *p = - (struct acpi_table_lapic_nmi*) header; - printk(KERN_INFO PREFIX "LAPIC_NMI (acpi_id[0x%02x] %s %s lint[0x%x])\n", - p->acpi_id, - mps_inti_flags_polarity[p->flags.polarity], - mps_inti_flags_trigger[p->flags.trigger], p->lint); - } + { + struct acpi_table_lapic_nmi *p = + (struct acpi_table_lapic_nmi *)header; + printk(KERN_INFO PREFIX + "LAPIC_NMI (acpi_id[0x%02x] %s %s lint[0x%x])\n", + p->acpi_id, + mps_inti_flags_polarity[p->flags.polarity], + mps_inti_flags_trigger[p->flags.trigger], + p->lint); + } break; case ACPI_MADT_LAPIC_ADDR_OVR: - { - struct acpi_table_lapic_addr_ovr *p = - (struct acpi_table_lapic_addr_ovr*) header; - printk(KERN_INFO PREFIX "LAPIC_ADDR_OVR (address[%p])\n", - (void *) (unsigned long) p->address); - } + { + struct acpi_table_lapic_addr_ovr *p = + (struct acpi_table_lapic_addr_ovr *)header; + printk(KERN_INFO PREFIX + "LAPIC_ADDR_OVR (address[%p])\n", + (void *)(unsigned long)p->address); + } break; case ACPI_MADT_IOSAPIC: - { - struct acpi_table_iosapic *p = - (struct acpi_table_iosapic*) header; - printk(KERN_INFO PREFIX "IOSAPIC (id[0x%x] address[%p] gsi_base[%d])\n", - p->id, (void *) (unsigned long) p->address, p->global_irq_base); - } + { + struct acpi_table_iosapic *p = + (struct acpi_table_iosapic *)header; + printk(KERN_INFO PREFIX + "IOSAPIC (id[0x%x] address[%p] gsi_base[%d])\n", + p->id, (void *)(unsigned long)p->address, + p->global_irq_base); + } break; case ACPI_MADT_LSAPIC: - { - struct acpi_table_lsapic *p = - (struct acpi_table_lsapic*) header; - printk(KERN_INFO PREFIX "LSAPIC (acpi_id[0x%02x] lsapic_id[0x%02x] lsapic_eid[0x%02x] %s)\n", - p->acpi_id, p->id, p->eid, p->flags.enabled?"enabled":"disabled"); - } + { + struct acpi_table_lsapic *p = + (struct acpi_table_lsapic *)header; + printk(KERN_INFO PREFIX + "LSAPIC (acpi_id[0x%02x] lsapic_id[0x%02x] lsapic_eid[0x%02x] %s)\n", + p->acpi_id, p->id, p->eid, + p->flags.enabled ? "enabled" : "disabled"); + } break; case ACPI_MADT_PLAT_INT_SRC: - { - struct acpi_table_plat_int_src *p = - (struct acpi_table_plat_int_src*) header; - printk(KERN_INFO PREFIX "PLAT_INT_SRC (%s %s type[0x%x] id[0x%04x] eid[0x%x] iosapic_vector[0x%x] global_irq[0x%x]\n", - mps_inti_flags_polarity[p->flags.polarity], - mps_inti_flags_trigger[p->flags.trigger], - p->type, p->id, p->eid, p->iosapic_vector, p->global_irq); - } + { + struct acpi_table_plat_int_src *p = + (struct acpi_table_plat_int_src *)header; + printk(KERN_INFO PREFIX + "PLAT_INT_SRC (%s %s type[0x%x] id[0x%04x] eid[0x%x] iosapic_vector[0x%x] global_irq[0x%x]\n", + mps_inti_flags_polarity[p->flags.polarity], + mps_inti_flags_trigger[p->flags.trigger], + p->type, p->id, p->eid, p->iosapic_vector, + p->global_irq); + } break; default: - printk(KERN_WARNING PREFIX "Found unsupported MADT entry (type = 0x%x)\n", - header->type); + printk(KERN_WARNING PREFIX + "Found unsupported MADT entry (type = 0x%x)\n", + header->type); break; } } - static int -acpi_table_compute_checksum ( - void *table_pointer, - unsigned long length) +acpi_table_compute_checksum(void *table_pointer, unsigned long length) { - u8 *p = (u8 *) table_pointer; - unsigned long remains = length; - unsigned long sum = 0; + u8 *p = (u8 *) table_pointer; + unsigned long remains = length; + unsigned long sum = 0; if (!p || !length) return -EINVAL; @@ -241,9 +247,8 @@ acpi_table_compute_checksum ( * for acpi_blacklisted(), acpi_table_get_sdt() */ int __init -acpi_get_table_header_early ( - enum acpi_table_id id, - struct acpi_table_header **header) +acpi_get_table_header_early(enum acpi_table_id id, + struct acpi_table_header **header) { unsigned int i; enum acpi_table_id temp_id; @@ -260,7 +265,7 @@ acpi_get_table_header_early ( if (sdt_entry[i].id != temp_id) continue; *header = (void *) - __acpi_map_table(sdt_entry[i].pa, sdt_entry[i].size); + __acpi_map_table(sdt_entry[i].pa, sdt_entry[i].size); if (!*header) { printk(KERN_WARNING PREFIX "Unable to map %s\n", acpi_table_signatures[temp_id]); @@ -277,14 +282,17 @@ acpi_get_table_header_early ( /* Map the DSDT header via the pointer in the FADT */ if (id == ACPI_DSDT) { - struct fadt_descriptor_rev2 *fadt = (struct fadt_descriptor_rev2 *) *header; + struct fadt_descriptor_rev2 *fadt = + (struct fadt_descriptor_rev2 *)*header; if (fadt->revision == 3 && fadt->Xdsdt) { - *header = (void *) __acpi_map_table(fadt->Xdsdt, - sizeof(struct acpi_table_header)); + *header = (void *)__acpi_map_table(fadt->Xdsdt, + sizeof(struct + acpi_table_header)); } else if (fadt->V1_dsdt) { - *header = (void *) __acpi_map_table(fadt->V1_dsdt, - sizeof(struct acpi_table_header)); + *header = (void *)__acpi_map_table(fadt->V1_dsdt, + sizeof(struct + acpi_table_header)); } else *header = NULL; @@ -296,21 +304,19 @@ acpi_get_table_header_early ( return 0; } - int __init -acpi_table_parse_madt_family ( - enum acpi_table_id id, - unsigned long madt_size, - int entry_id, - acpi_madt_entry_handler handler, - unsigned int max_entries) +acpi_table_parse_madt_family(enum acpi_table_id id, + unsigned long madt_size, + int entry_id, + acpi_madt_entry_handler handler, + unsigned int max_entries) { - void *madt = NULL; - acpi_table_entry_header *entry; - unsigned int count = 0; - unsigned long madt_end; - unsigned int i; + void *madt = NULL; + acpi_table_entry_header *entry; + unsigned int count = 0; + unsigned long madt_end; + unsigned int i; if (!handler) return -EINVAL; @@ -321,7 +327,7 @@ acpi_table_parse_madt_family ( if (sdt_entry[i].id != id) continue; madt = (void *) - __acpi_map_table(sdt_entry[i].pa, sdt_entry[i].size); + __acpi_map_table(sdt_entry[i].pa, sdt_entry[i].size); if (!madt) { printk(KERN_WARNING PREFIX "Unable to map %s\n", acpi_table_signatures[id]); @@ -336,21 +342,22 @@ acpi_table_parse_madt_family ( return -ENODEV; } - madt_end = (unsigned long) madt + sdt_entry[i].size; + madt_end = (unsigned long)madt + sdt_entry[i].size; /* Parse all entries looking for a match. */ entry = (acpi_table_entry_header *) - ((unsigned long) madt + madt_size); + ((unsigned long)madt + madt_size); - while (((unsigned long) entry) + sizeof(acpi_table_entry_header) < madt_end) { - if (entry->type == entry_id && - (!max_entries || count++ < max_entries)) + while (((unsigned long)entry) + sizeof(acpi_table_entry_header) < + madt_end) { + if (entry->type == entry_id + && (!max_entries || count++ < max_entries)) if (handler(entry, madt_end)) return -EINVAL; entry = (acpi_table_entry_header *) - ((unsigned long) entry + entry->length); + ((unsigned long)entry + entry->length); } if (max_entries && count > max_entries) { printk(KERN_WARNING PREFIX "[%s:0x%02x] ignored %i entries of " @@ -361,25 +368,19 @@ acpi_table_parse_madt_family ( return count; } - int __init -acpi_table_parse_madt ( - enum acpi_madt_entry_id id, - acpi_madt_entry_handler handler, - unsigned int max_entries) +acpi_table_parse_madt(enum acpi_madt_entry_id id, + acpi_madt_entry_handler handler, unsigned int max_entries) { - return acpi_table_parse_madt_family(ACPI_APIC, sizeof(struct acpi_table_madt), - id, handler, max_entries); + return acpi_table_parse_madt_family(ACPI_APIC, + sizeof(struct acpi_table_madt), id, + handler, max_entries); } - -int __init -acpi_table_parse ( - enum acpi_table_id id, - acpi_table_handler handler) +int __init acpi_table_parse(enum acpi_table_id id, acpi_table_handler handler) { - int count = 0; - unsigned int i = 0; + int count = 0; + unsigned int i = 0; if (!handler) return -EINVAL; @@ -392,20 +393,18 @@ acpi_table_parse ( handler(sdt_entry[i].pa, sdt_entry[i].size); else - printk(KERN_WARNING PREFIX "%d duplicate %s table ignored.\n", - count, acpi_table_signatures[id]); + printk(KERN_WARNING PREFIX + "%d duplicate %s table ignored.\n", count, + acpi_table_signatures[id]); } return count; } - -static int __init -acpi_table_get_sdt ( - struct acpi_table_rsdp *rsdp) +static int __init acpi_table_get_sdt(struct acpi_table_rsdp *rsdp) { struct acpi_table_header *header = NULL; - unsigned int i, id = 0; + unsigned int i, id = 0; if (!rsdp) return -EINVAL; @@ -413,24 +412,25 @@ acpi_table_get_sdt ( /* First check XSDT (but only on ACPI 2.0-compatible systems) */ if ((rsdp->revision >= 2) && - (((struct acpi20_table_rsdp*)rsdp)->xsdt_address)) { - - struct acpi_table_xsdt *mapped_xsdt = NULL; + (((struct acpi20_table_rsdp *)rsdp)->xsdt_address)) { + + struct acpi_table_xsdt *mapped_xsdt = NULL; - sdt_pa = ((struct acpi20_table_rsdp*)rsdp)->xsdt_address; + sdt_pa = ((struct acpi20_table_rsdp *)rsdp)->xsdt_address; /* map in just the header */ header = (struct acpi_table_header *) - __acpi_map_table(sdt_pa, sizeof(struct acpi_table_header)); + __acpi_map_table(sdt_pa, sizeof(struct acpi_table_header)); if (!header) { - printk(KERN_WARNING PREFIX "Unable to map XSDT header\n"); + printk(KERN_WARNING PREFIX + "Unable to map XSDT header\n"); return -ENODEV; } /* remap in the entire table before processing */ mapped_xsdt = (struct acpi_table_xsdt *) - __acpi_map_table(sdt_pa, header->length); + __acpi_map_table(sdt_pa, header->length); if (!mapped_xsdt) { printk(KERN_WARNING PREFIX "Unable to map XSDT\n"); return -ENODEV; @@ -438,7 +438,8 @@ acpi_table_get_sdt ( header = &mapped_xsdt->header; if (strncmp(header->signature, "XSDT", 4)) { - printk(KERN_WARNING PREFIX "XSDT signature incorrect\n"); + printk(KERN_WARNING PREFIX + "XSDT signature incorrect\n"); return -ENODEV; } @@ -447,36 +448,39 @@ acpi_table_get_sdt ( return -ENODEV; } - sdt_count = (header->length - sizeof(struct acpi_table_header)) >> 3; + sdt_count = + (header->length - sizeof(struct acpi_table_header)) >> 3; if (sdt_count > ACPI_MAX_TABLES) { - printk(KERN_WARNING PREFIX "Truncated %lu XSDT entries\n", - (sdt_count - ACPI_MAX_TABLES)); + printk(KERN_WARNING PREFIX + "Truncated %lu XSDT entries\n", + (sdt_count - ACPI_MAX_TABLES)); sdt_count = ACPI_MAX_TABLES; } for (i = 0; i < sdt_count; i++) - sdt_entry[i].pa = (unsigned long) mapped_xsdt->entry[i]; + sdt_entry[i].pa = (unsigned long)mapped_xsdt->entry[i]; } /* Then check RSDT */ else if (rsdp->rsdt_address) { - struct acpi_table_rsdt *mapped_rsdt = NULL; + struct acpi_table_rsdt *mapped_rsdt = NULL; sdt_pa = rsdp->rsdt_address; /* map in just the header */ header = (struct acpi_table_header *) - __acpi_map_table(sdt_pa, sizeof(struct acpi_table_header)); + __acpi_map_table(sdt_pa, sizeof(struct acpi_table_header)); if (!header) { - printk(KERN_WARNING PREFIX "Unable to map RSDT header\n"); + printk(KERN_WARNING PREFIX + "Unable to map RSDT header\n"); return -ENODEV; } /* remap in the entire table before processing */ mapped_rsdt = (struct acpi_table_rsdt *) - __acpi_map_table(sdt_pa, header->length); + __acpi_map_table(sdt_pa, header->length); if (!mapped_rsdt) { printk(KERN_WARNING PREFIX "Unable to map RSDT\n"); return -ENODEV; @@ -484,7 +488,8 @@ acpi_table_get_sdt ( header = &mapped_rsdt->header; if (strncmp(header->signature, "RSDT", 4)) { - printk(KERN_WARNING PREFIX "RSDT signature incorrect\n"); + printk(KERN_WARNING PREFIX + "RSDT signature incorrect\n"); return -ENODEV; } @@ -493,19 +498,22 @@ acpi_table_get_sdt ( return -ENODEV; } - sdt_count = (header->length - sizeof(struct acpi_table_header)) >> 2; + sdt_count = + (header->length - sizeof(struct acpi_table_header)) >> 2; if (sdt_count > ACPI_MAX_TABLES) { - printk(KERN_WARNING PREFIX "Truncated %lu RSDT entries\n", - (sdt_count - ACPI_MAX_TABLES)); + printk(KERN_WARNING PREFIX + "Truncated %lu RSDT entries\n", + (sdt_count - ACPI_MAX_TABLES)); sdt_count = ACPI_MAX_TABLES; } for (i = 0; i < sdt_count; i++) - sdt_entry[i].pa = (unsigned long) mapped_rsdt->entry[i]; + sdt_entry[i].pa = (unsigned long)mapped_rsdt->entry[i]; } else { - printk(KERN_WARNING PREFIX "No System Description Table (RSDT/XSDT) specified in RSDP\n"); + printk(KERN_WARNING PREFIX + "No System Description Table (RSDT/XSDT) specified in RSDP\n"); return -ENODEV; } @@ -515,18 +523,17 @@ acpi_table_get_sdt ( /* map in just the header */ header = (struct acpi_table_header *) - __acpi_map_table(sdt_entry[i].pa, - sizeof(struct acpi_table_header)); + __acpi_map_table(sdt_entry[i].pa, + sizeof(struct acpi_table_header)); if (!header) continue; /* remap in the entire table before processing */ header = (struct acpi_table_header *) - __acpi_map_table(sdt_entry[i].pa, - header->length); + __acpi_map_table(sdt_entry[i].pa, header->length); if (!header) continue; - + acpi_table_print(header, sdt_entry[i].pa); if (acpi_table_compute_checksum(header, header->length)) { @@ -537,9 +544,9 @@ acpi_table_get_sdt ( sdt_entry[i].size = header->length; for (id = 0; id < ACPI_TABLE_COUNT; id++) { - if (!strncmp((char *) &header->signature, - acpi_table_signatures[id], - sizeof(header->signature))) { + if (!strncmp((char *)&header->signature, + acpi_table_signatures[id], + sizeof(header->signature))) { sdt_entry[i].id = id; } } @@ -551,7 +558,7 @@ acpi_table_get_sdt ( * against. Unfortunately, we don't know the phys_addr, so just * print 0. Maybe no one will notice. */ - if(!acpi_get_table_header_early(ACPI_DSDT, &header)) + if (!acpi_get_table_header_early(ACPI_DSDT, &header)) acpi_table_print(header, 0); return 0; @@ -566,12 +573,11 @@ acpi_table_get_sdt ( * result: sdt_entry[] is initialized */ -int __init -acpi_table_init (void) +int __init acpi_table_init(void) { - struct acpi_table_rsdp *rsdp = NULL; - unsigned long rsdp_phys = 0; - int result = 0; + struct acpi_table_rsdp *rsdp = NULL; + unsigned long rsdp_phys = 0; + int result = 0; /* Locate and map the Root System Description Table (RSDP) */ @@ -581,19 +587,25 @@ acpi_table_init (void) return -ENODEV; } - rsdp = (struct acpi_table_rsdp *) __va(rsdp_phys); + rsdp = (struct acpi_table_rsdp *)__va(rsdp_phys); if (!rsdp) { printk(KERN_WARNING PREFIX "Unable to map RSDP\n"); return -ENODEV; } - printk(KERN_DEBUG PREFIX "RSDP (v%3.3d %6.6s ) @ 0x%p\n", - rsdp->revision, rsdp->oem_id, (void *) rsdp_phys); + printk(KERN_DEBUG PREFIX + "RSDP (v%3.3d %6.6s ) @ 0x%p\n", + rsdp->revision, rsdp->oem_id, (void *)rsdp_phys); if (rsdp->revision < 2) - result = acpi_table_compute_checksum(rsdp, sizeof(struct acpi_table_rsdp)); + result = + acpi_table_compute_checksum(rsdp, + sizeof(struct acpi_table_rsdp)); else - result = acpi_table_compute_checksum(rsdp, ((struct acpi20_table_rsdp *)rsdp)->length); + result = + acpi_table_compute_checksum(rsdp, + ((struct acpi20_table_rsdp *) + rsdp)->length); if (result) { printk(KERN_WARNING " >>> ERROR: Invalid checksum\n"); diff --git a/drivers/acpi/tables/tbconvrt.c b/drivers/acpi/tables/tbconvrt.c index d4ff71f5fe5..a03939399fa 100644 --- a/drivers/acpi/tables/tbconvrt.c +++ b/drivers/acpi/tables/tbconvrt.c @@ -46,28 +46,22 @@ #include #include - #define _COMPONENT ACPI_TABLES - ACPI_MODULE_NAME ("tbconvrt") +ACPI_MODULE_NAME("tbconvrt") /* Local prototypes */ - static void -acpi_tb_init_generic_address ( - struct acpi_generic_address *new_gas_struct, - u8 register_bit_width, - acpi_physical_address address); +acpi_tb_init_generic_address(struct acpi_generic_address *new_gas_struct, + u8 register_bit_width, + acpi_physical_address address); static void -acpi_tb_convert_fadt1 ( - struct fadt_descriptor_rev2 *local_fadt, - struct fadt_descriptor_rev1 *original_fadt); +acpi_tb_convert_fadt1(struct fadt_descriptor_rev2 *local_fadt, + struct fadt_descriptor_rev1 *original_fadt); static void -acpi_tb_convert_fadt2 ( - struct fadt_descriptor_rev2 *local_fadt, - struct fadt_descriptor_rev2 *original_fadt); - +acpi_tb_convert_fadt2(struct fadt_descriptor_rev2 *local_fadt, + struct fadt_descriptor_rev2 *original_fadt); u8 acpi_fadt_is_v1; EXPORT_SYMBOL(acpi_fadt_is_v1); @@ -87,23 +81,19 @@ EXPORT_SYMBOL(acpi_fadt_is_v1); ******************************************************************************/ u32 -acpi_tb_get_table_count ( - struct rsdp_descriptor *RSDP, - struct acpi_table_header *RSDT) +acpi_tb_get_table_count(struct rsdp_descriptor *RSDP, + struct acpi_table_header *RSDT) { - u32 pointer_size; - - - ACPI_FUNCTION_ENTRY (); + u32 pointer_size; + ACPI_FUNCTION_ENTRY(); /* RSDT pointers are 32 bits, XSDT pointers are 64 bits */ if (acpi_gbl_root_table_type == ACPI_TABLE_TYPE_RSDT) { - pointer_size = sizeof (u32); - } - else { - pointer_size = sizeof (u64); + pointer_size = sizeof(u32); + } else { + pointer_size = sizeof(u64); } /* @@ -112,10 +102,10 @@ acpi_tb_get_table_count ( * pointers contained within the RSDT/XSDT. The size of the pointers * is architecture-dependent. */ - return ((RSDT->length - sizeof (struct acpi_table_header)) / pointer_size); + return ((RSDT->length - + sizeof(struct acpi_table_header)) / pointer_size); } - /******************************************************************************* * * FUNCTION: acpi_tb_convert_to_xsdt @@ -128,33 +118,30 @@ acpi_tb_get_table_count ( * ******************************************************************************/ -acpi_status -acpi_tb_convert_to_xsdt ( - struct acpi_table_desc *table_info) +acpi_status acpi_tb_convert_to_xsdt(struct acpi_table_desc *table_info) { - acpi_size table_size; - u32 i; - XSDT_DESCRIPTOR *new_table; - - - ACPI_FUNCTION_ENTRY (); + acpi_size table_size; + u32 i; + XSDT_DESCRIPTOR *new_table; + ACPI_FUNCTION_ENTRY(); /* Compute size of the converted XSDT */ - table_size = ((acpi_size) acpi_gbl_rsdt_table_count * sizeof (u64)) + - sizeof (struct acpi_table_header); + table_size = ((acpi_size) acpi_gbl_rsdt_table_count * sizeof(u64)) + + sizeof(struct acpi_table_header); /* Allocate an XSDT */ - new_table = ACPI_MEM_CALLOCATE (table_size); + new_table = ACPI_MEM_CALLOCATE(table_size); if (!new_table) { return (AE_NO_MEMORY); } /* Copy the header and set the length */ - ACPI_MEMCPY (new_table, table_info->pointer, sizeof (struct acpi_table_header)); + ACPI_MEMCPY(new_table, table_info->pointer, + sizeof(struct acpi_table_header)); new_table->length = (u32) table_size; /* Copy the table pointers */ @@ -163,31 +150,33 @@ acpi_tb_convert_to_xsdt ( /* RSDT pointers are 32 bits, XSDT pointers are 64 bits */ if (acpi_gbl_root_table_type == ACPI_TABLE_TYPE_RSDT) { - ACPI_STORE_ADDRESS (new_table->table_offset_entry[i], - (ACPI_CAST_PTR (struct rsdt_descriptor_rev1, - table_info->pointer))->table_offset_entry[i]); - } - else { + ACPI_STORE_ADDRESS(new_table->table_offset_entry[i], + (ACPI_CAST_PTR + (struct rsdt_descriptor_rev1, + table_info->pointer))-> + table_offset_entry[i]); + } else { new_table->table_offset_entry[i] = - (ACPI_CAST_PTR (XSDT_DESCRIPTOR, - table_info->pointer))->table_offset_entry[i]; + (ACPI_CAST_PTR(XSDT_DESCRIPTOR, + table_info->pointer))-> + table_offset_entry[i]; } } /* Delete the original table (either mapped or in a buffer) */ - acpi_tb_delete_single_table (table_info); + acpi_tb_delete_single_table(table_info); /* Point the table descriptor to the new table */ - table_info->pointer = ACPI_CAST_PTR (struct acpi_table_header, new_table); - table_info->length = table_size; - table_info->allocation = ACPI_MEM_ALLOCATED; + table_info->pointer = + ACPI_CAST_PTR(struct acpi_table_header, new_table); + table_info->length = table_size; + table_info->allocation = ACPI_MEM_ALLOCATED; return (AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_tb_init_generic_address @@ -203,21 +192,19 @@ acpi_tb_convert_to_xsdt ( ******************************************************************************/ static void -acpi_tb_init_generic_address ( - struct acpi_generic_address *new_gas_struct, - u8 register_bit_width, - acpi_physical_address address) +acpi_tb_init_generic_address(struct acpi_generic_address *new_gas_struct, + u8 register_bit_width, + acpi_physical_address address) { - ACPI_STORE_ADDRESS (new_gas_struct->address, address); + ACPI_STORE_ADDRESS(new_gas_struct->address, address); new_gas_struct->address_space_id = ACPI_ADR_SPACE_SYSTEM_IO; new_gas_struct->register_bit_width = register_bit_width; new_gas_struct->register_bit_offset = 0; - new_gas_struct->access_width = 0; + new_gas_struct->access_width = 0; } - /******************************************************************************* * * FUNCTION: acpi_tb_convert_fadt1 @@ -232,9 +219,8 @@ acpi_tb_init_generic_address ( ******************************************************************************/ static void -acpi_tb_convert_fadt1 ( - struct fadt_descriptor_rev2 *local_fadt, - struct fadt_descriptor_rev1 *original_fadt) +acpi_tb_convert_fadt1(struct fadt_descriptor_rev2 *local_fadt, + struct fadt_descriptor_rev1 *original_fadt) { /* ACPI 1.0 FACS */ @@ -247,12 +233,14 @@ acpi_tb_convert_fadt1 ( * The 2.0 table is an extension of the 1.0 table, so the entire 1.0 * table can be copied first, then expand some fields to 64 bits. */ - ACPI_MEMCPY (local_fadt, original_fadt, sizeof (struct fadt_descriptor_rev1)); + ACPI_MEMCPY(local_fadt, original_fadt, + sizeof(struct fadt_descriptor_rev1)); /* Convert table pointers to 64-bit fields */ - ACPI_STORE_ADDRESS (local_fadt->xfirmware_ctrl, local_fadt->V1_firmware_ctrl); - ACPI_STORE_ADDRESS (local_fadt->Xdsdt, local_fadt->V1_dsdt); + ACPI_STORE_ADDRESS(local_fadt->xfirmware_ctrl, + local_fadt->V1_firmware_ctrl); + ACPI_STORE_ADDRESS(local_fadt->Xdsdt, local_fadt->V1_dsdt); /* * System Interrupt Model isn't used in ACPI 2.0 @@ -287,17 +275,17 @@ acpi_tb_convert_fadt1 ( * It primarily adds the FADT reset mechanism. */ if ((original_fadt->revision == 2) && - (original_fadt->length == sizeof (struct fadt_descriptor_rev2_minus))) { + (original_fadt->length == + sizeof(struct fadt_descriptor_rev2_minus))) { /* * Grab the entire generic address struct, plus the 1-byte reset value * that immediately follows. */ - ACPI_MEMCPY (&local_fadt->reset_register, - &(ACPI_CAST_PTR (struct fadt_descriptor_rev2_minus, - original_fadt))->reset_register, - sizeof (struct acpi_generic_address) + 1); - } - else { + ACPI_MEMCPY(&local_fadt->reset_register, + &(ACPI_CAST_PTR(struct fadt_descriptor_rev2_minus, + original_fadt))->reset_register, + sizeof(struct acpi_generic_address) + 1); + } else { /* * Since there isn't any equivalence in 1.0 and since it is highly * likely that a 1.0 system has legacy support. @@ -308,43 +296,60 @@ acpi_tb_convert_fadt1 ( /* * Convert the V1.0 block addresses to V2.0 GAS structures */ - acpi_tb_init_generic_address (&local_fadt->xpm1a_evt_blk, local_fadt->pm1_evt_len, - (acpi_physical_address) local_fadt->V1_pm1a_evt_blk); - acpi_tb_init_generic_address (&local_fadt->xpm1b_evt_blk, local_fadt->pm1_evt_len, - (acpi_physical_address) local_fadt->V1_pm1b_evt_blk); - acpi_tb_init_generic_address (&local_fadt->xpm1a_cnt_blk, local_fadt->pm1_cnt_len, - (acpi_physical_address) local_fadt->V1_pm1a_cnt_blk); - acpi_tb_init_generic_address (&local_fadt->xpm1b_cnt_blk, local_fadt->pm1_cnt_len, - (acpi_physical_address) local_fadt->V1_pm1b_cnt_blk); - acpi_tb_init_generic_address (&local_fadt->xpm2_cnt_blk, local_fadt->pm2_cnt_len, - (acpi_physical_address) local_fadt->V1_pm2_cnt_blk); - acpi_tb_init_generic_address (&local_fadt->xpm_tmr_blk, local_fadt->pm_tm_len, - (acpi_physical_address) local_fadt->V1_pm_tmr_blk); - acpi_tb_init_generic_address (&local_fadt->xgpe0_blk, 0, - (acpi_physical_address) local_fadt->V1_gpe0_blk); - acpi_tb_init_generic_address (&local_fadt->xgpe1_blk, 0, - (acpi_physical_address) local_fadt->V1_gpe1_blk); + acpi_tb_init_generic_address(&local_fadt->xpm1a_evt_blk, + local_fadt->pm1_evt_len, + (acpi_physical_address) local_fadt-> + V1_pm1a_evt_blk); + acpi_tb_init_generic_address(&local_fadt->xpm1b_evt_blk, + local_fadt->pm1_evt_len, + (acpi_physical_address) local_fadt-> + V1_pm1b_evt_blk); + acpi_tb_init_generic_address(&local_fadt->xpm1a_cnt_blk, + local_fadt->pm1_cnt_len, + (acpi_physical_address) local_fadt-> + V1_pm1a_cnt_blk); + acpi_tb_init_generic_address(&local_fadt->xpm1b_cnt_blk, + local_fadt->pm1_cnt_len, + (acpi_physical_address) local_fadt-> + V1_pm1b_cnt_blk); + acpi_tb_init_generic_address(&local_fadt->xpm2_cnt_blk, + local_fadt->pm2_cnt_len, + (acpi_physical_address) local_fadt-> + V1_pm2_cnt_blk); + acpi_tb_init_generic_address(&local_fadt->xpm_tmr_blk, + local_fadt->pm_tm_len, + (acpi_physical_address) local_fadt-> + V1_pm_tmr_blk); + acpi_tb_init_generic_address(&local_fadt->xgpe0_blk, 0, + (acpi_physical_address) local_fadt-> + V1_gpe0_blk); + acpi_tb_init_generic_address(&local_fadt->xgpe1_blk, 0, + (acpi_physical_address) local_fadt-> + V1_gpe1_blk); /* Create separate GAS structs for the PM1 Enable registers */ - acpi_tb_init_generic_address (&acpi_gbl_xpm1a_enable, - (u8) ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len), - (acpi_physical_address) - (local_fadt->xpm1a_evt_blk.address + - ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len))); + acpi_tb_init_generic_address(&acpi_gbl_xpm1a_enable, + (u8) ACPI_DIV_2(acpi_gbl_FADT-> + pm1_evt_len), + (acpi_physical_address) + (local_fadt->xpm1a_evt_blk.address + + ACPI_DIV_2(acpi_gbl_FADT->pm1_evt_len))); /* PM1B is optional; leave null if not present */ if (local_fadt->xpm1b_evt_blk.address) { - acpi_tb_init_generic_address (&acpi_gbl_xpm1b_enable, - (u8) ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len), - (acpi_physical_address) - (local_fadt->xpm1b_evt_blk.address + - ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len))); + acpi_tb_init_generic_address(&acpi_gbl_xpm1b_enable, + (u8) ACPI_DIV_2(acpi_gbl_FADT-> + pm1_evt_len), + (acpi_physical_address) + (local_fadt->xpm1b_evt_blk. + address + + ACPI_DIV_2(acpi_gbl_FADT-> + pm1_evt_len))); } } - /******************************************************************************* * * FUNCTION: acpi_tb_convert_fadt2 @@ -360,14 +365,14 @@ acpi_tb_convert_fadt1 ( ******************************************************************************/ static void -acpi_tb_convert_fadt2 ( - struct fadt_descriptor_rev2 *local_fadt, - struct fadt_descriptor_rev2 *original_fadt) +acpi_tb_convert_fadt2(struct fadt_descriptor_rev2 *local_fadt, + struct fadt_descriptor_rev2 *original_fadt) { /* We have an ACPI 2.0 FADT but we must copy it to our local buffer */ - ACPI_MEMCPY (local_fadt, original_fadt, sizeof (struct fadt_descriptor_rev2)); + ACPI_MEMCPY(local_fadt, original_fadt, + sizeof(struct fadt_descriptor_rev2)); /* * "X" fields are optional extensions to the original V1.0 fields, so @@ -375,86 +380,99 @@ acpi_tb_convert_fadt2 ( * is zero. */ if (!(local_fadt->xfirmware_ctrl)) { - ACPI_STORE_ADDRESS (local_fadt->xfirmware_ctrl, - local_fadt->V1_firmware_ctrl); + ACPI_STORE_ADDRESS(local_fadt->xfirmware_ctrl, + local_fadt->V1_firmware_ctrl); } if (!(local_fadt->Xdsdt)) { - ACPI_STORE_ADDRESS (local_fadt->Xdsdt, local_fadt->V1_dsdt); + ACPI_STORE_ADDRESS(local_fadt->Xdsdt, local_fadt->V1_dsdt); } if (!(local_fadt->xpm1a_evt_blk.address)) { - acpi_tb_init_generic_address (&local_fadt->xpm1a_evt_blk, - local_fadt->pm1_evt_len, - (acpi_physical_address) local_fadt->V1_pm1a_evt_blk); + acpi_tb_init_generic_address(&local_fadt->xpm1a_evt_blk, + local_fadt->pm1_evt_len, + (acpi_physical_address) + local_fadt->V1_pm1a_evt_blk); } if (!(local_fadt->xpm1b_evt_blk.address)) { - acpi_tb_init_generic_address (&local_fadt->xpm1b_evt_blk, - local_fadt->pm1_evt_len, - (acpi_physical_address) local_fadt->V1_pm1b_evt_blk); + acpi_tb_init_generic_address(&local_fadt->xpm1b_evt_blk, + local_fadt->pm1_evt_len, + (acpi_physical_address) + local_fadt->V1_pm1b_evt_blk); } if (!(local_fadt->xpm1a_cnt_blk.address)) { - acpi_tb_init_generic_address (&local_fadt->xpm1a_cnt_blk, - local_fadt->pm1_cnt_len, - (acpi_physical_address) local_fadt->V1_pm1a_cnt_blk); + acpi_tb_init_generic_address(&local_fadt->xpm1a_cnt_blk, + local_fadt->pm1_cnt_len, + (acpi_physical_address) + local_fadt->V1_pm1a_cnt_blk); } if (!(local_fadt->xpm1b_cnt_blk.address)) { - acpi_tb_init_generic_address (&local_fadt->xpm1b_cnt_blk, - local_fadt->pm1_cnt_len, - (acpi_physical_address) local_fadt->V1_pm1b_cnt_blk); + acpi_tb_init_generic_address(&local_fadt->xpm1b_cnt_blk, + local_fadt->pm1_cnt_len, + (acpi_physical_address) + local_fadt->V1_pm1b_cnt_blk); } if (!(local_fadt->xpm2_cnt_blk.address)) { - acpi_tb_init_generic_address (&local_fadt->xpm2_cnt_blk, - local_fadt->pm2_cnt_len, - (acpi_physical_address) local_fadt->V1_pm2_cnt_blk); + acpi_tb_init_generic_address(&local_fadt->xpm2_cnt_blk, + local_fadt->pm2_cnt_len, + (acpi_physical_address) + local_fadt->V1_pm2_cnt_blk); } if (!(local_fadt->xpm_tmr_blk.address)) { - acpi_tb_init_generic_address (&local_fadt->xpm_tmr_blk, - local_fadt->pm_tm_len, - (acpi_physical_address) local_fadt->V1_pm_tmr_blk); + acpi_tb_init_generic_address(&local_fadt->xpm_tmr_blk, + local_fadt->pm_tm_len, + (acpi_physical_address) + local_fadt->V1_pm_tmr_blk); } if (!(local_fadt->xgpe0_blk.address)) { - acpi_tb_init_generic_address (&local_fadt->xgpe0_blk, - 0, (acpi_physical_address) local_fadt->V1_gpe0_blk); + acpi_tb_init_generic_address(&local_fadt->xgpe0_blk, + 0, + (acpi_physical_address) + local_fadt->V1_gpe0_blk); } if (!(local_fadt->xgpe1_blk.address)) { - acpi_tb_init_generic_address (&local_fadt->xgpe1_blk, - 0, (acpi_physical_address) local_fadt->V1_gpe1_blk); + acpi_tb_init_generic_address(&local_fadt->xgpe1_blk, + 0, + (acpi_physical_address) + local_fadt->V1_gpe1_blk); } /* Create separate GAS structs for the PM1 Enable registers */ - acpi_tb_init_generic_address (&acpi_gbl_xpm1a_enable, - (u8) ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len), - (acpi_physical_address) - (local_fadt->xpm1a_evt_blk.address + - ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len))); + acpi_tb_init_generic_address(&acpi_gbl_xpm1a_enable, + (u8) ACPI_DIV_2(acpi_gbl_FADT-> + pm1_evt_len), + (acpi_physical_address) + (local_fadt->xpm1a_evt_blk.address + + ACPI_DIV_2(acpi_gbl_FADT->pm1_evt_len))); acpi_gbl_xpm1a_enable.address_space_id = - local_fadt->xpm1a_evt_blk.address_space_id; + local_fadt->xpm1a_evt_blk.address_space_id; /* PM1B is optional; leave null if not present */ if (local_fadt->xpm1b_evt_blk.address) { - acpi_tb_init_generic_address (&acpi_gbl_xpm1b_enable, - (u8) ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len), - (acpi_physical_address) - (local_fadt->xpm1b_evt_blk.address + - ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len))); + acpi_tb_init_generic_address(&acpi_gbl_xpm1b_enable, + (u8) ACPI_DIV_2(acpi_gbl_FADT-> + pm1_evt_len), + (acpi_physical_address) + (local_fadt->xpm1b_evt_blk. + address + + ACPI_DIV_2(acpi_gbl_FADT-> + pm1_evt_len))); acpi_gbl_xpm1b_enable.address_space_id = - local_fadt->xpm1b_evt_blk.address_space_id; + local_fadt->xpm1b_evt_blk.address_space_id; } } - /******************************************************************************* * * FUNCTION: acpi_tb_convert_table_fadt @@ -471,83 +489,76 @@ acpi_tb_convert_fadt2 ( * ******************************************************************************/ -acpi_status -acpi_tb_convert_table_fadt ( - void) +acpi_status acpi_tb_convert_table_fadt(void) { - struct fadt_descriptor_rev2 *local_fadt; - struct acpi_table_desc *table_desc; - - - ACPI_FUNCTION_TRACE ("tb_convert_table_fadt"); + struct fadt_descriptor_rev2 *local_fadt; + struct acpi_table_desc *table_desc; + ACPI_FUNCTION_TRACE("tb_convert_table_fadt"); /* * acpi_gbl_FADT is valid. Validate the FADT length. The table must be * at least as long as the version 1.0 FADT */ - if (acpi_gbl_FADT->length < sizeof (struct fadt_descriptor_rev1)) { - ACPI_REPORT_ERROR (("FADT is invalid, too short: 0x%X\n", - acpi_gbl_FADT->length)); - return_ACPI_STATUS (AE_INVALID_TABLE_LENGTH); + if (acpi_gbl_FADT->length < sizeof(struct fadt_descriptor_rev1)) { + ACPI_REPORT_ERROR(("FADT is invalid, too short: 0x%X\n", + acpi_gbl_FADT->length)); + return_ACPI_STATUS(AE_INVALID_TABLE_LENGTH); } /* Allocate buffer for the ACPI 2.0(+) FADT */ - local_fadt = ACPI_MEM_CALLOCATE (sizeof (struct fadt_descriptor_rev2)); + local_fadt = ACPI_MEM_CALLOCATE(sizeof(struct fadt_descriptor_rev2)); if (!local_fadt) { - return_ACPI_STATUS (AE_NO_MEMORY); + return_ACPI_STATUS(AE_NO_MEMORY); } if (acpi_gbl_FADT->revision >= FADT2_REVISION_ID) { - if (acpi_gbl_FADT->length < sizeof (struct fadt_descriptor_rev2)) { + if (acpi_gbl_FADT->length < sizeof(struct fadt_descriptor_rev2)) { /* Length is too short to be a V2.0 table */ - ACPI_REPORT_WARNING (( - "Inconsistent FADT length (0x%X) and revision (0x%X), using FADT V1.0 portion of table\n", - acpi_gbl_FADT->length, acpi_gbl_FADT->revision)); + ACPI_REPORT_WARNING(("Inconsistent FADT length (0x%X) and revision (0x%X), using FADT V1.0 portion of table\n", acpi_gbl_FADT->length, acpi_gbl_FADT->revision)); - acpi_tb_convert_fadt1 (local_fadt, (void *) acpi_gbl_FADT); - } - else { + acpi_tb_convert_fadt1(local_fadt, + (void *)acpi_gbl_FADT); + } else { /* Valid V2.0 table */ - acpi_tb_convert_fadt2 (local_fadt, acpi_gbl_FADT); + acpi_tb_convert_fadt2(local_fadt, acpi_gbl_FADT); } - } - else { + } else { /* Valid V1.0 table */ - acpi_tb_convert_fadt1 (local_fadt, (void *) acpi_gbl_FADT); + acpi_tb_convert_fadt1(local_fadt, (void *)acpi_gbl_FADT); } /* Global FADT pointer will point to the new common V2.0 FADT */ acpi_gbl_FADT = local_fadt; - acpi_gbl_FADT->length = sizeof (FADT_DESCRIPTOR); + acpi_gbl_FADT->length = sizeof(FADT_DESCRIPTOR); /* Free the original table */ table_desc = acpi_gbl_table_lists[ACPI_TABLE_FADT].next; - acpi_tb_delete_single_table (table_desc); + acpi_tb_delete_single_table(table_desc); /* Install the new table */ - table_desc->pointer = ACPI_CAST_PTR (struct acpi_table_header, acpi_gbl_FADT); - table_desc->allocation = ACPI_MEM_ALLOCATED; - table_desc->length = sizeof (struct fadt_descriptor_rev2); + table_desc->pointer = + ACPI_CAST_PTR(struct acpi_table_header, acpi_gbl_FADT); + table_desc->allocation = ACPI_MEM_ALLOCATED; + table_desc->length = sizeof(struct fadt_descriptor_rev2); /* Dump the entire FADT */ - ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, - "Hex dump of common internal FADT, size %d (%X)\n", - acpi_gbl_FADT->length, acpi_gbl_FADT->length)); - ACPI_DUMP_BUFFER ((u8 *) (acpi_gbl_FADT), acpi_gbl_FADT->length); + ACPI_DEBUG_PRINT((ACPI_DB_TABLES, + "Hex dump of common internal FADT, size %d (%X)\n", + acpi_gbl_FADT->length, acpi_gbl_FADT->length)); + ACPI_DUMP_BUFFER((u8 *) (acpi_gbl_FADT), acpi_gbl_FADT->length); - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_tb_build_common_facs @@ -561,26 +572,21 @@ acpi_tb_convert_table_fadt ( * ******************************************************************************/ -acpi_status -acpi_tb_build_common_facs ( - struct acpi_table_desc *table_info) +acpi_status acpi_tb_build_common_facs(struct acpi_table_desc *table_info) { - ACPI_FUNCTION_TRACE ("tb_build_common_facs"); - + ACPI_FUNCTION_TRACE("tb_build_common_facs"); /* Absolute minimum length is 24, but the ACPI spec says 64 */ if (acpi_gbl_FACS->length < 24) { - ACPI_REPORT_ERROR (("Invalid FACS table length: 0x%X\n", - acpi_gbl_FACS->length)); - return_ACPI_STATUS (AE_INVALID_TABLE_LENGTH); + ACPI_REPORT_ERROR(("Invalid FACS table length: 0x%X\n", + acpi_gbl_FACS->length)); + return_ACPI_STATUS(AE_INVALID_TABLE_LENGTH); } if (acpi_gbl_FACS->length < 64) { - ACPI_REPORT_WARNING (( - "FACS is shorter than the ACPI specification allows: 0x%X, using anyway\n", - acpi_gbl_FACS->length)); + ACPI_REPORT_WARNING(("FACS is shorter than the ACPI specification allows: 0x%X, using anyway\n", acpi_gbl_FACS->length)); } /* Copy fields to the new FACS */ @@ -588,22 +594,22 @@ acpi_tb_build_common_facs ( acpi_gbl_common_fACS.global_lock = &(acpi_gbl_FACS->global_lock); if ((acpi_gbl_RSDP->revision < 2) || - (acpi_gbl_FACS->length < 32) || - (!(acpi_gbl_FACS->xfirmware_waking_vector))) { + (acpi_gbl_FACS->length < 32) || + (!(acpi_gbl_FACS->xfirmware_waking_vector))) { /* ACPI 1.0 FACS or short table or optional X_ field is zero */ - acpi_gbl_common_fACS.firmware_waking_vector = ACPI_CAST_PTR (u64, - &(acpi_gbl_FACS->firmware_waking_vector)); + acpi_gbl_common_fACS.firmware_waking_vector = ACPI_CAST_PTR(u64, + & + (acpi_gbl_FACS-> + firmware_waking_vector)); acpi_gbl_common_fACS.vector_width = 32; - } - else { + } else { /* ACPI 2.0 FACS with valid X_ field */ - acpi_gbl_common_fACS.firmware_waking_vector = &acpi_gbl_FACS->xfirmware_waking_vector; + acpi_gbl_common_fACS.firmware_waking_vector = + &acpi_gbl_FACS->xfirmware_waking_vector; acpi_gbl_common_fACS.vector_width = 64; } - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - - diff --git a/drivers/acpi/tables/tbget.c b/drivers/acpi/tables/tbget.c index 4ab2aadc613..6acd5aeb093 100644 --- a/drivers/acpi/tables/tbget.c +++ b/drivers/acpi/tables/tbget.c @@ -41,27 +41,21 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include #include - #define _COMPONENT ACPI_TABLES - ACPI_MODULE_NAME ("tbget") +ACPI_MODULE_NAME("tbget") /* Local prototypes */ - static acpi_status -acpi_tb_get_this_table ( - struct acpi_pointer *address, - struct acpi_table_header *header, - struct acpi_table_desc *table_info); +acpi_tb_get_this_table(struct acpi_pointer *address, + struct acpi_table_header *header, + struct acpi_table_desc *table_info); static acpi_status -acpi_tb_table_override ( - struct acpi_table_header *header, - struct acpi_table_desc *table_info); - +acpi_tb_table_override(struct acpi_table_header *header, + struct acpi_table_desc *table_info); /******************************************************************************* * @@ -78,37 +72,34 @@ acpi_tb_table_override ( ******************************************************************************/ acpi_status -acpi_tb_get_table ( - struct acpi_pointer *address, - struct acpi_table_desc *table_info) +acpi_tb_get_table(struct acpi_pointer *address, + struct acpi_table_desc *table_info) { - acpi_status status; - struct acpi_table_header header; - - - ACPI_FUNCTION_TRACE ("tb_get_table"); + acpi_status status; + struct acpi_table_header header; + ACPI_FUNCTION_TRACE("tb_get_table"); /* Get the header in order to get signature and table size */ - status = acpi_tb_get_table_header (address, &header); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_tb_get_table_header(address, &header); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* Get the entire table */ - status = acpi_tb_get_table_body (address, &header, table_info); - if (ACPI_FAILURE (status)) { - ACPI_REPORT_ERROR (("Could not get ACPI table (size %X), %s\n", - header.length, acpi_format_exception (status))); - return_ACPI_STATUS (status); + status = acpi_tb_get_table_body(address, &header, table_info); + if (ACPI_FAILURE(status)) { + ACPI_REPORT_ERROR(("Could not get ACPI table (size %X), %s\n", + header.length, + acpi_format_exception(status))); + return_ACPI_STATUS(status); } - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_tb_get_table_header @@ -127,16 +118,13 @@ acpi_tb_get_table ( ******************************************************************************/ acpi_status -acpi_tb_get_table_header ( - struct acpi_pointer *address, - struct acpi_table_header *return_header) +acpi_tb_get_table_header(struct acpi_pointer *address, + struct acpi_table_header *return_header) { - acpi_status status = AE_OK; - struct acpi_table_header *header = NULL; - - - ACPI_FUNCTION_TRACE ("tb_get_table_header"); + acpi_status status = AE_OK; + struct acpi_table_header *header = NULL; + ACPI_FUNCTION_TRACE("tb_get_table_header"); /* * Flags contains the current processor mode (Virtual or Physical @@ -148,46 +136,42 @@ acpi_tb_get_table_header ( /* Pointer matches processor mode, copy the header */ - ACPI_MEMCPY (return_header, address->pointer.logical, - sizeof (struct acpi_table_header)); + ACPI_MEMCPY(return_header, address->pointer.logical, + sizeof(struct acpi_table_header)); break; - case ACPI_LOGMODE_PHYSPTR: - /* Create a logical address for the physical pointer*/ + /* Create a logical address for the physical pointer */ - status = acpi_os_map_memory (address->pointer.physical, - sizeof (struct acpi_table_header), (void *) &header); - if (ACPI_FAILURE (status)) { - ACPI_REPORT_ERROR (( - "Could not map memory at %8.8X%8.8X for length %X\n", - ACPI_FORMAT_UINT64 (address->pointer.physical), - sizeof (struct acpi_table_header))); - return_ACPI_STATUS (status); + status = acpi_os_map_memory(address->pointer.physical, + sizeof(struct acpi_table_header), + (void *)&header); + if (ACPI_FAILURE(status)) { + ACPI_REPORT_ERROR(("Could not map memory at %8.8X%8.8X for length %X\n", ACPI_FORMAT_UINT64(address->pointer.physical), sizeof(struct acpi_table_header))); + return_ACPI_STATUS(status); } /* Copy header and delete mapping */ - ACPI_MEMCPY (return_header, header, sizeof (struct acpi_table_header)); - acpi_os_unmap_memory (header, sizeof (struct acpi_table_header)); + ACPI_MEMCPY(return_header, header, + sizeof(struct acpi_table_header)); + acpi_os_unmap_memory(header, sizeof(struct acpi_table_header)); break; - default: - ACPI_REPORT_ERROR (("Invalid address flags %X\n", - address->pointer_type)); - return_ACPI_STATUS (AE_BAD_PARAMETER); + ACPI_REPORT_ERROR(("Invalid address flags %X\n", + address->pointer_type)); + return_ACPI_STATUS(AE_BAD_PARAMETER); } - ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "Table Signature: [%4.4s]\n", - return_header->signature)); + ACPI_DEBUG_PRINT((ACPI_DB_TABLES, "Table Signature: [%4.4s]\n", + return_header->signature)); - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_tb_get_table_body @@ -209,37 +193,33 @@ acpi_tb_get_table_header ( ******************************************************************************/ acpi_status -acpi_tb_get_table_body ( - struct acpi_pointer *address, - struct acpi_table_header *header, - struct acpi_table_desc *table_info) +acpi_tb_get_table_body(struct acpi_pointer *address, + struct acpi_table_header *header, + struct acpi_table_desc *table_info) { - acpi_status status; - - - ACPI_FUNCTION_TRACE ("tb_get_table_body"); + acpi_status status; + ACPI_FUNCTION_TRACE("tb_get_table_body"); if (!table_info || !address) { - return_ACPI_STATUS (AE_BAD_PARAMETER); + return_ACPI_STATUS(AE_BAD_PARAMETER); } /* Attempt table override. */ - status = acpi_tb_table_override (header, table_info); - if (ACPI_SUCCESS (status)) { + status = acpi_tb_table_override(header, table_info); + if (ACPI_SUCCESS(status)) { /* Table was overridden by the host OS */ - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } /* No override, get the original table */ - status = acpi_tb_get_this_table (address, header, table_info); - return_ACPI_STATUS (status); + status = acpi_tb_get_this_table(address, header, table_info); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_tb_table_override @@ -255,61 +235,57 @@ acpi_tb_get_table_body ( ******************************************************************************/ static acpi_status -acpi_tb_table_override ( - struct acpi_table_header *header, - struct acpi_table_desc *table_info) +acpi_tb_table_override(struct acpi_table_header *header, + struct acpi_table_desc *table_info) { - struct acpi_table_header *new_table; - acpi_status status; - struct acpi_pointer address; - - - ACPI_FUNCTION_TRACE ("tb_table_override"); + struct acpi_table_header *new_table; + acpi_status status; + struct acpi_pointer address; + ACPI_FUNCTION_TRACE("tb_table_override"); /* * The OSL will examine the header and decide whether to override this * table. If it decides to override, a table will be returned in new_table, * which we will then copy. */ - status = acpi_os_table_override (header, &new_table); - if (ACPI_FAILURE (status)) { + status = acpi_os_table_override(header, &new_table); + if (ACPI_FAILURE(status)) { /* Some severe error from the OSL, but we basically ignore it */ - ACPI_REPORT_ERROR (("Could not override ACPI table, %s\n", - acpi_format_exception (status))); - return_ACPI_STATUS (status); + ACPI_REPORT_ERROR(("Could not override ACPI table, %s\n", + acpi_format_exception(status))); + return_ACPI_STATUS(status); } if (!new_table) { /* No table override */ - return_ACPI_STATUS (AE_NO_ACPI_TABLES); + return_ACPI_STATUS(AE_NO_ACPI_TABLES); } /* * We have a new table to override the old one. Get a copy of * the new one. We know that the new table has a logical pointer. */ - address.pointer_type = ACPI_LOGICAL_POINTER | ACPI_LOGICAL_ADDRESSING; + address.pointer_type = ACPI_LOGICAL_POINTER | ACPI_LOGICAL_ADDRESSING; address.pointer.logical = new_table; - status = acpi_tb_get_this_table (&address, new_table, table_info); - if (ACPI_FAILURE (status)) { - ACPI_REPORT_ERROR (("Could not copy override ACPI table, %s\n", - acpi_format_exception (status))); - return_ACPI_STATUS (status); + status = acpi_tb_get_this_table(&address, new_table, table_info); + if (ACPI_FAILURE(status)) { + ACPI_REPORT_ERROR(("Could not copy override ACPI table, %s\n", + acpi_format_exception(status))); + return_ACPI_STATUS(status); } /* Copy the table info */ - ACPI_REPORT_INFO (("Table [%4.4s] replaced by host OS\n", - table_info->pointer->signature)); + ACPI_REPORT_INFO(("Table [%4.4s] replaced by host OS\n", + table_info->pointer->signature)); - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_tb_get_this_table @@ -329,18 +305,15 @@ acpi_tb_table_override ( ******************************************************************************/ static acpi_status -acpi_tb_get_this_table ( - struct acpi_pointer *address, - struct acpi_table_header *header, - struct acpi_table_desc *table_info) +acpi_tb_get_this_table(struct acpi_pointer *address, + struct acpi_table_header *header, + struct acpi_table_desc *table_info) { - struct acpi_table_header *full_table = NULL; - u8 allocation; - acpi_status status = AE_OK; - - - ACPI_FUNCTION_TRACE ("tb_get_this_table"); + struct acpi_table_header *full_table = NULL; + u8 allocation; + acpi_status status = AE_OK; + ACPI_FUNCTION_TRACE("tb_get_this_table"); /* * Flags contains the current processor mode (Virtual or Physical @@ -352,38 +325,33 @@ acpi_tb_get_this_table ( /* Pointer matches processor mode, copy the table to a new buffer */ - full_table = ACPI_MEM_ALLOCATE (header->length); + full_table = ACPI_MEM_ALLOCATE(header->length); if (!full_table) { - ACPI_REPORT_ERROR (( - "Could not allocate table memory for [%4.4s] length %X\n", - header->signature, header->length)); - return_ACPI_STATUS (AE_NO_MEMORY); + ACPI_REPORT_ERROR(("Could not allocate table memory for [%4.4s] length %X\n", header->signature, header->length)); + return_ACPI_STATUS(AE_NO_MEMORY); } /* Copy the entire table (including header) to the local buffer */ - ACPI_MEMCPY (full_table, address->pointer.logical, header->length); + ACPI_MEMCPY(full_table, address->pointer.logical, + header->length); /* Save allocation type */ allocation = ACPI_MEM_ALLOCATED; break; - case ACPI_LOGMODE_PHYSPTR: /* * Just map the table's physical memory * into our address space. */ - status = acpi_os_map_memory (address->pointer.physical, - (acpi_size) header->length, (void *) &full_table); - if (ACPI_FAILURE (status)) { - ACPI_REPORT_ERROR (( - "Could not map memory for table [%4.4s] at %8.8X%8.8X for length %X\n", - header->signature, - ACPI_FORMAT_UINT64 (address->pointer.physical), - header->length)); + status = acpi_os_map_memory(address->pointer.physical, + (acpi_size) header->length, + (void *)&full_table); + if (ACPI_FAILURE(status)) { + ACPI_REPORT_ERROR(("Could not map memory for table [%4.4s] at %8.8X%8.8X for length %X\n", header->signature, ACPI_FORMAT_UINT64(address->pointer.physical), header->length)); return (status); } @@ -392,12 +360,11 @@ acpi_tb_get_this_table ( allocation = ACPI_MEM_MAPPED; break; - default: - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid address flags %X\n", - address->pointer_type)); - return_ACPI_STATUS (AE_BAD_PARAMETER); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid address flags %X\n", + address->pointer_type)); + return_ACPI_STATUS(AE_BAD_PARAMETER); } /* @@ -405,10 +372,10 @@ acpi_tb_get_this_table ( * even the ones whose signature we don't recognize */ if (table_info->type != ACPI_TABLE_FACS) { - status = acpi_tb_verify_table_checksum (full_table); + status = acpi_tb_verify_table_checksum(full_table); #if (!ACPI_CHECKSUM_ABORT) - if (ACPI_FAILURE (status)) { + if (ACPI_FAILURE(status)) { /* Ignore the error if configuration says so */ status = AE_OK; @@ -418,19 +385,19 @@ acpi_tb_get_this_table ( /* Return values */ - table_info->pointer = full_table; - table_info->length = (acpi_size) header->length; - table_info->allocation = allocation; + table_info->pointer = full_table; + table_info->length = (acpi_size) header->length; + table_info->allocation = allocation; - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "Found table [%4.4s] at %8.8X%8.8X, mapped/copied to %p\n", - full_table->signature, - ACPI_FORMAT_UINT64 (address->pointer.physical), full_table)); + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "Found table [%4.4s] at %8.8X%8.8X, mapped/copied to %p\n", + full_table->signature, + ACPI_FORMAT_UINT64(address->pointer.physical), + full_table)); - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_tb_get_table_ptr @@ -447,24 +414,20 @@ acpi_tb_get_this_table ( ******************************************************************************/ acpi_status -acpi_tb_get_table_ptr ( - acpi_table_type table_type, - u32 instance, - struct acpi_table_header **table_ptr_loc) +acpi_tb_get_table_ptr(acpi_table_type table_type, + u32 instance, struct acpi_table_header **table_ptr_loc) { - struct acpi_table_desc *table_desc; - u32 i; - - - ACPI_FUNCTION_TRACE ("tb_get_table_ptr"); + struct acpi_table_desc *table_desc; + u32 i; + ACPI_FUNCTION_TRACE("tb_get_table_ptr"); if (!acpi_gbl_DSDT) { - return_ACPI_STATUS (AE_NO_ACPI_TABLES); + return_ACPI_STATUS(AE_NO_ACPI_TABLES); } if (table_type > ACPI_TABLE_MAX) { - return_ACPI_STATUS (AE_BAD_PARAMETER); + return_ACPI_STATUS(AE_BAD_PARAMETER); } /* @@ -476,15 +439,16 @@ acpi_tb_get_table_ptr ( *table_ptr_loc = NULL; if (acpi_gbl_table_lists[table_type].next) { - *table_ptr_loc = acpi_gbl_table_lists[table_type].next->pointer; + *table_ptr_loc = + acpi_gbl_table_lists[table_type].next->pointer; } - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } /* Check for instance out of range */ if (instance > acpi_gbl_table_lists[table_type].count) { - return_ACPI_STATUS (AE_NOT_EXIST); + return_ACPI_STATUS(AE_NOT_EXIST); } /* Walk the list to get the desired table @@ -503,6 +467,5 @@ acpi_tb_get_table_ptr ( *table_ptr_loc = table_desc->pointer; - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - diff --git a/drivers/acpi/tables/tbgetall.c b/drivers/acpi/tables/tbgetall.c index eea5b8cb5eb..8d72343537e 100644 --- a/drivers/acpi/tables/tbgetall.c +++ b/drivers/acpi/tables/tbgetall.c @@ -41,27 +41,21 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include #include - #define _COMPONENT ACPI_TABLES - ACPI_MODULE_NAME ("tbgetall") +ACPI_MODULE_NAME("tbgetall") /* Local prototypes */ - static acpi_status -acpi_tb_get_primary_table ( - struct acpi_pointer *address, - struct acpi_table_desc *table_info); +acpi_tb_get_primary_table(struct acpi_pointer *address, + struct acpi_table_desc *table_info); static acpi_status -acpi_tb_get_secondary_table ( - struct acpi_pointer *address, - acpi_string signature, - struct acpi_table_desc *table_info); - +acpi_tb_get_secondary_table(struct acpi_pointer *address, + acpi_string signature, + struct acpi_table_desc *table_info); /******************************************************************************* * @@ -77,58 +71,54 @@ acpi_tb_get_secondary_table ( ******************************************************************************/ static acpi_status -acpi_tb_get_primary_table ( - struct acpi_pointer *address, - struct acpi_table_desc *table_info) +acpi_tb_get_primary_table(struct acpi_pointer *address, + struct acpi_table_desc *table_info) { - acpi_status status; - struct acpi_table_header header; - - - ACPI_FUNCTION_TRACE ("tb_get_primary_table"); + acpi_status status; + struct acpi_table_header header; + ACPI_FUNCTION_TRACE("tb_get_primary_table"); /* Ignore a NULL address in the RSDT */ if (!address->pointer.value) { - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } /* Get the header in order to get signature and table size */ - status = acpi_tb_get_table_header (address, &header); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_tb_get_table_header(address, &header); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* Clear the table_info */ - ACPI_MEMSET (table_info, 0, sizeof (struct acpi_table_desc)); + ACPI_MEMSET(table_info, 0, sizeof(struct acpi_table_desc)); /* * Check the table signature and make sure it is recognized. * Also checks the header checksum */ table_info->pointer = &header; - status = acpi_tb_recognize_table (table_info, ACPI_TABLE_PRIMARY); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_tb_recognize_table(table_info, ACPI_TABLE_PRIMARY); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* Get the entire table */ - status = acpi_tb_get_table_body (address, &header, table_info); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_tb_get_table_body(address, &header, table_info); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* Install the table */ - status = acpi_tb_install_table (table_info); - return_ACPI_STATUS (status); + status = acpi_tb_install_table(table_info); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_tb_get_secondary_table @@ -143,32 +133,27 @@ acpi_tb_get_primary_table ( ******************************************************************************/ static acpi_status -acpi_tb_get_secondary_table ( - struct acpi_pointer *address, - acpi_string signature, - struct acpi_table_desc *table_info) +acpi_tb_get_secondary_table(struct acpi_pointer *address, + acpi_string signature, + struct acpi_table_desc *table_info) { - acpi_status status; - struct acpi_table_header header; - - - ACPI_FUNCTION_TRACE_STR ("tb_get_secondary_table", signature); + acpi_status status; + struct acpi_table_header header; + ACPI_FUNCTION_TRACE_STR("tb_get_secondary_table", signature); /* Get the header in order to match the signature */ - status = acpi_tb_get_table_header (address, &header); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_tb_get_table_header(address, &header); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* Signature must match request */ - if (ACPI_STRNCMP (header.signature, signature, ACPI_NAME_SIZE)) { - ACPI_REPORT_ERROR (( - "Incorrect table signature - wanted [%s] found [%4.4s]\n", - signature, header.signature)); - return_ACPI_STATUS (AE_BAD_SIGNATURE); + if (ACPI_STRNCMP(header.signature, signature, ACPI_NAME_SIZE)) { + ACPI_REPORT_ERROR(("Incorrect table signature - wanted [%s] found [%4.4s]\n", signature, header.signature)); + return_ACPI_STATUS(AE_BAD_SIGNATURE); } /* @@ -176,25 +161,24 @@ acpi_tb_get_secondary_table ( * Also checks the header checksum */ table_info->pointer = &header; - status = acpi_tb_recognize_table (table_info, ACPI_TABLE_SECONDARY); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_tb_recognize_table(table_info, ACPI_TABLE_SECONDARY); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* Get the entire table */ - status = acpi_tb_get_table_body (address, &header, table_info); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_tb_get_table_body(address, &header, table_info); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* Install the table */ - status = acpi_tb_install_table (table_info); - return_ACPI_STATUS (status); + status = acpi_tb_install_table(table_info); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_tb_get_required_tables @@ -214,23 +198,19 @@ acpi_tb_get_secondary_table ( * ******************************************************************************/ -acpi_status -acpi_tb_get_required_tables ( - void) +acpi_status acpi_tb_get_required_tables(void) { - acpi_status status = AE_OK; - u32 i; - struct acpi_table_desc table_info; - struct acpi_pointer address; - + acpi_status status = AE_OK; + u32 i; + struct acpi_table_desc table_info; + struct acpi_pointer address; - ACPI_FUNCTION_TRACE ("tb_get_required_tables"); + ACPI_FUNCTION_TRACE("tb_get_required_tables"); - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "%d ACPI tables in RSDT\n", - acpi_gbl_rsdt_table_count)); + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "%d ACPI tables in RSDT\n", + acpi_gbl_rsdt_table_count)); - - address.pointer_type = acpi_gbl_table_flags | ACPI_LOGICAL_ADDRESSING; + address.pointer_type = acpi_gbl_table_flags | ACPI_LOGICAL_ADDRESSING; /* * Loop through all table pointers found in RSDT. @@ -243,84 +223,79 @@ acpi_tb_get_required_tables ( for (i = 0; i < acpi_gbl_rsdt_table_count; i++) { /* Get the table address from the common internal XSDT */ - address.pointer.value = - acpi_gbl_XSDT->table_offset_entry[i]; + address.pointer.value = acpi_gbl_XSDT->table_offset_entry[i]; /* * Get the tables needed by this subsystem (FADT and any SSDTs). * NOTE: All other tables are completely ignored at this time. */ - status = acpi_tb_get_primary_table (&address, &table_info); + status = acpi_tb_get_primary_table(&address, &table_info); if ((status != AE_OK) && (status != AE_TABLE_NOT_SUPPORTED)) { - ACPI_REPORT_WARNING (("%s, while getting table at %8.8X%8.8X\n", - acpi_format_exception (status), - ACPI_FORMAT_UINT64 (address.pointer.value))); + ACPI_REPORT_WARNING(("%s, while getting table at %8.8X%8.8X\n", acpi_format_exception(status), ACPI_FORMAT_UINT64(address.pointer.value))); } } /* We must have a FADT to continue */ if (!acpi_gbl_FADT) { - ACPI_REPORT_ERROR (("No FADT present in RSDT/XSDT\n")); - return_ACPI_STATUS (AE_NO_ACPI_TABLES); + ACPI_REPORT_ERROR(("No FADT present in RSDT/XSDT\n")); + return_ACPI_STATUS(AE_NO_ACPI_TABLES); } /* * Convert the FADT to a common format. This allows earlier revisions of * the table to coexist with newer versions, using common access code. */ - status = acpi_tb_convert_table_fadt (); - if (ACPI_FAILURE (status)) { - ACPI_REPORT_ERROR (( - "Could not convert FADT to internal common format\n")); - return_ACPI_STATUS (status); + status = acpi_tb_convert_table_fadt(); + if (ACPI_FAILURE(status)) { + ACPI_REPORT_ERROR(("Could not convert FADT to internal common format\n")); + return_ACPI_STATUS(status); } /* Get the FACS (Pointed to by the FADT) */ address.pointer.value = acpi_gbl_FADT->xfirmware_ctrl; - status = acpi_tb_get_secondary_table (&address, FACS_SIG, &table_info); - if (ACPI_FAILURE (status)) { - ACPI_REPORT_ERROR (("Could not get/install the FACS, %s\n", - acpi_format_exception (status))); - return_ACPI_STATUS (status); + status = acpi_tb_get_secondary_table(&address, FACS_SIG, &table_info); + if (ACPI_FAILURE(status)) { + ACPI_REPORT_ERROR(("Could not get/install the FACS, %s\n", + acpi_format_exception(status))); + return_ACPI_STATUS(status); } /* * Create the common FACS pointer table * (Contains pointers to the original table) */ - status = acpi_tb_build_common_facs (&table_info); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_tb_build_common_facs(&table_info); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* Get/install the DSDT (Pointed to by the FADT) */ address.pointer.value = acpi_gbl_FADT->Xdsdt; - status = acpi_tb_get_secondary_table (&address, DSDT_SIG, &table_info); - if (ACPI_FAILURE (status)) { - ACPI_REPORT_ERROR (("Could not get/install the DSDT\n")); - return_ACPI_STATUS (status); + status = acpi_tb_get_secondary_table(&address, DSDT_SIG, &table_info); + if (ACPI_FAILURE(status)) { + ACPI_REPORT_ERROR(("Could not get/install the DSDT\n")); + return_ACPI_STATUS(status); } /* Set Integer Width (32/64) based upon DSDT revision */ - acpi_ut_set_integer_width (acpi_gbl_DSDT->revision); + acpi_ut_set_integer_width(acpi_gbl_DSDT->revision); /* Dump the entire DSDT */ - ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, - "Hex dump of entire DSDT, size %d (0x%X), Integer width = %d\n", - acpi_gbl_DSDT->length, acpi_gbl_DSDT->length, acpi_gbl_integer_bit_width)); - ACPI_DUMP_BUFFER ((u8 *) acpi_gbl_DSDT, acpi_gbl_DSDT->length); + ACPI_DEBUG_PRINT((ACPI_DB_TABLES, + "Hex dump of entire DSDT, size %d (0x%X), Integer width = %d\n", + acpi_gbl_DSDT->length, acpi_gbl_DSDT->length, + acpi_gbl_integer_bit_width)); + ACPI_DUMP_BUFFER((u8 *) acpi_gbl_DSDT, acpi_gbl_DSDT->length); /* Always delete the RSDP mapping, we are done with it */ - acpi_tb_delete_tables_by_type (ACPI_TABLE_RSDP); - return_ACPI_STATUS (status); + acpi_tb_delete_tables_by_type(ACPI_TABLE_RSDP); + return_ACPI_STATUS(status); } - - diff --git a/drivers/acpi/tables/tbinstal.c b/drivers/acpi/tables/tbinstal.c index 698799901f5..10db8484e46 100644 --- a/drivers/acpi/tables/tbinstal.c +++ b/drivers/acpi/tables/tbinstal.c @@ -41,22 +41,16 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include #include - #define _COMPONENT ACPI_TABLES - ACPI_MODULE_NAME ("tbinstal") +ACPI_MODULE_NAME("tbinstal") /* Local prototypes */ - static acpi_status -acpi_tb_match_signature ( - char *signature, - struct acpi_table_desc *table_info, - u8 search_type); - +acpi_tb_match_signature(char *signature, + struct acpi_table_desc *table_info, u8 search_type); /******************************************************************************* * @@ -74,16 +68,12 @@ acpi_tb_match_signature ( ******************************************************************************/ static acpi_status -acpi_tb_match_signature ( - char *signature, - struct acpi_table_desc *table_info, - u8 search_type) +acpi_tb_match_signature(char *signature, + struct acpi_table_desc *table_info, u8 search_type) { - acpi_native_uint i; - - - ACPI_FUNCTION_TRACE ("tb_match_signature"); + acpi_native_uint i; + ACPI_FUNCTION_TRACE("tb_match_signature"); /* Search for a signature match among the known table types */ @@ -92,30 +82,30 @@ acpi_tb_match_signature ( continue; } - if (!ACPI_STRNCMP (signature, acpi_gbl_table_data[i].signature, - acpi_gbl_table_data[i].sig_length)) { + if (!ACPI_STRNCMP(signature, acpi_gbl_table_data[i].signature, + acpi_gbl_table_data[i].sig_length)) { /* Found a signature match, return index if requested */ if (table_info) { table_info->type = (u8) i; } - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "Table [%4.4s] is an ACPI table consumed by the core subsystem\n", - (char *) acpi_gbl_table_data[i].signature)); + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "Table [%4.4s] is an ACPI table consumed by the core subsystem\n", + (char *)acpi_gbl_table_data[i]. + signature)); - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } } - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "Table [%4.4s] is not an ACPI table consumed by the core subsystem - ignored\n", - (char *) signature)); + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "Table [%4.4s] is not an ACPI table consumed by the core subsystem - ignored\n", + (char *)signature)); - return_ACPI_STATUS (AE_TABLE_NOT_SUPPORTED); + return_ACPI_STATUS(AE_TABLE_NOT_SUPPORTED); } - /******************************************************************************* * * FUNCTION: acpi_tb_install_table @@ -128,52 +118,48 @@ acpi_tb_match_signature ( * ******************************************************************************/ -acpi_status -acpi_tb_install_table ( - struct acpi_table_desc *table_info) +acpi_status acpi_tb_install_table(struct acpi_table_desc *table_info) { - acpi_status status; - - - ACPI_FUNCTION_TRACE ("tb_install_table"); + acpi_status status; + ACPI_FUNCTION_TRACE("tb_install_table"); /* Lock tables while installing */ - status = acpi_ut_acquire_mutex (ACPI_MTX_TABLES); - if (ACPI_FAILURE (status)) { - ACPI_REPORT_ERROR (("Could not acquire table mutex, %s\n", - acpi_format_exception (status))); - return_ACPI_STATUS (status); + status = acpi_ut_acquire_mutex(ACPI_MTX_TABLES); + if (ACPI_FAILURE(status)) { + ACPI_REPORT_ERROR(("Could not acquire table mutex, %s\n", + acpi_format_exception(status))); + return_ACPI_STATUS(status); } /* * Ignore a table that is already installed. For example, some BIOS * ASL code will repeatedly attempt to load the same SSDT. */ - status = acpi_tb_is_table_installed (table_info); - if (ACPI_FAILURE (status)) { + status = acpi_tb_is_table_installed(table_info); + if (ACPI_FAILURE(status)) { goto unlock_and_exit; } /* Install the table into the global data structure */ - status = acpi_tb_init_table_descriptor (table_info->type, table_info); - if (ACPI_FAILURE (status)) { - ACPI_REPORT_ERROR (("Could not install table [%4.4s], %s\n", - table_info->pointer->signature, acpi_format_exception (status))); + status = acpi_tb_init_table_descriptor(table_info->type, table_info); + if (ACPI_FAILURE(status)) { + ACPI_REPORT_ERROR(("Could not install table [%4.4s], %s\n", + table_info->pointer->signature, + acpi_format_exception(status))); } - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "%s located at %p\n", - acpi_gbl_table_data[table_info->type].name, table_info->pointer)); + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "%s located at %p\n", + acpi_gbl_table_data[table_info->type].name, + table_info->pointer)); - -unlock_and_exit: - (void) acpi_ut_release_mutex (ACPI_MTX_TABLES); - return_ACPI_STATUS (status); + unlock_and_exit: + (void)acpi_ut_release_mutex(ACPI_MTX_TABLES); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_tb_recognize_table @@ -196,22 +182,18 @@ unlock_and_exit: ******************************************************************************/ acpi_status -acpi_tb_recognize_table ( - struct acpi_table_desc *table_info, - u8 search_type) +acpi_tb_recognize_table(struct acpi_table_desc *table_info, u8 search_type) { - struct acpi_table_header *table_header; - acpi_status status; - - - ACPI_FUNCTION_TRACE ("tb_recognize_table"); + struct acpi_table_header *table_header; + acpi_status status; + ACPI_FUNCTION_TRACE("tb_recognize_table"); /* Ensure that we have a valid table pointer */ - table_header = (struct acpi_table_header *) table_info->pointer; + table_header = (struct acpi_table_header *)table_info->pointer; if (!table_header) { - return_ACPI_STATUS (AE_BAD_PARAMETER); + return_ACPI_STATUS(AE_BAD_PARAMETER); } /* @@ -222,25 +204,24 @@ acpi_tb_recognize_table ( * This can be any one of many valid ACPI tables, it just isn't one of * the tables that is consumed by the core subsystem */ - status = acpi_tb_match_signature (table_header->signature, - table_info, search_type); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_tb_match_signature(table_header->signature, + table_info, search_type); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } - status = acpi_tb_validate_table_header (table_header); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_tb_validate_table_header(table_header); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* Return the table type and length via the info struct */ table_info->length = (acpi_size) table_header->length; - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_tb_init_table_descriptor @@ -255,30 +236,27 @@ acpi_tb_recognize_table ( ******************************************************************************/ acpi_status -acpi_tb_init_table_descriptor ( - acpi_table_type table_type, - struct acpi_table_desc *table_info) +acpi_tb_init_table_descriptor(acpi_table_type table_type, + struct acpi_table_desc *table_info) { - struct acpi_table_list *list_head; - struct acpi_table_desc *table_desc; - acpi_status status; - - - ACPI_FUNCTION_TRACE_U32 ("tb_init_table_descriptor", table_type); + struct acpi_table_list *list_head; + struct acpi_table_desc *table_desc; + acpi_status status; + ACPI_FUNCTION_TRACE_U32("tb_init_table_descriptor", table_type); /* Allocate a descriptor for this table */ - table_desc = ACPI_MEM_CALLOCATE (sizeof (struct acpi_table_desc)); + table_desc = ACPI_MEM_CALLOCATE(sizeof(struct acpi_table_desc)); if (!table_desc) { - return_ACPI_STATUS (AE_NO_MEMORY); + return_ACPI_STATUS(AE_NO_MEMORY); } /* Get a new owner ID for the table */ - status = acpi_ut_allocate_owner_id (&table_desc->owner_id); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ut_allocate_owner_id(&table_desc->owner_id); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* Install the table into the global data structure */ @@ -290,14 +268,14 @@ acpi_tb_init_table_descriptor ( * includes most ACPI tables such as the DSDT. 2) Multiple instances of * the table are allowed. This includes SSDT and PSDTs. */ - if (ACPI_IS_SINGLE_TABLE (acpi_gbl_table_data[table_type].flags)) { + if (ACPI_IS_SINGLE_TABLE(acpi_gbl_table_data[table_type].flags)) { /* * Only one table allowed, and a table has alread been installed * at this location, so return an error. */ if (list_head->next) { - ACPI_MEM_FREE (table_desc); - return_ACPI_STATUS (AE_ALREADY_EXISTS); + ACPI_MEM_FREE(table_desc); + return_ACPI_STATUS(AE_ALREADY_EXISTS); } table_desc->next = list_head->next; @@ -308,8 +286,7 @@ acpi_tb_init_table_descriptor ( } list_head->count++; - } - else { + } else { /* * Link the new table in to the list of tables of this type. * Insert at the end of the list, order IS IMPORTANT. @@ -320,8 +297,7 @@ acpi_tb_init_table_descriptor ( if (!list_head->next) { list_head->next = table_desc; - } - else { + } else { table_desc->next = list_head->next; while (table_desc->next->next) { @@ -336,13 +312,14 @@ acpi_tb_init_table_descriptor ( /* Finish initialization of the table descriptor */ - table_desc->type = (u8) table_type; - table_desc->pointer = table_info->pointer; - table_desc->length = table_info->length; - table_desc->allocation = table_info->allocation; - table_desc->aml_start = (u8 *) (table_desc->pointer + 1), - table_desc->aml_length = (u32) (table_desc->length - - (u32) sizeof (struct acpi_table_header)); + table_desc->type = (u8) table_type; + table_desc->pointer = table_info->pointer; + table_desc->length = table_info->length; + table_desc->allocation = table_info->allocation; + table_desc->aml_start = (u8 *) (table_desc->pointer + 1), + table_desc->aml_length = (u32) (table_desc->length - + (u32) sizeof(struct + acpi_table_header)); table_desc->loaded_into_namespace = FALSE; /* @@ -350,18 +327,18 @@ acpi_tb_init_table_descriptor ( * newly installed table */ if (acpi_gbl_table_data[table_type].global_ptr) { - *(acpi_gbl_table_data[table_type].global_ptr) = table_info->pointer; + *(acpi_gbl_table_data[table_type].global_ptr) = + table_info->pointer; } /* Return Data */ - table_info->owner_id = table_desc->owner_id; - table_info->installed_desc = table_desc; + table_info->owner_id = table_desc->owner_id; + table_info->installed_desc = table_desc; - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_tb_delete_all_tables @@ -374,23 +351,19 @@ acpi_tb_init_table_descriptor ( * ******************************************************************************/ -void -acpi_tb_delete_all_tables ( - void) +void acpi_tb_delete_all_tables(void) { - acpi_table_type type; - + acpi_table_type type; /* * Free memory allocated for ACPI tables * Memory can either be mapped or allocated */ for (type = 0; type < NUM_ACPI_TABLE_TYPES; type++) { - acpi_tb_delete_tables_by_type (type); + acpi_tb_delete_tables_by_type(type); } } - /******************************************************************************* * * FUNCTION: acpi_tb_delete_tables_by_type @@ -404,23 +377,19 @@ acpi_tb_delete_all_tables ( * ******************************************************************************/ -void -acpi_tb_delete_tables_by_type ( - acpi_table_type type) +void acpi_tb_delete_tables_by_type(acpi_table_type type) { - struct acpi_table_desc *table_desc; - u32 count; - u32 i; - - - ACPI_FUNCTION_TRACE_U32 ("tb_delete_tables_by_type", type); + struct acpi_table_desc *table_desc; + u32 count; + u32 i; + ACPI_FUNCTION_TRACE_U32("tb_delete_tables_by_type", type); if (type > ACPI_TABLE_MAX) { return_VOID; } - if (ACPI_FAILURE (acpi_ut_acquire_mutex (ACPI_MTX_TABLES))) { + if (ACPI_FAILURE(acpi_ut_acquire_mutex(ACPI_MTX_TABLES))) { return; } @@ -458,21 +427,20 @@ acpi_tb_delete_tables_by_type ( * 1) Get the head of the list */ table_desc = acpi_gbl_table_lists[type].next; - count = acpi_gbl_table_lists[type].count; + count = acpi_gbl_table_lists[type].count; /* * 2) Walk the entire list, deleting both the allocated tables * and the table descriptors */ for (i = 0; i < count; i++) { - table_desc = acpi_tb_uninstall_table (table_desc); + table_desc = acpi_tb_uninstall_table(table_desc); } - (void) acpi_ut_release_mutex (ACPI_MTX_TABLES); + (void)acpi_ut_release_mutex(ACPI_MTX_TABLES); return_VOID; } - /******************************************************************************* * * FUNCTION: acpi_tb_delete_single_table @@ -486,15 +454,12 @@ acpi_tb_delete_tables_by_type ( * ******************************************************************************/ -void -acpi_tb_delete_single_table ( - struct acpi_table_desc *table_desc) +void acpi_tb_delete_single_table(struct acpi_table_desc *table_desc) { /* Must have a valid table descriptor and pointer */ - if ((!table_desc) || - (!table_desc->pointer)) { + if ((!table_desc) || (!table_desc->pointer)) { return; } @@ -506,12 +471,12 @@ acpi_tb_delete_single_table ( case ACPI_MEM_ALLOCATED: - ACPI_MEM_FREE (table_desc->pointer); + ACPI_MEM_FREE(table_desc->pointer); break; case ACPI_MEM_MAPPED: - acpi_os_unmap_memory (table_desc->pointer, table_desc->length); + acpi_os_unmap_memory(table_desc->pointer, table_desc->length); break; default: @@ -519,7 +484,6 @@ acpi_tb_delete_single_table ( } } - /******************************************************************************* * * FUNCTION: acpi_tb_uninstall_table @@ -534,26 +498,22 @@ acpi_tb_delete_single_table ( * ******************************************************************************/ -struct acpi_table_desc * -acpi_tb_uninstall_table ( - struct acpi_table_desc *table_desc) +struct acpi_table_desc *acpi_tb_uninstall_table(struct acpi_table_desc + *table_desc) { - struct acpi_table_desc *next_desc; - - - ACPI_FUNCTION_TRACE_PTR ("tb_uninstall_table", table_desc); + struct acpi_table_desc *next_desc; + ACPI_FUNCTION_TRACE_PTR("tb_uninstall_table", table_desc); if (!table_desc) { - return_PTR (NULL); + return_PTR(NULL); } /* Unlink the descriptor from the doubly linked list */ if (table_desc->prev) { table_desc->prev->next = table_desc->next; - } - else { + } else { /* Is first on list, update list head */ acpi_gbl_table_lists[table_desc->type].next = table_desc->next; @@ -565,16 +525,14 @@ acpi_tb_uninstall_table ( /* Free the memory allocated for the table itself */ - acpi_tb_delete_single_table (table_desc); + acpi_tb_delete_single_table(table_desc); /* Free the table descriptor */ next_desc = table_desc->next; - ACPI_MEM_FREE (table_desc); + ACPI_MEM_FREE(table_desc); /* Return pointer to the next descriptor */ - return_PTR (next_desc); + return_PTR(next_desc); } - - diff --git a/drivers/acpi/tables/tbrsdt.c b/drivers/acpi/tables/tbrsdt.c index 069d498465d..ad0252c2f7d 100644 --- a/drivers/acpi/tables/tbrsdt.c +++ b/drivers/acpi/tables/tbrsdt.c @@ -41,14 +41,11 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include #include - #define _COMPONENT ACPI_TABLES - ACPI_MODULE_NAME ("tbrsdt") - +ACPI_MODULE_NAME("tbrsdt") /******************************************************************************* * @@ -61,18 +58,13 @@ * DESCRIPTION: Load and validate the RSDP (ptr) and RSDT (table) * ******************************************************************************/ - -acpi_status -acpi_tb_verify_rsdp ( - struct acpi_pointer *address) +acpi_status acpi_tb_verify_rsdp(struct acpi_pointer *address) { - struct acpi_table_desc table_info; - acpi_status status; - struct rsdp_descriptor *rsdp; - - - ACPI_FUNCTION_TRACE ("tb_verify_rsdp"); + struct acpi_table_desc table_info; + acpi_status status; + struct rsdp_descriptor *rsdp; + ACPI_FUNCTION_TRACE("tb_verify_rsdp"); switch (address->pointer_type) { case ACPI_LOGICAL_POINTER: @@ -84,54 +76,53 @@ acpi_tb_verify_rsdp ( /* * Obtain access to the RSDP structure */ - status = acpi_os_map_memory (address->pointer.physical, - sizeof (struct rsdp_descriptor), - (void *) &rsdp); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_os_map_memory(address->pointer.physical, + sizeof(struct rsdp_descriptor), + (void *)&rsdp); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } break; default: - return_ACPI_STATUS (AE_BAD_PARAMETER); + return_ACPI_STATUS(AE_BAD_PARAMETER); } /* Verify RSDP signature and checksum */ - status = acpi_tb_validate_rsdp (rsdp); - if (ACPI_FAILURE (status)) { + status = acpi_tb_validate_rsdp(rsdp); + if (ACPI_FAILURE(status)) { goto cleanup; } /* The RSDP supplied is OK */ - table_info.pointer = ACPI_CAST_PTR (struct acpi_table_header, rsdp); - table_info.length = sizeof (struct rsdp_descriptor); - table_info.allocation = ACPI_MEM_MAPPED; + table_info.pointer = ACPI_CAST_PTR(struct acpi_table_header, rsdp); + table_info.length = sizeof(struct rsdp_descriptor); + table_info.allocation = ACPI_MEM_MAPPED; /* Save the table pointers and allocation info */ - status = acpi_tb_init_table_descriptor (ACPI_TABLE_RSDP, &table_info); - if (ACPI_FAILURE (status)) { + status = acpi_tb_init_table_descriptor(ACPI_TABLE_RSDP, &table_info); + if (ACPI_FAILURE(status)) { goto cleanup; } /* Save the RSDP in a global for easy access */ - acpi_gbl_RSDP = ACPI_CAST_PTR (struct rsdp_descriptor, table_info.pointer); - return_ACPI_STATUS (status); - + acpi_gbl_RSDP = + ACPI_CAST_PTR(struct rsdp_descriptor, table_info.pointer); + return_ACPI_STATUS(status); /* Error exit */ -cleanup: + cleanup: if (acpi_gbl_table_flags & ACPI_PHYSICAL_POINTER) { - acpi_os_unmap_memory (rsdp, sizeof (struct rsdp_descriptor)); + acpi_os_unmap_memory(rsdp, sizeof(struct rsdp_descriptor)); } - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_tb_get_rsdt_address @@ -145,33 +136,30 @@ cleanup: * ******************************************************************************/ -void -acpi_tb_get_rsdt_address ( - struct acpi_pointer *out_address) +void acpi_tb_get_rsdt_address(struct acpi_pointer *out_address) { - ACPI_FUNCTION_ENTRY (); - + ACPI_FUNCTION_ENTRY(); - out_address->pointer_type = acpi_gbl_table_flags | ACPI_LOGICAL_ADDRESSING; + out_address->pointer_type = + acpi_gbl_table_flags | ACPI_LOGICAL_ADDRESSING; /* Use XSDT if it is present */ if ((acpi_gbl_RSDP->revision >= 2) && - acpi_gbl_RSDP->xsdt_physical_address) { + acpi_gbl_RSDP->xsdt_physical_address) { out_address->pointer.value = - acpi_gbl_RSDP->xsdt_physical_address; + acpi_gbl_RSDP->xsdt_physical_address; acpi_gbl_root_table_type = ACPI_TABLE_TYPE_XSDT; - } - else { + } else { /* No XSDT, use the RSDT */ - out_address->pointer.value = acpi_gbl_RSDP->rsdt_physical_address; + out_address->pointer.value = + acpi_gbl_RSDP->rsdt_physical_address; acpi_gbl_root_table_type = ACPI_TABLE_TYPE_RSDT; } } - /******************************************************************************* * * FUNCTION: acpi_tb_validate_rsdt @@ -184,49 +172,43 @@ acpi_tb_get_rsdt_address ( * ******************************************************************************/ -acpi_status -acpi_tb_validate_rsdt ( - struct acpi_table_header *table_ptr) +acpi_status acpi_tb_validate_rsdt(struct acpi_table_header *table_ptr) { - int no_match; - - - ACPI_FUNCTION_NAME ("tb_validate_rsdt"); + int no_match; + ACPI_FUNCTION_NAME("tb_validate_rsdt"); /* * Search for appropriate signature, RSDT or XSDT */ if (acpi_gbl_root_table_type == ACPI_TABLE_TYPE_RSDT) { - no_match = ACPI_STRNCMP ((char *) table_ptr, RSDT_SIG, - sizeof (RSDT_SIG) -1); - } - else { - no_match = ACPI_STRNCMP ((char *) table_ptr, XSDT_SIG, - sizeof (XSDT_SIG) -1); + no_match = ACPI_STRNCMP((char *)table_ptr, RSDT_SIG, + sizeof(RSDT_SIG) - 1); + } else { + no_match = ACPI_STRNCMP((char *)table_ptr, XSDT_SIG, + sizeof(XSDT_SIG) - 1); } if (no_match) { /* Invalid RSDT or XSDT signature */ - ACPI_REPORT_ERROR (( - "Invalid signature where RSDP indicates RSDT/XSDT should be located\n")); + ACPI_REPORT_ERROR(("Invalid signature where RSDP indicates RSDT/XSDT should be located\n")); - ACPI_DUMP_BUFFER (acpi_gbl_RSDP, 20); + ACPI_DUMP_BUFFER(acpi_gbl_RSDP, 20); - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_ERROR, - "RSDT/XSDT signature at %X (%p) is invalid\n", - acpi_gbl_RSDP->rsdt_physical_address, - (void *) (acpi_native_uint) acpi_gbl_RSDP->rsdt_physical_address)); + ACPI_DEBUG_PRINT_RAW((ACPI_DB_ERROR, + "RSDT/XSDT signature at %X (%p) is invalid\n", + acpi_gbl_RSDP->rsdt_physical_address, + (void *)(acpi_native_uint) acpi_gbl_RSDP-> + rsdt_physical_address)); if (acpi_gbl_root_table_type == ACPI_TABLE_TYPE_RSDT) { - ACPI_REPORT_ERROR (("Looking for RSDT\n")) - } - else { - ACPI_REPORT_ERROR (("Looking for XSDT\n")) + ACPI_REPORT_ERROR(("Looking for RSDT\n")) + } else { + ACPI_REPORT_ERROR(("Looking for XSDT\n")) } - ACPI_DUMP_BUFFER ((char *) table_ptr, 48); + ACPI_DUMP_BUFFER((char *)table_ptr, 48); return (AE_BAD_SIGNATURE); } @@ -234,7 +216,6 @@ acpi_tb_validate_rsdt ( return (AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_tb_get_table_rsdt @@ -247,66 +228,61 @@ acpi_tb_validate_rsdt ( * ******************************************************************************/ -acpi_status -acpi_tb_get_table_rsdt ( - void) +acpi_status acpi_tb_get_table_rsdt(void) { - struct acpi_table_desc table_info; - acpi_status status; - struct acpi_pointer address; - - - ACPI_FUNCTION_TRACE ("tb_get_table_rsdt"); + struct acpi_table_desc table_info; + acpi_status status; + struct acpi_pointer address; + ACPI_FUNCTION_TRACE("tb_get_table_rsdt"); /* Get the RSDT/XSDT via the RSDP */ - acpi_tb_get_rsdt_address (&address); + acpi_tb_get_rsdt_address(&address); table_info.type = ACPI_TABLE_XSDT; - status = acpi_tb_get_table (&address, &table_info); - if (ACPI_FAILURE (status)) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not get the RSDT/XSDT, %s\n", - acpi_format_exception (status))); + status = acpi_tb_get_table(&address, &table_info); + if (ACPI_FAILURE(status)) { + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Could not get the RSDT/XSDT, %s\n", + acpi_format_exception(status))); - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "RSDP located at %p, points to RSDT physical=%8.8X%8.8X \n", - acpi_gbl_RSDP, - ACPI_FORMAT_UINT64 (address.pointer.value))); + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "RSDP located at %p, points to RSDT physical=%8.8X%8.8X \n", + acpi_gbl_RSDP, + ACPI_FORMAT_UINT64(address.pointer.value))); /* Check the RSDT or XSDT signature */ - status = acpi_tb_validate_rsdt (table_info.pointer); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_tb_validate_rsdt(table_info.pointer); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* Get the number of tables defined in the RSDT or XSDT */ - acpi_gbl_rsdt_table_count = acpi_tb_get_table_count (acpi_gbl_RSDP, - table_info.pointer); + acpi_gbl_rsdt_table_count = acpi_tb_get_table_count(acpi_gbl_RSDP, + table_info.pointer); /* Convert and/or copy to an XSDT structure */ - status = acpi_tb_convert_to_xsdt (&table_info); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_tb_convert_to_xsdt(&table_info); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* Save the table pointers and allocation info */ - status = acpi_tb_init_table_descriptor (ACPI_TABLE_XSDT, &table_info); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_tb_init_table_descriptor(ACPI_TABLE_XSDT, &table_info); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } - acpi_gbl_XSDT = ACPI_CAST_PTR (XSDT_DESCRIPTOR, table_info.pointer); + acpi_gbl_XSDT = ACPI_CAST_PTR(XSDT_DESCRIPTOR, table_info.pointer); - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "XSDT located at %p\n", acpi_gbl_XSDT)); - return_ACPI_STATUS (status); + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "XSDT located at %p\n", acpi_gbl_XSDT)); + return_ACPI_STATUS(status); } - - diff --git a/drivers/acpi/tables/tbutils.c b/drivers/acpi/tables/tbutils.c index 6fc1e36e604..5bcafebb9dd 100644 --- a/drivers/acpi/tables/tbutils.c +++ b/drivers/acpi/tables/tbutils.c @@ -41,24 +41,18 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include #include - #define _COMPONENT ACPI_TABLES - ACPI_MODULE_NAME ("tbutils") +ACPI_MODULE_NAME("tbutils") /* Local prototypes */ - #ifdef ACPI_OBSOLETE_FUNCTIONS acpi_status -acpi_tb_handle_to_object ( - u16 table_id, - struct acpi_table_desc **table_desc); +acpi_tb_handle_to_object(u16 table_id, struct acpi_table_desc **table_desc); #endif - /******************************************************************************* * * FUNCTION: acpi_tb_is_table_installed @@ -73,15 +67,11 @@ acpi_tb_handle_to_object ( * ******************************************************************************/ -acpi_status -acpi_tb_is_table_installed ( - struct acpi_table_desc *new_table_desc) +acpi_status acpi_tb_is_table_installed(struct acpi_table_desc *new_table_desc) { - struct acpi_table_desc *table_desc; - - - ACPI_FUNCTION_TRACE ("tb_is_table_installed"); + struct acpi_table_desc *table_desc; + ACPI_FUNCTION_TRACE("tb_is_table_installed"); /* Get the list descriptor and first table descriptor */ @@ -93,22 +83,23 @@ acpi_tb_is_table_installed ( /* Compare Revision and oem_table_id */ if ((table_desc->loaded_into_namespace) && - (table_desc->pointer->revision == - new_table_desc->pointer->revision) && - (!ACPI_MEMCMP (table_desc->pointer->oem_table_id, - new_table_desc->pointer->oem_table_id, 8))) { + (table_desc->pointer->revision == + new_table_desc->pointer->revision) && + (!ACPI_MEMCMP(table_desc->pointer->oem_table_id, + new_table_desc->pointer->oem_table_id, 8))) { /* This table is already installed */ - ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, - "Table [%4.4s] already installed: Rev %X oem_table_id [%8.8s]\n", - new_table_desc->pointer->signature, - new_table_desc->pointer->revision, - new_table_desc->pointer->oem_table_id)); + ACPI_DEBUG_PRINT((ACPI_DB_TABLES, + "Table [%4.4s] already installed: Rev %X oem_table_id [%8.8s]\n", + new_table_desc->pointer->signature, + new_table_desc->pointer->revision, + new_table_desc->pointer-> + oem_table_id)); - new_table_desc->owner_id = table_desc->owner_id; + new_table_desc->owner_id = table_desc->owner_id; new_table_desc->installed_desc = table_desc; - return_ACPI_STATUS (AE_ALREADY_EXISTS); + return_ACPI_STATUS(AE_ALREADY_EXISTS); } /* Get next table on the list */ @@ -116,10 +107,9 @@ acpi_tb_is_table_installed ( table_desc = table_desc->next; } - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_tb_validate_table_header @@ -141,57 +131,55 @@ acpi_tb_is_table_installed ( ******************************************************************************/ acpi_status -acpi_tb_validate_table_header ( - struct acpi_table_header *table_header) +acpi_tb_validate_table_header(struct acpi_table_header *table_header) { - acpi_name signature; - - - ACPI_FUNCTION_NAME ("tb_validate_table_header"); + acpi_name signature; + ACPI_FUNCTION_NAME("tb_validate_table_header"); /* Verify that this is a valid address */ - if (!acpi_os_readable (table_header, sizeof (struct acpi_table_header))) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Cannot read table header at %p\n", table_header)); + if (!acpi_os_readable(table_header, sizeof(struct acpi_table_header))) { + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Cannot read table header at %p\n", + table_header)); return (AE_BAD_ADDRESS); } /* Ensure that the signature is 4 ASCII characters */ - ACPI_MOVE_32_TO_32 (&signature, table_header->signature); - if (!acpi_ut_valid_acpi_name (signature)) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Table signature at %p [%p] has invalid characters\n", - table_header, &signature)); + ACPI_MOVE_32_TO_32(&signature, table_header->signature); + if (!acpi_ut_valid_acpi_name(signature)) { + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Table signature at %p [%p] has invalid characters\n", + table_header, &signature)); - ACPI_REPORT_WARNING (("Invalid table signature found: [%4.4s]\n", - (char *) &signature)); + ACPI_REPORT_WARNING(("Invalid table signature found: [%4.4s]\n", + (char *)&signature)); - ACPI_DUMP_BUFFER (table_header, sizeof (struct acpi_table_header)); + ACPI_DUMP_BUFFER(table_header, + sizeof(struct acpi_table_header)); return (AE_BAD_SIGNATURE); } /* Validate the table length */ - if (table_header->length < sizeof (struct acpi_table_header)) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Invalid length in table header %p name %4.4s\n", - table_header, (char *) &signature)); + if (table_header->length < sizeof(struct acpi_table_header)) { + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Invalid length in table header %p name %4.4s\n", + table_header, (char *)&signature)); - ACPI_REPORT_WARNING (("Invalid table header length (0x%X) found\n", - (u32) table_header->length)); + ACPI_REPORT_WARNING(("Invalid table header length (0x%X) found\n", (u32) table_header->length)); - ACPI_DUMP_BUFFER (table_header, sizeof (struct acpi_table_header)); + ACPI_DUMP_BUFFER(table_header, + sizeof(struct acpi_table_header)); return (AE_BAD_HEADER); } return (AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_tb_verify_table_checksum @@ -206,34 +194,28 @@ acpi_tb_validate_table_header ( ******************************************************************************/ acpi_status -acpi_tb_verify_table_checksum ( - struct acpi_table_header *table_header) +acpi_tb_verify_table_checksum(struct acpi_table_header * table_header) { - u8 checksum; - acpi_status status = AE_OK; - - - ACPI_FUNCTION_TRACE ("tb_verify_table_checksum"); + u8 checksum; + acpi_status status = AE_OK; + ACPI_FUNCTION_TRACE("tb_verify_table_checksum"); /* Compute the checksum on the table */ - checksum = acpi_tb_generate_checksum (table_header, table_header->length); + checksum = + acpi_tb_generate_checksum(table_header, table_header->length); /* Return the appropriate exception */ if (checksum) { - ACPI_REPORT_WARNING (( - "Invalid checksum in table [%4.4s] (%02X, sum %02X is not zero)\n", - table_header->signature, (u32) table_header->checksum, - (u32) checksum)); + ACPI_REPORT_WARNING(("Invalid checksum in table [%4.4s] (%02X, sum %02X is not zero)\n", table_header->signature, (u32) table_header->checksum, (u32) checksum)); status = AE_BAD_CHECKSUM; } - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_tb_generate_checksum @@ -247,15 +229,11 @@ acpi_tb_verify_table_checksum ( * ******************************************************************************/ -u8 -acpi_tb_generate_checksum ( - void *buffer, - u32 length) +u8 acpi_tb_generate_checksum(void *buffer, u32 length) { - const u8 *limit; - const u8 *rover; - u8 sum = 0; - + const u8 *limit; + const u8 *rover; + u8 sum = 0; if (buffer && length) { /* Buffer and Length are valid */ @@ -269,7 +247,6 @@ acpi_tb_generate_checksum ( return (sum); } - #ifdef ACPI_OBSOLETE_FUNCTIONS /******************************************************************************* * @@ -285,16 +262,13 @@ acpi_tb_generate_checksum ( ******************************************************************************/ acpi_status -acpi_tb_handle_to_object ( - u16 table_id, - struct acpi_table_desc **return_table_desc) +acpi_tb_handle_to_object(u16 table_id, + struct acpi_table_desc ** return_table_desc) { - u32 i; - struct acpi_table_desc *table_desc; - - - ACPI_FUNCTION_NAME ("tb_handle_to_object"); + u32 i; + struct acpi_table_desc *table_desc; + ACPI_FUNCTION_NAME("tb_handle_to_object"); for (i = 0; i < ACPI_TABLE_MAX; i++) { table_desc = acpi_gbl_table_lists[i].next; @@ -308,9 +282,8 @@ acpi_tb_handle_to_object ( } } - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "table_id=%X does not exist\n", table_id)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "table_id=%X does not exist\n", + table_id)); return (AE_BAD_PARAMETER); } #endif - - diff --git a/drivers/acpi/tables/tbxface.c b/drivers/acpi/tables/tbxface.c index e18a05d1b9b..3f96a4909aa 100644 --- a/drivers/acpi/tables/tbxface.c +++ b/drivers/acpi/tables/tbxface.c @@ -48,10 +48,8 @@ #include #include - #define _COMPONENT ACPI_TABLES - ACPI_MODULE_NAME ("tbxface") - +ACPI_MODULE_NAME("tbxface") /******************************************************************************* * @@ -65,25 +63,20 @@ * provided RSDT * ******************************************************************************/ - -acpi_status -acpi_load_tables ( - void) +acpi_status acpi_load_tables(void) { - struct acpi_pointer rsdp_address; - acpi_status status; - - - ACPI_FUNCTION_TRACE ("acpi_load_tables"); + struct acpi_pointer rsdp_address; + acpi_status status; + ACPI_FUNCTION_TRACE("acpi_load_tables"); /* Get the RSDP */ - status = acpi_os_get_root_pointer (ACPI_LOGICAL_ADDRESSING, - &rsdp_address); - if (ACPI_FAILURE (status)) { - ACPI_REPORT_ERROR (("acpi_load_tables: Could not get RSDP, %s\n", - acpi_format_exception (status))); + status = acpi_os_get_root_pointer(ACPI_LOGICAL_ADDRESSING, + &rsdp_address); + if (ACPI_FAILURE(status)) { + ACPI_REPORT_ERROR(("acpi_load_tables: Could not get RSDP, %s\n", + acpi_format_exception(status))); goto error_exit; } @@ -91,54 +84,47 @@ acpi_load_tables ( acpi_gbl_table_flags = rsdp_address.pointer_type; - status = acpi_tb_verify_rsdp (&rsdp_address); - if (ACPI_FAILURE (status)) { - ACPI_REPORT_ERROR (("acpi_load_tables: RSDP Failed validation: %s\n", - acpi_format_exception (status))); + status = acpi_tb_verify_rsdp(&rsdp_address); + if (ACPI_FAILURE(status)) { + ACPI_REPORT_ERROR(("acpi_load_tables: RSDP Failed validation: %s\n", acpi_format_exception(status))); goto error_exit; } /* Get the RSDT via the RSDP */ - status = acpi_tb_get_table_rsdt (); - if (ACPI_FAILURE (status)) { - ACPI_REPORT_ERROR (("acpi_load_tables: Could not load RSDT: %s\n", - acpi_format_exception (status))); + status = acpi_tb_get_table_rsdt(); + if (ACPI_FAILURE(status)) { + ACPI_REPORT_ERROR(("acpi_load_tables: Could not load RSDT: %s\n", acpi_format_exception(status))); goto error_exit; } /* Now get the tables needed by this subsystem (FADT, DSDT, etc.) */ - status = acpi_tb_get_required_tables (); - if (ACPI_FAILURE (status)) { - ACPI_REPORT_ERROR (( - "acpi_load_tables: Error getting required tables (DSDT/FADT/FACS): %s\n", - acpi_format_exception (status))); + status = acpi_tb_get_required_tables(); + if (ACPI_FAILURE(status)) { + ACPI_REPORT_ERROR(("acpi_load_tables: Error getting required tables (DSDT/FADT/FACS): %s\n", acpi_format_exception(status))); goto error_exit; } - ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "ACPI Tables successfully acquired\n")); + ACPI_DEBUG_PRINT((ACPI_DB_INIT, "ACPI Tables successfully acquired\n")); /* Load the namespace from the tables */ - status = acpi_ns_load_namespace (); - if (ACPI_FAILURE (status)) { - ACPI_REPORT_ERROR (("acpi_load_tables: Could not load namespace: %s\n", - acpi_format_exception (status))); + status = acpi_ns_load_namespace(); + if (ACPI_FAILURE(status)) { + ACPI_REPORT_ERROR(("acpi_load_tables: Could not load namespace: %s\n", acpi_format_exception(status))); goto error_exit; } - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); + error_exit: + ACPI_REPORT_ERROR(("acpi_load_tables: Could not load tables: %s\n", + acpi_format_exception(status))); -error_exit: - ACPI_REPORT_ERROR (("acpi_load_tables: Could not load tables: %s\n", - acpi_format_exception (status))); - - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - #ifdef ACPI_FUTURE_USAGE /******************************************************************************* * @@ -156,43 +142,39 @@ error_exit: * ******************************************************************************/ -acpi_status -acpi_load_table ( - struct acpi_table_header *table_ptr) +acpi_status acpi_load_table(struct acpi_table_header *table_ptr) { - acpi_status status; - struct acpi_table_desc table_info; - struct acpi_pointer address; - - - ACPI_FUNCTION_TRACE ("acpi_load_table"); + acpi_status status; + struct acpi_table_desc table_info; + struct acpi_pointer address; + ACPI_FUNCTION_TRACE("acpi_load_table"); if (!table_ptr) { - return_ACPI_STATUS (AE_BAD_PARAMETER); + return_ACPI_STATUS(AE_BAD_PARAMETER); } /* Copy the table to a local buffer */ - address.pointer_type = ACPI_LOGICAL_POINTER | ACPI_LOGICAL_ADDRESSING; + address.pointer_type = ACPI_LOGICAL_POINTER | ACPI_LOGICAL_ADDRESSING; address.pointer.logical = table_ptr; - status = acpi_tb_get_table_body (&address, table_ptr, &table_info); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_tb_get_table_body(&address, table_ptr, &table_info); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* Check signature for a valid table type */ - status = acpi_tb_recognize_table (&table_info, ACPI_TABLE_ALL); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_tb_recognize_table(&table_info, ACPI_TABLE_ALL); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* Install the new table into the local data structures */ - status = acpi_tb_install_table (&table_info); - if (ACPI_FAILURE (status)) { + status = acpi_tb_install_table(&table_info); + if (ACPI_FAILURE(status)) { if (status == AE_ALREADY_EXISTS) { /* Table already exists, no error */ @@ -201,8 +183,8 @@ acpi_load_table ( /* Free table allocated by acpi_tb_get_table_body */ - acpi_tb_delete_single_table (&table_info); - return_ACPI_STATUS (status); + acpi_tb_delete_single_table(&table_info); + return_ACPI_STATUS(status); } /* Convert the table to common format if necessary */ @@ -210,31 +192,32 @@ acpi_load_table ( switch (table_info.type) { case ACPI_TABLE_FADT: - status = acpi_tb_convert_table_fadt (); + status = acpi_tb_convert_table_fadt(); break; case ACPI_TABLE_FACS: - status = acpi_tb_build_common_facs (&table_info); + status = acpi_tb_build_common_facs(&table_info); break; default: /* Load table into namespace if it contains executable AML */ - status = acpi_ns_load_table (table_info.installed_desc, acpi_gbl_root_node); + status = + acpi_ns_load_table(table_info.installed_desc, + acpi_gbl_root_node); break; } - if (ACPI_FAILURE (status)) { + if (ACPI_FAILURE(status)) { /* Uninstall table and free the buffer */ - (void) acpi_tb_uninstall_table (table_info.installed_desc); + (void)acpi_tb_uninstall_table(table_info.installed_desc); } - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_unload_table @@ -247,20 +230,16 @@ acpi_load_table ( * ******************************************************************************/ -acpi_status -acpi_unload_table ( - acpi_table_type table_type) +acpi_status acpi_unload_table(acpi_table_type table_type) { - struct acpi_table_desc *table_desc; - - - ACPI_FUNCTION_TRACE ("acpi_unload_table"); + struct acpi_table_desc *table_desc; + ACPI_FUNCTION_TRACE("acpi_unload_table"); /* Parameter validation */ if (table_type > ACPI_TABLE_MAX) { - return_ACPI_STATUS (AE_BAD_PARAMETER); + return_ACPI_STATUS(AE_BAD_PARAMETER); } /* Find all tables of the requested type */ @@ -273,18 +252,17 @@ acpi_unload_table ( * "Scope" operator. Thus, we need to track ownership by an ID, not * simply a position within the hierarchy */ - acpi_ns_delete_namespace_by_owner (table_desc->owner_id); - acpi_ut_release_owner_id (&table_desc->owner_id); + acpi_ns_delete_namespace_by_owner(table_desc->owner_id); + acpi_ut_release_owner_id(&table_desc->owner_id); table_desc = table_desc->next; } /* Delete (or unmap) all tables of this type */ - acpi_tb_delete_tables_by_type (table_type); - return_ACPI_STATUS (AE_OK); + acpi_tb_delete_tables_by_type(table_type); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_get_table_header @@ -307,54 +285,49 @@ acpi_unload_table ( ******************************************************************************/ acpi_status -acpi_get_table_header ( - acpi_table_type table_type, - u32 instance, - struct acpi_table_header *out_table_header) +acpi_get_table_header(acpi_table_type table_type, + u32 instance, struct acpi_table_header *out_table_header) { - struct acpi_table_header *tbl_ptr; - acpi_status status; - - - ACPI_FUNCTION_TRACE ("acpi_get_table_header"); + struct acpi_table_header *tbl_ptr; + acpi_status status; + ACPI_FUNCTION_TRACE("acpi_get_table_header"); - if ((instance == 0) || - (table_type == ACPI_TABLE_RSDP) || - (!out_table_header)) { - return_ACPI_STATUS (AE_BAD_PARAMETER); + if ((instance == 0) || + (table_type == ACPI_TABLE_RSDP) || (!out_table_header)) { + return_ACPI_STATUS(AE_BAD_PARAMETER); } /* Check the table type and instance */ - if ((table_type > ACPI_TABLE_MAX) || - (ACPI_IS_SINGLE_TABLE (acpi_gbl_table_data[table_type].flags) && - instance > 1)) { - return_ACPI_STATUS (AE_BAD_PARAMETER); + if ((table_type > ACPI_TABLE_MAX) || + (ACPI_IS_SINGLE_TABLE(acpi_gbl_table_data[table_type].flags) && + instance > 1)) { + return_ACPI_STATUS(AE_BAD_PARAMETER); } /* Get a pointer to the entire table */ - status = acpi_tb_get_table_ptr (table_type, instance, &tbl_ptr); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_tb_get_table_ptr(table_type, instance, &tbl_ptr); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* The function will return a NULL pointer if the table is not loaded */ if (tbl_ptr == NULL) { - return_ACPI_STATUS (AE_NOT_EXIST); + return_ACPI_STATUS(AE_NOT_EXIST); } /* Copy the header to the caller's buffer */ - ACPI_MEMCPY ((void *) out_table_header, (void *) tbl_ptr, - sizeof (struct acpi_table_header)); + ACPI_MEMCPY((void *)out_table_header, (void *)tbl_ptr, + sizeof(struct acpi_table_header)); - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } -#endif /* ACPI_FUTURE_USAGE */ +#endif /* ACPI_FUTURE_USAGE */ /******************************************************************************* * @@ -380,43 +353,39 @@ acpi_get_table_header ( ******************************************************************************/ acpi_status -acpi_get_table ( - acpi_table_type table_type, - u32 instance, - struct acpi_buffer *ret_buffer) +acpi_get_table(acpi_table_type table_type, + u32 instance, struct acpi_buffer *ret_buffer) { - struct acpi_table_header *tbl_ptr; - acpi_status status; - acpi_size table_length; - - - ACPI_FUNCTION_TRACE ("acpi_get_table"); + struct acpi_table_header *tbl_ptr; + acpi_status status; + acpi_size table_length; + ACPI_FUNCTION_TRACE("acpi_get_table"); /* Parameter validation */ if (instance == 0) { - return_ACPI_STATUS (AE_BAD_PARAMETER); + return_ACPI_STATUS(AE_BAD_PARAMETER); } - status = acpi_ut_validate_buffer (ret_buffer); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ut_validate_buffer(ret_buffer); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* Check the table type and instance */ - if ((table_type > ACPI_TABLE_MAX) || - (ACPI_IS_SINGLE_TABLE (acpi_gbl_table_data[table_type].flags) && - instance > 1)) { - return_ACPI_STATUS (AE_BAD_PARAMETER); + if ((table_type > ACPI_TABLE_MAX) || + (ACPI_IS_SINGLE_TABLE(acpi_gbl_table_data[table_type].flags) && + instance > 1)) { + return_ACPI_STATUS(AE_BAD_PARAMETER); } /* Get a pointer to the entire table */ - status = acpi_tb_get_table_ptr (table_type, instance, &tbl_ptr); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_tb_get_table_ptr(table_type, instance, &tbl_ptr); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* @@ -424,7 +393,7 @@ acpi_get_table ( * table is not loaded. */ if (tbl_ptr == NULL) { - return_ACPI_STATUS (AE_NOT_EXIST); + return_ACPI_STATUS(AE_NOT_EXIST); } /* Get the table length */ @@ -432,23 +401,22 @@ acpi_get_table ( if (table_type == ACPI_TABLE_RSDP) { /* RSD PTR is the only "table" without a header */ - table_length = sizeof (struct rsdp_descriptor); - } - else { + table_length = sizeof(struct rsdp_descriptor); + } else { table_length = (acpi_size) tbl_ptr->length; } /* Validate/Allocate/Clear caller buffer */ - status = acpi_ut_initialize_buffer (ret_buffer, table_length); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ut_initialize_buffer(ret_buffer, table_length); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* Copy the table to the buffer */ - ACPI_MEMCPY ((void *) ret_buffer->pointer, (void *) tbl_ptr, table_length); - return_ACPI_STATUS (AE_OK); + ACPI_MEMCPY((void *)ret_buffer->pointer, (void *)tbl_ptr, table_length); + return_ACPI_STATUS(AE_OK); } -EXPORT_SYMBOL(acpi_get_table); +EXPORT_SYMBOL(acpi_get_table); diff --git a/drivers/acpi/tables/tbxfroot.c b/drivers/acpi/tables/tbxfroot.c index 87dccdda9ae..3b8a7e063e8 100644 --- a/drivers/acpi/tables/tbxfroot.c +++ b/drivers/acpi/tables/tbxfroot.c @@ -46,22 +46,14 @@ #include #include - #define _COMPONENT ACPI_TABLES - ACPI_MODULE_NAME ("tbxfroot") +ACPI_MODULE_NAME("tbxfroot") /* Local prototypes */ - static acpi_status -acpi_tb_find_rsdp ( - struct acpi_table_desc *table_info, - u32 flags); - -static u8 * -acpi_tb_scan_memory_for_rsdp ( - u8 *start_address, - u32 length); +acpi_tb_find_rsdp(struct acpi_table_desc *table_info, u32 flags); +static u8 *acpi_tb_scan_memory_for_rsdp(u8 * start_address, u32 length); /******************************************************************************* * @@ -75,17 +67,14 @@ acpi_tb_scan_memory_for_rsdp ( * ******************************************************************************/ -acpi_status -acpi_tb_validate_rsdp ( - struct rsdp_descriptor *rsdp) +acpi_status acpi_tb_validate_rsdp(struct rsdp_descriptor *rsdp) { - ACPI_FUNCTION_ENTRY (); - + ACPI_FUNCTION_ENTRY(); /* * The signature and checksum must both be correct */ - if (ACPI_STRNCMP ((char *) rsdp, RSDP_SIG, sizeof (RSDP_SIG)-1) != 0) { + if (ACPI_STRNCMP((char *)rsdp, RSDP_SIG, sizeof(RSDP_SIG) - 1) != 0) { /* Nope, BAD Signature */ return (AE_BAD_SIGNATURE); @@ -93,21 +82,21 @@ acpi_tb_validate_rsdp ( /* Check the standard checksum */ - if (acpi_tb_generate_checksum (rsdp, ACPI_RSDP_CHECKSUM_LENGTH) != 0) { + if (acpi_tb_generate_checksum(rsdp, ACPI_RSDP_CHECKSUM_LENGTH) != 0) { return (AE_BAD_CHECKSUM); } /* Check extended checksum if table version >= 2 */ if ((rsdp->revision >= 2) && - (acpi_tb_generate_checksum (rsdp, ACPI_RSDP_XCHECKSUM_LENGTH) != 0)) { + (acpi_tb_generate_checksum(rsdp, ACPI_RSDP_XCHECKSUM_LENGTH) != + 0)) { return (AE_BAD_CHECKSUM); } return (AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_tb_find_table @@ -125,28 +114,24 @@ acpi_tb_validate_rsdp ( ******************************************************************************/ acpi_status -acpi_tb_find_table ( - char *signature, - char *oem_id, - char *oem_table_id, - struct acpi_table_header **table_ptr) +acpi_tb_find_table(char *signature, + char *oem_id, + char *oem_table_id, struct acpi_table_header ** table_ptr) { - acpi_status status; - struct acpi_table_header *table; - - - ACPI_FUNCTION_TRACE ("tb_find_table"); + acpi_status status; + struct acpi_table_header *table; + ACPI_FUNCTION_TRACE("tb_find_table"); /* Validate string lengths */ - if ((ACPI_STRLEN (signature) > ACPI_NAME_SIZE) || - (ACPI_STRLEN (oem_id) > sizeof (table->oem_id)) || - (ACPI_STRLEN (oem_table_id) > sizeof (table->oem_table_id))) { - return_ACPI_STATUS (AE_AML_STRING_LIMIT); + if ((ACPI_STRLEN(signature) > ACPI_NAME_SIZE) || + (ACPI_STRLEN(oem_id) > sizeof(table->oem_id)) || + (ACPI_STRLEN(oem_table_id) > sizeof(table->oem_table_id))) { + return_ACPI_STATUS(AE_AML_STRING_LIMIT); } - if (!ACPI_STRNCMP (signature, DSDT_SIG, ACPI_NAME_SIZE)) { + if (!ACPI_STRNCMP(signature, DSDT_SIG, ACPI_NAME_SIZE)) { /* * The DSDT pointer is contained in the FADT, not the RSDT. * This code should suffice, because the only code that would perform @@ -155,40 +140,36 @@ acpi_tb_find_table ( * If this becomes insufficient, the FADT will have to be found first. */ if (!acpi_gbl_DSDT) { - return_ACPI_STATUS (AE_NO_ACPI_TABLES); + return_ACPI_STATUS(AE_NO_ACPI_TABLES); } table = acpi_gbl_DSDT; - } - else { + } else { /* Find the table */ - status = acpi_get_firmware_table (signature, 1, - ACPI_LOGICAL_ADDRESSING, &table); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_get_firmware_table(signature, 1, + ACPI_LOGICAL_ADDRESSING, + &table); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } } /* Check oem_id and oem_table_id */ - if ((oem_id[0] && ACPI_STRNCMP ( - oem_id, table->oem_id, - sizeof (table->oem_id))) || - - (oem_table_id[0] && ACPI_STRNCMP ( - oem_table_id, table->oem_table_id, - sizeof (table->oem_table_id)))) { - return_ACPI_STATUS (AE_AML_NAME_NOT_FOUND); + if ((oem_id[0] && ACPI_STRNCMP(oem_id, table->oem_id, + sizeof(table->oem_id))) || + (oem_table_id[0] && ACPI_STRNCMP(oem_table_id, table->oem_table_id, + sizeof(table->oem_table_id)))) { + return_ACPI_STATUS(AE_AML_NAME_NOT_FOUND); } - ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "Found table [%4.4s]\n", - table->signature)); + ACPI_DEBUG_PRINT((ACPI_DB_TABLES, "Found table [%4.4s]\n", + table->signature)); *table_ptr = table; - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_get_firmware_table @@ -209,34 +190,28 @@ acpi_tb_find_table ( ******************************************************************************/ acpi_status -acpi_get_firmware_table ( - acpi_string signature, - u32 instance, - u32 flags, - struct acpi_table_header **table_pointer) +acpi_get_firmware_table(acpi_string signature, + u32 instance, + u32 flags, struct acpi_table_header **table_pointer) { - acpi_status status; - struct acpi_pointer address; - struct acpi_table_header *header = NULL; - struct acpi_table_desc *table_info = NULL; - struct acpi_table_desc *rsdt_info; - u32 table_count; - u32 i; - u32 j; - - - ACPI_FUNCTION_TRACE ("acpi_get_firmware_table"); + acpi_status status; + struct acpi_pointer address; + struct acpi_table_header *header = NULL; + struct acpi_table_desc *table_info = NULL; + struct acpi_table_desc *rsdt_info; + u32 table_count; + u32 i; + u32 j; + ACPI_FUNCTION_TRACE("acpi_get_firmware_table"); /* * Ensure that at least the table manager is initialized. We don't * require that the entire ACPI subsystem is up for this interface. * If we have a buffer, we must have a length too */ - if ((instance == 0) || - (!signature) || - (!table_pointer)) { - return_ACPI_STATUS (AE_BAD_PARAMETER); + if ((instance == 0) || (!signature) || (!table_pointer)) { + return_ACPI_STATUS(AE_BAD_PARAMETER); } /* Ensure that we have a RSDP */ @@ -244,40 +219,41 @@ acpi_get_firmware_table ( if (!acpi_gbl_RSDP) { /* Get the RSDP */ - status = acpi_os_get_root_pointer (flags, &address); - if (ACPI_FAILURE (status)) { - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "RSDP not found\n")); - return_ACPI_STATUS (AE_NO_ACPI_TABLES); + status = acpi_os_get_root_pointer(flags, &address); + if (ACPI_FAILURE(status)) { + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "RSDP not found\n")); + return_ACPI_STATUS(AE_NO_ACPI_TABLES); } /* Map and validate the RSDP */ if ((flags & ACPI_MEMORY_MODE) == ACPI_LOGICAL_ADDRESSING) { - status = acpi_os_map_memory (address.pointer.physical, - sizeof (struct rsdp_descriptor), (void *) &acpi_gbl_RSDP); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_os_map_memory(address.pointer.physical, + sizeof(struct + rsdp_descriptor), + (void *)&acpi_gbl_RSDP); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } - } - else { + } else { acpi_gbl_RSDP = address.pointer.logical; } /* The RDSP signature and checksum must both be correct */ - status = acpi_tb_validate_rsdp (acpi_gbl_RSDP); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_tb_validate_rsdp(acpi_gbl_RSDP); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } } /* Get the RSDT address via the RSDP */ - acpi_tb_get_rsdt_address (&address); - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "RSDP located at %p, RSDT physical=%8.8X%8.8X \n", - acpi_gbl_RSDP, - ACPI_FORMAT_UINT64 (address.pointer.value))); + acpi_tb_get_rsdt_address(&address); + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "RSDP located at %p, RSDT physical=%8.8X%8.8X \n", + acpi_gbl_RSDP, + ACPI_FORMAT_UINT64(address.pointer.value))); /* Insert processor_mode flags */ @@ -285,30 +261,30 @@ acpi_get_firmware_table ( /* Get and validate the RSDT */ - rsdt_info = ACPI_MEM_CALLOCATE (sizeof (struct acpi_table_desc)); + rsdt_info = ACPI_MEM_CALLOCATE(sizeof(struct acpi_table_desc)); if (!rsdt_info) { - return_ACPI_STATUS (AE_NO_MEMORY); + return_ACPI_STATUS(AE_NO_MEMORY); } - status = acpi_tb_get_table (&address, rsdt_info); - if (ACPI_FAILURE (status)) { + status = acpi_tb_get_table(&address, rsdt_info); + if (ACPI_FAILURE(status)) { goto cleanup; } - status = acpi_tb_validate_rsdt (rsdt_info->pointer); - if (ACPI_FAILURE (status)) { + status = acpi_tb_validate_rsdt(rsdt_info->pointer); + if (ACPI_FAILURE(status)) { goto cleanup; } /* Allocate a scratch table header and table descriptor */ - header = ACPI_MEM_ALLOCATE (sizeof (struct acpi_table_header)); + header = ACPI_MEM_ALLOCATE(sizeof(struct acpi_table_header)); if (!header) { status = AE_NO_MEMORY; goto cleanup; } - table_info = ACPI_MEM_ALLOCATE (sizeof (struct acpi_table_desc)); + table_info = ACPI_MEM_ALLOCATE(sizeof(struct acpi_table_desc)); if (!table_info) { status = AE_NO_MEMORY; goto cleanup; @@ -316,7 +292,8 @@ acpi_get_firmware_table ( /* Get the number of table pointers within the RSDT */ - table_count = acpi_tb_get_table_count (acpi_gbl_RSDP, rsdt_info->pointer); + table_count = + acpi_tb_get_table_count(acpi_gbl_RSDP, rsdt_info->pointer); address.pointer_type = acpi_gbl_table_flags | flags; /* @@ -329,32 +306,37 @@ acpi_get_firmware_table ( * RSDT pointers are 32 bits, XSDT pointers are 64 bits */ if (acpi_gbl_root_table_type == ACPI_TABLE_TYPE_RSDT) { - address.pointer.value = (ACPI_CAST_PTR ( - RSDT_DESCRIPTOR, rsdt_info->pointer))->table_offset_entry[i]; - } - else { - address.pointer.value = (ACPI_CAST_PTR ( - XSDT_DESCRIPTOR, rsdt_info->pointer))->table_offset_entry[i]; + address.pointer.value = + (ACPI_CAST_PTR + (RSDT_DESCRIPTOR, + rsdt_info->pointer))->table_offset_entry[i]; + } else { + address.pointer.value = + (ACPI_CAST_PTR + (XSDT_DESCRIPTOR, + rsdt_info->pointer))->table_offset_entry[i]; } /* Get the table header */ - status = acpi_tb_get_table_header (&address, header); - if (ACPI_FAILURE (status)) { + status = acpi_tb_get_table_header(&address, header); + if (ACPI_FAILURE(status)) { goto cleanup; } /* Compare table signatures and table instance */ - if (!ACPI_STRNCMP (header->signature, signature, ACPI_NAME_SIZE)) { + if (!ACPI_STRNCMP(header->signature, signature, ACPI_NAME_SIZE)) { /* An instance of the table was found */ j++; if (j >= instance) { /* Found the correct instance, get the entire table */ - status = acpi_tb_get_table_body (&address, header, table_info); - if (ACPI_FAILURE (status)) { + status = + acpi_tb_get_table_body(&address, header, + table_info); + if (ACPI_FAILURE(status)) { goto cleanup; } @@ -368,24 +350,23 @@ acpi_get_firmware_table ( status = AE_NOT_EXIST; - -cleanup: + cleanup: if (rsdt_info->pointer) { - acpi_os_unmap_memory (rsdt_info->pointer, - (acpi_size) rsdt_info->pointer->length); + acpi_os_unmap_memory(rsdt_info->pointer, + (acpi_size) rsdt_info->pointer->length); } - ACPI_MEM_FREE (rsdt_info); + ACPI_MEM_FREE(rsdt_info); if (header) { - ACPI_MEM_FREE (header); + ACPI_MEM_FREE(header); } if (table_info) { - ACPI_MEM_FREE (table_info); + ACPI_MEM_FREE(table_info); } - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } -EXPORT_SYMBOL(acpi_get_firmware_table); +EXPORT_SYMBOL(acpi_get_firmware_table); /* TBD: Move to a new file */ @@ -404,35 +385,29 @@ EXPORT_SYMBOL(acpi_get_firmware_table); * ******************************************************************************/ -acpi_status -acpi_find_root_pointer ( - u32 flags, - struct acpi_pointer *rsdp_address) +acpi_status acpi_find_root_pointer(u32 flags, struct acpi_pointer *rsdp_address) { - struct acpi_table_desc table_info; - acpi_status status; - - - ACPI_FUNCTION_TRACE ("acpi_find_root_pointer"); + struct acpi_table_desc table_info; + acpi_status status; + ACPI_FUNCTION_TRACE("acpi_find_root_pointer"); /* Get the RSDP */ - status = acpi_tb_find_rsdp (&table_info, flags); - if (ACPI_FAILURE (status)) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "RSDP structure not found, %s Flags=%X\n", - acpi_format_exception (status), flags)); + status = acpi_tb_find_rsdp(&table_info, flags); + if (ACPI_FAILURE(status)) { + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "RSDP structure not found, %s Flags=%X\n", + acpi_format_exception(status), flags)); - return_ACPI_STATUS (AE_NO_ACPI_TABLES); + return_ACPI_STATUS(AE_NO_ACPI_TABLES); } rsdp_address->pointer_type = ACPI_PHYSICAL_POINTER; rsdp_address->pointer.physical = table_info.physical_address; - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_tb_scan_memory_for_rsdp @@ -446,34 +421,32 @@ acpi_find_root_pointer ( * ******************************************************************************/ -static u8 * -acpi_tb_scan_memory_for_rsdp ( - u8 *start_address, - u32 length) +static u8 *acpi_tb_scan_memory_for_rsdp(u8 * start_address, u32 length) { - acpi_status status; - u8 *mem_rover; - u8 *end_address; - - - ACPI_FUNCTION_TRACE ("tb_scan_memory_for_rsdp"); + acpi_status status; + u8 *mem_rover; + u8 *end_address; + ACPI_FUNCTION_TRACE("tb_scan_memory_for_rsdp"); end_address = start_address + length; /* Search from given start address for the requested length */ for (mem_rover = start_address; mem_rover < end_address; - mem_rover += ACPI_RSDP_SCAN_STEP) { + mem_rover += ACPI_RSDP_SCAN_STEP) { /* The RSDP signature and checksum must both be correct */ - status = acpi_tb_validate_rsdp (ACPI_CAST_PTR (struct rsdp_descriptor, mem_rover)); - if (ACPI_SUCCESS (status)) { + status = + acpi_tb_validate_rsdp(ACPI_CAST_PTR + (struct rsdp_descriptor, mem_rover)); + if (ACPI_SUCCESS(status)) { /* Sig and checksum valid, we have found a real RSDP */ - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "RSDP located at physical address %p\n", mem_rover)); - return_PTR (mem_rover); + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "RSDP located at physical address %p\n", + mem_rover)); + return_PTR(mem_rover); } /* No sig match or bad checksum, keep searching */ @@ -481,13 +454,12 @@ acpi_tb_scan_memory_for_rsdp ( /* Searched entire block, no RSDP was found */ - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "Searched entire block from %p, valid RSDP was not found\n", - start_address)); - return_PTR (NULL); + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "Searched entire block from %p, valid RSDP was not found\n", + start_address)); + return_PTR(NULL); } - /******************************************************************************* * * FUNCTION: acpi_tb_find_rsdp @@ -511,18 +483,14 @@ acpi_tb_scan_memory_for_rsdp ( ******************************************************************************/ static acpi_status -acpi_tb_find_rsdp ( - struct acpi_table_desc *table_info, - u32 flags) +acpi_tb_find_rsdp(struct acpi_table_desc *table_info, u32 flags) { - u8 *table_ptr; - u8 *mem_rover; - u32 physical_address; - acpi_status status; - - - ACPI_FUNCTION_TRACE ("tb_find_rsdp"); + u8 *table_ptr; + u8 *mem_rover; + u32 physical_address; + acpi_status status; + ACPI_FUNCTION_TRACE("tb_find_rsdp"); /* * Scan supports either logical addressing or physical addressing @@ -530,23 +498,25 @@ acpi_tb_find_rsdp ( if ((flags & ACPI_MEMORY_MODE) == ACPI_LOGICAL_ADDRESSING) { /* 1a) Get the location of the Extended BIOS Data Area (EBDA) */ - status = acpi_os_map_memory ( - (acpi_physical_address) ACPI_EBDA_PTR_LOCATION, - ACPI_EBDA_PTR_LENGTH, (void *) &table_ptr); - if (ACPI_FAILURE (status)) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Could not map memory at %8.8X for length %X\n", - ACPI_EBDA_PTR_LOCATION, ACPI_EBDA_PTR_LENGTH)); - - return_ACPI_STATUS (status); + status = acpi_os_map_memory((acpi_physical_address) + ACPI_EBDA_PTR_LOCATION, + ACPI_EBDA_PTR_LENGTH, + (void *)&table_ptr); + if (ACPI_FAILURE(status)) { + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Could not map memory at %8.8X for length %X\n", + ACPI_EBDA_PTR_LOCATION, + ACPI_EBDA_PTR_LENGTH)); + + return_ACPI_STATUS(status); } - ACPI_MOVE_16_TO_32 (&physical_address, table_ptr); + ACPI_MOVE_16_TO_32(&physical_address, table_ptr); /* Convert segment part to physical address */ physical_address <<= 4; - acpi_os_unmap_memory (table_ptr, ACPI_EBDA_PTR_LENGTH); + acpi_os_unmap_memory(table_ptr, ACPI_EBDA_PTR_LENGTH); /* EBDA present? */ @@ -555,59 +525,67 @@ acpi_tb_find_rsdp ( * 1b) Search EBDA paragraphs (EBDa is required to be a * minimum of 1_k length) */ - status = acpi_os_map_memory ( - (acpi_physical_address) physical_address, - ACPI_EBDA_WINDOW_SIZE, (void *) &table_ptr); - if (ACPI_FAILURE (status)) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Could not map memory at %8.8X for length %X\n", - physical_address, ACPI_EBDA_WINDOW_SIZE)); - - return_ACPI_STATUS (status); + status = acpi_os_map_memory((acpi_physical_address) + physical_address, + ACPI_EBDA_WINDOW_SIZE, + (void *)&table_ptr); + if (ACPI_FAILURE(status)) { + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Could not map memory at %8.8X for length %X\n", + physical_address, + ACPI_EBDA_WINDOW_SIZE)); + + return_ACPI_STATUS(status); } - mem_rover = acpi_tb_scan_memory_for_rsdp (table_ptr, - ACPI_EBDA_WINDOW_SIZE); - acpi_os_unmap_memory (table_ptr, ACPI_EBDA_WINDOW_SIZE); + mem_rover = acpi_tb_scan_memory_for_rsdp(table_ptr, + ACPI_EBDA_WINDOW_SIZE); + acpi_os_unmap_memory(table_ptr, ACPI_EBDA_WINDOW_SIZE); if (mem_rover) { /* Return the physical address */ - physical_address += ACPI_PTR_DIFF (mem_rover, table_ptr); + physical_address += + ACPI_PTR_DIFF(mem_rover, table_ptr); table_info->physical_address = - (acpi_physical_address) physical_address; - return_ACPI_STATUS (AE_OK); + (acpi_physical_address) physical_address; + return_ACPI_STATUS(AE_OK); } } /* * 2) Search upper memory: 16-byte boundaries in E0000h-FFFFFh */ - status = acpi_os_map_memory ( - (acpi_physical_address) ACPI_HI_RSDP_WINDOW_BASE, - ACPI_HI_RSDP_WINDOW_SIZE, (void *) &table_ptr); - - if (ACPI_FAILURE (status)) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Could not map memory at %8.8X for length %X\n", - ACPI_HI_RSDP_WINDOW_BASE, ACPI_HI_RSDP_WINDOW_SIZE)); - - return_ACPI_STATUS (status); + status = acpi_os_map_memory((acpi_physical_address) + ACPI_HI_RSDP_WINDOW_BASE, + ACPI_HI_RSDP_WINDOW_SIZE, + (void *)&table_ptr); + + if (ACPI_FAILURE(status)) { + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Could not map memory at %8.8X for length %X\n", + ACPI_HI_RSDP_WINDOW_BASE, + ACPI_HI_RSDP_WINDOW_SIZE)); + + return_ACPI_STATUS(status); } - mem_rover = acpi_tb_scan_memory_for_rsdp (table_ptr, ACPI_HI_RSDP_WINDOW_SIZE); - acpi_os_unmap_memory (table_ptr, ACPI_HI_RSDP_WINDOW_SIZE); + mem_rover = + acpi_tb_scan_memory_for_rsdp(table_ptr, + ACPI_HI_RSDP_WINDOW_SIZE); + acpi_os_unmap_memory(table_ptr, ACPI_HI_RSDP_WINDOW_SIZE); if (mem_rover) { /* Return the physical address */ physical_address = - ACPI_HI_RSDP_WINDOW_BASE + ACPI_PTR_DIFF (mem_rover, table_ptr); + ACPI_HI_RSDP_WINDOW_BASE + ACPI_PTR_DIFF(mem_rover, + table_ptr); table_info->physical_address = - (acpi_physical_address) physical_address; - return_ACPI_STATUS (AE_OK); + (acpi_physical_address) physical_address; + return_ACPI_STATUS(AE_OK); } } @@ -617,8 +595,8 @@ acpi_tb_find_rsdp ( else { /* 1a) Get the location of the EBDA */ - ACPI_MOVE_16_TO_32 (&physical_address, ACPI_EBDA_PTR_LOCATION); - physical_address <<= 4; /* Convert segment to physical address */ + ACPI_MOVE_16_TO_32(&physical_address, ACPI_EBDA_PTR_LOCATION); + physical_address <<= 4; /* Convert segment to physical address */ /* EBDA present? */ @@ -627,35 +605,38 @@ acpi_tb_find_rsdp ( * 1b) Search EBDA paragraphs (EBDa is required to be a minimum of * 1_k length) */ - mem_rover = acpi_tb_scan_memory_for_rsdp ( - ACPI_PHYSADDR_TO_PTR (physical_address), - ACPI_EBDA_WINDOW_SIZE); + mem_rover = + acpi_tb_scan_memory_for_rsdp(ACPI_PHYSADDR_TO_PTR + (physical_address), + ACPI_EBDA_WINDOW_SIZE); if (mem_rover) { /* Return the physical address */ - table_info->physical_address = ACPI_TO_INTEGER (mem_rover); - return_ACPI_STATUS (AE_OK); + table_info->physical_address = + ACPI_TO_INTEGER(mem_rover); + return_ACPI_STATUS(AE_OK); } } /* 2) Search upper memory: 16-byte boundaries in E0000h-FFFFFh */ - mem_rover = acpi_tb_scan_memory_for_rsdp ( - ACPI_PHYSADDR_TO_PTR (ACPI_HI_RSDP_WINDOW_BASE), - ACPI_HI_RSDP_WINDOW_SIZE); + mem_rover = + acpi_tb_scan_memory_for_rsdp(ACPI_PHYSADDR_TO_PTR + (ACPI_HI_RSDP_WINDOW_BASE), + ACPI_HI_RSDP_WINDOW_SIZE); if (mem_rover) { /* Found it, return the physical address */ - table_info->physical_address = ACPI_TO_INTEGER (mem_rover); - return_ACPI_STATUS (AE_OK); + table_info->physical_address = + ACPI_TO_INTEGER(mem_rover); + return_ACPI_STATUS(AE_OK); } } /* A valid RSDP was not found */ - ACPI_REPORT_ERROR (("No valid RSDP was found\n")); - return_ACPI_STATUS (AE_NOT_FOUND); + ACPI_REPORT_ERROR(("No valid RSDP was found\n")); + return_ACPI_STATUS(AE_NOT_FOUND); } #endif - diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c index 79c3a686bc4..a24847c08f7 100644 --- a/drivers/acpi/thermal.c +++ b/drivers/acpi/thermal.c @@ -70,9 +70,9 @@ #define CELSIUS_TO_KELVIN(t) ((t+273)*10) #define _COMPONENT ACPI_THERMAL_COMPONENT -ACPI_MODULE_NAME ("acpi_thermal") +ACPI_MODULE_NAME("acpi_thermal") -MODULE_AUTHOR("Paul Diefenbaugh"); + MODULE_AUTHOR("Paul Diefenbaugh"); MODULE_DESCRIPTION(ACPI_THERMAL_DRIVER_NAME); MODULE_LICENSE("GPL"); @@ -80,143 +80,145 @@ static int tzp; module_param(tzp, int, 0); MODULE_PARM_DESC(tzp, "Thermal zone polling frequency, in 1/10 seconds.\n"); - -static int acpi_thermal_add (struct acpi_device *device); -static int acpi_thermal_remove (struct acpi_device *device, int type); +static int acpi_thermal_add(struct acpi_device *device); +static int acpi_thermal_remove(struct acpi_device *device, int type); static int acpi_thermal_state_open_fs(struct inode *inode, struct file *file); static int acpi_thermal_temp_open_fs(struct inode *inode, struct file *file); static int acpi_thermal_trip_open_fs(struct inode *inode, struct file *file); -static ssize_t acpi_thermal_write_trip_points (struct file*,const char __user *,size_t,loff_t *); +static ssize_t acpi_thermal_write_trip_points(struct file *, + const char __user *, size_t, + loff_t *); static int acpi_thermal_cooling_open_fs(struct inode *inode, struct file *file); -static ssize_t acpi_thermal_write_cooling_mode (struct file*,const char __user *,size_t,loff_t *); +static ssize_t acpi_thermal_write_cooling_mode(struct file *, + const char __user *, size_t, + loff_t *); static int acpi_thermal_polling_open_fs(struct inode *inode, struct file *file); -static ssize_t acpi_thermal_write_polling(struct file*,const char __user *,size_t,loff_t *); +static ssize_t acpi_thermal_write_polling(struct file *, const char __user *, + size_t, loff_t *); static struct acpi_driver acpi_thermal_driver = { - .name = ACPI_THERMAL_DRIVER_NAME, - .class = ACPI_THERMAL_CLASS, - .ids = ACPI_THERMAL_HID, - .ops = { - .add = acpi_thermal_add, - .remove = acpi_thermal_remove, - }, + .name = ACPI_THERMAL_DRIVER_NAME, + .class = ACPI_THERMAL_CLASS, + .ids = ACPI_THERMAL_HID, + .ops = { + .add = acpi_thermal_add, + .remove = acpi_thermal_remove, + }, }; struct acpi_thermal_state { - u8 critical:1; - u8 hot:1; - u8 passive:1; - u8 active:1; - u8 reserved:4; - int active_index; + u8 critical:1; + u8 hot:1; + u8 passive:1; + u8 active:1; + u8 reserved:4; + int active_index; }; struct acpi_thermal_state_flags { - u8 valid:1; - u8 enabled:1; - u8 reserved:6; + u8 valid:1; + u8 enabled:1; + u8 reserved:6; }; struct acpi_thermal_critical { struct acpi_thermal_state_flags flags; - unsigned long temperature; + unsigned long temperature; }; struct acpi_thermal_hot { struct acpi_thermal_state_flags flags; - unsigned long temperature; + unsigned long temperature; }; struct acpi_thermal_passive { struct acpi_thermal_state_flags flags; - unsigned long temperature; - unsigned long tc1; - unsigned long tc2; - unsigned long tsp; - struct acpi_handle_list devices; + unsigned long temperature; + unsigned long tc1; + unsigned long tc2; + unsigned long tsp; + struct acpi_handle_list devices; }; struct acpi_thermal_active { struct acpi_thermal_state_flags flags; - unsigned long temperature; - struct acpi_handle_list devices; + unsigned long temperature; + struct acpi_handle_list devices; }; struct acpi_thermal_trips { struct acpi_thermal_critical critical; - struct acpi_thermal_hot hot; + struct acpi_thermal_hot hot; struct acpi_thermal_passive passive; struct acpi_thermal_active active[ACPI_THERMAL_MAX_ACTIVE]; }; struct acpi_thermal_flags { - u8 cooling_mode:1; /* _SCP */ - u8 devices:1; /* _TZD */ - u8 reserved:6; + u8 cooling_mode:1; /* _SCP */ + u8 devices:1; /* _TZD */ + u8 reserved:6; }; struct acpi_thermal { - acpi_handle handle; - acpi_bus_id name; - unsigned long temperature; - unsigned long last_temperature; - unsigned long polling_frequency; - u8 cooling_mode; - volatile u8 zombie; + acpi_handle handle; + acpi_bus_id name; + unsigned long temperature; + unsigned long last_temperature; + unsigned long polling_frequency; + u8 cooling_mode; + volatile u8 zombie; struct acpi_thermal_flags flags; struct acpi_thermal_state state; struct acpi_thermal_trips trips; - struct acpi_handle_list devices; - struct timer_list timer; + struct acpi_handle_list devices; + struct timer_list timer; }; static struct file_operations acpi_thermal_state_fops = { - .open = acpi_thermal_state_open_fs, - .read = seq_read, - .llseek = seq_lseek, - .release = single_release, + .open = acpi_thermal_state_open_fs, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, }; static struct file_operations acpi_thermal_temp_fops = { - .open = acpi_thermal_temp_open_fs, - .read = seq_read, - .llseek = seq_lseek, - .release = single_release, + .open = acpi_thermal_temp_open_fs, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, }; static struct file_operations acpi_thermal_trip_fops = { - .open = acpi_thermal_trip_open_fs, - .read = seq_read, - .write = acpi_thermal_write_trip_points, - .llseek = seq_lseek, - .release = single_release, + .open = acpi_thermal_trip_open_fs, + .read = seq_read, + .write = acpi_thermal_write_trip_points, + .llseek = seq_lseek, + .release = single_release, }; static struct file_operations acpi_thermal_cooling_fops = { - .open = acpi_thermal_cooling_open_fs, - .read = seq_read, - .write = acpi_thermal_write_cooling_mode, - .llseek = seq_lseek, - .release = single_release, + .open = acpi_thermal_cooling_open_fs, + .read = seq_read, + .write = acpi_thermal_write_cooling_mode, + .llseek = seq_lseek, + .release = single_release, }; static struct file_operations acpi_thermal_polling_fops = { - .open = acpi_thermal_polling_open_fs, - .read = seq_read, - .write = acpi_thermal_write_polling, - .llseek = seq_lseek, - .release = single_release, + .open = acpi_thermal_polling_open_fs, + .read = seq_read, + .write = acpi_thermal_write_polling, + .llseek = seq_lseek, + .release = single_release, }; /* -------------------------------------------------------------------------- Thermal Zone Management -------------------------------------------------------------------------- */ -static int -acpi_thermal_get_temperature ( - struct acpi_thermal *tz) +static int acpi_thermal_get_temperature(struct acpi_thermal *tz) { - acpi_status status = AE_OK; + acpi_status status = AE_OK; ACPI_FUNCTION_TRACE("acpi_thermal_get_temperature"); @@ -225,41 +227,39 @@ acpi_thermal_get_temperature ( tz->last_temperature = tz->temperature; - status = acpi_evaluate_integer(tz->handle, "_TMP", NULL, &tz->temperature); + status = + acpi_evaluate_integer(tz->handle, "_TMP", NULL, &tz->temperature); if (ACPI_FAILURE(status)) return_VALUE(-ENODEV); - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Temperature is %lu dK\n", tz->temperature)); + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Temperature is %lu dK\n", + tz->temperature)); return_VALUE(0); } - -static int -acpi_thermal_get_polling_frequency ( - struct acpi_thermal *tz) +static int acpi_thermal_get_polling_frequency(struct acpi_thermal *tz) { - acpi_status status = AE_OK; + acpi_status status = AE_OK; ACPI_FUNCTION_TRACE("acpi_thermal_get_polling_frequency"); if (!tz) return_VALUE(-EINVAL); - status = acpi_evaluate_integer(tz->handle, "_TZP", NULL, &tz->polling_frequency); + status = + acpi_evaluate_integer(tz->handle, "_TZP", NULL, + &tz->polling_frequency); if (ACPI_FAILURE(status)) return_VALUE(-ENODEV); - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Polling frequency is %lu dS\n", tz->polling_frequency)); + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Polling frequency is %lu dS\n", + tz->polling_frequency)); return_VALUE(0); } - -static int -acpi_thermal_set_polling ( - struct acpi_thermal *tz, - int seconds) +static int acpi_thermal_set_polling(struct acpi_thermal *tz, int seconds) { ACPI_FUNCTION_TRACE("acpi_thermal_set_polling"); @@ -268,21 +268,19 @@ acpi_thermal_set_polling ( tz->polling_frequency = seconds * 10; /* Convert value to deci-seconds */ - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Polling frequency set to %lu seconds\n", tz->polling_frequency)); + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "Polling frequency set to %lu seconds\n", + tz->polling_frequency)); return_VALUE(0); } - -static int -acpi_thermal_set_cooling_mode ( - struct acpi_thermal *tz, - int mode) +static int acpi_thermal_set_cooling_mode(struct acpi_thermal *tz, int mode) { - acpi_status status = AE_OK; - union acpi_object arg0 = {ACPI_TYPE_INTEGER}; - struct acpi_object_list arg_list = {1, &arg0}; - acpi_handle handle = NULL; + acpi_status status = AE_OK; + union acpi_object arg0 = { ACPI_TYPE_INTEGER }; + struct acpi_object_list arg_list = { 1, &arg0 }; + acpi_handle handle = NULL; ACPI_FUNCTION_TRACE("acpi_thermal_set_cooling_mode"); @@ -303,19 +301,16 @@ acpi_thermal_set_cooling_mode ( tz->cooling_mode = mode; - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Cooling mode [%s]\n", - mode?"passive":"active")); + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Cooling mode [%s]\n", + mode ? "passive" : "active")); return_VALUE(0); } - -static int -acpi_thermal_get_trip_points ( - struct acpi_thermal *tz) +static int acpi_thermal_get_trip_points(struct acpi_thermal *tz) { - acpi_status status = AE_OK; - int i = 0; + acpi_status status = AE_OK; + int i = 0; ACPI_FUNCTION_TRACE("acpi_thermal_get_trip_points"); @@ -324,111 +319,128 @@ acpi_thermal_get_trip_points ( /* Critical Shutdown (required) */ - status = acpi_evaluate_integer(tz->handle, "_CRT", NULL, - &tz->trips.critical.temperature); + status = acpi_evaluate_integer(tz->handle, "_CRT", NULL, + &tz->trips.critical.temperature); if (ACPI_FAILURE(status)) { tz->trips.critical.flags.valid = 0; ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "No critical threshold\n")); return_VALUE(-ENODEV); - } - else { + } else { tz->trips.critical.flags.valid = 1; - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found critical threshold [%lu]\n", tz->trips.critical.temperature)); + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "Found critical threshold [%lu]\n", + tz->trips.critical.temperature)); } /* Critical Sleep (optional) */ - status = acpi_evaluate_integer(tz->handle, "_HOT", NULL, &tz->trips.hot.temperature); + status = + acpi_evaluate_integer(tz->handle, "_HOT", NULL, + &tz->trips.hot.temperature); if (ACPI_FAILURE(status)) { tz->trips.hot.flags.valid = 0; ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No hot threshold\n")); - } - else { + } else { tz->trips.hot.flags.valid = 1; - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found hot threshold [%lu]\n", tz->trips.hot.temperature)); + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found hot threshold [%lu]\n", + tz->trips.hot.temperature)); } /* Passive: Processors (optional) */ - status = acpi_evaluate_integer(tz->handle, "_PSV", NULL, &tz->trips.passive.temperature); + status = + acpi_evaluate_integer(tz->handle, "_PSV", NULL, + &tz->trips.passive.temperature); if (ACPI_FAILURE(status)) { tz->trips.passive.flags.valid = 0; ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No passive threshold\n")); - } - else { + } else { tz->trips.passive.flags.valid = 1; - status = acpi_evaluate_integer(tz->handle, "_TC1", NULL, &tz->trips.passive.tc1); + status = + acpi_evaluate_integer(tz->handle, "_TC1", NULL, + &tz->trips.passive.tc1); if (ACPI_FAILURE(status)) tz->trips.passive.flags.valid = 0; - status = acpi_evaluate_integer(tz->handle, "_TC2", NULL, &tz->trips.passive.tc2); + status = + acpi_evaluate_integer(tz->handle, "_TC2", NULL, + &tz->trips.passive.tc2); if (ACPI_FAILURE(status)) tz->trips.passive.flags.valid = 0; - status = acpi_evaluate_integer(tz->handle, "_TSP", NULL, &tz->trips.passive.tsp); + status = + acpi_evaluate_integer(tz->handle, "_TSP", NULL, + &tz->trips.passive.tsp); if (ACPI_FAILURE(status)) tz->trips.passive.flags.valid = 0; - status = acpi_evaluate_reference(tz->handle, "_PSL", NULL, &tz->trips.passive.devices); + status = + acpi_evaluate_reference(tz->handle, "_PSL", NULL, + &tz->trips.passive.devices); if (ACPI_FAILURE(status)) tz->trips.passive.flags.valid = 0; if (!tz->trips.passive.flags.valid) - ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Invalid passive threshold\n")); + ACPI_DEBUG_PRINT((ACPI_DB_WARN, + "Invalid passive threshold\n")); else - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found passive threshold [%lu]\n", tz->trips.passive.temperature)); + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "Found passive threshold [%lu]\n", + tz->trips.passive.temperature)); } /* Active: Fans, etc. (optional) */ - for (i=0; ihandle, name, NULL, &tz->trips.active[i].temperature); + status = + acpi_evaluate_integer(tz->handle, name, NULL, + &tz->trips.active[i].temperature); if (ACPI_FAILURE(status)) break; name[2] = 'L'; - status = acpi_evaluate_reference(tz->handle, name, NULL, &tz->trips.active[i].devices); + status = + acpi_evaluate_reference(tz->handle, name, NULL, + &tz->trips.active[i].devices); if (ACPI_SUCCESS(status)) { tz->trips.active[i].flags.valid = 1; - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found active threshold [%d]:[%lu]\n", i, tz->trips.active[i].temperature)); - } - else - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid active threshold [%d]\n", i)); + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "Found active threshold [%d]:[%lu]\n", + i, tz->trips.active[i].temperature)); + } else + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Invalid active threshold [%d]\n", + i)); } return_VALUE(0); } - -static int -acpi_thermal_get_devices ( - struct acpi_thermal *tz) +static int acpi_thermal_get_devices(struct acpi_thermal *tz) { - acpi_status status = AE_OK; + acpi_status status = AE_OK; ACPI_FUNCTION_TRACE("acpi_thermal_get_devices"); if (!tz) return_VALUE(-EINVAL); - status = acpi_evaluate_reference(tz->handle, "_TZD", NULL, &tz->devices); + status = + acpi_evaluate_reference(tz->handle, "_TZD", NULL, &tz->devices); if (ACPI_FAILURE(status)) return_VALUE(-ENODEV); return_VALUE(0); } - -static int -acpi_thermal_call_usermode ( - char *path) +static int acpi_thermal_call_usermode(char *path) { - char *argv[2] = {NULL, NULL}; - char *envp[3] = {NULL, NULL, NULL}; + char *argv[2] = { NULL, NULL }; + char *envp[3] = { NULL, NULL, NULL }; ACPI_FUNCTION_TRACE("acpi_thermal_call_usermode"); @@ -440,19 +452,16 @@ acpi_thermal_call_usermode ( /* minimal command environment */ envp[0] = "HOME=/"; envp[1] = "PATH=/sbin:/bin:/usr/sbin:/usr/bin"; - + call_usermodehelper(argv[0], argv, envp, 0); return_VALUE(0); } - -static int -acpi_thermal_critical ( - struct acpi_thermal *tz) +static int acpi_thermal_critical(struct acpi_thermal *tz) { - int result = 0; - struct acpi_device *device = NULL; + int result = 0; + struct acpi_device *device = NULL; ACPI_FUNCTION_TRACE("acpi_thermal_critical"); @@ -462,29 +471,28 @@ acpi_thermal_critical ( if (tz->temperature >= tz->trips.critical.temperature) { ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Critical trip point\n")); tz->trips.critical.flags.enabled = 1; - } - else if (tz->trips.critical.flags.enabled) + } else if (tz->trips.critical.flags.enabled) tz->trips.critical.flags.enabled = 0; result = acpi_bus_get_device(tz->handle, &device); if (result) return_VALUE(result); - printk(KERN_EMERG "Critical temperature reached (%ld C), shutting down.\n", KELVIN_TO_CELSIUS(tz->temperature)); - acpi_bus_generate_event(device, ACPI_THERMAL_NOTIFY_CRITICAL, tz->trips.critical.flags.enabled); + printk(KERN_EMERG + "Critical temperature reached (%ld C), shutting down.\n", + KELVIN_TO_CELSIUS(tz->temperature)); + acpi_bus_generate_event(device, ACPI_THERMAL_NOTIFY_CRITICAL, + tz->trips.critical.flags.enabled); acpi_thermal_call_usermode(ACPI_THERMAL_PATH_POWEROFF); return_VALUE(0); } - -static int -acpi_thermal_hot ( - struct acpi_thermal *tz) +static int acpi_thermal_hot(struct acpi_thermal *tz) { - int result = 0; - struct acpi_device *device = NULL; + int result = 0; + struct acpi_device *device = NULL; ACPI_FUNCTION_TRACE("acpi_thermal_hot"); @@ -494,30 +502,27 @@ acpi_thermal_hot ( if (tz->temperature >= tz->trips.hot.temperature) { ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Hot trip point\n")); tz->trips.hot.flags.enabled = 1; - } - else if (tz->trips.hot.flags.enabled) + } else if (tz->trips.hot.flags.enabled) tz->trips.hot.flags.enabled = 0; result = acpi_bus_get_device(tz->handle, &device); if (result) return_VALUE(result); - acpi_bus_generate_event(device, ACPI_THERMAL_NOTIFY_HOT, tz->trips.hot.flags.enabled); + acpi_bus_generate_event(device, ACPI_THERMAL_NOTIFY_HOT, + tz->trips.hot.flags.enabled); /* TBD: Call user-mode "sleep(S4)" function */ return_VALUE(0); } - -static int -acpi_thermal_passive ( - struct acpi_thermal *tz) +static int acpi_thermal_passive(struct acpi_thermal *tz) { - int result = 0; + int result = 0; struct acpi_thermal_passive *passive = NULL; - int trend = 0; - int i = 0; + int trend = 0; + int i = 0; ACPI_FUNCTION_TRACE("acpi_thermal_passive"); @@ -534,25 +539,29 @@ acpi_thermal_passive ( * accordingly. Note that we assume symmetry. */ if (tz->temperature >= passive->temperature) { - trend = (passive->tc1 * (tz->temperature - tz->last_temperature)) + (passive->tc2 * (tz->temperature - passive->temperature)); - ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "trend[%d]=(tc1[%lu]*(tmp[%lu]-last[%lu]))+(tc2[%lu]*(tmp[%lu]-psv[%lu]))\n", - trend, passive->tc1, tz->temperature, - tz->last_temperature, passive->tc2, - tz->temperature, passive->temperature)); + trend = + (passive->tc1 * (tz->temperature - tz->last_temperature)) + + (passive->tc2 * (tz->temperature - passive->temperature)); + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "trend[%d]=(tc1[%lu]*(tmp[%lu]-last[%lu]))+(tc2[%lu]*(tmp[%lu]-psv[%lu]))\n", + trend, passive->tc1, tz->temperature, + tz->last_temperature, passive->tc2, + tz->temperature, passive->temperature)); tz->trips.passive.flags.enabled = 1; /* Heating up? */ if (trend > 0) - for (i=0; idevices.count; i++) - acpi_processor_set_thermal_limit( - passive->devices.handles[i], - ACPI_PROCESSOR_LIMIT_INCREMENT); + for (i = 0; i < passive->devices.count; i++) + acpi_processor_set_thermal_limit(passive-> + devices. + handles[i], + ACPI_PROCESSOR_LIMIT_INCREMENT); /* Cooling off? */ else if (trend < 0) - for (i=0; idevices.count; i++) - acpi_processor_set_thermal_limit( - passive->devices.handles[i], - ACPI_PROCESSOR_LIMIT_DECREMENT); + for (i = 0; i < passive->devices.count; i++) + acpi_processor_set_thermal_limit(passive-> + devices. + handles[i], + ACPI_PROCESSOR_LIMIT_DECREMENT); } /* @@ -563,37 +572,35 @@ acpi_thermal_passive ( * assume symmetry. */ else if (tz->trips.passive.flags.enabled) { - for (i=0; idevices.count; i++) - result = acpi_processor_set_thermal_limit( - passive->devices.handles[i], - ACPI_PROCESSOR_LIMIT_DECREMENT); + for (i = 0; i < passive->devices.count; i++) + result = + acpi_processor_set_thermal_limit(passive->devices. + handles[i], + ACPI_PROCESSOR_LIMIT_DECREMENT); if (result == 1) { tz->trips.passive.flags.enabled = 0; - ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "Disabling passive cooling (zone is cool)\n")); + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "Disabling passive cooling (zone is cool)\n")); } } return_VALUE(0); } - -static int -acpi_thermal_active ( - struct acpi_thermal *tz) +static int acpi_thermal_active(struct acpi_thermal *tz) { - int result = 0; + int result = 0; struct acpi_thermal_active *active = NULL; - int i = 0; - int j = 0; - unsigned long maxtemp = 0; + int i = 0; + int j = 0; + unsigned long maxtemp = 0; ACPI_FUNCTION_TRACE("acpi_thermal_active"); if (!tz) return_VALUE(-EINVAL); - for (i=0; itrips.active[i]); if (!active || !active->flags.valid) @@ -607,16 +614,27 @@ acpi_thermal_active ( */ if (tz->temperature >= active->temperature) { if (active->temperature > maxtemp) - tz->state.active_index = i, maxtemp = active->temperature; + tz->state.active_index = i, maxtemp = + active->temperature; if (!active->flags.enabled) { for (j = 0; j < active->devices.count; j++) { - result = acpi_bus_set_power(active->devices.handles[j], ACPI_STATE_D0); + result = + acpi_bus_set_power(active->devices. + handles[j], + ACPI_STATE_D0); if (result) { - ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Unable to turn cooling device [%p] 'on'\n", active->devices.handles[j])); + ACPI_DEBUG_PRINT((ACPI_DB_WARN, + "Unable to turn cooling device [%p] 'on'\n", + active-> + devices. + handles[j])); continue; } active->flags.enabled = 1; - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Cooling device [%p] now 'on'\n", active->devices.handles[j])); + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "Cooling device [%p] now 'on'\n", + active->devices. + handles[j])); } } } @@ -628,13 +646,21 @@ acpi_thermal_active ( */ else if (active->flags.enabled) { for (j = 0; j < active->devices.count; j++) { - result = acpi_bus_set_power(active->devices.handles[j], ACPI_STATE_D3); + result = + acpi_bus_set_power(active->devices. + handles[j], + ACPI_STATE_D3); if (result) { - ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Unable to turn cooling device [%p] 'off'\n", active->devices.handles[j])); + ACPI_DEBUG_PRINT((ACPI_DB_WARN, + "Unable to turn cooling device [%p] 'off'\n", + active->devices. + handles[j])); continue; } active->flags.enabled = 0; - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Cooling device [%p] now 'off'\n", active->devices.handles[j])); + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "Cooling device [%p] now 'off'\n", + active->devices.handles[j])); } } } @@ -642,28 +668,22 @@ acpi_thermal_active ( return_VALUE(0); } +static void acpi_thermal_check(void *context); -static void acpi_thermal_check (void *context); - -static void -acpi_thermal_run ( - unsigned long data) +static void acpi_thermal_run(unsigned long data) { struct acpi_thermal *tz = (struct acpi_thermal *)data; if (!tz->zombie) - acpi_os_queue_for_execution(OSD_PRIORITY_GPE, - acpi_thermal_check, (void *) data); + acpi_os_queue_for_execution(OSD_PRIORITY_GPE, + acpi_thermal_check, (void *)data); } - -static void -acpi_thermal_check ( - void *data) +static void acpi_thermal_check(void *data) { - int result = 0; - struct acpi_thermal *tz = (struct acpi_thermal *) data; - unsigned long sleep_time = 0; - int i = 0; + int result = 0; + struct acpi_thermal *tz = (struct acpi_thermal *)data; + unsigned long sleep_time = 0; + int i = 0; struct acpi_thermal_state state; ACPI_FUNCTION_TRACE("acpi_thermal_check"); @@ -678,9 +698,9 @@ acpi_thermal_check ( result = acpi_thermal_get_temperature(tz); if (result) return_VOID; - + memset(&tz->state, 0, sizeof(tz->state)); - + /* * Check Trip Points * ----------------- @@ -690,14 +710,18 @@ acpi_thermal_check ( * individual policy decides when it is exited (e.g. hysteresis). */ if (tz->trips.critical.flags.valid) - state.critical |= (tz->temperature >= tz->trips.critical.temperature); + state.critical |= + (tz->temperature >= tz->trips.critical.temperature); if (tz->trips.hot.flags.valid) state.hot |= (tz->temperature >= tz->trips.hot.temperature); if (tz->trips.passive.flags.valid) - state.passive |= (tz->temperature >= tz->trips.passive.temperature); - for (i=0; itemperature >= tz->trips.passive.temperature); + for (i = 0; i < ACPI_THERMAL_MAX_ACTIVE; i++) if (tz->trips.active[i].flags.valid) - state.active |= (tz->temperature >= tz->trips.active[i].temperature); + state.active |= + (tz->temperature >= + tz->trips.active[i].temperature); /* * Invoke Policy @@ -726,7 +750,7 @@ acpi_thermal_check ( tz->state.hot = 1; if (tz->trips.passive.flags.enabled) tz->state.passive = 1; - for (i=0; itrips.active[i].flags.enabled) tz->state.active = 1; @@ -744,8 +768,8 @@ acpi_thermal_check ( else if (tz->polling_frequency > 0) sleep_time = tz->polling_frequency * 100; - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "%s: temperature[%lu] sleep[%lu]\n", - tz->name, tz->temperature, sleep_time)); + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "%s: temperature[%lu] sleep[%lu]\n", + tz->name, tz->temperature, sleep_time)); /* * Schedule Next Poll @@ -754,12 +778,11 @@ acpi_thermal_check ( if (!sleep_time) { if (timer_pending(&(tz->timer))) del_timer(&(tz->timer)); - } - else { + } else { if (timer_pending(&(tz->timer))) mod_timer(&(tz->timer), (HZ * sleep_time) / 1000); else { - tz->timer.data = (unsigned long) tz; + tz->timer.data = (unsigned long)tz; tz->timer.function = acpi_thermal_run; tz->timer.expires = jiffies + (HZ * sleep_time) / 1000; add_timer(&(tz->timer)); @@ -769,16 +792,15 @@ acpi_thermal_check ( return_VOID; } - /* -------------------------------------------------------------------------- FS Interface (/proc) -------------------------------------------------------------------------- */ -static struct proc_dir_entry *acpi_thermal_dir; +static struct proc_dir_entry *acpi_thermal_dir; static int acpi_thermal_state_seq_show(struct seq_file *seq, void *offset) { - struct acpi_thermal *tz = (struct acpi_thermal *)seq->private; + struct acpi_thermal *tz = (struct acpi_thermal *)seq->private; ACPI_FUNCTION_TRACE("acpi_thermal_state_seq_show"); @@ -787,7 +809,8 @@ static int acpi_thermal_state_seq_show(struct seq_file *seq, void *offset) seq_puts(seq, "state: "); - if (!tz->state.critical && !tz->state.hot && !tz->state.passive && !tz->state.active) + if (!tz->state.critical && !tz->state.hot && !tz->state.passive + && !tz->state.active) seq_puts(seq, "ok\n"); else { if (tz->state.critical) @@ -801,7 +824,7 @@ static int acpi_thermal_state_seq_show(struct seq_file *seq, void *offset) seq_puts(seq, "\n"); } -end: + end: return_VALUE(0); } @@ -810,11 +833,10 @@ static int acpi_thermal_state_open_fs(struct inode *inode, struct file *file) return single_open(file, acpi_thermal_state_seq_show, PDE(inode)->data); } - static int acpi_thermal_temp_seq_show(struct seq_file *seq, void *offset) { - int result = 0; - struct acpi_thermal *tz = (struct acpi_thermal *)seq->private; + int result = 0; + struct acpi_thermal *tz = (struct acpi_thermal *)seq->private; ACPI_FUNCTION_TRACE("acpi_thermal_temp_seq_show"); @@ -825,10 +847,10 @@ static int acpi_thermal_temp_seq_show(struct seq_file *seq, void *offset) if (result) goto end; - seq_printf(seq, "temperature: %ld C\n", - KELVIN_TO_CELSIUS(tz->temperature)); + seq_printf(seq, "temperature: %ld C\n", + KELVIN_TO_CELSIUS(tz->temperature)); -end: + end: return_VALUE(0); } @@ -837,12 +859,11 @@ static int acpi_thermal_temp_open_fs(struct inode *inode, struct file *file) return single_open(file, acpi_thermal_temp_seq_show, PDE(inode)->data); } - static int acpi_thermal_trip_seq_show(struct seq_file *seq, void *offset) { - struct acpi_thermal *tz = (struct acpi_thermal *)seq->private; - int i = 0; - int j = 0; + struct acpi_thermal *tz = (struct acpi_thermal *)seq->private; + int i = 0; + int j = 0; ACPI_FUNCTION_TRACE("acpi_thermal_trip_seq_show"); @@ -851,21 +872,22 @@ static int acpi_thermal_trip_seq_show(struct seq_file *seq, void *offset) if (tz->trips.critical.flags.valid) seq_printf(seq, "critical (S5): %ld C\n", - KELVIN_TO_CELSIUS(tz->trips.critical.temperature)); + KELVIN_TO_CELSIUS(tz->trips.critical.temperature)); if (tz->trips.hot.flags.valid) seq_printf(seq, "hot (S4): %ld C\n", - KELVIN_TO_CELSIUS(tz->trips.hot.temperature)); + KELVIN_TO_CELSIUS(tz->trips.hot.temperature)); if (tz->trips.passive.flags.valid) { - seq_printf(seq, "passive: %ld C: tc1=%lu tc2=%lu tsp=%lu devices=", - KELVIN_TO_CELSIUS(tz->trips.passive.temperature), - tz->trips.passive.tc1, - tz->trips.passive.tc2, - tz->trips.passive.tsp); - for (j=0; jtrips.passive.devices.count; j++) { - - seq_printf(seq, "0x%p ", tz->trips.passive.devices.handles[j]); + seq_printf(seq, + "passive: %ld C: tc1=%lu tc2=%lu tsp=%lu devices=", + KELVIN_TO_CELSIUS(tz->trips.passive.temperature), + tz->trips.passive.tc1, tz->trips.passive.tc2, + tz->trips.passive.tsp); + for (j = 0; j < tz->trips.passive.devices.count; j++) { + + seq_printf(seq, "0x%p ", + tz->trips.passive.devices.handles[j]); } seq_puts(seq, "\n"); } @@ -874,14 +896,15 @@ static int acpi_thermal_trip_seq_show(struct seq_file *seq, void *offset) if (!(tz->trips.active[i].flags.valid)) break; seq_printf(seq, "active[%d]: %ld C: devices=", - i, KELVIN_TO_CELSIUS(tz->trips.active[i].temperature)); - for (j = 0; j < tz->trips.active[i].devices.count; j++) + i, + KELVIN_TO_CELSIUS(tz->trips.active[i].temperature)); + for (j = 0; j < tz->trips.active[i].devices.count; j++) seq_printf(seq, "0x%p ", - tz->trips.active[i].devices.handles[j]); + tz->trips.active[i].devices.handles[j]); seq_puts(seq, "\n"); } -end: + end: return_VALUE(0); } @@ -891,30 +914,28 @@ static int acpi_thermal_trip_open_fs(struct inode *inode, struct file *file) } static ssize_t -acpi_thermal_write_trip_points ( - struct file *file, - const char __user *buffer, - size_t count, - loff_t *ppos) +acpi_thermal_write_trip_points(struct file *file, + const char __user * buffer, + size_t count, loff_t * ppos) { - struct seq_file *m = (struct seq_file *)file->private_data; - struct acpi_thermal *tz = (struct acpi_thermal *)m->private; + struct seq_file *m = (struct seq_file *)file->private_data; + struct acpi_thermal *tz = (struct acpi_thermal *)m->private; - char *limit_string; - int num, critical, hot, passive; - int *active; - int i = 0; + char *limit_string; + int num, critical, hot, passive; + int *active; + int i = 0; ACPI_FUNCTION_TRACE("acpi_thermal_write_trip_points"); limit_string = kmalloc(ACPI_THERMAL_MAX_LIMIT_STR_LEN, GFP_KERNEL); - if(!limit_string) + if (!limit_string) return_VALUE(-ENOMEM); memset(limit_string, 0, ACPI_THERMAL_MAX_LIMIT_STR_LEN); - active = kmalloc(ACPI_THERMAL_MAX_ACTIVE *sizeof(int), GFP_KERNEL); - if(!active) + active = kmalloc(ACPI_THERMAL_MAX_ACTIVE * sizeof(int), GFP_KERNEL); + if (!active) return_VALUE(-ENOMEM); if (!tz || (count > ACPI_THERMAL_MAX_LIMIT_STR_LEN - 1)) { @@ -922,20 +943,21 @@ acpi_thermal_write_trip_points ( count = -EINVAL; goto end; } - + if (copy_from_user(limit_string, buffer, count)) { ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid data\n")); count = -EFAULT; goto end; } - + limit_string[count] = '\0'; num = sscanf(limit_string, "%d:%d:%d:%d:%d:%d:%d:%d:%d:%d:%d:%d:%d", - &critical, &hot, &passive, - &active[0], &active[1], &active[2], &active[3], &active[4], - &active[5], &active[6], &active[7], &active[8], &active[9]); - if(!(num >=5 && num < (ACPI_THERMAL_MAX_ACTIVE + 3))) { + &critical, &hot, &passive, + &active[0], &active[1], &active[2], &active[3], &active[4], + &active[5], &active[6], &active[7], &active[8], + &active[9]); + if (!(num >= 5 && num < (ACPI_THERMAL_MAX_ACTIVE + 3))) { ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid data format\n")); count = -EINVAL; goto end; @@ -949,17 +971,16 @@ acpi_thermal_write_trip_points ( break; tz->trips.active[i].temperature = CELSIUS_TO_KELVIN(active[i]); } - -end: + + end: kfree(active); kfree(limit_string); return_VALUE(count); } - static int acpi_thermal_cooling_seq_show(struct seq_file *seq, void *offset) { - struct acpi_thermal *tz = (struct acpi_thermal *)seq->private; + struct acpi_thermal *tz = (struct acpi_thermal *)seq->private; ACPI_FUNCTION_TRACE("acpi_thermal_cooling_seq_show"); @@ -970,33 +991,31 @@ static int acpi_thermal_cooling_seq_show(struct seq_file *seq, void *offset) seq_puts(seq, "\n"); } - if ( tz->cooling_mode == ACPI_THERMAL_MODE_CRITICAL ) + if (tz->cooling_mode == ACPI_THERMAL_MODE_CRITICAL) seq_printf(seq, "cooling mode: critical\n"); else seq_printf(seq, "cooling mode: %s\n", - tz->cooling_mode?"passive":"active"); + tz->cooling_mode ? "passive" : "active"); -end: + end: return_VALUE(0); } static int acpi_thermal_cooling_open_fs(struct inode *inode, struct file *file) { return single_open(file, acpi_thermal_cooling_seq_show, - PDE(inode)->data); + PDE(inode)->data); } static ssize_t -acpi_thermal_write_cooling_mode ( - struct file *file, - const char __user *buffer, - size_t count, - loff_t *ppos) +acpi_thermal_write_cooling_mode(struct file *file, + const char __user * buffer, + size_t count, loff_t * ppos) { - struct seq_file *m = (struct seq_file *)file->private_data; - struct acpi_thermal *tz = (struct acpi_thermal *)m->private; - int result = 0; - char mode_string[12] = {'\0'}; + struct seq_file *m = (struct seq_file *)file->private_data; + struct acpi_thermal *tz = (struct acpi_thermal *)m->private; + int result = 0; + char mode_string[12] = { '\0' }; ACPI_FUNCTION_TRACE("acpi_thermal_write_cooling_mode"); @@ -1008,11 +1027,12 @@ acpi_thermal_write_cooling_mode ( if (copy_from_user(mode_string, buffer, count)) return_VALUE(-EFAULT); - + mode_string[count] = '\0'; - - result = acpi_thermal_set_cooling_mode(tz, - simple_strtoul(mode_string, NULL, 0)); + + result = acpi_thermal_set_cooling_mode(tz, + simple_strtoul(mode_string, NULL, + 0)); if (result) return_VALUE(result); @@ -1021,10 +1041,9 @@ acpi_thermal_write_cooling_mode ( return_VALUE(count); } - static int acpi_thermal_polling_seq_show(struct seq_file *seq, void *offset) { - struct acpi_thermal *tz = (struct acpi_thermal *)seq->private; + struct acpi_thermal *tz = (struct acpi_thermal *)seq->private; ACPI_FUNCTION_TRACE("acpi_thermal_polling_seq_show"); @@ -1037,43 +1056,41 @@ static int acpi_thermal_polling_seq_show(struct seq_file *seq, void *offset) } seq_printf(seq, "polling frequency: %lu seconds\n", - (tz->polling_frequency / 10)); + (tz->polling_frequency / 10)); -end: + end: return_VALUE(0); } static int acpi_thermal_polling_open_fs(struct inode *inode, struct file *file) { return single_open(file, acpi_thermal_polling_seq_show, - PDE(inode)->data); + PDE(inode)->data); } static ssize_t -acpi_thermal_write_polling ( - struct file *file, - const char __user *buffer, - size_t count, - loff_t *ppos) +acpi_thermal_write_polling(struct file *file, + const char __user * buffer, + size_t count, loff_t * ppos) { - struct seq_file *m = (struct seq_file *)file->private_data; - struct acpi_thermal *tz = (struct acpi_thermal *)m->private; - int result = 0; - char polling_string[12] = {'\0'}; - int seconds = 0; + struct seq_file *m = (struct seq_file *)file->private_data; + struct acpi_thermal *tz = (struct acpi_thermal *)m->private; + int result = 0; + char polling_string[12] = { '\0' }; + int seconds = 0; ACPI_FUNCTION_TRACE("acpi_thermal_write_polling"); if (!tz || (count > sizeof(polling_string) - 1)) return_VALUE(-EINVAL); - + if (copy_from_user(polling_string, buffer, count)) return_VALUE(-EFAULT); - + polling_string[count] = '\0'; seconds = simple_strtoul(polling_string, NULL, 0); - + result = acpi_thermal_set_polling(tz, seconds); if (result) return_VALUE(result); @@ -1083,18 +1100,15 @@ acpi_thermal_write_polling ( return_VALUE(count); } - -static int -acpi_thermal_add_fs ( - struct acpi_device *device) +static int acpi_thermal_add_fs(struct acpi_device *device) { - struct proc_dir_entry *entry = NULL; + struct proc_dir_entry *entry = NULL; ACPI_FUNCTION_TRACE("acpi_thermal_add_fs"); if (!acpi_device_dir(device)) { acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), - acpi_thermal_dir); + acpi_thermal_dir); if (!acpi_device_dir(device)) return_VALUE(-ENODEV); acpi_device_dir(device)->owner = THIS_MODULE; @@ -1102,11 +1116,11 @@ acpi_thermal_add_fs ( /* 'state' [R] */ entry = create_proc_entry(ACPI_THERMAL_FILE_STATE, - S_IRUGO, acpi_device_dir(device)); + S_IRUGO, acpi_device_dir(device)); if (!entry) ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create '%s' fs entry\n", - ACPI_THERMAL_FILE_STATE)); + "Unable to create '%s' fs entry\n", + ACPI_THERMAL_FILE_STATE)); else { entry->proc_fops = &acpi_thermal_state_fops; entry->data = acpi_driver_data(device); @@ -1115,11 +1129,11 @@ acpi_thermal_add_fs ( /* 'temperature' [R] */ entry = create_proc_entry(ACPI_THERMAL_FILE_TEMPERATURE, - S_IRUGO, acpi_device_dir(device)); + S_IRUGO, acpi_device_dir(device)); if (!entry) ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create '%s' fs entry\n", - ACPI_THERMAL_FILE_TEMPERATURE)); + "Unable to create '%s' fs entry\n", + ACPI_THERMAL_FILE_TEMPERATURE)); else { entry->proc_fops = &acpi_thermal_temp_fops; entry->data = acpi_driver_data(device); @@ -1128,11 +1142,12 @@ acpi_thermal_add_fs ( /* 'trip_points' [R/W] */ entry = create_proc_entry(ACPI_THERMAL_FILE_TRIP_POINTS, - S_IFREG|S_IRUGO|S_IWUSR, acpi_device_dir(device)); + S_IFREG | S_IRUGO | S_IWUSR, + acpi_device_dir(device)); if (!entry) ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create '%s' fs entry\n", - ACPI_THERMAL_FILE_TRIP_POINTS)); + "Unable to create '%s' fs entry\n", + ACPI_THERMAL_FILE_TRIP_POINTS)); else { entry->proc_fops = &acpi_thermal_trip_fops; entry->data = acpi_driver_data(device); @@ -1141,11 +1156,12 @@ acpi_thermal_add_fs ( /* 'cooling_mode' [R/W] */ entry = create_proc_entry(ACPI_THERMAL_FILE_COOLING_MODE, - S_IFREG|S_IRUGO|S_IWUSR, acpi_device_dir(device)); + S_IFREG | S_IRUGO | S_IWUSR, + acpi_device_dir(device)); if (!entry) ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create '%s' fs entry\n", - ACPI_THERMAL_FILE_COOLING_MODE)); + "Unable to create '%s' fs entry\n", + ACPI_THERMAL_FILE_COOLING_MODE)); else { entry->proc_fops = &acpi_thermal_cooling_fops; entry->data = acpi_driver_data(device); @@ -1154,11 +1170,12 @@ acpi_thermal_add_fs ( /* 'polling_frequency' [R/W] */ entry = create_proc_entry(ACPI_THERMAL_FILE_POLLING_FREQ, - S_IFREG|S_IRUGO|S_IWUSR, acpi_device_dir(device)); + S_IFREG | S_IRUGO | S_IWUSR, + acpi_device_dir(device)); if (!entry) ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create '%s' fs entry\n", - ACPI_THERMAL_FILE_POLLING_FREQ)); + "Unable to create '%s' fs entry\n", + ACPI_THERMAL_FILE_POLLING_FREQ)); else { entry->proc_fops = &acpi_thermal_polling_fops; entry->data = acpi_driver_data(device); @@ -1168,10 +1185,7 @@ acpi_thermal_add_fs ( return_VALUE(0); } - -static int -acpi_thermal_remove_fs ( - struct acpi_device *device) +static int acpi_thermal_remove_fs(struct acpi_device *device) { ACPI_FUNCTION_TRACE("acpi_thermal_remove_fs"); @@ -1193,19 +1207,14 @@ acpi_thermal_remove_fs ( return_VALUE(0); } - /* -------------------------------------------------------------------------- Driver Interface -------------------------------------------------------------------------- */ -static void -acpi_thermal_notify ( - acpi_handle handle, - u32 event, - void *data) +static void acpi_thermal_notify(acpi_handle handle, u32 event, void *data) { - struct acpi_thermal *tz = (struct acpi_thermal *) data; - struct acpi_device *device = NULL; + struct acpi_thermal *tz = (struct acpi_thermal *)data; + struct acpi_device *device = NULL; ACPI_FUNCTION_TRACE("acpi_thermal_notify"); @@ -1231,19 +1240,16 @@ acpi_thermal_notify ( break; default: ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "Unsupported event [0x%x]\n", event)); + "Unsupported event [0x%x]\n", event)); break; } return_VOID; } - -static int -acpi_thermal_get_info ( - struct acpi_thermal *tz) +static int acpi_thermal_get_info(struct acpi_thermal *tz) { - int result = 0; + int result = 0; ACPI_FUNCTION_TRACE("acpi_thermal_get_info"); @@ -1262,20 +1268,24 @@ acpi_thermal_get_info ( /* Set the cooling mode [_SCP] to active cooling (default) */ result = acpi_thermal_set_cooling_mode(tz, ACPI_THERMAL_MODE_ACTIVE); - if (!result) + if (!result) tz->flags.cooling_mode = 1; - else { + else { /* Oh,we have not _SCP method. - Generally show cooling_mode by _ACx, _PSV,spec 12.2*/ + Generally show cooling_mode by _ACx, _PSV,spec 12.2 */ tz->flags.cooling_mode = 0; - if ( tz->trips.active[0].flags.valid && tz->trips.passive.flags.valid ) { - if ( tz->trips.passive.temperature > tz->trips.active[0].temperature ) + if (tz->trips.active[0].flags.valid + && tz->trips.passive.flags.valid) { + if (tz->trips.passive.temperature > + tz->trips.active[0].temperature) tz->cooling_mode = ACPI_THERMAL_MODE_ACTIVE; - else + else tz->cooling_mode = ACPI_THERMAL_MODE_PASSIVE; - } else if ( !tz->trips.active[0].flags.valid && tz->trips.passive.flags.valid ) { + } else if (!tz->trips.active[0].flags.valid + && tz->trips.passive.flags.valid) { tz->cooling_mode = ACPI_THERMAL_MODE_PASSIVE; - } else if ( tz->trips.active[0].flags.valid && !tz->trips.passive.flags.valid ) { + } else if (tz->trips.active[0].flags.valid + && !tz->trips.passive.flags.valid) { tz->cooling_mode = ACPI_THERMAL_MODE_ACTIVE; } else { /* _ACx and _PSV are optional, but _CRT is required */ @@ -1297,14 +1307,11 @@ acpi_thermal_get_info ( return_VALUE(0); } - -static int -acpi_thermal_add ( - struct acpi_device *device) +static int acpi_thermal_add(struct acpi_device *device) { - int result = 0; - acpi_status status = AE_OK; - struct acpi_thermal *tz = NULL; + int result = 0; + acpi_status status = AE_OK; + struct acpi_thermal *tz = NULL; ACPI_FUNCTION_TRACE("acpi_thermal_add"); @@ -1335,19 +1342,20 @@ acpi_thermal_add ( acpi_thermal_check(tz); status = acpi_install_notify_handler(tz->handle, - ACPI_DEVICE_NOTIFY, acpi_thermal_notify, tz); + ACPI_DEVICE_NOTIFY, + acpi_thermal_notify, tz); if (ACPI_FAILURE(status)) { ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error installing notify handler\n")); + "Error installing notify handler\n")); result = -ENODEV; goto end; } printk(KERN_INFO PREFIX "%s [%s] (%ld C)\n", - acpi_device_name(device), acpi_device_bid(device), - KELVIN_TO_CELSIUS(tz->temperature)); + acpi_device_name(device), acpi_device_bid(device), + KELVIN_TO_CELSIUS(tz->temperature)); -end: + end: if (result) { acpi_thermal_remove_fs(device); kfree(tz); @@ -1356,21 +1364,17 @@ end: return_VALUE(result); } - -static int -acpi_thermal_remove ( - struct acpi_device *device, - int type) +static int acpi_thermal_remove(struct acpi_device *device, int type) { - acpi_status status = AE_OK; - struct acpi_thermal *tz = NULL; + acpi_status status = AE_OK; + struct acpi_thermal *tz = NULL; ACPI_FUNCTION_TRACE("acpi_thermal_remove"); if (!device || !acpi_driver_data(device)) return_VALUE(-EINVAL); - tz = (struct acpi_thermal *) acpi_driver_data(device); + tz = (struct acpi_thermal *)acpi_driver_data(device); /* avoid timer adding new defer task */ tz->zombie = 1; @@ -1382,19 +1386,19 @@ acpi_thermal_remove ( del_timer_sync(&(tz->timer)); status = acpi_remove_notify_handler(tz->handle, - ACPI_DEVICE_NOTIFY, acpi_thermal_notify); + ACPI_DEVICE_NOTIFY, + acpi_thermal_notify); if (ACPI_FAILURE(status)) ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error removing notify handler\n")); + "Error removing notify handler\n")); /* Terminate policy */ - if (tz->trips.passive.flags.valid - && tz->trips.passive.flags.enabled) { + if (tz->trips.passive.flags.valid && tz->trips.passive.flags.enabled) { tz->trips.passive.flags.enabled = 0; acpi_thermal_passive(tz); } if (tz->trips.active[0].flags.valid - && tz->trips.active[0].flags.enabled) { + && tz->trips.active[0].flags.enabled) { tz->trips.active[0].flags.enabled = 0; acpi_thermal_active(tz); } @@ -1405,11 +1409,9 @@ acpi_thermal_remove ( return_VALUE(0); } - -static int __init -acpi_thermal_init (void) +static int __init acpi_thermal_init(void) { - int result = 0; + int result = 0; ACPI_FUNCTION_TRACE("acpi_thermal_init"); @@ -1427,9 +1429,7 @@ acpi_thermal_init (void) return_VALUE(0); } - -static void __exit -acpi_thermal_exit (void) +static void __exit acpi_thermal_exit(void) { ACPI_FUNCTION_TRACE("acpi_thermal_exit"); @@ -1440,6 +1440,5 @@ acpi_thermal_exit (void) return_VOID; } - module_init(acpi_thermal_init); module_exit(acpi_thermal_exit); diff --git a/drivers/acpi/toshiba_acpi.c b/drivers/acpi/toshiba_acpi.c index 73b1d8aeae9..7fe0b7ae973 100644 --- a/drivers/acpi/toshiba_acpi.c +++ b/drivers/acpi/toshiba_acpi.c @@ -100,8 +100,7 @@ MODULE_LICENSE("GPL"); /* utility */ -static __inline__ void -_set_bit(u32* word, u32 mask, int value) +static __inline__ void _set_bit(u32 * word, u32 mask, int value) { *word = (*word & ~mask) | (mask * value); } @@ -109,35 +108,32 @@ _set_bit(u32* word, u32 mask, int value) /* acpi interface wrappers */ -static int -is_valid_acpi_path(const char* methodName) +static int is_valid_acpi_path(const char *methodName) { acpi_handle handle; acpi_status status; - status = acpi_get_handle(NULL, (char*)methodName, &handle); + status = acpi_get_handle(NULL, (char *)methodName, &handle); return !ACPI_FAILURE(status); } -static int -write_acpi_int(const char* methodName, int val) +static int write_acpi_int(const char *methodName, int val) { struct acpi_object_list params; union acpi_object in_objs[1]; acpi_status status; - params.count = sizeof(in_objs)/sizeof(in_objs[0]); + params.count = sizeof(in_objs) / sizeof(in_objs[0]); params.pointer = in_objs; in_objs[0].type = ACPI_TYPE_INTEGER; in_objs[0].integer.value = val; - status = acpi_evaluate_object(NULL, (char*)methodName, ¶ms, NULL); + status = acpi_evaluate_object(NULL, (char *)methodName, ¶ms, NULL); return (status == AE_OK); } #if 0 -static int -read_acpi_int(const char* methodName, int* pVal) +static int read_acpi_int(const char *methodName, int *pVal) { struct acpi_buffer results; union acpi_object out_objs[1]; @@ -146,25 +142,24 @@ read_acpi_int(const char* methodName, int* pVal) results.length = sizeof(out_objs); results.pointer = out_objs; - status = acpi_evaluate_object(0, (char*)methodName, 0, &results); + status = acpi_evaluate_object(0, (char *)methodName, 0, &results); *pVal = out_objs[0].integer.value; return (status == AE_OK) && (out_objs[0].type == ACPI_TYPE_INTEGER); } #endif -static const char* method_hci /*= 0*/; +static const char *method_hci /*= 0*/ ; /* Perform a raw HCI call. Here we don't care about input or output buffer * format. */ -static acpi_status -hci_raw(const u32 in[HCI_WORDS], u32 out[HCI_WORDS]) +static acpi_status hci_raw(const u32 in[HCI_WORDS], u32 out[HCI_WORDS]) { struct acpi_object_list params; union acpi_object in_objs[HCI_WORDS]; struct acpi_buffer results; - union acpi_object out_objs[HCI_WORDS+1]; + union acpi_object out_objs[HCI_WORDS + 1]; acpi_status status; int i; @@ -178,8 +173,8 @@ hci_raw(const u32 in[HCI_WORDS], u32 out[HCI_WORDS]) results.length = sizeof(out_objs); results.pointer = out_objs; - status = acpi_evaluate_object(NULL, (char*)method_hci, ¶ms, - &results); + status = acpi_evaluate_object(NULL, (char *)method_hci, ¶ms, + &results); if ((status == AE_OK) && (out_objs->package.count <= HCI_WORDS)) { for (i = 0; i < out_objs->package.count; ++i) { out[i] = out_objs->package.elements[i].integer.value; @@ -195,8 +190,7 @@ hci_raw(const u32 in[HCI_WORDS], u32 out[HCI_WORDS]) * may be useful (such as "not supported"). */ -static acpi_status -hci_write1(u32 reg, u32 in1, u32* result) +static acpi_status hci_write1(u32 reg, u32 in1, u32 * result) { u32 in[HCI_WORDS] = { HCI_SET, reg, in1, 0, 0, 0 }; u32 out[HCI_WORDS]; @@ -205,8 +199,7 @@ hci_write1(u32 reg, u32 in1, u32* result) return status; } -static acpi_status -hci_read1(u32 reg, u32* out1, u32* result) +static acpi_status hci_read1(u32 reg, u32 * out1, u32 * result) { u32 in[HCI_WORDS] = { HCI_GET, reg, 0, 0, 0, 0 }; u32 out[HCI_WORDS]; @@ -216,26 +209,25 @@ hci_read1(u32 reg, u32* out1, u32* result) return status; } -static struct proc_dir_entry* toshiba_proc_dir /*= 0*/; -static int force_fan; -static int last_key_event; -static int key_event_valid; +static struct proc_dir_entry *toshiba_proc_dir /*= 0*/ ; +static int force_fan; +static int last_key_event; +static int key_event_valid; -typedef struct _ProcItem -{ - const char* name; - char* (*read_func)(char*); - unsigned long (*write_func)(const char*, unsigned long); +typedef struct _ProcItem { + const char *name; + char *(*read_func) (char *); + unsigned long (*write_func) (const char *, unsigned long); } ProcItem; /* proc file handlers */ static int -dispatch_read(char* page, char** start, off_t off, int count, int* eof, - ProcItem* item) +dispatch_read(char *page, char **start, off_t off, int count, int *eof, + ProcItem * item) { - char* p = page; + char *p = page; int len; if (off == 0) @@ -243,33 +235,35 @@ dispatch_read(char* page, char** start, off_t off, int count, int* eof, /* ISSUE: I don't understand this code */ len = (p - page); - if (len <= off+count) *eof = 1; + if (len <= off + count) + *eof = 1; *start = page + off; len -= off; - if (len>count) len = count; - if (len<0) len = 0; + if (len > count) + len = count; + if (len < 0) + len = 0; return len; } static int -dispatch_write(struct file* file, const char __user * buffer, - unsigned long count, ProcItem* item) +dispatch_write(struct file *file, const char __user * buffer, + unsigned long count, ProcItem * item) { int result; - char* tmp_buffer; + char *tmp_buffer; /* Arg buffer points to userspace memory, which can't be accessed * directly. Since we're making a copy, zero-terminate the * destination so that sscanf can be used on it safely. */ tmp_buffer = kmalloc(count + 1, GFP_KERNEL); - if(!tmp_buffer) + if (!tmp_buffer) return -ENOMEM; if (copy_from_user(tmp_buffer, buffer, count)) { result = -EFAULT; - } - else { + } else { tmp_buffer[count] = 0; result = item->write_func(tmp_buffer, count); } @@ -277,8 +271,7 @@ dispatch_write(struct file* file, const char __user * buffer, return result; } -static char* -read_lcd(char* p) +static char *read_lcd(char *p) { u32 hci_result; u32 value; @@ -288,7 +281,7 @@ read_lcd(char* p) value = value >> HCI_LCD_BRIGHTNESS_SHIFT; p += sprintf(p, "brightness: %d\n", value); p += sprintf(p, "brightness_levels: %d\n", - HCI_LCD_BRIGHTNESS_LEVELS); + HCI_LCD_BRIGHTNESS_LEVELS); } else { printk(MY_ERR "Error reading LCD brightness\n"); } @@ -296,14 +289,13 @@ read_lcd(char* p) return p; } -static unsigned long -write_lcd(const char* buffer, unsigned long count) +static unsigned long write_lcd(const char *buffer, unsigned long count) { int value; u32 hci_result; if (sscanf(buffer, " brightness : %i", &value) == 1 && - value >= 0 && value < HCI_LCD_BRIGHTNESS_LEVELS) { + value >= 0 && value < HCI_LCD_BRIGHTNESS_LEVELS) { value = value << HCI_LCD_BRIGHTNESS_SHIFT; hci_write1(HCI_LCD_BRIGHTNESS, value, &hci_result); if (hci_result != HCI_SUCCESS) @@ -315,8 +307,7 @@ write_lcd(const char* buffer, unsigned long count) return count; } -static char* -read_video(char* p) +static char *read_video(char *p) { u32 hci_result; u32 value; @@ -325,7 +316,7 @@ read_video(char* p) if (hci_result == HCI_SUCCESS) { int is_lcd = (value & HCI_VIDEO_OUT_LCD) ? 1 : 0; int is_crt = (value & HCI_VIDEO_OUT_CRT) ? 1 : 0; - int is_tv = (value & HCI_VIDEO_OUT_TV ) ? 1 : 0; + int is_tv = (value & HCI_VIDEO_OUT_TV) ? 1 : 0; p += sprintf(p, "lcd_out: %d\n", is_lcd); p += sprintf(p, "crt_out: %d\n", is_crt); p += sprintf(p, "tv_out: %d\n", is_tv); @@ -336,8 +327,7 @@ read_video(char* p) return p; } -static unsigned long -write_video(const char* buffer, unsigned long count) +static unsigned long write_video(const char *buffer, unsigned long count) { int value; int remain = count; @@ -363,7 +353,7 @@ write_video(const char* buffer, unsigned long count) ++buffer; --remain; } - while (remain && *(buffer-1) != ';'); + while (remain && *(buffer - 1) != ';'); } hci_read1(HCI_VIDEO_OUT, &video_out, &hci_result); @@ -386,8 +376,7 @@ write_video(const char* buffer, unsigned long count) return count; } -static char* -read_fan(char* p) +static char *read_fan(char *p) { u32 hci_result; u32 value; @@ -403,14 +392,13 @@ read_fan(char* p) return p; } -static unsigned long -write_fan(const char* buffer, unsigned long count) +static unsigned long write_fan(const char *buffer, unsigned long count) { int value; u32 hci_result; if (sscanf(buffer, " force_on : %i", &value) == 1 && - value >= 0 && value <= 1) { + value >= 0 && value <= 1) { hci_write1(HCI_FAN, value, &hci_result); if (hci_result != HCI_SUCCESS) return -EFAULT; @@ -423,8 +411,7 @@ write_fan(const char* buffer, unsigned long count) return count; } -static char* -read_keys(char* p) +static char *read_keys(char *p) { u32 hci_result; u32 value; @@ -451,17 +438,15 @@ read_keys(char* p) p += sprintf(p, "hotkey_ready: %d\n", key_event_valid); p += sprintf(p, "hotkey: 0x%04x\n", last_key_event); -end: + end: return p; } -static unsigned long -write_keys(const char* buffer, unsigned long count) +static unsigned long write_keys(const char *buffer, unsigned long count) { int value; - if (sscanf(buffer, " hotkey_ready : %i", &value) == 1 && - value == 0) { + if (sscanf(buffer, " hotkey_ready : %i", &value) == 1 && value == 0) { key_event_valid = 0; } else { return -EINVAL; @@ -470,12 +455,11 @@ write_keys(const char* buffer, unsigned long count) return count; } -static char* -read_version(char* p) +static char *read_version(char *p) { p += sprintf(p, "driver: %s\n", TOSHIBA_ACPI_VERSION); p += sprintf(p, "proc_interface: %d\n", - PROC_INTERFACE_VERSION); + PROC_INTERFACE_VERSION); return p; } @@ -484,48 +468,45 @@ read_version(char* p) #define PROC_TOSHIBA "toshiba" -static ProcItem proc_items[] = -{ - { "lcd" , read_lcd , write_lcd }, - { "video" , read_video , write_video }, - { "fan" , read_fan , write_fan }, - { "keys" , read_keys , write_keys }, - { "version" , read_version , NULL }, - { NULL } +static ProcItem proc_items[] = { + {"lcd", read_lcd, write_lcd}, + {"video", read_video, write_video}, + {"fan", read_fan, write_fan}, + {"keys", read_keys, write_keys}, + {"version", read_version, NULL}, + {NULL} }; -static acpi_status __init -add_device(void) +static acpi_status __init add_device(void) { - struct proc_dir_entry* proc; - ProcItem* item; + struct proc_dir_entry *proc; + ProcItem *item; - for (item = proc_items; item->name; ++item) - { + for (item = proc_items; item->name; ++item) { proc = create_proc_read_entry(item->name, - S_IFREG | S_IRUGO | S_IWUSR, - toshiba_proc_dir, (read_proc_t*)dispatch_read, item); + S_IFREG | S_IRUGO | S_IWUSR, + toshiba_proc_dir, + (read_proc_t *) dispatch_read, + item); if (proc) proc->owner = THIS_MODULE; if (proc && item->write_func) - proc->write_proc = (write_proc_t*)dispatch_write; + proc->write_proc = (write_proc_t *) dispatch_write; } return AE_OK; } -static acpi_status __exit -remove_device(void) +static acpi_status __exit remove_device(void) { - ProcItem* item; + ProcItem *item; for (item = proc_items; item->name; ++item) remove_proc_entry(item->name, toshiba_proc_dir); return AE_OK; } -static int __init -toshiba_acpi_init(void) +static int __init toshiba_acpi_init(void) { acpi_status status = AE_OK; u32 hci_result; @@ -533,9 +514,9 @@ toshiba_acpi_init(void) if (acpi_disabled) return -ENODEV; - if (!acpi_specific_hotkey_enabled){ + if (!acpi_specific_hotkey_enabled) { printk(MY_INFO "Using generic hotkey driver\n"); - return -ENODEV; + return -ENODEV; } /* simple device detection: look for HCI method */ if (is_valid_acpi_path(METHOD_HCI_1)) @@ -546,7 +527,7 @@ toshiba_acpi_init(void) return -ENODEV; printk(MY_INFO "Toshiba Laptop ACPI Extras version %s\n", - TOSHIBA_ACPI_VERSION); + TOSHIBA_ACPI_VERSION); printk(MY_INFO " HCI method: %s\n", method_hci); force_fan = 0; @@ -568,8 +549,7 @@ toshiba_acpi_init(void) return (ACPI_SUCCESS(status)) ? 0 : -ENODEV; } -static void __exit -toshiba_acpi_exit(void) +static void __exit toshiba_acpi_exit(void) { remove_device(); diff --git a/drivers/acpi/utilities/utalloc.c b/drivers/acpi/utilities/utalloc.c index 78270f50e62..068450b3647 100644 --- a/drivers/acpi/utilities/utalloc.c +++ b/drivers/acpi/utilities/utalloc.c @@ -41,45 +41,31 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include #define _COMPONENT ACPI_UTILITIES - ACPI_MODULE_NAME ("utalloc") +ACPI_MODULE_NAME("utalloc") /* Local prototypes */ - #ifdef ACPI_DBG_TRACK_ALLOCATIONS -static struct acpi_debug_mem_block * -acpi_ut_find_allocation ( - void *allocation); +static struct acpi_debug_mem_block *acpi_ut_find_allocation(void *allocation); static acpi_status -acpi_ut_track_allocation ( - struct acpi_debug_mem_block *address, - acpi_size size, - u8 alloc_type, - u32 component, - char *module, - u32 line); +acpi_ut_track_allocation(struct acpi_debug_mem_block *address, + acpi_size size, + u8 alloc_type, u32 component, char *module, u32 line); static acpi_status -acpi_ut_remove_allocation ( - struct acpi_debug_mem_block *address, - u32 component, - char *module, - u32 line); -#endif /* ACPI_DBG_TRACK_ALLOCATIONS */ +acpi_ut_remove_allocation(struct acpi_debug_mem_block *address, + u32 component, char *module, u32 line); +#endif /* ACPI_DBG_TRACK_ALLOCATIONS */ #ifdef ACPI_DBG_TRACK_ALLOCATIONS static acpi_status -acpi_ut_create_list ( - char *list_name, - u16 object_size, - struct acpi_memory_list **return_cache); +acpi_ut_create_list(char *list_name, + u16 object_size, struct acpi_memory_list **return_cache); #endif - /******************************************************************************* * * FUNCTION: acpi_ut_create_caches @@ -92,60 +78,68 @@ acpi_ut_create_list ( * ******************************************************************************/ -acpi_status -acpi_ut_create_caches ( - void) +acpi_status acpi_ut_create_caches(void) { - acpi_status status; - + acpi_status status; #ifdef ACPI_DBG_TRACK_ALLOCATIONS /* Memory allocation lists */ - status = acpi_ut_create_list ("Acpi-Global", 0, - &acpi_gbl_global_list); - if (ACPI_FAILURE (status)) { + status = acpi_ut_create_list("Acpi-Global", 0, &acpi_gbl_global_list); + if (ACPI_FAILURE(status)) { return (status); } - status = acpi_ut_create_list ("Acpi-Namespace", sizeof (struct acpi_namespace_node), - &acpi_gbl_ns_node_list); - if (ACPI_FAILURE (status)) { + status = + acpi_ut_create_list("Acpi-Namespace", + sizeof(struct acpi_namespace_node), + &acpi_gbl_ns_node_list); + if (ACPI_FAILURE(status)) { return (status); } #endif /* Object Caches, for frequently used objects */ - status = acpi_os_create_cache ("acpi_state", sizeof (union acpi_generic_state), - ACPI_MAX_STATE_CACHE_DEPTH, &acpi_gbl_state_cache); - if (ACPI_FAILURE (status)) { + status = + acpi_os_create_cache("acpi_state", sizeof(union acpi_generic_state), + ACPI_MAX_STATE_CACHE_DEPTH, + &acpi_gbl_state_cache); + if (ACPI_FAILURE(status)) { return (status); } - status = acpi_os_create_cache ("acpi_parse", sizeof (struct acpi_parse_obj_common), - ACPI_MAX_PARSE_CACHE_DEPTH, &acpi_gbl_ps_node_cache); - if (ACPI_FAILURE (status)) { + status = + acpi_os_create_cache("acpi_parse", + sizeof(struct acpi_parse_obj_common), + ACPI_MAX_PARSE_CACHE_DEPTH, + &acpi_gbl_ps_node_cache); + if (ACPI_FAILURE(status)) { return (status); } - status = acpi_os_create_cache ("acpi_parse_ext", sizeof (struct acpi_parse_obj_named), - ACPI_MAX_EXTPARSE_CACHE_DEPTH, &acpi_gbl_ps_node_ext_cache); - if (ACPI_FAILURE (status)) { + status = + acpi_os_create_cache("acpi_parse_ext", + sizeof(struct acpi_parse_obj_named), + ACPI_MAX_EXTPARSE_CACHE_DEPTH, + &acpi_gbl_ps_node_ext_cache); + if (ACPI_FAILURE(status)) { return (status); } - status = acpi_os_create_cache ("acpi_operand", sizeof (union acpi_operand_object), - ACPI_MAX_OBJECT_CACHE_DEPTH, &acpi_gbl_operand_cache); - if (ACPI_FAILURE (status)) { + status = + acpi_os_create_cache("acpi_operand", + sizeof(union acpi_operand_object), + ACPI_MAX_OBJECT_CACHE_DEPTH, + &acpi_gbl_operand_cache); + if (ACPI_FAILURE(status)) { return (status); } return (AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_ut_delete_caches @@ -158,21 +152,19 @@ acpi_ut_create_caches ( * ******************************************************************************/ -acpi_status -acpi_ut_delete_caches ( - void) +acpi_status acpi_ut_delete_caches(void) { - (void) acpi_os_delete_cache (acpi_gbl_state_cache); + (void)acpi_os_delete_cache(acpi_gbl_state_cache); acpi_gbl_state_cache = NULL; - (void) acpi_os_delete_cache (acpi_gbl_operand_cache); + (void)acpi_os_delete_cache(acpi_gbl_operand_cache); acpi_gbl_operand_cache = NULL; - (void) acpi_os_delete_cache (acpi_gbl_ps_node_cache); + (void)acpi_os_delete_cache(acpi_gbl_ps_node_cache); acpi_gbl_ps_node_cache = NULL; - (void) acpi_os_delete_cache (acpi_gbl_ps_node_ext_cache); + (void)acpi_os_delete_cache(acpi_gbl_ps_node_ext_cache); acpi_gbl_ps_node_ext_cache = NULL; return (AE_OK); @@ -190,9 +182,7 @@ acpi_ut_delete_caches ( * ******************************************************************************/ -acpi_status -acpi_ut_validate_buffer ( - struct acpi_buffer *buffer) +acpi_status acpi_ut_validate_buffer(struct acpi_buffer * buffer) { /* Obviously, the structure pointer must be valid */ @@ -203,9 +193,9 @@ acpi_ut_validate_buffer ( /* Special semantics for the length */ - if ((buffer->length == ACPI_NO_BUFFER) || - (buffer->length == ACPI_ALLOCATE_BUFFER) || - (buffer->length == ACPI_ALLOCATE_LOCAL_BUFFER)) { + if ((buffer->length == ACPI_NO_BUFFER) || + (buffer->length == ACPI_ALLOCATE_BUFFER) || + (buffer->length == ACPI_ALLOCATE_LOCAL_BUFFER)) { return (AE_OK); } @@ -218,7 +208,6 @@ acpi_ut_validate_buffer ( return (AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_ut_initialize_buffer @@ -234,12 +223,10 @@ acpi_ut_validate_buffer ( ******************************************************************************/ acpi_status -acpi_ut_initialize_buffer ( - struct acpi_buffer *buffer, - acpi_size required_length) +acpi_ut_initialize_buffer(struct acpi_buffer * buffer, + acpi_size required_length) { - acpi_status status = AE_OK; - + acpi_status status = AE_OK; switch (buffer->length) { case ACPI_NO_BUFFER: @@ -249,33 +236,30 @@ acpi_ut_initialize_buffer ( status = AE_BUFFER_OVERFLOW; break; - case ACPI_ALLOCATE_BUFFER: /* Allocate a new buffer */ - buffer->pointer = acpi_os_allocate (required_length); + buffer->pointer = acpi_os_allocate(required_length); if (!buffer->pointer) { return (AE_NO_MEMORY); } /* Clear the buffer */ - ACPI_MEMSET (buffer->pointer, 0, required_length); + ACPI_MEMSET(buffer->pointer, 0, required_length); break; - case ACPI_ALLOCATE_LOCAL_BUFFER: /* Allocate a new buffer with local interface to allow tracking */ - buffer->pointer = ACPI_MEM_CALLOCATE (required_length); + buffer->pointer = ACPI_MEM_CALLOCATE(required_length); if (!buffer->pointer) { return (AE_NO_MEMORY); } break; - default: /* Existing buffer: Validate the size of the buffer */ @@ -287,7 +271,7 @@ acpi_ut_initialize_buffer ( /* Clear the buffer */ - ACPI_MEMSET (buffer->pointer, 0, required_length); + ACPI_MEMSET(buffer->pointer, 0, required_length); break; } @@ -295,7 +279,6 @@ acpi_ut_initialize_buffer ( return (status); } - /******************************************************************************* * * FUNCTION: acpi_ut_allocate @@ -311,41 +294,34 @@ acpi_ut_initialize_buffer ( * ******************************************************************************/ -void * -acpi_ut_allocate ( - acpi_size size, - u32 component, - char *module, - u32 line) +void *acpi_ut_allocate(acpi_size size, u32 component, char *module, u32 line) { - void *allocation; - - - ACPI_FUNCTION_TRACE_U32 ("ut_allocate", size); + void *allocation; + ACPI_FUNCTION_TRACE_U32("ut_allocate", size); /* Check for an inadvertent size of zero bytes */ if (!size) { - _ACPI_REPORT_ERROR (module, line, component, - ("ut_allocate: Attempt to allocate zero bytes\n")); + _ACPI_REPORT_ERROR(module, line, component, + ("ut_allocate: Attempt to allocate zero bytes\n")); size = 1; } - allocation = acpi_os_allocate (size); + allocation = acpi_os_allocate(size); if (!allocation) { /* Report allocation error */ - _ACPI_REPORT_ERROR (module, line, component, - ("ut_allocate: Could not allocate size %X\n", (u32) size)); + _ACPI_REPORT_ERROR(module, line, component, + ("ut_allocate: Could not allocate size %X\n", + (u32) size)); - return_PTR (NULL); + return_PTR(NULL); } - return_PTR (allocation); + return_PTR(allocation); } - /******************************************************************************* * * FUNCTION: acpi_ut_callocate @@ -361,43 +337,36 @@ acpi_ut_allocate ( * ******************************************************************************/ -void * -acpi_ut_callocate ( - acpi_size size, - u32 component, - char *module, - u32 line) +void *acpi_ut_callocate(acpi_size size, u32 component, char *module, u32 line) { - void *allocation; - - - ACPI_FUNCTION_TRACE_U32 ("ut_callocate", size); + void *allocation; + ACPI_FUNCTION_TRACE_U32("ut_callocate", size); /* Check for an inadvertent size of zero bytes */ if (!size) { - _ACPI_REPORT_ERROR (module, line, component, - ("ut_callocate: Attempt to allocate zero bytes\n")); - return_PTR (NULL); + _ACPI_REPORT_ERROR(module, line, component, + ("ut_callocate: Attempt to allocate zero bytes\n")); + return_PTR(NULL); } - allocation = acpi_os_allocate (size); + allocation = acpi_os_allocate(size); if (!allocation) { /* Report allocation error */ - _ACPI_REPORT_ERROR (module, line, component, - ("ut_callocate: Could not allocate size %X\n", (u32) size)); - return_PTR (NULL); + _ACPI_REPORT_ERROR(module, line, component, + ("ut_callocate: Could not allocate size %X\n", + (u32) size)); + return_PTR(NULL); } /* Clear the memory block */ - ACPI_MEMSET (allocation, 0, size); - return_PTR (allocation); + ACPI_MEMSET(allocation, 0, size); + return_PTR(allocation); } - #ifdef ACPI_DBG_TRACK_ALLOCATIONS /* * These procedures are used for tracking memory leaks in the subsystem, and @@ -425,29 +394,25 @@ acpi_ut_callocate ( ******************************************************************************/ static acpi_status -acpi_ut_create_list ( - char *list_name, - u16 object_size, - struct acpi_memory_list **return_cache) +acpi_ut_create_list(char *list_name, + u16 object_size, struct acpi_memory_list **return_cache) { - struct acpi_memory_list *cache; + struct acpi_memory_list *cache; - - cache = acpi_os_allocate (sizeof (struct acpi_memory_list)); + cache = acpi_os_allocate(sizeof(struct acpi_memory_list)); if (!cache) { return (AE_NO_MEMORY); } - ACPI_MEMSET (cache, 0, sizeof (struct acpi_memory_list)); + ACPI_MEMSET(cache, 0, sizeof(struct acpi_memory_list)); - cache->list_name = list_name; + cache->list_name = list_name; cache->object_size = object_size; *return_cache = cache; return (AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_ut_allocate_and_track @@ -463,37 +428,33 @@ acpi_ut_create_list ( * ******************************************************************************/ -void * -acpi_ut_allocate_and_track ( - acpi_size size, - u32 component, - char *module, - u32 line) +void *acpi_ut_allocate_and_track(acpi_size size, + u32 component, char *module, u32 line) { - struct acpi_debug_mem_block *allocation; - acpi_status status; - + struct acpi_debug_mem_block *allocation; + acpi_status status; - allocation = acpi_ut_allocate (size + sizeof (struct acpi_debug_mem_header), - component, module, line); + allocation = + acpi_ut_allocate(size + sizeof(struct acpi_debug_mem_header), + component, module, line); if (!allocation) { return (NULL); } - status = acpi_ut_track_allocation (allocation, size, - ACPI_MEM_MALLOC, component, module, line); - if (ACPI_FAILURE (status)) { - acpi_os_free (allocation); + status = acpi_ut_track_allocation(allocation, size, + ACPI_MEM_MALLOC, component, module, + line); + if (ACPI_FAILURE(status)) { + acpi_os_free(allocation); return (NULL); } acpi_gbl_global_list->total_allocated++; acpi_gbl_global_list->current_total_size += (u32) size; - return ((void *) &allocation->user_space); + return ((void *)&allocation->user_space); } - /******************************************************************************* * * FUNCTION: acpi_ut_callocate_and_track @@ -509,41 +470,38 @@ acpi_ut_allocate_and_track ( * ******************************************************************************/ -void * -acpi_ut_callocate_and_track ( - acpi_size size, - u32 component, - char *module, - u32 line) +void *acpi_ut_callocate_and_track(acpi_size size, + u32 component, char *module, u32 line) { - struct acpi_debug_mem_block *allocation; - acpi_status status; - + struct acpi_debug_mem_block *allocation; + acpi_status status; - allocation = acpi_ut_callocate (size + sizeof (struct acpi_debug_mem_header), - component, module, line); + allocation = + acpi_ut_callocate(size + sizeof(struct acpi_debug_mem_header), + component, module, line); if (!allocation) { /* Report allocation error */ - _ACPI_REPORT_ERROR (module, line, component, - ("ut_callocate: Could not allocate size %X\n", (u32) size)); + _ACPI_REPORT_ERROR(module, line, component, + ("ut_callocate: Could not allocate size %X\n", + (u32) size)); return (NULL); } - status = acpi_ut_track_allocation (allocation, size, - ACPI_MEM_CALLOC, component, module, line); - if (ACPI_FAILURE (status)) { - acpi_os_free (allocation); + status = acpi_ut_track_allocation(allocation, size, + ACPI_MEM_CALLOC, component, module, + line); + if (ACPI_FAILURE(status)) { + acpi_os_free(allocation); return (NULL); } acpi_gbl_global_list->total_allocated++; acpi_gbl_global_list->current_total_size += (u32) size; - return ((void *) &allocation->user_space); + return ((void *)&allocation->user_space); } - /******************************************************************************* * * FUNCTION: acpi_ut_free_and_track @@ -560,47 +518,41 @@ acpi_ut_callocate_and_track ( ******************************************************************************/ void -acpi_ut_free_and_track ( - void *allocation, - u32 component, - char *module, - u32 line) +acpi_ut_free_and_track(void *allocation, u32 component, char *module, u32 line) { - struct acpi_debug_mem_block *debug_block; - acpi_status status; - - - ACPI_FUNCTION_TRACE_PTR ("ut_free", allocation); + struct acpi_debug_mem_block *debug_block; + acpi_status status; + ACPI_FUNCTION_TRACE_PTR("ut_free", allocation); if (NULL == allocation) { - _ACPI_REPORT_ERROR (module, line, component, - ("acpi_ut_free: Attempt to delete a NULL address\n")); + _ACPI_REPORT_ERROR(module, line, component, + ("acpi_ut_free: Attempt to delete a NULL address\n")); return_VOID; } - debug_block = ACPI_CAST_PTR (struct acpi_debug_mem_block, - (((char *) allocation) - sizeof (struct acpi_debug_mem_header))); + debug_block = ACPI_CAST_PTR(struct acpi_debug_mem_block, + (((char *)allocation) - + sizeof(struct acpi_debug_mem_header))); acpi_gbl_global_list->total_freed++; acpi_gbl_global_list->current_total_size -= debug_block->size; - status = acpi_ut_remove_allocation (debug_block, - component, module, line); - if (ACPI_FAILURE (status)) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not free memory, %s\n", - acpi_format_exception (status))); + status = acpi_ut_remove_allocation(debug_block, + component, module, line); + if (ACPI_FAILURE(status)) { + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Could not free memory, %s\n", + acpi_format_exception(status))); } - acpi_os_free (debug_block); + acpi_os_free(debug_block); - ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "%p freed\n", allocation)); + ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, "%p freed\n", allocation)); return_VOID; } - /******************************************************************************* * * FUNCTION: acpi_ut_find_allocation @@ -613,15 +565,11 @@ acpi_ut_free_and_track ( * ******************************************************************************/ -static struct acpi_debug_mem_block * -acpi_ut_find_allocation ( - void *allocation) +static struct acpi_debug_mem_block *acpi_ut_find_allocation(void *allocation) { - struct acpi_debug_mem_block *element; - - - ACPI_FUNCTION_ENTRY (); + struct acpi_debug_mem_block *element; + ACPI_FUNCTION_ENTRY(); element = acpi_gbl_global_list->list_head; @@ -638,7 +586,6 @@ acpi_ut_find_allocation ( return (NULL); } - /******************************************************************************* * * FUNCTION: acpi_ut_track_allocation @@ -657,58 +604,51 @@ acpi_ut_find_allocation ( ******************************************************************************/ static acpi_status -acpi_ut_track_allocation ( - struct acpi_debug_mem_block *allocation, - acpi_size size, - u8 alloc_type, - u32 component, - char *module, - u32 line) +acpi_ut_track_allocation(struct acpi_debug_mem_block *allocation, + acpi_size size, + u8 alloc_type, u32 component, char *module, u32 line) { - struct acpi_memory_list *mem_list; - struct acpi_debug_mem_block *element; - acpi_status status = AE_OK; - - - ACPI_FUNCTION_TRACE_PTR ("ut_track_allocation", allocation); + struct acpi_memory_list *mem_list; + struct acpi_debug_mem_block *element; + acpi_status status = AE_OK; + ACPI_FUNCTION_TRACE_PTR("ut_track_allocation", allocation); mem_list = acpi_gbl_global_list; - status = acpi_ut_acquire_mutex (ACPI_MTX_MEMORY); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ut_acquire_mutex(ACPI_MTX_MEMORY); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* * Search list for this address to make sure it is not already on the list. * This will catch several kinds of problems. */ - element = acpi_ut_find_allocation (allocation); + element = acpi_ut_find_allocation(allocation); if (element) { - ACPI_REPORT_ERROR (( - "ut_track_allocation: Allocation already present in list! (%p)\n", - allocation)); + ACPI_REPORT_ERROR(("ut_track_allocation: Allocation already present in list! (%p)\n", allocation)); - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Element %p Address %p\n", - element, allocation)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Element %p Address %p\n", + element, allocation)); goto unlock_and_exit; } /* Fill in the instance data. */ - allocation->size = (u32) size; + allocation->size = (u32) size; allocation->alloc_type = alloc_type; allocation->component = component; - allocation->line = line; + allocation->line = line; - ACPI_STRNCPY (allocation->module, module, ACPI_MAX_MODULE_NAME); - allocation->module[ACPI_MAX_MODULE_NAME-1] = 0; + ACPI_STRNCPY(allocation->module, module, ACPI_MAX_MODULE_NAME); + allocation->module[ACPI_MAX_MODULE_NAME - 1] = 0; /* Insert at list head */ if (mem_list->list_head) { - ((struct acpi_debug_mem_block *)(mem_list->list_head))->previous = allocation; + ((struct acpi_debug_mem_block *)(mem_list->list_head))-> + previous = allocation; } allocation->next = mem_list->list_head; @@ -716,13 +656,11 @@ acpi_ut_track_allocation ( mem_list->list_head = allocation; - -unlock_and_exit: - status = acpi_ut_release_mutex (ACPI_MTX_MEMORY); - return_ACPI_STATUS (status); + unlock_and_exit: + status = acpi_ut_release_mutex(ACPI_MTX_MEMORY); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_ut_remove_allocation @@ -739,40 +677,34 @@ unlock_and_exit: ******************************************************************************/ static acpi_status -acpi_ut_remove_allocation ( - struct acpi_debug_mem_block *allocation, - u32 component, - char *module, - u32 line) +acpi_ut_remove_allocation(struct acpi_debug_mem_block *allocation, + u32 component, char *module, u32 line) { - struct acpi_memory_list *mem_list; - acpi_status status; - - - ACPI_FUNCTION_TRACE ("ut_remove_allocation"); + struct acpi_memory_list *mem_list; + acpi_status status; + ACPI_FUNCTION_TRACE("ut_remove_allocation"); mem_list = acpi_gbl_global_list; if (NULL == mem_list->list_head) { /* No allocations! */ - _ACPI_REPORT_ERROR (module, line, component, - ("ut_remove_allocation: Empty allocation list, nothing to free!\n")); + _ACPI_REPORT_ERROR(module, line, component, + ("ut_remove_allocation: Empty allocation list, nothing to free!\n")); - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - status = acpi_ut_acquire_mutex (ACPI_MTX_MEMORY); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ut_acquire_mutex(ACPI_MTX_MEMORY); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* Unlink */ if (allocation->previous) { (allocation->previous)->next = allocation->next; - } - else { + } else { mem_list->list_head = allocation->next; } @@ -782,16 +714,15 @@ acpi_ut_remove_allocation ( /* Mark the segment as deleted */ - ACPI_MEMSET (&allocation->user_space, 0xEA, allocation->size); + ACPI_MEMSET(&allocation->user_space, 0xEA, allocation->size); - ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Freeing size 0%X\n", - allocation->size)); + ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, "Freeing size 0%X\n", + allocation->size)); - status = acpi_ut_release_mutex (ACPI_MTX_MEMORY); - return_ACPI_STATUS (status); + status = acpi_ut_release_mutex(ACPI_MTX_MEMORY); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_ut_dump_allocation_info @@ -805,15 +736,13 @@ acpi_ut_remove_allocation ( ******************************************************************************/ #ifdef ACPI_FUTURE_USAGE -void -acpi_ut_dump_allocation_info ( - void) +void acpi_ut_dump_allocation_info(void) { /* struct acpi_memory_list *mem_list; */ - ACPI_FUNCTION_TRACE ("ut_dump_allocation_info"); + ACPI_FUNCTION_TRACE("ut_dump_allocation_info"); /* ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES, @@ -826,7 +755,6 @@ acpi_ut_dump_allocation_info ( mem_list->max_concurrent_count, ROUND_UP_TO_1K (mem_list->max_concurrent_size))); - ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES, ("%30s: %4d (%3d Kb)\n", "Total (all) internal objects", running_object_count, @@ -837,7 +765,6 @@ acpi_ut_dump_allocation_info ( running_alloc_count, ROUND_UP_TO_1K (running_alloc_size))); - ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES, ("%30s: %4d (%3d Kb)\n", "Current Nodes", acpi_gbl_current_node_count, @@ -851,8 +778,7 @@ acpi_ut_dump_allocation_info ( */ return_VOID; } -#endif /* ACPI_FUTURE_USAGE */ - +#endif /* ACPI_FUTURE_USAGE */ /******************************************************************************* * @@ -867,84 +793,87 @@ acpi_ut_dump_allocation_info ( * ******************************************************************************/ -void -acpi_ut_dump_allocations ( - u32 component, - char *module) +void acpi_ut_dump_allocations(u32 component, char *module) { - struct acpi_debug_mem_block *element; - union acpi_descriptor *descriptor; - u32 num_outstanding = 0; - - - ACPI_FUNCTION_TRACE ("ut_dump_allocations"); + struct acpi_debug_mem_block *element; + union acpi_descriptor *descriptor; + u32 num_outstanding = 0; + ACPI_FUNCTION_TRACE("ut_dump_allocations"); /* * Walk the allocation list. */ - if (ACPI_FAILURE (acpi_ut_acquire_mutex (ACPI_MTX_MEMORY))) { + if (ACPI_FAILURE(acpi_ut_acquire_mutex(ACPI_MTX_MEMORY))) { return; } element = acpi_gbl_global_list->list_head; while (element) { if ((element->component & component) && - ((module == NULL) || (0 == ACPI_STRCMP (module, element->module)))) { + ((module == NULL) + || (0 == ACPI_STRCMP(module, element->module)))) { /* Ignore allocated objects that are in a cache */ - descriptor = ACPI_CAST_PTR (union acpi_descriptor, &element->user_space); + descriptor = + ACPI_CAST_PTR(union acpi_descriptor, + &element->user_space); if (descriptor->descriptor_id != ACPI_DESC_TYPE_CACHED) { - acpi_os_printf ("%p Len %04X %9.9s-%d [%s] ", - descriptor, element->size, element->module, - element->line, acpi_ut_get_descriptor_name (descriptor)); + acpi_os_printf("%p Len %04X %9.9s-%d [%s] ", + descriptor, element->size, + element->module, element->line, + acpi_ut_get_descriptor_name + (descriptor)); /* Most of the elements will be Operand objects. */ - switch (ACPI_GET_DESCRIPTOR_TYPE (descriptor)) { + switch (ACPI_GET_DESCRIPTOR_TYPE(descriptor)) { case ACPI_DESC_TYPE_OPERAND: - acpi_os_printf ("%12.12s R%hd", - acpi_ut_get_type_name (descriptor->object.common.type), - descriptor->object.common.reference_count); + acpi_os_printf("%12.12s R%hd", + acpi_ut_get_type_name + (descriptor->object. + common.type), + descriptor->object. + common.reference_count); break; case ACPI_DESC_TYPE_PARSER: - acpi_os_printf ("aml_opcode %04hX", - descriptor->op.asl.aml_opcode); + acpi_os_printf("aml_opcode %04hX", + descriptor->op.asl. + aml_opcode); break; case ACPI_DESC_TYPE_NAMED: - acpi_os_printf ("%4.4s", - acpi_ut_get_node_name (&descriptor->node)); + acpi_os_printf("%4.4s", + acpi_ut_get_node_name + (&descriptor->node)); break; default: break; } - acpi_os_printf ( "\n"); + acpi_os_printf("\n"); num_outstanding++; } } element = element->next; } - (void) acpi_ut_release_mutex (ACPI_MTX_MEMORY); + (void)acpi_ut_release_mutex(ACPI_MTX_MEMORY); /* Print summary */ if (!num_outstanding) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "No outstanding allocations.\n")); - } - else { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "%d(%X) Outstanding allocations\n", - num_outstanding, num_outstanding)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "No outstanding allocations.\n")); + } else { + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "%d(%X) Outstanding allocations\n", + num_outstanding, num_outstanding)); } return_VOID; } -#endif /* #ifdef ACPI_DBG_TRACK_ALLOCATIONS */ - +#endif /* #ifdef ACPI_DBG_TRACK_ALLOCATIONS */ diff --git a/drivers/acpi/utilities/utcache.c b/drivers/acpi/utilities/utcache.c index c0df0585c68..93d48681d27 100644 --- a/drivers/acpi/utilities/utcache.c +++ b/drivers/acpi/utilities/utcache.c @@ -41,12 +41,10 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include #define _COMPONENT ACPI_UTILITIES - ACPI_MODULE_NAME ("utcache") - +ACPI_MODULE_NAME("utcache") #ifdef ACPI_USE_LOCAL_CACHE /******************************************************************************* @@ -63,19 +61,14 @@ * DESCRIPTION: Create a cache object * ******************************************************************************/ - acpi_status -acpi_os_create_cache ( - char *cache_name, - u16 object_size, - u16 max_depth, - struct acpi_memory_list **return_cache) +acpi_os_create_cache(char *cache_name, + u16 object_size, + u16 max_depth, struct acpi_memory_list **return_cache) { - struct acpi_memory_list *cache; - - - ACPI_FUNCTION_ENTRY (); + struct acpi_memory_list *cache; + ACPI_FUNCTION_ENTRY(); if (!cache_name || !return_cache || (object_size < 16)) { return (AE_BAD_PARAMETER); @@ -83,24 +76,23 @@ acpi_os_create_cache ( /* Create the cache object */ - cache = acpi_os_allocate (sizeof (struct acpi_memory_list)); + cache = acpi_os_allocate(sizeof(struct acpi_memory_list)); if (!cache) { return (AE_NO_MEMORY); } /* Populate the cache object and return it */ - ACPI_MEMSET (cache, 0, sizeof (struct acpi_memory_list)); + ACPI_MEMSET(cache, 0, sizeof(struct acpi_memory_list)); cache->link_offset = 8; - cache->list_name = cache_name; + cache->list_name = cache_name; cache->object_size = object_size; - cache->max_depth = max_depth; + cache->max_depth = max_depth; *return_cache = cache; return (AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_os_purge_cache @@ -113,15 +105,11 @@ acpi_os_create_cache ( * ******************************************************************************/ -acpi_status -acpi_os_purge_cache ( - struct acpi_memory_list *cache) +acpi_status acpi_os_purge_cache(struct acpi_memory_list * cache) { - char *next; - - - ACPI_FUNCTION_ENTRY (); + char *next; + ACPI_FUNCTION_ENTRY(); if (!cache) { return (AE_BAD_PARAMETER); @@ -132,9 +120,11 @@ acpi_os_purge_cache ( while (cache->list_head) { /* Delete and unlink one cached state object */ - next = *(ACPI_CAST_INDIRECT_PTR (char, - &(((char *) cache->list_head)[cache->link_offset]))); - ACPI_MEM_FREE (cache->list_head); + next = *(ACPI_CAST_INDIRECT_PTR(char, + &(((char *)cache-> + list_head)[cache-> + link_offset]))); + ACPI_MEM_FREE(cache->list_head); cache->list_head = next; cache->current_depth--; @@ -143,7 +133,6 @@ acpi_os_purge_cache ( return (AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_os_delete_cache @@ -157,30 +146,25 @@ acpi_os_purge_cache ( * ******************************************************************************/ -acpi_status -acpi_os_delete_cache ( - struct acpi_memory_list *cache) +acpi_status acpi_os_delete_cache(struct acpi_memory_list * cache) { - acpi_status status; - + acpi_status status; - ACPI_FUNCTION_ENTRY (); + ACPI_FUNCTION_ENTRY(); + /* Purge all objects in the cache */ - /* Purge all objects in the cache */ - - status = acpi_os_purge_cache (cache); - if (ACPI_FAILURE (status)) { + status = acpi_os_purge_cache(cache); + if (ACPI_FAILURE(status)) { return (status); } /* Now we can delete the cache object */ - acpi_os_free (cache); + acpi_os_free(cache); return (AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_os_release_object @@ -196,15 +180,11 @@ acpi_os_delete_cache ( ******************************************************************************/ acpi_status -acpi_os_release_object ( - struct acpi_memory_list *cache, - void *object) +acpi_os_release_object(struct acpi_memory_list * cache, void *object) { - acpi_status status; - - - ACPI_FUNCTION_ENTRY (); + acpi_status status; + ACPI_FUNCTION_ENTRY(); if (!cache || !object) { return (AE_BAD_PARAMETER); @@ -213,37 +193,38 @@ acpi_os_release_object ( /* If cache is full, just free this object */ if (cache->current_depth >= cache->max_depth) { - ACPI_MEM_FREE (object); - ACPI_MEM_TRACKING (cache->total_freed++); + ACPI_MEM_FREE(object); + ACPI_MEM_TRACKING(cache->total_freed++); } /* Otherwise put this object back into the cache */ else { - status = acpi_ut_acquire_mutex (ACPI_MTX_CACHES); - if (ACPI_FAILURE (status)) { + status = acpi_ut_acquire_mutex(ACPI_MTX_CACHES); + if (ACPI_FAILURE(status)) { return (status); } /* Mark the object as cached */ - ACPI_MEMSET (object, 0xCA, cache->object_size); - ACPI_SET_DESCRIPTOR_TYPE (object, ACPI_DESC_TYPE_CACHED); + ACPI_MEMSET(object, 0xCA, cache->object_size); + ACPI_SET_DESCRIPTOR_TYPE(object, ACPI_DESC_TYPE_CACHED); /* Put the object at the head of the cache list */ - * (ACPI_CAST_INDIRECT_PTR (char, - &(((char *) object)[cache->link_offset]))) = cache->list_head; + *(ACPI_CAST_INDIRECT_PTR(char, + &(((char *)object)[cache-> + link_offset]))) = + cache->list_head; cache->list_head = object; cache->current_depth++; - (void) acpi_ut_release_mutex (ACPI_MTX_CACHES); + (void)acpi_ut_release_mutex(ACPI_MTX_CACHES); } return (AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_os_acquire_object @@ -257,27 +238,23 @@ acpi_os_release_object ( * ******************************************************************************/ -void * -acpi_os_acquire_object ( - struct acpi_memory_list *cache) +void *acpi_os_acquire_object(struct acpi_memory_list *cache) { - acpi_status status; - void *object; - - - ACPI_FUNCTION_NAME ("os_acquire_object"); + acpi_status status; + void *object; + ACPI_FUNCTION_NAME("os_acquire_object"); if (!cache) { return (NULL); } - status = acpi_ut_acquire_mutex (ACPI_MTX_CACHES); - if (ACPI_FAILURE (status)) { + status = acpi_ut_acquire_mutex(ACPI_MTX_CACHES); + if (ACPI_FAILURE(status)) { return (NULL); } - ACPI_MEM_TRACKING (cache->requests++); + ACPI_MEM_TRACKING(cache->requests++); /* Check the cache first */ @@ -285,37 +262,39 @@ acpi_os_acquire_object ( /* There is an object available, use it */ object = cache->list_head; - cache->list_head = *(ACPI_CAST_INDIRECT_PTR (char, - &(((char *) object)[cache->link_offset]))); + cache->list_head = *(ACPI_CAST_INDIRECT_PTR(char, + &(((char *) + object)[cache-> + link_offset]))); cache->current_depth--; - ACPI_MEM_TRACKING (cache->hits++); - ACPI_MEM_TRACKING (ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "Object %p from %s cache\n", object, cache->list_name))); + ACPI_MEM_TRACKING(cache->hits++); + ACPI_MEM_TRACKING(ACPI_DEBUG_PRINT((ACPI_DB_EXEC, + "Object %p from %s cache\n", + object, cache->list_name))); - status = acpi_ut_release_mutex (ACPI_MTX_CACHES); - if (ACPI_FAILURE (status)) { + status = acpi_ut_release_mutex(ACPI_MTX_CACHES); + if (ACPI_FAILURE(status)) { return (NULL); } /* Clear (zero) the previously used Object */ - ACPI_MEMSET (object, 0, cache->object_size); - } - else { + ACPI_MEMSET(object, 0, cache->object_size); + } else { /* The cache is empty, create a new object */ - ACPI_MEM_TRACKING (cache->total_allocated++); + ACPI_MEM_TRACKING(cache->total_allocated++); /* Avoid deadlock with ACPI_MEM_CALLOCATE */ - status = acpi_ut_release_mutex (ACPI_MTX_CACHES); - if (ACPI_FAILURE (status)) { + status = acpi_ut_release_mutex(ACPI_MTX_CACHES); + if (ACPI_FAILURE(status)) { return (NULL); } - object = ACPI_MEM_CALLOCATE (cache->object_size); + object = ACPI_MEM_CALLOCATE(cache->object_size); if (!object) { return (NULL); } @@ -323,6 +302,4 @@ acpi_os_acquire_object ( return (object); } -#endif /* ACPI_USE_LOCAL_CACHE */ - - +#endif /* ACPI_USE_LOCAL_CACHE */ diff --git a/drivers/acpi/utilities/utcopy.c b/drivers/acpi/utilities/utcopy.c index 31c30a32e5c..5442b32de61 100644 --- a/drivers/acpi/utilities/utcopy.c +++ b/drivers/acpi/utilities/utcopy.c @@ -41,59 +41,46 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include #include - #define _COMPONENT ACPI_UTILITIES - ACPI_MODULE_NAME ("utcopy") +ACPI_MODULE_NAME("utcopy") /* Local prototypes */ - static acpi_status -acpi_ut_copy_isimple_to_esimple ( - union acpi_operand_object *internal_object, - union acpi_object *external_object, - u8 *data_space, - acpi_size *buffer_space_used); +acpi_ut_copy_isimple_to_esimple(union acpi_operand_object *internal_object, + union acpi_object *external_object, + u8 * data_space, acpi_size * buffer_space_used); static acpi_status -acpi_ut_copy_ielement_to_ielement ( - u8 object_type, - union acpi_operand_object *source_object, - union acpi_generic_state *state, - void *context); +acpi_ut_copy_ielement_to_ielement(u8 object_type, + union acpi_operand_object *source_object, + union acpi_generic_state *state, + void *context); static acpi_status -acpi_ut_copy_ipackage_to_epackage ( - union acpi_operand_object *internal_object, - u8 *buffer, - acpi_size *space_used); +acpi_ut_copy_ipackage_to_epackage(union acpi_operand_object *internal_object, + u8 * buffer, acpi_size * space_used); static acpi_status -acpi_ut_copy_esimple_to_isimple( - union acpi_object *user_obj, - union acpi_operand_object **return_obj); +acpi_ut_copy_esimple_to_isimple(union acpi_object *user_obj, + union acpi_operand_object **return_obj); static acpi_status -acpi_ut_copy_simple_object ( - union acpi_operand_object *source_desc, - union acpi_operand_object *dest_desc); +acpi_ut_copy_simple_object(union acpi_operand_object *source_desc, + union acpi_operand_object *dest_desc); static acpi_status -acpi_ut_copy_ielement_to_eelement ( - u8 object_type, - union acpi_operand_object *source_object, - union acpi_generic_state *state, - void *context); +acpi_ut_copy_ielement_to_eelement(u8 object_type, + union acpi_operand_object *source_object, + union acpi_generic_state *state, + void *context); static acpi_status -acpi_ut_copy_ipackage_to_ipackage ( - union acpi_operand_object *source_obj, - union acpi_operand_object *dest_obj, - struct acpi_walk_state *walk_state); - +acpi_ut_copy_ipackage_to_ipackage(union acpi_operand_object *source_obj, + union acpi_operand_object *dest_obj, + struct acpi_walk_state *walk_state); /******************************************************************************* * @@ -116,17 +103,13 @@ acpi_ut_copy_ipackage_to_ipackage ( ******************************************************************************/ static acpi_status -acpi_ut_copy_isimple_to_esimple ( - union acpi_operand_object *internal_object, - union acpi_object *external_object, - u8 *data_space, - acpi_size *buffer_space_used) +acpi_ut_copy_isimple_to_esimple(union acpi_operand_object *internal_object, + union acpi_object *external_object, + u8 * data_space, acpi_size * buffer_space_used) { - acpi_status status = AE_OK; - - - ACPI_FUNCTION_TRACE ("ut_copy_isimple_to_esimple"); + acpi_status status = AE_OK; + ACPI_FUNCTION_TRACE("ut_copy_isimple_to_esimple"); *buffer_space_used = 0; @@ -135,54 +118,54 @@ acpi_ut_copy_isimple_to_esimple ( * package element) */ if (!internal_object) { - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } /* Always clear the external object */ - ACPI_MEMSET (external_object, 0, sizeof (union acpi_object)); + ACPI_MEMSET(external_object, 0, sizeof(union acpi_object)); /* * In general, the external object will be the same type as * the internal object */ - external_object->type = ACPI_GET_OBJECT_TYPE (internal_object); + external_object->type = ACPI_GET_OBJECT_TYPE(internal_object); /* However, only a limited number of external types are supported */ - switch (ACPI_GET_OBJECT_TYPE (internal_object)) { + switch (ACPI_GET_OBJECT_TYPE(internal_object)) { case ACPI_TYPE_STRING: - external_object->string.pointer = (char *) data_space; + external_object->string.pointer = (char *)data_space; external_object->string.length = internal_object->string.length; - *buffer_space_used = ACPI_ROUND_UP_TO_NATIVE_WORD ( - (acpi_size) internal_object->string.length + 1); - - ACPI_MEMCPY ((void *) data_space, - (void *) internal_object->string.pointer, - (acpi_size) internal_object->string.length + 1); + *buffer_space_used = ACPI_ROUND_UP_TO_NATIVE_WORD((acpi_size) + internal_object-> + string. + length + 1); + + ACPI_MEMCPY((void *)data_space, + (void *)internal_object->string.pointer, + (acpi_size) internal_object->string.length + 1); break; - case ACPI_TYPE_BUFFER: external_object->buffer.pointer = data_space; external_object->buffer.length = internal_object->buffer.length; - *buffer_space_used = ACPI_ROUND_UP_TO_NATIVE_WORD ( - internal_object->string.length); + *buffer_space_used = + ACPI_ROUND_UP_TO_NATIVE_WORD(internal_object->string. + length); - ACPI_MEMCPY ((void *) data_space, - (void *) internal_object->buffer.pointer, - internal_object->buffer.length); + ACPI_MEMCPY((void *)data_space, + (void *)internal_object->buffer.pointer, + internal_object->buffer.length); break; - case ACPI_TYPE_INTEGER: external_object->integer.value = internal_object->integer.value; break; - case ACPI_TYPE_LOCAL_REFERENCE: /* @@ -199,41 +182,41 @@ acpi_ut_copy_isimple_to_esimple ( * to object containing a handle to an ACPI named object. */ external_object->type = ACPI_TYPE_ANY; - external_object->reference.handle = internal_object->reference.node; + external_object->reference.handle = + internal_object->reference.node; break; } break; - case ACPI_TYPE_PROCESSOR: - external_object->processor.proc_id = internal_object->processor.proc_id; - external_object->processor.pblk_address = internal_object->processor.address; - external_object->processor.pblk_length = internal_object->processor.length; + external_object->processor.proc_id = + internal_object->processor.proc_id; + external_object->processor.pblk_address = + internal_object->processor.address; + external_object->processor.pblk_length = + internal_object->processor.length; break; - case ACPI_TYPE_POWER: external_object->power_resource.system_level = - internal_object->power_resource.system_level; + internal_object->power_resource.system_level; external_object->power_resource.resource_order = - internal_object->power_resource.resource_order; + internal_object->power_resource.resource_order; break; - default: /* * There is no corresponding external object type */ - return_ACPI_STATUS (AE_SUPPORT); + return_ACPI_STATUS(AE_SUPPORT); } - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_ut_copy_ielement_to_eelement @@ -247,25 +230,23 @@ acpi_ut_copy_isimple_to_esimple ( ******************************************************************************/ static acpi_status -acpi_ut_copy_ielement_to_eelement ( - u8 object_type, - union acpi_operand_object *source_object, - union acpi_generic_state *state, - void *context) +acpi_ut_copy_ielement_to_eelement(u8 object_type, + union acpi_operand_object *source_object, + union acpi_generic_state *state, + void *context) { - acpi_status status = AE_OK; - struct acpi_pkg_info *info = (struct acpi_pkg_info *) context; - acpi_size object_space; - u32 this_index; - union acpi_object *target_object; - + acpi_status status = AE_OK; + struct acpi_pkg_info *info = (struct acpi_pkg_info *)context; + acpi_size object_space; + u32 this_index; + union acpi_object *target_object; - ACPI_FUNCTION_ENTRY (); + ACPI_FUNCTION_ENTRY(); - - this_index = state->pkg.index; + this_index = state->pkg.index; target_object = (union acpi_object *) - &((union acpi_object *)(state->pkg.dest_object))->package.elements[this_index]; + &((union acpi_object *)(state->pkg.dest_object))->package. + elements[this_index]; switch (object_type) { case ACPI_COPY_TYPE_SIMPLE: @@ -273,23 +254,24 @@ acpi_ut_copy_ielement_to_eelement ( /* * This is a simple or null object */ - status = acpi_ut_copy_isimple_to_esimple (source_object, - target_object, info->free_space, &object_space); - if (ACPI_FAILURE (status)) { + status = acpi_ut_copy_isimple_to_esimple(source_object, + target_object, + info->free_space, + &object_space); + if (ACPI_FAILURE(status)) { return (status); } break; - case ACPI_COPY_TYPE_PACKAGE: /* * Build the package object */ - target_object->type = ACPI_TYPE_PACKAGE; - target_object->package.count = source_object->package.count; + target_object->type = ACPI_TYPE_PACKAGE; + target_object->package.count = source_object->package.count; target_object->package.elements = - ACPI_CAST_PTR (union acpi_object, info->free_space); + ACPI_CAST_PTR(union acpi_object, info->free_space); /* * Pass the new package object back to the package walk routine @@ -300,22 +282,22 @@ acpi_ut_copy_ielement_to_eelement ( * Save space for the array of objects (Package elements) * update the buffer length counter */ - object_space = ACPI_ROUND_UP_TO_NATIVE_WORD ( - (acpi_size) target_object->package.count * - sizeof (union acpi_object)); + object_space = ACPI_ROUND_UP_TO_NATIVE_WORD((acpi_size) + target_object-> + package.count * + sizeof(union + acpi_object)); break; - default: return (AE_BAD_PARAMETER); } - info->free_space += object_space; - info->length += object_space; + info->free_space += object_space; + info->length += object_space; return (status); } - /******************************************************************************* * * FUNCTION: acpi_ut_copy_ipackage_to_epackage @@ -336,55 +318,51 @@ acpi_ut_copy_ielement_to_eelement ( ******************************************************************************/ static acpi_status -acpi_ut_copy_ipackage_to_epackage ( - union acpi_operand_object *internal_object, - u8 *buffer, - acpi_size *space_used) +acpi_ut_copy_ipackage_to_epackage(union acpi_operand_object *internal_object, + u8 * buffer, acpi_size * space_used) { - union acpi_object *external_object; - acpi_status status; - struct acpi_pkg_info info; - - - ACPI_FUNCTION_TRACE ("ut_copy_ipackage_to_epackage"); + union acpi_object *external_object; + acpi_status status; + struct acpi_pkg_info info; + ACPI_FUNCTION_TRACE("ut_copy_ipackage_to_epackage"); /* * First package at head of the buffer */ - external_object = ACPI_CAST_PTR (union acpi_object, buffer); + external_object = ACPI_CAST_PTR(union acpi_object, buffer); /* * Free space begins right after the first package */ - info.length = ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (union acpi_object)); - info.free_space = buffer + ACPI_ROUND_UP_TO_NATIVE_WORD ( - sizeof (union acpi_object)); + info.length = ACPI_ROUND_UP_TO_NATIVE_WORD(sizeof(union acpi_object)); + info.free_space = + buffer + ACPI_ROUND_UP_TO_NATIVE_WORD(sizeof(union acpi_object)); info.object_space = 0; info.num_packages = 1; - external_object->type = ACPI_GET_OBJECT_TYPE (internal_object); - external_object->package.count = internal_object->package.count; - external_object->package.elements = ACPI_CAST_PTR (union acpi_object, - info.free_space); + external_object->type = ACPI_GET_OBJECT_TYPE(internal_object); + external_object->package.count = internal_object->package.count; + external_object->package.elements = ACPI_CAST_PTR(union acpi_object, + info.free_space); /* * Leave room for an array of ACPI_OBJECTS in the buffer * and move the free space past it */ - info.length += (acpi_size) external_object->package.count * - ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (union acpi_object)); + info.length += (acpi_size) external_object->package.count * + ACPI_ROUND_UP_TO_NATIVE_WORD(sizeof(union acpi_object)); info.free_space += external_object->package.count * - ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (union acpi_object)); + ACPI_ROUND_UP_TO_NATIVE_WORD(sizeof(union acpi_object)); - status = acpi_ut_walk_package_tree (internal_object, external_object, - acpi_ut_copy_ielement_to_eelement, &info); + status = acpi_ut_walk_package_tree(internal_object, external_object, + acpi_ut_copy_ielement_to_eelement, + &info); *space_used = info.length; - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_ut_copy_iobject_to_eobject @@ -400,44 +378,45 @@ acpi_ut_copy_ipackage_to_epackage ( ******************************************************************************/ acpi_status -acpi_ut_copy_iobject_to_eobject ( - union acpi_operand_object *internal_object, - struct acpi_buffer *ret_buffer) +acpi_ut_copy_iobject_to_eobject(union acpi_operand_object *internal_object, + struct acpi_buffer *ret_buffer) { - acpi_status status; + acpi_status status; + ACPI_FUNCTION_TRACE("ut_copy_iobject_to_eobject"); - ACPI_FUNCTION_TRACE ("ut_copy_iobject_to_eobject"); - - - if (ACPI_GET_OBJECT_TYPE (internal_object) == ACPI_TYPE_PACKAGE) { + if (ACPI_GET_OBJECT_TYPE(internal_object) == ACPI_TYPE_PACKAGE) { /* * Package object: Copy all subobjects (including * nested packages) */ - status = acpi_ut_copy_ipackage_to_epackage (internal_object, - ret_buffer->pointer, &ret_buffer->length); - } - else { + status = acpi_ut_copy_ipackage_to_epackage(internal_object, + ret_buffer->pointer, + &ret_buffer->length); + } else { /* * Build a simple object (no nested objects) */ - status = acpi_ut_copy_isimple_to_esimple (internal_object, - (union acpi_object *) ret_buffer->pointer, - ((u8 *) ret_buffer->pointer + - ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (union acpi_object))), - &ret_buffer->length); + status = acpi_ut_copy_isimple_to_esimple(internal_object, + (union acpi_object *) + ret_buffer->pointer, + ((u8 *) ret_buffer-> + pointer + + ACPI_ROUND_UP_TO_NATIVE_WORD + (sizeof + (union + acpi_object))), + &ret_buffer->length); /* * build simple does not include the object size in the length * so we add it in here */ - ret_buffer->length += sizeof (union acpi_object); + ret_buffer->length += sizeof(union acpi_object); } - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_ut_copy_esimple_to_isimple @@ -455,15 +434,12 @@ acpi_ut_copy_iobject_to_eobject ( ******************************************************************************/ static acpi_status -acpi_ut_copy_esimple_to_isimple ( - union acpi_object *external_object, - union acpi_operand_object **ret_internal_object) +acpi_ut_copy_esimple_to_isimple(union acpi_object *external_object, + union acpi_operand_object **ret_internal_object) { - union acpi_operand_object *internal_object; - - - ACPI_FUNCTION_TRACE ("ut_copy_esimple_to_isimple"); + union acpi_operand_object *internal_object; + ACPI_FUNCTION_TRACE("ut_copy_esimple_to_isimple"); /* * Simple types supported are: String, Buffer, Integer @@ -473,58 +449,57 @@ acpi_ut_copy_esimple_to_isimple ( case ACPI_TYPE_BUFFER: case ACPI_TYPE_INTEGER: - internal_object = acpi_ut_create_internal_object ( - (u8) external_object->type); + internal_object = acpi_ut_create_internal_object((u8) + external_object-> + type); if (!internal_object) { - return_ACPI_STATUS (AE_NO_MEMORY); + return_ACPI_STATUS(AE_NO_MEMORY); } break; default: /* All other types are not supported */ - return_ACPI_STATUS (AE_SUPPORT); + return_ACPI_STATUS(AE_SUPPORT); } - /* Must COPY string and buffer contents */ switch (external_object->type) { case ACPI_TYPE_STRING: internal_object->string.pointer = - ACPI_MEM_CALLOCATE ((acpi_size) external_object->string.length + 1); + ACPI_MEM_CALLOCATE((acpi_size) external_object->string. + length + 1); if (!internal_object->string.pointer) { goto error_exit; } - ACPI_MEMCPY (internal_object->string.pointer, - external_object->string.pointer, - external_object->string.length); + ACPI_MEMCPY(internal_object->string.pointer, + external_object->string.pointer, + external_object->string.length); internal_object->string.length = external_object->string.length; break; - case ACPI_TYPE_BUFFER: internal_object->buffer.pointer = - ACPI_MEM_CALLOCATE (external_object->buffer.length); + ACPI_MEM_CALLOCATE(external_object->buffer.length); if (!internal_object->buffer.pointer) { goto error_exit; } - ACPI_MEMCPY (internal_object->buffer.pointer, - external_object->buffer.pointer, - external_object->buffer.length); + ACPI_MEMCPY(internal_object->buffer.pointer, + external_object->buffer.pointer, + external_object->buffer.length); internal_object->buffer.length = external_object->buffer.length; break; - case ACPI_TYPE_INTEGER: - internal_object->integer.value = external_object->integer.value; + internal_object->integer.value = external_object->integer.value; break; default: @@ -533,15 +508,13 @@ acpi_ut_copy_esimple_to_isimple ( } *ret_internal_object = internal_object; - return_ACPI_STATUS (AE_OK); - + return_ACPI_STATUS(AE_OK); -error_exit: - acpi_ut_remove_reference (internal_object); - return_ACPI_STATUS (AE_NO_MEMORY); + error_exit: + acpi_ut_remove_reference(internal_object); + return_ACPI_STATUS(AE_NO_MEMORY); } - #ifdef ACPI_FUTURE_IMPLEMENTATION /* Code to convert packages that are parameters to control methods */ @@ -565,22 +538,18 @@ error_exit: ******************************************************************************/ static acpi_status -acpi_ut_copy_epackage_to_ipackage ( - union acpi_operand_object *internal_object, - u8 *buffer, - u32 *space_used) +acpi_ut_copy_epackage_to_ipackage(union acpi_operand_object *internal_object, + u8 * buffer, u32 * space_used) { - u8 *free_space; - union acpi_object *external_object; - u32 length = 0; - u32 this_index; - u32 object_space = 0; - union acpi_operand_object *this_internal_obj; - union acpi_object *this_external_obj; - - - ACPI_FUNCTION_TRACE ("ut_copy_epackage_to_ipackage"); + u8 *free_space; + union acpi_object *external_object; + u32 length = 0; + u32 this_index; + u32 object_space = 0; + union acpi_operand_object *this_internal_obj; + union acpi_object *this_external_obj; + ACPI_FUNCTION_TRACE("ut_copy_epackage_to_ipackage"); /* * First package at head of the buffer @@ -592,24 +561,22 @@ acpi_ut_copy_epackage_to_ipackage ( */ free_space = buffer + sizeof(union acpi_object); - - external_object->type = ACPI_GET_OBJECT_TYPE (internal_object); - external_object->package.count = internal_object->package.count; - external_object->package.elements = (union acpi_object *)free_space; + external_object->type = ACPI_GET_OBJECT_TYPE(internal_object); + external_object->package.count = internal_object->package.count; + external_object->package.elements = (union acpi_object *)free_space; /* * Build an array of ACPI_OBJECTS in the buffer * and move the free space past it */ - free_space += external_object->package.count * sizeof(union acpi_object); - + free_space += + external_object->package.count * sizeof(union acpi_object); /* Call walk_package */ } -#endif /* Future implementation */ - +#endif /* Future implementation */ /******************************************************************************* * @@ -625,37 +592,35 @@ acpi_ut_copy_epackage_to_ipackage ( ******************************************************************************/ acpi_status -acpi_ut_copy_eobject_to_iobject ( - union acpi_object *external_object, - union acpi_operand_object **internal_object) +acpi_ut_copy_eobject_to_iobject(union acpi_object *external_object, + union acpi_operand_object **internal_object) { - acpi_status status; - - - ACPI_FUNCTION_TRACE ("ut_copy_eobject_to_iobject"); + acpi_status status; + ACPI_FUNCTION_TRACE("ut_copy_eobject_to_iobject"); if (external_object->type == ACPI_TYPE_PACKAGE) { /* * Packages as external input to control methods are not supported, */ - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Packages as parameters not implemented!\n")); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Packages as parameters not implemented!\n")); - return_ACPI_STATUS (AE_NOT_IMPLEMENTED); + return_ACPI_STATUS(AE_NOT_IMPLEMENTED); } else { /* * Build a simple object (no nested objects) */ - status = acpi_ut_copy_esimple_to_isimple (external_object, internal_object); + status = + acpi_ut_copy_esimple_to_isimple(external_object, + internal_object); } - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_ut_copy_simple_object @@ -671,23 +636,21 @@ acpi_ut_copy_eobject_to_iobject ( ******************************************************************************/ static acpi_status -acpi_ut_copy_simple_object ( - union acpi_operand_object *source_desc, - union acpi_operand_object *dest_desc) +acpi_ut_copy_simple_object(union acpi_operand_object *source_desc, + union acpi_operand_object *dest_desc) { - u16 reference_count; - union acpi_operand_object *next_object; - + u16 reference_count; + union acpi_operand_object *next_object; /* Save fields from destination that we don't want to overwrite */ reference_count = dest_desc->common.reference_count; next_object = dest_desc->common.next_object; - /* Copy the entire source object over the destination object*/ + /* Copy the entire source object over the destination object */ - ACPI_MEMCPY ((char *) dest_desc, (char *) source_desc, - sizeof (union acpi_operand_object)); + ACPI_MEMCPY((char *)dest_desc, (char *)source_desc, + sizeof(union acpi_operand_object)); /* Restore the saved fields */ @@ -700,7 +663,7 @@ acpi_ut_copy_simple_object ( /* Handle the objects with extra data */ - switch (ACPI_GET_OBJECT_TYPE (dest_desc)) { + switch (ACPI_GET_OBJECT_TYPE(dest_desc)) { case ACPI_TYPE_BUFFER: /* * Allocate and copy the actual buffer if and only if: @@ -708,18 +671,18 @@ acpi_ut_copy_simple_object ( * 2) The buffer has a length > 0 */ if ((source_desc->buffer.pointer) && - (source_desc->buffer.length)) { + (source_desc->buffer.length)) { dest_desc->buffer.pointer = - ACPI_MEM_ALLOCATE (source_desc->buffer.length); + ACPI_MEM_ALLOCATE(source_desc->buffer.length); if (!dest_desc->buffer.pointer) { return (AE_NO_MEMORY); } /* Copy the actual buffer data */ - ACPI_MEMCPY (dest_desc->buffer.pointer, - source_desc->buffer.pointer, - source_desc->buffer.length); + ACPI_MEMCPY(dest_desc->buffer.pointer, + source_desc->buffer.pointer, + source_desc->buffer.length); } break; @@ -731,15 +694,17 @@ acpi_ut_copy_simple_object ( */ if (source_desc->string.pointer) { dest_desc->string.pointer = - ACPI_MEM_ALLOCATE ((acpi_size) source_desc->string.length + 1); + ACPI_MEM_ALLOCATE((acpi_size) source_desc->string. + length + 1); if (!dest_desc->string.pointer) { return (AE_NO_MEMORY); } /* Copy the actual string data */ - ACPI_MEMCPY (dest_desc->string.pointer, source_desc->string.pointer, - (acpi_size) source_desc->string.length + 1); + ACPI_MEMCPY(dest_desc->string.pointer, + source_desc->string.pointer, + (acpi_size) source_desc->string.length + 1); } break; @@ -748,7 +713,7 @@ acpi_ut_copy_simple_object ( * We copied the reference object, so we now must add a reference * to the object pointed to by the reference */ - acpi_ut_add_reference (source_desc->reference.object); + acpi_ut_add_reference(source_desc->reference.object); break; default: @@ -759,7 +724,6 @@ acpi_ut_copy_simple_object ( return (AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_ut_copy_ielement_to_ielement @@ -773,24 +737,21 @@ acpi_ut_copy_simple_object ( ******************************************************************************/ static acpi_status -acpi_ut_copy_ielement_to_ielement ( - u8 object_type, - union acpi_operand_object *source_object, - union acpi_generic_state *state, - void *context) +acpi_ut_copy_ielement_to_ielement(u8 object_type, + union acpi_operand_object *source_object, + union acpi_generic_state *state, + void *context) { - acpi_status status = AE_OK; - u32 this_index; - union acpi_operand_object **this_target_ptr; - union acpi_operand_object *target_object; + acpi_status status = AE_OK; + u32 this_index; + union acpi_operand_object **this_target_ptr; + union acpi_operand_object *target_object; + ACPI_FUNCTION_ENTRY(); - ACPI_FUNCTION_ENTRY (); - - - this_index = state->pkg.index; + this_index = state->pkg.index; this_target_ptr = (union acpi_operand_object **) - &state->pkg.dest_object->package.elements[this_index]; + &state->pkg.dest_object->package.elements[this_index]; switch (object_type) { case ACPI_COPY_TYPE_SIMPLE: @@ -801,34 +762,36 @@ acpi_ut_copy_ielement_to_ielement ( /* * This is a simple object, just copy it */ - target_object = acpi_ut_create_internal_object ( - ACPI_GET_OBJECT_TYPE (source_object)); + target_object = + acpi_ut_create_internal_object(ACPI_GET_OBJECT_TYPE + (source_object)); if (!target_object) { return (AE_NO_MEMORY); } - status = acpi_ut_copy_simple_object (source_object, target_object); - if (ACPI_FAILURE (status)) { + status = + acpi_ut_copy_simple_object(source_object, + target_object); + if (ACPI_FAILURE(status)) { goto error_exit; } *this_target_ptr = target_object; - } - else { + } else { /* Pass through a null element */ *this_target_ptr = NULL; } break; - case ACPI_COPY_TYPE_PACKAGE: /* * This object is a package - go down another nesting level * Create and build the package object */ - target_object = acpi_ut_create_internal_object (ACPI_TYPE_PACKAGE); + target_object = + acpi_ut_create_internal_object(ACPI_TYPE_PACKAGE); if (!target_object) { return (AE_NO_MEMORY); } @@ -840,8 +803,8 @@ acpi_ut_copy_ielement_to_ielement ( * Create the object array */ target_object->package.elements = - ACPI_MEM_CALLOCATE (((acpi_size) source_object->package.count + 1) * - sizeof (void *)); + ACPI_MEM_CALLOCATE(((acpi_size) source_object->package. + count + 1) * sizeof(void *)); if (!target_object->package.elements) { status = AE_NO_MEMORY; goto error_exit; @@ -858,19 +821,17 @@ acpi_ut_copy_ielement_to_ielement ( *this_target_ptr = target_object; break; - default: return (AE_BAD_PARAMETER); } return (status); -error_exit: - acpi_ut_remove_reference (target_object); + error_exit: + acpi_ut_remove_reference(target_object); return (status); } - /******************************************************************************* * * FUNCTION: acpi_ut_copy_ipackage_to_ipackage @@ -886,49 +847,46 @@ error_exit: ******************************************************************************/ static acpi_status -acpi_ut_copy_ipackage_to_ipackage ( - union acpi_operand_object *source_obj, - union acpi_operand_object *dest_obj, - struct acpi_walk_state *walk_state) +acpi_ut_copy_ipackage_to_ipackage(union acpi_operand_object *source_obj, + union acpi_operand_object *dest_obj, + struct acpi_walk_state *walk_state) { - acpi_status status = AE_OK; - - - ACPI_FUNCTION_TRACE ("ut_copy_ipackage_to_ipackage"); + acpi_status status = AE_OK; + ACPI_FUNCTION_TRACE("ut_copy_ipackage_to_ipackage"); - dest_obj->common.type = ACPI_GET_OBJECT_TYPE (source_obj); - dest_obj->common.flags = source_obj->common.flags; + dest_obj->common.type = ACPI_GET_OBJECT_TYPE(source_obj); + dest_obj->common.flags = source_obj->common.flags; dest_obj->package.count = source_obj->package.count; /* * Create the object array and walk the source package tree */ - dest_obj->package.elements = ACPI_MEM_CALLOCATE ( - ((acpi_size) source_obj->package.count + 1) * - sizeof (void *)); + dest_obj->package.elements = ACPI_MEM_CALLOCATE(((acpi_size) + source_obj->package. + count + + 1) * sizeof(void *)); if (!dest_obj->package.elements) { - ACPI_REPORT_ERROR ( - ("aml_build_copy_internal_package_object: Package allocation failure\n")); - return_ACPI_STATUS (AE_NO_MEMORY); + ACPI_REPORT_ERROR(("aml_build_copy_internal_package_object: Package allocation failure\n")); + return_ACPI_STATUS(AE_NO_MEMORY); } /* * Copy the package element-by-element by walking the package "tree". * This handles nested packages of arbitrary depth. */ - status = acpi_ut_walk_package_tree (source_obj, dest_obj, - acpi_ut_copy_ielement_to_ielement, walk_state); - if (ACPI_FAILURE (status)) { + status = acpi_ut_walk_package_tree(source_obj, dest_obj, + acpi_ut_copy_ielement_to_ielement, + walk_state); + if (ACPI_FAILURE(status)) { /* On failure, delete the destination package object */ - acpi_ut_remove_reference (dest_obj); + acpi_ut_remove_reference(dest_obj); } - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_ut_copy_iobject_to_iobject @@ -944,35 +902,31 @@ acpi_ut_copy_ipackage_to_ipackage ( ******************************************************************************/ acpi_status -acpi_ut_copy_iobject_to_iobject ( - union acpi_operand_object *source_desc, - union acpi_operand_object **dest_desc, - struct acpi_walk_state *walk_state) +acpi_ut_copy_iobject_to_iobject(union acpi_operand_object *source_desc, + union acpi_operand_object **dest_desc, + struct acpi_walk_state *walk_state) { - acpi_status status = AE_OK; - - - ACPI_FUNCTION_TRACE ("ut_copy_iobject_to_iobject"); + acpi_status status = AE_OK; + ACPI_FUNCTION_TRACE("ut_copy_iobject_to_iobject"); /* Create the top level object */ - *dest_desc = acpi_ut_create_internal_object (ACPI_GET_OBJECT_TYPE (source_desc)); + *dest_desc = + acpi_ut_create_internal_object(ACPI_GET_OBJECT_TYPE(source_desc)); if (!*dest_desc) { - return_ACPI_STATUS (AE_NO_MEMORY); + return_ACPI_STATUS(AE_NO_MEMORY); } /* Copy the object and possible subobjects */ - if (ACPI_GET_OBJECT_TYPE (source_desc) == ACPI_TYPE_PACKAGE) { - status = acpi_ut_copy_ipackage_to_ipackage (source_desc, *dest_desc, - walk_state); - } - else { - status = acpi_ut_copy_simple_object (source_desc, *dest_desc); + if (ACPI_GET_OBJECT_TYPE(source_desc) == ACPI_TYPE_PACKAGE) { + status = + acpi_ut_copy_ipackage_to_ipackage(source_desc, *dest_desc, + walk_state); + } else { + status = acpi_ut_copy_simple_object(source_desc, *dest_desc); } - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - - diff --git a/drivers/acpi/utilities/utdebug.c b/drivers/acpi/utilities/utdebug.c index c27cbb7f5c5..081a778aba8 100644 --- a/drivers/acpi/utilities/utdebug.c +++ b/drivers/acpi/utilities/utdebug.c @@ -46,21 +46,16 @@ #include #define _COMPONENT ACPI_UTILITIES - ACPI_MODULE_NAME ("utdebug") - +ACPI_MODULE_NAME("utdebug") #ifdef ACPI_DEBUG_OUTPUT - -static u32 acpi_gbl_prev_thread_id = 0xFFFFFFFF; -static char *acpi_gbl_fn_entry_str = "----Entry"; -static char *acpi_gbl_fn_exit_str = "----Exit-"; +static u32 acpi_gbl_prev_thread_id = 0xFFFFFFFF; +static char *acpi_gbl_fn_entry_str = "----Entry"; +static char *acpi_gbl_fn_exit_str = "----Exit-"; /* Local prototypes */ -static const char * -acpi_ut_trim_function_name ( - const char *function_name); - +static const char *acpi_ut_trim_function_name(const char *function_name); /******************************************************************************* * @@ -74,17 +69,13 @@ acpi_ut_trim_function_name ( * ******************************************************************************/ -void -acpi_ut_init_stack_ptr_trace ( - void) +void acpi_ut_init_stack_ptr_trace(void) { - u32 current_sp; - + u32 current_sp; - acpi_gbl_entry_stack_pointer = ACPI_PTR_DIFF (¤t_sp, NULL); + acpi_gbl_entry_stack_pointer = ACPI_PTR_DIFF(¤t_sp, NULL); } - /******************************************************************************* * * FUNCTION: acpi_ut_track_stack_ptr @@ -97,14 +88,11 @@ acpi_ut_init_stack_ptr_trace ( * ******************************************************************************/ -void -acpi_ut_track_stack_ptr ( - void) +void acpi_ut_track_stack_ptr(void) { - acpi_size current_sp; + acpi_size current_sp; - - current_sp = ACPI_PTR_DIFF (¤t_sp, NULL); + current_sp = ACPI_PTR_DIFF(¤t_sp, NULL); if (current_sp < acpi_gbl_lowest_stack_pointer) { acpi_gbl_lowest_stack_pointer = current_sp; @@ -115,7 +103,6 @@ acpi_ut_track_stack_ptr ( } } - /******************************************************************************* * * FUNCTION: acpi_ut_trim_function_name @@ -130,20 +117,18 @@ acpi_ut_track_stack_ptr ( * ******************************************************************************/ -static const char * -acpi_ut_trim_function_name ( - const char *function_name) +static const char *acpi_ut_trim_function_name(const char *function_name) { /* All Function names are longer than 4 chars, check is safe */ - if (*(ACPI_CAST_PTR (u32, function_name)) == ACPI_FUNCTION_PREFIX1) { + if (*(ACPI_CAST_PTR(u32, function_name)) == ACPI_FUNCTION_PREFIX1) { /* This is the case where the original source has not been modified */ return (function_name + 4); } - if (*(ACPI_CAST_PTR (u32, function_name)) == ACPI_FUNCTION_PREFIX2) { + if (*(ACPI_CAST_PTR(u32, function_name)) == ACPI_FUNCTION_PREFIX2) { /* This is the case where the source has been 'linuxized' */ return (function_name + 5); @@ -152,7 +137,6 @@ acpi_ut_trim_function_name ( return (function_name); } - /******************************************************************************* * * FUNCTION: acpi_ut_debug_print @@ -172,38 +156,33 @@ acpi_ut_trim_function_name ( * ******************************************************************************/ -void ACPI_INTERNAL_VAR_XFACE -acpi_ut_debug_print ( - u32 requested_debug_level, - u32 line_number, - const char *function_name, - char *module_name, - u32 component_id, - char *format, - ...) +void ACPI_INTERNAL_VAR_XFACE +acpi_ut_debug_print(u32 requested_debug_level, + u32 line_number, + const char *function_name, + char *module_name, u32 component_id, char *format, ...) { - u32 thread_id; - va_list args; - + u32 thread_id; + va_list args; /* * Stay silent if the debug level or component ID is disabled */ if (!(requested_debug_level & acpi_dbg_level) || - !(component_id & acpi_dbg_layer)) { + !(component_id & acpi_dbg_layer)) { return; } /* * Thread tracking and context switch notification */ - thread_id = acpi_os_get_thread_id (); + thread_id = acpi_os_get_thread_id(); if (thread_id != acpi_gbl_prev_thread_id) { if (ACPI_LV_THREADS & acpi_dbg_level) { - acpi_os_printf ( - "\n**** Context Switch from TID %X to TID %X ****\n\n", - acpi_gbl_prev_thread_id, thread_id); + acpi_os_printf + ("\n**** Context Switch from TID %X to TID %X ****\n\n", + acpi_gbl_prev_thread_id, thread_id); } acpi_gbl_prev_thread_id = thread_id; @@ -213,17 +192,18 @@ acpi_ut_debug_print ( * Display the module name, current line number, thread ID (if requested), * current procedure nesting level, and the current procedure name */ - acpi_os_printf ("%8s-%04ld ", module_name, line_number); + acpi_os_printf("%8s-%04ld ", module_name, line_number); if (ACPI_LV_THREADS & acpi_dbg_level) { - acpi_os_printf ("[%04lX] ", thread_id); + acpi_os_printf("[%04lX] ", thread_id); } - acpi_os_printf ("[%02ld] %-22.22s: ", - acpi_gbl_nesting_level, acpi_ut_trim_function_name (function_name)); + acpi_os_printf("[%02ld] %-22.22s: ", + acpi_gbl_nesting_level, + acpi_ut_trim_function_name(function_name)); - va_start (args, format); - acpi_os_vprintf (format, args); + va_start(args, format); + acpi_os_vprintf(format, args); } EXPORT_SYMBOL(acpi_ut_debug_print); @@ -247,29 +227,24 @@ EXPORT_SYMBOL(acpi_ut_debug_print); * ******************************************************************************/ -void ACPI_INTERNAL_VAR_XFACE -acpi_ut_debug_print_raw ( - u32 requested_debug_level, - u32 line_number, - const char *function_name, - char *module_name, - u32 component_id, - char *format, - ...) +void ACPI_INTERNAL_VAR_XFACE +acpi_ut_debug_print_raw(u32 requested_debug_level, + u32 line_number, + const char *function_name, + char *module_name, u32 component_id, char *format, ...) { - va_list args; - + va_list args; if (!(requested_debug_level & acpi_dbg_level) || - !(component_id & acpi_dbg_layer)) { + !(component_id & acpi_dbg_layer)) { return; } - va_start (args, format); - acpi_os_vprintf (format, args); + va_start(args, format); + acpi_os_vprintf(format, args); } -EXPORT_SYMBOL(acpi_ut_debug_print_raw); +EXPORT_SYMBOL(acpi_ut_debug_print_raw); /******************************************************************************* * @@ -288,22 +263,19 @@ EXPORT_SYMBOL(acpi_ut_debug_print_raw); ******************************************************************************/ void -acpi_ut_trace ( - u32 line_number, - const char *function_name, - char *module_name, - u32 component_id) +acpi_ut_trace(u32 line_number, + const char *function_name, char *module_name, u32 component_id) { acpi_gbl_nesting_level++; - acpi_ut_track_stack_ptr (); + acpi_ut_track_stack_ptr(); - acpi_ut_debug_print (ACPI_LV_FUNCTIONS, - line_number, function_name, module_name, component_id, - "%s\n", acpi_gbl_fn_entry_str); + acpi_ut_debug_print(ACPI_LV_FUNCTIONS, + line_number, function_name, module_name, + component_id, "%s\n", acpi_gbl_fn_entry_str); } -EXPORT_SYMBOL(acpi_ut_trace); +EXPORT_SYMBOL(acpi_ut_trace); /******************************************************************************* * @@ -323,22 +295,19 @@ EXPORT_SYMBOL(acpi_ut_trace); ******************************************************************************/ void -acpi_ut_trace_ptr ( - u32 line_number, - const char *function_name, - char *module_name, - u32 component_id, - void *pointer) +acpi_ut_trace_ptr(u32 line_number, + const char *function_name, + char *module_name, u32 component_id, void *pointer) { acpi_gbl_nesting_level++; - acpi_ut_track_stack_ptr (); + acpi_ut_track_stack_ptr(); - acpi_ut_debug_print (ACPI_LV_FUNCTIONS, - line_number, function_name, module_name, component_id, - "%s %p\n", acpi_gbl_fn_entry_str, pointer); + acpi_ut_debug_print(ACPI_LV_FUNCTIONS, + line_number, function_name, module_name, + component_id, "%s %p\n", acpi_gbl_fn_entry_str, + pointer); } - /******************************************************************************* * * FUNCTION: acpi_ut_trace_str @@ -357,23 +326,20 @@ acpi_ut_trace_ptr ( ******************************************************************************/ void -acpi_ut_trace_str ( - u32 line_number, - const char *function_name, - char *module_name, - u32 component_id, - char *string) +acpi_ut_trace_str(u32 line_number, + const char *function_name, + char *module_name, u32 component_id, char *string) { acpi_gbl_nesting_level++; - acpi_ut_track_stack_ptr (); + acpi_ut_track_stack_ptr(); - acpi_ut_debug_print (ACPI_LV_FUNCTIONS, - line_number, function_name, module_name, component_id, - "%s %s\n", acpi_gbl_fn_entry_str, string); + acpi_ut_debug_print(ACPI_LV_FUNCTIONS, + line_number, function_name, module_name, + component_id, "%s %s\n", acpi_gbl_fn_entry_str, + string); } - /******************************************************************************* * * FUNCTION: acpi_ut_trace_u32 @@ -392,23 +358,20 @@ acpi_ut_trace_str ( ******************************************************************************/ void -acpi_ut_trace_u32 ( - u32 line_number, - const char *function_name, - char *module_name, - u32 component_id, - u32 integer) +acpi_ut_trace_u32(u32 line_number, + const char *function_name, + char *module_name, u32 component_id, u32 integer) { acpi_gbl_nesting_level++; - acpi_ut_track_stack_ptr (); + acpi_ut_track_stack_ptr(); - acpi_ut_debug_print (ACPI_LV_FUNCTIONS, - line_number, function_name, module_name, component_id, - "%s %08X\n", acpi_gbl_fn_entry_str, integer); + acpi_ut_debug_print(ACPI_LV_FUNCTIONS, + line_number, function_name, module_name, + component_id, "%s %08X\n", acpi_gbl_fn_entry_str, + integer); } - /******************************************************************************* * * FUNCTION: acpi_ut_exit @@ -426,21 +389,18 @@ acpi_ut_trace_u32 ( ******************************************************************************/ void -acpi_ut_exit ( - u32 line_number, - const char *function_name, - char *module_name, - u32 component_id) +acpi_ut_exit(u32 line_number, + const char *function_name, char *module_name, u32 component_id) { - acpi_ut_debug_print (ACPI_LV_FUNCTIONS, - line_number, function_name, module_name, component_id, - "%s\n", acpi_gbl_fn_exit_str); + acpi_ut_debug_print(ACPI_LV_FUNCTIONS, + line_number, function_name, module_name, + component_id, "%s\n", acpi_gbl_fn_exit_str); acpi_gbl_nesting_level--; } -EXPORT_SYMBOL(acpi_ut_exit); +EXPORT_SYMBOL(acpi_ut_exit); /******************************************************************************* * @@ -460,31 +420,29 @@ EXPORT_SYMBOL(acpi_ut_exit); ******************************************************************************/ void -acpi_ut_status_exit ( - u32 line_number, - const char *function_name, - char *module_name, - u32 component_id, - acpi_status status) +acpi_ut_status_exit(u32 line_number, + const char *function_name, + char *module_name, u32 component_id, acpi_status status) { - if (ACPI_SUCCESS (status)) { - acpi_ut_debug_print (ACPI_LV_FUNCTIONS, - line_number, function_name, module_name, component_id, - "%s %s\n", acpi_gbl_fn_exit_str, - acpi_format_exception (status)); - } - else { - acpi_ut_debug_print (ACPI_LV_FUNCTIONS, - line_number, function_name, module_name, component_id, - "%s ****Exception****: %s\n", acpi_gbl_fn_exit_str, - acpi_format_exception (status)); + if (ACPI_SUCCESS(status)) { + acpi_ut_debug_print(ACPI_LV_FUNCTIONS, + line_number, function_name, module_name, + component_id, "%s %s\n", + acpi_gbl_fn_exit_str, + acpi_format_exception(status)); + } else { + acpi_ut_debug_print(ACPI_LV_FUNCTIONS, + line_number, function_name, module_name, + component_id, "%s ****Exception****: %s\n", + acpi_gbl_fn_exit_str, + acpi_format_exception(status)); } acpi_gbl_nesting_level--; } -EXPORT_SYMBOL(acpi_ut_status_exit); +EXPORT_SYMBOL(acpi_ut_status_exit); /******************************************************************************* * @@ -504,23 +462,20 @@ EXPORT_SYMBOL(acpi_ut_status_exit); ******************************************************************************/ void -acpi_ut_value_exit ( - u32 line_number, - const char *function_name, - char *module_name, - u32 component_id, - acpi_integer value) +acpi_ut_value_exit(u32 line_number, + const char *function_name, + char *module_name, u32 component_id, acpi_integer value) { - acpi_ut_debug_print (ACPI_LV_FUNCTIONS, - line_number, function_name, module_name, component_id, - "%s %8.8X%8.8X\n", acpi_gbl_fn_exit_str, - ACPI_FORMAT_UINT64 (value)); + acpi_ut_debug_print(ACPI_LV_FUNCTIONS, + line_number, function_name, module_name, + component_id, "%s %8.8X%8.8X\n", + acpi_gbl_fn_exit_str, ACPI_FORMAT_UINT64(value)); acpi_gbl_nesting_level--; } -EXPORT_SYMBOL(acpi_ut_value_exit); +EXPORT_SYMBOL(acpi_ut_value_exit); /******************************************************************************* * @@ -540,24 +495,20 @@ EXPORT_SYMBOL(acpi_ut_value_exit); ******************************************************************************/ void -acpi_ut_ptr_exit ( - u32 line_number, - const char *function_name, - char *module_name, - u32 component_id, - u8 *ptr) +acpi_ut_ptr_exit(u32 line_number, + const char *function_name, + char *module_name, u32 component_id, u8 * ptr) { - acpi_ut_debug_print (ACPI_LV_FUNCTIONS, - line_number, function_name, module_name, component_id, - "%s %p\n", acpi_gbl_fn_exit_str, ptr); + acpi_ut_debug_print(ACPI_LV_FUNCTIONS, + line_number, function_name, module_name, + component_id, "%s %p\n", acpi_gbl_fn_exit_str, ptr); acpi_gbl_nesting_level--; } #endif - /******************************************************************************* * * FUNCTION: acpi_ut_dump_buffer @@ -573,23 +524,17 @@ acpi_ut_ptr_exit ( * ******************************************************************************/ -void -acpi_ut_dump_buffer ( - u8 *buffer, - u32 count, - u32 display, - u32 component_id) +void acpi_ut_dump_buffer(u8 * buffer, u32 count, u32 display, u32 component_id) { - acpi_native_uint i = 0; - acpi_native_uint j; - u32 temp32; - u8 buf_char; - + acpi_native_uint i = 0; + acpi_native_uint j; + u32 temp32; + u8 buf_char; /* Only dump the buffer if tracing is enabled */ if (!((ACPI_LV_TABLES & acpi_dbg_level) && - (component_id & acpi_dbg_layer))) { + (component_id & acpi_dbg_layer))) { return; } @@ -602,7 +547,7 @@ acpi_ut_dump_buffer ( while (i < count) { /* Print current offset */ - acpi_os_printf ("%6.4X: ", (u32) i); + acpi_os_printf("%6.4X: ", (u32) i); /* Print 16 hex chars */ @@ -610,39 +555,36 @@ acpi_ut_dump_buffer ( if (i + j >= count) { /* Dump fill spaces */ - acpi_os_printf ("%*s", ((display * 2) + 1), " "); + acpi_os_printf("%*s", ((display * 2) + 1), " "); j += (acpi_native_uint) display; continue; } switch (display) { - default: /* Default is BYTE display */ + default: /* Default is BYTE display */ - acpi_os_printf ("%02X ", buffer[i + j]); + acpi_os_printf("%02X ", buffer[i + j]); break; - case DB_WORD_DISPLAY: - ACPI_MOVE_16_TO_32 (&temp32, &buffer[i + j]); - acpi_os_printf ("%04X ", temp32); + ACPI_MOVE_16_TO_32(&temp32, &buffer[i + j]); + acpi_os_printf("%04X ", temp32); break; - case DB_DWORD_DISPLAY: - ACPI_MOVE_32_TO_32 (&temp32, &buffer[i + j]); - acpi_os_printf ("%08X ", temp32); + ACPI_MOVE_32_TO_32(&temp32, &buffer[i + j]); + acpi_os_printf("%08X ", temp32); break; - case DB_QWORD_DISPLAY: - ACPI_MOVE_32_TO_32 (&temp32, &buffer[i + j]); - acpi_os_printf ("%08X", temp32); + ACPI_MOVE_32_TO_32(&temp32, &buffer[i + j]); + acpi_os_printf("%08X", temp32); - ACPI_MOVE_32_TO_32 (&temp32, &buffer[i + j + 4]); - acpi_os_printf ("%08X ", temp32); + ACPI_MOVE_32_TO_32(&temp32, &buffer[i + j + 4]); + acpi_os_printf("%08X ", temp32); break; } @@ -653,28 +595,26 @@ acpi_ut_dump_buffer ( * Print the ASCII equivalent characters but watch out for the bad * unprintable ones (printable chars are 0x20 through 0x7E) */ - acpi_os_printf (" "); + acpi_os_printf(" "); for (j = 0; j < 16; j++) { if (i + j >= count) { - acpi_os_printf ("\n"); + acpi_os_printf("\n"); return; } buf_char = buffer[i + j]; - if (ACPI_IS_PRINT (buf_char)) { - acpi_os_printf ("%c", buf_char); - } - else { - acpi_os_printf ("."); + if (ACPI_IS_PRINT(buf_char)) { + acpi_os_printf("%c", buf_char); + } else { + acpi_os_printf("."); } } /* Done with that line. */ - acpi_os_printf ("\n"); + acpi_os_printf("\n"); i += 16; } return; } - diff --git a/drivers/acpi/utilities/utdelete.c b/drivers/acpi/utilities/utdelete.c index eeafb324c50..2bc878f7a12 100644 --- a/drivers/acpi/utilities/utdelete.c +++ b/drivers/acpi/utilities/utdelete.c @@ -41,7 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include #include #include @@ -49,19 +48,13 @@ #include #define _COMPONENT ACPI_UTILITIES - ACPI_MODULE_NAME ("utdelete") +ACPI_MODULE_NAME("utdelete") /* Local prototypes */ +static void acpi_ut_delete_internal_obj(union acpi_operand_object *object); static void -acpi_ut_delete_internal_obj ( - union acpi_operand_object *object); - -static void -acpi_ut_update_ref_count ( - union acpi_operand_object *object, - u32 action); - +acpi_ut_update_ref_count(union acpi_operand_object *object, u32 action); /******************************************************************************* * @@ -76,18 +69,14 @@ acpi_ut_update_ref_count ( * ******************************************************************************/ -static void -acpi_ut_delete_internal_obj ( - union acpi_operand_object *object) +static void acpi_ut_delete_internal_obj(union acpi_operand_object *object) { - void *obj_pointer = NULL; - union acpi_operand_object *handler_desc; - union acpi_operand_object *second_desc; - union acpi_operand_object *next_desc; - - - ACPI_FUNCTION_TRACE_PTR ("ut_delete_internal_obj", object); + void *obj_pointer = NULL; + union acpi_operand_object *handler_desc; + union acpi_operand_object *second_desc; + union acpi_operand_object *next_desc; + ACPI_FUNCTION_TRACE_PTR("ut_delete_internal_obj", object); if (!object) { return_VOID; @@ -97,11 +86,12 @@ acpi_ut_delete_internal_obj ( * Must delete or free any pointers within the object that are not * actual ACPI objects (for example, a raw buffer pointer). */ - switch (ACPI_GET_OBJECT_TYPE (object)) { + switch (ACPI_GET_OBJECT_TYPE(object)) { case ACPI_TYPE_STRING: - ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "**** String %p, ptr %p\n", - object, object->string.pointer)); + ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, + "**** String %p, ptr %p\n", object, + object->string.pointer)); /* Free the actual string buffer */ @@ -112,11 +102,11 @@ acpi_ut_delete_internal_obj ( } break; - case ACPI_TYPE_BUFFER: - ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "**** Buffer %p, ptr %p\n", - object, object->buffer.pointer)); + ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, + "**** Buffer %p, ptr %p\n", object, + object->buffer.pointer)); /* Free the actual buffer */ @@ -127,11 +117,11 @@ acpi_ut_delete_internal_obj ( } break; - case ACPI_TYPE_PACKAGE: - ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, " **** Package of count %X\n", - object->package.count)); + ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, + " **** Package of count %X\n", + object->package.count)); /* * Elements of the package are not handled here, they are deleted @@ -143,11 +133,11 @@ acpi_ut_delete_internal_obj ( obj_pointer = object->package.elements; break; - case ACPI_TYPE_DEVICE: if (object->device.gpe_block) { - (void) acpi_ev_delete_gpe_block (object->device.gpe_block); + (void)acpi_ev_delete_gpe_block(object->device. + gpe_block); } /* Walk the handler list for this device */ @@ -155,54 +145,51 @@ acpi_ut_delete_internal_obj ( handler_desc = object->device.handler; while (handler_desc) { next_desc = handler_desc->address_space.next; - acpi_ut_remove_reference (handler_desc); + acpi_ut_remove_reference(handler_desc); handler_desc = next_desc; } break; - case ACPI_TYPE_MUTEX: - ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, - "***** Mutex %p, Semaphore %p\n", - object, object->mutex.semaphore)); + ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, + "***** Mutex %p, Semaphore %p\n", + object, object->mutex.semaphore)); - acpi_ex_unlink_mutex (object); - (void) acpi_os_delete_semaphore (object->mutex.semaphore); + acpi_ex_unlink_mutex(object); + (void)acpi_os_delete_semaphore(object->mutex.semaphore); break; - case ACPI_TYPE_EVENT: - ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, - "***** Event %p, Semaphore %p\n", - object, object->event.semaphore)); + ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, + "***** Event %p, Semaphore %p\n", + object, object->event.semaphore)); - (void) acpi_os_delete_semaphore (object->event.semaphore); + (void)acpi_os_delete_semaphore(object->event.semaphore); object->event.semaphore = NULL; break; - case ACPI_TYPE_METHOD: - ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, - "***** Method %p\n", object)); + ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, + "***** Method %p\n", object)); /* Delete the method semaphore if it exists */ if (object->method.semaphore) { - (void) acpi_os_delete_semaphore (object->method.semaphore); + (void)acpi_os_delete_semaphore(object->method. + semaphore); object->method.semaphore = NULL; } break; - case ACPI_TYPE_REGION: - ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, - "***** Region %p\n", object)); + ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, + "***** Region %p\n", object)); - second_desc = acpi_ns_get_secondary_object (object); + second_desc = acpi_ns_get_secondary_object(object); if (second_desc) { /* * Free the region_context if and only if the handler is one of the @@ -211,32 +198,33 @@ acpi_ut_delete_internal_obj ( */ handler_desc = object->region.handler; if (handler_desc) { - if (handler_desc->address_space.hflags & ACPI_ADDR_HANDLER_DEFAULT_INSTALLED) { - obj_pointer = second_desc->extra.region_context; + if (handler_desc->address_space. + hflags & + ACPI_ADDR_HANDLER_DEFAULT_INSTALLED) { + obj_pointer = + second_desc->extra.region_context; } - acpi_ut_remove_reference (handler_desc); + acpi_ut_remove_reference(handler_desc); } /* Now we can free the Extra object */ - acpi_ut_delete_object_desc (second_desc); + acpi_ut_delete_object_desc(second_desc); } break; - case ACPI_TYPE_BUFFER_FIELD: - ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, - "***** Buffer Field %p\n", object)); + ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, + "***** Buffer Field %p\n", object)); - second_desc = acpi_ns_get_secondary_object (object); + second_desc = acpi_ns_get_secondary_object(object); if (second_desc) { - acpi_ut_delete_object_desc (second_desc); + acpi_ut_delete_object_desc(second_desc); } break; - default: break; } @@ -244,21 +232,20 @@ acpi_ut_delete_internal_obj ( /* Free any allocated memory (pointer within the object) found above */ if (obj_pointer) { - ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Deleting Object Subptr %p\n", - obj_pointer)); - ACPI_MEM_FREE (obj_pointer); + ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, + "Deleting Object Subptr %p\n", obj_pointer)); + ACPI_MEM_FREE(obj_pointer); } /* Now the object can be safely deleted */ - ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Deleting Object %p [%s]\n", - object, acpi_ut_get_object_type_name (object))); + ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, "Deleting Object %p [%s]\n", + object, acpi_ut_get_object_type_name(object))); - acpi_ut_delete_object_desc (object); + acpi_ut_delete_object_desc(object); return_VOID; } - /******************************************************************************* * * FUNCTION: acpi_ut_delete_internal_object_list @@ -272,29 +259,24 @@ acpi_ut_delete_internal_obj ( * ******************************************************************************/ -void -acpi_ut_delete_internal_object_list ( - union acpi_operand_object **obj_list) +void acpi_ut_delete_internal_object_list(union acpi_operand_object **obj_list) { - union acpi_operand_object **internal_obj; - - - ACPI_FUNCTION_TRACE ("ut_delete_internal_object_list"); + union acpi_operand_object **internal_obj; + ACPI_FUNCTION_TRACE("ut_delete_internal_object_list"); /* Walk the null-terminated internal list */ for (internal_obj = obj_list; *internal_obj; internal_obj++) { - acpi_ut_remove_reference (*internal_obj); + acpi_ut_remove_reference(*internal_obj); } /* Free the combined parameter pointer list and object array */ - ACPI_MEM_FREE (obj_list); + ACPI_MEM_FREE(obj_list); return_VOID; } - /******************************************************************************* * * FUNCTION: acpi_ut_update_ref_count @@ -309,16 +291,12 @@ acpi_ut_delete_internal_object_list ( ******************************************************************************/ static void -acpi_ut_update_ref_count ( - union acpi_operand_object *object, - u32 action) +acpi_ut_update_ref_count(union acpi_operand_object *object, u32 action) { - u16 count; - u16 new_count; - - - ACPI_FUNCTION_NAME ("ut_update_ref_count"); + u16 count; + u16 new_count; + ACPI_FUNCTION_NAME("ut_update_ref_count"); if (!object) { return; @@ -338,58 +316,55 @@ acpi_ut_update_ref_count ( new_count++; object->common.reference_count = new_count; - ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, - "Obj %p Refs=%X, [Incremented]\n", - object, new_count)); + ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, + "Obj %p Refs=%X, [Incremented]\n", + object, new_count)); break; - case REF_DECREMENT: if (count < 1) { - ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, - "Obj %p Refs=%X, can't decrement! (Set to 0)\n", - object, new_count)); + ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, + "Obj %p Refs=%X, can't decrement! (Set to 0)\n", + object, new_count)); new_count = 0; - } - else { + } else { new_count--; - ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, - "Obj %p Refs=%X, [Decremented]\n", - object, new_count)); + ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, + "Obj %p Refs=%X, [Decremented]\n", + object, new_count)); } - if (ACPI_GET_OBJECT_TYPE (object) == ACPI_TYPE_METHOD) { - ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, - "Method Obj %p Refs=%X, [Decremented]\n", - object, new_count)); + if (ACPI_GET_OBJECT_TYPE(object) == ACPI_TYPE_METHOD) { + ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, + "Method Obj %p Refs=%X, [Decremented]\n", + object, new_count)); } object->common.reference_count = new_count; if (new_count == 0) { - acpi_ut_delete_internal_obj (object); + acpi_ut_delete_internal_obj(object); } break; - case REF_FORCE_DELETE: - ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, - "Obj %p Refs=%X, Force delete! (Set to 0)\n", - object, count)); + ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, + "Obj %p Refs=%X, Force delete! (Set to 0)\n", + object, count)); new_count = 0; object->common.reference_count = new_count; - acpi_ut_delete_internal_obj (object); + acpi_ut_delete_internal_obj(object); break; - default: - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown action (%X)\n", action)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unknown action (%X)\n", + action)); break; } @@ -399,15 +374,14 @@ acpi_ut_update_ref_count ( */ if (count > ACPI_MAX_REFERENCE_COUNT) { - ACPI_DEBUG_PRINT ((ACPI_DB_WARN, - "**** Warning **** Large Reference Count (%X) in object %p\n\n", - count, object)); + ACPI_DEBUG_PRINT((ACPI_DB_WARN, + "**** Warning **** Large Reference Count (%X) in object %p\n\n", + count, object)); } return; } - /******************************************************************************* * * FUNCTION: acpi_ut_update_object_reference @@ -431,38 +405,36 @@ acpi_ut_update_ref_count ( ******************************************************************************/ acpi_status -acpi_ut_update_object_reference ( - union acpi_operand_object *object, - u16 action) +acpi_ut_update_object_reference(union acpi_operand_object * object, u16 action) { - acpi_status status = AE_OK; - union acpi_generic_state *state_list = NULL; - union acpi_operand_object *next_object = NULL; - union acpi_generic_state *state; - acpi_native_uint i; - - - ACPI_FUNCTION_TRACE_PTR ("ut_update_object_reference", object); + acpi_status status = AE_OK; + union acpi_generic_state *state_list = NULL; + union acpi_operand_object *next_object = NULL; + union acpi_generic_state *state; + acpi_native_uint i; + ACPI_FUNCTION_TRACE_PTR("ut_update_object_reference", object); while (object) { /* Make sure that this isn't a namespace handle */ - if (ACPI_GET_DESCRIPTOR_TYPE (object) == ACPI_DESC_TYPE_NAMED) { - ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, - "Object %p is NS handle\n", object)); - return_ACPI_STATUS (AE_OK); + if (ACPI_GET_DESCRIPTOR_TYPE(object) == ACPI_DESC_TYPE_NAMED) { + ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, + "Object %p is NS handle\n", object)); + return_ACPI_STATUS(AE_OK); } /* * All sub-objects must have their reference count incremented also. * Different object types have different subobjects. */ - switch (ACPI_GET_OBJECT_TYPE (object)) { + switch (ACPI_GET_OBJECT_TYPE(object)) { case ACPI_TYPE_DEVICE: - acpi_ut_update_ref_count (object->device.system_notify, action); - acpi_ut_update_ref_count (object->device.device_notify, action); + acpi_ut_update_ref_count(object->device.system_notify, + action); + acpi_ut_update_ref_count(object->device.device_notify, + action); break; case ACPI_TYPE_PACKAGE: @@ -476,9 +448,11 @@ acpi_ut_update_object_reference ( * Note: There can be null elements within the package, * these are simply ignored */ - status = acpi_ut_create_update_state_and_push ( - object->package.elements[i], action, &state_list); - if (ACPI_FAILURE (status)) { + status = + acpi_ut_create_update_state_and_push + (object->package.elements[i], action, + &state_list); + if (ACPI_FAILURE(status)) { goto error_exit; } } @@ -497,9 +471,13 @@ acpi_ut_update_object_reference ( case ACPI_TYPE_LOCAL_BANK_FIELD: next_object = object->bank_field.bank_obj; - status = acpi_ut_create_update_state_and_push ( - object->bank_field.region_obj, action, &state_list); - if (ACPI_FAILURE (status)) { + status = + acpi_ut_create_update_state_and_push(object-> + bank_field. + region_obj, + action, + &state_list); + if (ACPI_FAILURE(status)) { goto error_exit; } break; @@ -507,9 +485,13 @@ acpi_ut_update_object_reference ( case ACPI_TYPE_LOCAL_INDEX_FIELD: next_object = object->index_field.index_obj; - status = acpi_ut_create_update_state_and_push ( - object->index_field.data_obj, action, &state_list); - if (ACPI_FAILURE (status)) { + status = + acpi_ut_create_update_state_and_push(object-> + index_field. + data_obj, + action, + &state_list); + if (ACPI_FAILURE(status)) { goto error_exit; } break; @@ -526,7 +508,7 @@ acpi_ut_update_object_reference ( case ACPI_TYPE_REGION: default: - break;/* No subobjects */ + break; /* No subobjects */ } /* @@ -534,7 +516,7 @@ acpi_ut_update_object_reference ( * happen after we update the sub-objects in case this causes the * main object to be deleted. */ - acpi_ut_update_ref_count (object, action); + acpi_ut_update_ref_count(object, action); object = NULL; /* Move on to the next object to be updated */ @@ -542,25 +524,23 @@ acpi_ut_update_object_reference ( if (next_object) { object = next_object; next_object = NULL; - } - else if (state_list) { - state = acpi_ut_pop_generic_state (&state_list); + } else if (state_list) { + state = acpi_ut_pop_generic_state(&state_list); object = state->update.object; - acpi_ut_delete_generic_state (state); + acpi_ut_delete_generic_state(state); } } - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); -error_exit: + error_exit: - ACPI_REPORT_ERROR (("Could not update object reference count, %s\n", - acpi_format_exception (status))); + ACPI_REPORT_ERROR(("Could not update object reference count, %s\n", + acpi_format_exception(status))); - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_ut_add_reference @@ -574,31 +554,27 @@ error_exit: * ******************************************************************************/ -void -acpi_ut_add_reference ( - union acpi_operand_object *object) +void acpi_ut_add_reference(union acpi_operand_object *object) { - ACPI_FUNCTION_TRACE_PTR ("ut_add_reference", object); - + ACPI_FUNCTION_TRACE_PTR("ut_add_reference", object); /* Ensure that we have a valid object */ - if (!acpi_ut_valid_internal_object (object)) { + if (!acpi_ut_valid_internal_object(object)) { return_VOID; } - ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, - "Obj %p Current Refs=%X [To Be Incremented]\n", - object, object->common.reference_count)); + ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, + "Obj %p Current Refs=%X [To Be Incremented]\n", + object, object->common.reference_count)); /* Increment the reference count */ - (void) acpi_ut_update_object_reference (object, REF_INCREMENT); + (void)acpi_ut_update_object_reference(object, REF_INCREMENT); return_VOID; } - /******************************************************************************* * * FUNCTION: acpi_ut_remove_reference @@ -611,13 +587,10 @@ acpi_ut_add_reference ( * ******************************************************************************/ -void -acpi_ut_remove_reference ( - union acpi_operand_object *object) +void acpi_ut_remove_reference(union acpi_operand_object *object) { - ACPI_FUNCTION_TRACE_PTR ("ut_remove_reference", object); - + ACPI_FUNCTION_TRACE_PTR("ut_remove_reference", object); /* * Allow a NULL pointer to be passed in, just ignore it. This saves @@ -625,27 +598,25 @@ acpi_ut_remove_reference ( * */ if (!object || - (ACPI_GET_DESCRIPTOR_TYPE (object) == ACPI_DESC_TYPE_NAMED)) { + (ACPI_GET_DESCRIPTOR_TYPE(object) == ACPI_DESC_TYPE_NAMED)) { return_VOID; } /* Ensure that we have a valid object */ - if (!acpi_ut_valid_internal_object (object)) { + if (!acpi_ut_valid_internal_object(object)) { return_VOID; } - ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, - "Obj %p Current Refs=%X [To Be Decremented]\n", - object, object->common.reference_count)); + ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, + "Obj %p Current Refs=%X [To Be Decremented]\n", + object, object->common.reference_count)); /* * Decrement the reference count, and only actually delete the object * if the reference count becomes 0. (Must also decrement the ref count * of all subobjects!) */ - (void) acpi_ut_update_object_reference (object, REF_DECREMENT); + (void)acpi_ut_update_object_reference(object, REF_DECREMENT); return_VOID; } - - diff --git a/drivers/acpi/utilities/uteval.c b/drivers/acpi/utilities/uteval.c index 00046dd5d92..7b81d5ef3c3 100644 --- a/drivers/acpi/utilities/uteval.c +++ b/drivers/acpi/utilities/uteval.c @@ -41,28 +41,20 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include #include #include - #define _COMPONENT ACPI_UTILITIES - ACPI_MODULE_NAME ("uteval") +ACPI_MODULE_NAME("uteval") /* Local prototypes */ - static void -acpi_ut_copy_id_string ( - char *destination, - char *source, - acpi_size max_length); +acpi_ut_copy_id_string(char *destination, char *source, acpi_size max_length); static acpi_status -acpi_ut_translate_one_cid ( - union acpi_operand_object *obj_desc, - struct acpi_compatible_id *one_cid); - +acpi_ut_translate_one_cid(union acpi_operand_object *obj_desc, + struct acpi_compatible_id *one_cid); /******************************************************************************* * @@ -77,37 +69,33 @@ acpi_ut_translate_one_cid ( * ******************************************************************************/ -acpi_status -acpi_ut_osi_implementation ( - struct acpi_walk_state *walk_state) +acpi_status acpi_ut_osi_implementation(struct acpi_walk_state *walk_state) { - union acpi_operand_object *string_desc; - union acpi_operand_object *return_desc; - acpi_native_uint i; - - - ACPI_FUNCTION_TRACE ("ut_osi_implementation"); + union acpi_operand_object *string_desc; + union acpi_operand_object *return_desc; + acpi_native_uint i; + ACPI_FUNCTION_TRACE("ut_osi_implementation"); /* Validate the string input argument */ string_desc = walk_state->arguments[0].object; if (!string_desc || (string_desc->common.type != ACPI_TYPE_STRING)) { - return_ACPI_STATUS (AE_TYPE); + return_ACPI_STATUS(AE_TYPE); } /* Create a return object (Default value = 0) */ - return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER); + return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); if (!return_desc) { - return_ACPI_STATUS (AE_NO_MEMORY); + return_ACPI_STATUS(AE_NO_MEMORY); } /* Compare input string to table of supported strings */ for (i = 0; i < ACPI_NUM_OSI_STRINGS; i++) { - if (!ACPI_STRCMP (string_desc->string.pointer, - (char *) acpi_gbl_valid_osi_strings[i])) { + if (!ACPI_STRCMP(string_desc->string.pointer, + (char *)acpi_gbl_valid_osi_strings[i])) { /* This string is supported */ return_desc->integer.value = 0xFFFFFFFF; @@ -116,10 +104,9 @@ acpi_ut_osi_implementation ( } walk_state->return_desc = return_desc; - return_ACPI_STATUS (AE_CTRL_TERMINATE); + return_ACPI_STATUS(AE_CTRL_TERMINATE); } - /******************************************************************************* * * FUNCTION: acpi_ut_evaluate_object @@ -140,19 +127,16 @@ acpi_ut_osi_implementation ( ******************************************************************************/ acpi_status -acpi_ut_evaluate_object ( - struct acpi_namespace_node *prefix_node, - char *path, - u32 expected_return_btypes, - union acpi_operand_object **return_desc) +acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node, + char *path, + u32 expected_return_btypes, + union acpi_operand_object **return_desc) { - struct acpi_parameter_info info; - acpi_status status; - u32 return_btype; - - - ACPI_FUNCTION_TRACE ("ut_evaluate_object"); + struct acpi_parameter_info info; + acpi_status status; + u32 return_btype; + ACPI_FUNCTION_TRACE("ut_evaluate_object"); info.node = prefix_node; info.parameters = NULL; @@ -160,36 +144,38 @@ acpi_ut_evaluate_object ( /* Evaluate the object/method */ - status = acpi_ns_evaluate_relative (path, &info); - if (ACPI_FAILURE (status)) { + status = acpi_ns_evaluate_relative(path, &info); + if (ACPI_FAILURE(status)) { if (status == AE_NOT_FOUND) { - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s.%s] was not found\n", - acpi_ut_get_node_name (prefix_node), path)); - } - else { - ACPI_REPORT_METHOD_ERROR ("Method execution failed", - prefix_node, path, status); + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, + "[%4.4s.%s] was not found\n", + acpi_ut_get_node_name(prefix_node), + path)); + } else { + ACPI_REPORT_METHOD_ERROR("Method execution failed", + prefix_node, path, status); } - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } /* Did we get a return object? */ if (!info.return_object) { if (expected_return_btypes) { - ACPI_REPORT_METHOD_ERROR ("No object was returned from", - prefix_node, path, AE_NOT_EXIST); + ACPI_REPORT_METHOD_ERROR("No object was returned from", + prefix_node, path, + AE_NOT_EXIST); - return_ACPI_STATUS (AE_NOT_EXIST); + return_ACPI_STATUS(AE_NOT_EXIST); } - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } /* Map the return object type to the bitmapped type */ - switch (ACPI_GET_OBJECT_TYPE (info.return_object)) { + switch (ACPI_GET_OBJECT_TYPE(info.return_object)) { case ACPI_TYPE_INTEGER: return_btype = ACPI_BTYPE_INTEGER; break; @@ -211,41 +197,41 @@ acpi_ut_evaluate_object ( break; } - if ((acpi_gbl_enable_interpreter_slack) && - (!expected_return_btypes)) { + if ((acpi_gbl_enable_interpreter_slack) && (!expected_return_btypes)) { /* * We received a return object, but one was not expected. This can * happen frequently if the "implicit return" feature is enabled. * Just delete the return object and return AE_OK. */ - acpi_ut_remove_reference (info.return_object); - return_ACPI_STATUS (AE_OK); + acpi_ut_remove_reference(info.return_object); + return_ACPI_STATUS(AE_OK); } /* Is the return object one of the expected types? */ if (!(expected_return_btypes & return_btype)) { - ACPI_REPORT_METHOD_ERROR ("Return object type is incorrect", - prefix_node, path, AE_TYPE); + ACPI_REPORT_METHOD_ERROR("Return object type is incorrect", + prefix_node, path, AE_TYPE); - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Type returned from %s was incorrect: %s, expected Btypes: %X\n", - path, acpi_ut_get_object_type_name (info.return_object), - expected_return_btypes)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Type returned from %s was incorrect: %s, expected Btypes: %X\n", + path, + acpi_ut_get_object_type_name(info. + return_object), + expected_return_btypes)); /* On error exit, we must delete the return object */ - acpi_ut_remove_reference (info.return_object); - return_ACPI_STATUS (AE_TYPE); + acpi_ut_remove_reference(info.return_object); + return_ACPI_STATUS(AE_TYPE); } /* Object type is OK, return it */ *return_desc = info.return_object; - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_ut_evaluate_numeric_object @@ -264,22 +250,19 @@ acpi_ut_evaluate_object ( ******************************************************************************/ acpi_status -acpi_ut_evaluate_numeric_object ( - char *object_name, - struct acpi_namespace_node *device_node, - acpi_integer *address) +acpi_ut_evaluate_numeric_object(char *object_name, + struct acpi_namespace_node *device_node, + acpi_integer * address) { - union acpi_operand_object *obj_desc; - acpi_status status; - + union acpi_operand_object *obj_desc; + acpi_status status; - ACPI_FUNCTION_TRACE ("ut_evaluate_numeric_object"); + ACPI_FUNCTION_TRACE("ut_evaluate_numeric_object"); - - status = acpi_ut_evaluate_object (device_node, object_name, - ACPI_BTYPE_INTEGER, &obj_desc); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ut_evaluate_object(device_node, object_name, + ACPI_BTYPE_INTEGER, &obj_desc); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* Get the returned Integer */ @@ -288,11 +271,10 @@ acpi_ut_evaluate_numeric_object ( /* On exit, we must delete the return object */ - acpi_ut_remove_reference (obj_desc); - return_ACPI_STATUS (status); + acpi_ut_remove_reference(obj_desc); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_ut_copy_id_string @@ -310,10 +292,7 @@ acpi_ut_evaluate_numeric_object ( ******************************************************************************/ static void -acpi_ut_copy_id_string ( - char *destination, - char *source, - acpi_size max_length) +acpi_ut_copy_id_string(char *destination, char *source, acpi_size max_length) { /* @@ -328,10 +307,9 @@ acpi_ut_copy_id_string ( /* Do the actual copy */ - ACPI_STRNCPY (destination, source, max_length); + ACPI_STRNCPY(destination, source, max_length); } - /******************************************************************************* * * FUNCTION: acpi_ut_execute_HID @@ -349,42 +327,39 @@ acpi_ut_copy_id_string ( ******************************************************************************/ acpi_status -acpi_ut_execute_HID ( - struct acpi_namespace_node *device_node, - struct acpi_device_id *hid) +acpi_ut_execute_HID(struct acpi_namespace_node *device_node, + struct acpi_device_id *hid) { - union acpi_operand_object *obj_desc; - acpi_status status; - + union acpi_operand_object *obj_desc; + acpi_status status; - ACPI_FUNCTION_TRACE ("ut_execute_HID"); + ACPI_FUNCTION_TRACE("ut_execute_HID"); - - status = acpi_ut_evaluate_object (device_node, METHOD_NAME__HID, - ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING, &obj_desc); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ut_evaluate_object(device_node, METHOD_NAME__HID, + ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING, + &obj_desc); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } - if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_INTEGER) { + if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) { /* Convert the Numeric HID to string */ - acpi_ex_eisa_id_to_string ((u32) obj_desc->integer.value, hid->value); - } - else { + acpi_ex_eisa_id_to_string((u32) obj_desc->integer.value, + hid->value); + } else { /* Copy the String HID from the returned object */ - acpi_ut_copy_id_string (hid->value, obj_desc->string.pointer, - sizeof (hid->value)); + acpi_ut_copy_id_string(hid->value, obj_desc->string.pointer, + sizeof(hid->value)); } /* On exit, we must delete the return object */ - acpi_ut_remove_reference (obj_desc); - return_ACPI_STATUS (status); + acpi_ut_remove_reference(obj_desc); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_ut_translate_one_cid @@ -403,18 +378,17 @@ acpi_ut_execute_HID ( ******************************************************************************/ static acpi_status -acpi_ut_translate_one_cid ( - union acpi_operand_object *obj_desc, - struct acpi_compatible_id *one_cid) +acpi_ut_translate_one_cid(union acpi_operand_object *obj_desc, + struct acpi_compatible_id *one_cid) { - - switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { + switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { case ACPI_TYPE_INTEGER: /* Convert the Numeric CID to string */ - acpi_ex_eisa_id_to_string ((u32) obj_desc->integer.value, one_cid->value); + acpi_ex_eisa_id_to_string((u32) obj_desc->integer.value, + one_cid->value); return (AE_OK); case ACPI_TYPE_STRING: @@ -425,8 +399,8 @@ acpi_ut_translate_one_cid ( /* Copy the String CID from the returned object */ - acpi_ut_copy_id_string (one_cid->value, obj_desc->string.pointer, - ACPI_MAX_CID_LENGTH); + acpi_ut_copy_id_string(one_cid->value, obj_desc->string.pointer, + ACPI_MAX_CID_LENGTH); return (AE_OK); default: @@ -435,7 +409,6 @@ acpi_ut_translate_one_cid ( } } - /******************************************************************************* * * FUNCTION: acpi_ut_execute_CID @@ -453,45 +426,42 @@ acpi_ut_translate_one_cid ( ******************************************************************************/ acpi_status -acpi_ut_execute_CID ( - struct acpi_namespace_node *device_node, - struct acpi_compatible_id_list **return_cid_list) +acpi_ut_execute_CID(struct acpi_namespace_node * device_node, + struct acpi_compatible_id_list ** return_cid_list) { - union acpi_operand_object *obj_desc; - acpi_status status; - u32 count; - u32 size; + union acpi_operand_object *obj_desc; + acpi_status status; + u32 count; + u32 size; struct acpi_compatible_id_list *cid_list; - acpi_native_uint i; - - - ACPI_FUNCTION_TRACE ("ut_execute_CID"); + acpi_native_uint i; + ACPI_FUNCTION_TRACE("ut_execute_CID"); /* Evaluate the _CID method for this device */ - status = acpi_ut_evaluate_object (device_node, METHOD_NAME__CID, - ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING | ACPI_BTYPE_PACKAGE, - &obj_desc); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ut_evaluate_object(device_node, METHOD_NAME__CID, + ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING + | ACPI_BTYPE_PACKAGE, &obj_desc); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* Get the number of _CIDs returned */ count = 1; - if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_PACKAGE) { + if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_PACKAGE) { count = obj_desc->package.count; } /* Allocate a worst-case buffer for the _CIDs */ - size = (((count - 1) * sizeof (struct acpi_compatible_id)) + - sizeof (struct acpi_compatible_id_list)); + size = (((count - 1) * sizeof(struct acpi_compatible_id)) + + sizeof(struct acpi_compatible_id_list)); - cid_list = ACPI_MEM_CALLOCATE ((acpi_size) size); + cid_list = ACPI_MEM_CALLOCATE((acpi_size) size); if (!cid_list) { - return_ACPI_STATUS (AE_NO_MEMORY); + return_ACPI_STATUS(AE_NO_MEMORY); } /* Init CID list */ @@ -508,39 +478,38 @@ acpi_ut_execute_CID ( /* The _CID object can be either a single CID or a package (list) of CIDs */ - if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_PACKAGE) { + if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_PACKAGE) { /* Translate each package element */ for (i = 0; i < count; i++) { - status = acpi_ut_translate_one_cid (obj_desc->package.elements[i], - &cid_list->id[i]); - if (ACPI_FAILURE (status)) { + status = + acpi_ut_translate_one_cid(obj_desc->package. + elements[i], + &cid_list->id[i]); + if (ACPI_FAILURE(status)) { break; } } - } - else { + } else { /* Only one CID, translate to a string */ - status = acpi_ut_translate_one_cid (obj_desc, cid_list->id); + status = acpi_ut_translate_one_cid(obj_desc, cid_list->id); } /* Cleanup on error */ - if (ACPI_FAILURE (status)) { - ACPI_MEM_FREE (cid_list); - } - else { + if (ACPI_FAILURE(status)) { + ACPI_MEM_FREE(cid_list); + } else { *return_cid_list = cid_list; } /* On exit, we must delete the _CID return object */ - acpi_ut_remove_reference (obj_desc); - return_ACPI_STATUS (status); + acpi_ut_remove_reference(obj_desc); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_ut_execute_UID @@ -558,42 +527,39 @@ acpi_ut_execute_CID ( ******************************************************************************/ acpi_status -acpi_ut_execute_UID ( - struct acpi_namespace_node *device_node, - struct acpi_device_id *uid) +acpi_ut_execute_UID(struct acpi_namespace_node *device_node, + struct acpi_device_id *uid) { - union acpi_operand_object *obj_desc; - acpi_status status; - - - ACPI_FUNCTION_TRACE ("ut_execute_UID"); + union acpi_operand_object *obj_desc; + acpi_status status; + ACPI_FUNCTION_TRACE("ut_execute_UID"); - status = acpi_ut_evaluate_object (device_node, METHOD_NAME__UID, - ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING, &obj_desc); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ut_evaluate_object(device_node, METHOD_NAME__UID, + ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING, + &obj_desc); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } - if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_INTEGER) { + if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) { /* Convert the Numeric UID to string */ - acpi_ex_unsigned_integer_to_string (obj_desc->integer.value, uid->value); - } - else { + acpi_ex_unsigned_integer_to_string(obj_desc->integer.value, + uid->value); + } else { /* Copy the String UID from the returned object */ - acpi_ut_copy_id_string (uid->value, obj_desc->string.pointer, - sizeof (uid->value)); + acpi_ut_copy_id_string(uid->value, obj_desc->string.pointer, + sizeof(uid->value)); } /* On exit, we must delete the return object */ - acpi_ut_remove_reference (obj_desc); - return_ACPI_STATUS (status); + acpi_ut_remove_reference(obj_desc); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_ut_execute_STA @@ -611,30 +577,26 @@ acpi_ut_execute_UID ( ******************************************************************************/ acpi_status -acpi_ut_execute_STA ( - struct acpi_namespace_node *device_node, - u32 *flags) +acpi_ut_execute_STA(struct acpi_namespace_node *device_node, u32 * flags) { - union acpi_operand_object *obj_desc; - acpi_status status; - + union acpi_operand_object *obj_desc; + acpi_status status; - ACPI_FUNCTION_TRACE ("ut_execute_STA"); + ACPI_FUNCTION_TRACE("ut_execute_STA"); - - status = acpi_ut_evaluate_object (device_node, METHOD_NAME__STA, - ACPI_BTYPE_INTEGER, &obj_desc); - if (ACPI_FAILURE (status)) { + status = acpi_ut_evaluate_object(device_node, METHOD_NAME__STA, + ACPI_BTYPE_INTEGER, &obj_desc); + if (ACPI_FAILURE(status)) { if (AE_NOT_FOUND == status) { - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "_STA on %4.4s was not found, assuming device is present\n", - acpi_ut_get_node_name (device_node))); + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, + "_STA on %4.4s was not found, assuming device is present\n", + acpi_ut_get_node_name(device_node))); *flags = 0x0F; status = AE_OK; } - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } /* Extract the status flags */ @@ -643,11 +605,10 @@ acpi_ut_execute_STA ( /* On exit, we must delete the return object */ - acpi_ut_remove_reference (obj_desc); - return_ACPI_STATUS (status); + acpi_ut_remove_reference(obj_desc); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_ut_execute_Sxds @@ -665,44 +626,45 @@ acpi_ut_execute_STA ( ******************************************************************************/ acpi_status -acpi_ut_execute_sxds ( - struct acpi_namespace_node *device_node, - u8 *highest) +acpi_ut_execute_sxds(struct acpi_namespace_node *device_node, u8 * highest) { - union acpi_operand_object *obj_desc; - acpi_status status; - u32 i; - - - ACPI_FUNCTION_TRACE ("ut_execute_Sxds"); + union acpi_operand_object *obj_desc; + acpi_status status; + u32 i; + ACPI_FUNCTION_TRACE("ut_execute_Sxds"); for (i = 0; i < 4; i++) { highest[i] = 0xFF; - status = acpi_ut_evaluate_object (device_node, - (char *) acpi_gbl_highest_dstate_names[i], - ACPI_BTYPE_INTEGER, &obj_desc); - if (ACPI_FAILURE (status)) { + status = acpi_ut_evaluate_object(device_node, + (char *) + acpi_gbl_highest_dstate_names + [i], ACPI_BTYPE_INTEGER, + &obj_desc); + if (ACPI_FAILURE(status)) { if (status != AE_NOT_FOUND) { - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "%s on Device %4.4s, %s\n", - (char *) acpi_gbl_highest_dstate_names[i], - acpi_ut_get_node_name (device_node), - acpi_format_exception (status))); - - return_ACPI_STATUS (status); + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, + "%s on Device %4.4s, %s\n", + (char *) + acpi_gbl_highest_dstate_names + [i], + acpi_ut_get_node_name + (device_node), + acpi_format_exception + (status))); + + return_ACPI_STATUS(status); } - } - else { + } else { /* Extract the Dstate value */ highest[i] = (u8) obj_desc->integer.value; /* Delete the return object */ - acpi_ut_remove_reference (obj_desc); + acpi_ut_remove_reference(obj_desc); } } - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } diff --git a/drivers/acpi/utilities/utglobal.c b/drivers/acpi/utilities/utglobal.c index 0e4161c8107..399e64b5188 100644 --- a/drivers/acpi/utilities/utglobal.c +++ b/drivers/acpi/utilities/utglobal.c @@ -48,8 +48,7 @@ #include #define _COMPONENT ACPI_UTILITIES - ACPI_MODULE_NAME ("utglobal") - +ACPI_MODULE_NAME("utglobal") /******************************************************************************* * @@ -63,17 +62,12 @@ * DESCRIPTION: This function translates an ACPI exception into an ASCII string. * ******************************************************************************/ - -const char * -acpi_format_exception ( - acpi_status status) +const char *acpi_format_exception(acpi_status status) { - acpi_status sub_status; - const char *exception = NULL; - - - ACPI_FUNCTION_NAME ("format_exception"); + acpi_status sub_status; + const char *exception = NULL; + ACPI_FUNCTION_NAME("format_exception"); sub_status = (status & ~AE_CODE_MASK); @@ -81,35 +75,39 @@ acpi_format_exception ( case AE_CODE_ENVIRONMENTAL: if (sub_status <= AE_CODE_ENV_MAX) { - exception = acpi_gbl_exception_names_env [sub_status]; + exception = acpi_gbl_exception_names_env[sub_status]; } break; case AE_CODE_PROGRAMMER: if (sub_status <= AE_CODE_PGM_MAX) { - exception = acpi_gbl_exception_names_pgm [sub_status -1]; + exception = + acpi_gbl_exception_names_pgm[sub_status - 1]; } break; case AE_CODE_ACPI_TABLES: if (sub_status <= AE_CODE_TBL_MAX) { - exception = acpi_gbl_exception_names_tbl [sub_status -1]; + exception = + acpi_gbl_exception_names_tbl[sub_status - 1]; } break; case AE_CODE_AML: if (sub_status <= AE_CODE_AML_MAX) { - exception = acpi_gbl_exception_names_aml [sub_status -1]; + exception = + acpi_gbl_exception_names_aml[sub_status - 1]; } break; case AE_CODE_CONTROL: if (sub_status <= AE_CODE_CTRL_MAX) { - exception = acpi_gbl_exception_names_ctrl [sub_status -1]; + exception = + acpi_gbl_exception_names_ctrl[sub_status - 1]; } break; @@ -120,16 +118,15 @@ acpi_format_exception ( if (!exception) { /* Exception code was not recognized */ - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Unknown exception code: 0x%8.8X\n", status)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Unknown exception code: 0x%8.8X\n", status)); - return ((const char *) "UNKNOWN_STATUS_CODE"); + return ((const char *)"UNKNOWN_STATUS_CODE"); } - return ((const char *) exception); + return ((const char *)exception); } - /******************************************************************************* * * Static global variable initialization. @@ -142,34 +139,32 @@ acpi_format_exception ( */ /* Debug switch - level and trace mask */ -u32 acpi_dbg_level = ACPI_DEBUG_DEFAULT; +u32 acpi_dbg_level = ACPI_DEBUG_DEFAULT; EXPORT_SYMBOL(acpi_dbg_level); /* Debug switch - layer (component) mask */ -u32 acpi_dbg_layer = ACPI_COMPONENT_DEFAULT | ACPI_ALL_DRIVERS; +u32 acpi_dbg_layer = ACPI_COMPONENT_DEFAULT | ACPI_ALL_DRIVERS; EXPORT_SYMBOL(acpi_dbg_layer); -u32 acpi_gbl_nesting_level = 0; - +u32 acpi_gbl_nesting_level = 0; /* Debugger globals */ -u8 acpi_gbl_db_terminate_threads = FALSE; -u8 acpi_gbl_abort_method = FALSE; -u8 acpi_gbl_method_executing = FALSE; +u8 acpi_gbl_db_terminate_threads = FALSE; +u8 acpi_gbl_abort_method = FALSE; +u8 acpi_gbl_method_executing = FALSE; /* System flags */ -u32 acpi_gbl_startup_flags = 0; +u32 acpi_gbl_startup_flags = 0; /* System starts uninitialized */ -u8 acpi_gbl_shutdown = TRUE; +u8 acpi_gbl_shutdown = TRUE; -const u8 acpi_gbl_decode_to8bit [8] = {1,2,4,8,16,32,64,128}; +const u8 acpi_gbl_decode_to8bit[8] = { 1, 2, 4, 8, 16, 32, 64, 128 }; -const char *acpi_gbl_sleep_state_names[ACPI_S_STATE_COUNT] = -{ +const char *acpi_gbl_sleep_state_names[ACPI_S_STATE_COUNT] = { "\\_S0_", "\\_S1_", "\\_S2_", @@ -178,8 +173,7 @@ const char *acpi_gbl_sleep_state_names[ACPI_S_STATE_COU "\\_S5_" }; -const char *acpi_gbl_highest_dstate_names[4] = -{ +const char *acpi_gbl_highest_dstate_names[4] = { "_S1D", "_S2D", "_S3D", @@ -190,8 +184,7 @@ const char *acpi_gbl_highest_dstate_names[4] = * Strings supported by the _OSI predefined (internal) method. * When adding strings, be sure to update ACPI_NUM_OSI_STRINGS. */ -const char *acpi_gbl_valid_osi_strings[ACPI_NUM_OSI_STRINGS] = -{ +const char *acpi_gbl_valid_osi_strings[ACPI_NUM_OSI_STRINGS] = { /* Operating System Vendor Strings */ "Linux", @@ -209,7 +202,6 @@ const char *acpi_gbl_valid_osi_strings[ACPI_NUM_OSI_STR "Extended Address Space Descriptor" }; - /******************************************************************************* * * Namespace globals @@ -225,74 +217,70 @@ const char *acpi_gbl_valid_osi_strings[ACPI_NUM_OSI_STR * 2) _TZ_ is defined to be a thermal zone in order to allow ASL code to * perform a Notify() operation on it. */ -const struct acpi_predefined_names acpi_gbl_pre_defined_names[] = -{ {"_GPE", ACPI_TYPE_LOCAL_SCOPE, NULL}, - {"_PR_", ACPI_TYPE_LOCAL_SCOPE, NULL}, - {"_SB_", ACPI_TYPE_DEVICE, NULL}, - {"_SI_", ACPI_TYPE_LOCAL_SCOPE, NULL}, - {"_TZ_", ACPI_TYPE_THERMAL, NULL}, - {"_REV", ACPI_TYPE_INTEGER, (char *) ACPI_CA_SUPPORT_LEVEL}, - {"_OS_", ACPI_TYPE_STRING, ACPI_OS_NAME}, - {"_GL_", ACPI_TYPE_MUTEX, (char *) 1}, +const struct acpi_predefined_names acpi_gbl_pre_defined_names[] = + { {"_GPE", ACPI_TYPE_LOCAL_SCOPE, NULL}, +{"_PR_", ACPI_TYPE_LOCAL_SCOPE, NULL}, +{"_SB_", ACPI_TYPE_DEVICE, NULL}, +{"_SI_", ACPI_TYPE_LOCAL_SCOPE, NULL}, +{"_TZ_", ACPI_TYPE_THERMAL, NULL}, +{"_REV", ACPI_TYPE_INTEGER, (char *)ACPI_CA_SUPPORT_LEVEL}, +{"_OS_", ACPI_TYPE_STRING, ACPI_OS_NAME}, +{"_GL_", ACPI_TYPE_MUTEX, (char *)1}, #if !defined (ACPI_NO_METHOD_EXECUTION) || defined (ACPI_CONSTANT_EVAL_ONLY) - {"_OSI", ACPI_TYPE_METHOD, (char *) 1}, +{"_OSI", ACPI_TYPE_METHOD, (char *)1}, #endif /* Table terminator */ - {NULL, ACPI_TYPE_ANY, NULL} +{NULL, ACPI_TYPE_ANY, NULL} }; /* * Properties of the ACPI Object Types, both internal and external. * The table is indexed by values of acpi_object_type */ -const u8 acpi_gbl_ns_properties[] = -{ - ACPI_NS_NORMAL, /* 00 Any */ - ACPI_NS_NORMAL, /* 01 Number */ - ACPI_NS_NORMAL, /* 02 String */ - ACPI_NS_NORMAL, /* 03 Buffer */ - ACPI_NS_NORMAL, /* 04 Package */ - ACPI_NS_NORMAL, /* 05 field_unit */ - ACPI_NS_NEWSCOPE, /* 06 Device */ - ACPI_NS_NORMAL, /* 07 Event */ - ACPI_NS_NEWSCOPE, /* 08 Method */ - ACPI_NS_NORMAL, /* 09 Mutex */ - ACPI_NS_NORMAL, /* 10 Region */ - ACPI_NS_NEWSCOPE, /* 11 Power */ - ACPI_NS_NEWSCOPE, /* 12 Processor */ - ACPI_NS_NEWSCOPE, /* 13 Thermal */ - ACPI_NS_NORMAL, /* 14 buffer_field */ - ACPI_NS_NORMAL, /* 15 ddb_handle */ - ACPI_NS_NORMAL, /* 16 Debug Object */ - ACPI_NS_NORMAL, /* 17 def_field */ - ACPI_NS_NORMAL, /* 18 bank_field */ - ACPI_NS_NORMAL, /* 19 index_field */ - ACPI_NS_NORMAL, /* 20 Reference */ - ACPI_NS_NORMAL, /* 21 Alias */ - ACPI_NS_NORMAL, /* 22 method_alias */ - ACPI_NS_NORMAL, /* 23 Notify */ - ACPI_NS_NORMAL, /* 24 Address Handler */ - ACPI_NS_NEWSCOPE | ACPI_NS_LOCAL, /* 25 Resource Desc */ - ACPI_NS_NEWSCOPE | ACPI_NS_LOCAL, /* 26 Resource Field */ - ACPI_NS_NEWSCOPE, /* 27 Scope */ - ACPI_NS_NORMAL, /* 28 Extra */ - ACPI_NS_NORMAL, /* 29 Data */ - ACPI_NS_NORMAL /* 30 Invalid */ +const u8 acpi_gbl_ns_properties[] = { + ACPI_NS_NORMAL, /* 00 Any */ + ACPI_NS_NORMAL, /* 01 Number */ + ACPI_NS_NORMAL, /* 02 String */ + ACPI_NS_NORMAL, /* 03 Buffer */ + ACPI_NS_NORMAL, /* 04 Package */ + ACPI_NS_NORMAL, /* 05 field_unit */ + ACPI_NS_NEWSCOPE, /* 06 Device */ + ACPI_NS_NORMAL, /* 07 Event */ + ACPI_NS_NEWSCOPE, /* 08 Method */ + ACPI_NS_NORMAL, /* 09 Mutex */ + ACPI_NS_NORMAL, /* 10 Region */ + ACPI_NS_NEWSCOPE, /* 11 Power */ + ACPI_NS_NEWSCOPE, /* 12 Processor */ + ACPI_NS_NEWSCOPE, /* 13 Thermal */ + ACPI_NS_NORMAL, /* 14 buffer_field */ + ACPI_NS_NORMAL, /* 15 ddb_handle */ + ACPI_NS_NORMAL, /* 16 Debug Object */ + ACPI_NS_NORMAL, /* 17 def_field */ + ACPI_NS_NORMAL, /* 18 bank_field */ + ACPI_NS_NORMAL, /* 19 index_field */ + ACPI_NS_NORMAL, /* 20 Reference */ + ACPI_NS_NORMAL, /* 21 Alias */ + ACPI_NS_NORMAL, /* 22 method_alias */ + ACPI_NS_NORMAL, /* 23 Notify */ + ACPI_NS_NORMAL, /* 24 Address Handler */ + ACPI_NS_NEWSCOPE | ACPI_NS_LOCAL, /* 25 Resource Desc */ + ACPI_NS_NEWSCOPE | ACPI_NS_LOCAL, /* 26 Resource Field */ + ACPI_NS_NEWSCOPE, /* 27 Scope */ + ACPI_NS_NORMAL, /* 28 Extra */ + ACPI_NS_NORMAL, /* 29 Data */ + ACPI_NS_NORMAL /* 30 Invalid */ }; - /* Hex to ASCII conversion table */ -static const char acpi_gbl_hex_to_ascii[] = -{ - '0','1','2','3','4','5','6','7', - '8','9','A','B','C','D','E','F' +static const char acpi_gbl_hex_to_ascii[] = { + '0', '1', '2', '3', '4', '5', '6', '7', + '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; - /******************************************************************************* * * FUNCTION: acpi_ut_hex_to_ascii_char @@ -307,16 +295,12 @@ static const char acpi_gbl_hex_to_ascii[] = * ******************************************************************************/ -char -acpi_ut_hex_to_ascii_char ( - acpi_integer integer, - u32 position) +char acpi_ut_hex_to_ascii_char(acpi_integer integer, u32 position) { return (acpi_gbl_hex_to_ascii[(integer >> position) & 0xF]); } - /******************************************************************************* * * Table name globals @@ -330,67 +314,139 @@ acpi_ut_hex_to_ascii_char ( * ******************************************************************************/ -struct acpi_table_list acpi_gbl_table_lists[NUM_ACPI_TABLE_TYPES]; +struct acpi_table_list acpi_gbl_table_lists[NUM_ACPI_TABLE_TYPES]; -struct acpi_table_support acpi_gbl_table_data[NUM_ACPI_TABLE_TYPES] = -{ +struct acpi_table_support acpi_gbl_table_data[NUM_ACPI_TABLE_TYPES] = { /*********** Name, Signature, Global typed pointer Signature size, Type How many allowed?, Contains valid AML? */ - /* RSDP 0 */ {RSDP_NAME, RSDP_SIG, NULL, sizeof (RSDP_SIG)-1, ACPI_TABLE_ROOT | ACPI_TABLE_SINGLE}, - /* DSDT 1 */ {DSDT_SIG, DSDT_SIG, (void *) &acpi_gbl_DSDT, sizeof (DSDT_SIG)-1, ACPI_TABLE_SECONDARY| ACPI_TABLE_SINGLE | ACPI_TABLE_EXECUTABLE}, - /* FADT 2 */ {FADT_SIG, FADT_SIG, (void *) &acpi_gbl_FADT, sizeof (FADT_SIG)-1, ACPI_TABLE_PRIMARY | ACPI_TABLE_SINGLE}, - /* FACS 3 */ {FACS_SIG, FACS_SIG, (void *) &acpi_gbl_FACS, sizeof (FACS_SIG)-1, ACPI_TABLE_SECONDARY| ACPI_TABLE_SINGLE}, - /* PSDT 4 */ {PSDT_SIG, PSDT_SIG, NULL, sizeof (PSDT_SIG)-1, ACPI_TABLE_PRIMARY | ACPI_TABLE_MULTIPLE | ACPI_TABLE_EXECUTABLE}, - /* SSDT 5 */ {SSDT_SIG, SSDT_SIG, NULL, sizeof (SSDT_SIG)-1, ACPI_TABLE_PRIMARY | ACPI_TABLE_MULTIPLE | ACPI_TABLE_EXECUTABLE}, - /* XSDT 6 */ {XSDT_SIG, XSDT_SIG, NULL, sizeof (RSDT_SIG)-1, ACPI_TABLE_ROOT | ACPI_TABLE_SINGLE}, + /* RSDP 0 */ {RSDP_NAME, RSDP_SIG, NULL, sizeof(RSDP_SIG) - 1, + ACPI_TABLE_ROOT | ACPI_TABLE_SINGLE} + , + /* DSDT 1 */ {DSDT_SIG, DSDT_SIG, (void *)&acpi_gbl_DSDT, + sizeof(DSDT_SIG) - 1, + ACPI_TABLE_SECONDARY | ACPI_TABLE_SINGLE | + ACPI_TABLE_EXECUTABLE} + , + /* FADT 2 */ {FADT_SIG, FADT_SIG, (void *)&acpi_gbl_FADT, + sizeof(FADT_SIG) - 1, + ACPI_TABLE_PRIMARY | ACPI_TABLE_SINGLE} + , + /* FACS 3 */ {FACS_SIG, FACS_SIG, (void *)&acpi_gbl_FACS, + sizeof(FACS_SIG) - 1, + ACPI_TABLE_SECONDARY | ACPI_TABLE_SINGLE} + , + /* PSDT 4 */ {PSDT_SIG, PSDT_SIG, NULL, sizeof(PSDT_SIG) - 1, + ACPI_TABLE_PRIMARY | ACPI_TABLE_MULTIPLE | + ACPI_TABLE_EXECUTABLE} + , + /* SSDT 5 */ {SSDT_SIG, SSDT_SIG, NULL, sizeof(SSDT_SIG) - 1, + ACPI_TABLE_PRIMARY | ACPI_TABLE_MULTIPLE | + ACPI_TABLE_EXECUTABLE} + , + /* XSDT 6 */ {XSDT_SIG, XSDT_SIG, NULL, sizeof(RSDT_SIG) - 1, + ACPI_TABLE_ROOT | ACPI_TABLE_SINGLE} + , }; - /****************************************************************************** * * Event and Hardware globals * ******************************************************************************/ -struct acpi_bit_register_info acpi_gbl_bit_register_info[ACPI_NUM_BITREG] = -{ +struct acpi_bit_register_info acpi_gbl_bit_register_info[ACPI_NUM_BITREG] = { /* Name Parent Register Register Bit Position Register Bit Mask */ - /* ACPI_BITREG_TIMER_STATUS */ {ACPI_REGISTER_PM1_STATUS, ACPI_BITPOSITION_TIMER_STATUS, ACPI_BITMASK_TIMER_STATUS}, - /* ACPI_BITREG_BUS_MASTER_STATUS */ {ACPI_REGISTER_PM1_STATUS, ACPI_BITPOSITION_BUS_MASTER_STATUS, ACPI_BITMASK_BUS_MASTER_STATUS}, - /* ACPI_BITREG_GLOBAL_LOCK_STATUS */ {ACPI_REGISTER_PM1_STATUS, ACPI_BITPOSITION_GLOBAL_LOCK_STATUS, ACPI_BITMASK_GLOBAL_LOCK_STATUS}, - /* ACPI_BITREG_POWER_BUTTON_STATUS */ {ACPI_REGISTER_PM1_STATUS, ACPI_BITPOSITION_POWER_BUTTON_STATUS, ACPI_BITMASK_POWER_BUTTON_STATUS}, - /* ACPI_BITREG_SLEEP_BUTTON_STATUS */ {ACPI_REGISTER_PM1_STATUS, ACPI_BITPOSITION_SLEEP_BUTTON_STATUS, ACPI_BITMASK_SLEEP_BUTTON_STATUS}, - /* ACPI_BITREG_RT_CLOCK_STATUS */ {ACPI_REGISTER_PM1_STATUS, ACPI_BITPOSITION_RT_CLOCK_STATUS, ACPI_BITMASK_RT_CLOCK_STATUS}, - /* ACPI_BITREG_WAKE_STATUS */ {ACPI_REGISTER_PM1_STATUS, ACPI_BITPOSITION_WAKE_STATUS, ACPI_BITMASK_WAKE_STATUS}, - /* ACPI_BITREG_PCIEXP_WAKE_STATUS */ {ACPI_REGISTER_PM1_STATUS, ACPI_BITPOSITION_PCIEXP_WAKE_STATUS, ACPI_BITMASK_PCIEXP_WAKE_STATUS}, - - /* ACPI_BITREG_TIMER_ENABLE */ {ACPI_REGISTER_PM1_ENABLE, ACPI_BITPOSITION_TIMER_ENABLE, ACPI_BITMASK_TIMER_ENABLE}, - /* ACPI_BITREG_GLOBAL_LOCK_ENABLE */ {ACPI_REGISTER_PM1_ENABLE, ACPI_BITPOSITION_GLOBAL_LOCK_ENABLE, ACPI_BITMASK_GLOBAL_LOCK_ENABLE}, - /* ACPI_BITREG_POWER_BUTTON_ENABLE */ {ACPI_REGISTER_PM1_ENABLE, ACPI_BITPOSITION_POWER_BUTTON_ENABLE, ACPI_BITMASK_POWER_BUTTON_ENABLE}, - /* ACPI_BITREG_SLEEP_BUTTON_ENABLE */ {ACPI_REGISTER_PM1_ENABLE, ACPI_BITPOSITION_SLEEP_BUTTON_ENABLE, ACPI_BITMASK_SLEEP_BUTTON_ENABLE}, - /* ACPI_BITREG_RT_CLOCK_ENABLE */ {ACPI_REGISTER_PM1_ENABLE, ACPI_BITPOSITION_RT_CLOCK_ENABLE, ACPI_BITMASK_RT_CLOCK_ENABLE}, - /* ACPI_BITREG_WAKE_ENABLE */ {ACPI_REGISTER_PM1_ENABLE, 0, 0}, - /* ACPI_BITREG_PCIEXP_WAKE_DISABLE */ {ACPI_REGISTER_PM1_ENABLE, ACPI_BITPOSITION_PCIEXP_WAKE_DISABLE, ACPI_BITMASK_PCIEXP_WAKE_DISABLE}, - - /* ACPI_BITREG_SCI_ENABLE */ {ACPI_REGISTER_PM1_CONTROL, ACPI_BITPOSITION_SCI_ENABLE, ACPI_BITMASK_SCI_ENABLE}, - /* ACPI_BITREG_BUS_MASTER_RLD */ {ACPI_REGISTER_PM1_CONTROL, ACPI_BITPOSITION_BUS_MASTER_RLD, ACPI_BITMASK_BUS_MASTER_RLD}, - /* ACPI_BITREG_GLOBAL_LOCK_RELEASE */ {ACPI_REGISTER_PM1_CONTROL, ACPI_BITPOSITION_GLOBAL_LOCK_RELEASE, ACPI_BITMASK_GLOBAL_LOCK_RELEASE}, - /* ACPI_BITREG_SLEEP_TYPE_A */ {ACPI_REGISTER_PM1_CONTROL, ACPI_BITPOSITION_SLEEP_TYPE_X, ACPI_BITMASK_SLEEP_TYPE_X}, - /* ACPI_BITREG_SLEEP_TYPE_B */ {ACPI_REGISTER_PM1_CONTROL, ACPI_BITPOSITION_SLEEP_TYPE_X, ACPI_BITMASK_SLEEP_TYPE_X}, - /* ACPI_BITREG_SLEEP_ENABLE */ {ACPI_REGISTER_PM1_CONTROL, ACPI_BITPOSITION_SLEEP_ENABLE, ACPI_BITMASK_SLEEP_ENABLE}, - - /* ACPI_BITREG_ARB_DIS */ {ACPI_REGISTER_PM2_CONTROL, ACPI_BITPOSITION_ARB_DISABLE, ACPI_BITMASK_ARB_DISABLE} + /* ACPI_BITREG_TIMER_STATUS */ {ACPI_REGISTER_PM1_STATUS, + ACPI_BITPOSITION_TIMER_STATUS, + ACPI_BITMASK_TIMER_STATUS}, + /* ACPI_BITREG_BUS_MASTER_STATUS */ {ACPI_REGISTER_PM1_STATUS, + ACPI_BITPOSITION_BUS_MASTER_STATUS, + ACPI_BITMASK_BUS_MASTER_STATUS}, + /* ACPI_BITREG_GLOBAL_LOCK_STATUS */ {ACPI_REGISTER_PM1_STATUS, + ACPI_BITPOSITION_GLOBAL_LOCK_STATUS, + ACPI_BITMASK_GLOBAL_LOCK_STATUS}, + /* ACPI_BITREG_POWER_BUTTON_STATUS */ {ACPI_REGISTER_PM1_STATUS, + ACPI_BITPOSITION_POWER_BUTTON_STATUS, + ACPI_BITMASK_POWER_BUTTON_STATUS}, + /* ACPI_BITREG_SLEEP_BUTTON_STATUS */ {ACPI_REGISTER_PM1_STATUS, + ACPI_BITPOSITION_SLEEP_BUTTON_STATUS, + ACPI_BITMASK_SLEEP_BUTTON_STATUS}, + /* ACPI_BITREG_RT_CLOCK_STATUS */ {ACPI_REGISTER_PM1_STATUS, + ACPI_BITPOSITION_RT_CLOCK_STATUS, + ACPI_BITMASK_RT_CLOCK_STATUS}, + /* ACPI_BITREG_WAKE_STATUS */ {ACPI_REGISTER_PM1_STATUS, + ACPI_BITPOSITION_WAKE_STATUS, + ACPI_BITMASK_WAKE_STATUS}, + /* ACPI_BITREG_PCIEXP_WAKE_STATUS */ {ACPI_REGISTER_PM1_STATUS, + ACPI_BITPOSITION_PCIEXP_WAKE_STATUS, + ACPI_BITMASK_PCIEXP_WAKE_STATUS}, + + /* ACPI_BITREG_TIMER_ENABLE */ {ACPI_REGISTER_PM1_ENABLE, + ACPI_BITPOSITION_TIMER_ENABLE, + ACPI_BITMASK_TIMER_ENABLE}, + /* ACPI_BITREG_GLOBAL_LOCK_ENABLE */ {ACPI_REGISTER_PM1_ENABLE, + ACPI_BITPOSITION_GLOBAL_LOCK_ENABLE, + ACPI_BITMASK_GLOBAL_LOCK_ENABLE}, + /* ACPI_BITREG_POWER_BUTTON_ENABLE */ {ACPI_REGISTER_PM1_ENABLE, + ACPI_BITPOSITION_POWER_BUTTON_ENABLE, + ACPI_BITMASK_POWER_BUTTON_ENABLE}, + /* ACPI_BITREG_SLEEP_BUTTON_ENABLE */ {ACPI_REGISTER_PM1_ENABLE, + ACPI_BITPOSITION_SLEEP_BUTTON_ENABLE, + ACPI_BITMASK_SLEEP_BUTTON_ENABLE}, + /* ACPI_BITREG_RT_CLOCK_ENABLE */ {ACPI_REGISTER_PM1_ENABLE, + ACPI_BITPOSITION_RT_CLOCK_ENABLE, + ACPI_BITMASK_RT_CLOCK_ENABLE}, + /* ACPI_BITREG_WAKE_ENABLE */ {ACPI_REGISTER_PM1_ENABLE, 0, 0}, + /* ACPI_BITREG_PCIEXP_WAKE_DISABLE */ {ACPI_REGISTER_PM1_ENABLE, + ACPI_BITPOSITION_PCIEXP_WAKE_DISABLE, + ACPI_BITMASK_PCIEXP_WAKE_DISABLE}, + + /* ACPI_BITREG_SCI_ENABLE */ {ACPI_REGISTER_PM1_CONTROL, + ACPI_BITPOSITION_SCI_ENABLE, + ACPI_BITMASK_SCI_ENABLE}, + /* ACPI_BITREG_BUS_MASTER_RLD */ {ACPI_REGISTER_PM1_CONTROL, + ACPI_BITPOSITION_BUS_MASTER_RLD, + ACPI_BITMASK_BUS_MASTER_RLD}, + /* ACPI_BITREG_GLOBAL_LOCK_RELEASE */ {ACPI_REGISTER_PM1_CONTROL, + ACPI_BITPOSITION_GLOBAL_LOCK_RELEASE, + ACPI_BITMASK_GLOBAL_LOCK_RELEASE}, + /* ACPI_BITREG_SLEEP_TYPE_A */ {ACPI_REGISTER_PM1_CONTROL, + ACPI_BITPOSITION_SLEEP_TYPE_X, + ACPI_BITMASK_SLEEP_TYPE_X}, + /* ACPI_BITREG_SLEEP_TYPE_B */ {ACPI_REGISTER_PM1_CONTROL, + ACPI_BITPOSITION_SLEEP_TYPE_X, + ACPI_BITMASK_SLEEP_TYPE_X}, + /* ACPI_BITREG_SLEEP_ENABLE */ {ACPI_REGISTER_PM1_CONTROL, + ACPI_BITPOSITION_SLEEP_ENABLE, + ACPI_BITMASK_SLEEP_ENABLE}, + + /* ACPI_BITREG_ARB_DIS */ {ACPI_REGISTER_PM2_CONTROL, + ACPI_BITPOSITION_ARB_DISABLE, + ACPI_BITMASK_ARB_DISABLE} }; - -struct acpi_fixed_event_info acpi_gbl_fixed_event_info[ACPI_NUM_FIXED_EVENTS] = -{ - /* ACPI_EVENT_PMTIMER */ {ACPI_BITREG_TIMER_STATUS, ACPI_BITREG_TIMER_ENABLE, ACPI_BITMASK_TIMER_STATUS, ACPI_BITMASK_TIMER_ENABLE}, - /* ACPI_EVENT_GLOBAL */ {ACPI_BITREG_GLOBAL_LOCK_STATUS, ACPI_BITREG_GLOBAL_LOCK_ENABLE, ACPI_BITMASK_GLOBAL_LOCK_STATUS, ACPI_BITMASK_GLOBAL_LOCK_ENABLE}, - /* ACPI_EVENT_POWER_BUTTON */ {ACPI_BITREG_POWER_BUTTON_STATUS, ACPI_BITREG_POWER_BUTTON_ENABLE, ACPI_BITMASK_POWER_BUTTON_STATUS, ACPI_BITMASK_POWER_BUTTON_ENABLE}, - /* ACPI_EVENT_SLEEP_BUTTON */ {ACPI_BITREG_SLEEP_BUTTON_STATUS, ACPI_BITREG_SLEEP_BUTTON_ENABLE, ACPI_BITMASK_SLEEP_BUTTON_STATUS, ACPI_BITMASK_SLEEP_BUTTON_ENABLE}, - /* ACPI_EVENT_RTC */ {ACPI_BITREG_RT_CLOCK_STATUS, ACPI_BITREG_RT_CLOCK_ENABLE, ACPI_BITMASK_RT_CLOCK_STATUS, ACPI_BITMASK_RT_CLOCK_ENABLE}, +struct acpi_fixed_event_info acpi_gbl_fixed_event_info[ACPI_NUM_FIXED_EVENTS] = { + /* ACPI_EVENT_PMTIMER */ {ACPI_BITREG_TIMER_STATUS, + ACPI_BITREG_TIMER_ENABLE, + ACPI_BITMASK_TIMER_STATUS, + ACPI_BITMASK_TIMER_ENABLE}, + /* ACPI_EVENT_GLOBAL */ {ACPI_BITREG_GLOBAL_LOCK_STATUS, + ACPI_BITREG_GLOBAL_LOCK_ENABLE, + ACPI_BITMASK_GLOBAL_LOCK_STATUS, + ACPI_BITMASK_GLOBAL_LOCK_ENABLE}, + /* ACPI_EVENT_POWER_BUTTON */ {ACPI_BITREG_POWER_BUTTON_STATUS, + ACPI_BITREG_POWER_BUTTON_ENABLE, + ACPI_BITMASK_POWER_BUTTON_STATUS, + ACPI_BITMASK_POWER_BUTTON_ENABLE}, + /* ACPI_EVENT_SLEEP_BUTTON */ {ACPI_BITREG_SLEEP_BUTTON_STATUS, + ACPI_BITREG_SLEEP_BUTTON_ENABLE, + ACPI_BITMASK_SLEEP_BUTTON_STATUS, + ACPI_BITMASK_SLEEP_BUTTON_ENABLE}, + /* ACPI_EVENT_RTC */ {ACPI_BITREG_RT_CLOCK_STATUS, + ACPI_BITREG_RT_CLOCK_ENABLE, + ACPI_BITMASK_RT_CLOCK_STATUS, + ACPI_BITMASK_RT_CLOCK_ENABLE}, }; /******************************************************************************* @@ -407,8 +463,7 @@ struct acpi_fixed_event_info acpi_gbl_fixed_event_info[ACPI_NUM_FIXED_EVE /* Region type decoding */ -const char *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS] = -{ +const char *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS] = { /*! [Begin] no source code translation (keep these ASL Keywords as-is) */ "SystemMemory", "SystemIO", @@ -421,25 +476,18 @@ const char *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS] = /*! [End] no source code translation !*/ }; - -char * -acpi_ut_get_region_name ( - u8 space_id) +char *acpi_ut_get_region_name(u8 space_id) { - if (space_id >= ACPI_USER_REGION_BEGIN) - { + if (space_id >= ACPI_USER_REGION_BEGIN) { return ("user_defined_region"); - } - else if (space_id >= ACPI_NUM_PREDEFINED_REGIONS) - { + } else if (space_id >= ACPI_NUM_PREDEFINED_REGIONS) { return ("invalid_space_id"); } - return ((char *) acpi_gbl_region_types[space_id]); + return ((char *)acpi_gbl_region_types[space_id]); } - /******************************************************************************* * * FUNCTION: acpi_ut_get_event_name @@ -454,8 +502,7 @@ acpi_ut_get_region_name ( /* Event type decoding */ -static const char *acpi_gbl_event_types[ACPI_NUM_FIXED_EVENTS] = -{ +static const char *acpi_gbl_event_types[ACPI_NUM_FIXED_EVENTS] = { "PM_Timer", "global_lock", "power_button", @@ -463,21 +510,16 @@ static const char *acpi_gbl_event_types[ACPI_NUM_FIXED_EVENTS] = "real_time_clock", }; - -char * -acpi_ut_get_event_name ( - u32 event_id) +char *acpi_ut_get_event_name(u32 event_id) { - if (event_id > ACPI_EVENT_MAX) - { + if (event_id > ACPI_EVENT_MAX) { return ("invalid_event_iD"); } - return ((char *) acpi_gbl_event_types[event_id]); + return ((char *)acpi_gbl_event_types[event_id]); } - /******************************************************************************* * * FUNCTION: acpi_ut_get_type_name @@ -498,12 +540,11 @@ acpi_ut_get_event_name ( * when stored in a table it really means that we have thus far seen no * evidence to indicate what type is actually going to be stored for this entry. */ -static const char acpi_gbl_bad_type[] = "UNDEFINED"; +static const char acpi_gbl_bad_type[] = "UNDEFINED"; /* Printable names of the ACPI object types */ -static const char *acpi_gbl_ns_type_names[] = -{ +static const char *acpi_gbl_ns_type_names[] = { /* 00 */ "Untyped", /* 01 */ "Integer", /* 02 */ "String", @@ -537,35 +578,26 @@ static const char *acpi_gbl_ns_type_names[] = /* 30 */ "Invalid" }; - -char * -acpi_ut_get_type_name ( - acpi_object_type type) +char *acpi_ut_get_type_name(acpi_object_type type) { - if (type > ACPI_TYPE_INVALID) - { - return ((char *) acpi_gbl_bad_type); + if (type > ACPI_TYPE_INVALID) { + return ((char *)acpi_gbl_bad_type); } - return ((char *) acpi_gbl_ns_type_names[type]); + return ((char *)acpi_gbl_ns_type_names[type]); } - -char * -acpi_ut_get_object_type_name ( - union acpi_operand_object *obj_desc) +char *acpi_ut_get_object_type_name(union acpi_operand_object *obj_desc) { - if (!obj_desc) - { + if (!obj_desc) { return ("[NULL Object Descriptor]"); } - return (acpi_ut_get_type_name (ACPI_GET_OBJECT_TYPE (obj_desc))); + return (acpi_ut_get_type_name(ACPI_GET_OBJECT_TYPE(obj_desc))); } - /******************************************************************************* * * FUNCTION: acpi_ut_get_node_name @@ -578,39 +610,31 @@ acpi_ut_get_object_type_name ( * ******************************************************************************/ -char * -acpi_ut_get_node_name ( - void *object) +char *acpi_ut_get_node_name(void *object) { - struct acpi_namespace_node *node = (struct acpi_namespace_node *) object; - + struct acpi_namespace_node *node = (struct acpi_namespace_node *)object; /* Must return a string of exactly 4 characters == ACPI_NAME_SIZE */ - if (!object) - { + if (!object) { return ("NULL"); } /* Check for Root node */ - if ((object == ACPI_ROOT_OBJECT) || - (object == acpi_gbl_root_node)) - { + if ((object == ACPI_ROOT_OBJECT) || (object == acpi_gbl_root_node)) { return ("\"\\\" "); } /* Descriptor must be a namespace node */ - if (node->descriptor != ACPI_DESC_TYPE_NAMED) - { + if (node->descriptor != ACPI_DESC_TYPE_NAMED) { return ("####"); } /* Name must be a valid ACPI name */ - if (!acpi_ut_valid_acpi_name (* (u32 *) node->name.ascii)) - { + if (!acpi_ut_valid_acpi_name(*(u32 *) node->name.ascii)) { return ("????"); } @@ -619,7 +643,6 @@ acpi_ut_get_node_name ( return (node->name.ascii); } - /******************************************************************************* * * FUNCTION: acpi_ut_get_descriptor_name @@ -634,8 +657,7 @@ acpi_ut_get_node_name ( /* Printable names of object descriptor types */ -static const char *acpi_gbl_desc_type_names[] = -{ +static const char *acpi_gbl_desc_type_names[] = { /* 00 */ "Invalid", /* 01 */ "Cached", /* 02 */ "State-Generic", @@ -654,27 +676,22 @@ static const char *acpi_gbl_desc_type_names[] = /* 15 */ "Node" }; - -char * -acpi_ut_get_descriptor_name ( - void *object) +char *acpi_ut_get_descriptor_name(void *object) { - if (!object) - { + if (!object) { return ("NULL OBJECT"); } - if (ACPI_GET_DESCRIPTOR_TYPE (object) > ACPI_DESC_TYPE_MAX) - { - return ((char *) acpi_gbl_bad_type); + if (ACPI_GET_DESCRIPTOR_TYPE(object) > ACPI_DESC_TYPE_MAX) { + return ((char *)acpi_gbl_bad_type); } - return ((char *) acpi_gbl_desc_type_names[ACPI_GET_DESCRIPTOR_TYPE (object)]); + return ((char *) + acpi_gbl_desc_type_names[ACPI_GET_DESCRIPTOR_TYPE(object)]); } - #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) /* * Strings and procedures used for debug only @@ -693,13 +710,10 @@ acpi_ut_get_descriptor_name ( * ******************************************************************************/ -char * -acpi_ut_get_mutex_name ( - u32 mutex_id) +char *acpi_ut_get_mutex_name(u32 mutex_id) { - if (mutex_id > MAX_MUTEX) - { + if (mutex_id > MAX_MUTEX) { return ("Invalid Mutex ID"); } @@ -707,7 +721,6 @@ acpi_ut_get_mutex_name ( } #endif - /******************************************************************************* * * FUNCTION: acpi_ut_valid_object_type @@ -720,13 +733,10 @@ acpi_ut_get_mutex_name ( * ******************************************************************************/ -u8 -acpi_ut_valid_object_type ( - acpi_object_type type) +u8 acpi_ut_valid_object_type(acpi_object_type type) { - if (type > ACPI_TYPE_LOCAL_MAX) - { + if (type > ACPI_TYPE_LOCAL_MAX) { /* Note: Assumes all TYPEs are contiguous (external/local) */ return (FALSE); @@ -735,7 +745,6 @@ acpi_ut_valid_object_type ( return (TRUE); } - /******************************************************************************* * * FUNCTION: acpi_ut_init_globals @@ -749,106 +758,96 @@ acpi_ut_valid_object_type ( * ******************************************************************************/ -void -acpi_ut_init_globals ( - void) +void acpi_ut_init_globals(void) { - acpi_status status; - u32 i; - - - ACPI_FUNCTION_TRACE ("ut_init_globals"); + acpi_status status; + u32 i; + ACPI_FUNCTION_TRACE("ut_init_globals"); /* Create all memory caches */ - status = acpi_ut_create_caches (); - if (ACPI_FAILURE (status)) - { + status = acpi_ut_create_caches(); + if (ACPI_FAILURE(status)) { return; } /* ACPI table structure */ - for (i = 0; i < NUM_ACPI_TABLE_TYPES; i++) - { - acpi_gbl_table_lists[i].next = NULL; - acpi_gbl_table_lists[i].count = 0; + for (i = 0; i < NUM_ACPI_TABLE_TYPES; i++) { + acpi_gbl_table_lists[i].next = NULL; + acpi_gbl_table_lists[i].count = 0; } /* Mutex locked flags */ - for (i = 0; i < NUM_MUTEX; i++) - { - acpi_gbl_mutex_info[i].mutex = NULL; - acpi_gbl_mutex_info[i].thread_id = ACPI_MUTEX_NOT_ACQUIRED; - acpi_gbl_mutex_info[i].use_count = 0; + for (i = 0; i < NUM_MUTEX; i++) { + acpi_gbl_mutex_info[i].mutex = NULL; + acpi_gbl_mutex_info[i].thread_id = ACPI_MUTEX_NOT_ACQUIRED; + acpi_gbl_mutex_info[i].use_count = 0; } /* GPE support */ - acpi_gbl_gpe_xrupt_list_head = NULL; - acpi_gbl_gpe_fadt_blocks[0] = NULL; - acpi_gbl_gpe_fadt_blocks[1] = NULL; + acpi_gbl_gpe_xrupt_list_head = NULL; + acpi_gbl_gpe_fadt_blocks[0] = NULL; + acpi_gbl_gpe_fadt_blocks[1] = NULL; /* Global notify handlers */ - acpi_gbl_system_notify.handler = NULL; - acpi_gbl_device_notify.handler = NULL; - acpi_gbl_exception_handler = NULL; - acpi_gbl_init_handler = NULL; + acpi_gbl_system_notify.handler = NULL; + acpi_gbl_device_notify.handler = NULL; + acpi_gbl_exception_handler = NULL; + acpi_gbl_init_handler = NULL; /* Global "typed" ACPI table pointers */ - acpi_gbl_RSDP = NULL; - acpi_gbl_XSDT = NULL; - acpi_gbl_FACS = NULL; - acpi_gbl_FADT = NULL; - acpi_gbl_DSDT = NULL; + acpi_gbl_RSDP = NULL; + acpi_gbl_XSDT = NULL; + acpi_gbl_FACS = NULL; + acpi_gbl_FADT = NULL; + acpi_gbl_DSDT = NULL; /* Global Lock support */ - acpi_gbl_global_lock_acquired = FALSE; - acpi_gbl_global_lock_thread_count = 0; - acpi_gbl_global_lock_handle = 0; + acpi_gbl_global_lock_acquired = FALSE; + acpi_gbl_global_lock_thread_count = 0; + acpi_gbl_global_lock_handle = 0; /* Miscellaneous variables */ - acpi_gbl_table_flags = ACPI_PHYSICAL_POINTER; - acpi_gbl_rsdp_original_location = 0; - acpi_gbl_cm_single_step = FALSE; - acpi_gbl_db_terminate_threads = FALSE; - acpi_gbl_shutdown = FALSE; - acpi_gbl_ns_lookup_count = 0; - acpi_gbl_ps_find_count = 0; - acpi_gbl_acpi_hardware_present = TRUE; - acpi_gbl_owner_id_mask = 0; - acpi_gbl_debugger_configuration = DEBUGGER_THREADING; - acpi_gbl_db_output_flags = ACPI_DB_CONSOLE_OUTPUT; + acpi_gbl_table_flags = ACPI_PHYSICAL_POINTER; + acpi_gbl_rsdp_original_location = 0; + acpi_gbl_cm_single_step = FALSE; + acpi_gbl_db_terminate_threads = FALSE; + acpi_gbl_shutdown = FALSE; + acpi_gbl_ns_lookup_count = 0; + acpi_gbl_ps_find_count = 0; + acpi_gbl_acpi_hardware_present = TRUE; + acpi_gbl_owner_id_mask = 0; + acpi_gbl_debugger_configuration = DEBUGGER_THREADING; + acpi_gbl_db_output_flags = ACPI_DB_CONSOLE_OUTPUT; /* Hardware oriented */ - acpi_gbl_events_initialized = FALSE; - acpi_gbl_system_awake_and_running = TRUE; + acpi_gbl_events_initialized = FALSE; + acpi_gbl_system_awake_and_running = TRUE; /* Namespace */ - acpi_gbl_root_node = NULL; + acpi_gbl_root_node = NULL; acpi_gbl_root_node_struct.name.integer = ACPI_ROOT_NAME; acpi_gbl_root_node_struct.descriptor = ACPI_DESC_TYPE_NAMED; - acpi_gbl_root_node_struct.type = ACPI_TYPE_DEVICE; - acpi_gbl_root_node_struct.child = NULL; - acpi_gbl_root_node_struct.peer = NULL; - acpi_gbl_root_node_struct.object = NULL; - acpi_gbl_root_node_struct.flags = ANOBJ_END_OF_PEER_LIST; - + acpi_gbl_root_node_struct.type = ACPI_TYPE_DEVICE; + acpi_gbl_root_node_struct.child = NULL; + acpi_gbl_root_node_struct.peer = NULL; + acpi_gbl_root_node_struct.object = NULL; + acpi_gbl_root_node_struct.flags = ANOBJ_END_OF_PEER_LIST; #ifdef ACPI_DEBUG_OUTPUT - acpi_gbl_lowest_stack_pointer = ACPI_SIZE_MAX; + acpi_gbl_lowest_stack_pointer = ACPI_SIZE_MAX; #endif return_VOID; } - - diff --git a/drivers/acpi/utilities/utinit.c b/drivers/acpi/utilities/utinit.c index fd7ceba8322..9dde82b0bea 100644 --- a/drivers/acpi/utilities/utinit.c +++ b/drivers/acpi/utilities/utinit.c @@ -41,25 +41,18 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include #include #include #define _COMPONENT ACPI_UTILITIES - ACPI_MODULE_NAME ("utinit") +ACPI_MODULE_NAME("utinit") /* Local prototypes */ - static void -acpi_ut_fadt_register_error ( - char *register_name, - u32 value, - acpi_size offset); - -static void acpi_ut_terminate ( - void); +acpi_ut_fadt_register_error(char *register_name, u32 value, acpi_size offset); +static void acpi_ut_terminate(void); /******************************************************************************* * @@ -76,18 +69,14 @@ static void acpi_ut_terminate ( ******************************************************************************/ static void -acpi_ut_fadt_register_error ( - char *register_name, - u32 value, - acpi_size offset) +acpi_ut_fadt_register_error(char *register_name, u32 value, acpi_size offset) { - ACPI_REPORT_WARNING ( - ("Invalid FADT value %s=%X at offset %X FADT=%p\n", - register_name, value, (u32) offset, acpi_gbl_FADT)); + ACPI_REPORT_WARNING(("Invalid FADT value %s=%X at offset %X FADT=%p\n", + register_name, value, (u32) offset, + acpi_gbl_FADT)); } - /****************************************************************************** * * FUNCTION: acpi_ut_validate_fadt @@ -100,9 +89,7 @@ acpi_ut_fadt_register_error ( * ******************************************************************************/ -acpi_status -acpi_ut_validate_fadt ( - void) +acpi_status acpi_ut_validate_fadt(void) { /* @@ -110,64 +97,66 @@ acpi_ut_validate_fadt ( * but don't abort on any problems, just display error */ if (acpi_gbl_FADT->pm1_evt_len < 4) { - acpi_ut_fadt_register_error ("PM1_EVT_LEN", - (u32) acpi_gbl_FADT->pm1_evt_len, - ACPI_FADT_OFFSET (pm1_evt_len)); + acpi_ut_fadt_register_error("PM1_EVT_LEN", + (u32) acpi_gbl_FADT->pm1_evt_len, + ACPI_FADT_OFFSET(pm1_evt_len)); } if (!acpi_gbl_FADT->pm1_cnt_len) { - acpi_ut_fadt_register_error ("PM1_CNT_LEN", 0, - ACPI_FADT_OFFSET (pm1_cnt_len)); + acpi_ut_fadt_register_error("PM1_CNT_LEN", 0, + ACPI_FADT_OFFSET(pm1_cnt_len)); } if (!acpi_gbl_FADT->xpm1a_evt_blk.address) { - acpi_ut_fadt_register_error ("X_PM1a_EVT_BLK", 0, - ACPI_FADT_OFFSET (xpm1a_evt_blk.address)); + acpi_ut_fadt_register_error("X_PM1a_EVT_BLK", 0, + ACPI_FADT_OFFSET(xpm1a_evt_blk. + address)); } if (!acpi_gbl_FADT->xpm1a_cnt_blk.address) { - acpi_ut_fadt_register_error ("X_PM1a_CNT_BLK", 0, - ACPI_FADT_OFFSET (xpm1a_cnt_blk.address)); + acpi_ut_fadt_register_error("X_PM1a_CNT_BLK", 0, + ACPI_FADT_OFFSET(xpm1a_cnt_blk. + address)); } if (!acpi_gbl_FADT->xpm_tmr_blk.address) { - acpi_ut_fadt_register_error ("X_PM_TMR_BLK", 0, - ACPI_FADT_OFFSET (xpm_tmr_blk.address)); + acpi_ut_fadt_register_error("X_PM_TMR_BLK", 0, + ACPI_FADT_OFFSET(xpm_tmr_blk. + address)); } if ((acpi_gbl_FADT->xpm2_cnt_blk.address && - !acpi_gbl_FADT->pm2_cnt_len)) { - acpi_ut_fadt_register_error ("PM2_CNT_LEN", - (u32) acpi_gbl_FADT->pm2_cnt_len, - ACPI_FADT_OFFSET (pm2_cnt_len)); + !acpi_gbl_FADT->pm2_cnt_len)) { + acpi_ut_fadt_register_error("PM2_CNT_LEN", + (u32) acpi_gbl_FADT->pm2_cnt_len, + ACPI_FADT_OFFSET(pm2_cnt_len)); } if (acpi_gbl_FADT->pm_tm_len < 4) { - acpi_ut_fadt_register_error ("PM_TM_LEN", - (u32) acpi_gbl_FADT->pm_tm_len, - ACPI_FADT_OFFSET (pm_tm_len)); + acpi_ut_fadt_register_error("PM_TM_LEN", + (u32) acpi_gbl_FADT->pm_tm_len, + ACPI_FADT_OFFSET(pm_tm_len)); } /* Length of GPE blocks must be a multiple of 2 */ if (acpi_gbl_FADT->xgpe0_blk.address && - (acpi_gbl_FADT->gpe0_blk_len & 1)) { - acpi_ut_fadt_register_error ("(x)GPE0_BLK_LEN", - (u32) acpi_gbl_FADT->gpe0_blk_len, - ACPI_FADT_OFFSET (gpe0_blk_len)); + (acpi_gbl_FADT->gpe0_blk_len & 1)) { + acpi_ut_fadt_register_error("(x)GPE0_BLK_LEN", + (u32) acpi_gbl_FADT->gpe0_blk_len, + ACPI_FADT_OFFSET(gpe0_blk_len)); } if (acpi_gbl_FADT->xgpe1_blk.address && - (acpi_gbl_FADT->gpe1_blk_len & 1)) { - acpi_ut_fadt_register_error ("(x)GPE1_BLK_LEN", - (u32) acpi_gbl_FADT->gpe1_blk_len, - ACPI_FADT_OFFSET (gpe1_blk_len)); + (acpi_gbl_FADT->gpe1_blk_len & 1)) { + acpi_ut_fadt_register_error("(x)GPE1_BLK_LEN", + (u32) acpi_gbl_FADT->gpe1_blk_len, + ACPI_FADT_OFFSET(gpe1_blk_len)); } return (AE_OK); } - /****************************************************************************** * * FUNCTION: acpi_ut_terminate @@ -180,18 +169,14 @@ acpi_ut_validate_fadt ( * ******************************************************************************/ -static void -acpi_ut_terminate ( - void) +static void acpi_ut_terminate(void) { - struct acpi_gpe_block_info *gpe_block; - struct acpi_gpe_block_info *next_gpe_block; - struct acpi_gpe_xrupt_info *gpe_xrupt_info; - struct acpi_gpe_xrupt_info *next_gpe_xrupt_info; - - - ACPI_FUNCTION_TRACE ("ut_terminate"); + struct acpi_gpe_block_info *gpe_block; + struct acpi_gpe_block_info *next_gpe_block; + struct acpi_gpe_xrupt_info *gpe_xrupt_info; + struct acpi_gpe_xrupt_info *next_gpe_xrupt_info; + ACPI_FUNCTION_TRACE("ut_terminate"); /* Free global tables, etc. */ /* Free global GPE blocks and related info structures */ @@ -201,21 +186,20 @@ acpi_ut_terminate ( gpe_block = gpe_xrupt_info->gpe_block_list_head; while (gpe_block) { next_gpe_block = gpe_block->next; - ACPI_MEM_FREE (gpe_block->event_info); - ACPI_MEM_FREE (gpe_block->register_info); - ACPI_MEM_FREE (gpe_block); + ACPI_MEM_FREE(gpe_block->event_info); + ACPI_MEM_FREE(gpe_block->register_info); + ACPI_MEM_FREE(gpe_block); gpe_block = next_gpe_block; } next_gpe_xrupt_info = gpe_xrupt_info->next; - ACPI_MEM_FREE (gpe_xrupt_info); + ACPI_MEM_FREE(gpe_xrupt_info); gpe_xrupt_info = next_gpe_xrupt_info; } return_VOID; } - /******************************************************************************* * * FUNCTION: acpi_ut_subsystem_shutdown @@ -229,50 +213,45 @@ acpi_ut_terminate ( * ******************************************************************************/ -void -acpi_ut_subsystem_shutdown ( - void) +void acpi_ut_subsystem_shutdown(void) { - ACPI_FUNCTION_TRACE ("ut_subsystem_shutdown"); + ACPI_FUNCTION_TRACE("ut_subsystem_shutdown"); /* Just exit if subsystem is already shutdown */ if (acpi_gbl_shutdown) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "ACPI Subsystem is already terminated\n")); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "ACPI Subsystem is already terminated\n")); return_VOID; } /* Subsystem appears active, go ahead and shut it down */ acpi_gbl_shutdown = TRUE; - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "Shutting down ACPI Subsystem...\n")); + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Shutting down ACPI Subsystem...\n")); /* Close the acpi_event Handling */ - acpi_ev_terminate (); + acpi_ev_terminate(); /* Close the Namespace */ - acpi_ns_terminate (); + acpi_ns_terminate(); /* Close the globals */ - acpi_ut_terminate (); + acpi_ut_terminate(); /* Purge the local caches */ - (void) acpi_ut_delete_caches (); + (void)acpi_ut_delete_caches(); /* Debug only - display leftover memory allocation, if any */ #ifdef ACPI_DBG_TRACK_ALLOCATIONS - acpi_ut_dump_allocations (ACPI_UINT32_MAX, NULL); + acpi_ut_dump_allocations(ACPI_UINT32_MAX, NULL); #endif return_VOID; } - - diff --git a/drivers/acpi/utilities/utmath.c b/drivers/acpi/utilities/utmath.c index 0d527c91543..68a0a6f9412 100644 --- a/drivers/acpi/utilities/utmath.c +++ b/drivers/acpi/utilities/utmath.c @@ -41,19 +41,16 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include - #define _COMPONENT ACPI_UTILITIES - ACPI_MODULE_NAME ("utmath") +ACPI_MODULE_NAME("utmath") /* * Support for double-precision integer divide. This code is included here * in order to support kernel environments where the double-precision math * library is not available. */ - #ifndef ACPI_USE_NATIVE_DIVIDE /******************************************************************************* * @@ -71,27 +68,22 @@ * 32-bit remainder. * ******************************************************************************/ - acpi_status -acpi_ut_short_divide ( - acpi_integer dividend, - u32 divisor, - acpi_integer *out_quotient, - u32 *out_remainder) +acpi_ut_short_divide(acpi_integer dividend, + u32 divisor, + acpi_integer * out_quotient, u32 * out_remainder) { - union uint64_overlay dividend_ovl; - union uint64_overlay quotient; - u32 remainder32; - - - ACPI_FUNCTION_TRACE ("ut_short_divide"); + union uint64_overlay dividend_ovl; + union uint64_overlay quotient; + u32 remainder32; + ACPI_FUNCTION_TRACE("ut_short_divide"); /* Always check for a zero divisor */ if (divisor == 0) { - ACPI_REPORT_ERROR (("acpi_ut_short_divide: Divide by zero\n")); - return_ACPI_STATUS (AE_AML_DIVIDE_BY_ZERO); + ACPI_REPORT_ERROR(("acpi_ut_short_divide: Divide by zero\n")); + return_ACPI_STATUS(AE_AML_DIVIDE_BY_ZERO); } dividend_ovl.full = dividend; @@ -100,9 +92,9 @@ acpi_ut_short_divide ( * The quotient is 64 bits, the remainder is always 32 bits, * and is generated by the second divide. */ - ACPI_DIV_64_BY_32 (0, dividend_ovl.part.hi, divisor, + ACPI_DIV_64_BY_32(0, dividend_ovl.part.hi, divisor, quotient.part.hi, remainder32); - ACPI_DIV_64_BY_32 (remainder32, dividend_ovl.part.lo, divisor, + ACPI_DIV_64_BY_32(remainder32, dividend_ovl.part.lo, divisor, quotient.part.lo, remainder32); /* Return only what was requested */ @@ -114,10 +106,9 @@ acpi_ut_short_divide ( *out_remainder = remainder32; } - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_ut_divide @@ -134,34 +125,30 @@ acpi_ut_short_divide ( ******************************************************************************/ acpi_status -acpi_ut_divide ( - acpi_integer in_dividend, - acpi_integer in_divisor, - acpi_integer *out_quotient, - acpi_integer *out_remainder) +acpi_ut_divide(acpi_integer in_dividend, + acpi_integer in_divisor, + acpi_integer * out_quotient, acpi_integer * out_remainder) { - union uint64_overlay dividend; - union uint64_overlay divisor; - union uint64_overlay quotient; - union uint64_overlay remainder; - union uint64_overlay normalized_dividend; - union uint64_overlay normalized_divisor; - u32 partial1; - union uint64_overlay partial2; - union uint64_overlay partial3; - - - ACPI_FUNCTION_TRACE ("ut_divide"); - + union uint64_overlay dividend; + union uint64_overlay divisor; + union uint64_overlay quotient; + union uint64_overlay remainder; + union uint64_overlay normalized_dividend; + union uint64_overlay normalized_divisor; + u32 partial1; + union uint64_overlay partial2; + union uint64_overlay partial3; + + ACPI_FUNCTION_TRACE("ut_divide"); /* Always check for a zero divisor */ if (in_divisor == 0) { - ACPI_REPORT_ERROR (("acpi_ut_divide: Divide by zero\n")); - return_ACPI_STATUS (AE_AML_DIVIDE_BY_ZERO); + ACPI_REPORT_ERROR(("acpi_ut_divide: Divide by zero\n")); + return_ACPI_STATUS(AE_AML_DIVIDE_BY_ZERO); } - divisor.full = in_divisor; + divisor.full = in_divisor; dividend.full = in_dividend; if (divisor.part.hi == 0) { /* @@ -174,9 +161,9 @@ acpi_ut_divide ( * The quotient is 64 bits, the remainder is always 32 bits, * and is generated by the second divide. */ - ACPI_DIV_64_BY_32 (0, dividend.part.hi, divisor.part.lo, + ACPI_DIV_64_BY_32(0, dividend.part.hi, divisor.part.lo, quotient.part.hi, partial1); - ACPI_DIV_64_BY_32 (partial1, dividend.part.lo, divisor.part.lo, + ACPI_DIV_64_BY_32(partial1, dividend.part.lo, divisor.part.lo, quotient.part.lo, remainder.part.lo); } @@ -185,23 +172,23 @@ acpi_ut_divide ( * 2) The general case where the divisor is a full 64 bits * is more difficult */ - quotient.part.hi = 0; + quotient.part.hi = 0; normalized_dividend = dividend; normalized_divisor = divisor; /* Normalize the operands (shift until the divisor is < 32 bits) */ do { - ACPI_SHIFT_RIGHT_64 (normalized_divisor.part.hi, - normalized_divisor.part.lo); - ACPI_SHIFT_RIGHT_64 (normalized_dividend.part.hi, - normalized_dividend.part.lo); + ACPI_SHIFT_RIGHT_64(normalized_divisor.part.hi, + normalized_divisor.part.lo); + ACPI_SHIFT_RIGHT_64(normalized_dividend.part.hi, + normalized_dividend.part.lo); } while (normalized_divisor.part.hi != 0); /* Partial divide */ - ACPI_DIV_64_BY_32 (normalized_dividend.part.hi, + ACPI_DIV_64_BY_32(normalized_dividend.part.hi, normalized_dividend.part.lo, normalized_divisor.part.lo, quotient.part.lo, partial1); @@ -210,8 +197,9 @@ acpi_ut_divide ( * The quotient is always 32 bits, and simply requires adjustment. * The 64-bit remainder must be generated. */ - partial1 = quotient.part.lo * divisor.part.hi; - partial2.full = (acpi_integer) quotient.part.lo * divisor.part.lo; + partial1 = quotient.part.lo * divisor.part.hi; + partial2.full = + (acpi_integer) quotient.part.lo * divisor.part.lo; partial3.full = (acpi_integer) partial2.part.hi + partial1; remainder.part.hi = partial3.part.lo; @@ -224,16 +212,15 @@ acpi_ut_divide ( quotient.part.lo--; remainder.full -= divisor.full; } - } - else { + } else { quotient.part.lo--; remainder.full -= divisor.full; } } - remainder.full = remainder.full - dividend.full; - remainder.part.hi = (u32) -((s32) remainder.part.hi); - remainder.part.lo = (u32) -((s32) remainder.part.lo); + remainder.full = remainder.full - dividend.full; + remainder.part.hi = (u32) - ((s32) remainder.part.hi); + remainder.part.lo = (u32) - ((s32) remainder.part.lo); if (remainder.part.lo) { remainder.part.hi--; @@ -250,11 +237,10 @@ acpi_ut_divide ( *out_remainder = remainder.full; } - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } #else - /******************************************************************************* * * FUNCTION: acpi_ut_short_divide, acpi_ut_divide @@ -269,23 +255,19 @@ acpi_ut_divide ( * perform the divide. * ******************************************************************************/ - acpi_status -acpi_ut_short_divide ( - acpi_integer in_dividend, - u32 divisor, - acpi_integer *out_quotient, - u32 *out_remainder) +acpi_ut_short_divide(acpi_integer in_dividend, + u32 divisor, + acpi_integer * out_quotient, u32 * out_remainder) { - ACPI_FUNCTION_TRACE ("ut_short_divide"); - + ACPI_FUNCTION_TRACE("ut_short_divide"); /* Always check for a zero divisor */ if (divisor == 0) { - ACPI_REPORT_ERROR (("acpi_ut_short_divide: Divide by zero\n")); - return_ACPI_STATUS (AE_AML_DIVIDE_BY_ZERO); + ACPI_REPORT_ERROR(("acpi_ut_short_divide: Divide by zero\n")); + return_ACPI_STATUS(AE_AML_DIVIDE_BY_ZERO); } /* Return only what was requested */ @@ -297,27 +279,23 @@ acpi_ut_short_divide ( *out_remainder = (u32) in_dividend % divisor; } - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } acpi_status -acpi_ut_divide ( - acpi_integer in_dividend, - acpi_integer in_divisor, - acpi_integer *out_quotient, - acpi_integer *out_remainder) +acpi_ut_divide(acpi_integer in_dividend, + acpi_integer in_divisor, + acpi_integer * out_quotient, acpi_integer * out_remainder) { - ACPI_FUNCTION_TRACE ("ut_divide"); - + ACPI_FUNCTION_TRACE("ut_divide"); /* Always check for a zero divisor */ if (in_divisor == 0) { - ACPI_REPORT_ERROR (("acpi_ut_divide: Divide by zero\n")); - return_ACPI_STATUS (AE_AML_DIVIDE_BY_ZERO); + ACPI_REPORT_ERROR(("acpi_ut_divide: Divide by zero\n")); + return_ACPI_STATUS(AE_AML_DIVIDE_BY_ZERO); } - /* Return only what was requested */ if (out_quotient) { @@ -327,9 +305,7 @@ acpi_ut_divide ( *out_remainder = in_dividend % in_divisor; } - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } #endif - - diff --git a/drivers/acpi/utilities/utmisc.c b/drivers/acpi/utilities/utmisc.c index 1d350b302a3..474fe7cb6c0 100644 --- a/drivers/acpi/utilities/utmisc.c +++ b/drivers/acpi/utilities/utmisc.c @@ -41,14 +41,11 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include #include - #define _COMPONENT ACPI_UTILITIES - ACPI_MODULE_NAME ("utmisc") - +ACPI_MODULE_NAME("utmisc") /******************************************************************************* * @@ -63,23 +60,18 @@ * when the method exits or the table is unloaded. * ******************************************************************************/ - -acpi_status -acpi_ut_allocate_owner_id ( - acpi_owner_id *owner_id) +acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id) { - acpi_native_uint i; - acpi_status status; - - - ACPI_FUNCTION_TRACE ("ut_allocate_owner_id"); + acpi_native_uint i; + acpi_status status; + ACPI_FUNCTION_TRACE("ut_allocate_owner_id"); /* Mutex for the global ID mask */ - status = acpi_ut_acquire_mutex (ACPI_MTX_CACHES); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ut_acquire_mutex(ACPI_MTX_CACHES); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* Find a free owner ID */ @@ -101,15 +93,13 @@ acpi_ut_allocate_owner_id ( */ *owner_id = 0; status = AE_OWNER_ID_LIMIT; - ACPI_REPORT_ERROR (( - "Could not allocate new owner_id (32 max), AE_OWNER_ID_LIMIT\n")); + ACPI_REPORT_ERROR(("Could not allocate new owner_id (32 max), AE_OWNER_ID_LIMIT\n")); -exit: - (void) acpi_ut_release_mutex (ACPI_MTX_CACHES); - return_ACPI_STATUS (status); + exit: + (void)acpi_ut_release_mutex(ACPI_MTX_CACHES); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_ut_release_owner_id @@ -124,16 +114,12 @@ exit: * ******************************************************************************/ -void -acpi_ut_release_owner_id ( - acpi_owner_id *owner_id_ptr) +void acpi_ut_release_owner_id(acpi_owner_id * owner_id_ptr) { - acpi_owner_id owner_id = *owner_id_ptr; - acpi_status status; - - - ACPI_FUNCTION_TRACE ("ut_release_owner_id"); + acpi_owner_id owner_id = *owner_id_ptr; + acpi_status status; + ACPI_FUNCTION_TRACE("ut_release_owner_id"); /* Always clear the input owner_id (zero is an invalid ID) */ @@ -142,18 +128,18 @@ acpi_ut_release_owner_id ( /* Zero is not a valid owner_iD */ if ((owner_id == 0) || (owner_id > 32)) { - ACPI_REPORT_ERROR (("Invalid owner_id: %2.2X\n", owner_id)); + ACPI_REPORT_ERROR(("Invalid owner_id: %2.2X\n", owner_id)); return_VOID; } /* Mutex for the global ID mask */ - status = acpi_ut_acquire_mutex (ACPI_MTX_CACHES); - if (ACPI_FAILURE (status)) { + status = acpi_ut_acquire_mutex(ACPI_MTX_CACHES); + if (ACPI_FAILURE(status)) { return_VOID; } - owner_id--; /* Normalize to zero */ + owner_id--; /* Normalize to zero */ /* Free the owner ID only if it is valid */ @@ -161,11 +147,10 @@ acpi_ut_release_owner_id ( acpi_gbl_owner_id_mask ^= (1 << owner_id); } - (void) acpi_ut_release_mutex (ACPI_MTX_CACHES); + (void)acpi_ut_release_mutex(ACPI_MTX_CACHES); return_VOID; } - /******************************************************************************* * * FUNCTION: acpi_ut_strupr (strupr) @@ -180,15 +165,11 @@ acpi_ut_release_owner_id ( * ******************************************************************************/ -void -acpi_ut_strupr ( - char *src_string) +void acpi_ut_strupr(char *src_string) { - char *string; - - - ACPI_FUNCTION_ENTRY (); + char *string; + ACPI_FUNCTION_ENTRY(); if (!src_string) { return; @@ -197,13 +178,12 @@ acpi_ut_strupr ( /* Walk entire string, uppercasing the letters */ for (string = src_string; *string; string++) { - *string = (char) ACPI_TOUPPER (*string); + *string = (char)ACPI_TOUPPER(*string); } return; } - /******************************************************************************* * * FUNCTION: acpi_ut_print_string @@ -218,85 +198,77 @@ acpi_ut_strupr ( * ******************************************************************************/ -void -acpi_ut_print_string ( - char *string, - u8 max_length) +void acpi_ut_print_string(char *string, u8 max_length) { - u32 i; - + u32 i; if (!string) { - acpi_os_printf ("<\"NULL STRING PTR\">"); + acpi_os_printf("<\"NULL STRING PTR\">"); return; } - acpi_os_printf ("\""); + acpi_os_printf("\""); for (i = 0; string[i] && (i < max_length); i++) { /* Escape sequences */ switch (string[i]) { case 0x07: - acpi_os_printf ("\\a"); /* BELL */ + acpi_os_printf("\\a"); /* BELL */ break; case 0x08: - acpi_os_printf ("\\b"); /* BACKSPACE */ + acpi_os_printf("\\b"); /* BACKSPACE */ break; case 0x0C: - acpi_os_printf ("\\f"); /* FORMFEED */ + acpi_os_printf("\\f"); /* FORMFEED */ break; case 0x0A: - acpi_os_printf ("\\n"); /* LINEFEED */ + acpi_os_printf("\\n"); /* LINEFEED */ break; case 0x0D: - acpi_os_printf ("\\r"); /* CARRIAGE RETURN*/ + acpi_os_printf("\\r"); /* CARRIAGE RETURN */ break; case 0x09: - acpi_os_printf ("\\t"); /* HORIZONTAL TAB */ + acpi_os_printf("\\t"); /* HORIZONTAL TAB */ break; case 0x0B: - acpi_os_printf ("\\v"); /* VERTICAL TAB */ + acpi_os_printf("\\v"); /* VERTICAL TAB */ break; - case '\'': /* Single Quote */ - case '\"': /* Double Quote */ - case '\\': /* Backslash */ - acpi_os_printf ("\\%c", (int) string[i]); + case '\'': /* Single Quote */ + case '\"': /* Double Quote */ + case '\\': /* Backslash */ + acpi_os_printf("\\%c", (int)string[i]); break; default: /* Check for printable character or hex escape */ - if (ACPI_IS_PRINT (string[i])) - { + if (ACPI_IS_PRINT(string[i])) { /* This is a normal character */ - acpi_os_printf ("%c", (int) string[i]); - } - else - { + acpi_os_printf("%c", (int)string[i]); + } else { /* All others will be Hex escapes */ - acpi_os_printf ("\\x%2.2X", (s32) string[i]); + acpi_os_printf("\\x%2.2X", (s32) string[i]); } break; } } - acpi_os_printf ("\""); + acpi_os_printf("\""); if (i == max_length && string[i]) { - acpi_os_printf ("..."); + acpi_os_printf("..."); } } - /******************************************************************************* * * FUNCTION: acpi_ut_dword_byte_swap @@ -309,22 +281,18 @@ acpi_ut_print_string ( * ******************************************************************************/ -u32 -acpi_ut_dword_byte_swap ( - u32 value) +u32 acpi_ut_dword_byte_swap(u32 value) { union { - u32 value; - u8 bytes[4]; + u32 value; + u8 bytes[4]; } out; union { - u32 value; - u8 bytes[4]; + u32 value; + u8 bytes[4]; } in; - - ACPI_FUNCTION_ENTRY (); - + ACPI_FUNCTION_ENTRY(); in.value = value; @@ -336,7 +304,6 @@ acpi_ut_dword_byte_swap ( return (out.value); } - /******************************************************************************* * * FUNCTION: acpi_ut_set_integer_width @@ -352,24 +319,20 @@ acpi_ut_dword_byte_swap ( * ******************************************************************************/ -void -acpi_ut_set_integer_width ( - u8 revision) +void acpi_ut_set_integer_width(u8 revision) { if (revision <= 1) { acpi_gbl_integer_bit_width = 32; acpi_gbl_integer_nybble_width = 8; acpi_gbl_integer_byte_width = 4; - } - else { + } else { acpi_gbl_integer_bit_width = 64; acpi_gbl_integer_nybble_width = 16; acpi_gbl_integer_byte_width = 8; } } - #ifdef ACPI_DEBUG_OUTPUT /******************************************************************************* * @@ -387,17 +350,14 @@ acpi_ut_set_integer_width ( ******************************************************************************/ void -acpi_ut_display_init_pathname ( - u8 type, - struct acpi_namespace_node *obj_handle, - char *path) +acpi_ut_display_init_pathname(u8 type, + struct acpi_namespace_node *obj_handle, + char *path) { - acpi_status status; - struct acpi_buffer buffer; - - - ACPI_FUNCTION_ENTRY (); + acpi_status status; + struct acpi_buffer buffer; + ACPI_FUNCTION_ENTRY(); /* Only print the path if the appropriate debug level is enabled */ @@ -408,8 +368,8 @@ acpi_ut_display_init_pathname ( /* Get the full pathname to the node */ buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER; - status = acpi_ns_handle_to_pathname (obj_handle, &buffer); - if (ACPI_FAILURE (status)) { + status = acpi_ns_handle_to_pathname(obj_handle, &buffer); + if (ACPI_FAILURE(status)) { return; } @@ -417,31 +377,30 @@ acpi_ut_display_init_pathname ( switch (type) { case ACPI_TYPE_METHOD: - acpi_os_printf ("Executing "); + acpi_os_printf("Executing "); break; default: - acpi_os_printf ("Initializing "); + acpi_os_printf("Initializing "); break; } /* Print the object type and pathname */ - acpi_os_printf ("%-12s %s", - acpi_ut_get_type_name (type), (char *) buffer.pointer); + acpi_os_printf("%-12s %s", + acpi_ut_get_type_name(type), (char *)buffer.pointer); /* Extra path is used to append names like _STA, _INI, etc. */ if (path) { - acpi_os_printf (".%s", path); + acpi_os_printf(".%s", path); } - acpi_os_printf ("\n"); + acpi_os_printf("\n"); - ACPI_MEM_FREE (buffer.pointer); + ACPI_MEM_FREE(buffer.pointer); } #endif - /******************************************************************************* * * FUNCTION: acpi_ut_valid_acpi_name @@ -457,25 +416,21 @@ acpi_ut_display_init_pathname ( * ******************************************************************************/ -u8 -acpi_ut_valid_acpi_name ( - u32 name) +u8 acpi_ut_valid_acpi_name(u32 name) { - char *name_ptr = (char *) &name; - char character; - acpi_native_uint i; - - - ACPI_FUNCTION_ENTRY (); + char *name_ptr = (char *)&name; + char character; + acpi_native_uint i; + ACPI_FUNCTION_ENTRY(); for (i = 0; i < ACPI_NAME_SIZE; i++) { character = *name_ptr; name_ptr++; if (!((character == '_') || - (character >= 'A' && character <= 'Z') || - (character >= '0' && character <= '9'))) { + (character >= 'A' && character <= 'Z') || + (character >= '0' && character <= '9'))) { return (FALSE); } } @@ -483,7 +438,6 @@ acpi_ut_valid_acpi_name ( return (TRUE); } - /******************************************************************************* * * FUNCTION: acpi_ut_valid_acpi_character @@ -496,19 +450,16 @@ acpi_ut_valid_acpi_name ( * ******************************************************************************/ -u8 -acpi_ut_valid_acpi_character ( - char character) +u8 acpi_ut_valid_acpi_character(char character) { - ACPI_FUNCTION_ENTRY (); + ACPI_FUNCTION_ENTRY(); - return ((u8) ((character == '_') || - (character >= 'A' && character <= 'Z') || - (character >= '0' && character <= '9'))); + return ((u8) ((character == '_') || + (character >= 'A' && character <= 'Z') || + (character >= '0' && character <= '9'))); } - /******************************************************************************* * * FUNCTION: acpi_ut_strtoul64 @@ -525,18 +476,13 @@ acpi_ut_valid_acpi_character ( ******************************************************************************/ acpi_status -acpi_ut_strtoul64 ( - char *string, - u32 base, - acpi_integer *ret_integer) +acpi_ut_strtoul64(char *string, u32 base, acpi_integer * ret_integer) { - u32 this_digit = 0; - acpi_integer return_value = 0; - acpi_integer quotient; - - - ACPI_FUNCTION_TRACE ("ut_stroul64"); + u32 this_digit = 0; + acpi_integer return_value = 0; + acpi_integer quotient; + ACPI_FUNCTION_TRACE("ut_stroul64"); if ((!string) || !(*string)) { goto error_exit; @@ -550,12 +496,12 @@ acpi_ut_strtoul64 ( default: /* Invalid Base */ - return_ACPI_STATUS (AE_BAD_PARAMETER); + return_ACPI_STATUS(AE_BAD_PARAMETER); } /* Skip over any white space in the buffer */ - while (ACPI_IS_SPACE (*string) || *string == '\t') { + while (ACPI_IS_SPACE(*string) || *string == '\t') { string++; } @@ -564,12 +510,10 @@ acpi_ut_strtoul64 ( * determine if it is decimal or hexadecimal: */ if (base == 0) { - if ((*string == '0') && - (ACPI_TOLOWER (*(string + 1)) == 'x')) { + if ((*string == '0') && (ACPI_TOLOWER(*(string + 1)) == 'x')) { base = 16; string += 2; - } - else { + } else { base = 10; } } @@ -579,8 +523,7 @@ acpi_ut_strtoul64 ( * 0 or 0x, if they are present. */ if ((base == 16) && - (*string == '0') && - (ACPI_TOLOWER (*(string + 1)) == 'x')) { + (*string == '0') && (ACPI_TOLOWER(*(string + 1)) == 'x')) { string += 2; } @@ -593,25 +536,23 @@ acpi_ut_strtoul64 ( /* Main loop: convert the string to a 64-bit integer */ while (*string) { - if (ACPI_IS_DIGIT (*string)) { + if (ACPI_IS_DIGIT(*string)) { /* Convert ASCII 0-9 to Decimal value */ - this_digit = ((u8) *string) - '0'; - } - else { + this_digit = ((u8) * string) - '0'; + } else { if (base == 10) { /* Digit is out of range */ goto error_exit; } - this_digit = (u8) ACPI_TOUPPER (*string); - if (ACPI_IS_XDIGIT ((char) this_digit)) { + this_digit = (u8) ACPI_TOUPPER(*string); + if (ACPI_IS_XDIGIT((char)this_digit)) { /* Convert ASCII Hex char to value */ this_digit = this_digit - 'A' + 10; - } - else { + } else { /* * We allow non-hex chars, just stop now, same as end-of-string. * See ACPI spec, string-to-integer conversion. @@ -622,8 +563,10 @@ acpi_ut_strtoul64 ( /* Divide the digit into the correct position */ - (void) acpi_ut_short_divide ((ACPI_INTEGER_MAX - (acpi_integer) this_digit), - base, "ient, NULL); + (void) + acpi_ut_short_divide((ACPI_INTEGER_MAX - + (acpi_integer) this_digit), base, + "ient, NULL); if (return_value > quotient) { goto error_exit; } @@ -636,21 +579,18 @@ acpi_ut_strtoul64 ( /* All done, normal exit */ *ret_integer = return_value; - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); - -error_exit: + error_exit: /* Base was set/validated above */ if (base == 10) { - return_ACPI_STATUS (AE_BAD_DECIMAL_CONSTANT); - } - else { - return_ACPI_STATUS (AE_BAD_HEX_CONSTANT); + return_ACPI_STATUS(AE_BAD_DECIMAL_CONSTANT); + } else { + return_ACPI_STATUS(AE_BAD_HEX_CONSTANT); } } - /******************************************************************************* * * FUNCTION: acpi_ut_create_update_state_and_push @@ -666,16 +606,13 @@ error_exit: ******************************************************************************/ acpi_status -acpi_ut_create_update_state_and_push ( - union acpi_operand_object *object, - u16 action, - union acpi_generic_state **state_list) +acpi_ut_create_update_state_and_push(union acpi_operand_object *object, + u16 action, + union acpi_generic_state **state_list) { - union acpi_generic_state *state; - - - ACPI_FUNCTION_ENTRY (); + union acpi_generic_state *state; + ACPI_FUNCTION_ENTRY(); /* Ignore null objects; these are expected */ @@ -683,16 +620,15 @@ acpi_ut_create_update_state_and_push ( return (AE_OK); } - state = acpi_ut_create_update_state (object, action); + state = acpi_ut_create_update_state(object, action); if (!state) { return (AE_NO_MEMORY); } - acpi_ut_push_generic_state (state_list, state); + acpi_ut_push_generic_state(state_list, state); return (AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_ut_walk_package_tree @@ -709,33 +645,29 @@ acpi_ut_create_update_state_and_push ( ******************************************************************************/ acpi_status -acpi_ut_walk_package_tree ( - union acpi_operand_object *source_object, - void *target_object, - acpi_pkg_callback walk_callback, - void *context) +acpi_ut_walk_package_tree(union acpi_operand_object * source_object, + void *target_object, + acpi_pkg_callback walk_callback, void *context) { - acpi_status status = AE_OK; - union acpi_generic_state *state_list = NULL; - union acpi_generic_state *state; - u32 this_index; - union acpi_operand_object *this_source_obj; - + acpi_status status = AE_OK; + union acpi_generic_state *state_list = NULL; + union acpi_generic_state *state; + u32 this_index; + union acpi_operand_object *this_source_obj; - ACPI_FUNCTION_TRACE ("ut_walk_package_tree"); + ACPI_FUNCTION_TRACE("ut_walk_package_tree"); - - state = acpi_ut_create_pkg_state (source_object, target_object, 0); + state = acpi_ut_create_pkg_state(source_object, target_object, 0); if (!state) { - return_ACPI_STATUS (AE_NO_MEMORY); + return_ACPI_STATUS(AE_NO_MEMORY); } while (state) { /* Get one element of the package */ - this_index = state->pkg.index; + this_index = state->pkg.index; this_source_obj = (union acpi_operand_object *) - state->pkg.source_object->package.elements[this_index]; + state->pkg.source_object->package.elements[this_index]; /* * Check for: @@ -746,16 +678,20 @@ acpi_ut_walk_package_tree ( * case below. */ if ((!this_source_obj) || - (ACPI_GET_DESCRIPTOR_TYPE (this_source_obj) != ACPI_DESC_TYPE_OPERAND) || - (ACPI_GET_OBJECT_TYPE (this_source_obj) != ACPI_TYPE_PACKAGE)) { - status = walk_callback (ACPI_COPY_TYPE_SIMPLE, this_source_obj, - state, context); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + (ACPI_GET_DESCRIPTOR_TYPE(this_source_obj) != + ACPI_DESC_TYPE_OPERAND) + || (ACPI_GET_OBJECT_TYPE(this_source_obj) != + ACPI_TYPE_PACKAGE)) { + status = + walk_callback(ACPI_COPY_TYPE_SIMPLE, + this_source_obj, state, context); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } state->pkg.index++; - while (state->pkg.index >= state->pkg.source_object->package.count) { + while (state->pkg.index >= + state->pkg.source_object->package.count) { /* * We've handled all of the objects at this level, This means * that we have just completed a package. That package may @@ -763,8 +699,8 @@ acpi_ut_walk_package_tree ( * * Delete this state and pop the previous state (package). */ - acpi_ut_delete_generic_state (state); - state = acpi_ut_pop_generic_state (&state_list); + acpi_ut_delete_generic_state(state); + state = acpi_ut_pop_generic_state(&state_list); /* Finished when there are no more states */ @@ -774,7 +710,7 @@ acpi_ut_walk_package_tree ( * package just add the length of the package objects * and exit */ - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } /* @@ -783,35 +719,35 @@ acpi_ut_walk_package_tree ( */ state->pkg.index++; } - } - else { + } else { /* This is a subobject of type package */ - status = walk_callback (ACPI_COPY_TYPE_PACKAGE, this_source_obj, - state, context); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = + walk_callback(ACPI_COPY_TYPE_PACKAGE, + this_source_obj, state, context); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* * Push the current state and create a new one * The callback above returned a new target package object. */ - acpi_ut_push_generic_state (&state_list, state); - state = acpi_ut_create_pkg_state (this_source_obj, - state->pkg.this_target_obj, 0); + acpi_ut_push_generic_state(&state_list, state); + state = acpi_ut_create_pkg_state(this_source_obj, + state->pkg. + this_target_obj, 0); if (!state) { - return_ACPI_STATUS (AE_NO_MEMORY); + return_ACPI_STATUS(AE_NO_MEMORY); } } } /* We should never get here */ - return_ACPI_STATUS (AE_AML_INTERNAL); + return_ACPI_STATUS(AE_AML_INTERNAL); } - /******************************************************************************* * * FUNCTION: acpi_ut_generate_checksum @@ -825,23 +761,18 @@ acpi_ut_walk_package_tree ( * ******************************************************************************/ -u8 -acpi_ut_generate_checksum ( - u8 *buffer, - u32 length) +u8 acpi_ut_generate_checksum(u8 * buffer, u32 length) { - u32 i; - signed char sum = 0; - + u32 i; + signed char sum = 0; for (i = 0; i < length; i++) { - sum = (signed char) (sum + buffer[i]); + sum = (signed char)(sum + buffer[i]); } return ((u8) (0 - sum)); } - /******************************************************************************* * * FUNCTION: acpi_ut_get_resource_end_tag @@ -854,17 +785,13 @@ acpi_ut_generate_checksum ( * ******************************************************************************/ - -u8 * -acpi_ut_get_resource_end_tag ( - union acpi_operand_object *obj_desc) +u8 *acpi_ut_get_resource_end_tag(union acpi_operand_object * obj_desc) { - u8 buffer_byte; - u8 *buffer; - u8 *end_buffer; + u8 buffer_byte; + u8 *buffer; + u8 *end_buffer; - - buffer = obj_desc->buffer.pointer; + buffer = obj_desc->buffer.pointer; end_buffer = buffer + obj_desc->buffer.length; while (buffer < end_buffer) { @@ -872,12 +799,12 @@ acpi_ut_get_resource_end_tag ( if (buffer_byte & ACPI_RDESC_TYPE_MASK) { /* Large Descriptor - Length is next 2 bytes */ - buffer += ((*(buffer+1) | (*(buffer+2) << 8)) + 3); - } - else { + buffer += ((*(buffer + 1) | (*(buffer + 2) << 8)) + 3); + } else { /* Small Descriptor. End Tag will be found here */ - if ((buffer_byte & ACPI_RDESC_SMALL_MASK) == ACPI_RDESC_TYPE_END_TAG) { + if ((buffer_byte & ACPI_RDESC_SMALL_MASK) == + ACPI_RDESC_TYPE_END_TAG) { /* Found the end tag descriptor, all done. */ return (buffer); @@ -894,7 +821,6 @@ acpi_ut_get_resource_end_tag ( return (NULL); } - /******************************************************************************* * * FUNCTION: acpi_ut_report_error @@ -909,17 +835,12 @@ acpi_ut_get_resource_end_tag ( * ******************************************************************************/ -void -acpi_ut_report_error ( - char *module_name, - u32 line_number, - u32 component_id) +void acpi_ut_report_error(char *module_name, u32 line_number, u32 component_id) { - acpi_os_printf ("%8s-%04d: *** Error: ", module_name, line_number); + acpi_os_printf("%8s-%04d: *** Error: ", module_name, line_number); } - /******************************************************************************* * * FUNCTION: acpi_ut_report_warning @@ -935,16 +856,12 @@ acpi_ut_report_error ( ******************************************************************************/ void -acpi_ut_report_warning ( - char *module_name, - u32 line_number, - u32 component_id) +acpi_ut_report_warning(char *module_name, u32 line_number, u32 component_id) { - acpi_os_printf ("%8s-%04d: *** Warning: ", module_name, line_number); + acpi_os_printf("%8s-%04d: *** Warning: ", module_name, line_number); } - /******************************************************************************* * * FUNCTION: acpi_ut_report_info @@ -959,14 +876,8 @@ acpi_ut_report_warning ( * ******************************************************************************/ -void -acpi_ut_report_info ( - char *module_name, - u32 line_number, - u32 component_id) +void acpi_ut_report_info(char *module_name, u32 line_number, u32 component_id) { - acpi_os_printf ("%8s-%04d: *** Info: ", module_name, line_number); + acpi_os_printf("%8s-%04d: *** Info: ", module_name, line_number); } - - diff --git a/drivers/acpi/utilities/utmutex.c b/drivers/acpi/utilities/utmutex.c index 0699b6be62b..90134c56ece 100644 --- a/drivers/acpi/utilities/utmutex.c +++ b/drivers/acpi/utilities/utmutex.c @@ -41,22 +41,15 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include #define _COMPONENT ACPI_UTILITIES - ACPI_MODULE_NAME ("utmutex") +ACPI_MODULE_NAME("utmutex") /* Local prototypes */ +static acpi_status acpi_ut_create_mutex(acpi_mutex_handle mutex_id); -static acpi_status -acpi_ut_create_mutex ( - acpi_mutex_handle mutex_id); - -static acpi_status -acpi_ut_delete_mutex ( - acpi_mutex_handle mutex_id); - +static acpi_status acpi_ut_delete_mutex(acpi_mutex_handle mutex_id); /******************************************************************************* * @@ -70,32 +63,27 @@ acpi_ut_delete_mutex ( * ******************************************************************************/ -acpi_status -acpi_ut_mutex_initialize ( - void) +acpi_status acpi_ut_mutex_initialize(void) { - u32 i; - acpi_status status; - - - ACPI_FUNCTION_TRACE ("ut_mutex_initialize"); + u32 i; + acpi_status status; + ACPI_FUNCTION_TRACE("ut_mutex_initialize"); /* * Create each of the predefined mutex objects */ for (i = 0; i < NUM_MUTEX; i++) { - status = acpi_ut_create_mutex (i); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ut_create_mutex(i); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } } - status = acpi_os_create_lock (&acpi_gbl_gpe_lock); - return_ACPI_STATUS (status); + status = acpi_os_create_lock(&acpi_gbl_gpe_lock); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_ut_mutex_terminate @@ -108,28 +96,23 @@ acpi_ut_mutex_initialize ( * ******************************************************************************/ -void -acpi_ut_mutex_terminate ( - void) +void acpi_ut_mutex_terminate(void) { - u32 i; - - - ACPI_FUNCTION_TRACE ("ut_mutex_terminate"); + u32 i; + ACPI_FUNCTION_TRACE("ut_mutex_terminate"); /* * Delete each predefined mutex object */ for (i = 0; i < NUM_MUTEX; i++) { - (void) acpi_ut_delete_mutex (i); + (void)acpi_ut_delete_mutex(i); } - acpi_os_delete_lock (acpi_gbl_gpe_lock); + acpi_os_delete_lock(acpi_gbl_gpe_lock); return_VOID; } - /******************************************************************************* * * FUNCTION: acpi_ut_create_mutex @@ -142,31 +125,28 @@ acpi_ut_mutex_terminate ( * ******************************************************************************/ -static acpi_status -acpi_ut_create_mutex ( - acpi_mutex_handle mutex_id) +static acpi_status acpi_ut_create_mutex(acpi_mutex_handle mutex_id) { - acpi_status status = AE_OK; - - - ACPI_FUNCTION_TRACE_U32 ("ut_create_mutex", mutex_id); + acpi_status status = AE_OK; + ACPI_FUNCTION_TRACE_U32("ut_create_mutex", mutex_id); if (mutex_id > MAX_MUTEX) { - return_ACPI_STATUS (AE_BAD_PARAMETER); + return_ACPI_STATUS(AE_BAD_PARAMETER); } if (!acpi_gbl_mutex_info[mutex_id].mutex) { - status = acpi_os_create_semaphore (1, 1, - &acpi_gbl_mutex_info[mutex_id].mutex); - acpi_gbl_mutex_info[mutex_id].thread_id = ACPI_MUTEX_NOT_ACQUIRED; + status = acpi_os_create_semaphore(1, 1, + &acpi_gbl_mutex_info + [mutex_id].mutex); + acpi_gbl_mutex_info[mutex_id].thread_id = + ACPI_MUTEX_NOT_ACQUIRED; acpi_gbl_mutex_info[mutex_id].use_count = 0; } - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_ut_delete_mutex @@ -179,29 +159,24 @@ acpi_ut_create_mutex ( * ******************************************************************************/ -static acpi_status -acpi_ut_delete_mutex ( - acpi_mutex_handle mutex_id) +static acpi_status acpi_ut_delete_mutex(acpi_mutex_handle mutex_id) { - acpi_status status; - - - ACPI_FUNCTION_TRACE_U32 ("ut_delete_mutex", mutex_id); + acpi_status status; + ACPI_FUNCTION_TRACE_U32("ut_delete_mutex", mutex_id); if (mutex_id > MAX_MUTEX) { - return_ACPI_STATUS (AE_BAD_PARAMETER); + return_ACPI_STATUS(AE_BAD_PARAMETER); } - status = acpi_os_delete_semaphore (acpi_gbl_mutex_info[mutex_id].mutex); + status = acpi_os_delete_semaphore(acpi_gbl_mutex_info[mutex_id].mutex); acpi_gbl_mutex_info[mutex_id].mutex = NULL; acpi_gbl_mutex_info[mutex_id].thread_id = ACPI_MUTEX_NOT_ACQUIRED; - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_ut_acquire_mutex @@ -214,26 +189,22 @@ acpi_ut_delete_mutex ( * ******************************************************************************/ -acpi_status -acpi_ut_acquire_mutex ( - acpi_mutex_handle mutex_id) +acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id) { - acpi_status status; - u32 this_thread_id; - - - ACPI_FUNCTION_NAME ("ut_acquire_mutex"); + acpi_status status; + u32 this_thread_id; + ACPI_FUNCTION_NAME("ut_acquire_mutex"); if (mutex_id > MAX_MUTEX) { return (AE_BAD_PARAMETER); } - this_thread_id = acpi_os_get_thread_id (); + this_thread_id = acpi_os_get_thread_id(); #ifdef ACPI_MUTEX_DEBUG { - u32 i; + u32 i; /* * Mutex debug code, for internal debugging only. * @@ -245,17 +216,21 @@ acpi_ut_acquire_mutex ( for (i = mutex_id; i < MAX_MUTEX; i++) { if (acpi_gbl_mutex_info[i].owner_id == this_thread_id) { if (i == mutex_id) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Mutex [%s] already acquired by this thread [%X]\n", - acpi_ut_get_mutex_name (mutex_id), this_thread_id)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Mutex [%s] already acquired by this thread [%X]\n", + acpi_ut_get_mutex_name + (mutex_id), + this_thread_id)); return (AE_ALREADY_ACQUIRED); } - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Invalid acquire order: Thread %X owns [%s], wants [%s]\n", - this_thread_id, acpi_ut_get_mutex_name (i), - acpi_ut_get_mutex_name (mutex_id))); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Invalid acquire order: Thread %X owns [%s], wants [%s]\n", + this_thread_id, + acpi_ut_get_mutex_name(i), + acpi_ut_get_mutex_name + (mutex_id))); return (AE_ACQUIRE_DEADLOCK); } @@ -263,30 +238,31 @@ acpi_ut_acquire_mutex ( } #endif - ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, - "Thread %X attempting to acquire Mutex [%s]\n", - this_thread_id, acpi_ut_get_mutex_name (mutex_id))); + ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, + "Thread %X attempting to acquire Mutex [%s]\n", + this_thread_id, acpi_ut_get_mutex_name(mutex_id))); - status = acpi_os_wait_semaphore (acpi_gbl_mutex_info[mutex_id].mutex, - 1, ACPI_WAIT_FOREVER); - if (ACPI_SUCCESS (status)) { - ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Thread %X acquired Mutex [%s]\n", - this_thread_id, acpi_ut_get_mutex_name (mutex_id))); + status = acpi_os_wait_semaphore(acpi_gbl_mutex_info[mutex_id].mutex, + 1, ACPI_WAIT_FOREVER); + if (ACPI_SUCCESS(status)) { + ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, + "Thread %X acquired Mutex [%s]\n", + this_thread_id, + acpi_ut_get_mutex_name(mutex_id))); acpi_gbl_mutex_info[mutex_id].use_count++; acpi_gbl_mutex_info[mutex_id].thread_id = this_thread_id; - } - else { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Thread %X could not acquire Mutex [%s] %s\n", - this_thread_id, acpi_ut_get_mutex_name (mutex_id), - acpi_format_exception (status))); + } else { + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Thread %X could not acquire Mutex [%s] %s\n", + this_thread_id, + acpi_ut_get_mutex_name(mutex_id), + acpi_format_exception(status))); } return (status); } - /******************************************************************************* * * FUNCTION: acpi_ut_release_mutex @@ -299,21 +275,17 @@ acpi_ut_acquire_mutex ( * ******************************************************************************/ -acpi_status -acpi_ut_release_mutex ( - acpi_mutex_handle mutex_id) +acpi_status acpi_ut_release_mutex(acpi_mutex_handle mutex_id) { - acpi_status status; - u32 this_thread_id; - + acpi_status status; + u32 this_thread_id; - ACPI_FUNCTION_NAME ("ut_release_mutex"); + ACPI_FUNCTION_NAME("ut_release_mutex"); - - this_thread_id = acpi_os_get_thread_id (); - ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, - "Thread %X releasing Mutex [%s]\n", this_thread_id, - acpi_ut_get_mutex_name (mutex_id))); + this_thread_id = acpi_os_get_thread_id(); + ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, + "Thread %X releasing Mutex [%s]\n", this_thread_id, + acpi_ut_get_mutex_name(mutex_id))); if (mutex_id > MAX_MUTEX) { return (AE_BAD_PARAMETER); @@ -323,16 +295,15 @@ acpi_ut_release_mutex ( * Mutex must be acquired in order to release it! */ if (acpi_gbl_mutex_info[mutex_id].thread_id == ACPI_MUTEX_NOT_ACQUIRED) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Mutex [%s] is not acquired, cannot release\n", - acpi_ut_get_mutex_name (mutex_id))); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Mutex [%s] is not acquired, cannot release\n", + acpi_ut_get_mutex_name(mutex_id))); return (AE_NOT_ACQUIRED); } - #ifdef ACPI_MUTEX_DEBUG { - u32 i; + u32 i; /* * Mutex debug code, for internal debugging only. * @@ -347,9 +318,11 @@ acpi_ut_release_mutex ( continue; } - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Invalid release order: owns [%s], releasing [%s]\n", - acpi_ut_get_mutex_name (i), acpi_ut_get_mutex_name (mutex_id))); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Invalid release order: owns [%s], releasing [%s]\n", + acpi_ut_get_mutex_name(i), + acpi_ut_get_mutex_name + (mutex_id))); return (AE_RELEASE_DEADLOCK); } @@ -361,20 +334,21 @@ acpi_ut_release_mutex ( acpi_gbl_mutex_info[mutex_id].thread_id = ACPI_MUTEX_NOT_ACQUIRED; - status = acpi_os_signal_semaphore (acpi_gbl_mutex_info[mutex_id].mutex, 1); - - if (ACPI_FAILURE (status)) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Thread %X could not release Mutex [%s] %s\n", - this_thread_id, acpi_ut_get_mutex_name (mutex_id), - acpi_format_exception (status))); - } - else { - ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Thread %X released Mutex [%s]\n", - this_thread_id, acpi_ut_get_mutex_name (mutex_id))); + status = + acpi_os_signal_semaphore(acpi_gbl_mutex_info[mutex_id].mutex, 1); + + if (ACPI_FAILURE(status)) { + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Thread %X could not release Mutex [%s] %s\n", + this_thread_id, + acpi_ut_get_mutex_name(mutex_id), + acpi_format_exception(status))); + } else { + ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, + "Thread %X released Mutex [%s]\n", + this_thread_id, + acpi_ut_get_mutex_name(mutex_id))); } return (status); } - - diff --git a/drivers/acpi/utilities/utobject.c b/drivers/acpi/utilities/utobject.c index 19178e14295..3015e154005 100644 --- a/drivers/acpi/utilities/utobject.c +++ b/drivers/acpi/utilities/utobject.c @@ -41,34 +41,26 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include #include #include - #define _COMPONENT ACPI_UTILITIES - ACPI_MODULE_NAME ("utobject") +ACPI_MODULE_NAME("utobject") /* Local prototypes */ - static acpi_status -acpi_ut_get_simple_object_size ( - union acpi_operand_object *obj, - acpi_size *obj_length); +acpi_ut_get_simple_object_size(union acpi_operand_object *obj, + acpi_size * obj_length); static acpi_status -acpi_ut_get_package_object_size ( - union acpi_operand_object *obj, - acpi_size *obj_length); +acpi_ut_get_package_object_size(union acpi_operand_object *obj, + acpi_size * obj_length); static acpi_status -acpi_ut_get_element_length ( - u8 object_type, - union acpi_operand_object *source_object, - union acpi_generic_state *state, - void *context); - +acpi_ut_get_element_length(u8 object_type, + union acpi_operand_object *source_object, + union acpi_generic_state *state, void *context); /******************************************************************************* * @@ -91,26 +83,25 @@ acpi_ut_get_element_length ( * ******************************************************************************/ -union acpi_operand_object * -acpi_ut_create_internal_object_dbg ( - char *module_name, - u32 line_number, - u32 component_id, - acpi_object_type type) +union acpi_operand_object *acpi_ut_create_internal_object_dbg(char *module_name, + u32 line_number, + u32 component_id, + acpi_object_type + type) { - union acpi_operand_object *object; - union acpi_operand_object *second_object; - - - ACPI_FUNCTION_TRACE_STR ("ut_create_internal_object_dbg", - acpi_ut_get_type_name (type)); + union acpi_operand_object *object; + union acpi_operand_object *second_object; + ACPI_FUNCTION_TRACE_STR("ut_create_internal_object_dbg", + acpi_ut_get_type_name(type)); /* Allocate the raw object descriptor */ - object = acpi_ut_allocate_object_desc_dbg (module_name, line_number, component_id); + object = + acpi_ut_allocate_object_desc_dbg(module_name, line_number, + component_id); if (!object) { - return_PTR (NULL); + return_PTR(NULL); } switch (type) { @@ -119,11 +110,12 @@ acpi_ut_create_internal_object_dbg ( /* These types require a secondary object */ - second_object = acpi_ut_allocate_object_desc_dbg (module_name, - line_number, component_id); + second_object = acpi_ut_allocate_object_desc_dbg(module_name, + line_number, + component_id); if (!second_object) { - acpi_ut_delete_object_desc (object); - return_PTR (NULL); + acpi_ut_delete_object_desc(object); + return_PTR(NULL); } second_object->common.type = ACPI_TYPE_LOCAL_EXTRA; @@ -149,10 +141,9 @@ acpi_ut_create_internal_object_dbg ( /* Any per-type initialization should go here */ - return_PTR (object); + return_PTR(object); } - /******************************************************************************* * * FUNCTION: acpi_ut_create_buffer_object @@ -165,22 +156,18 @@ acpi_ut_create_internal_object_dbg ( * ******************************************************************************/ -union acpi_operand_object * -acpi_ut_create_buffer_object ( - acpi_size buffer_size) +union acpi_operand_object *acpi_ut_create_buffer_object(acpi_size buffer_size) { - union acpi_operand_object *buffer_desc; - u8 *buffer = NULL; - - - ACPI_FUNCTION_TRACE_U32 ("ut_create_buffer_object", buffer_size); + union acpi_operand_object *buffer_desc; + u8 *buffer = NULL; + ACPI_FUNCTION_TRACE_U32("ut_create_buffer_object", buffer_size); /* Create a new Buffer object */ - buffer_desc = acpi_ut_create_internal_object (ACPI_TYPE_BUFFER); + buffer_desc = acpi_ut_create_internal_object(ACPI_TYPE_BUFFER); if (!buffer_desc) { - return_PTR (NULL); + return_PTR(NULL); } /* Create an actual buffer only if size > 0 */ @@ -188,12 +175,11 @@ acpi_ut_create_buffer_object ( if (buffer_size > 0) { /* Allocate the actual buffer */ - buffer = ACPI_MEM_CALLOCATE (buffer_size); + buffer = ACPI_MEM_CALLOCATE(buffer_size); if (!buffer) { - ACPI_REPORT_ERROR (("create_buffer: could not allocate size %X\n", - (u32) buffer_size)); - acpi_ut_remove_reference (buffer_desc); - return_PTR (NULL); + ACPI_REPORT_ERROR(("create_buffer: could not allocate size %X\n", (u32) buffer_size)); + acpi_ut_remove_reference(buffer_desc); + return_PTR(NULL); } } @@ -205,10 +191,9 @@ acpi_ut_create_buffer_object ( /* Return the new buffer descriptor */ - return_PTR (buffer_desc); + return_PTR(buffer_desc); } - /******************************************************************************* * * FUNCTION: acpi_ut_create_string_object @@ -223,34 +208,29 @@ acpi_ut_create_buffer_object ( * ******************************************************************************/ -union acpi_operand_object * -acpi_ut_create_string_object ( - acpi_size string_size) +union acpi_operand_object *acpi_ut_create_string_object(acpi_size string_size) { - union acpi_operand_object *string_desc; - char *string; - - - ACPI_FUNCTION_TRACE_U32 ("ut_create_string_object", string_size); + union acpi_operand_object *string_desc; + char *string; + ACPI_FUNCTION_TRACE_U32("ut_create_string_object", string_size); /* Create a new String object */ - string_desc = acpi_ut_create_internal_object (ACPI_TYPE_STRING); + string_desc = acpi_ut_create_internal_object(ACPI_TYPE_STRING); if (!string_desc) { - return_PTR (NULL); + return_PTR(NULL); } /* * Allocate the actual string buffer -- (Size + 1) for NULL terminator. * NOTE: Zero-length strings are NULL terminated */ - string = ACPI_MEM_CALLOCATE (string_size + 1); + string = ACPI_MEM_CALLOCATE(string_size + 1); if (!string) { - ACPI_REPORT_ERROR (("create_string: could not allocate size %X\n", - (u32) string_size)); - acpi_ut_remove_reference (string_desc); - return_PTR (NULL); + ACPI_REPORT_ERROR(("create_string: could not allocate size %X\n", (u32) string_size)); + acpi_ut_remove_reference(string_desc); + return_PTR(NULL); } /* Complete string object initialization */ @@ -260,10 +240,9 @@ acpi_ut_create_string_object ( /* Return the new string descriptor */ - return_PTR (string_desc); + return_PTR(string_desc); } - /******************************************************************************* * * FUNCTION: acpi_ut_valid_internal_object @@ -276,24 +255,21 @@ acpi_ut_create_string_object ( * ******************************************************************************/ -u8 -acpi_ut_valid_internal_object ( - void *object) +u8 acpi_ut_valid_internal_object(void *object) { - ACPI_FUNCTION_NAME ("ut_valid_internal_object"); - + ACPI_FUNCTION_NAME("ut_valid_internal_object"); /* Check for a null pointer */ if (!object) { - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "**** Null Object Ptr\n")); + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "**** Null Object Ptr\n")); return (FALSE); } /* Check the descriptor type field */ - switch (ACPI_GET_DESCRIPTOR_TYPE (object)) { + switch (ACPI_GET_DESCRIPTOR_TYPE(object)) { case ACPI_DESC_TYPE_OPERAND: /* The object appears to be a valid union acpi_operand_object */ @@ -301,16 +277,15 @@ acpi_ut_valid_internal_object ( return (TRUE); default: - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "%p is not not an ACPI operand obj [%s]\n", - object, acpi_ut_get_descriptor_name (object))); + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "%p is not not an ACPI operand obj [%s]\n", + object, acpi_ut_get_descriptor_name(object))); break; } return (FALSE); } - /******************************************************************************* * * FUNCTION: acpi_ut_allocate_object_desc_dbg @@ -326,37 +301,31 @@ acpi_ut_valid_internal_object ( * ******************************************************************************/ -void * -acpi_ut_allocate_object_desc_dbg ( - char *module_name, - u32 line_number, - u32 component_id) +void *acpi_ut_allocate_object_desc_dbg(char *module_name, + u32 line_number, u32 component_id) { - union acpi_operand_object *object; - + union acpi_operand_object *object; - ACPI_FUNCTION_TRACE ("ut_allocate_object_desc_dbg"); + ACPI_FUNCTION_TRACE("ut_allocate_object_desc_dbg"); - - object = acpi_os_acquire_object (acpi_gbl_operand_cache); + object = acpi_os_acquire_object(acpi_gbl_operand_cache); if (!object) { - _ACPI_REPORT_ERROR (module_name, line_number, component_id, - ("Could not allocate an object descriptor\n")); + _ACPI_REPORT_ERROR(module_name, line_number, component_id, + ("Could not allocate an object descriptor\n")); - return_PTR (NULL); + return_PTR(NULL); } /* Mark the descriptor type */ memset(object, 0, sizeof(union acpi_operand_object)); - ACPI_SET_DESCRIPTOR_TYPE (object, ACPI_DESC_TYPE_OPERAND); + ACPI_SET_DESCRIPTOR_TYPE(object, ACPI_DESC_TYPE_OPERAND); - ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "%p Size %X\n", - object, (u32) sizeof (union acpi_operand_object))); + ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, "%p Size %X\n", + object, (u32) sizeof(union acpi_operand_object))); - return_PTR (object); + return_PTR(object); } - /******************************************************************************* * * FUNCTION: acpi_ut_delete_object_desc @@ -369,27 +338,23 @@ acpi_ut_allocate_object_desc_dbg ( * ******************************************************************************/ -void -acpi_ut_delete_object_desc ( - union acpi_operand_object *object) +void acpi_ut_delete_object_desc(union acpi_operand_object *object) { - ACPI_FUNCTION_TRACE_PTR ("ut_delete_object_desc", object); - + ACPI_FUNCTION_TRACE_PTR("ut_delete_object_desc", object); /* Object must be an union acpi_operand_object */ - if (ACPI_GET_DESCRIPTOR_TYPE (object) != ACPI_DESC_TYPE_OPERAND) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "%p is not an ACPI Operand object [%s]\n", object, - acpi_ut_get_descriptor_name (object))); + if (ACPI_GET_DESCRIPTOR_TYPE(object) != ACPI_DESC_TYPE_OPERAND) { + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "%p is not an ACPI Operand object [%s]\n", + object, acpi_ut_get_descriptor_name(object))); return_VOID; } - (void) acpi_os_release_object (acpi_gbl_operand_cache, object); + (void)acpi_os_release_object(acpi_gbl_operand_cache, object); return_VOID; } - /******************************************************************************* * * FUNCTION: acpi_ut_get_simple_object_size @@ -408,16 +373,13 @@ acpi_ut_delete_object_desc ( ******************************************************************************/ static acpi_status -acpi_ut_get_simple_object_size ( - union acpi_operand_object *internal_object, - acpi_size *obj_length) +acpi_ut_get_simple_object_size(union acpi_operand_object *internal_object, + acpi_size * obj_length) { - acpi_size length; - acpi_status status = AE_OK; - - - ACPI_FUNCTION_TRACE_PTR ("ut_get_simple_object_size", internal_object); + acpi_size length; + acpi_status status = AE_OK; + ACPI_FUNCTION_TRACE_PTR("ut_get_simple_object_size", internal_object); /* * Handle a null object (Could be a uninitialized package @@ -425,18 +387,18 @@ acpi_ut_get_simple_object_size ( */ if (!internal_object) { *obj_length = 0; - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } /* Start with the length of the Acpi object */ - length = sizeof (union acpi_object); + length = sizeof(union acpi_object); - if (ACPI_GET_DESCRIPTOR_TYPE (internal_object) == ACPI_DESC_TYPE_NAMED) { + if (ACPI_GET_DESCRIPTOR_TYPE(internal_object) == ACPI_DESC_TYPE_NAMED) { /* Object is a named object (reference), just return the length */ - *obj_length = ACPI_ROUND_UP_TO_NATIVE_WORD (length); - return_ACPI_STATUS (status); + *obj_length = ACPI_ROUND_UP_TO_NATIVE_WORD(length); + return_ACPI_STATUS(status); } /* @@ -445,19 +407,17 @@ acpi_ut_get_simple_object_size ( * must be accessed bytewise or there may be alignment problems on * certain processors */ - switch (ACPI_GET_OBJECT_TYPE (internal_object)) { + switch (ACPI_GET_OBJECT_TYPE(internal_object)) { case ACPI_TYPE_STRING: length += (acpi_size) internal_object->string.length + 1; break; - case ACPI_TYPE_BUFFER: length += (acpi_size) internal_object->buffer.length; break; - case ACPI_TYPE_INTEGER: case ACPI_TYPE_PROCESSOR: case ACPI_TYPE_POWER: @@ -467,7 +427,6 @@ acpi_ut_get_simple_object_size ( */ break; - case ACPI_TYPE_LOCAL_REFERENCE: switch (internal_object->reference.opcode) { @@ -477,8 +436,10 @@ acpi_ut_get_simple_object_size ( * Get the actual length of the full pathname to this object. * The reference will be converted to the pathname to the object */ - length += ACPI_ROUND_UP_TO_NATIVE_WORD ( - acpi_ns_get_pathname_length (internal_object->reference.node)); + length += + ACPI_ROUND_UP_TO_NATIVE_WORD + (acpi_ns_get_pathname_length + (internal_object->reference.node)); break; default: @@ -488,19 +449,21 @@ acpi_ut_get_simple_object_size ( * Notably, Locals and Args are not supported, but this may be * required eventually. */ - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Unsupported Reference opcode=%X in object %p\n", - internal_object->reference.opcode, internal_object)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Unsupported Reference opcode=%X in object %p\n", + internal_object->reference.opcode, + internal_object)); status = AE_TYPE; break; } break; - default: - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unsupported type=%X in object %p\n", - ACPI_GET_OBJECT_TYPE (internal_object), internal_object)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Unsupported type=%X in object %p\n", + ACPI_GET_OBJECT_TYPE(internal_object), + internal_object)); status = AE_TYPE; break; } @@ -511,11 +474,10 @@ acpi_ut_get_simple_object_size ( * on a machine word boundary. (preventing alignment faults on some * machines.) */ - *obj_length = ACPI_ROUND_UP_TO_NATIVE_WORD (length); - return_ACPI_STATUS (status); + *obj_length = ACPI_ROUND_UP_TO_NATIVE_WORD(length); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_ut_get_element_length @@ -529,16 +491,13 @@ acpi_ut_get_simple_object_size ( ******************************************************************************/ static acpi_status -acpi_ut_get_element_length ( - u8 object_type, - union acpi_operand_object *source_object, - union acpi_generic_state *state, - void *context) +acpi_ut_get_element_length(u8 object_type, + union acpi_operand_object *source_object, + union acpi_generic_state *state, void *context) { - acpi_status status = AE_OK; - struct acpi_pkg_info *info = (struct acpi_pkg_info *) context; - acpi_size object_space; - + acpi_status status = AE_OK; + struct acpi_pkg_info *info = (struct acpi_pkg_info *)context; + acpi_size object_space; switch (object_type) { case ACPI_COPY_TYPE_SIMPLE: @@ -547,15 +506,16 @@ acpi_ut_get_element_length ( * Simple object - just get the size (Null object/entry is handled * here also) and sum it into the running package length */ - status = acpi_ut_get_simple_object_size (source_object, &object_space); - if (ACPI_FAILURE (status)) { + status = + acpi_ut_get_simple_object_size(source_object, + &object_space); + if (ACPI_FAILURE(status)) { return (status); } info->length += object_space; break; - case ACPI_COPY_TYPE_PACKAGE: /* Package object - nothing much to do here, let the walk handle it */ @@ -564,7 +524,6 @@ acpi_ut_get_element_length ( state->pkg.this_target_obj = NULL; break; - default: /* No other types allowed */ @@ -575,7 +534,6 @@ acpi_ut_get_element_length ( return (status); } - /******************************************************************************* * * FUNCTION: acpi_ut_get_package_object_size @@ -594,25 +552,22 @@ acpi_ut_get_element_length ( ******************************************************************************/ static acpi_status -acpi_ut_get_package_object_size ( - union acpi_operand_object *internal_object, - acpi_size *obj_length) +acpi_ut_get_package_object_size(union acpi_operand_object *internal_object, + acpi_size * obj_length) { - acpi_status status; - struct acpi_pkg_info info; + acpi_status status; + struct acpi_pkg_info info; + ACPI_FUNCTION_TRACE_PTR("ut_get_package_object_size", internal_object); - ACPI_FUNCTION_TRACE_PTR ("ut_get_package_object_size", internal_object); - - - info.length = 0; + info.length = 0; info.object_space = 0; info.num_packages = 1; - status = acpi_ut_walk_package_tree (internal_object, NULL, - acpi_ut_get_element_length, &info); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ut_walk_package_tree(internal_object, NULL, + acpi_ut_get_element_length, &info); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* @@ -620,16 +575,15 @@ acpi_ut_get_package_object_size ( * just add the length of the package objects themselves. * Round up to the next machine word. */ - info.length += ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (union acpi_object)) * - (acpi_size) info.num_packages; + info.length += ACPI_ROUND_UP_TO_NATIVE_WORD(sizeof(union acpi_object)) * + (acpi_size) info.num_packages; /* Return the total package length */ *obj_length = info.length; - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_ut_get_object_size @@ -645,25 +599,23 @@ acpi_ut_get_package_object_size ( ******************************************************************************/ acpi_status -acpi_ut_get_object_size ( - union acpi_operand_object *internal_object, - acpi_size *obj_length) +acpi_ut_get_object_size(union acpi_operand_object *internal_object, + acpi_size * obj_length) { - acpi_status status; - - - ACPI_FUNCTION_ENTRY (); - - - if ((ACPI_GET_DESCRIPTOR_TYPE (internal_object) == ACPI_DESC_TYPE_OPERAND) && - (ACPI_GET_OBJECT_TYPE (internal_object) == ACPI_TYPE_PACKAGE)) { - status = acpi_ut_get_package_object_size (internal_object, obj_length); - } - else { - status = acpi_ut_get_simple_object_size (internal_object, obj_length); + acpi_status status; + + ACPI_FUNCTION_ENTRY(); + + if ((ACPI_GET_DESCRIPTOR_TYPE(internal_object) == + ACPI_DESC_TYPE_OPERAND) + && (ACPI_GET_OBJECT_TYPE(internal_object) == ACPI_TYPE_PACKAGE)) { + status = + acpi_ut_get_package_object_size(internal_object, + obj_length); + } else { + status = + acpi_ut_get_simple_object_size(internal_object, obj_length); } return (status); } - - diff --git a/drivers/acpi/utilities/utstate.c b/drivers/acpi/utilities/utstate.c index 192e7ac9569..c1cb27583be 100644 --- a/drivers/acpi/utilities/utstate.c +++ b/drivers/acpi/utilities/utstate.c @@ -41,12 +41,10 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include #define _COMPONENT ACPI_UTILITIES - ACPI_MODULE_NAME ("utstate") - +ACPI_MODULE_NAME("utstate") /******************************************************************************* * @@ -61,30 +59,26 @@ * DESCRIPTION: Create a new state and push it * ******************************************************************************/ - acpi_status -acpi_ut_create_pkg_state_and_push ( - void *internal_object, - void *external_object, - u16 index, - union acpi_generic_state **state_list) +acpi_ut_create_pkg_state_and_push(void *internal_object, + void *external_object, + u16 index, + union acpi_generic_state ** state_list) { - union acpi_generic_state *state; - + union acpi_generic_state *state; - ACPI_FUNCTION_ENTRY (); + ACPI_FUNCTION_ENTRY(); - - state = acpi_ut_create_pkg_state (internal_object, external_object, index); + state = + acpi_ut_create_pkg_state(internal_object, external_object, index); if (!state) { return (AE_NO_MEMORY); } - acpi_ut_push_generic_state (state_list, state); + acpi_ut_push_generic_state(state_list, state); return (AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_ut_push_generic_state @@ -99,12 +93,10 @@ acpi_ut_create_pkg_state_and_push ( ******************************************************************************/ void -acpi_ut_push_generic_state ( - union acpi_generic_state **list_head, - union acpi_generic_state *state) +acpi_ut_push_generic_state(union acpi_generic_state **list_head, + union acpi_generic_state *state) { - ACPI_FUNCTION_TRACE ("ut_push_generic_state"); - + ACPI_FUNCTION_TRACE("ut_push_generic_state"); /* Push the state object onto the front of the list (stack) */ @@ -114,7 +106,6 @@ acpi_ut_push_generic_state ( return_VOID; } - /******************************************************************************* * * FUNCTION: acpi_ut_pop_generic_state @@ -127,15 +118,12 @@ acpi_ut_push_generic_state ( * ******************************************************************************/ -union acpi_generic_state * -acpi_ut_pop_generic_state ( - union acpi_generic_state **list_head) +union acpi_generic_state *acpi_ut_pop_generic_state(union acpi_generic_state + **list_head) { - union acpi_generic_state *state; - - - ACPI_FUNCTION_TRACE ("ut_pop_generic_state"); + union acpi_generic_state *state; + ACPI_FUNCTION_TRACE("ut_pop_generic_state"); /* Remove the state object at the head of the list (stack) */ @@ -146,10 +134,9 @@ acpi_ut_pop_generic_state ( *list_head = state->common.next; } - return_PTR (state); + return_PTR(state); } - /******************************************************************************* * * FUNCTION: acpi_ut_create_generic_state @@ -163,17 +150,13 @@ acpi_ut_pop_generic_state ( * ******************************************************************************/ -union acpi_generic_state * -acpi_ut_create_generic_state ( - void) +union acpi_generic_state *acpi_ut_create_generic_state(void) { - union acpi_generic_state *state; - + union acpi_generic_state *state; - ACPI_FUNCTION_ENTRY (); + ACPI_FUNCTION_ENTRY(); - - state = acpi_os_acquire_object (acpi_gbl_state_cache); + state = acpi_os_acquire_object(acpi_gbl_state_cache); if (state) { /* Initialize */ memset(state, 0, sizeof(union acpi_generic_state)); @@ -183,7 +166,6 @@ acpi_ut_create_generic_state ( return (state); } - /******************************************************************************* * * FUNCTION: acpi_ut_create_thread_state @@ -197,32 +179,27 @@ acpi_ut_create_generic_state ( * ******************************************************************************/ -struct acpi_thread_state * -acpi_ut_create_thread_state ( - void) +struct acpi_thread_state *acpi_ut_create_thread_state(void) { - union acpi_generic_state *state; - - - ACPI_FUNCTION_TRACE ("ut_create_thread_state"); + union acpi_generic_state *state; + ACPI_FUNCTION_TRACE("ut_create_thread_state"); /* Create the generic state object */ - state = acpi_ut_create_generic_state (); + state = acpi_ut_create_generic_state(); if (!state) { - return_PTR (NULL); + return_PTR(NULL); } /* Init fields specific to the update struct */ state->common.data_type = ACPI_DESC_TYPE_STATE_THREAD; - state->thread.thread_id = acpi_os_get_thread_id (); + state->thread.thread_id = acpi_os_get_thread_id(); - return_PTR ((struct acpi_thread_state *) state); + return_PTR((struct acpi_thread_state *)state); } - /******************************************************************************* * * FUNCTION: acpi_ut_create_update_state @@ -238,34 +215,29 @@ acpi_ut_create_thread_state ( * ******************************************************************************/ -union acpi_generic_state * -acpi_ut_create_update_state ( - union acpi_operand_object *object, - u16 action) +union acpi_generic_state *acpi_ut_create_update_state(union acpi_operand_object + *object, u16 action) { - union acpi_generic_state *state; - - - ACPI_FUNCTION_TRACE_PTR ("ut_create_update_state", object); + union acpi_generic_state *state; + ACPI_FUNCTION_TRACE_PTR("ut_create_update_state", object); /* Create the generic state object */ - state = acpi_ut_create_generic_state (); + state = acpi_ut_create_generic_state(); if (!state) { - return_PTR (NULL); + return_PTR(NULL); } /* Init fields specific to the update struct */ state->common.data_type = ACPI_DESC_TYPE_STATE_UPDATE; state->update.object = object; - state->update.value = action; + state->update.value = action; - return_PTR (state); + return_PTR(state); } - /******************************************************************************* * * FUNCTION: acpi_ut_create_pkg_state @@ -279,37 +251,32 @@ acpi_ut_create_update_state ( * ******************************************************************************/ -union acpi_generic_state * -acpi_ut_create_pkg_state ( - void *internal_object, - void *external_object, - u16 index) +union acpi_generic_state *acpi_ut_create_pkg_state(void *internal_object, + void *external_object, + u16 index) { - union acpi_generic_state *state; - - - ACPI_FUNCTION_TRACE_PTR ("ut_create_pkg_state", internal_object); + union acpi_generic_state *state; + ACPI_FUNCTION_TRACE_PTR("ut_create_pkg_state", internal_object); /* Create the generic state object */ - state = acpi_ut_create_generic_state (); + state = acpi_ut_create_generic_state(); if (!state) { - return_PTR (NULL); + return_PTR(NULL); } /* Init fields specific to the update struct */ state->common.data_type = ACPI_DESC_TYPE_STATE_PACKAGE; - state->pkg.source_object = (union acpi_operand_object *) internal_object; - state->pkg.dest_object = external_object; - state->pkg.index = index; + state->pkg.source_object = (union acpi_operand_object *)internal_object; + state->pkg.dest_object = external_object; + state->pkg.index = index; state->pkg.num_packages = 1; - return_PTR (state); + return_PTR(state); } - /******************************************************************************* * * FUNCTION: acpi_ut_create_control_state @@ -323,32 +290,27 @@ acpi_ut_create_pkg_state ( * ******************************************************************************/ -union acpi_generic_state * -acpi_ut_create_control_state ( - void) +union acpi_generic_state *acpi_ut_create_control_state(void) { - union acpi_generic_state *state; - - - ACPI_FUNCTION_TRACE ("ut_create_control_state"); + union acpi_generic_state *state; + ACPI_FUNCTION_TRACE("ut_create_control_state"); /* Create the generic state object */ - state = acpi_ut_create_generic_state (); + state = acpi_ut_create_generic_state(); if (!state) { - return_PTR (NULL); + return_PTR(NULL); } /* Init fields specific to the control struct */ state->common.data_type = ACPI_DESC_TYPE_STATE_CONTROL; - state->common.state = ACPI_CONTROL_CONDITIONAL_EXECUTING; + state->common.state = ACPI_CONTROL_CONDITIONAL_EXECUTING; - return_PTR (state); + return_PTR(state); } - /******************************************************************************* * * FUNCTION: acpi_ut_delete_generic_state @@ -362,15 +324,10 @@ acpi_ut_create_control_state ( * ******************************************************************************/ -void -acpi_ut_delete_generic_state ( - union acpi_generic_state *state) +void acpi_ut_delete_generic_state(union acpi_generic_state *state) { - ACPI_FUNCTION_TRACE ("ut_delete_generic_state"); + ACPI_FUNCTION_TRACE("ut_delete_generic_state"); - - (void) acpi_os_release_object (acpi_gbl_state_cache, state); + (void)acpi_os_release_object(acpi_gbl_state_cache, state); return_VOID; } - - diff --git a/drivers/acpi/utilities/utxface.c b/drivers/acpi/utilities/utxface.c index 850da681742..f06bd5e5e9d 100644 --- a/drivers/acpi/utilities/utxface.c +++ b/drivers/acpi/utilities/utxface.c @@ -49,8 +49,7 @@ #include #define _COMPONENT ACPI_UTILITIES - ACPI_MODULE_NAME ("utxface") - +ACPI_MODULE_NAME("utxface") /******************************************************************************* * @@ -64,60 +63,54 @@ * called, so any early initialization belongs here. * ******************************************************************************/ - -acpi_status -acpi_initialize_subsystem ( - void) +acpi_status acpi_initialize_subsystem(void) { - acpi_status status; - + acpi_status status; - ACPI_FUNCTION_TRACE ("acpi_initialize_subsystem"); + ACPI_FUNCTION_TRACE("acpi_initialize_subsystem"); - - ACPI_DEBUG_EXEC (acpi_ut_init_stack_ptr_trace ()); + ACPI_DEBUG_EXEC(acpi_ut_init_stack_ptr_trace()); /* Initialize the OS-Dependent layer */ - status = acpi_os_initialize (); - if (ACPI_FAILURE (status)) { - ACPI_REPORT_ERROR (("OSD failed to initialize, %s\n", - acpi_format_exception (status))); - return_ACPI_STATUS (status); + status = acpi_os_initialize(); + if (ACPI_FAILURE(status)) { + ACPI_REPORT_ERROR(("OSD failed to initialize, %s\n", + acpi_format_exception(status))); + return_ACPI_STATUS(status); } /* Initialize all globals used by the subsystem */ - acpi_ut_init_globals (); + acpi_ut_init_globals(); /* Create the default mutex objects */ - status = acpi_ut_mutex_initialize (); - if (ACPI_FAILURE (status)) { - ACPI_REPORT_ERROR (("Global mutex creation failure, %s\n", - acpi_format_exception (status))); - return_ACPI_STATUS (status); + status = acpi_ut_mutex_initialize(); + if (ACPI_FAILURE(status)) { + ACPI_REPORT_ERROR(("Global mutex creation failure, %s\n", + acpi_format_exception(status))); + return_ACPI_STATUS(status); } /* * Initialize the namespace manager and * the root of the namespace tree */ - status = acpi_ns_root_initialize (); - if (ACPI_FAILURE (status)) { - ACPI_REPORT_ERROR (("Namespace initialization failure, %s\n", - acpi_format_exception (status))); - return_ACPI_STATUS (status); + status = acpi_ns_root_initialize(); + if (ACPI_FAILURE(status)) { + ACPI_REPORT_ERROR(("Namespace initialization failure, %s\n", + acpi_format_exception(status))); + return_ACPI_STATUS(status); } /* If configured, initialize the AML debugger */ - ACPI_DEBUGGER_EXEC (status = acpi_db_initialize ()); + ACPI_DEBUGGER_EXEC(status = acpi_db_initialize()); - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_enable_subsystem @@ -131,41 +124,39 @@ acpi_initialize_subsystem ( * ******************************************************************************/ -acpi_status -acpi_enable_subsystem ( - u32 flags) +acpi_status acpi_enable_subsystem(u32 flags) { - acpi_status status = AE_OK; - - - ACPI_FUNCTION_TRACE ("acpi_enable_subsystem"); + acpi_status status = AE_OK; + ACPI_FUNCTION_TRACE("acpi_enable_subsystem"); /* * We must initialize the hardware before we can enable ACPI. * The values from the FADT are validated here. */ if (!(flags & ACPI_NO_HARDWARE_INIT)) { - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "[Init] Initializing ACPI hardware\n")); + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, + "[Init] Initializing ACPI hardware\n")); - status = acpi_hw_initialize (); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_hw_initialize(); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } } /* Enable ACPI mode */ if (!(flags & ACPI_NO_ACPI_ENABLE)) { - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Init] Going into ACPI mode\n")); + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, + "[Init] Going into ACPI mode\n")); acpi_gbl_original_mode = acpi_hw_get_mode(); - status = acpi_enable (); - if (ACPI_FAILURE (status)) { - ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "acpi_enable failed.\n")); - return_ACPI_STATUS (status); + status = acpi_enable(); + if (ACPI_FAILURE(status)) { + ACPI_DEBUG_PRINT((ACPI_DB_WARN, + "acpi_enable failed.\n")); + return_ACPI_STATUS(status); } } @@ -175,12 +166,12 @@ acpi_enable_subsystem ( * install_address_space_handler interface. */ if (!(flags & ACPI_NO_ADDRESS_SPACE_INIT)) { - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "[Init] Installing default address space handlers\n")); + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, + "[Init] Installing default address space handlers\n")); - status = acpi_ev_install_region_handlers (); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ev_install_region_handlers(); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } } @@ -193,28 +184,28 @@ acpi_enable_subsystem ( * execution! */ if (!(flags & ACPI_NO_EVENT_INIT)) { - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "[Init] Initializing ACPI events\n")); + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, + "[Init] Initializing ACPI events\n")); - status = acpi_ev_initialize_events (); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ev_initialize_events(); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } } /* Install the SCI handler and Global Lock handler */ if (!(flags & ACPI_NO_HANDLER_INIT)) { - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "[Init] Installing SCI/GL handlers\n")); + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, + "[Init] Installing SCI/GL handlers\n")); - status = acpi_ev_install_xrupt_handlers (); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ev_install_xrupt_handlers(); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } } - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } /******************************************************************************* @@ -230,15 +221,11 @@ acpi_enable_subsystem ( * ******************************************************************************/ -acpi_status -acpi_initialize_objects ( - u32 flags) +acpi_status acpi_initialize_objects(u32 flags) { - acpi_status status = AE_OK; - - - ACPI_FUNCTION_TRACE ("acpi_initialize_objects"); + acpi_status status = AE_OK; + ACPI_FUNCTION_TRACE("acpi_initialize_objects"); /* * Run all _REG methods @@ -248,12 +235,12 @@ acpi_initialize_objects ( * contain executable AML (see call to acpi_ns_initialize_objects below). */ if (!(flags & ACPI_NO_ADDRESS_SPACE_INIT)) { - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "[Init] Executing _REG op_region methods\n")); + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, + "[Init] Executing _REG op_region methods\n")); - status = acpi_ev_initialize_op_regions (); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ev_initialize_op_regions(); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } } @@ -263,12 +250,12 @@ acpi_initialize_objects ( * objects: operation_regions, buffer_fields, Buffers, and Packages. */ if (!(flags & ACPI_NO_OBJECT_INIT)) { - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "[Init] Completing Initialization of ACPI Objects\n")); + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, + "[Init] Completing Initialization of ACPI Objects\n")); - status = acpi_ns_initialize_objects (); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ns_initialize_objects(); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } } @@ -277,12 +264,12 @@ acpi_initialize_objects ( * This runs the _STA and _INI methods. */ if (!(flags & ACPI_NO_DEVICE_INIT)) { - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "[Init] Initializing ACPI Devices\n")); + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, + "[Init] Initializing ACPI Devices\n")); - status = acpi_ns_initialize_devices (); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ns_initialize_devices(); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } } @@ -291,13 +278,12 @@ acpi_initialize_objects ( * the table load filled them up more than they will be at runtime -- * thus wasting non-paged memory. */ - status = acpi_purge_cached_objects (); + status = acpi_purge_cached_objects(); acpi_gbl_startup_flags |= ACPI_INITIALIZED_OK; - return_ACPI_STATUS (status); + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_terminate @@ -310,15 +296,11 @@ acpi_initialize_objects ( * ******************************************************************************/ -acpi_status -acpi_terminate ( - void) +acpi_status acpi_terminate(void) { - acpi_status status; - - - ACPI_FUNCTION_TRACE ("acpi_terminate"); + acpi_status status; + ACPI_FUNCTION_TRACE("acpi_terminate"); /* Terminate the AML Debugger if present */ @@ -326,28 +308,25 @@ acpi_terminate ( /* Shutdown and free all resources */ - acpi_ut_subsystem_shutdown (); - + acpi_ut_subsystem_shutdown(); /* Free the mutex objects */ - acpi_ut_mutex_terminate (); - + acpi_ut_mutex_terminate(); #ifdef ACPI_DEBUGGER /* Shut down the debugger */ - acpi_db_terminate (); + acpi_db_terminate(); #endif /* Now we can shutdown the OS-dependent layer */ - status = acpi_os_terminate (); - return_ACPI_STATUS (status); + status = acpi_os_terminate(); + return_ACPI_STATUS(status); } - #ifdef ACPI_FUTURE_USAGE /******************************************************************************* * @@ -363,20 +342,16 @@ acpi_terminate ( * ******************************************************************************/ -acpi_status -acpi_subsystem_status ( - void) +acpi_status acpi_subsystem_status(void) { if (acpi_gbl_startup_flags & ACPI_INITIALIZED_OK) { return (AE_OK); - } - else { + } else { return (AE_ERROR); } } - /******************************************************************************* * * FUNCTION: acpi_get_system_info @@ -395,64 +370,60 @@ acpi_subsystem_status ( * ******************************************************************************/ -acpi_status -acpi_get_system_info ( - struct acpi_buffer *out_buffer) +acpi_status acpi_get_system_info(struct acpi_buffer * out_buffer) { - struct acpi_system_info *info_ptr; - acpi_status status; - u32 i; - - - ACPI_FUNCTION_TRACE ("acpi_get_system_info"); + struct acpi_system_info *info_ptr; + acpi_status status; + u32 i; + ACPI_FUNCTION_TRACE("acpi_get_system_info"); /* Parameter validation */ - status = acpi_ut_validate_buffer (out_buffer); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_ut_validate_buffer(out_buffer); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* Validate/Allocate/Clear caller buffer */ - status = acpi_ut_initialize_buffer (out_buffer, sizeof (struct acpi_system_info)); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = + acpi_ut_initialize_buffer(out_buffer, + sizeof(struct acpi_system_info)); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* * Populate the return buffer */ - info_ptr = (struct acpi_system_info *) out_buffer->pointer; + info_ptr = (struct acpi_system_info *)out_buffer->pointer; - info_ptr->acpi_ca_version = ACPI_CA_VERSION; + info_ptr->acpi_ca_version = ACPI_CA_VERSION; /* System flags (ACPI capabilities) */ - info_ptr->flags = ACPI_SYS_MODE_ACPI; + info_ptr->flags = ACPI_SYS_MODE_ACPI; /* Timer resolution - 24 or 32 bits */ if (!acpi_gbl_FADT) { info_ptr->timer_resolution = 0; - } - else if (acpi_gbl_FADT->tmr_val_ext == 0) { + } else if (acpi_gbl_FADT->tmr_val_ext == 0) { info_ptr->timer_resolution = 24; - } - else { + } else { info_ptr->timer_resolution = 32; } /* Clear the reserved fields */ - info_ptr->reserved1 = 0; - info_ptr->reserved2 = 0; + info_ptr->reserved1 = 0; + info_ptr->reserved2 = 0; /* Current debug levels */ - info_ptr->debug_layer = acpi_dbg_layer; - info_ptr->debug_level = acpi_dbg_level; + info_ptr->debug_layer = acpi_dbg_layer; + info_ptr->debug_level = acpi_dbg_level; /* Current status of the ACPI tables, per table type */ @@ -461,10 +432,10 @@ acpi_get_system_info ( info_ptr->table_info[i].count = acpi_gbl_table_lists[i].count; } - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } -EXPORT_SYMBOL(acpi_get_system_info); +EXPORT_SYMBOL(acpi_get_system_info); /***************************************************************************** * @@ -482,9 +453,7 @@ EXPORT_SYMBOL(acpi_get_system_info); ****************************************************************************/ acpi_status -acpi_install_initialization_handler ( - acpi_init_handler handler, - u32 function) +acpi_install_initialization_handler(acpi_init_handler handler, u32 function) { if (!handler) { @@ -499,7 +468,7 @@ acpi_install_initialization_handler ( return AE_OK; } -#endif /* ACPI_FUTURE_USAGE */ +#endif /* ACPI_FUTURE_USAGE */ /***************************************************************************** * @@ -513,15 +482,13 @@ acpi_install_initialization_handler ( * ****************************************************************************/ -acpi_status -acpi_purge_cached_objects ( - void) +acpi_status acpi_purge_cached_objects(void) { - ACPI_FUNCTION_TRACE ("acpi_purge_cached_objects"); + ACPI_FUNCTION_TRACE("acpi_purge_cached_objects"); - (void) acpi_os_purge_cache (acpi_gbl_state_cache); - (void) acpi_os_purge_cache (acpi_gbl_operand_cache); - (void) acpi_os_purge_cache (acpi_gbl_ps_node_cache); - (void) acpi_os_purge_cache (acpi_gbl_ps_node_ext_cache); - return_ACPI_STATUS (AE_OK); + (void)acpi_os_purge_cache(acpi_gbl_state_cache); + (void)acpi_os_purge_cache(acpi_gbl_operand_cache); + (void)acpi_os_purge_cache(acpi_gbl_ps_node_cache); + (void)acpi_os_purge_cache(acpi_gbl_ps_node_ext_cache); + return_ACPI_STATUS(AE_OK); } diff --git a/drivers/acpi/utils.c b/drivers/acpi/utils.c index 1ce2047c380..6458c47f7ac 100644 --- a/drivers/acpi/utils.c +++ b/drivers/acpi/utils.c @@ -30,15 +30,12 @@ #include #include - #define _COMPONENT ACPI_BUS_COMPONENT -ACPI_MODULE_NAME ("acpi_utils") - +ACPI_MODULE_NAME("acpi_utils") /* -------------------------------------------------------------------------- Object Evaluation Helpers -------------------------------------------------------------------------- */ - #ifdef ACPI_DEBUG_OUTPUT #define acpi_util_eval_error(h,p,s) {\ char prefix[80] = {'\0'};\ @@ -49,26 +46,24 @@ ACPI_MODULE_NAME ("acpi_utils") #else #define acpi_util_eval_error(h,p,s) #endif - - acpi_status -acpi_extract_package ( - union acpi_object *package, - struct acpi_buffer *format, - struct acpi_buffer *buffer) +acpi_extract_package(union acpi_object *package, + struct acpi_buffer *format, struct acpi_buffer *buffer) { - u32 size_required = 0; - u32 tail_offset = 0; - char *format_string = NULL; - u32 format_count = 0; - u32 i = 0; - u8 *head = NULL; - u8 *tail = NULL; + u32 size_required = 0; + u32 tail_offset = 0; + char *format_string = NULL; + u32 format_count = 0; + u32 i = 0; + u8 *head = NULL; + u8 *tail = NULL; ACPI_FUNCTION_TRACE("acpi_extract_package"); - if (!package || (package->type != ACPI_TYPE_PACKAGE) || (package->package.count < 1)) { - ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Invalid 'package' argument\n")); + if (!package || (package->type != ACPI_TYPE_PACKAGE) + || (package->package.count < 1)) { + ACPI_DEBUG_PRINT((ACPI_DB_WARN, + "Invalid 'package' argument\n")); return_ACPI_STATUS(AE_BAD_PARAMETER); } @@ -82,18 +77,20 @@ acpi_extract_package ( return_ACPI_STATUS(AE_BAD_PARAMETER); } - format_count = (format->length/sizeof(char)) - 1; + format_count = (format->length / sizeof(char)) - 1; if (format_count > package->package.count) { - ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Format specifies more objects [%d] than exist in package [%d].", format_count, package->package.count)); + ACPI_DEBUG_PRINT((ACPI_DB_WARN, + "Format specifies more objects [%d] than exist in package [%d].", + format_count, package->package.count)); return_ACPI_STATUS(AE_BAD_DATA); } - format_string = (char*)format->pointer; + format_string = (char *)format->pointer; /* * Calculate size_required. */ - for (i=0; ipackage.elements[i]); @@ -110,11 +107,15 @@ acpi_extract_package ( tail_offset += sizeof(acpi_integer); break; case 'S': - size_required += sizeof(char*) + sizeof(acpi_integer) + sizeof(char); - tail_offset += sizeof(char*); + size_required += + sizeof(char *) + sizeof(acpi_integer) + + sizeof(char); + tail_offset += sizeof(char *); break; default: - ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Invalid package element [%d]: got number, expecing [%c].\n", i, format_string[i])); + ACPI_DEBUG_PRINT((ACPI_DB_WARN, + "Invalid package element [%d]: got number, expecing [%c].\n", + i, format_string[i])); return_ACPI_STATUS(AE_BAD_DATA); break; } @@ -124,15 +125,22 @@ acpi_extract_package ( case ACPI_TYPE_BUFFER: switch (format_string[i]) { case 'S': - size_required += sizeof(char*) + (element->string.length * sizeof(char)) + sizeof(char); - tail_offset += sizeof(char*); + size_required += + sizeof(char *) + + (element->string.length * sizeof(char)) + + sizeof(char); + tail_offset += sizeof(char *); break; case 'B': - size_required += sizeof(u8*) + (element->buffer.length * sizeof(u8)); - tail_offset += sizeof(u8*); + size_required += + sizeof(u8 *) + + (element->buffer.length * sizeof(u8)); + tail_offset += sizeof(u8 *); break; default: - ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Invalid package element [%d] got string/buffer, expecing [%c].\n", i, format_string[i])); + ACPI_DEBUG_PRINT((ACPI_DB_WARN, + "Invalid package element [%d] got string/buffer, expecing [%c].\n", + i, format_string[i])); return_ACPI_STATUS(AE_BAD_DATA); break; } @@ -140,7 +148,9 @@ acpi_extract_package ( case ACPI_TYPE_PACKAGE: default: - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found unsupported element at index=%d\n", i)); + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "Found unsupported element at index=%d\n", + i)); /* TBD: handle nested packages... */ return_ACPI_STATUS(AE_SUPPORT); break; @@ -153,8 +163,7 @@ acpi_extract_package ( if (buffer->length < size_required) { buffer->length = size_required; return_ACPI_STATUS(AE_BUFFER_OVERFLOW); - } - else if (buffer->length != size_required || !buffer->pointer) { + } else if (buffer->length != size_required || !buffer->pointer) { return_ACPI_STATUS(AE_BAD_PARAMETER); } @@ -164,7 +173,7 @@ acpi_extract_package ( /* * Extract package data. */ - for (i=0; ipackage.elements[i]); @@ -178,14 +187,16 @@ acpi_extract_package ( case ACPI_TYPE_INTEGER: switch (format_string[i]) { case 'N': - *((acpi_integer*)head) = element->integer.value; + *((acpi_integer *) head) = + element->integer.value; head += sizeof(acpi_integer); break; case 'S': - pointer = (u8**)head; + pointer = (u8 **) head; *pointer = tail; - *((acpi_integer*)tail) = element->integer.value; - head += sizeof(acpi_integer*); + *((acpi_integer *) tail) = + element->integer.value; + head += sizeof(acpi_integer *); tail += sizeof(acpi_integer); /* NULL terminate string */ *tail = (char)0; @@ -201,20 +212,22 @@ acpi_extract_package ( case ACPI_TYPE_BUFFER: switch (format_string[i]) { case 'S': - pointer = (u8**)head; + pointer = (u8 **) head; *pointer = tail; - memcpy(tail, element->string.pointer, element->string.length); - head += sizeof(char*); + memcpy(tail, element->string.pointer, + element->string.length); + head += sizeof(char *); tail += element->string.length * sizeof(char); /* NULL terminate string */ *tail = (char)0; tail += sizeof(char); break; case 'B': - pointer = (u8**)head; + pointer = (u8 **) head; *pointer = tail; - memcpy(tail, element->buffer.pointer, element->buffer.length); - head += sizeof(u8*); + memcpy(tail, element->buffer.pointer, + element->buffer.length); + head += sizeof(u8 *); tail += element->buffer.length * sizeof(u8); break; default: @@ -233,19 +246,17 @@ acpi_extract_package ( return_ACPI_STATUS(AE_OK); } -EXPORT_SYMBOL(acpi_extract_package); +EXPORT_SYMBOL(acpi_extract_package); acpi_status -acpi_evaluate_integer ( - acpi_handle handle, - acpi_string pathname, - struct acpi_object_list *arguments, - unsigned long *data) +acpi_evaluate_integer(acpi_handle handle, + acpi_string pathname, + struct acpi_object_list *arguments, unsigned long *data) { - acpi_status status = AE_OK; - union acpi_object *element; - struct acpi_buffer buffer = {0,NULL}; + acpi_status status = AE_OK; + union acpi_object *element; + struct acpi_buffer buffer = { 0, NULL }; ACPI_FUNCTION_TRACE("acpi_evaluate_integer"); @@ -253,7 +264,7 @@ acpi_evaluate_integer ( return_ACPI_STATUS(AE_BAD_PARAMETER); element = kmalloc(sizeof(union acpi_object), GFP_KERNEL); - if(!element) + if (!element) return_ACPI_STATUS(AE_NO_MEMORY); memset(element, 0, sizeof(union acpi_object)); @@ -277,20 +288,18 @@ acpi_evaluate_integer ( return_ACPI_STATUS(AE_OK); } -EXPORT_SYMBOL(acpi_evaluate_integer); +EXPORT_SYMBOL(acpi_evaluate_integer); #if 0 acpi_status -acpi_evaluate_string ( - acpi_handle handle, - acpi_string pathname, - acpi_object_list *arguments, - acpi_string *data) +acpi_evaluate_string(acpi_handle handle, + acpi_string pathname, + acpi_object_list * arguments, acpi_string * data) { - acpi_status status = AE_OK; - acpi_object *element = NULL; - acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL}; + acpi_status status = AE_OK; + acpi_object *element = NULL; + acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; ACPI_FUNCTION_TRACE("acpi_evaluate_string"); @@ -305,9 +314,9 @@ acpi_evaluate_string ( element = (acpi_object *) buffer.pointer; - if ((element->type != ACPI_TYPE_STRING) - || (element->type != ACPI_TYPE_BUFFER) - || !element->string.length) { + if ((element->type != ACPI_TYPE_STRING) + || (element->type != ACPI_TYPE_BUFFER) + || !element->string.length) { acpi_util_eval_error(handle, pathname, AE_BAD_DATA); return_ACPI_STATUS(AE_BAD_DATA); } @@ -329,19 +338,17 @@ acpi_evaluate_string ( } #endif - acpi_status -acpi_evaluate_reference ( - acpi_handle handle, - acpi_string pathname, - struct acpi_object_list *arguments, - struct acpi_handle_list *list) +acpi_evaluate_reference(acpi_handle handle, + acpi_string pathname, + struct acpi_object_list *arguments, + struct acpi_handle_list *list) { - acpi_status status = AE_OK; - union acpi_object *package = NULL; - union acpi_object *element = NULL; - struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL}; - u32 i = 0; + acpi_status status = AE_OK; + union acpi_object *package = NULL; + union acpi_object *element = NULL; + struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; + u32 i = 0; ACPI_FUNCTION_TRACE("acpi_evaluate_reference"); @@ -355,28 +362,28 @@ acpi_evaluate_reference ( if (ACPI_FAILURE(status)) goto end; - package = (union acpi_object *) buffer.pointer; + package = (union acpi_object *)buffer.pointer; if ((buffer.length == 0) || !package) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "No return object (len %X ptr %p)\n", - (unsigned)buffer.length, package)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "No return object (len %X ptr %p)\n", + (unsigned)buffer.length, package)); status = AE_BAD_DATA; acpi_util_eval_error(handle, pathname, status); goto end; } if (package->type != ACPI_TYPE_PACKAGE) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Expecting a [Package], found type %X\n", - package->type)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Expecting a [Package], found type %X\n", + package->type)); status = AE_BAD_DATA; acpi_util_eval_error(handle, pathname, status); goto end; } if (!package->package.count) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "[Package] has zero elements (%p)\n", - package)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "[Package] has zero elements (%p)\n", + package)); status = AE_BAD_DATA; acpi_util_eval_error(handle, pathname, status); goto end; @@ -395,9 +402,9 @@ acpi_evaluate_reference ( if (element->type != ACPI_TYPE_ANY) { status = AE_BAD_DATA; - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Expecting a [Reference] package element, found type %X\n", - element->type)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Expecting a [Reference] package element, found type %X\n", + element->type)); acpi_util_eval_error(handle, pathname, status); break; } @@ -406,10 +413,10 @@ acpi_evaluate_reference ( list->handles[i] = element->reference.handle; ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found reference [%p]\n", - list->handles[i])); + list->handles[i])); } -end: + end: if (ACPI_FAILURE(status)) { list->count = 0; //kfree(list->handles); @@ -419,5 +426,5 @@ end: return_ACPI_STATUS(status); } -EXPORT_SYMBOL(acpi_evaluate_reference); +EXPORT_SYMBOL(acpi_evaluate_reference); diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index 7b10a7b070c..b9132b5ac0f 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c @@ -53,21 +53,20 @@ #define ACPI_VIDEO_NOTIFY_ZERO_BRIGHTNESS 0x85 #define ACPI_VIDEO_NOTIFY_DISPLAY_OFF 0x86 - #define ACPI_VIDEO_HEAD_INVALID (~0u - 1) #define ACPI_VIDEO_HEAD_END (~0u) - #define _COMPONENT ACPI_VIDEO_COMPONENT -ACPI_MODULE_NAME ("acpi_video") +ACPI_MODULE_NAME("acpi_video") -MODULE_AUTHOR("Bruno Ducrot"); + MODULE_AUTHOR("Bruno Ducrot"); MODULE_DESCRIPTION(ACPI_VIDEO_DRIVER_NAME); MODULE_LICENSE("GPL"); -static int acpi_video_bus_add (struct acpi_device *device); -static int acpi_video_bus_remove (struct acpi_device *device, int type); -static int acpi_video_bus_match (struct acpi_device *device, struct acpi_driver *driver); +static int acpi_video_bus_add(struct acpi_device *device); +static int acpi_video_bus_remove(struct acpi_device *device, int type); +static int acpi_video_bus_match(struct acpi_device *device, + struct acpi_driver *driver); static struct acpi_driver acpi_video_bus = { .name = ACPI_VIDEO_DRIVER_NAME, @@ -76,187 +75,192 @@ static struct acpi_driver acpi_video_bus = { .add = acpi_video_bus_add, .remove = acpi_video_bus_remove, .match = acpi_video_bus_match, - }, + }, }; struct acpi_video_bus_flags { - u8 multihead:1; /* can switch video heads */ - u8 rom:1; /* can retrieve a video rom */ - u8 post:1; /* can configure the head to */ - u8 reserved:5; + u8 multihead:1; /* can switch video heads */ + u8 rom:1; /* can retrieve a video rom */ + u8 post:1; /* can configure the head to */ + u8 reserved:5; }; struct acpi_video_bus_cap { - u8 _DOS:1; /*Enable/Disable output switching*/ - u8 _DOD:1; /*Enumerate all devices attached to display adapter*/ - u8 _ROM:1; /*Get ROM Data*/ - u8 _GPD:1; /*Get POST Device*/ - u8 _SPD:1; /*Set POST Device*/ - u8 _VPO:1; /*Video POST Options*/ - u8 reserved:2; + u8 _DOS:1; /*Enable/Disable output switching */ + u8 _DOD:1; /*Enumerate all devices attached to display adapter */ + u8 _ROM:1; /*Get ROM Data */ + u8 _GPD:1; /*Get POST Device */ + u8 _SPD:1; /*Set POST Device */ + u8 _VPO:1; /*Video POST Options */ + u8 reserved:2; }; -struct acpi_video_device_attrib{ - u32 display_index:4; /* A zero-based instance of the Display*/ - u32 display_port_attachment:4; /*This field differenates displays type*/ - u32 display_type:4; /*Describe the specific type in use*/ - u32 vendor_specific:4; /*Chipset Vendor Specifi*/ - u32 bios_can_detect:1; /*BIOS can detect the device*/ - u32 depend_on_vga:1; /*Non-VGA output device whose power is related to - the VGA device.*/ - u32 pipe_id:3; /*For VGA multiple-head devices.*/ - u32 reserved:10; /*Must be 0*/ - u32 device_id_scheme:1; /*Device ID Scheme*/ +struct acpi_video_device_attrib { + u32 display_index:4; /* A zero-based instance of the Display */ + u32 display_port_attachment:4; /*This field differenates displays type */ + u32 display_type:4; /*Describe the specific type in use */ + u32 vendor_specific:4; /*Chipset Vendor Specifi */ + u32 bios_can_detect:1; /*BIOS can detect the device */ + u32 depend_on_vga:1; /*Non-VGA output device whose power is related to + the VGA device. */ + u32 pipe_id:3; /*For VGA multiple-head devices. */ + u32 reserved:10; /*Must be 0 */ + u32 device_id_scheme:1; /*Device ID Scheme */ }; struct acpi_video_enumerated_device { union { u32 int_val; - struct acpi_video_device_attrib attrib; + struct acpi_video_device_attrib attrib; } value; struct acpi_video_device *bind_info; }; struct acpi_video_bus { - acpi_handle handle; - u8 dos_setting; + acpi_handle handle; + u8 dos_setting; struct acpi_video_enumerated_device *attached_array; - u8 attached_count; - struct acpi_video_bus_cap cap; + u8 attached_count; + struct acpi_video_bus_cap cap; struct acpi_video_bus_flags flags; - struct semaphore sem; - struct list_head video_device_list; - struct proc_dir_entry *dir; + struct semaphore sem; + struct list_head video_device_list; + struct proc_dir_entry *dir; }; struct acpi_video_device_flags { - u8 crt:1; - u8 lcd:1; - u8 tvout:1; - u8 bios:1; - u8 unknown:1; - u8 reserved:3; + u8 crt:1; + u8 lcd:1; + u8 tvout:1; + u8 bios:1; + u8 unknown:1; + u8 reserved:3; }; struct acpi_video_device_cap { - u8 _ADR:1; /*Return the unique ID */ - u8 _BCL:1; /*Query list of brightness control levels supported*/ - u8 _BCM:1; /*Set the brightness level*/ - u8 _DDC:1; /*Return the EDID for this device*/ - u8 _DCS:1; /*Return status of output device*/ - u8 _DGS:1; /*Query graphics state*/ - u8 _DSS:1; /*Device state set*/ - u8 _reserved:1; + u8 _ADR:1; /*Return the unique ID */ + u8 _BCL:1; /*Query list of brightness control levels supported */ + u8 _BCM:1; /*Set the brightness level */ + u8 _DDC:1; /*Return the EDID for this device */ + u8 _DCS:1; /*Return status of output device */ + u8 _DGS:1; /*Query graphics state */ + u8 _DSS:1; /*Device state set */ + u8 _reserved:1; }; struct acpi_video_device_brightness { - int curr; - int count; - int *levels; + int curr; + int count; + int *levels; }; struct acpi_video_device { - acpi_handle handle; - unsigned long device_id; - struct acpi_video_device_flags flags; - struct acpi_video_device_cap cap; - struct list_head entry; - struct acpi_video_bus *video; - struct acpi_device *dev; + acpi_handle handle; + unsigned long device_id; + struct acpi_video_device_flags flags; + struct acpi_video_device_cap cap; + struct list_head entry; + struct acpi_video_bus *video; + struct acpi_device *dev; struct acpi_video_device_brightness *brightness; }; - /* bus */ static int acpi_video_bus_info_open_fs(struct inode *inode, struct file *file); static struct file_operations acpi_video_bus_info_fops = { - .open = acpi_video_bus_info_open_fs, - .read = seq_read, - .llseek = seq_lseek, - .release = single_release, + .open = acpi_video_bus_info_open_fs, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, }; static int acpi_video_bus_ROM_open_fs(struct inode *inode, struct file *file); static struct file_operations acpi_video_bus_ROM_fops = { - .open = acpi_video_bus_ROM_open_fs, - .read = seq_read, - .llseek = seq_lseek, - .release = single_release, + .open = acpi_video_bus_ROM_open_fs, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, }; -static int acpi_video_bus_POST_info_open_fs(struct inode *inode, struct file *file); +static int acpi_video_bus_POST_info_open_fs(struct inode *inode, + struct file *file); static struct file_operations acpi_video_bus_POST_info_fops = { - .open = acpi_video_bus_POST_info_open_fs, - .read = seq_read, - .llseek = seq_lseek, - .release = single_release, + .open = acpi_video_bus_POST_info_open_fs, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, }; static int acpi_video_bus_POST_open_fs(struct inode *inode, struct file *file); static struct file_operations acpi_video_bus_POST_fops = { - .open = acpi_video_bus_POST_open_fs, - .read = seq_read, - .llseek = seq_lseek, - .release = single_release, + .open = acpi_video_bus_POST_open_fs, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, }; - static int acpi_video_bus_DOS_open_fs(struct inode *inode, struct file *file); static struct file_operations acpi_video_bus_DOS_fops = { - .open = acpi_video_bus_DOS_open_fs, - .read = seq_read, - .llseek = seq_lseek, - .release = single_release, + .open = acpi_video_bus_DOS_open_fs, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, }; /* device */ -static int acpi_video_device_info_open_fs(struct inode *inode, struct file *file); +static int acpi_video_device_info_open_fs(struct inode *inode, + struct file *file); static struct file_operations acpi_video_device_info_fops = { - .open = acpi_video_device_info_open_fs, - .read = seq_read, - .llseek = seq_lseek, - .release = single_release, + .open = acpi_video_device_info_open_fs, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, }; -static int acpi_video_device_state_open_fs(struct inode *inode, struct file *file); +static int acpi_video_device_state_open_fs(struct inode *inode, + struct file *file); static struct file_operations acpi_video_device_state_fops = { - .open = acpi_video_device_state_open_fs, - .read = seq_read, - .llseek = seq_lseek, - .release = single_release, + .open = acpi_video_device_state_open_fs, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, }; -static int acpi_video_device_brightness_open_fs(struct inode *inode, struct file *file); +static int acpi_video_device_brightness_open_fs(struct inode *inode, + struct file *file); static struct file_operations acpi_video_device_brightness_fops = { - .open = acpi_video_device_brightness_open_fs, - .read = seq_read, - .llseek = seq_lseek, - .release = single_release, + .open = acpi_video_device_brightness_open_fs, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, }; -static int acpi_video_device_EDID_open_fs(struct inode *inode, struct file *file); +static int acpi_video_device_EDID_open_fs(struct inode *inode, + struct file *file); static struct file_operations acpi_video_device_EDID_fops = { - .open = acpi_video_device_EDID_open_fs, - .read = seq_read, - .llseek = seq_lseek, - .release = single_release, + .open = acpi_video_device_EDID_open_fs, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, }; -static char device_decode[][30] = { +static char device_decode[][30] = { "motherboard VGA device", "PCI VGA device", "AGP VGA device", "UNKNOWN", }; -static void acpi_video_device_notify ( acpi_handle handle, u32 event, void *data); -static void acpi_video_device_rebind( struct acpi_video_bus *video); -static void acpi_video_device_bind( struct acpi_video_bus *video, struct acpi_video_device *device); +static void acpi_video_device_notify(acpi_handle handle, u32 event, void *data); +static void acpi_video_device_rebind(struct acpi_video_bus *video); +static void acpi_video_device_bind(struct acpi_video_bus *video, + struct acpi_video_device *device); static int acpi_video_device_enumerate(struct acpi_video_bus *video); -static int acpi_video_switch_output( struct acpi_video_bus *video, int event); -static int acpi_video_get_next_level( struct acpi_video_device *device, u32 level_current,u32 event); -static void acpi_video_switch_brightness ( struct acpi_video_device *device, int event); - +static int acpi_video_switch_output(struct acpi_video_bus *video, int event); +static int acpi_video_get_next_level(struct acpi_video_device *device, + u32 level_current, u32 event); +static void acpi_video_switch_brightness(struct acpi_video_device *device, + int event); /* -------------------------------------------------------------------------- Video Management @@ -265,11 +269,9 @@ static void acpi_video_switch_brightness ( struct acpi_video_device *device, int /* device */ static int -acpi_video_device_query ( - struct acpi_video_device *device, - unsigned long *state) +acpi_video_device_query(struct acpi_video_device *device, unsigned long *state) { - int status; + int status; ACPI_FUNCTION_TRACE("acpi_video_device_query"); status = acpi_evaluate_integer(device->handle, "_DGS", NULL, state); @@ -277,11 +279,10 @@ acpi_video_device_query ( } static int -acpi_video_device_get_state ( - struct acpi_video_device *device, - unsigned long *state) +acpi_video_device_get_state(struct acpi_video_device *device, + unsigned long *state) { - int status; + int status; ACPI_FUNCTION_TRACE("acpi_video_device_get_state"); @@ -291,13 +292,11 @@ acpi_video_device_get_state ( } static int -acpi_video_device_set_state ( - struct acpi_video_device *device, - int state) +acpi_video_device_set_state(struct acpi_video_device *device, int state) { - int status; - union acpi_object arg0 = {ACPI_TYPE_INTEGER}; - struct acpi_object_list args = {1, &arg0}; + int status; + union acpi_object arg0 = { ACPI_TYPE_INTEGER }; + struct acpi_object_list args = { 1, &arg0 }; ACPI_FUNCTION_TRACE("acpi_video_device_set_state"); @@ -308,14 +307,12 @@ acpi_video_device_set_state ( } static int -acpi_video_device_lcd_query_levels ( - struct acpi_video_device *device, - union acpi_object **levels) +acpi_video_device_lcd_query_levels(struct acpi_video_device *device, + union acpi_object **levels) { - int status; - struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL}; - union acpi_object *obj; - + int status; + struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; + union acpi_object *obj; ACPI_FUNCTION_TRACE("acpi_video_device_lcd_query_levels"); @@ -324,7 +321,7 @@ acpi_video_device_lcd_query_levels ( status = acpi_evaluate_object(device->handle, "_BCL", NULL, &buffer); if (!ACPI_SUCCESS(status)) return_VALUE(status); - obj = (union acpi_object *) buffer.pointer; + obj = (union acpi_object *)buffer.pointer; if (!obj && (obj->type != ACPI_TYPE_PACKAGE)) { ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid _BCL data\n")); status = -EFAULT; @@ -335,7 +332,7 @@ acpi_video_device_lcd_query_levels ( return_VALUE(0); -err: + err: if (buffer.pointer) kfree(buffer.pointer); @@ -343,13 +340,11 @@ err: } static int -acpi_video_device_lcd_set_level ( - struct acpi_video_device *device, - int level) +acpi_video_device_lcd_set_level(struct acpi_video_device *device, int level) { - int status; - union acpi_object arg0 = {ACPI_TYPE_INTEGER}; - struct acpi_object_list args = {1, &arg0}; + int status; + union acpi_object arg0 = { ACPI_TYPE_INTEGER }; + struct acpi_object_list args = { 1, &arg0 }; ACPI_FUNCTION_TRACE("acpi_video_device_lcd_set_level"); @@ -361,11 +356,10 @@ acpi_video_device_lcd_set_level ( } static int -acpi_video_device_lcd_get_level_current ( - struct acpi_video_device *device, - unsigned long *level) +acpi_video_device_lcd_get_level_current(struct acpi_video_device *device, + unsigned long *level) { - int status; + int status; ACPI_FUNCTION_TRACE("acpi_video_device_lcd_get_level_current"); status = acpi_evaluate_integer(device->handle, "_BQC", NULL, level); @@ -374,16 +368,14 @@ acpi_video_device_lcd_get_level_current ( } static int -acpi_video_device_EDID ( - struct acpi_video_device *device, - union acpi_object **edid, - ssize_t length) +acpi_video_device_EDID(struct acpi_video_device *device, + union acpi_object **edid, ssize_t length) { - int status; - struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL}; - union acpi_object *obj; - union acpi_object arg0 = {ACPI_TYPE_INTEGER}; - struct acpi_object_list args = {1, &arg0}; + int status; + struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; + union acpi_object *obj; + union acpi_object arg0 = { ACPI_TYPE_INTEGER }; + struct acpi_object_list args = { 1, &arg0 }; ACPI_FUNCTION_TRACE("acpi_video_device_get_EDID"); @@ -402,7 +394,7 @@ acpi_video_device_EDID ( if (ACPI_FAILURE(status)) return_VALUE(-ENODEV); - obj = (union acpi_object *) buffer.pointer; + obj = (union acpi_object *)buffer.pointer; if (obj && obj->type == ACPI_TYPE_BUFFER) *edid = obj; @@ -415,18 +407,15 @@ acpi_video_device_EDID ( return_VALUE(status); } - /* bus */ static int -acpi_video_bus_set_POST ( - struct acpi_video_bus *video, - unsigned long option) +acpi_video_bus_set_POST(struct acpi_video_bus *video, unsigned long option) { - int status; - unsigned long tmp; - union acpi_object arg0 = {ACPI_TYPE_INTEGER}; - struct acpi_object_list args = {1, &arg0}; + int status; + unsigned long tmp; + union acpi_object arg0 = { ACPI_TYPE_INTEGER }; + struct acpi_object_list args = { 1, &arg0 }; ACPI_FUNCTION_TRACE("acpi_video_bus_set_POST"); @@ -434,15 +423,13 @@ acpi_video_bus_set_POST ( status = acpi_evaluate_integer(video->handle, "_SPD", &args, &tmp); if (ACPI_SUCCESS(status)) - status = tmp ? (-EINVAL):(AE_OK); + status = tmp ? (-EINVAL) : (AE_OK); return_VALUE(status); } static int -acpi_video_bus_get_POST ( - struct acpi_video_bus *video, - unsigned long *id) +acpi_video_bus_get_POST(struct acpi_video_bus *video, unsigned long *id) { int status; @@ -454,11 +441,10 @@ acpi_video_bus_get_POST ( } static int -acpi_video_bus_POST_options ( - struct acpi_video_bus *video, - unsigned long *options) +acpi_video_bus_POST_options(struct acpi_video_bus *video, + unsigned long *options) { - int status; + int status; ACPI_FUNCTION_TRACE("acpi_video_bus_POST_options"); status = acpi_evaluate_integer(video->handle, "_VPO", NULL, options); @@ -489,18 +475,15 @@ acpi_video_bus_POST_options ( */ static int -acpi_video_bus_DOS( - struct acpi_video_bus *video, - int bios_flag, - int lcd_flag) +acpi_video_bus_DOS(struct acpi_video_bus *video, int bios_flag, int lcd_flag) { - acpi_integer status = 0; - union acpi_object arg0 = {ACPI_TYPE_INTEGER}; - struct acpi_object_list args = {1, &arg0}; + acpi_integer status = 0; + union acpi_object arg0 = { ACPI_TYPE_INTEGER }; + struct acpi_object_list args = { 1, &arg0 }; ACPI_FUNCTION_TRACE("acpi_video_bus_DOS"); - if (bios_flag < 0 || bios_flag >3 || lcd_flag < 0 || lcd_flag > 1){ + if (bios_flag < 0 || bios_flag > 3 || lcd_flag < 0 || lcd_flag > 1) { status = -1; goto Failed; } @@ -508,7 +491,7 @@ acpi_video_bus_DOS( video->dos_setting = arg0.integer.value; acpi_evaluate_object(video->handle, "_DOS", &args, NULL); -Failed: + Failed: return_VALUE(status); } @@ -523,10 +506,9 @@ Failed: * device. */ -static void -acpi_video_device_find_cap (struct acpi_video_device *device) +static void acpi_video_device_find_cap(struct acpi_video_device *device) { - acpi_integer status; + acpi_integer status; acpi_handle h_dummy1; int i; union acpi_object *obj = NULL; @@ -534,27 +516,27 @@ acpi_video_device_find_cap (struct acpi_video_device *device) ACPI_FUNCTION_TRACE("acpi_video_device_find_cap"); - memset( &device->cap, 0, 4); + memset(&device->cap, 0, 4); - if( ACPI_SUCCESS(acpi_get_handle(device->handle, "_ADR", &h_dummy1))) { + if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_ADR", &h_dummy1))) { device->cap._ADR = 1; } - if( ACPI_SUCCESS(acpi_get_handle(device->handle, "_BCL", &h_dummy1))) { - device->cap._BCL= 1; + if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_BCL", &h_dummy1))) { + device->cap._BCL = 1; } - if( ACPI_SUCCESS(acpi_get_handle(device->handle, "_BCM", &h_dummy1))) { - device->cap._BCM= 1; + if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_BCM", &h_dummy1))) { + device->cap._BCM = 1; } - if( ACPI_SUCCESS(acpi_get_handle(device->handle, "_DDC", &h_dummy1))) { - device->cap._DDC= 1; + if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_DDC", &h_dummy1))) { + device->cap._DDC = 1; } - if( ACPI_SUCCESS(acpi_get_handle(device->handle, "_DCS", &h_dummy1))) { + if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_DCS", &h_dummy1))) { device->cap._DCS = 1; } - if( ACPI_SUCCESS(acpi_get_handle(device->handle, "_DGS", &h_dummy1))) { + if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_DGS", &h_dummy1))) { device->cap._DGS = 1; } - if( ACPI_SUCCESS(acpi_get_handle(device->handle, "_DSS", &h_dummy1))) { + if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_DSS", &h_dummy1))) { device->cap._DSS = 1; } @@ -563,34 +545,38 @@ acpi_video_device_find_cap (struct acpi_video_device *device) if (obj && obj->type == ACPI_TYPE_PACKAGE && obj->package.count >= 2) { int count = 0; union acpi_object *o; - + br = kmalloc(sizeof(*br), GFP_KERNEL); if (!br) { printk(KERN_ERR "can't allocate memory\n"); } else { memset(br, 0, sizeof(*br)); br->levels = kmalloc(obj->package.count * - sizeof *(br->levels), GFP_KERNEL); + sizeof *(br->levels), GFP_KERNEL); if (!br->levels) goto out; for (i = 0; i < obj->package.count; i++) { - o = (union acpi_object *) &obj->package.elements[i]; + o = (union acpi_object *)&obj->package. + elements[i]; if (o->type != ACPI_TYPE_INTEGER) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid data\n")); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Invalid data\n")); continue; } br->levels[count] = (u32) o->integer.value; count++; } -out: + out: if (count < 2) { kfree(br->levels); kfree(br); } else { br->count = count; device->brightness = br; - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "found %d brightness levels\n", count)); + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "found %d brightness levels\n", + count)); } } } @@ -610,28 +596,27 @@ out: * Find out all required AML method defined under the video bus device. */ -static void -acpi_video_bus_find_cap (struct acpi_video_bus *video) +static void acpi_video_bus_find_cap(struct acpi_video_bus *video) { - acpi_handle h_dummy1; + acpi_handle h_dummy1; - memset(&video->cap ,0, 4); - if( ACPI_SUCCESS(acpi_get_handle(video->handle, "_DOS", &h_dummy1))) { + memset(&video->cap, 0, 4); + if (ACPI_SUCCESS(acpi_get_handle(video->handle, "_DOS", &h_dummy1))) { video->cap._DOS = 1; } - if( ACPI_SUCCESS(acpi_get_handle(video->handle, "_DOD", &h_dummy1))) { + if (ACPI_SUCCESS(acpi_get_handle(video->handle, "_DOD", &h_dummy1))) { video->cap._DOD = 1; } - if( ACPI_SUCCESS(acpi_get_handle(video->handle, "_ROM", &h_dummy1))) { + if (ACPI_SUCCESS(acpi_get_handle(video->handle, "_ROM", &h_dummy1))) { video->cap._ROM = 1; } - if( ACPI_SUCCESS(acpi_get_handle(video->handle, "_GPD", &h_dummy1))) { + if (ACPI_SUCCESS(acpi_get_handle(video->handle, "_GPD", &h_dummy1))) { video->cap._GPD = 1; } - if( ACPI_SUCCESS(acpi_get_handle(video->handle, "_SPD", &h_dummy1))) { + if (ACPI_SUCCESS(acpi_get_handle(video->handle, "_SPD", &h_dummy1))) { video->cap._SPD = 1; } - if( ACPI_SUCCESS(acpi_get_handle(video->handle, "_VPO", &h_dummy1))) { + if (ACPI_SUCCESS(acpi_get_handle(video->handle, "_VPO", &h_dummy1))) { video->cap._VPO = 1; } } @@ -641,12 +626,9 @@ acpi_video_bus_find_cap (struct acpi_video_bus *video) * support the desired features */ -static int -acpi_video_bus_check ( - struct acpi_video_bus *video) +static int acpi_video_bus_check(struct acpi_video_bus *video) { - acpi_status status = -ENOENT; - + acpi_status status = -ENOENT; ACPI_FUNCTION_TRACE("acpi_video_bus_check"); @@ -658,19 +640,19 @@ acpi_video_bus_check ( */ /* Does this device able to support video switching ? */ - if(video->cap._DOS){ + if (video->cap._DOS) { video->flags.multihead = 1; status = 0; } /* Does this device able to retrieve a retrieve a video ROM ? */ - if(video->cap._ROM){ + if (video->cap._ROM) { video->flags.rom = 1; status = 0; } /* Does this device able to configure which video device to POST ? */ - if(video->cap._GPD && video->cap._SPD && video->cap._VPO){ + if (video->cap._GPD && video->cap._SPD && video->cap._VPO) { video->flags.post = 1; status = 0; } @@ -682,16 +664,14 @@ acpi_video_bus_check ( FS Interface (/proc) -------------------------------------------------------------------------- */ -static struct proc_dir_entry *acpi_video_dir; +static struct proc_dir_entry *acpi_video_dir; /* video devices */ -static int -acpi_video_device_info_seq_show ( - struct seq_file *seq, - void *offset) +static int acpi_video_device_info_seq_show(struct seq_file *seq, void *offset) { - struct acpi_video_device *dev = (struct acpi_video_device *) seq->private; + struct acpi_video_device *dev = + (struct acpi_video_device *)seq->private; ACPI_FUNCTION_TRACE("acpi_video_device_info_seq_show"); @@ -709,30 +689,25 @@ acpi_video_device_info_seq_show ( else seq_printf(seq, "UNKNOWN\n"); - seq_printf(seq,"known by bios: %s\n", - dev->flags.bios ? "yes":"no"); + seq_printf(seq, "known by bios: %s\n", dev->flags.bios ? "yes" : "no"); -end: + end: return_VALUE(0); } static int -acpi_video_device_info_open_fs ( - struct inode *inode, - struct file *file) +acpi_video_device_info_open_fs(struct inode *inode, struct file *file) { return single_open(file, acpi_video_device_info_seq_show, PDE(inode)->data); } -static int -acpi_video_device_state_seq_show ( - struct seq_file *seq, - void *offset) +static int acpi_video_device_state_seq_show(struct seq_file *seq, void *offset) { - int status; - struct acpi_video_device *dev = (struct acpi_video_device *) seq->private; - unsigned long state; + int status; + struct acpi_video_device *dev = + (struct acpi_video_device *)seq->private; + unsigned long state; ACPI_FUNCTION_TRACE("acpi_video_device_state_seq_show"); @@ -753,31 +728,27 @@ acpi_video_device_state_seq_show ( else seq_printf(seq, "\n"); -end: + end: return_VALUE(0); } static int -acpi_video_device_state_open_fs ( - struct inode *inode, - struct file *file) +acpi_video_device_state_open_fs(struct inode *inode, struct file *file) { return single_open(file, acpi_video_device_state_seq_show, PDE(inode)->data); } static ssize_t -acpi_video_device_write_state ( - struct file *file, - const char __user *buffer, - size_t count, - loff_t *data) +acpi_video_device_write_state(struct file *file, + const char __user * buffer, + size_t count, loff_t * data) { - int status; - struct seq_file *m = (struct seq_file *) file->private_data; - struct acpi_video_device *dev = (struct acpi_video_device *) m->private; - char str[12] = {0}; - u32 state = 0; + int status; + struct seq_file *m = (struct seq_file *)file->private_data; + struct acpi_video_device *dev = (struct acpi_video_device *)m->private; + char str[12] = { 0 }; + u32 state = 0; ACPI_FUNCTION_TRACE("acpi_video_device_write_state"); @@ -789,7 +760,7 @@ acpi_video_device_write_state ( str[count] = 0; state = simple_strtoul(str, NULL, 0); - state &= ((1ul<<31) | (1ul<<30) | (1ul<<0)); + state &= ((1ul << 31) | (1ul << 30) | (1ul << 0)); status = acpi_video_device_set_state(dev, state); @@ -800,12 +771,11 @@ acpi_video_device_write_state ( } static int -acpi_video_device_brightness_seq_show ( - struct seq_file *seq, - void *offset) +acpi_video_device_brightness_seq_show(struct seq_file *seq, void *offset) { - struct acpi_video_device *dev = (struct acpi_video_device *) seq->private; - int i; + struct acpi_video_device *dev = + (struct acpi_video_device *)seq->private; + int i; ACPI_FUNCTION_TRACE("acpi_video_device_brightness_seq_show"); @@ -823,26 +793,22 @@ acpi_video_device_brightness_seq_show ( } static int -acpi_video_device_brightness_open_fs ( - struct inode *inode, - struct file *file) +acpi_video_device_brightness_open_fs(struct inode *inode, struct file *file) { return single_open(file, acpi_video_device_brightness_seq_show, PDE(inode)->data); } static ssize_t -acpi_video_device_write_brightness ( - struct file *file, - const char __user *buffer, - size_t count, - loff_t *data) +acpi_video_device_write_brightness(struct file *file, + const char __user * buffer, + size_t count, loff_t * data) { - struct seq_file *m = (struct seq_file *) file->private_data; - struct acpi_video_device *dev = (struct acpi_video_device *) m->private; - char str[4] = {0}; - unsigned int level = 0; - int i; + struct seq_file *m = (struct seq_file *)file->private_data; + struct acpi_video_device *dev = (struct acpi_video_device *)m->private; + char str[4] = { 0 }; + unsigned int level = 0; + int i; ACPI_FUNCTION_TRACE("acpi_video_device_write_brightness"); @@ -854,14 +820,15 @@ acpi_video_device_write_brightness ( str[count] = 0; level = simple_strtoul(str, NULL, 0); - + if (level > 100) return_VALUE(-EFAULT); /* validate though the list of available levels */ for (i = 0; i < dev->brightness->count; i++) if (level == dev->brightness->levels[i]) { - if (ACPI_SUCCESS(acpi_video_device_lcd_set_level(dev, level))) + if (ACPI_SUCCESS + (acpi_video_device_lcd_set_level(dev, level))) dev->brightness->curr = level; break; } @@ -869,24 +836,22 @@ acpi_video_device_write_brightness ( return_VALUE(count); } -static int -acpi_video_device_EDID_seq_show ( - struct seq_file *seq, - void *offset) +static int acpi_video_device_EDID_seq_show(struct seq_file *seq, void *offset) { - struct acpi_video_device *dev = (struct acpi_video_device *) seq->private; - int status; - int i; - union acpi_object *edid = NULL; + struct acpi_video_device *dev = + (struct acpi_video_device *)seq->private; + int status; + int i; + union acpi_object *edid = NULL; ACPI_FUNCTION_TRACE("acpi_video_device_EDID_seq_show"); if (!dev) goto out; - status = acpi_video_device_EDID (dev, &edid, 128); + status = acpi_video_device_EDID(dev, &edid, 128); if (ACPI_FAILURE(status)) { - status = acpi_video_device_EDID (dev, &edid, 256); + status = acpi_video_device_EDID(dev, &edid, 256); } if (ACPI_FAILURE(status)) { @@ -898,7 +863,7 @@ acpi_video_device_EDID_seq_show ( seq_putc(seq, edid->buffer.pointer[i]); } -out: + out: if (!edid) seq_printf(seq, "\n"); else @@ -908,20 +873,15 @@ out: } static int -acpi_video_device_EDID_open_fs ( - struct inode *inode, - struct file *file) +acpi_video_device_EDID_open_fs(struct inode *inode, struct file *file) { return single_open(file, acpi_video_device_EDID_seq_show, PDE(inode)->data); } - -static int -acpi_video_device_add_fs ( - struct acpi_device *device) +static int acpi_video_device_add_fs(struct acpi_device *device) { - struct proc_dir_entry *entry = NULL; + struct proc_dir_entry *entry = NULL; struct acpi_video_device *vid_dev; ACPI_FUNCTION_TRACE("acpi_video_device_add_fs"); @@ -929,13 +889,13 @@ acpi_video_device_add_fs ( if (!device) return_VALUE(-ENODEV); - vid_dev = (struct acpi_video_device *) acpi_driver_data(device); + vid_dev = (struct acpi_video_device *)acpi_driver_data(device); if (!vid_dev) return_VALUE(-ENODEV); if (!acpi_device_dir(device)) { acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), - vid_dev->video->dir); + vid_dev->video->dir); if (!acpi_device_dir(device)) return_VALUE(-ENODEV); acpi_device_dir(device)->owner = THIS_MODULE; @@ -945,7 +905,7 @@ acpi_video_device_add_fs ( entry = create_proc_entry("info", S_IRUGO, acpi_device_dir(device)); if (!entry) ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create 'info' fs entry\n")); + "Unable to create 'info' fs entry\n")); else { entry->proc_fops = &acpi_video_device_info_fops; entry->data = acpi_driver_data(device); @@ -953,10 +913,12 @@ acpi_video_device_add_fs ( } /* 'state' [R/W] */ - entry = create_proc_entry("state", S_IFREG|S_IRUGO|S_IWUSR, acpi_device_dir(device)); + entry = + create_proc_entry("state", S_IFREG | S_IRUGO | S_IWUSR, + acpi_device_dir(device)); if (!entry) ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create 'state' fs entry\n")); + "Unable to create 'state' fs entry\n")); else { entry->proc_fops = &acpi_video_device_state_fops; entry->proc_fops->write = acpi_video_device_write_state; @@ -965,10 +927,12 @@ acpi_video_device_add_fs ( } /* 'brightness' [R/W] */ - entry = create_proc_entry("brightness", S_IFREG|S_IRUGO|S_IWUSR, acpi_device_dir(device)); + entry = + create_proc_entry("brightness", S_IFREG | S_IRUGO | S_IWUSR, + acpi_device_dir(device)); if (!entry) ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create 'brightness' fs entry\n")); + "Unable to create 'brightness' fs entry\n")); else { entry->proc_fops = &acpi_video_device_brightness_fops; entry->proc_fops->write = acpi_video_device_write_brightness; @@ -980,7 +944,7 @@ acpi_video_device_add_fs ( entry = create_proc_entry("EDID", S_IRUGO, acpi_device_dir(device)); if (!entry) ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create 'brightness' fs entry\n")); + "Unable to create 'brightness' fs entry\n")); else { entry->proc_fops = &acpi_video_device_EDID_fops; entry->data = acpi_driver_data(device); @@ -990,14 +954,12 @@ acpi_video_device_add_fs ( return_VALUE(0); } -static int -acpi_video_device_remove_fs ( - struct acpi_device *device) +static int acpi_video_device_remove_fs(struct acpi_device *device) { struct acpi_video_device *vid_dev; ACPI_FUNCTION_TRACE("acpi_video_device_remove_fs"); - vid_dev = (struct acpi_video_device *) acpi_driver_data(device); + vid_dev = (struct acpi_video_device *)acpi_driver_data(device); if (!vid_dev || !vid_dev->video || !vid_dev->video->dir) return_VALUE(-ENODEV); @@ -1006,22 +968,17 @@ acpi_video_device_remove_fs ( remove_proc_entry("state", acpi_device_dir(device)); remove_proc_entry("brightness", acpi_device_dir(device)); remove_proc_entry("EDID", acpi_device_dir(device)); - remove_proc_entry(acpi_device_bid(device), - vid_dev->video->dir); + remove_proc_entry(acpi_device_bid(device), vid_dev->video->dir); acpi_device_dir(device) = NULL; } return_VALUE(0); } - /* video bus */ -static int -acpi_video_bus_info_seq_show ( - struct seq_file *seq, - void *offset) +static int acpi_video_bus_info_seq_show(struct seq_file *seq, void *offset) { - struct acpi_video_bus *video = (struct acpi_video_bus *) seq->private; + struct acpi_video_bus *video = (struct acpi_video_bus *)seq->private; ACPI_FUNCTION_TRACE("acpi_video_bus_info_seq_show"); @@ -1029,30 +986,25 @@ acpi_video_bus_info_seq_show ( goto end; seq_printf(seq, "Switching heads: %s\n", - video->flags.multihead ? "yes":"no"); + video->flags.multihead ? "yes" : "no"); seq_printf(seq, "Video ROM: %s\n", - video->flags.rom ? "yes":"no"); + video->flags.rom ? "yes" : "no"); seq_printf(seq, "Device to be POSTed on boot: %s\n", - video->flags.post ? "yes":"no"); + video->flags.post ? "yes" : "no"); -end: + end: return_VALUE(0); } -static int -acpi_video_bus_info_open_fs ( - struct inode *inode, - struct file *file) +static int acpi_video_bus_info_open_fs(struct inode *inode, struct file *file) { - return single_open(file, acpi_video_bus_info_seq_show, PDE(inode)->data); + return single_open(file, acpi_video_bus_info_seq_show, + PDE(inode)->data); } -static int -acpi_video_bus_ROM_seq_show ( - struct seq_file *seq, - void *offset) +static int acpi_video_bus_ROM_seq_show(struct seq_file *seq, void *offset) { - struct acpi_video_bus *video = (struct acpi_video_bus *) seq->private; + struct acpi_video_bus *video = (struct acpi_video_bus *)seq->private; ACPI_FUNCTION_TRACE("acpi_video_bus_ROM_seq_show"); @@ -1062,26 +1014,20 @@ acpi_video_bus_ROM_seq_show ( printk(KERN_INFO PREFIX "Please implement %s\n", __FUNCTION__); seq_printf(seq, "\n"); -end: + end: return_VALUE(0); } -static int -acpi_video_bus_ROM_open_fs ( - struct inode *inode, - struct file *file) +static int acpi_video_bus_ROM_open_fs(struct inode *inode, struct file *file) { return single_open(file, acpi_video_bus_ROM_seq_show, PDE(inode)->data); } -static int -acpi_video_bus_POST_info_seq_show ( - struct seq_file *seq, - void *offset) +static int acpi_video_bus_POST_info_seq_show(struct seq_file *seq, void *offset) { - struct acpi_video_bus *video = (struct acpi_video_bus *) seq->private; - unsigned long options; - int status; + struct acpi_video_bus *video = (struct acpi_video_bus *)seq->private; + unsigned long options; + int status; ACPI_FUNCTION_TRACE("acpi_video_bus_POST_info_seq_show"); @@ -1091,8 +1037,10 @@ acpi_video_bus_POST_info_seq_show ( status = acpi_video_bus_POST_options(video, &options); if (ACPI_SUCCESS(status)) { if (!(options & 1)) { - printk(KERN_WARNING PREFIX "The motherboard VGA device is not listed as a possible POST device.\n"); - printk(KERN_WARNING PREFIX "This indicate a BIOS bug. Please contact the manufacturer.\n"); + printk(KERN_WARNING PREFIX + "The motherboard VGA device is not listed as a possible POST device.\n"); + printk(KERN_WARNING PREFIX + "This indicate a BIOS bug. Please contact the manufacturer.\n"); } printk("%lx\n", options); seq_printf(seq, "can POST: "); @@ -1103,89 +1051,74 @@ acpi_video_bus_POST_info_seq_show ( seq_putc(seq, '\n'); } else seq_printf(seq, "\n"); -end: + end: return_VALUE(0); } static int -acpi_video_bus_POST_info_open_fs ( - struct inode *inode, - struct file *file) +acpi_video_bus_POST_info_open_fs(struct inode *inode, struct file *file) { - return single_open(file, acpi_video_bus_POST_info_seq_show, PDE(inode)->data); + return single_open(file, acpi_video_bus_POST_info_seq_show, + PDE(inode)->data); } -static int -acpi_video_bus_POST_seq_show ( - struct seq_file *seq, - void *offset) +static int acpi_video_bus_POST_seq_show(struct seq_file *seq, void *offset) { - struct acpi_video_bus *video = (struct acpi_video_bus *) seq->private; - int status; - unsigned long id; + struct acpi_video_bus *video = (struct acpi_video_bus *)seq->private; + int status; + unsigned long id; ACPI_FUNCTION_TRACE("acpi_video_bus_POST_seq_show"); if (!video) goto end; - status = acpi_video_bus_get_POST (video, &id); + status = acpi_video_bus_get_POST(video, &id); if (!ACPI_SUCCESS(status)) { seq_printf(seq, "\n"); goto end; } - seq_printf(seq, "device posted is <%s>\n", device_decode[id & 3]); + seq_printf(seq, "device posted is <%s>\n", device_decode[id & 3]); -end: + end: return_VALUE(0); } -static int -acpi_video_bus_DOS_seq_show ( - struct seq_file *seq, - void *offset) +static int acpi_video_bus_DOS_seq_show(struct seq_file *seq, void *offset) { - struct acpi_video_bus *video = (struct acpi_video_bus *) seq->private; + struct acpi_video_bus *video = (struct acpi_video_bus *)seq->private; ACPI_FUNCTION_TRACE("acpi_video_bus_DOS_seq_show"); - seq_printf(seq, "DOS setting: <%d>\n", video->dos_setting ); + seq_printf(seq, "DOS setting: <%d>\n", video->dos_setting); return_VALUE(0); } -static int -acpi_video_bus_POST_open_fs ( - struct inode *inode, - struct file *file) +static int acpi_video_bus_POST_open_fs(struct inode *inode, struct file *file) { - return single_open(file, acpi_video_bus_POST_seq_show, PDE(inode)->data); + return single_open(file, acpi_video_bus_POST_seq_show, + PDE(inode)->data); } -static int -acpi_video_bus_DOS_open_fs ( - struct inode *inode, - struct file *file) +static int acpi_video_bus_DOS_open_fs(struct inode *inode, struct file *file) { return single_open(file, acpi_video_bus_DOS_seq_show, PDE(inode)->data); } static ssize_t -acpi_video_bus_write_POST ( - struct file *file, - const char __user *buffer, - size_t count, - loff_t *data) +acpi_video_bus_write_POST(struct file *file, + const char __user * buffer, + size_t count, loff_t * data) { - int status; - struct seq_file *m = (struct seq_file *) file->private_data; - struct acpi_video_bus *video = (struct acpi_video_bus *) m->private; - char str[12] = {0}; - unsigned long opt, options; + int status; + struct seq_file *m = (struct seq_file *)file->private_data; + struct acpi_video_bus *video = (struct acpi_video_bus *)m->private; + char str[12] = { 0 }; + unsigned long opt, options; ACPI_FUNCTION_TRACE("acpi_video_bus_write_POST"); - if (!video || count + 1 > sizeof str) return_VALUE(-EINVAL); @@ -1205,32 +1138,28 @@ acpi_video_bus_write_POST ( options |= 1; if (options & (1ul << opt)) { - status = acpi_video_bus_set_POST (video, opt); + status = acpi_video_bus_set_POST(video, opt); if (!ACPI_SUCCESS(status)) return_VALUE(-EFAULT); } - return_VALUE(count); } static ssize_t -acpi_video_bus_write_DOS ( - struct file *file, - const char __user *buffer, - size_t count, - loff_t *data) +acpi_video_bus_write_DOS(struct file *file, + const char __user * buffer, + size_t count, loff_t * data) { - int status; - struct seq_file *m = (struct seq_file *) file->private_data; - struct acpi_video_bus *video = (struct acpi_video_bus *) m->private; - char str[12] = {0}; - unsigned long opt; + int status; + struct seq_file *m = (struct seq_file *)file->private_data; + struct acpi_video_bus *video = (struct acpi_video_bus *)m->private; + char str[12] = { 0 }; + unsigned long opt; ACPI_FUNCTION_TRACE("acpi_video_bus_write_DOS"); - if (!video || count + 1 > sizeof str) return_VALUE(-EINVAL); @@ -1242,7 +1171,7 @@ acpi_video_bus_write_DOS ( if (opt > 7) return_VALUE(-EFAULT); - status = acpi_video_bus_DOS (video, opt & 0x3, (opt & 0x4)>>2); + status = acpi_video_bus_DOS(video, opt & 0x3, (opt & 0x4) >> 2); if (!ACPI_SUCCESS(status)) return_VALUE(-EFAULT); @@ -1250,20 +1179,18 @@ acpi_video_bus_write_DOS ( return_VALUE(count); } -static int -acpi_video_bus_add_fs ( - struct acpi_device *device) +static int acpi_video_bus_add_fs(struct acpi_device *device) { - struct proc_dir_entry *entry = NULL; - struct acpi_video_bus *video; + struct proc_dir_entry *entry = NULL; + struct acpi_video_bus *video; ACPI_FUNCTION_TRACE("acpi_video_bus_add_fs"); - video = (struct acpi_video_bus *) acpi_driver_data(device); + video = (struct acpi_video_bus *)acpi_driver_data(device); if (!acpi_device_dir(device)) { acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), - acpi_video_dir); + acpi_video_dir); if (!acpi_device_dir(device)) return_VALUE(-ENODEV); video->dir = acpi_device_dir(device); @@ -1273,7 +1200,8 @@ acpi_video_bus_add_fs ( /* 'info' [R] */ entry = create_proc_entry("info", S_IRUGO, acpi_device_dir(device)); if (!entry) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unable to create 'info' fs entry\n")); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Unable to create 'info' fs entry\n")); else { entry->proc_fops = &acpi_video_bus_info_fops; entry->data = acpi_driver_data(device); @@ -1283,7 +1211,8 @@ acpi_video_bus_add_fs ( /* 'ROM' [R] */ entry = create_proc_entry("ROM", S_IRUGO, acpi_device_dir(device)); if (!entry) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unable to create 'ROM' fs entry\n")); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Unable to create 'ROM' fs entry\n")); else { entry->proc_fops = &acpi_video_bus_ROM_fops; entry->data = acpi_driver_data(device); @@ -1291,9 +1220,11 @@ acpi_video_bus_add_fs ( } /* 'POST_info' [R] */ - entry = create_proc_entry("POST_info", S_IRUGO, acpi_device_dir(device)); + entry = + create_proc_entry("POST_info", S_IRUGO, acpi_device_dir(device)); if (!entry) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unable to create 'POST_info' fs entry\n")); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Unable to create 'POST_info' fs entry\n")); else { entry->proc_fops = &acpi_video_bus_POST_info_fops; entry->data = acpi_driver_data(device); @@ -1301,9 +1232,12 @@ acpi_video_bus_add_fs ( } /* 'POST' [R/W] */ - entry = create_proc_entry("POST", S_IFREG|S_IRUGO|S_IRUSR, acpi_device_dir(device)); + entry = + create_proc_entry("POST", S_IFREG | S_IRUGO | S_IRUSR, + acpi_device_dir(device)); if (!entry) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unable to create 'POST' fs entry\n")); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Unable to create 'POST' fs entry\n")); else { entry->proc_fops = &acpi_video_bus_POST_fops; entry->proc_fops->write = acpi_video_bus_write_POST; @@ -1312,9 +1246,12 @@ acpi_video_bus_add_fs ( } /* 'DOS' [R/W] */ - entry = create_proc_entry("DOS", S_IFREG|S_IRUGO|S_IRUSR, acpi_device_dir(device)); + entry = + create_proc_entry("DOS", S_IFREG | S_IRUGO | S_IRUSR, + acpi_device_dir(device)); if (!entry) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unable to create 'DOS' fs entry\n")); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Unable to create 'DOS' fs entry\n")); else { entry->proc_fops = &acpi_video_bus_DOS_fops; entry->proc_fops->write = acpi_video_bus_write_DOS; @@ -1325,15 +1262,13 @@ acpi_video_bus_add_fs ( return_VALUE(0); } -static int -acpi_video_bus_remove_fs ( - struct acpi_device *device) +static int acpi_video_bus_remove_fs(struct acpi_device *device) { - struct acpi_video_bus *video; + struct acpi_video_bus *video; ACPI_FUNCTION_TRACE("acpi_video_bus_remove_fs"); - video = (struct acpi_video_bus *) acpi_driver_data(device); + video = (struct acpi_video_bus *)acpi_driver_data(device); if (acpi_device_dir(device)) { remove_proc_entry("info", acpi_device_dir(device)); @@ -1341,8 +1276,7 @@ acpi_video_bus_remove_fs ( remove_proc_entry("POST_info", acpi_device_dir(device)); remove_proc_entry("POST", acpi_device_dir(device)); remove_proc_entry("DOS", acpi_device_dir(device)); - remove_proc_entry(acpi_device_bid(device), - acpi_video_dir); + remove_proc_entry(acpi_device_bid(device), acpi_video_dir); acpi_device_dir(device) = NULL; } @@ -1356,20 +1290,20 @@ acpi_video_bus_remove_fs ( /* device interface */ static int -acpi_video_bus_get_one_device ( - struct acpi_device *device, - struct acpi_video_bus *video) +acpi_video_bus_get_one_device(struct acpi_device *device, + struct acpi_video_bus *video) { - unsigned long device_id; - int status, result; - struct acpi_video_device *data; + unsigned long device_id; + int status, result; + struct acpi_video_device *data; ACPI_FUNCTION_TRACE("acpi_video_bus_get_one_device"); if (!device || !video) return_VALUE(-EINVAL); - status = acpi_evaluate_integer(device->handle, "_ADR", NULL, &device_id); + status = + acpi_evaluate_integer(device->handle, "_ADR", NULL, &device_id); if (ACPI_SUCCESS(status)) { data = kmalloc(sizeof(struct acpi_video_device), GFP_KERNEL); @@ -1401,15 +1335,17 @@ acpi_video_bus_get_one_device ( data->flags.unknown = 1; break; } - + acpi_video_device_bind(video, data); acpi_video_device_find_cap(data); status = acpi_install_notify_handler(data->handle, - ACPI_DEVICE_NOTIFY, acpi_video_device_notify, data); + ACPI_DEVICE_NOTIFY, + acpi_video_device_notify, + data); if (ACPI_FAILURE(status)) { ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error installing notify handler\n")); + "Error installing notify handler\n")); result = -ENODEV; goto end; } @@ -1423,7 +1359,7 @@ acpi_video_bus_get_one_device ( return_VALUE(0); } -end: + end: return_VALUE(-ENOENT); } @@ -1437,15 +1373,15 @@ end: * Enumerate the video device list of the video bus, * bind the ids with the corresponding video devices * under the video bus. - */ + */ -static void -acpi_video_device_rebind( struct acpi_video_bus *video) +static void acpi_video_device_rebind(struct acpi_video_bus *video) { - struct list_head * node, * next; + struct list_head *node, *next; list_for_each_safe(node, next, &video->video_device_list) { - struct acpi_video_device * dev = container_of(node, struct acpi_video_device, entry); - acpi_video_device_bind( video, dev); + struct acpi_video_device *dev = + container_of(node, struct acpi_video_device, entry); + acpi_video_device_bind(video, dev); } } @@ -1460,21 +1396,21 @@ acpi_video_device_rebind( struct acpi_video_bus *video) * * Bind the ids with the corresponding video devices * under the video bus. - */ + */ static void -acpi_video_device_bind( struct acpi_video_bus *video, - struct acpi_video_device *device) +acpi_video_device_bind(struct acpi_video_bus *video, + struct acpi_video_device *device) { - int i; + int i; ACPI_FUNCTION_TRACE("acpi_video_device_bind"); #define IDS_VAL(i) video->attached_array[i].value.int_val #define IDS_BIND(i) video->attached_array[i].bind_info - - for (i = 0; IDS_VAL(i) != ACPI_VIDEO_HEAD_INVALID && - i < video->attached_count; i++) { - if (device->device_id == (IDS_VAL(i)& 0xffff)) { + + for (i = 0; IDS_VAL(i) != ACPI_VIDEO_HEAD_INVALID && + i < video->attached_count; i++) { + if (device->device_id == (IDS_VAL(i) & 0xffff)) { IDS_BIND(i) = device; ACPI_DEBUG_PRINT((ACPI_DB_INFO, "device_bind %d\n", i)); } @@ -1492,17 +1428,17 @@ acpi_video_device_bind( struct acpi_video_bus *video, * * Call _DOD to enumerate all devices attached to display adapter * - */ + */ static int acpi_video_device_enumerate(struct acpi_video_bus *video) { - int status; - int count; - int i; + int status; + int count; + int i; struct acpi_video_enumerated_device *active_device_list; - struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL}; - union acpi_object *dod = NULL; - union acpi_object *obj; + struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; + union acpi_object *dod = NULL; + union acpi_object *obj; ACPI_FUNCTION_TRACE("acpi_video_device_enumerate"); @@ -1512,7 +1448,7 @@ static int acpi_video_device_enumerate(struct acpi_video_bus *video) return_VALUE(status); } - dod = (union acpi_object *) buffer.pointer; + dod = (union acpi_object *)buffer.pointer; if (!dod || (dod->type != ACPI_TYPE_PACKAGE)) { ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid _DOD data\n")); status = -EFAULT; @@ -1520,11 +1456,13 @@ static int acpi_video_device_enumerate(struct acpi_video_bus *video) } ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found %d video heads in _DOD\n", - dod->package.count)); + dod->package.count)); - active_device_list= kmalloc( - (1+dod->package.count)*sizeof(struct acpi_video_enumerated_device), - GFP_KERNEL); + active_device_list = kmalloc((1 + + dod->package.count) * + sizeof(struct + acpi_video_enumerated_device), + GFP_KERNEL); if (!active_device_list) { status = -ENOMEM; @@ -1533,25 +1471,28 @@ static int acpi_video_device_enumerate(struct acpi_video_bus *video) count = 0; for (i = 0; i < dod->package.count; i++) { - obj = (union acpi_object *) &dod->package.elements[i]; + obj = (union acpi_object *)&dod->package.elements[i]; if (obj->type != ACPI_TYPE_INTEGER) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid _DOD data\n")); - active_device_list[i].value.int_val = ACPI_VIDEO_HEAD_INVALID; + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Invalid _DOD data\n")); + active_device_list[i].value.int_val = + ACPI_VIDEO_HEAD_INVALID; } active_device_list[i].value.int_val = obj->integer.value; active_device_list[i].bind_info = NULL; - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "dod element[%d] = %d\n", i, (int) obj->integer.value)); + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "dod element[%d] = %d\n", i, + (int)obj->integer.value)); count++; } active_device_list[count].value.int_val = ACPI_VIDEO_HEAD_END; - if(video->attached_array) + if (video->attached_array) kfree(video->attached_array); - + video->attached_array = active_device_list; video->attached_count = count; -out: + out: acpi_os_free(buffer.pointer); return_VALUE(status); } @@ -1567,17 +1508,14 @@ out: * 1. Find out the current active output device. * 2. Identify the next output device to switch * 3. call _DSS to do actual switch. - */ + */ -static int -acpi_video_switch_output( - struct acpi_video_bus *video, - int event) +static int acpi_video_switch_output(struct acpi_video_bus *video, int event) { - struct list_head * node, * next; - struct acpi_video_device *dev=NULL; - struct acpi_video_device *dev_next=NULL; - struct acpi_video_device *dev_prev=NULL; + struct list_head *node, *next; + struct acpi_video_device *dev = NULL; + struct acpi_video_device *dev_next = NULL; + struct acpi_video_device *dev_prev = NULL; unsigned long state; int status = 0; @@ -1586,15 +1524,19 @@ acpi_video_switch_output( list_for_each_safe(node, next, &video->video_device_list) { dev = container_of(node, struct acpi_video_device, entry); status = acpi_video_device_get_state(dev, &state); - if (state & 0x2){ - dev_next = container_of(node->next, struct acpi_video_device, entry); - dev_prev = container_of(node->prev, struct acpi_video_device, entry); + if (state & 0x2) { + dev_next = + container_of(node->next, struct acpi_video_device, + entry); + dev_prev = + container_of(node->prev, struct acpi_video_device, + entry); goto out; } } dev_next = container_of(node->next, struct acpi_video_device, entry); dev_prev = container_of(node->prev, struct acpi_video_device, entry); -out: + out: switch (event) { case ACPI_VIDEO_NOTIFY_CYCLE: case ACPI_VIDEO_NOTIFY_NEXT_OUTPUT: @@ -1611,21 +1553,16 @@ out: return_VALUE(status); } -static int -acpi_video_get_next_level( - struct acpi_video_device *device, - u32 level_current, - u32 event) +static int +acpi_video_get_next_level(struct acpi_video_device *device, + u32 level_current, u32 event) { - /*Fix me*/ + /*Fix me */ return level_current; } - static void -acpi_video_switch_brightness ( - struct acpi_video_device *device, - int event) +acpi_video_switch_brightness(struct acpi_video_device *device, int event) { unsigned long level_current, level_next; acpi_video_device_lcd_get_level_current(device, &level_current); @@ -1634,26 +1571,27 @@ acpi_video_switch_brightness ( } static int -acpi_video_bus_get_devices ( - struct acpi_video_bus *video, - struct acpi_device *device) +acpi_video_bus_get_devices(struct acpi_video_bus *video, + struct acpi_device *device) { - int status = 0; - struct list_head *node, *next; + int status = 0; + struct list_head *node, *next; ACPI_FUNCTION_TRACE("acpi_video_get_devices"); acpi_video_device_enumerate(video); list_for_each_safe(node, next, &device->children) { - struct acpi_device *dev = list_entry(node, struct acpi_device, node); + struct acpi_device *dev = + list_entry(node, struct acpi_device, node); if (!dev) continue; status = acpi_video_bus_get_one_device(dev, video); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Cant attach device\n")); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Cant attach device\n")); continue; } @@ -1661,9 +1599,7 @@ acpi_video_bus_get_devices ( return_VALUE(status); } -static int -acpi_video_bus_put_one_device( - struct acpi_video_device *device) +static int acpi_video_bus_put_one_device(struct acpi_video_device *device) { acpi_status status; struct acpi_video_bus *video; @@ -1681,31 +1617,32 @@ acpi_video_bus_put_one_device( acpi_video_device_remove_fs(device->dev); status = acpi_remove_notify_handler(device->handle, - ACPI_DEVICE_NOTIFY, acpi_video_device_notify); + ACPI_DEVICE_NOTIFY, + acpi_video_device_notify); if (ACPI_FAILURE(status)) ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error removing notify handler\n")); + "Error removing notify handler\n")); return_VALUE(0); } -static int -acpi_video_bus_put_devices ( - struct acpi_video_bus *video) +static int acpi_video_bus_put_devices(struct acpi_video_bus *video) { - int status; - struct list_head *node, *next; + int status; + struct list_head *node, *next; ACPI_FUNCTION_TRACE("acpi_video_bus_put_devices"); list_for_each_safe(node, next, &video->video_device_list) { - struct acpi_video_device *data = list_entry(node, struct acpi_video_device, entry); + struct acpi_video_device *data = + list_entry(node, struct acpi_video_device, entry); if (!data) continue; status = acpi_video_bus_put_one_device(data); - if(ACPI_FAILURE(status)) - printk(KERN_WARNING PREFIX "hhuuhhuu bug in acpi video driver.\n"); + if (ACPI_FAILURE(status)) + printk(KERN_WARNING PREFIX + "hhuuhhuu bug in acpi video driver.\n"); if (data->brightness) kfree(data->brightness); @@ -1718,28 +1655,20 @@ acpi_video_bus_put_devices ( /* acpi_video interface */ -static int -acpi_video_bus_start_devices( - struct acpi_video_bus *video) +static int acpi_video_bus_start_devices(struct acpi_video_bus *video) { return acpi_video_bus_DOS(video, 1, 0); } -static int -acpi_video_bus_stop_devices( - struct acpi_video_bus *video) +static int acpi_video_bus_stop_devices(struct acpi_video_bus *video) { return acpi_video_bus_DOS(video, 0, 1); } -static void -acpi_video_bus_notify ( - acpi_handle handle, - u32 event, - void *data) +static void acpi_video_bus_notify(acpi_handle handle, u32 event, void *data) { - struct acpi_video_bus *video = (struct acpi_video_bus *) data; - struct acpi_device *device = NULL; + struct acpi_video_bus *video = (struct acpi_video_bus *)data; + struct acpi_device *device = NULL; ACPI_FUNCTION_TRACE("acpi_video_bus_notify"); printk("video bus notify\n"); @@ -1764,30 +1693,27 @@ acpi_video_bus_notify ( acpi_bus_generate_event(device, event, 0); break; - case ACPI_VIDEO_NOTIFY_CYCLE: /* Cycle Display output hotkey pressed.*/ - case ACPI_VIDEO_NOTIFY_NEXT_OUTPUT: /* Next Display output hotkey pressed. */ - case ACPI_VIDEO_NOTIFY_PREV_OUTPUT: /* previous Display output hotkey pressed. */ + case ACPI_VIDEO_NOTIFY_CYCLE: /* Cycle Display output hotkey pressed. */ + case ACPI_VIDEO_NOTIFY_NEXT_OUTPUT: /* Next Display output hotkey pressed. */ + case ACPI_VIDEO_NOTIFY_PREV_OUTPUT: /* previous Display output hotkey pressed. */ acpi_video_switch_output(video, event); acpi_bus_generate_event(device, event, 0); break; default: ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "Unsupported event [0x%x]\n", event)); + "Unsupported event [0x%x]\n", event)); break; } return_VOID; } -static void -acpi_video_device_notify ( - acpi_handle handle, - u32 event, - void *data) +static void acpi_video_device_notify(acpi_handle handle, u32 event, void *data) { - struct acpi_video_device *video_device = (struct acpi_video_device *) data; - struct acpi_device *device = NULL; + struct acpi_video_device *video_device = + (struct acpi_video_device *)data; + struct acpi_device *device = NULL; ACPI_FUNCTION_TRACE("acpi_video_device_notify"); @@ -1799,36 +1725,34 @@ acpi_video_device_notify ( return_VOID; switch (event) { - case ACPI_VIDEO_NOTIFY_SWITCH: /* change in status (cycle output device) */ - case ACPI_VIDEO_NOTIFY_PROBE: /* change in status (output device status) */ + case ACPI_VIDEO_NOTIFY_SWITCH: /* change in status (cycle output device) */ + case ACPI_VIDEO_NOTIFY_PROBE: /* change in status (output device status) */ acpi_bus_generate_event(device, event, 0); break; - case ACPI_VIDEO_NOTIFY_CYCLE_BRIGHTNESS: /* Cycle brightness */ - case ACPI_VIDEO_NOTIFY_INC_BRIGHTNESS: /* Increase brightness */ - case ACPI_VIDEO_NOTIFY_DEC_BRIGHTNESS: /* Decrease brightness */ - case ACPI_VIDEO_NOTIFY_ZERO_BRIGHTNESS: /* zero brightnesss */ - case ACPI_VIDEO_NOTIFY_DISPLAY_OFF: /* display device off */ - acpi_video_switch_brightness (video_device, event); + case ACPI_VIDEO_NOTIFY_CYCLE_BRIGHTNESS: /* Cycle brightness */ + case ACPI_VIDEO_NOTIFY_INC_BRIGHTNESS: /* Increase brightness */ + case ACPI_VIDEO_NOTIFY_DEC_BRIGHTNESS: /* Decrease brightness */ + case ACPI_VIDEO_NOTIFY_ZERO_BRIGHTNESS: /* zero brightnesss */ + case ACPI_VIDEO_NOTIFY_DISPLAY_OFF: /* display device off */ + acpi_video_switch_brightness(video_device, event); acpi_bus_generate_event(device, event, 0); break; default: ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "Unsupported event [0x%x]\n", event)); + "Unsupported event [0x%x]\n", event)); break; } return_VOID; } -static int -acpi_video_bus_add ( - struct acpi_device *device) +static int acpi_video_bus_add(struct acpi_device *device) { - int result = 0; - acpi_status status = 0; - struct acpi_video_bus *video = NULL; + int result = 0; + acpi_status status = 0; + struct acpi_video_bus *video = NULL; ACPI_FUNCTION_TRACE("acpi_video_bus_add"); - + if (!device) return_VALUE(-EINVAL); @@ -1858,21 +1782,22 @@ acpi_video_bus_add ( acpi_video_bus_start_devices(video); status = acpi_install_notify_handler(video->handle, - ACPI_DEVICE_NOTIFY, acpi_video_bus_notify, video); + ACPI_DEVICE_NOTIFY, + acpi_video_bus_notify, video); if (ACPI_FAILURE(status)) { ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error installing notify handler\n")); + "Error installing notify handler\n")); result = -ENODEV; goto end; } printk(KERN_INFO PREFIX "%s [%s] (multi-head: %s rom: %s post: %s)\n", - ACPI_VIDEO_DEVICE_NAME, acpi_device_bid(device), - video->flags.multihead ? "yes":"no", - video->flags.rom ? "yes":"no", - video->flags.post ? "yes":"no"); + ACPI_VIDEO_DEVICE_NAME, acpi_device_bid(device), + video->flags.multihead ? "yes" : "no", + video->flags.rom ? "yes" : "no", + video->flags.post ? "yes" : "no"); -end: + end: if (result) { acpi_video_bus_remove_fs(device); kfree(video); @@ -1881,28 +1806,26 @@ end: return_VALUE(result); } -static int -acpi_video_bus_remove ( - struct acpi_device *device, - int type) +static int acpi_video_bus_remove(struct acpi_device *device, int type) { - acpi_status status = 0; - struct acpi_video_bus *video = NULL; + acpi_status status = 0; + struct acpi_video_bus *video = NULL; ACPI_FUNCTION_TRACE("acpi_video_bus_remove"); if (!device || !acpi_driver_data(device)) return_VALUE(-EINVAL); - video = (struct acpi_video_bus *) acpi_driver_data(device); + video = (struct acpi_video_bus *)acpi_driver_data(device); acpi_video_bus_stop_devices(video); status = acpi_remove_notify_handler(video->handle, - ACPI_DEVICE_NOTIFY, acpi_video_bus_notify); + ACPI_DEVICE_NOTIFY, + acpi_video_bus_notify); if (ACPI_FAILURE(status)) ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error removing notify handler\n")); + "Error removing notify handler\n")); acpi_video_bus_put_devices(video); acpi_video_bus_remove_fs(device); @@ -1914,15 +1837,12 @@ acpi_video_bus_remove ( return_VALUE(0); } - static int -acpi_video_bus_match ( - struct acpi_device *device, - struct acpi_driver *driver) +acpi_video_bus_match(struct acpi_device *device, struct acpi_driver *driver) { - acpi_handle h_dummy1; - acpi_handle h_dummy2; - acpi_handle h_dummy3; + acpi_handle h_dummy1; + acpi_handle h_dummy2; + acpi_handle h_dummy3; ACPI_FUNCTION_TRACE("acpi_video_bus_match"); @@ -1948,22 +1868,19 @@ acpi_video_bus_match ( ACPI_SUCCESS(acpi_get_handle(device->handle, "_SPD", &h_dummy3))) return_VALUE(0); - return_VALUE(-ENODEV); } - -static int __init -acpi_video_init (void) +static int __init acpi_video_init(void) { - int result = 0; + int result = 0; ACPI_FUNCTION_TRACE("acpi_video_init"); /* - acpi_dbg_level = 0xFFFFFFFF; - acpi_dbg_layer = 0x08000000; - */ + acpi_dbg_level = 0xFFFFFFFF; + acpi_dbg_layer = 0x08000000; + */ acpi_video_dir = proc_mkdir(ACPI_VIDEO_CLASS, acpi_root_dir); if (!acpi_video_dir) @@ -1979,8 +1896,7 @@ acpi_video_init (void) return_VALUE(0); } -static void __exit -acpi_video_exit (void) +static void __exit acpi_video_exit(void) { ACPI_FUNCTION_TRACE("acpi_video_exit"); diff --git a/include/acpi/acconfig.h b/include/acpi/acconfig.h index d62af729392..f3810cc5d48 100644 --- a/include/acpi/acconfig.h +++ b/include/acpi/acconfig.h @@ -44,7 +44,6 @@ #ifndef _ACCONFIG_H #define _ACCONFIG_H - /****************************************************************************** * * Configuration options @@ -78,10 +77,10 @@ /* Maximum objects in the various object caches */ -#define ACPI_MAX_STATE_CACHE_DEPTH 96 /* State objects */ -#define ACPI_MAX_PARSE_CACHE_DEPTH 96 /* Parse tree objects */ -#define ACPI_MAX_EXTPARSE_CACHE_DEPTH 96 /* Parse tree objects */ -#define ACPI_MAX_OBJECT_CACHE_DEPTH 96 /* Interpreter operand objects */ +#define ACPI_MAX_STATE_CACHE_DEPTH 96 /* State objects */ +#define ACPI_MAX_PARSE_CACHE_DEPTH 96 /* Parse tree objects */ +#define ACPI_MAX_EXTPARSE_CACHE_DEPTH 96 /* Parse tree objects */ +#define ACPI_MAX_OBJECT_CACHE_DEPTH 96 /* Interpreter operand objects */ /* * Should the subystem abort the loading of an ACPI table if the @@ -89,7 +88,6 @@ */ #define ACPI_CHECKSUM_ABORT FALSE - /****************************************************************************** * * Subsystem Constants @@ -103,7 +101,7 @@ /* String size constants */ #define ACPI_MAX_STRING_LENGTH 512 -#define ACPI_PATHNAME_MAX 256 /* A full namespace pathname */ +#define ACPI_PATHNAME_MAX 256 /* A full namespace pathname */ /* Maximum count for a semaphore object */ @@ -117,7 +115,6 @@ #define ACPI_SYSMEM_REGION_WINDOW_SIZE 4096 - /****************************************************************************** * * ACPI Specification constants (Do not change unless the specification changes) @@ -155,15 +152,15 @@ /* Names within the namespace are 4 bytes long */ #define ACPI_NAME_SIZE 4 -#define ACPI_PATH_SEGMENT_LENGTH 5 /* 4 chars for name + 1 char for separator */ +#define ACPI_PATH_SEGMENT_LENGTH 5 /* 4 chars for name + 1 char for separator */ #define ACPI_PATH_SEPARATOR '.' /* Constants used in searching for the RSDP in low memory */ -#define ACPI_EBDA_PTR_LOCATION 0x0000040E /* Physical Address */ +#define ACPI_EBDA_PTR_LOCATION 0x0000040E /* Physical Address */ #define ACPI_EBDA_PTR_LENGTH 2 #define ACPI_EBDA_WINDOW_SIZE 1024 -#define ACPI_HI_RSDP_WINDOW_BASE 0x000E0000 /* Physical Address */ +#define ACPI_HI_RSDP_WINDOW_BASE 0x000E0000 /* Physical Address */ #define ACPI_HI_RSDP_WINDOW_SIZE 0x00020000 #define ACPI_RSDP_SCAN_STEP 16 @@ -198,18 +195,15 @@ #define ACPI_NUM_OSI_STRINGS 10 - /****************************************************************************** * * ACPI AML Debugger * *****************************************************************************/ -#define ACPI_DEBUGGER_MAX_ARGS 8 /* Must be max method args + 1 */ +#define ACPI_DEBUGGER_MAX_ARGS 8 /* Must be max method args + 1 */ #define ACPI_DEBUGGER_COMMAND_PROMPT '-' #define ACPI_DEBUGGER_EXECUTE_PROMPT '%' - -#endif /* _ACCONFIG_H */ - +#endif /* _ACCONFIG_H */ diff --git a/include/acpi/acdebug.h b/include/acpi/acdebug.h index f8fa2227583..70ce3b4d006 100644 --- a/include/acpi/acdebug.h +++ b/include/acpi/acdebug.h @@ -44,22 +44,17 @@ #ifndef __ACDEBUG_H__ #define __ACDEBUG_H__ - #define ACPI_DEBUG_BUFFER_SIZE 4196 -struct command_info -{ - char *name; /* Command Name */ - u8 min_args; /* Minimum arguments required */ +struct command_info { + char *name; /* Command Name */ + u8 min_args; /* Minimum arguments required */ }; - -struct argument_info -{ - char *name; /* Argument Name */ +struct argument_info { + char *name; /* Argument Name */ }; - #define PARAM_LIST(pl) pl #define DBTEST_OUTPUT_LEVEL(lvl) if (acpi_gbl_db_opt_verbose) #define VERBOSE_PRINT(fp) DBTEST_OUTPUT_LEVEL(lvl) {\ @@ -68,279 +63,155 @@ struct argument_info #define EX_NO_SINGLE_STEP 1 #define EX_SINGLE_STEP 2 - /* * dbxface - external debugger interfaces */ -acpi_status -acpi_db_initialize ( - void); +acpi_status acpi_db_initialize(void); -void -acpi_db_terminate ( - void); +void acpi_db_terminate(void); acpi_status -acpi_db_single_step ( - struct acpi_walk_state *walk_state, - union acpi_parse_object *op, - u32 op_type); - +acpi_db_single_step(struct acpi_walk_state *walk_state, + union acpi_parse_object *op, u32 op_type); /* * dbcmds - debug commands and output routines */ -acpi_status -acpi_db_disassemble_method ( - char *name); - -void -acpi_db_display_table_info ( - char *table_arg); +acpi_status acpi_db_disassemble_method(char *name); -void -acpi_db_unload_acpi_table ( - char *table_arg, - char *instance_arg); +void acpi_db_display_table_info(char *table_arg); -void -acpi_db_set_method_breakpoint ( - char *location, - struct acpi_walk_state *walk_state, - union acpi_parse_object *op); +void acpi_db_unload_acpi_table(char *table_arg, char *instance_arg); void -acpi_db_set_method_call_breakpoint ( - union acpi_parse_object *op); +acpi_db_set_method_breakpoint(char *location, + struct acpi_walk_state *walk_state, + union acpi_parse_object *op); -void -acpi_db_get_bus_info ( - void); +void acpi_db_set_method_call_breakpoint(union acpi_parse_object *op); -void -acpi_db_disassemble_aml ( - char *statements, - union acpi_parse_object *op); +void acpi_db_get_bus_info(void); -void -acpi_db_dump_namespace ( - char *start_arg, - char *depth_arg); +void acpi_db_disassemble_aml(char *statements, union acpi_parse_object *op); -void -acpi_db_dump_namespace_by_owner ( - char *owner_arg, - char *depth_arg); +void acpi_db_dump_namespace(char *start_arg, char *depth_arg); -void -acpi_db_send_notify ( - char *name, - u32 value); +void acpi_db_dump_namespace_by_owner(char *owner_arg, char *depth_arg); -void -acpi_db_set_method_data ( - char *type_arg, - char *index_arg, - char *value_arg); +void acpi_db_send_notify(char *name, u32 value); -acpi_status -acpi_db_display_objects ( - char *obj_type_arg, - char *display_count_arg); +void acpi_db_set_method_data(char *type_arg, char *index_arg, char *value_arg); acpi_status -acpi_db_find_name_in_namespace ( - char *name_arg); +acpi_db_display_objects(char *obj_type_arg, char *display_count_arg); -void -acpi_db_set_scope ( - char *name); +acpi_status acpi_db_find_name_in_namespace(char *name_arg); -acpi_status -acpi_db_sleep ( - char *object_arg); +void acpi_db_set_scope(char *name); -void -acpi_db_find_references ( - char *object_arg); +acpi_status acpi_db_sleep(char *object_arg); -void -acpi_db_display_locks ( - void); +void acpi_db_find_references(char *object_arg); -void -acpi_db_display_resources ( - char *object_arg); +void acpi_db_display_locks(void); -void -acpi_db_display_gpes ( - void); +void acpi_db_display_resources(char *object_arg); -void -acpi_db_check_integrity ( - void); +void acpi_db_display_gpes(void); -void -acpi_db_generate_gpe ( - char *gpe_arg, - char *block_arg); +void acpi_db_check_integrity(void); +void acpi_db_generate_gpe(char *gpe_arg, char *block_arg); /* * dbdisply - debug display commands */ -void -acpi_db_display_method_info ( - union acpi_parse_object *op); +void acpi_db_display_method_info(union acpi_parse_object *op); -void -acpi_db_decode_and_display_object ( - char *target, - char *output_type); +void acpi_db_decode_and_display_object(char *target, char *output_type); void -acpi_db_display_result_object ( - union acpi_operand_object *obj_desc, - struct acpi_walk_state *walk_state); +acpi_db_display_result_object(union acpi_operand_object *obj_desc, + struct acpi_walk_state *walk_state); -acpi_status -acpi_db_display_all_methods ( - char *display_count_arg); +acpi_status acpi_db_display_all_methods(char *display_count_arg); -void -acpi_db_display_arguments ( - void); +void acpi_db_display_arguments(void); -void -acpi_db_display_locals ( - void); +void acpi_db_display_locals(void); -void -acpi_db_display_results ( - void); +void acpi_db_display_results(void); -void -acpi_db_display_calling_tree ( - void); +void acpi_db_display_calling_tree(void); -void -acpi_db_display_object_type ( - char *object_arg); +void acpi_db_display_object_type(char *object_arg); void -acpi_db_display_argument_object ( - union acpi_operand_object *obj_desc, - struct acpi_walk_state *walk_state); - +acpi_db_display_argument_object(union acpi_operand_object *obj_desc, + struct acpi_walk_state *walk_state); /* * dbexec - debugger control method execution */ -void -acpi_db_execute ( - char *name, - char **args, - u32 flags); +void acpi_db_execute(char *name, char **args, u32 flags); void -acpi_db_create_execution_threads ( - char *num_threads_arg, - char *num_loops_arg, - char *method_name_arg); - +acpi_db_create_execution_threads(char *num_threads_arg, + char *num_loops_arg, char *method_name_arg); /* * dbfileio - Debugger file I/O commands */ acpi_object_type -acpi_db_match_argument ( - char *user_argument, - struct argument_info *arguments); +acpi_db_match_argument(char *user_argument, struct argument_info *arguments); -void -acpi_db_close_debug_file ( - void); +void acpi_db_close_debug_file(void); -void -acpi_db_open_debug_file ( - char *name); +void acpi_db_open_debug_file(char *name); -acpi_status -acpi_db_load_acpi_table ( - char *filename); +acpi_status acpi_db_load_acpi_table(char *filename); acpi_status -acpi_db_get_table_from_file ( - char *filename, - struct acpi_table_header **table); +acpi_db_get_table_from_file(char *filename, struct acpi_table_header **table); acpi_status -acpi_db_read_table_from_file ( - char *filename, - struct acpi_table_header **table); - +acpi_db_read_table_from_file(char *filename, struct acpi_table_header **table); /* * dbhistry - debugger HISTORY command */ -void -acpi_db_add_to_history ( - char *command_line); +void acpi_db_add_to_history(char *command_line); -void -acpi_db_display_history ( - void); - -char * -acpi_db_get_from_history ( - char *command_num_arg); +void acpi_db_display_history(void); +char *acpi_db_get_from_history(char *command_num_arg); /* * dbinput - user front-end to the AML debugger */ acpi_status -acpi_db_command_dispatch ( - char *input_buffer, - struct acpi_walk_state *walk_state, - union acpi_parse_object *op); - -void ACPI_SYSTEM_XFACE -acpi_db_execute_thread ( - void *context); +acpi_db_command_dispatch(char *input_buffer, + struct acpi_walk_state *walk_state, + union acpi_parse_object *op); +void ACPI_SYSTEM_XFACE acpi_db_execute_thread(void *context); /* * dbstats - Generation and display of ACPI table statistics */ -void -acpi_db_generate_statistics ( - union acpi_parse_object *root, - u8 is_method); - -acpi_status -acpi_db_display_statistics ( - char *type_arg); +void acpi_db_generate_statistics(union acpi_parse_object *root, u8 is_method); +acpi_status acpi_db_display_statistics(char *type_arg); /* * dbutils - AML debugger utilities */ -void -acpi_db_set_output_destination ( - u32 where); +void acpi_db_set_output_destination(u32 where); -void -acpi_db_dump_external_object ( - union acpi_object *obj_desc, - u32 level); +void acpi_db_dump_external_object(union acpi_object *obj_desc, u32 level); -void -acpi_db_prep_namestring ( - char *name); +void acpi_db_prep_namestring(char *name); -struct acpi_namespace_node * -acpi_db_local_ns_lookup ( - char *name); +struct acpi_namespace_node *acpi_db_local_ns_lookup(char *name); -#endif /* __ACDEBUG_H__ */ +#endif /* __ACDEBUG_H__ */ diff --git a/include/acpi/acdisasm.h b/include/acpi/acdisasm.h index 26325430db8..3d96dcb1bb4 100644 --- a/include/acpi/acdisasm.h +++ b/include/acpi/acdisasm.h @@ -46,328 +46,219 @@ #include "amlresrc.h" - #define BLOCK_NONE 0 #define BLOCK_PAREN 1 #define BLOCK_BRACE 2 #define BLOCK_COMMA_LIST 4 -struct acpi_external_list -{ - char *path; - struct acpi_external_list *next; +struct acpi_external_list { + char *path; + struct acpi_external_list *next; }; -extern struct acpi_external_list *acpi_gbl_external_list; -extern const char *acpi_gbl_io_decode[2]; -extern const char *acpi_gbl_word_decode[4]; -extern const char *acpi_gbl_consume_decode[2]; -extern const char *acpi_gbl_min_decode[2]; -extern const char *acpi_gbl_max_decode[2]; -extern const char *acpi_gbl_DECdecode[2]; -extern const char *acpi_gbl_RNGdecode[4]; -extern const char *acpi_gbl_MEMdecode[4]; -extern const char *acpi_gbl_RWdecode[2]; -extern const char *acpi_gbl_irq_decode[2]; -extern const char *acpi_gbl_HEdecode[2]; -extern const char *acpi_gbl_LLdecode[2]; -extern const char *acpi_gbl_SHRdecode[2]; -extern const char *acpi_gbl_TYPdecode[4]; -extern const char *acpi_gbl_BMdecode[2]; -extern const char *acpi_gbl_SIZdecode[4]; -extern const char *acpi_gbl_TTPdecode[2]; -extern const char *acpi_gbl_MTPdecode[4]; -extern const char *acpi_gbl_TRSdecode[2]; - - -extern const char *acpi_gbl_lock_rule[ACPI_NUM_LOCK_RULES]; -extern const char *acpi_gbl_access_types[ACPI_NUM_ACCESS_TYPES]; -extern const char *acpi_gbl_update_rules[ACPI_NUM_UPDATE_RULES]; -extern const char *acpi_gbl_match_ops[ACPI_NUM_MATCH_OPS]; - - -struct acpi_op_walk_info -{ - u32 level; - u32 bit_offset; - struct acpi_walk_state *walk_state; +extern struct acpi_external_list *acpi_gbl_external_list; +extern const char *acpi_gbl_io_decode[2]; +extern const char *acpi_gbl_word_decode[4]; +extern const char *acpi_gbl_consume_decode[2]; +extern const char *acpi_gbl_min_decode[2]; +extern const char *acpi_gbl_max_decode[2]; +extern const char *acpi_gbl_DECdecode[2]; +extern const char *acpi_gbl_RNGdecode[4]; +extern const char *acpi_gbl_MEMdecode[4]; +extern const char *acpi_gbl_RWdecode[2]; +extern const char *acpi_gbl_irq_decode[2]; +extern const char *acpi_gbl_HEdecode[2]; +extern const char *acpi_gbl_LLdecode[2]; +extern const char *acpi_gbl_SHRdecode[2]; +extern const char *acpi_gbl_TYPdecode[4]; +extern const char *acpi_gbl_BMdecode[2]; +extern const char *acpi_gbl_SIZdecode[4]; +extern const char *acpi_gbl_TTPdecode[2]; +extern const char *acpi_gbl_MTPdecode[4]; +extern const char *acpi_gbl_TRSdecode[2]; + +extern const char *acpi_gbl_lock_rule[ACPI_NUM_LOCK_RULES]; +extern const char *acpi_gbl_access_types[ACPI_NUM_ACCESS_TYPES]; +extern const char *acpi_gbl_update_rules[ACPI_NUM_UPDATE_RULES]; +extern const char *acpi_gbl_match_ops[ACPI_NUM_MATCH_OPS]; + +struct acpi_op_walk_info { + u32 level; + u32 bit_offset; + struct acpi_walk_state *walk_state; }; typedef -acpi_status (*asl_walk_callback) ( - union acpi_parse_object *op, - u32 level, - void *context); - +acpi_status(*asl_walk_callback) (union acpi_parse_object * op, + u32 level, void *context); /* * dmwalk */ void -acpi_dm_disassemble ( - struct acpi_walk_state *walk_state, - union acpi_parse_object *origin, - u32 num_opcodes); - +acpi_dm_disassemble(struct acpi_walk_state *walk_state, + union acpi_parse_object *origin, u32 num_opcodes); /* * dmopcode */ void -acpi_dm_disassemble_one_op ( - struct acpi_walk_state *walk_state, - struct acpi_op_walk_info *info, - union acpi_parse_object *op); +acpi_dm_disassemble_one_op(struct acpi_walk_state *walk_state, + struct acpi_op_walk_info *info, + union acpi_parse_object *op); -void -acpi_dm_decode_internal_object ( - union acpi_operand_object *obj_desc); +void acpi_dm_decode_internal_object(union acpi_operand_object *obj_desc); -u32 -acpi_dm_list_type ( - union acpi_parse_object *op); +u32 acpi_dm_list_type(union acpi_parse_object *op); -void -acpi_dm_method_flags ( - union acpi_parse_object *op); - -void -acpi_dm_field_flags ( - union acpi_parse_object *op); +void acpi_dm_method_flags(union acpi_parse_object *op); -void -acpi_dm_address_space ( - u8 space_id); +void acpi_dm_field_flags(union acpi_parse_object *op); -void -acpi_dm_region_flags ( - union acpi_parse_object *op); +void acpi_dm_address_space(u8 space_id); -void -acpi_dm_match_op ( - union acpi_parse_object *op); +void acpi_dm_region_flags(union acpi_parse_object *op); -u8 -acpi_dm_comma_if_list_member ( - union acpi_parse_object *op); +void acpi_dm_match_op(union acpi_parse_object *op); -void -acpi_dm_comma_if_field_member ( - union acpi_parse_object *op); +u8 acpi_dm_comma_if_list_member(union acpi_parse_object *op); +void acpi_dm_comma_if_field_member(union acpi_parse_object *op); /* * dmnames */ -u32 -acpi_dm_dump_name ( - char *name); +u32 acpi_dm_dump_name(char *name); acpi_status -acpi_ps_display_object_pathname ( - struct acpi_walk_state *walk_state, - union acpi_parse_object *op); - -void -acpi_dm_namestring ( - char *name); +acpi_ps_display_object_pathname(struct acpi_walk_state *walk_state, + union acpi_parse_object *op); +void acpi_dm_namestring(char *name); /* * dmobject */ void -acpi_dm_display_internal_object ( - union acpi_operand_object *obj_desc, - struct acpi_walk_state *walk_state); +acpi_dm_display_internal_object(union acpi_operand_object *obj_desc, + struct acpi_walk_state *walk_state); -void -acpi_dm_display_arguments ( - struct acpi_walk_state *walk_state); +void acpi_dm_display_arguments(struct acpi_walk_state *walk_state); -void -acpi_dm_display_locals ( - struct acpi_walk_state *walk_state); +void acpi_dm_display_locals(struct acpi_walk_state *walk_state); void -acpi_dm_dump_method_info ( - acpi_status status, - struct acpi_walk_state *walk_state, - union acpi_parse_object *op); - +acpi_dm_dump_method_info(acpi_status status, + struct acpi_walk_state *walk_state, + union acpi_parse_object *op); /* * dmbuffer */ -void -acpi_dm_disasm_byte_list ( - u32 level, - u8 *byte_data, - u32 byte_count); +void acpi_dm_disasm_byte_list(u32 level, u8 * byte_data, u32 byte_count); void -acpi_dm_byte_list ( - struct acpi_op_walk_info *info, - union acpi_parse_object *op); +acpi_dm_byte_list(struct acpi_op_walk_info *info, union acpi_parse_object *op); -void -acpi_dm_is_eisa_id ( - union acpi_parse_object *op); +void acpi_dm_is_eisa_id(union acpi_parse_object *op); -void -acpi_dm_eisa_id ( - u32 encoded_id); - -u8 -acpi_dm_is_unicode_buffer ( - union acpi_parse_object *op); +void acpi_dm_eisa_id(u32 encoded_id); -u8 -acpi_dm_is_string_buffer ( - union acpi_parse_object *op); +u8 acpi_dm_is_unicode_buffer(union acpi_parse_object *op); +u8 acpi_dm_is_string_buffer(union acpi_parse_object *op); /* * dmresrc */ void -acpi_dm_resource_descriptor ( - struct acpi_op_walk_info *info, - u8 *byte_data, - u32 byte_count); +acpi_dm_resource_descriptor(struct acpi_op_walk_info *info, + u8 * byte_data, u32 byte_count); -u8 -acpi_dm_is_resource_descriptor ( - union acpi_parse_object *op); +u8 acpi_dm_is_resource_descriptor(union acpi_parse_object *op); -void -acpi_dm_indent ( - u32 level); +void acpi_dm_indent(u32 level); -void -acpi_dm_bit_list ( - u16 mask); - -void -acpi_dm_decode_attribute ( - u8 attribute); +void acpi_dm_bit_list(u16 mask); +void acpi_dm_decode_attribute(u8 attribute); /* * dmresrcl */ void -acpi_dm_word_descriptor ( - struct asl_word_address_desc *resource, - u32 length, - u32 level); +acpi_dm_word_descriptor(struct asl_word_address_desc *resource, + u32 length, u32 level); void -acpi_dm_dword_descriptor ( - struct asl_dword_address_desc *resource, - u32 length, - u32 level); +acpi_dm_dword_descriptor(struct asl_dword_address_desc *resource, + u32 length, u32 level); void -acpi_dm_extended_descriptor ( - struct asl_extended_address_desc *resource, - u32 length, - u32 level); +acpi_dm_extended_descriptor(struct asl_extended_address_desc *resource, + u32 length, u32 level); void -acpi_dm_qword_descriptor ( - struct asl_qword_address_desc *resource, - u32 length, - u32 level); +acpi_dm_qword_descriptor(struct asl_qword_address_desc *resource, + u32 length, u32 level); void -acpi_dm_memory24_descriptor ( - struct asl_memory_24_desc *resource, - u32 length, - u32 level); +acpi_dm_memory24_descriptor(struct asl_memory_24_desc *resource, + u32 length, u32 level); void -acpi_dm_memory32_descriptor ( - struct asl_memory_32_desc *resource, - u32 length, - u32 level); +acpi_dm_memory32_descriptor(struct asl_memory_32_desc *resource, + u32 length, u32 level); void -acpi_dm_fixed_mem32_descriptor ( - struct asl_fixed_memory_32_desc *resource, - u32 length, - u32 level); +acpi_dm_fixed_mem32_descriptor(struct asl_fixed_memory_32_desc *resource, + u32 length, u32 level); void -acpi_dm_generic_register_descriptor ( - struct asl_general_register_desc *resource, - u32 length, - u32 level); +acpi_dm_generic_register_descriptor(struct asl_general_register_desc *resource, + u32 length, u32 level); void -acpi_dm_interrupt_descriptor ( - struct asl_extended_xrupt_desc *resource, - u32 length, - u32 level); +acpi_dm_interrupt_descriptor(struct asl_extended_xrupt_desc *resource, + u32 length, u32 level); void -acpi_dm_vendor_large_descriptor ( - struct asl_large_vendor_desc *resource, - u32 length, - u32 level); - +acpi_dm_vendor_large_descriptor(struct asl_large_vendor_desc *resource, + u32 length, u32 level); /* * dmresrcs */ void -acpi_dm_irq_descriptor ( - struct asl_irq_format_desc *resource, - u32 length, - u32 level); +acpi_dm_irq_descriptor(struct asl_irq_format_desc *resource, + u32 length, u32 level); void -acpi_dm_dma_descriptor ( - struct asl_dma_format_desc *resource, - u32 length, - u32 level); +acpi_dm_dma_descriptor(struct asl_dma_format_desc *resource, + u32 length, u32 level); void -acpi_dm_io_descriptor ( - struct asl_io_port_desc *resource, - u32 length, - u32 level); +acpi_dm_io_descriptor(struct asl_io_port_desc *resource, u32 length, u32 level); void -acpi_dm_fixed_io_descriptor ( - struct asl_fixed_io_port_desc *resource, - u32 length, - u32 level); +acpi_dm_fixed_io_descriptor(struct asl_fixed_io_port_desc *resource, + u32 length, u32 level); void -acpi_dm_start_dependent_descriptor ( - struct asl_start_dependent_desc *resource, - u32 length, - u32 level); +acpi_dm_start_dependent_descriptor(struct asl_start_dependent_desc *resource, + u32 length, u32 level); void -acpi_dm_end_dependent_descriptor ( - struct asl_start_dependent_desc *resource, - u32 length, - u32 level); +acpi_dm_end_dependent_descriptor(struct asl_start_dependent_desc *resource, + u32 length, u32 level); void -acpi_dm_vendor_small_descriptor ( - struct asl_small_vendor_desc *resource, - u32 length, - u32 level); - +acpi_dm_vendor_small_descriptor(struct asl_small_vendor_desc *resource, + u32 length, u32 level); /* * dmutils */ -void -acpi_dm_add_to_external_list ( - char *path); +void acpi_dm_add_to_external_list(char *path); -#endif /* __ACDISASM_H__ */ +#endif /* __ACDISASM_H__ */ diff --git a/include/acpi/acdispat.h b/include/acpi/acdispat.h index 90b7d30bd25..59306186f5e 100644 --- a/include/acpi/acdispat.h +++ b/include/acpi/acdispat.h @@ -41,413 +41,305 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #ifndef _ACDISPAT_H_ #define _ACDISPAT_H_ - #define NAMEOF_LOCAL_NTE "__L0" #define NAMEOF_ARG_NTE "__A0" - /* * dsopcode - support for late evaluation */ acpi_status -acpi_ds_get_buffer_field_arguments ( - union acpi_operand_object *obj_desc); +acpi_ds_get_buffer_field_arguments(union acpi_operand_object *obj_desc); -acpi_status -acpi_ds_get_region_arguments ( - union acpi_operand_object *rgn_desc); +acpi_status acpi_ds_get_region_arguments(union acpi_operand_object *rgn_desc); -acpi_status -acpi_ds_get_buffer_arguments ( - union acpi_operand_object *obj_desc); +acpi_status acpi_ds_get_buffer_arguments(union acpi_operand_object *obj_desc); -acpi_status -acpi_ds_get_package_arguments ( - union acpi_operand_object *obj_desc); - -acpi_status -acpi_ds_eval_buffer_field_operands ( - struct acpi_walk_state *walk_state, - union acpi_parse_object *op); +acpi_status acpi_ds_get_package_arguments(union acpi_operand_object *obj_desc); acpi_status -acpi_ds_eval_region_operands ( - struct acpi_walk_state *walk_state, - union acpi_parse_object *op); +acpi_ds_eval_buffer_field_operands(struct acpi_walk_state *walk_state, + union acpi_parse_object *op); acpi_status -acpi_ds_eval_data_object_operands ( - struct acpi_walk_state *walk_state, - union acpi_parse_object *op, - union acpi_operand_object *obj_desc); +acpi_ds_eval_region_operands(struct acpi_walk_state *walk_state, + union acpi_parse_object *op); acpi_status -acpi_ds_initialize_region ( - acpi_handle obj_handle); +acpi_ds_eval_data_object_operands(struct acpi_walk_state *walk_state, + union acpi_parse_object *op, + union acpi_operand_object *obj_desc); +acpi_status acpi_ds_initialize_region(acpi_handle obj_handle); /* * dsctrl - Parser/Interpreter interface, control stack routines */ acpi_status -acpi_ds_exec_begin_control_op ( - struct acpi_walk_state *walk_state, - union acpi_parse_object *op); +acpi_ds_exec_begin_control_op(struct acpi_walk_state *walk_state, + union acpi_parse_object *op); acpi_status -acpi_ds_exec_end_control_op ( - struct acpi_walk_state *walk_state, - union acpi_parse_object *op); - +acpi_ds_exec_end_control_op(struct acpi_walk_state *walk_state, + union acpi_parse_object *op); /* * dsexec - Parser/Interpreter interface, method execution callbacks */ acpi_status -acpi_ds_get_predicate_value ( - struct acpi_walk_state *walk_state, - union acpi_operand_object *result_obj); +acpi_ds_get_predicate_value(struct acpi_walk_state *walk_state, + union acpi_operand_object *result_obj); acpi_status -acpi_ds_exec_begin_op ( - struct acpi_walk_state *walk_state, - union acpi_parse_object **out_op); - -acpi_status -acpi_ds_exec_end_op ( - struct acpi_walk_state *state); +acpi_ds_exec_begin_op(struct acpi_walk_state *walk_state, + union acpi_parse_object **out_op); +acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *state); /* * dsfield - Parser/Interpreter interface for AML fields */ acpi_status -acpi_ds_create_field ( - union acpi_parse_object *op, - struct acpi_namespace_node *region_node, - struct acpi_walk_state *walk_state); +acpi_ds_create_field(union acpi_parse_object *op, + struct acpi_namespace_node *region_node, + struct acpi_walk_state *walk_state); acpi_status -acpi_ds_create_bank_field ( - union acpi_parse_object *op, - struct acpi_namespace_node *region_node, - struct acpi_walk_state *walk_state); +acpi_ds_create_bank_field(union acpi_parse_object *op, + struct acpi_namespace_node *region_node, + struct acpi_walk_state *walk_state); acpi_status -acpi_ds_create_index_field ( - union acpi_parse_object *op, - struct acpi_namespace_node *region_node, - struct acpi_walk_state *walk_state); +acpi_ds_create_index_field(union acpi_parse_object *op, + struct acpi_namespace_node *region_node, + struct acpi_walk_state *walk_state); acpi_status -acpi_ds_create_buffer_field ( - union acpi_parse_object *op, - struct acpi_walk_state *walk_state); +acpi_ds_create_buffer_field(union acpi_parse_object *op, + struct acpi_walk_state *walk_state); acpi_status -acpi_ds_init_field_objects ( - union acpi_parse_object *op, - struct acpi_walk_state *walk_state); - +acpi_ds_init_field_objects(union acpi_parse_object *op, + struct acpi_walk_state *walk_state); /* * dsload - Parser/Interpreter interface, namespace load callbacks */ acpi_status -acpi_ds_load1_begin_op ( - struct acpi_walk_state *walk_state, - union acpi_parse_object **out_op); +acpi_ds_load1_begin_op(struct acpi_walk_state *walk_state, + union acpi_parse_object **out_op); -acpi_status -acpi_ds_load1_end_op ( - struct acpi_walk_state *walk_state); +acpi_status acpi_ds_load1_end_op(struct acpi_walk_state *walk_state); acpi_status -acpi_ds_load2_begin_op ( - struct acpi_walk_state *walk_state, - union acpi_parse_object **out_op); +acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state, + union acpi_parse_object **out_op); -acpi_status -acpi_ds_load2_end_op ( - struct acpi_walk_state *walk_state); +acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state); acpi_status -acpi_ds_init_callbacks ( - struct acpi_walk_state *walk_state, - u32 pass_number); - +acpi_ds_init_callbacks(struct acpi_walk_state *walk_state, u32 pass_number); /* * dsmthdat - method data (locals/args) */ acpi_status -acpi_ds_store_object_to_local ( - u16 opcode, - u32 index, - union acpi_operand_object *src_desc, - struct acpi_walk_state *walk_state); +acpi_ds_store_object_to_local(u16 opcode, + u32 index, + union acpi_operand_object *src_desc, + struct acpi_walk_state *walk_state); acpi_status -acpi_ds_method_data_get_entry ( - u16 opcode, - u32 index, - struct acpi_walk_state *walk_state, - union acpi_operand_object ***node); +acpi_ds_method_data_get_entry(u16 opcode, + u32 index, + struct acpi_walk_state *walk_state, + union acpi_operand_object ***node); -void -acpi_ds_method_data_delete_all ( - struct acpi_walk_state *walk_state); +void acpi_ds_method_data_delete_all(struct acpi_walk_state *walk_state); -u8 -acpi_ds_is_method_value ( - union acpi_operand_object *obj_desc); +u8 acpi_ds_is_method_value(union acpi_operand_object *obj_desc); acpi_status -acpi_ds_method_data_get_value ( - u16 opcode, - u32 index, - struct acpi_walk_state *walk_state, - union acpi_operand_object **dest_desc); +acpi_ds_method_data_get_value(u16 opcode, + u32 index, + struct acpi_walk_state *walk_state, + union acpi_operand_object **dest_desc); acpi_status -acpi_ds_method_data_init_args ( - union acpi_operand_object **params, - u32 max_param_count, - struct acpi_walk_state *walk_state); +acpi_ds_method_data_init_args(union acpi_operand_object **params, + u32 max_param_count, + struct acpi_walk_state *walk_state); acpi_status -acpi_ds_method_data_get_node ( - u16 opcode, - u32 index, - struct acpi_walk_state *walk_state, - struct acpi_namespace_node **node); - -void -acpi_ds_method_data_init ( - struct acpi_walk_state *walk_state); +acpi_ds_method_data_get_node(u16 opcode, + u32 index, + struct acpi_walk_state *walk_state, + struct acpi_namespace_node **node); +void acpi_ds_method_data_init(struct acpi_walk_state *walk_state); /* * dsmethod - Parser/Interpreter interface - control method parsing */ -acpi_status -acpi_ds_parse_method ( - struct acpi_namespace_node *node); +acpi_status acpi_ds_parse_method(struct acpi_namespace_node *node); acpi_status -acpi_ds_call_control_method ( - struct acpi_thread_state *thread, - struct acpi_walk_state *walk_state, - union acpi_parse_object *op); +acpi_ds_call_control_method(struct acpi_thread_state *thread, + struct acpi_walk_state *walk_state, + union acpi_parse_object *op); acpi_status -acpi_ds_restart_control_method ( - struct acpi_walk_state *walk_state, - union acpi_operand_object *return_desc); +acpi_ds_restart_control_method(struct acpi_walk_state *walk_state, + union acpi_operand_object *return_desc); acpi_status -acpi_ds_terminate_control_method ( - struct acpi_walk_state *walk_state); +acpi_ds_terminate_control_method(struct acpi_walk_state *walk_state); acpi_status -acpi_ds_begin_method_execution ( - struct acpi_namespace_node *method_node, - union acpi_operand_object *obj_desc, - struct acpi_namespace_node *calling_method_node); - +acpi_ds_begin_method_execution(struct acpi_namespace_node *method_node, + union acpi_operand_object *obj_desc, + struct acpi_namespace_node *calling_method_node); /* * dsinit */ acpi_status -acpi_ds_initialize_objects ( - struct acpi_table_desc *table_desc, - struct acpi_namespace_node *start_node); - +acpi_ds_initialize_objects(struct acpi_table_desc *table_desc, + struct acpi_namespace_node *start_node); /* * dsobject - Parser/Interpreter interface - object initialization and conversion */ acpi_status -acpi_ds_build_internal_buffer_obj ( - struct acpi_walk_state *walk_state, - union acpi_parse_object *op, - u32 buffer_length, - union acpi_operand_object **obj_desc_ptr); +acpi_ds_build_internal_buffer_obj(struct acpi_walk_state *walk_state, + union acpi_parse_object *op, + u32 buffer_length, + union acpi_operand_object **obj_desc_ptr); acpi_status -acpi_ds_build_internal_package_obj ( - struct acpi_walk_state *walk_state, - union acpi_parse_object *op, - u32 package_length, - union acpi_operand_object **obj_desc); +acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state, + union acpi_parse_object *op, + u32 package_length, + union acpi_operand_object **obj_desc); acpi_status -acpi_ds_init_object_from_op ( - struct acpi_walk_state *walk_state, - union acpi_parse_object *op, - u16 opcode, - union acpi_operand_object **obj_desc); +acpi_ds_init_object_from_op(struct acpi_walk_state *walk_state, + union acpi_parse_object *op, + u16 opcode, union acpi_operand_object **obj_desc); acpi_status -acpi_ds_create_node ( - struct acpi_walk_state *walk_state, - struct acpi_namespace_node *node, - union acpi_parse_object *op); - +acpi_ds_create_node(struct acpi_walk_state *walk_state, + struct acpi_namespace_node *node, + union acpi_parse_object *op); /* * dsutils - Parser/Interpreter interface utility routines */ -void -acpi_ds_clear_implicit_return ( - struct acpi_walk_state *walk_state); +void acpi_ds_clear_implicit_return(struct acpi_walk_state *walk_state); u8 -acpi_ds_do_implicit_return ( - union acpi_operand_object *return_desc, - struct acpi_walk_state *walk_state, - u8 add_reference); +acpi_ds_do_implicit_return(union acpi_operand_object *return_desc, + struct acpi_walk_state *walk_state, + u8 add_reference); u8 -acpi_ds_is_result_used ( - union acpi_parse_object *op, - struct acpi_walk_state *walk_state); +acpi_ds_is_result_used(union acpi_parse_object *op, + struct acpi_walk_state *walk_state); void -acpi_ds_delete_result_if_not_used ( - union acpi_parse_object *op, - union acpi_operand_object *result_obj, - struct acpi_walk_state *walk_state); - -acpi_status -acpi_ds_create_operand ( - struct acpi_walk_state *walk_state, - union acpi_parse_object *arg, - u32 args_remaining); +acpi_ds_delete_result_if_not_used(union acpi_parse_object *op, + union acpi_operand_object *result_obj, + struct acpi_walk_state *walk_state); acpi_status -acpi_ds_create_operands ( - struct acpi_walk_state *walk_state, - union acpi_parse_object *first_arg); +acpi_ds_create_operand(struct acpi_walk_state *walk_state, + union acpi_parse_object *arg, u32 args_remaining); acpi_status -acpi_ds_resolve_operands ( - struct acpi_walk_state *walk_state); +acpi_ds_create_operands(struct acpi_walk_state *walk_state, + union acpi_parse_object *first_arg); -void -acpi_ds_clear_operands ( - struct acpi_walk_state *walk_state); +acpi_status acpi_ds_resolve_operands(struct acpi_walk_state *walk_state); +void acpi_ds_clear_operands(struct acpi_walk_state *walk_state); /* * dswscope - Scope Stack manipulation */ acpi_status -acpi_ds_scope_stack_push ( - struct acpi_namespace_node *node, - acpi_object_type type, - struct acpi_walk_state *walk_state); +acpi_ds_scope_stack_push(struct acpi_namespace_node *node, + acpi_object_type type, + struct acpi_walk_state *walk_state); +acpi_status acpi_ds_scope_stack_pop(struct acpi_walk_state *walk_state); -acpi_status -acpi_ds_scope_stack_pop ( - struct acpi_walk_state *walk_state); - -void -acpi_ds_scope_stack_clear ( - struct acpi_walk_state *walk_state); - +void acpi_ds_scope_stack_clear(struct acpi_walk_state *walk_state); /* * dswstate - parser WALK_STATE management routines */ acpi_status -acpi_ds_obj_stack_push ( - void *object, - struct acpi_walk_state *walk_state); +acpi_ds_obj_stack_push(void *object, struct acpi_walk_state *walk_state); acpi_status -acpi_ds_obj_stack_pop ( - u32 pop_count, - struct acpi_walk_state *walk_state); +acpi_ds_obj_stack_pop(u32 pop_count, struct acpi_walk_state *walk_state); -struct acpi_walk_state * -acpi_ds_create_walk_state ( - acpi_owner_id owner_id, - union acpi_parse_object *origin, - union acpi_operand_object *mth_desc, - struct acpi_thread_state *thread); +struct acpi_walk_state *acpi_ds_create_walk_state(acpi_owner_id owner_id, + union acpi_parse_object + *origin, + union acpi_operand_object + *mth_desc, + struct acpi_thread_state + *thread); acpi_status -acpi_ds_init_aml_walk ( - struct acpi_walk_state *walk_state, - union acpi_parse_object *op, - struct acpi_namespace_node *method_node, - u8 *aml_start, - u32 aml_length, - struct acpi_parameter_info *info, - u8 pass_number); +acpi_ds_init_aml_walk(struct acpi_walk_state *walk_state, + union acpi_parse_object *op, + struct acpi_namespace_node *method_node, + u8 * aml_start, + u32 aml_length, + struct acpi_parameter_info *info, u8 pass_number); acpi_status -acpi_ds_obj_stack_pop_and_delete ( - u32 pop_count, - struct acpi_walk_state *walk_state); +acpi_ds_obj_stack_pop_and_delete(u32 pop_count, + struct acpi_walk_state *walk_state); -void -acpi_ds_delete_walk_state ( - struct acpi_walk_state *walk_state); +void acpi_ds_delete_walk_state(struct acpi_walk_state *walk_state); -struct acpi_walk_state * -acpi_ds_pop_walk_state ( - struct acpi_thread_state *thread); +struct acpi_walk_state *acpi_ds_pop_walk_state(struct acpi_thread_state + *thread); void -acpi_ds_push_walk_state ( - struct acpi_walk_state *walk_state, - struct acpi_thread_state *thread); +acpi_ds_push_walk_state(struct acpi_walk_state *walk_state, + struct acpi_thread_state *thread); -acpi_status -acpi_ds_result_stack_pop ( - struct acpi_walk_state *walk_state); +acpi_status acpi_ds_result_stack_pop(struct acpi_walk_state *walk_state); -acpi_status -acpi_ds_result_stack_push ( - struct acpi_walk_state *walk_state); +acpi_status acpi_ds_result_stack_push(struct acpi_walk_state *walk_state); -acpi_status -acpi_ds_result_stack_clear ( - struct acpi_walk_state *walk_state); +acpi_status acpi_ds_result_stack_clear(struct acpi_walk_state *walk_state); -struct acpi_walk_state * -acpi_ds_get_current_walk_state ( - struct acpi_thread_state *thread); +struct acpi_walk_state *acpi_ds_get_current_walk_state(struct acpi_thread_state + *thread); #ifdef ACPI_FUTURE_USAGE acpi_status -acpi_ds_result_remove ( - union acpi_operand_object **object, - u32 index, - struct acpi_walk_state *walk_state); +acpi_ds_result_remove(union acpi_operand_object **object, + u32 index, struct acpi_walk_state *walk_state); #endif acpi_status -acpi_ds_result_pop ( - union acpi_operand_object **object, - struct acpi_walk_state *walk_state); +acpi_ds_result_pop(union acpi_operand_object **object, + struct acpi_walk_state *walk_state); acpi_status -acpi_ds_result_push ( - union acpi_operand_object *object, - struct acpi_walk_state *walk_state); +acpi_ds_result_push(union acpi_operand_object *object, + struct acpi_walk_state *walk_state); acpi_status -acpi_ds_result_pop_from_bottom ( - union acpi_operand_object **object, - struct acpi_walk_state *walk_state); +acpi_ds_result_pop_from_bottom(union acpi_operand_object **object, + struct acpi_walk_state *walk_state); -#endif /* _ACDISPAT_H_ */ +#endif /* _ACDISPAT_H_ */ diff --git a/include/acpi/acevents.h b/include/acpi/acevents.h index 33ae2ca997b..bfa54600ecd 100644 --- a/include/acpi/acevents.h +++ b/include/acpi/acevents.h @@ -44,249 +44,167 @@ #ifndef __ACEVENTS_H__ #define __ACEVENTS_H__ - /* * evevent */ -acpi_status -acpi_ev_initialize_events ( - void); +acpi_status acpi_ev_initialize_events(void); -acpi_status -acpi_ev_install_xrupt_handlers ( - void); - -u32 -acpi_ev_fixed_event_detect ( - void); +acpi_status acpi_ev_install_xrupt_handlers(void); +u32 acpi_ev_fixed_event_detect(void); /* * evmisc */ -u8 -acpi_ev_is_notify_object ( - struct acpi_namespace_node *node); +u8 acpi_ev_is_notify_object(struct acpi_namespace_node *node); -acpi_status -acpi_ev_acquire_global_lock( - u16 timeout); +acpi_status acpi_ev_acquire_global_lock(u16 timeout); -acpi_status -acpi_ev_release_global_lock( - void); +acpi_status acpi_ev_release_global_lock(void); -acpi_status -acpi_ev_init_global_lock_handler ( - void); +acpi_status acpi_ev_init_global_lock_handler(void); -u32 -acpi_ev_get_gpe_number_index ( - u32 gpe_number); +u32 acpi_ev_get_gpe_number_index(u32 gpe_number); acpi_status -acpi_ev_queue_notify_request ( - struct acpi_namespace_node *node, - u32 notify_value); - +acpi_ev_queue_notify_request(struct acpi_namespace_node *node, + u32 notify_value); /* * evgpe - GPE handling and dispatch */ acpi_status -acpi_ev_update_gpe_enable_masks ( - struct acpi_gpe_event_info *gpe_event_info, - u8 type); +acpi_ev_update_gpe_enable_masks(struct acpi_gpe_event_info *gpe_event_info, + u8 type); acpi_status -acpi_ev_enable_gpe ( - struct acpi_gpe_event_info *gpe_event_info, - u8 write_to_hardware); +acpi_ev_enable_gpe(struct acpi_gpe_event_info *gpe_event_info, + u8 write_to_hardware); -acpi_status -acpi_ev_disable_gpe ( - struct acpi_gpe_event_info *gpe_event_info); - -struct acpi_gpe_event_info * -acpi_ev_get_gpe_event_info ( - acpi_handle gpe_device, - u32 gpe_number); +acpi_status acpi_ev_disable_gpe(struct acpi_gpe_event_info *gpe_event_info); +struct acpi_gpe_event_info *acpi_ev_get_gpe_event_info(acpi_handle gpe_device, + u32 gpe_number); /* * evgpeblk */ -u8 -acpi_ev_valid_gpe_event ( - struct acpi_gpe_event_info *gpe_event_info); - -acpi_status -acpi_ev_walk_gpe_list ( - ACPI_GPE_CALLBACK gpe_walk_callback); +u8 acpi_ev_valid_gpe_event(struct acpi_gpe_event_info *gpe_event_info); -acpi_status -acpi_ev_delete_gpe_handlers ( - struct acpi_gpe_xrupt_info *gpe_xrupt_info, - struct acpi_gpe_block_info *gpe_block); +acpi_status acpi_ev_walk_gpe_list(ACPI_GPE_CALLBACK gpe_walk_callback); acpi_status -acpi_ev_create_gpe_block ( - struct acpi_namespace_node *gpe_device, - struct acpi_generic_address *gpe_block_address, - u32 register_count, - u8 gpe_block_base_number, - u32 interrupt_number, - struct acpi_gpe_block_info **return_gpe_block); +acpi_ev_delete_gpe_handlers(struct acpi_gpe_xrupt_info *gpe_xrupt_info, + struct acpi_gpe_block_info *gpe_block); acpi_status -acpi_ev_delete_gpe_block ( - struct acpi_gpe_block_info *gpe_block); +acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device, + struct acpi_generic_address *gpe_block_address, + u32 register_count, + u8 gpe_block_base_number, + u32 interrupt_number, + struct acpi_gpe_block_info **return_gpe_block); -u32 -acpi_ev_gpe_dispatch ( - struct acpi_gpe_event_info *gpe_event_info, - u32 gpe_number); +acpi_status acpi_ev_delete_gpe_block(struct acpi_gpe_block_info *gpe_block); u32 -acpi_ev_gpe_detect ( - struct acpi_gpe_xrupt_info *gpe_xrupt_list); +acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, + u32 gpe_number); -acpi_status -acpi_ev_set_gpe_type ( - struct acpi_gpe_event_info *gpe_event_info, - u8 type); +u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info *gpe_xrupt_list); acpi_status -acpi_ev_check_for_wake_only_gpe ( - struct acpi_gpe_event_info *gpe_event_info); +acpi_ev_set_gpe_type(struct acpi_gpe_event_info *gpe_event_info, u8 type); acpi_status -acpi_ev_gpe_initialize ( - void); +acpi_ev_check_for_wake_only_gpe(struct acpi_gpe_event_info *gpe_event_info); +acpi_status acpi_ev_gpe_initialize(void); /* * evregion - Address Space handling */ -acpi_status -acpi_ev_install_region_handlers ( - void); +acpi_status acpi_ev_install_region_handlers(void); -acpi_status -acpi_ev_initialize_op_regions ( - void); +acpi_status acpi_ev_initialize_op_regions(void); acpi_status -acpi_ev_address_space_dispatch ( - union acpi_operand_object *region_obj, - u32 function, - acpi_physical_address address, - u32 bit_width, - void *value); +acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, + u32 function, + acpi_physical_address address, + u32 bit_width, void *value); acpi_status -acpi_ev_attach_region ( - union acpi_operand_object *handler_obj, - union acpi_operand_object *region_obj, - u8 acpi_ns_is_locked); +acpi_ev_attach_region(union acpi_operand_object *handler_obj, + union acpi_operand_object *region_obj, + u8 acpi_ns_is_locked); void -acpi_ev_detach_region ( - union acpi_operand_object *region_obj, - u8 acpi_ns_is_locked); +acpi_ev_detach_region(union acpi_operand_object *region_obj, + u8 acpi_ns_is_locked); acpi_status -acpi_ev_install_space_handler ( - struct acpi_namespace_node *node, - acpi_adr_space_type space_id, - acpi_adr_space_handler handler, - acpi_adr_space_setup setup, - void *context); +acpi_ev_install_space_handler(struct acpi_namespace_node *node, + acpi_adr_space_type space_id, + acpi_adr_space_handler handler, + acpi_adr_space_setup setup, void *context); acpi_status -acpi_ev_execute_reg_methods ( - struct acpi_namespace_node *node, - acpi_adr_space_type space_id); +acpi_ev_execute_reg_methods(struct acpi_namespace_node *node, + acpi_adr_space_type space_id); acpi_status -acpi_ev_execute_reg_method ( - union acpi_operand_object *region_obj, - u32 function); - +acpi_ev_execute_reg_method(union acpi_operand_object *region_obj, u32 function); /* * evregini - Region initialization and setup */ acpi_status -acpi_ev_system_memory_region_setup ( - acpi_handle handle, - u32 function, - void *handler_context, - void **region_context); +acpi_ev_system_memory_region_setup(acpi_handle handle, + u32 function, + void *handler_context, + void **region_context); acpi_status -acpi_ev_io_space_region_setup ( - acpi_handle handle, - u32 function, - void *handler_context, - void **region_context); +acpi_ev_io_space_region_setup(acpi_handle handle, + u32 function, + void *handler_context, void **region_context); acpi_status -acpi_ev_pci_config_region_setup ( - acpi_handle handle, - u32 function, - void *handler_context, - void **region_context); +acpi_ev_pci_config_region_setup(acpi_handle handle, + u32 function, + void *handler_context, void **region_context); acpi_status -acpi_ev_cmos_region_setup ( - acpi_handle handle, - u32 function, - void *handler_context, - void **region_context); +acpi_ev_cmos_region_setup(acpi_handle handle, + u32 function, + void *handler_context, void **region_context); acpi_status -acpi_ev_pci_bar_region_setup ( - acpi_handle handle, - u32 function, - void *handler_context, - void **region_context); +acpi_ev_pci_bar_region_setup(acpi_handle handle, + u32 function, + void *handler_context, void **region_context); acpi_status -acpi_ev_default_region_setup ( - acpi_handle handle, - u32 function, - void *handler_context, - void **region_context); +acpi_ev_default_region_setup(acpi_handle handle, + u32 function, + void *handler_context, void **region_context); acpi_status -acpi_ev_initialize_region ( - union acpi_operand_object *region_obj, - u8 acpi_ns_locked); - +acpi_ev_initialize_region(union acpi_operand_object *region_obj, + u8 acpi_ns_locked); /* * evsci - SCI (System Control Interrupt) handling/dispatch */ -u32 ACPI_SYSTEM_XFACE -acpi_ev_gpe_xrupt_handler ( - void *context); - -u32 -acpi_ev_install_sci_handler ( - void); +u32 ACPI_SYSTEM_XFACE acpi_ev_gpe_xrupt_handler(void *context); -acpi_status -acpi_ev_remove_sci_handler ( - void); +u32 acpi_ev_install_sci_handler(void); -u32 -acpi_ev_initialize_sCI ( - u32 program_sCI); +acpi_status acpi_ev_remove_sci_handler(void); -void -acpi_ev_terminate ( - void); +u32 acpi_ev_initialize_sCI(u32 program_sCI); +void acpi_ev_terminate(void); -#endif /* __ACEVENTS_H__ */ +#endif /* __ACEVENTS_H__ */ diff --git a/include/acpi/acexcep.h b/include/acpi/acexcep.h index 0a6f492f3c8..4f005eb6592 100644 --- a/include/acpi/acexcep.h +++ b/include/acpi/acexcep.h @@ -44,7 +44,6 @@ #ifndef __ACEXCEP_H__ #define __ACEXCEP_H__ - /* * Exceptions returned by external ACPI interfaces */ @@ -55,11 +54,9 @@ #define AE_CODE_CONTROL 0x4000 #define AE_CODE_MASK 0xF000 - #define ACPI_SUCCESS(a) (!(a)) #define ACPI_FAILURE(a) (a) - #define AE_OK (acpi_status) 0x0000 /* @@ -99,7 +96,6 @@ #define AE_CODE_ENV_MAX 0x001F - /* * Programmer exceptions */ @@ -115,7 +111,6 @@ #define AE_CODE_PGM_MAX 0x0009 - /* * Acpi table exceptions */ @@ -128,7 +123,6 @@ #define AE_CODE_TBL_MAX 0x0006 - /* * AML exceptions. These are caused by problems with * the actual AML byte stream @@ -169,7 +163,6 @@ #define AE_CODE_AML_MAX 0x0021 - /* * Internal exceptions used for control */ @@ -187,16 +180,13 @@ #define AE_CODE_CTRL_MAX 0x000B - #ifdef DEFINE_ACPI_GLOBALS - /* * String versions of the exception codes above * These strings must match the corresponding defines exactly */ -char const *acpi_gbl_exception_names_env[] = -{ +char const *acpi_gbl_exception_names_env[] = { "AE_OK", "AE_ERROR", "AE_NO_ACPI_TABLES", @@ -231,8 +221,7 @@ char const *acpi_gbl_exception_names_env[] = "AE_OWNER_ID_LIMIT" }; -char const *acpi_gbl_exception_names_pgm[] = -{ +char const *acpi_gbl_exception_names_pgm[] = { "AE_BAD_PARAMETER", "AE_BAD_CHARACTER", "AE_BAD_PATHNAME", @@ -244,8 +233,7 @@ char const *acpi_gbl_exception_names_pgm[] = "AE_BAD_DECIMAL_CONSTANT" }; -char const *acpi_gbl_exception_names_tbl[] = -{ +char const *acpi_gbl_exception_names_tbl[] = { "AE_BAD_SIGNATURE", "AE_BAD_HEADER", "AE_BAD_CHECKSUM", @@ -254,8 +242,7 @@ char const *acpi_gbl_exception_names_tbl[] = "AE_INVALID_TABLE_LENGTH" }; -char const *acpi_gbl_exception_names_aml[] = -{ +char const *acpi_gbl_exception_names_aml[] = { "AE_AML_ERROR", "AE_AML_PARSE", "AE_AML_BAD_OPCODE", @@ -291,8 +278,7 @@ char const *acpi_gbl_exception_names_aml[] = "AE_AML_BAD_RESOURCE_LENGTH" }; -char const *acpi_gbl_exception_names_ctrl[] = -{ +char const *acpi_gbl_exception_names_ctrl[] = { "AE_CTRL_RETURN_VALUE", "AE_CTRL_PENDING", "AE_CTRL_TERMINATE", @@ -306,6 +292,6 @@ char const *acpi_gbl_exception_names_ctrl[] = "AE_CTRL_SKIP" }; -#endif /* ACPI GLOBALS */ +#endif /* ACPI GLOBALS */ -#endif /* __ACEXCEP_H__ */ +#endif /* __ACEXCEP_H__ */ diff --git a/include/acpi/acglobal.h b/include/acpi/acglobal.h index e3cf16eadbe..e9c2790139e 100644 --- a/include/acpi/acglobal.h +++ b/include/acpi/acglobal.h @@ -44,7 +44,6 @@ #ifndef __ACGLOBAL_H__ #define __ACGLOBAL_H__ - /* * Ensure that the globals are actually defined and initialized only once. * @@ -63,9 +62,8 @@ * Keep local copies of these FADT-based registers. NOTE: These globals * are first in this file for alignment reasons on 64-bit systems. */ -ACPI_EXTERN struct acpi_generic_address acpi_gbl_xpm1a_enable; -ACPI_EXTERN struct acpi_generic_address acpi_gbl_xpm1b_enable; - +ACPI_EXTERN struct acpi_generic_address acpi_gbl_xpm1a_enable; +ACPI_EXTERN struct acpi_generic_address acpi_gbl_xpm1b_enable; /***************************************************************************** * @@ -75,13 +73,12 @@ ACPI_EXTERN struct acpi_generic_address acpi_gbl_xpm1b_enable; /* Runtime configuration of debug print levels */ -extern u32 acpi_dbg_level; -extern u32 acpi_dbg_layer; +extern u32 acpi_dbg_level; +extern u32 acpi_dbg_layer; /* Procedure nesting level for debug output */ -extern u32 acpi_gbl_nesting_level; - +extern u32 acpi_gbl_nesting_level; /***************************************************************************** * @@ -98,7 +95,7 @@ extern u32 acpi_gbl_nesting_level; * 3) Allow access to uninitialized locals/args (auto-init to integer 0) * 4) Allow ANY object type to be a source operand for the Store() operator */ -ACPI_EXTERN u8 ACPI_INIT_GLOBAL (acpi_gbl_enable_interpreter_slack, FALSE); +ACPI_EXTERN u8 ACPI_INIT_GLOBAL(acpi_gbl_enable_interpreter_slack, FALSE); /* * Automatically serialize ALL control methods? Default is FALSE, meaning @@ -106,22 +103,21 @@ ACPI_EXTERN u8 ACPI_INIT_GLOBAL (acpi_gbl_enable_interpreter_slack, FALSE) * Only change this if the ASL code is poorly written and cannot handle * reentrancy even though methods are marked "not_serialized". */ -ACPI_EXTERN u8 ACPI_INIT_GLOBAL (acpi_gbl_all_methods_serialized, FALSE); +ACPI_EXTERN u8 ACPI_INIT_GLOBAL(acpi_gbl_all_methods_serialized, FALSE); /* * Create the predefined _OSI method in the namespace? Default is TRUE * because ACPI CA is fully compatible with other ACPI implementations. * Changing this will revert ACPI CA (and machine ASL) to pre-OSI behavior. */ -ACPI_EXTERN u8 ACPI_INIT_GLOBAL (acpi_gbl_create_osi_method, TRUE); +ACPI_EXTERN u8 ACPI_INIT_GLOBAL(acpi_gbl_create_osi_method, TRUE); /* * Disable wakeup GPEs during runtime? Default is TRUE because WAKE and * RUNTIME GPEs should never be shared, and WAKE GPEs should typically only * be enabled just before going to sleep. */ -ACPI_EXTERN u8 ACPI_INIT_GLOBAL (acpi_gbl_leave_wake_gpes_disabled, TRUE); - +ACPI_EXTERN u8 ACPI_INIT_GLOBAL(acpi_gbl_leave_wake_gpes_disabled, TRUE); /***************************************************************************** * @@ -137,49 +133,46 @@ ACPI_EXTERN u8 ACPI_INIT_GLOBAL (acpi_gbl_leave_wake_gpes_disabled, TRUE); * These tables are single-table only; meaning that there can be at most one * of each in the system. Each global points to the actual table. */ -ACPI_EXTERN u32 acpi_gbl_table_flags; -ACPI_EXTERN u32 acpi_gbl_rsdt_table_count; -ACPI_EXTERN struct rsdp_descriptor *acpi_gbl_RSDP; -ACPI_EXTERN XSDT_DESCRIPTOR *acpi_gbl_XSDT; -ACPI_EXTERN FADT_DESCRIPTOR *acpi_gbl_FADT; -ACPI_EXTERN struct acpi_table_header *acpi_gbl_DSDT; -ACPI_EXTERN FACS_DESCRIPTOR *acpi_gbl_FACS; -ACPI_EXTERN struct acpi_common_facs acpi_gbl_common_fACS; +ACPI_EXTERN u32 acpi_gbl_table_flags; +ACPI_EXTERN u32 acpi_gbl_rsdt_table_count; +ACPI_EXTERN struct rsdp_descriptor *acpi_gbl_RSDP; +ACPI_EXTERN XSDT_DESCRIPTOR *acpi_gbl_XSDT; +ACPI_EXTERN FADT_DESCRIPTOR *acpi_gbl_FADT; +ACPI_EXTERN struct acpi_table_header *acpi_gbl_DSDT; +ACPI_EXTERN FACS_DESCRIPTOR *acpi_gbl_FACS; +ACPI_EXTERN struct acpi_common_facs acpi_gbl_common_fACS; /* * Since there may be multiple SSDTs and PSDTs, a single pointer is not * sufficient; Therefore, there isn't one! */ - /* The root table can be either an RSDT or an XSDT */ -ACPI_EXTERN u8 acpi_gbl_root_table_type; +ACPI_EXTERN u8 acpi_gbl_root_table_type; #define ACPI_TABLE_TYPE_RSDT 'R' #define ACPI_TABLE_TYPE_XSDT 'X' - /* * Handle both ACPI 1.0 and ACPI 2.0 Integer widths: * If we are executing a method that exists in a 32-bit ACPI table, * use only the lower 32 bits of the (internal) 64-bit Integer. */ -ACPI_EXTERN u8 acpi_gbl_integer_bit_width; -ACPI_EXTERN u8 acpi_gbl_integer_byte_width; -ACPI_EXTERN u8 acpi_gbl_integer_nybble_width; +ACPI_EXTERN u8 acpi_gbl_integer_bit_width; +ACPI_EXTERN u8 acpi_gbl_integer_byte_width; +ACPI_EXTERN u8 acpi_gbl_integer_nybble_width; /* * ACPI Table info arrays */ -extern struct acpi_table_list acpi_gbl_table_lists[NUM_ACPI_TABLE_TYPES]; -extern struct acpi_table_support acpi_gbl_table_data[NUM_ACPI_TABLE_TYPES]; +extern struct acpi_table_list acpi_gbl_table_lists[NUM_ACPI_TABLE_TYPES]; +extern struct acpi_table_support acpi_gbl_table_data[NUM_ACPI_TABLE_TYPES]; /* * Predefined mutex objects. This array contains the * actual OS mutex handles, indexed by the local ACPI_MUTEX_HANDLEs. * (The table maps local handles to the real OS handles) */ -ACPI_EXTERN struct acpi_mutex_info acpi_gbl_mutex_info[NUM_MUTEX]; - +ACPI_EXTERN struct acpi_mutex_info acpi_gbl_mutex_info[NUM_MUTEX]; /***************************************************************************** * @@ -191,53 +184,52 @@ ACPI_EXTERN struct acpi_mutex_info acpi_gbl_mutex_info[NUM_MUTEX]; /* Lists for tracking memory allocations */ -ACPI_EXTERN struct acpi_memory_list *acpi_gbl_global_list; -ACPI_EXTERN struct acpi_memory_list *acpi_gbl_ns_node_list; +ACPI_EXTERN struct acpi_memory_list *acpi_gbl_global_list; +ACPI_EXTERN struct acpi_memory_list *acpi_gbl_ns_node_list; #endif /* Object caches */ -ACPI_EXTERN acpi_cache_t *acpi_gbl_state_cache; -ACPI_EXTERN acpi_cache_t *acpi_gbl_ps_node_cache; -ACPI_EXTERN acpi_cache_t *acpi_gbl_ps_node_ext_cache; -ACPI_EXTERN acpi_cache_t *acpi_gbl_operand_cache; +ACPI_EXTERN acpi_cache_t *acpi_gbl_state_cache; +ACPI_EXTERN acpi_cache_t *acpi_gbl_ps_node_cache; +ACPI_EXTERN acpi_cache_t *acpi_gbl_ps_node_ext_cache; +ACPI_EXTERN acpi_cache_t *acpi_gbl_operand_cache; /* Global handlers */ -ACPI_EXTERN struct acpi_object_notify_handler acpi_gbl_device_notify; -ACPI_EXTERN struct acpi_object_notify_handler acpi_gbl_system_notify; -ACPI_EXTERN acpi_exception_handler acpi_gbl_exception_handler; -ACPI_EXTERN acpi_init_handler acpi_gbl_init_handler; -ACPI_EXTERN struct acpi_walk_state *acpi_gbl_breakpoint_walk; -ACPI_EXTERN acpi_handle acpi_gbl_global_lock_semaphore; +ACPI_EXTERN struct acpi_object_notify_handler acpi_gbl_device_notify; +ACPI_EXTERN struct acpi_object_notify_handler acpi_gbl_system_notify; +ACPI_EXTERN acpi_exception_handler acpi_gbl_exception_handler; +ACPI_EXTERN acpi_init_handler acpi_gbl_init_handler; +ACPI_EXTERN struct acpi_walk_state *acpi_gbl_breakpoint_walk; +ACPI_EXTERN acpi_handle acpi_gbl_global_lock_semaphore; /* Misc */ -ACPI_EXTERN u32 acpi_gbl_global_lock_thread_count; -ACPI_EXTERN u32 acpi_gbl_original_mode; -ACPI_EXTERN u32 acpi_gbl_rsdp_original_location; -ACPI_EXTERN u32 acpi_gbl_ns_lookup_count; -ACPI_EXTERN u32 acpi_gbl_ps_find_count; -ACPI_EXTERN u32 acpi_gbl_owner_id_mask; -ACPI_EXTERN u16 acpi_gbl_pm1_enable_register_save; -ACPI_EXTERN u16 acpi_gbl_global_lock_handle; -ACPI_EXTERN u8 acpi_gbl_debugger_configuration; -ACPI_EXTERN u8 acpi_gbl_global_lock_acquired; -ACPI_EXTERN u8 acpi_gbl_step_to_next_call; -ACPI_EXTERN u8 acpi_gbl_acpi_hardware_present; -ACPI_EXTERN u8 acpi_gbl_global_lock_present; -ACPI_EXTERN u8 acpi_gbl_events_initialized; -ACPI_EXTERN u8 acpi_gbl_system_awake_and_running; - -extern u8 acpi_gbl_shutdown; -extern u32 acpi_gbl_startup_flags; -extern const u8 acpi_gbl_decode_to8bit[8]; -extern const char *acpi_gbl_sleep_state_names[ACPI_S_STATE_COUNT]; -extern const char *acpi_gbl_highest_dstate_names[4]; -extern const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES]; -extern const char *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS]; -extern const char *acpi_gbl_valid_osi_strings[ACPI_NUM_OSI_STRINGS]; - +ACPI_EXTERN u32 acpi_gbl_global_lock_thread_count; +ACPI_EXTERN u32 acpi_gbl_original_mode; +ACPI_EXTERN u32 acpi_gbl_rsdp_original_location; +ACPI_EXTERN u32 acpi_gbl_ns_lookup_count; +ACPI_EXTERN u32 acpi_gbl_ps_find_count; +ACPI_EXTERN u32 acpi_gbl_owner_id_mask; +ACPI_EXTERN u16 acpi_gbl_pm1_enable_register_save; +ACPI_EXTERN u16 acpi_gbl_global_lock_handle; +ACPI_EXTERN u8 acpi_gbl_debugger_configuration; +ACPI_EXTERN u8 acpi_gbl_global_lock_acquired; +ACPI_EXTERN u8 acpi_gbl_step_to_next_call; +ACPI_EXTERN u8 acpi_gbl_acpi_hardware_present; +ACPI_EXTERN u8 acpi_gbl_global_lock_present; +ACPI_EXTERN u8 acpi_gbl_events_initialized; +ACPI_EXTERN u8 acpi_gbl_system_awake_and_running; + +extern u8 acpi_gbl_shutdown; +extern u32 acpi_gbl_startup_flags; +extern const u8 acpi_gbl_decode_to8bit[8]; +extern const char *acpi_gbl_sleep_state_names[ACPI_S_STATE_COUNT]; +extern const char *acpi_gbl_highest_dstate_names[4]; +extern const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES]; +extern const char *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS]; +extern const char *acpi_gbl_valid_osi_strings[ACPI_NUM_OSI_STRINGS]; /***************************************************************************** * @@ -253,36 +245,34 @@ extern const char *acpi_gbl_valid_osi_strings[ACPI_ #define NUM_PREDEFINED_NAMES 9 #endif -ACPI_EXTERN struct acpi_namespace_node acpi_gbl_root_node_struct; -ACPI_EXTERN struct acpi_namespace_node *acpi_gbl_root_node; -ACPI_EXTERN struct acpi_namespace_node *acpi_gbl_fadt_gpe_device; +ACPI_EXTERN struct acpi_namespace_node acpi_gbl_root_node_struct; +ACPI_EXTERN struct acpi_namespace_node *acpi_gbl_root_node; +ACPI_EXTERN struct acpi_namespace_node *acpi_gbl_fadt_gpe_device; -extern const u8 acpi_gbl_ns_properties[NUM_NS_TYPES]; -extern const struct acpi_predefined_names acpi_gbl_pre_defined_names [NUM_PREDEFINED_NAMES]; +extern const u8 acpi_gbl_ns_properties[NUM_NS_TYPES]; +extern const struct acpi_predefined_names + acpi_gbl_pre_defined_names[NUM_PREDEFINED_NAMES]; #ifdef ACPI_DEBUG_OUTPUT -ACPI_EXTERN u32 acpi_gbl_current_node_count; -ACPI_EXTERN u32 acpi_gbl_current_node_size; -ACPI_EXTERN u32 acpi_gbl_max_concurrent_node_count; -ACPI_EXTERN acpi_size acpi_gbl_entry_stack_pointer; -ACPI_EXTERN acpi_size acpi_gbl_lowest_stack_pointer; -ACPI_EXTERN u32 acpi_gbl_deepest_nesting; +ACPI_EXTERN u32 acpi_gbl_current_node_count; +ACPI_EXTERN u32 acpi_gbl_current_node_size; +ACPI_EXTERN u32 acpi_gbl_max_concurrent_node_count; +ACPI_EXTERN acpi_size acpi_gbl_entry_stack_pointer; +ACPI_EXTERN acpi_size acpi_gbl_lowest_stack_pointer; +ACPI_EXTERN u32 acpi_gbl_deepest_nesting; #endif - /***************************************************************************** * * Interpreter globals * ****************************************************************************/ - -ACPI_EXTERN struct acpi_thread_state *acpi_gbl_current_walk_list; +ACPI_EXTERN struct acpi_thread_state *acpi_gbl_current_walk_list; /* Control method single step flag */ -ACPI_EXTERN u8 acpi_gbl_cm_single_step; - +ACPI_EXTERN u8 acpi_gbl_cm_single_step; /***************************************************************************** * @@ -290,8 +280,7 @@ ACPI_EXTERN u8 acpi_gbl_cm_single_step; * ****************************************************************************/ -ACPI_EXTERN union acpi_parse_object *acpi_gbl_parsed_namespace_root; - +ACPI_EXTERN union acpi_parse_object *acpi_gbl_parsed_namespace_root; /***************************************************************************** * @@ -299,10 +288,10 @@ ACPI_EXTERN union acpi_parse_object *acpi_gbl_parsed_namespace_root; * ****************************************************************************/ -extern struct acpi_bit_register_info acpi_gbl_bit_register_info[ACPI_NUM_BITREG]; -ACPI_EXTERN u8 acpi_gbl_sleep_type_a; -ACPI_EXTERN u8 acpi_gbl_sleep_type_b; - +extern struct acpi_bit_register_info + acpi_gbl_bit_register_info[ACPI_NUM_BITREG]; +ACPI_EXTERN u8 acpi_gbl_sleep_type_a; +ACPI_EXTERN u8 acpi_gbl_sleep_type_b; /***************************************************************************** * @@ -310,12 +299,14 @@ ACPI_EXTERN u8 acpi_gbl_sleep_type_b; * ****************************************************************************/ -extern struct acpi_fixed_event_info acpi_gbl_fixed_event_info[ACPI_NUM_FIXED_EVENTS]; -ACPI_EXTERN struct acpi_fixed_event_handler acpi_gbl_fixed_event_handlers[ACPI_NUM_FIXED_EVENTS]; -ACPI_EXTERN struct acpi_gpe_xrupt_info *acpi_gbl_gpe_xrupt_list_head; -ACPI_EXTERN struct acpi_gpe_block_info *acpi_gbl_gpe_fadt_blocks[ACPI_MAX_GPE_BLOCKS]; -ACPI_EXTERN acpi_handle acpi_gbl_gpe_lock; - +extern struct acpi_fixed_event_info + acpi_gbl_fixed_event_info[ACPI_NUM_FIXED_EVENTS]; +ACPI_EXTERN struct acpi_fixed_event_handler + acpi_gbl_fixed_event_handlers[ACPI_NUM_FIXED_EVENTS]; +ACPI_EXTERN struct acpi_gpe_xrupt_info *acpi_gbl_gpe_xrupt_list_head; +ACPI_EXTERN struct acpi_gpe_block_info + *acpi_gbl_gpe_fadt_blocks[ACPI_MAX_GPE_BLOCKS]; +ACPI_EXTERN acpi_handle acpi_gbl_gpe_lock; /***************************************************************************** * @@ -323,58 +314,55 @@ ACPI_EXTERN acpi_handle acpi_gbl_gpe_lock; * ****************************************************************************/ -ACPI_EXTERN u8 acpi_gbl_db_output_flags; +ACPI_EXTERN u8 acpi_gbl_db_output_flags; #ifdef ACPI_DISASSEMBLER -ACPI_EXTERN u8 acpi_gbl_db_opt_disasm; -ACPI_EXTERN u8 acpi_gbl_db_opt_verbose; +ACPI_EXTERN u8 acpi_gbl_db_opt_disasm; +ACPI_EXTERN u8 acpi_gbl_db_opt_verbose; #endif - #ifdef ACPI_DEBUGGER -extern u8 acpi_gbl_method_executing; -extern u8 acpi_gbl_abort_method; -extern u8 acpi_gbl_db_terminate_threads; - -ACPI_EXTERN int optind; -ACPI_EXTERN char *optarg; - -ACPI_EXTERN u8 acpi_gbl_db_opt_tables; -ACPI_EXTERN u8 acpi_gbl_db_opt_stats; -ACPI_EXTERN u8 acpi_gbl_db_opt_ini_methods; - - -ACPI_EXTERN char *acpi_gbl_db_args[ACPI_DEBUGGER_MAX_ARGS]; -ACPI_EXTERN char acpi_gbl_db_line_buf[80]; -ACPI_EXTERN char acpi_gbl_db_parsed_buf[80]; -ACPI_EXTERN char acpi_gbl_db_scope_buf[40]; -ACPI_EXTERN char acpi_gbl_db_debug_filename[40]; -ACPI_EXTERN u8 acpi_gbl_db_output_to_file; -ACPI_EXTERN char *acpi_gbl_db_buffer; -ACPI_EXTERN char *acpi_gbl_db_filename; -ACPI_EXTERN u32 acpi_gbl_db_debug_level; -ACPI_EXTERN u32 acpi_gbl_db_console_debug_level; -ACPI_EXTERN struct acpi_table_header *acpi_gbl_db_table_ptr; -ACPI_EXTERN struct acpi_namespace_node *acpi_gbl_db_scope_node; +extern u8 acpi_gbl_method_executing; +extern u8 acpi_gbl_abort_method; +extern u8 acpi_gbl_db_terminate_threads; + +ACPI_EXTERN int optind; +ACPI_EXTERN char *optarg; + +ACPI_EXTERN u8 acpi_gbl_db_opt_tables; +ACPI_EXTERN u8 acpi_gbl_db_opt_stats; +ACPI_EXTERN u8 acpi_gbl_db_opt_ini_methods; + +ACPI_EXTERN char *acpi_gbl_db_args[ACPI_DEBUGGER_MAX_ARGS]; +ACPI_EXTERN char acpi_gbl_db_line_buf[80]; +ACPI_EXTERN char acpi_gbl_db_parsed_buf[80]; +ACPI_EXTERN char acpi_gbl_db_scope_buf[40]; +ACPI_EXTERN char acpi_gbl_db_debug_filename[40]; +ACPI_EXTERN u8 acpi_gbl_db_output_to_file; +ACPI_EXTERN char *acpi_gbl_db_buffer; +ACPI_EXTERN char *acpi_gbl_db_filename; +ACPI_EXTERN u32 acpi_gbl_db_debug_level; +ACPI_EXTERN u32 acpi_gbl_db_console_debug_level; +ACPI_EXTERN struct acpi_table_header *acpi_gbl_db_table_ptr; +ACPI_EXTERN struct acpi_namespace_node *acpi_gbl_db_scope_node; /* * Statistic globals */ -ACPI_EXTERN u16 acpi_gbl_obj_type_count[ACPI_TYPE_NS_NODE_MAX+1]; -ACPI_EXTERN u16 acpi_gbl_node_type_count[ACPI_TYPE_NS_NODE_MAX+1]; -ACPI_EXTERN u16 acpi_gbl_obj_type_count_misc; -ACPI_EXTERN u16 acpi_gbl_node_type_count_misc; -ACPI_EXTERN u32 acpi_gbl_num_nodes; -ACPI_EXTERN u32 acpi_gbl_num_objects; - +ACPI_EXTERN u16 acpi_gbl_obj_type_count[ACPI_TYPE_NS_NODE_MAX + 1]; +ACPI_EXTERN u16 acpi_gbl_node_type_count[ACPI_TYPE_NS_NODE_MAX + 1]; +ACPI_EXTERN u16 acpi_gbl_obj_type_count_misc; +ACPI_EXTERN u16 acpi_gbl_node_type_count_misc; +ACPI_EXTERN u32 acpi_gbl_num_nodes; +ACPI_EXTERN u32 acpi_gbl_num_objects; -ACPI_EXTERN u32 acpi_gbl_size_of_parse_tree; -ACPI_EXTERN u32 acpi_gbl_size_of_method_trees; -ACPI_EXTERN u32 acpi_gbl_size_of_node_entries; -ACPI_EXTERN u32 acpi_gbl_size_of_acpi_objects; +ACPI_EXTERN u32 acpi_gbl_size_of_parse_tree; +ACPI_EXTERN u32 acpi_gbl_size_of_method_trees; +ACPI_EXTERN u32 acpi_gbl_size_of_node_entries; +ACPI_EXTERN u32 acpi_gbl_size_of_acpi_objects; -#endif /* ACPI_DEBUGGER */ +#endif /* ACPI_DEBUGGER */ -#endif /* __ACGLOBAL_H__ */ +#endif /* __ACGLOBAL_H__ */ diff --git a/include/acpi/achware.h b/include/acpi/achware.h index cf5de4625a7..3644d7248e7 100644 --- a/include/acpi/achware.h +++ b/include/acpi/achware.h @@ -44,7 +44,6 @@ #ifndef __ACHWARE_H__ #define __ACHWARE_H__ - /* PM Timer ticks per second (HZ) */ #define PM_TIMER_FREQUENCY 3579545 @@ -57,126 +56,78 @@ #define ACPI_SST_SLEEPING 3 #define ACPI_SST_SLEEP_CONTEXT 4 - /* Prototypes */ - /* * hwacpi - high level functions */ -acpi_status -acpi_hw_initialize ( - void); +acpi_status acpi_hw_initialize(void); -acpi_status -acpi_hw_set_mode ( - u32 mode); - -u32 -acpi_hw_get_mode ( - void); +acpi_status acpi_hw_set_mode(u32 mode); +u32 acpi_hw_get_mode(void); /* * hwregs - ACPI Register I/O */ -struct acpi_bit_register_info * -acpi_hw_get_bit_register_info ( - u32 register_id); - -acpi_status -acpi_hw_register_read ( - u8 use_lock, - u32 register_id, - u32 *return_value); +struct acpi_bit_register_info *acpi_hw_get_bit_register_info(u32 register_id); acpi_status -acpi_hw_register_write ( - u8 use_lock, - u32 register_id, - u32 value); +acpi_hw_register_read(u8 use_lock, u32 register_id, u32 * return_value); -acpi_status -acpi_hw_low_level_read ( - u32 width, - u32 *value, - struct acpi_generic_address *reg); +acpi_status acpi_hw_register_write(u8 use_lock, u32 register_id, u32 value); acpi_status -acpi_hw_low_level_write ( - u32 width, - u32 value, - struct acpi_generic_address *reg); +acpi_hw_low_level_read(u32 width, + u32 * value, struct acpi_generic_address *reg); acpi_status -acpi_hw_clear_acpi_status ( - u32 flags); +acpi_hw_low_level_write(u32 width, u32 value, struct acpi_generic_address *reg); +acpi_status acpi_hw_clear_acpi_status(u32 flags); /* * hwgpe - GPE support */ acpi_status -acpi_hw_write_gpe_enable_reg ( - struct acpi_gpe_event_info *gpe_event_info); +acpi_hw_write_gpe_enable_reg(struct acpi_gpe_event_info *gpe_event_info); acpi_status -acpi_hw_disable_gpe_block ( - struct acpi_gpe_xrupt_info *gpe_xrupt_info, - struct acpi_gpe_block_info *gpe_block); +acpi_hw_disable_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info, + struct acpi_gpe_block_info *gpe_block); -acpi_status -acpi_hw_clear_gpe ( - struct acpi_gpe_event_info *gpe_event_info); +acpi_status acpi_hw_clear_gpe(struct acpi_gpe_event_info *gpe_event_info); acpi_status -acpi_hw_clear_gpe_block ( - struct acpi_gpe_xrupt_info *gpe_xrupt_info, - struct acpi_gpe_block_info *gpe_block); +acpi_hw_clear_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info, + struct acpi_gpe_block_info *gpe_block); #ifdef ACPI_FUTURE_USAGE acpi_status -acpi_hw_get_gpe_status ( - struct acpi_gpe_event_info *gpe_event_info, - acpi_event_status *event_status); -#endif /* ACPI_FUTURE_USAGE */ +acpi_hw_get_gpe_status(struct acpi_gpe_event_info *gpe_event_info, + acpi_event_status * event_status); +#endif /* ACPI_FUTURE_USAGE */ -acpi_status -acpi_hw_disable_all_gpes ( - void); +acpi_status acpi_hw_disable_all_gpes(void); -acpi_status -acpi_hw_enable_all_runtime_gpes ( - void); +acpi_status acpi_hw_enable_all_runtime_gpes(void); -acpi_status -acpi_hw_enable_all_wakeup_gpes ( - void); +acpi_status acpi_hw_enable_all_wakeup_gpes(void); acpi_status -acpi_hw_enable_runtime_gpe_block ( - struct acpi_gpe_xrupt_info *gpe_xrupt_info, - struct acpi_gpe_block_info *gpe_block); - +acpi_hw_enable_runtime_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info, + struct acpi_gpe_block_info *gpe_block); #ifdef ACPI_FUTURE_USAGE /* * hwtimer - ACPI Timer prototypes */ -acpi_status -acpi_get_timer_resolution ( - u32 *resolution); +acpi_status acpi_get_timer_resolution(u32 * resolution); -acpi_status -acpi_get_timer ( - u32 *ticks); +acpi_status acpi_get_timer(u32 * ticks); acpi_status -acpi_get_timer_duration ( - u32 start_ticks, - u32 end_ticks, - u32 *time_elapsed); -#endif /* ACPI_FUTURE_USAGE */ - +acpi_get_timer_duration(u32 start_ticks, u32 end_ticks, u32 * time_elapsed); +#endif /* ACPI_FUTURE_USAGE */ -#endif /* __ACHWARE_H__ */ +#endif /* __ACHWARE_H__ */ diff --git a/include/acpi/acinterp.h b/include/acpi/acinterp.h index 5c7172477a0..2c9c1a1d1b7 100644 --- a/include/acpi/acinterp.h +++ b/include/acpi/acinterp.h @@ -44,29 +44,22 @@ #ifndef __ACINTERP_H__ #define __ACINTERP_H__ - #define ACPI_WALK_OPERANDS (&(walk_state->operands [walk_state->num_operands -1])) - /* * exconvrt - object conversion */ acpi_status -acpi_ex_convert_to_integer ( - union acpi_operand_object *obj_desc, - union acpi_operand_object **result_desc, - u32 flags); +acpi_ex_convert_to_integer(union acpi_operand_object *obj_desc, + union acpi_operand_object **result_desc, u32 flags); acpi_status -acpi_ex_convert_to_buffer ( - union acpi_operand_object *obj_desc, - union acpi_operand_object **result_desc); +acpi_ex_convert_to_buffer(union acpi_operand_object *obj_desc, + union acpi_operand_object **result_desc); acpi_status -acpi_ex_convert_to_string ( - union acpi_operand_object *obj_desc, - union acpi_operand_object **result_desc, - u32 type); +acpi_ex_convert_to_string(union acpi_operand_object *obj_desc, + union acpi_operand_object **result_desc, u32 type); /* Types for ->String conversion */ @@ -76,587 +69,412 @@ acpi_ex_convert_to_string ( #define ACPI_EXPLICIT_CONVERT_DECIMAL 0x00000003 acpi_status -acpi_ex_convert_to_target_type ( - acpi_object_type destination_type, - union acpi_operand_object *source_desc, - union acpi_operand_object **result_desc, - struct acpi_walk_state *walk_state); - +acpi_ex_convert_to_target_type(acpi_object_type destination_type, + union acpi_operand_object *source_desc, + union acpi_operand_object **result_desc, + struct acpi_walk_state *walk_state); /* * exfield - ACPI AML (p-code) execution - field manipulation */ acpi_status -acpi_ex_common_buffer_setup ( - union acpi_operand_object *obj_desc, - u32 buffer_length, - u32 *datum_count); +acpi_ex_common_buffer_setup(union acpi_operand_object *obj_desc, + u32 buffer_length, u32 * datum_count); acpi_status -acpi_ex_write_with_update_rule ( - union acpi_operand_object *obj_desc, - acpi_integer mask, - acpi_integer field_value, - u32 field_datum_byte_offset); +acpi_ex_write_with_update_rule(union acpi_operand_object *obj_desc, + acpi_integer mask, + acpi_integer field_value, + u32 field_datum_byte_offset); void -acpi_ex_get_buffer_datum( - acpi_integer *datum, - void *buffer, - u32 buffer_length, - u32 byte_granularity, - u32 buffer_offset); +acpi_ex_get_buffer_datum(acpi_integer * datum, + void *buffer, + u32 buffer_length, + u32 byte_granularity, u32 buffer_offset); void -acpi_ex_set_buffer_datum ( - acpi_integer merged_datum, - void *buffer, - u32 buffer_length, - u32 byte_granularity, - u32 buffer_offset); +acpi_ex_set_buffer_datum(acpi_integer merged_datum, + void *buffer, + u32 buffer_length, + u32 byte_granularity, u32 buffer_offset); acpi_status -acpi_ex_read_data_from_field ( - struct acpi_walk_state *walk_state, - union acpi_operand_object *obj_desc, - union acpi_operand_object **ret_buffer_desc); +acpi_ex_read_data_from_field(struct acpi_walk_state *walk_state, + union acpi_operand_object *obj_desc, + union acpi_operand_object **ret_buffer_desc); acpi_status -acpi_ex_write_data_to_field ( - union acpi_operand_object *source_desc, - union acpi_operand_object *obj_desc, - union acpi_operand_object **result_desc); - +acpi_ex_write_data_to_field(union acpi_operand_object *source_desc, + union acpi_operand_object *obj_desc, + union acpi_operand_object **result_desc); /* * exfldio - low level field I/O */ acpi_status -acpi_ex_extract_from_field ( - union acpi_operand_object *obj_desc, - void *buffer, - u32 buffer_length); +acpi_ex_extract_from_field(union acpi_operand_object *obj_desc, + void *buffer, u32 buffer_length); acpi_status -acpi_ex_insert_into_field ( - union acpi_operand_object *obj_desc, - void *buffer, - u32 buffer_length); +acpi_ex_insert_into_field(union acpi_operand_object *obj_desc, + void *buffer, u32 buffer_length); acpi_status -acpi_ex_access_region ( - union acpi_operand_object *obj_desc, - u32 field_datum_byte_offset, - acpi_integer *value, - u32 read_write); - +acpi_ex_access_region(union acpi_operand_object *obj_desc, + u32 field_datum_byte_offset, + acpi_integer * value, u32 read_write); /* * exmisc - misc support routines */ acpi_status -acpi_ex_get_object_reference ( - union acpi_operand_object *obj_desc, - union acpi_operand_object **return_desc, - struct acpi_walk_state *walk_state); +acpi_ex_get_object_reference(union acpi_operand_object *obj_desc, + union acpi_operand_object **return_desc, + struct acpi_walk_state *walk_state); acpi_status -acpi_ex_concat_template ( - union acpi_operand_object *obj_desc, - union acpi_operand_object *obj_desc2, - union acpi_operand_object **actual_return_desc, - struct acpi_walk_state *walk_state); +acpi_ex_concat_template(union acpi_operand_object *obj_desc, + union acpi_operand_object *obj_desc2, + union acpi_operand_object **actual_return_desc, + struct acpi_walk_state *walk_state); acpi_status -acpi_ex_do_concatenate ( - union acpi_operand_object *obj_desc, - union acpi_operand_object *obj_desc2, - union acpi_operand_object **actual_return_desc, - struct acpi_walk_state *walk_state); +acpi_ex_do_concatenate(union acpi_operand_object *obj_desc, + union acpi_operand_object *obj_desc2, + union acpi_operand_object **actual_return_desc, + struct acpi_walk_state *walk_state); acpi_status -acpi_ex_do_logical_numeric_op ( - u16 opcode, - acpi_integer integer0, - acpi_integer integer1, - u8 *logical_result); +acpi_ex_do_logical_numeric_op(u16 opcode, + acpi_integer integer0, + acpi_integer integer1, u8 * logical_result); acpi_status -acpi_ex_do_logical_op ( - u16 opcode, - union acpi_operand_object *operand0, - union acpi_operand_object *operand1, - u8 *logical_result); +acpi_ex_do_logical_op(u16 opcode, + union acpi_operand_object *operand0, + union acpi_operand_object *operand1, u8 * logical_result); acpi_integer -acpi_ex_do_math_op ( - u16 opcode, - acpi_integer operand0, - acpi_integer operand1); +acpi_ex_do_math_op(u16 opcode, acpi_integer operand0, acpi_integer operand1); -acpi_status -acpi_ex_create_mutex ( - struct acpi_walk_state *walk_state); +acpi_status acpi_ex_create_mutex(struct acpi_walk_state *walk_state); -acpi_status -acpi_ex_create_processor ( - struct acpi_walk_state *walk_state); +acpi_status acpi_ex_create_processor(struct acpi_walk_state *walk_state); -acpi_status -acpi_ex_create_power_resource ( - struct acpi_walk_state *walk_state); +acpi_status acpi_ex_create_power_resource(struct acpi_walk_state *walk_state); acpi_status -acpi_ex_create_region ( - u8 *aml_start, - u32 aml_length, - u8 region_space, - struct acpi_walk_state *walk_state); +acpi_ex_create_region(u8 * aml_start, + u32 aml_length, + u8 region_space, struct acpi_walk_state *walk_state); -acpi_status -acpi_ex_create_table_region ( - struct acpi_walk_state *walk_state); +acpi_status acpi_ex_create_table_region(struct acpi_walk_state *walk_state); -acpi_status -acpi_ex_create_event ( - struct acpi_walk_state *walk_state); +acpi_status acpi_ex_create_event(struct acpi_walk_state *walk_state); -acpi_status -acpi_ex_create_alias ( - struct acpi_walk_state *walk_state); +acpi_status acpi_ex_create_alias(struct acpi_walk_state *walk_state); acpi_status -acpi_ex_create_method ( - u8 *aml_start, - u32 aml_length, - struct acpi_walk_state *walk_state); - +acpi_ex_create_method(u8 * aml_start, + u32 aml_length, struct acpi_walk_state *walk_state); /* * exconfig - dynamic table load/unload */ acpi_status -acpi_ex_load_op ( - union acpi_operand_object *obj_desc, - union acpi_operand_object *target, - struct acpi_walk_state *walk_state); +acpi_ex_load_op(union acpi_operand_object *obj_desc, + union acpi_operand_object *target, + struct acpi_walk_state *walk_state); acpi_status -acpi_ex_load_table_op ( - struct acpi_walk_state *walk_state, - union acpi_operand_object **return_desc); - -acpi_status -acpi_ex_unload_table ( - union acpi_operand_object *ddb_handle); +acpi_ex_load_table_op(struct acpi_walk_state *walk_state, + union acpi_operand_object **return_desc); +acpi_status acpi_ex_unload_table(union acpi_operand_object *ddb_handle); /* * exmutex - mutex support */ acpi_status -acpi_ex_acquire_mutex ( - union acpi_operand_object *time_desc, - union acpi_operand_object *obj_desc, - struct acpi_walk_state *walk_state); +acpi_ex_acquire_mutex(union acpi_operand_object *time_desc, + union acpi_operand_object *obj_desc, + struct acpi_walk_state *walk_state); acpi_status -acpi_ex_release_mutex ( - union acpi_operand_object *obj_desc, - struct acpi_walk_state *walk_state); +acpi_ex_release_mutex(union acpi_operand_object *obj_desc, + struct acpi_walk_state *walk_state); -void -acpi_ex_release_all_mutexes ( - struct acpi_thread_state *thread); - -void -acpi_ex_unlink_mutex ( - union acpi_operand_object *obj_desc); +void acpi_ex_release_all_mutexes(struct acpi_thread_state *thread); +void acpi_ex_unlink_mutex(union acpi_operand_object *obj_desc); /* * exprep - ACPI AML execution - prep utilities */ acpi_status -acpi_ex_prep_common_field_object ( - union acpi_operand_object *obj_desc, - u8 field_flags, - u8 field_attribute, - u32 field_bit_position, - u32 field_bit_length); - -acpi_status -acpi_ex_prep_field_value ( - struct acpi_create_field_info *info); +acpi_ex_prep_common_field_object(union acpi_operand_object *obj_desc, + u8 field_flags, + u8 field_attribute, + u32 field_bit_position, u32 field_bit_length); +acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info); /* * exsystem - Interface to OS services */ acpi_status -acpi_ex_system_do_notify_op ( - union acpi_operand_object *value, - union acpi_operand_object *obj_desc); +acpi_ex_system_do_notify_op(union acpi_operand_object *value, + union acpi_operand_object *obj_desc); -acpi_status -acpi_ex_system_do_suspend( - acpi_integer time); +acpi_status acpi_ex_system_do_suspend(acpi_integer time); -acpi_status -acpi_ex_system_do_stall ( - u32 time); +acpi_status acpi_ex_system_do_stall(u32 time); acpi_status -acpi_ex_system_acquire_mutex( - union acpi_operand_object *time, - union acpi_operand_object *obj_desc); +acpi_ex_system_acquire_mutex(union acpi_operand_object *time, + union acpi_operand_object *obj_desc); -acpi_status -acpi_ex_system_release_mutex( - union acpi_operand_object *obj_desc); +acpi_status acpi_ex_system_release_mutex(union acpi_operand_object *obj_desc); -acpi_status -acpi_ex_system_signal_event( - union acpi_operand_object *obj_desc); +acpi_status acpi_ex_system_signal_event(union acpi_operand_object *obj_desc); acpi_status -acpi_ex_system_wait_event( - union acpi_operand_object *time, - union acpi_operand_object *obj_desc); +acpi_ex_system_wait_event(union acpi_operand_object *time, + union acpi_operand_object *obj_desc); -acpi_status -acpi_ex_system_reset_event( - union acpi_operand_object *obj_desc); - -acpi_status -acpi_ex_system_wait_semaphore ( - acpi_handle semaphore, - u16 timeout); +acpi_status acpi_ex_system_reset_event(union acpi_operand_object *obj_desc); +acpi_status acpi_ex_system_wait_semaphore(acpi_handle semaphore, u16 timeout); /* * exoparg1 - ACPI AML execution, 1 operand */ -acpi_status -acpi_ex_opcode_0A_0T_1R ( - struct acpi_walk_state *walk_state); +acpi_status acpi_ex_opcode_0A_0T_1R(struct acpi_walk_state *walk_state); -acpi_status -acpi_ex_opcode_1A_0T_0R ( - struct acpi_walk_state *walk_state); +acpi_status acpi_ex_opcode_1A_0T_0R(struct acpi_walk_state *walk_state); -acpi_status -acpi_ex_opcode_1A_0T_1R ( - struct acpi_walk_state *walk_state); +acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state); -acpi_status -acpi_ex_opcode_1A_1T_1R ( - struct acpi_walk_state *walk_state); +acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state); -acpi_status -acpi_ex_opcode_1A_1T_0R ( - struct acpi_walk_state *walk_state); +acpi_status acpi_ex_opcode_1A_1T_0R(struct acpi_walk_state *walk_state); /* * exoparg2 - ACPI AML execution, 2 operands */ -acpi_status -acpi_ex_opcode_2A_0T_0R ( - struct acpi_walk_state *walk_state); +acpi_status acpi_ex_opcode_2A_0T_0R(struct acpi_walk_state *walk_state); -acpi_status -acpi_ex_opcode_2A_0T_1R ( - struct acpi_walk_state *walk_state); +acpi_status acpi_ex_opcode_2A_0T_1R(struct acpi_walk_state *walk_state); -acpi_status -acpi_ex_opcode_2A_1T_1R ( - struct acpi_walk_state *walk_state); - -acpi_status -acpi_ex_opcode_2A_2T_1R ( - struct acpi_walk_state *walk_state); +acpi_status acpi_ex_opcode_2A_1T_1R(struct acpi_walk_state *walk_state); +acpi_status acpi_ex_opcode_2A_2T_1R(struct acpi_walk_state *walk_state); /* * exoparg3 - ACPI AML execution, 3 operands */ -acpi_status -acpi_ex_opcode_3A_0T_0R ( - struct acpi_walk_state *walk_state); - -acpi_status -acpi_ex_opcode_3A_1T_1R ( - struct acpi_walk_state *walk_state); +acpi_status acpi_ex_opcode_3A_0T_0R(struct acpi_walk_state *walk_state); +acpi_status acpi_ex_opcode_3A_1T_1R(struct acpi_walk_state *walk_state); /* * exoparg6 - ACPI AML execution, 6 operands */ -acpi_status -acpi_ex_opcode_6A_0T_1R ( - struct acpi_walk_state *walk_state); - +acpi_status acpi_ex_opcode_6A_0T_1R(struct acpi_walk_state *walk_state); /* * exresolv - Object resolution and get value functions */ acpi_status -acpi_ex_resolve_to_value ( - union acpi_operand_object **stack_ptr, - struct acpi_walk_state *walk_state); +acpi_ex_resolve_to_value(union acpi_operand_object **stack_ptr, + struct acpi_walk_state *walk_state); acpi_status -acpi_ex_resolve_multiple ( - struct acpi_walk_state *walk_state, - union acpi_operand_object *operand, - acpi_object_type *return_type, - union acpi_operand_object **return_desc); - +acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state, + union acpi_operand_object *operand, + acpi_object_type * return_type, + union acpi_operand_object **return_desc); /* * exresnte - resolve namespace node */ acpi_status -acpi_ex_resolve_node_to_value ( - struct acpi_namespace_node **stack_ptr, - struct acpi_walk_state *walk_state); - +acpi_ex_resolve_node_to_value(struct acpi_namespace_node **stack_ptr, + struct acpi_walk_state *walk_state); /* * exresop - resolve operand to value */ acpi_status -acpi_ex_resolve_operands ( - u16 opcode, - union acpi_operand_object **stack_ptr, - struct acpi_walk_state *walk_state); - +acpi_ex_resolve_operands(u16 opcode, + union acpi_operand_object **stack_ptr, + struct acpi_walk_state *walk_state); /* * exdump - Interpreter debug output routines */ -void -acpi_ex_dump_operand ( - union acpi_operand_object *obj_desc, - u32 depth); +void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth); void -acpi_ex_dump_operands ( - union acpi_operand_object **operands, - acpi_interpreter_mode interpreter_mode, - char *ident, - u32 num_levels, - char *note, - char *module_name, - u32 line_number); +acpi_ex_dump_operands(union acpi_operand_object **operands, + acpi_interpreter_mode interpreter_mode, + char *ident, + u32 num_levels, + char *note, char *module_name, u32 line_number); #ifdef ACPI_FUTURE_USAGE void -acpi_ex_dump_object_descriptor ( - union acpi_operand_object *object, - u32 flags); - -void -acpi_ex_dump_node ( - struct acpi_namespace_node *node, - u32 flags); -#endif /* ACPI_FUTURE_USAGE */ +acpi_ex_dump_object_descriptor(union acpi_operand_object *object, u32 flags); +void acpi_ex_dump_node(struct acpi_namespace_node *node, u32 flags); +#endif /* ACPI_FUTURE_USAGE */ /* * exnames - AML namestring support */ acpi_status -acpi_ex_get_name_string ( - acpi_object_type data_type, - u8 *in_aml_address, - char **out_name_string, - u32 *out_name_length); - +acpi_ex_get_name_string(acpi_object_type data_type, + u8 * in_aml_address, + char **out_name_string, u32 * out_name_length); /* * exstore - Object store support */ acpi_status -acpi_ex_store ( - union acpi_operand_object *val_desc, - union acpi_operand_object *dest_desc, - struct acpi_walk_state *walk_state); +acpi_ex_store(union acpi_operand_object *val_desc, + union acpi_operand_object *dest_desc, + struct acpi_walk_state *walk_state); acpi_status -acpi_ex_store_object_to_node ( - union acpi_operand_object *source_desc, - struct acpi_namespace_node *node, - struct acpi_walk_state *walk_state, - u8 implicit_conversion); +acpi_ex_store_object_to_node(union acpi_operand_object *source_desc, + struct acpi_namespace_node *node, + struct acpi_walk_state *walk_state, + u8 implicit_conversion); #define ACPI_IMPLICIT_CONVERSION TRUE #define ACPI_NO_IMPLICIT_CONVERSION FALSE - /* * exstoren - resolve/store object */ acpi_status -acpi_ex_resolve_object ( - union acpi_operand_object **source_desc_ptr, - acpi_object_type target_type, - struct acpi_walk_state *walk_state); +acpi_ex_resolve_object(union acpi_operand_object **source_desc_ptr, + acpi_object_type target_type, + struct acpi_walk_state *walk_state); acpi_status -acpi_ex_store_object_to_object ( - union acpi_operand_object *source_desc, - union acpi_operand_object *dest_desc, - union acpi_operand_object **new_desc, - struct acpi_walk_state *walk_state); - +acpi_ex_store_object_to_object(union acpi_operand_object *source_desc, + union acpi_operand_object *dest_desc, + union acpi_operand_object **new_desc, + struct acpi_walk_state *walk_state); /* * exstorob - store object - buffer/string */ acpi_status -acpi_ex_store_buffer_to_buffer ( - union acpi_operand_object *source_desc, - union acpi_operand_object *target_desc); +acpi_ex_store_buffer_to_buffer(union acpi_operand_object *source_desc, + union acpi_operand_object *target_desc); acpi_status -acpi_ex_store_string_to_string ( - union acpi_operand_object *source_desc, - union acpi_operand_object *target_desc); - +acpi_ex_store_string_to_string(union acpi_operand_object *source_desc, + union acpi_operand_object *target_desc); /* * excopy - object copy */ acpi_status -acpi_ex_copy_integer_to_index_field ( - union acpi_operand_object *source_desc, - union acpi_operand_object *target_desc); +acpi_ex_copy_integer_to_index_field(union acpi_operand_object *source_desc, + union acpi_operand_object *target_desc); acpi_status -acpi_ex_copy_integer_to_bank_field ( - union acpi_operand_object *source_desc, - union acpi_operand_object *target_desc); +acpi_ex_copy_integer_to_bank_field(union acpi_operand_object *source_desc, + union acpi_operand_object *target_desc); acpi_status -acpi_ex_copy_data_to_named_field ( - union acpi_operand_object *source_desc, - struct acpi_namespace_node *node); +acpi_ex_copy_data_to_named_field(union acpi_operand_object *source_desc, + struct acpi_namespace_node *node); acpi_status -acpi_ex_copy_integer_to_buffer_field ( - union acpi_operand_object *source_desc, - union acpi_operand_object *target_desc); - +acpi_ex_copy_integer_to_buffer_field(union acpi_operand_object *source_desc, + union acpi_operand_object *target_desc); /* * exutils - interpreter/scanner utilities */ -acpi_status -acpi_ex_enter_interpreter ( - void); +acpi_status acpi_ex_enter_interpreter(void); -void -acpi_ex_exit_interpreter ( - void); +void acpi_ex_exit_interpreter(void); -void -acpi_ex_truncate_for32bit_table ( - union acpi_operand_object *obj_desc); +void acpi_ex_truncate_for32bit_table(union acpi_operand_object *obj_desc); -u8 -acpi_ex_acquire_global_lock ( - u32 rule); +u8 acpi_ex_acquire_global_lock(u32 rule); -void -acpi_ex_release_global_lock ( - u8 locked); +void acpi_ex_release_global_lock(u8 locked); -void -acpi_ex_eisa_id_to_string ( - u32 numeric_id, - char *out_string); - -void -acpi_ex_unsigned_integer_to_string ( - acpi_integer value, - char *out_string); +void acpi_ex_eisa_id_to_string(u32 numeric_id, char *out_string); +void acpi_ex_unsigned_integer_to_string(acpi_integer value, char *out_string); /* * exregion - default op_region handlers */ acpi_status -acpi_ex_system_memory_space_handler ( - u32 function, - acpi_physical_address address, - u32 bit_width, - acpi_integer *value, - void *handler_context, - void *region_context); - -acpi_status -acpi_ex_system_io_space_handler ( - u32 function, - acpi_physical_address address, - u32 bit_width, - acpi_integer *value, - void *handler_context, - void *region_context); - -acpi_status -acpi_ex_pci_config_space_handler ( - u32 function, - acpi_physical_address address, - u32 bit_width, - acpi_integer *value, - void *handler_context, - void *region_context); - -acpi_status -acpi_ex_cmos_space_handler ( - u32 function, - acpi_physical_address address, - u32 bit_width, - acpi_integer *value, - void *handler_context, - void *region_context); - -acpi_status -acpi_ex_pci_bar_space_handler ( - u32 function, - acpi_physical_address address, - u32 bit_width, - acpi_integer *value, - void *handler_context, - void *region_context); - -acpi_status -acpi_ex_embedded_controller_space_handler ( - u32 function, - acpi_physical_address address, - u32 bit_width, - acpi_integer *value, - void *handler_context, - void *region_context); - -acpi_status -acpi_ex_sm_bus_space_handler ( - u32 function, - acpi_physical_address address, - u32 bit_width, - acpi_integer *value, - void *handler_context, - void *region_context); - - -acpi_status -acpi_ex_data_table_space_handler ( - u32 function, - acpi_physical_address address, - u32 bit_width, - acpi_integer *value, - void *handler_context, - void *region_context); - -#endif /* __INTERP_H__ */ +acpi_ex_system_memory_space_handler(u32 function, + acpi_physical_address address, + u32 bit_width, + acpi_integer * value, + void *handler_context, + void *region_context); + +acpi_status +acpi_ex_system_io_space_handler(u32 function, + acpi_physical_address address, + u32 bit_width, + acpi_integer * value, + void *handler_context, void *region_context); + +acpi_status +acpi_ex_pci_config_space_handler(u32 function, + acpi_physical_address address, + u32 bit_width, + acpi_integer * value, + void *handler_context, void *region_context); + +acpi_status +acpi_ex_cmos_space_handler(u32 function, + acpi_physical_address address, + u32 bit_width, + acpi_integer * value, + void *handler_context, void *region_context); + +acpi_status +acpi_ex_pci_bar_space_handler(u32 function, + acpi_physical_address address, + u32 bit_width, + acpi_integer * value, + void *handler_context, void *region_context); + +acpi_status +acpi_ex_embedded_controller_space_handler(u32 function, + acpi_physical_address address, + u32 bit_width, + acpi_integer * value, + void *handler_context, + void *region_context); + +acpi_status +acpi_ex_sm_bus_space_handler(u32 function, + acpi_physical_address address, + u32 bit_width, + acpi_integer * value, + void *handler_context, void *region_context); + +acpi_status +acpi_ex_data_table_space_handler(u32 function, + acpi_physical_address address, + u32 bit_width, + acpi_integer * value, + void *handler_context, void *region_context); + +#endif /* __INTERP_H__ */ diff --git a/include/acpi/aclocal.h b/include/acpi/aclocal.h index 4d2635698e1..9fba0fddda9 100644 --- a/include/acpi/aclocal.h +++ b/include/acpi/aclocal.h @@ -44,24 +44,20 @@ #ifndef __ACLOCAL_H__ #define __ACLOCAL_H__ +#define ACPI_WAIT_FOREVER 0xFFFF /* u16, as per ACPI spec */ -#define ACPI_WAIT_FOREVER 0xFFFF /* u16, as per ACPI spec */ - -typedef void * acpi_mutex; -typedef u32 acpi_mutex_handle; - +typedef void *acpi_mutex; +typedef u32 acpi_mutex_handle; /* Total number of aml opcodes defined */ #define AML_NUM_OPCODES 0x7F - /* Forward declarations */ -struct acpi_walk_state ; +struct acpi_walk_state; struct acpi_obj_mutex; -union acpi_parse_object ; - +union acpi_parse_object; /***************************************************************************** * @@ -69,7 +65,6 @@ union acpi_parse_object ; * ****************************************************************************/ - /* * Predefined handles for the mutex objects used within the subsystem * All mutex objects are automatically created by acpi_ut_mutex_initialize. @@ -96,14 +91,12 @@ union acpi_parse_object ; #define MAX_MUTEX 12 #define NUM_MUTEX MAX_MUTEX+1 - #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) #ifdef DEFINE_ACPI_GLOBALS /* Names for the mutexes used in the subsystem */ -static char *acpi_gbl_mutex_names[] = -{ +static char *acpi_gbl_mutex_names[] = { "ACPI_MTX_Execute", "ACPI_MTX_Interpreter", "ACPI_MTX_Parser", @@ -122,10 +115,9 @@ static char *acpi_gbl_mutex_names[] = #endif #endif - /* Owner IDs are used to track namespace nodes for selective deletion */ -typedef u8 acpi_owner_id; +typedef u8 acpi_owner_id; #define ACPI_OWNER_ID_MAX 0xFF /* This Thread ID means that the mutex is not in use (unlocked) */ @@ -134,20 +126,17 @@ typedef u8 acpi_owner_id; /* Table for the global mutexes */ -struct acpi_mutex_info -{ - acpi_mutex mutex; - u32 use_count; - u32 thread_id; +struct acpi_mutex_info { + acpi_mutex mutex; + u32 use_count; + u32 thread_id; }; - /* Lock flag parameter for various interfaces */ #define ACPI_MTX_DO_NOT_LOCK 0 #define ACPI_MTX_LOCK 1 - /* Field access granularities */ #define ACPI_FIELD_BYTE_GRANULARITY 1 @@ -155,7 +144,6 @@ struct acpi_mutex_info #define ACPI_FIELD_DWORD_GRANULARITY 4 #define ACPI_FIELD_QWORD_GRANULARITY 8 - /***************************************************************************** * * Namespace typedefs and structs @@ -164,15 +152,12 @@ struct acpi_mutex_info /* Operational modes of the AML interpreter/scanner */ -typedef enum -{ - ACPI_IMODE_LOAD_PASS1 = 0x01, - ACPI_IMODE_LOAD_PASS2 = 0x02, - ACPI_IMODE_EXECUTE = 0x0E - +typedef enum { + ACPI_IMODE_LOAD_PASS1 = 0x01, + ACPI_IMODE_LOAD_PASS2 = 0x02, + ACPI_IMODE_EXECUTE = 0x0E } acpi_interpreter_mode; - /* * The Node describes a named object that appears in the AML * An acpi_node is used to store Nodes. @@ -180,41 +165,37 @@ typedef enum * data_type is used to differentiate between internal descriptors, and MUST * be the first byte in this structure. */ -union acpi_name_union -{ - u32 integer; - char ascii[4]; -}; - -struct acpi_namespace_node -{ - u8 descriptor; /* Used to differentiate object descriptor types */ - u8 type; /* Type associated with this name */ - u16 reference_count; /* Current count of references and children */ - union acpi_name_union name; /* ACPI Name, always 4 chars per ACPI spec */ - union acpi_operand_object *object; /* Pointer to attached ACPI object (optional) */ - struct acpi_namespace_node *child; /* First child */ - struct acpi_namespace_node *peer; /* Next peer*/ - u8 owner_id; /* Who created this node */ - u8 flags; +union acpi_name_union { + u32 integer; + char ascii[4]; +}; + +struct acpi_namespace_node { + u8 descriptor; /* Used to differentiate object descriptor types */ + u8 type; /* Type associated with this name */ + u16 reference_count; /* Current count of references and children */ + union acpi_name_union name; /* ACPI Name, always 4 chars per ACPI spec */ + union acpi_operand_object *object; /* Pointer to attached ACPI object (optional) */ + struct acpi_namespace_node *child; /* First child */ + struct acpi_namespace_node *peer; /* Next peer */ + u8 owner_id; /* Who created this node */ + u8 flags; /* Fields used by the ASL compiler only */ #ifdef ACPI_ASL_COMPILER - u32 value; - union acpi_parse_object *op; + u32 value; + union acpi_parse_object *op; #endif }; - #define ACPI_ENTRY_NOT_FOUND NULL - /* Node flags */ #define ANOBJ_RESERVED 0x01 #define ANOBJ_END_OF_PEER_LIST 0x02 -#define ANOBJ_DATA_WIDTH_32 0x04 /* Parent table is 64-bits */ +#define ANOBJ_DATA_WIDTH_32 0x04 /* Parent table is 64-bits */ #define ANOBJ_METHOD_ARG 0x08 #define ANOBJ_METHOD_LOCAL 0x10 #define ANOBJ_METHOD_NO_RETVAL 0x20 @@ -224,91 +205,77 @@ struct acpi_namespace_node /* * ACPI Table Descriptor. One per ACPI table */ -struct acpi_table_desc -{ - struct acpi_table_desc *prev; - struct acpi_table_desc *next; - struct acpi_table_desc *installed_desc; - struct acpi_table_header *pointer; - u8 *aml_start; - u64 physical_address; - u32 aml_length; - acpi_size length; - acpi_owner_id owner_id; - u8 type; - u8 allocation; - u8 loaded_into_namespace; +struct acpi_table_desc { + struct acpi_table_desc *prev; + struct acpi_table_desc *next; + struct acpi_table_desc *installed_desc; + struct acpi_table_header *pointer; + u8 *aml_start; + u64 physical_address; + u32 aml_length; + acpi_size length; + acpi_owner_id owner_id; + u8 type; + u8 allocation; + u8 loaded_into_namespace; }; -struct acpi_table_list -{ - struct acpi_table_desc *next; - u32 count; +struct acpi_table_list { + struct acpi_table_desc *next; + u32 count; }; - -struct acpi_find_context -{ - char *search_for; - acpi_handle *list; - u32 *count; +struct acpi_find_context { + char *search_for; + acpi_handle *list; + u32 *count; }; - -struct acpi_ns_search_data -{ - struct acpi_namespace_node *node; +struct acpi_ns_search_data { + struct acpi_namespace_node *node; }; - /* * Predefined Namespace items */ -struct acpi_predefined_names -{ - char *name; - u8 type; - char *val; +struct acpi_predefined_names { + char *name; + u8 type; + char *val; }; - /* Object types used during package copies */ - #define ACPI_COPY_TYPE_SIMPLE 0 #define ACPI_COPY_TYPE_PACKAGE 1 /* Info structure used to convert external<->internal namestrings */ -struct acpi_namestring_info -{ - char *external_name; - char *next_external_char; - char *internal_name; - u32 length; - u32 num_segments; - u32 num_carats; - u8 fully_qualified; +struct acpi_namestring_info { + char *external_name; + char *next_external_char; + char *internal_name; + u32 length; + u32 num_segments; + u32 num_carats; + u8 fully_qualified; }; - /* Field creation info */ -struct acpi_create_field_info -{ - struct acpi_namespace_node *region_node; - struct acpi_namespace_node *field_node; - struct acpi_namespace_node *register_node; - struct acpi_namespace_node *data_register_node; - u32 bank_value; - u32 field_bit_position; - u32 field_bit_length; - u8 field_flags; - u8 attribute; - u8 field_type; +struct acpi_create_field_info { + struct acpi_namespace_node *region_node; + struct acpi_namespace_node *field_node; + struct acpi_namespace_node *register_node; + struct acpi_namespace_node *data_register_node; + u32 bank_value; + u32 field_bit_position; + u32 field_bit_length; + u8 field_flags; + u8 attribute; + u8 field_type; }; - /***************************************************************************** * * Event typedefs and structs @@ -317,108 +284,95 @@ struct acpi_create_field_info /* Dispatch info for each GPE -- either a method or handler, cannot be both */ -struct acpi_handler_info -{ - acpi_event_handler address; /* Address of handler, if any */ - void *context; /* Context to be passed to handler */ - struct acpi_namespace_node *method_node; /* Method node for this GPE level (saved) */ +struct acpi_handler_info { + acpi_event_handler address; /* Address of handler, if any */ + void *context; /* Context to be passed to handler */ + struct acpi_namespace_node *method_node; /* Method node for this GPE level (saved) */ }; -union acpi_gpe_dispatch_info -{ - struct acpi_namespace_node *method_node; /* Method node for this GPE level */ - struct acpi_handler_info *handler; +union acpi_gpe_dispatch_info { + struct acpi_namespace_node *method_node; /* Method node for this GPE level */ + struct acpi_handler_info *handler; }; /* * Information about a GPE, one per each GPE in an array. * NOTE: Important to keep this struct as small as possible. */ -struct acpi_gpe_event_info -{ - union acpi_gpe_dispatch_info dispatch; /* Either Method or Handler */ - struct acpi_gpe_register_info *register_info; /* Backpointer to register info */ - u8 flags; /* Misc info about this GPE */ - u8 register_bit; /* This GPE bit within the register */ +struct acpi_gpe_event_info { + union acpi_gpe_dispatch_info dispatch; /* Either Method or Handler */ + struct acpi_gpe_register_info *register_info; /* Backpointer to register info */ + u8 flags; /* Misc info about this GPE */ + u8 register_bit; /* This GPE bit within the register */ }; /* Information about a GPE register pair, one per each status/enable pair in an array */ -struct acpi_gpe_register_info -{ - struct acpi_generic_address status_address; /* Address of status reg */ - struct acpi_generic_address enable_address; /* Address of enable reg */ - u8 enable_for_wake; /* GPEs to keep enabled when sleeping */ - u8 enable_for_run; /* GPEs to keep enabled when running */ - u8 base_gpe_number; /* Base GPE number for this register */ +struct acpi_gpe_register_info { + struct acpi_generic_address status_address; /* Address of status reg */ + struct acpi_generic_address enable_address; /* Address of enable reg */ + u8 enable_for_wake; /* GPEs to keep enabled when sleeping */ + u8 enable_for_run; /* GPEs to keep enabled when running */ + u8 base_gpe_number; /* Base GPE number for this register */ }; /* * Information about a GPE register block, one per each installed block -- * GPE0, GPE1, and one per each installed GPE Block Device. */ -struct acpi_gpe_block_info -{ - struct acpi_namespace_node *node; - struct acpi_gpe_block_info *previous; - struct acpi_gpe_block_info *next; - struct acpi_gpe_xrupt_info *xrupt_block; /* Backpointer to interrupt block */ - struct acpi_gpe_register_info *register_info; /* One per GPE register pair */ - struct acpi_gpe_event_info *event_info; /* One for each GPE */ - struct acpi_generic_address block_address; /* Base address of the block */ - u32 register_count; /* Number of register pairs in block */ - u8 block_base_number;/* Base GPE number for this block */ +struct acpi_gpe_block_info { + struct acpi_namespace_node *node; + struct acpi_gpe_block_info *previous; + struct acpi_gpe_block_info *next; + struct acpi_gpe_xrupt_info *xrupt_block; /* Backpointer to interrupt block */ + struct acpi_gpe_register_info *register_info; /* One per GPE register pair */ + struct acpi_gpe_event_info *event_info; /* One for each GPE */ + struct acpi_generic_address block_address; /* Base address of the block */ + u32 register_count; /* Number of register pairs in block */ + u8 block_base_number; /* Base GPE number for this block */ }; /* Information about GPE interrupt handlers, one per each interrupt level used for GPEs */ -struct acpi_gpe_xrupt_info -{ - struct acpi_gpe_xrupt_info *previous; - struct acpi_gpe_xrupt_info *next; - struct acpi_gpe_block_info *gpe_block_list_head; /* List of GPE blocks for this xrupt */ - u32 interrupt_number; /* System interrupt number */ +struct acpi_gpe_xrupt_info { + struct acpi_gpe_xrupt_info *previous; + struct acpi_gpe_xrupt_info *next; + struct acpi_gpe_block_info *gpe_block_list_head; /* List of GPE blocks for this xrupt */ + u32 interrupt_number; /* System interrupt number */ }; - -struct acpi_gpe_walk_info -{ - struct acpi_namespace_node *gpe_device; - struct acpi_gpe_block_info *gpe_block; +struct acpi_gpe_walk_info { + struct acpi_namespace_node *gpe_device; + struct acpi_gpe_block_info *gpe_block; }; - -typedef acpi_status (*ACPI_GPE_CALLBACK) ( - struct acpi_gpe_xrupt_info *gpe_xrupt_info, - struct acpi_gpe_block_info *gpe_block); - +typedef acpi_status(*ACPI_GPE_CALLBACK) (struct acpi_gpe_xrupt_info * + gpe_xrupt_info, + struct acpi_gpe_block_info * + gpe_block); /* Information about each particular fixed event */ -struct acpi_fixed_event_handler -{ - acpi_event_handler handler; /* Address of handler. */ - void *context; /* Context to be passed to handler */ +struct acpi_fixed_event_handler { + acpi_event_handler handler; /* Address of handler. */ + void *context; /* Context to be passed to handler */ }; -struct acpi_fixed_event_info -{ - u8 status_register_id; - u8 enable_register_id; - u16 status_bit_mask; - u16 enable_bit_mask; +struct acpi_fixed_event_info { + u8 status_register_id; + u8 enable_register_id; + u16 status_bit_mask; + u16 enable_bit_mask; }; /* Information used during field processing */ -struct acpi_field_info -{ - u8 skip_field; - u8 field_flag; - u32 pkg_length; +struct acpi_field_info { + u8 skip_field; + u8 field_flag; + u32 pkg_length; }; - /***************************************************************************** * * Generic "state" object for stacks @@ -431,7 +385,6 @@ struct acpi_field_info #define ACPI_CONTROL_PREDICATE_FALSE 0xC3 #define ACPI_CONTROL_PREDICATE_TRUE 0xC4 - #define ACPI_STATE_COMMON /* Two 32-bit fields and a pointer */\ u8 data_type; /* To differentiate various internal objs */\ u8 flags; \ @@ -440,147 +393,112 @@ struct acpi_field_info u16 reserved; \ void *next; \ -struct acpi_common_state -{ - ACPI_STATE_COMMON -}; - +struct acpi_common_state { +ACPI_STATE_COMMON}; /* * Update state - used to traverse complex objects such as packages */ -struct acpi_update_state -{ - ACPI_STATE_COMMON - union acpi_operand_object *object; +struct acpi_update_state { + ACPI_STATE_COMMON union acpi_operand_object *object; }; - /* * Pkg state - used to traverse nested package structures */ -struct acpi_pkg_state -{ - ACPI_STATE_COMMON - union acpi_operand_object *source_object; - union acpi_operand_object *dest_object; - struct acpi_walk_state *walk_state; - void *this_target_obj; - u32 num_packages; - u16 index; +struct acpi_pkg_state { + ACPI_STATE_COMMON union acpi_operand_object *source_object; + union acpi_operand_object *dest_object; + struct acpi_walk_state *walk_state; + void *this_target_obj; + u32 num_packages; + u16 index; }; - /* * Control state - one per if/else and while constructs. * Allows nesting of these constructs */ -struct acpi_control_state -{ - ACPI_STATE_COMMON - union acpi_parse_object *predicate_op; - u8 *aml_predicate_start; /* Start of if/while predicate */ - u8 *package_end; /* End of if/while block */ - u16 opcode; +struct acpi_control_state { + ACPI_STATE_COMMON union acpi_parse_object *predicate_op; + u8 *aml_predicate_start; /* Start of if/while predicate */ + u8 *package_end; /* End of if/while block */ + u16 opcode; }; - /* * Scope state - current scope during namespace lookups */ -struct acpi_scope_state -{ - ACPI_STATE_COMMON - struct acpi_namespace_node *node; +struct acpi_scope_state { + ACPI_STATE_COMMON struct acpi_namespace_node *node; }; - -struct acpi_pscope_state -{ - ACPI_STATE_COMMON - union acpi_parse_object *op; /* Current op being parsed */ - u8 *arg_end; /* Current argument end */ - u8 *pkg_end; /* Current package end */ - u32 arg_list; /* Next argument to parse */ - u32 arg_count; /* Number of fixed arguments */ +struct acpi_pscope_state { + ACPI_STATE_COMMON union acpi_parse_object *op; /* Current op being parsed */ + u8 *arg_end; /* Current argument end */ + u8 *pkg_end; /* Current package end */ + u32 arg_list; /* Next argument to parse */ + u32 arg_count; /* Number of fixed arguments */ }; - /* * Thread state - one per thread across multiple walk states. Multiple walk * states are created when there are nested control methods executing. */ -struct acpi_thread_state -{ - ACPI_STATE_COMMON - struct acpi_walk_state *walk_state_list; /* Head of list of walk_states for this thread */ - union acpi_operand_object *acquired_mutex_list; /* List of all currently acquired mutexes */ - u32 thread_id; /* Running thread ID */ - u8 current_sync_level; /* Mutex Sync (nested acquire) level */ +struct acpi_thread_state { + ACPI_STATE_COMMON struct acpi_walk_state *walk_state_list; /* Head of list of walk_states for this thread */ + union acpi_operand_object *acquired_mutex_list; /* List of all currently acquired mutexes */ + u32 thread_id; /* Running thread ID */ + u8 current_sync_level; /* Mutex Sync (nested acquire) level */ }; - /* * Result values - used to accumulate the results of nested * AML arguments */ -struct acpi_result_values -{ +struct acpi_result_values { ACPI_STATE_COMMON - union acpi_operand_object *obj_desc [ACPI_OBJ_NUM_OPERANDS]; - u8 num_results; - u8 last_insert; + union acpi_operand_object *obj_desc[ACPI_OBJ_NUM_OPERANDS]; + u8 num_results; + u8 last_insert; }; - typedef -acpi_status (*acpi_parse_downwards) ( - struct acpi_walk_state *walk_state, - union acpi_parse_object **out_op); - -typedef -acpi_status (*acpi_parse_upwards) ( - struct acpi_walk_state *walk_state); +acpi_status(*acpi_parse_downwards) (struct acpi_walk_state * walk_state, + union acpi_parse_object ** out_op); +typedef acpi_status(*acpi_parse_upwards) (struct acpi_walk_state * walk_state); /* * Notify info - used to pass info to the deferred notify * handler/dispatcher. */ -struct acpi_notify_info -{ - ACPI_STATE_COMMON - struct acpi_namespace_node *node; - union acpi_operand_object *handler_obj; +struct acpi_notify_info { + ACPI_STATE_COMMON struct acpi_namespace_node *node; + union acpi_operand_object *handler_obj; }; - /* Generic state is union of structs above */ -union acpi_generic_state -{ - struct acpi_common_state common; - struct acpi_control_state control; - struct acpi_update_state update; - struct acpi_scope_state scope; - struct acpi_pscope_state parse_scope; - struct acpi_pkg_state pkg; - struct acpi_thread_state thread; - struct acpi_result_values results; - struct acpi_notify_info notify; +union acpi_generic_state { + struct acpi_common_state common; + struct acpi_control_state control; + struct acpi_update_state update; + struct acpi_scope_state scope; + struct acpi_pscope_state parse_scope; + struct acpi_pkg_state pkg; + struct acpi_thread_state thread; + struct acpi_result_values results; + struct acpi_notify_info notify; }; - /***************************************************************************** * * Interpreter typedefs and structs * ****************************************************************************/ -typedef -acpi_status (*ACPI_EXECUTE_OP) ( - struct acpi_walk_state *walk_state); - +typedef acpi_status(*ACPI_EXECUTE_OP) (struct acpi_walk_state * walk_state); /***************************************************************************** * @@ -591,28 +509,26 @@ acpi_status (*ACPI_EXECUTE_OP) ( /* * AML opcode, name, and argument layout */ -struct acpi_opcode_info -{ +struct acpi_opcode_info { #if defined(ACPI_DISASSEMBLER) || defined(ACPI_DEBUG_OUTPUT) - char *name; /* Opcode name (disassembler/debug only) */ + char *name; /* Opcode name (disassembler/debug only) */ #endif - u32 parse_args; /* Grammar/Parse time arguments */ - u32 runtime_args; /* Interpret time arguments */ - u32 flags; /* Misc flags */ - u8 object_type; /* Corresponding internal object type */ - u8 class; /* Opcode class */ - u8 type; /* Opcode type */ + u32 parse_args; /* Grammar/Parse time arguments */ + u32 runtime_args; /* Interpret time arguments */ + u32 flags; /* Misc flags */ + u8 object_type; /* Corresponding internal object type */ + u8 class; /* Opcode class */ + u8 type; /* Opcode type */ }; -union acpi_parse_value -{ - acpi_integer integer; /* Integer constant (Up to 64 bits) */ - struct uint64_struct integer64; /* Structure overlay for 2 32-bit Dwords */ - u32 size; /* bytelist or field size */ - char *string; /* NULL terminated string */ - u8 *buffer; /* buffer or string */ - char *name; /* NULL terminated string */ - union acpi_parse_object *arg; /* arguments and contained ops */ +union acpi_parse_value { + acpi_integer integer; /* Integer constant (Up to 64 bits) */ + struct uint64_struct integer64; /* Structure overlay for 2 32-bit Dwords */ + u32 size; /* bytelist or field size */ + char *string; /* NULL terminated string */ + u8 *buffer; /* buffer or string */ + char *name; /* NULL terminated string */ + union acpi_parse_object *arg; /* arguments and contained ops */ }; #define ACPI_PARSE_COMMON \ @@ -641,84 +557,72 @@ union acpi_parse_value /* * generic operation (for example: If, While, Store) */ -struct acpi_parse_obj_common -{ - ACPI_PARSE_COMMON -}; - +struct acpi_parse_obj_common { +ACPI_PARSE_COMMON}; /* * Extended Op for named ops (Scope, Method, etc.), deferred ops (Methods and op_regions), * and bytelists. */ -struct acpi_parse_obj_named -{ - ACPI_PARSE_COMMON - u8 *path; - u8 *data; /* AML body or bytelist data */ - u32 length; /* AML length */ - u32 name; /* 4-byte name or zero if no name */ +struct acpi_parse_obj_named { + ACPI_PARSE_COMMON u8 * path; + u8 *data; /* AML body or bytelist data */ + u32 length; /* AML length */ + u32 name; /* 4-byte name or zero if no name */ }; - /* The parse node is the fundamental element of the parse tree */ -struct acpi_parse_obj_asl -{ - ACPI_PARSE_COMMON - union acpi_parse_object *child; - union acpi_parse_object *parent_method; - char *filename; - char *external_name; - char *namepath; - char name_seg[4]; - u32 extra_value; - u32 column; - u32 line_number; - u32 logical_line_number; - u32 logical_byte_offset; - u32 end_line; - u32 end_logical_line; - u32 acpi_btype; - u32 aml_length; - u32 aml_subtree_length; - u32 final_aml_length; - u32 final_aml_offset; - u32 compile_flags; - u16 parse_opcode; - u8 aml_opcode_length; - u8 aml_pkg_len_bytes; - u8 extra; - char parse_op_name[12]; -}; - -union acpi_parse_object -{ - struct acpi_parse_obj_common common; - struct acpi_parse_obj_named named; - struct acpi_parse_obj_asl asl; +struct acpi_parse_obj_asl { + ACPI_PARSE_COMMON union acpi_parse_object *child; + union acpi_parse_object *parent_method; + char *filename; + char *external_name; + char *namepath; + char name_seg[4]; + u32 extra_value; + u32 column; + u32 line_number; + u32 logical_line_number; + u32 logical_byte_offset; + u32 end_line; + u32 end_logical_line; + u32 acpi_btype; + u32 aml_length; + u32 aml_subtree_length; + u32 final_aml_length; + u32 final_aml_offset; + u32 compile_flags; + u16 parse_opcode; + u8 aml_opcode_length; + u8 aml_pkg_len_bytes; + u8 extra; + char parse_op_name[12]; +}; + +union acpi_parse_object { + struct acpi_parse_obj_common common; + struct acpi_parse_obj_named named; + struct acpi_parse_obj_asl asl; }; - /* * Parse state - one state per parser invocation and each control * method. */ -struct acpi_parse_state -{ - u32 aml_size; - u8 *aml_start; /* First AML byte */ - u8 *aml; /* Next AML byte */ - u8 *aml_end; /* (last + 1) AML byte */ - u8 *pkg_start; /* Current package begin */ - u8 *pkg_end; /* Current package end */ - union acpi_parse_object *start_op; /* Root of parse tree */ - struct acpi_namespace_node *start_node; - union acpi_generic_state *scope; /* Current scope */ - union acpi_parse_object *start_scope; +struct acpi_parse_state { + u32 aml_size; + u8 *aml_start; /* First AML byte */ + u8 *aml; /* Next AML byte */ + u8 *aml_end; /* (last + 1) AML byte */ + u8 *pkg_start; /* Current package begin */ + u8 *pkg_end; /* Current package end */ + union acpi_parse_object *start_op; /* Root of parse tree */ + struct acpi_namespace_node *start_node; + union acpi_generic_state *scope; /* Current scope */ + union acpi_parse_object *start_scope; }; - /* Parse object flags */ #define ACPI_PARSEOP_GENERIC 0x01 @@ -734,7 +638,6 @@ struct acpi_parse_state #define ACPI_PARSEOP_EMPTY_TERMLIST 0x04 #define ACPI_PARSEOP_SPECIAL 0x10 - /***************************************************************************** * * Hardware (ACPI registers) and PNP @@ -744,14 +647,12 @@ struct acpi_parse_state #define PCI_ROOT_HID_STRING "PNP0A03" #define PCI_EXPRESS_ROOT_HID_STRING "PNP0A08" -struct acpi_bit_register_info -{ - u8 parent_register; - u8 bit_position; - u16 access_bit_mask; +struct acpi_bit_register_info { + u8 parent_register; + u8 bit_position; + u16 access_bit_mask; }; - /* * Register IDs * These are the full ACPI registers @@ -766,7 +667,6 @@ struct acpi_bit_register_info #define ACPI_REGISTER_PROCESSOR_BLOCK 0x08 #define ACPI_REGISTER_SMI_COMMAND_BLOCK 0x09 - /* Masks used to access the bit_registers */ #define ACPI_BITMASK_TIMER_STATUS 0x0001 @@ -775,7 +675,7 @@ struct acpi_bit_register_info #define ACPI_BITMASK_POWER_BUTTON_STATUS 0x0100 #define ACPI_BITMASK_SLEEP_BUTTON_STATUS 0x0200 #define ACPI_BITMASK_RT_CLOCK_STATUS 0x0400 -#define ACPI_BITMASK_PCIEXP_WAKE_STATUS 0x4000 /* ACPI 3.0 */ +#define ACPI_BITMASK_PCIEXP_WAKE_STATUS 0x4000 /* ACPI 3.0 */ #define ACPI_BITMASK_WAKE_STATUS 0x8000 #define ACPI_BITMASK_ALL_FIXED_STATUS (ACPI_BITMASK_TIMER_STATUS | \ @@ -791,7 +691,7 @@ struct acpi_bit_register_info #define ACPI_BITMASK_POWER_BUTTON_ENABLE 0x0100 #define ACPI_BITMASK_SLEEP_BUTTON_ENABLE 0x0200 #define ACPI_BITMASK_RT_CLOCK_ENABLE 0x0400 -#define ACPI_BITMASK_PCIEXP_WAKE_DISABLE 0x4000 /* ACPI 3.0 */ +#define ACPI_BITMASK_PCIEXP_WAKE_DISABLE 0x4000 /* ACPI 3.0 */ #define ACPI_BITMASK_SCI_ENABLE 0x0001 #define ACPI_BITMASK_BUS_MASTER_RLD 0x0002 @@ -801,7 +701,6 @@ struct acpi_bit_register_info #define ACPI_BITMASK_ARB_DISABLE 0x0001 - /* Raw bit position of each bit_register */ #define ACPI_BITPOSITION_TIMER_STATUS 0x00 @@ -810,7 +709,7 @@ struct acpi_bit_register_info #define ACPI_BITPOSITION_POWER_BUTTON_STATUS 0x08 #define ACPI_BITPOSITION_SLEEP_BUTTON_STATUS 0x09 #define ACPI_BITPOSITION_RT_CLOCK_STATUS 0x0A -#define ACPI_BITPOSITION_PCIEXP_WAKE_STATUS 0x0E /* ACPI 3.0 */ +#define ACPI_BITPOSITION_PCIEXP_WAKE_STATUS 0x0E /* ACPI 3.0 */ #define ACPI_BITPOSITION_WAKE_STATUS 0x0F #define ACPI_BITPOSITION_TIMER_ENABLE 0x00 @@ -818,7 +717,7 @@ struct acpi_bit_register_info #define ACPI_BITPOSITION_POWER_BUTTON_ENABLE 0x08 #define ACPI_BITPOSITION_SLEEP_BUTTON_ENABLE 0x09 #define ACPI_BITPOSITION_RT_CLOCK_ENABLE 0x0A -#define ACPI_BITPOSITION_PCIEXP_WAKE_DISABLE 0x0E /* ACPI 3.0 */ +#define ACPI_BITPOSITION_PCIEXP_WAKE_DISABLE 0x0E /* ACPI 3.0 */ #define ACPI_BITPOSITION_SCI_ENABLE 0x00 #define ACPI_BITPOSITION_BUS_MASTER_RLD 0x01 @@ -828,7 +727,6 @@ struct acpi_bit_register_info #define ACPI_BITPOSITION_ARB_DISABLE 0x00 - /***************************************************************************** * * Resource descriptors @@ -847,8 +745,7 @@ struct acpi_bit_register_info #define ACPI_RDESC_TYPE_SMALL 0x00 #define ACPI_RDESC_TYPE_MASK 0x80 -#define ACPI_RDESC_SMALL_MASK 0x78 /* Only bits 6:3 contain the type */ - +#define ACPI_RDESC_SMALL_MASK 0x78 /* Only bits 6:3 contain the type */ /* * Small resource descriptor types @@ -877,7 +774,6 @@ struct acpi_bit_register_info #define ACPI_RDESC_TYPE_QWORD_ADDRESS_SPACE 0x8A #define ACPI_RDESC_TYPE_EXTENDED_ADDRESS_SPACE 0x8B - /***************************************************************************** * * Miscellaneous @@ -886,35 +782,30 @@ struct acpi_bit_register_info #define ACPI_ASCII_ZERO 0x30 - /***************************************************************************** * * Debugger * ****************************************************************************/ -struct acpi_db_method_info -{ - acpi_handle thread_gate; - char *name; - char **args; - u32 flags; - u32 num_loops; - char pathname[128]; +struct acpi_db_method_info { + acpi_handle thread_gate; + char *name; + char **args; + u32 flags; + u32 num_loops; + char pathname[128]; }; -struct acpi_integrity_info -{ - u32 nodes; - u32 objects; +struct acpi_integrity_info { + u32 nodes; + u32 objects; }; - #define ACPI_DB_REDIRECTABLE_OUTPUT 0x01 #define ACPI_DB_CONSOLE_OUTPUT 0x02 #define ACPI_DB_DUPLICATE_OUTPUT 0x03 - /***************************************************************************** * * Debug @@ -936,43 +827,36 @@ struct acpi_integrity_info char module[ACPI_MAX_MODULE_NAME]; \ u8 alloc_type; -struct acpi_debug_mem_header -{ - ACPI_COMMON_DEBUG_MEM_HEADER -}; +struct acpi_debug_mem_header { +ACPI_COMMON_DEBUG_MEM_HEADER}; -struct acpi_debug_mem_block -{ - ACPI_COMMON_DEBUG_MEM_HEADER - u64 user_space; +struct acpi_debug_mem_block { + ACPI_COMMON_DEBUG_MEM_HEADER u64 user_space; }; - #define ACPI_MEM_LIST_GLOBAL 0 #define ACPI_MEM_LIST_NSNODE 1 #define ACPI_MEM_LIST_MAX 1 #define ACPI_NUM_MEM_LISTS 2 - -struct acpi_memory_list -{ - char *list_name; - void *list_head; - u16 object_size; - u16 max_depth; - u16 current_depth; - u16 link_offset; +struct acpi_memory_list { + char *list_name; + void *list_head; + u16 object_size; + u16 max_depth; + u16 current_depth; + u16 link_offset; #ifdef ACPI_DBG_TRACK_ALLOCATIONS /* Statistics for debug memory tracking only */ - u32 total_allocated; - u32 total_freed; - u32 current_total_size; - u32 requests; - u32 hits; + u32 total_allocated; + u32 total_freed; + u32 current_total_size; + u32 requests; + u32 hits; #endif }; -#endif /* __ACLOCAL_H__ */ +#endif /* __ACLOCAL_H__ */ diff --git a/include/acpi/acmacros.h b/include/acpi/acmacros.h index fcdef0a4b01..702cc4e57f5 100644 --- a/include/acpi/acmacros.h +++ b/include/acpi/acmacros.h @@ -44,7 +44,6 @@ #ifndef __ACMACROS_H__ #define __ACMACROS_H__ - /* * Data manipulation macros */ @@ -57,7 +56,6 @@ #define ACPI_CLEAR_BIT(target,bit) ((target) &= ~(bit)) #define ACPI_MIN(a,b) (((a)<(b))?(a):(b)) - #if ACPI_MACHINE_WIDTH == 16 /* @@ -168,7 +166,7 @@ /* 32-bit source, 16/32/64 destination */ -#define ACPI_MOVE_32_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */ +#define ACPI_MOVE_32_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */ #define ACPI_MOVE_32_TO_32(d,s) {(( u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[3];\ (( u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[2];\ @@ -183,9 +181,9 @@ /* 64-bit source, 16/32/64 destination */ -#define ACPI_MOVE_64_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */ +#define ACPI_MOVE_64_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */ -#define ACPI_MOVE_64_TO_32(d,s) ACPI_MOVE_32_TO_32(d,s) /* Truncate to 32 */ +#define ACPI_MOVE_64_TO_32(d,s) ACPI_MOVE_32_TO_32(d,s) /* Truncate to 32 */ #define ACPI_MOVE_64_TO_64(d,s) {(( u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[7];\ (( u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[6];\ @@ -219,14 +217,14 @@ /* 32-bit source, 16/32/64 destination */ -#define ACPI_MOVE_32_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */ +#define ACPI_MOVE_32_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */ #define ACPI_MOVE_32_TO_32(d,s) *(u32 *)(void *)(d) = *(u32 *)(void *)(s) #define ACPI_MOVE_32_TO_64(d,s) ACPI_MOVE_32_TO_32(d,s) /* 64-bit source, 16/32/64 destination */ -#define ACPI_MOVE_64_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */ -#define ACPI_MOVE_64_TO_32(d,s) ACPI_MOVE_32_TO_32(d,s) /* Truncate to 32 */ +#define ACPI_MOVE_64_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */ +#define ACPI_MOVE_64_TO_32(d,s) ACPI_MOVE_32_TO_32(d,s) /* Truncate to 32 */ #define ACPI_MOVE_64_TO_64(d,s) ACPI_MOVE_32_TO_32(d,s) #else @@ -238,14 +236,14 @@ /* 32-bit source, 16/32/64 destination */ -#define ACPI_MOVE_32_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */ +#define ACPI_MOVE_32_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */ #define ACPI_MOVE_32_TO_32(d,s) *(u32 *)(void *)(d) = *(u32 *)(void *)(s) #define ACPI_MOVE_32_TO_64(d,s) *(u64 *)(void *)(d) = *(u32 *)(void *)(s) /* 64-bit source, 16/32/64 destination */ -#define ACPI_MOVE_64_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */ -#define ACPI_MOVE_64_TO_32(d,s) ACPI_MOVE_32_TO_32(d,s) /* Truncate to 32 */ +#define ACPI_MOVE_64_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */ +#define ACPI_MOVE_64_TO_32(d,s) ACPI_MOVE_32_TO_32(d,s) /* Truncate to 32 */ #define ACPI_MOVE_64_TO_64(d,s) *(u64 *)(void *)(d) = *(u64 *)(void *)(s) #endif @@ -266,7 +264,7 @@ /* 32-bit source, 16/32/64 destination */ -#define ACPI_MOVE_32_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */ +#define ACPI_MOVE_32_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */ #define ACPI_MOVE_32_TO_32(d,s) {(( u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[0];\ (( u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[1];\ @@ -277,8 +275,8 @@ /* 64-bit source, 16/32/64 destination */ -#define ACPI_MOVE_64_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */ -#define ACPI_MOVE_64_TO_32(d,s) ACPI_MOVE_32_TO_32(d,s) /* Truncate to 32 */ +#define ACPI_MOVE_64_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */ +#define ACPI_MOVE_64_TO_32(d,s) ACPI_MOVE_32_TO_32(d,s) /* Truncate to 32 */ #define ACPI_MOVE_64_TO_64(d,s) {(( u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[0];\ (( u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[1];\ (( u8 *)(void *)(d))[2] = ((u8 *)(void *)(s))[2];\ @@ -305,7 +303,6 @@ #error unknown ACPI_MACHINE_WIDTH #endif - /* * Fast power-of-two math macros for non-optimized compilers */ @@ -329,7 +326,6 @@ #define ACPI_MUL_16(a) _ACPI_MUL(a,4) #define ACPI_MOD_16(a) _ACPI_MOD(a,16) - /* * Rounding macros (Power of two boundaries only) */ @@ -344,7 +340,6 @@ #define ACPI_ROUND_UP_to_64_bITS(a) ACPI_ROUND_UP(a,8) #define ACPI_ROUND_UP_TO_NATIVE_WORD(a) ACPI_ROUND_UP(a,ALIGNED_ADDRESS_BOUNDARY) - #define ACPI_ROUND_BITS_UP_TO_BYTES(a) ACPI_DIV_8((a) + 7) #define ACPI_ROUND_BITS_DOWN_TO_BYTES(a) ACPI_DIV_8((a)) @@ -365,7 +360,6 @@ #define ACPI_IS_OCTAL_DIGIT(d) (((char)(d) >= '0') && ((char)(d) <= '7')) - /* Bitfields within ACPI registers */ #define ACPI_REGISTER_PREPARE_BITS(val, pos, mask) ((val << pos) & mask) @@ -381,7 +375,6 @@ #define ACPI_GET_DESCRIPTOR_TYPE(d) (((union acpi_descriptor *)(void *)(d))->descriptor_id) #define ACPI_SET_DESCRIPTOR_TYPE(d,t) (((union acpi_descriptor *)(void *)(d))->descriptor_id = t) - /* Macro to test the object type */ #define ACPI_GET_OBJECT_TYPE(d) (((union acpi_operand_object *)(void *)(d))->common.type) @@ -430,7 +423,6 @@ #define GET_CURRENT_ARG_TYPE(list) (list & ((u32) 0x1F)) #define INCREMENT_ARG_LIST(list) (list >>= ((u32) ARG_TYPE_WIDTH)) - /* * Reporting macros that are never compiled out */ @@ -554,20 +546,17 @@ #define ACPI_DEBUG_ONLY_MEMBERS(a) a; #define _VERBOSE_STRUCTURES - /* Stack and buffer dumping */ #define ACPI_DUMP_STACK_ENTRY(a) acpi_ex_dump_operand((a),0) #define ACPI_DUMP_OPERANDS(a,b,c,d,e) acpi_ex_dump_operands(a,b,c,d,e,_acpi_module_name,__LINE__) - #define ACPI_DUMP_ENTRY(a,b) acpi_ns_dump_entry (a,b) #define ACPI_DUMP_PATHNAME(a,b,c,d) acpi_ns_dump_pathname(a,b,c,d) #define ACPI_DUMP_RESOURCE_LIST(a) acpi_rs_dump_resource_list(a) #define ACPI_DUMP_BUFFER(a,b) acpi_ut_dump_buffer((u8 *)a,b,DB_BYTE_DISPLAY,_COMPONENT) #define ACPI_BREAK_MSG(a) acpi_os_signal (ACPI_SIGNAL_BREAKPOINT,(a)) - /* * Generate INT3 on ACPI_ERROR (Debug only!) */ @@ -588,7 +577,6 @@ #define ACPI_DEBUG_PRINT(pl) acpi_ut_debug_print ACPI_PARAM_LIST(pl) #define ACPI_DEBUG_PRINT_RAW(pl) acpi_ut_debug_print_raw ACPI_PARAM_LIST(pl) - #else /* * This is the non-debug case -- make everything go away, @@ -639,7 +627,6 @@ #define ACPI_DEBUGGER_EXEC(a) #endif - /* * For 16-bit code, we want to shrink some things even though * we are using ACPI_DEBUG_OUTPUT to get the debug output @@ -650,7 +637,6 @@ #define ACPI_DEBUG_ONLY_MEMBERS(a) #endif - #ifdef ACPI_DEBUG_OUTPUT /* * 1) Set name to blanks @@ -663,7 +649,6 @@ #define ACPI_ADD_OBJECT_NAME(a,b) #endif - /* * Memory allocation tracking (DEBUG ONLY) */ @@ -685,6 +670,6 @@ #define ACPI_MEM_FREE(a) acpi_ut_free_and_track(a,_COMPONENT,_acpi_module_name,__LINE__) #define ACPI_MEM_TRACKING(a) a -#endif /* ACPI_DBG_TRACK_ALLOCATIONS */ +#endif /* ACPI_DBG_TRACK_ALLOCATIONS */ -#endif /* ACMACROS_H */ +#endif /* ACMACROS_H */ diff --git a/include/acpi/acnames.h b/include/acpi/acnames.h index 280e9ed7667..79152fbc8f8 100644 --- a/include/acpi/acnames.h +++ b/include/acpi/acnames.h @@ -71,9 +71,9 @@ /* Definitions of the predefined namespace names */ -#define ACPI_UNKNOWN_NAME (u32) 0x3F3F3F3F /* Unknown name is "????" */ -#define ACPI_ROOT_NAME (u32) 0x5F5F5F5C /* Root name is "\___" */ -#define ACPI_SYS_BUS_NAME (u32) 0x5F53425F /* Sys bus name is "_SB_" */ +#define ACPI_UNKNOWN_NAME (u32) 0x3F3F3F3F /* Unknown name is "????" */ +#define ACPI_ROOT_NAME (u32) 0x5F5F5F5C /* Root name is "\___" */ +#define ACPI_SYS_BUS_NAME (u32) 0x5F53425F /* Sys bus name is "_SB_" */ #define ACPI_NS_ROOT_PATH "\\" #define ACPI_NS_SYSTEM_BUS "_SB_" @@ -83,7 +83,4 @@ #define ACPI_FUNCTION_PREFIX2 'ipca' /*! [End] no source code translation !*/ - -#endif /* __ACNAMES_H__ */ - - +#endif /* __ACNAMES_H__ */ diff --git a/include/acpi/acnamesp.h b/include/acpi/acnamesp.h index 0c9ba707925..dd3501f7e5d 100644 --- a/include/acpi/acnamesp.h +++ b/include/acpi/acnamesp.h @@ -44,7 +44,6 @@ #ifndef __ACNAMESP_H__ #define __ACNAMESP_H__ - /* To search the entire name space, pass this as search_base */ #define ACPI_NS_ALL ((acpi_handle)0) @@ -54,8 +53,8 @@ * and should be one-to-one with values of acpi_object_type */ #define ACPI_NS_NORMAL 0 -#define ACPI_NS_NEWSCOPE 1 /* a definition of this type opens a name scope */ -#define ACPI_NS_LOCAL 2 /* suppress search of enclosing scopes */ +#define ACPI_NS_NEWSCOPE 1 /* a definition of this type opens a name scope */ +#define ACPI_NS_LOCAL 2 /* suppress search of enclosing scopes */ /* Flags for acpi_ns_lookup, acpi_ns_search_and_enter */ @@ -68,357 +67,237 @@ #define ACPI_NS_WALK_UNLOCK TRUE #define ACPI_NS_WALK_NO_UNLOCK FALSE - /* * nsinit - Namespace initialization */ -acpi_status -acpi_ns_initialize_objects ( - void); - -acpi_status -acpi_ns_initialize_devices ( - void); +acpi_status acpi_ns_initialize_objects(void); +acpi_status acpi_ns_initialize_devices(void); /* * nsload - Namespace loading */ -acpi_status -acpi_ns_load_namespace ( - void); +acpi_status acpi_ns_load_namespace(void); acpi_status -acpi_ns_load_table ( - struct acpi_table_desc *table_desc, - struct acpi_namespace_node *node); - +acpi_ns_load_table(struct acpi_table_desc *table_desc, + struct acpi_namespace_node *node); /* * nswalk - walk the namespace */ acpi_status -acpi_ns_walk_namespace ( - acpi_object_type type, - acpi_handle start_object, - u32 max_depth, - u8 unlock_before_callback, - acpi_walk_callback user_function, - void *context, - void **return_value); - -struct acpi_namespace_node * -acpi_ns_get_next_node ( - acpi_object_type type, - struct acpi_namespace_node *parent, - struct acpi_namespace_node *child); - +acpi_ns_walk_namespace(acpi_object_type type, + acpi_handle start_object, + u32 max_depth, + u8 unlock_before_callback, + acpi_walk_callback user_function, + void *context, void **return_value); + +struct acpi_namespace_node *acpi_ns_get_next_node(acpi_object_type type, + struct acpi_namespace_node + *parent, + struct acpi_namespace_node + *child); /* * nsparse - table parsing */ acpi_status -acpi_ns_parse_table ( - struct acpi_table_desc *table_desc, - struct acpi_namespace_node *scope); +acpi_ns_parse_table(struct acpi_table_desc *table_desc, + struct acpi_namespace_node *scope); acpi_status -acpi_ns_one_complete_parse ( - u8 pass_number, - struct acpi_table_desc *table_desc); - +acpi_ns_one_complete_parse(u8 pass_number, struct acpi_table_desc *table_desc); /* * nsaccess - Top-level namespace access */ -acpi_status -acpi_ns_root_initialize ( - void); +acpi_status acpi_ns_root_initialize(void); acpi_status -acpi_ns_lookup ( - union acpi_generic_state *scope_info, - char *name, - acpi_object_type type, - acpi_interpreter_mode interpreter_mode, - u32 flags, - struct acpi_walk_state *walk_state, - struct acpi_namespace_node **ret_node); - +acpi_ns_lookup(union acpi_generic_state *scope_info, + char *name, + acpi_object_type type, + acpi_interpreter_mode interpreter_mode, + u32 flags, + struct acpi_walk_state *walk_state, + struct acpi_namespace_node **ret_node); /* * nsalloc - Named object allocation/deallocation */ -struct acpi_namespace_node * -acpi_ns_create_node ( - u32 name); - -void -acpi_ns_delete_node ( - struct acpi_namespace_node *node); +struct acpi_namespace_node *acpi_ns_create_node(u32 name); -void -acpi_ns_delete_namespace_subtree ( - struct acpi_namespace_node *parent_handle); +void acpi_ns_delete_node(struct acpi_namespace_node *node); void -acpi_ns_delete_namespace_by_owner ( - acpi_owner_id owner_id); +acpi_ns_delete_namespace_subtree(struct acpi_namespace_node *parent_handle); -void -acpi_ns_detach_object ( - struct acpi_namespace_node *node); +void acpi_ns_delete_namespace_by_owner(acpi_owner_id owner_id); -void -acpi_ns_delete_children ( - struct acpi_namespace_node *parent); +void acpi_ns_detach_object(struct acpi_namespace_node *node); -int -acpi_ns_compare_names ( - char *name1, - char *name2); +void acpi_ns_delete_children(struct acpi_namespace_node *parent); +int acpi_ns_compare_names(char *name1, char *name2); /* * nsdump - Namespace dump/print utilities */ #ifdef ACPI_FUTURE_USAGE -void -acpi_ns_dump_tables ( - acpi_handle search_base, - u32 max_depth); -#endif /* ACPI_FUTURE_USAGE */ +void acpi_ns_dump_tables(acpi_handle search_base, u32 max_depth); +#endif /* ACPI_FUTURE_USAGE */ -void -acpi_ns_dump_entry ( - acpi_handle handle, - u32 debug_level); +void acpi_ns_dump_entry(acpi_handle handle, u32 debug_level); void -acpi_ns_dump_pathname ( - acpi_handle handle, - char *msg, - u32 level, - u32 component); +acpi_ns_dump_pathname(acpi_handle handle, char *msg, u32 level, u32 component); -void -acpi_ns_print_pathname ( - u32 num_segments, - char *pathname); +void acpi_ns_print_pathname(u32 num_segments, char *pathname); acpi_status -acpi_ns_dump_one_object ( - acpi_handle obj_handle, - u32 level, - void *context, - void **return_value); +acpi_ns_dump_one_object(acpi_handle obj_handle, + u32 level, void *context, void **return_value); #ifdef ACPI_FUTURE_USAGE void -acpi_ns_dump_objects ( - acpi_object_type type, - u8 display_type, - u32 max_depth, - acpi_owner_id owner_id, - acpi_handle start_handle); -#endif /* ACPI_FUTURE_USAGE */ - +acpi_ns_dump_objects(acpi_object_type type, + u8 display_type, + u32 max_depth, + acpi_owner_id owner_id, acpi_handle start_handle); +#endif /* ACPI_FUTURE_USAGE */ /* * nseval - Namespace evaluation functions */ -acpi_status -acpi_ns_evaluate_by_handle ( - struct acpi_parameter_info *info); +acpi_status acpi_ns_evaluate_by_handle(struct acpi_parameter_info *info); acpi_status -acpi_ns_evaluate_by_name ( - char *pathname, - struct acpi_parameter_info *info); +acpi_ns_evaluate_by_name(char *pathname, struct acpi_parameter_info *info); acpi_status -acpi_ns_evaluate_relative ( - char *pathname, - struct acpi_parameter_info *info); - +acpi_ns_evaluate_relative(char *pathname, struct acpi_parameter_info *info); /* * nsnames - Name and Scope manipulation */ -u32 -acpi_ns_opens_scope ( - acpi_object_type type); +u32 acpi_ns_opens_scope(acpi_object_type type); -char * -acpi_ns_get_external_pathname ( - struct acpi_namespace_node *node); +char *acpi_ns_get_external_pathname(struct acpi_namespace_node *node); -char * -acpi_ns_name_of_current_scope ( - struct acpi_walk_state *walk_state); +char *acpi_ns_name_of_current_scope(struct acpi_walk_state *walk_state); acpi_status -acpi_ns_handle_to_pathname ( - acpi_handle target_handle, - struct acpi_buffer *buffer); +acpi_ns_handle_to_pathname(acpi_handle target_handle, + struct acpi_buffer *buffer); u8 -acpi_ns_pattern_match ( - struct acpi_namespace_node *obj_node, - char *search_for); +acpi_ns_pattern_match(struct acpi_namespace_node *obj_node, char *search_for); acpi_status -acpi_ns_get_node_by_path ( - char *external_pathname, - struct acpi_namespace_node *in_prefix_node, - u32 flags, - struct acpi_namespace_node **out_node); - -acpi_size -acpi_ns_get_pathname_length ( - struct acpi_namespace_node *node); +acpi_ns_get_node_by_path(char *external_pathname, + struct acpi_namespace_node *in_prefix_node, + u32 flags, struct acpi_namespace_node **out_node); +acpi_size acpi_ns_get_pathname_length(struct acpi_namespace_node *node); /* * nsobject - Object management for namespace nodes */ acpi_status -acpi_ns_attach_object ( - struct acpi_namespace_node *node, - union acpi_operand_object *object, - acpi_object_type type); +acpi_ns_attach_object(struct acpi_namespace_node *node, + union acpi_operand_object *object, acpi_object_type type); -union acpi_operand_object * -acpi_ns_get_attached_object ( - struct acpi_namespace_node *node); +union acpi_operand_object *acpi_ns_get_attached_object(struct + acpi_namespace_node + *node); -union acpi_operand_object * -acpi_ns_get_secondary_object ( - union acpi_operand_object *obj_desc); +union acpi_operand_object *acpi_ns_get_secondary_object(union + acpi_operand_object + *obj_desc); acpi_status -acpi_ns_attach_data ( - struct acpi_namespace_node *node, - acpi_object_handler handler, - void *data); +acpi_ns_attach_data(struct acpi_namespace_node *node, + acpi_object_handler handler, void *data); acpi_status -acpi_ns_detach_data ( - struct acpi_namespace_node *node, - acpi_object_handler handler); +acpi_ns_detach_data(struct acpi_namespace_node *node, + acpi_object_handler handler); acpi_status -acpi_ns_get_attached_data ( - struct acpi_namespace_node *node, - acpi_object_handler handler, - void **data); - +acpi_ns_get_attached_data(struct acpi_namespace_node *node, + acpi_object_handler handler, void **data); /* * nssearch - Namespace searching and entry */ acpi_status -acpi_ns_search_and_enter ( - u32 entry_name, - struct acpi_walk_state *walk_state, - struct acpi_namespace_node *node, - acpi_interpreter_mode interpreter_mode, - acpi_object_type type, - u32 flags, - struct acpi_namespace_node **ret_node); +acpi_ns_search_and_enter(u32 entry_name, + struct acpi_walk_state *walk_state, + struct acpi_namespace_node *node, + acpi_interpreter_mode interpreter_mode, + acpi_object_type type, + u32 flags, struct acpi_namespace_node **ret_node); acpi_status -acpi_ns_search_node ( - u32 entry_name, - struct acpi_namespace_node *node, - acpi_object_type type, - struct acpi_namespace_node **ret_node); +acpi_ns_search_node(u32 entry_name, + struct acpi_namespace_node *node, + acpi_object_type type, + struct acpi_namespace_node **ret_node); void -acpi_ns_install_node ( - struct acpi_walk_state *walk_state, - struct acpi_namespace_node *parent_node, - struct acpi_namespace_node *node, - acpi_object_type type); - +acpi_ns_install_node(struct acpi_walk_state *walk_state, + struct acpi_namespace_node *parent_node, + struct acpi_namespace_node *node, acpi_object_type type); /* * nsutils - Utility functions */ -u8 -acpi_ns_valid_root_prefix ( - char prefix); +u8 acpi_ns_valid_root_prefix(char prefix); -acpi_object_type -acpi_ns_get_type ( - struct acpi_namespace_node *node); +acpi_object_type acpi_ns_get_type(struct acpi_namespace_node *node); -u32 -acpi_ns_local ( - acpi_object_type type); +u32 acpi_ns_local(acpi_object_type type); void -acpi_ns_report_error ( - char *module_name, - u32 line_number, - u32 component_id, - char *internal_name, - acpi_status lookup_status); +acpi_ns_report_error(char *module_name, + u32 line_number, + u32 component_id, + char *internal_name, acpi_status lookup_status); void -acpi_ns_report_method_error ( - char *module_name, - u32 line_number, - u32 component_id, - char *message, - struct acpi_namespace_node *node, - char *path, - acpi_status lookup_status); +acpi_ns_report_method_error(char *module_name, + u32 line_number, + u32 component_id, + char *message, + struct acpi_namespace_node *node, + char *path, acpi_status lookup_status); -void -acpi_ns_print_node_pathname ( - struct acpi_namespace_node *node, - char *msg); +void acpi_ns_print_node_pathname(struct acpi_namespace_node *node, char *msg); -acpi_status -acpi_ns_build_internal_name ( - struct acpi_namestring_info *info); +acpi_status acpi_ns_build_internal_name(struct acpi_namestring_info *info); -void -acpi_ns_get_internal_name_length ( - struct acpi_namestring_info *info); +void acpi_ns_get_internal_name_length(struct acpi_namestring_info *info); -acpi_status -acpi_ns_internalize_name ( - char *dotted_name, - char **converted_name); +acpi_status acpi_ns_internalize_name(char *dotted_name, char **converted_name); acpi_status -acpi_ns_externalize_name ( - u32 internal_name_length, - char *internal_name, - u32 *converted_name_length, - char **converted_name); +acpi_ns_externalize_name(u32 internal_name_length, + char *internal_name, + u32 * converted_name_length, char **converted_name); -struct acpi_namespace_node * -acpi_ns_map_handle_to_node ( - acpi_handle handle); +struct acpi_namespace_node *acpi_ns_map_handle_to_node(acpi_handle handle); -acpi_handle -acpi_ns_convert_entry_to_handle( - struct acpi_namespace_node *node); - -void -acpi_ns_terminate ( - void); +acpi_handle acpi_ns_convert_entry_to_handle(struct acpi_namespace_node *node); -struct acpi_namespace_node * -acpi_ns_get_parent_node ( - struct acpi_namespace_node *node); +void acpi_ns_terminate(void); +struct acpi_namespace_node *acpi_ns_get_parent_node(struct acpi_namespace_node + *node); -struct acpi_namespace_node * -acpi_ns_get_next_valid_node ( - struct acpi_namespace_node *node); +struct acpi_namespace_node *acpi_ns_get_next_valid_node(struct + acpi_namespace_node + *node); -#endif /* __ACNAMESP_H__ */ +#endif /* __ACNAMESP_H__ */ diff --git a/include/acpi/acobject.h b/include/acpi/acobject.h index 34f9d1f1f79..4a326ba6d48 100644 --- a/include/acpi/acobject.h +++ b/include/acpi/acobject.h @@ -45,7 +45,6 @@ #ifndef _ACOBJECT_H #define _ACOBJECT_H - /* * The union acpi_operand_object is used to pass AML operands from the dispatcher * to the interpreter, and to keep track of the various handlers such as @@ -81,7 +80,6 @@ #define AOPOBJ_SETUP_COMPLETE 0x10 #define AOPOBJ_SINGLE_DATUM 0x20 - /* * Common bitfield for the field objects * "Field Datum" -- a datum from the actual field object @@ -96,8 +94,7 @@ u8 start_field_bit_offset;/* Bit offset within first field datum (0-63) */\ u8 access_bit_width; /* Read/Write size in bits (8-64) */\ u32 value; /* Value to store into the Bank or Index register */\ - struct acpi_namespace_node *node; /* Link back to parent node */ - + struct acpi_namespace_node *node; /* Link back to parent node */ /* * Fields common to both Strings and Buffers @@ -105,15 +102,13 @@ #define ACPI_COMMON_BUFFER_INFO \ u32 length; - /* * Common fields for objects that support ASL notifications */ #define ACPI_COMMON_NOTIFY_INFO \ union acpi_operand_object *system_notify; /* Handler for system notifies */\ union acpi_operand_object *device_notify; /* Handler for driver notifies */\ - union acpi_operand_object *handler; /* Handler for Address space */ - + union acpi_operand_object *handler; /* Handler for Address space */ /****************************************************************************** * @@ -121,161 +116,110 @@ * *****************************************************************************/ -struct acpi_object_common -{ - ACPI_OBJECT_COMMON_HEADER -}; +struct acpi_object_common { +ACPI_OBJECT_COMMON_HEADER}; - -struct acpi_object_integer -{ - ACPI_OBJECT_COMMON_HEADER - acpi_integer value; +struct acpi_object_integer { + ACPI_OBJECT_COMMON_HEADER acpi_integer value; }; - /* * Note: The String and Buffer object must be identical through the Pointer * element. There is code that depends on this. */ -struct acpi_object_string /* Null terminated, ASCII characters only */ -{ - ACPI_OBJECT_COMMON_HEADER - ACPI_COMMON_BUFFER_INFO - char *pointer; /* String in AML stream or allocated string */ +struct acpi_object_string { /* Null terminated, ASCII characters only */ + ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_BUFFER_INFO char *pointer; /* String in AML stream or allocated string */ }; - -struct acpi_object_buffer -{ - ACPI_OBJECT_COMMON_HEADER - ACPI_COMMON_BUFFER_INFO - u8 *pointer; /* Buffer in AML stream or allocated buffer */ - struct acpi_namespace_node *node; /* Link back to parent node */ - u8 *aml_start; - u32 aml_length; +struct acpi_object_buffer { + ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_BUFFER_INFO u8 * pointer; /* Buffer in AML stream or allocated buffer */ + struct acpi_namespace_node *node; /* Link back to parent node */ + u8 *aml_start; + u32 aml_length; }; - -struct acpi_object_package -{ - ACPI_OBJECT_COMMON_HEADER - - u32 count; /* # of elements in package */ - u32 aml_length; - u8 *aml_start; - struct acpi_namespace_node *node; /* Link back to parent node */ - union acpi_operand_object **elements; /* Array of pointers to acpi_objects */ +struct acpi_object_package { + ACPI_OBJECT_COMMON_HEADER u32 count; /* # of elements in package */ + u32 aml_length; + u8 *aml_start; + struct acpi_namespace_node *node; /* Link back to parent node */ + union acpi_operand_object **elements; /* Array of pointers to acpi_objects */ }; - /****************************************************************************** * * Complex data types * *****************************************************************************/ -struct acpi_object_event -{ - ACPI_OBJECT_COMMON_HEADER - void *semaphore; +struct acpi_object_event { + ACPI_OBJECT_COMMON_HEADER void *semaphore; }; - #define ACPI_INFINITE_CONCURRENCY 0xFF typedef -acpi_status (*ACPI_INTERNAL_METHOD) ( - struct acpi_walk_state *walk_state); - -struct acpi_object_method -{ - ACPI_OBJECT_COMMON_HEADER - u8 method_flags; - u8 param_count; - u32 aml_length; - void *semaphore; - u8 *aml_start; - ACPI_INTERNAL_METHOD implementation; - u8 concurrency; - u8 thread_count; - acpi_owner_id owner_id; +acpi_status(*ACPI_INTERNAL_METHOD) (struct acpi_walk_state * walk_state); + +struct acpi_object_method { + ACPI_OBJECT_COMMON_HEADER u8 method_flags; + u8 param_count; + u32 aml_length; + void *semaphore; + u8 *aml_start; + ACPI_INTERNAL_METHOD implementation; + u8 concurrency; + u8 thread_count; + acpi_owner_id owner_id; }; - -struct acpi_object_mutex -{ - ACPI_OBJECT_COMMON_HEADER - u8 sync_level; /* 0-15, specified in Mutex() call */ - u16 acquisition_depth; /* Allow multiple Acquires, same thread */ - struct acpi_thread_state *owner_thread; /* Current owner of the mutex */ - void *semaphore; /* Actual OS synchronization object */ - union acpi_operand_object *prev; /* Link for list of acquired mutexes */ - union acpi_operand_object *next; /* Link for list of acquired mutexes */ - struct acpi_namespace_node *node; /* Containing namespace node */ - u8 original_sync_level; /* Owner's original sync level (0-15) */ +struct acpi_object_mutex { + ACPI_OBJECT_COMMON_HEADER u8 sync_level; /* 0-15, specified in Mutex() call */ + u16 acquisition_depth; /* Allow multiple Acquires, same thread */ + struct acpi_thread_state *owner_thread; /* Current owner of the mutex */ + void *semaphore; /* Actual OS synchronization object */ + union acpi_operand_object *prev; /* Link for list of acquired mutexes */ + union acpi_operand_object *next; /* Link for list of acquired mutexes */ + struct acpi_namespace_node *node; /* Containing namespace node */ + u8 original_sync_level; /* Owner's original sync level (0-15) */ }; - -struct acpi_object_region -{ - ACPI_OBJECT_COMMON_HEADER - - u8 space_id; - union acpi_operand_object *handler; /* Handler for region access */ - struct acpi_namespace_node *node; /* Containing namespace node */ - union acpi_operand_object *next; - u32 length; - acpi_physical_address address; +struct acpi_object_region { + ACPI_OBJECT_COMMON_HEADER u8 space_id; + union acpi_operand_object *handler; /* Handler for region access */ + struct acpi_namespace_node *node; /* Containing namespace node */ + union acpi_operand_object *next; + u32 length; + acpi_physical_address address; }; - /****************************************************************************** * * Objects that can be notified. All share a common notify_info area. * *****************************************************************************/ -struct acpi_object_notify_common /* COMMON NOTIFY for POWER, PROCESSOR, DEVICE, and THERMAL */ -{ - ACPI_OBJECT_COMMON_HEADER - ACPI_COMMON_NOTIFY_INFO -}; - - -struct acpi_object_device -{ - ACPI_OBJECT_COMMON_HEADER - ACPI_COMMON_NOTIFY_INFO - struct acpi_gpe_block_info *gpe_block; -}; - +struct acpi_object_notify_common { /* COMMON NOTIFY for POWER, PROCESSOR, DEVICE, and THERMAL */ +ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_NOTIFY_INFO}; -struct acpi_object_power_resource -{ +struct acpi_object_device { ACPI_OBJECT_COMMON_HEADER - ACPI_COMMON_NOTIFY_INFO - u32 system_level; - u32 resource_order; + ACPI_COMMON_NOTIFY_INFO struct acpi_gpe_block_info *gpe_block; }; - -struct acpi_object_processor -{ - ACPI_OBJECT_COMMON_HEADER - ACPI_COMMON_NOTIFY_INFO - u32 proc_id; - u32 length; - acpi_io_address address; +struct acpi_object_power_resource { + ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_NOTIFY_INFO u32 system_level; + u32 resource_order; }; - -struct acpi_object_thermal_zone -{ - ACPI_OBJECT_COMMON_HEADER - ACPI_COMMON_NOTIFY_INFO +struct acpi_object_processor { + ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_NOTIFY_INFO u32 proc_id; + u32 length; + acpi_io_address address; }; +struct acpi_object_thermal_zone { +ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_NOTIFY_INFO}; /****************************************************************************** * @@ -283,90 +227,63 @@ struct acpi_object_thermal_zone * *****************************************************************************/ -struct acpi_object_field_common /* COMMON FIELD (for BUFFER, REGION, BANK, and INDEX fields) */ -{ - ACPI_OBJECT_COMMON_HEADER - ACPI_COMMON_FIELD_INFO - union acpi_operand_object *region_obj; /* Containing Operation Region object */ - /* (REGION/BANK fields only) */ +struct acpi_object_field_common { /* COMMON FIELD (for BUFFER, REGION, BANK, and INDEX fields) */ + ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_FIELD_INFO union acpi_operand_object *region_obj; /* Containing Operation Region object */ + /* (REGION/BANK fields only) */ }; - -struct acpi_object_region_field -{ - ACPI_OBJECT_COMMON_HEADER - ACPI_COMMON_FIELD_INFO - union acpi_operand_object *region_obj; /* Containing op_region object */ +struct acpi_object_region_field { + ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_FIELD_INFO union acpi_operand_object *region_obj; /* Containing op_region object */ }; - -struct acpi_object_bank_field -{ - ACPI_OBJECT_COMMON_HEADER - ACPI_COMMON_FIELD_INFO - union acpi_operand_object *region_obj; /* Containing op_region object */ - union acpi_operand_object *bank_obj; /* bank_select Register object */ +struct acpi_object_bank_field { + ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_FIELD_INFO union acpi_operand_object *region_obj; /* Containing op_region object */ + union acpi_operand_object *bank_obj; /* bank_select Register object */ }; - -struct acpi_object_index_field -{ - ACPI_OBJECT_COMMON_HEADER - ACPI_COMMON_FIELD_INFO - - /* - * No "region_obj" pointer needed since the Index and Data registers - * are each field definitions unto themselves. - */ - union acpi_operand_object *index_obj; /* Index register */ - union acpi_operand_object *data_obj; /* Data register */ +struct acpi_object_index_field { + ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_FIELD_INFO + /* + * No "region_obj" pointer needed since the Index and Data registers + * are each field definitions unto themselves. + */ + union acpi_operand_object *index_obj; /* Index register */ + union acpi_operand_object *data_obj; /* Data register */ }; - /* The buffer_field is different in that it is part of a Buffer, not an op_region */ -struct acpi_object_buffer_field -{ - ACPI_OBJECT_COMMON_HEADER - ACPI_COMMON_FIELD_INFO - union acpi_operand_object *buffer_obj; /* Containing Buffer object */ +struct acpi_object_buffer_field { + ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_FIELD_INFO union acpi_operand_object *buffer_obj; /* Containing Buffer object */ }; - /****************************************************************************** * * Objects for handlers * *****************************************************************************/ -struct acpi_object_notify_handler -{ - ACPI_OBJECT_COMMON_HEADER - struct acpi_namespace_node *node; /* Parent device */ - acpi_notify_handler handler; - void *context; +struct acpi_object_notify_handler { + ACPI_OBJECT_COMMON_HEADER struct acpi_namespace_node *node; /* Parent device */ + acpi_notify_handler handler; + void *context; }; - /* Flags for address handler */ #define ACPI_ADDR_HANDLER_DEFAULT_INSTALLED 0x1 - -struct acpi_object_addr_handler -{ - ACPI_OBJECT_COMMON_HEADER - u8 space_id; - u16 hflags; - acpi_adr_space_handler handler; - struct acpi_namespace_node *node; /* Parent device */ - void *context; - acpi_adr_space_setup setup; - union acpi_operand_object *region_list; /* regions using this handler */ - union acpi_operand_object *next; +struct acpi_object_addr_handler { + ACPI_OBJECT_COMMON_HEADER u8 space_id; + u16 hflags; + acpi_adr_space_handler handler; + struct acpi_namespace_node *node; /* Parent device */ + void *context; + acpi_adr_space_setup setup; + union acpi_operand_object *region_list; /* regions using this handler */ + union acpi_operand_object *next; }; - /****************************************************************************** * * Special internal objects @@ -377,18 +294,15 @@ struct acpi_object_addr_handler * The Reference object type is used for these opcodes: * Arg[0-6], Local[0-7], index_op, name_op, zero_op, one_op, ones_op, debug_op */ -struct acpi_object_reference -{ - ACPI_OBJECT_COMMON_HEADER - u8 target_type; /* Used for index_op */ - u16 opcode; - u32 offset; /* Used for arg_op, local_op, and index_op */ - void *object; /* name_op=>HANDLE to obj, index_op=>union acpi_operand_object */ - struct acpi_namespace_node *node; - union acpi_operand_object **where; +struct acpi_object_reference { + ACPI_OBJECT_COMMON_HEADER u8 target_type; /* Used for index_op */ + u16 opcode; + u32 offset; /* Used for arg_op, local_op, and index_op */ + void *object; /* name_op=>HANDLE to obj, index_op=>union acpi_operand_object */ + struct acpi_namespace_node *node; + union acpi_operand_object **where; }; - /* * Extra object is used as additional storage for types that * have AML code in their declarations (term_args) that must be @@ -396,73 +310,62 @@ struct acpi_object_reference * * Currently: Region and field_unit types */ -struct acpi_object_extra -{ - ACPI_OBJECT_COMMON_HEADER - u8 byte_fill1; - u16 word_fill1; - u32 aml_length; - u8 *aml_start; - struct acpi_namespace_node *method_REG; /* _REG method for this region (if any) */ - void *region_context; /* Region-specific data */ +struct acpi_object_extra { + ACPI_OBJECT_COMMON_HEADER u8 byte_fill1; + u16 word_fill1; + u32 aml_length; + u8 *aml_start; + struct acpi_namespace_node *method_REG; /* _REG method for this region (if any) */ + void *region_context; /* Region-specific data */ }; - /* Additional data that can be attached to namespace nodes */ -struct acpi_object_data -{ - ACPI_OBJECT_COMMON_HEADER - acpi_object_handler handler; - void *pointer; +struct acpi_object_data { + ACPI_OBJECT_COMMON_HEADER acpi_object_handler handler; + void *pointer; }; - /* Structure used when objects are cached for reuse */ -struct acpi_object_cache_list -{ - ACPI_OBJECT_COMMON_HEADER - union acpi_operand_object *next; /* Link for object cache and internal lists*/ +struct acpi_object_cache_list { + ACPI_OBJECT_COMMON_HEADER union acpi_operand_object *next; /* Link for object cache and internal lists */ }; - /****************************************************************************** * * union acpi_operand_object Descriptor - a giant union of all of the above * *****************************************************************************/ -union acpi_operand_object -{ - struct acpi_object_common common; - struct acpi_object_integer integer; - struct acpi_object_string string; - struct acpi_object_buffer buffer; - struct acpi_object_package package; - struct acpi_object_event event; - struct acpi_object_method method; - struct acpi_object_mutex mutex; - struct acpi_object_region region; - struct acpi_object_notify_common common_notify; - struct acpi_object_device device; - struct acpi_object_power_resource power_resource; - struct acpi_object_processor processor; - struct acpi_object_thermal_zone thermal_zone; - struct acpi_object_field_common common_field; - struct acpi_object_region_field field; - struct acpi_object_buffer_field buffer_field; - struct acpi_object_bank_field bank_field; - struct acpi_object_index_field index_field; - struct acpi_object_notify_handler notify; - struct acpi_object_addr_handler address_space; - struct acpi_object_reference reference; - struct acpi_object_extra extra; - struct acpi_object_data data; - struct acpi_object_cache_list cache; +union acpi_operand_object { + struct acpi_object_common common; + struct acpi_object_integer integer; + struct acpi_object_string string; + struct acpi_object_buffer buffer; + struct acpi_object_package package; + struct acpi_object_event event; + struct acpi_object_method method; + struct acpi_object_mutex mutex; + struct acpi_object_region region; + struct acpi_object_notify_common common_notify; + struct acpi_object_device device; + struct acpi_object_power_resource power_resource; + struct acpi_object_processor processor; + struct acpi_object_thermal_zone thermal_zone; + struct acpi_object_field_common common_field; + struct acpi_object_region_field field; + struct acpi_object_buffer_field buffer_field; + struct acpi_object_bank_field bank_field; + struct acpi_object_index_field index_field; + struct acpi_object_notify_handler notify; + struct acpi_object_addr_handler address_space; + struct acpi_object_reference reference; + struct acpi_object_extra extra; + struct acpi_object_data data; + struct acpi_object_cache_list cache; }; - /****************************************************************************** * * union acpi_descriptor - objects that share a common descriptor identifier @@ -471,7 +374,7 @@ union acpi_operand_object /* Object descriptor types */ -#define ACPI_DESC_TYPE_CACHED 0x01 /* Used only when object is cached */ +#define ACPI_DESC_TYPE_CACHED 0x01 /* Used only when object is cached */ #define ACPI_DESC_TYPE_STATE 0x02 #define ACPI_DESC_TYPE_STATE_UPDATE 0x03 #define ACPI_DESC_TYPE_STATE_PACKAGE 0x04 @@ -488,14 +391,11 @@ union acpi_operand_object #define ACPI_DESC_TYPE_NAMED 0x0F #define ACPI_DESC_TYPE_MAX 0x0F - -union acpi_descriptor -{ - u8 descriptor_id; /* To differentiate various internal objs */\ - union acpi_operand_object object; - struct acpi_namespace_node node; - union acpi_parse_object op; +union acpi_descriptor { + u8 descriptor_id; /* To differentiate various internal objs */ + union acpi_operand_object object; + struct acpi_namespace_node node; + union acpi_parse_object op; }; - -#endif /* _ACOBJECT_H */ +#endif /* _ACOBJECT_H */ diff --git a/include/acpi/acopcode.h b/include/acpi/acopcode.h index 093f697e8c5..64da4299219 100644 --- a/include/acpi/acopcode.h +++ b/include/acpi/acopcode.h @@ -62,7 +62,6 @@ #define _NAM 0x6C #define _PFX 0x6D - /* * All AML opcodes and the parse-time arguments for each. Used by the AML * parser Each list is compressed into a 32-bit number and stored in the @@ -191,7 +190,6 @@ #define ARGP_WORD_OP ARGP_LIST1 (ARGP_WORDDATA) #define ARGP_ZERO_OP ARG_NONE - /* * All AML opcodes and the runtime arguments for each. Used by the AML * interpreter Each list is compressed into a 32-bit number and stored @@ -322,4 +320,4 @@ #define ARGI_WORD_OP ARGI_INVALID_OPCODE #define ARGI_ZERO_OP ARG_NONE -#endif /* __ACOPCODE_H__ */ +#endif /* __ACOPCODE_H__ */ diff --git a/include/acpi/acoutput.h b/include/acpi/acoutput.h index d7e828cb84b..68d7edf0f69 100644 --- a/include/acpi/acoutput.h +++ b/include/acpi/acoutput.h @@ -73,12 +73,10 @@ #define ACPI_ALL_COMPONENTS 0x00003FFF #define ACPI_COMPONENT_DEFAULT (ACPI_ALL_COMPONENTS) - /* Component IDs reserved for ACPI drivers */ #define ACPI_ALL_DRIVERS 0xFFFF0000 - /* * Raw debug output levels, do not use these in the DEBUG_PRINT macros */ @@ -132,7 +130,6 @@ #define ACPI_LV_VERBOSE 0xF0000000 - /* * Debug level macros that are used in the DEBUG_PRINT macros */ @@ -147,7 +144,6 @@ #define ACPI_DB_INFO ACPI_DEBUG_LEVEL (ACPI_LV_INFO) #define ACPI_DB_ALL_EXCEPTIONS ACPI_DEBUG_LEVEL (ACPI_LV_ALL_EXCEPTIONS) - /* Trace level -- also used in the global "debug_level" */ #define ACPI_DB_INIT_NAMES ACPI_DEBUG_LEVEL (ACPI_LV_INIT_NAMES) @@ -174,12 +170,10 @@ #define ACPI_DB_ALL ACPI_DEBUG_LEVEL (ACPI_LV_ALL) - /* Defaults for debug_level, debug and normal */ #define ACPI_DEBUG_DEFAULT (ACPI_LV_INIT | ACPI_LV_WARN | ACPI_LV_ERROR | ACPI_LV_DEBUG_OBJECT) #define ACPI_NORMAL_DEFAULT (ACPI_LV_INIT | ACPI_LV_WARN | ACPI_LV_ERROR | ACPI_LV_DEBUG_OBJECT) #define ACPI_DEBUG_ALL (ACPI_LV_AML_DISASSEMBLE | ACPI_LV_ALL_EXCEPTIONS | ACPI_LV_ALL) - -#endif /* __ACOUTPUT_H__ */ +#endif /* __ACOUTPUT_H__ */ diff --git a/include/acpi/acparser.h b/include/acpi/acparser.h index f692ad56cd8..d352d40de1f 100644 --- a/include/acpi/acparser.h +++ b/include/acpi/acparser.h @@ -41,18 +41,15 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #ifndef __ACPARSER_H__ #define __ACPARSER_H__ - #define OP_HAS_RETURN_VALUE 1 /* variable # arguments */ #define ACPI_VAR_ARGS ACPI_UINT32_MAX - #define ACPI_PARSE_DELETE_TREE 0x0001 #define ACPI_PARSE_NO_TREE_DELETE 0x0000 #define ACPI_PARSE_TREE_MASK 0x0001 @@ -65,266 +62,171 @@ #define ACPI_PARSE_DEFERRED_OP 0x0100 #define ACPI_PARSE_DISASSEMBLE 0x0200 - /****************************************************************************** * * Parser interfaces * *****************************************************************************/ - /* * psxface - Parser external interfaces */ -acpi_status -acpi_ps_execute_method ( - struct acpi_parameter_info *info); - +acpi_status acpi_ps_execute_method(struct acpi_parameter_info *info); /* * psargs - Parse AML opcode arguments */ -u8 * -acpi_ps_get_next_package_end ( - struct acpi_parse_state *parser_state); +u8 *acpi_ps_get_next_package_end(struct acpi_parse_state *parser_state); -char * -acpi_ps_get_next_namestring ( - struct acpi_parse_state *parser_state); +char *acpi_ps_get_next_namestring(struct acpi_parse_state *parser_state); void -acpi_ps_get_next_simple_arg ( - struct acpi_parse_state *parser_state, - u32 arg_type, - union acpi_parse_object *arg); +acpi_ps_get_next_simple_arg(struct acpi_parse_state *parser_state, + u32 arg_type, union acpi_parse_object *arg); acpi_status -acpi_ps_get_next_namepath ( - struct acpi_walk_state *walk_state, - struct acpi_parse_state *parser_state, - union acpi_parse_object *arg, - u8 method_call); +acpi_ps_get_next_namepath(struct acpi_walk_state *walk_state, + struct acpi_parse_state *parser_state, + union acpi_parse_object *arg, u8 method_call); acpi_status -acpi_ps_get_next_arg ( - struct acpi_walk_state *walk_state, - struct acpi_parse_state *parser_state, - u32 arg_type, - union acpi_parse_object **return_arg); - +acpi_ps_get_next_arg(struct acpi_walk_state *walk_state, + struct acpi_parse_state *parser_state, + u32 arg_type, union acpi_parse_object **return_arg); /* * psfind */ -union acpi_parse_object * -acpi_ps_find_name ( - union acpi_parse_object *scope, - u32 name, - u32 opcode); - -union acpi_parse_object* -acpi_ps_get_parent ( - union acpi_parse_object *op); +union acpi_parse_object *acpi_ps_find_name(union acpi_parse_object *scope, + u32 name, u32 opcode); +union acpi_parse_object *acpi_ps_get_parent(union acpi_parse_object *op); /* * psopcode - AML Opcode information */ -const struct acpi_opcode_info * -acpi_ps_get_opcode_info ( - u16 opcode); - -char * -acpi_ps_get_opcode_name ( - u16 opcode); +const struct acpi_opcode_info *acpi_ps_get_opcode_info(u16 opcode); +char *acpi_ps_get_opcode_name(u16 opcode); /* * psparse - top level parsing routines */ -acpi_status -acpi_ps_parse_aml ( - struct acpi_walk_state *walk_state); +acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state); -u32 -acpi_ps_get_opcode_size ( - u32 opcode); +u32 acpi_ps_get_opcode_size(u32 opcode); -u16 -acpi_ps_peek_opcode ( - struct acpi_parse_state *state); +u16 acpi_ps_peek_opcode(struct acpi_parse_state *state); acpi_status -acpi_ps_complete_this_op ( - struct acpi_walk_state *walk_state, - union acpi_parse_object *op); +acpi_ps_complete_this_op(struct acpi_walk_state *walk_state, + union acpi_parse_object *op); acpi_status -acpi_ps_next_parse_state ( - struct acpi_walk_state *walk_state, - union acpi_parse_object *op, - acpi_status callback_status); - +acpi_ps_next_parse_state(struct acpi_walk_state *walk_state, + union acpi_parse_object *op, + acpi_status callback_status); /* * psloop - main parse loop */ -acpi_status -acpi_ps_parse_loop ( - struct acpi_walk_state *walk_state); - +acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state); /* * psscope - Scope stack management routines */ acpi_status -acpi_ps_init_scope ( - struct acpi_parse_state *parser_state, - union acpi_parse_object *root); +acpi_ps_init_scope(struct acpi_parse_state *parser_state, + union acpi_parse_object *root); -union acpi_parse_object * -acpi_ps_get_parent_scope ( - struct acpi_parse_state *state); +union acpi_parse_object *acpi_ps_get_parent_scope(struct acpi_parse_state + *state); -u8 -acpi_ps_has_completed_scope ( - struct acpi_parse_state *parser_state); +u8 acpi_ps_has_completed_scope(struct acpi_parse_state *parser_state); void -acpi_ps_pop_scope ( - struct acpi_parse_state *parser_state, - union acpi_parse_object **op, - u32 *arg_list, - u32 *arg_count); +acpi_ps_pop_scope(struct acpi_parse_state *parser_state, + union acpi_parse_object **op, + u32 * arg_list, u32 * arg_count); acpi_status -acpi_ps_push_scope ( - struct acpi_parse_state *parser_state, - union acpi_parse_object *op, - u32 remaining_args, - u32 arg_count); - -void -acpi_ps_cleanup_scope ( - struct acpi_parse_state *state); +acpi_ps_push_scope(struct acpi_parse_state *parser_state, + union acpi_parse_object *op, + u32 remaining_args, u32 arg_count); +void acpi_ps_cleanup_scope(struct acpi_parse_state *state); /* * pstree - parse tree manipulation routines */ void -acpi_ps_append_arg( - union acpi_parse_object *op, - union acpi_parse_object *arg); - -union acpi_parse_object* -acpi_ps_find ( - union acpi_parse_object *scope, - char *path, - u16 opcode, - u32 create); - -union acpi_parse_object * -acpi_ps_get_arg( - union acpi_parse_object *op, - u32 argn); +acpi_ps_append_arg(union acpi_parse_object *op, union acpi_parse_object *arg); -#ifdef ACPI_FUTURE_USAGE -union acpi_parse_object * -acpi_ps_get_depth_next ( - union acpi_parse_object *origin, - union acpi_parse_object *op); -#endif /* ACPI_FUTURE_USAGE */ +union acpi_parse_object *acpi_ps_find(union acpi_parse_object *scope, + char *path, u16 opcode, u32 create); + +union acpi_parse_object *acpi_ps_get_arg(union acpi_parse_object *op, u32 argn); +#ifdef ACPI_FUTURE_USAGE +union acpi_parse_object *acpi_ps_get_depth_next(union acpi_parse_object *origin, + union acpi_parse_object *op); +#endif /* ACPI_FUTURE_USAGE */ /* * pswalk - parse tree walk routines */ acpi_status -acpi_ps_walk_parsed_aml ( - union acpi_parse_object *start_op, - union acpi_parse_object *end_op, - union acpi_operand_object *mth_desc, - struct acpi_namespace_node *start_node, - union acpi_operand_object **params, - union acpi_operand_object **caller_return_desc, - acpi_owner_id owner_id, - acpi_parse_downwards descending_callback, - acpi_parse_upwards ascending_callback); - -acpi_status -acpi_ps_get_next_walk_op ( - struct acpi_walk_state *walk_state, - union acpi_parse_object *op, - acpi_parse_upwards ascending_callback); +acpi_ps_walk_parsed_aml(union acpi_parse_object *start_op, + union acpi_parse_object *end_op, + union acpi_operand_object *mth_desc, + struct acpi_namespace_node *start_node, + union acpi_operand_object **params, + union acpi_operand_object **caller_return_desc, + acpi_owner_id owner_id, + acpi_parse_downwards descending_callback, + acpi_parse_upwards ascending_callback); acpi_status -acpi_ps_delete_completed_op ( - struct acpi_walk_state *walk_state); +acpi_ps_get_next_walk_op(struct acpi_walk_state *walk_state, + union acpi_parse_object *op, + acpi_parse_upwards ascending_callback); -void -acpi_ps_delete_parse_tree ( - union acpi_parse_object *root); +acpi_status acpi_ps_delete_completed_op(struct acpi_walk_state *walk_state); +void acpi_ps_delete_parse_tree(union acpi_parse_object *root); /* * psutils - parser utilities */ -union acpi_parse_object * -acpi_ps_create_scope_op ( - void); +union acpi_parse_object *acpi_ps_create_scope_op(void); -void -acpi_ps_init_op ( - union acpi_parse_object *op, - u16 opcode); +void acpi_ps_init_op(union acpi_parse_object *op, u16 opcode); -union acpi_parse_object * -acpi_ps_alloc_op ( - u16 opcode); +union acpi_parse_object *acpi_ps_alloc_op(u16 opcode); -void -acpi_ps_free_op ( - union acpi_parse_object *op); +void acpi_ps_free_op(union acpi_parse_object *op); -u8 -acpi_ps_is_leading_char ( - u32 c); +u8 acpi_ps_is_leading_char(u32 c); -u8 -acpi_ps_is_prefix_char ( - u32 c); +u8 acpi_ps_is_prefix_char(u32 c); #ifdef ACPI_FUTURE_USAGE -u32 -acpi_ps_get_name( - union acpi_parse_object *op); -#endif /* ACPI_FUTURE_USAGE */ - -void -acpi_ps_set_name( - union acpi_parse_object *op, - u32 name); +u32 acpi_ps_get_name(union acpi_parse_object *op); +#endif /* ACPI_FUTURE_USAGE */ +void acpi_ps_set_name(union acpi_parse_object *op, u32 name); /* * psdump - display parser tree */ u32 -acpi_ps_sprint_path ( - char *buffer_start, - u32 buffer_size, - union acpi_parse_object *op); +acpi_ps_sprint_path(char *buffer_start, + u32 buffer_size, union acpi_parse_object *op); u32 -acpi_ps_sprint_op ( - char *buffer_start, - u32 buffer_size, - union acpi_parse_object *op); - -void -acpi_ps_show ( - union acpi_parse_object *op); +acpi_ps_sprint_op(char *buffer_start, + u32 buffer_size, union acpi_parse_object *op); +void acpi_ps_show(union acpi_parse_object *op); -#endif /* __ACPARSER_H__ */ +#endif /* __ACPARSER_H__ */ diff --git a/include/acpi/acpi.h b/include/acpi/acpi.h index a69d7894204..ccf34f9dac6 100644 --- a/include/acpi/acpi.h +++ b/include/acpi/acpi.h @@ -49,22 +49,21 @@ * We put them here because we don't want to duplicate them * in the rest of the source code again and again. */ -#include "acnames.h" /* Global ACPI names and strings */ -#include "acconfig.h" /* Configuration constants */ -#include "platform/acenv.h" /* Target environment specific items */ -#include "actypes.h" /* Fundamental common data types */ -#include "acexcep.h" /* ACPI exception codes */ -#include "acmacros.h" /* C macros */ -#include "actbl.h" /* ACPI table definitions */ -#include "aclocal.h" /* Internal data types */ -#include "acoutput.h" /* Error output and Debug macros */ -#include "acpiosxf.h" /* Interfaces to the ACPI-to-OS layer*/ -#include "acpixf.h" /* ACPI core subsystem external interfaces */ -#include "acobject.h" /* ACPI internal object */ -#include "acstruct.h" /* Common structures */ -#include "acglobal.h" /* All global variables */ -#include "achware.h" /* Hardware defines and interfaces */ -#include "acutils.h" /* Utility interfaces */ +#include "acnames.h" /* Global ACPI names and strings */ +#include "acconfig.h" /* Configuration constants */ +#include "platform/acenv.h" /* Target environment specific items */ +#include "actypes.h" /* Fundamental common data types */ +#include "acexcep.h" /* ACPI exception codes */ +#include "acmacros.h" /* C macros */ +#include "actbl.h" /* ACPI table definitions */ +#include "aclocal.h" /* Internal data types */ +#include "acoutput.h" /* Error output and Debug macros */ +#include "acpiosxf.h" /* Interfaces to the ACPI-to-OS layer */ +#include "acpixf.h" /* ACPI core subsystem external interfaces */ +#include "acobject.h" /* ACPI internal object */ +#include "acstruct.h" /* Common structures */ +#include "acglobal.h" /* All global variables */ +#include "achware.h" /* Hardware defines and interfaces */ +#include "acutils.h" /* Utility interfaces */ - -#endif /* __ACPI_H__ */ +#endif /* __ACPI_H__ */ diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h index 8d0e1290bc7..4f4b2baa717 100644 --- a/include/acpi/acpi_bus.h +++ b/include/acpi/acpi_bus.h @@ -35,48 +35,41 @@ /* TBD: Make dynamic */ #define ACPI_MAX_HANDLES 10 struct acpi_handle_list { - u32 count; - acpi_handle handles[ACPI_MAX_HANDLES]; + u32 count; + acpi_handle handles[ACPI_MAX_HANDLES]; }; - /* acpi_utils.h */ acpi_status -acpi_extract_package ( - union acpi_object *package, - struct acpi_buffer *format, - struct acpi_buffer *buffer); +acpi_extract_package(union acpi_object *package, + struct acpi_buffer *format, struct acpi_buffer *buffer); acpi_status -acpi_evaluate_integer ( - acpi_handle handle, - acpi_string pathname, - struct acpi_object_list *arguments, - unsigned long *data); +acpi_evaluate_integer(acpi_handle handle, + acpi_string pathname, + struct acpi_object_list *arguments, unsigned long *data); acpi_status -acpi_evaluate_reference ( - acpi_handle handle, - acpi_string pathname, - struct acpi_object_list *arguments, - struct acpi_handle_list *list); - +acpi_evaluate_reference(acpi_handle handle, + acpi_string pathname, + struct acpi_object_list *arguments, + struct acpi_handle_list *list); #ifdef CONFIG_ACPI_BUS #include #define ACPI_BUS_FILE_ROOT "acpi" -extern struct proc_dir_entry *acpi_root_dir; -extern FADT_DESCRIPTOR acpi_fadt; +extern struct proc_dir_entry *acpi_root_dir; +extern FADT_DESCRIPTOR acpi_fadt; enum acpi_bus_removal_type { - ACPI_BUS_REMOVAL_NORMAL = 0, + ACPI_BUS_REMOVAL_NORMAL = 0, ACPI_BUS_REMOVAL_EJECT, ACPI_BUS_REMOVAL_SUPRISE, ACPI_BUS_REMOVAL_TYPE_COUNT }; enum acpi_bus_device_type { - ACPI_BUS_TYPE_DEVICE = 0, + ACPI_BUS_TYPE_DEVICE = 0, ACPI_BUS_TYPE_POWER, ACPI_BUS_TYPE_PROCESSOR, ACPI_BUS_TYPE_THERMAL, @@ -89,61 +82,60 @@ enum acpi_bus_device_type { struct acpi_driver; struct acpi_device; - /* * ACPI Driver * ----------- */ -typedef int (*acpi_op_add) (struct acpi_device *device); -typedef int (*acpi_op_remove) (struct acpi_device *device, int type); -typedef int (*acpi_op_lock) (struct acpi_device *device, int type); -typedef int (*acpi_op_start) (struct acpi_device *device); -typedef int (*acpi_op_stop) (struct acpi_device *device, int type); -typedef int (*acpi_op_suspend) (struct acpi_device *device, int state); -typedef int (*acpi_op_resume) (struct acpi_device *device, int state); -typedef int (*acpi_op_scan) (struct acpi_device *device); -typedef int (*acpi_op_bind) (struct acpi_device *device); -typedef int (*acpi_op_unbind) (struct acpi_device *device); -typedef int (*acpi_op_match) (struct acpi_device *device, - struct acpi_driver *driver); +typedef int (*acpi_op_add) (struct acpi_device * device); +typedef int (*acpi_op_remove) (struct acpi_device * device, int type); +typedef int (*acpi_op_lock) (struct acpi_device * device, int type); +typedef int (*acpi_op_start) (struct acpi_device * device); +typedef int (*acpi_op_stop) (struct acpi_device * device, int type); +typedef int (*acpi_op_suspend) (struct acpi_device * device, int state); +typedef int (*acpi_op_resume) (struct acpi_device * device, int state); +typedef int (*acpi_op_scan) (struct acpi_device * device); +typedef int (*acpi_op_bind) (struct acpi_device * device); +typedef int (*acpi_op_unbind) (struct acpi_device * device); +typedef int (*acpi_op_match) (struct acpi_device * device, + struct acpi_driver * driver); struct acpi_bus_ops { - u32 acpi_op_add:1; - u32 acpi_op_remove:1; - u32 acpi_op_lock:1; - u32 acpi_op_start:1; - u32 acpi_op_stop:1; - u32 acpi_op_suspend:1; - u32 acpi_op_resume:1; - u32 acpi_op_scan:1; - u32 acpi_op_bind:1; - u32 acpi_op_unbind:1; - u32 acpi_op_match:1; - u32 reserved:21; + u32 acpi_op_add:1; + u32 acpi_op_remove:1; + u32 acpi_op_lock:1; + u32 acpi_op_start:1; + u32 acpi_op_stop:1; + u32 acpi_op_suspend:1; + u32 acpi_op_resume:1; + u32 acpi_op_scan:1; + u32 acpi_op_bind:1; + u32 acpi_op_unbind:1; + u32 acpi_op_match:1; + u32 reserved:21; }; struct acpi_device_ops { - acpi_op_add add; - acpi_op_remove remove; - acpi_op_lock lock; - acpi_op_start start; - acpi_op_stop stop; - acpi_op_suspend suspend; - acpi_op_resume resume; - acpi_op_scan scan; - acpi_op_bind bind; - acpi_op_unbind unbind; - acpi_op_match match; + acpi_op_add add; + acpi_op_remove remove; + acpi_op_lock lock; + acpi_op_start start; + acpi_op_stop stop; + acpi_op_suspend suspend; + acpi_op_resume resume; + acpi_op_scan scan; + acpi_op_bind bind; + acpi_op_unbind unbind; + acpi_op_match match; }; struct acpi_driver { - struct list_head node; - char name[80]; - char class[80]; - atomic_t references; - char *ids; /* Supported Hardware IDs */ - struct acpi_device_ops ops; + struct list_head node; + char name[80]; + char class[80]; + atomic_t references; + char *ids; /* Supported Hardware IDs */ + struct acpi_device_ops ops; }; /* @@ -154,60 +146,57 @@ struct acpi_driver { /* Status (_STA) */ struct acpi_device_status { - u32 present:1; - u32 enabled:1; - u32 show_in_ui:1; - u32 functional:1; - u32 battery_present:1; - u32 reserved:27; + u32 present:1; + u32 enabled:1; + u32 show_in_ui:1; + u32 functional:1; + u32 battery_present:1; + u32 reserved:27; }; - /* Flags */ struct acpi_device_flags { - u32 dynamic_status:1; - u32 hardware_id:1; - u32 compatible_ids:1; - u32 bus_address:1; - u32 unique_id:1; - u32 removable:1; - u32 ejectable:1; - u32 lockable:1; - u32 suprise_removal_ok:1; - u32 power_manageable:1; - u32 performance_manageable:1; - u32 wake_capable:1; /* Wakeup(_PRW) supported? */ - u32 reserved:20; + u32 dynamic_status:1; + u32 hardware_id:1; + u32 compatible_ids:1; + u32 bus_address:1; + u32 unique_id:1; + u32 removable:1; + u32 ejectable:1; + u32 lockable:1; + u32 suprise_removal_ok:1; + u32 power_manageable:1; + u32 performance_manageable:1; + u32 wake_capable:1; /* Wakeup(_PRW) supported? */ + u32 reserved:20; }; - /* File System */ struct acpi_device_dir { - struct proc_dir_entry *entry; + struct proc_dir_entry *entry; }; #define acpi_device_dir(d) ((d)->dir.entry) - /* Plug and Play */ -typedef char acpi_bus_id[5]; -typedef unsigned long acpi_bus_address; -typedef char acpi_hardware_id[9]; -typedef char acpi_unique_id[9]; -typedef char acpi_device_name[40]; -typedef char acpi_device_class[20]; +typedef char acpi_bus_id[5]; +typedef unsigned long acpi_bus_address; +typedef char acpi_hardware_id[9]; +typedef char acpi_unique_id[9]; +typedef char acpi_device_name[40]; +typedef char acpi_device_class[20]; struct acpi_device_pnp { - acpi_bus_id bus_id; /* Object name */ - acpi_bus_address bus_address; /* _ADR */ - acpi_hardware_id hardware_id; /* _HID */ - struct acpi_compatible_id_list *cid_list; /* _CIDs */ - acpi_unique_id unique_id; /* _UID */ - acpi_device_name device_name; /* Driver-determined */ - acpi_device_class device_class; /* " */ + acpi_bus_id bus_id; /* Object name */ + acpi_bus_address bus_address; /* _ADR */ + acpi_hardware_id hardware_id; /* _HID */ + struct acpi_compatible_id_list *cid_list; /* _CIDs */ + acpi_unique_id unique_id; /* _UID */ + acpi_device_name device_name; /* Driver-determined */ + acpi_device_class device_class; /* " */ }; #define acpi_device_bid(d) ((d)->pnp.bus_id) @@ -217,114 +206,111 @@ struct acpi_device_pnp { #define acpi_device_name(d) ((d)->pnp.device_name) #define acpi_device_class(d) ((d)->pnp.device_class) - /* Power Management */ struct acpi_device_power_flags { - u32 explicit_get:1; /* _PSC present? */ - u32 power_resources:1; /* Power resources */ - u32 inrush_current:1; /* Serialize Dx->D0 */ - u32 power_removed:1; /* Optimize Dx->D0 */ - u32 reserved:28; + u32 explicit_get:1; /* _PSC present? */ + u32 power_resources:1; /* Power resources */ + u32 inrush_current:1; /* Serialize Dx->D0 */ + u32 power_removed:1; /* Optimize Dx->D0 */ + u32 reserved:28; }; struct acpi_device_power_state { struct { - u8 valid:1; - u8 explicit_set:1; /* _PSx present? */ - u8 reserved:6; - } flags; - int power; /* % Power (compared to D0) */ - int latency; /* Dx->D0 time (microseconds) */ - struct acpi_handle_list resources; /* Power resources referenced */ + u8 valid:1; + u8 explicit_set:1; /* _PSx present? */ + u8 reserved:6; + } flags; + int power; /* % Power (compared to D0) */ + int latency; /* Dx->D0 time (microseconds) */ + struct acpi_handle_list resources; /* Power resources referenced */ }; struct acpi_device_power { - int state; /* Current state */ + int state; /* Current state */ struct acpi_device_power_flags flags; - struct acpi_device_power_state states[4]; /* Power states (D0-D3) */ + struct acpi_device_power_state states[4]; /* Power states (D0-D3) */ }; - /* Performance Management */ struct acpi_device_perf_flags { - u8 reserved:8; + u8 reserved:8; }; struct acpi_device_perf_state { struct { - u8 valid:1; - u8 reserved:7; - } flags; - u8 power; /* % Power (compared to P0) */ - u8 performance; /* % Performance ( " ) */ - int latency; /* Px->P0 time (microseconds) */ + u8 valid:1; + u8 reserved:7; + } flags; + u8 power; /* % Power (compared to P0) */ + u8 performance; /* % Performance ( " ) */ + int latency; /* Px->P0 time (microseconds) */ }; struct acpi_device_perf { - int state; + int state; struct acpi_device_perf_flags flags; - int state_count; + int state_count; struct acpi_device_perf_state *states; }; /* Wakeup Management */ struct acpi_device_wakeup_flags { - u8 valid:1; /* Can successfully enable wakeup? */ - u8 run_wake:1; /* Run-Wake GPE devices */ + u8 valid:1; /* Can successfully enable wakeup? */ + u8 run_wake:1; /* Run-Wake GPE devices */ }; struct acpi_device_wakeup_state { - u8 enabled:1; - u8 active:1; + u8 enabled:1; + u8 active:1; }; struct acpi_device_wakeup { - acpi_handle gpe_device; - acpi_integer gpe_number;; - acpi_integer sleep_state; - struct acpi_handle_list resources; - struct acpi_device_wakeup_state state; - struct acpi_device_wakeup_flags flags; + acpi_handle gpe_device; + acpi_integer gpe_number;; + acpi_integer sleep_state; + struct acpi_handle_list resources; + struct acpi_device_wakeup_state state; + struct acpi_device_wakeup_flags flags; }; /* Device */ struct acpi_device { - acpi_handle handle; - struct acpi_device *parent; - struct list_head children; - struct list_head node; - struct list_head wakeup_list; - struct list_head g_list; + acpi_handle handle; + struct acpi_device *parent; + struct list_head children; + struct list_head node; + struct list_head wakeup_list; + struct list_head g_list; struct acpi_device_status status; struct acpi_device_flags flags; - struct acpi_device_pnp pnp; + struct acpi_device_pnp pnp; struct acpi_device_power power; struct acpi_device_wakeup wakeup; - struct acpi_device_perf performance; - struct acpi_device_dir dir; - struct acpi_device_ops ops; - struct acpi_driver *driver; - void *driver_data; - struct kobject kobj; + struct acpi_device_perf performance; + struct acpi_device_dir dir; + struct acpi_device_ops ops; + struct acpi_driver *driver; + void *driver_data; + struct kobject kobj; }; #define acpi_driver_data(d) ((d)->driver_data) - /* * Events * ------ */ struct acpi_bus_event { - struct list_head node; - acpi_device_class device_class; - acpi_bus_id bus_id; - u32 type; - u32 data; + struct list_head node; + acpi_device_class device_class; + acpi_bus_id bus_id; + u32 type; + u32 data; }; extern struct subsystem acpi_subsys; @@ -335,34 +321,32 @@ extern struct subsystem acpi_subsys; int acpi_bus_get_device(acpi_handle handle, struct acpi_device **device); void acpi_bus_data_handler(acpi_handle handle, u32 function, void *context); -int acpi_bus_get_status (struct acpi_device *device); -int acpi_bus_get_power (acpi_handle handle, int *state); -int acpi_bus_set_power (acpi_handle handle, int state); -int acpi_bus_generate_event (struct acpi_device *device, u8 type, int data); -int acpi_bus_receive_event (struct acpi_bus_event *event); -int acpi_bus_register_driver (struct acpi_driver *driver); -int acpi_bus_unregister_driver (struct acpi_driver *driver); -int acpi_bus_add (struct acpi_device **child, struct acpi_device *parent, - acpi_handle handle, int type); -int acpi_bus_start (struct acpi_device *device); - - -int acpi_match_ids (struct acpi_device *device, char *ids); +int acpi_bus_get_status(struct acpi_device *device); +int acpi_bus_get_power(acpi_handle handle, int *state); +int acpi_bus_set_power(acpi_handle handle, int state); +int acpi_bus_generate_event(struct acpi_device *device, u8 type, int data); +int acpi_bus_receive_event(struct acpi_bus_event *event); +int acpi_bus_register_driver(struct acpi_driver *driver); +int acpi_bus_unregister_driver(struct acpi_driver *driver); +int acpi_bus_add(struct acpi_device **child, struct acpi_device *parent, + acpi_handle handle, int type); +int acpi_bus_start(struct acpi_device *device); + +int acpi_match_ids(struct acpi_device *device, char *ids); int acpi_create_dir(struct acpi_device *); void acpi_remove_dir(struct acpi_device *); - /* * Bind physical devices with ACPI devices */ #include struct acpi_bus_type { - struct list_head list; - struct bus_type *bus; - /* For general devices under the bus*/ - int (*find_device)(struct device *, acpi_handle*); + struct list_head list; + struct bus_type *bus; + /* For general devices under the bus */ + int (*find_device) (struct device *, acpi_handle *); /* For bridges, such as PCI root bridge, IDE controller */ - int (*find_bridge)(struct device *, acpi_handle *); + int (*find_bridge) (struct device *, acpi_handle *); }; int register_acpi_bus_type(struct acpi_bus_type *); int unregister_acpi_bus_type(struct acpi_bus_type *); @@ -372,6 +356,6 @@ acpi_handle acpi_get_child(acpi_handle, acpi_integer); acpi_handle acpi_get_pci_rootbridge_handle(unsigned int, unsigned int); #define DEVICE_ACPI_HANDLE(dev) ((acpi_handle)((dev)->firmware_data)) -#endif /*CONFIG_ACPI_BUS*/ +#endif /*CONFIG_ACPI_BUS */ #endif /*__ACPI_BUS_H__*/ diff --git a/include/acpi/acpi_drivers.h b/include/acpi/acpi_drivers.h index 579fe191b7e..e976cb109b1 100644 --- a/include/acpi/acpi_drivers.h +++ b/include/acpi/acpi_drivers.h @@ -29,7 +29,6 @@ #include #include - #define ACPI_MAX_STRING 80 #define ACPI_BUS_COMPONENT 0x00010000 @@ -44,7 +43,6 @@ #define ACPI_BUTTON_HID_POWERF "ACPI_FPB" #define ACPI_BUTTON_HID_SLEEPF "ACPI_FSB" - /* -------------------------------------------------------------------------- PCI -------------------------------------------------------------------------- */ @@ -55,49 +53,49 @@ /* ACPI PCI Interrupt Link (pci_link.c) */ -int acpi_irq_penalty_init (void); -int acpi_pci_link_allocate_irq (acpi_handle handle, int index, int *edge_level, - int *active_high_low, char **name); +int acpi_irq_penalty_init(void); +int acpi_pci_link_allocate_irq(acpi_handle handle, int index, int *edge_level, + int *active_high_low, char **name); int acpi_pci_link_free_irq(acpi_handle handle); /* ACPI PCI Interrupt Routing (pci_irq.c) */ -int acpi_pci_irq_add_prt (acpi_handle handle, int segment, int bus); -void acpi_pci_irq_del_prt (int segment, int bus); +int acpi_pci_irq_add_prt(acpi_handle handle, int segment, int bus); +void acpi_pci_irq_del_prt(int segment, int bus); /* ACPI PCI Device Binding (pci_bind.c) */ struct pci_bus; -acpi_status acpi_get_pci_id (acpi_handle handle, struct acpi_pci_id *id); -int acpi_pci_bind (struct acpi_device *device); -int acpi_pci_unbind (struct acpi_device *device); -int acpi_pci_bind_root (struct acpi_device *device, struct acpi_pci_id *id, struct pci_bus *bus); +acpi_status acpi_get_pci_id(acpi_handle handle, struct acpi_pci_id *id); +int acpi_pci_bind(struct acpi_device *device); +int acpi_pci_unbind(struct acpi_device *device); +int acpi_pci_bind_root(struct acpi_device *device, struct acpi_pci_id *id, + struct pci_bus *bus); /* Arch-defined function to add a bus to the system */ -struct pci_bus *pci_acpi_scan_root(struct acpi_device *device, int domain, int bus); - -#endif /*CONFIG_ACPI_PCI*/ +struct pci_bus *pci_acpi_scan_root(struct acpi_device *device, int domain, + int bus); +#endif /*CONFIG_ACPI_PCI */ /* -------------------------------------------------------------------------- Power Resource -------------------------------------------------------------------------- */ #ifdef CONFIG_ACPI_POWER -int acpi_enable_wakeup_device_power (struct acpi_device *dev); -int acpi_disable_wakeup_device_power (struct acpi_device *dev); -int acpi_power_get_inferred_state (struct acpi_device *device); -int acpi_power_transition (struct acpi_device *device, int state); +int acpi_enable_wakeup_device_power(struct acpi_device *dev); +int acpi_disable_wakeup_device_power(struct acpi_device *dev); +int acpi_power_get_inferred_state(struct acpi_device *device); +int acpi_power_transition(struct acpi_device *device, int state); #endif - /* -------------------------------------------------------------------------- Embedded Controller -------------------------------------------------------------------------- */ #ifdef CONFIG_ACPI_EC -int acpi_ec_ecdt_probe (void); +int acpi_ec_ecdt_probe(void); #endif /* -------------------------------------------------------------------------- diff --git a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h index 819a53f83cf..98e0b8cd14e 100644 --- a/include/acpi/acpiosxf.h +++ b/include/acpi/acpiosxf.h @@ -7,7 +7,6 @@ * *****************************************************************************/ - /* * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. @@ -51,7 +50,6 @@ #include "platform/acenv.h" #include "actypes.h" - /* Priorities for acpi_os_queue_for_execution */ #define OSD_PRIORITY_GPE 1 @@ -62,227 +60,136 @@ #define ACPI_NO_UNIT_LIMIT ((u32) -1) #define ACPI_MUTEX_SEM 1 - /* Functions for acpi_os_signal */ #define ACPI_SIGNAL_FATAL 0 #define ACPI_SIGNAL_BREAKPOINT 1 -struct acpi_signal_fatal_info -{ - u32 type; - u32 code; - u32 argument; +struct acpi_signal_fatal_info { + u32 type; + u32 code; + u32 argument; }; - /* * OSL Initialization and shutdown primitives */ -acpi_status -acpi_os_initialize ( - void); - -acpi_status -acpi_os_terminate ( - void); +acpi_status acpi_os_initialize(void); +acpi_status acpi_os_terminate(void); /* * ACPI Table interfaces */ -acpi_status -acpi_os_get_root_pointer ( - u32 flags, - struct acpi_pointer *address); +acpi_status acpi_os_get_root_pointer(u32 flags, struct acpi_pointer *address); acpi_status -acpi_os_predefined_override ( - const struct acpi_predefined_names *init_val, - acpi_string *new_val); +acpi_os_predefined_override(const struct acpi_predefined_names *init_val, + acpi_string * new_val); acpi_status -acpi_os_table_override ( - struct acpi_table_header *existing_table, - struct acpi_table_header **new_table); - +acpi_os_table_override(struct acpi_table_header *existing_table, + struct acpi_table_header **new_table); /* * Synchronization primitives */ acpi_status -acpi_os_create_semaphore ( - u32 max_units, - u32 initial_units, - acpi_handle *out_handle); - -acpi_status -acpi_os_delete_semaphore ( - acpi_handle handle); +acpi_os_create_semaphore(u32 max_units, + u32 initial_units, acpi_handle * out_handle); -acpi_status -acpi_os_wait_semaphore ( - acpi_handle handle, - u32 units, - u16 timeout); +acpi_status acpi_os_delete_semaphore(acpi_handle handle); -acpi_status -acpi_os_signal_semaphore ( - acpi_handle handle, - u32 units); +acpi_status acpi_os_wait_semaphore(acpi_handle handle, u32 units, u16 timeout); -acpi_status -acpi_os_create_lock ( - acpi_handle *out_handle); +acpi_status acpi_os_signal_semaphore(acpi_handle handle, u32 units); -void -acpi_os_delete_lock ( - acpi_handle handle); +acpi_status acpi_os_create_lock(acpi_handle * out_handle); -unsigned long -acpi_os_acquire_lock ( - acpi_handle handle); +void acpi_os_delete_lock(acpi_handle handle); -void -acpi_os_release_lock ( - acpi_handle handle, - unsigned long flags); +unsigned long acpi_os_acquire_lock(acpi_handle handle); +void acpi_os_release_lock(acpi_handle handle, unsigned long flags); /* * Memory allocation and mapping */ -void * -acpi_os_allocate ( - acpi_size size); +void *acpi_os_allocate(acpi_size size); -void -acpi_os_free ( - void * memory); +void acpi_os_free(void *memory); acpi_status -acpi_os_map_memory ( - acpi_physical_address physical_address, - acpi_size size, - void __iomem **logical_address); +acpi_os_map_memory(acpi_physical_address physical_address, + acpi_size size, void __iomem ** logical_address); -void -acpi_os_unmap_memory ( - void __iomem *logical_address, - acpi_size size); +void acpi_os_unmap_memory(void __iomem * logical_address, acpi_size size); #ifdef ACPI_FUTURE_USAGE acpi_status -acpi_os_get_physical_address ( - void *logical_address, - acpi_physical_address *physical_address); +acpi_os_get_physical_address(void *logical_address, + acpi_physical_address * physical_address); #endif - - /* * Memory/Object Cache */ acpi_status -acpi_os_create_cache ( - char *cache_name, - u16 object_size, - u16 max_depth, - acpi_cache_t **return_cache); +acpi_os_create_cache(char *cache_name, + u16 object_size, + u16 max_depth, acpi_cache_t ** return_cache); -acpi_status -acpi_os_delete_cache ( - acpi_cache_t *cache); +acpi_status acpi_os_delete_cache(acpi_cache_t * cache); -acpi_status -acpi_os_purge_cache ( - acpi_cache_t *cache); +acpi_status acpi_os_purge_cache(acpi_cache_t * cache); -void * -acpi_os_acquire_object ( - acpi_cache_t *cache); +void *acpi_os_acquire_object(acpi_cache_t * cache); -acpi_status -acpi_os_release_object ( - acpi_cache_t *cache, - void *object); +acpi_status acpi_os_release_object(acpi_cache_t * cache, void *object); /* * Interrupt handlers */ acpi_status -acpi_os_install_interrupt_handler ( - u32 gsi, - acpi_osd_handler service_routine, - void *context); +acpi_os_install_interrupt_handler(u32 gsi, + acpi_osd_handler service_routine, + void *context); acpi_status -acpi_os_remove_interrupt_handler ( - u32 gsi, - acpi_osd_handler service_routine); - +acpi_os_remove_interrupt_handler(u32 gsi, acpi_osd_handler service_routine); /* * Threads and Scheduling */ -u32 -acpi_os_get_thread_id ( - void); +u32 acpi_os_get_thread_id(void); acpi_status -acpi_os_queue_for_execution ( - u32 priority, - acpi_osd_exec_callback function, - void *context); - -void -acpi_os_wait_events_complete( - void * context); +acpi_os_queue_for_execution(u32 priority, + acpi_osd_exec_callback function, void *context); -void -acpi_os_wait_events_complete ( - void *context); +void acpi_os_wait_events_complete(void *context); -void -acpi_os_sleep ( - acpi_integer milliseconds); +void acpi_os_wait_events_complete(void *context); -void -acpi_os_stall ( - u32 microseconds); +void acpi_os_sleep(acpi_integer milliseconds); +void acpi_os_stall(u32 microseconds); /* * Platform and hardware-independent I/O interfaces */ -acpi_status -acpi_os_read_port ( - acpi_io_address address, - u32 *value, - u32 width); - -acpi_status -acpi_os_write_port ( - acpi_io_address address, - u32 value, - u32 width); +acpi_status acpi_os_read_port(acpi_io_address address, u32 * value, u32 width); +acpi_status acpi_os_write_port(acpi_io_address address, u32 value, u32 width); /* * Platform and hardware-independent physical memory interfaces */ acpi_status -acpi_os_read_memory ( - acpi_physical_address address, - u32 *value, - u32 width); +acpi_os_read_memory(acpi_physical_address address, u32 * value, u32 width); acpi_status -acpi_os_write_memory ( - acpi_physical_address address, - u32 value, - u32 width); - +acpi_os_write_memory(acpi_physical_address address, u32 value, u32 width); /* * Platform and hardware-independent PCI configuration space access @@ -290,111 +197,69 @@ acpi_os_write_memory ( * certain compilers complain. */ acpi_status -acpi_os_read_pci_configuration ( - struct acpi_pci_id *pci_id, - u32 reg, - void *value, - u32 width); +acpi_os_read_pci_configuration(struct acpi_pci_id *pci_id, + u32 reg, void *value, u32 width); acpi_status -acpi_os_write_pci_configuration ( - struct acpi_pci_id *pci_id, - u32 reg, - acpi_integer value, - u32 width); +acpi_os_write_pci_configuration(struct acpi_pci_id *pci_id, + u32 reg, acpi_integer value, u32 width); /* * Interim function needed for PCI IRQ routing */ void -acpi_os_derive_pci_id( - acpi_handle rhandle, - acpi_handle chandle, - struct acpi_pci_id **pci_id); +acpi_os_derive_pci_id(acpi_handle rhandle, + acpi_handle chandle, struct acpi_pci_id **pci_id); /* * Miscellaneous */ -u8 -acpi_os_readable ( - void *pointer, - acpi_size length); +u8 acpi_os_readable(void *pointer, acpi_size length); #ifdef ACPI_FUTURE_USAGE -u8 -acpi_os_writable ( - void *pointer, - acpi_size length); +u8 acpi_os_writable(void *pointer, acpi_size length); #endif -u64 -acpi_os_get_timer ( - void); +u64 acpi_os_get_timer(void); -acpi_status -acpi_os_signal ( - u32 function, - void *info); +acpi_status acpi_os_signal(u32 function, void *info); /* * Debug print routines */ -void ACPI_INTERNAL_VAR_XFACE -acpi_os_printf ( - const char *format, - ...); - -void -acpi_os_vprintf ( - const char *format, - va_list args); +void ACPI_INTERNAL_VAR_XFACE acpi_os_printf(const char *format, ...); -void -acpi_os_redirect_output ( - void *destination); +void acpi_os_vprintf(const char *format, va_list args); +void acpi_os_redirect_output(void *destination); #ifdef ACPI_FUTURE_USAGE /* * Debug input */ -u32 -acpi_os_get_line ( - char *buffer); +u32 acpi_os_get_line(char *buffer); #endif - /* * Directory manipulation */ -void * -acpi_os_open_directory ( - char *pathname, - char *wildcard_spec, - char requested_file_type); +void *acpi_os_open_directory(char *pathname, + char *wildcard_spec, char requested_file_type); /* requeste_file_type values */ #define REQUEST_FILE_ONLY 0 #define REQUEST_DIR_ONLY 1 +char *acpi_os_get_next_filename(void *dir_handle); -char * -acpi_os_get_next_filename ( - void *dir_handle); - -void -acpi_os_close_directory ( - void *dir_handle); +void acpi_os_close_directory(void *dir_handle); /* * Debug */ void -acpi_os_dbg_assert( - void *failed_assertion, - void *file_name, - u32 line_number, - char *message); +acpi_os_dbg_assert(void *failed_assertion, + void *file_name, u32 line_number, char *message); -#endif /* __ACPIOSXF_H__ */ +#endif /* __ACPIOSXF_H__ */ diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h index 9ca212d73fb..2a9dbc13b0f 100644 --- a/include/acpi/acpixf.h +++ b/include/acpi/acpixf.h @@ -42,447 +42,283 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #ifndef __ACXFACE_H__ #define __ACXFACE_H__ #include "actypes.h" #include "actbl.h" - /* * Global interfaces */ -acpi_status -acpi_initialize_subsystem ( - void); +acpi_status acpi_initialize_subsystem(void); -acpi_status -acpi_enable_subsystem ( - u32 flags); +acpi_status acpi_enable_subsystem(u32 flags); -acpi_status -acpi_initialize_objects ( - u32 flags); +acpi_status acpi_initialize_objects(u32 flags); -acpi_status -acpi_terminate ( - void); +acpi_status acpi_terminate(void); #ifdef ACPI_FUTURE_USAGE -acpi_status -acpi_subsystem_status ( - void); +acpi_status acpi_subsystem_status(void); #endif -acpi_status -acpi_enable ( - void); +acpi_status acpi_enable(void); -acpi_status -acpi_disable ( - void); +acpi_status acpi_disable(void); #ifdef ACPI_FUTURE_USAGE -acpi_status -acpi_get_system_info ( - struct acpi_buffer *ret_buffer); +acpi_status acpi_get_system_info(struct acpi_buffer *ret_buffer); #endif -const char * -acpi_format_exception ( - acpi_status exception); +const char *acpi_format_exception(acpi_status exception); -acpi_status -acpi_purge_cached_objects ( - void); +acpi_status acpi_purge_cached_objects(void); #ifdef ACPI_FUTURE_USAGE acpi_status -acpi_install_initialization_handler ( - acpi_init_handler handler, - u32 function); +acpi_install_initialization_handler(acpi_init_handler handler, u32 function); #endif /* * ACPI Memory managment */ -void * -acpi_allocate ( - u32 size); - -void * -acpi_callocate ( - u32 size); +void *acpi_allocate(u32 size); -void -acpi_free ( - void *address); +void *acpi_callocate(u32 size); +void acpi_free(void *address); /* * ACPI table manipulation interfaces */ acpi_status -acpi_find_root_pointer ( - u32 flags, - struct acpi_pointer *rsdp_address); +acpi_find_root_pointer(u32 flags, struct acpi_pointer *rsdp_address); -acpi_status -acpi_load_tables ( - void); +acpi_status acpi_load_tables(void); #ifdef ACPI_FUTURE_USAGE -acpi_status -acpi_load_table ( - struct acpi_table_header *table_ptr); +acpi_status acpi_load_table(struct acpi_table_header *table_ptr); -acpi_status -acpi_unload_table ( - acpi_table_type table_type); +acpi_status acpi_unload_table(acpi_table_type table_type); acpi_status -acpi_get_table_header ( - acpi_table_type table_type, - u32 instance, - struct acpi_table_header *out_table_header); -#endif /* ACPI_FUTURE_USAGE */ +acpi_get_table_header(acpi_table_type table_type, + u32 instance, struct acpi_table_header *out_table_header); +#endif /* ACPI_FUTURE_USAGE */ acpi_status -acpi_get_table ( - acpi_table_type table_type, - u32 instance, - struct acpi_buffer *ret_buffer); +acpi_get_table(acpi_table_type table_type, + u32 instance, struct acpi_buffer *ret_buffer); acpi_status -acpi_get_firmware_table ( - acpi_string signature, - u32 instance, - u32 flags, - struct acpi_table_header **table_pointer); - +acpi_get_firmware_table(acpi_string signature, + u32 instance, + u32 flags, struct acpi_table_header **table_pointer); /* * Namespace and name interfaces */ acpi_status -acpi_walk_namespace ( - acpi_object_type type, - acpi_handle start_object, - u32 max_depth, - acpi_walk_callback user_function, - void *context, - void **return_value); +acpi_walk_namespace(acpi_object_type type, + acpi_handle start_object, + u32 max_depth, + acpi_walk_callback user_function, + void *context, void **return_value); acpi_status -acpi_get_devices ( - char *HID, - acpi_walk_callback user_function, - void *context, - void **return_value); +acpi_get_devices(char *HID, + acpi_walk_callback user_function, + void *context, void **return_value); acpi_status -acpi_get_name ( - acpi_handle handle, - u32 name_type, - struct acpi_buffer *ret_path_ptr); +acpi_get_name(acpi_handle handle, + u32 name_type, struct acpi_buffer *ret_path_ptr); acpi_status -acpi_get_handle ( - acpi_handle parent, - acpi_string pathname, - acpi_handle *ret_handle); +acpi_get_handle(acpi_handle parent, + acpi_string pathname, acpi_handle * ret_handle); acpi_status -acpi_attach_data ( - acpi_handle obj_handle, - acpi_object_handler handler, - void *data); +acpi_attach_data(acpi_handle obj_handle, + acpi_object_handler handler, void *data); acpi_status -acpi_detach_data ( - acpi_handle obj_handle, - acpi_object_handler handler); +acpi_detach_data(acpi_handle obj_handle, acpi_object_handler handler); acpi_status -acpi_get_data ( - acpi_handle obj_handle, - acpi_object_handler handler, - void **data); - +acpi_get_data(acpi_handle obj_handle, acpi_object_handler handler, void **data); /* * Object manipulation and enumeration */ acpi_status -acpi_evaluate_object ( - acpi_handle object, - acpi_string pathname, - struct acpi_object_list *parameter_objects, - struct acpi_buffer *return_object_buffer); +acpi_evaluate_object(acpi_handle object, + acpi_string pathname, + struct acpi_object_list *parameter_objects, + struct acpi_buffer *return_object_buffer); #ifdef ACPI_FUTURE_USAGE acpi_status -acpi_evaluate_object_typed ( - acpi_handle object, - acpi_string pathname, - struct acpi_object_list *external_params, - struct acpi_buffer *return_buffer, - acpi_object_type return_type); +acpi_evaluate_object_typed(acpi_handle object, + acpi_string pathname, + struct acpi_object_list *external_params, + struct acpi_buffer *return_buffer, + acpi_object_type return_type); #endif acpi_status -acpi_get_object_info ( - acpi_handle handle, - struct acpi_buffer *return_buffer); +acpi_get_object_info(acpi_handle handle, struct acpi_buffer *return_buffer); acpi_status -acpi_get_next_object ( - acpi_object_type type, - acpi_handle parent, - acpi_handle child, - acpi_handle *out_handle); +acpi_get_next_object(acpi_object_type type, + acpi_handle parent, + acpi_handle child, acpi_handle * out_handle); -acpi_status -acpi_get_type ( - acpi_handle object, - acpi_object_type *out_type); - -acpi_status -acpi_get_parent ( - acpi_handle object, - acpi_handle *out_handle); +acpi_status acpi_get_type(acpi_handle object, acpi_object_type * out_type); +acpi_status acpi_get_parent(acpi_handle object, acpi_handle * out_handle); /* * Event handler interfaces */ acpi_status -acpi_install_fixed_event_handler ( - u32 acpi_event, - acpi_event_handler handler, - void *context); +acpi_install_fixed_event_handler(u32 acpi_event, + acpi_event_handler handler, void *context); acpi_status -acpi_remove_fixed_event_handler ( - u32 acpi_event, - acpi_event_handler handler); +acpi_remove_fixed_event_handler(u32 acpi_event, acpi_event_handler handler); acpi_status -acpi_install_notify_handler ( - acpi_handle device, - u32 handler_type, - acpi_notify_handler handler, - void *context); +acpi_install_notify_handler(acpi_handle device, + u32 handler_type, + acpi_notify_handler handler, void *context); acpi_status -acpi_remove_notify_handler ( - acpi_handle device, - u32 handler_type, - acpi_notify_handler handler); +acpi_remove_notify_handler(acpi_handle device, + u32 handler_type, acpi_notify_handler handler); acpi_status -acpi_install_address_space_handler ( - acpi_handle device, - acpi_adr_space_type space_id, - acpi_adr_space_handler handler, - acpi_adr_space_setup setup, - void *context); +acpi_install_address_space_handler(acpi_handle device, + acpi_adr_space_type space_id, + acpi_adr_space_handler handler, + acpi_adr_space_setup setup, void *context); acpi_status -acpi_remove_address_space_handler ( - acpi_handle device, - acpi_adr_space_type space_id, - acpi_adr_space_handler handler); +acpi_remove_address_space_handler(acpi_handle device, + acpi_adr_space_type space_id, + acpi_adr_space_handler handler); acpi_status -acpi_install_gpe_handler ( - acpi_handle gpe_device, - u32 gpe_number, - u32 type, - acpi_event_handler address, - void *context); +acpi_install_gpe_handler(acpi_handle gpe_device, + u32 gpe_number, + u32 type, acpi_event_handler address, void *context); #ifdef ACPI_FUTURE_USAGE -acpi_status -acpi_install_exception_handler ( - acpi_exception_handler handler); +acpi_status acpi_install_exception_handler(acpi_exception_handler handler); #endif - /* * Event interfaces */ -acpi_status -acpi_acquire_global_lock ( - u16 timeout, - u32 *handle); +acpi_status acpi_acquire_global_lock(u16 timeout, u32 * handle); -acpi_status -acpi_release_global_lock ( - u32 handle); +acpi_status acpi_release_global_lock(u32 handle); acpi_status -acpi_remove_gpe_handler ( - acpi_handle gpe_device, - u32 gpe_number, - acpi_event_handler address); +acpi_remove_gpe_handler(acpi_handle gpe_device, + u32 gpe_number, acpi_event_handler address); -acpi_status -acpi_enable_event ( - u32 event, - u32 flags); +acpi_status acpi_enable_event(u32 event, u32 flags); -acpi_status -acpi_disable_event ( - u32 event, - u32 flags); +acpi_status acpi_disable_event(u32 event, u32 flags); -acpi_status -acpi_clear_event ( - u32 event); +acpi_status acpi_clear_event(u32 event); #ifdef ACPI_FUTURE_USAGE -acpi_status -acpi_get_event_status ( - u32 event, - acpi_event_status *event_status); -#endif /* ACPI_FUTURE_USAGE */ +acpi_status acpi_get_event_status(u32 event, acpi_event_status * event_status); +#endif /* ACPI_FUTURE_USAGE */ -acpi_status -acpi_set_gpe_type ( - acpi_handle gpe_device, - u32 gpe_number, - u8 type); +acpi_status acpi_set_gpe_type(acpi_handle gpe_device, u32 gpe_number, u8 type); -acpi_status -acpi_enable_gpe ( - acpi_handle gpe_device, - u32 gpe_number, - u32 flags); +acpi_status acpi_enable_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags); -acpi_status -acpi_disable_gpe ( - acpi_handle gpe_device, - u32 gpe_number, - u32 flags); +acpi_status acpi_disable_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags); -acpi_status -acpi_clear_gpe ( - acpi_handle gpe_device, - u32 gpe_number, - u32 flags); +acpi_status acpi_clear_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags); #ifdef ACPI_FUTURE_USAGE acpi_status -acpi_get_gpe_status ( - acpi_handle gpe_device, - u32 gpe_number, - u32 flags, - acpi_event_status *event_status); -#endif /* ACPI_FUTURE_USAGE */ +acpi_get_gpe_status(acpi_handle gpe_device, + u32 gpe_number, + u32 flags, acpi_event_status * event_status); +#endif /* ACPI_FUTURE_USAGE */ acpi_status -acpi_install_gpe_block ( - acpi_handle gpe_device, - struct acpi_generic_address *gpe_block_address, - u32 register_count, - u32 interrupt_number); - -acpi_status -acpi_remove_gpe_block ( - acpi_handle gpe_device); +acpi_install_gpe_block(acpi_handle gpe_device, + struct acpi_generic_address *gpe_block_address, + u32 register_count, u32 interrupt_number); +acpi_status acpi_remove_gpe_block(acpi_handle gpe_device); /* * Resource interfaces */ typedef -acpi_status (*ACPI_WALK_RESOURCE_CALLBACK) ( - struct acpi_resource *resource, - void *context); - +acpi_status(*ACPI_WALK_RESOURCE_CALLBACK) (struct acpi_resource * resource, + void *context); acpi_status -acpi_get_current_resources( - acpi_handle device_handle, - struct acpi_buffer *ret_buffer); +acpi_get_current_resources(acpi_handle device_handle, + struct acpi_buffer *ret_buffer); #ifdef ACPI_FUTURE_USAGE acpi_status -acpi_get_possible_resources( - acpi_handle device_handle, - struct acpi_buffer *ret_buffer); +acpi_get_possible_resources(acpi_handle device_handle, + struct acpi_buffer *ret_buffer); #endif acpi_status -acpi_walk_resources ( - acpi_handle device_handle, - char *path, - ACPI_WALK_RESOURCE_CALLBACK user_function, - void *context); +acpi_walk_resources(acpi_handle device_handle, + char *path, + ACPI_WALK_RESOURCE_CALLBACK user_function, void *context); acpi_status -acpi_set_current_resources ( - acpi_handle device_handle, - struct acpi_buffer *in_buffer); +acpi_set_current_resources(acpi_handle device_handle, + struct acpi_buffer *in_buffer); acpi_status -acpi_get_irq_routing_table ( - acpi_handle bus_device_handle, - struct acpi_buffer *ret_buffer); +acpi_get_irq_routing_table(acpi_handle bus_device_handle, + struct acpi_buffer *ret_buffer); acpi_status -acpi_resource_to_address64 ( - struct acpi_resource *resource, - struct acpi_resource_address64 *out); +acpi_resource_to_address64(struct acpi_resource *resource, + struct acpi_resource_address64 *out); /* * Hardware (ACPI device) interfaces */ -acpi_status -acpi_get_register ( - u32 register_id, - u32 *return_value, - u32 flags); +acpi_status acpi_get_register(u32 register_id, u32 * return_value, u32 flags); -acpi_status -acpi_set_register ( - u32 register_id, - u32 value, - u32 flags); +acpi_status acpi_set_register(u32 register_id, u32 value, u32 flags); acpi_status -acpi_set_firmware_waking_vector ( - acpi_physical_address physical_address); +acpi_set_firmware_waking_vector(acpi_physical_address physical_address); #ifdef ACPI_FUTURE_USAGE acpi_status -acpi_get_firmware_waking_vector ( - acpi_physical_address *physical_address); +acpi_get_firmware_waking_vector(acpi_physical_address * physical_address); #endif acpi_status -acpi_get_sleep_type_data ( - u8 sleep_state, - u8 *slp_typ_a, - u8 *slp_typ_b); +acpi_get_sleep_type_data(u8 sleep_state, u8 * slp_typ_a, u8 * slp_typ_b); -acpi_status -acpi_enter_sleep_state_prep ( - u8 sleep_state); +acpi_status acpi_enter_sleep_state_prep(u8 sleep_state); -acpi_status asmlinkage -acpi_enter_sleep_state ( - u8 sleep_state); +acpi_status asmlinkage acpi_enter_sleep_state(u8 sleep_state); -acpi_status asmlinkage -acpi_enter_sleep_state_s4bios ( - void); - -acpi_status -acpi_leave_sleep_state ( - u8 sleep_state); +acpi_status asmlinkage acpi_enter_sleep_state_s4bios(void); +acpi_status acpi_leave_sleep_state(u8 sleep_state); -#endif /* __ACXFACE_H__ */ +#endif /* __ACXFACE_H__ */ diff --git a/include/acpi/acresrc.h b/include/acpi/acresrc.h index ed679264c12..38e798b05d0 100644 --- a/include/acpi/acresrc.h +++ b/include/acpi/acresrc.h @@ -44,303 +44,216 @@ #ifndef __ACRESRC_H__ #define __ACRESRC_H__ - /* * Function prototypes called from Acpi* APIs */ acpi_status -acpi_rs_get_prt_method_data ( - acpi_handle handle, - struct acpi_buffer *ret_buffer); - +acpi_rs_get_prt_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer); acpi_status -acpi_rs_get_crs_method_data ( - acpi_handle handle, - struct acpi_buffer *ret_buffer); +acpi_rs_get_crs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer); #ifdef ACPI_FUTURE_USAGE acpi_status -acpi_rs_get_prs_method_data ( - acpi_handle handle, - struct acpi_buffer *ret_buffer); -#endif /* ACPI_FUTURE_USAGE */ +acpi_rs_get_prs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer); +#endif /* ACPI_FUTURE_USAGE */ acpi_status -acpi_rs_get_method_data ( - acpi_handle handle, - char *path, - struct acpi_buffer *ret_buffer); +acpi_rs_get_method_data(acpi_handle handle, + char *path, struct acpi_buffer *ret_buffer); acpi_status -acpi_rs_set_srs_method_data ( - acpi_handle handle, - struct acpi_buffer *ret_buffer); +acpi_rs_set_srs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer); acpi_status -acpi_rs_create_resource_list ( - union acpi_operand_object *byte_stream_buffer, - struct acpi_buffer *output_buffer); +acpi_rs_create_resource_list(union acpi_operand_object *byte_stream_buffer, + struct acpi_buffer *output_buffer); acpi_status -acpi_rs_create_byte_stream ( - struct acpi_resource *linked_list_buffer, - struct acpi_buffer *output_buffer); +acpi_rs_create_byte_stream(struct acpi_resource *linked_list_buffer, + struct acpi_buffer *output_buffer); acpi_status -acpi_rs_create_pci_routing_table ( - union acpi_operand_object *package_object, - struct acpi_buffer *output_buffer); - +acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, + struct acpi_buffer *output_buffer); /* * rsdump */ #ifdef ACPI_FUTURE_USAGE -void -acpi_rs_dump_resource_list ( - struct acpi_resource *resource); - -void -acpi_rs_dump_irq_list ( - u8 *route_table); -#endif /* ACPI_FUTURE_USAGE */ +void acpi_rs_dump_resource_list(struct acpi_resource *resource); +void acpi_rs_dump_irq_list(u8 * route_table); +#endif /* ACPI_FUTURE_USAGE */ /* * rscalc */ acpi_status -acpi_rs_get_byte_stream_start ( - u8 *byte_stream_buffer, - u8 **byte_stream_start, - u32 *size); +acpi_rs_get_byte_stream_start(u8 * byte_stream_buffer, + u8 ** byte_stream_start, u32 * size); acpi_status -acpi_rs_get_list_length ( - u8 *byte_stream_buffer, - u32 byte_stream_buffer_length, - acpi_size *size_needed); +acpi_rs_get_list_length(u8 * byte_stream_buffer, + u32 byte_stream_buffer_length, acpi_size * size_needed); acpi_status -acpi_rs_get_byte_stream_length ( - struct acpi_resource *linked_list_buffer, - acpi_size *size_needed); +acpi_rs_get_byte_stream_length(struct acpi_resource *linked_list_buffer, + acpi_size * size_needed); acpi_status -acpi_rs_get_pci_routing_table_length ( - union acpi_operand_object *package_object, - acpi_size *buffer_size_needed); +acpi_rs_get_pci_routing_table_length(union acpi_operand_object *package_object, + acpi_size * buffer_size_needed); acpi_status -acpi_rs_byte_stream_to_list ( - u8 *byte_stream_buffer, - u32 byte_stream_buffer_length, - u8 *output_buffer); +acpi_rs_byte_stream_to_list(u8 * byte_stream_buffer, + u32 byte_stream_buffer_length, u8 * output_buffer); acpi_status -acpi_rs_list_to_byte_stream ( - struct acpi_resource *linked_list, - acpi_size byte_stream_size_needed, - u8 *output_buffer); +acpi_rs_list_to_byte_stream(struct acpi_resource *linked_list, + acpi_size byte_stream_size_needed, + u8 * output_buffer); acpi_status -acpi_rs_io_resource ( - u8 *byte_stream_buffer, - acpi_size *bytes_consumed, - u8 **output_buffer, - acpi_size *structure_size); +acpi_rs_io_resource(u8 * byte_stream_buffer, + acpi_size * bytes_consumed, + u8 ** output_buffer, acpi_size * structure_size); acpi_status -acpi_rs_fixed_io_resource ( - u8 *byte_stream_buffer, - acpi_size *bytes_consumed, - u8 **output_buffer, - acpi_size *structure_size); +acpi_rs_fixed_io_resource(u8 * byte_stream_buffer, + acpi_size * bytes_consumed, + u8 ** output_buffer, acpi_size * structure_size); acpi_status -acpi_rs_io_stream ( - struct acpi_resource *linked_list, - u8 **output_buffer, - acpi_size *bytes_consumed); +acpi_rs_io_stream(struct acpi_resource *linked_list, + u8 ** output_buffer, acpi_size * bytes_consumed); acpi_status -acpi_rs_fixed_io_stream ( - struct acpi_resource *linked_list, - u8 **output_buffer, - acpi_size *bytes_consumed); +acpi_rs_fixed_io_stream(struct acpi_resource *linked_list, + u8 ** output_buffer, acpi_size * bytes_consumed); acpi_status -acpi_rs_irq_resource ( - u8 *byte_stream_buffer, - acpi_size *bytes_consumed, - u8 **output_buffer, - acpi_size *structure_size); +acpi_rs_irq_resource(u8 * byte_stream_buffer, + acpi_size * bytes_consumed, + u8 ** output_buffer, acpi_size * structure_size); acpi_status -acpi_rs_irq_stream ( - struct acpi_resource *linked_list, - u8 **output_buffer, - acpi_size *bytes_consumed); +acpi_rs_irq_stream(struct acpi_resource *linked_list, + u8 ** output_buffer, acpi_size * bytes_consumed); acpi_status -acpi_rs_dma_resource ( - u8 *byte_stream_buffer, - acpi_size *bytes_consumed, - u8 **output_buffer, - acpi_size *structure_size); +acpi_rs_dma_resource(u8 * byte_stream_buffer, + acpi_size * bytes_consumed, + u8 ** output_buffer, acpi_size * structure_size); acpi_status -acpi_rs_dma_stream ( - struct acpi_resource *linked_list, - u8 **output_buffer, - acpi_size *bytes_consumed); +acpi_rs_dma_stream(struct acpi_resource *linked_list, + u8 ** output_buffer, acpi_size * bytes_consumed); acpi_status -acpi_rs_address16_resource ( - u8 *byte_stream_buffer, - acpi_size *bytes_consumed, - u8 **output_buffer, - acpi_size *structure_size); +acpi_rs_address16_resource(u8 * byte_stream_buffer, + acpi_size * bytes_consumed, + u8 ** output_buffer, acpi_size * structure_size); acpi_status -acpi_rs_address16_stream ( - struct acpi_resource *linked_list, - u8 **output_buffer, - acpi_size *bytes_consumed); +acpi_rs_address16_stream(struct acpi_resource *linked_list, + u8 ** output_buffer, acpi_size * bytes_consumed); acpi_status -acpi_rs_address32_resource ( - u8 *byte_stream_buffer, - acpi_size *bytes_consumed, - u8 **output_buffer, - acpi_size *structure_size); +acpi_rs_address32_resource(u8 * byte_stream_buffer, + acpi_size * bytes_consumed, + u8 ** output_buffer, acpi_size * structure_size); acpi_status -acpi_rs_address32_stream ( - struct acpi_resource *linked_list, - u8 **output_buffer, - acpi_size *bytes_consumed); +acpi_rs_address32_stream(struct acpi_resource *linked_list, + u8 ** output_buffer, acpi_size * bytes_consumed); acpi_status -acpi_rs_address64_resource ( - u8 *byte_stream_buffer, - acpi_size *bytes_consumed, - u8 **output_buffer, - acpi_size *structure_size); +acpi_rs_address64_resource(u8 * byte_stream_buffer, + acpi_size * bytes_consumed, + u8 ** output_buffer, acpi_size * structure_size); acpi_status -acpi_rs_address64_stream ( - struct acpi_resource *linked_list, - u8 **output_buffer, - acpi_size *bytes_consumed); +acpi_rs_address64_stream(struct acpi_resource *linked_list, + u8 ** output_buffer, acpi_size * bytes_consumed); acpi_status -acpi_rs_start_depend_fns_resource ( - u8 *byte_stream_buffer, - acpi_size *bytes_consumed, - u8 **output_buffer, - acpi_size *structure_size); +acpi_rs_start_depend_fns_resource(u8 * byte_stream_buffer, + acpi_size * bytes_consumed, + u8 ** output_buffer, + acpi_size * structure_size); acpi_status -acpi_rs_end_depend_fns_resource ( - u8 *byte_stream_buffer, - acpi_size *bytes_consumed, - u8 **output_buffer, - acpi_size *structure_size); +acpi_rs_end_depend_fns_resource(u8 * byte_stream_buffer, + acpi_size * bytes_consumed, + u8 ** output_buffer, + acpi_size * structure_size); acpi_status -acpi_rs_start_depend_fns_stream ( - struct acpi_resource *linked_list, - u8 **output_buffer, - acpi_size *bytes_consumed); +acpi_rs_start_depend_fns_stream(struct acpi_resource *linked_list, + u8 ** output_buffer, + acpi_size * bytes_consumed); acpi_status -acpi_rs_end_depend_fns_stream ( - struct acpi_resource *linked_list, - u8 **output_buffer, - acpi_size *bytes_consumed); +acpi_rs_end_depend_fns_stream(struct acpi_resource *linked_list, + u8 ** output_buffer, acpi_size * bytes_consumed); acpi_status -acpi_rs_memory24_resource ( - u8 *byte_stream_buffer, - acpi_size *bytes_consumed, - u8 **output_buffer, - acpi_size *structure_size); +acpi_rs_memory24_resource(u8 * byte_stream_buffer, + acpi_size * bytes_consumed, + u8 ** output_buffer, acpi_size * structure_size); acpi_status -acpi_rs_memory24_stream ( - struct acpi_resource *linked_list, - u8 **output_buffer, - acpi_size *bytes_consumed); +acpi_rs_memory24_stream(struct acpi_resource *linked_list, + u8 ** output_buffer, acpi_size * bytes_consumed); acpi_status -acpi_rs_memory32_range_resource ( - u8 *byte_stream_buffer, - acpi_size *bytes_consumed, - u8 **output_buffer, - acpi_size *structure_size); +acpi_rs_memory32_range_resource(u8 * byte_stream_buffer, + acpi_size * bytes_consumed, + u8 ** output_buffer, + acpi_size * structure_size); acpi_status -acpi_rs_fixed_memory32_resource ( - u8 *byte_stream_buffer, - acpi_size *bytes_consumed, - u8 **output_buffer, - acpi_size *structure_size); +acpi_rs_fixed_memory32_resource(u8 * byte_stream_buffer, + acpi_size * bytes_consumed, + u8 ** output_buffer, + acpi_size * structure_size); acpi_status -acpi_rs_memory32_range_stream ( - struct acpi_resource *linked_list, - u8 **output_buffer, - acpi_size *bytes_consumed); +acpi_rs_memory32_range_stream(struct acpi_resource *linked_list, + u8 ** output_buffer, acpi_size * bytes_consumed); acpi_status -acpi_rs_fixed_memory32_stream ( - struct acpi_resource *linked_list, - u8 **output_buffer, - acpi_size *bytes_consumed); +acpi_rs_fixed_memory32_stream(struct acpi_resource *linked_list, + u8 ** output_buffer, acpi_size * bytes_consumed); acpi_status -acpi_rs_extended_irq_resource ( - u8 *byte_stream_buffer, - acpi_size *bytes_consumed, - u8 **output_buffer, - acpi_size *structure_size); +acpi_rs_extended_irq_resource(u8 * byte_stream_buffer, + acpi_size * bytes_consumed, + u8 ** output_buffer, acpi_size * structure_size); acpi_status -acpi_rs_extended_irq_stream ( - struct acpi_resource *linked_list, - u8 **output_buffer, - acpi_size *bytes_consumed); +acpi_rs_extended_irq_stream(struct acpi_resource *linked_list, + u8 ** output_buffer, acpi_size * bytes_consumed); acpi_status -acpi_rs_end_tag_resource ( - u8 *byte_stream_buffer, - acpi_size *bytes_consumed, - u8 **output_buffer, - acpi_size *structure_size); +acpi_rs_end_tag_resource(u8 * byte_stream_buffer, + acpi_size * bytes_consumed, + u8 ** output_buffer, acpi_size * structure_size); acpi_status -acpi_rs_end_tag_stream ( - struct acpi_resource *linked_list, - u8 **output_buffer, - acpi_size *bytes_consumed); +acpi_rs_end_tag_stream(struct acpi_resource *linked_list, + u8 ** output_buffer, acpi_size * bytes_consumed); acpi_status -acpi_rs_vendor_resource ( - u8 *byte_stream_buffer, - acpi_size *bytes_consumed, - u8 **output_buffer, - acpi_size *structure_size); +acpi_rs_vendor_resource(u8 * byte_stream_buffer, + acpi_size * bytes_consumed, + u8 ** output_buffer, acpi_size * structure_size); acpi_status -acpi_rs_vendor_stream ( - struct acpi_resource *linked_list, - u8 **output_buffer, - acpi_size *bytes_consumed); +acpi_rs_vendor_stream(struct acpi_resource *linked_list, + u8 ** output_buffer, acpi_size * bytes_consumed); -u8 -acpi_rs_get_resource_type ( - u8 resource_start_byte); +u8 acpi_rs_get_resource_type(u8 resource_start_byte); -#endif /* __ACRESRC_H__ */ +#endif /* __ACRESRC_H__ */ diff --git a/include/acpi/acstruct.h b/include/acpi/acstruct.h index 27b22bb3d22..99d23533980 100644 --- a/include/acpi/acstruct.h +++ b/include/acpi/acstruct.h @@ -44,14 +44,12 @@ #ifndef __ACSTRUCT_H__ #define __ACSTRUCT_H__ - /***************************************************************************** * * Tree walking typedefs and structs * ****************************************************************************/ - /* * Walk state - current state of a parse tree walk. Used for both a leisurely stroll through * the tree (for whatever reason), and for control method execution. @@ -65,97 +63,90 @@ #define ACPI_WALK_CONST_REQUIRED 3 #define ACPI_WALK_CONST_OPTIONAL 4 -struct acpi_walk_state -{ - u8 data_type; /* To differentiate various internal objs MUST BE FIRST!*/\ - u8 walk_type; - acpi_owner_id owner_id; /* Owner of objects created during the walk */ - u8 last_predicate; /* Result of last predicate */ - u8 current_result; /* */ - u8 next_op_info; /* Info about next_op */ - u8 num_operands; /* Stack pointer for Operands[] array */ - u8 return_used; - u16 opcode; /* Current AML opcode */ - u8 scope_depth; - u8 pass_number; /* Parse pass during table load */ - u32 arg_count; /* push for fixed or var args */ - u32 aml_offset; - u32 arg_types; - u32 method_breakpoint; /* For single stepping */ - u32 user_breakpoint; /* User AML breakpoint */ - u32 parse_flags; - u32 prev_arg_types; - - u8 *aml_last_while; - struct acpi_namespace_node arguments[ACPI_METHOD_NUM_ARGS]; /* Control method arguments */ - union acpi_operand_object **caller_return_desc; - union acpi_generic_state *control_state; /* List of control states (nested IFs) */ - struct acpi_namespace_node *deferred_node; /* Used when executing deferred opcodes */ - struct acpi_gpe_event_info *gpe_event_info; /* Info for GPE (_Lxx/_Exx methods only */ - union acpi_operand_object *implicit_return_obj; - struct acpi_namespace_node local_variables[ACPI_METHOD_NUM_LOCALS]; /* Control method locals */ - struct acpi_namespace_node *method_call_node; /* Called method Node*/ - union acpi_parse_object *method_call_op; /* method_call Op if running a method */ - union acpi_operand_object *method_desc; /* Method descriptor if running a method */ - struct acpi_namespace_node *method_node; /* Method node if running a method. */ - union acpi_parse_object *op; /* Current parser op */ - union acpi_operand_object *operands[ACPI_OBJ_NUM_OPERANDS+1]; /* Operands passed to the interpreter (+1 for NULL terminator) */ - const struct acpi_opcode_info *op_info; /* Info on current opcode */ - union acpi_parse_object *origin; /* Start of walk [Obsolete] */ - union acpi_operand_object **params; - struct acpi_parse_state parser_state; /* Current state of parser */ - union acpi_operand_object *result_obj; - union acpi_generic_state *results; /* Stack of accumulated results */ - union acpi_operand_object *return_desc; /* Return object, if any */ - union acpi_generic_state *scope_info; /* Stack of nested scopes */ - - union acpi_parse_object *prev_op; /* Last op that was processed */ - union acpi_parse_object *next_op; /* next op to be processed */ - acpi_parse_downwards descending_callback; - acpi_parse_upwards ascending_callback; - struct acpi_thread_state *thread; - struct acpi_walk_state *next; /* Next walk_state in list */ +struct acpi_walk_state { + u8 data_type; /* To differentiate various internal objs MUST BE FIRST! */ + u8 walk_type; + acpi_owner_id owner_id; /* Owner of objects created during the walk */ + u8 last_predicate; /* Result of last predicate */ + u8 current_result; /* */ + u8 next_op_info; /* Info about next_op */ + u8 num_operands; /* Stack pointer for Operands[] array */ + u8 return_used; + u16 opcode; /* Current AML opcode */ + u8 scope_depth; + u8 pass_number; /* Parse pass during table load */ + u32 arg_count; /* push for fixed or var args */ + u32 aml_offset; + u32 arg_types; + u32 method_breakpoint; /* For single stepping */ + u32 user_breakpoint; /* User AML breakpoint */ + u32 parse_flags; + u32 prev_arg_types; + + u8 *aml_last_while; + struct acpi_namespace_node arguments[ACPI_METHOD_NUM_ARGS]; /* Control method arguments */ + union acpi_operand_object **caller_return_desc; + union acpi_generic_state *control_state; /* List of control states (nested IFs) */ + struct acpi_namespace_node *deferred_node; /* Used when executing deferred opcodes */ + struct acpi_gpe_event_info *gpe_event_info; /* Info for GPE (_Lxx/_Exx methods only */ + union acpi_operand_object *implicit_return_obj; + struct acpi_namespace_node local_variables[ACPI_METHOD_NUM_LOCALS]; /* Control method locals */ + struct acpi_namespace_node *method_call_node; /* Called method Node */ + union acpi_parse_object *method_call_op; /* method_call Op if running a method */ + union acpi_operand_object *method_desc; /* Method descriptor if running a method */ + struct acpi_namespace_node *method_node; /* Method node if running a method. */ + union acpi_parse_object *op; /* Current parser op */ + union acpi_operand_object *operands[ACPI_OBJ_NUM_OPERANDS + 1]; /* Operands passed to the interpreter (+1 for NULL terminator) */ + const struct acpi_opcode_info *op_info; /* Info on current opcode */ + union acpi_parse_object *origin; /* Start of walk [Obsolete] */ + union acpi_operand_object **params; + struct acpi_parse_state parser_state; /* Current state of parser */ + union acpi_operand_object *result_obj; + union acpi_generic_state *results; /* Stack of accumulated results */ + union acpi_operand_object *return_desc; /* Return object, if any */ + union acpi_generic_state *scope_info; /* Stack of nested scopes */ + + union acpi_parse_object *prev_op; /* Last op that was processed */ + union acpi_parse_object *next_op; /* next op to be processed */ + acpi_parse_downwards descending_callback; + acpi_parse_upwards ascending_callback; + struct acpi_thread_state *thread; + struct acpi_walk_state *next; /* Next walk_state in list */ }; - /* Info used by acpi_ps_init_objects */ -struct acpi_init_walk_info -{ - u16 method_count; - u16 device_count; - u16 op_region_count; - u16 field_count; - u16 buffer_count; - u16 package_count; - u16 op_region_init; - u16 field_init; - u16 buffer_init; - u16 package_init; - u16 object_count; - struct acpi_table_desc *table_desc; +struct acpi_init_walk_info { + u16 method_count; + u16 device_count; + u16 op_region_count; + u16 field_count; + u16 buffer_count; + u16 package_count; + u16 op_region_init; + u16 field_init; + u16 buffer_init; + u16 package_init; + u16 object_count; + struct acpi_table_desc *table_desc; }; - /* Info used by acpi_ns_initialize_devices */ -struct acpi_device_walk_info -{ - u16 device_count; - u16 num_STA; - u16 num_INI; - struct acpi_table_desc *table_desc; +struct acpi_device_walk_info { + u16 device_count; + u16 num_STA; + u16 num_INI; + struct acpi_table_desc *table_desc; }; - /* TBD: [Restructure] Merge with struct above */ -struct acpi_walk_info -{ - u32 debug_level; - u32 count; - acpi_owner_id owner_id; - u8 display_type; +struct acpi_walk_info { + u32 debug_level; + u32 count; + acpi_owner_id owner_id; + u8 display_type; }; /* Display Types */ @@ -166,56 +157,48 @@ struct acpi_walk_info #define ACPI_DISPLAY_SHORT (u8) 2 -struct acpi_get_devices_info -{ - acpi_walk_callback user_function; - void *context; - char *hid; +struct acpi_get_devices_info { + acpi_walk_callback user_function; + void *context; + char *hid; }; +union acpi_aml_operands { + union acpi_operand_object *operands[7]; -union acpi_aml_operands -{ - union acpi_operand_object *operands[7]; - - struct - { - struct acpi_object_integer *type; - struct acpi_object_integer *code; - struct acpi_object_integer *argument; + struct { + struct acpi_object_integer *type; + struct acpi_object_integer *code; + struct acpi_object_integer *argument; } fatal; - struct - { - union acpi_operand_object *source; - struct acpi_object_integer *index; - union acpi_operand_object *target; + struct { + union acpi_operand_object *source; + struct acpi_object_integer *index; + union acpi_operand_object *target; } index; - struct - { - union acpi_operand_object *source; - struct acpi_object_integer *index; - struct acpi_object_integer *length; - union acpi_operand_object *target; + struct { + union acpi_operand_object *source; + struct acpi_object_integer *index; + struct acpi_object_integer *length; + union acpi_operand_object *target; } mid; }; - /* Internal method parameter list */ -struct acpi_parameter_info -{ - struct acpi_namespace_node *node; - union acpi_operand_object *obj_desc; - union acpi_operand_object **parameters; - union acpi_operand_object *return_object; - u8 pass_number; - u8 parameter_type; - u8 return_object_type; +struct acpi_parameter_info { + struct acpi_namespace_node *node; + union acpi_operand_object *obj_desc; + union acpi_operand_object **parameters; + union acpi_operand_object *return_object; + u8 pass_number; + u8 parameter_type; + u8 return_object_type; }; /* Types for parameter_type above */ @@ -223,5 +206,4 @@ struct acpi_parameter_info #define ACPI_PARAM_ARGS 0 #define ACPI_PARAM_GPE 1 - #endif diff --git a/include/acpi/actables.h b/include/acpi/actables.h index e6ceb181964..f92c1858b80 100644 --- a/include/acpi/actables.h +++ b/include/acpi/actables.h @@ -44,154 +44,101 @@ #ifndef __ACTABLES_H__ #define __ACTABLES_H__ - /* Used in acpi_tb_map_acpi_table for size parameter if table header is to be used */ #define SIZE_IN_HEADER 0 - /* * tbconvrt - Table conversion routines */ -acpi_status -acpi_tb_convert_to_xsdt ( - struct acpi_table_desc *table_info); +acpi_status acpi_tb_convert_to_xsdt(struct acpi_table_desc *table_info); -acpi_status -acpi_tb_convert_table_fadt ( - void); +acpi_status acpi_tb_convert_table_fadt(void); -acpi_status -acpi_tb_build_common_facs ( - struct acpi_table_desc *table_info); +acpi_status acpi_tb_build_common_facs(struct acpi_table_desc *table_info); u32 -acpi_tb_get_table_count ( - struct rsdp_descriptor *RSDP, - struct acpi_table_header *RSDT); - +acpi_tb_get_table_count(struct rsdp_descriptor *RSDP, + struct acpi_table_header *RSDT); /* * tbget - Table "get" routines */ acpi_status -acpi_tb_get_table ( - struct acpi_pointer *address, - struct acpi_table_desc *table_info); - -acpi_status -acpi_tb_get_table_header ( - struct acpi_pointer *address, - struct acpi_table_header *return_header); +acpi_tb_get_table(struct acpi_pointer *address, + struct acpi_table_desc *table_info); acpi_status -acpi_tb_get_table_body ( - struct acpi_pointer *address, - struct acpi_table_header *header, - struct acpi_table_desc *table_info); +acpi_tb_get_table_header(struct acpi_pointer *address, + struct acpi_table_header *return_header); acpi_status -acpi_tb_get_table_ptr ( - acpi_table_type table_type, - u32 instance, - struct acpi_table_header **table_ptr_loc); +acpi_tb_get_table_body(struct acpi_pointer *address, + struct acpi_table_header *header, + struct acpi_table_desc *table_info); acpi_status -acpi_tb_verify_rsdp ( - struct acpi_pointer *address); +acpi_tb_get_table_ptr(acpi_table_type table_type, + u32 instance, struct acpi_table_header **table_ptr_loc); -void -acpi_tb_get_rsdt_address ( - struct acpi_pointer *out_address); +acpi_status acpi_tb_verify_rsdp(struct acpi_pointer *address); -acpi_status -acpi_tb_validate_rsdt ( - struct acpi_table_header *table_ptr); +void acpi_tb_get_rsdt_address(struct acpi_pointer *out_address); +acpi_status acpi_tb_validate_rsdt(struct acpi_table_header *table_ptr); /* * tbgetall - get multiple required tables */ -acpi_status -acpi_tb_get_required_tables ( - void); - +acpi_status acpi_tb_get_required_tables(void); /* * tbinstall - Table installation */ -acpi_status -acpi_tb_install_table ( - struct acpi_table_desc *table_info); +acpi_status acpi_tb_install_table(struct acpi_table_desc *table_info); acpi_status -acpi_tb_recognize_table ( - struct acpi_table_desc *table_info, - u8 search_type); +acpi_tb_recognize_table(struct acpi_table_desc *table_info, u8 search_type); acpi_status -acpi_tb_init_table_descriptor ( - acpi_table_type table_type, - struct acpi_table_desc *table_info); - +acpi_tb_init_table_descriptor(acpi_table_type table_type, + struct acpi_table_desc *table_info); /* * tbremove - Table removal and deletion */ -void -acpi_tb_delete_all_tables ( - void); - -void -acpi_tb_delete_tables_by_type ( - acpi_table_type type); +void acpi_tb_delete_all_tables(void); -void -acpi_tb_delete_single_table ( - struct acpi_table_desc *table_desc); +void acpi_tb_delete_tables_by_type(acpi_table_type type); -struct acpi_table_desc * -acpi_tb_uninstall_table ( - struct acpi_table_desc *table_desc); +void acpi_tb_delete_single_table(struct acpi_table_desc *table_desc); +struct acpi_table_desc *acpi_tb_uninstall_table(struct acpi_table_desc + *table_desc); /* * tbxfroot - RSDP, RSDT utilities */ acpi_status -acpi_tb_find_table ( - char *signature, - char *oem_id, - char *oem_table_id, - struct acpi_table_header **table_ptr); +acpi_tb_find_table(char *signature, + char *oem_id, + char *oem_table_id, struct acpi_table_header **table_ptr); -acpi_status -acpi_tb_get_table_rsdt ( - void); - -acpi_status -acpi_tb_validate_rsdp ( - struct rsdp_descriptor *rsdp); +acpi_status acpi_tb_get_table_rsdt(void); +acpi_status acpi_tb_validate_rsdp(struct rsdp_descriptor *rsdp); /* * tbutils - common table utilities */ -acpi_status -acpi_tb_is_table_installed ( - struct acpi_table_desc *new_table_desc); +acpi_status acpi_tb_is_table_installed(struct acpi_table_desc *new_table_desc); acpi_status -acpi_tb_verify_table_checksum ( - struct acpi_table_header *table_header); +acpi_tb_verify_table_checksum(struct acpi_table_header *table_header); -u8 -acpi_tb_generate_checksum ( - void *buffer, - u32 length); +u8 acpi_tb_generate_checksum(void *buffer, u32 length); acpi_status -acpi_tb_validate_table_header ( - struct acpi_table_header *table_header); +acpi_tb_validate_table_header(struct acpi_table_header *table_header); -#endif /* __ACTABLES_H__ */ +#endif /* __ACTABLES_H__ */ diff --git a/include/acpi/actbl.h b/include/acpi/actbl.h index c1e9110c366..a46f406e1c9 100644 --- a/include/acpi/actbl.h +++ b/include/acpi/actbl.h @@ -44,27 +44,24 @@ #ifndef __ACTBL_H__ #define __ACTBL_H__ - /* * Values for description table header signatures */ #define RSDP_NAME "RSDP" -#define RSDP_SIG "RSD PTR " /* RSDT Pointer signature */ -#define APIC_SIG "APIC" /* Multiple APIC Description Table */ -#define DSDT_SIG "DSDT" /* Differentiated System Description Table */ -#define FADT_SIG "FACP" /* Fixed ACPI Description Table */ -#define FACS_SIG "FACS" /* Firmware ACPI Control Structure */ -#define PSDT_SIG "PSDT" /* Persistent System Description Table */ -#define RSDT_SIG "RSDT" /* Root System Description Table */ -#define XSDT_SIG "XSDT" /* Extended System Description Table */ -#define SSDT_SIG "SSDT" /* Secondary System Description Table */ -#define SBST_SIG "SBST" /* Smart Battery Specification Table */ -#define SPIC_SIG "SPIC" /* IOSAPIC table */ -#define BOOT_SIG "BOOT" /* Boot table */ - - -#define GL_OWNED 0x02 /* Ownership of global lock is bit 1 */ - +#define RSDP_SIG "RSD PTR " /* RSDT Pointer signature */ +#define APIC_SIG "APIC" /* Multiple APIC Description Table */ +#define DSDT_SIG "DSDT" /* Differentiated System Description Table */ +#define FADT_SIG "FACP" /* Fixed ACPI Description Table */ +#define FACS_SIG "FACS" /* Firmware ACPI Control Structure */ +#define PSDT_SIG "PSDT" /* Persistent System Description Table */ +#define RSDT_SIG "RSDT" /* Root System Description Table */ +#define XSDT_SIG "XSDT" /* Extended System Description Table */ +#define SSDT_SIG "SSDT" /* Secondary System Description Table */ +#define SBST_SIG "SBST" /* Smart Battery Specification Table */ +#define SPIC_SIG "SPIC" /* IOSAPIC table */ +#define BOOT_SIG "BOOT" /* Boot table */ + +#define GL_OWNED 0x02 /* Ownership of global lock is bit 1 */ /* * Common table types. The base code can remain @@ -75,7 +72,6 @@ #define FACS_DESCRIPTOR struct facs_descriptor_rev2 #define FADT_DESCRIPTOR struct fadt_descriptor_rev2 - #pragma pack(1) /* @@ -84,28 +80,24 @@ * NOTE: The tables that are specific to ACPI versions (1.0, 2.0, etc.) * are in separate files. */ -struct rsdp_descriptor /* Root System Descriptor Pointer */ -{ - char signature[8]; /* ACPI signature, contains "RSD PTR " */ - u8 checksum; /* ACPI 1.0 checksum */ - char oem_id[6]; /* OEM identification */ - u8 revision; /* Must be (0) for ACPI 1.0 or (2) for ACPI 2.0+ */ - u32 rsdt_physical_address; /* 32-bit physical address of the RSDT */ - u32 length; /* XSDT Length in bytes, including header */ - u64 xsdt_physical_address; /* 64-bit physical address of the XSDT */ - u8 extended_checksum; /* Checksum of entire table (ACPI 2.0) */ - char reserved[3]; /* Reserved, must be zero */ +struct rsdp_descriptor { /* Root System Descriptor Pointer */ + char signature[8]; /* ACPI signature, contains "RSD PTR " */ + u8 checksum; /* ACPI 1.0 checksum */ + char oem_id[6]; /* OEM identification */ + u8 revision; /* Must be (0) for ACPI 1.0 or (2) for ACPI 2.0+ */ + u32 rsdt_physical_address; /* 32-bit physical address of the RSDT */ + u32 length; /* XSDT Length in bytes, including header */ + u64 xsdt_physical_address; /* 64-bit physical address of the XSDT */ + u8 extended_checksum; /* Checksum of entire table (ACPI 2.0) */ + char reserved[3]; /* Reserved, must be zero */ }; - -struct acpi_common_facs /* Common FACS for internal use */ -{ - u32 *global_lock; - u64 *firmware_waking_vector; - u8 vector_width; +struct acpi_common_facs { /* Common FACS for internal use */ + u32 *global_lock; + u64 *firmware_waking_vector; + u8 vector_width; }; - #define ACPI_TABLE_HEADER_DEF /* ACPI common table header */ \ char signature[4]; /* ASCII table signature */\ u32 length; /* Length of table in bytes, including this header */\ @@ -115,14 +107,10 @@ struct acpi_common_facs /* Common FACS for internal use */ char oem_table_id[8]; /* ASCII OEM table identification */\ u32 oem_revision; /* OEM revision number */\ char asl_compiler_id [4]; /* ASCII ASL compiler vendor ID */\ - u32 asl_compiler_revision; /* ASL compiler version */ - - -struct acpi_table_header /* ACPI common table header */ -{ - ACPI_TABLE_HEADER_DEF -}; + u32 asl_compiler_revision; /* ASL compiler version */ +struct acpi_table_header { /* ACPI common table header */ +ACPI_TABLE_HEADER_DEF}; /* * MADT values and structures @@ -135,16 +123,15 @@ struct acpi_table_header /* ACPI common table header */ /* Master MADT */ -struct multiple_apic_table -{ - ACPI_TABLE_HEADER_DEF /* ACPI common table header */ - u32 local_apic_address; /* Physical address of local APIC */ +struct multiple_apic_table { + ACPI_TABLE_HEADER_DEF /* ACPI common table header */ + u32 local_apic_address; /* Physical address of local APIC */ /* Flags (32 bits) */ - u8 PCATcompat : 1; /* 00: System also has dual 8259s */ - u8 : 7; /* 01-07: Reserved, must be zero */ - u8 reserved1[3]; /* 08-31: Reserved, must be zero */ + u8 PCATcompat:1; /* 00: System also has dual 8259s */ + u8:7; /* 01-07: Reserved, must be zero */ + u8 reserved1[3]; /* 08-31: Reserved, must be zero */ }; /* Values for Type in APIC_HEADER_DEF */ @@ -158,7 +145,7 @@ struct multiple_apic_table #define APIC_IO_SAPIC 6 #define APIC_LOCAL_SAPIC 7 #define APIC_XRUPT_SOURCE 8 -#define APIC_RESERVED 9 /* 9 and greater are reserved */ +#define APIC_RESERVED 9 /* 9 and greater are reserved */ /* * MADT sub-structures (Follow MULTIPLE_APIC_DESCRIPTION_TABLE) @@ -167,10 +154,8 @@ struct multiple_apic_table u8 type; \ u8 length; -struct apic_header -{ - APIC_HEADER_DEF -}; +struct apic_header { +APIC_HEADER_DEF}; /* Values for MPS INTI flags */ @@ -190,113 +175,84 @@ struct apic_header u8 polarity : 2; /* 00-01: Polarity of APIC I/O input signals */\ u8 trigger_mode : 2; /* 02-03: Trigger mode of APIC input signals */\ u8 : 4; /* 04-07: Reserved, must be zero */\ - u8 reserved1; /* 08-15: Reserved, must be zero */ + u8 reserved1; /* 08-15: Reserved, must be zero */ #define LOCAL_APIC_FLAGS \ u8 processor_enabled: 1; /* 00: Processor is usable if set */\ u8 : 7; /* 01-07: Reserved, must be zero */\ - u8 reserved2; /* 08-15: Reserved, must be zero */ + u8 reserved2; /* 08-15: Reserved, must be zero */ /* Sub-structures for MADT */ -struct madt_processor_apic -{ - APIC_HEADER_DEF - u8 processor_id; /* ACPI processor id */ - u8 local_apic_id; /* Processor's local APIC id */ - LOCAL_APIC_FLAGS +struct madt_processor_apic { + APIC_HEADER_DEF u8 processor_id; /* ACPI processor id */ + u8 local_apic_id; /* Processor's local APIC id */ + LOCAL_APIC_FLAGS}; + +struct madt_io_apic { + APIC_HEADER_DEF u8 io_apic_id; /* I/O APIC ID */ + u8 reserved; /* Reserved - must be zero */ + u32 address; /* APIC physical address */ + u32 interrupt; /* Global system interrupt where INTI + * lines start */ }; -struct madt_io_apic -{ - APIC_HEADER_DEF - u8 io_apic_id; /* I/O APIC ID */ - u8 reserved; /* Reserved - must be zero */ - u32 address; /* APIC physical address */ - u32 interrupt; /* Global system interrupt where INTI - * lines start */ -}; - -struct madt_interrupt_override -{ - APIC_HEADER_DEF - u8 bus; /* 0 - ISA */ - u8 source; /* Interrupt source (IRQ) */ - u32 interrupt; /* Global system interrupt */ - MPS_INTI_FLAGS -}; +struct madt_interrupt_override { + APIC_HEADER_DEF u8 bus; /* 0 - ISA */ + u8 source; /* Interrupt source (IRQ) */ + u32 interrupt; /* Global system interrupt */ + MPS_INTI_FLAGS}; -struct madt_nmi_source -{ - APIC_HEADER_DEF - MPS_INTI_FLAGS - u32 interrupt; /* Global system interrupt */ +struct madt_nmi_source { + APIC_HEADER_DEF MPS_INTI_FLAGS u32 interrupt; /* Global system interrupt */ }; -struct madt_local_apic_nmi -{ - APIC_HEADER_DEF - u8 processor_id; /* ACPI processor id */ - MPS_INTI_FLAGS - u8 lint; /* LINTn to which NMI is connected */ +struct madt_local_apic_nmi { + APIC_HEADER_DEF u8 processor_id; /* ACPI processor id */ + MPS_INTI_FLAGS u8 lint; /* LINTn to which NMI is connected */ }; -struct madt_address_override -{ - APIC_HEADER_DEF - u16 reserved; /* Reserved, must be zero */ - u64 address; /* APIC physical address */ +struct madt_address_override { + APIC_HEADER_DEF u16 reserved; /* Reserved, must be zero */ + u64 address; /* APIC physical address */ }; -struct madt_io_sapic -{ - APIC_HEADER_DEF - u8 io_sapic_id; /* I/O SAPIC ID */ - u8 reserved; /* Reserved, must be zero */ - u32 interrupt_base; /* Glocal interrupt for SAPIC start */ - u64 address; /* SAPIC physical address */ +struct madt_io_sapic { + APIC_HEADER_DEF u8 io_sapic_id; /* I/O SAPIC ID */ + u8 reserved; /* Reserved, must be zero */ + u32 interrupt_base; /* Glocal interrupt for SAPIC start */ + u64 address; /* SAPIC physical address */ }; -struct madt_local_sapic -{ - APIC_HEADER_DEF - u8 processor_id; /* ACPI processor id */ - u8 local_sapic_id; /* SAPIC ID */ - u8 local_sapic_eid; /* SAPIC EID */ - u8 reserved[3]; /* Reserved, must be zero */ - LOCAL_APIC_FLAGS - u32 processor_uID; /* Numeric UID - ACPI 3.0 */ - char processor_uIDstring[1]; /* String UID - ACPI 3.0 */ +struct madt_local_sapic { + APIC_HEADER_DEF u8 processor_id; /* ACPI processor id */ + u8 local_sapic_id; /* SAPIC ID */ + u8 local_sapic_eid; /* SAPIC EID */ + u8 reserved[3]; /* Reserved, must be zero */ + LOCAL_APIC_FLAGS u32 processor_uID; /* Numeric UID - ACPI 3.0 */ + char processor_uIDstring[1]; /* String UID - ACPI 3.0 */ }; -struct madt_interrupt_source -{ - APIC_HEADER_DEF - MPS_INTI_FLAGS - u8 interrupt_type; /* 1=PMI, 2=INIT, 3=corrected */ - u8 processor_id; /* Processor ID */ - u8 processor_eid; /* Processor EID */ - u8 io_sapic_vector; /* Vector value for PMI interrupts */ - u32 interrupt; /* Global system interrupt */ - u32 flags; /* Interrupt Source Flags */ +struct madt_interrupt_source { + APIC_HEADER_DEF MPS_INTI_FLAGS u8 interrupt_type; /* 1=PMI, 2=INIT, 3=corrected */ + u8 processor_id; /* Processor ID */ + u8 processor_eid; /* Processor EID */ + u8 io_sapic_vector; /* Vector value for PMI interrupts */ + u32 interrupt; /* Global system interrupt */ + u32 flags; /* Interrupt Source Flags */ }; - /* * Smart Battery */ -struct smart_battery_table -{ - ACPI_TABLE_HEADER_DEF - u32 warning_level; - u32 low_level; - u32 critical_level; +struct smart_battery_table { + ACPI_TABLE_HEADER_DEF u32 warning_level; + u32 low_level; + u32 critical_level; }; - #pragma pack() - /* * ACPI Table information. We save the table address, length, * and type of memory allocation (mapped or allocated) for each @@ -320,39 +276,35 @@ struct smart_battery_table /* Data about each known table type */ -struct acpi_table_support -{ - char *name; - char *signature; - void **global_ptr; - u8 sig_length; - u8 flags; +struct acpi_table_support { + char *name; + char *signature; + void **global_ptr; + u8 sig_length; + u8 flags; }; - /* * Get the ACPI version-specific tables */ -#include "actbl1.h" /* Acpi 1.0 table definitions */ -#include "actbl2.h" /* Acpi 2.0 table definitions */ +#include "actbl1.h" /* Acpi 1.0 table definitions */ +#include "actbl2.h" /* Acpi 2.0 table definitions */ -extern u8 acpi_fadt_is_v1; /* is set to 1 if FADT is revision 1, - * needed for certain workarounds */ +extern u8 acpi_fadt_is_v1; /* is set to 1 if FADT is revision 1, + * needed for certain workarounds */ #pragma pack(1) /* * High performance timer */ -struct hpet_table -{ - ACPI_TABLE_HEADER_DEF - u32 hardware_id; - struct acpi_generic_address base_address; - u8 hpet_number; - u16 clock_tick; - u8 attributes; +struct hpet_table { + ACPI_TABLE_HEADER_DEF u32 hardware_id; + struct acpi_generic_address base_address; + u8 hpet_number; + u16 clock_tick; + u8 attributes; }; #pragma pack() -#endif /* __ACTBL_H__ */ +#endif /* __ACTBL_H__ */ diff --git a/include/acpi/actbl1.h b/include/acpi/actbl1.h index 93c175a4f44..67312c3a915 100644 --- a/include/acpi/actbl1.h +++ b/include/acpi/actbl1.h @@ -49,94 +49,87 @@ /* * ACPI 1.0 Root System Description Table (RSDT) */ -struct rsdt_descriptor_rev1 -{ - ACPI_TABLE_HEADER_DEF /* ACPI common table header */ - u32 table_offset_entry[1]; /* Array of pointers to ACPI tables */ +struct rsdt_descriptor_rev1 { + ACPI_TABLE_HEADER_DEF /* ACPI common table header */ + u32 table_offset_entry[1]; /* Array of pointers to ACPI tables */ }; - /* * ACPI 1.0 Firmware ACPI Control Structure (FACS) */ -struct facs_descriptor_rev1 -{ - char signature[4]; /* ASCII table signature */ - u32 length; /* Length of structure in bytes */ - u32 hardware_signature; /* Hardware configuration signature */ - u32 firmware_waking_vector; /* ACPI OS waking vector */ - u32 global_lock; /* Global Lock */ +struct facs_descriptor_rev1 { + char signature[4]; /* ASCII table signature */ + u32 length; /* Length of structure in bytes */ + u32 hardware_signature; /* Hardware configuration signature */ + u32 firmware_waking_vector; /* ACPI OS waking vector */ + u32 global_lock; /* Global Lock */ /* Flags (32 bits) */ - u8 S4bios_f : 1; /* 00: S4BIOS support is present */ - u8 : 7; /* 01-07: Reserved, must be zero */ - u8 reserved1[3]; /* 08-31: Reserved, must be zero */ + u8 S4bios_f:1; /* 00: S4BIOS support is present */ + u8:7; /* 01-07: Reserved, must be zero */ + u8 reserved1[3]; /* 08-31: Reserved, must be zero */ - u8 reserved2[40]; /* Reserved, must be zero */ + u8 reserved2[40]; /* Reserved, must be zero */ }; - /* * ACPI 1.0 Fixed ACPI Description Table (FADT) */ -struct fadt_descriptor_rev1 -{ - ACPI_TABLE_HEADER_DEF /* ACPI common table header */ - u32 firmware_ctrl; /* Physical address of FACS */ - u32 dsdt; /* Physical address of DSDT */ - u8 model; /* System Interrupt Model */ - u8 reserved1; /* Reserved, must be zero */ - u16 sci_int; /* System vector of SCI interrupt */ - u32 smi_cmd; /* Port address of SMI command port */ - u8 acpi_enable; /* Value to write to smi_cmd to enable ACPI */ - u8 acpi_disable; /* Value to write to smi_cmd to disable ACPI */ - u8 S4bios_req; /* Value to write to SMI CMD to enter S4BIOS state */ - u8 reserved2; /* Reserved, must be zero */ - u32 pm1a_evt_blk; /* Port address of Power Mgt 1a acpi_event Reg Blk */ - u32 pm1b_evt_blk; /* Port address of Power Mgt 1b acpi_event Reg Blk */ - u32 pm1a_cnt_blk; /* Port address of Power Mgt 1a Control Reg Blk */ - u32 pm1b_cnt_blk; /* Port address of Power Mgt 1b Control Reg Blk */ - u32 pm2_cnt_blk; /* Port address of Power Mgt 2 Control Reg Blk */ - u32 pm_tmr_blk; /* Port address of Power Mgt Timer Ctrl Reg Blk */ - u32 gpe0_blk; /* Port addr of General Purpose acpi_event 0 Reg Blk */ - u32 gpe1_blk; /* Port addr of General Purpose acpi_event 1 Reg Blk */ - u8 pm1_evt_len; /* Byte length of ports at pm1_x_evt_blk */ - u8 pm1_cnt_len; /* Byte length of ports at pm1_x_cnt_blk */ - u8 pm2_cnt_len; /* Byte Length of ports at pm2_cnt_blk */ - u8 pm_tm_len; /* Byte Length of ports at pm_tm_blk */ - u8 gpe0_blk_len; /* Byte Length of ports at gpe0_blk */ - u8 gpe1_blk_len; /* Byte Length of ports at gpe1_blk */ - u8 gpe1_base; /* Offset in gpe model where gpe1 events start */ - u8 reserved3; /* Reserved, must be zero */ - u16 plvl2_lat; /* Worst case HW latency to enter/exit C2 state */ - u16 plvl3_lat; /* Worst case HW latency to enter/exit C3 state */ - u16 flush_size; /* Size of area read to flush caches */ - u16 flush_stride; /* Stride used in flushing caches */ - u8 duty_offset; /* Bit location of duty cycle field in p_cnt reg */ - u8 duty_width; /* Bit width of duty cycle field in p_cnt reg */ - u8 day_alrm; /* Index to day-of-month alarm in RTC CMOS RAM */ - u8 mon_alrm; /* Index to month-of-year alarm in RTC CMOS RAM */ - u8 century; /* Index to century in RTC CMOS RAM */ - u8 reserved4[3]; /* Reserved, must be zero */ +struct fadt_descriptor_rev1 { + ACPI_TABLE_HEADER_DEF /* ACPI common table header */ + u32 firmware_ctrl; /* Physical address of FACS */ + u32 dsdt; /* Physical address of DSDT */ + u8 model; /* System Interrupt Model */ + u8 reserved1; /* Reserved, must be zero */ + u16 sci_int; /* System vector of SCI interrupt */ + u32 smi_cmd; /* Port address of SMI command port */ + u8 acpi_enable; /* Value to write to smi_cmd to enable ACPI */ + u8 acpi_disable; /* Value to write to smi_cmd to disable ACPI */ + u8 S4bios_req; /* Value to write to SMI CMD to enter S4BIOS state */ + u8 reserved2; /* Reserved, must be zero */ + u32 pm1a_evt_blk; /* Port address of Power Mgt 1a acpi_event Reg Blk */ + u32 pm1b_evt_blk; /* Port address of Power Mgt 1b acpi_event Reg Blk */ + u32 pm1a_cnt_blk; /* Port address of Power Mgt 1a Control Reg Blk */ + u32 pm1b_cnt_blk; /* Port address of Power Mgt 1b Control Reg Blk */ + u32 pm2_cnt_blk; /* Port address of Power Mgt 2 Control Reg Blk */ + u32 pm_tmr_blk; /* Port address of Power Mgt Timer Ctrl Reg Blk */ + u32 gpe0_blk; /* Port addr of General Purpose acpi_event 0 Reg Blk */ + u32 gpe1_blk; /* Port addr of General Purpose acpi_event 1 Reg Blk */ + u8 pm1_evt_len; /* Byte length of ports at pm1_x_evt_blk */ + u8 pm1_cnt_len; /* Byte length of ports at pm1_x_cnt_blk */ + u8 pm2_cnt_len; /* Byte Length of ports at pm2_cnt_blk */ + u8 pm_tm_len; /* Byte Length of ports at pm_tm_blk */ + u8 gpe0_blk_len; /* Byte Length of ports at gpe0_blk */ + u8 gpe1_blk_len; /* Byte Length of ports at gpe1_blk */ + u8 gpe1_base; /* Offset in gpe model where gpe1 events start */ + u8 reserved3; /* Reserved, must be zero */ + u16 plvl2_lat; /* Worst case HW latency to enter/exit C2 state */ + u16 plvl3_lat; /* Worst case HW latency to enter/exit C3 state */ + u16 flush_size; /* Size of area read to flush caches */ + u16 flush_stride; /* Stride used in flushing caches */ + u8 duty_offset; /* Bit location of duty cycle field in p_cnt reg */ + u8 duty_width; /* Bit width of duty cycle field in p_cnt reg */ + u8 day_alrm; /* Index to day-of-month alarm in RTC CMOS RAM */ + u8 mon_alrm; /* Index to month-of-year alarm in RTC CMOS RAM */ + u8 century; /* Index to century in RTC CMOS RAM */ + u8 reserved4[3]; /* Reserved, must be zero */ /* Flags (32 bits) */ - u8 wb_invd : 1; /* 00: The wbinvd instruction works properly */ - u8 wb_invd_flush : 1; /* 01: The wbinvd flushes but does not invalidate */ - u8 proc_c1 : 1; /* 02: All processors support C1 state */ - u8 plvl2_up : 1; /* 03: C2 state works on MP system */ - u8 pwr_button : 1; /* 04: Power button is handled as a generic feature */ - u8 sleep_button : 1; /* 05: Sleep button is handled as a generic feature, or not present */ - u8 fixed_rTC : 1; /* 06: RTC wakeup stat not in fixed register space */ - u8 rtcs4 : 1; /* 07: RTC wakeup stat not possible from S4 */ - u8 tmr_val_ext : 1; /* 08: tmr_val width is 32 bits (0 = 24 bits) */ - u8 : 7; /* 09-15: Reserved, must be zero */ - u8 reserved5[2]; /* 16-31: Reserved, must be zero */ + u8 wb_invd:1; /* 00: The wbinvd instruction works properly */ + u8 wb_invd_flush:1; /* 01: The wbinvd flushes but does not invalidate */ + u8 proc_c1:1; /* 02: All processors support C1 state */ + u8 plvl2_up:1; /* 03: C2 state works on MP system */ + u8 pwr_button:1; /* 04: Power button is handled as a generic feature */ + u8 sleep_button:1; /* 05: Sleep button is handled as a generic feature, or not present */ + u8 fixed_rTC:1; /* 06: RTC wakeup stat not in fixed register space */ + u8 rtcs4:1; /* 07: RTC wakeup stat not possible from S4 */ + u8 tmr_val_ext:1; /* 08: tmr_val width is 32 bits (0 = 24 bits) */ + u8:7; /* 09-15: Reserved, must be zero */ + u8 reserved5[2]; /* 16-31: Reserved, must be zero */ }; #pragma pack() -#endif /* __ACTBL1_H__ */ - - +#endif /* __ACTBL1_H__ */ diff --git a/include/acpi/actbl2.h b/include/acpi/actbl2.h index 84ce5abbd6f..50305ce2681 100644 --- a/include/acpi/actbl2.h +++ b/include/acpi/actbl2.h @@ -64,65 +64,56 @@ #define FADT2_REVISION_ID 3 #define FADT2_MINUS_REVISION_ID 2 - #pragma pack(1) /* * ACPI 2.0 Root System Description Table (RSDT) */ -struct rsdt_descriptor_rev2 -{ - ACPI_TABLE_HEADER_DEF /* ACPI common table header */ - u32 table_offset_entry[1]; /* Array of pointers to ACPI tables */ +struct rsdt_descriptor_rev2 { + ACPI_TABLE_HEADER_DEF /* ACPI common table header */ + u32 table_offset_entry[1]; /* Array of pointers to ACPI tables */ }; - /* * ACPI 2.0 Extended System Description Table (XSDT) */ -struct xsdt_descriptor_rev2 -{ - ACPI_TABLE_HEADER_DEF /* ACPI common table header */ - u64 table_offset_entry[1]; /* Array of pointers to ACPI tables */ +struct xsdt_descriptor_rev2 { + ACPI_TABLE_HEADER_DEF /* ACPI common table header */ + u64 table_offset_entry[1]; /* Array of pointers to ACPI tables */ }; - /* * ACPI 2.0 Firmware ACPI Control Structure (FACS) */ -struct facs_descriptor_rev2 -{ - char signature[4]; /* ASCII table signature */ - u32 length; /* Length of structure, in bytes */ - u32 hardware_signature; /* Hardware configuration signature */ - u32 firmware_waking_vector; /* 32-bit physical address of the Firmware Waking Vector. */ - u32 global_lock; /* Global Lock used to synchronize access to shared hardware resources */ +struct facs_descriptor_rev2 { + char signature[4]; /* ASCII table signature */ + u32 length; /* Length of structure, in bytes */ + u32 hardware_signature; /* Hardware configuration signature */ + u32 firmware_waking_vector; /* 32-bit physical address of the Firmware Waking Vector. */ + u32 global_lock; /* Global Lock used to synchronize access to shared hardware resources */ /* Flags (32 bits) */ - u8 S4bios_f : 1; /* 00: S4BIOS support is present */ - u8 : 7; /* 01-07: Reserved, must be zero */ - u8 reserved1[3]; /* 08-31: Reserved, must be zero */ + u8 S4bios_f:1; /* 00: S4BIOS support is present */ + u8:7; /* 01-07: Reserved, must be zero */ + u8 reserved1[3]; /* 08-31: Reserved, must be zero */ - u64 xfirmware_waking_vector; /* 64-bit physical address of the Firmware Waking Vector. */ - u8 version; /* Version of this table */ - u8 reserved3[31]; /* Reserved, must be zero */ + u64 xfirmware_waking_vector; /* 64-bit physical address of the Firmware Waking Vector. */ + u8 version; /* Version of this table */ + u8 reserved3[31]; /* Reserved, must be zero */ }; - /* * ACPI 2.0+ Generic Address Structure (GAS) */ -struct acpi_generic_address -{ - u8 address_space_id; /* Address space where struct or register exists. */ - u8 register_bit_width; /* Size in bits of given register */ - u8 register_bit_offset; /* Bit offset within the register */ - u8 access_width; /* Minimum Access size (ACPI 3.0) */ - u64 address; /* 64-bit address of struct or register */ +struct acpi_generic_address { + u8 address_space_id; /* Address space where struct or register exists. */ + u8 register_bit_width; /* Size in bits of given register */ + u8 register_bit_offset; /* Bit offset within the register */ + u8 access_width; /* Minimum Access size (ACPI 3.0) */ + u64 address; /* 64-bit address of struct or register */ }; - #define FADT_REV2_COMMON \ u32 V1_firmware_ctrl; /* 32-bit physical address of FACS */ \ u32 V1_dsdt; /* 32-bit physical address of DSDT */ \ @@ -164,141 +155,123 @@ struct acpi_generic_address /* * ACPI 2.0+ Fixed ACPI Description Table (FADT) */ -struct fadt_descriptor_rev2 -{ - ACPI_TABLE_HEADER_DEF /* ACPI common table header */ - FADT_REV2_COMMON - u8 reserved2; /* Reserved, must be zero */ +struct fadt_descriptor_rev2 { + ACPI_TABLE_HEADER_DEF /* ACPI common table header */ + FADT_REV2_COMMON u8 reserved2; /* Reserved, must be zero */ /* Flags (32 bits) */ - u8 wb_invd : 1; /* 00: The wbinvd instruction works properly */ - u8 wb_invd_flush : 1; /* 01: The wbinvd flushes but does not invalidate */ - u8 proc_c1 : 1; /* 02: All processors support C1 state */ - u8 plvl2_up : 1; /* 03: C2 state works on MP system */ - u8 pwr_button : 1; /* 04: Power button is handled as a generic feature */ - u8 sleep_button : 1; /* 05: Sleep button is handled as a generic feature, or not present */ - u8 fixed_rTC : 1; /* 06: RTC wakeup stat not in fixed register space */ - u8 rtcs4 : 1; /* 07: RTC wakeup stat not possible from S4 */ - u8 tmr_val_ext : 1; /* 08: tmr_val is 32 bits 0=24-bits */ - u8 dock_cap : 1; /* 09: Docking supported */ - u8 reset_reg_sup : 1; /* 10: System reset via the FADT RESET_REG supported */ - u8 sealed_case : 1; /* 11: No internal expansion capabilities and case is sealed */ - u8 headless : 1; /* 12: No local video capabilities or local input devices */ - u8 cpu_sw_sleep : 1; /* 13: Must execute native instruction after writing SLP_TYPx register */ - - u8 pci_exp_wak : 1; /* 14: System supports PCIEXP_WAKE (STS/EN) bits (ACPI 3.0) */ - u8 use_platform_clock : 1; /* 15: OSPM should use platform-provided timer (ACPI 3.0) */ - u8 S4rtc_sts_valid : 1; /* 16: Contents of RTC_STS valid after S4 wake (ACPI 3.0) */ - u8 remote_power_on_capable : 1; /* 17: System is compatible with remote power on (ACPI 3.0) */ - u8 force_apic_cluster_model : 1; /* 18: All local APICs must use cluster model (ACPI 3.0) */ - u8 force_apic_physical_destination_mode : 1; /* 19: all local x_aPICs must use physical dest mode (ACPI 3.0) */ - u8 : 4; /* 20-23: Reserved, must be zero */ - u8 reserved3; /* 24-31: Reserved, must be zero */ - - struct acpi_generic_address reset_register; /* Reset register address in GAS format */ - u8 reset_value; /* Value to write to the reset_register port to reset the system */ - u8 reserved4[3]; /* These three bytes must be zero */ - u64 xfirmware_ctrl; /* 64-bit physical address of FACS */ - u64 Xdsdt; /* 64-bit physical address of DSDT */ - struct acpi_generic_address xpm1a_evt_blk; /* Extended Power Mgt 1a acpi_event Reg Blk address */ - struct acpi_generic_address xpm1b_evt_blk; /* Extended Power Mgt 1b acpi_event Reg Blk address */ - struct acpi_generic_address xpm1a_cnt_blk; /* Extended Power Mgt 1a Control Reg Blk address */ - struct acpi_generic_address xpm1b_cnt_blk; /* Extended Power Mgt 1b Control Reg Blk address */ - struct acpi_generic_address xpm2_cnt_blk; /* Extended Power Mgt 2 Control Reg Blk address */ - struct acpi_generic_address xpm_tmr_blk; /* Extended Power Mgt Timer Ctrl Reg Blk address */ - struct acpi_generic_address xgpe0_blk; /* Extended General Purpose acpi_event 0 Reg Blk address */ - struct acpi_generic_address xgpe1_blk; /* Extended General Purpose acpi_event 1 Reg Blk address */ + u8 wb_invd:1; /* 00: The wbinvd instruction works properly */ + u8 wb_invd_flush:1; /* 01: The wbinvd flushes but does not invalidate */ + u8 proc_c1:1; /* 02: All processors support C1 state */ + u8 plvl2_up:1; /* 03: C2 state works on MP system */ + u8 pwr_button:1; /* 04: Power button is handled as a generic feature */ + u8 sleep_button:1; /* 05: Sleep button is handled as a generic feature, or not present */ + u8 fixed_rTC:1; /* 06: RTC wakeup stat not in fixed register space */ + u8 rtcs4:1; /* 07: RTC wakeup stat not possible from S4 */ + u8 tmr_val_ext:1; /* 08: tmr_val is 32 bits 0=24-bits */ + u8 dock_cap:1; /* 09: Docking supported */ + u8 reset_reg_sup:1; /* 10: System reset via the FADT RESET_REG supported */ + u8 sealed_case:1; /* 11: No internal expansion capabilities and case is sealed */ + u8 headless:1; /* 12: No local video capabilities or local input devices */ + u8 cpu_sw_sleep:1; /* 13: Must execute native instruction after writing SLP_TYPx register */ + + u8 pci_exp_wak:1; /* 14: System supports PCIEXP_WAKE (STS/EN) bits (ACPI 3.0) */ + u8 use_platform_clock:1; /* 15: OSPM should use platform-provided timer (ACPI 3.0) */ + u8 S4rtc_sts_valid:1; /* 16: Contents of RTC_STS valid after S4 wake (ACPI 3.0) */ + u8 remote_power_on_capable:1; /* 17: System is compatible with remote power on (ACPI 3.0) */ + u8 force_apic_cluster_model:1; /* 18: All local APICs must use cluster model (ACPI 3.0) */ + u8 force_apic_physical_destination_mode:1; /* 19: all local x_aPICs must use physical dest mode (ACPI 3.0) */ + u8:4; /* 20-23: Reserved, must be zero */ + u8 reserved3; /* 24-31: Reserved, must be zero */ + + struct acpi_generic_address reset_register; /* Reset register address in GAS format */ + u8 reset_value; /* Value to write to the reset_register port to reset the system */ + u8 reserved4[3]; /* These three bytes must be zero */ + u64 xfirmware_ctrl; /* 64-bit physical address of FACS */ + u64 Xdsdt; /* 64-bit physical address of DSDT */ + struct acpi_generic_address xpm1a_evt_blk; /* Extended Power Mgt 1a acpi_event Reg Blk address */ + struct acpi_generic_address xpm1b_evt_blk; /* Extended Power Mgt 1b acpi_event Reg Blk address */ + struct acpi_generic_address xpm1a_cnt_blk; /* Extended Power Mgt 1a Control Reg Blk address */ + struct acpi_generic_address xpm1b_cnt_blk; /* Extended Power Mgt 1b Control Reg Blk address */ + struct acpi_generic_address xpm2_cnt_blk; /* Extended Power Mgt 2 Control Reg Blk address */ + struct acpi_generic_address xpm_tmr_blk; /* Extended Power Mgt Timer Ctrl Reg Blk address */ + struct acpi_generic_address xgpe0_blk; /* Extended General Purpose acpi_event 0 Reg Blk address */ + struct acpi_generic_address xgpe1_blk; /* Extended General Purpose acpi_event 1 Reg Blk address */ }; - /* "Down-revved" ACPI 2.0 FADT descriptor */ -struct fadt_descriptor_rev2_minus -{ - ACPI_TABLE_HEADER_DEF /* ACPI common table header */ - FADT_REV2_COMMON - u8 reserved2; /* Reserved, must be zero */ - u32 flags; - struct acpi_generic_address reset_register; /* Reset register address in GAS format */ - u8 reset_value; /* Value to write to the reset_register port to reset the system. */ - u8 reserved7[3]; /* Reserved, must be zero */ +struct fadt_descriptor_rev2_minus { + ACPI_TABLE_HEADER_DEF /* ACPI common table header */ + FADT_REV2_COMMON u8 reserved2; /* Reserved, must be zero */ + u32 flags; + struct acpi_generic_address reset_register; /* Reset register address in GAS format */ + u8 reset_value; /* Value to write to the reset_register port to reset the system. */ + u8 reserved7[3]; /* Reserved, must be zero */ }; - /* ECDT - Embedded Controller Boot Resources Table */ -struct ec_boot_resources -{ - ACPI_TABLE_HEADER_DEF - struct acpi_generic_address ec_control; /* Address of EC command/status register */ - struct acpi_generic_address ec_data; /* Address of EC data register */ - u32 uid; /* Unique ID - must be same as the EC _UID method */ - u8 gpe_bit; /* The GPE for the EC */ - u8 ec_id[1]; /* Full namepath of the EC in the ACPI namespace */ +struct ec_boot_resources { + ACPI_TABLE_HEADER_DEF struct acpi_generic_address ec_control; /* Address of EC command/status register */ + struct acpi_generic_address ec_data; /* Address of EC data register */ + u32 uid; /* Unique ID - must be same as the EC _UID method */ + u8 gpe_bit; /* The GPE for the EC */ + u8 ec_id[1]; /* Full namepath of the EC in the ACPI namespace */ }; - /* SRAT - System Resource Affinity Table */ -struct static_resource_alloc -{ - u8 type; - u8 length; - u8 proximity_domain_lo; - u8 apic_id; +struct static_resource_alloc { + u8 type; + u8 length; + u8 proximity_domain_lo; + u8 apic_id; /* Flags (32 bits) */ - u8 enabled :1; /* 00: Use affinity structure */ - u8 :7; /* 01-07: Reserved, must be zero */ - u8 reserved3[3]; /* 08-31: Reserved, must be zero */ + u8 enabled:1; /* 00: Use affinity structure */ + u8:7; /* 01-07: Reserved, must be zero */ + u8 reserved3[3]; /* 08-31: Reserved, must be zero */ - u8 local_sapic_eid; - u8 proximity_domain_hi[3]; - u32 reserved4; /* Reserved, must be zero */ + u8 local_sapic_eid; + u8 proximity_domain_hi[3]; + u32 reserved4; /* Reserved, must be zero */ }; -struct memory_affinity -{ - u8 type; - u8 length; - u32 proximity_domain; - u16 reserved3; - u64 base_address; - u64 address_length; - u32 reserved4; +struct memory_affinity { + u8 type; + u8 length; + u32 proximity_domain; + u16 reserved3; + u64 base_address; + u64 address_length; + u32 reserved4; /* Flags (32 bits) */ - u8 enabled :1; /* 00: Use affinity structure */ - u8 hot_pluggable :1; /* 01: Memory region is hot pluggable */ - u8 non_volatile :1; /* 02: Memory is non-volatile */ - u8 :5; /* 03-07: Reserved, must be zero */ - u8 reserved5[3]; /* 08-31: Reserved, must be zero */ + u8 enabled:1; /* 00: Use affinity structure */ + u8 hot_pluggable:1; /* 01: Memory region is hot pluggable */ + u8 non_volatile:1; /* 02: Memory is non-volatile */ + u8:5; /* 03-07: Reserved, must be zero */ + u8 reserved5[3]; /* 08-31: Reserved, must be zero */ - u64 reserved6; /* Reserved, must be zero */ + u64 reserved6; /* Reserved, must be zero */ }; -struct system_resource_affinity -{ - ACPI_TABLE_HEADER_DEF - u32 reserved1; /* Must be value '1' */ - u64 reserved2; /* Reserved, must be zero */ +struct system_resource_affinity { + ACPI_TABLE_HEADER_DEF u32 reserved1; /* Must be value '1' */ + u64 reserved2; /* Reserved, must be zero */ }; - /* SLIT - System Locality Distance Information Table */ -struct system_locality_info -{ - ACPI_TABLE_HEADER_DEF - u64 locality_count; - u8 entry[1][1]; +struct system_locality_info { + ACPI_TABLE_HEADER_DEF u64 locality_count; + u8 entry[1][1]; }; - #pragma pack() -#endif /* __ACTBL2_H__ */ - +#endif /* __ACTBL2_H__ */ diff --git a/include/acpi/actbl71.h b/include/acpi/actbl71.h index 7b4fb44261f..10ac05bb36b 100644 --- a/include/acpi/actbl71.h +++ b/include/acpi/actbl71.h @@ -27,7 +27,6 @@ #ifndef __ACTBL71_H__ #define __ACTBL71_H__ - /* 0.71 FADT address_space data item bitmasks defines */ /* If the associated bit is zero then it is in memory space else in io space */ @@ -40,105 +39,96 @@ /* Only for clarity in declarations */ -typedef u64 IO_ADDRESS; - +typedef u64 IO_ADDRESS; #pragma pack(1) -struct /* Root System Descriptor Pointer */ -{ - NATIVE_CHAR signature [8]; /* contains "RSD PTR " */ - u8 checksum; /* to make sum of struct == 0 */ - NATIVE_CHAR oem_id [6]; /* OEM identification */ - u8 reserved; /* Must be 0 for 1.0, 2 for 2.0 */ - u64 rsdt_physical_address; /* 64-bit physical address of RSDT */ +struct { /* Root System Descriptor Pointer */ + NATIVE_CHAR signature[8]; /* contains "RSD PTR " */ + u8 checksum; /* to make sum of struct == 0 */ + NATIVE_CHAR oem_id[6]; /* OEM identification */ + u8 reserved; /* Must be 0 for 1.0, 2 for 2.0 */ + u64 rsdt_physical_address; /* 64-bit physical address of RSDT */ }; - /*****************************************/ /* IA64 Extensions to ACPI Spec Rev 0.71 */ /* for the Root System Description Table */ /*****************************************/ -struct -{ - struct acpi_table_header header; /* Table header */ - u32 reserved_pad; /* IA64 alignment, must be 0 */ - u64 table_offset_entry [1]; /* Array of pointers to other */ - /* tables' headers */ +struct { + struct acpi_table_header header; /* Table header */ + u32 reserved_pad; /* IA64 alignment, must be 0 */ + u64 table_offset_entry[1]; /* Array of pointers to other */ + /* tables' headers */ }; - /*******************************************/ /* IA64 Extensions to ACPI Spec Rev 0.71 */ /* for the Firmware ACPI Control Structure */ /*******************************************/ -struct -{ - NATIVE_CHAR signature[4]; /* signature "FACS" */ - u32 length; /* length of structure, in bytes */ - u32 hardware_signature; /* hardware configuration signature */ - u32 reserved4; /* must be 0 */ - u64 firmware_waking_vector; /* ACPI OS waking vector */ - u64 global_lock; /* Global Lock */ - u32 S4bios_f : 1; /* Indicates if S4BIOS support is present */ - u32 reserved1 : 31; /* must be 0 */ - u8 reserved3 [28]; /* reserved - must be zero */ +struct { + NATIVE_CHAR signature[4]; /* signature "FACS" */ + u32 length; /* length of structure, in bytes */ + u32 hardware_signature; /* hardware configuration signature */ + u32 reserved4; /* must be 0 */ + u64 firmware_waking_vector; /* ACPI OS waking vector */ + u64 global_lock; /* Global Lock */ + u32 S4bios_f:1; /* Indicates if S4BIOS support is present */ + u32 reserved1:31; /* must be 0 */ + u8 reserved3[28]; /* reserved - must be zero */ }; - /******************************************/ /* IA64 Extensions to ACPI Spec Rev 0.71 */ /* for the Fixed ACPI Description Table */ /******************************************/ -struct -{ - struct acpi_table_header header; /* table header */ - u32 reserved_pad; /* IA64 alignment, must be 0 */ - u64 firmware_ctrl; /* 64-bit Physical address of FACS */ - u64 dsdt; /* 64-bit Physical address of DSDT */ - u8 model; /* System Interrupt Model */ - u8 address_space; /* Address Space Bitmask */ - u16 sci_int; /* System vector of SCI interrupt */ - u8 acpi_enable; /* value to write to smi_cmd to enable ACPI */ - u8 acpi_disable; /* value to write to smi_cmd to disable ACPI */ - u8 S4bios_req; /* Value to write to SMI CMD to enter S4BIOS state */ - u8 reserved2; /* reserved - must be zero */ - u64 smi_cmd; /* Port address of SMI command port */ - u64 pm1a_evt_blk; /* Port address of Power Mgt 1a acpi_event Reg Blk */ - u64 pm1b_evt_blk; /* Port address of Power Mgt 1b acpi_event Reg Blk */ - u64 pm1a_cnt_blk; /* Port address of Power Mgt 1a Control Reg Blk */ - u64 pm1b_cnt_blk; /* Port address of Power Mgt 1b Control Reg Blk */ - u64 pm2_cnt_blk; /* Port address of Power Mgt 2 Control Reg Blk */ - u64 pm_tmr_blk; /* Port address of Power Mgt Timer Ctrl Reg Blk */ - u64 gpe0_blk; /* Port addr of General Purpose acpi_event 0 Reg Blk */ - u64 gpe1_blk; /* Port addr of General Purpose acpi_event 1 Reg Blk */ - u8 pm1_evt_len; /* Byte length of ports at pm1_x_evt_blk */ - u8 pm1_cnt_len; /* Byte length of ports at pm1_x_cnt_blk */ - u8 pm2_cnt_len; /* Byte Length of ports at pm2_cnt_blk */ - u8 pm_tm_len; /* Byte Length of ports at pm_tm_blk */ - u8 gpe0_blk_len; /* Byte Length of ports at gpe0_blk */ - u8 gpe1_blk_len; /* Byte Length of ports at gpe1_blk */ - u8 gpe1_base; /* offset in gpe model where gpe1 events start */ - u8 reserved3; /* reserved */ - u16 plvl2_lat; /* worst case HW latency to enter/exit C2 state */ - u16 plvl3_lat; /* worst case HW latency to enter/exit C3 state */ - u8 day_alrm; /* index to day-of-month alarm in RTC CMOS RAM */ - u8 mon_alrm; /* index to month-of-year alarm in RTC CMOS RAM */ - u8 century; /* index to century in RTC CMOS RAM */ - u8 reserved4; /* reserved */ - u32 flush_cash : 1; /* PAL_FLUSH_CACHE is correctly supported */ - u32 reserved5 : 1; /* reserved - must be zero */ - u32 proc_c1 : 1; /* all processors support C1 state */ - u32 plvl2_up : 1; /* C2 state works on MP system */ - u32 pwr_button : 1; /* Power button is handled as a generic feature */ - u32 sleep_button : 1; /* Sleep button is handled as a generic feature, or not present */ - u32 fixed_rTC : 1; /* RTC wakeup stat not in fixed register space */ - u32 rtcs4 : 1; /* RTC wakeup stat not possible from S4 */ - u32 tmr_val_ext : 1; /* tmr_val is 32 bits */ - u32 dock_cap : 1; /* Supports Docking */ - u32 reserved6 : 22; /* reserved - must be zero */ +struct { + struct acpi_table_header header; /* table header */ + u32 reserved_pad; /* IA64 alignment, must be 0 */ + u64 firmware_ctrl; /* 64-bit Physical address of FACS */ + u64 dsdt; /* 64-bit Physical address of DSDT */ + u8 model; /* System Interrupt Model */ + u8 address_space; /* Address Space Bitmask */ + u16 sci_int; /* System vector of SCI interrupt */ + u8 acpi_enable; /* value to write to smi_cmd to enable ACPI */ + u8 acpi_disable; /* value to write to smi_cmd to disable ACPI */ + u8 S4bios_req; /* Value to write to SMI CMD to enter S4BIOS state */ + u8 reserved2; /* reserved - must be zero */ + u64 smi_cmd; /* Port address of SMI command port */ + u64 pm1a_evt_blk; /* Port address of Power Mgt 1a acpi_event Reg Blk */ + u64 pm1b_evt_blk; /* Port address of Power Mgt 1b acpi_event Reg Blk */ + u64 pm1a_cnt_blk; /* Port address of Power Mgt 1a Control Reg Blk */ + u64 pm1b_cnt_blk; /* Port address of Power Mgt 1b Control Reg Blk */ + u64 pm2_cnt_blk; /* Port address of Power Mgt 2 Control Reg Blk */ + u64 pm_tmr_blk; /* Port address of Power Mgt Timer Ctrl Reg Blk */ + u64 gpe0_blk; /* Port addr of General Purpose acpi_event 0 Reg Blk */ + u64 gpe1_blk; /* Port addr of General Purpose acpi_event 1 Reg Blk */ + u8 pm1_evt_len; /* Byte length of ports at pm1_x_evt_blk */ + u8 pm1_cnt_len; /* Byte length of ports at pm1_x_cnt_blk */ + u8 pm2_cnt_len; /* Byte Length of ports at pm2_cnt_blk */ + u8 pm_tm_len; /* Byte Length of ports at pm_tm_blk */ + u8 gpe0_blk_len; /* Byte Length of ports at gpe0_blk */ + u8 gpe1_blk_len; /* Byte Length of ports at gpe1_blk */ + u8 gpe1_base; /* offset in gpe model where gpe1 events start */ + u8 reserved3; /* reserved */ + u16 plvl2_lat; /* worst case HW latency to enter/exit C2 state */ + u16 plvl3_lat; /* worst case HW latency to enter/exit C3 state */ + u8 day_alrm; /* index to day-of-month alarm in RTC CMOS RAM */ + u8 mon_alrm; /* index to month-of-year alarm in RTC CMOS RAM */ + u8 century; /* index to century in RTC CMOS RAM */ + u8 reserved4; /* reserved */ + u32 flush_cash:1; /* PAL_FLUSH_CACHE is correctly supported */ + u32 reserved5:1; /* reserved - must be zero */ + u32 proc_c1:1; /* all processors support C1 state */ + u32 plvl2_up:1; /* C2 state works on MP system */ + u32 pwr_button:1; /* Power button is handled as a generic feature */ + u32 sleep_button:1; /* Sleep button is handled as a generic feature, or not present */ + u32 fixed_rTC:1; /* RTC wakeup stat not in fixed register space */ + u32 rtcs4:1; /* RTC wakeup stat not possible from S4 */ + u32 tmr_val_ext:1; /* tmr_val is 32 bits */ + u32 dock_cap:1; /* Supports Docking */ + u32 reserved6:22; /* reserved - must be zero */ }; #pragma pack() -#endif /* __ACTBL71_H__ */ - +#endif /* __ACTBL71_H__ */ diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h index 1895b862ce0..254f4b06e7e 100644 --- a/include/acpi/actypes.h +++ b/include/acpi/actypes.h @@ -46,35 +46,31 @@ /*! [Begin] no source code translation (keep the typedefs) */ - - /* * Data type ranges * Note: These macros are designed to be compiler independent as well as * working around problems that some 32-bit compilers have with 64-bit * constants. */ -#define ACPI_UINT8_MAX (UINT8) (~((UINT8) 0)) /* 0xFF */ -#define ACPI_UINT16_MAX (UINT16)(~((UINT16) 0)) /* 0xFFFF */ -#define ACPI_UINT32_MAX (UINT32)(~((UINT32) 0)) /* 0xFFFFFFFF */ -#define ACPI_UINT64_MAX (UINT64)(~((UINT64) 0)) /* 0xFFFFFFFFFFFFFFFF */ +#define ACPI_UINT8_MAX (UINT8) (~((UINT8) 0)) /* 0xFF */ +#define ACPI_UINT16_MAX (UINT16)(~((UINT16) 0)) /* 0xFFFF */ +#define ACPI_UINT32_MAX (UINT32)(~((UINT32) 0)) /* 0xFFFFFFFF */ +#define ACPI_UINT64_MAX (UINT64)(~((UINT64) 0)) /* 0xFFFFFFFFFFFFFFFF */ #define ACPI_ASCII_MAX 0x7F - #ifdef DEFINE_ALTERNATE_TYPES /* * Types used only in translated source, defined here to enable * cross-platform compilation only. */ -typedef int s32; -typedef unsigned char u8; -typedef unsigned short u16; -typedef unsigned int u32; -typedef COMPILER_DEPENDENT_UINT64 u64; +typedef int s32; +typedef unsigned char u8; +typedef unsigned short u16; +typedef unsigned int u32; +typedef COMPILER_DEPENDENT_UINT64 u64; #endif - /* * Data types - Fixed across all compilation models (16/32/64) * @@ -102,30 +98,29 @@ typedef COMPILER_DEPENDENT_UINT64 u64; /* * 64-bit type definitions */ -typedef unsigned char UINT8; -typedef unsigned char BOOLEAN; -typedef unsigned short UINT16; -typedef int INT32; -typedef unsigned int UINT32; -typedef COMPILER_DEPENDENT_INT64 INT64; -typedef COMPILER_DEPENDENT_UINT64 UINT64; +typedef unsigned char UINT8; +typedef unsigned char BOOLEAN; +typedef unsigned short UINT16; +typedef int INT32; +typedef unsigned int UINT32; +typedef COMPILER_DEPENDENT_INT64 INT64; +typedef COMPILER_DEPENDENT_UINT64 UINT64; /*! [End] no source code translation !*/ -typedef s64 acpi_native_int; -typedef u64 acpi_native_uint; +typedef s64 acpi_native_int; +typedef u64 acpi_native_uint; -typedef u64 acpi_table_ptr; -typedef u64 acpi_io_address; -typedef u64 acpi_physical_address; -typedef u64 acpi_size; +typedef u64 acpi_table_ptr; +typedef u64 acpi_io_address; +typedef u64 acpi_physical_address; +typedef u64 acpi_size; -#define ALIGNED_ADDRESS_BOUNDARY 0x00000008 /* No hardware alignment support in IA64 */ -#define ACPI_USE_NATIVE_DIVIDE /* Native 64-bit integer support */ +#define ALIGNED_ADDRESS_BOUNDARY 0x00000008 /* No hardware alignment support in IA64 */ +#define ACPI_USE_NATIVE_DIVIDE /* Native 64-bit integer support */ #define ACPI_MAX_PTR ACPI_UINT64_MAX #define ACPI_SIZE_MAX ACPI_UINT64_MAX - #elif ACPI_MACHINE_WIDTH == 16 /*! [Begin] no source code translation (keep the typedefs) */ @@ -133,32 +128,31 @@ typedef u64 acpi_size; /* * 16-bit type definitions */ -typedef unsigned char UINT8; -typedef unsigned char BOOLEAN; -typedef unsigned int UINT16; -typedef long INT32; -typedef int INT16; -typedef unsigned long UINT32; - -struct -{ - UINT32 Lo; - UINT32 Hi; +typedef unsigned char UINT8; +typedef unsigned char BOOLEAN; +typedef unsigned int UINT16; +typedef long INT32; +typedef int INT16; +typedef unsigned long UINT32; + +struct { + UINT32 Lo; + UINT32 Hi; }; /*! [End] no source code translation !*/ -typedef u16 acpi_native_uint; -typedef s16 acpi_native_int; +typedef u16 acpi_native_uint; +typedef s16 acpi_native_int; -typedef u32 acpi_table_ptr; -typedef u32 acpi_io_address; -typedef char *acpi_physical_address; -typedef u16 acpi_size; +typedef u32 acpi_table_ptr; +typedef u32 acpi_io_address; +typedef char *acpi_physical_address; +typedef u16 acpi_size; #define ALIGNED_ADDRESS_BOUNDARY 0x00000002 #define ACPI_MISALIGNED_TRANSFERS -#define ACPI_USE_NATIVE_DIVIDE /* No 64-bit integers, ok to use native divide */ +#define ACPI_USE_NATIVE_DIVIDE /* No 64-bit integers, ok to use native divide */ #define ACPI_MAX_PTR ACPI_UINT16_MAX #define ACPI_SIZE_MAX ACPI_UINT16_MAX @@ -168,7 +162,6 @@ typedef u16 acpi_size; */ #define ACPI_NO_INTEGER64_SUPPORT - #elif ACPI_MACHINE_WIDTH == 32 /*! [Begin] no source code translation (keep the typedefs) */ @@ -176,23 +169,23 @@ typedef u16 acpi_size; /* * 32-bit type definitions (default) */ -typedef unsigned char UINT8; -typedef unsigned char BOOLEAN; -typedef unsigned short UINT16; -typedef int INT32; -typedef unsigned int UINT32; -typedef COMPILER_DEPENDENT_INT64 INT64; -typedef COMPILER_DEPENDENT_UINT64 UINT64; +typedef unsigned char UINT8; +typedef unsigned char BOOLEAN; +typedef unsigned short UINT16; +typedef int INT32; +typedef unsigned int UINT32; +typedef COMPILER_DEPENDENT_INT64 INT64; +typedef COMPILER_DEPENDENT_UINT64 UINT64; /*! [End] no source code translation !*/ -typedef s32 acpi_native_int; -typedef u32 acpi_native_uint; +typedef s32 acpi_native_int; +typedef u32 acpi_native_uint; -typedef u64 acpi_table_ptr; -typedef u32 acpi_io_address; -typedef u64 acpi_physical_address; -typedef u32 acpi_size; +typedef u64 acpi_table_ptr; +typedef u32 acpi_io_address; +typedef u64 acpi_physical_address; +typedef u32 acpi_size; #define ALIGNED_ADDRESS_BOUNDARY 0x00000004 #define ACPI_MISALIGNED_TRANSFERS @@ -203,30 +196,27 @@ typedef u32 acpi_size; #error unknown ACPI_MACHINE_WIDTH #endif - /* * This type is used for bitfields in ACPI tables. The only type that is * even remotely portable is u8. Anything else is not portable, so * do not add any more bitfield types. */ -typedef u8 UINT8_BIT; -typedef acpi_native_uint ACPI_PTRDIFF; +typedef u8 UINT8_BIT; +typedef acpi_native_uint ACPI_PTRDIFF; /* * Pointer overlays to avoid lots of typecasting for * code that accepts both physical and logical pointers. */ -union acpi_pointers -{ - acpi_physical_address physical; - void *logical; - acpi_table_ptr value; +union acpi_pointers { + acpi_physical_address physical; + void *logical; + acpi_table_ptr value; }; -struct acpi_pointer -{ - u32 pointer_type; - union acpi_pointers pointer; +struct acpi_pointer { + u32 pointer_type; + union acpi_pointers pointer; }; /* pointer_types for above */ @@ -270,34 +260,29 @@ struct acpi_pointer #define NULL (void *) 0 #endif - /* * Local datatypes */ -typedef u32 acpi_status; /* All ACPI Exceptions */ -typedef u32 acpi_name; /* 4-byte ACPI name */ -typedef char * acpi_string; /* Null terminated ASCII string */ -typedef void * acpi_handle; /* Actually a ptr to an Node */ - -struct uint64_struct -{ - u32 lo; - u32 hi; +typedef u32 acpi_status; /* All ACPI Exceptions */ +typedef u32 acpi_name; /* 4-byte ACPI name */ +typedef char *acpi_string; /* Null terminated ASCII string */ +typedef void *acpi_handle; /* Actually a ptr to an Node */ + +struct uint64_struct { + u32 lo; + u32 hi; }; -union uint64_overlay -{ - u64 full; - struct uint64_struct part; +union uint64_overlay { + u64 full; + struct uint64_struct part; }; -struct uint32_struct -{ - u32 lo; - u32 hi; +struct uint32_struct { + u32 lo; + u32 hi; }; - /* * Acpi integer width. In ACPI version 1, integers are * 32 bits. In ACPI version 2, integers are 64 bits. @@ -309,26 +294,24 @@ struct uint32_struct /* 32-bit integers only, no 64-bit support */ -typedef u32 acpi_integer; +typedef u32 acpi_integer; #define ACPI_INTEGER_MAX ACPI_UINT32_MAX #define ACPI_INTEGER_BIT_SIZE 32 -#define ACPI_MAX_DECIMAL_DIGITS 10 /* 2^32 = 4,294,967,296 */ - -#define ACPI_USE_NATIVE_DIVIDE /* Use compiler native 32-bit divide */ +#define ACPI_MAX_DECIMAL_DIGITS 10 /* 2^32 = 4,294,967,296 */ +#define ACPI_USE_NATIVE_DIVIDE /* Use compiler native 32-bit divide */ #else /* 64-bit integers */ -typedef u64 acpi_integer; +typedef u64 acpi_integer; #define ACPI_INTEGER_MAX ACPI_UINT64_MAX #define ACPI_INTEGER_BIT_SIZE 64 -#define ACPI_MAX_DECIMAL_DIGITS 20 /* 2^64 = 18,446,744,073,709,551,616 */ - +#define ACPI_MAX_DECIMAL_DIGITS 20 /* 2^64 = 18,446,744,073,709,551,616 */ #if ACPI_MACHINE_WIDTH == 64 -#define ACPI_USE_NATIVE_DIVIDE /* Use compiler native 64-bit divide */ +#define ACPI_USE_NATIVE_DIVIDE /* Use compiler native 64-bit divide */ #endif #endif @@ -342,7 +325,6 @@ typedef u64 acpi_integer; */ #define ACPI_ROOT_OBJECT (acpi_handle) ACPI_PTR_ADD (char, NULL, ACPI_MAX_PTR) - /* * Initialization sequence */ @@ -409,7 +391,7 @@ typedef u64 acpi_integer; /* * Table types. These values are passed to the table related APIs */ -typedef u32 acpi_table_type; +typedef u32 acpi_table_type; #define ACPI_TABLE_RSDP (acpi_table_type) 0 #define ACPI_TABLE_DSDT (acpi_table_type) 1 @@ -430,22 +412,22 @@ typedef u32 acpi_table_type; * NOTE: Types must be kept in sync with the global acpi_ns_properties * and acpi_ns_type_names arrays. */ -typedef u32 acpi_object_type; +typedef u32 acpi_object_type; #define ACPI_TYPE_ANY 0x00 -#define ACPI_TYPE_INTEGER 0x01 /* Byte/Word/Dword/Zero/One/Ones */ +#define ACPI_TYPE_INTEGER 0x01 /* Byte/Word/Dword/Zero/One/Ones */ #define ACPI_TYPE_STRING 0x02 #define ACPI_TYPE_BUFFER 0x03 -#define ACPI_TYPE_PACKAGE 0x04 /* byte_const, multiple data_term/Constant/super_name */ +#define ACPI_TYPE_PACKAGE 0x04 /* byte_const, multiple data_term/Constant/super_name */ #define ACPI_TYPE_FIELD_UNIT 0x05 -#define ACPI_TYPE_DEVICE 0x06 /* Name, multiple Node */ +#define ACPI_TYPE_DEVICE 0x06 /* Name, multiple Node */ #define ACPI_TYPE_EVENT 0x07 -#define ACPI_TYPE_METHOD 0x08 /* Name, byte_const, multiple Code */ +#define ACPI_TYPE_METHOD 0x08 /* Name, byte_const, multiple Code */ #define ACPI_TYPE_MUTEX 0x09 #define ACPI_TYPE_REGION 0x0A -#define ACPI_TYPE_POWER 0x0B /* Name,byte_const,word_const,multi Node */ -#define ACPI_TYPE_PROCESSOR 0x0C /* Name,byte_const,Dword_const,byte_const,multi nm_o */ -#define ACPI_TYPE_THERMAL 0x0D /* Name, multiple Node */ +#define ACPI_TYPE_POWER 0x0B /* Name,byte_const,word_const,multi Node */ +#define ACPI_TYPE_PROCESSOR 0x0C /* Name,byte_const,Dword_const,byte_const,multi nm_o */ +#define ACPI_TYPE_THERMAL 0x0D /* Name, multiple Node */ #define ACPI_TYPE_BUFFER_FIELD 0x0E #define ACPI_TYPE_DDB_HANDLE 0x0F #define ACPI_TYPE_DEBUG_OBJECT 0x10 @@ -462,16 +444,16 @@ typedef u32 acpi_object_type; #define ACPI_TYPE_LOCAL_REGION_FIELD 0x11 #define ACPI_TYPE_LOCAL_BANK_FIELD 0x12 #define ACPI_TYPE_LOCAL_INDEX_FIELD 0x13 -#define ACPI_TYPE_LOCAL_REFERENCE 0x14 /* Arg#, Local#, Name, Debug, ref_of, Index */ +#define ACPI_TYPE_LOCAL_REFERENCE 0x14 /* Arg#, Local#, Name, Debug, ref_of, Index */ #define ACPI_TYPE_LOCAL_ALIAS 0x15 #define ACPI_TYPE_LOCAL_METHOD_ALIAS 0x16 #define ACPI_TYPE_LOCAL_NOTIFY 0x17 #define ACPI_TYPE_LOCAL_ADDRESS_HANDLER 0x18 #define ACPI_TYPE_LOCAL_RESOURCE 0x19 #define ACPI_TYPE_LOCAL_RESOURCE_FIELD 0x1A -#define ACPI_TYPE_LOCAL_SCOPE 0x1B /* 1 Name, multiple object_list Nodes */ +#define ACPI_TYPE_LOCAL_SCOPE 0x1B /* 1 Name, multiple object_list Nodes */ -#define ACPI_TYPE_NS_NODE_MAX 0x1B /* Last typecode used within a NS Node */ +#define ACPI_TYPE_NS_NODE_MAX 0x1B /* Last typecode used within a NS Node */ /* * These are special object types that never appear in @@ -515,7 +497,7 @@ typedef u32 acpi_object_type; #define ACPI_BTYPE_DATA (ACPI_BTYPE_COMPUTE_DATA | ACPI_BTYPE_PACKAGE) #define ACPI_BTYPE_DATA_REFERENCE (ACPI_BTYPE_DATA | ACPI_BTYPE_REFERENCE | ACPI_BTYPE_DDB_HANDLE) #define ACPI_BTYPE_DEVICE_OBJECTS (ACPI_BTYPE_DEVICE | ACPI_BTYPE_THERMAL | ACPI_BTYPE_PROCESSOR) -#define ACPI_BTYPE_OBJECTS_AND_REFS 0x0001FFFF /* ARG or LOCAL */ +#define ACPI_BTYPE_OBJECTS_AND_REFS 0x0001FFFF /* ARG or LOCAL */ #define ACPI_BTYPE_ALL_OBJECTS 0x0000FFFF /* @@ -528,7 +510,7 @@ typedef u32 acpi_object_type; /* * Event Types: Fixed & General Purpose */ -typedef u32 acpi_event_type; +typedef u32 acpi_event_type; /* * Fixed events @@ -556,7 +538,7 @@ typedef u32 acpi_event_type; * | +----- Set? * +----------- */ -typedef u32 acpi_event_status; +typedef u32 acpi_event_status; #define ACPI_EVENT_FLAG_DISABLED (acpi_event_status) 0x00 #define ACPI_EVENT_FLAG_ENABLED (acpi_event_status) 0x01 @@ -573,7 +555,6 @@ typedef u32 acpi_event_status; #define ACPI_GPE_ENABLE 0 #define ACPI_GPE_DISABLE 1 - /* * GPE info flags - Per GPE * +-+-+-+---+---+-+ @@ -594,22 +575,22 @@ typedef u32 acpi_event_status; #define ACPI_GPE_TYPE_MASK (u8) 0x06 #define ACPI_GPE_TYPE_WAKE_RUN (u8) 0x06 #define ACPI_GPE_TYPE_WAKE (u8) 0x02 -#define ACPI_GPE_TYPE_RUNTIME (u8) 0x04 /* Default */ +#define ACPI_GPE_TYPE_RUNTIME (u8) 0x04 /* Default */ #define ACPI_GPE_DISPATCH_MASK (u8) 0x18 #define ACPI_GPE_DISPATCH_HANDLER (u8) 0x08 #define ACPI_GPE_DISPATCH_METHOD (u8) 0x10 -#define ACPI_GPE_DISPATCH_NOT_USED (u8) 0x00 /* Default */ +#define ACPI_GPE_DISPATCH_NOT_USED (u8) 0x00 /* Default */ #define ACPI_GPE_RUN_ENABLE_MASK (u8) 0x20 #define ACPI_GPE_RUN_ENABLED (u8) 0x20 -#define ACPI_GPE_RUN_DISABLED (u8) 0x00 /* Default */ +#define ACPI_GPE_RUN_DISABLED (u8) 0x00 /* Default */ #define ACPI_GPE_WAKE_ENABLE_MASK (u8) 0x40 #define ACPI_GPE_WAKE_ENABLED (u8) 0x40 -#define ACPI_GPE_WAKE_DISABLED (u8) 0x00 /* Default */ +#define ACPI_GPE_WAKE_DISABLED (u8) 0x00 /* Default */ -#define ACPI_GPE_ENABLE_MASK (u8) 0x60 /* Both run/wake */ +#define ACPI_GPE_ENABLE_MASK (u8) 0x60 /* Both run/wake */ #define ACPI_GPE_SYSTEM_MASK (u8) 0x80 #define ACPI_GPE_SYSTEM_RUNNING (u8) 0x80 @@ -618,13 +599,12 @@ typedef u32 acpi_event_status; /* * Flags for GPE and Lock interfaces */ -#define ACPI_EVENT_WAKE_ENABLE 0x2 /* acpi_gpe_enable */ -#define ACPI_EVENT_WAKE_DISABLE 0x2 /* acpi_gpe_disable */ +#define ACPI_EVENT_WAKE_ENABLE 0x2 /* acpi_gpe_enable */ +#define ACPI_EVENT_WAKE_DISABLE 0x2 /* acpi_gpe_disable */ #define ACPI_NOT_ISR 0x1 #define ACPI_ISR 0x0 - /* Notify types */ #define ACPI_SYSTEM_NOTIFY 0x1 @@ -634,10 +614,9 @@ typedef u32 acpi_event_status; #define ACPI_MAX_SYS_NOTIFY 0x7f - /* Address Space (Operation Region) Types */ -typedef u8 acpi_adr_space_type; +typedef u8 acpi_adr_space_type; #define ACPI_ADR_SPACE_SYSTEM_MEMORY (acpi_adr_space_type) 0 #define ACPI_ADR_SPACE_SYSTEM_IO (acpi_adr_space_type) 1 @@ -649,7 +628,6 @@ typedef u8 acpi_adr_space_type; #define ACPI_ADR_SPACE_DATA_TABLE (acpi_adr_space_type) 7 #define ACPI_ADR_SPACE_FIXED_HARDWARE (acpi_adr_space_type) 127 - /* * bit_register IDs * These are bitfields defined within the full ACPI registers @@ -683,74 +661,62 @@ typedef u8 acpi_adr_space_type; #define ACPI_BITREG_MAX 0x15 #define ACPI_NUM_BITREG ACPI_BITREG_MAX + 1 - /* * External ACPI object definition */ -union acpi_object -{ - acpi_object_type type; /* See definition of acpi_ns_type for values */ - struct - { - acpi_object_type type; - acpi_integer value; /* The actual number */ +union acpi_object { + acpi_object_type type; /* See definition of acpi_ns_type for values */ + struct { + acpi_object_type type; + acpi_integer value; /* The actual number */ } integer; - struct - { - acpi_object_type type; - u32 length; /* # of bytes in string, excluding trailing null */ - char *pointer; /* points to the string value */ + struct { + acpi_object_type type; + u32 length; /* # of bytes in string, excluding trailing null */ + char *pointer; /* points to the string value */ } string; - struct - { - acpi_object_type type; - u32 length; /* # of bytes in buffer */ - u8 *pointer; /* points to the buffer */ + struct { + acpi_object_type type; + u32 length; /* # of bytes in buffer */ + u8 *pointer; /* points to the buffer */ } buffer; - struct - { - acpi_object_type type; - u32 fill1; - acpi_handle handle; /* object reference */ + struct { + acpi_object_type type; + u32 fill1; + acpi_handle handle; /* object reference */ } reference; - struct - { - acpi_object_type type; - u32 count; /* # of elements in package */ - union acpi_object *elements; /* Pointer to an array of ACPI_OBJECTs */ + struct { + acpi_object_type type; + u32 count; /* # of elements in package */ + union acpi_object *elements; /* Pointer to an array of ACPI_OBJECTs */ } package; - struct - { - acpi_object_type type; - u32 proc_id; - acpi_io_address pblk_address; - u32 pblk_length; + struct { + acpi_object_type type; + u32 proc_id; + acpi_io_address pblk_address; + u32 pblk_length; } processor; - struct - { - acpi_object_type type; - u32 system_level; - u32 resource_order; + struct { + acpi_object_type type; + u32 system_level; + u32 resource_order; } power_resource; }; - /* * List of objects, used as a parameter list for control method evaluation */ -struct acpi_object_list -{ - u32 count; - union acpi_object *pointer; +struct acpi_object_list { + u32 count; + union acpi_object *pointer; }; - /* * Miscellaneous common Data Structures used by the interfaces */ @@ -758,13 +724,11 @@ struct acpi_object_list #define ACPI_ALLOCATE_BUFFER (acpi_size) (-1) #define ACPI_ALLOCATE_LOCAL_BUFFER (acpi_size) (-2) -struct acpi_buffer -{ - acpi_size length; /* Length in bytes of the buffer */ - void *pointer; /* pointer to buffer */ +struct acpi_buffer { + acpi_size length; /* Length in bytes of the buffer */ + void *pointer; /* pointer to buffer */ }; - /* * name_type for acpi_get_name */ @@ -772,7 +736,6 @@ struct acpi_buffer #define ACPI_SINGLE_NAME 1 #define ACPI_NAME_TYPE_MAX 1 - /* * Structure and flags for acpi_get_system_info */ @@ -781,139 +744,106 @@ struct acpi_buffer #define ACPI_SYS_MODE_LEGACY 0x0002 #define ACPI_SYS_MODES_MASK 0x0003 - /* * ACPI Table Info. One per ACPI table _type_ */ -struct acpi_table_info -{ - u32 count; +struct acpi_table_info { + u32 count; }; - /* * System info returned by acpi_get_system_info() */ -struct acpi_system_info -{ - u32 acpi_ca_version; - u32 flags; - u32 timer_resolution; - u32 reserved1; - u32 reserved2; - u32 debug_level; - u32 debug_layer; - u32 num_table_types; - struct acpi_table_info table_info [NUM_ACPI_TABLE_TYPES]; +struct acpi_system_info { + u32 acpi_ca_version; + u32 flags; + u32 timer_resolution; + u32 reserved1; + u32 reserved2; + u32 debug_level; + u32 debug_layer; + u32 num_table_types; + struct acpi_table_info table_info[NUM_ACPI_TABLE_TYPES]; }; - /* * Types specific to the OS service interfaces */ -typedef u32 -(ACPI_SYSTEM_XFACE *acpi_osd_handler) ( - void *context); +typedef u32(ACPI_SYSTEM_XFACE * acpi_osd_handler) (void *context); typedef void -(ACPI_SYSTEM_XFACE *acpi_osd_exec_callback) ( - void *context); + (ACPI_SYSTEM_XFACE * acpi_osd_exec_callback) (void *context); /* * Various handlers and callback procedures */ -typedef -u32 (*acpi_event_handler) ( - void *context); +typedef u32(*acpi_event_handler) (void *context); typedef -void (*acpi_notify_handler) ( - acpi_handle device, - u32 value, - void *context); +void (*acpi_notify_handler) (acpi_handle device, u32 value, void *context); typedef -void (*acpi_object_handler) ( - acpi_handle object, - u32 function, - void *data); +void (*acpi_object_handler) (acpi_handle object, u32 function, void *data); -typedef -acpi_status (*acpi_init_handler) ( - acpi_handle object, - u32 function); +typedef acpi_status(*acpi_init_handler) (acpi_handle object, u32 function); #define ACPI_INIT_DEVICE_INI 1 typedef -acpi_status (*acpi_exception_handler) ( - acpi_status aml_status, - acpi_name name, - u16 opcode, - u32 aml_offset, - void *context); - +acpi_status(*acpi_exception_handler) (acpi_status aml_status, + acpi_name name, + u16 opcode, + u32 aml_offset, void *context); /* Address Spaces (For Operation Regions) */ typedef -acpi_status (*acpi_adr_space_handler) ( - u32 function, - acpi_physical_address address, - u32 bit_width, - acpi_integer *value, - void *handler_context, - void *region_context); +acpi_status(*acpi_adr_space_handler) (u32 function, + acpi_physical_address address, + u32 bit_width, + acpi_integer * value, + void *handler_context, + void *region_context); #define ACPI_DEFAULT_HANDLER NULL - typedef -acpi_status (*acpi_adr_space_setup) ( - acpi_handle region_handle, - u32 function, - void *handler_context, - void **region_context); +acpi_status(*acpi_adr_space_setup) (acpi_handle region_handle, + u32 function, + void *handler_context, + void **region_context); #define ACPI_REGION_ACTIVATE 0 #define ACPI_REGION_DEACTIVATE 1 typedef -acpi_status (*acpi_walk_callback) ( - acpi_handle obj_handle, - u32 nesting_level, - void *context, - void **return_value); - +acpi_status(*acpi_walk_callback) (acpi_handle obj_handle, + u32 nesting_level, + void *context, void **return_value); /* Interrupt handler return values */ #define ACPI_INTERRUPT_NOT_HANDLED 0x00 #define ACPI_INTERRUPT_HANDLED 0x01 - /* Common string version of device HIDs and UIDs */ -struct acpi_device_id -{ - char value[ACPI_DEVICE_ID_LENGTH]; +struct acpi_device_id { + char value[ACPI_DEVICE_ID_LENGTH]; }; /* Common string version of device CIDs */ -struct acpi_compatible_id -{ - char value[ACPI_MAX_CID_LENGTH]; +struct acpi_compatible_id { + char value[ACPI_MAX_CID_LENGTH]; }; -struct acpi_compatible_id_list -{ - u32 count; - u32 size; - struct acpi_compatible_id id[1]; +struct acpi_compatible_id_list { + u32 count; + u32 size; + struct acpi_compatible_id id[1]; }; - /* Structure and flags for acpi_get_object_info */ #define ACPI_VALID_STA 0x0001 @@ -923,55 +853,45 @@ struct acpi_compatible_id_list #define ACPI_VALID_CID 0x0010 #define ACPI_VALID_SXDS 0x0020 - #define ACPI_COMMON_OBJ_INFO \ acpi_object_type type; /* ACPI object type */ \ - acpi_name name /* ACPI object Name */ - + acpi_name name /* ACPI object Name */ -struct acpi_obj_info_header -{ +struct acpi_obj_info_header { ACPI_COMMON_OBJ_INFO; }; - /* Structure returned from Get Object Info */ -struct acpi_device_info -{ +struct acpi_device_info { ACPI_COMMON_OBJ_INFO; - u32 valid; /* Indicates which fields below are valid */ - u32 current_status; /* _STA value */ - acpi_integer address; /* _ADR value if any */ - struct acpi_device_id hardware_id; /* _HID value if any */ - struct acpi_device_id unique_id; /* _UID value if any */ - u8 highest_dstates[4]; /* _sx_d values: 0xFF indicates not valid */ - struct acpi_compatible_id_list compatibility_id; /* List of _CIDs if any */ + u32 valid; /* Indicates which fields below are valid */ + u32 current_status; /* _STA value */ + acpi_integer address; /* _ADR value if any */ + struct acpi_device_id hardware_id; /* _HID value if any */ + struct acpi_device_id unique_id; /* _UID value if any */ + u8 highest_dstates[4]; /* _sx_d values: 0xFF indicates not valid */ + struct acpi_compatible_id_list compatibility_id; /* List of _CIDs if any */ }; - /* Context structs for address space handlers */ -struct acpi_pci_id -{ - u16 segment; - u16 bus; - u16 device; - u16 function; +struct acpi_pci_id { + u16 segment; + u16 bus; + u16 device; + u16 function; }; - -struct acpi_mem_space_context -{ - u32 length; - acpi_physical_address address; - acpi_physical_address mapped_physical_address; - u8 *mapped_logical_address; - acpi_size mapped_length; +struct acpi_mem_space_context { + u32 length; + acpi_physical_address address; + acpi_physical_address mapped_physical_address; + u8 *mapped_logical_address; + acpi_size mapped_length; }; - /* * Definitions for Resource Attributes */ @@ -1001,8 +921,8 @@ struct acpi_mem_space_context /* * IO Port Descriptor Decode */ -#define ACPI_DECODE_10 (u8) 0x00 /* 10-bit IO address decode */ -#define ACPI_DECODE_16 (u8) 0x01 /* 16-bit IO address decode */ +#define ACPI_DECODE_10 (u8) 0x00 /* 10-bit IO address decode */ +#define ACPI_DECODE_16 (u8) 0x01 /* 16-bit IO address decode */ /* * IRQ Attributes @@ -1054,32 +974,28 @@ struct acpi_mem_space_context #define ACPI_PRODUCER (u8) 0x00 #define ACPI_CONSUMER (u8) 0x01 - /* * Structures used to describe device resources */ -struct acpi_resource_irq -{ - u32 edge_level; - u32 active_high_low; - u32 shared_exclusive; - u32 number_of_interrupts; - u32 interrupts[1]; +struct acpi_resource_irq { + u32 edge_level; + u32 active_high_low; + u32 shared_exclusive; + u32 number_of_interrupts; + u32 interrupts[1]; }; -struct acpi_resource_dma -{ - u32 type; - u32 bus_master; - u32 transfer; - u32 number_of_channels; - u32 channels[1]; +struct acpi_resource_dma { + u32 type; + u32 bus_master; + u32 transfer; + u32 number_of_channels; + u32 channels[1]; }; -struct acpi_resource_start_dpf -{ - u32 compatibility_priority; - u32 performance_robustness; +struct acpi_resource_start_dpf { + u32 compatibility_priority; + u32 performance_robustness; }; /* @@ -1087,150 +1003,133 @@ struct acpi_resource_start_dpf * needed because it has no fields */ -struct acpi_resource_io -{ - u32 io_decode; - u32 min_base_address; - u32 max_base_address; - u32 alignment; - u32 range_length; +struct acpi_resource_io { + u32 io_decode; + u32 min_base_address; + u32 max_base_address; + u32 alignment; + u32 range_length; }; -struct acpi_resource_fixed_io -{ - u32 base_address; - u32 range_length; +struct acpi_resource_fixed_io { + u32 base_address; + u32 range_length; }; -struct acpi_resource_vendor -{ - u32 length; - u8 reserved[1]; +struct acpi_resource_vendor { + u32 length; + u8 reserved[1]; }; -struct acpi_resource_end_tag -{ - u8 checksum; +struct acpi_resource_end_tag { + u8 checksum; }; -struct acpi_resource_mem24 -{ - u32 read_write_attribute; - u32 min_base_address; - u32 max_base_address; - u32 alignment; - u32 range_length; +struct acpi_resource_mem24 { + u32 read_write_attribute; + u32 min_base_address; + u32 max_base_address; + u32 alignment; + u32 range_length; }; -struct acpi_resource_mem32 -{ - u32 read_write_attribute; - u32 min_base_address; - u32 max_base_address; - u32 alignment; - u32 range_length; +struct acpi_resource_mem32 { + u32 read_write_attribute; + u32 min_base_address; + u32 max_base_address; + u32 alignment; + u32 range_length; }; -struct acpi_resource_fixed_mem32 -{ - u32 read_write_attribute; - u32 range_base_address; - u32 range_length; +struct acpi_resource_fixed_mem32 { + u32 read_write_attribute; + u32 range_base_address; + u32 range_length; }; -struct acpi_memory_attribute -{ - u16 cache_attribute; - u16 read_write_attribute; +struct acpi_memory_attribute { + u16 cache_attribute; + u16 read_write_attribute; }; -struct acpi_io_attribute -{ - u16 range_attribute; - u16 translation_attribute; +struct acpi_io_attribute { + u16 range_attribute; + u16 translation_attribute; }; -struct acpi_bus_attribute -{ - u16 reserved1; - u16 reserved2; +struct acpi_bus_attribute { + u16 reserved1; + u16 reserved2; }; -union acpi_resource_attribute -{ - struct acpi_memory_attribute memory; - struct acpi_io_attribute io; - struct acpi_bus_attribute bus; +union acpi_resource_attribute { + struct acpi_memory_attribute memory; + struct acpi_io_attribute io; + struct acpi_bus_attribute bus; }; -struct acpi_resource_source -{ - u32 index; - u32 string_length; - char *string_ptr; +struct acpi_resource_source { + u32 index; + u32 string_length; + char *string_ptr; }; -struct acpi_resource_address16 -{ - u32 resource_type; - u32 producer_consumer; - u32 decode; - u32 min_address_fixed; - u32 max_address_fixed; - union acpi_resource_attribute attribute; - u32 granularity; - u32 min_address_range; - u32 max_address_range; - u32 address_translation_offset; - u32 address_length; - struct acpi_resource_source resource_source; +struct acpi_resource_address16 { + u32 resource_type; + u32 producer_consumer; + u32 decode; + u32 min_address_fixed; + u32 max_address_fixed; + union acpi_resource_attribute attribute; + u32 granularity; + u32 min_address_range; + u32 max_address_range; + u32 address_translation_offset; + u32 address_length; + struct acpi_resource_source resource_source; }; -struct acpi_resource_address32 -{ - u32 resource_type; - u32 producer_consumer; - u32 decode; - u32 min_address_fixed; - u32 max_address_fixed; - union acpi_resource_attribute attribute; - u32 granularity; - u32 min_address_range; - u32 max_address_range; - u32 address_translation_offset; - u32 address_length; - struct acpi_resource_source resource_source; +struct acpi_resource_address32 { + u32 resource_type; + u32 producer_consumer; + u32 decode; + u32 min_address_fixed; + u32 max_address_fixed; + union acpi_resource_attribute attribute; + u32 granularity; + u32 min_address_range; + u32 max_address_range; + u32 address_translation_offset; + u32 address_length; + struct acpi_resource_source resource_source; }; -struct acpi_resource_address64 -{ - u32 resource_type; - u32 producer_consumer; - u32 decode; - u32 min_address_fixed; - u32 max_address_fixed; - union acpi_resource_attribute attribute; - u64 granularity; - u64 min_address_range; - u64 max_address_range; - u64 address_translation_offset; - u64 address_length; - u64 type_specific_attributes; - struct acpi_resource_source resource_source; +struct acpi_resource_address64 { + u32 resource_type; + u32 producer_consumer; + u32 decode; + u32 min_address_fixed; + u32 max_address_fixed; + union acpi_resource_attribute attribute; + u64 granularity; + u64 min_address_range; + u64 max_address_range; + u64 address_translation_offset; + u64 address_length; + u64 type_specific_attributes; + struct acpi_resource_source resource_source; }; -struct acpi_resource_ext_irq -{ - u32 producer_consumer; - u32 edge_level; - u32 active_high_low; - u32 shared_exclusive; - u32 number_of_interrupts; - struct acpi_resource_source resource_source; - u32 interrupts[1]; +struct acpi_resource_ext_irq { + u32 producer_consumer; + u32 edge_level; + u32 active_high_low; + u32 shared_exclusive; + u32 number_of_interrupts; + struct acpi_resource_source resource_source; + u32 interrupts[1]; }; - /* ACPI_RESOURCE_TYPEs */ #define ACPI_RSTYPE_IRQ 0 @@ -1249,35 +1148,33 @@ struct acpi_resource_ext_irq #define ACPI_RSTYPE_ADDRESS64 13 #define ACPI_RSTYPE_EXT_IRQ 14 -typedef u32 acpi_resource_type; - -union acpi_resource_data -{ - struct acpi_resource_irq irq; - struct acpi_resource_dma dma; - struct acpi_resource_start_dpf start_dpf; - struct acpi_resource_io io; - struct acpi_resource_fixed_io fixed_io; - struct acpi_resource_vendor vendor_specific; - struct acpi_resource_end_tag end_tag; - struct acpi_resource_mem24 memory24; - struct acpi_resource_mem32 memory32; - struct acpi_resource_fixed_mem32 fixed_memory32; - struct acpi_resource_address16 address16; - struct acpi_resource_address32 address32; - struct acpi_resource_address64 address64; - struct acpi_resource_ext_irq extended_irq; +typedef u32 acpi_resource_type; + +union acpi_resource_data { + struct acpi_resource_irq irq; + struct acpi_resource_dma dma; + struct acpi_resource_start_dpf start_dpf; + struct acpi_resource_io io; + struct acpi_resource_fixed_io fixed_io; + struct acpi_resource_vendor vendor_specific; + struct acpi_resource_end_tag end_tag; + struct acpi_resource_mem24 memory24; + struct acpi_resource_mem32 memory32; + struct acpi_resource_fixed_mem32 fixed_memory32; + struct acpi_resource_address16 address16; + struct acpi_resource_address32 address32; + struct acpi_resource_address64 address64; + struct acpi_resource_ext_irq extended_irq; }; -struct acpi_resource -{ - acpi_resource_type id; - u32 length; - union acpi_resource_data data; +struct acpi_resource { + acpi_resource_type id; + u32 length; + union acpi_resource_data data; }; #define ACPI_RESOURCE_LENGTH 12 -#define ACPI_RESOURCE_LENGTH_NO_DATA 8 /* Id + Length fields */ +#define ACPI_RESOURCE_LENGTH_NO_DATA 8 /* Id + Length fields */ #define ACPI_SIZEOF_RESOURCE(type) (ACPI_RESOURCE_LENGTH_NO_DATA + sizeof (type)) @@ -1293,19 +1190,16 @@ struct acpi_resource * END: of definitions for Resource Attributes */ - -struct acpi_pci_routing_table -{ - u32 length; - u32 pin; - acpi_integer address; /* here for 64-bit alignment */ - u32 source_index; - char source[4]; /* pad to 64 bits so sizeof() works in all cases */ +struct acpi_pci_routing_table { + u32 length; + u32 pin; + acpi_integer address; /* here for 64-bit alignment */ + u32 source_index; + char source[4]; /* pad to 64 bits so sizeof() works in all cases */ }; /* * END: of definitions for PCI Routing tables */ - -#endif /* __ACTYPES_H__ */ +#endif /* __ACTYPES_H__ */ diff --git a/include/acpi/acutils.h b/include/acpi/acutils.h index 0e7b0a3e3b5..c1086452696 100644 --- a/include/acpi/acutils.h +++ b/include/acpi/acutils.h @@ -44,20 +44,17 @@ #ifndef _ACUTILS_H #define _ACUTILS_H - typedef -acpi_status (*acpi_pkg_callback) ( - u8 object_type, - union acpi_operand_object *source_object, - union acpi_generic_state *state, - void *context); - -struct acpi_pkg_info -{ - u8 *free_space; - acpi_size length; - u32 object_space; - u32 num_packages; +acpi_status(*acpi_pkg_callback) (u8 object_type, + union acpi_operand_object * source_object, + union acpi_generic_state * state, + void *context); + +struct acpi_pkg_info { + u8 *free_space; + acpi_size length; + u32 object_space; + u32 num_packages; }; #define REF_INCREMENT (u16) 0 @@ -71,163 +68,89 @@ struct acpi_pkg_info #define DB_DWORD_DISPLAY 4 #define DB_QWORD_DISPLAY 8 - /* * utglobal - Global data structures and procedures */ -void -acpi_ut_init_globals ( - void); +void acpi_ut_init_globals(void); #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) -char * -acpi_ut_get_mutex_name ( - u32 mutex_id); +char *acpi_ut_get_mutex_name(u32 mutex_id); #endif -char * -acpi_ut_get_type_name ( - acpi_object_type type); - -char * -acpi_ut_get_node_name ( - void *object); +char *acpi_ut_get_type_name(acpi_object_type type); -char * -acpi_ut_get_descriptor_name ( - void *object); +char *acpi_ut_get_node_name(void *object); -char * -acpi_ut_get_object_type_name ( - union acpi_operand_object *obj_desc); +char *acpi_ut_get_descriptor_name(void *object); -char * -acpi_ut_get_region_name ( - u8 space_id); +char *acpi_ut_get_object_type_name(union acpi_operand_object *obj_desc); -char * -acpi_ut_get_event_name ( - u32 event_id); +char *acpi_ut_get_region_name(u8 space_id); -char -acpi_ut_hex_to_ascii_char ( - acpi_integer integer, - u32 position); +char *acpi_ut_get_event_name(u32 event_id); -u8 -acpi_ut_valid_object_type ( - acpi_object_type type); +char acpi_ut_hex_to_ascii_char(acpi_integer integer, u32 position); +u8 acpi_ut_valid_object_type(acpi_object_type type); /* * utinit - miscellaneous initialization and shutdown */ -acpi_status -acpi_ut_hardware_initialize ( - void); - -void -acpi_ut_subsystem_shutdown ( - void); +acpi_status acpi_ut_hardware_initialize(void); -acpi_status -acpi_ut_validate_fadt ( - void); +void acpi_ut_subsystem_shutdown(void); +acpi_status acpi_ut_validate_fadt(void); /* * utclib - Local implementations of C library functions */ #ifndef ACPI_USE_SYSTEM_CLIBRARY -acpi_size -acpi_ut_strlen ( - const char *string); - -char * -acpi_ut_strcpy ( - char *dst_string, - const char *src_string); - -char * -acpi_ut_strncpy ( - char *dst_string, - const char *src_string, - acpi_size count); - -int -acpi_ut_memcmp ( - const char *buffer1, - const char *buffer2, - acpi_size count); - -int -acpi_ut_strncmp ( - const char *string1, - const char *string2, - acpi_size count); - -int -acpi_ut_strcmp ( - const char *string1, - const char *string2); - -char * -acpi_ut_strcat ( - char *dst_string, - const char *src_string); - -char * -acpi_ut_strncat ( - char *dst_string, - const char *src_string, - acpi_size count); - -u32 -acpi_ut_strtoul ( - const char *string, - char **terminator, - u32 base); - -char * -acpi_ut_strstr ( - char *string1, - char *string2); - -void * -acpi_ut_memcpy ( - void *dest, - const void *src, - acpi_size count); - -void * -acpi_ut_memset ( - void *dest, - acpi_native_uint value, - acpi_size count); - -int -acpi_ut_to_upper ( - int c); - -int -acpi_ut_to_lower ( - int c); +acpi_size acpi_ut_strlen(const char *string); + +char *acpi_ut_strcpy(char *dst_string, const char *src_string); + +char *acpi_ut_strncpy(char *dst_string, + const char *src_string, acpi_size count); + +int acpi_ut_memcmp(const char *buffer1, const char *buffer2, acpi_size count); + +int acpi_ut_strncmp(const char *string1, const char *string2, acpi_size count); + +int acpi_ut_strcmp(const char *string1, const char *string2); + +char *acpi_ut_strcat(char *dst_string, const char *src_string); + +char *acpi_ut_strncat(char *dst_string, + const char *src_string, acpi_size count); + +u32 acpi_ut_strtoul(const char *string, char **terminator, u32 base); + +char *acpi_ut_strstr(char *string1, char *string2); + +void *acpi_ut_memcpy(void *dest, const void *src, acpi_size count); + +void *acpi_ut_memset(void *dest, acpi_native_uint value, acpi_size count); + +int acpi_ut_to_upper(int c); + +int acpi_ut_to_lower(int c); extern const u8 _acpi_ctype[]; -#define _ACPI_XA 0x00 /* extra alphabetic - not supported */ -#define _ACPI_XS 0x40 /* extra space */ -#define _ACPI_BB 0x00 /* BEL, BS, etc. - not supported */ -#define _ACPI_CN 0x20 /* CR, FF, HT, NL, VT */ -#define _ACPI_DI 0x04 /* '0'-'9' */ -#define _ACPI_LO 0x02 /* 'a'-'z' */ -#define _ACPI_PU 0x10 /* punctuation */ -#define _ACPI_SP 0x08 /* space */ -#define _ACPI_UP 0x01 /* 'A'-'Z' */ -#define _ACPI_XD 0x80 /* '0'-'9', 'A'-'F', 'a'-'f' */ +#define _ACPI_XA 0x00 /* extra alphabetic - not supported */ +#define _ACPI_XS 0x40 /* extra space */ +#define _ACPI_BB 0x00 /* BEL, BS, etc. - not supported */ +#define _ACPI_CN 0x20 /* CR, FF, HT, NL, VT */ +#define _ACPI_DI 0x04 /* '0'-'9' */ +#define _ACPI_LO 0x02 /* 'a'-'z' */ +#define _ACPI_PU 0x10 /* punctuation */ +#define _ACPI_SP 0x08 /* space */ +#define _ACPI_UP 0x01 /* 'A'-'Z' */ +#define _ACPI_XD 0x80 /* '0'-'9', 'A'-'F', 'a'-'f' */ #define ACPI_IS_DIGIT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_DI)) #define ACPI_IS_SPACE(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_SP)) @@ -238,517 +161,323 @@ extern const u8 _acpi_ctype[]; #define ACPI_IS_ALPHA(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP)) #define ACPI_IS_ASCII(c) ((c) < 0x80) -#endif /* ACPI_USE_SYSTEM_CLIBRARY */ - +#endif /* ACPI_USE_SYSTEM_CLIBRARY */ /* * utcopy - Object construction and conversion interfaces */ acpi_status -acpi_ut_build_simple_object( - union acpi_operand_object *obj, - union acpi_object *user_obj, - u8 *data_space, - u32 *buffer_space_used); +acpi_ut_build_simple_object(union acpi_operand_object *obj, + union acpi_object *user_obj, + u8 * data_space, u32 * buffer_space_used); acpi_status -acpi_ut_build_package_object ( - union acpi_operand_object *obj, - u8 *buffer, - u32 *space_used); +acpi_ut_build_package_object(union acpi_operand_object *obj, + u8 * buffer, u32 * space_used); acpi_status -acpi_ut_copy_iobject_to_eobject ( - union acpi_operand_object *obj, - struct acpi_buffer *ret_buffer); +acpi_ut_copy_iobject_to_eobject(union acpi_operand_object *obj, + struct acpi_buffer *ret_buffer); acpi_status -acpi_ut_copy_eobject_to_iobject ( - union acpi_object *obj, - union acpi_operand_object **internal_obj); +acpi_ut_copy_eobject_to_iobject(union acpi_object *obj, + union acpi_operand_object **internal_obj); acpi_status -acpi_ut_copy_isimple_to_isimple ( - union acpi_operand_object *source_obj, - union acpi_operand_object *dest_obj); +acpi_ut_copy_isimple_to_isimple(union acpi_operand_object *source_obj, + union acpi_operand_object *dest_obj); acpi_status -acpi_ut_copy_iobject_to_iobject ( - union acpi_operand_object *source_desc, - union acpi_operand_object **dest_desc, - struct acpi_walk_state *walk_state); - +acpi_ut_copy_iobject_to_iobject(union acpi_operand_object *source_desc, + union acpi_operand_object **dest_desc, + struct acpi_walk_state *walk_state); /* * utcreate - Object creation */ acpi_status -acpi_ut_update_object_reference ( - union acpi_operand_object *object, - u16 action); - +acpi_ut_update_object_reference(union acpi_operand_object *object, u16 action); /* * utdebug - Debug interfaces */ -void -acpi_ut_init_stack_ptr_trace ( - void); +void acpi_ut_init_stack_ptr_trace(void); -void -acpi_ut_track_stack_ptr ( - void); +void acpi_ut_track_stack_ptr(void); void -acpi_ut_trace ( - u32 line_number, - const char *function_name, - char *module_name, - u32 component_id); +acpi_ut_trace(u32 line_number, + const char *function_name, char *module_name, u32 component_id); void -acpi_ut_trace_ptr ( - u32 line_number, - const char *function_name, - char *module_name, - u32 component_id, - void *pointer); +acpi_ut_trace_ptr(u32 line_number, + const char *function_name, + char *module_name, u32 component_id, void *pointer); void -acpi_ut_trace_u32 ( - u32 line_number, - const char *function_name, - char *module_name, - u32 component_id, - u32 integer); +acpi_ut_trace_u32(u32 line_number, + const char *function_name, + char *module_name, u32 component_id, u32 integer); void -acpi_ut_trace_str ( - u32 line_number, - const char *function_name, - char *module_name, - u32 component_id, - char *string); +acpi_ut_trace_str(u32 line_number, + const char *function_name, + char *module_name, u32 component_id, char *string); void -acpi_ut_exit ( - u32 line_number, - const char *function_name, - char *module_name, - u32 component_id); +acpi_ut_exit(u32 line_number, + const char *function_name, char *module_name, u32 component_id); void -acpi_ut_status_exit ( - u32 line_number, - const char *function_name, - char *module_name, - u32 component_id, - acpi_status status); +acpi_ut_status_exit(u32 line_number, + const char *function_name, + char *module_name, u32 component_id, acpi_status status); void -acpi_ut_value_exit ( - u32 line_number, - const char *function_name, - char *module_name, - u32 component_id, - acpi_integer value); +acpi_ut_value_exit(u32 line_number, + const char *function_name, + char *module_name, u32 component_id, acpi_integer value); void -acpi_ut_ptr_exit ( - u32 line_number, - const char *function_name, - char *module_name, - u32 component_id, - u8 *ptr); +acpi_ut_ptr_exit(u32 line_number, + const char *function_name, + char *module_name, u32 component_id, u8 * ptr); -void -acpi_ut_report_info ( - char *module_name, - u32 line_number, - u32 component_id); +void acpi_ut_report_info(char *module_name, u32 line_number, u32 component_id); -void -acpi_ut_report_error ( - char *module_name, - u32 line_number, - u32 component_id); +void acpi_ut_report_error(char *module_name, u32 line_number, u32 component_id); void -acpi_ut_report_warning ( - char *module_name, - u32 line_number, - u32 component_id); +acpi_ut_report_warning(char *module_name, u32 line_number, u32 component_id); -void -acpi_ut_dump_buffer ( - u8 *buffer, - u32 count, - u32 display, - u32 component_id); +void acpi_ut_dump_buffer(u8 * buffer, u32 count, u32 display, u32 component_id); void ACPI_INTERNAL_VAR_XFACE -acpi_ut_debug_print ( - u32 requested_debug_level, - u32 line_number, - const char *function_name, - char *module_name, - u32 component_id, - char *format, - ...) ACPI_PRINTF_LIKE_FUNC; +acpi_ut_debug_print(u32 requested_debug_level, + u32 line_number, + const char *function_name, + char *module_name, + u32 component_id, char *format, ...) ACPI_PRINTF_LIKE_FUNC; void ACPI_INTERNAL_VAR_XFACE -acpi_ut_debug_print_raw ( - u32 requested_debug_level, - u32 line_number, - const char *function_name, - char *module_name, - u32 component_id, - char *format, - ...) ACPI_PRINTF_LIKE_FUNC; - +acpi_ut_debug_print_raw(u32 requested_debug_level, + u32 line_number, + const char *function_name, + char *module_name, + u32 component_id, + char *format, ...) ACPI_PRINTF_LIKE_FUNC; /* * utdelete - Object deletion and reference counts */ -void -acpi_ut_add_reference ( - union acpi_operand_object *object); +void acpi_ut_add_reference(union acpi_operand_object *object); -void -acpi_ut_remove_reference ( - union acpi_operand_object *object); +void acpi_ut_remove_reference(union acpi_operand_object *object); -void -acpi_ut_delete_internal_package_object ( - union acpi_operand_object *object); - -void -acpi_ut_delete_internal_simple_object ( - union acpi_operand_object *object); +void acpi_ut_delete_internal_package_object(union acpi_operand_object *object); -void -acpi_ut_delete_internal_object_list ( - union acpi_operand_object **obj_list); +void acpi_ut_delete_internal_simple_object(union acpi_operand_object *object); +void acpi_ut_delete_internal_object_list(union acpi_operand_object **obj_list); /* * uteval - object evaluation */ -acpi_status -acpi_ut_osi_implementation ( - struct acpi_walk_state *walk_state); +acpi_status acpi_ut_osi_implementation(struct acpi_walk_state *walk_state); acpi_status -acpi_ut_evaluate_object ( - struct acpi_namespace_node *prefix_node, - char *path, - u32 expected_return_btypes, - union acpi_operand_object **return_desc); +acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node, + char *path, + u32 expected_return_btypes, + union acpi_operand_object **return_desc); acpi_status -acpi_ut_evaluate_numeric_object ( - char *object_name, - struct acpi_namespace_node *device_node, - acpi_integer *address); +acpi_ut_evaluate_numeric_object(char *object_name, + struct acpi_namespace_node *device_node, + acpi_integer * address); acpi_status -acpi_ut_execute_HID ( - struct acpi_namespace_node *device_node, - struct acpi_device_id *hid); +acpi_ut_execute_HID(struct acpi_namespace_node *device_node, + struct acpi_device_id *hid); acpi_status -acpi_ut_execute_CID ( - struct acpi_namespace_node *device_node, - struct acpi_compatible_id_list **return_cid_list); +acpi_ut_execute_CID(struct acpi_namespace_node *device_node, + struct acpi_compatible_id_list **return_cid_list); acpi_status -acpi_ut_execute_STA ( - struct acpi_namespace_node *device_node, - u32 *status_flags); +acpi_ut_execute_STA(struct acpi_namespace_node *device_node, + u32 * status_flags); acpi_status -acpi_ut_execute_UID ( - struct acpi_namespace_node *device_node, - struct acpi_device_id *uid); +acpi_ut_execute_UID(struct acpi_namespace_node *device_node, + struct acpi_device_id *uid); acpi_status -acpi_ut_execute_sxds ( - struct acpi_namespace_node *device_node, - u8 *highest); - +acpi_ut_execute_sxds(struct acpi_namespace_node *device_node, u8 * highest); /* * utobject - internal object create/delete/cache routines */ -union acpi_operand_object * -acpi_ut_create_internal_object_dbg ( - char *module_name, - u32 line_number, - u32 component_id, - acpi_object_type type); - -void * -acpi_ut_allocate_object_desc_dbg ( - char *module_name, - u32 line_number, - u32 component_id); +union acpi_operand_object *acpi_ut_create_internal_object_dbg(char *module_name, + u32 line_number, + u32 component_id, + acpi_object_type + type); + +void *acpi_ut_allocate_object_desc_dbg(char *module_name, + u32 line_number, u32 component_id); #define acpi_ut_create_internal_object(t) acpi_ut_create_internal_object_dbg (_acpi_module_name,__LINE__,_COMPONENT,t) #define acpi_ut_allocate_object_desc() acpi_ut_allocate_object_desc_dbg (_acpi_module_name,__LINE__,_COMPONENT) -void -acpi_ut_delete_object_desc ( - union acpi_operand_object *object); +void acpi_ut_delete_object_desc(union acpi_operand_object *object); -u8 -acpi_ut_valid_internal_object ( - void *object); +u8 acpi_ut_valid_internal_object(void *object); -union acpi_operand_object * -acpi_ut_create_buffer_object ( - acpi_size buffer_size); +union acpi_operand_object *acpi_ut_create_buffer_object(acpi_size buffer_size); -union acpi_operand_object * -acpi_ut_create_string_object ( - acpi_size string_size); +union acpi_operand_object *acpi_ut_create_string_object(acpi_size string_size); acpi_status -acpi_ut_get_object_size( - union acpi_operand_object *obj, - acpi_size *obj_length); - +acpi_ut_get_object_size(union acpi_operand_object *obj, acpi_size * obj_length); /* * utstate - Generic state creation/cache routines */ void -acpi_ut_push_generic_state ( - union acpi_generic_state **list_head, - union acpi_generic_state *state); - -union acpi_generic_state * -acpi_ut_pop_generic_state ( - union acpi_generic_state **list_head); +acpi_ut_push_generic_state(union acpi_generic_state **list_head, + union acpi_generic_state *state); +union acpi_generic_state *acpi_ut_pop_generic_state(union acpi_generic_state + **list_head); -union acpi_generic_state * -acpi_ut_create_generic_state ( - void); +union acpi_generic_state *acpi_ut_create_generic_state(void); -struct acpi_thread_state * -acpi_ut_create_thread_state ( - void); +struct acpi_thread_state *acpi_ut_create_thread_state(void); -union acpi_generic_state * -acpi_ut_create_update_state ( - union acpi_operand_object *object, - u16 action); +union acpi_generic_state *acpi_ut_create_update_state(union acpi_operand_object + *object, u16 action); -union acpi_generic_state * -acpi_ut_create_pkg_state ( - void *internal_object, - void *external_object, - u16 index); +union acpi_generic_state *acpi_ut_create_pkg_state(void *internal_object, + void *external_object, + u16 index); acpi_status -acpi_ut_create_update_state_and_push ( - union acpi_operand_object *object, - u16 action, - union acpi_generic_state **state_list); +acpi_ut_create_update_state_and_push(union acpi_operand_object *object, + u16 action, + union acpi_generic_state **state_list); #ifdef ACPI_FUTURE_USAGE acpi_status -acpi_ut_create_pkg_state_and_push ( - void *internal_object, - void *external_object, - u16 index, - union acpi_generic_state **state_list); -#endif /* ACPI_FUTURE_USAGE */ +acpi_ut_create_pkg_state_and_push(void *internal_object, + void *external_object, + u16 index, + union acpi_generic_state **state_list); +#endif /* ACPI_FUTURE_USAGE */ -union acpi_generic_state * -acpi_ut_create_control_state ( - void); - -void -acpi_ut_delete_generic_state ( - union acpi_generic_state *state); +union acpi_generic_state *acpi_ut_create_control_state(void); +void acpi_ut_delete_generic_state(union acpi_generic_state *state); /* * utmath */ acpi_status -acpi_ut_divide ( - acpi_integer in_dividend, - acpi_integer in_divisor, - acpi_integer *out_quotient, - acpi_integer *out_remainder); +acpi_ut_divide(acpi_integer in_dividend, + acpi_integer in_divisor, + acpi_integer * out_quotient, acpi_integer * out_remainder); acpi_status -acpi_ut_short_divide ( - acpi_integer in_dividend, - u32 divisor, - acpi_integer *out_quotient, - u32 *out_remainder); +acpi_ut_short_divide(acpi_integer in_dividend, + u32 divisor, + acpi_integer * out_quotient, u32 * out_remainder); /* * utmisc */ -acpi_status -acpi_ut_allocate_owner_id ( - acpi_owner_id *owner_id); +acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id); -void -acpi_ut_release_owner_id ( - acpi_owner_id *owner_id); +void acpi_ut_release_owner_id(acpi_owner_id * owner_id); acpi_status -acpi_ut_walk_package_tree ( - union acpi_operand_object *source_object, - void *target_object, - acpi_pkg_callback walk_callback, - void *context); +acpi_ut_walk_package_tree(union acpi_operand_object *source_object, + void *target_object, + acpi_pkg_callback walk_callback, void *context); -void -acpi_ut_strupr ( - char *src_string); +void acpi_ut_strupr(char *src_string); -void -acpi_ut_print_string ( - char *string, - u8 max_length); +void acpi_ut_print_string(char *string, u8 max_length); -u8 -acpi_ut_valid_acpi_name ( - u32 name); +u8 acpi_ut_valid_acpi_name(u32 name); -u8 -acpi_ut_valid_acpi_character ( - char character); +u8 acpi_ut_valid_acpi_character(char character); acpi_status -acpi_ut_strtoul64 ( - char *string, - u32 base, - acpi_integer *ret_integer); +acpi_ut_strtoul64(char *string, u32 base, acpi_integer * ret_integer); /* Values for Base above (16=Hex, 10=Decimal) */ #define ACPI_ANY_BASE 0 -u8 * -acpi_ut_get_resource_end_tag ( - union acpi_operand_object *obj_desc); +u8 *acpi_ut_get_resource_end_tag(union acpi_operand_object *obj_desc); -u8 -acpi_ut_generate_checksum ( - u8 *buffer, - u32 length); +u8 acpi_ut_generate_checksum(u8 * buffer, u32 length); -u32 -acpi_ut_dword_byte_swap ( - u32 value); +u32 acpi_ut_dword_byte_swap(u32 value); -void -acpi_ut_set_integer_width ( - u8 revision); +void acpi_ut_set_integer_width(u8 revision); #ifdef ACPI_DEBUG_OUTPUT void -acpi_ut_display_init_pathname ( - u8 type, - struct acpi_namespace_node *obj_handle, - char *path); +acpi_ut_display_init_pathname(u8 type, + struct acpi_namespace_node *obj_handle, + char *path); #endif - /* * utmutex - mutex support */ -acpi_status -acpi_ut_mutex_initialize ( - void); - -void -acpi_ut_mutex_terminate ( - void); +acpi_status acpi_ut_mutex_initialize(void); -acpi_status -acpi_ut_acquire_mutex ( - acpi_mutex_handle mutex_id); +void acpi_ut_mutex_terminate(void); -acpi_status -acpi_ut_release_mutex ( - acpi_mutex_handle mutex_id); +acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id); +acpi_status acpi_ut_release_mutex(acpi_mutex_handle mutex_id); /* * utalloc - memory allocation and object caching */ -acpi_status -acpi_ut_create_caches ( - void); +acpi_status acpi_ut_create_caches(void); -acpi_status -acpi_ut_delete_caches ( - void); +acpi_status acpi_ut_delete_caches(void); -acpi_status -acpi_ut_validate_buffer ( - struct acpi_buffer *buffer); +acpi_status acpi_ut_validate_buffer(struct acpi_buffer *buffer); acpi_status -acpi_ut_initialize_buffer ( - struct acpi_buffer *buffer, - acpi_size required_length); - -void * -acpi_ut_allocate ( - acpi_size size, - u32 component, - char *module, - u32 line); - -void * -acpi_ut_callocate ( - acpi_size size, - u32 component, - char *module, - u32 line); +acpi_ut_initialize_buffer(struct acpi_buffer *buffer, + acpi_size required_length); + +void *acpi_ut_allocate(acpi_size size, u32 component, char *module, u32 line); + +void *acpi_ut_callocate(acpi_size size, u32 component, char *module, u32 line); #ifdef ACPI_DBG_TRACK_ALLOCATIONS -void * -acpi_ut_allocate_and_track ( - acpi_size size, - u32 component, - char *module, - u32 line); - -void * -acpi_ut_callocate_and_track ( - acpi_size size, - u32 component, - char *module, - u32 line); +void *acpi_ut_allocate_and_track(acpi_size size, + u32 component, char *module, u32 line); + +void *acpi_ut_callocate_and_track(acpi_size size, + u32 component, char *module, u32 line); void -acpi_ut_free_and_track ( - void *address, - u32 component, - char *module, - u32 line); +acpi_ut_free_and_track(void *address, u32 component, char *module, u32 line); #ifdef ACPI_FUTURE_USAGE -void -acpi_ut_dump_allocation_info ( - void); -#endif /* ACPI_FUTURE_USAGE */ +void acpi_ut_dump_allocation_info(void); +#endif /* ACPI_FUTURE_USAGE */ -void -acpi_ut_dump_allocations ( - u32 component, - char *module); +void acpi_ut_dump_allocations(u32 component, char *module); #endif -#endif /* _ACUTILS_H */ +#endif /* _ACUTILS_H */ diff --git a/include/acpi/amlcode.h b/include/acpi/amlcode.h index 50a08890119..7fdf5299f50 100644 --- a/include/acpi/amlcode.h +++ b/include/acpi/amlcode.h @@ -59,11 +59,11 @@ #define AML_WORD_OP (u16) 0x0b #define AML_DWORD_OP (u16) 0x0c #define AML_STRING_OP (u16) 0x0d -#define AML_QWORD_OP (u16) 0x0e /* ACPI 2.0 */ +#define AML_QWORD_OP (u16) 0x0e /* ACPI 2.0 */ #define AML_SCOPE_OP (u16) 0x10 #define AML_BUFFER_OP (u16) 0x11 #define AML_PACKAGE_OP (u16) 0x12 -#define AML_VAR_PACKAGE_OP (u16) 0x13 /* ACPI 2.0 */ +#define AML_VAR_PACKAGE_OP (u16) 0x13 /* ACPI 2.0 */ #define AML_METHOD_OP (u16) 0x14 #define AML_DUAL_NAME_PREFIX (u16) 0x2e #define AML_MULTI_NAME_PREFIX_OP (u16) 0x2f @@ -109,8 +109,8 @@ #define AML_FIND_SET_LEFT_BIT_OP (u16) 0x81 #define AML_FIND_SET_RIGHT_BIT_OP (u16) 0x82 #define AML_DEREF_OF_OP (u16) 0x83 -#define AML_CONCAT_RES_OP (u16) 0x84 /* ACPI 2.0 */ -#define AML_MOD_OP (u16) 0x85 /* ACPI 2.0 */ +#define AML_CONCAT_RES_OP (u16) 0x84 /* ACPI 2.0 */ +#define AML_MOD_OP (u16) 0x85 /* ACPI 2.0 */ #define AML_NOTIFY_OP (u16) 0x86 #define AML_SIZE_OF_OP (u16) 0x87 #define AML_INDEX_OP (u16) 0x88 @@ -120,21 +120,21 @@ #define AML_CREATE_BYTE_FIELD_OP (u16) 0x8c #define AML_CREATE_BIT_FIELD_OP (u16) 0x8d #define AML_TYPE_OP (u16) 0x8e -#define AML_CREATE_QWORD_FIELD_OP (u16) 0x8f /* ACPI 2.0 */ +#define AML_CREATE_QWORD_FIELD_OP (u16) 0x8f /* ACPI 2.0 */ #define AML_LAND_OP (u16) 0x90 #define AML_LOR_OP (u16) 0x91 #define AML_LNOT_OP (u16) 0x92 #define AML_LEQUAL_OP (u16) 0x93 #define AML_LGREATER_OP (u16) 0x94 #define AML_LLESS_OP (u16) 0x95 -#define AML_TO_BUFFER_OP (u16) 0x96 /* ACPI 2.0 */ -#define AML_TO_DECSTRING_OP (u16) 0x97 /* ACPI 2.0 */ -#define AML_TO_HEXSTRING_OP (u16) 0x98 /* ACPI 2.0 */ -#define AML_TO_INTEGER_OP (u16) 0x99 /* ACPI 2.0 */ -#define AML_TO_STRING_OP (u16) 0x9c /* ACPI 2.0 */ -#define AML_COPY_OP (u16) 0x9d /* ACPI 2.0 */ -#define AML_MID_OP (u16) 0x9e /* ACPI 2.0 */ -#define AML_CONTINUE_OP (u16) 0x9f /* ACPI 2.0 */ +#define AML_TO_BUFFER_OP (u16) 0x96 /* ACPI 2.0 */ +#define AML_TO_DECSTRING_OP (u16) 0x97 /* ACPI 2.0 */ +#define AML_TO_HEXSTRING_OP (u16) 0x98 /* ACPI 2.0 */ +#define AML_TO_INTEGER_OP (u16) 0x99 /* ACPI 2.0 */ +#define AML_TO_STRING_OP (u16) 0x9c /* ACPI 2.0 */ +#define AML_COPY_OP (u16) 0x9d /* ACPI 2.0 */ +#define AML_MID_OP (u16) 0x9e /* ACPI 2.0 */ +#define AML_CONTINUE_OP (u16) 0x9f /* ACPI 2.0 */ #define AML_IF_OP (u16) 0xa0 #define AML_ELSE_OP (u16) 0xa1 #define AML_WHILE_OP (u16) 0xa2 @@ -146,7 +146,7 @@ /* prefixed opcodes */ -#define AML_EXTENDED_OPCODE (u16) 0x5b00 /* prefix for 2-byte opcodes */ +#define AML_EXTENDED_OPCODE (u16) 0x5b00 /* prefix for 2-byte opcodes */ #define AML_MUTEX_OP (u16) 0x5b01 #define AML_EVENT_OP (u16) 0x5b02 @@ -154,7 +154,7 @@ #define AML_SHIFT_LEFT_BIT_OP (u16) 0x5b11 #define AML_COND_REF_OF_OP (u16) 0x5b12 #define AML_CREATE_FIELD_OP (u16) 0x5b13 -#define AML_LOAD_TABLE_OP (u16) 0x5b1f /* ACPI 2.0 */ +#define AML_LOAD_TABLE_OP (u16) 0x5b1f /* ACPI 2.0 */ #define AML_LOAD_OP (u16) 0x5b20 #define AML_STALL_OP (u16) 0x5b21 #define AML_SLEEP_OP (u16) 0x5b22 @@ -169,7 +169,7 @@ #define AML_REVISION_OP (u16) 0x5b30 #define AML_DEBUG_OP (u16) 0x5b31 #define AML_FATAL_OP (u16) 0x5b32 -#define AML_TIMER_OP (u16) 0x5b33 /* ACPI 3.0 */ +#define AML_TIMER_OP (u16) 0x5b33 /* ACPI 3.0 */ #define AML_REGION_OP (u16) 0x5b80 #define AML_FIELD_OP (u16) 0x5b81 #define AML_DEVICE_OP (u16) 0x5b82 @@ -178,8 +178,7 @@ #define AML_THERMAL_ZONE_OP (u16) 0x5b85 #define AML_INDEX_FIELD_OP (u16) 0x5b86 #define AML_BANK_FIELD_OP (u16) 0x5b87 -#define AML_DATA_REGION_OP (u16) 0x5b88 /* ACPI 2.0 */ - +#define AML_DATA_REGION_OP (u16) 0x5b88 /* ACPI 2.0 */ /* Bogus opcodes (they are actually two separate opcodes) */ @@ -187,7 +186,6 @@ #define AML_LLESSEQUAL_OP (u16) 0x9294 #define AML_LNOTEQUAL_OP (u16) 0x9293 - /* * Internal opcodes * Use only "Unknown" AML opcodes, don't attempt to use @@ -203,7 +201,6 @@ #define AML_INT_RETURN_VALUE_OP (u16) 0x0036 #define AML_INT_EVAL_SUBTREE_OP (u16) 0x0037 - #define ARG_NONE 0x0 /* @@ -245,7 +242,7 @@ /* Single, simple types */ -#define ARGI_ANYTYPE 0x01 /* Don't care */ +#define ARGI_ANYTYPE 0x01 /* Don't care */ #define ARGI_PACKAGE 0x02 #define ARGI_EVENT 0x03 #define ARGI_MUTEX 0x04 @@ -256,8 +253,8 @@ #define ARGI_INTEGER 0x06 #define ARGI_STRING 0x07 #define ARGI_BUFFER 0x08 -#define ARGI_BUFFER_OR_STRING 0x09 /* Used by MID op only */ -#define ARGI_COMPUTEDATA 0x0A /* Buffer, String, or Integer */ +#define ARGI_BUFFER_OR_STRING 0x09 /* Used by MID op only */ +#define ARGI_COMPUTEDATA 0x0A /* Buffer, String, or Integer */ /* Reference objects */ @@ -265,30 +262,28 @@ #define ARGI_OBJECT_REF 0x0C #define ARGI_DEVICE_REF 0x0D #define ARGI_REFERENCE 0x0E -#define ARGI_TARGETREF 0x0F /* Target, subject to implicit conversion */ -#define ARGI_FIXED_TARGET 0x10 /* Target, no implicit conversion */ -#define ARGI_SIMPLE_TARGET 0x11 /* Name, Local, Arg -- no implicit conversion */ +#define ARGI_TARGETREF 0x0F /* Target, subject to implicit conversion */ +#define ARGI_FIXED_TARGET 0x10 /* Target, no implicit conversion */ +#define ARGI_SIMPLE_TARGET 0x11 /* Name, Local, Arg -- no implicit conversion */ /* Multiple/complex types */ -#define ARGI_DATAOBJECT 0x12 /* Buffer, String, package or reference to a Node - Used only by size_of operator*/ -#define ARGI_COMPLEXOBJ 0x13 /* Buffer, String, or package (Used by INDEX op only) */ -#define ARGI_REF_OR_STRING 0x14 /* Reference or String (Used by DEREFOF op only) */ -#define ARGI_REGION_OR_FIELD 0x15 /* Used by LOAD op only */ +#define ARGI_DATAOBJECT 0x12 /* Buffer, String, package or reference to a Node - Used only by size_of operator */ +#define ARGI_COMPLEXOBJ 0x13 /* Buffer, String, or package (Used by INDEX op only) */ +#define ARGI_REF_OR_STRING 0x14 /* Reference or String (Used by DEREFOF op only) */ +#define ARGI_REGION_OR_FIELD 0x15 /* Used by LOAD op only */ #define ARGI_DATAREFOBJ 0x16 /* Note: types above can expand to 0x1F maximum */ #define ARGI_INVALID_OPCODE 0xFFFFFFFF - /* * hash offsets */ #define AML_EXTOP_HASH_OFFSET 22 #define AML_LNOT_HASH_OFFSET 19 - /* * opcode groups and types */ @@ -296,7 +291,6 @@ #define OPGRP_FIELD 0x02 #define OPGRP_BYTELIST 0x04 - /* * Opcode information */ @@ -322,31 +316,30 @@ /* Convenient flag groupings */ #define AML_FLAGS_EXEC_0A_0T_1R AML_HAS_RETVAL -#define AML_FLAGS_EXEC_1A_0T_0R AML_HAS_ARGS /* Monadic1 */ -#define AML_FLAGS_EXEC_1A_0T_1R AML_HAS_ARGS | AML_HAS_RETVAL /* Monadic2 */ +#define AML_FLAGS_EXEC_1A_0T_0R AML_HAS_ARGS /* Monadic1 */ +#define AML_FLAGS_EXEC_1A_0T_1R AML_HAS_ARGS | AML_HAS_RETVAL /* Monadic2 */ #define AML_FLAGS_EXEC_1A_1T_0R AML_HAS_ARGS | AML_HAS_TARGET -#define AML_FLAGS_EXEC_1A_1T_1R AML_HAS_ARGS | AML_HAS_TARGET | AML_HAS_RETVAL /* monadic2_r */ -#define AML_FLAGS_EXEC_2A_0T_0R AML_HAS_ARGS /* Dyadic1 */ -#define AML_FLAGS_EXEC_2A_0T_1R AML_HAS_ARGS | AML_HAS_RETVAL /* Dyadic2 */ -#define AML_FLAGS_EXEC_2A_1T_1R AML_HAS_ARGS | AML_HAS_TARGET | AML_HAS_RETVAL /* dyadic2_r */ +#define AML_FLAGS_EXEC_1A_1T_1R AML_HAS_ARGS | AML_HAS_TARGET | AML_HAS_RETVAL /* monadic2_r */ +#define AML_FLAGS_EXEC_2A_0T_0R AML_HAS_ARGS /* Dyadic1 */ +#define AML_FLAGS_EXEC_2A_0T_1R AML_HAS_ARGS | AML_HAS_RETVAL /* Dyadic2 */ +#define AML_FLAGS_EXEC_2A_1T_1R AML_HAS_ARGS | AML_HAS_TARGET | AML_HAS_RETVAL /* dyadic2_r */ #define AML_FLAGS_EXEC_2A_2T_1R AML_HAS_ARGS | AML_HAS_TARGET | AML_HAS_RETVAL #define AML_FLAGS_EXEC_3A_0T_0R AML_HAS_ARGS #define AML_FLAGS_EXEC_3A_1T_1R AML_HAS_ARGS | AML_HAS_TARGET | AML_HAS_RETVAL #define AML_FLAGS_EXEC_6A_0T_1R AML_HAS_ARGS | AML_HAS_RETVAL - /* * The opcode Type is used in a dispatch table, do not change * without updating the table. */ #define AML_TYPE_EXEC_0A_0T_1R 0x00 -#define AML_TYPE_EXEC_1A_0T_0R 0x01 /* Monadic1 */ -#define AML_TYPE_EXEC_1A_0T_1R 0x02 /* Monadic2 */ +#define AML_TYPE_EXEC_1A_0T_0R 0x01 /* Monadic1 */ +#define AML_TYPE_EXEC_1A_0T_1R 0x02 /* Monadic2 */ #define AML_TYPE_EXEC_1A_1T_0R 0x03 -#define AML_TYPE_EXEC_1A_1T_1R 0x04 /* monadic2_r */ -#define AML_TYPE_EXEC_2A_0T_0R 0x05 /* Dyadic1 */ -#define AML_TYPE_EXEC_2A_0T_1R 0x06 /* Dyadic2 */ -#define AML_TYPE_EXEC_2A_1T_1R 0x07 /* dyadic2_r */ +#define AML_TYPE_EXEC_1A_1T_1R 0x04 /* monadic2_r */ +#define AML_TYPE_EXEC_2A_0T_0R 0x05 /* Dyadic1 */ +#define AML_TYPE_EXEC_2A_0T_1R 0x06 /* Dyadic2 */ +#define AML_TYPE_EXEC_2A_1T_1R 0x07 /* dyadic2_r */ #define AML_TYPE_EXEC_2A_2T_1R 0x08 #define AML_TYPE_EXEC_3A_0T_0R 0x09 #define AML_TYPE_EXEC_3A_1T_1R 0x0A @@ -399,40 +392,33 @@ #define AML_CLASS_METHOD_CALL 0x09 #define AML_CLASS_UNKNOWN 0x0A - /* Predefined Operation Region space_iDs */ -typedef enum -{ - REGION_MEMORY = 0, +typedef enum { + REGION_MEMORY = 0, REGION_IO, REGION_PCI_CONFIG, REGION_EC, REGION_SMBUS, REGION_CMOS, REGION_PCI_BAR, - REGION_DATA_TABLE, /* Internal use only */ - REGION_FIXED_HW = 0x7F - + REGION_DATA_TABLE, /* Internal use only */ + REGION_FIXED_HW = 0x7F } AML_REGION_TYPES; - /* Comparison operation codes for match_op operator */ -typedef enum -{ - MATCH_MTR = 0, - MATCH_MEQ = 1, - MATCH_MLE = 2, - MATCH_MLT = 3, - MATCH_MGE = 4, - MATCH_MGT = 5 - +typedef enum { + MATCH_MTR = 0, + MATCH_MEQ = 1, + MATCH_MLE = 2, + MATCH_MLT = 3, + MATCH_MGE = 4, + MATCH_MGT = 5 } AML_MATCH_OPERATOR; #define MAX_MATCH_OPERATOR 5 - /* * field_flags * @@ -450,60 +436,47 @@ typedef enum #define AML_FIELD_LOCK_RULE_MASK 0x10 #define AML_FIELD_UPDATE_RULE_MASK 0x60 - /* 1) Field Access Types */ -typedef enum -{ - AML_FIELD_ACCESS_ANY = 0x00, - AML_FIELD_ACCESS_BYTE = 0x01, - AML_FIELD_ACCESS_WORD = 0x02, - AML_FIELD_ACCESS_DWORD = 0x03, - AML_FIELD_ACCESS_QWORD = 0x04, /* ACPI 2.0 */ - AML_FIELD_ACCESS_BUFFER = 0x05 /* ACPI 2.0 */ - +typedef enum { + AML_FIELD_ACCESS_ANY = 0x00, + AML_FIELD_ACCESS_BYTE = 0x01, + AML_FIELD_ACCESS_WORD = 0x02, + AML_FIELD_ACCESS_DWORD = 0x03, + AML_FIELD_ACCESS_QWORD = 0x04, /* ACPI 2.0 */ + AML_FIELD_ACCESS_BUFFER = 0x05 /* ACPI 2.0 */ } AML_ACCESS_TYPE; - /* 2) Field Lock Rules */ -typedef enum -{ - AML_FIELD_LOCK_NEVER = 0x00, - AML_FIELD_LOCK_ALWAYS = 0x10 - +typedef enum { + AML_FIELD_LOCK_NEVER = 0x00, + AML_FIELD_LOCK_ALWAYS = 0x10 } AML_LOCK_RULE; - /* 3) Field Update Rules */ -typedef enum -{ - AML_FIELD_UPDATE_PRESERVE = 0x00, - AML_FIELD_UPDATE_WRITE_AS_ONES = 0x20, +typedef enum { + AML_FIELD_UPDATE_PRESERVE = 0x00, + AML_FIELD_UPDATE_WRITE_AS_ONES = 0x20, AML_FIELD_UPDATE_WRITE_AS_ZEROS = 0x40 - } AML_UPDATE_RULE; - /* * Field Access Attributes. * This byte is extracted from the AML via the * access_as keyword */ -typedef enum -{ - AML_FIELD_ATTRIB_SMB_QUICK = 0x02, - AML_FIELD_ATTRIB_SMB_SEND_RCV = 0x04, - AML_FIELD_ATTRIB_SMB_BYTE = 0x06, - AML_FIELD_ATTRIB_SMB_WORD = 0x08, - AML_FIELD_ATTRIB_SMB_BLOCK = 0x0A, - AML_FIELD_ATTRIB_SMB_WORD_CALL = 0x0C, +typedef enum { + AML_FIELD_ATTRIB_SMB_QUICK = 0x02, + AML_FIELD_ATTRIB_SMB_SEND_RCV = 0x04, + AML_FIELD_ATTRIB_SMB_BYTE = 0x06, + AML_FIELD_ATTRIB_SMB_WORD = 0x08, + AML_FIELD_ATTRIB_SMB_BLOCK = 0x0A, + AML_FIELD_ATTRIB_SMB_WORD_CALL = 0x0C, AML_FIELD_ATTRIB_SMB_BLOCK_CALL = 0x0D - } AML_ACCESS_ATTRIBUTE; - /* Bit fields in method_flags byte */ #define AML_METHOD_ARG_COUNT 0x07 @@ -516,5 +489,4 @@ typedef enum #define AML_METHOD_RESERVED1 0x02 #define AML_METHOD_RESERVED2 0x04 - -#endif /* __AMLCODE_H__ */ +#endif /* __AMLCODE_H__ */ diff --git a/include/acpi/amlresrc.h b/include/acpi/amlresrc.h index b20ec303df0..051786e4b21 100644 --- a/include/acpi/amlresrc.h +++ b/include/acpi/amlresrc.h @@ -42,29 +42,27 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #ifndef __AMLRESRC_H #define __AMLRESRC_H - #define ASL_RESNAME_ADDRESS "_ADR" #define ASL_RESNAME_ALIGNMENT "_ALN" #define ASL_RESNAME_ADDRESSSPACE "_ASI" #define ASL_RESNAME_ACCESSSIZE "_ASZ" #define ASL_RESNAME_TYPESPECIFICATTRIBUTES "_ATT" #define ASL_RESNAME_BASEADDRESS "_BAS" -#define ASL_RESNAME_BUSMASTER "_BM_" /* Master(1), Slave(0) */ +#define ASL_RESNAME_BUSMASTER "_BM_" /* Master(1), Slave(0) */ #define ASL_RESNAME_DECODE "_DEC" #define ASL_RESNAME_DMA "_DMA" -#define ASL_RESNAME_DMATYPE "_TYP" /* Compatible(0), A(1), B(2), F(3) */ +#define ASL_RESNAME_DMATYPE "_TYP" /* Compatible(0), A(1), B(2), F(3) */ #define ASL_RESNAME_GRANULARITY "_GRA" #define ASL_RESNAME_INTERRUPT "_INT" -#define ASL_RESNAME_INTERRUPTLEVEL "_LL_" /* active_lo(1), active_hi(0) */ -#define ASL_RESNAME_INTERRUPTSHARE "_SHR" /* Shareable(1), no_share(0) */ -#define ASL_RESNAME_INTERRUPTTYPE "_HE_" /* Edge(1), Level(0) */ +#define ASL_RESNAME_INTERRUPTLEVEL "_LL_" /* active_lo(1), active_hi(0) */ +#define ASL_RESNAME_INTERRUPTSHARE "_SHR" /* Shareable(1), no_share(0) */ +#define ASL_RESNAME_INTERRUPTTYPE "_HE_" /* Edge(1), Level(0) */ #define ASL_RESNAME_LENGTH "_LEN" -#define ASL_RESNAME_MEMATTRIBUTES "_MTP" /* Memory(0), Reserved(1), ACPI(2), NVS(3) */ -#define ASL_RESNAME_MEMTYPE "_MEM" /* non_cache(0), Cacheable(1) Cache+combine(2), Cache+prefetch(3) */ +#define ASL_RESNAME_MEMATTRIBUTES "_MTP" /* Memory(0), Reserved(1), ACPI(2), NVS(3) */ +#define ASL_RESNAME_MEMTYPE "_MEM" /* non_cache(0), Cacheable(1) Cache+combine(2), Cache+prefetch(3) */ #define ASL_RESNAME_MAXADDR "_MAX" #define ASL_RESNAME_MINADDR "_MIN" #define ASL_RESNAME_MAXTYPE "_MAF" @@ -72,12 +70,11 @@ #define ASL_RESNAME_REGISTERBITOFFSET "_RBO" #define ASL_RESNAME_REGISTERBITWIDTH "_RBW" #define ASL_RESNAME_RANGETYPE "_RNG" -#define ASL_RESNAME_READWRITETYPE "_RW_" /* read_only(0), Writeable (1) */ +#define ASL_RESNAME_READWRITETYPE "_RW_" /* read_only(0), Writeable (1) */ #define ASL_RESNAME_TRANSLATION "_TRA" -#define ASL_RESNAME_TRANSTYPE "_TRS" /* Sparse(1), Dense(0) */ -#define ASL_RESNAME_TYPE "_TTP" /* Translation(1), Static (0) */ -#define ASL_RESNAME_XFERTYPE "_SIz" /* 8(0), 8_and16(1), 16(2) */ - +#define ASL_RESNAME_TRANSTYPE "_TRS" /* Sparse(1), Dense(0) */ +#define ASL_RESNAME_TYPE "_TTP" /* Translation(1), Static (0) */ +#define ASL_RESNAME_XFERTYPE "_SIz" /* 8(0), 8_and16(1), 16(2) */ /* Default sizes for "small" resource descriptors */ @@ -89,15 +86,12 @@ #define ASL_RDESC_FIXED_IO_SIZE 0x03 #define ASL_RDESC_END_TAG_SIZE 0x01 - -struct asl_resource_node -{ - u32 buffer_length; - void *buffer; - struct asl_resource_node *next; +struct asl_resource_node { + u32 buffer_length; + void *buffer; + struct asl_resource_node *next; }; - /* * Resource descriptors defined in the ACPI specification. * @@ -106,214 +100,175 @@ struct asl_resource_node */ #pragma pack(1) -struct asl_irq_format_desc -{ - u8 descriptor_type; - u16 irq_mask; - u8 flags; +struct asl_irq_format_desc { + u8 descriptor_type; + u16 irq_mask; + u8 flags; }; - -struct asl_irq_noflags_desc -{ - u8 descriptor_type; - u16 irq_mask; +struct asl_irq_noflags_desc { + u8 descriptor_type; + u16 irq_mask; }; - -struct asl_dma_format_desc -{ - u8 descriptor_type; - u8 dma_channel_mask; - u8 flags; +struct asl_dma_format_desc { + u8 descriptor_type; + u8 dma_channel_mask; + u8 flags; }; - -struct asl_start_dependent_desc -{ - u8 descriptor_type; - u8 flags; +struct asl_start_dependent_desc { + u8 descriptor_type; + u8 flags; }; - -struct asl_start_dependent_noprio_desc -{ - u8 descriptor_type; +struct asl_start_dependent_noprio_desc { + u8 descriptor_type; }; - -struct asl_end_dependent_desc -{ - u8 descriptor_type; +struct asl_end_dependent_desc { + u8 descriptor_type; }; - -struct asl_io_port_desc -{ - u8 descriptor_type; - u8 information; - u16 address_min; - u16 address_max; - u8 alignment; - u8 length; +struct asl_io_port_desc { + u8 descriptor_type; + u8 information; + u16 address_min; + u16 address_max; + u8 alignment; + u8 length; }; - -struct asl_fixed_io_port_desc -{ - u8 descriptor_type; - u16 base_address; - u8 length; +struct asl_fixed_io_port_desc { + u8 descriptor_type; + u16 base_address; + u8 length; }; - -struct asl_small_vendor_desc -{ - u8 descriptor_type; - u8 vendor_defined[7]; +struct asl_small_vendor_desc { + u8 descriptor_type; + u8 vendor_defined[7]; }; - -struct asl_end_tag_desc -{ - u8 descriptor_type; - u8 checksum; +struct asl_end_tag_desc { + u8 descriptor_type; + u8 checksum; }; - /* LARGE descriptors */ -struct asl_memory_24_desc -{ - u8 descriptor_type; - u16 length; - u8 information; - u16 address_min; - u16 address_max; - u16 alignment; - u16 range_length; +struct asl_memory_24_desc { + u8 descriptor_type; + u16 length; + u8 information; + u16 address_min; + u16 address_max; + u16 alignment; + u16 range_length; }; - -struct asl_large_vendor_desc -{ - u8 descriptor_type; - u16 length; - u8 vendor_defined[1]; +struct asl_large_vendor_desc { + u8 descriptor_type; + u16 length; + u8 vendor_defined[1]; }; - -struct asl_memory_32_desc -{ - u8 descriptor_type; - u16 length; - u8 information; - u32 address_min; - u32 address_max; - u32 alignment; - u32 range_length; +struct asl_memory_32_desc { + u8 descriptor_type; + u16 length; + u8 information; + u32 address_min; + u32 address_max; + u32 alignment; + u32 range_length; }; - -struct asl_fixed_memory_32_desc -{ - u8 descriptor_type; - u16 length; - u8 information; - u32 base_address; - u32 range_length; +struct asl_fixed_memory_32_desc { + u8 descriptor_type; + u16 length; + u8 information; + u32 base_address; + u32 range_length; }; - -struct asl_extended_address_desc -{ - u8 descriptor_type; - u16 length; - u8 resource_type; - u8 flags; - u8 specific_flags; - u8 revision_iD; - u8 reserved; - u64 granularity; - u64 address_min; - u64 address_max; - u64 translation_offset; - u64 address_length; - u64 type_specific_attributes; - u8 optional_fields[2]; /* Used for length calculation only */ +struct asl_extended_address_desc { + u8 descriptor_type; + u16 length; + u8 resource_type; + u8 flags; + u8 specific_flags; + u8 revision_iD; + u8 reserved; + u64 granularity; + u64 address_min; + u64 address_max; + u64 translation_offset; + u64 address_length; + u64 type_specific_attributes; + u8 optional_fields[2]; /* Used for length calculation only */ }; -#define ASL_EXTENDED_ADDRESS_DESC_REVISION 1 /* ACPI 3.0 */ - - -struct asl_qword_address_desc -{ - u8 descriptor_type; - u16 length; - u8 resource_type; - u8 flags; - u8 specific_flags; - u64 granularity; - u64 address_min; - u64 address_max; - u64 translation_offset; - u64 address_length; - u8 optional_fields[2]; +#define ASL_EXTENDED_ADDRESS_DESC_REVISION 1 /* ACPI 3.0 */ + +struct asl_qword_address_desc { + u8 descriptor_type; + u16 length; + u8 resource_type; + u8 flags; + u8 specific_flags; + u64 granularity; + u64 address_min; + u64 address_max; + u64 translation_offset; + u64 address_length; + u8 optional_fields[2]; }; - -struct asl_dword_address_desc -{ - u8 descriptor_type; - u16 length; - u8 resource_type; - u8 flags; - u8 specific_flags; - u32 granularity; - u32 address_min; - u32 address_max; - u32 translation_offset; - u32 address_length; - u8 optional_fields[2]; +struct asl_dword_address_desc { + u8 descriptor_type; + u16 length; + u8 resource_type; + u8 flags; + u8 specific_flags; + u32 granularity; + u32 address_min; + u32 address_max; + u32 translation_offset; + u32 address_length; + u8 optional_fields[2]; }; - -struct asl_word_address_desc -{ - u8 descriptor_type; - u16 length; - u8 resource_type; - u8 flags; - u8 specific_flags; - u16 granularity; - u16 address_min; - u16 address_max; - u16 translation_offset; - u16 address_length; - u8 optional_fields[2]; +struct asl_word_address_desc { + u8 descriptor_type; + u16 length; + u8 resource_type; + u8 flags; + u8 specific_flags; + u16 granularity; + u16 address_min; + u16 address_max; + u16 translation_offset; + u16 address_length; + u8 optional_fields[2]; }; - -struct asl_extended_xrupt_desc -{ - u8 descriptor_type; - u16 length; - u8 flags; - u8 table_length; - u32 interrupt_number[1]; +struct asl_extended_xrupt_desc { + u8 descriptor_type; + u16 length; + u8 flags; + u8 table_length; + u32 interrupt_number[1]; /* res_source_index, res_source optional fields follow */ }; - -struct asl_general_register_desc -{ - u8 descriptor_type; - u16 length; - u8 address_space_id; - u8 bit_width; - u8 bit_offset; - u8 access_size; /* ACPI 3.0, was Reserved */ - u64 address; +struct asl_general_register_desc { + u8 descriptor_type; + u16 length; + u8 address_space_id; + u8 bit_width; + u8 bit_offset; + u8 access_size; /* ACPI 3.0, was Reserved */ + u64 address; }; /* restore default alignment */ @@ -322,32 +277,29 @@ struct asl_general_register_desc /* Union of all resource descriptors, so we can allocate the worst case */ -union asl_resource_desc -{ - struct asl_irq_format_desc irq; - struct asl_dma_format_desc dma; - struct asl_start_dependent_desc std; - struct asl_end_dependent_desc end; - struct asl_io_port_desc iop; - struct asl_fixed_io_port_desc fio; - struct asl_small_vendor_desc smv; - struct asl_end_tag_desc et; - - struct asl_memory_24_desc M24; - struct asl_large_vendor_desc lgv; - struct asl_memory_32_desc M32; - struct asl_fixed_memory_32_desc F32; - struct asl_qword_address_desc qas; - struct asl_dword_address_desc das; - struct asl_word_address_desc was; - struct asl_extended_address_desc eas; - struct asl_extended_xrupt_desc exx; - struct asl_general_register_desc grg; - u32 u32_item; - u16 u16_item; - u8 U8item; +union asl_resource_desc { + struct asl_irq_format_desc irq; + struct asl_dma_format_desc dma; + struct asl_start_dependent_desc std; + struct asl_end_dependent_desc end; + struct asl_io_port_desc iop; + struct asl_fixed_io_port_desc fio; + struct asl_small_vendor_desc smv; + struct asl_end_tag_desc et; + + struct asl_memory_24_desc M24; + struct asl_large_vendor_desc lgv; + struct asl_memory_32_desc M32; + struct asl_fixed_memory_32_desc F32; + struct asl_qword_address_desc qas; + struct asl_dword_address_desc das; + struct asl_word_address_desc was; + struct asl_extended_address_desc eas; + struct asl_extended_xrupt_desc exx; + struct asl_general_register_desc grg; + u32 u32_item; + u16 u16_item; + u8 U8item; }; - #endif - diff --git a/include/acpi/container.h b/include/acpi/container.h index d716df04d9d..a703f14e049 100644 --- a/include/acpi/container.h +++ b/include/acpi/container.h @@ -9,5 +9,4 @@ struct acpi_container { int state; }; -#endif /* __ACPI_CONTAINER_H */ - +#endif /* __ACPI_CONTAINER_H */ diff --git a/include/acpi/pdc_intel.h b/include/acpi/pdc_intel.h index fd6730e4e56..91f4a12a99a 100644 --- a/include/acpi/pdc_intel.h +++ b/include/acpi/pdc_intel.h @@ -14,7 +14,6 @@ #define ACPI_PDC_SMP_T_SWCOORD (0x0080) #define ACPI_PDC_C_C1_FFH (0x0100) - #define ACPI_PDC_EST_CAPABILITY_SMP (ACPI_PDC_SMP_C1PT | \ ACPI_PDC_C_C1_HALT) @@ -25,5 +24,4 @@ ACPI_PDC_SMP_C1PT | \ ACPI_PDC_C_C1_HALT) -#endif /* __PDC_INTEL_H__ */ - +#endif /* __PDC_INTEL_H__ */ diff --git a/include/acpi/platform/acenv.h b/include/acpi/platform/acenv.h index bae1fbed097..16609c1ab2e 100644 --- a/include/acpi/platform/acenv.h +++ b/include/acpi/platform/acenv.h @@ -44,7 +44,6 @@ #ifndef __ACENV_H__ #define __ACENV_H__ - /* * Configuration for ACPI tools and utilities */ @@ -134,7 +133,7 @@ #elif defined(WIN64) #include "acwin64.h" -#elif defined(MSDOS) /* Must appear after WIN32 and WIN64 check */ +#elif defined(MSDOS) /* Must appear after WIN32 and WIN64 check */ #include "acdos16.h" #elif defined(__FreeBSD__) @@ -180,7 +179,6 @@ /*! [End] no source code translation !*/ - /* * Debugger threading model * Use single threaded if the entire subsystem is contained in an application @@ -199,8 +197,7 @@ #else #define DEBUGGER_THREADING DEBUGGER_MULTI_THREADED #endif -#endif /* !DEBUGGER_THREADING */ - +#endif /* !DEBUGGER_THREADING */ /****************************************************************************** * @@ -222,7 +219,7 @@ #include #include -#endif /* ACPI_USE_STANDARD_HEADERS */ +#endif /* ACPI_USE_STANDARD_HEADERS */ /* * We will be linking to the standard Clib functions @@ -260,18 +257,18 @@ *****************************************************************************/ /* - * Use local definitions of C library macros and functions - * NOTE: The function implementations may not be as efficient - * as an inline or assembly code implementation provided by a - * native C library. - */ + * Use local definitions of C library macros and functions + * NOTE: The function implementations may not be as efficient + * as an inline or assembly code implementation provided by a + * native C library. + */ #ifndef va_arg #ifndef _VALIST #define _VALIST typedef char *va_list; -#endif /* _VALIST */ +#endif /* _VALIST */ /* * Storage alignment properties @@ -287,8 +284,7 @@ typedef char *va_list; #define va_end(ap) (void) 0 #define va_start(ap, A) (void) ((ap) = (((char *) &(A)) + (_bnd (A,_AUPBND)))) -#endif /* va_arg */ - +#endif /* va_arg */ #define ACPI_STRSTR(s1,s2) acpi_ut_strstr ((s1), (s2)) #define ACPI_STRCHR(s1,c) acpi_ut_strchr ((s1), (c)) @@ -306,8 +302,7 @@ typedef char *va_list; #define ACPI_TOUPPER acpi_ut_to_upper #define ACPI_TOLOWER acpi_ut_to_lower -#endif /* ACPI_USE_SYSTEM_CLIBRARY */ - +#endif /* ACPI_USE_SYSTEM_CLIBRARY */ /****************************************************************************** * @@ -348,8 +343,7 @@ typedef char *va_list; #define ACPI_ACQUIRE_GLOBAL_LOCK(Glptr, acq) #define ACPI_RELEASE_GLOBAL_LOCK(Glptr, acq) -#endif /* ACPI_ASM_MACROS */ - +#endif /* ACPI_ASM_MACROS */ #ifdef ACPI_APPLICATION @@ -359,11 +353,10 @@ typedef char *va_list; #define BREAKPOINT3 #endif - /****************************************************************************** * * Compiler-specific information is contained in the compiler-specific * headers. * *****************************************************************************/ -#endif /* __ACENV_H__ */ +#endif /* __ACENV_H__ */ diff --git a/include/acpi/platform/acgcc.h b/include/acpi/platform/acgcc.h index 39264127574..4c0e0ba09ba 100644 --- a/include/acpi/platform/acgcc.h +++ b/include/acpi/platform/acgcc.h @@ -60,4 +60,4 @@ */ #define ACPI_UNUSED_VAR __attribute__ ((unused)) -#endif /* __ACGCC_H__ */ +#endif /* __ACGCC_H__ */ diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h index 4fbc0fd52a2..c93e6562f0e 100644 --- a/include/acpi/platform/aclinux.h +++ b/include/acpi/platform/aclinux.h @@ -71,9 +71,7 @@ #define acpi_cache_t kmem_cache_t #endif - - -#else /* !__KERNEL__ */ +#else /* !__KERNEL__ */ #include #include @@ -94,10 +92,10 @@ #define __cdecl #define ACPI_FLUSH_CPU_CACHE() -#endif /* __KERNEL__ */ +#endif /* __KERNEL__ */ /* Linux uses GCC */ #include "acgcc.h" -#endif /* __ACLINUX_H__ */ +#endif /* __ACLINUX_H__ */ diff --git a/include/acpi/processor.h b/include/acpi/processor.h index 50cfea4ff6c..7a00d5089de 100644 --- a/include/acpi/processor.h +++ b/include/acpi/processor.h @@ -23,45 +23,44 @@ struct acpi_processor_cx; struct acpi_power_register { - u8 descriptor; - u16 length; - u8 space_id; - u8 bit_width; - u8 bit_offset; - u8 reserved; - u64 address; + u8 descriptor; + u16 length; + u8 space_id; + u8 bit_width; + u8 bit_offset; + u8 reserved; + u64 address; } __attribute__ ((packed)); - struct acpi_processor_cx_policy { - u32 count; + u32 count; struct acpi_processor_cx *state; struct { - u32 time; - u32 ticks; - u32 count; - u32 bm; - } threshold; + u32 time; + u32 ticks; + u32 count; + u32 bm; + } threshold; }; struct acpi_processor_cx { - u8 valid; - u8 type; - u32 address; - u32 latency; - u32 latency_ticks; - u32 power; - u32 usage; + u8 valid; + u8 type; + u32 address; + u32 latency; + u32 latency_ticks; + u32 power; + u32 usage; struct acpi_processor_cx_policy promotion; struct acpi_processor_cx_policy demotion; }; struct acpi_processor_power { struct acpi_processor_cx *state; - unsigned long bm_check_timestamp; - u32 default_state; - u32 bm_activity; - int count; + unsigned long bm_check_timestamp; + u32 default_state; + u32 bm_activity; + int count; struct acpi_processor_cx states[ACPI_PROCESSOR_MAX_POWER]; /* the _PDC objects passed by the driver, if any */ @@ -71,85 +70,82 @@ struct acpi_processor_power { /* Performance Management */ struct acpi_pct_register { - u8 descriptor; - u16 length; - u8 space_id; - u8 bit_width; - u8 bit_offset; - u8 reserved; - u64 address; + u8 descriptor; + u16 length; + u8 space_id; + u8 bit_width; + u8 bit_offset; + u8 reserved; + u64 address; } __attribute__ ((packed)); struct acpi_processor_px { - acpi_integer core_frequency; /* megahertz */ - acpi_integer power; /* milliWatts */ - acpi_integer transition_latency; /* microseconds */ - acpi_integer bus_master_latency; /* microseconds */ - acpi_integer control; /* control value */ - acpi_integer status; /* success indicator */ + acpi_integer core_frequency; /* megahertz */ + acpi_integer power; /* milliWatts */ + acpi_integer transition_latency; /* microseconds */ + acpi_integer bus_master_latency; /* microseconds */ + acpi_integer control; /* control value */ + acpi_integer status; /* success indicator */ }; struct acpi_processor_performance { - unsigned int state; - unsigned int platform_limit; + unsigned int state; + unsigned int platform_limit; struct acpi_pct_register control_register; struct acpi_pct_register status_register; - unsigned int state_count; + unsigned int state_count; struct acpi_processor_px *states; /* the _PDC objects passed by the driver, if any */ struct acpi_object_list *pdc; }; - - /* Throttling Control */ struct acpi_processor_tx { - u16 power; - u16 performance; + u16 power; + u16 performance; }; struct acpi_processor_throttling { - int state; - u32 address; - u8 duty_offset; - u8 duty_width; - int state_count; + int state; + u32 address; + u8 duty_offset; + u8 duty_width; + int state_count; struct acpi_processor_tx states[ACPI_PROCESSOR_MAX_THROTTLING]; }; /* Limit Interface */ struct acpi_processor_lx { - int px; /* performace state */ - int tx; /* throttle level */ + int px; /* performace state */ + int tx; /* throttle level */ }; struct acpi_processor_limit { - struct acpi_processor_lx state; /* current limit */ + struct acpi_processor_lx state; /* current limit */ struct acpi_processor_lx thermal; /* thermal limit */ - struct acpi_processor_lx user; /* user limit */ + struct acpi_processor_lx user; /* user limit */ }; - struct acpi_processor_flags { - u8 power:1; - u8 performance:1; - u8 throttling:1; - u8 limit:1; - u8 bm_control:1; - u8 bm_check:1; - u8 has_cst:1; - u8 power_setup_done:1; + u8 power:1; + u8 performance:1; + u8 throttling:1; + u8 limit:1; + u8 bm_control:1; + u8 bm_check:1; + u8 has_cst:1; + u8 power_setup_done:1; }; struct acpi_processor { - acpi_handle handle; - u32 acpi_id; - u32 id; - u32 pblk; - int performance_platform_limit; + acpi_handle handle; + u32 acpi_id; + u32 id; + u32 pblk; + int performance_platform_limit; struct acpi_processor_flags flags; struct acpi_processor_power power; struct acpi_processor_performance *performance; @@ -158,50 +154,49 @@ struct acpi_processor { }; struct acpi_processor_errata { - u8 smp; + u8 smp; struct { - u8 throttle:1; - u8 fdma:1; - u8 reserved:6; - u32 bmisx; - } piix4; + u8 throttle:1; + u8 fdma:1; + u8 reserved:6; + u32 bmisx; + } piix4; }; -extern int acpi_processor_register_performance ( - struct acpi_processor_performance * performance, - unsigned int cpu); -extern void acpi_processor_unregister_performance ( - struct acpi_processor_performance * performance, - unsigned int cpu); +extern int acpi_processor_register_performance(struct acpi_processor_performance + *performance, unsigned int cpu); +extern void acpi_processor_unregister_performance(struct + acpi_processor_performance + *performance, + unsigned int cpu); /* note: this locks both the calling module and the processor module if a _PPC object exists, rmmod is disallowed then */ int acpi_processor_notify_smm(struct module *calling_module); - - /* for communication between multiple parts of the processor kernel module */ -extern struct acpi_processor *processors[NR_CPUS]; +extern struct acpi_processor *processors[NR_CPUS]; extern struct acpi_processor_errata errata; int acpi_processor_set_pdc(struct acpi_processor *pr, - struct acpi_object_list *pdc_in); + struct acpi_object_list *pdc_in); #ifdef ARCH_HAS_POWER_PDC_INIT void acpi_processor_power_init_pdc(struct acpi_processor_power *pow, - unsigned int cpu); + unsigned int cpu); void acpi_processor_power_init_bm_check(struct acpi_processor_flags *flags, - unsigned int cpu); + unsigned int cpu); #else -static inline void acpi_processor_power_init_pdc( - struct acpi_processor_power *pow, unsigned int cpu) +static inline void acpi_processor_power_init_pdc(struct acpi_processor_power + *pow, unsigned int cpu) { pow->pdc = NULL; return; } -static inline void acpi_processor_power_init_bm_check( - struct acpi_processor_flags *flags, unsigned int cpu) +static inline void acpi_processor_power_init_bm_check(struct + acpi_processor_flags + *flags, unsigned int cpu) { flags->bm_check = 1; return; @@ -215,51 +210,62 @@ void acpi_processor_ppc_init(void); void acpi_processor_ppc_exit(void); int acpi_processor_ppc_has_changed(struct acpi_processor *pr); #else -static inline void acpi_processor_ppc_init(void) { return; } -static inline void acpi_processor_ppc_exit(void) { return; } -static inline int acpi_processor_ppc_has_changed(struct acpi_processor *pr) { +static inline void acpi_processor_ppc_init(void) +{ + return; +} +static inline void acpi_processor_ppc_exit(void) +{ + return; +} +static inline int acpi_processor_ppc_has_changed(struct acpi_processor *pr) +{ static unsigned int printout = 1; if (printout) { - printk(KERN_WARNING "Warning: Processor Platform Limit event detected, but not handled.\n"); - printk(KERN_WARNING "Consider compiling CPUfreq support into your kernel.\n"); + printk(KERN_WARNING + "Warning: Processor Platform Limit event detected, but not handled.\n"); + printk(KERN_WARNING + "Consider compiling CPUfreq support into your kernel.\n"); printout = 0; } return 0; } -#endif /* CONFIG_CPU_FREQ */ +#endif /* CONFIG_CPU_FREQ */ /* in processor_throttling.c */ -int acpi_processor_get_throttling_info (struct acpi_processor *pr); -int acpi_processor_set_throttling (struct acpi_processor *pr, int state); -ssize_t acpi_processor_write_throttling ( - struct file *file, - const char __user *buffer, - size_t count, - loff_t *data); +int acpi_processor_get_throttling_info(struct acpi_processor *pr); +int acpi_processor_set_throttling(struct acpi_processor *pr, int state); +ssize_t acpi_processor_write_throttling(struct file *file, + const char __user * buffer, + size_t count, loff_t * data); extern struct file_operations acpi_processor_throttling_fops; /* in processor_idle.c */ -int acpi_processor_power_init(struct acpi_processor *pr, struct acpi_device *device); -int acpi_processor_cst_has_changed (struct acpi_processor *pr); -int acpi_processor_power_exit(struct acpi_processor *pr, struct acpi_device *device); - +int acpi_processor_power_init(struct acpi_processor *pr, + struct acpi_device *device); +int acpi_processor_cst_has_changed(struct acpi_processor *pr); +int acpi_processor_power_exit(struct acpi_processor *pr, + struct acpi_device *device); /* in processor_thermal.c */ -int acpi_processor_get_limit_info (struct acpi_processor *pr); -ssize_t acpi_processor_write_limit ( - struct file *file, - const char __user *buffer, - size_t count, - loff_t *data); +int acpi_processor_get_limit_info(struct acpi_processor *pr); +ssize_t acpi_processor_write_limit(struct file *file, + const char __user * buffer, + size_t count, loff_t * data); extern struct file_operations acpi_processor_limit_fops; #ifdef CONFIG_CPU_FREQ void acpi_thermal_cpufreq_init(void); void acpi_thermal_cpufreq_exit(void); #else -static inline void acpi_thermal_cpufreq_init(void) { return; } -static inline void acpi_thermal_cpufreq_exit(void) { return; } +static inline void acpi_thermal_cpufreq_init(void) +{ + return; +} +static inline void acpi_thermal_cpufreq_exit(void) +{ + return; +} #endif - #endif -- cgit v1.2.3-70-g09d2 From b21a41385118f9a6af3cd96ce71090c5ada52eb5 Mon Sep 17 00:00:00 2001 From: James Bottomley Date: Fri, 5 Aug 2005 21:45:40 -0500 Subject: [SCSI] add global timeout to the scsi mid-layer There are certain rogue devices (and the aic7xxx driver) that return BUSY or QUEUE_FULL forever. This code will apply a global timeout (of the total number of retries times the per command timer) to a given command. If it is exceeded, the command is completed regardless of its state. The patch also removes the unused field in the command: timeout and timeout_total. This solves the problem of detecting an endless loop in the mid-layer because of BUSY/QUEUE_FULL bouncing, but will not recover the device. In the aic7xxx case, the driver can be recovered by sending a bus reset, so possibly this should be tied into the error handler? Signed-off-by: James Bottomley --- drivers/scsi/advansys.c | 4 ++-- drivers/scsi/scsi.c | 15 +++++++++++++++ include/scsi/scsi_cmnd.h | 8 ++++++-- 3 files changed, 23 insertions(+), 4 deletions(-) (limited to 'include') diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c index 0fb93363eb2..37ec5411e32 100644 --- a/drivers/scsi/advansys.c +++ b/drivers/scsi/advansys.c @@ -9200,8 +9200,8 @@ asc_prt_scsi_cmnd(struct scsi_cmnd *s) (unsigned) s->serial_number, s->retries, s->allowed); printk( -" timeout_per_command %d, timeout_total %d, timeout %d\n", - s->timeout_per_command, s->timeout_total, s->timeout); +" timeout_per_command %d\n", + s->timeout_per_command); printk( " scsi_done 0x%lx, done 0x%lx, host_scribble 0x%lx, result 0x%x\n", diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c index d1aa95d45a7..4befbc275f9 100644 --- a/drivers/scsi/scsi.c +++ b/drivers/scsi/scsi.c @@ -268,6 +268,7 @@ struct scsi_cmnd *scsi_get_command(struct scsi_device *dev, int gfp_mask) } else put_device(&dev->sdev_gendev); + cmd->jiffies_at_alloc = jiffies; return cmd; } EXPORT_SYMBOL(scsi_get_command); @@ -798,9 +799,23 @@ static void scsi_softirq(struct softirq_action *h) while (!list_empty(&local_q)) { struct scsi_cmnd *cmd = list_entry(local_q.next, struct scsi_cmnd, eh_entry); + /* The longest time any command should be outstanding is the + * per command timeout multiplied by the number of retries. + * + * For a typical command, this is 2.5 minutes */ + unsigned long wait_for + = cmd->allowed * cmd->timeout_per_command; list_del_init(&cmd->eh_entry); disposition = scsi_decide_disposition(cmd); + if (disposition != SUCCESS && + time_before(cmd->jiffies_at_alloc + wait_for, jiffies)) { + dev_printk(KERN_ERR, &cmd->device->sdev_gendev, + "timing out command, waited %ds\n", + wait_for/HZ); + disposition = SUCCESS; + } + scsi_log_completion(cmd, disposition); switch (disposition) { case SUCCESS: diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h index 9957f16dcc5..bed4b7c9be9 100644 --- a/include/scsi/scsi_cmnd.h +++ b/include/scsi/scsi_cmnd.h @@ -51,12 +51,16 @@ struct scsi_cmnd { * printk's to use ->pid, so that we can kill this field. */ unsigned long serial_number; + /* + * This is set to jiffies as it was when the command was first + * allocated. It is used to time how long the command has + * been outstanding + */ + unsigned long jiffies_at_alloc; int retries; int allowed; int timeout_per_command; - int timeout_total; - int timeout; unsigned char cmd_len; unsigned char old_cmd_len; -- cgit v1.2.3-70-g09d2 From 10c1b88987d618f4f89c10e11e574c76de73b5e7 Mon Sep 17 00:00:00 2001 From: James Bottomley Date: Sun, 14 Aug 2005 14:34:06 -0500 Subject: [SCSI] add ability to deny binding to SPI transport class This patch is necessary if we begin exposing underlying physical disks (which can attach to the SPI transport class) of the hardware RAID cards, since we don't want any SPI parameters binding to the RAID devices. Signed-off-by: James Bottomley --- drivers/scsi/scsi_transport_spi.c | 11 ++++++++++- include/scsi/scsi_transport_spi.h | 1 + 2 files changed, 11 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/drivers/scsi/scsi_transport_spi.c b/drivers/scsi/scsi_transport_spi.c index e7b9570c818..02134fce217 100644 --- a/drivers/scsi/scsi_transport_spi.c +++ b/drivers/scsi/scsi_transport_spi.c @@ -1082,6 +1082,7 @@ static int spi_device_match(struct attribute_container *cont, { struct scsi_device *sdev; struct Scsi_Host *shost; + struct spi_internal *i; if (!scsi_is_sdev_device(dev)) return 0; @@ -1094,6 +1095,9 @@ static int spi_device_match(struct attribute_container *cont, /* Note: this class has no device attributes, so it has * no per-HBA allocation and thus we don't need to distinguish * the attribute containers for the device */ + i = to_spi_internal(shost->transportt); + if (i->f->deny_binding && i->f->deny_binding(sdev->sdev_target)) + return 0; return 1; } @@ -1101,6 +1105,7 @@ static int spi_target_match(struct attribute_container *cont, struct device *dev) { struct Scsi_Host *shost; + struct scsi_target *starget; struct spi_internal *i; if (!scsi_is_target_device(dev)) @@ -1112,7 +1117,11 @@ static int spi_target_match(struct attribute_container *cont, return 0; i = to_spi_internal(shost->transportt); - + starget = to_scsi_target(dev); + + if (i->f->deny_binding && i->f->deny_binding(starget)) + return 0; + return &i->t.target_attrs.ac == cont; } diff --git a/include/scsi/scsi_transport_spi.h b/include/scsi/scsi_transport_spi.h index d8ef86006e0..6bdc4afb248 100644 --- a/include/scsi/scsi_transport_spi.h +++ b/include/scsi/scsi_transport_spi.h @@ -120,6 +120,7 @@ struct spi_function_template { void (*set_hold_mcs)(struct scsi_target *, int); void (*get_signalling)(struct Scsi_Host *); void (*set_signalling)(struct Scsi_Host *, enum spi_signal_type); + int (*deny_binding)(struct scsi_target *); /* The driver sets these to tell the transport class it * wants the attributes displayed in sysfs. If the show_ flag * is not set, the attribute will be private to the transport -- cgit v1.2.3-70-g09d2 From d0a7e574007fd547d72ec693bfa35778623d0738 Mon Sep 17 00:00:00 2001 From: James Bottomley Date: Sun, 14 Aug 2005 17:09:01 -0500 Subject: [SCSI] correct transport class abstraction to work outside SCSI I recently tried to construct a totally generic transport class and found there were certain features missing from the current abstract transport class. Most notable is that you have to hang the data on the class_device but most of the API is framed in terms of the generic device, not the class_device. These changes are two fold - Provide the class_device to all of the setup and configure APIs - Provide and extra API to take the device and the attribute class and return the corresponding class_device Signed-off-by: James Bottomley --- drivers/base/attribute_container.c | 38 +++++++++++++++++++++++++++++++++++++ drivers/base/transport_class.c | 17 +++++++++++------ drivers/scsi/scsi_transport_fc.c | 6 ++++-- drivers/scsi/scsi_transport_spi.c | 11 ++++++++--- include/linux/attribute_container.h | 9 +++------ include/linux/transport_class.h | 11 ++++++++--- 6 files changed, 72 insertions(+), 20 deletions(-) (limited to 'include') diff --git a/drivers/base/attribute_container.c b/drivers/base/attribute_container.c index ec615d854be..62c093db11e 100644 --- a/drivers/base/attribute_container.c +++ b/drivers/base/attribute_container.c @@ -58,6 +58,7 @@ attribute_container_register(struct attribute_container *cont) { INIT_LIST_HEAD(&cont->node); INIT_LIST_HEAD(&cont->containers); + spin_lock_init(&cont->containers_lock); down(&attribute_container_mutex); list_add_tail(&cont->node, &attribute_container_list); @@ -77,11 +78,13 @@ attribute_container_unregister(struct attribute_container *cont) { int retval = -EBUSY; down(&attribute_container_mutex); + spin_lock(&cont->containers_lock); if (!list_empty(&cont->containers)) goto out; retval = 0; list_del(&cont->node); out: + spin_unlock(&cont->containers_lock); up(&attribute_container_mutex); return retval; @@ -151,7 +154,9 @@ attribute_container_add_device(struct device *dev, fn(cont, dev, &ic->classdev); else attribute_container_add_class_device(&ic->classdev); + spin_lock(&cont->containers_lock); list_add_tail(&ic->node, &cont->containers); + spin_unlock(&cont->containers_lock); } up(&attribute_container_mutex); } @@ -189,6 +194,7 @@ attribute_container_remove_device(struct device *dev, if (!cont->match(cont, dev)) continue; + spin_lock(&cont->containers_lock); list_for_each_entry_safe(ic, tmp, &cont->containers, node) { if (dev != ic->classdev.dev) continue; @@ -200,6 +206,7 @@ attribute_container_remove_device(struct device *dev, class_device_unregister(&ic->classdev); } } + spin_unlock(&cont->containers_lock); } up(&attribute_container_mutex); } @@ -230,10 +237,12 @@ attribute_container_device_trigger(struct device *dev, if (!cont->match(cont, dev)) continue; + spin_lock(&cont->containers_lock); list_for_each_entry_safe(ic, tmp, &cont->containers, node) { if (dev == ic->classdev.dev) fn(cont, dev, &ic->classdev); } + spin_unlock(&cont->containers_lock); } up(&attribute_container_mutex); } @@ -368,6 +377,35 @@ attribute_container_class_device_del(struct class_device *classdev) } EXPORT_SYMBOL_GPL(attribute_container_class_device_del); +/** + * attribute_container_find_class_device - find the corresponding class_device + * + * @cont: the container + * @dev: the generic device + * + * Looks up the device in the container's list of class devices and returns + * the corresponding class_device. + */ +struct class_device * +attribute_container_find_class_device(struct attribute_container *cont, + struct device *dev) +{ + struct class_device *cdev = NULL; + struct internal_container *ic; + + spin_lock(&cont->containers_lock); + list_for_each_entry(ic, &cont->containers, node) { + if (ic->classdev.dev == dev) { + cdev = &ic->classdev; + break; + } + } + spin_unlock(&cont->containers_lock); + + return cdev; +} +EXPORT_SYMBOL_GPL(attribute_container_find_class_device); + int __init attribute_container_init(void) { diff --git a/drivers/base/transport_class.c b/drivers/base/transport_class.c index 6c2b447a333..4fb4c5de847 100644 --- a/drivers/base/transport_class.c +++ b/drivers/base/transport_class.c @@ -64,7 +64,9 @@ void transport_class_unregister(struct transport_class *tclass) } EXPORT_SYMBOL_GPL(transport_class_unregister); -static int anon_transport_dummy_function(struct device *dev) +static int anon_transport_dummy_function(struct transport_container *tc, + struct device *dev, + struct class_device *cdev) { /* do nothing */ return 0; @@ -115,9 +117,10 @@ static int transport_setup_classdev(struct attribute_container *cont, struct class_device *classdev) { struct transport_class *tclass = class_to_transport_class(cont->class); + struct transport_container *tcont = attribute_container_to_transport_container(cont); if (tclass->setup) - tclass->setup(dev); + tclass->setup(tcont, dev, classdev); return 0; } @@ -178,12 +181,14 @@ void transport_add_device(struct device *dev) EXPORT_SYMBOL_GPL(transport_add_device); static int transport_configure(struct attribute_container *cont, - struct device *dev) + struct device *dev, + struct class_device *cdev) { struct transport_class *tclass = class_to_transport_class(cont->class); + struct transport_container *tcont = attribute_container_to_transport_container(cont); if (tclass->configure) - tclass->configure(dev); + tclass->configure(tcont, dev, cdev); return 0; } @@ -202,7 +207,7 @@ static int transport_configure(struct attribute_container *cont, */ void transport_configure_device(struct device *dev) { - attribute_container_trigger(dev, transport_configure); + attribute_container_device_trigger(dev, transport_configure); } EXPORT_SYMBOL_GPL(transport_configure_device); @@ -215,7 +220,7 @@ static int transport_remove_classdev(struct attribute_container *cont, struct transport_class *tclass = class_to_transport_class(cont->class); if (tclass->remove) - tclass->remove(dev); + tclass->remove(tcont, dev, classdev); if (tclass->remove != anon_transport_dummy_function) { if (tcont->statistics) diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c index 35d1c1e8e34..96243c7fe11 100644 --- a/drivers/scsi/scsi_transport_fc.c +++ b/drivers/scsi/scsi_transport_fc.c @@ -252,7 +252,8 @@ struct fc_internal { #define to_fc_internal(tmpl) container_of(tmpl, struct fc_internal, t) -static int fc_target_setup(struct device *dev) +static int fc_target_setup(struct transport_container *tc, struct device *dev, + struct class_device *cdev) { struct scsi_target *starget = to_scsi_target(dev); struct fc_rport *rport = starget_to_rport(starget); @@ -281,7 +282,8 @@ static DECLARE_TRANSPORT_CLASS(fc_transport_class, NULL, NULL); -static int fc_host_setup(struct device *dev) +static int fc_host_setup(struct transport_container *tc, struct device *dev, + struct class_device *cdev) { struct Scsi_Host *shost = dev_to_shost(dev); diff --git a/drivers/scsi/scsi_transport_spi.c b/drivers/scsi/scsi_transport_spi.c index 02134fce217..89f6b7feb9c 100644 --- a/drivers/scsi/scsi_transport_spi.c +++ b/drivers/scsi/scsi_transport_spi.c @@ -162,7 +162,8 @@ static inline enum spi_signal_type spi_signal_to_value(const char *name) return SPI_SIGNAL_UNKNOWN; } -static int spi_host_setup(struct device *dev) +static int spi_host_setup(struct transport_container *tc, struct device *dev, + struct class_device *cdev) { struct Scsi_Host *shost = dev_to_shost(dev); @@ -196,7 +197,9 @@ static int spi_host_match(struct attribute_container *cont, return &i->t.host_attrs.ac == cont; } -static int spi_device_configure(struct device *dev) +static int spi_device_configure(struct transport_container *tc, + struct device *dev, + struct class_device *cdev) { struct scsi_device *sdev = to_scsi_device(dev); struct scsi_target *starget = sdev->sdev_target; @@ -214,7 +217,9 @@ static int spi_device_configure(struct device *dev) return 0; } -static int spi_setup_transport_attrs(struct device *dev) +static int spi_setup_transport_attrs(struct transport_container *tc, + struct device *dev, + struct class_device *cdev) { struct scsi_target *starget = to_scsi_target(dev); diff --git a/include/linux/attribute_container.h b/include/linux/attribute_container.h index af1010b6dab..f54b05b052b 100644 --- a/include/linux/attribute_container.h +++ b/include/linux/attribute_container.h @@ -11,10 +11,12 @@ #include #include +#include struct attribute_container { struct list_head node; struct list_head containers; + spinlock_t containers_lock; struct class *class; struct class_device_attribute **attrs; int (*match)(struct attribute_container *, struct device *); @@ -62,12 +64,7 @@ int attribute_container_add_class_device_adapter(struct attribute_container *con struct class_device *classdev); void attribute_container_remove_attrs(struct class_device *classdev); void attribute_container_class_device_del(struct class_device *classdev); - - - - - - +struct class_device *attribute_container_find_class_device(struct attribute_container *, struct device *); struct class_device_attribute **attribute_container_classdev_to_attrs(const struct class_device *classdev); #endif diff --git a/include/linux/transport_class.h b/include/linux/transport_class.h index 87d98d1faef..1d6cc22e5f4 100644 --- a/include/linux/transport_class.h +++ b/include/linux/transport_class.h @@ -12,11 +12,16 @@ #include #include +struct transport_container; + struct transport_class { struct class class; - int (*setup)(struct device *); - int (*configure)(struct device *); - int (*remove)(struct device *); + int (*setup)(struct transport_container *, struct device *, + struct class_device *); + int (*configure)(struct transport_container *, struct device *, + struct class_device *); + int (*remove)(struct transport_container *, struct device *, + struct class_device *); }; #define DECLARE_TRANSPORT_CLASS(cls, nm, su, rm, cfg) \ -- cgit v1.2.3-70-g09d2 From 888ba6c62bc61a995d283977eb3a6cbafd6f4ac6 Mon Sep 17 00:00:00 2001 From: Len Brown Date: Wed, 24 Aug 2005 12:07:20 -0400 Subject: [ACPI] delete CONFIG_ACPI_BOOT it has been a synonym for CONFIG_ACPI since 2.6.12 Signed-off-by: Len Brown --- arch/i386/Kconfig | 1 - arch/i386/defconfig | 1 - arch/i386/kernel/Makefile | 2 +- arch/i386/kernel/acpi/Makefile | 2 +- arch/i386/kernel/io_apic.c | 4 ++-- arch/i386/kernel/mpparse.c | 10 ++++------ arch/i386/kernel/setup.c | 8 ++++---- arch/i386/mach-es7000/es7000plat.c | 4 ++-- arch/ia64/configs/bigsur_defconfig | 1 - arch/ia64/configs/sn2_defconfig | 1 - arch/ia64/configs/tiger_defconfig | 1 - arch/ia64/configs/zx1_defconfig | 1 - arch/ia64/defconfig | 1 - arch/ia64/kernel/acpi.c | 4 ++-- arch/ia64/kernel/setup.c | 4 ++-- arch/ia64/kernel/topology.c | 2 +- arch/x86_64/Kconfig | 2 -- arch/x86_64/defconfig | 1 - arch/x86_64/kernel/Makefile | 2 +- arch/x86_64/kernel/acpi/Makefile | 4 ++-- arch/x86_64/kernel/io_apic.c | 4 ++-- arch/x86_64/kernel/mpparse.c | 10 ++++------ arch/x86_64/kernel/setup.c | 8 ++++---- drivers/Makefile | 2 +- drivers/acpi/Kconfig | 6 +----- drivers/acpi/Makefile | 2 +- include/asm-i386/acpi.h | 4 ++-- include/asm-i386/fixmap.h | 2 +- include/asm-i386/io_apic.h | 4 ++-- include/asm-i386/mpspec.h | 4 ++-- include/asm-x86_64/acpi.h | 6 +++--- include/asm-x86_64/io_apic.h | 2 +- include/asm-x86_64/mpspec.h | 2 +- include/linux/acpi.h | 6 +++--- 34 files changed, 50 insertions(+), 68 deletions(-) (limited to 'include') diff --git a/arch/i386/Kconfig b/arch/i386/Kconfig index 619d843ba23..9ba33490874 100644 --- a/arch/i386/Kconfig +++ b/arch/i386/Kconfig @@ -1203,7 +1203,6 @@ config PCI_DIRECT config PCI_MMCONFIG bool depends on PCI && ACPI && (PCI_GOMMCONFIG || PCI_GOANY) - select ACPI_BOOT default y source "drivers/pci/pcie/Kconfig" diff --git a/arch/i386/defconfig b/arch/i386/defconfig index ca07b95c06b..1c0076e22dd 100644 --- a/arch/i386/defconfig +++ b/arch/i386/defconfig @@ -131,7 +131,6 @@ CONFIG_SOFTWARE_SUSPEND=y # ACPI (Advanced Configuration and Power Interface) Support # CONFIG_ACPI=y -CONFIG_ACPI_BOOT=y CONFIG_ACPI_INTERPRETER=y CONFIG_ACPI_SLEEP=y CONFIG_ACPI_SLEEP_PROC_FS=y diff --git a/arch/i386/kernel/Makefile b/arch/i386/kernel/Makefile index 4cc83b322b3..c52b4fad011 100644 --- a/arch/i386/kernel/Makefile +++ b/arch/i386/kernel/Makefile @@ -11,7 +11,7 @@ obj-y := process.o semaphore.o signal.o entry.o traps.o irq.o vm86.o \ obj-y += cpu/ obj-y += timers/ -obj-$(CONFIG_ACPI_BOOT) += acpi/ +obj-$(CONFIG_ACPI) += acpi/ obj-$(CONFIG_X86_BIOS_REBOOT) += reboot.o obj-$(CONFIG_MCA) += mca.o obj-$(CONFIG_X86_MSR) += msr.o diff --git a/arch/i386/kernel/acpi/Makefile b/arch/i386/kernel/acpi/Makefile index 5e291a20c03..267ca48e1b6 100644 --- a/arch/i386/kernel/acpi/Makefile +++ b/arch/i386/kernel/acpi/Makefile @@ -1,4 +1,4 @@ -obj-$(CONFIG_ACPI_BOOT) := boot.o +obj-y := boot.o obj-$(CONFIG_X86_IO_APIC) += earlyquirk.o obj-$(CONFIG_ACPI_SLEEP) += sleep.o wakeup.o diff --git a/arch/i386/kernel/io_apic.c b/arch/i386/kernel/io_apic.c index 6578f40bd50..ebedd2e2167 100644 --- a/arch/i386/kernel/io_apic.c +++ b/arch/i386/kernel/io_apic.c @@ -2421,7 +2421,7 @@ device_initcall(ioapic_init_sysfs); ACPI-based IOAPIC Configuration -------------------------------------------------------------------------- */ -#ifdef CONFIG_ACPI_BOOT +#ifdef CONFIG_ACPI int __init io_apic_get_unique_id (int ioapic, int apic_id) { @@ -2574,4 +2574,4 @@ int io_apic_set_pci_routing (int ioapic, int pin, int irq, int edge_level, int a return 0; } -#endif /*CONFIG_ACPI_BOOT*/ +#endif /* CONFIG_ACPI */ diff --git a/arch/i386/kernel/mpparse.c b/arch/i386/kernel/mpparse.c index ce838abb27d..9a4db7d3000 100644 --- a/arch/i386/kernel/mpparse.c +++ b/arch/i386/kernel/mpparse.c @@ -653,8 +653,6 @@ void __init get_smp_config (void) struct intel_mp_floating *mpf = mpf_found; /* - * ACPI may be used to obtain the entire SMP configuration or just to - * enumerate/configure processors (CONFIG_ACPI_BOOT). Note that * ACPI supports both logical (e.g. Hyper-Threading) and physical * processors, where MPS only supports physical. */ @@ -810,7 +808,7 @@ void __init find_smp_config (void) ACPI-based MP Configuration -------------------------------------------------------------------------- */ -#ifdef CONFIG_ACPI_BOOT +#ifdef CONFIG_ACPI void __init mp_register_lapic_address ( u64 address) @@ -856,7 +854,7 @@ void __init mp_register_lapic ( MP_processor_info(&processor); } -#if defined(CONFIG_X86_IO_APIC) && (defined(CONFIG_ACPI_INTERPRETER) || defined(CONFIG_ACPI_BOOT)) +#if defined(CONFIG_X86_IO_APIC) && defined(CONFIG_ACPI_INTERPRETER) #define MP_ISA_BUS 0 #define MP_MAX_IOAPIC_PIN 127 @@ -1138,5 +1136,5 @@ int mp_register_gsi (u32 gsi, int edge_level, int active_high_low) return gsi; } -#endif /*CONFIG_X86_IO_APIC && (CONFIG_ACPI_INTERPRETER || CONFIG_ACPI_BOOT)*/ -#endif /*CONFIG_ACPI_BOOT*/ +#endif /* CONFIG_X86_IO_APIC && CONFIG_ACPI_INTERPRETER */ +#endif /* CONFIG_ACPI */ diff --git a/arch/i386/kernel/setup.c b/arch/i386/kernel/setup.c index af4de58cab5..d3943e5edc8 100644 --- a/arch/i386/kernel/setup.c +++ b/arch/i386/kernel/setup.c @@ -94,7 +94,7 @@ unsigned long mmu_cr4_features; #endif EXPORT_SYMBOL(acpi_disabled); -#ifdef CONFIG_ACPI_BOOT +#ifdef CONFIG_ACPI int __initdata acpi_force = 0; extern acpi_interrupt_flags acpi_sci_flags; #endif @@ -794,7 +794,7 @@ static void __init parse_cmdline_early (char ** cmdline_p) } #endif -#ifdef CONFIG_ACPI_BOOT +#ifdef CONFIG_ACPI /* "acpi=off" disables both ACPI table parsing and interpreter */ else if (!memcmp(from, "acpi=off", 8)) { disable_acpi(); @@ -850,7 +850,7 @@ static void __init parse_cmdline_early (char ** cmdline_p) else if (!memcmp(from, "noapic", 6)) disable_ioapic_setup(); #endif /* CONFIG_X86_LOCAL_APIC */ -#endif /* CONFIG_ACPI_BOOT */ +#endif /* CONFIG_ACPI */ #ifdef CONFIG_X86_LOCAL_APIC /* enable local APIC */ @@ -1575,7 +1575,7 @@ void __init setup_arch(char **cmdline_p) if (efi_enabled) efi_map_memmap(); -#ifdef CONFIG_ACPI_BOOT +#ifdef CONFIG_ACPI /* * Parse the ACPI tables for possible boot-time SMP configuration. */ diff --git a/arch/i386/mach-es7000/es7000plat.c b/arch/i386/mach-es7000/es7000plat.c index d5936d50047..baac9da042c 100644 --- a/arch/i386/mach-es7000/es7000plat.c +++ b/arch/i386/mach-es7000/es7000plat.c @@ -51,7 +51,7 @@ struct mip_reg *host_reg; int mip_port; unsigned long mip_addr, host_addr; -#if defined(CONFIG_X86_IO_APIC) && (defined(CONFIG_ACPI_INTERPRETER) || defined(CONFIG_ACPI_BOOT)) +#if defined(CONFIG_X86_IO_APIC) && defined(CONFIG_ACPI_INTERPRETER) /* * GSI override for ES7000 platforms. @@ -73,7 +73,7 @@ es7000_rename_gsi(int ioapic, int gsi) return gsi; } -#endif // (CONFIG_X86_IO_APIC) && (CONFIG_ACPI_INTERPRETER || CONFIG_ACPI_BOOT) +#endif // (CONFIG_X86_IO_APIC) && (CONFIG_ACPI_INTERPRETER) /* * Parse the OEM Table diff --git a/arch/ia64/configs/bigsur_defconfig b/arch/ia64/configs/bigsur_defconfig index b95fcf86ea0..456c65689be 100644 --- a/arch/ia64/configs/bigsur_defconfig +++ b/arch/ia64/configs/bigsur_defconfig @@ -107,7 +107,6 @@ CONFIG_ACPI=y # # ACPI (Advanced Configuration and Power Interface) Support # -CONFIG_ACPI_BOOT=y CONFIG_ACPI_INTERPRETER=y CONFIG_ACPI_BUTTON=m CONFIG_ACPI_VIDEO=m diff --git a/arch/ia64/configs/sn2_defconfig b/arch/ia64/configs/sn2_defconfig index dccf35c60b9..dc483c18343 100644 --- a/arch/ia64/configs/sn2_defconfig +++ b/arch/ia64/configs/sn2_defconfig @@ -130,7 +130,6 @@ CONFIG_ACPI=y # # ACPI (Advanced Configuration and Power Interface) Support # -CONFIG_ACPI_BOOT=y CONFIG_ACPI_INTERPRETER=y # CONFIG_ACPI_BUTTON is not set CONFIG_ACPI_VIDEO=m diff --git a/arch/ia64/configs/tiger_defconfig b/arch/ia64/configs/tiger_defconfig index c853cfcd2d1..cd2d6375a85 100644 --- a/arch/ia64/configs/tiger_defconfig +++ b/arch/ia64/configs/tiger_defconfig @@ -128,7 +128,6 @@ CONFIG_ACPI=y # # ACPI (Advanced Configuration and Power Interface) Support # -CONFIG_ACPI_BOOT=y CONFIG_ACPI_INTERPRETER=y CONFIG_ACPI_BUTTON=m # CONFIG_ACPI_VIDEO is not set diff --git a/arch/ia64/configs/zx1_defconfig b/arch/ia64/configs/zx1_defconfig index 88e8867fa8e..cf58404769a 100644 --- a/arch/ia64/configs/zx1_defconfig +++ b/arch/ia64/configs/zx1_defconfig @@ -128,7 +128,6 @@ CONFIG_ACPI=y # # ACPI (Advanced Configuration and Power Interface) Support # -CONFIG_ACPI_BOOT=y CONFIG_ACPI_INTERPRETER=y CONFIG_ACPI_BUTTON=y CONFIG_ACPI_VIDEO=m diff --git a/arch/ia64/defconfig b/arch/ia64/defconfig index 8444add7638..f38c677f7af 100644 --- a/arch/ia64/defconfig +++ b/arch/ia64/defconfig @@ -118,7 +118,6 @@ CONFIG_ACPI=y # # ACPI (Advanced Configuration and Power Interface) Support # -CONFIG_ACPI_BOOT=y CONFIG_ACPI_INTERPRETER=y CONFIG_ACPI_BUTTON=m CONFIG_ACPI_VIDEO=m diff --git a/arch/ia64/kernel/acpi.c b/arch/ia64/kernel/acpi.c index 78bc2198712..318787c84ac 100644 --- a/arch/ia64/kernel/acpi.c +++ b/arch/ia64/kernel/acpi.c @@ -132,7 +132,7 @@ const char *acpi_get_sysname(void) #endif } -#ifdef CONFIG_ACPI_BOOT +#ifdef CONFIG_ACPI #define ACPI_MAX_PLATFORM_INTERRUPTS 256 @@ -917,4 +917,4 @@ int acpi_unregister_ioapic(acpi_handle handle, u32 gsi_base) EXPORT_SYMBOL(acpi_unregister_ioapic); -#endif /* CONFIG_ACPI_BOOT */ +#endif /* CONFIG_ACPI */ diff --git a/arch/ia64/kernel/setup.c b/arch/ia64/kernel/setup.c index 84f89da7c64..1f5c26dbe70 100644 --- a/arch/ia64/kernel/setup.c +++ b/arch/ia64/kernel/setup.c @@ -384,7 +384,7 @@ setup_arch (char **cmdline_p) if (early_console_setup(*cmdline_p) == 0) mark_bsp_online(); -#ifdef CONFIG_ACPI_BOOT +#ifdef CONFIG_ACPI /* Initialize the ACPI boot-time table parser */ acpi_table_init(); # ifdef CONFIG_ACPI_NUMA @@ -420,7 +420,7 @@ setup_arch (char **cmdline_p) cpu_init(); /* initialize the bootstrap CPU */ -#ifdef CONFIG_ACPI_BOOT +#ifdef CONFIG_ACPI acpi_boot_init(); #endif diff --git a/arch/ia64/kernel/topology.c b/arch/ia64/kernel/topology.c index 92ff46ad21e..706b7734e19 100644 --- a/arch/ia64/kernel/topology.c +++ b/arch/ia64/kernel/topology.c @@ -36,7 +36,7 @@ int arch_register_cpu(int num) parent = &sysfs_nodes[cpu_to_node(num)]; #endif /* CONFIG_NUMA */ -#ifdef CONFIG_ACPI_BOOT +#ifdef CONFIG_ACPI /* * If CPEI cannot be re-targetted, and this is * CPEI target, then dont create the control file diff --git a/arch/x86_64/Kconfig b/arch/x86_64/Kconfig index 660a03a89e6..40242c61e90 100644 --- a/arch/x86_64/Kconfig +++ b/arch/x86_64/Kconfig @@ -144,7 +144,6 @@ config X86_CPUID with major 203 and minors 0 to 31 for /dev/cpu/0/cpuid to /dev/cpu/31/cpuid. -# disable it for opteron optimized builds because it pulls in ACPI_BOOT config X86_HT bool depends on SMP && !MK8 @@ -461,7 +460,6 @@ config PCI_DIRECT config PCI_MMCONFIG bool "Support mmconfig PCI config space access" depends on PCI && ACPI - select ACPI_BOOT config UNORDERED_IO bool "Unordered IO mapping access" diff --git a/arch/x86_64/defconfig b/arch/x86_64/defconfig index 776f3c866b7..aed77c1c5cc 100644 --- a/arch/x86_64/defconfig +++ b/arch/x86_64/defconfig @@ -135,7 +135,6 @@ CONFIG_PM_STD_PARTITION="" # ACPI (Advanced Configuration and Power Interface) Support # CONFIG_ACPI=y -CONFIG_ACPI_BOOT=y CONFIG_ACPI_INTERPRETER=y CONFIG_ACPI_AC=y CONFIG_ACPI_BATTERY=y diff --git a/arch/x86_64/kernel/Makefile b/arch/x86_64/kernel/Makefile index 48f9e2c19cd..0296ca6cbfa 100644 --- a/arch/x86_64/kernel/Makefile +++ b/arch/x86_64/kernel/Makefile @@ -12,7 +12,7 @@ obj-y := process.o semaphore.o signal.o entry.o traps.o irq.o \ obj-$(CONFIG_X86_MCE) += mce.o obj-$(CONFIG_X86_MCE_INTEL) += mce_intel.o obj-$(CONFIG_MTRR) += ../../i386/kernel/cpu/mtrr/ -obj-$(CONFIG_ACPI_BOOT) += acpi/ +obj-$(CONFIG_ACPI) += acpi/ obj-$(CONFIG_X86_MSR) += msr.o obj-$(CONFIG_MICROCODE) += microcode.o obj-$(CONFIG_X86_CPUID) += cpuid.o diff --git a/arch/x86_64/kernel/acpi/Makefile b/arch/x86_64/kernel/acpi/Makefile index d2c2ee5f9a8..7da9ace890b 100644 --- a/arch/x86_64/kernel/acpi/Makefile +++ b/arch/x86_64/kernel/acpi/Makefile @@ -1,3 +1,3 @@ -obj-$(CONFIG_ACPI_BOOT) := boot.o -boot-$(CONFIG_ACPI_BOOT) := ../../../i386/kernel/acpi/boot.o +obj-y := boot.o +boot-y := ../../../i386/kernel/acpi/boot.o obj-$(CONFIG_ACPI_SLEEP) += sleep.o wakeup.o diff --git a/arch/x86_64/kernel/io_apic.c b/arch/x86_64/kernel/io_apic.c index d206d7e49cf..1013a8fe44d 100644 --- a/arch/x86_64/kernel/io_apic.c +++ b/arch/x86_64/kernel/io_apic.c @@ -1841,7 +1841,7 @@ device_initcall(ioapic_init_sysfs); ACPI-based IOAPIC Configuration -------------------------------------------------------------------------- */ -#ifdef CONFIG_ACPI_BOOT +#ifdef CONFIG_ACPI #define IO_APIC_MAX_ID 0xFE @@ -1923,7 +1923,7 @@ int io_apic_set_pci_routing (int ioapic, int pin, int irq, int edge_level, int a return 0; } -#endif /*CONFIG_ACPI_BOOT*/ +#endif /* CONFIG_ACPI */ /* diff --git a/arch/x86_64/kernel/mpparse.c b/arch/x86_64/kernel/mpparse.c index 79c362d03e2..86445f320d8 100644 --- a/arch/x86_64/kernel/mpparse.c +++ b/arch/x86_64/kernel/mpparse.c @@ -74,7 +74,7 @@ static unsigned int num_processors = 0; physid_mask_t phys_cpu_present_map = PHYSID_MASK_NONE; /* ACPI MADT entry parsing functions */ -#ifdef CONFIG_ACPI_BOOT +#ifdef CONFIG_ACPI extern struct acpi_boot_flags acpi_boot; #ifdef CONFIG_X86_LOCAL_APIC extern int acpi_parse_lapic (acpi_table_entry_header *header); @@ -84,7 +84,7 @@ extern int acpi_parse_lapic_nmi (acpi_table_entry_header *header); #ifdef CONFIG_X86_IO_APIC extern int acpi_parse_ioapic (acpi_table_entry_header *header); #endif /*CONFIG_X86_IO_APIC*/ -#endif /*CONFIG_ACPI_BOOT*/ +#endif /*CONFIG_ACPI*/ u8 bios_cpu_apicid[NR_CPUS] = { [0 ... NR_CPUS-1] = BAD_APICID }; @@ -519,8 +519,6 @@ void __init get_smp_config (void) struct intel_mp_floating *mpf = mpf_found; /* - * ACPI may be used to obtain the entire SMP configuration or just to - * enumerate/configure processors (CONFIG_ACPI_BOOT). Note that * ACPI supports both logical (e.g. Hyper-Threading) and physical * processors, where MPS only supports physical. */ @@ -673,7 +671,7 @@ void __init find_smp_config (void) ACPI-based MP Configuration -------------------------------------------------------------------------- */ -#ifdef CONFIG_ACPI_BOOT +#ifdef CONFIG_ACPI void __init mp_register_lapic_address ( u64 address) @@ -994,4 +992,4 @@ int mp_register_gsi(u32 gsi, int edge_level, int active_high_low) } #endif /*CONFIG_X86_IO_APIC*/ -#endif /*CONFIG_ACPI_BOOT*/ +#endif /*CONFIG_ACPI*/ diff --git a/arch/x86_64/kernel/setup.c b/arch/x86_64/kernel/setup.c index 116a491e296..cfcebc8ab7b 100644 --- a/arch/x86_64/kernel/setup.c +++ b/arch/x86_64/kernel/setup.c @@ -71,7 +71,7 @@ unsigned long mmu_cr4_features; int acpi_disabled; EXPORT_SYMBOL(acpi_disabled); -#ifdef CONFIG_ACPI_BOOT +#ifdef CONFIG_ACPI extern int __initdata acpi_ht; extern acpi_interrupt_flags acpi_sci_flags; int __initdata acpi_force = 0; @@ -294,7 +294,7 @@ static __init void parse_cmdline_early (char ** cmdline_p) maxcpus = simple_strtoul(from + 8, NULL, 0); } #endif -#ifdef CONFIG_ACPI_BOOT +#ifdef CONFIG_ACPI /* "acpi=off" disables both ACPI table parsing and interpreter init */ if (!memcmp(from, "acpi=off", 8)) disable_acpi(); @@ -566,7 +566,7 @@ void __init setup_arch(char **cmdline_p) init_memory_mapping(0, (end_pfn_map << PAGE_SHIFT)); -#ifdef CONFIG_ACPI_BOOT +#ifdef CONFIG_ACPI /* * Initialize the ACPI boot-time table parser (gets the RSDP and SDT). * Call this early for SRAT node setup. @@ -658,7 +658,7 @@ void __init setup_arch(char **cmdline_p) check_ioapic(); -#ifdef CONFIG_ACPI_BOOT +#ifdef CONFIG_ACPI /* * Read APIC and some other early information from ACPI tables. */ diff --git a/drivers/Makefile b/drivers/Makefile index 126a851d565..784b93c8888 100644 --- a/drivers/Makefile +++ b/drivers/Makefile @@ -8,7 +8,7 @@ obj-$(CONFIG_PCI) += pci/ obj-$(CONFIG_PARISC) += parisc/ obj-y += video/ -obj-$(CONFIG_ACPI_BOOT) += acpi/ +obj-$(CONFIG_ACPI) += acpi/ # PnP must come after ACPI since it will eventually need to check if acpi # was used and do nothing if so obj-$(CONFIG_PNP) += pnp/ diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig index 66c60982ba4..14b70c259f3 100644 --- a/drivers/acpi/Kconfig +++ b/drivers/acpi/Kconfig @@ -43,10 +43,6 @@ config ACPI if ACPI -config ACPI_BOOT - bool - default y - config ACPI_INTERPRETER bool default y @@ -312,7 +308,7 @@ endif # ACPI_INTERPRETER config X86_PM_TIMER bool "Power Management Timer Support" depends on X86 - depends on ACPI_BOOT && EXPERIMENTAL + depends on EXPERIMENTAL depends on !X86_64 default n help diff --git a/drivers/acpi/Makefile b/drivers/acpi/Makefile index ad67e8f61e6..952ab352af9 100644 --- a/drivers/acpi/Makefile +++ b/drivers/acpi/Makefile @@ -15,7 +15,7 @@ EXTRA_CFLAGS += $(ACPI_CFLAGS) # # ACPI Boot-Time Table Parsing # -obj-$(CONFIG_ACPI_BOOT) += tables.o +obj-y += tables.o obj-$(CONFIG_ACPI_INTERPRETER) += blacklist.o # diff --git a/include/asm-i386/acpi.h b/include/asm-i386/acpi.h index cf828ace13f..1f1ade923d6 100644 --- a/include/asm-i386/acpi.h +++ b/include/asm-i386/acpi.h @@ -103,7 +103,7 @@ __acpi_release_global_lock (unsigned int *lock) :"=r"(n_hi), "=r"(n_lo) \ :"0"(n_hi), "1"(n_lo)) -#ifdef CONFIG_ACPI_BOOT +#ifdef CONFIG_ACPI extern int acpi_lapic; extern int acpi_ioapic; extern int acpi_noirq; @@ -146,7 +146,7 @@ static inline void check_acpi_pci(void) { } #endif -#else /* CONFIG_ACPI_BOOT */ +#else /* !CONFIG_ACPI */ # define acpi_lapic 0 # define acpi_ioapic 0 diff --git a/include/asm-i386/fixmap.h b/include/asm-i386/fixmap.h index c94cac95838..cfb1c61d3b9 100644 --- a/include/asm-i386/fixmap.h +++ b/include/asm-i386/fixmap.h @@ -76,7 +76,7 @@ enum fixed_addresses { FIX_KMAP_BEGIN, /* reserved pte's for temporary kernel mappings */ FIX_KMAP_END = FIX_KMAP_BEGIN+(KM_TYPE_NR*NR_CPUS)-1, #endif -#ifdef CONFIG_ACPI_BOOT +#ifdef CONFIG_ACPI FIX_ACPI_BEGIN, FIX_ACPI_END = FIX_ACPI_BEGIN + FIX_ACPI_PAGES - 1, #endif diff --git a/include/asm-i386/io_apic.h b/include/asm-i386/io_apic.h index 002c203ccd6..51c4e5fe606 100644 --- a/include/asm-i386/io_apic.h +++ b/include/asm-i386/io_apic.h @@ -195,12 +195,12 @@ extern int skip_ioapic_setup; */ #define io_apic_assign_pci_irqs (mp_irq_entries && !skip_ioapic_setup && io_apic_irqs) -#ifdef CONFIG_ACPI_BOOT +#ifdef CONFIG_ACPI extern int io_apic_get_unique_id (int ioapic, int apic_id); extern int io_apic_get_version (int ioapic); extern int io_apic_get_redir_entries (int ioapic); extern int io_apic_set_pci_routing (int ioapic, int pin, int irq, int edge_level, int active_high_low); -#endif /*CONFIG_ACPI_BOOT*/ +#endif /* CONFIG_ACPI */ extern int (*ioapic_renumber_irq)(int ioapic, int irq); diff --git a/include/asm-i386/mpspec.h b/include/asm-i386/mpspec.h index d9fafba075b..b9e9f66d272 100644 --- a/include/asm-i386/mpspec.h +++ b/include/asm-i386/mpspec.h @@ -26,14 +26,14 @@ extern unsigned long mp_lapic_addr; extern int pic_mode; extern int using_apic_timer; -#ifdef CONFIG_ACPI_BOOT +#ifdef CONFIG_ACPI extern void mp_register_lapic (u8 id, u8 enabled); extern void mp_register_lapic_address (u64 address); extern void mp_register_ioapic (u8 id, u32 address, u32 gsi_base); extern void mp_override_legacy_irq (u8 bus_irq, u8 polarity, u8 trigger, u32 gsi); extern void mp_config_acpi_legacy_irqs (void); extern int mp_register_gsi (u32 gsi, int edge_level, int active_high_low); -#endif /*CONFIG_ACPI_BOOT*/ +#endif /* CONFIG_ACPI */ #define PHYSID_ARRAY_SIZE BITS_TO_LONGS(MAX_APICS) diff --git a/include/asm-x86_64/acpi.h b/include/asm-x86_64/acpi.h index dc8c981af27..7d537e1867c 100644 --- a/include/asm-x86_64/acpi.h +++ b/include/asm-x86_64/acpi.h @@ -101,7 +101,7 @@ __acpi_release_global_lock (unsigned int *lock) :"=r"(n_hi), "=r"(n_lo) \ :"0"(n_hi), "1"(n_lo)) -#ifdef CONFIG_ACPI_BOOT +#ifdef CONFIG_ACPI extern int acpi_lapic; extern int acpi_ioapic; extern int acpi_noirq; @@ -122,10 +122,10 @@ static inline void disable_acpi(void) extern int acpi_gsi_to_irq(u32 gsi, unsigned int *irq); -#else /* !CONFIG_ACPI_BOOT */ +#else /* !CONFIG_ACPI */ #define acpi_lapic 0 #define acpi_ioapic 0 -#endif /* !CONFIG_ACPI_BOOT */ +#endif /* !CONFIG_ACPI */ extern int acpi_numa; extern int acpi_scan_nodes(unsigned long start, unsigned long end); diff --git a/include/asm-x86_64/io_apic.h b/include/asm-x86_64/io_apic.h index a8babd2bbe8..ee1bc69aec9 100644 --- a/include/asm-x86_64/io_apic.h +++ b/include/asm-x86_64/io_apic.h @@ -201,7 +201,7 @@ extern int skip_ioapic_setup; */ #define io_apic_assign_pci_irqs (mp_irq_entries && !skip_ioapic_setup && io_apic_irqs) -#ifdef CONFIG_ACPI_BOOT +#ifdef CONFIG_ACPI extern int io_apic_get_version (int ioapic); extern int io_apic_get_redir_entries (int ioapic); extern int io_apic_set_pci_routing (int ioapic, int pin, int irq, int, int); diff --git a/include/asm-x86_64/mpspec.h b/include/asm-x86_64/mpspec.h index 331f6a3c72a..f267e10c023 100644 --- a/include/asm-x86_64/mpspec.h +++ b/include/asm-x86_64/mpspec.h @@ -179,7 +179,7 @@ extern int mpc_default_type; extern unsigned long mp_lapic_addr; extern int pic_mode; -#ifdef CONFIG_ACPI_BOOT +#ifdef CONFIG_ACPI extern void mp_register_lapic (u8 id, u8 enabled); extern void mp_register_lapic_address (u64 address); diff --git a/include/linux/acpi.h b/include/linux/acpi.h index fd48db320f5..fa1ad1a60a0 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h @@ -41,7 +41,7 @@ #include -#ifdef CONFIG_ACPI_BOOT +#ifdef CONFIG_ACPI enum acpi_irq_model_id { ACPI_IRQ_MODEL_PIC = 0, @@ -429,11 +429,11 @@ extern int pci_mmcfg_config_num; extern int sbf_port ; -#else /*!CONFIG_ACPI_BOOT*/ +#else /* !CONFIG_ACPI */ #define acpi_mp_config 0 -#endif /*!CONFIG_ACPI_BOOT*/ +#endif /* !CONFIG_ACPI */ int acpi_register_gsi (u32 gsi, int edge_level, int active_high_low); int acpi_gsi_to_irq (u32 gsi, unsigned int *irq); -- cgit v1.2.3-70-g09d2 From 8466361ad5233d4356a4601e16b66c25277920d1 Mon Sep 17 00:00:00 2001 From: Len Brown Date: Wed, 24 Aug 2005 12:09:07 -0400 Subject: [ACPI] delete CONFIG_ACPI_INTERPRETER it is a synonym for CONFIG_ACPI Signed-off-by: Len Brown --- arch/i386/defconfig | 1 - arch/i386/kernel/acpi/boot.c | 8 +++----- arch/i386/kernel/mpparse.c | 4 ++-- arch/i386/kernel/setup.c | 2 +- arch/i386/mach-es7000/es7000plat.c | 4 ++-- arch/ia64/configs/bigsur_defconfig | 1 - arch/ia64/configs/sn2_defconfig | 1 - arch/ia64/configs/tiger_defconfig | 1 - arch/ia64/configs/zx1_defconfig | 1 - arch/ia64/defconfig | 1 - arch/x86_64/defconfig | 1 - drivers/acpi/Kconfig | 10 ---------- drivers/acpi/Makefile | 4 ++-- drivers/char/ipmi/ipmi_si_intf.c | 6 +++--- include/linux/acpi.h | 11 ----------- 15 files changed, 13 insertions(+), 43 deletions(-) (limited to 'include') diff --git a/arch/i386/defconfig b/arch/i386/defconfig index 1c0076e22dd..f137a32634a 100644 --- a/arch/i386/defconfig +++ b/arch/i386/defconfig @@ -131,7 +131,6 @@ CONFIG_SOFTWARE_SUSPEND=y # ACPI (Advanced Configuration and Power Interface) Support # CONFIG_ACPI=y -CONFIG_ACPI_INTERPRETER=y CONFIG_ACPI_SLEEP=y CONFIG_ACPI_SLEEP_PROC_FS=y CONFIG_ACPI_AC=y diff --git a/arch/i386/kernel/acpi/boot.c b/arch/i386/kernel/acpi/boot.c index 09700d89466..84befaecedf 100644 --- a/arch/i386/kernel/acpi/boot.c +++ b/arch/i386/kernel/acpi/boot.c @@ -303,7 +303,7 @@ acpi_parse_lapic_nmi(acpi_table_entry_header * header, const unsigned long end) #endif /*CONFIG_X86_LOCAL_APIC */ -#if defined(CONFIG_X86_IO_APIC) && defined(CONFIG_ACPI_INTERPRETER) +#ifdef CONFIG_X86_IO_APIC static int __init acpi_parse_ioapic(acpi_table_entry_header * header, const unsigned long end) @@ -634,10 +634,8 @@ static int __init acpi_parse_fadt(unsigned long phys, unsigned long size) printk(KERN_WARNING PREFIX "Unable to map FADT\n"); return 0; } -#ifdef CONFIG_ACPI_INTERPRETER /* initialize sci_int early for INT_SRC_OVR MADT parsing */ acpi_fadt.sci_int = fadt->sci_int; -#endif #ifdef CONFIG_ACPI_BUS /* initialize rev and apic_phys_dest_mode for x86_64 genapic */ @@ -735,7 +733,7 @@ static int __init acpi_parse_madt_lapic_entries(void) } #endif /* CONFIG_X86_LOCAL_APIC */ -#if defined(CONFIG_X86_IO_APIC) && defined(CONFIG_ACPI_INTERPRETER) +#ifdef CONFIG_X86_IO_APIC /* * Parse IOAPIC related entries in MADT * returns 0 on success, < 0 on error @@ -810,7 +808,7 @@ static inline int acpi_parse_madt_ioapic_entries(void) { return -1; } -#endif /* !(CONFIG_X86_IO_APIC && CONFIG_ACPI_INTERPRETER) */ +#endif /* !CONFIG_X86_IO_APIC */ static void __init acpi_process_madt(void) { diff --git a/arch/i386/kernel/mpparse.c b/arch/i386/kernel/mpparse.c index 9a4db7d3000..db90d141481 100644 --- a/arch/i386/kernel/mpparse.c +++ b/arch/i386/kernel/mpparse.c @@ -854,7 +854,7 @@ void __init mp_register_lapic ( MP_processor_info(&processor); } -#if defined(CONFIG_X86_IO_APIC) && defined(CONFIG_ACPI_INTERPRETER) +#ifdef CONFIG_X86_IO_APIC #define MP_ISA_BUS 0 #define MP_MAX_IOAPIC_PIN 127 @@ -1136,5 +1136,5 @@ int mp_register_gsi (u32 gsi, int edge_level, int active_high_low) return gsi; } -#endif /* CONFIG_X86_IO_APIC && CONFIG_ACPI_INTERPRETER */ +#endif /* CONFIG_X86_IO_APIC */ #endif /* CONFIG_ACPI */ diff --git a/arch/i386/kernel/setup.c b/arch/i386/kernel/setup.c index d3943e5edc8..d52eda399a7 100644 --- a/arch/i386/kernel/setup.c +++ b/arch/i386/kernel/setup.c @@ -87,7 +87,7 @@ EXPORT_SYMBOL(boot_cpu_data); unsigned long mmu_cr4_features; -#ifdef CONFIG_ACPI_INTERPRETER +#ifdef CONFIG_ACPI int acpi_disabled = 0; #else int acpi_disabled = 1; diff --git a/arch/i386/mach-es7000/es7000plat.c b/arch/i386/mach-es7000/es7000plat.c index baac9da042c..f549c0efdb9 100644 --- a/arch/i386/mach-es7000/es7000plat.c +++ b/arch/i386/mach-es7000/es7000plat.c @@ -51,7 +51,7 @@ struct mip_reg *host_reg; int mip_port; unsigned long mip_addr, host_addr; -#if defined(CONFIG_X86_IO_APIC) && defined(CONFIG_ACPI_INTERPRETER) +#if defined(CONFIG_X86_IO_APIC) && defined(CONFIG_ACPI) /* * GSI override for ES7000 platforms. @@ -73,7 +73,7 @@ es7000_rename_gsi(int ioapic, int gsi) return gsi; } -#endif // (CONFIG_X86_IO_APIC) && (CONFIG_ACPI_INTERPRETER) +#endif /* (CONFIG_X86_IO_APIC) && (CONFIG_ACPI) */ /* * Parse the OEM Table diff --git a/arch/ia64/configs/bigsur_defconfig b/arch/ia64/configs/bigsur_defconfig index 456c65689be..2c3ba6a6ec7 100644 --- a/arch/ia64/configs/bigsur_defconfig +++ b/arch/ia64/configs/bigsur_defconfig @@ -107,7 +107,6 @@ CONFIG_ACPI=y # # ACPI (Advanced Configuration and Power Interface) Support # -CONFIG_ACPI_INTERPRETER=y CONFIG_ACPI_BUTTON=m CONFIG_ACPI_VIDEO=m CONFIG_ACPI_FAN=m diff --git a/arch/ia64/configs/sn2_defconfig b/arch/ia64/configs/sn2_defconfig index dc483c18343..6a0c114e086 100644 --- a/arch/ia64/configs/sn2_defconfig +++ b/arch/ia64/configs/sn2_defconfig @@ -130,7 +130,6 @@ CONFIG_ACPI=y # # ACPI (Advanced Configuration and Power Interface) Support # -CONFIG_ACPI_INTERPRETER=y # CONFIG_ACPI_BUTTON is not set CONFIG_ACPI_VIDEO=m CONFIG_ACPI_HOTKEY=m diff --git a/arch/ia64/configs/tiger_defconfig b/arch/ia64/configs/tiger_defconfig index cd2d6375a85..dec24a6de6a 100644 --- a/arch/ia64/configs/tiger_defconfig +++ b/arch/ia64/configs/tiger_defconfig @@ -128,7 +128,6 @@ CONFIG_ACPI=y # # ACPI (Advanced Configuration and Power Interface) Support # -CONFIG_ACPI_INTERPRETER=y CONFIG_ACPI_BUTTON=m # CONFIG_ACPI_VIDEO is not set # CONFIG_ACPI_HOTKEY is not set diff --git a/arch/ia64/configs/zx1_defconfig b/arch/ia64/configs/zx1_defconfig index cf58404769a..d318087bfcb 100644 --- a/arch/ia64/configs/zx1_defconfig +++ b/arch/ia64/configs/zx1_defconfig @@ -128,7 +128,6 @@ CONFIG_ACPI=y # # ACPI (Advanced Configuration and Power Interface) Support # -CONFIG_ACPI_INTERPRETER=y CONFIG_ACPI_BUTTON=y CONFIG_ACPI_VIDEO=m CONFIG_ACPI_HOTKEY=m diff --git a/arch/ia64/defconfig b/arch/ia64/defconfig index f38c677f7af..e6d34df7d2f 100644 --- a/arch/ia64/defconfig +++ b/arch/ia64/defconfig @@ -118,7 +118,6 @@ CONFIG_ACPI=y # # ACPI (Advanced Configuration and Power Interface) Support # -CONFIG_ACPI_INTERPRETER=y CONFIG_ACPI_BUTTON=m CONFIG_ACPI_VIDEO=m CONFIG_ACPI_FAN=m diff --git a/arch/x86_64/defconfig b/arch/x86_64/defconfig index aed77c1c5cc..8ccb4a12eed 100644 --- a/arch/x86_64/defconfig +++ b/arch/x86_64/defconfig @@ -135,7 +135,6 @@ CONFIG_PM_STD_PARTITION="" # ACPI (Advanced Configuration and Power Interface) Support # CONFIG_ACPI=y -CONFIG_ACPI_INTERPRETER=y CONFIG_ACPI_AC=y CONFIG_ACPI_BATTERY=y CONFIG_ACPI_BUTTON=y diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig index 14b70c259f3..f023a88ca39 100644 --- a/drivers/acpi/Kconfig +++ b/drivers/acpi/Kconfig @@ -43,12 +43,6 @@ config ACPI if ACPI -config ACPI_INTERPRETER - bool - default y - -if ACPI_INTERPRETER - config ACPI_SLEEP bool "Sleep States (EXPERIMENTAL)" depends on X86 && (!SMP || SUSPEND_SMP) @@ -126,7 +120,6 @@ config ACPI_VIDEO config ACPI_HOTKEY tristate "Generic Hotkey" - depends on ACPI_INTERPRETER depends on EXPERIMENTAL depends on !IA64_SGI_SN default n @@ -257,7 +250,6 @@ config ACPI_CUSTOM_DSDT_FILE config ACPI_BLACKLIST_YEAR int "Disable ACPI for systems before Jan 1st this year" - depends on ACPI_INTERPRETER default 0 help enter a 4-digit year, eg. 2001 to disable ACPI by default @@ -303,8 +295,6 @@ config ACPI_SYSTEM This driver will enable your system to shut down using ACPI, and dump your ACPI DSDT table using /proc/acpi/dsdt. -endif # ACPI_INTERPRETER - config X86_PM_TIMER bool "Power Management Timer Support" depends on X86 diff --git a/drivers/acpi/Makefile b/drivers/acpi/Makefile index 952ab352af9..060afaf962a 100644 --- a/drivers/acpi/Makefile +++ b/drivers/acpi/Makefile @@ -16,12 +16,12 @@ EXTRA_CFLAGS += $(ACPI_CFLAGS) # ACPI Boot-Time Table Parsing # obj-y += tables.o -obj-$(CONFIG_ACPI_INTERPRETER) += blacklist.o +obj-y += blacklist.o # # ACPI Core Subsystem (Interpreter) # -obj-$(CONFIG_ACPI_INTERPRETER) += osl.o utils.o \ +obj-y += osl.o utils.o \ dispatcher/ events/ executer/ hardware/ \ namespace/ parser/ resources/ tables/ \ utilities/ diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c index a44b97304e9..c51b02d9dfd 100644 --- a/drivers/char/ipmi/ipmi_si_intf.c +++ b/drivers/char/ipmi/ipmi_si_intf.c @@ -986,7 +986,7 @@ MODULE_PARM_DESC(slave_addrs, "Set the default IPMB slave address for" #define IPMI_MEM_ADDR_SPACE 1 #define IPMI_IO_ADDR_SPACE 2 -#if defined(CONFIG_ACPI_INTERPRETER) || defined(CONFIG_X86) || defined(CONFIG_PCI) +#if defined(CONFIG_ACPI) || defined(CONFIG_X86) || defined(CONFIG_PCI) static int is_new_interface(int intf, u8 addr_space, unsigned long base_addr) { int i; @@ -1362,7 +1362,7 @@ static int try_init_mem(int intf_num, struct smi_info **new_info) } -#ifdef CONFIG_ACPI_INTERPRETER +#ifdef CONFIG_ACPI #include @@ -2067,7 +2067,7 @@ static int init_one_smi(int intf_num, struct smi_info **smi) rv = try_init_mem(intf_num, &new_smi); if (rv) rv = try_init_port(intf_num, &new_smi); -#ifdef CONFIG_ACPI_INTERPRETER +#ifdef CONFIG_ACPI if ((rv) && (si_trydefaults)) { rv = try_init_acpi(intf_num, &new_smi); } diff --git a/include/linux/acpi.h b/include/linux/acpi.h index fa1ad1a60a0..6882b32aa40 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h @@ -488,20 +488,9 @@ extern int ec_write(u8 addr, u8 val); #endif /*CONFIG_ACPI_EC*/ -#ifdef CONFIG_ACPI_INTERPRETER - extern int acpi_blacklisted(void); extern void acpi_bios_year(char *s); -#else /*!CONFIG_ACPI_INTERPRETER*/ - -static inline int acpi_blacklisted(void) -{ - return 0; -} - -#endif /*!CONFIG_ACPI_INTERPRETER*/ - #define ACPI_CSTATE_LIMIT_DEFINED /* for driver builds */ #ifdef CONFIG_ACPI -- cgit v1.2.3-70-g09d2 From 76f58584824c61eb5b3bdbf019236815921d2e7c Mon Sep 17 00:00:00 2001 From: Len Brown Date: Wed, 24 Aug 2005 12:10:49 -0400 Subject: [ACPI] delete CONFIG_ACPI_BUS it is a synonym for CONFIG_ACPI Signed-off-by: Len Brown --- arch/i386/defconfig | 1 - arch/i386/kernel/acpi/boot.c | 6 ------ arch/i386/kernel/mpparse.c | 4 ---- arch/ia64/configs/bigsur_defconfig | 1 - arch/ia64/configs/sn2_defconfig | 1 - arch/ia64/configs/tiger_defconfig | 1 - arch/ia64/configs/zx1_defconfig | 1 - arch/ia64/defconfig | 1 - arch/x86_64/defconfig | 1 - arch/x86_64/kernel/genapic.c | 4 ++-- arch/x86_64/kernel/mpparse.c | 4 ---- drivers/acpi/Kconfig | 4 ---- drivers/acpi/Makefile | 6 +++--- drivers/char/tpm/Kconfig | 2 +- drivers/pci/hotplug/Kconfig | 4 ++-- drivers/pci/hotplug/Makefile | 4 ++-- drivers/pnp/Kconfig | 2 +- drivers/pnp/pnpacpi/Kconfig | 2 +- drivers/serial/Kconfig | 2 +- include/acpi/acpi_bus.h | 4 ++-- 20 files changed, 15 insertions(+), 40 deletions(-) (limited to 'include') diff --git a/arch/i386/defconfig b/arch/i386/defconfig index f137a32634a..1a387856c87 100644 --- a/arch/i386/defconfig +++ b/arch/i386/defconfig @@ -142,7 +142,6 @@ CONFIG_ACPI_THERMAL=y # CONFIG_ACPI_ASUS is not set # CONFIG_ACPI_TOSHIBA is not set # CONFIG_ACPI_DEBUG is not set -CONFIG_ACPI_BUS=y CONFIG_ACPI_EC=y CONFIG_ACPI_POWER=y CONFIG_ACPI_PCI=y diff --git a/arch/i386/kernel/acpi/boot.c b/arch/i386/kernel/acpi/boot.c index 84befaecedf..552fc85691a 100644 --- a/arch/i386/kernel/acpi/boot.c +++ b/arch/i386/kernel/acpi/boot.c @@ -408,8 +408,6 @@ acpi_parse_nmi_src(acpi_table_entry_header * header, const unsigned long end) #endif /* CONFIG_X86_IO_APIC */ -#ifdef CONFIG_ACPI_BUS - /* * acpi_pic_sci_set_trigger() * @@ -460,8 +458,6 @@ void __init acpi_pic_sci_set_trigger(unsigned int irq, u16 trigger) outb(new >> 8, 0x4d1); } -#endif /* CONFIG_ACPI_BUS */ - int acpi_gsi_to_irq(u32 gsi, unsigned int *irq) { #ifdef CONFIG_X86_IO_APIC @@ -637,12 +633,10 @@ static int __init acpi_parse_fadt(unsigned long phys, unsigned long size) /* initialize sci_int early for INT_SRC_OVR MADT parsing */ acpi_fadt.sci_int = fadt->sci_int; -#ifdef CONFIG_ACPI_BUS /* initialize rev and apic_phys_dest_mode for x86_64 genapic */ acpi_fadt.revision = fadt->revision; acpi_fadt.force_apic_physical_destination_mode = fadt->force_apic_physical_destination_mode; -#endif #ifdef CONFIG_X86_PM_TIMER /* detect the location of the ACPI PM Timer */ diff --git a/arch/i386/kernel/mpparse.c b/arch/i386/kernel/mpparse.c index db90d141481..97dbf289dbd 100644 --- a/arch/i386/kernel/mpparse.c +++ b/arch/i386/kernel/mpparse.c @@ -1069,11 +1069,9 @@ int mp_register_gsi (u32 gsi, int edge_level, int active_high_low) */ static int gsi_to_irq[MAX_GSI_NUM]; -#ifdef CONFIG_ACPI_BUS /* Don't set up the ACPI SCI because it's already set up */ if (acpi_fadt.sci_int == gsi) return gsi; -#endif ioapic = mp_find_ioapic(gsi); if (ioapic < 0) { @@ -1116,13 +1114,11 @@ int mp_register_gsi (u32 gsi, int edge_level, int active_high_low) if (gsi < MAX_GSI_NUM) { if (gsi > 15) gsi = pci_irq++; -#ifdef CONFIG_ACPI_BUS /* * Don't assign IRQ used by ACPI SCI */ if (gsi == acpi_fadt.sci_int) gsi = pci_irq++; -#endif gsi_to_irq[irq] = gsi; } else { printk(KERN_ERR "GSI %u is too high\n", gsi); diff --git a/arch/ia64/configs/bigsur_defconfig b/arch/ia64/configs/bigsur_defconfig index 2c3ba6a6ec7..996144e840d 100644 --- a/arch/ia64/configs/bigsur_defconfig +++ b/arch/ia64/configs/bigsur_defconfig @@ -114,7 +114,6 @@ CONFIG_ACPI_PROCESSOR=m CONFIG_ACPI_THERMAL=m CONFIG_ACPI_BLACKLIST_YEAR=0 # CONFIG_ACPI_DEBUG is not set -CONFIG_ACPI_BUS=y CONFIG_ACPI_POWER=y CONFIG_ACPI_PCI=y CONFIG_ACPI_SYSTEM=y diff --git a/arch/ia64/configs/sn2_defconfig b/arch/ia64/configs/sn2_defconfig index 6a0c114e086..4644ebea8ea 100644 --- a/arch/ia64/configs/sn2_defconfig +++ b/arch/ia64/configs/sn2_defconfig @@ -138,7 +138,6 @@ CONFIG_ACPI_HOTKEY=m CONFIG_ACPI_NUMA=y CONFIG_ACPI_BLACKLIST_YEAR=0 # CONFIG_ACPI_DEBUG is not set -CONFIG_ACPI_BUS=y CONFIG_ACPI_POWER=y CONFIG_ACPI_PCI=y CONFIG_ACPI_SYSTEM=y diff --git a/arch/ia64/configs/tiger_defconfig b/arch/ia64/configs/tiger_defconfig index dec24a6de6a..f5fa113f302 100644 --- a/arch/ia64/configs/tiger_defconfig +++ b/arch/ia64/configs/tiger_defconfig @@ -137,7 +137,6 @@ CONFIG_ACPI_PROCESSOR=m CONFIG_ACPI_THERMAL=m CONFIG_ACPI_BLACKLIST_YEAR=0 # CONFIG_ACPI_DEBUG is not set -CONFIG_ACPI_BUS=y CONFIG_ACPI_POWER=y CONFIG_ACPI_PCI=y CONFIG_ACPI_SYSTEM=y diff --git a/arch/ia64/configs/zx1_defconfig b/arch/ia64/configs/zx1_defconfig index d318087bfcb..1e6d286ad0f 100644 --- a/arch/ia64/configs/zx1_defconfig +++ b/arch/ia64/configs/zx1_defconfig @@ -136,7 +136,6 @@ CONFIG_ACPI_PROCESSOR=y CONFIG_ACPI_THERMAL=y CONFIG_ACPI_BLACKLIST_YEAR=0 # CONFIG_ACPI_DEBUG is not set -CONFIG_ACPI_BUS=y CONFIG_ACPI_POWER=y CONFIG_ACPI_PCI=y CONFIG_ACPI_SYSTEM=y diff --git a/arch/ia64/defconfig b/arch/ia64/defconfig index e6d34df7d2f..163ef12641b 100644 --- a/arch/ia64/defconfig +++ b/arch/ia64/defconfig @@ -127,7 +127,6 @@ CONFIG_ACPI_THERMAL=m CONFIG_ACPI_NUMA=y CONFIG_ACPI_BLACKLIST_YEAR=0 # CONFIG_ACPI_DEBUG is not set -CONFIG_ACPI_BUS=y CONFIG_ACPI_POWER=y CONFIG_ACPI_PCI=y CONFIG_ACPI_SYSTEM=y diff --git a/arch/x86_64/defconfig b/arch/x86_64/defconfig index 8ccb4a12eed..62abdc0adab 100644 --- a/arch/x86_64/defconfig +++ b/arch/x86_64/defconfig @@ -149,7 +149,6 @@ CONFIG_ACPI_NUMA=y CONFIG_ACPI_TOSHIBA=y CONFIG_ACPI_BLACKLIST_YEAR=2001 # CONFIG_ACPI_DEBUG is not set -CONFIG_ACPI_BUS=y CONFIG_ACPI_EC=y CONFIG_ACPI_POWER=y CONFIG_ACPI_PCI=y diff --git a/arch/x86_64/kernel/genapic.c b/arch/x86_64/kernel/genapic.c index 30c843a5efd..f031358906f 100644 --- a/arch/x86_64/kernel/genapic.c +++ b/arch/x86_64/kernel/genapic.c @@ -20,7 +20,7 @@ #include #include -#if defined(CONFIG_ACPI_BUS) +#if defined(CONFIG_ACPI) #include #endif @@ -47,7 +47,7 @@ void __init clustered_apic_check(void) u8 cluster_cnt[NUM_APIC_CLUSTERS]; int num_cpus = 0; -#if defined(CONFIG_ACPI_BUS) +#if defined(CONFIG_ACPI) /* * Some x86_64 machines use physical APIC mode regardless of how many * procs/clusters are present (x86_64 ES7000 is an example). diff --git a/arch/x86_64/kernel/mpparse.c b/arch/x86_64/kernel/mpparse.c index 86445f320d8..8d8ed6ae1d0 100644 --- a/arch/x86_64/kernel/mpparse.c +++ b/arch/x86_64/kernel/mpparse.c @@ -927,11 +927,9 @@ int mp_register_gsi(u32 gsi, int edge_level, int active_high_low) if (acpi_irq_model != ACPI_IRQ_MODEL_IOAPIC) return gsi; -#ifdef CONFIG_ACPI_BUS /* Don't set up the ACPI SCI because it's already set up */ if (acpi_fadt.sci_int == gsi) return gsi; -#endif ioapic = mp_find_ioapic(gsi); if (ioapic < 0) { @@ -971,13 +969,11 @@ int mp_register_gsi(u32 gsi, int edge_level, int active_high_low) if (gsi < MAX_GSI_NUM) { if (gsi > 15) gsi = pci_irq++; -#ifdef CONFIG_ACPI_BUS /* * Don't assign IRQ used by ACPI SCI */ if (gsi == acpi_fadt.sci_int) gsi = pci_irq++; -#endif gsi_to_irq[irq] = gsi; } else { printk(KERN_ERR "GSI %u is too high\n", gsi); diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig index f023a88ca39..8cafa4adcf4 100644 --- a/drivers/acpi/Kconfig +++ b/drivers/acpi/Kconfig @@ -267,10 +267,6 @@ config ACPI_DEBUG of verbosity. Saying Y enables these statements. This will increase your kernel size by around 50K. -config ACPI_BUS - bool - default y - config ACPI_EC bool depends on X86 diff --git a/drivers/acpi/Makefile b/drivers/acpi/Makefile index 060afaf962a..b6a3c919238 100644 --- a/drivers/acpi/Makefile +++ b/drivers/acpi/Makefile @@ -35,8 +35,8 @@ ifdef CONFIG_CPU_FREQ processor-objs += processor_perflib.o endif -obj-$(CONFIG_ACPI_BUS) += sleep/ -obj-$(CONFIG_ACPI_BUS) += bus.o glue.o +obj-y += sleep/ +obj-y += bus.o glue.o obj-$(CONFIG_ACPI_AC) += ac.o obj-$(CONFIG_ACPI_BATTERY) += battery.o obj-$(CONFIG_ACPI_BUTTON) += button.o @@ -55,5 +55,5 @@ obj-$(CONFIG_ACPI_NUMA) += numa.o obj-$(CONFIG_ACPI_ASUS) += asus_acpi.o obj-$(CONFIG_ACPI_IBM) += ibm_acpi.o obj-$(CONFIG_ACPI_TOSHIBA) += toshiba_acpi.o -obj-$(CONFIG_ACPI_BUS) += scan.o motherboard.o +obj-y += scan.o motherboard.o obj-$(CONFIG_ACPI_HOTPLUG_MEMORY) += acpi_memhotplug.o diff --git a/drivers/char/tpm/Kconfig b/drivers/char/tpm/Kconfig index 79e9832ef1f..b58adfe3ed1 100644 --- a/drivers/char/tpm/Kconfig +++ b/drivers/char/tpm/Kconfig @@ -17,7 +17,7 @@ config TCG_TPM obtained at: . To compile this driver as a module, choose M here; the module will be called tpm. If unsure, say N. - Note: For more TPM drivers enable CONFIG_PNP, CONFIG_ACPI_BUS + Note: For more TPM drivers enable CONFIG_PNP, CONFIG_ACPI and CONFIG_PNPACPI. config TCG_NSC diff --git a/drivers/pci/hotplug/Kconfig b/drivers/pci/hotplug/Kconfig index 9c4a39ee89b..2f1289eebb3 100644 --- a/drivers/pci/hotplug/Kconfig +++ b/drivers/pci/hotplug/Kconfig @@ -78,7 +78,7 @@ config HOTPLUG_PCI_IBM config HOTPLUG_PCI_ACPI tristate "ACPI PCI Hotplug driver" - depends on ACPI_BUS && HOTPLUG_PCI + depends on ACPI && HOTPLUG_PCI help Say Y here if you have a system that supports PCI Hotplug using ACPI. @@ -157,7 +157,7 @@ config HOTPLUG_PCI_SHPC_POLL_EVENT_MODE config HOTPLUG_PCI_SHPC_PHPRM_LEGACY bool "For AMD SHPC only: Use $HRT for resource/configuration" - depends on HOTPLUG_PCI_SHPC && !ACPI_BUS + depends on HOTPLUG_PCI_SHPC && !ACPI help Say Y here for AMD SHPC. You have to select this option if you are using this driver on platform with AMD SHPC. diff --git a/drivers/pci/hotplug/Makefile b/drivers/pci/hotplug/Makefile index 31a307004b9..246586a3d91 100644 --- a/drivers/pci/hotplug/Makefile +++ b/drivers/pci/hotplug/Makefile @@ -51,7 +51,7 @@ pciehp-objs := pciehp_core.o \ pciehp_ctrl.o \ pciehp_pci.o \ pciehp_hpc.o -ifdef CONFIG_ACPI_BUS +ifdef CONFIG_ACPI pciehp-objs += pciehprm_acpi.o else pciehp-objs += pciehprm_nonacpi.o @@ -62,7 +62,7 @@ shpchp-objs := shpchp_core.o \ shpchp_pci.o \ shpchp_sysfs.o \ shpchp_hpc.o -ifdef CONFIG_ACPI_BUS +ifdef CONFIG_ACPI shpchp-objs += shpchprm_acpi.o else ifdef CONFIG_HOTPLUG_PCI_SHPC_PHPRM_LEGACY diff --git a/drivers/pnp/Kconfig b/drivers/pnp/Kconfig index 6776308a1fe..c5143201419 100644 --- a/drivers/pnp/Kconfig +++ b/drivers/pnp/Kconfig @@ -6,7 +6,7 @@ menu "Plug and Play support" config PNP bool "Plug and Play support" - depends on ISA || ACPI_BUS + depends on ISA || ACPI ---help--- Plug and Play (PnP) is a standard for peripherals which allows those peripherals to be configured by software, e.g. assign IRQ's or other diff --git a/drivers/pnp/pnpacpi/Kconfig b/drivers/pnp/pnpacpi/Kconfig index 0782cdc5009..b1854171b96 100644 --- a/drivers/pnp/pnpacpi/Kconfig +++ b/drivers/pnp/pnpacpi/Kconfig @@ -3,7 +3,7 @@ # config PNPACPI bool "Plug and Play ACPI support (EXPERIMENTAL)" - depends on PNP && ACPI_BUS && EXPERIMENTAL + depends on PNP && ACPI && EXPERIMENTAL default y ---help--- Linux uses the PNPACPI to autodetect built-in diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig index 97034d3937f..56de409f486 100644 --- a/drivers/serial/Kconfig +++ b/drivers/serial/Kconfig @@ -80,7 +80,7 @@ config SERIAL_8250_CS config SERIAL_8250_ACPI bool "8250/16550 device discovery via ACPI namespace" default y if IA64 - depends on ACPI_BUS && SERIAL_8250 + depends on ACPI && SERIAL_8250 ---help--- If you wish to enable serial port discovery via the ACPI namespace, say Y here. If unsure, say N. diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h index 4f4b2baa717..0b54e9a4a8a 100644 --- a/include/acpi/acpi_bus.h +++ b/include/acpi/acpi_bus.h @@ -53,7 +53,7 @@ acpi_evaluate_reference(acpi_handle handle, struct acpi_object_list *arguments, struct acpi_handle_list *list); -#ifdef CONFIG_ACPI_BUS +#ifdef CONFIG_ACPI #include @@ -356,6 +356,6 @@ acpi_handle acpi_get_child(acpi_handle, acpi_integer); acpi_handle acpi_get_pci_rootbridge_handle(unsigned int, unsigned int); #define DEVICE_ACPI_HANDLE(dev) ((acpi_handle)((dev)->firmware_data)) -#endif /*CONFIG_ACPI_BUS */ +#endif /* CONFIG_ACPI */ #endif /*__ACPI_BUS_H__*/ -- cgit v1.2.3-70-g09d2 From 6153df7b2f4d27c8bde054db1b947369a6f64d83 Mon Sep 17 00:00:00 2001 From: Len Brown Date: Thu, 25 Aug 2005 12:27:09 -0400 Subject: [ACPI] delete CONFIG_ACPI_PCI Delete the ability to build an ACPI kernel that does not include PCI support. When such a machine is created and it requires a tuned kernel, send a patch. http://bugzilla.kernel.org/show_bug.cgi?id=1364 Signed-off-by: Len Brown --- arch/i386/defconfig | 1 - arch/i386/kernel/acpi/boot.c | 9 --------- arch/i386/pci/Makefile | 2 +- arch/i386/pci/irq.c | 2 +- arch/ia64/configs/bigsur_defconfig | 1 - arch/ia64/configs/sn2_defconfig | 1 - arch/ia64/configs/tiger_defconfig | 1 - arch/ia64/configs/zx1_defconfig | 1 - arch/ia64/defconfig | 1 - arch/x86_64/defconfig | 1 - arch/x86_64/pci/Makefile | 2 +- arch/x86_64/pci/Makefile-BUS | 2 +- drivers/acpi/Kconfig | 7 ++----- drivers/acpi/Makefile | 2 +- drivers/acpi/osl.c | 28 ---------------------------- include/acpi/acpi_drivers.h | 4 ---- include/asm-i386/acpi.h | 18 ++++++++---------- include/asm-x86_64/acpi.h | 25 +++++++++++-------------- include/linux/acpi.h | 4 ++-- 19 files changed, 28 insertions(+), 84 deletions(-) (limited to 'include') diff --git a/arch/i386/defconfig b/arch/i386/defconfig index 1a387856c87..6a431b92601 100644 --- a/arch/i386/defconfig +++ b/arch/i386/defconfig @@ -144,7 +144,6 @@ CONFIG_ACPI_THERMAL=y # CONFIG_ACPI_DEBUG is not set CONFIG_ACPI_EC=y CONFIG_ACPI_POWER=y -CONFIG_ACPI_PCI=y CONFIG_ACPI_SYSTEM=y # CONFIG_X86_PM_TIMER is not set diff --git a/arch/i386/kernel/acpi/boot.c b/arch/i386/kernel/acpi/boot.c index 552fc85691a..0fb23c30eb9 100644 --- a/arch/i386/kernel/acpi/boot.c +++ b/arch/i386/kernel/acpi/boot.c @@ -66,13 +66,8 @@ static inline int ioapic_setup_disabled(void) #define PREFIX "ACPI: " -#ifdef CONFIG_ACPI_PCI int acpi_noirq __initdata; /* skip ACPI IRQ initialization */ int acpi_pci_disabled __initdata; /* skip ACPI PCI scan and IRQ initialization */ -#else -int acpi_noirq __initdata = 1; -int acpi_pci_disabled __initdata = 1; -#endif int acpi_ht __initdata = 1; /* enable HT */ int acpi_lapic; @@ -849,7 +844,6 @@ extern int acpi_force; #ifdef __i386__ -#ifdef CONFIG_ACPI_PCI static int __init disable_acpi_irq(struct dmi_system_id *d) { if (!acpi_force) { @@ -869,7 +863,6 @@ static int __init disable_acpi_pci(struct dmi_system_id *d) } return 0; } -#endif static int __init dmi_disable_acpi(struct dmi_system_id *d) { @@ -1017,7 +1010,6 @@ static struct dmi_system_id __initdata acpi_dmi_table[] = { }, }, -#ifdef CONFIG_ACPI_PCI /* * Boxes that need ACPI PCI IRQ routing disabled */ @@ -1055,7 +1047,6 @@ static struct dmi_system_id __initdata acpi_dmi_table[] = { DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 360"), }, }, -#endif {} }; diff --git a/arch/i386/pci/Makefile b/arch/i386/pci/Makefile index 1bff03f3696..ead6122dd06 100644 --- a/arch/i386/pci/Makefile +++ b/arch/i386/pci/Makefile @@ -5,7 +5,7 @@ obj-$(CONFIG_PCI_MMCONFIG) += mmconfig.o obj-$(CONFIG_PCI_DIRECT) += direct.o pci-y := fixup.o -pci-$(CONFIG_ACPI_PCI) += acpi.o +pci-$(CONFIG_ACPI) += acpi.o pci-y += legacy.o irq.o pci-$(CONFIG_X86_VISWS) := visws.o fixup.o diff --git a/arch/i386/pci/irq.c b/arch/i386/pci/irq.c index 86348b68fda..326a2edc383 100644 --- a/arch/i386/pci/irq.c +++ b/arch/i386/pci/irq.c @@ -1075,7 +1075,7 @@ static void pirq_penalize_isa_irq(int irq, int active) void pcibios_penalize_isa_irq(int irq, int active) { -#ifdef CONFIG_ACPI_PCI +#ifdef CONFIG_ACPI if (!acpi_noirq) acpi_penalize_isa_irq(irq, active); else diff --git a/arch/ia64/configs/bigsur_defconfig b/arch/ia64/configs/bigsur_defconfig index 71dcfe0e3f7..3b65cbb31b1 100644 --- a/arch/ia64/configs/bigsur_defconfig +++ b/arch/ia64/configs/bigsur_defconfig @@ -113,7 +113,6 @@ CONFIG_ACPI_PROCESSOR=m CONFIG_ACPI_THERMAL=m # CONFIG_ACPI_DEBUG is not set CONFIG_ACPI_POWER=y -CONFIG_ACPI_PCI=y CONFIG_ACPI_SYSTEM=y # diff --git a/arch/ia64/configs/sn2_defconfig b/arch/ia64/configs/sn2_defconfig index ac17ed2ff97..1ca6e6e11b4 100644 --- a/arch/ia64/configs/sn2_defconfig +++ b/arch/ia64/configs/sn2_defconfig @@ -136,7 +136,6 @@ CONFIG_ACPI=y CONFIG_ACPI_NUMA=y # CONFIG_ACPI_DEBUG is not set CONFIG_ACPI_POWER=y -CONFIG_ACPI_PCI=y CONFIG_ACPI_SYSTEM=y # CONFIG_ACPI_CONTAINER is not set diff --git a/arch/ia64/configs/tiger_defconfig b/arch/ia64/configs/tiger_defconfig index 3a629414229..3ec94a12eac 100644 --- a/arch/ia64/configs/tiger_defconfig +++ b/arch/ia64/configs/tiger_defconfig @@ -135,7 +135,6 @@ CONFIG_ACPI_PROCESSOR=m CONFIG_ACPI_THERMAL=m # CONFIG_ACPI_DEBUG is not set CONFIG_ACPI_POWER=y -CONFIG_ACPI_PCI=y CONFIG_ACPI_SYSTEM=y # CONFIG_ACPI_CONTAINER is not set diff --git a/arch/ia64/configs/zx1_defconfig b/arch/ia64/configs/zx1_defconfig index 84cdf32ede7..d4cf73d124b 100644 --- a/arch/ia64/configs/zx1_defconfig +++ b/arch/ia64/configs/zx1_defconfig @@ -134,7 +134,6 @@ CONFIG_ACPI_PROCESSOR=y CONFIG_ACPI_THERMAL=y # CONFIG_ACPI_DEBUG is not set CONFIG_ACPI_POWER=y -CONFIG_ACPI_PCI=y CONFIG_ACPI_SYSTEM=y # CONFIG_ACPI_CONTAINER is not set diff --git a/arch/ia64/defconfig b/arch/ia64/defconfig index 7002d5a3cc1..b6ec8d32c34 100644 --- a/arch/ia64/defconfig +++ b/arch/ia64/defconfig @@ -126,7 +126,6 @@ CONFIG_ACPI_THERMAL=m CONFIG_ACPI_NUMA=y # CONFIG_ACPI_DEBUG is not set CONFIG_ACPI_POWER=y -CONFIG_ACPI_PCI=y CONFIG_ACPI_SYSTEM=y CONFIG_ACPI_CONTAINER=m diff --git a/arch/x86_64/defconfig b/arch/x86_64/defconfig index 62abdc0adab..b95c6cf2659 100644 --- a/arch/x86_64/defconfig +++ b/arch/x86_64/defconfig @@ -151,7 +151,6 @@ CONFIG_ACPI_BLACKLIST_YEAR=2001 # CONFIG_ACPI_DEBUG is not set CONFIG_ACPI_EC=y CONFIG_ACPI_POWER=y -CONFIG_ACPI_PCI=y CONFIG_ACPI_SYSTEM=y # CONFIG_ACPI_CONTAINER is not set diff --git a/arch/x86_64/pci/Makefile b/arch/x86_64/pci/Makefile index 37c92e841de..bb34e5ef916 100644 --- a/arch/x86_64/pci/Makefile +++ b/arch/x86_64/pci/Makefile @@ -8,7 +8,7 @@ CFLAGS += -Iarch/i386/pci obj-y := i386.o obj-$(CONFIG_PCI_DIRECT)+= direct.o obj-y += fixup.o -obj-$(CONFIG_ACPI_PCI) += acpi.o +obj-$(CONFIG_ACPI) += acpi.o obj-y += legacy.o irq.o common.o # mmconfig has a 64bit special obj-$(CONFIG_PCI_MMCONFIG) += mmconfig.o diff --git a/arch/x86_64/pci/Makefile-BUS b/arch/x86_64/pci/Makefile-BUS index 291985f0d2e..4f0c05abd40 100644 --- a/arch/x86_64/pci/Makefile-BUS +++ b/arch/x86_64/pci/Makefile-BUS @@ -8,7 +8,7 @@ CFLAGS += -I arch/i386/pci obj-y := i386.o obj-$(CONFIG_PCI_DIRECT)+= direct.o obj-y += fixup.o -obj-$(CONFIG_ACPI_PCI) += acpi.o +obj-$(CONFIG_ACPI) += acpi.o obj-y += legacy.o irq.o common.o # mmconfig has a 64bit special obj-$(CONFIG_PCI_MMCONFIG) += mmconfig.o diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig index 83cac52308d..3998c9d35fe 100644 --- a/drivers/acpi/Kconfig +++ b/drivers/acpi/Kconfig @@ -3,7 +3,6 @@ # menu "ACPI (Advanced Configuration and Power Interface) Support" - depends on PM depends on !X86_VISWS depends on !IA64_HP_SIM depends on IA64 || X86 @@ -11,6 +10,8 @@ menu "ACPI (Advanced Configuration and Power Interface) Support" config ACPI bool "ACPI Support" depends on IA64 || X86 + select PM + select PCI default y ---help--- @@ -281,10 +282,6 @@ config ACPI_POWER bool default y -config ACPI_PCI - bool - default PCI - config ACPI_SYSTEM bool default y diff --git a/drivers/acpi/Makefile b/drivers/acpi/Makefile index b6a3c919238..a18243488c6 100644 --- a/drivers/acpi/Makefile +++ b/drivers/acpi/Makefile @@ -44,7 +44,7 @@ obj-$(CONFIG_ACPI_EC) += ec.o obj-$(CONFIG_ACPI_FAN) += fan.o obj-$(CONFIG_ACPI_VIDEO) += video.o obj-$(CONFIG_ACPI_HOTKEY) += hotkey.o -obj-$(CONFIG_ACPI_PCI) += pci_root.o pci_link.o pci_irq.o pci_bind.o +obj-y += pci_root.o pci_link.o pci_irq.o pci_bind.o obj-$(CONFIG_ACPI_POWER) += power.o obj-$(CONFIG_ACPI_PROCESSOR) += processor.o obj-$(CONFIG_ACPI_CONTAINER) += container.o diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index 81f0eb863a7..dc69d8760a5 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c @@ -86,13 +86,11 @@ acpi_status acpi_os_initialize1(void) * Initialize PCI configuration space access, as we'll need to access * it while walking the namespace (bus 0 and root bridges w/ _BBNs). */ -#ifdef CONFIG_ACPI_PCI if (!raw_pci_ops) { printk(KERN_ERR PREFIX "Access to PCI configuration space unavailable\n"); return AE_NULL_ENTRY; } -#endif kacpid_wq = create_singlethread_workqueue("kacpid"); BUG_ON(!kacpid_wq); @@ -484,8 +482,6 @@ acpi_os_write_memory(acpi_physical_address phys_addr, u32 value, u32 width) return AE_OK; } -#ifdef CONFIG_ACPI_PCI - acpi_status acpi_os_read_pci_configuration(struct acpi_pci_id * pci_id, u32 reg, void *value, u32 width) @@ -618,30 +614,6 @@ void acpi_os_derive_pci_id(acpi_handle rhandle, /* upper bound */ acpi_os_derive_pci_id_2(rhandle, chandle, id, &is_bridge, &bus_number); } -#else /*!CONFIG_ACPI_PCI */ - -acpi_status -acpi_os_write_pci_configuration(struct acpi_pci_id * pci_id, - u32 reg, acpi_integer value, u32 width) -{ - return AE_SUPPORT; -} - -acpi_status -acpi_os_read_pci_configuration(struct acpi_pci_id * pci_id, - u32 reg, void *value, u32 width) -{ - return AE_SUPPORT; -} - -void acpi_os_derive_pci_id(acpi_handle rhandle, /* upper bound */ - acpi_handle chandle, /* current node */ - struct acpi_pci_id **id) -{ -} - -#endif /*CONFIG_ACPI_PCI */ - static void acpi_os_execute_deferred(void *context) { struct acpi_os_dpc *dpc = NULL; diff --git a/include/acpi/acpi_drivers.h b/include/acpi/acpi_drivers.h index e976cb109b1..c1b4e1f882e 100644 --- a/include/acpi/acpi_drivers.h +++ b/include/acpi/acpi_drivers.h @@ -47,8 +47,6 @@ PCI -------------------------------------------------------------------------- */ -#ifdef CONFIG_ACPI_PCI - #define ACPI_PCI_COMPONENT 0x00400000 /* ACPI PCI Interrupt Link (pci_link.c) */ @@ -78,8 +76,6 @@ int acpi_pci_bind_root(struct acpi_device *device, struct acpi_pci_id *id, struct pci_bus *pci_acpi_scan_root(struct acpi_device *device, int domain, int bus); -#endif /*CONFIG_ACPI_PCI */ - /* -------------------------------------------------------------------------- Power Resource -------------------------------------------------------------------------- */ diff --git a/include/asm-i386/acpi.h b/include/asm-i386/acpi.h index 1f1ade923d6..df4ed323aa4 100644 --- a/include/asm-i386/acpi.h +++ b/include/asm-i386/acpi.h @@ -146,13 +146,6 @@ static inline void check_acpi_pci(void) { } #endif -#else /* !CONFIG_ACPI */ -# define acpi_lapic 0 -# define acpi_ioapic 0 - -#endif - -#ifdef CONFIG_ACPI_PCI static inline void acpi_noirq_set(void) { acpi_noirq = 1; } static inline void acpi_disable_pci(void) { @@ -160,11 +153,16 @@ static inline void acpi_disable_pci(void) acpi_noirq_set(); } extern int acpi_irq_balance_set(char *str); -#else + +#else /* !CONFIG_ACPI */ + +#define acpi_lapic 0 +#define acpi_ioapic 0 static inline void acpi_noirq_set(void) { } static inline void acpi_disable_pci(void) { } -static inline int acpi_irq_balance_set(char *str) { return 0; } -#endif + +#endif /* !CONFIG_ACPI */ + #ifdef CONFIG_ACPI_SLEEP diff --git a/include/asm-x86_64/acpi.h b/include/asm-x86_64/acpi.h index 7d537e1867c..aa1c7b2e438 100644 --- a/include/asm-x86_64/acpi.h +++ b/include/asm-x86_64/acpi.h @@ -121,17 +121,6 @@ static inline void disable_acpi(void) #define FIX_ACPI_PAGES 4 extern int acpi_gsi_to_irq(u32 gsi, unsigned int *irq); - -#else /* !CONFIG_ACPI */ -#define acpi_lapic 0 -#define acpi_ioapic 0 -#endif /* !CONFIG_ACPI */ - -extern int acpi_numa; -extern int acpi_scan_nodes(unsigned long start, unsigned long end); -#define NR_NODE_MEMBLKS (MAX_NUMNODES*2) - -#ifdef CONFIG_ACPI_PCI static inline void acpi_noirq_set(void) { acpi_noirq = 1; } static inline void acpi_disable_pci(void) { @@ -139,11 +128,19 @@ static inline void acpi_disable_pci(void) acpi_noirq_set(); } extern int acpi_irq_balance_set(char *str); -#else + +#else /* !CONFIG_ACPI */ + +#define acpi_lapic 0 +#define acpi_ioapic 0 static inline void acpi_noirq_set(void) { } static inline void acpi_disable_pci(void) { } -static inline int acpi_irq_balance_set(char *str) { return 0; } -#endif + +#endif /* !CONFIG_ACPI */ + +extern int acpi_numa; +extern int acpi_scan_nodes(unsigned long start, unsigned long end); +#define NR_NODE_MEMBLKS (MAX_NUMNODES*2) #ifdef CONFIG_ACPI_SLEEP diff --git a/include/linux/acpi.h b/include/linux/acpi.h index 6882b32aa40..026c3c011dc 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h @@ -445,7 +445,7 @@ int acpi_gsi_to_irq (u32 gsi, unsigned int *irq); */ void acpi_unregister_gsi (u32 gsi); -#ifdef CONFIG_ACPI_PCI +#ifdef CONFIG_ACPI struct acpi_prt_entry { struct list_head node; @@ -479,7 +479,7 @@ struct acpi_pci_driver { int acpi_pci_register_driver(struct acpi_pci_driver *driver); void acpi_pci_unregister_driver(struct acpi_pci_driver *driver); -#endif /*CONFIG_ACPI_PCI*/ +#endif /* CONFIG_ACPI */ #ifdef CONFIG_ACPI_EC -- cgit v1.2.3-70-g09d2 From 392160335c798bbe94ab3aae6ea0c85d32b81bbc Mon Sep 17 00:00:00 2001 From: James Bottomley Date: Wed, 15 Jun 2005 18:48:29 -0500 Subject: [SCSI] use scatter lists for all block pc requests and simplify hw handlers Original From: Mike Christie Add scsi_execute_req() as a replacement for scsi_wait_req() Fixed up various pieces (added REQ_SPECIAL and caught req use after free) Signed-off-by: James Bottomley --- drivers/scsi/scsi_lib.c | 51 +++++++++++++++++++- drivers/scsi/scsi_scan.c | 112 +++++++++++++++++++------------------------- include/scsi/scsi_request.h | 3 ++ 3 files changed, 102 insertions(+), 64 deletions(-) (limited to 'include') diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 60f07b6a5ff..b8212c563fe 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -246,7 +246,7 @@ void scsi_wait_req(struct scsi_request *sreq, const void *cmnd, void *buffer, unsigned bufflen, int timeout, int retries) { DECLARE_COMPLETION(wait); - int write = sreq->sr_data_direction == DMA_TO_DEVICE; + int write = (sreq->sr_data_direction == DMA_TO_DEVICE); struct request *req; req = blk_get_request(sreq->sr_device->request_queue, write, @@ -281,6 +281,55 @@ void scsi_wait_req(struct scsi_request *sreq, const void *cmnd, void *buffer, EXPORT_SYMBOL(scsi_wait_req); +/** + * scsi_execute_req - insert request and wait for the result + * @sdev: scsi device + * @cmd: scsi command + * @data_direction: data direction + * @buffer: data buffer + * @bufflen: len of buffer + * @sense: optional sense buffer + * @timeout: request timeout in seconds + * @retries: number of times to retry request + * + * scsi_execute_req returns the req->errors value which is the + * the scsi_cmnd result field. + **/ +int scsi_execute_req(struct scsi_device *sdev, unsigned char *cmd, + int data_direction, void *buffer, unsigned bufflen, + unsigned char *sense, int timeout, int retries) +{ + struct request *req; + int write = (data_direction == DMA_TO_DEVICE); + int ret = DRIVER_ERROR << 24; + + req = blk_get_request(sdev->request_queue, write, __GFP_WAIT); + + if (bufflen && blk_rq_map_kern(sdev->request_queue, req, + buffer, bufflen, __GFP_WAIT)) + goto out; + + req->cmd_len = COMMAND_SIZE(cmd[0]); + memcpy(req->cmd, cmd, req->cmd_len); + req->sense = sense; + req->sense_len = 0; + req->timeout = timeout; + req->flags |= REQ_BLOCK_PC | REQ_SPECIAL; + + /* + * head injection *required* here otherwise quiesce won't work + */ + blk_execute_rq(req->q, NULL, req, 1); + + ret = req->errors; + out: + blk_put_request(req); + + return ret; +} + +EXPORT_SYMBOL(scsi_execute_req); + /* * Function: scsi_init_cmd_errh() * diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c index 48edd67982a..d2ca4b8fbc1 100644 --- a/drivers/scsi/scsi_scan.c +++ b/drivers/scsi/scsi_scan.c @@ -111,15 +111,14 @@ MODULE_PARM_DESC(inq_timeout, /** * scsi_unlock_floptical - unlock device via a special MODE SENSE command - * @sreq: used to send the command + * @sdev: scsi device to send command to * @result: area to store the result of the MODE SENSE * * Description: - * Send a vendor specific MODE SENSE (not a MODE SELECT) command using - * @sreq to unlock a device, storing the (unused) results into result. + * Send a vendor specific MODE SENSE (not a MODE SELECT) command. * Called for BLIST_KEY devices. **/ -static void scsi_unlock_floptical(struct scsi_request *sreq, +static void scsi_unlock_floptical(struct scsi_device *sdev, unsigned char *result) { unsigned char scsi_cmd[MAX_COMMAND_SIZE]; @@ -129,11 +128,10 @@ static void scsi_unlock_floptical(struct scsi_request *sreq, scsi_cmd[1] = 0; scsi_cmd[2] = 0x2e; scsi_cmd[3] = 0; - scsi_cmd[4] = 0x2a; /* size */ + scsi_cmd[4] = 0x2a; /* size */ scsi_cmd[5] = 0; - sreq->sr_cmd_len = 0; - sreq->sr_data_direction = DMA_FROM_DEVICE; - scsi_wait_req(sreq, scsi_cmd, result, 0x2a /* size */, SCSI_TIMEOUT, 3); + scsi_execute_req(sdev, scsi_cmd, DMA_FROM_DEVICE, result, 0x2a, NULL, + SCSI_TIMEOUT, 3); } /** @@ -433,26 +431,26 @@ void scsi_target_reap(struct scsi_target *starget) /** * scsi_probe_lun - probe a single LUN using a SCSI INQUIRY - * @sreq: used to send the INQUIRY + * @sdev: scsi_device to probe * @inq_result: area to store the INQUIRY result + * @result_len: len of inq_result * @bflags: store any bflags found here * * Description: - * Probe the lun associated with @sreq using a standard SCSI INQUIRY; + * Probe the lun associated with @req using a standard SCSI INQUIRY; * - * If the INQUIRY is successful, sreq->sr_result is zero and: the + * If the INQUIRY is successful, zero is returned and the * INQUIRY data is in @inq_result; the scsi_level and INQUIRY length - * are copied to the Scsi_Device at @sreq->sr_device (sdev); - * any flags value is stored in *@bflags. + * are copied to the Scsi_Device any flags value is stored in *@bflags. **/ -static void scsi_probe_lun(struct scsi_request *sreq, char *inq_result, - int *bflags) +static int scsi_probe_lun(struct scsi_device *sdev, char *inq_result, + int result_len, int *bflags) { - struct scsi_device *sdev = sreq->sr_device; /* a bit ugly */ + char sense[SCSI_SENSE_BUFFERSIZE]; unsigned char scsi_cmd[MAX_COMMAND_SIZE]; int first_inquiry_len, try_inquiry_len, next_inquiry_len; int response_len = 0; - int pass, count; + int pass, count, result; struct scsi_sense_hdr sshdr; *bflags = 0; @@ -475,28 +473,28 @@ static void scsi_probe_lun(struct scsi_request *sreq, char *inq_result, memset(scsi_cmd, 0, 6); scsi_cmd[0] = INQUIRY; scsi_cmd[4] = (unsigned char) try_inquiry_len; - sreq->sr_cmd_len = 0; - sreq->sr_data_direction = DMA_FROM_DEVICE; + memset(sense, 0, sizeof(sense)); memset(inq_result, 0, try_inquiry_len); - scsi_wait_req(sreq, (void *) scsi_cmd, (void *) inq_result, - try_inquiry_len, - HZ/2 + HZ*scsi_inq_timeout, 3); + + result = scsi_execute_req(sdev, scsi_cmd, DMA_FROM_DEVICE, + inq_result, try_inquiry_len, sense, + HZ / 2 + HZ * scsi_inq_timeout, 3); SCSI_LOG_SCAN_BUS(3, printk(KERN_INFO "scsi scan: INQUIRY %s " "with code 0x%x\n", - sreq->sr_result ? "failed" : "successful", - sreq->sr_result)); + result ? "failed" : "successful", result)); - if (sreq->sr_result) { + if (result) { /* * not-ready to ready transition [asc/ascq=0x28/0x0] * or power-on, reset [asc/ascq=0x29/0x0], continue. * INQUIRY should not yield UNIT_ATTENTION * but many buggy devices do so anyway. */ - if ((driver_byte(sreq->sr_result) & DRIVER_SENSE) && - scsi_request_normalize_sense(sreq, &sshdr)) { + if ((driver_byte(result) & DRIVER_SENSE) && + scsi_normalize_sense(sense, sizeof(sense), + &sshdr)) { if ((sshdr.sense_key == UNIT_ATTENTION) && ((sshdr.asc == 0x28) || (sshdr.asc == 0x29)) && @@ -507,7 +505,7 @@ static void scsi_probe_lun(struct scsi_request *sreq, char *inq_result, break; } - if (sreq->sr_result == 0) { + if (result == 0) { response_len = (unsigned char) inq_result[4] + 5; if (response_len > 255) response_len = first_inquiry_len; /* sanity */ @@ -556,8 +554,8 @@ static void scsi_probe_lun(struct scsi_request *sreq, char *inq_result, /* If the last transfer attempt got an error, assume the * peripheral doesn't exist or is dead. */ - if (sreq->sr_result) - return; + if (result) + return -EIO; /* Don't report any more data than the device says is valid */ sdev->inquiry_len = min(try_inquiry_len, response_len); @@ -593,7 +591,7 @@ static void scsi_probe_lun(struct scsi_request *sreq, char *inq_result, (sdev->scsi_level == 1 && (inq_result[3] & 0x0f) == 1)) sdev->scsi_level++; - return; + return 0; } /** @@ -800,9 +798,8 @@ static int scsi_probe_and_add_lun(struct scsi_target *starget, void *hostdata) { struct scsi_device *sdev; - struct scsi_request *sreq; unsigned char *result; - int bflags, res = SCSI_SCAN_NO_RESPONSE; + int bflags, res = SCSI_SCAN_NO_RESPONSE, result_len = 256; struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); /* @@ -831,16 +828,13 @@ static int scsi_probe_and_add_lun(struct scsi_target *starget, sdev = scsi_alloc_sdev(starget, lun, hostdata); if (!sdev) goto out; - sreq = scsi_allocate_request(sdev, GFP_ATOMIC); - if (!sreq) - goto out_free_sdev; - result = kmalloc(256, GFP_ATOMIC | + + result = kmalloc(result_len, GFP_ATOMIC | ((shost->unchecked_isa_dma) ? __GFP_DMA : 0)); if (!result) - goto out_free_sreq; + goto out_free_sdev; - scsi_probe_lun(sreq, result, &bflags); - if (sreq->sr_result) + if (scsi_probe_lun(sdev, result, result_len, &bflags)) goto out_free_result; /* @@ -868,7 +862,7 @@ static int scsi_probe_and_add_lun(struct scsi_target *starget, if (res == SCSI_SCAN_LUN_PRESENT) { if (bflags & BLIST_KEY) { sdev->lockable = 0; - scsi_unlock_floptical(sreq, result); + scsi_unlock_floptical(sdev, result); } if (bflagsp) *bflagsp = bflags; @@ -876,8 +870,6 @@ static int scsi_probe_and_add_lun(struct scsi_target *starget, out_free_result: kfree(result); - out_free_sreq: - scsi_release_request(sreq); out_free_sdev: if (res == SCSI_SCAN_LUN_PRESENT) { if (sdevp) { @@ -1065,13 +1057,14 @@ static int scsi_report_lun_scan(struct scsi_device *sdev, int bflags, int rescan) { char devname[64]; + char sense[SCSI_SENSE_BUFFERSIZE]; unsigned char scsi_cmd[MAX_COMMAND_SIZE]; unsigned int length; unsigned int lun; unsigned int num_luns; unsigned int retries; + int result; struct scsi_lun *lunp, *lun_data; - struct scsi_request *sreq; u8 *data; struct scsi_sense_hdr sshdr; struct scsi_target *starget = scsi_target(sdev); @@ -1089,10 +1082,6 @@ static int scsi_report_lun_scan(struct scsi_device *sdev, int bflags, if (bflags & BLIST_NOLUN) return 0; - sreq = scsi_allocate_request(sdev, GFP_ATOMIC); - if (!sreq) - goto out; - sprintf(devname, "host %d channel %d id %d", sdev->host->host_no, sdev->channel, sdev->id); @@ -1110,7 +1099,7 @@ static int scsi_report_lun_scan(struct scsi_device *sdev, int bflags, lun_data = kmalloc(length, GFP_ATOMIC | (sdev->host->unchecked_isa_dma ? __GFP_DMA : 0)); if (!lun_data) - goto out_release_request; + goto out; scsi_cmd[0] = REPORT_LUNS; @@ -1129,8 +1118,6 @@ static int scsi_report_lun_scan(struct scsi_device *sdev, int bflags, scsi_cmd[10] = 0; /* reserved */ scsi_cmd[11] = 0; /* control */ - sreq->sr_cmd_len = 0; - sreq->sr_data_direction = DMA_FROM_DEVICE; /* * We can get a UNIT ATTENTION, for example a power on/reset, so @@ -1146,29 +1133,30 @@ static int scsi_report_lun_scan(struct scsi_device *sdev, int bflags, SCSI_LOG_SCAN_BUS(3, printk (KERN_INFO "scsi scan: Sending" " REPORT LUNS to %s (try %d)\n", devname, retries)); - scsi_wait_req(sreq, scsi_cmd, lun_data, length, - SCSI_TIMEOUT + 4*HZ, 3); + + memset(sense, 0, sizeof(sense)); + result = scsi_execute_req(sdev, scsi_cmd, DMA_FROM_DEVICE, + lun_data, length, sense, + SCSI_TIMEOUT + 4 * HZ, 3); + SCSI_LOG_SCAN_BUS(3, printk (KERN_INFO "scsi scan: REPORT LUNS" - " %s (try %d) result 0x%x\n", sreq->sr_result - ? "failed" : "successful", retries, - sreq->sr_result)); - if (sreq->sr_result == 0) + " %s (try %d) result 0x%x\n", result + ? "failed" : "successful", retries, result)); + if (result == 0) break; - else if (scsi_request_normalize_sense(sreq, &sshdr)) { + else if (scsi_normalize_sense(sense, sizeof(sense), &sshdr)) { if (sshdr.sense_key != UNIT_ATTENTION) break; } } - if (sreq->sr_result) { + if (result) { /* * The device probably does not support a REPORT LUN command */ kfree(lun_data); - scsi_release_request(sreq); return 1; } - scsi_release_request(sreq); /* * Get the length from the first four bytes of lun_data. @@ -1242,8 +1230,6 @@ static int scsi_report_lun_scan(struct scsi_device *sdev, int bflags, kfree(lun_data); return 0; - out_release_request: - scsi_release_request(sreq); out: /* * We are out of memory, don't try scanning any further. diff --git a/include/scsi/scsi_request.h b/include/scsi/scsi_request.h index 98719407d55..d64903a617c 100644 --- a/include/scsi/scsi_request.h +++ b/include/scsi/scsi_request.h @@ -54,6 +54,9 @@ extern void scsi_do_req(struct scsi_request *, const void *cmnd, void *buffer, unsigned bufflen, void (*done) (struct scsi_cmnd *), int timeout, int retries); +extern int scsi_execute_req(struct scsi_device *sdev, unsigned char *cmd, + int data_direction, void *buffer, unsigned bufflen, + unsigned char *sense, int timeout, int retries); struct scsi_mode_data { __u32 length; -- cgit v1.2.3-70-g09d2 From caca1779870b1bcc0fb07e48ebd2403901f356b8 Mon Sep 17 00:00:00 2001 From: James Bottomley Date: Tue, 16 Aug 2005 17:26:10 -0500 Subject: [SCSI] add missing attribute container function prototype attribute_container_classdev_to_container is an exported function of the attribute_container.c file. However, there's no prototype for it. Now I actually want to use it, so add one. Signed-off-by: James Bottomley --- include/linux/attribute_container.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/linux/attribute_container.h b/include/linux/attribute_container.h index f54b05b052b..ee83fe64a10 100644 --- a/include/linux/attribute_container.h +++ b/include/linux/attribute_container.h @@ -64,6 +64,7 @@ int attribute_container_add_class_device_adapter(struct attribute_container *con struct class_device *classdev); void attribute_container_remove_attrs(struct class_device *classdev); void attribute_container_class_device_del(struct class_device *classdev); +struct attribute_container *attribute_container_classdev_to_container(struct class_device *); struct class_device *attribute_container_find_class_device(struct attribute_container *, struct device *); struct class_device_attribute **attribute_container_classdev_to_attrs(const struct class_device *classdev); -- cgit v1.2.3-70-g09d2 From 1cf72699c1530c3e4ac3d58344f6a6a40a2f46d3 Mon Sep 17 00:00:00 2001 From: James Bottomley Date: Sun, 28 Aug 2005 11:27:01 -0500 Subject: [SCSI] convert the remaining mid-layer pieces to scsi_execute_req After this, we just have some drivers, all the ULDs and the SPI transport class using scsi_wait_req(). Signed-off-by: James Bottomley --- drivers/scsi/scsi_ioctl.c | 46 ++++++++-------------- drivers/scsi/scsi_lib.c | 94 ++++++++++++++++----------------------------- drivers/scsi/sd.c | 5 ++- drivers/scsi/sr.c | 2 +- include/scsi/scsi_device.h | 13 ++++++- include/scsi/scsi_request.h | 15 -------- 6 files changed, 64 insertions(+), 111 deletions(-) (limited to 'include') diff --git a/drivers/scsi/scsi_ioctl.c b/drivers/scsi/scsi_ioctl.c index f5bf5c07be9..5f399c9c68e 100644 --- a/drivers/scsi/scsi_ioctl.c +++ b/drivers/scsi/scsi_ioctl.c @@ -88,25 +88,21 @@ static int ioctl_probe(struct Scsi_Host *host, void __user *buffer) static int ioctl_internal_command(struct scsi_device *sdev, char *cmd, int timeout, int retries) { - struct scsi_request *sreq; int result; struct scsi_sense_hdr sshdr; + char sense[SCSI_SENSE_BUFFERSIZE]; SCSI_LOG_IOCTL(1, printk("Trying ioctl with scsi command %d\n", *cmd)); - sreq = scsi_allocate_request(sdev, GFP_KERNEL); - if (!sreq) { - printk(KERN_WARNING "SCSI internal ioctl failed, no memory\n"); - return -ENOMEM; - } - sreq->sr_data_direction = DMA_NONE; - scsi_wait_req(sreq, cmd, NULL, 0, timeout, retries); + memset(sense, 0, sizeof(*sense)); + result = scsi_execute_req(sdev, cmd, DMA_NONE, NULL, 0, + sense, timeout, retries); - SCSI_LOG_IOCTL(2, printk("Ioctl returned 0x%x\n", sreq->sr_result)); + SCSI_LOG_IOCTL(2, printk("Ioctl returned 0x%x\n", result)); - if ((driver_byte(sreq->sr_result) & DRIVER_SENSE) && - (scsi_request_normalize_sense(sreq, &sshdr))) { + if ((driver_byte(result) & DRIVER_SENSE) && + (scsi_normalize_sense(sense, sizeof(*sense), &sshdr))) { switch (sshdr.sense_key) { case ILLEGAL_REQUEST: if (cmd[0] == ALLOW_MEDIUM_REMOVAL) @@ -125,7 +121,7 @@ static int ioctl_internal_command(struct scsi_device *sdev, char *cmd, case UNIT_ATTENTION: if (sdev->removable) { sdev->changed = 1; - sreq->sr_result = 0; /* This is no longer considered an error */ + result = 0; /* This is no longer considered an error */ break; } default: /* Fall through for non-removable media */ @@ -135,15 +131,13 @@ static int ioctl_internal_command(struct scsi_device *sdev, char *cmd, sdev->channel, sdev->id, sdev->lun, - sreq->sr_result); - scsi_print_req_sense(" ", sreq); + result); + __scsi_print_sense(" ", sense, sizeof(*sense)); break; } } - result = sreq->sr_result; SCSI_LOG_IOCTL(2, printk("IOCTL Releasing command\n")); - scsi_release_request(sreq); return result; } @@ -208,8 +202,8 @@ int scsi_ioctl_send_command(struct scsi_device *sdev, { char *buf; unsigned char cmd[MAX_COMMAND_SIZE]; + unsigned char sense[SCSI_SENSE_BUFFERSIZE]; char __user *cmd_in; - struct scsi_request *sreq; unsigned char opcode; unsigned int inlen, outlen, cmdlen; unsigned int needed, buf_needed; @@ -321,31 +315,23 @@ int scsi_ioctl_send_command(struct scsi_device *sdev, break; } - sreq = scsi_allocate_request(sdev, GFP_KERNEL); - if (!sreq) { - result = -EINTR; - goto error; - } - - sreq->sr_data_direction = data_direction; - scsi_wait_req(sreq, cmd, buf, needed, timeout, retries); - + result = scsi_execute_req(sdev, cmd, data_direction, buf, needed, + sense, timeout, retries); + /* * If there was an error condition, pass the info back to the user. */ - result = sreq->sr_result; if (result) { - int sb_len = sizeof(sreq->sr_sense_buffer); + int sb_len = sizeof(*sense); sb_len = (sb_len > OMAX_SB_LEN) ? OMAX_SB_LEN : sb_len; - if (copy_to_user(cmd_in, sreq->sr_sense_buffer, sb_len)) + if (copy_to_user(cmd_in, sense, sb_len)) result = -EFAULT; } else { if (copy_to_user(cmd_in, buf, outlen)) result = -EFAULT; } - scsi_release_request(sreq); error: kfree(buf); return result; diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 278e0c99b2a..3f3accd6cd4 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -1615,7 +1615,7 @@ void scsi_exit_queue(void) /** * __scsi_mode_sense - issue a mode sense, falling back from 10 to * six bytes if necessary. - * @sreq: SCSI request to fill in with the MODE_SENSE + * @sdev: SCSI device to be queried * @dbd: set if mode sense will allow block descriptors to be returned * @modepage: mode page being requested * @buffer: request buffer (may not be smaller than eight bytes) @@ -1623,26 +1623,38 @@ void scsi_exit_queue(void) * @timeout: command timeout * @retries: number of retries before failing * @data: returns a structure abstracting the mode header data + * @sense: place to put sense data (or NULL if no sense to be collected). + * must be SCSI_SENSE_BUFFERSIZE big. * * Returns zero if unsuccessful, or the header offset (either 4 * or 8 depending on whether a six or ten byte command was * issued) if successful. **/ int -__scsi_mode_sense(struct scsi_request *sreq, int dbd, int modepage, +scsi_mode_sense(struct scsi_device *sdev, int dbd, int modepage, unsigned char *buffer, int len, int timeout, int retries, - struct scsi_mode_data *data) { + struct scsi_mode_data *data, char *sense) { unsigned char cmd[12]; int use_10_for_ms; int header_length; + int result; + char *sense_buffer = NULL; memset(data, 0, sizeof(*data)); memset(&cmd[0], 0, 12); cmd[1] = dbd & 0x18; /* allows DBD and LLBA bits */ cmd[2] = modepage; + if (!sense) { + sense_buffer = kmalloc(SCSI_SENSE_BUFFERSIZE, GFP_KERNEL); + if (!sense_buffer) { + dev_printk(KERN_ERR, &sdev->sdev_gendev, "failed to allocate sense buffer\n"); + return 0; + } + sense = sense_buffer; + } retry: - use_10_for_ms = sreq->sr_device->use_10_for_ms; + use_10_for_ms = sdev->use_10_for_ms; if (use_10_for_ms) { if (len < 8) @@ -1660,36 +1672,35 @@ __scsi_mode_sense(struct scsi_request *sreq, int dbd, int modepage, header_length = 4; } - sreq->sr_cmd_len = 0; - memset(sreq->sr_sense_buffer, 0, sizeof(sreq->sr_sense_buffer)); - sreq->sr_data_direction = DMA_FROM_DEVICE; + memset(sense, 0, SCSI_SENSE_BUFFERSIZE); memset(buffer, 0, len); - scsi_wait_req(sreq, cmd, buffer, len, timeout, retries); + result = scsi_execute_req(sdev, cmd, DMA_FROM_DEVICE, buffer, len, + sense, timeout, retries); /* This code looks awful: what it's doing is making sure an * ILLEGAL REQUEST sense return identifies the actual command * byte as the problem. MODE_SENSE commands can return * ILLEGAL REQUEST if the code page isn't supported */ - if (use_10_for_ms && !scsi_status_is_good(sreq->sr_result) && - (driver_byte(sreq->sr_result) & DRIVER_SENSE)) { + if (use_10_for_ms && !scsi_status_is_good(result) && + (driver_byte(result) & DRIVER_SENSE)) { struct scsi_sense_hdr sshdr; - if (scsi_request_normalize_sense(sreq, &sshdr)) { + if (scsi_normalize_sense(sense, SCSI_SENSE_BUFFERSIZE, &sshdr)) { if ((sshdr.sense_key == ILLEGAL_REQUEST) && (sshdr.asc == 0x20) && (sshdr.ascq == 0)) { /* * Invalid command operation code */ - sreq->sr_device->use_10_for_ms = 0; + sdev->use_10_for_ms = 0; goto retry; } } } - if(scsi_status_is_good(sreq->sr_result)) { + if(scsi_status_is_good(result)) { data->header_length = header_length; if(use_10_for_ms) { data->length = buffer[0]*256 + buffer[1] + 2; @@ -1706,73 +1717,34 @@ __scsi_mode_sense(struct scsi_request *sreq, int dbd, int modepage, } } - return sreq->sr_result; -} -EXPORT_SYMBOL(__scsi_mode_sense); - -/** - * scsi_mode_sense - issue a mode sense, falling back from 10 to - * six bytes if necessary. - * @sdev: scsi device to send command to. - * @dbd: set if mode sense will disable block descriptors in the return - * @modepage: mode page being requested - * @buffer: request buffer (may not be smaller than eight bytes) - * @len: length of request buffer. - * @timeout: command timeout - * @retries: number of retries before failing - * - * Returns zero if unsuccessful, or the header offset (either 4 - * or 8 depending on whether a six or ten byte command was - * issued) if successful. - **/ -int -scsi_mode_sense(struct scsi_device *sdev, int dbd, int modepage, - unsigned char *buffer, int len, int timeout, int retries, - struct scsi_mode_data *data) -{ - struct scsi_request *sreq = scsi_allocate_request(sdev, GFP_KERNEL); - int ret; - - if (!sreq) - return -1; - - ret = __scsi_mode_sense(sreq, dbd, modepage, buffer, len, - timeout, retries, data); - - scsi_release_request(sreq); - - return ret; + kfree(sense_buffer); + return result; } EXPORT_SYMBOL(scsi_mode_sense); int scsi_test_unit_ready(struct scsi_device *sdev, int timeout, int retries) { - struct scsi_request *sreq; char cmd[] = { TEST_UNIT_READY, 0, 0, 0, 0, 0, }; + char sense[SCSI_SENSE_BUFFERSIZE]; int result; - sreq = scsi_allocate_request(sdev, GFP_KERNEL); - if (!sreq) - return -ENOMEM; - - sreq->sr_data_direction = DMA_NONE; - scsi_wait_req(sreq, cmd, NULL, 0, timeout, retries); + result = scsi_execute_req(sdev, cmd, DMA_NONE, NULL, 0, sense, + timeout, retries); - if ((driver_byte(sreq->sr_result) & DRIVER_SENSE) && sdev->removable) { + if ((driver_byte(result) & DRIVER_SENSE) && sdev->removable) { struct scsi_sense_hdr sshdr; - if ((scsi_request_normalize_sense(sreq, &sshdr)) && + if ((scsi_normalize_sense(sense, SCSI_SENSE_BUFFERSIZE, + &sshdr)) && ((sshdr.sense_key == UNIT_ATTENTION) || (sshdr.sense_key == NOT_READY))) { sdev->changed = 1; - sreq->sr_result = 0; + result = 0; } } - result = sreq->sr_result; - scsi_release_request(sreq); return result; } EXPORT_SYMBOL(scsi_test_unit_ready); diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 0410e1bf109..15c2039059c 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -1299,8 +1299,9 @@ static inline int sd_do_mode_sense(struct scsi_request *SRpnt, int dbd, int modepage, unsigned char *buffer, int len, struct scsi_mode_data *data) { - return __scsi_mode_sense(SRpnt, dbd, modepage, buffer, len, - SD_TIMEOUT, SD_MAX_RETRIES, data); + return scsi_mode_sense(SRpnt->sr_device, dbd, modepage, buffer, len, + SD_TIMEOUT, SD_MAX_RETRIES, data, + SRpnt->sr_sense_buffer); } /* diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c index 2f259f24952..8cbe6e00418 100644 --- a/drivers/scsi/sr.c +++ b/drivers/scsi/sr.c @@ -817,7 +817,7 @@ static void get_capabilities(struct scsi_cd *cd) /* ask for mode page 0x2a */ rc = scsi_mode_sense(cd->device, 0, 0x2a, buffer, 128, - SR_TIMEOUT, 3, &data); + SR_TIMEOUT, 3, &data, NULL); if (!scsi_status_is_good(rc)) { /* failed, drive doesn't have capabilities mode page */ diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h index 835af8ecbb7..9181068883c 100644 --- a/include/scsi/scsi_device.h +++ b/include/scsi/scsi_device.h @@ -8,9 +8,17 @@ struct request_queue; struct scsi_cmnd; -struct scsi_mode_data; struct scsi_lun; +struct scsi_mode_data { + __u32 length; + __u16 block_descriptor_length; + __u8 medium_type; + __u8 device_specific; + __u8 header_length; + __u8 longlba:1; +}; + /* * sdev state: If you alter this, you also need to alter scsi_sysfs.c * (for the ascii descriptions) and the state model enforcer: @@ -228,7 +236,8 @@ extern int scsi_set_medium_removal(struct scsi_device *, char); extern int scsi_mode_sense(struct scsi_device *sdev, int dbd, int modepage, unsigned char *buffer, int len, int timeout, - int retries, struct scsi_mode_data *data); + int retries, struct scsi_mode_data *data, + char *sense); extern int scsi_test_unit_ready(struct scsi_device *sdev, int timeout, int retries); extern int scsi_device_set_state(struct scsi_device *sdev, diff --git a/include/scsi/scsi_request.h b/include/scsi/scsi_request.h index d64903a617c..f5dfdfec9fe 100644 --- a/include/scsi/scsi_request.h +++ b/include/scsi/scsi_request.h @@ -58,19 +58,4 @@ extern int scsi_execute_req(struct scsi_device *sdev, unsigned char *cmd, int data_direction, void *buffer, unsigned bufflen, unsigned char *sense, int timeout, int retries); -struct scsi_mode_data { - __u32 length; - __u16 block_descriptor_length; - __u8 medium_type; - __u8 device_specific; - __u8 header_length; - __u8 longlba:1; -}; - -extern int __scsi_mode_sense(struct scsi_request *SRpnt, int dbd, - int modepage, unsigned char *buffer, int len, - int timeout, int retries, - struct scsi_mode_data *data); - - #endif /* _SCSI_SCSI_REQUEST_H */ -- cgit v1.2.3-70-g09d2 From 33aa687db90dd8541bd5e9a762eebf880eaee767 Mon Sep 17 00:00:00 2001 From: James Bottomley Date: Sun, 28 Aug 2005 11:31:14 -0500 Subject: [SCSI] convert SPI transport class to scsi_execute This one's slightly more difficult. The transport class uses REQ_FAILFAST, so another interface (scsi_execute) had to be invented to take the extra flag. Also, the sense functions are shifted around to allow spi_execute to place data directly into a struct scsi_sense_hdr. With this change, there's probably a lot of unnecessary sense buffer allocation going on which we can fix later. Signed-off-by: James Bottomley --- drivers/scsi/scsi_error.c | 6 +- drivers/scsi/scsi_lib.c | 13 ++-- drivers/scsi/scsi_transport_spi.c | 124 ++++++++++++++++++-------------------- include/scsi/scsi_device.h | 13 ++++ include/scsi/scsi_eh.h | 8 +++ include/scsi/scsi_request.h | 4 -- 6 files changed, 90 insertions(+), 78 deletions(-) (limited to 'include') diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c index e9c451ba71f..2686d5672e5 100644 --- a/drivers/scsi/scsi_error.c +++ b/drivers/scsi/scsi_error.c @@ -1847,12 +1847,16 @@ EXPORT_SYMBOL(scsi_reset_provider); int scsi_normalize_sense(const u8 *sense_buffer, int sb_len, struct scsi_sense_hdr *sshdr) { - if (!sense_buffer || !sb_len || (sense_buffer[0] & 0x70) != 0x70) + if (!sense_buffer || !sb_len) return 0; memset(sshdr, 0, sizeof(struct scsi_sense_hdr)); sshdr->response_code = (sense_buffer[0] & 0x7f); + + if (!scsi_sense_valid(sshdr)) + return 0; + if (sshdr->response_code >= 0x72) { /* * descriptor format diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 3f3accd6cd4..42edf29223a 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -282,7 +282,7 @@ void scsi_wait_req(struct scsi_request *sreq, const void *cmnd, void *buffer, EXPORT_SYMBOL(scsi_wait_req); /** - * scsi_execute_req - insert request and wait for the result + * scsi_execute - insert request and wait for the result * @sdev: scsi device * @cmd: scsi command * @data_direction: data direction @@ -291,13 +291,14 @@ EXPORT_SYMBOL(scsi_wait_req); * @sense: optional sense buffer * @timeout: request timeout in seconds * @retries: number of times to retry request + * @flags: or into request flags; * * scsi_execute_req returns the req->errors value which is the * the scsi_cmnd result field. **/ -int scsi_execute_req(struct scsi_device *sdev, unsigned char *cmd, - int data_direction, void *buffer, unsigned bufflen, - unsigned char *sense, int timeout, int retries) +int scsi_execute(struct scsi_device *sdev, const unsigned char *cmd, + int data_direction, void *buffer, unsigned bufflen, + unsigned char *sense, int timeout, int retries, int flags) { struct request *req; int write = (data_direction == DMA_TO_DEVICE); @@ -314,7 +315,7 @@ int scsi_execute_req(struct scsi_device *sdev, unsigned char *cmd, req->sense = sense; req->sense_len = 0; req->timeout = timeout; - req->flags |= REQ_BLOCK_PC | REQ_SPECIAL; + req->flags |= flags | REQ_BLOCK_PC | REQ_SPECIAL; /* * head injection *required* here otherwise quiesce won't work @@ -328,7 +329,7 @@ int scsi_execute_req(struct scsi_device *sdev, unsigned char *cmd, return ret; } -EXPORT_SYMBOL(scsi_execute_req); +EXPORT_SYMBOL(scsi_execute); /* * Function: scsi_init_cmd_errh() diff --git a/drivers/scsi/scsi_transport_spi.c b/drivers/scsi/scsi_transport_spi.c index 89f6b7feb9c..874042f1899 100644 --- a/drivers/scsi/scsi_transport_spi.c +++ b/drivers/scsi/scsi_transport_spi.c @@ -28,7 +28,7 @@ #include "scsi_priv.h" #include #include -#include +#include #include #include #include @@ -108,25 +108,33 @@ static int sprint_frac(char *dest, int value, int denom) /* Modification of scsi_wait_req that will clear UNIT ATTENTION conditions * resulting from (likely) bus and device resets */ -static void spi_wait_req(struct scsi_request *sreq, const void *cmd, - void *buffer, unsigned bufflen) +static int spi_execute(struct scsi_device *sdev, const void *cmd, + enum dma_data_direction dir, + void *buffer, unsigned bufflen, + struct scsi_sense_hdr *sshdr) { - int i; + int i, result; + unsigned char sense[SCSI_SENSE_BUFFERSIZE]; for(i = 0; i < DV_RETRIES; i++) { - sreq->sr_request->flags |= REQ_FAILFAST; - - scsi_wait_req(sreq, cmd, buffer, bufflen, - DV_TIMEOUT, /* retries */ 1); - if (sreq->sr_result & DRIVER_SENSE) { - struct scsi_sense_hdr sshdr; - if (scsi_request_normalize_sense(sreq, &sshdr) - && sshdr.sense_key == UNIT_ATTENTION) + /* FIXME: need to set REQ_FAILFAST */ + result = scsi_execute(sdev, cmd, dir, buffer, bufflen, + sense, DV_TIMEOUT, /* retries */ 1, + REQ_FAILFAST); + if (result & DRIVER_SENSE) { + struct scsi_sense_hdr sshdr_tmp; + if (!sshdr) + sshdr = &sshdr_tmp; + + if (scsi_normalize_sense(sense, sizeof(*sense), + sshdr) + && sshdr->sense_key == UNIT_ATTENTION) continue; } break; } + return result; } static struct { @@ -546,13 +554,13 @@ enum spi_compare_returns { /* This is for read/write Domain Validation: If the device supports * an echo buffer, we do read/write tests to it */ static enum spi_compare_returns -spi_dv_device_echo_buffer(struct scsi_request *sreq, u8 *buffer, +spi_dv_device_echo_buffer(struct scsi_device *sdev, u8 *buffer, u8 *ptr, const int retries) { - struct scsi_device *sdev = sreq->sr_device; int len = ptr - buffer; - int j, k, r; + int j, k, r, result; unsigned int pattern = 0x0000ffff; + struct scsi_sense_hdr sshdr; const char spi_write_buffer[] = { WRITE_BUFFER, 0x0a, 0, 0, 0, 0, 0, len >> 8, len & 0xff, 0 @@ -597,14 +605,12 @@ spi_dv_device_echo_buffer(struct scsi_request *sreq, u8 *buffer, } for (r = 0; r < retries; r++) { - sreq->sr_cmd_len = 0; /* wait_req to fill in */ - sreq->sr_data_direction = DMA_TO_DEVICE; - spi_wait_req(sreq, spi_write_buffer, buffer, len); - if(sreq->sr_result || !scsi_device_online(sdev)) { - struct scsi_sense_hdr sshdr; + result = spi_execute(sdev, spi_write_buffer, DMA_TO_DEVICE, + buffer, len, &sshdr); + if(result || !scsi_device_online(sdev)) { scsi_device_set_state(sdev, SDEV_QUIESCE); - if (scsi_request_normalize_sense(sreq, &sshdr) + if (scsi_sense_valid(&sshdr) && sshdr.sense_key == ILLEGAL_REQUEST /* INVALID FIELD IN CDB */ && sshdr.asc == 0x24 && sshdr.ascq == 0x00) @@ -616,14 +622,13 @@ spi_dv_device_echo_buffer(struct scsi_request *sreq, u8 *buffer, return SPI_COMPARE_SKIP_TEST; - SPI_PRINTK(sdev->sdev_target, KERN_ERR, "Write Buffer failure %x\n", sreq->sr_result); + SPI_PRINTK(sdev->sdev_target, KERN_ERR, "Write Buffer failure %x\n", result); return SPI_COMPARE_FAILURE; } memset(ptr, 0, len); - sreq->sr_cmd_len = 0; /* wait_req to fill in */ - sreq->sr_data_direction = DMA_FROM_DEVICE; - spi_wait_req(sreq, spi_read_buffer, ptr, len); + spi_execute(sdev, spi_read_buffer, DMA_FROM_DEVICE, + ptr, len, NULL); scsi_device_set_state(sdev, SDEV_QUIESCE); if (memcmp(buffer, ptr, len) != 0) @@ -635,25 +640,22 @@ spi_dv_device_echo_buffer(struct scsi_request *sreq, u8 *buffer, /* This is for the simplest form of Domain Validation: a read test * on the inquiry data from the device */ static enum spi_compare_returns -spi_dv_device_compare_inquiry(struct scsi_request *sreq, u8 *buffer, +spi_dv_device_compare_inquiry(struct scsi_device *sdev, u8 *buffer, u8 *ptr, const int retries) { - int r; - const int len = sreq->sr_device->inquiry_len; - struct scsi_device *sdev = sreq->sr_device; + int r, result; + const int len = sdev->inquiry_len; const char spi_inquiry[] = { INQUIRY, 0, 0, 0, len, 0 }; for (r = 0; r < retries; r++) { - sreq->sr_cmd_len = 0; /* wait_req to fill in */ - sreq->sr_data_direction = DMA_FROM_DEVICE; - memset(ptr, 0, len); - spi_wait_req(sreq, spi_inquiry, ptr, len); + result = spi_execute(sdev, spi_inquiry, DMA_FROM_DEVICE, + ptr, len, NULL); - if(sreq->sr_result || !scsi_device_online(sdev)) { + if(result || !scsi_device_online(sdev)) { scsi_device_set_state(sdev, SDEV_QUIESCE); return SPI_COMPARE_FAILURE; } @@ -674,12 +676,11 @@ spi_dv_device_compare_inquiry(struct scsi_request *sreq, u8 *buffer, } static enum spi_compare_returns -spi_dv_retrain(struct scsi_request *sreq, u8 *buffer, u8 *ptr, +spi_dv_retrain(struct scsi_device *sdev, u8 *buffer, u8 *ptr, enum spi_compare_returns - (*compare_fn)(struct scsi_request *, u8 *, u8 *, int)) + (*compare_fn)(struct scsi_device *, u8 *, u8 *, int)) { - struct spi_internal *i = to_spi_internal(sreq->sr_host->transportt); - struct scsi_device *sdev = sreq->sr_device; + struct spi_internal *i = to_spi_internal(sdev->host->transportt); struct scsi_target *starget = sdev->sdev_target; int period = 0, prevperiod = 0; enum spi_compare_returns retval; @@ -687,7 +688,7 @@ spi_dv_retrain(struct scsi_request *sreq, u8 *buffer, u8 *ptr, for (;;) { int newperiod; - retval = compare_fn(sreq, buffer, ptr, DV_LOOPS); + retval = compare_fn(sdev, buffer, ptr, DV_LOOPS); if (retval == SPI_COMPARE_SUCCESS || retval == SPI_COMPARE_SKIP_TEST) @@ -733,9 +734,9 @@ spi_dv_retrain(struct scsi_request *sreq, u8 *buffer, u8 *ptr, } static int -spi_dv_device_get_echo_buffer(struct scsi_request *sreq, u8 *buffer) +spi_dv_device_get_echo_buffer(struct scsi_device *sdev, u8 *buffer) { - int l; + int l, result; /* first off do a test unit ready. This can error out * because of reservations or some other reason. If it @@ -751,18 +752,16 @@ spi_dv_device_get_echo_buffer(struct scsi_request *sreq, u8 *buffer) }; - sreq->sr_cmd_len = 0; - sreq->sr_data_direction = DMA_NONE; - /* We send a set of three TURs to clear any outstanding * unit attention conditions if they exist (Otherwise the * buffer tests won't be happy). If the TUR still fails * (reservation conflict, device not ready, etc) just * skip the write tests */ for (l = 0; ; l++) { - spi_wait_req(sreq, spi_test_unit_ready, NULL, 0); + result = spi_execute(sdev, spi_test_unit_ready, DMA_NONE, + NULL, 0, NULL); - if(sreq->sr_result) { + if(result) { if(l >= 3) return 0; } else { @@ -771,12 +770,10 @@ spi_dv_device_get_echo_buffer(struct scsi_request *sreq, u8 *buffer) } } - sreq->sr_cmd_len = 0; - sreq->sr_data_direction = DMA_FROM_DEVICE; + result = spi_execute(sdev, spi_read_buffer_descriptor, + DMA_FROM_DEVICE, buffer, 4, NULL); - spi_wait_req(sreq, spi_read_buffer_descriptor, buffer, 4); - - if (sreq->sr_result) + if (result) /* Device has no echo buffer */ return 0; @@ -784,17 +781,16 @@ spi_dv_device_get_echo_buffer(struct scsi_request *sreq, u8 *buffer) } static void -spi_dv_device_internal(struct scsi_request *sreq, u8 *buffer) +spi_dv_device_internal(struct scsi_device *sdev, u8 *buffer) { - struct spi_internal *i = to_spi_internal(sreq->sr_host->transportt); - struct scsi_device *sdev = sreq->sr_device; + struct spi_internal *i = to_spi_internal(sdev->host->transportt); struct scsi_target *starget = sdev->sdev_target; int len = sdev->inquiry_len; /* first set us up for narrow async */ DV_SET(offset, 0); DV_SET(width, 0); - if (spi_dv_device_compare_inquiry(sreq, buffer, buffer, DV_LOOPS) + if (spi_dv_device_compare_inquiry(sdev, buffer, buffer, DV_LOOPS) != SPI_COMPARE_SUCCESS) { SPI_PRINTK(starget, KERN_ERR, "Domain Validation Initial Inquiry Failed\n"); /* FIXME: should probably offline the device here? */ @@ -806,7 +802,7 @@ spi_dv_device_internal(struct scsi_request *sreq, u8 *buffer) scsi_device_wide(sdev)) { i->f->set_width(starget, 1); - if (spi_dv_device_compare_inquiry(sreq, buffer, + if (spi_dv_device_compare_inquiry(sdev, buffer, buffer + len, DV_LOOPS) != SPI_COMPARE_SUCCESS) { @@ -827,7 +823,7 @@ spi_dv_device_internal(struct scsi_request *sreq, u8 *buffer) len = 0; if (scsi_device_dt(sdev)) - len = spi_dv_device_get_echo_buffer(sreq, buffer); + len = spi_dv_device_get_echo_buffer(sdev, buffer); retry: @@ -853,7 +849,7 @@ spi_dv_device_internal(struct scsi_request *sreq, u8 *buffer) if (len == 0) { SPI_PRINTK(starget, KERN_INFO, "Domain Validation skipping write tests\n"); - spi_dv_retrain(sreq, buffer, buffer + len, + spi_dv_retrain(sdev, buffer, buffer + len, spi_dv_device_compare_inquiry); return; } @@ -863,7 +859,7 @@ spi_dv_device_internal(struct scsi_request *sreq, u8 *buffer) len = SPI_MAX_ECHO_BUFFER_SIZE; } - if (spi_dv_retrain(sreq, buffer, buffer + len, + if (spi_dv_retrain(sdev, buffer, buffer + len, spi_dv_device_echo_buffer) == SPI_COMPARE_SKIP_TEST) { /* OK, the stupid drive can't do a write echo buffer @@ -886,16 +882,12 @@ spi_dv_device_internal(struct scsi_request *sreq, u8 *buffer) void spi_dv_device(struct scsi_device *sdev) { - struct scsi_request *sreq = scsi_allocate_request(sdev, GFP_KERNEL); struct scsi_target *starget = sdev->sdev_target; u8 *buffer; const int len = SPI_MAX_ECHO_BUFFER_SIZE*2; - if (unlikely(!sreq)) - return; - if (unlikely(scsi_device_get(sdev))) - goto out_free_req; + return; buffer = kmalloc(len, GFP_KERNEL); @@ -916,7 +908,7 @@ spi_dv_device(struct scsi_device *sdev) SPI_PRINTK(starget, KERN_INFO, "Beginning Domain Validation\n"); - spi_dv_device_internal(sreq, buffer); + spi_dv_device_internal(sdev, buffer); SPI_PRINTK(starget, KERN_INFO, "Ending Domain Validation\n"); @@ -931,8 +923,6 @@ spi_dv_device(struct scsi_device *sdev) kfree(buffer); out_put: scsi_device_put(sdev); - out_free_req: - scsi_release_request(sreq); } EXPORT_SYMBOL(spi_dv_device); diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h index 9181068883c..5ad08b70763 100644 --- a/include/scsi/scsi_device.h +++ b/include/scsi/scsi_device.h @@ -256,6 +256,19 @@ extern void int_to_scsilun(unsigned int, struct scsi_lun *); extern const char *scsi_device_state_name(enum scsi_device_state); extern int scsi_is_sdev_device(const struct device *); extern int scsi_is_target_device(const struct device *); +extern int scsi_execute(struct scsi_device *sdev, const unsigned char *cmd, + int data_direction, void *buffer, unsigned bufflen, + unsigned char *sense, int timeout, int retries, + int flag); + +static inline int +scsi_execute_req(struct scsi_device *sdev, const unsigned char *cmd, + int data_direction, void *buffer, unsigned bufflen, + unsigned char *sense, int timeout, int retries) +{ + return scsi_execute(sdev, cmd, data_direction, buffer, bufflen, sense, + timeout, retries, 0); +} static inline int scsi_device_online(struct scsi_device *sdev) { return sdev->sdev_state != SDEV_OFFLINE; diff --git a/include/scsi/scsi_eh.h b/include/scsi/scsi_eh.h index 80557f879e3..b24d224281b 100644 --- a/include/scsi/scsi_eh.h +++ b/include/scsi/scsi_eh.h @@ -26,6 +26,14 @@ struct scsi_sense_hdr { /* See SPC-3 section 4.5 */ u8 additional_length; /* always 0 for fixed sense format */ }; +static inline int scsi_sense_valid(struct scsi_sense_hdr *sshdr) +{ + if (!sshdr) + return 0; + + return (sshdr->response_code & 0x70) == 0x70; +} + extern void scsi_add_timer(struct scsi_cmnd *, int, void (*)(struct scsi_cmnd *)); diff --git a/include/scsi/scsi_request.h b/include/scsi/scsi_request.h index f5dfdfec9fe..6a140020d7c 100644 --- a/include/scsi/scsi_request.h +++ b/include/scsi/scsi_request.h @@ -54,8 +54,4 @@ extern void scsi_do_req(struct scsi_request *, const void *cmnd, void *buffer, unsigned bufflen, void (*done) (struct scsi_cmnd *), int timeout, int retries); -extern int scsi_execute_req(struct scsi_device *sdev, unsigned char *cmd, - int data_direction, void *buffer, unsigned bufflen, - unsigned char *sense, int timeout, int retries); - #endif /* _SCSI_SCSI_REQUEST_H */ -- cgit v1.2.3-70-g09d2 From ea73a9f23906c374b697cd5b0d64f6dceced63de Mon Sep 17 00:00:00 2001 From: James Bottomley Date: Sun, 28 Aug 2005 11:33:52 -0500 Subject: [SCSI] convert sd to scsi_execute_req (and update the scsi_execute_req API) This one removes struct scsi_request entirely from sd. In the process, I noticed we have no callers of scsi_wait_req who don't immediately normalise the sense, so I updated the API to make it take a struct scsi_sense_hdr instead of simply a big sense buffer. Signed-off-by: James Bottomley --- drivers/scsi/constants.c | 48 +++++++------- drivers/scsi/scsi_ioctl.c | 15 ++--- drivers/scsi/scsi_lib.c | 67 +++++++++++-------- drivers/scsi/scsi_scan.c | 13 ++-- drivers/scsi/sd.c | 160 ++++++++++++++++++--------------------------- include/scsi/scsi_dbg.h | 2 + include/scsi/scsi_device.h | 14 ++-- 7 files changed, 146 insertions(+), 173 deletions(-) (limited to 'include') diff --git a/drivers/scsi/constants.c b/drivers/scsi/constants.c index 0d58d3538bd..f6be2c1c394 100644 --- a/drivers/scsi/constants.c +++ b/drivers/scsi/constants.c @@ -1156,6 +1156,31 @@ scsi_show_extd_sense(unsigned char asc, unsigned char ascq) } } +void +scsi_print_sense_hdr(const char *name, struct scsi_sense_hdr *sshdr) +{ + const char *sense_txt; + /* An example of deferred is when an earlier write to disk cache + * succeeded, but now the disk discovers that it cannot write the + * data to the magnetic media. + */ + const char *error = scsi_sense_is_deferred(sshdr) ? + "<>" : "Current"; + printk(KERN_INFO "%s: %s", name, error); + if (sshdr->response_code >= 0x72) + printk(" [descriptor]"); + + sense_txt = scsi_sense_key_string(sshdr->sense_key); + if (sense_txt) + printk(": sense key: %s\n", sense_txt); + else + printk(": sense key=0x%x\n", sshdr->sense_key); + printk(KERN_INFO " "); + scsi_show_extd_sense(sshdr->asc, sshdr->ascq); + printk("\n"); +} +EXPORT_SYMBOL(scsi_print_sense_hdr); + /* Print sense information */ void __scsi_print_sense(const char *name, const unsigned char *sense_buffer, @@ -1163,8 +1188,6 @@ __scsi_print_sense(const char *name, const unsigned char *sense_buffer, { int k, num, res; unsigned int info; - const char *error; - const char *sense_txt; struct scsi_sense_hdr ssh; res = scsi_normalize_sense(sense_buffer, sense_len, &ssh); @@ -1182,26 +1205,7 @@ __scsi_print_sense(const char *name, const unsigned char *sense_buffer, printk("\n"); return; } - - /* An example of deferred is when an earlier write to disk cache - * succeeded, but now the disk discovers that it cannot write the - * data to the magnetic media. - */ - error = scsi_sense_is_deferred(&ssh) ? - "<>" : "Current"; - printk(KERN_INFO "%s: %s", name, error); - if (ssh.response_code >= 0x72) - printk(" [descriptor]"); - - sense_txt = scsi_sense_key_string(ssh.sense_key); - if (sense_txt) - printk(": sense key: %s\n", sense_txt); - else - printk(": sense key=0x%x\n", ssh.sense_key); - printk(KERN_INFO " "); - scsi_show_extd_sense(ssh.asc, ssh.ascq); - printk("\n"); - + scsi_print_sense_hdr(name, &ssh); if (ssh.response_code < 0x72) { /* only decode extras for "fixed" format now */ char buff[80]; diff --git a/drivers/scsi/scsi_ioctl.c b/drivers/scsi/scsi_ioctl.c index 5f399c9c68e..179a767d221 100644 --- a/drivers/scsi/scsi_ioctl.c +++ b/drivers/scsi/scsi_ioctl.c @@ -90,19 +90,16 @@ static int ioctl_internal_command(struct scsi_device *sdev, char *cmd, { int result; struct scsi_sense_hdr sshdr; - char sense[SCSI_SENSE_BUFFERSIZE]; SCSI_LOG_IOCTL(1, printk("Trying ioctl with scsi command %d\n", *cmd)); - - memset(sense, 0, sizeof(*sense)); result = scsi_execute_req(sdev, cmd, DMA_NONE, NULL, 0, - sense, timeout, retries); + &sshdr, timeout, retries); SCSI_LOG_IOCTL(2, printk("Ioctl returned 0x%x\n", result)); if ((driver_byte(result) & DRIVER_SENSE) && - (scsi_normalize_sense(sense, sizeof(*sense), &sshdr))) { + (scsi_sense_valid(&sshdr))) { switch (sshdr.sense_key) { case ILLEGAL_REQUEST: if (cmd[0] == ALLOW_MEDIUM_REMOVAL) @@ -132,7 +129,7 @@ static int ioctl_internal_command(struct scsi_device *sdev, char *cmd, sdev->id, sdev->lun, result); - __scsi_print_sense(" ", sense, sizeof(*sense)); + scsi_print_sense_hdr(" ", &sshdr); break; } } @@ -315,9 +312,9 @@ int scsi_ioctl_send_command(struct scsi_device *sdev, break; } - result = scsi_execute_req(sdev, cmd, data_direction, buf, needed, - sense, timeout, retries); - + result = scsi_execute(sdev, cmd, data_direction, buf, needed, + sense, timeout, retries, 0); + /* * If there was an error condition, pass the info back to the user. */ diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 42edf29223a..bdea26b56dc 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -293,8 +293,8 @@ EXPORT_SYMBOL(scsi_wait_req); * @retries: number of times to retry request * @flags: or into request flags; * - * scsi_execute_req returns the req->errors value which is the - * the scsi_cmnd result field. + * returns the req->errors value which is the the scsi_cmnd result + * field. **/ int scsi_execute(struct scsi_device *sdev, const unsigned char *cmd, int data_direction, void *buffer, unsigned bufflen, @@ -328,9 +328,31 @@ int scsi_execute(struct scsi_device *sdev, const unsigned char *cmd, return ret; } - EXPORT_SYMBOL(scsi_execute); + +int scsi_execute_req(struct scsi_device *sdev, const unsigned char *cmd, + int data_direction, void *buffer, unsigned bufflen, + struct scsi_sense_hdr *sshdr, int timeout, int retries) +{ + char *sense = NULL; + + if (sshdr) { + sense = kmalloc(SCSI_SENSE_BUFFERSIZE, GFP_KERNEL); + if (!sense) + return DRIVER_ERROR << 24; + memset(sense, 0, sizeof(*sense)); + } + int result = scsi_execute(sdev, cmd, data_direction, buffer, bufflen, + sense, timeout, retries, 0); + if (sshdr) + scsi_normalize_sense(sense, sizeof(*sense), sshdr); + + kfree(sense); + return result; +} +EXPORT_SYMBOL(scsi_execute_req); + /* * Function: scsi_init_cmd_errh() * @@ -1614,7 +1636,7 @@ void scsi_exit_queue(void) } } /** - * __scsi_mode_sense - issue a mode sense, falling back from 10 to + * scsi_mode_sense - issue a mode sense, falling back from 10 to * six bytes if necessary. * @sdev: SCSI device to be queried * @dbd: set if mode sense will allow block descriptors to be returned @@ -1634,26 +1656,22 @@ void scsi_exit_queue(void) int scsi_mode_sense(struct scsi_device *sdev, int dbd, int modepage, unsigned char *buffer, int len, int timeout, int retries, - struct scsi_mode_data *data, char *sense) { + struct scsi_mode_data *data, struct scsi_sense_hdr *sshdr) { unsigned char cmd[12]; int use_10_for_ms; int header_length; int result; - char *sense_buffer = NULL; + struct scsi_sense_hdr my_sshdr; memset(data, 0, sizeof(*data)); memset(&cmd[0], 0, 12); cmd[1] = dbd & 0x18; /* allows DBD and LLBA bits */ cmd[2] = modepage; - if (!sense) { - sense_buffer = kmalloc(SCSI_SENSE_BUFFERSIZE, GFP_KERNEL); - if (!sense_buffer) { - dev_printk(KERN_ERR, &sdev->sdev_gendev, "failed to allocate sense buffer\n"); - return 0; - } - sense = sense_buffer; - } + /* caller might not be interested in sense, but we need it */ + if (!sshdr) + sshdr = &my_sshdr; + retry: use_10_for_ms = sdev->use_10_for_ms; @@ -1673,12 +1691,10 @@ scsi_mode_sense(struct scsi_device *sdev, int dbd, int modepage, header_length = 4; } - memset(sense, 0, SCSI_SENSE_BUFFERSIZE); - memset(buffer, 0, len); result = scsi_execute_req(sdev, cmd, DMA_FROM_DEVICE, buffer, len, - sense, timeout, retries); + sshdr, timeout, retries); /* This code looks awful: what it's doing is making sure an * ILLEGAL REQUEST sense return identifies the actual command @@ -1687,11 +1703,9 @@ scsi_mode_sense(struct scsi_device *sdev, int dbd, int modepage, if (use_10_for_ms && !scsi_status_is_good(result) && (driver_byte(result) & DRIVER_SENSE)) { - struct scsi_sense_hdr sshdr; - - if (scsi_normalize_sense(sense, SCSI_SENSE_BUFFERSIZE, &sshdr)) { - if ((sshdr.sense_key == ILLEGAL_REQUEST) && - (sshdr.asc == 0x20) && (sshdr.ascq == 0)) { + if (scsi_sense_valid(sshdr)) { + if ((sshdr->sense_key == ILLEGAL_REQUEST) && + (sshdr->asc == 0x20) && (sshdr->ascq == 0)) { /* * Invalid command operation code */ @@ -1718,7 +1732,6 @@ scsi_mode_sense(struct scsi_device *sdev, int dbd, int modepage, } } - kfree(sense_buffer); return result; } EXPORT_SYMBOL(scsi_mode_sense); @@ -1729,17 +1742,15 @@ scsi_test_unit_ready(struct scsi_device *sdev, int timeout, int retries) char cmd[] = { TEST_UNIT_READY, 0, 0, 0, 0, 0, }; - char sense[SCSI_SENSE_BUFFERSIZE]; + struct scsi_sense_hdr sshdr; int result; - result = scsi_execute_req(sdev, cmd, DMA_NONE, NULL, 0, sense, + result = scsi_execute_req(sdev, cmd, DMA_NONE, NULL, 0, &sshdr, timeout, retries); if ((driver_byte(result) & DRIVER_SENSE) && sdev->removable) { - struct scsi_sense_hdr sshdr; - if ((scsi_normalize_sense(sense, SCSI_SENSE_BUFFERSIZE, - &sshdr)) && + if ((scsi_sense_valid(&sshdr)) && ((sshdr.sense_key == UNIT_ATTENTION) || (sshdr.sense_key == NOT_READY))) { sdev->changed = 1; diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c index 0048beaffc9..19c9a232a75 100644 --- a/drivers/scsi/scsi_scan.c +++ b/drivers/scsi/scsi_scan.c @@ -446,7 +446,6 @@ void scsi_target_reap(struct scsi_target *starget) static int scsi_probe_lun(struct scsi_device *sdev, char *inq_result, int result_len, int *bflags) { - char sense[SCSI_SENSE_BUFFERSIZE]; unsigned char scsi_cmd[MAX_COMMAND_SIZE]; int first_inquiry_len, try_inquiry_len, next_inquiry_len; int response_len = 0; @@ -474,11 +473,10 @@ static int scsi_probe_lun(struct scsi_device *sdev, char *inq_result, scsi_cmd[0] = INQUIRY; scsi_cmd[4] = (unsigned char) try_inquiry_len; - memset(sense, 0, sizeof(sense)); memset(inq_result, 0, try_inquiry_len); result = scsi_execute_req(sdev, scsi_cmd, DMA_FROM_DEVICE, - inq_result, try_inquiry_len, sense, + inq_result, try_inquiry_len, &sshdr, HZ / 2 + HZ * scsi_inq_timeout, 3); SCSI_LOG_SCAN_BUS(3, printk(KERN_INFO "scsi scan: INQUIRY %s " @@ -493,8 +491,7 @@ static int scsi_probe_lun(struct scsi_device *sdev, char *inq_result, * but many buggy devices do so anyway. */ if ((driver_byte(result) & DRIVER_SENSE) && - scsi_normalize_sense(sense, sizeof(sense), - &sshdr)) { + scsi_sense_valid(&sshdr)) { if ((sshdr.sense_key == UNIT_ATTENTION) && ((sshdr.asc == 0x28) || (sshdr.asc == 0x29)) && @@ -1057,7 +1054,6 @@ static int scsi_report_lun_scan(struct scsi_device *sdev, int bflags, int rescan) { char devname[64]; - char sense[SCSI_SENSE_BUFFERSIZE]; unsigned char scsi_cmd[MAX_COMMAND_SIZE]; unsigned int length; unsigned int lun; @@ -1134,9 +1130,8 @@ static int scsi_report_lun_scan(struct scsi_device *sdev, int bflags, " REPORT LUNS to %s (try %d)\n", devname, retries)); - memset(sense, 0, sizeof(sense)); result = scsi_execute_req(sdev, scsi_cmd, DMA_FROM_DEVICE, - lun_data, length, sense, + lun_data, length, &sshdr, SCSI_TIMEOUT + 4 * HZ, 3); SCSI_LOG_SCAN_BUS(3, printk (KERN_INFO "scsi scan: REPORT LUNS" @@ -1144,7 +1139,7 @@ static int scsi_report_lun_scan(struct scsi_device *sdev, int bflags, ? "failed" : "successful", retries, result)); if (result == 0) break; - else if (scsi_normalize_sense(sense, sizeof(sense), &sshdr)) { + else if (scsi_sense_valid(&sshdr)) { if (sshdr.sense_key != UNIT_ATTENTION) break; } diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 15c2039059c..611ccde8477 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -59,7 +59,6 @@ #include #include #include -#include #include #include "scsi_logging.h" @@ -125,7 +124,7 @@ static int sd_issue_flush(struct device *, sector_t *); static void sd_end_flush(request_queue_t *, struct request *); static int sd_prepare_flush(request_queue_t *, struct request *); static void sd_read_capacity(struct scsi_disk *sdkp, char *diskname, - struct scsi_request *SRpnt, unsigned char *buffer); + unsigned char *buffer); static struct scsi_driver sd_template = { .owner = THIS_MODULE, @@ -682,19 +681,13 @@ not_present: static int sd_sync_cache(struct scsi_device *sdp) { - struct scsi_request *sreq; int retries, res; + struct scsi_sense_hdr sshdr; if (!scsi_device_online(sdp)) return -ENODEV; - sreq = scsi_allocate_request(sdp, GFP_KERNEL); - if (!sreq) { - printk("FAILED\n No memory for request\n"); - return -ENOMEM; - } - sreq->sr_data_direction = DMA_NONE; for (retries = 3; retries > 0; --retries) { unsigned char cmd[10] = { 0 }; @@ -703,22 +696,20 @@ static int sd_sync_cache(struct scsi_device *sdp) * Leave the rest of the command zero to indicate * flush everything. */ - scsi_wait_req(sreq, cmd, NULL, 0, SD_TIMEOUT, SD_MAX_RETRIES); - if (sreq->sr_result == 0) + res = scsi_execute_req(sdp, cmd, DMA_NONE, NULL, 0, &sshdr, + SD_TIMEOUT, SD_MAX_RETRIES); + if (res == 0) break; } - res = sreq->sr_result; - if (res) { - printk(KERN_WARNING "FAILED\n status = %x, message = %02x, " + if (res) { printk(KERN_WARNING "FAILED\n status = %x, message = %02x, " "host = %d, driver = %02x\n ", status_byte(res), msg_byte(res), host_byte(res), driver_byte(res)); if (driver_byte(res) & DRIVER_SENSE) - scsi_print_req_sense("sd", sreq); + scsi_print_sense_hdr("sd", &sshdr); } - scsi_release_request(sreq); return res; } @@ -957,22 +948,19 @@ static void sd_rw_intr(struct scsi_cmnd * SCpnt) scsi_io_completion(SCpnt, good_bytes, block_sectors << 9); } -static int media_not_present(struct scsi_disk *sdkp, struct scsi_request *srp) +static int media_not_present(struct scsi_disk *sdkp, + struct scsi_sense_hdr *sshdr) { - struct scsi_sense_hdr sshdr; - if (!srp->sr_result) - return 0; - if (!(driver_byte(srp->sr_result) & DRIVER_SENSE)) + if (!scsi_sense_valid(sshdr)) return 0; /* not invoked for commands that could return deferred errors */ - if (scsi_request_normalize_sense(srp, &sshdr)) { - if (sshdr.sense_key != NOT_READY && - sshdr.sense_key != UNIT_ATTENTION) - return 0; - if (sshdr.asc != 0x3A) /* medium not present */ - return 0; - } + if (sshdr->sense_key != NOT_READY && + sshdr->sense_key != UNIT_ATTENTION) + return 0; + if (sshdr->asc != 0x3A) /* medium not present */ + return 0; + set_media_not_present(sdkp); return 1; } @@ -981,8 +969,8 @@ static int media_not_present(struct scsi_disk *sdkp, struct scsi_request *srp) * spinup disk - called only in sd_revalidate_disk() */ static void -sd_spinup_disk(struct scsi_disk *sdkp, char *diskname, - struct scsi_request *SRpnt, unsigned char *buffer) { +sd_spinup_disk(struct scsi_disk *sdkp, char *diskname) +{ unsigned char cmd[10]; unsigned long spintime_value = 0; int retries, spintime; @@ -1001,18 +989,13 @@ sd_spinup_disk(struct scsi_disk *sdkp, char *diskname, cmd[0] = TEST_UNIT_READY; memset((void *) &cmd[1], 0, 9); - SRpnt->sr_cmd_len = 0; - memset(SRpnt->sr_sense_buffer, 0, - SCSI_SENSE_BUFFERSIZE); - SRpnt->sr_data_direction = DMA_NONE; + the_result = scsi_execute_req(sdkp->device, cmd, + DMA_NONE, NULL, 0, + &sshdr, SD_TIMEOUT, + SD_MAX_RETRIES); - scsi_wait_req (SRpnt, (void *) cmd, (void *) buffer, - 0/*512*/, SD_TIMEOUT, SD_MAX_RETRIES); - - the_result = SRpnt->sr_result; if (the_result) - sense_valid = scsi_request_normalize_sense( - SRpnt, &sshdr); + sense_valid = scsi_sense_valid(&sshdr); retries++; } while (retries < 3 && (!scsi_status_is_good(the_result) || @@ -1024,7 +1007,7 @@ sd_spinup_disk(struct scsi_disk *sdkp, char *diskname, * any media in it, don't bother with any of the rest of * this crap. */ - if (media_not_present(sdkp, SRpnt)) + if (media_not_present(sdkp, &sshdr)) return; if ((driver_byte(the_result) & DRIVER_SENSE) == 0) { @@ -1063,14 +1046,9 @@ sd_spinup_disk(struct scsi_disk *sdkp, char *diskname, cmd[1] = 1; /* Return immediately */ memset((void *) &cmd[2], 0, 8); cmd[4] = 1; /* Start spin cycle */ - SRpnt->sr_cmd_len = 0; - memset(SRpnt->sr_sense_buffer, 0, - SCSI_SENSE_BUFFERSIZE); - - SRpnt->sr_data_direction = DMA_NONE; - scsi_wait_req(SRpnt, (void *)cmd, - (void *) buffer, 0/*512*/, - SD_TIMEOUT, SD_MAX_RETRIES); + scsi_execute_req(sdkp->device, cmd, DMA_NONE, + NULL, 0, &sshdr, + SD_TIMEOUT, SD_MAX_RETRIES); spintime_value = jiffies; } spintime = 1; @@ -1083,7 +1061,7 @@ sd_spinup_disk(struct scsi_disk *sdkp, char *diskname, if(!spintime) { printk(KERN_NOTICE "%s: Unit Not Ready, " "sense:\n", diskname); - scsi_print_req_sense("", SRpnt); + scsi_print_sense_hdr("", &sshdr); } break; } @@ -1104,14 +1082,15 @@ sd_spinup_disk(struct scsi_disk *sdkp, char *diskname, */ static void sd_read_capacity(struct scsi_disk *sdkp, char *diskname, - struct scsi_request *SRpnt, unsigned char *buffer) { + unsigned char *buffer) +{ unsigned char cmd[16]; - struct scsi_device *sdp = sdkp->device; int the_result, retries; int sector_size = 0; int longrc = 0; struct scsi_sense_hdr sshdr; int sense_valid = 0; + struct scsi_device *sdp = sdkp->device; repeat: retries = 3; @@ -1128,20 +1107,15 @@ repeat: memset((void *) buffer, 0, 8); } - SRpnt->sr_cmd_len = 0; - memset(SRpnt->sr_sense_buffer, 0, SCSI_SENSE_BUFFERSIZE); - SRpnt->sr_data_direction = DMA_FROM_DEVICE; - - scsi_wait_req(SRpnt, (void *) cmd, (void *) buffer, - longrc ? 12 : 8, SD_TIMEOUT, SD_MAX_RETRIES); + the_result = scsi_execute_req(sdp, cmd, DMA_FROM_DEVICE, + buffer, longrc ? 12 : 8, &sshdr, + SD_TIMEOUT, SD_MAX_RETRIES); - if (media_not_present(sdkp, SRpnt)) + if (media_not_present(sdkp, &sshdr)) return; - the_result = SRpnt->sr_result; if (the_result) - sense_valid = scsi_request_normalize_sense(SRpnt, - &sshdr); + sense_valid = scsi_sense_valid(&sshdr); retries--; } while (the_result && retries); @@ -1156,7 +1130,7 @@ repeat: driver_byte(the_result)); if (driver_byte(the_result) & DRIVER_SENSE) - scsi_print_req_sense("sd", SRpnt); + scsi_print_sense_hdr("sd", &sshdr); else printk("%s : sense not available. \n", diskname); @@ -1296,12 +1270,13 @@ got_data: /* called with buffer of length 512 */ static inline int -sd_do_mode_sense(struct scsi_request *SRpnt, int dbd, int modepage, - unsigned char *buffer, int len, struct scsi_mode_data *data) +sd_do_mode_sense(struct scsi_device *sdp, int dbd, int modepage, + unsigned char *buffer, int len, struct scsi_mode_data *data, + struct scsi_sense_hdr *sshdr) { - return scsi_mode_sense(SRpnt->sr_device, dbd, modepage, buffer, len, + return scsi_mode_sense(sdp, dbd, modepage, buffer, len, SD_TIMEOUT, SD_MAX_RETRIES, data, - SRpnt->sr_sense_buffer); + sshdr); } /* @@ -1310,25 +1285,27 @@ sd_do_mode_sense(struct scsi_request *SRpnt, int dbd, int modepage, */ static void sd_read_write_protect_flag(struct scsi_disk *sdkp, char *diskname, - struct scsi_request *SRpnt, unsigned char *buffer) { + unsigned char *buffer) +{ int res; + struct scsi_device *sdp = sdkp->device; struct scsi_mode_data data; set_disk_ro(sdkp->disk, 0); - if (sdkp->device->skip_ms_page_3f) { + if (sdp->skip_ms_page_3f) { printk(KERN_NOTICE "%s: assuming Write Enabled\n", diskname); return; } - if (sdkp->device->use_192_bytes_for_3f) { - res = sd_do_mode_sense(SRpnt, 0, 0x3F, buffer, 192, &data); + if (sdp->use_192_bytes_for_3f) { + res = sd_do_mode_sense(sdp, 0, 0x3F, buffer, 192, &data, NULL); } else { /* * First attempt: ask for all pages (0x3F), but only 4 bytes. * We have to start carefully: some devices hang if we ask * for more than is available. */ - res = sd_do_mode_sense(SRpnt, 0, 0x3F, buffer, 4, &data); + res = sd_do_mode_sense(sdp, 0, 0x3F, buffer, 4, &data, NULL); /* * Second attempt: ask for page 0 When only page 0 is @@ -1337,14 +1314,14 @@ sd_read_write_protect_flag(struct scsi_disk *sdkp, char *diskname, * CDB. */ if (!scsi_status_is_good(res)) - res = sd_do_mode_sense(SRpnt, 0, 0, buffer, 4, &data); + res = sd_do_mode_sense(sdp, 0, 0, buffer, 4, &data, NULL); /* * Third attempt: ask 255 bytes, as we did earlier. */ if (!scsi_status_is_good(res)) - res = sd_do_mode_sense(SRpnt, 0, 0x3F, buffer, 255, - &data); + res = sd_do_mode_sense(sdp, 0, 0x3F, buffer, 255, + &data, NULL); } if (!scsi_status_is_good(res)) { @@ -1366,19 +1343,20 @@ sd_read_write_protect_flag(struct scsi_disk *sdkp, char *diskname, */ static void sd_read_cache_type(struct scsi_disk *sdkp, char *diskname, - struct scsi_request *SRpnt, unsigned char *buffer) + unsigned char *buffer) { int len = 0, res; + struct scsi_device *sdp = sdkp->device; int dbd; int modepage; struct scsi_mode_data data; struct scsi_sense_hdr sshdr; - if (sdkp->device->skip_ms_page_8) + if (sdp->skip_ms_page_8) goto defaults; - if (sdkp->device->type == TYPE_RBC) { + if (sdp->type == TYPE_RBC) { modepage = 6; dbd = 8; } else { @@ -1387,7 +1365,7 @@ sd_read_cache_type(struct scsi_disk *sdkp, char *diskname, } /* cautiously ask */ - res = sd_do_mode_sense(SRpnt, dbd, modepage, buffer, 4, &data); + res = sd_do_mode_sense(sdp, dbd, modepage, buffer, 4, &data, &sshdr); if (!scsi_status_is_good(res)) goto bad_sense; @@ -1408,7 +1386,7 @@ sd_read_cache_type(struct scsi_disk *sdkp, char *diskname, len += data.header_length + data.block_descriptor_length; /* Get the data */ - res = sd_do_mode_sense(SRpnt, dbd, modepage, buffer, len, &data); + res = sd_do_mode_sense(sdp, dbd, modepage, buffer, len, &data, &sshdr); if (scsi_status_is_good(res)) { const char *types[] = { @@ -1440,7 +1418,7 @@ sd_read_cache_type(struct scsi_disk *sdkp, char *diskname, } bad_sense: - if (scsi_request_normalize_sense(SRpnt, &sshdr) && + if (scsi_sense_valid(&sshdr) && sshdr.sense_key == ILLEGAL_REQUEST && sshdr.asc == 0x24 && sshdr.ascq == 0x0) printk(KERN_NOTICE "%s: cache data unavailable\n", @@ -1465,7 +1443,6 @@ static int sd_revalidate_disk(struct gendisk *disk) { struct scsi_disk *sdkp = scsi_disk(disk); struct scsi_device *sdp = sdkp->device; - struct scsi_request *sreq; unsigned char *buffer; SCSI_LOG_HLQUEUE(3, printk("sd_revalidate_disk: disk=%s\n", disk->disk_name)); @@ -1477,18 +1454,11 @@ static int sd_revalidate_disk(struct gendisk *disk) if (!scsi_device_online(sdp)) goto out; - sreq = scsi_allocate_request(sdp, GFP_KERNEL); - if (!sreq) { - printk(KERN_WARNING "(sd_revalidate_disk:) Request allocation " - "failure.\n"); - goto out; - } - buffer = kmalloc(512, GFP_KERNEL | __GFP_DMA); if (!buffer) { printk(KERN_WARNING "(sd_revalidate_disk:) Memory allocation " "failure.\n"); - goto out_release_request; + goto out; } /* defaults, until the device tells us otherwise */ @@ -1499,25 +1469,23 @@ static int sd_revalidate_disk(struct gendisk *disk) sdkp->WCE = 0; sdkp->RCD = 0; - sd_spinup_disk(sdkp, disk->disk_name, sreq, buffer); + sd_spinup_disk(sdkp, disk->disk_name); /* * Without media there is no reason to ask; moreover, some devices * react badly if we do. */ if (sdkp->media_present) { - sd_read_capacity(sdkp, disk->disk_name, sreq, buffer); + sd_read_capacity(sdkp, disk->disk_name, buffer); if (sdp->removable) sd_read_write_protect_flag(sdkp, disk->disk_name, - sreq, buffer); - sd_read_cache_type(sdkp, disk->disk_name, sreq, buffer); + buffer); + sd_read_cache_type(sdkp, disk->disk_name, buffer); } set_capacity(disk, sdkp->capacity); kfree(buffer); - out_release_request: - scsi_release_request(sreq); out: return 0; } diff --git a/include/scsi/scsi_dbg.h b/include/scsi/scsi_dbg.h index 12e90934a7a..b090a11d7e1 100644 --- a/include/scsi/scsi_dbg.h +++ b/include/scsi/scsi_dbg.h @@ -3,8 +3,10 @@ struct scsi_cmnd; struct scsi_request; +struct scsi_sense_hdr; extern void scsi_print_command(struct scsi_cmnd *); +extern void scsi_print_sense_hdr(const char *, struct scsi_sense_hdr *); extern void __scsi_print_command(unsigned char *); extern void scsi_print_sense(const char *, struct scsi_cmnd *); extern void scsi_print_req_sense(const char *, struct scsi_request *); diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h index 5ad08b70763..da63722c012 100644 --- a/include/scsi/scsi_device.h +++ b/include/scsi/scsi_device.h @@ -9,6 +9,7 @@ struct request_queue; struct scsi_cmnd; struct scsi_lun; +struct scsi_sense_hdr; struct scsi_mode_data { __u32 length; @@ -237,7 +238,7 @@ extern int scsi_set_medium_removal(struct scsi_device *, char); extern int scsi_mode_sense(struct scsi_device *sdev, int dbd, int modepage, unsigned char *buffer, int len, int timeout, int retries, struct scsi_mode_data *data, - char *sense); + struct scsi_sense_hdr *); extern int scsi_test_unit_ready(struct scsi_device *sdev, int timeout, int retries); extern int scsi_device_set_state(struct scsi_device *sdev, @@ -260,15 +261,10 @@ extern int scsi_execute(struct scsi_device *sdev, const unsigned char *cmd, int data_direction, void *buffer, unsigned bufflen, unsigned char *sense, int timeout, int retries, int flag); +extern int scsi_execute_req(struct scsi_device *sdev, const unsigned char *cmd, + int data_direction, void *buffer, unsigned bufflen, + struct scsi_sense_hdr *, int timeout, int retries); -static inline int -scsi_execute_req(struct scsi_device *sdev, const unsigned char *cmd, - int data_direction, void *buffer, unsigned bufflen, - unsigned char *sense, int timeout, int retries) -{ - return scsi_execute(sdev, cmd, data_direction, buffer, bufflen, sense, - timeout, retries, 0); -} static inline int scsi_device_online(struct scsi_device *sdev) { return sdev->sdev_state != SDEV_OFFLINE; -- cgit v1.2.3-70-g09d2 From a18ecf413ca9846becb760f7f990c2c62c15965e Mon Sep 17 00:00:00 2001 From: Bob Moore Date: Mon, 15 Aug 2005 03:42:00 -0800 Subject: [ACPI] ACPICA 20050815 Implemented a full bytewise compare to determine if a table load request is attempting to load a duplicate table. The compare is performed if the table signatures and table lengths match. This will allow different tables with the same OEM Table ID and revision to be loaded. Although the BIOS is technically violating the ACPI spec when this happens -- it does happen -- so Linux must handle it. Signed-off-by: Robert Moore Signed-off-by: Len Brown --- drivers/acpi/tables/tbutils.c | 24 +++++++++++++++++------- drivers/acpi/utilities/utdebug.c | 4 ++-- drivers/acpi/utilities/utmisc.c | 6 +++++- include/acpi/acconfig.h | 2 +- include/acpi/acnames.h | 13 +++++-------- 5 files changed, 30 insertions(+), 19 deletions(-) (limited to 'include') diff --git a/drivers/acpi/tables/tbutils.c b/drivers/acpi/tables/tbutils.c index 5bcafebb9dd..4b2fbb592f4 100644 --- a/drivers/acpi/tables/tbutils.c +++ b/drivers/acpi/tables/tbutils.c @@ -80,14 +80,24 @@ acpi_status acpi_tb_is_table_installed(struct acpi_table_desc *new_table_desc) /* Examine all installed tables of this type */ while (table_desc) { - /* Compare Revision and oem_table_id */ - + /* + * If the table lengths match, perform a full bytewise compare. This + * means that we will allow tables with duplicate oem_table_id(s), as + * long as the tables are different in some way. + * + * Checking if the table has been loaded into the namespace means that + * we don't check for duplicate tables during the initial installation + * of tables within the RSDT/XSDT. + */ if ((table_desc->loaded_into_namespace) && - (table_desc->pointer->revision == - new_table_desc->pointer->revision) && - (!ACPI_MEMCMP(table_desc->pointer->oem_table_id, - new_table_desc->pointer->oem_table_id, 8))) { - /* This table is already installed */ + (table_desc->pointer->length == + new_table_desc->pointer->length) + && + (!ACPI_MEMCMP + ((const char *)table_desc->pointer, + (const char *)new_table_desc->pointer, + (acpi_size) new_table_desc->pointer->length))) { + /* Match: this table is already installed */ ACPI_DEBUG_PRINT((ACPI_DB_TABLES, "Table [%4.4s] already installed: Rev %X oem_table_id [%8.8s]\n", diff --git a/drivers/acpi/utilities/utdebug.c b/drivers/acpi/utilities/utdebug.c index 081a778aba8..d80e9263993 100644 --- a/drivers/acpi/utilities/utdebug.c +++ b/drivers/acpi/utilities/utdebug.c @@ -122,13 +122,13 @@ static const char *acpi_ut_trim_function_name(const char *function_name) /* All Function names are longer than 4 chars, check is safe */ - if (*(ACPI_CAST_PTR(u32, function_name)) == ACPI_FUNCTION_PREFIX1) { + if (*(ACPI_CAST_PTR(u32, function_name)) == ACPI_PREFIX_MIXED) { /* This is the case where the original source has not been modified */ return (function_name + 4); } - if (*(ACPI_CAST_PTR(u32, function_name)) == ACPI_FUNCTION_PREFIX2) { + if (*(ACPI_CAST_PTR(u32, function_name)) == ACPI_PREFIX_LOWER) { /* This is the case where the source has been 'linuxized' */ return (function_name + 5); diff --git a/drivers/acpi/utilities/utmisc.c b/drivers/acpi/utilities/utmisc.c index 474fe7cb6c0..f0275025b71 100644 --- a/drivers/acpi/utilities/utmisc.c +++ b/drivers/acpi/utilities/utmisc.c @@ -78,6 +78,10 @@ acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id) for (i = 0; i < 32; i++) { if (!(acpi_gbl_owner_id_mask & (1 << i))) { + ACPI_DEBUG_PRINT((ACPI_DB_VALUES, + "Current owner_id mask: %8.8X New ID: %2.2X\n", + acpi_gbl_owner_id_mask, (i + 1))); + acpi_gbl_owner_id_mask |= (1 << i); *owner_id = (acpi_owner_id) (i + 1); goto exit; @@ -119,7 +123,7 @@ void acpi_ut_release_owner_id(acpi_owner_id * owner_id_ptr) acpi_owner_id owner_id = *owner_id_ptr; acpi_status status; - ACPI_FUNCTION_TRACE("ut_release_owner_id"); + ACPI_FUNCTION_TRACE_U32("ut_release_owner_id", owner_id); /* Always clear the input owner_id (zero is an invalid ID) */ diff --git a/include/acpi/acconfig.h b/include/acpi/acconfig.h index f3810cc5d48..73c43a39663 100644 --- a/include/acpi/acconfig.h +++ b/include/acpi/acconfig.h @@ -63,7 +63,7 @@ /* Version string */ -#define ACPI_CA_VERSION 0x20050729 +#define ACPI_CA_VERSION 0x20050815 /* * OS name, used for the _OS object. The _OS object is essentially obsolete, diff --git a/include/acpi/acnames.h b/include/acpi/acnames.h index 79152fbc8f8..4f9063f3e95 100644 --- a/include/acpi/acnames.h +++ b/include/acpi/acnames.h @@ -71,16 +71,13 @@ /* Definitions of the predefined namespace names */ -#define ACPI_UNKNOWN_NAME (u32) 0x3F3F3F3F /* Unknown name is "????" */ -#define ACPI_ROOT_NAME (u32) 0x5F5F5F5C /* Root name is "\___" */ -#define ACPI_SYS_BUS_NAME (u32) 0x5F53425F /* Sys bus name is "_SB_" */ +#define ACPI_UNKNOWN_NAME (u32) 0x3F3F3F3F /* Unknown name is "????" */ +#define ACPI_ROOT_NAME (u32) 0x5F5F5F5C /* Root name is "\___" */ + +#define ACPI_PREFIX_MIXED (u32) 0x69706341 /* "Acpi" */ +#define ACPI_PREFIX_LOWER (u32) 0x69706361 /* "acpi" */ #define ACPI_NS_ROOT_PATH "\\" #define ACPI_NS_SYSTEM_BUS "_SB_" -/*! [Begin] no source code translation (not handled by acpisrc) */ -#define ACPI_FUNCTION_PREFIX1 'ipcA' -#define ACPI_FUNCTION_PREFIX2 'ipca' -/*! [End] no source code translation !*/ - #endif /* __ACNAMES_H__ */ -- cgit v1.2.3-70-g09d2 From d7ce78fd9a51ca0d6b9a8cf35baef884ddb9a95c Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Mon, 29 Aug 2005 22:46:43 -0700 Subject: [SPARC64]: Eliminate irq_cpustat_t. We can put the __softirq_pending mask in the cpudata, no need for the silly NR_CPUS array in kernel/softirq.c Signed-off-by: David S. Miller --- arch/sparc64/kernel/rtrap.S | 13 ++++++++----- arch/sparc64/kernel/setup.c | 12 ------------ include/asm-sparc64/cpudata.h | 4 ++-- include/asm-sparc64/hardirq.h | 16 +++++----------- 4 files changed, 15 insertions(+), 30 deletions(-) (limited to 'include') diff --git a/arch/sparc64/kernel/rtrap.S b/arch/sparc64/kernel/rtrap.S index 0696ed4b9d6..fafd227735f 100644 --- a/arch/sparc64/kernel/rtrap.S +++ b/arch/sparc64/kernel/rtrap.S @@ -153,11 +153,14 @@ __handle_signal: rtrap_irq: rtrap_clr_l6: clr %l6 rtrap: - ldub [%g6 + TI_CPU], %l0 - sethi %hi(irq_stat), %l2 ! &softirq_active - or %l2, %lo(irq_stat), %l2 ! &softirq_active -irqsz_patchme: sllx %l0, 0, %l0 - lduw [%l2 + %l0], %l1 ! softirq_pending +#ifndef CONFIG_SMP + sethi %hi(per_cpu____cpu_data), %l0 + lduw [%l0 + %lo(per_cpu____cpu_data)], %l1 +#else + sethi %hi(per_cpu____cpu_data), %l0 + or %l0, %lo(per_cpu____cpu_data), %l0 + lduw [%l0 + %g5], %l1 +#endif cmp %l1, 0 /* mm/ultra.S:xcall_report_regs KNOWS about this load. */ diff --git a/arch/sparc64/kernel/setup.c b/arch/sparc64/kernel/setup.c index fbdfed3798d..ddbed3341a2 100644 --- a/arch/sparc64/kernel/setup.c +++ b/arch/sparc64/kernel/setup.c @@ -511,18 +511,6 @@ void __init setup_arch(char **cmdline_p) conswitchp = &prom_con; #endif -#ifdef CONFIG_SMP - i = (unsigned long)&irq_stat[1] - (unsigned long)&irq_stat[0]; - if ((i == SMP_CACHE_BYTES) || (i == (2 * SMP_CACHE_BYTES))) { - extern unsigned int irqsz_patchme[1]; - irqsz_patchme[0] |= ((i == SMP_CACHE_BYTES) ? SMP_CACHE_BYTES_SHIFT : \ - SMP_CACHE_BYTES_SHIFT + 1); - flushi((long)&irqsz_patchme[0]); - } else { - prom_printf("Unexpected size of irq_stat[] elements\n"); - prom_halt(); - } -#endif /* Work out if we are starfire early on */ check_if_starfire(); diff --git a/include/asm-sparc64/cpudata.h b/include/asm-sparc64/cpudata.h index cc7198aaac5..9a3a81f1cc5 100644 --- a/include/asm-sparc64/cpudata.h +++ b/include/asm-sparc64/cpudata.h @@ -1,6 +1,6 @@ /* cpudata.h: Per-cpu parameters. * - * Copyright (C) 2003 David S. Miller (davem@redhat.com) + * Copyright (C) 2003, 2005 David S. Miller (davem@redhat.com) */ #ifndef _SPARC64_CPUDATA_H @@ -10,7 +10,7 @@ typedef struct { /* Dcache line 1 */ - unsigned int __pad0; /* bh_count moved to irq_stat for consistency. KAO */ + unsigned int __softirq_pending; /* must be 1st, see rtrap.S */ unsigned int multiplier; unsigned int counter; unsigned int idle_volume; diff --git a/include/asm-sparc64/hardirq.h b/include/asm-sparc64/hardirq.h index d6db1aed764..f0cf71376ec 100644 --- a/include/asm-sparc64/hardirq.h +++ b/include/asm-sparc64/hardirq.h @@ -1,22 +1,16 @@ /* hardirq.h: 64-bit Sparc hard IRQ support. * - * Copyright (C) 1997, 1998 David S. Miller (davem@caip.rutgers.edu) + * Copyright (C) 1997, 1998, 2005 David S. Miller (davem@davemloft.net) */ #ifndef __SPARC64_HARDIRQ_H #define __SPARC64_HARDIRQ_H -#include -#include -#include -#include +#include -/* rtrap.S is sensitive to the offsets of these fields */ -typedef struct { - unsigned int __softirq_pending; -} ____cacheline_aligned irq_cpustat_t; - -#include /* Standard mappings for irq_cpustat_t above */ +#define __ARCH_IRQ_STAT +#define local_softirq_pending() \ + (local_cpu_data().__softirq_pending) #define HARDIRQ_BITS 8 -- cgit v1.2.3-70-g09d2 From 1623c81eece58740279b8de802fa5895221f2044 Mon Sep 17 00:00:00 2001 From: Jeff Garzik Date: Tue, 30 Aug 2005 03:37:42 -0400 Subject: [libata] allow ATAPI to be enabled with new atapi_enabled module option ATAPI is getting close to being ready. To increase exposure, we enable the code in the upstream kernel, but default it to off (present behavior). Users must pass atapi_enabled=1 as a module option (if module) or on the kernel command line (if built in) to turn on discovery of their ATAPI devices. --- drivers/scsi/libata-core.c | 4 ++++ drivers/scsi/libata-scsi.c | 8 ++++---- drivers/scsi/libata.h | 1 + include/linux/libata.h | 1 - 4 files changed, 9 insertions(+), 5 deletions(-) (limited to 'include') diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c index dee4b12b034..d824938d05c 100644 --- a/drivers/scsi/libata-core.c +++ b/drivers/scsi/libata-core.c @@ -75,6 +75,10 @@ static void __ata_qc_complete(struct ata_queued_cmd *qc); static unsigned int ata_unique_id = 1; static struct workqueue_struct *ata_wq; +int atapi_enabled = 0; +module_param(atapi_enabled, int, 0444); +MODULE_PARM_DESC(atapi_enabled, "Enable discovery of ATAPI devices (0=off, 1=on)"); + MODULE_AUTHOR("Jeff Garzik"); MODULE_DESCRIPTION("Library module for ATA devices"); MODULE_LICENSE("GPL"); diff --git a/drivers/scsi/libata-scsi.c b/drivers/scsi/libata-scsi.c index 346eb36b1e3..55823765425 100644 --- a/drivers/scsi/libata-scsi.c +++ b/drivers/scsi/libata-scsi.c @@ -1470,10 +1470,10 @@ ata_scsi_find_dev(struct ata_port *ap, struct scsi_device *scsidev) if (unlikely(!ata_dev_present(dev))) return NULL; -#ifndef ATA_ENABLE_ATAPI - if (unlikely(dev->class == ATA_DEV_ATAPI)) - return NULL; -#endif + if (atapi_enabled) { + if (unlikely(dev->class == ATA_DEV_ATAPI)) + return NULL; + } return dev; } diff --git a/drivers/scsi/libata.h b/drivers/scsi/libata.h index 809c634afbc..d608b3a0f6f 100644 --- a/drivers/scsi/libata.h +++ b/drivers/scsi/libata.h @@ -38,6 +38,7 @@ struct ata_scsi_args { }; /* libata-core.c */ +extern int atapi_enabled; extern struct ata_queued_cmd *ata_qc_new_init(struct ata_port *ap, struct ata_device *dev); extern void ata_qc_free(struct ata_queued_cmd *qc); diff --git a/include/linux/libata.h b/include/linux/libata.h index fc05a989928..1eaba4077e1 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h @@ -40,7 +40,6 @@ #undef ATA_VERBOSE_DEBUG /* yet more debugging output */ #undef ATA_IRQ_TRAP /* define to ack screaming irqs */ #undef ATA_NDEBUG /* define to disable quick runtime checks */ -#undef ATA_ENABLE_ATAPI /* define to enable ATAPI support */ #undef ATA_ENABLE_PATA /* define to enable PATA support in some * low-level drivers */ #undef ATAPI_ENABLE_DMADIR /* enables ATAPI DMADIR bridge support */ -- cgit v1.2.3-70-g09d2 From 374b1873571bf80dc0c1fcceaaad067980f3b9de Mon Sep 17 00:00:00 2001 From: Jeff Garzik Date: Tue, 30 Aug 2005 05:42:52 -0400 Subject: [libata] update several drivers to use pci_iomap()/pci_iounmap() --- drivers/scsi/ahci.c | 7 +++---- drivers/scsi/ata_piix.c | 9 ++++----- drivers/scsi/libata-core.c | 11 ++++++++++- drivers/scsi/sata_nv.c | 9 +++++---- drivers/scsi/sata_promise.c | 8 ++++---- drivers/scsi/sata_qstor.c | 8 ++++---- drivers/scsi/sata_sil.c | 7 ++++--- drivers/scsi/sata_svw.c | 5 ++--- drivers/scsi/sata_sx4.c | 15 +++++++-------- drivers/scsi/sata_vsc.c | 5 ++--- include/linux/libata.h | 1 + 11 files changed, 46 insertions(+), 39 deletions(-) (limited to 'include') diff --git a/drivers/scsi/ahci.c b/drivers/scsi/ahci.c index 4cfb257a0f6..31065261de8 100644 --- a/drivers/scsi/ahci.c +++ b/drivers/scsi/ahci.c @@ -995,8 +995,7 @@ static int ahci_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) probe_ent->dev = pci_dev_to_dev(pdev); INIT_LIST_HEAD(&probe_ent->node); - mmio_base = ioremap(pci_resource_start(pdev, AHCI_PCI_BAR), - pci_resource_len(pdev, AHCI_PCI_BAR)); + mmio_base = pci_iomap(pdev, AHCI_PCI_BAR, 0); if (mmio_base == NULL) { rc = -ENOMEM; goto err_out_free_ent; @@ -1040,7 +1039,7 @@ static int ahci_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) err_out_hpriv: kfree(hpriv); err_out_iounmap: - iounmap(mmio_base); + pci_iounmap(pdev, mmio_base); err_out_free_ent: kfree(probe_ent); err_out_msi: @@ -1081,7 +1080,7 @@ static void ahci_remove_one (struct pci_dev *pdev) } kfree(hpriv); - iounmap(host_set->mmio_base); + pci_iounmap(pdev, host_set->mmio_base); kfree(host_set); if (have_msi) diff --git a/drivers/scsi/ata_piix.c b/drivers/scsi/ata_piix.c index 90c53b88a1e..deec0cef88d 100644 --- a/drivers/scsi/ata_piix.c +++ b/drivers/scsi/ata_piix.c @@ -584,7 +584,6 @@ static void pci_enable_intx(struct pci_dev *pdev) static int piix_disable_ahci(struct pci_dev *pdev) { void __iomem *mmio; - unsigned long addr; u32 tmp; int rc = 0; @@ -592,11 +591,11 @@ static int piix_disable_ahci(struct pci_dev *pdev) * works because this device is usually set up by BIOS. */ - addr = pci_resource_start(pdev, AHCI_PCI_BAR); - if (!addr || !pci_resource_len(pdev, AHCI_PCI_BAR)) + if (!pci_resource_start(pdev, AHCI_PCI_BAR) || + !pci_resource_len(pdev, AHCI_PCI_BAR)) return 0; - mmio = ioremap(addr, 64); + mmio = pci_iomap(pdev, AHCI_PCI_BAR, 64); if (!mmio) return -ENOMEM; @@ -610,7 +609,7 @@ static int piix_disable_ahci(struct pci_dev *pdev) rc = -EIO; } - iounmap(mmio); + pci_iounmap(pdev, mmio); return rc; } diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c index dee4b12b034..1fe20f76fb5 100644 --- a/drivers/scsi/libata-core.c +++ b/drivers/scsi/libata-core.c @@ -4200,6 +4200,15 @@ ata_probe_ent_alloc(struct device *dev, struct ata_port_info *port) +#ifdef CONFIG_PCI + +void ata_pci_host_stop (struct ata_host_set *host_set) +{ + struct pci_dev *pdev = to_pci_dev(host_set->dev); + + pci_iounmap(pdev, host_set->mmio_base); +} + /** * ata_pci_init_native_mode - Initialize native-mode driver * @pdev: pci device to be initialized @@ -4212,7 +4221,6 @@ ata_probe_ent_alloc(struct device *dev, struct ata_port_info *port) * ata_probe_ent structure should then be freed with kfree(). */ -#ifdef CONFIG_PCI struct ata_probe_ent * ata_pci_init_native_mode(struct pci_dev *pdev, struct ata_port_info **port) { @@ -4595,6 +4603,7 @@ EXPORT_SYMBOL_GPL(ata_scsi_simulate); #ifdef CONFIG_PCI EXPORT_SYMBOL_GPL(pci_test_config_bits); +EXPORT_SYMBOL_GPL(ata_pci_host_stop); EXPORT_SYMBOL_GPL(ata_pci_init_native_mode); EXPORT_SYMBOL_GPL(ata_pci_init_one); EXPORT_SYMBOL_GPL(ata_pci_remove_one); diff --git a/drivers/scsi/sata_nv.c b/drivers/scsi/sata_nv.c index 03d9bc6e69d..a1d62dee3be 100644 --- a/drivers/scsi/sata_nv.c +++ b/drivers/scsi/sata_nv.c @@ -351,6 +351,7 @@ static void nv_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val) static void nv_host_stop (struct ata_host_set *host_set) { struct nv_host *host = host_set->private_data; + struct pci_dev *pdev = to_pci_dev(host_set->dev); // Disable hotplug event interrupts. if (host->host_desc->disable_hotplug) @@ -358,7 +359,8 @@ static void nv_host_stop (struct ata_host_set *host_set) kfree(host); - ata_host_stop(host_set); + if (host_set->mmio_base) + pci_iounmap(pdev, host_set->mmio_base); } static int nv_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) @@ -420,8 +422,7 @@ static int nv_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) if (host->host_flags & NV_HOST_FLAGS_SCR_MMIO) { unsigned long base; - probe_ent->mmio_base = ioremap(pci_resource_start(pdev, 5), - pci_resource_len(pdev, 5)); + probe_ent->mmio_base = pci_iomap(pdev, 5, 0); if (probe_ent->mmio_base == NULL) { rc = -EIO; goto err_out_free_host; @@ -457,7 +458,7 @@ static int nv_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) err_out_iounmap: if (host->host_flags & NV_HOST_FLAGS_SCR_MMIO) - iounmap(probe_ent->mmio_base); + pci_iounmap(pdev, probe_ent->mmio_base); err_out_free_host: kfree(host); err_out_free_ent: diff --git a/drivers/scsi/sata_promise.c b/drivers/scsi/sata_promise.c index ed54f281060..538ad727bd2 100644 --- a/drivers/scsi/sata_promise.c +++ b/drivers/scsi/sata_promise.c @@ -92,6 +92,7 @@ static void pdc_exec_command_mmio(struct ata_port *ap, struct ata_taskfile *tf); static void pdc_irq_clear(struct ata_port *ap); static int pdc_qc_issue_prot(struct ata_queued_cmd *qc); + static Scsi_Host_Template pdc_ata_sht = { .module = THIS_MODULE, .name = DRV_NAME, @@ -132,7 +133,7 @@ static struct ata_port_operations pdc_sata_ops = { .scr_write = pdc_sata_scr_write, .port_start = pdc_port_start, .port_stop = pdc_port_stop, - .host_stop = ata_host_stop, + .host_stop = ata_pci_host_stop, }; static struct ata_port_operations pdc_pata_ops = { @@ -153,7 +154,7 @@ static struct ata_port_operations pdc_pata_ops = { .port_start = pdc_port_start, .port_stop = pdc_port_stop, - .host_stop = ata_host_stop, + .host_stop = ata_pci_host_stop, }; static struct ata_port_info pdc_port_info[] = { @@ -663,8 +664,7 @@ static int pdc_ata_init_one (struct pci_dev *pdev, const struct pci_device_id *e probe_ent->dev = pci_dev_to_dev(pdev); INIT_LIST_HEAD(&probe_ent->node); - mmio_base = ioremap(pci_resource_start(pdev, 3), - pci_resource_len(pdev, 3)); + mmio_base = pci_iomap(pdev, 3, 0); if (mmio_base == NULL) { rc = -ENOMEM; goto err_out_free_ent; diff --git a/drivers/scsi/sata_qstor.c b/drivers/scsi/sata_qstor.c index 9c99ab433bd..029c2482e12 100644 --- a/drivers/scsi/sata_qstor.c +++ b/drivers/scsi/sata_qstor.c @@ -538,11 +538,12 @@ static void qs_port_stop(struct ata_port *ap) static void qs_host_stop(struct ata_host_set *host_set) { void __iomem *mmio_base = host_set->mmio_base; + struct pci_dev *pdev = to_pci_dev(host_set->dev); writeb(0, mmio_base + QS_HCT_CTRL); /* disable host interrupts */ writeb(QS_CNFG3_GSRST, mmio_base + QS_HCF_CNFG3); /* global reset */ - ata_host_stop(host_set); + pci_iounmap(pdev, mmio_base); } static void qs_host_init(unsigned int chip_id, struct ata_probe_ent *pe) @@ -646,8 +647,7 @@ static int qs_ata_init_one(struct pci_dev *pdev, goto err_out_regions; } - mmio_base = ioremap(pci_resource_start(pdev, 4), - pci_resource_len(pdev, 4)); + mmio_base = pci_iomap(pdev, 4, 0); if (mmio_base == NULL) { rc = -ENOMEM; goto err_out_regions; @@ -697,7 +697,7 @@ static int qs_ata_init_one(struct pci_dev *pdev, return 0; err_out_iounmap: - iounmap(mmio_base); + pci_iounmap(pdev, mmio_base); err_out_regions: pci_release_regions(pdev); err_out: diff --git a/drivers/scsi/sata_sil.c b/drivers/scsi/sata_sil.c index b1a696fcec8..ba98a175ee3 100644 --- a/drivers/scsi/sata_sil.c +++ b/drivers/scsi/sata_sil.c @@ -86,6 +86,7 @@ static u32 sil_scr_read (struct ata_port *ap, unsigned int sc_reg); static void sil_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val); static void sil_post_set_mode (struct ata_port *ap); + static struct pci_device_id sil_pci_tbl[] = { { 0x1095, 0x3112, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3112_m15w }, { 0x1095, 0x0240, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3112_m15w }, @@ -172,7 +173,7 @@ static struct ata_port_operations sil_ops = { .scr_write = sil_scr_write, .port_start = ata_port_start, .port_stop = ata_port_stop, - .host_stop = ata_host_stop, + .host_stop = ata_pci_host_stop, }; static struct ata_port_info sil_port_info[] = { @@ -231,6 +232,7 @@ MODULE_LICENSE("GPL"); MODULE_DEVICE_TABLE(pci, sil_pci_tbl); MODULE_VERSION(DRV_VERSION); + static unsigned char sil_get_device_cache_line(struct pci_dev *pdev) { u8 cache_line = 0; @@ -426,8 +428,7 @@ static int sil_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) probe_ent->irq_flags = SA_SHIRQ; probe_ent->host_flags = sil_port_info[ent->driver_data].host_flags; - mmio_base = ioremap(pci_resource_start(pdev, 5), - pci_resource_len(pdev, 5)); + mmio_base = pci_iomap(pdev, 5, 0); if (mmio_base == NULL) { rc = -ENOMEM; goto err_out_free_ent; diff --git a/drivers/scsi/sata_svw.c b/drivers/scsi/sata_svw.c index d48de9547fb..d89d968beda 100644 --- a/drivers/scsi/sata_svw.c +++ b/drivers/scsi/sata_svw.c @@ -318,7 +318,7 @@ static struct ata_port_operations k2_sata_ops = { .scr_write = k2_sata_scr_write, .port_start = ata_port_start, .port_stop = ata_port_stop, - .host_stop = ata_host_stop, + .host_stop = ata_pci_host_stop, }; static void k2_sata_setup_port(struct ata_ioports *port, unsigned long base) @@ -392,8 +392,7 @@ static int k2_sata_init_one (struct pci_dev *pdev, const struct pci_device_id *e probe_ent->dev = pci_dev_to_dev(pdev); INIT_LIST_HEAD(&probe_ent->node); - mmio_base = ioremap(pci_resource_start(pdev, 5), - pci_resource_len(pdev, 5)); + mmio_base = pci_iomap(pdev, 5, 0); if (mmio_base == NULL) { rc = -ENOMEM; goto err_out_free_ent; diff --git a/drivers/scsi/sata_sx4.c b/drivers/scsi/sata_sx4.c index 38b3dd2d750..540a8519117 100644 --- a/drivers/scsi/sata_sx4.c +++ b/drivers/scsi/sata_sx4.c @@ -245,13 +245,14 @@ static struct pci_driver pdc_sata_pci_driver = { static void pdc20621_host_stop(struct ata_host_set *host_set) { + struct pci_dev *pdev = to_pci_dev(host_set->dev); struct pdc_host_priv *hpriv = host_set->private_data; void *dimm_mmio = hpriv->dimm_mmio; - iounmap(dimm_mmio); + pci_iounmap(pdev, dimm_mmio); kfree(hpriv); - ata_host_stop(host_set); + pci_iounmap(pdev, host_set->mmio_base); } static int pdc_port_start(struct ata_port *ap) @@ -1418,8 +1419,7 @@ static int pdc_sata_init_one (struct pci_dev *pdev, const struct pci_device_id * probe_ent->dev = pci_dev_to_dev(pdev); INIT_LIST_HEAD(&probe_ent->node); - mmio_base = ioremap(pci_resource_start(pdev, 3), - pci_resource_len(pdev, 3)); + mmio_base = pci_iomap(pdev, 3, 0); if (mmio_base == NULL) { rc = -ENOMEM; goto err_out_free_ent; @@ -1433,8 +1433,7 @@ static int pdc_sata_init_one (struct pci_dev *pdev, const struct pci_device_id * } memset(hpriv, 0, sizeof(*hpriv)); - dimm_mmio = ioremap(pci_resource_start(pdev, 4), - pci_resource_len(pdev, 4)); + dimm_mmio = pci_iomap(pdev, 4, 0); if (!dimm_mmio) { kfree(hpriv); rc = -ENOMEM; @@ -1481,9 +1480,9 @@ static int pdc_sata_init_one (struct pci_dev *pdev, const struct pci_device_id * err_out_iounmap_dimm: /* only get to this label if 20621 */ kfree(hpriv); - iounmap(dimm_mmio); + pci_iounmap(pdev, dimm_mmio); err_out_iounmap: - iounmap(mmio_base); + pci_iounmap(pdev, mmio_base); err_out_free_ent: kfree(probe_ent); err_out_regions: diff --git a/drivers/scsi/sata_vsc.c b/drivers/scsi/sata_vsc.c index 3985f344da4..cf94e0158a8 100644 --- a/drivers/scsi/sata_vsc.c +++ b/drivers/scsi/sata_vsc.c @@ -252,7 +252,7 @@ static struct ata_port_operations vsc_sata_ops = { .scr_write = vsc_sata_scr_write, .port_start = ata_port_start, .port_stop = ata_port_stop, - .host_stop = ata_host_stop, + .host_stop = ata_pci_host_stop, }; static void __devinit vsc_sata_setup_port(struct ata_ioports *port, unsigned long base) @@ -326,8 +326,7 @@ static int __devinit vsc_sata_init_one (struct pci_dev *pdev, const struct pci_d probe_ent->dev = pci_dev_to_dev(pdev); INIT_LIST_HEAD(&probe_ent->node); - mmio_base = ioremap(pci_resource_start(pdev, 0), - pci_resource_len(pdev, 0)); + mmio_base = pci_iomap(pdev, 0, 0); if (mmio_base == NULL) { rc = -ENOMEM; goto err_out_free_ent; diff --git a/include/linux/libata.h b/include/linux/libata.h index fc05a989928..bd0f79dfb9c 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h @@ -450,6 +450,7 @@ struct pci_bits { unsigned long val; }; +extern void ata_pci_host_stop (struct ata_host_set *host_set); extern struct ata_probe_ent * ata_pci_init_native_mode(struct pci_dev *pdev, struct ata_port_info **port); extern int pci_test_config_bits(struct pci_dev *pdev, struct pci_bits *bits); -- cgit v1.2.3-70-g09d2 From 53c165e0a6c8a4ff7df316557528fa7a52d20711 Mon Sep 17 00:00:00 2001 From: James Bottomley Date: Mon, 22 Aug 2005 10:06:19 -0500 Subject: [SCSI] correct attribute_container list usage One of the changes in the attribute_container code in the scsi-misc tree was to add a lock to protect the list of devices per container. This, unfortunately, leads to potential scheduling while atomic problems if there's a sleep in the function called by a trigger. The correct solution is to use the kernel klist infrastructure instead which allows lockless traversal of a list. Signed-off-by: James Bottomley --- drivers/base/attribute_container.c | 51 +++++++++++++++++++++---------------- include/linux/attribute_container.h | 4 +-- 2 files changed, 31 insertions(+), 24 deletions(-) (limited to 'include') diff --git a/drivers/base/attribute_container.c b/drivers/base/attribute_container.c index ebcae5c3413..6c0f49340eb 100644 --- a/drivers/base/attribute_container.c +++ b/drivers/base/attribute_container.c @@ -22,7 +22,7 @@ /* This is a private structure used to tie the classdev and the * container .. it should never be visible outside this file */ struct internal_container { - struct list_head node; + struct klist_node node; struct attribute_container *cont; struct class_device classdev; }; @@ -57,8 +57,7 @@ int attribute_container_register(struct attribute_container *cont) { INIT_LIST_HEAD(&cont->node); - INIT_LIST_HEAD(&cont->containers); - spin_lock_init(&cont->containers_lock); + klist_init(&cont->containers); down(&attribute_container_mutex); list_add_tail(&cont->node, &attribute_container_list); @@ -78,13 +77,13 @@ attribute_container_unregister(struct attribute_container *cont) { int retval = -EBUSY; down(&attribute_container_mutex); - spin_lock(&cont->containers_lock); - if (!list_empty(&cont->containers)) + spin_lock(&cont->containers.k_lock); + if (!list_empty(&cont->containers.k_list)) goto out; retval = 0; list_del(&cont->node); out: - spin_unlock(&cont->containers_lock); + spin_unlock(&cont->containers.k_lock); up(&attribute_container_mutex); return retval; @@ -143,7 +142,6 @@ attribute_container_add_device(struct device *dev, continue; } memset(ic, 0, sizeof(struct internal_container)); - INIT_LIST_HEAD(&ic->node); ic->cont = cont; class_device_initialize(&ic->classdev); ic->classdev.dev = get_device(dev); @@ -154,13 +152,22 @@ attribute_container_add_device(struct device *dev, fn(cont, dev, &ic->classdev); else attribute_container_add_class_device(&ic->classdev); - spin_lock(&cont->containers_lock); - list_add_tail(&ic->node, &cont->containers); - spin_unlock(&cont->containers_lock); + klist_add_tail(&ic->node, &cont->containers); } up(&attribute_container_mutex); } +/* FIXME: can't break out of this unless klist_iter_exit is also + * called before doing the break + */ +#define klist_for_each_entry(pos, head, member, iter) \ + for (klist_iter_init(head, iter); (pos = ({ \ + struct klist_node *n = klist_next(iter); \ + n ? ({ klist_iter_exit(iter) ; NULL; }) : \ + container_of(n, typeof(*pos), member);\ + }) ) != NULL; ) + + /** * attribute_container_remove_device - make device eligible for removal. * @@ -187,18 +194,19 @@ attribute_container_remove_device(struct device *dev, down(&attribute_container_mutex); list_for_each_entry(cont, &attribute_container_list, node) { - struct internal_container *ic, *tmp; + struct internal_container *ic; + struct klist_iter iter; if (attribute_container_no_classdevs(cont)) continue; if (!cont->match(cont, dev)) continue; - spin_lock(&cont->containers_lock); - list_for_each_entry_safe(ic, tmp, &cont->containers, node) { + + klist_for_each_entry(ic, &cont->containers, node, &iter) { if (dev != ic->classdev.dev) continue; - list_del(&ic->node); + klist_remove(&ic->node); if (fn) fn(cont, dev, &ic->classdev); else { @@ -206,7 +214,6 @@ attribute_container_remove_device(struct device *dev, class_device_unregister(&ic->classdev); } } - spin_unlock(&cont->containers_lock); } up(&attribute_container_mutex); } @@ -232,7 +239,8 @@ attribute_container_device_trigger(struct device *dev, down(&attribute_container_mutex); list_for_each_entry(cont, &attribute_container_list, node) { - struct internal_container *ic, *tmp; + struct internal_container *ic; + struct klist_iter iter; if (!cont->match(cont, dev)) continue; @@ -242,12 +250,10 @@ attribute_container_device_trigger(struct device *dev, continue; } - spin_lock(&cont->containers_lock); - list_for_each_entry_safe(ic, tmp, &cont->containers, node) { + klist_for_each_entry(ic, &cont->containers, node, &iter) { if (dev == ic->classdev.dev) fn(cont, dev, &ic->classdev); } - spin_unlock(&cont->containers_lock); } up(&attribute_container_mutex); } @@ -397,15 +403,16 @@ attribute_container_find_class_device(struct attribute_container *cont, { struct class_device *cdev = NULL; struct internal_container *ic; + struct klist_iter iter; - spin_lock(&cont->containers_lock); - list_for_each_entry(ic, &cont->containers, node) { + klist_for_each_entry(ic, &cont->containers, node, &iter) { if (ic->classdev.dev == dev) { cdev = &ic->classdev; + /* FIXME: must exit iterator then break */ + klist_iter_exit(&iter); break; } } - spin_unlock(&cont->containers_lock); return cdev; } diff --git a/include/linux/attribute_container.h b/include/linux/attribute_container.h index ee83fe64a10..93bfb0beb62 100644 --- a/include/linux/attribute_container.h +++ b/include/linux/attribute_container.h @@ -11,12 +11,12 @@ #include #include +#include #include struct attribute_container { struct list_head node; - struct list_head containers; - spinlock_t containers_lock; + struct klist containers; struct class *class; struct class_device_attribute **attrs; int (*match)(struct attribute_container *, struct device *); -- cgit v1.2.3-70-g09d2 From 61a7afa2c476a3be261cf88a95b0dea0c3bd29d4 Mon Sep 17 00:00:00 2001 From: James Bottomley Date: Tue, 16 Aug 2005 18:27:34 -0500 Subject: [SCSI] embryonic RAID class The idea behind a RAID class is to provide a uniform interface to all RAID subsystems (both hardware and software) in the kernel. To do that, I've made this class a transport class that's entirely subsystem independent (although the matching routines have to match per subsystem, as you'll see looking at the code). I put it in the scsi subdirectory purely because I needed somewhere to play with it, but it's not a scsi specific module. I used a fusion raid card as the test bed for this; with that kind of card, this is the type of class output you get: jejb@titanic> ls -l /sys/class/raid_devices/20\:0\:0\:0/ total 0 lrwxrwxrwx 1 root root 0 Aug 16 17:21 component-0 -> ../../../devices/pci0000:80/0000:80:04.0/host20/target20:1:0/20:1:0:0/ lrwxrwxrwx 1 root root 0 Aug 16 17:21 component-1 -> ../../../devices/pci0000:80/0000:80:04.0/host20/target20:1:1/20:1:1:0/ lrwxrwxrwx 1 root root 0 Aug 16 17:21 device -> ../../../devices/pci0000:80/0000:80:04.0/host20/target20:0:0/20:0:0:0/ -r--r--r-- 1 root root 16384 Aug 16 17:21 level -r--r--r-- 1 root root 16384 Aug 16 17:21 resync -r--r--r-- 1 root root 16384 Aug 16 17:21 state So it's really simple: for a SCSI device representing a hardware raid, it shows the raid level, the array state, the resync % complete (if the state is resyncing) and the underlying components of the RAID (these are exposed in fusion on the virtual channel 1). As you can see, this type of information can be exported by almost anything, including software raid. The more difficult trick, of course, is going to be getting it to perform configuration type actions with writable attributes. Signed-off-by: James Bottomley --- drivers/scsi/Kconfig | 6 ++ drivers/scsi/Makefile | 2 + drivers/scsi/raid_class.c | 250 +++++++++++++++++++++++++++++++++++++++++++++ include/linux/raid_class.h | 59 +++++++++++ 4 files changed, 317 insertions(+) create mode 100644 drivers/scsi/raid_class.c create mode 100644 include/linux/raid_class.h (limited to 'include') diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig index 96df148ed96..68adc3cc8ad 100644 --- a/drivers/scsi/Kconfig +++ b/drivers/scsi/Kconfig @@ -1,5 +1,11 @@ menu "SCSI device support" +config RAID_ATTRS + tristate "RAID Transport Class" + default n + ---help--- + Provides RAID + config SCSI tristate "SCSI device support" ---help--- diff --git a/drivers/scsi/Makefile b/drivers/scsi/Makefile index 3746fb9fa2f..85f9e6bb34b 100644 --- a/drivers/scsi/Makefile +++ b/drivers/scsi/Makefile @@ -22,6 +22,8 @@ subdir-$(CONFIG_PCMCIA) += pcmcia obj-$(CONFIG_SCSI) += scsi_mod.o +obj-$(CONFIG_RAID_ATTRS) += raid_class.o + # --- NOTE ORDERING HERE --- # For kernel non-modular link, transport attributes need to # be initialised before drivers diff --git a/drivers/scsi/raid_class.c b/drivers/scsi/raid_class.c new file mode 100644 index 00000000000..f1ea5027865 --- /dev/null +++ b/drivers/scsi/raid_class.c @@ -0,0 +1,250 @@ +/* + * RAID Attributes + */ +#include +#include +#include +#include +#include +#include + +#define RAID_NUM_ATTRS 3 + +struct raid_internal { + struct raid_template r; + struct raid_function_template *f; + /* The actual attributes */ + struct class_device_attribute private_attrs[RAID_NUM_ATTRS]; + /* The array of null terminated pointers to attributes + * needed by scsi_sysfs.c */ + struct class_device_attribute *attrs[RAID_NUM_ATTRS + 1]; +}; + +struct raid_component { + struct list_head node; + struct device *dev; + int num; +}; + +#define to_raid_internal(tmpl) container_of(tmpl, struct raid_internal, r) + +#define tc_to_raid_internal(tcont) ({ \ + struct raid_template *r = \ + container_of(tcont, struct raid_template, raid_attrs); \ + to_raid_internal(r); \ +}) + +#define ac_to_raid_internal(acont) ({ \ + struct transport_container *tc = \ + container_of(acont, struct transport_container, ac); \ + tc_to_raid_internal(tc); \ +}) + +#define class_device_to_raid_internal(cdev) ({ \ + struct attribute_container *ac = \ + attribute_container_classdev_to_container(cdev); \ + ac_to_raid_internal(ac); \ +}) + + +static int raid_match(struct attribute_container *cont, struct device *dev) +{ + /* We have to look for every subsystem that could house + * emulated RAID devices, so start with SCSI */ + struct raid_internal *i = ac_to_raid_internal(cont); + + if (scsi_is_sdev_device(dev)) { + struct scsi_device *sdev = to_scsi_device(dev); + + if (i->f->cookie != sdev->host->hostt) + return 0; + + return i->f->is_raid(dev); + } + /* FIXME: look at other subsystems too */ + return 0; +} + +static int raid_setup(struct transport_container *tc, struct device *dev, + struct class_device *cdev) +{ + struct raid_data *rd; + + BUG_ON(class_get_devdata(cdev)); + + rd = kmalloc(sizeof(*rd), GFP_KERNEL); + if (!rd) + return -ENOMEM; + + memset(rd, 0, sizeof(*rd)); + INIT_LIST_HEAD(&rd->component_list); + class_set_devdata(cdev, rd); + + return 0; +} + +static int raid_remove(struct transport_container *tc, struct device *dev, + struct class_device *cdev) +{ + struct raid_data *rd = class_get_devdata(cdev); + struct raid_component *rc, *next; + class_set_devdata(cdev, NULL); + list_for_each_entry_safe(rc, next, &rd->component_list, node) { + char buf[40]; + snprintf(buf, sizeof(buf), "component-%d", rc->num); + list_del(&rc->node); + sysfs_remove_link(&cdev->kobj, buf); + kfree(rc); + } + kfree(class_get_devdata(cdev)); + return 0; +} + +static DECLARE_TRANSPORT_CLASS(raid_class, + "raid_devices", + raid_setup, + raid_remove, + NULL); + +static struct { + enum raid_state value; + char *name; +} raid_states[] = { + { RAID_ACTIVE, "active" }, + { RAID_DEGRADED, "degraded" }, + { RAID_RESYNCING, "resyncing" }, + { RAID_OFFLINE, "offline" }, +}; + +static const char *raid_state_name(enum raid_state state) +{ + int i; + char *name = NULL; + + for (i = 0; i < sizeof(raid_states)/sizeof(raid_states[0]); i++) { + if (raid_states[i].value == state) { + name = raid_states[i].name; + break; + } + } + return name; +} + + +#define raid_attr_show_internal(attr, fmt, var, code) \ +static ssize_t raid_show_##attr(struct class_device *cdev, char *buf) \ +{ \ + struct raid_data *rd = class_get_devdata(cdev); \ + code \ + return snprintf(buf, 20, #fmt "\n", var); \ +} + +#define raid_attr_ro_states(attr, states, code) \ +raid_attr_show_internal(attr, %s, name, \ + const char *name; \ + code \ + name = raid_##states##_name(rd->attr); \ +) \ +static CLASS_DEVICE_ATTR(attr, S_IRUGO, raid_show_##attr, NULL) + + +#define raid_attr_ro_internal(attr, code) \ +raid_attr_show_internal(attr, %d, rd->attr, code) \ +static CLASS_DEVICE_ATTR(attr, S_IRUGO, raid_show_##attr, NULL) + +#define ATTR_CODE(attr) \ + struct raid_internal *i = class_device_to_raid_internal(cdev); \ + if (i->f->get_##attr) \ + i->f->get_##attr(cdev->dev); + +#define raid_attr_ro(attr) raid_attr_ro_internal(attr, ) +#define raid_attr_ro_fn(attr) raid_attr_ro_internal(attr, ATTR_CODE(attr)) +#define raid_attr_ro_state(attr) raid_attr_ro_states(attr, attr, ATTR_CODE(attr)) + +raid_attr_ro(level); +raid_attr_ro_fn(resync); +raid_attr_ro_state(state); + +void raid_component_add(struct raid_template *r,struct device *raid_dev, + struct device *component_dev) +{ + struct class_device *cdev = + attribute_container_find_class_device(&r->raid_attrs.ac, + raid_dev); + struct raid_component *rc; + struct raid_data *rd = class_get_devdata(cdev); + char buf[40]; + + rc = kmalloc(sizeof(*rc), GFP_KERNEL); + if (!rc) + return; + + INIT_LIST_HEAD(&rc->node); + rc->dev = component_dev; + rc->num = rd->component_count++; + + snprintf(buf, sizeof(buf), "component-%d", rc->num); + list_add_tail(&rc->node, &rd->component_list); + sysfs_create_link(&cdev->kobj, &component_dev->kobj, buf); +} +EXPORT_SYMBOL(raid_component_add); + +struct raid_template * +raid_class_attach(struct raid_function_template *ft) +{ + struct raid_internal *i = kmalloc(sizeof(struct raid_internal), + GFP_KERNEL); + int count = 0; + + if (unlikely(!i)) + return NULL; + + memset(i, 0, sizeof(*i)); + + i->f = ft; + + i->r.raid_attrs.ac.class = &raid_class.class; + i->r.raid_attrs.ac.match = raid_match; + i->r.raid_attrs.ac.attrs = &i->attrs[0]; + + attribute_container_register(&i->r.raid_attrs.ac); + + i->attrs[count++] = &class_device_attr_level; + i->attrs[count++] = &class_device_attr_resync; + i->attrs[count++] = &class_device_attr_state; + + i->attrs[count] = NULL; + BUG_ON(count > RAID_NUM_ATTRS); + + return &i->r; +} +EXPORT_SYMBOL(raid_class_attach); + +void +raid_class_release(struct raid_template *r) +{ + struct raid_internal *i = to_raid_internal(r); + + attribute_container_unregister(&i->r.raid_attrs.ac); + + kfree(i); +} +EXPORT_SYMBOL(raid_class_release); + +static __init int raid_init(void) +{ + return transport_class_register(&raid_class); +} + +static __exit void raid_exit(void) +{ + transport_class_unregister(&raid_class); +} + +MODULE_AUTHOR("James Bottomley"); +MODULE_DESCRIPTION("RAID device class"); +MODULE_LICENSE("GPL"); + +module_init(raid_init); +module_exit(raid_exit); + diff --git a/include/linux/raid_class.h b/include/linux/raid_class.h new file mode 100644 index 00000000000..a71123c2827 --- /dev/null +++ b/include/linux/raid_class.h @@ -0,0 +1,59 @@ +/* + */ +#include + +struct raid_template { + struct transport_container raid_attrs; +}; + +struct raid_function_template { + void *cookie; + int (*is_raid)(struct device *); + void (*get_resync)(struct device *); + void (*get_state)(struct device *); +}; + +enum raid_state { + RAID_ACTIVE = 1, + RAID_DEGRADED, + RAID_RESYNCING, + RAID_OFFLINE, +}; + +struct raid_data { + struct list_head component_list; + int component_count; + int level; + enum raid_state state; + int resync; +}; + +#define DEFINE_RAID_ATTRIBUTE(type, attr) \ +static inline void \ +raid_set_##attr(struct raid_template *r, struct device *dev, type value) { \ + struct class_device *cdev = \ + attribute_container_find_class_device(&r->raid_attrs.ac, dev);\ + struct raid_data *rd; \ + BUG_ON(!cdev); \ + rd = class_get_devdata(cdev); \ + rd->attr = value; \ +} \ +static inline type \ +raid_get_##attr(struct raid_template *r, struct device *dev) { \ + struct class_device *cdev = \ + attribute_container_find_class_device(&r->raid_attrs.ac, dev);\ + struct raid_data *rd; \ + BUG_ON(!cdev); \ + rd = class_get_devdata(cdev); \ + return rd->attr; \ +} + +DEFINE_RAID_ATTRIBUTE(int, level) +DEFINE_RAID_ATTRIBUTE(int, resync) +DEFINE_RAID_ATTRIBUTE(enum raid_state, state) + +struct raid_template *raid_class_attach(struct raid_function_template *); +void raid_class_release(struct raid_template *); + +void raid_component_add(struct raid_template *, struct device *, + struct device *); -- cgit v1.2.3-70-g09d2 From 8813dfbfc56b3f7c369b3115c2f70bcacd77ec51 Mon Sep 17 00:00:00 2001 From: "Alexey Y. Starikovskiy" Date: Thu, 25 Aug 2005 09:56:52 +0400 Subject: [ACPI] Error: Invalid owner_id: 00 Signed-off-by: Alexey Y. Starikovskiy Signed-off-by: Len Brown --- drivers/acpi/dispatcher/dsmethod.c | 52 +++++++++++++++++++------------------- drivers/acpi/parser/psparse.c | 21 +++++---------- drivers/acpi/parser/psxface.c | 13 ---------- drivers/acpi/utilities/utmisc.c | 2 ++ include/acpi/acdispat.h | 2 +- 5 files changed, 35 insertions(+), 55 deletions(-) (limited to 'include') diff --git a/drivers/acpi/dispatcher/dsmethod.c b/drivers/acpi/dispatcher/dsmethod.c index 77fcfc3070d..8b67a918341 100644 --- a/drivers/acpi/dispatcher/dsmethod.c +++ b/drivers/acpi/dispatcher/dsmethod.c @@ -235,6 +235,16 @@ acpi_ds_begin_method_execution(struct acpi_namespace_node *method_node, acpi_ex_system_wait_semaphore(obj_desc->method.semaphore, ACPI_WAIT_FOREVER); } + /* + * allocate owner id for this method + */ + if (!obj_desc->method.thread_count) { + status = acpi_ut_allocate_owner_id (&obj_desc->method.owner_id); + if (ACPI_FAILURE (status)) { + return_ACPI_STATUS (status); + } + } + /* * Increment the method parse tree thread count since it has been @@ -289,11 +299,6 @@ acpi_ds_call_control_method(struct acpi_thread_state *thread, return_ACPI_STATUS(AE_NULL_OBJECT); } - status = acpi_ut_allocate_owner_id(&obj_desc->method.owner_id); - if (ACPI_FAILURE(status)) { - return_ACPI_STATUS(status); - } - /* Init for new method, wait on concurrency semaphore */ status = acpi_ds_begin_method_execution(method_node, obj_desc, @@ -380,22 +385,18 @@ acpi_ds_call_control_method(struct acpi_thread_state *thread, if (obj_desc->method.method_flags & AML_METHOD_INTERNAL_ONLY) { status = obj_desc->method.implementation(next_walk_state); - return_ACPI_STATUS(status); } + goto end; - return_ACPI_STATUS(AE_OK); - - /* On error, we must delete the new walk state */ - - cleanup: - acpi_ut_release_owner_id(&obj_desc->method.owner_id); +cleanup: + /* Decrement the thread count on the method parse tree */ if (next_walk_state && (next_walk_state->method_desc)) { - /* Decrement the thread count on the method parse tree */ - next_walk_state->method_desc->method.thread_count--; } - (void)acpi_ds_terminate_control_method(next_walk_state); - acpi_ds_delete_walk_state(next_walk_state); + /* On error, we must delete the new walk state */ + acpi_ds_terminate_control_method (next_walk_state); + acpi_ds_delete_walk_state (next_walk_state); +end: return_ACPI_STATUS(status); } @@ -479,7 +480,7 @@ acpi_ds_restart_control_method(struct acpi_walk_state *walk_state, * * PARAMETERS: walk_state - State of the method * - * RETURN: Status + * RETURN: None * * DESCRIPTION: Terminate a control method. Delete everything that the method * created, delete all locals and arguments, and delete the parse @@ -487,7 +488,7 @@ acpi_ds_restart_control_method(struct acpi_walk_state *walk_state, * ******************************************************************************/ -acpi_status acpi_ds_terminate_control_method(struct acpi_walk_state *walk_state) +void acpi_ds_terminate_control_method(struct acpi_walk_state *walk_state) { union acpi_operand_object *obj_desc; struct acpi_namespace_node *method_node; @@ -496,14 +497,14 @@ acpi_status acpi_ds_terminate_control_method(struct acpi_walk_state *walk_state) ACPI_FUNCTION_TRACE_PTR("ds_terminate_control_method", walk_state); if (!walk_state) { - return (AE_BAD_PARAMETER); + return_VOID; } /* The current method object was saved in the walk state */ obj_desc = walk_state->method_desc; if (!obj_desc) { - return_ACPI_STATUS(AE_OK); + return_VOID; } /* Delete all arguments and locals */ @@ -517,7 +518,7 @@ acpi_status acpi_ds_terminate_control_method(struct acpi_walk_state *walk_state) */ status = acpi_ut_acquire_mutex(ACPI_MTX_PARSER); if (ACPI_FAILURE(status)) { - return_ACPI_STATUS(status); + return_VOID; } /* Signal completion of the execution of this method if necessary */ @@ -574,7 +575,7 @@ acpi_status acpi_ds_terminate_control_method(struct acpi_walk_state *walk_state) */ status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); if (ACPI_FAILURE(status)) { - return_ACPI_STATUS(status); + goto cleanup; } if (method_node->child) { @@ -592,10 +593,9 @@ acpi_status acpi_ds_terminate_control_method(struct acpi_walk_state *walk_state) owner_id); if (ACPI_FAILURE(status)) { - return_ACPI_STATUS(status); + goto cleanup; } } - - status = acpi_ut_release_mutex(ACPI_MTX_PARSER); - return_ACPI_STATUS(status); +cleanup: + acpi_ut_release_mutex (ACPI_MTX_PARSER); } diff --git a/drivers/acpi/parser/psparse.c b/drivers/acpi/parser/psparse.c index 3248051d77e..36771309c62 100644 --- a/drivers/acpi/parser/psparse.c +++ b/drivers/acpi/parser/psparse.c @@ -438,7 +438,6 @@ acpi_ps_next_parse_state(struct acpi_walk_state *walk_state, acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state) { acpi_status status; - acpi_status terminate_status; struct acpi_thread_state *thread; struct acpi_thread_state *prev_walk_list = acpi_gbl_current_walk_list; struct acpi_walk_state *previous_walk_state; @@ -508,6 +507,9 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state) walk_state->method_node, NULL, status); + /* Make sure that failed method will be cleaned as if it was executed */ + walk_state->parse_flags |= ACPI_PARSE_EXECUTE; + /* Check for possible multi-thread reentrancy problem */ if ((status == AE_ALREADY_EXISTS) && @@ -524,14 +526,6 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state) } } - if (walk_state->method_desc) { - /* Decrement the thread count on the method parse tree */ - - if (walk_state->method_desc->method.thread_count) { - walk_state->method_desc->method.thread_count--; - } - } - /* We are done with this walk, move on to the parent if any */ walk_state = acpi_ds_pop_walk_state(thread); @@ -546,13 +540,10 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state) */ if ((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) == ACPI_PARSE_EXECUTE) { - terminate_status = - acpi_ds_terminate_control_method(walk_state); - if (ACPI_FAILURE(terminate_status)) { - ACPI_REPORT_ERROR(("Could not terminate control method properly\n")); - - /* Ignore error and continue */ + if (walk_state->method_desc) { + walk_state->method_desc->method.thread_count--; } + acpi_ds_terminate_control_method (walk_state); } /* Delete this walk state and all linked control states */ diff --git a/drivers/acpi/parser/psxface.c b/drivers/acpi/parser/psxface.c index 80c67f2d3dd..f6904bdf573 100644 --- a/drivers/acpi/parser/psxface.c +++ b/drivers/acpi/parser/psxface.c @@ -98,16 +98,6 @@ acpi_status acpi_ps_execute_method(struct acpi_parameter_info *info) return_ACPI_STATUS(status); } - /* - * Get a new owner_id for objects created by this method. Namespace - * objects (such as Operation Regions) can be created during the - * first pass parse. - */ - status = acpi_ut_allocate_owner_id(&info->obj_desc->method.owner_id); - if (ACPI_FAILURE(status)) { - return_ACPI_STATUS(status); - } - /* * The caller "owns" the parameters, so give each one an extra * reference @@ -139,9 +129,6 @@ acpi_status acpi_ps_execute_method(struct acpi_parameter_info *info) status = acpi_ps_execute_pass(info); cleanup: - if (info->obj_desc->method.owner_id) { - acpi_ut_release_owner_id(&info->obj_desc->method.owner_id); - } /* Take away the extra reference that we gave the parameters above */ diff --git a/drivers/acpi/utilities/utmisc.c b/drivers/acpi/utilities/utmisc.c index f0275025b71..c2f5b2adb5d 100644 --- a/drivers/acpi/utilities/utmisc.c +++ b/drivers/acpi/utilities/utmisc.c @@ -67,6 +67,8 @@ acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id) ACPI_FUNCTION_TRACE("ut_allocate_owner_id"); + WARN_ON(*owner_id); + /* Mutex for the global ID mask */ status = acpi_ut_acquire_mutex(ACPI_MTX_CACHES); diff --git a/include/acpi/acdispat.h b/include/acpi/acdispat.h index 59306186f5e..c436e8be6ba 100644 --- a/include/acpi/acdispat.h +++ b/include/acpi/acdispat.h @@ -194,7 +194,7 @@ acpi_status acpi_ds_restart_control_method(struct acpi_walk_state *walk_state, union acpi_operand_object *return_desc); -acpi_status +void acpi_ds_terminate_control_method(struct acpi_walk_state *walk_state); acpi_status -- cgit v1.2.3-70-g09d2 From 8a36895c0ddac143b7f0e87d46153f4f75d9fff7 Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Wed, 31 Aug 2005 15:01:33 -0700 Subject: [SPARC64]: Use 'unsigned long' for port argument to I/O string ops. This kills warnings when building drivers/ide/ide-iops.c and puts us in-line with what other platforms do here. Signed-off-by: David S. Miller --- arch/sparc64/lib/PeeCeeI.c | 77 ++++++++++++++++++++++++++-------------------- include/asm-sparc64/io.h | 47 ++++++++++++++++++++-------- 2 files changed, 79 insertions(+), 45 deletions(-) (limited to 'include') diff --git a/arch/sparc64/lib/PeeCeeI.c b/arch/sparc64/lib/PeeCeeI.c index 3008d536e8c..3c6cfbb2036 100644 --- a/arch/sparc64/lib/PeeCeeI.c +++ b/arch/sparc64/lib/PeeCeeI.c @@ -7,28 +7,31 @@ #include #include -void outsb(void __iomem *addr, const void *src, unsigned long count) +void outsb(unsigned long __addr, const void *src, unsigned long count) { + void __iomem *addr = (void __iomem *) __addr; const u8 *p = src; - while(count--) + while (count--) outb(*p++, addr); } -void outsw(void __iomem *addr, const void *src, unsigned long count) +void outsw(unsigned long __addr, const void *src, unsigned long count) { - if(count) { + void __iomem *addr = (void __iomem *) __addr; + + if (count) { u16 *ps = (u16 *)src; u32 *pi; - if(((u64)src) & 0x2) { + if (((u64)src) & 0x2) { u16 val = le16_to_cpup(ps); outw(val, addr); ps++; count--; } pi = (u32 *)ps; - while(count >= 2) { + while (count >= 2) { u32 w = le32_to_cpup(pi); pi++; @@ -37,19 +40,21 @@ void outsw(void __iomem *addr, const void *src, unsigned long count) count -= 2; } ps = (u16 *)pi; - if(count) { + if (count) { u16 val = le16_to_cpup(ps); outw(val, addr); } } } -void outsl(void __iomem *addr, const void *src, unsigned long count) +void outsl(unsigned long __addr, const void *src, unsigned long count) { - if(count) { - if((((u64)src) & 0x3) == 0) { + void __iomem *addr = (void __iomem *) __addr; + + if (count) { + if ((((u64)src) & 0x3) == 0) { u32 *p = (u32 *)src; - while(count--) { + while (count--) { u32 val = cpu_to_le32p(p); outl(val, addr); p++; @@ -60,13 +65,13 @@ void outsl(void __iomem *addr, const void *src, unsigned long count) u32 l = 0, l2; u32 *pi; - switch(((u64)src) & 0x3) { + switch (((u64)src) & 0x3) { case 0x2: count -= 1; l = cpu_to_le16p(ps) << 16; ps++; pi = (u32 *)ps; - while(count--) { + while (count--) { l2 = cpu_to_le32p(pi); pi++; outl(((l >> 16) | (l2 << 16)), addr); @@ -86,7 +91,7 @@ void outsl(void __iomem *addr, const void *src, unsigned long count) ps++; l |= (l2 << 16); pi = (u32 *)ps; - while(count--) { + while (count--) { l2 = cpu_to_le32p(pi); pi++; outl(((l >> 8) | (l2 << 24)), addr); @@ -101,7 +106,7 @@ void outsl(void __iomem *addr, const void *src, unsigned long count) pb = (u8 *)src; l = (*pb++ << 24); pi = (u32 *)pb; - while(count--) { + while (count--) { l2 = cpu_to_le32p(pi); pi++; outl(((l >> 24) | (l2 << 8)), addr); @@ -119,16 +124,18 @@ void outsl(void __iomem *addr, const void *src, unsigned long count) } } -void insb(void __iomem *addr, void *dst, unsigned long count) +void insb(unsigned long __addr, void *dst, unsigned long count) { - if(count) { + void __iomem *addr = (void __iomem *) __addr; + + if (count) { u32 *pi; u8 *pb = dst; - while((((unsigned long)pb) & 0x3) && count--) + while ((((unsigned long)pb) & 0x3) && count--) *pb++ = inb(addr); pi = (u32 *)pb; - while(count >= 4) { + while (count >= 4) { u32 w; w = (inb(addr) << 24); @@ -139,23 +146,25 @@ void insb(void __iomem *addr, void *dst, unsigned long count) count -= 4; } pb = (u8 *)pi; - while(count--) + while (count--) *pb++ = inb(addr); } } -void insw(void __iomem *addr, void *dst, unsigned long count) +void insw(unsigned long __addr, void *dst, unsigned long count) { - if(count) { + void __iomem *addr = (void __iomem *) __addr; + + if (count) { u16 *ps = dst; u32 *pi; - if(((unsigned long)ps) & 0x2) { + if (((unsigned long)ps) & 0x2) { *ps++ = le16_to_cpu(inw(addr)); count--; } pi = (u32 *)ps; - while(count >= 2) { + while (count >= 2) { u32 w; w = (le16_to_cpu(inw(addr)) << 16); @@ -164,31 +173,33 @@ void insw(void __iomem *addr, void *dst, unsigned long count) count -= 2; } ps = (u16 *)pi; - if(count) + if (count) *ps = le16_to_cpu(inw(addr)); } } -void insl(void __iomem *addr, void *dst, unsigned long count) +void insl(unsigned long __addr, void *dst, unsigned long count) { - if(count) { - if((((unsigned long)dst) & 0x3) == 0) { + void __iomem *addr = (void __iomem *) __addr; + + if (count) { + if ((((unsigned long)dst) & 0x3) == 0) { u32 *pi = dst; - while(count--) + while (count--) *pi++ = le32_to_cpu(inl(addr)); } else { u32 l = 0, l2, *pi; u16 *ps; u8 *pb; - switch(((unsigned long)dst) & 3) { + switch (((unsigned long)dst) & 3) { case 0x2: ps = dst; count -= 1; l = le32_to_cpu(inl(addr)); *ps++ = l; pi = (u32 *)ps; - while(count--) { + while (count--) { l2 = le32_to_cpu(inl(addr)); *pi++ = (l << 16) | (l2 >> 16); l = l2; @@ -205,7 +216,7 @@ void insl(void __iomem *addr, void *dst, unsigned long count) ps = (u16 *)pb; *ps++ = ((l >> 8) & 0xffff); pi = (u32 *)ps; - while(count--) { + while (count--) { l2 = le32_to_cpu(inl(addr)); *pi++ = (l << 24) | (l2 >> 8); l = l2; @@ -220,7 +231,7 @@ void insl(void __iomem *addr, void *dst, unsigned long count) l = le32_to_cpu(inl(addr)); *pb++ = l >> 24; pi = (u32 *)pb; - while(count--) { + while (count--) { l2 = le32_to_cpu(inl(addr)); *pi++ = (l << 8) | (l2 >> 24); l = l2; diff --git a/include/asm-sparc64/io.h b/include/asm-sparc64/io.h index afdcea90707..0056770e83a 100644 --- a/include/asm-sparc64/io.h +++ b/include/asm-sparc64/io.h @@ -100,18 +100,41 @@ static __inline__ void _outl(u32 l, unsigned long addr) #define inl_p(__addr) inl(__addr) #define outl_p(__l, __addr) outl(__l, __addr) -extern void outsb(void __iomem *addr, const void *src, unsigned long count); -extern void outsw(void __iomem *addr, const void *src, unsigned long count); -extern void outsl(void __iomem *addr, const void *src, unsigned long count); -extern void insb(void __iomem *addr, void *dst, unsigned long count); -extern void insw(void __iomem *addr, void *dst, unsigned long count); -extern void insl(void __iomem *addr, void *dst, unsigned long count); -#define ioread8_rep(a,d,c) insb(a,d,c) -#define ioread16_rep(a,d,c) insw(a,d,c) -#define ioread32_rep(a,d,c) insl(a,d,c) -#define iowrite8_rep(a,s,c) outsb(a,s,c) -#define iowrite16_rep(a,s,c) outsw(a,s,c) -#define iowrite32_rep(a,s,c) outsl(a,s,c) +extern void outsb(unsigned long, const void *, unsigned long); +extern void outsw(unsigned long, const void *, unsigned long); +extern void outsl(unsigned long, const void *, unsigned long); +extern void insb(unsigned long, void *, unsigned long); +extern void insw(unsigned long, void *, unsigned long); +extern void insl(unsigned long, void *, unsigned long); + +static inline void ioread8_rep(void __iomem *port, void *buf, unsigned long count) +{ + insb((unsigned long __force)port, buf, count); +} +static inline void ioread16_rep(void __iomem *port, void *buf, unsigned long count) +{ + insw((unsigned long __force)port, buf, count); +} + +static inline void ioread32_rep(void __iomem *port, void *buf, unsigned long count) +{ + insl((unsigned long __force)port, buf, count); +} + +static inline void iowrite8_rep(void __iomem *port, const void *buf, unsigned long count) +{ + outsb((unsigned long __force)port, buf, count); +} + +static inline void iowrite16_rep(void __iomem *port, const void *buf, unsigned long count) +{ + outsw((unsigned long __force)port, buf, count); +} + +static inline void iowrite32_rep(void __iomem *port, const void *buf, unsigned long count) +{ + outsl((unsigned long __force)port, buf, count); +} /* Memory functions, same as I/O accesses on Ultra. */ static inline u8 _readb(const volatile void __iomem *addr) -- cgit v1.2.3-70-g09d2 From ff4cc3ac93e1d0369928fd60ec1fe82417afc576 Mon Sep 17 00:00:00 2001 From: Mike Kershaw Date: Thu, 1 Sep 2005 17:40:05 -0700 Subject: [TUNTAP]: Allow setting the linktype of the tap device from userspace Currently tun/tap only supports the EN10MB ARP type. For use with wireless and other networking types it should be possible to set the ARP type via an ioctl. Patch v2: Included check that the tap interface is down before changing the link type out from underneath it Signed-off-by: Mike Kershaw Signed-off-by: David S. Miller --- drivers/net/tun.c | 15 +++++++++++++++ include/linux/if_tun.h | 1 + 2 files changed, 16 insertions(+) (limited to 'include') diff --git a/drivers/net/tun.c b/drivers/net/tun.c index effab0b9adc..50b8c6754b1 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c @@ -18,6 +18,9 @@ /* * Changes: * + * Mike Kershaw 2005/08/14 + * Add TUNSETLINK ioctl to set the link encapsulation + * * Mark Smith * Use random_ether_addr() for tap MAC address. * @@ -612,6 +615,18 @@ static int tun_chr_ioctl(struct inode *inode, struct file *file, DBG(KERN_INFO "%s: owner set to %d\n", tun->dev->name, tun->owner); break; + case TUNSETLINK: + /* Only allow setting the type when the interface is down */ + if (tun->dev->flags & IFF_UP) { + DBG(KERN_INFO "%s: Linktype set failed because interface is up\n", + tun->dev->name); + return -EBUSY; + } else { + tun->dev->type = (int) arg; + DBG(KERN_INFO "%s: linktype set to %d\n", tun->dev->name, tun->dev->type); + } + break; + #ifdef TUN_DEBUG case TUNSETDEBUG: tun->debug = arg; diff --git a/include/linux/if_tun.h b/include/linux/if_tun.h index 096a85a58ae..88aef7b86ef 100644 --- a/include/linux/if_tun.h +++ b/include/linux/if_tun.h @@ -77,6 +77,7 @@ struct tun_struct { #define TUNSETIFF _IOW('T', 202, int) #define TUNSETPERSIST _IOW('T', 203, int) #define TUNSETOWNER _IOW('T', 204, int) +#define TUNSETLINK _IOW('T', 205, int) /* TUNSETIFF ifr flags */ #define IFF_TUN 0x0001 -- cgit v1.2.3-70-g09d2 From 732db659b83579b922c18dee9123e1529b5fb5d2 Mon Sep 17 00:00:00 2001 From: Adrian Bunk Date: Thu, 1 Sep 2005 17:40:26 -0700 Subject: [IPVS]: "extern inline" -> "static inline" "extern inline" doesn't make much sense. Signed-off-by: Adrian Bunk Signed-off-by: David S. Miller --- include/net/ip_vs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h index 7a3c43711a1..e426641c519 100644 --- a/include/net/ip_vs.h +++ b/include/net/ip_vs.h @@ -958,7 +958,7 @@ static __inline__ int ip_vs_todrop(void) */ #define IP_VS_FWD_METHOD(cp) (cp->flags & IP_VS_CONN_F_FWD_MASK) -extern __inline__ char ip_vs_fwd_tag(struct ip_vs_conn *cp) +static inline char ip_vs_fwd_tag(struct ip_vs_conn *cp) { char fwd; -- cgit v1.2.3-70-g09d2 From 64baf3cfea974d2b9e671ccfdbc03e030ea5ebc6 Mon Sep 17 00:00:00 2001 From: Herbert Xu Date: Thu, 1 Sep 2005 17:43:05 -0700 Subject: [CRYPTO]: Added CRYPTO_TFM_REQ_MAY_SLEEP flag The crypto layer currently uses in_atomic() to determine whether it is allowed to sleep. This is incorrect since spin locks don't always cause in_atomic() to return true. Instead of that, this patch returns to an earlier idea of a per-tfm flag which determines whether sleeping is allowed. Unlike the earlier version, the default is to not allow sleeping. This ensures that no existing code can break. As usual, this flag may either be set through crypto_alloc_tfm(), or just before a specific crypto operation. Signed-off-by: Herbert Xu Signed-off-by: David S. Miller --- crypto/api.c | 3 ++- crypto/cipher.c | 4 ---- crypto/internal.h | 3 ++- include/linux/crypto.h | 1 + 4 files changed, 5 insertions(+), 6 deletions(-) (limited to 'include') diff --git a/crypto/api.c b/crypto/api.c index b4728811ce3..959c4e5f264 100644 --- a/crypto/api.c +++ b/crypto/api.c @@ -66,7 +66,8 @@ static inline struct crypto_alg *crypto_alg_mod_lookup(const char *name) static int crypto_init_flags(struct crypto_tfm *tfm, u32 flags) { - tfm->crt_flags = 0; + tfm->crt_flags = flags & CRYPTO_TFM_REQ_MASK; + flags &= ~CRYPTO_TFM_REQ_MASK; switch (crypto_tfm_alg_type(tfm)) { case CRYPTO_ALG_TYPE_CIPHER: diff --git a/crypto/cipher.c b/crypto/cipher.c index 8da644364cb..3df47f93c9d 100644 --- a/crypto/cipher.c +++ b/crypto/cipher.c @@ -377,11 +377,7 @@ static int nocrypt_iv(struct crypto_tfm *tfm, int crypto_init_cipher_flags(struct crypto_tfm *tfm, u32 flags) { u32 mode = flags & CRYPTO_TFM_MODE_MASK; - tfm->crt_cipher.cit_mode = mode ? mode : CRYPTO_TFM_MODE_ECB; - if (flags & CRYPTO_TFM_REQ_WEAK_KEY) - tfm->crt_flags = CRYPTO_TFM_REQ_WEAK_KEY; - return 0; } diff --git a/crypto/internal.h b/crypto/internal.h index 37515beafc8..37aa652ce5c 100644 --- a/crypto/internal.h +++ b/crypto/internal.h @@ -17,6 +17,7 @@ #include #include #include +#include #include extern enum km_type crypto_km_types[]; @@ -38,7 +39,7 @@ static inline void crypto_kunmap(void *vaddr, int out) static inline void crypto_yield(struct crypto_tfm *tfm) { - if (!in_atomic()) + if (tfm->crt_flags & CRYPTO_TFM_REQ_MAY_SLEEP) cond_resched(); } diff --git a/include/linux/crypto.h b/include/linux/crypto.h index 5e2bcc636a0..3c89df6e776 100644 --- a/include/linux/crypto.h +++ b/include/linux/crypto.h @@ -45,6 +45,7 @@ #define CRYPTO_TFM_MODE_CTR 0x00000008 #define CRYPTO_TFM_REQ_WEAK_KEY 0x00000100 +#define CRYPTO_TFM_REQ_MAY_SLEEP 0x00000200 #define CRYPTO_TFM_RES_WEAK_KEY 0x00100000 #define CRYPTO_TFM_RES_BAD_KEY_LEN 0x00200000 #define CRYPTO_TFM_RES_BAD_KEY_SCHED 0x00400000 -- cgit v1.2.3-70-g09d2 From d80d99d643090c3cf2b1f9fb3fadd1256f7e384f Mon Sep 17 00:00:00 2001 From: Herbert Xu Date: Thu, 1 Sep 2005 17:48:23 -0700 Subject: [NET]: Add sk_stream_wmem_schedule This patch introduces sk_stream_wmem_schedule as a short-hand for the sk_forward_alloc checking on egress. Signed-off-by: Herbert Xu Signed-off-by: David S. Miller --- include/net/sock.h | 12 ++++++++---- net/ipv4/tcp.c | 3 +-- 2 files changed, 9 insertions(+), 6 deletions(-) (limited to 'include') diff --git a/include/net/sock.h b/include/net/sock.h index 312cb25cbd1..e51e626e9af 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -709,6 +709,12 @@ static inline int sk_stream_rmem_schedule(struct sock *sk, struct sk_buff *skb) sk_stream_mem_schedule(sk, skb->truesize, 1); } +static inline int sk_stream_wmem_schedule(struct sock *sk, int size) +{ + return size <= sk->sk_forward_alloc || + sk_stream_mem_schedule(sk, size, 0); +} + /* Used by processes to "lock" a socket state, so that * interrupts and bottom half handlers won't change it * from under us. It essentially blocks any incoming @@ -1203,8 +1209,7 @@ static inline struct sk_buff *sk_stream_alloc_pskb(struct sock *sk, skb = alloc_skb_fclone(size + hdr_len, gfp); if (skb) { skb->truesize += mem; - if (sk->sk_forward_alloc >= (int)skb->truesize || - sk_stream_mem_schedule(sk, skb->truesize, 0)) { + if (sk_stream_wmem_schedule(sk, skb->truesize)) { skb_reserve(skb, hdr_len); return skb; } @@ -1227,8 +1232,7 @@ static inline struct page *sk_stream_alloc_page(struct sock *sk) { struct page *page = NULL; - if (sk->sk_forward_alloc >= (int)PAGE_SIZE || - sk_stream_mem_schedule(sk, PAGE_SIZE, 0)) + if (sk_stream_wmem_schedule(sk, PAGE_SIZE)) page = alloc_pages(sk->sk_allocation, 0); else { sk->sk_prot->enter_memory_pressure(); diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index 02fdda68718..854f6d0c4bb 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c @@ -552,8 +552,7 @@ new_segment: tcp_mark_push(tp, skb); goto new_segment; } - if (sk->sk_forward_alloc < copy && - !sk_stream_mem_schedule(sk, copy, 0)) + if (!sk_stream_wmem_schedule(sk, copy)) goto wait_for_memory; if (can_coalesce) { -- cgit v1.2.3-70-g09d2 From ef015786152adaff5a6a8bf0c8ea2f70cee8059d Mon Sep 17 00:00:00 2001 From: Herbert Xu Date: Thu, 1 Sep 2005 17:48:59 -0700 Subject: [TCP]: Fix sk_forward_alloc underflow in tcp_sendmsg I've finally found a potential cause of the sk_forward_alloc underflows that people have been reporting sporadically. When tcp_sendmsg tacks on extra bits to an existing TCP_PAGE we don't check sk_forward_alloc even though a large amount of time may have elapsed since we allocated the page. In the mean time someone could've come along and liberated packets and reclaimed sk_forward_alloc memory. This patch makes tcp_sendmsg check sk_forward_alloc every time as we do in do_tcp_sendpages. Signed-off-by: Herbert Xu Signed-off-by: David S. Miller --- include/net/sock.h | 5 ++--- net/ipv4/tcp.c | 14 +++++++++----- 2 files changed, 11 insertions(+), 8 deletions(-) (limited to 'include') diff --git a/include/net/sock.h b/include/net/sock.h index e51e626e9af..cf628261da5 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -1232,9 +1232,8 @@ static inline struct page *sk_stream_alloc_page(struct sock *sk) { struct page *page = NULL; - if (sk_stream_wmem_schedule(sk, PAGE_SIZE)) - page = alloc_pages(sk->sk_allocation, 0); - else { + page = alloc_pages(sk->sk_allocation, 0); + if (!page) { sk->sk_prot->enter_memory_pressure(); sk_stream_moderate_sndbuf(sk); } diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index 854f6d0c4bb..cbcc9fc4778 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c @@ -769,19 +769,23 @@ new_segment: if (off == PAGE_SIZE) { put_page(page); TCP_PAGE(sk) = page = NULL; + TCP_OFF(sk) = off = 0; } - } + } else + BUG_ON(off); + + if (copy > PAGE_SIZE - off) + copy = PAGE_SIZE - off; + + if (!sk_stream_wmem_schedule(sk, copy)) + goto wait_for_memory; if (!page) { /* Allocate new cache page. */ if (!(page = sk_stream_alloc_page(sk))) goto wait_for_memory; - off = 0; } - if (copy > PAGE_SIZE - off) - copy = PAGE_SIZE - off; - /* Time to copy data. We are close to * the end! */ err = skb_copy_to_page(sk, from, skb, page, -- cgit v1.2.3-70-g09d2 From a7a6cac204147634aba7487e4d618b028ff54c0d Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Thu, 1 Sep 2005 21:51:26 -0700 Subject: [SPARC]: Kill io_remap_page_range() It's been deprecated long enough and there are no in-tree users any longer. Signed-off-by: David S. Miller --- arch/sparc/kernel/sparc_ksyms.c | 1 - arch/sparc/mm/generic.c | 57 ------------------------------------- arch/sparc64/kernel/pci.c | 3 +- arch/sparc64/kernel/sparc64_ksyms.c | 3 -- arch/sparc64/mm/generic.c | 31 -------------------- include/asm-sparc/pgtable.h | 3 -- include/asm-sparc64/pgtable.h | 3 -- 7 files changed, 1 insertion(+), 100 deletions(-) (limited to 'include') diff --git a/arch/sparc/kernel/sparc_ksyms.c b/arch/sparc/kernel/sparc_ksyms.c index 8faa8dc4de4..5d974a2b735 100644 --- a/arch/sparc/kernel/sparc_ksyms.c +++ b/arch/sparc/kernel/sparc_ksyms.c @@ -175,7 +175,6 @@ EXPORT_SYMBOL(set_auxio); EXPORT_SYMBOL(get_auxio); #endif EXPORT_SYMBOL(request_fast_irq); -EXPORT_SYMBOL(io_remap_page_range); EXPORT_SYMBOL(io_remap_pfn_range); /* P3: iounit_xxx may be needed, sun4d users */ /* EXPORT_SYMBOL(iounit_map_dma_init); */ diff --git a/arch/sparc/mm/generic.c b/arch/sparc/mm/generic.c index db27eee3bda..20ccb957fb7 100644 --- a/arch/sparc/mm/generic.c +++ b/arch/sparc/mm/generic.c @@ -16,31 +16,6 @@ #include #include -static inline void forget_pte(pte_t page) -{ -#if 0 /* old 2.4 code */ - if (pte_none(page)) - return; - if (pte_present(page)) { - unsigned long pfn = pte_pfn(page); - struct page *ptpage; - if (!pfn_valid(pfn)) - return; - ptpage = pfn_to_page(pfn); - if (PageReserved(ptpage)) - return; - page_cache_release(ptpage); - return; - } - swap_free(pte_to_swp_entry(page)); -#else - if (!pte_none(page)) { - printk("forget_pte: old mapping existed!\n"); - BUG(); - } -#endif -} - /* Remap IO memory, the same way as remap_pfn_range(), but use * the obio memory space. * @@ -60,7 +35,6 @@ static inline void io_remap_pte_range(struct mm_struct *mm, pte_t * pte, unsigne pte_t oldpage = *pte; pte_clear(mm, address, pte); set_pte(pte, mk_pte_io(offset, prot, space)); - forget_pte(oldpage); address += PAGE_SIZE; offset += PAGE_SIZE; pte++; @@ -88,37 +62,6 @@ static inline int io_remap_pmd_range(struct mm_struct *mm, pmd_t * pmd, unsigned return 0; } -int io_remap_page_range(struct vm_area_struct *vma, unsigned long from, unsigned long offset, unsigned long size, pgprot_t prot, int space) -{ - int error = 0; - pgd_t * dir; - unsigned long beg = from; - unsigned long end = from + size; - struct mm_struct *mm = vma->vm_mm; - - prot = __pgprot(pg_iobits); - offset -= from; - dir = pgd_offset(mm, from); - flush_cache_range(vma, beg, end); - - spin_lock(&mm->page_table_lock); - while (from < end) { - pmd_t *pmd = pmd_alloc(current->mm, dir, from); - error = -ENOMEM; - if (!pmd) - break; - error = io_remap_pmd_range(mm, pmd, from, end - from, offset + from, prot, space); - if (error) - break; - from = (from + PGDIR_SIZE) & PGDIR_MASK; - dir++; - } - spin_unlock(&mm->page_table_lock); - - flush_tlb_range(vma, beg, end); - return error; -} - int io_remap_pfn_range(struct vm_area_struct *vma, unsigned long from, unsigned long pfn, unsigned long size, pgprot_t prot) { diff --git a/arch/sparc64/kernel/pci.c b/arch/sparc64/kernel/pci.c index f21c993f885..ec8bf4012c0 100644 --- a/arch/sparc64/kernel/pci.c +++ b/arch/sparc64/kernel/pci.c @@ -736,8 +736,7 @@ static void __pci_mmap_set_flags(struct pci_dev *dev, struct vm_area_struct *vma static void __pci_mmap_set_pgprot(struct pci_dev *dev, struct vm_area_struct *vma, enum pci_mmap_state mmap_state) { - /* Our io_remap_page_range/io_remap_pfn_range takes care of this, - do nothing. */ + /* Our io_remap_pfn_range takes care of this, do nothing. */ } /* Perform the actual remap of the pages for a PCI device mapping, as appropriate diff --git a/arch/sparc64/kernel/sparc64_ksyms.c b/arch/sparc64/kernel/sparc64_ksyms.c index a3ea697f1ad..d89fc24808d 100644 --- a/arch/sparc64/kernel/sparc64_ksyms.c +++ b/arch/sparc64/kernel/sparc64_ksyms.c @@ -88,8 +88,6 @@ extern int svr4_setcontext(svr4_ucontext_t *uc, struct pt_regs *regs); extern int compat_sys_ioctl(unsigned int fd, unsigned int cmd, u32 arg); extern int (*handle_mathemu)(struct pt_regs *, struct fpustate *); extern long sparc32_open(const char __user * filename, int flags, int mode); -extern int io_remap_page_range(struct vm_area_struct *vma, unsigned long from, - unsigned long offset, unsigned long size, pgprot_t prot, int space); extern int io_remap_pfn_range(struct vm_area_struct *vma, unsigned long from, unsigned long pfn, unsigned long size, pgprot_t prot); extern void (*prom_palette)(int); @@ -245,7 +243,6 @@ EXPORT_SYMBOL(pci_dma_supported); #endif /* I/O device mmaping on Sparc64. */ -EXPORT_SYMBOL(io_remap_page_range); EXPORT_SYMBOL(io_remap_pfn_range); /* Solaris/SunOS binary compatibility */ diff --git a/arch/sparc64/mm/generic.c b/arch/sparc64/mm/generic.c index 6b31f6117a9..c954d91f01d 100644 --- a/arch/sparc64/mm/generic.c +++ b/arch/sparc64/mm/generic.c @@ -116,37 +116,6 @@ static inline int io_remap_pud_range(struct mm_struct *mm, pud_t * pud, unsigned return 0; } -int io_remap_page_range(struct vm_area_struct *vma, unsigned long from, unsigned long offset, unsigned long size, pgprot_t prot, int space) -{ - int error = 0; - pgd_t * dir; - unsigned long beg = from; - unsigned long end = from + size; - struct mm_struct *mm = vma->vm_mm; - - prot = __pgprot(pg_iobits); - offset -= from; - dir = pgd_offset(mm, from); - flush_cache_range(vma, beg, end); - - spin_lock(&mm->page_table_lock); - while (from < end) { - pud_t *pud = pud_alloc(mm, dir, from); - error = -ENOMEM; - if (!pud) - break; - error = io_remap_pud_range(mm, pud, from, end - from, offset + from, prot, space); - if (error) - break; - from = (from + PGDIR_SIZE) & PGDIR_MASK; - dir++; - } - flush_tlb_range(vma, beg, end); - spin_unlock(&mm->page_table_lock); - - return error; -} - int io_remap_pfn_range(struct vm_area_struct *vma, unsigned long from, unsigned long pfn, unsigned long size, pgprot_t prot) { diff --git a/include/asm-sparc/pgtable.h b/include/asm-sparc/pgtable.h index 40ed30a2b7c..8f4f6a95965 100644 --- a/include/asm-sparc/pgtable.h +++ b/include/asm-sparc/pgtable.h @@ -435,9 +435,6 @@ extern unsigned long *sparc_valid_addr_bitmap; #define kern_addr_valid(addr) \ (test_bit(__pa((unsigned long)(addr))>>20, sparc_valid_addr_bitmap)) -extern int io_remap_page_range(struct vm_area_struct *vma, - unsigned long from, unsigned long to, - unsigned long size, pgprot_t prot, int space); extern int io_remap_pfn_range(struct vm_area_struct *vma, unsigned long from, unsigned long pfn, unsigned long size, pgprot_t prot); diff --git a/include/asm-sparc64/pgtable.h b/include/asm-sparc64/pgtable.h index 1ae00c5087f..a2b4f5ed462 100644 --- a/include/asm-sparc64/pgtable.h +++ b/include/asm-sparc64/pgtable.h @@ -410,9 +410,6 @@ extern unsigned long *sparc64_valid_addr_bitmap; #define kern_addr_valid(addr) \ (test_bit(__pa((unsigned long)(addr))>>22, sparc64_valid_addr_bitmap)) -extern int io_remap_page_range(struct vm_area_struct *vma, unsigned long from, - unsigned long offset, - unsigned long size, pgprot_t prot, int space); extern int io_remap_pfn_range(struct vm_area_struct *vma, unsigned long from, unsigned long pfn, unsigned long size, pgprot_t prot); -- cgit v1.2.3-70-g09d2 From 6475be16fd9b3c6746ca4d18959246b13c669ea8 Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Thu, 1 Sep 2005 22:47:01 -0700 Subject: [TCP]: Keep TSO enabled even during loss events. All we need to do is resegment the queue so that we record SACK information accurately. The edges of the SACK blocks guide our resegmenting decisions. With help from Herbert Xu. Signed-off-by: David S. Miller --- include/net/tcp.h | 1 + net/ipv4/tcp_input.c | 36 ++++++++++++++++++++++----------- net/ipv4/tcp_output.c | 55 +++++++++++++++++++-------------------------------- 3 files changed, 45 insertions(+), 47 deletions(-) (limited to 'include') diff --git a/include/net/tcp.h b/include/net/tcp.h index d6bcf1317a6..97af77c4d09 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h @@ -454,6 +454,7 @@ extern int tcp_retransmit_skb(struct sock *, struct sk_buff *); extern void tcp_xmit_retransmit_queue(struct sock *); extern void tcp_simple_retransmit(struct sock *); extern int tcp_trim_head(struct sock *, struct sk_buff *, u32); +extern int tcp_fragment(struct sock *, struct sk_buff *, u32, unsigned int); extern void tcp_send_probe0(struct sock *); extern void tcp_send_partial(struct sock *); diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 1afb080bdf0..29222b96495 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c @@ -923,14 +923,6 @@ tcp_sacktag_write_queue(struct sock *sk, struct sk_buff *ack_skb, u32 prior_snd_ int flag = 0; int i; - /* So, SACKs for already sent large segments will be lost. - * Not good, but alternative is to resegment the queue. */ - if (sk->sk_route_caps & NETIF_F_TSO) { - sk->sk_route_caps &= ~NETIF_F_TSO; - sock_set_flag(sk, SOCK_NO_LARGESEND); - tp->mss_cache = tp->mss_cache; - } - if (!tp->sacked_out) tp->fackets_out = 0; prior_fackets = tp->fackets_out; @@ -978,20 +970,40 @@ tcp_sacktag_write_queue(struct sock *sk, struct sk_buff *ack_skb, u32 prior_snd_ flag |= FLAG_DATA_LOST; sk_stream_for_retrans_queue(skb, sk) { - u8 sacked = TCP_SKB_CB(skb)->sacked; - int in_sack; + int in_sack, pcount; + u8 sacked; /* The retransmission queue is always in order, so * we can short-circuit the walk early. */ - if(!before(TCP_SKB_CB(skb)->seq, end_seq)) + if (!before(TCP_SKB_CB(skb)->seq, end_seq)) break; - fack_count += tcp_skb_pcount(skb); + pcount = tcp_skb_pcount(skb); + + if (pcount > 1 && + (after(start_seq, TCP_SKB_CB(skb)->seq) || + before(end_seq, TCP_SKB_CB(skb)->end_seq))) { + unsigned int pkt_len; + + if (after(start_seq, TCP_SKB_CB(skb)->seq)) + pkt_len = (start_seq - + TCP_SKB_CB(skb)->seq); + else + pkt_len = (end_seq - + TCP_SKB_CB(skb)->seq); + if (tcp_fragment(sk, skb, pkt_len, skb_shinfo(skb)->tso_size)) + break; + pcount = tcp_skb_pcount(skb); + } + + fack_count += pcount; in_sack = !after(start_seq, TCP_SKB_CB(skb)->seq) && !before(end_seq, TCP_SKB_CB(skb)->end_seq); + sacked = TCP_SKB_CB(skb)->sacked; + /* Account D-SACK for retransmitted packet. */ if ((dup_sack && in_sack) && (sacked & TCPCB_RETRANS) && diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index 75b68116682..6094db5e11b 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c @@ -428,11 +428,11 @@ static void tcp_set_skb_tso_segs(struct sock *sk, struct sk_buff *skb, unsigned * packet to the list. This won't be called frequently, I hope. * Remember, these are still headerless SKBs at this point. */ -static int tcp_fragment(struct sock *sk, struct sk_buff *skb, u32 len, unsigned int mss_now) +int tcp_fragment(struct sock *sk, struct sk_buff *skb, u32 len, unsigned int mss_now) { struct tcp_sock *tp = tcp_sk(sk); struct sk_buff *buff; - int nsize; + int nsize, old_factor; u16 flags; nsize = skb_headlen(skb) - len; @@ -490,18 +490,29 @@ static int tcp_fragment(struct sock *sk, struct sk_buff *skb, u32 len, unsigned tp->left_out -= tcp_skb_pcount(skb); } + old_factor = tcp_skb_pcount(skb); + /* Fix up tso_factor for both original and new SKB. */ tcp_set_skb_tso_segs(sk, skb, mss_now); tcp_set_skb_tso_segs(sk, buff, mss_now); - if (TCP_SKB_CB(skb)->sacked & TCPCB_LOST) { - tp->lost_out += tcp_skb_pcount(skb); - tp->left_out += tcp_skb_pcount(skb); - } + /* If this packet has been sent out already, we must + * adjust the various packet counters. + */ + if (after(tp->snd_nxt, TCP_SKB_CB(buff)->end_seq)) { + int diff = old_factor - tcp_skb_pcount(skb) - + tcp_skb_pcount(buff); - if (TCP_SKB_CB(buff)->sacked&TCPCB_LOST) { - tp->lost_out += tcp_skb_pcount(buff); - tp->left_out += tcp_skb_pcount(buff); + tp->packets_out -= diff; + if (TCP_SKB_CB(skb)->sacked & TCPCB_LOST) { + tp->lost_out -= diff; + tp->left_out -= diff; + } + if (diff > 0) { + tp->fackets_out -= diff; + if ((int)tp->fackets_out < 0) + tp->fackets_out = 0; + } } /* Link BUFF into the send queue. */ @@ -1350,12 +1361,6 @@ int tcp_retransmit_skb(struct sock *sk, struct sk_buff *skb) if (before(TCP_SKB_CB(skb)->seq, tp->snd_una)) { if (before(TCP_SKB_CB(skb)->end_seq, tp->snd_una)) BUG(); - - if (sk->sk_route_caps & NETIF_F_TSO) { - sk->sk_route_caps &= ~NETIF_F_TSO; - sock_set_flag(sk, SOCK_NO_LARGESEND); - } - if (tcp_trim_head(sk, skb, tp->snd_una - TCP_SKB_CB(skb)->seq)) return -ENOMEM; } @@ -1370,22 +1375,8 @@ int tcp_retransmit_skb(struct sock *sk, struct sk_buff *skb) return -EAGAIN; if (skb->len > cur_mss) { - int old_factor = tcp_skb_pcount(skb); - int diff; - if (tcp_fragment(sk, skb, cur_mss, cur_mss)) return -ENOMEM; /* We'll try again later. */ - - /* New SKB created, account for it. */ - diff = old_factor - tcp_skb_pcount(skb) - - tcp_skb_pcount(skb->next); - tp->packets_out -= diff; - - if (diff > 0) { - tp->fackets_out -= diff; - if ((int)tp->fackets_out < 0) - tp->fackets_out = 0; - } } /* Collapse two adjacent packets if worthwhile and we can. */ @@ -1993,12 +1984,6 @@ int tcp_write_wakeup(struct sock *sk) TCP_SKB_CB(skb)->flags |= TCPCB_FLAG_PSH; if (tcp_fragment(sk, skb, seg_size, mss)) return -1; - /* SWS override triggered forced fragmentation. - * Disable TSO, the connection is too sick. */ - if (sk->sk_route_caps & NETIF_F_TSO) { - sock_set_flag(sk, SOCK_NO_LARGESEND); - sk->sk_route_caps &= ~NETIF_F_TSO; - } } else if (!tcp_skb_pcount(skb)) tcp_set_skb_tso_segs(sk, skb, mss); -- cgit v1.2.3-70-g09d2 From a94f18810f52d3a6de0a09bee0c7258b62eca262 Mon Sep 17 00:00:00 2001 From: Len Brown Date: Sat, 3 Sep 2005 00:09:12 -0400 Subject: [ACPI] revert owner-id-3.patch Signed-off-by: Len Brown --- drivers/acpi/dispatcher/dsmethod.c | 52 +++++++++++++++++++------------------- drivers/acpi/parser/psparse.c | 21 ++++++++++----- drivers/acpi/parser/psxface.c | 13 ++++++++++ drivers/acpi/utilities/utmisc.c | 2 -- include/acpi/acdispat.h | 2 +- 5 files changed, 55 insertions(+), 35 deletions(-) (limited to 'include') diff --git a/drivers/acpi/dispatcher/dsmethod.c b/drivers/acpi/dispatcher/dsmethod.c index 8b67a918341..77fcfc3070d 100644 --- a/drivers/acpi/dispatcher/dsmethod.c +++ b/drivers/acpi/dispatcher/dsmethod.c @@ -235,16 +235,6 @@ acpi_ds_begin_method_execution(struct acpi_namespace_node *method_node, acpi_ex_system_wait_semaphore(obj_desc->method.semaphore, ACPI_WAIT_FOREVER); } - /* - * allocate owner id for this method - */ - if (!obj_desc->method.thread_count) { - status = acpi_ut_allocate_owner_id (&obj_desc->method.owner_id); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); - } - } - /* * Increment the method parse tree thread count since it has been @@ -299,6 +289,11 @@ acpi_ds_call_control_method(struct acpi_thread_state *thread, return_ACPI_STATUS(AE_NULL_OBJECT); } + status = acpi_ut_allocate_owner_id(&obj_desc->method.owner_id); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); + } + /* Init for new method, wait on concurrency semaphore */ status = acpi_ds_begin_method_execution(method_node, obj_desc, @@ -385,18 +380,22 @@ acpi_ds_call_control_method(struct acpi_thread_state *thread, if (obj_desc->method.method_flags & AML_METHOD_INTERNAL_ONLY) { status = obj_desc->method.implementation(next_walk_state); + return_ACPI_STATUS(status); } - goto end; -cleanup: - /* Decrement the thread count on the method parse tree */ + return_ACPI_STATUS(AE_OK); + + /* On error, we must delete the new walk state */ + + cleanup: + acpi_ut_release_owner_id(&obj_desc->method.owner_id); if (next_walk_state && (next_walk_state->method_desc)) { + /* Decrement the thread count on the method parse tree */ + next_walk_state->method_desc->method.thread_count--; } - /* On error, we must delete the new walk state */ - acpi_ds_terminate_control_method (next_walk_state); - acpi_ds_delete_walk_state (next_walk_state); -end: + (void)acpi_ds_terminate_control_method(next_walk_state); + acpi_ds_delete_walk_state(next_walk_state); return_ACPI_STATUS(status); } @@ -480,7 +479,7 @@ acpi_ds_restart_control_method(struct acpi_walk_state *walk_state, * * PARAMETERS: walk_state - State of the method * - * RETURN: None + * RETURN: Status * * DESCRIPTION: Terminate a control method. Delete everything that the method * created, delete all locals and arguments, and delete the parse @@ -488,7 +487,7 @@ acpi_ds_restart_control_method(struct acpi_walk_state *walk_state, * ******************************************************************************/ -void acpi_ds_terminate_control_method(struct acpi_walk_state *walk_state) +acpi_status acpi_ds_terminate_control_method(struct acpi_walk_state *walk_state) { union acpi_operand_object *obj_desc; struct acpi_namespace_node *method_node; @@ -497,14 +496,14 @@ void acpi_ds_terminate_control_method(struct acpi_walk_state *walk_state) ACPI_FUNCTION_TRACE_PTR("ds_terminate_control_method", walk_state); if (!walk_state) { - return_VOID; + return (AE_BAD_PARAMETER); } /* The current method object was saved in the walk state */ obj_desc = walk_state->method_desc; if (!obj_desc) { - return_VOID; + return_ACPI_STATUS(AE_OK); } /* Delete all arguments and locals */ @@ -518,7 +517,7 @@ void acpi_ds_terminate_control_method(struct acpi_walk_state *walk_state) */ status = acpi_ut_acquire_mutex(ACPI_MTX_PARSER); if (ACPI_FAILURE(status)) { - return_VOID; + return_ACPI_STATUS(status); } /* Signal completion of the execution of this method if necessary */ @@ -575,7 +574,7 @@ void acpi_ds_terminate_control_method(struct acpi_walk_state *walk_state) */ status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); if (ACPI_FAILURE(status)) { - goto cleanup; + return_ACPI_STATUS(status); } if (method_node->child) { @@ -593,9 +592,10 @@ void acpi_ds_terminate_control_method(struct acpi_walk_state *walk_state) owner_id); if (ACPI_FAILURE(status)) { - goto cleanup; + return_ACPI_STATUS(status); } } -cleanup: - acpi_ut_release_mutex (ACPI_MTX_PARSER); + + status = acpi_ut_release_mutex(ACPI_MTX_PARSER); + return_ACPI_STATUS(status); } diff --git a/drivers/acpi/parser/psparse.c b/drivers/acpi/parser/psparse.c index 36771309c62..3248051d77e 100644 --- a/drivers/acpi/parser/psparse.c +++ b/drivers/acpi/parser/psparse.c @@ -438,6 +438,7 @@ acpi_ps_next_parse_state(struct acpi_walk_state *walk_state, acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state) { acpi_status status; + acpi_status terminate_status; struct acpi_thread_state *thread; struct acpi_thread_state *prev_walk_list = acpi_gbl_current_walk_list; struct acpi_walk_state *previous_walk_state; @@ -507,9 +508,6 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state) walk_state->method_node, NULL, status); - /* Make sure that failed method will be cleaned as if it was executed */ - walk_state->parse_flags |= ACPI_PARSE_EXECUTE; - /* Check for possible multi-thread reentrancy problem */ if ((status == AE_ALREADY_EXISTS) && @@ -526,6 +524,14 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state) } } + if (walk_state->method_desc) { + /* Decrement the thread count on the method parse tree */ + + if (walk_state->method_desc->method.thread_count) { + walk_state->method_desc->method.thread_count--; + } + } + /* We are done with this walk, move on to the parent if any */ walk_state = acpi_ds_pop_walk_state(thread); @@ -540,10 +546,13 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state) */ if ((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) == ACPI_PARSE_EXECUTE) { - if (walk_state->method_desc) { - walk_state->method_desc->method.thread_count--; + terminate_status = + acpi_ds_terminate_control_method(walk_state); + if (ACPI_FAILURE(terminate_status)) { + ACPI_REPORT_ERROR(("Could not terminate control method properly\n")); + + /* Ignore error and continue */ } - acpi_ds_terminate_control_method (walk_state); } /* Delete this walk state and all linked control states */ diff --git a/drivers/acpi/parser/psxface.c b/drivers/acpi/parser/psxface.c index f6904bdf573..80c67f2d3dd 100644 --- a/drivers/acpi/parser/psxface.c +++ b/drivers/acpi/parser/psxface.c @@ -98,6 +98,16 @@ acpi_status acpi_ps_execute_method(struct acpi_parameter_info *info) return_ACPI_STATUS(status); } + /* + * Get a new owner_id for objects created by this method. Namespace + * objects (such as Operation Regions) can be created during the + * first pass parse. + */ + status = acpi_ut_allocate_owner_id(&info->obj_desc->method.owner_id); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); + } + /* * The caller "owns" the parameters, so give each one an extra * reference @@ -129,6 +139,9 @@ acpi_status acpi_ps_execute_method(struct acpi_parameter_info *info) status = acpi_ps_execute_pass(info); cleanup: + if (info->obj_desc->method.owner_id) { + acpi_ut_release_owner_id(&info->obj_desc->method.owner_id); + } /* Take away the extra reference that we gave the parameters above */ diff --git a/drivers/acpi/utilities/utmisc.c b/drivers/acpi/utilities/utmisc.c index c2f5b2adb5d..f0275025b71 100644 --- a/drivers/acpi/utilities/utmisc.c +++ b/drivers/acpi/utilities/utmisc.c @@ -67,8 +67,6 @@ acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id) ACPI_FUNCTION_TRACE("ut_allocate_owner_id"); - WARN_ON(*owner_id); - /* Mutex for the global ID mask */ status = acpi_ut_acquire_mutex(ACPI_MTX_CACHES); diff --git a/include/acpi/acdispat.h b/include/acpi/acdispat.h index c436e8be6ba..59306186f5e 100644 --- a/include/acpi/acdispat.h +++ b/include/acpi/acdispat.h @@ -194,7 +194,7 @@ acpi_status acpi_ds_restart_control_method(struct acpi_walk_state *walk_state, union acpi_operand_object *return_desc); -void +acpi_status acpi_ds_terminate_control_method(struct acpi_walk_state *walk_state); acpi_status -- cgit v1.2.3-70-g09d2 From aff8c2777d1a9edf97f26bf60579f9c931443eb1 Mon Sep 17 00:00:00 2001 From: Robert Moore Date: Fri, 2 Sep 2005 17:24:17 -0400 Subject: [ACPI] ACPICA 20050902 Fixed a problem with the internal Owner ID allocation and deallocation mechanisms for control method execution and recursive method invocation. This should eliminate the OWNER_ID_LIMIT exceptions and "Invalid OwnerId" messages seen on some systems. Recursive method invocation depth is currently limited to 255. (Alexey Starikovskiy) http://bugzilla.kernel.org/show_bug.cgi?id=4892 Completely eliminated all vestiges of support for the "module-level executable code" until this support is fully implemented and debugged. This should eliminate the NO_RETURN_VALUE exceptions seen during table load on some systems that invoke this support. http://bugzilla.kernel.org/show_bug.cgi?id=5162 Fixed a problem within the resource manager code where the transaction flags for a 64-bit address descriptor were handled incorrectly in the type-specific flag byte. Consolidated duplicate code within the address descriptor resource manager code, reducing overall subsystem code size. Signed-off-by: Robert Moore Signed-off-by: Len Brown --- drivers/acpi/dispatcher/dsmethod.c | 69 ++--- drivers/acpi/dispatcher/dswload.c | 5 + drivers/acpi/parser/psparse.c | 23 +- drivers/acpi/parser/psxface.c | 14 - drivers/acpi/resources/rsaddr.c | 542 ++++++++++++++++++------------------- drivers/acpi/resources/rsirq.c | 21 +- drivers/acpi/utilities/utmisc.c | 15 +- include/acpi/acconfig.h | 2 +- include/acpi/acdispat.h | 3 +- include/acpi/actypes.h | 38 ++- 10 files changed, 350 insertions(+), 382 deletions(-) (limited to 'include') diff --git a/drivers/acpi/dispatcher/dsmethod.c b/drivers/acpi/dispatcher/dsmethod.c index 77fcfc3070d..36c1ca0b9ad 100644 --- a/drivers/acpi/dispatcher/dsmethod.c +++ b/drivers/acpi/dispatcher/dsmethod.c @@ -207,6 +207,13 @@ acpi_ds_begin_method_execution(struct acpi_namespace_node *method_node, return_ACPI_STATUS(AE_NULL_ENTRY); } + /* Prevent wraparound of thread count */ + + if (obj_desc->method.thread_count == ACPI_UINT8_MAX) { + ACPI_REPORT_ERROR(("Method reached maximum reentrancy limit (255)\n")); + return_ACPI_STATUS(AE_AML_METHOD_LIMIT); + } + /* * If there is a concurrency limit on this method, we need to * obtain a unit from the method semaphore. @@ -236,6 +243,18 @@ acpi_ds_begin_method_execution(struct acpi_namespace_node *method_node, ACPI_WAIT_FOREVER); } + /* + * Allocate an Owner ID for this method, only if this is the first thread + * to begin concurrent execution. We only need one owner_id, even if the + * method is invoked recursively. + */ + if (!obj_desc->method.owner_id) { + status = acpi_ut_allocate_owner_id(&obj_desc->method.owner_id); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); + } + } + /* * Increment the method parse tree thread count since it has been * reentered one more time (even if it is the same thread) @@ -289,11 +308,6 @@ acpi_ds_call_control_method(struct acpi_thread_state *thread, return_ACPI_STATUS(AE_NULL_OBJECT); } - status = acpi_ut_allocate_owner_id(&obj_desc->method.owner_id); - if (ACPI_FAILURE(status)) { - return_ACPI_STATUS(status); - } - /* Init for new method, wait on concurrency semaphore */ status = acpi_ds_begin_method_execution(method_node, obj_desc, @@ -345,9 +359,8 @@ acpi_ds_call_control_method(struct acpi_thread_state *thread, } /* * The resolved arguments were put on the previous walk state's operand - * stack. Operands on the previous walk state stack always - * start at index 0. - * Null terminate the list of arguments + * stack. Operands on the previous walk state stack always + * start at index 0. Also, null terminate the list of arguments */ this_walk_state->operands[this_walk_state->num_operands] = NULL; @@ -380,21 +393,20 @@ acpi_ds_call_control_method(struct acpi_thread_state *thread, if (obj_desc->method.method_flags & AML_METHOD_INTERNAL_ONLY) { status = obj_desc->method.implementation(next_walk_state); - return_ACPI_STATUS(status); } - return_ACPI_STATUS(AE_OK); - - /* On error, we must delete the new walk state */ + return_ACPI_STATUS(status); cleanup: - acpi_ut_release_owner_id(&obj_desc->method.owner_id); - if (next_walk_state && (next_walk_state->method_desc)) { - /* Decrement the thread count on the method parse tree */ + /* Decrement the thread count on the method parse tree */ + if (next_walk_state && (next_walk_state->method_desc)) { next_walk_state->method_desc->method.thread_count--; } - (void)acpi_ds_terminate_control_method(next_walk_state); + + /* On error, we must delete the new walk state */ + + acpi_ds_terminate_control_method(next_walk_state); acpi_ds_delete_walk_state(next_walk_state); return_ACPI_STATUS(status); } @@ -479,7 +491,7 @@ acpi_ds_restart_control_method(struct acpi_walk_state *walk_state, * * PARAMETERS: walk_state - State of the method * - * RETURN: Status + * RETURN: None * * DESCRIPTION: Terminate a control method. Delete everything that the method * created, delete all locals and arguments, and delete the parse @@ -487,7 +499,7 @@ acpi_ds_restart_control_method(struct acpi_walk_state *walk_state, * ******************************************************************************/ -acpi_status acpi_ds_terminate_control_method(struct acpi_walk_state *walk_state) +void acpi_ds_terminate_control_method(struct acpi_walk_state *walk_state) { union acpi_operand_object *obj_desc; struct acpi_namespace_node *method_node; @@ -496,14 +508,14 @@ acpi_status acpi_ds_terminate_control_method(struct acpi_walk_state *walk_state) ACPI_FUNCTION_TRACE_PTR("ds_terminate_control_method", walk_state); if (!walk_state) { - return (AE_BAD_PARAMETER); + return_VOID; } /* The current method object was saved in the walk state */ obj_desc = walk_state->method_desc; if (!obj_desc) { - return_ACPI_STATUS(AE_OK); + return_VOID; } /* Delete all arguments and locals */ @@ -517,7 +529,7 @@ acpi_status acpi_ds_terminate_control_method(struct acpi_walk_state *walk_state) */ status = acpi_ut_acquire_mutex(ACPI_MTX_PARSER); if (ACPI_FAILURE(status)) { - return_ACPI_STATUS(status); + return_VOID; } /* Signal completion of the execution of this method if necessary */ @@ -528,7 +540,6 @@ acpi_status acpi_ds_terminate_control_method(struct acpi_walk_state *walk_state) semaphore, 1); if (ACPI_FAILURE(status)) { ACPI_REPORT_ERROR(("Could not signal method semaphore\n")); - status = AE_OK; /* Ignore error and continue cleanup */ } @@ -539,9 +550,8 @@ acpi_status acpi_ds_terminate_control_method(struct acpi_walk_state *walk_state) "*** Not deleting method namespace, there are still %d threads\n", walk_state->method_desc->method. thread_count)); - } + } else { /* This is the last executing thread */ - if (!walk_state->method_desc->method.thread_count) { /* * Support to dynamically change a method from not_serialized to * Serialized if it appears that the method is written foolishly and @@ -574,7 +584,7 @@ acpi_status acpi_ds_terminate_control_method(struct acpi_walk_state *walk_state) */ status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); if (ACPI_FAILURE(status)) { - return_ACPI_STATUS(status); + goto exit; } if (method_node->child) { @@ -590,12 +600,9 @@ acpi_status acpi_ds_terminate_control_method(struct acpi_walk_state *walk_state) status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); acpi_ut_release_owner_id(&walk_state->method_desc->method. owner_id); - - if (ACPI_FAILURE(status)) { - return_ACPI_STATUS(status); - } } - status = acpi_ut_release_mutex(ACPI_MTX_PARSER); - return_ACPI_STATUS(status); + exit: + (void)acpi_ut_release_mutex(ACPI_MTX_PARSER); + return_VOID; } diff --git a/drivers/acpi/dispatcher/dswload.c b/drivers/acpi/dispatcher/dswload.c index 362bbcfc171..411731261c2 100644 --- a/drivers/acpi/dispatcher/dswload.c +++ b/drivers/acpi/dispatcher/dswload.c @@ -486,8 +486,10 @@ acpi_ds_load2_begin_op(struct acpi_walk_state * walk_state, if ((!(walk_state->op_info->flags & AML_NSOPCODE) && (walk_state->opcode != AML_INT_NAMEPATH_OP)) || (!(walk_state->op_info->flags & AML_NAMED))) { +#ifdef ACPI_ENABLE_MODULE_LEVEL_CODE if ((walk_state->op_info->class == AML_CLASS_EXECUTE) || (walk_state->op_info->class == AML_CLASS_CONTROL)) { + ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Begin/EXEC: %s (fl %8.8X)\n", walk_state->op_info->name, @@ -499,6 +501,7 @@ acpi_ds_load2_begin_op(struct acpi_walk_state * walk_state, acpi_ds_exec_begin_op(walk_state, out_op); return_ACPI_STATUS(status); } +#endif return_ACPI_STATUS(AE_OK); } @@ -731,6 +734,7 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state) if (!(walk_state->op_info->flags & AML_NSOBJECT)) { #ifndef ACPI_NO_METHOD_EXECUTION +#ifdef ACPI_ENABLE_MODULE_LEVEL_CODE /* No namespace object. Executable opcode? */ if ((walk_state->op_info->class == AML_CLASS_EXECUTE) || @@ -745,6 +749,7 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state) status = acpi_ds_exec_end_op(walk_state); return_ACPI_STATUS(status); } +#endif #endif return_ACPI_STATUS(AE_OK); } diff --git a/drivers/acpi/parser/psparse.c b/drivers/acpi/parser/psparse.c index 3248051d77e..76d4d640d83 100644 --- a/drivers/acpi/parser/psparse.c +++ b/drivers/acpi/parser/psparse.c @@ -438,7 +438,6 @@ acpi_ps_next_parse_state(struct acpi_walk_state *walk_state, acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state) { acpi_status status; - acpi_status terminate_status; struct acpi_thread_state *thread; struct acpi_thread_state *prev_walk_list = acpi_gbl_current_walk_list; struct acpi_walk_state *previous_walk_state; @@ -508,6 +507,10 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state) walk_state->method_node, NULL, status); + /* Ensure proper cleanup */ + + walk_state->parse_flags |= ACPI_PARSE_EXECUTE; + /* Check for possible multi-thread reentrancy problem */ if ((status == AE_ALREADY_EXISTS) && @@ -524,14 +527,6 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state) } } - if (walk_state->method_desc) { - /* Decrement the thread count on the method parse tree */ - - if (walk_state->method_desc->method.thread_count) { - walk_state->method_desc->method.thread_count--; - } - } - /* We are done with this walk, move on to the parent if any */ walk_state = acpi_ds_pop_walk_state(thread); @@ -546,13 +541,13 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state) */ if ((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) == ACPI_PARSE_EXECUTE) { - terminate_status = - acpi_ds_terminate_control_method(walk_state); - if (ACPI_FAILURE(terminate_status)) { - ACPI_REPORT_ERROR(("Could not terminate control method properly\n")); + if (walk_state->method_desc) { + /* Decrement the thread count on the method parse tree */ - /* Ignore error and continue */ + walk_state->method_desc->method.thread_count--; } + + acpi_ds_terminate_control_method(walk_state); } /* Delete this walk state and all linked control states */ diff --git a/drivers/acpi/parser/psxface.c b/drivers/acpi/parser/psxface.c index 80c67f2d3dd..4dcbd443160 100644 --- a/drivers/acpi/parser/psxface.c +++ b/drivers/acpi/parser/psxface.c @@ -98,16 +98,6 @@ acpi_status acpi_ps_execute_method(struct acpi_parameter_info *info) return_ACPI_STATUS(status); } - /* - * Get a new owner_id for objects created by this method. Namespace - * objects (such as Operation Regions) can be created during the - * first pass parse. - */ - status = acpi_ut_allocate_owner_id(&info->obj_desc->method.owner_id); - if (ACPI_FAILURE(status)) { - return_ACPI_STATUS(status); - } - /* * The caller "owns" the parameters, so give each one an extra * reference @@ -139,10 +129,6 @@ acpi_status acpi_ps_execute_method(struct acpi_parameter_info *info) status = acpi_ps_execute_pass(info); cleanup: - if (info->obj_desc->method.owner_id) { - acpi_ut_release_owner_id(&info->obj_desc->method.owner_id); - } - /* Take away the extra reference that we gave the parameters above */ acpi_ps_update_parameter_list(info, REF_DECREMENT); diff --git a/drivers/acpi/resources/rsaddr.c b/drivers/acpi/resources/rsaddr.c index 4cf46e1ee01..23b54baa0cb 100644 --- a/drivers/acpi/resources/rsaddr.c +++ b/drivers/acpi/resources/rsaddr.c @@ -47,6 +47,180 @@ #define _COMPONENT ACPI_RESOURCES ACPI_MODULE_NAME("rsaddr") +/* Local prototypes */ +static void +acpi_rs_decode_general_flags(union acpi_resource_data *resource, u8 flags); + +static u8 acpi_rs_encode_general_flags(union acpi_resource_data *resource); + +static void +acpi_rs_decode_specific_flags(union acpi_resource_data *resource, u8 flags); + +static u8 acpi_rs_encode_specific_flags(union acpi_resource_data *resource); + +/******************************************************************************* + * + * FUNCTION: acpi_rs_decode_general_flags + * + * PARAMETERS: Resource - Address resource data struct + * Flags - Actual flag byte + * + * RETURN: Decoded flag bits in resource struct + * + * DESCRIPTION: Decode a general flag byte to an address resource struct + * + ******************************************************************************/ + +static void +acpi_rs_decode_general_flags(union acpi_resource_data *resource, u8 flags) +{ + ACPI_FUNCTION_ENTRY(); + + /* Producer / Consumer - flag bit[0] */ + + resource->address.producer_consumer = (u32) (flags & 0x01); + + /* Decode (_DEC) - flag bit[1] */ + + resource->address.decode = (u32) ((flags >> 1) & 0x01); + + /* Min Address Fixed (_MIF) - flag bit[2] */ + + resource->address.min_address_fixed = (u32) ((flags >> 2) & 0x01); + + /* Max Address Fixed (_MAF) - flag bit[3] */ + + resource->address.max_address_fixed = (u32) ((flags >> 3) & 0x01); +} + +/******************************************************************************* + * + * FUNCTION: acpi_rs_encode_general_flags + * + * PARAMETERS: Resource - Address resource data struct + * + * RETURN: Encoded general flag byte + * + * DESCRIPTION: Construct a general flag byte from an address resource struct + * + ******************************************************************************/ + +static u8 acpi_rs_encode_general_flags(union acpi_resource_data *resource) +{ + u8 flags; + + ACPI_FUNCTION_ENTRY(); + + /* Producer / Consumer - flag bit[0] */ + + flags = (u8) (resource->address.producer_consumer & 0x01); + + /* Decode (_DEC) - flag bit[1] */ + + flags |= (u8) ((resource->address.decode & 0x01) << 1); + + /* Min Address Fixed (_MIF) - flag bit[2] */ + + flags |= (u8) ((resource->address.min_address_fixed & 0x01) << 2); + + /* Max Address Fixed (_MAF) - flag bit[3] */ + + flags |= (u8) ((resource->address.max_address_fixed & 0x01) << 3); + + return (flags); +} + +/******************************************************************************* + * + * FUNCTION: acpi_rs_decode_specific_flags + * + * PARAMETERS: Resource - Address resource data struct + * Flags - Actual flag byte + * + * RETURN: Decoded flag bits in attribute struct + * + * DESCRIPTION: Decode a type-specific flag byte to an attribute struct. + * Type-specific flags are only defined for the Memory and IO + * resource types. + * + ******************************************************************************/ + +static void +acpi_rs_decode_specific_flags(union acpi_resource_data *resource, u8 flags) +{ + ACPI_FUNCTION_ENTRY(); + + if (resource->address.resource_type == ACPI_MEMORY_RANGE) { + /* Write Status (_RW) - flag bit[0] */ + + resource->address.attribute.memory.read_write_attribute = + (u16) (flags & 0x01); + + /* Memory Attributes (_MEM) - flag bits[2:1] */ + + resource->address.attribute.memory.cache_attribute = + (u16) ((flags >> 1) & 0x03); + } else if (resource->address.resource_type == ACPI_IO_RANGE) { + /* Ranges (_RNG) - flag bits[1:0] */ + + resource->address.attribute.io.range_attribute = + (u16) (flags & 0x03); + + /* Translations (_TTP and _TRS) - flag bits[5:4] */ + + resource->address.attribute.io.translation_attribute = + (u16) ((flags >> 4) & 0x03); + } +} + +/******************************************************************************* + * + * FUNCTION: acpi_rs_encode_specific_flags + * + * PARAMETERS: Resource - Address resource data struct + * + * RETURN: Encoded type-specific flag byte + * + * DESCRIPTION: Construct a type-specific flag byte from an attribute struct. + * Type-specific flags are only defined for the Memory and IO + * resource types. + * + ******************************************************************************/ + +static u8 acpi_rs_encode_specific_flags(union acpi_resource_data *resource) +{ + u8 flags = 0; + + ACPI_FUNCTION_ENTRY(); + + if (resource->address.resource_type == ACPI_MEMORY_RANGE) { + /* Write Status (_RW) - flag bit[0] */ + + flags = (u8) + (resource->address.attribute.memory. + read_write_attribute & 0x01); + + /* Memory Attributes (_MEM) - flag bits[2:1] */ + + flags |= (u8) + ((resource->address.attribute.memory. + cache_attribute & 0x03) << 1); + } else if (resource->address.resource_type == ACPI_IO_RANGE) { + /* Ranges (_RNG) - flag bits[1:0] */ + + flags = (u8) + (resource->address.attribute.io.range_attribute & 0x03); + + /* Translations (_TTP and _TRS) - flag bits[5:4] */ + + flags |= (u8) + ((resource->address.attribute.io. + translation_attribute & 0x03) << 4); + } + + return (flags); +} + /******************************************************************************* * * FUNCTION: acpi_rs_address16_resource @@ -67,6 +241,7 @@ ACPI_MODULE_NAME("rsaddr") * number of bytes consumed from the byte stream. * ******************************************************************************/ + acpi_status acpi_rs_address16_resource(u8 * byte_stream_buffer, acpi_size * bytes_consumed, @@ -83,7 +258,7 @@ acpi_rs_address16_resource(u8 * byte_stream_buffer, ACPI_FUNCTION_TRACE("rs_address16_resource"); - /* Point past the Descriptor to get the number of bytes consumed */ + /* Get the Descriptor Length field */ buffer += 1; ACPI_MOVE_16_TO_16(&temp16, buffer); @@ -113,46 +288,12 @@ acpi_rs_address16_resource(u8 * byte_stream_buffer, /* Get the General Flags (Byte4) */ buffer += 1; - temp8 = *buffer; - - /* Producer / Consumer */ - - output_struct->data.address16.producer_consumer = temp8 & 0x01; - - /* Decode */ - - output_struct->data.address16.decode = (temp8 >> 1) & 0x01; - - /* Min Address Fixed */ - - output_struct->data.address16.min_address_fixed = (temp8 >> 2) & 0x01; - - /* Max Address Fixed */ - - output_struct->data.address16.max_address_fixed = (temp8 >> 3) & 0x01; + acpi_rs_decode_general_flags(&output_struct->data, *buffer); /* Get the Type Specific Flags (Byte5) */ buffer += 1; - temp8 = *buffer; - - if (ACPI_MEMORY_RANGE == output_struct->data.address16.resource_type) { - output_struct->data.address16.attribute.memory. - read_write_attribute = (u16) (temp8 & 0x01); - output_struct->data.address16.attribute.memory.cache_attribute = - (u16) ((temp8 >> 1) & 0x03); - } else { - if (ACPI_IO_RANGE == - output_struct->data.address16.resource_type) { - output_struct->data.address16.attribute.io. - range_attribute = (u16) (temp8 & 0x03); - output_struct->data.address16.attribute.io. - translation_attribute = (u16) ((temp8 >> 4) & 0x03); - } else { - /* BUS_NUMBER_RANGE == Address16.Data->resource_type */ - /* Nothing needs to be filled in */ - } - } + acpi_rs_decode_specific_flags(&output_struct->data, *buffer); /* Get Granularity (Bytes 6-7) */ @@ -200,9 +341,8 @@ acpi_rs_address16_resource(u8 * byte_stream_buffer, if (*bytes_consumed > (16 + 1)) { /* Dereference the Index */ - temp8 = *buffer; output_struct->data.address16.resource_source.index = - (u32) temp8; + (u32) * buffer; /* Point to the String */ @@ -216,22 +356,20 @@ acpi_rs_address16_resource(u8 * byte_stream_buffer, temp_ptr = (u8 *) output_struct->data.address16.resource_source.string_ptr; - /* Copy the string into the buffer */ + /* Copy the resource_source string into the buffer */ index = 0; - - while (0x00 != *buffer) { + while (*buffer) { *temp_ptr = *buffer; - temp_ptr += 1; - buffer += 1; - index += 1; + temp_ptr++; + buffer++; + index++; } - /* Add the terminating null */ - - *temp_ptr = 0x00; + /* Add the terminating null and set the string length */ + *temp_ptr = 0; output_struct->data.address16.resource_source.string_length = index + 1; @@ -243,7 +381,7 @@ acpi_rs_address16_resource(u8 * byte_stream_buffer, temp8 = (u8) (index + 1); struct_size += ACPI_ROUND_UP_to_32_bITS(temp8); } else { - output_struct->data.address16.resource_source.index = 0x00; + output_struct->data.address16.resource_source.index = 0; output_struct->data.address16.resource_source.string_length = 0; output_struct->data.address16.resource_source.string_ptr = NULL; } @@ -280,15 +418,13 @@ acpi_rs_address16_stream(struct acpi_resource *linked_list, { u8 *buffer = *output_buffer; u8 *length_field; - u8 temp8; - char *temp_pointer = NULL; acpi_size actual_bytes; ACPI_FUNCTION_TRACE("rs_address16_stream"); - /* The descriptor field is static */ + /* Set the Descriptor Type field */ - *buffer = 0x88; + *buffer = ACPI_RDESC_TYPE_WORD_ADDRESS_SPACE; buffer += 1; /* Save a pointer to the Length field - to be filled in later */ @@ -298,43 +434,17 @@ acpi_rs_address16_stream(struct acpi_resource *linked_list, /* Set the Resource Type (Memory, Io, bus_number) */ - temp8 = (u8) (linked_list->data.address16.resource_type & 0x03); - *buffer = temp8; + *buffer = (u8) (linked_list->data.address16.resource_type & 0x03); buffer += 1; /* Set the general flags */ - temp8 = (u8) (linked_list->data.address16.producer_consumer & 0x01); - - temp8 |= (linked_list->data.address16.decode & 0x01) << 1; - temp8 |= (linked_list->data.address16.min_address_fixed & 0x01) << 2; - temp8 |= (linked_list->data.address16.max_address_fixed & 0x01) << 3; - - *buffer = temp8; + *buffer = acpi_rs_encode_general_flags(&linked_list->data); buffer += 1; /* Set the type specific flags */ - temp8 = 0; - - if (ACPI_MEMORY_RANGE == linked_list->data.address16.resource_type) { - temp8 = (u8) - (linked_list->data.address16.attribute.memory. - read_write_attribute & 0x01); - - temp8 |= - (linked_list->data.address16.attribute.memory. - cache_attribute & 0x03) << 1; - } else if (ACPI_IO_RANGE == linked_list->data.address16.resource_type) { - temp8 = (u8) - (linked_list->data.address16.attribute.io.range_attribute & - 0x03); - temp8 |= - (linked_list->data.address16.attribute.io. - translation_attribute & 0x03) << 4; - } - - *buffer = temp8; + *buffer = acpi_rs_encode_specific_flags(&linked_list->data); buffer += 1; /* Set the address space granularity */ @@ -368,22 +478,19 @@ acpi_rs_address16_stream(struct acpi_resource *linked_list, /* Resource Source Index and Resource Source are optional */ - if (0 != linked_list->data.address16.resource_source.string_length) { - temp8 = (u8) linked_list->data.address16.resource_source.index; - - *buffer = temp8; + if (linked_list->data.address16.resource_source.string_length) { + *buffer = + (u8) linked_list->data.address16.resource_source.index; buffer += 1; - temp_pointer = (char *)buffer; - - /* Copy the string */ + /* Copy the resource_source string */ - ACPI_STRCPY(temp_pointer, + ACPI_STRCPY((char *)buffer, linked_list->data.address16.resource_source. string_ptr); /* - * Buffer needs to be set to the length of the sting + one for the + * Buffer needs to be set to the length of the string + one for the * terminating null */ buffer += @@ -432,20 +539,18 @@ acpi_rs_address32_resource(u8 * byte_stream_buffer, acpi_size * bytes_consumed, u8 ** output_buffer, acpi_size * structure_size) { - u8 *buffer; - struct acpi_resource *output_struct = (void *)*output_buffer; u16 temp16; u8 temp8; u8 *temp_ptr; - acpi_size struct_size; u32 index; + u8 *buffer = byte_stream_buffer; + struct acpi_resource *output_struct = (void *)*output_buffer; + acpi_size struct_size = + ACPI_SIZEOF_RESOURCE(struct acpi_resource_address32); ACPI_FUNCTION_TRACE("rs_address32_resource"); - buffer = byte_stream_buffer; - struct_size = ACPI_SIZEOF_RESOURCE(struct acpi_resource_address32); - - /* Point past the Descriptor to get the number of bytes consumed */ + /* Get the Descriptor Length field */ buffer += 1; ACPI_MOVE_16_TO_16(&temp16, buffer); @@ -475,47 +580,12 @@ acpi_rs_address32_resource(u8 * byte_stream_buffer, /* Get the General Flags (Byte4) */ buffer += 1; - temp8 = *buffer; - - /* Producer / Consumer */ - - output_struct->data.address32.producer_consumer = temp8 & 0x01; - - /* Decode */ - - output_struct->data.address32.decode = (temp8 >> 1) & 0x01; - - /* Min Address Fixed */ - - output_struct->data.address32.min_address_fixed = (temp8 >> 2) & 0x01; - - /* Max Address Fixed */ - - output_struct->data.address32.max_address_fixed = (temp8 >> 3) & 0x01; + acpi_rs_decode_general_flags(&output_struct->data, *buffer); /* Get the Type Specific Flags (Byte5) */ buffer += 1; - temp8 = *buffer; - - if (ACPI_MEMORY_RANGE == output_struct->data.address32.resource_type) { - output_struct->data.address32.attribute.memory. - read_write_attribute = (u16) (temp8 & 0x01); - - output_struct->data.address32.attribute.memory.cache_attribute = - (u16) ((temp8 >> 1) & 0x03); - } else { - if (ACPI_IO_RANGE == - output_struct->data.address32.resource_type) { - output_struct->data.address32.attribute.io. - range_attribute = (u16) (temp8 & 0x03); - output_struct->data.address32.attribute.io. - translation_attribute = (u16) ((temp8 >> 4) & 0x03); - } else { - /* BUS_NUMBER_RANGE == output_struct->Data.Address32.resource_type */ - /* Nothing needs to be filled in */ - } - } + acpi_rs_decode_specific_flags(&output_struct->data, *buffer); /* Get Granularity (Bytes 6-9) */ @@ -561,9 +631,8 @@ acpi_rs_address32_resource(u8 * byte_stream_buffer, if (*bytes_consumed > (26 + 1)) { /* Dereference the Index */ - temp8 = *buffer; output_struct->data.address32.resource_source.index = - (u32) temp8; + (u32) * buffer; /* Point to the String */ @@ -577,20 +646,20 @@ acpi_rs_address32_resource(u8 * byte_stream_buffer, temp_ptr = (u8 *) output_struct->data.address32.resource_source.string_ptr; - /* Copy the string into the buffer */ + /* Copy the resource_source string into the buffer */ index = 0; - while (0x00 != *buffer) { + while (*buffer) { *temp_ptr = *buffer; - temp_ptr += 1; - buffer += 1; - index += 1; + temp_ptr++; + buffer++; + index++; } - /* Add the terminating null */ + /* Add the terminating null and set the string length */ - *temp_ptr = 0x00; + *temp_ptr = 0; output_struct->data.address32.resource_source.string_length = index + 1; @@ -602,7 +671,7 @@ acpi_rs_address32_resource(u8 * byte_stream_buffer, temp8 = (u8) (index + 1); struct_size += ACPI_ROUND_UP_to_32_bITS(temp8); } else { - output_struct->data.address32.resource_source.index = 0x00; + output_struct->data.address32.resource_source.index = 0; output_struct->data.address32.resource_source.string_length = 0; output_struct->data.address32.resource_source.string_ptr = NULL; } @@ -639,62 +708,34 @@ acpi_rs_address32_stream(struct acpi_resource *linked_list, { u8 *buffer; u16 *length_field; - u8 temp8; - char *temp_pointer; ACPI_FUNCTION_TRACE("rs_address32_stream"); buffer = *output_buffer; - /* The descriptor field is static */ + /* Set the Descriptor Type field */ - *buffer = 0x87; + *buffer = ACPI_RDESC_TYPE_DWORD_ADDRESS_SPACE; buffer += 1; - /* Set a pointer to the Length field - to be filled in later */ + /* Save a pointer to the Length field - to be filled in later */ length_field = ACPI_CAST_PTR(u16, buffer); buffer += 2; /* Set the Resource Type (Memory, Io, bus_number) */ - temp8 = (u8) (linked_list->data.address32.resource_type & 0x03); - - *buffer = temp8; + *buffer = (u8) (linked_list->data.address32.resource_type & 0x03); buffer += 1; /* Set the general flags */ - temp8 = (u8) (linked_list->data.address32.producer_consumer & 0x01); - temp8 |= (linked_list->data.address32.decode & 0x01) << 1; - temp8 |= (linked_list->data.address32.min_address_fixed & 0x01) << 2; - temp8 |= (linked_list->data.address32.max_address_fixed & 0x01) << 3; - - *buffer = temp8; + *buffer = acpi_rs_encode_general_flags(&linked_list->data); buffer += 1; /* Set the type specific flags */ - temp8 = 0; - - if (ACPI_MEMORY_RANGE == linked_list->data.address32.resource_type) { - temp8 = (u8) - (linked_list->data.address32.attribute.memory. - read_write_attribute & 0x01); - - temp8 |= - (linked_list->data.address32.attribute.memory. - cache_attribute & 0x03) << 1; - } else if (ACPI_IO_RANGE == linked_list->data.address32.resource_type) { - temp8 = (u8) - (linked_list->data.address32.attribute.io.range_attribute & - 0x03); - temp8 |= - (linked_list->data.address32.attribute.io. - translation_attribute & 0x03) << 4; - } - - *buffer = temp8; + *buffer = acpi_rs_encode_specific_flags(&linked_list->data); buffer += 1; /* Set the address space granularity */ @@ -728,22 +769,19 @@ acpi_rs_address32_stream(struct acpi_resource *linked_list, /* Resource Source Index and Resource Source are optional */ - if (0 != linked_list->data.address32.resource_source.string_length) { - temp8 = (u8) linked_list->data.address32.resource_source.index; - - *buffer = temp8; + if (linked_list->data.address32.resource_source.string_length) { + *buffer = + (u8) linked_list->data.address32.resource_source.index; buffer += 1; - temp_pointer = (char *)buffer; - - /* Copy the string */ + /* Copy the resource_source string */ - ACPI_STRCPY(temp_pointer, + ACPI_STRCPY((char *)buffer, linked_list->data.address32.resource_source. string_ptr); /* - * Buffer needs to be set to the length of the sting + one for the + * Buffer needs to be set to the length of the string + one for the * terminating null */ buffer += @@ -758,7 +796,7 @@ acpi_rs_address32_stream(struct acpi_resource *linked_list, /* * Set the length field to the number of bytes consumed - * minus the header size (3 bytes) + * minus the header size (3 bytes) */ *length_field = (u16) (*bytes_consumed - 3); return_ACPI_STATUS(AE_OK); @@ -790,22 +828,23 @@ acpi_rs_address64_resource(u8 * byte_stream_buffer, acpi_size * bytes_consumed, u8 ** output_buffer, acpi_size * structure_size) { - u8 *buffer; - struct acpi_resource *output_struct = (void *)*output_buffer; u16 temp16; u8 temp8; u8 resource_type; u8 *temp_ptr; - acpi_size struct_size; u32 index; + u8 *buffer = byte_stream_buffer; + struct acpi_resource *output_struct = (void *)*output_buffer; + acpi_size struct_size = + ACPI_SIZEOF_RESOURCE(struct acpi_resource_address64); ACPI_FUNCTION_TRACE("rs_address64_resource"); - buffer = byte_stream_buffer; - struct_size = ACPI_SIZEOF_RESOURCE(struct acpi_resource_address64); + /* Get the Descriptor Type */ + resource_type = *buffer; - /* Point past the Descriptor to get the number of bytes consumed */ + /* Get the Descriptor Length field */ buffer += 1; ACPI_MOVE_16_TO_16(&temp16, buffer); @@ -835,47 +874,12 @@ acpi_rs_address64_resource(u8 * byte_stream_buffer, /* Get the General Flags (Byte4) */ buffer += 1; - temp8 = *buffer; - - /* Producer / Consumer */ - - output_struct->data.address64.producer_consumer = temp8 & 0x01; - - /* Decode */ - - output_struct->data.address64.decode = (temp8 >> 1) & 0x01; - - /* Min Address Fixed */ - - output_struct->data.address64.min_address_fixed = (temp8 >> 2) & 0x01; - - /* Max Address Fixed */ - - output_struct->data.address64.max_address_fixed = (temp8 >> 3) & 0x01; + acpi_rs_decode_general_flags(&output_struct->data, *buffer); /* Get the Type Specific Flags (Byte5) */ buffer += 1; - temp8 = *buffer; - - if (ACPI_MEMORY_RANGE == output_struct->data.address64.resource_type) { - output_struct->data.address64.attribute.memory. - read_write_attribute = (u16) (temp8 & 0x01); - - output_struct->data.address64.attribute.memory.cache_attribute = - (u16) ((temp8 >> 1) & 0x03); - } else { - if (ACPI_IO_RANGE == - output_struct->data.address64.resource_type) { - output_struct->data.address64.attribute.io. - range_attribute = (u16) (temp8 & 0x03); - output_struct->data.address64.attribute.io. - translation_attribute = (u16) ((temp8 >> 4) & 0x03); - } else { - /* BUS_NUMBER_RANGE == output_struct->Data.Address64.resource_type */ - /* Nothing needs to be filled in */ - } - } + acpi_rs_decode_specific_flags(&output_struct->data, *buffer); if (resource_type == ACPI_RDESC_TYPE_EXTENDED_ADDRESS_SPACE) { /* Move past revision_id and Reserved byte */ @@ -912,7 +916,7 @@ acpi_rs_address64_resource(u8 * byte_stream_buffer, ACPI_MOVE_64_TO_64(&output_struct->data.address64.address_length, buffer); - output_struct->data.address64.resource_source.index = 0x00; + output_struct->data.address64.resource_source.index = 0; output_struct->data.address64.resource_source.string_length = 0; output_struct->data.address64.resource_source.string_ptr = NULL; @@ -942,9 +946,8 @@ acpi_rs_address64_resource(u8 * byte_stream_buffer, if (*bytes_consumed > (46 + 1)) { /* Dereference the Index */ - temp8 = *buffer; output_struct->data.address64.resource_source.index = - (u32) temp8; + (u32) * buffer; /* Point to the String */ @@ -960,21 +963,21 @@ acpi_rs_address64_resource(u8 * byte_stream_buffer, output_struct->data.address64.resource_source. string_ptr; - /* Copy the string into the buffer */ + /* Copy the resource_source string into the buffer */ index = 0; - while (0x00 != *buffer) { + while (*buffer) { *temp_ptr = *buffer; - temp_ptr += 1; - buffer += 1; - index += 1; + temp_ptr++; + buffer++; + index++; } /* - * Add the terminating null + * Add the terminating null and set the string length */ - *temp_ptr = 0x00; + *temp_ptr = 0; output_struct->data.address64.resource_source. string_length = index + 1; @@ -1020,62 +1023,34 @@ acpi_rs_address64_stream(struct acpi_resource *linked_list, { u8 *buffer; u16 *length_field; - u8 temp8; - char *temp_pointer; ACPI_FUNCTION_TRACE("rs_address64_stream"); buffer = *output_buffer; - /* The descriptor field is static */ + /* Set the Descriptor Type field */ - *buffer = 0x8A; + *buffer = ACPI_RDESC_TYPE_QWORD_ADDRESS_SPACE; buffer += 1; - /* Set a pointer to the Length field - to be filled in later */ + /* Save a pointer to the Length field - to be filled in later */ length_field = ACPI_CAST_PTR(u16, buffer); buffer += 2; /* Set the Resource Type (Memory, Io, bus_number) */ - temp8 = (u8) (linked_list->data.address64.resource_type & 0x03); - - *buffer = temp8; + *buffer = (u8) (linked_list->data.address64.resource_type & 0x03); buffer += 1; /* Set the general flags */ - temp8 = (u8) (linked_list->data.address64.producer_consumer & 0x01); - temp8 |= (linked_list->data.address64.decode & 0x01) << 1; - temp8 |= (linked_list->data.address64.min_address_fixed & 0x01) << 2; - temp8 |= (linked_list->data.address64.max_address_fixed & 0x01) << 3; - - *buffer = temp8; + *buffer = acpi_rs_encode_general_flags(&linked_list->data); buffer += 1; /* Set the type specific flags */ - temp8 = 0; - - if (ACPI_MEMORY_RANGE == linked_list->data.address64.resource_type) { - temp8 = (u8) - (linked_list->data.address64.attribute.memory. - read_write_attribute & 0x01); - - temp8 |= - (linked_list->data.address64.attribute.memory. - cache_attribute & 0x03) << 1; - } else if (ACPI_IO_RANGE == linked_list->data.address64.resource_type) { - temp8 = (u8) - (linked_list->data.address64.attribute.io.range_attribute & - 0x03); - temp8 |= - (linked_list->data.address64.attribute.io.range_attribute & - 0x03) << 4; - } - - *buffer = temp8; + *buffer = acpi_rs_encode_specific_flags(&linked_list->data); buffer += 1; /* Set the address space granularity */ @@ -1109,22 +1084,19 @@ acpi_rs_address64_stream(struct acpi_resource *linked_list, /* Resource Source Index and Resource Source are optional */ - if (0 != linked_list->data.address64.resource_source.string_length) { - temp8 = (u8) linked_list->data.address64.resource_source.index; - - *buffer = temp8; + if (linked_list->data.address64.resource_source.string_length) { + *buffer = + (u8) linked_list->data.address64.resource_source.index; buffer += 1; - temp_pointer = (char *)buffer; - - /* Copy the string */ + /* Copy the resource_source string */ - ACPI_STRCPY(temp_pointer, + ACPI_STRCPY((char *)buffer, linked_list->data.address64.resource_source. string_ptr); /* - * Buffer needs to be set to the length of the sting + one for the + * Buffer needs to be set to the length of the string + one for the * terminating null */ buffer += diff --git a/drivers/acpi/resources/rsirq.c b/drivers/acpi/resources/rsirq.c index 7179b6243f5..56043fee96c 100644 --- a/drivers/acpi/resources/rsirq.c +++ b/drivers/acpi/resources/rsirq.c @@ -290,7 +290,7 @@ acpi_rs_extended_irq_resource(u8 * byte_stream_buffer, ACPI_FUNCTION_TRACE("rs_extended_irq_resource"); - /* Point past the Descriptor to get the number of bytes consumed */ + /* Get the Descriptor Length field */ buffer += 1; ACPI_MOVE_16_TO_16(&temp16, buffer); @@ -398,7 +398,7 @@ acpi_rs_extended_irq_resource(u8 * byte_stream_buffer, /* Copy the string into the buffer */ index = 0; - while (0x00 != *buffer) { + while (*buffer) { *temp_ptr = *buffer; temp_ptr += 1; @@ -408,7 +408,7 @@ acpi_rs_extended_irq_resource(u8 * byte_stream_buffer, /* Add the terminating null */ - *temp_ptr = 0x00; + *temp_ptr = 0; output_struct->data.extended_irq.resource_source.string_length = index + 1; @@ -420,7 +420,7 @@ acpi_rs_extended_irq_resource(u8 * byte_stream_buffer, temp8 = (u8) (index + 1); struct_size += ACPI_ROUND_UP_to_32_bITS(temp8); } else { - output_struct->data.extended_irq.resource_source.index = 0x00; + output_struct->data.extended_irq.resource_source.index = 0; output_struct->data.extended_irq.resource_source.string_length = 0; output_struct->data.extended_irq.resource_source.string_ptr = @@ -461,16 +461,15 @@ acpi_rs_extended_irq_stream(struct acpi_resource *linked_list, u16 *length_field; u8 temp8 = 0; u8 index; - char *temp_pointer = NULL; ACPI_FUNCTION_TRACE("rs_extended_irq_stream"); - /* The descriptor field is static */ + /* Set the Descriptor Type field */ - *buffer = 0x89; + *buffer = ACPI_RDESC_TYPE_EXTENDED_XRUPT; buffer += 1; - /* Set a pointer to the Length field - to be filled in later */ + /* Save a pointer to the Length field - to be filled in later */ length_field = ACPI_CAST_PTR(u16, buffer); buffer += 2; @@ -524,16 +523,14 @@ acpi_rs_extended_irq_stream(struct acpi_resource *linked_list, (u8) linked_list->data.extended_irq.resource_source.index; buffer += 1; - temp_pointer = (char *)buffer; - /* Copy the string */ - ACPI_STRCPY(temp_pointer, + ACPI_STRCPY((char *)buffer, linked_list->data.extended_irq.resource_source. string_ptr); /* - * Buffer needs to be set to the length of the sting + one for the + * Buffer needs to be set to the length of the string + one for the * terminating null */ buffer += diff --git a/drivers/acpi/utilities/utmisc.c b/drivers/acpi/utilities/utmisc.c index f0275025b71..0c5abc536c7 100644 --- a/drivers/acpi/utilities/utmisc.c +++ b/drivers/acpi/utilities/utmisc.c @@ -67,6 +67,14 @@ acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id) ACPI_FUNCTION_TRACE("ut_allocate_owner_id"); + /* Guard against multiple allocations of ID to the same location */ + + if (*owner_id) { + ACPI_REPORT_ERROR(("Owner ID [%2.2X] already exists\n", + *owner_id)); + return_ACPI_STATUS(AE_ALREADY_EXISTS); + } + /* Mutex for the global ID mask */ status = acpi_ut_acquire_mutex(ACPI_MTX_CACHES); @@ -80,7 +88,8 @@ acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id) if (!(acpi_gbl_owner_id_mask & (1 << i))) { ACPI_DEBUG_PRINT((ACPI_DB_VALUES, "Current owner_id mask: %8.8X New ID: %2.2X\n", - acpi_gbl_owner_id_mask, (i + 1))); + acpi_gbl_owner_id_mask, + (unsigned int)(i + 1))); acpi_gbl_owner_id_mask |= (1 << i); *owner_id = (acpi_owner_id) (i + 1); @@ -143,7 +152,9 @@ void acpi_ut_release_owner_id(acpi_owner_id * owner_id_ptr) return_VOID; } - owner_id--; /* Normalize to zero */ + /* Normalize the ID to zero */ + + owner_id--; /* Free the owner ID only if it is valid */ diff --git a/include/acpi/acconfig.h b/include/acpi/acconfig.h index 73c43a39663..427cff1a3f8 100644 --- a/include/acpi/acconfig.h +++ b/include/acpi/acconfig.h @@ -63,7 +63,7 @@ /* Version string */ -#define ACPI_CA_VERSION 0x20050815 +#define ACPI_CA_VERSION 0x20050902 /* * OS name, used for the _OS object. The _OS object is essentially obsolete, diff --git a/include/acpi/acdispat.h b/include/acpi/acdispat.h index 59306186f5e..065f24a77cf 100644 --- a/include/acpi/acdispat.h +++ b/include/acpi/acdispat.h @@ -194,8 +194,7 @@ acpi_status acpi_ds_restart_control_method(struct acpi_walk_state *walk_state, union acpi_operand_object *return_desc); -acpi_status -acpi_ds_terminate_control_method(struct acpi_walk_state *walk_state); +void acpi_ds_terminate_control_method(struct acpi_walk_state *walk_state); acpi_status acpi_ds_begin_method_execution(struct acpi_namespace_node *method_node, diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h index 254f4b06e7e..6213b27516e 100644 --- a/include/acpi/actypes.h +++ b/include/acpi/actypes.h @@ -1074,14 +1074,21 @@ struct acpi_resource_source { char *string_ptr; }; +/* Fields common to all address descriptors, 16/32/64 bit */ + +#define ACPI_RESOURCE_ADDRESS_COMMON \ + u32 resource_type; \ + u32 producer_consumer; \ + u32 decode; \ + u32 min_address_fixed; \ + u32 max_address_fixed; \ + union acpi_resource_attribute attribute; + +struct acpi_resource_address { +ACPI_RESOURCE_ADDRESS_COMMON}; + struct acpi_resource_address16 { - u32 resource_type; - u32 producer_consumer; - u32 decode; - u32 min_address_fixed; - u32 max_address_fixed; - union acpi_resource_attribute attribute; - u32 granularity; + ACPI_RESOURCE_ADDRESS_COMMON u32 granularity; u32 min_address_range; u32 max_address_range; u32 address_translation_offset; @@ -1090,13 +1097,7 @@ struct acpi_resource_address16 { }; struct acpi_resource_address32 { - u32 resource_type; - u32 producer_consumer; - u32 decode; - u32 min_address_fixed; - u32 max_address_fixed; - union acpi_resource_attribute attribute; - u32 granularity; + ACPI_RESOURCE_ADDRESS_COMMON u32 granularity; u32 min_address_range; u32 max_address_range; u32 address_translation_offset; @@ -1105,13 +1106,7 @@ struct acpi_resource_address32 { }; struct acpi_resource_address64 { - u32 resource_type; - u32 producer_consumer; - u32 decode; - u32 min_address_fixed; - u32 max_address_fixed; - union acpi_resource_attribute attribute; - u64 granularity; + ACPI_RESOURCE_ADDRESS_COMMON u64 granularity; u64 min_address_range; u64 max_address_range; u64 address_translation_offset; @@ -1161,6 +1156,7 @@ union acpi_resource_data { struct acpi_resource_mem24 memory24; struct acpi_resource_mem32 memory32; struct acpi_resource_fixed_mem32 fixed_memory32; + struct acpi_resource_address address; /* Common 16/32/64 address fields */ struct acpi_resource_address16 address16; struct acpi_resource_address32 address32; struct acpi_resource_address64 address64; -- cgit v1.2.3-70-g09d2 From 865e9f13c94891daed4f6a5f69c5d6ec04d4932f Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Sat, 3 Sep 2005 16:45:02 +0100 Subject: [MMC] ios for mmc chip select Adds a new ios for setting the chip select pin on MMC cards. Needed on SD controllers which use this pin for other things and therefore cannot have it pulled high at all times. Signed-off-by: Pierre Ossman Signed-off-by: Russell King --- drivers/mmc/mmc.c | 12 ++++++++++++ include/linux/mmc/host.h | 6 ++++++ 2 files changed, 18 insertions(+) (limited to 'include') diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c index 3c5904834fe..0a8165974ba 100644 --- a/drivers/mmc/mmc.c +++ b/drivers/mmc/mmc.c @@ -457,6 +457,11 @@ static void mmc_idle_cards(struct mmc_host *host) { struct mmc_command cmd; + host->ios.chip_select = MMC_CS_HIGH; + host->ops->set_ios(host, &host->ios); + + mmc_delay(1); + cmd.opcode = MMC_GO_IDLE_STATE; cmd.arg = 0; cmd.flags = MMC_RSP_NONE; @@ -464,6 +469,11 @@ static void mmc_idle_cards(struct mmc_host *host) mmc_wait_for_cmd(host, &cmd, 0); mmc_delay(1); + + host->ios.chip_select = MMC_CS_DONTCARE; + host->ops->set_ios(host, &host->ios); + + mmc_delay(1); } /* @@ -475,6 +485,7 @@ static void mmc_power_up(struct mmc_host *host) host->ios.vdd = bit; host->ios.bus_mode = MMC_BUSMODE_OPENDRAIN; + host->ios.chip_select = MMC_CS_DONTCARE; host->ios.power_mode = MMC_POWER_UP; host->ops->set_ios(host, &host->ios); @@ -492,6 +503,7 @@ static void mmc_power_off(struct mmc_host *host) host->ios.clock = 0; host->ios.vdd = 0; host->ios.bus_mode = MMC_BUSMODE_OPENDRAIN; + host->ios.chip_select = MMC_CS_DONTCARE; host->ios.power_mode = MMC_POWER_OFF; host->ops->set_ios(host, &host->ios); } diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index 9a0893f3249..30f68c0c8c6 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h @@ -46,6 +46,12 @@ struct mmc_ios { #define MMC_BUSMODE_OPENDRAIN 1 #define MMC_BUSMODE_PUSHPULL 2 + unsigned char chip_select; /* SPI chip select */ + +#define MMC_CS_DONTCARE 0 +#define MMC_CS_HIGH 1 +#define MMC_CS_LOW 2 + unsigned char power_mode; /* power supply mode */ #define MMC_POWER_OFF 0 -- cgit v1.2.3-70-g09d2 From 7801907b8c4a49f8ec033d13a938751114a97a55 Mon Sep 17 00:00:00 2001 From: Russell King Date: Sun, 4 Sep 2005 19:43:13 +0100 Subject: [ARM] Change irq_chip wake/type methods to set_wake/set_type This is part of Thomas Gleixner's generic IRQ patch, which converts ARM to use the generic IRQ subsystem. Here, we rename two of the irq_chip methods - wake becomes set_wake, and type becomes set_type. Signed-off-by: Russell King --- arch/arm/common/sa1111.c | 8 ++++---- arch/arm/kernel/irq.c | 16 ++++++++-------- arch/arm/mach-imx/irq.c | 2 +- arch/arm/mach-ixp2000/core.c | 8 ++++---- arch/arm/mach-pxa/irq.c | 4 ++-- arch/arm/mach-s3c2410/irq.c | 12 ++++++------ arch/arm/mach-sa1100/irq.c | 8 ++++---- include/asm-arm/mach/irq.h | 4 ++-- 8 files changed, 31 insertions(+), 31 deletions(-) (limited to 'include') diff --git a/arch/arm/common/sa1111.c b/arch/arm/common/sa1111.c index 38c2eb667eb..1a47fbf9cbb 100644 --- a/arch/arm/common/sa1111.c +++ b/arch/arm/common/sa1111.c @@ -268,8 +268,8 @@ static struct irqchip sa1111_low_chip = { .mask = sa1111_mask_lowirq, .unmask = sa1111_unmask_lowirq, .retrigger = sa1111_retrigger_lowirq, - .type = sa1111_type_lowirq, - .wake = sa1111_wake_lowirq, + .set_type = sa1111_type_lowirq, + .set_wake = sa1111_wake_lowirq, }; static void sa1111_mask_highirq(unsigned int irq) @@ -364,8 +364,8 @@ static struct irqchip sa1111_high_chip = { .mask = sa1111_mask_highirq, .unmask = sa1111_unmask_highirq, .retrigger = sa1111_retrigger_highirq, - .type = sa1111_type_highirq, - .wake = sa1111_wake_highirq, + .set_type = sa1111_type_highirq, + .set_wake = sa1111_wake_highirq, }; static void sa1111_setup_irq(struct sa1111 *sachip) diff --git a/arch/arm/kernel/irq.c b/arch/arm/kernel/irq.c index 395137a8fad..58b3bd00083 100644 --- a/arch/arm/kernel/irq.c +++ b/arch/arm/kernel/irq.c @@ -207,8 +207,8 @@ void enable_irq_wake(unsigned int irq) unsigned long flags; spin_lock_irqsave(&irq_controller_lock, flags); - if (desc->chip->wake) - desc->chip->wake(irq, 1); + if (desc->chip->set_wake) + desc->chip->set_wake(irq, 1); spin_unlock_irqrestore(&irq_controller_lock, flags); } EXPORT_SYMBOL(enable_irq_wake); @@ -219,8 +219,8 @@ void disable_irq_wake(unsigned int irq) unsigned long flags; spin_lock_irqsave(&irq_controller_lock, flags); - if (desc->chip->wake) - desc->chip->wake(irq, 0); + if (desc->chip->set_wake) + desc->chip->set_wake(irq, 0); spin_unlock_irqrestore(&irq_controller_lock, flags); } EXPORT_SYMBOL(disable_irq_wake); @@ -624,9 +624,9 @@ int set_irq_type(unsigned int irq, unsigned int type) } desc = irq_desc + irq; - if (desc->chip->type) { + if (desc->chip->set_type) { spin_lock_irqsave(&irq_controller_lock, flags); - ret = desc->chip->type(irq, type); + ret = desc->chip->set_type(irq, type); spin_unlock_irqrestore(&irq_controller_lock, flags); } @@ -846,8 +846,8 @@ unsigned long probe_irq_on(void) irq_desc[i].probing = 1; irq_desc[i].triggered = 0; - if (irq_desc[i].chip->type) - irq_desc[i].chip->type(i, IRQT_PROBE); + if (irq_desc[i].chip->set_type) + irq_desc[i].chip->set_type(i, IRQT_PROBE); irq_desc[i].chip->unmask(i); irqs += 1; } diff --git a/arch/arm/mach-imx/irq.c b/arch/arm/mach-imx/irq.c index 0c2713426df..45d22dd5583 100644 --- a/arch/arm/mach-imx/irq.c +++ b/arch/arm/mach-imx/irq.c @@ -214,7 +214,7 @@ static struct irqchip imx_gpio_chip = { .ack = imx_gpio_ack_irq, .mask = imx_gpio_mask_irq, .unmask = imx_gpio_unmask_irq, - .type = imx_gpio_irq_type, + .set_type = imx_gpio_irq_type, }; void __init diff --git a/arch/arm/mach-ixp2000/core.c b/arch/arm/mach-ixp2000/core.c index 45b18658499..594b4c4d5b1 100644 --- a/arch/arm/mach-ixp2000/core.c +++ b/arch/arm/mach-ixp2000/core.c @@ -380,10 +380,10 @@ static void ixp2000_GPIO_irq_unmask(unsigned int irq) } static struct irqchip ixp2000_GPIO_irq_chip = { - .type = ixp2000_GPIO_irq_type, - .ack = ixp2000_GPIO_irq_mask_ack, - .mask = ixp2000_GPIO_irq_mask, - .unmask = ixp2000_GPIO_irq_unmask + .ack = ixp2000_GPIO_irq_mask_ack, + .mask = ixp2000_GPIO_irq_mask, + .unmask = ixp2000_GPIO_irq_unmask + .set_type = ixp2000_GPIO_irq_type, }; static void ixp2000_pci_irq_mask(unsigned int irq) diff --git a/arch/arm/mach-pxa/irq.c b/arch/arm/mach-pxa/irq.c index f3cac43124a..6cf35f67446 100644 --- a/arch/arm/mach-pxa/irq.c +++ b/arch/arm/mach-pxa/irq.c @@ -133,7 +133,7 @@ static struct irqchip pxa_low_gpio_chip = { .ack = pxa_ack_low_gpio, .mask = pxa_mask_low_irq, .unmask = pxa_unmask_low_irq, - .type = pxa_gpio_irq_type, + .set_type = pxa_gpio_irq_type, }; /* @@ -241,7 +241,7 @@ static struct irqchip pxa_muxed_gpio_chip = { .ack = pxa_ack_muxed_gpio, .mask = pxa_mask_muxed_gpio, .unmask = pxa_unmask_muxed_gpio, - .type = pxa_gpio_irq_type, + .set_type = pxa_gpio_irq_type, }; diff --git a/arch/arm/mach-s3c2410/irq.c b/arch/arm/mach-s3c2410/irq.c index 973a5fe6769..67138797866 100644 --- a/arch/arm/mach-s3c2410/irq.c +++ b/arch/arm/mach-s3c2410/irq.c @@ -184,14 +184,14 @@ struct irqchip s3c_irq_level_chip = { .ack = s3c_irq_maskack, .mask = s3c_irq_mask, .unmask = s3c_irq_unmask, - .wake = s3c_irq_wake + .set_wake = s3c_irq_wake }; static struct irqchip s3c_irq_chip = { .ack = s3c_irq_ack, .mask = s3c_irq_mask, .unmask = s3c_irq_unmask, - .wake = s3c_irq_wake + .set_wake = s3c_irq_wake }; /* S3C2410_EINTMASK @@ -350,16 +350,16 @@ static struct irqchip s3c_irqext_chip = { .mask = s3c_irqext_mask, .unmask = s3c_irqext_unmask, .ack = s3c_irqext_ack, - .type = s3c_irqext_type, - .wake = s3c_irqext_wake + .set_type = s3c_irqext_type, + .set_wake = s3c_irqext_wake }; static struct irqchip s3c_irq_eint0t4 = { .ack = s3c_irq_ack, .mask = s3c_irq_mask, .unmask = s3c_irq_unmask, - .wake = s3c_irq_wake, - .type = s3c_irqext_type, + .set_wake = s3c_irq_wake, + .set_type = s3c_irqext_type, }; /* mask values for the parent registers for each of the interrupt types */ diff --git a/arch/arm/mach-sa1100/irq.c b/arch/arm/mach-sa1100/irq.c index 66a929cb7bc..cc349bc1b7c 100644 --- a/arch/arm/mach-sa1100/irq.c +++ b/arch/arm/mach-sa1100/irq.c @@ -98,8 +98,8 @@ static struct irqchip sa1100_low_gpio_chip = { .ack = sa1100_low_gpio_ack, .mask = sa1100_low_gpio_mask, .unmask = sa1100_low_gpio_unmask, - .type = sa1100_gpio_type, - .wake = sa1100_low_gpio_wake, + .set_type = sa1100_gpio_type, + .set_wake = sa1100_low_gpio_wake, }; /* @@ -181,8 +181,8 @@ static struct irqchip sa1100_high_gpio_chip = { .ack = sa1100_high_gpio_ack, .mask = sa1100_high_gpio_mask, .unmask = sa1100_high_gpio_unmask, - .type = sa1100_gpio_type, - .wake = sa1100_high_gpio_wake, + .set_type = sa1100_gpio_type, + .set_wake = sa1100_high_gpio_wake, }; /* diff --git a/include/asm-arm/mach/irq.h b/include/asm-arm/mach/irq.h index a43a353f6c7..bc9763db1d3 100644 --- a/include/asm-arm/mach/irq.h +++ b/include/asm-arm/mach/irq.h @@ -42,11 +42,11 @@ struct irqchip { /* * Set the type of the IRQ. */ - int (*type)(unsigned int, unsigned int); + int (*set_type)(unsigned int, unsigned int); /* * Set wakeup-enable on the selected IRQ */ - int (*wake)(unsigned int, unsigned int); + int (*set_wake)(unsigned int, unsigned int); #ifdef CONFIG_SMP /* -- cgit v1.2.3-70-g09d2 From 664399e1fbdceb18da9c9c5534dedd62327c63e8 Mon Sep 17 00:00:00 2001 From: Russell King Date: Sun, 4 Sep 2005 19:45:00 +0100 Subject: [ARM] Wrap calls to descriptor handlers This is part of Thomas Gleixner's generic IRQ patch, which converts ARM to use the generic IRQ subsystem. Here, we wrap calls to desc->handler() in an inline function, desc_handle_irq(). This reduces the size of Thomas' patch since the changes become more localised. Signed-off-by: Russell King --- arch/arm/common/locomo.c | 10 +++++----- arch/arm/kernel/ecard.c | 4 ++-- arch/arm/kernel/irq.c | 4 ++-- arch/arm/mach-footbridge/isa-irq.c | 2 +- arch/arm/mach-h720x/common.c | 2 +- arch/arm/mach-h720x/cpu-h7202.c | 2 +- arch/arm/mach-imx/irq.c | 2 +- arch/arm/mach-integrator/integrator_cp.c | 2 +- arch/arm/mach-ixp2000/core.c | 2 +- arch/arm/mach-ixp2000/ixdp2x00.c | 2 +- arch/arm/mach-ixp2000/ixdp2x01.c | 2 +- arch/arm/mach-lh7a40x/common.h | 2 +- arch/arm/mach-omap1/fpga.c | 2 +- arch/arm/mach-pxa/irq.c | 8 ++++---- arch/arm/mach-pxa/lubbock.c | 2 +- arch/arm/mach-pxa/mainstone.c | 2 +- arch/arm/mach-s3c2410/bast-irq.c | 2 +- arch/arm/mach-s3c2410/irq.c | 10 +++++----- arch/arm/mach-s3c2410/s3c2440-irq.c | 8 ++++---- arch/arm/mach-sa1100/irq.c | 2 +- arch/arm/mach-sa1100/neponset.c | 6 +++--- arch/arm/mach-versatile/core.c | 2 +- arch/arm/plat-omap/gpio.c | 2 +- include/asm-arm/mach/irq.h | 8 ++++++++ 24 files changed, 49 insertions(+), 41 deletions(-) (limited to 'include') diff --git a/arch/arm/common/locomo.c b/arch/arm/common/locomo.c index 30ab1c3e1d4..51f430cc2fb 100644 --- a/arch/arm/common/locomo.c +++ b/arch/arm/common/locomo.c @@ -177,7 +177,7 @@ static void locomo_handler(unsigned int irq, struct irqdesc *desc, d = irq_desc + irq; for (i = 0; i <= 3; i++, d++, irq++) { if (req & (0x0100 << i)) { - d->handle(irq, d, regs); + desc_handle_irq(irq, d, regs); } } @@ -220,7 +220,7 @@ static void locomo_key_handler(unsigned int irq, struct irqdesc *desc, if (locomo_readl(mapbase + LOCOMO_KEYBOARD + LOCOMO_KIC) & 0x0001) { d = irq_desc + LOCOMO_IRQ_KEY_START; - d->handle(LOCOMO_IRQ_KEY_START, d, regs); + desc_handle_irq(LOCOMO_IRQ_KEY_START, d, regs); } } @@ -273,7 +273,7 @@ static void locomo_gpio_handler(unsigned int irq, struct irqdesc *desc, d = irq_desc + LOCOMO_IRQ_GPIO_START; for (i = 0; i <= 15; i++, irq++, d++) { if (req & (0x0001 << i)) { - d->handle(irq, d, regs); + desc_handle_irq(irq, d, regs); } } } @@ -328,7 +328,7 @@ static void locomo_lt_handler(unsigned int irq, struct irqdesc *desc, if (locomo_readl(mapbase + LOCOMO_LTINT) & 0x0001) { d = irq_desc + LOCOMO_IRQ_LT_START; - d->handle(LOCOMO_IRQ_LT_START, d, regs); + desc_handle_irq(LOCOMO_IRQ_LT_START, d, regs); } } @@ -379,7 +379,7 @@ static void locomo_spi_handler(unsigned int irq, struct irqdesc *desc, for (i = 0; i <= 3; i++, irq++, d++) { if (req & (0x0001 << i)) { - d->handle(irq, d, regs); + desc_handle_irq(irq, d, regs); } } } diff --git a/arch/arm/kernel/ecard.c b/arch/arm/kernel/ecard.c index 6540db69133..dceb826bd21 100644 --- a/arch/arm/kernel/ecard.c +++ b/arch/arm/kernel/ecard.c @@ -585,7 +585,7 @@ ecard_irq_handler(unsigned int irq, struct irqdesc *desc, struct pt_regs *regs) if (pending) { struct irqdesc *d = irq_desc + ec->irq; - d->handle(ec->irq, d, regs); + desc_handle_irq(ec->irq, d, regs); called ++; } } @@ -632,7 +632,7 @@ ecard_irqexp_handler(unsigned int irq, struct irqdesc *desc, struct pt_regs *reg * Serial cards should go in 0/1, ethernet/scsi in 2/3 * otherwise you will lose serial data at high speeds! */ - d->handle(ec->irq, d, regs); + desc_handle_irq(ec->irq, d, regs); } else { printk(KERN_WARNING "card%d: interrupt from unclaimed " "card???\n", slot); diff --git a/arch/arm/kernel/irq.c b/arch/arm/kernel/irq.c index 58b3bd00083..3284118f356 100644 --- a/arch/arm/kernel/irq.c +++ b/arch/arm/kernel/irq.c @@ -517,7 +517,7 @@ static void do_pending_irqs(struct pt_regs *regs) list_for_each_safe(l, n, &head) { desc = list_entry(l, struct irqdesc, pend); list_del_init(&desc->pend); - desc->handle(desc - irq_desc, desc, regs); + desc_handle_irq(desc - irq_desc, desc, regs); } /* @@ -545,7 +545,7 @@ asmlinkage void asm_do_IRQ(unsigned int irq, struct pt_regs *regs) irq_enter(); spin_lock(&irq_controller_lock); - desc->handle(irq, desc, regs); + desc_handle_irq(irq, desc, regs); /* * Now re-run any pending interrupts. diff --git a/arch/arm/mach-footbridge/isa-irq.c b/arch/arm/mach-footbridge/isa-irq.c index b21016070ea..e1c43b331d6 100644 --- a/arch/arm/mach-footbridge/isa-irq.c +++ b/arch/arm/mach-footbridge/isa-irq.c @@ -95,7 +95,7 @@ isa_irq_handler(unsigned int irq, struct irqdesc *desc, struct pt_regs *regs) } desc = irq_desc + isa_irq; - desc->handle(isa_irq, desc, regs); + desc_handle_irq(isa_irq, desc, regs); } static struct irqaction irq_cascade = { .handler = no_action, .name = "cascade", }; diff --git a/arch/arm/mach-h720x/common.c b/arch/arm/mach-h720x/common.c index 96aa3af70d8..5110e2e65dd 100644 --- a/arch/arm/mach-h720x/common.c +++ b/arch/arm/mach-h720x/common.c @@ -108,7 +108,7 @@ h720x_gpio_handler(unsigned int mask, unsigned int irq, while (mask) { if (mask & 1) { IRQDBG("handling irq %d\n", irq); - desc->handle(irq, desc, regs); + desc_handle_irq(irq, desc, regs); } irq++; desc++; diff --git a/arch/arm/mach-h720x/cpu-h7202.c b/arch/arm/mach-h720x/cpu-h7202.c index 593b6a2a30e..4b3199319e6 100644 --- a/arch/arm/mach-h720x/cpu-h7202.c +++ b/arch/arm/mach-h720x/cpu-h7202.c @@ -126,7 +126,7 @@ h7202_timerx_demux_handler(unsigned int irq_unused, struct irqdesc *desc, desc = irq_desc + irq; while (mask) { if (mask & 1) - desc->handle(irq, desc, regs); + desc_handle_irq(irq, desc, regs); irq++; desc++; mask >>= 1; diff --git a/arch/arm/mach-imx/irq.c b/arch/arm/mach-imx/irq.c index 45d22dd5583..eeb8a6d4a39 100644 --- a/arch/arm/mach-imx/irq.c +++ b/arch/arm/mach-imx/irq.c @@ -152,7 +152,7 @@ imx_gpio_handler(unsigned int mask, unsigned int irq, while (mask) { if (mask & 1) { DEBUG_IRQ("handling irq %d\n", irq); - desc->handle(irq, desc, regs); + desc_handle_irq(irq, desc, regs); } irq++; desc++; diff --git a/arch/arm/mach-integrator/integrator_cp.c b/arch/arm/mach-integrator/integrator_cp.c index 569f328c479..2be5c03ab87 100644 --- a/arch/arm/mach-integrator/integrator_cp.c +++ b/arch/arm/mach-integrator/integrator_cp.c @@ -170,7 +170,7 @@ sic_handle_irq(unsigned int irq, struct irqdesc *desc, struct pt_regs *regs) irq += IRQ_SIC_START; desc = irq_desc + irq; - desc->handle(irq, desc, regs); + desc_handle_irq(irq, desc, regs); } while (status); } diff --git a/arch/arm/mach-ixp2000/core.c b/arch/arm/mach-ixp2000/core.c index 594b4c4d5b1..781d10ae00b 100644 --- a/arch/arm/mach-ixp2000/core.c +++ b/arch/arm/mach-ixp2000/core.c @@ -317,7 +317,7 @@ static void ixp2000_GPIO_irq_handler(unsigned int irq, struct irqdesc *desc, str for (i = 0; i <= 7; i++) { if (status & (1<handle(i + IRQ_IXP2000_GPIO0, desc, regs); + desc_handle_irq(i + IRQ_IXP2000_GPIO0, desc, regs); } } } diff --git a/arch/arm/mach-ixp2000/ixdp2x00.c b/arch/arm/mach-ixp2000/ixdp2x00.c index a43369ad876..63ba0191aa6 100644 --- a/arch/arm/mach-ixp2000/ixdp2x00.c +++ b/arch/arm/mach-ixp2000/ixdp2x00.c @@ -133,7 +133,7 @@ static void ixdp2x00_irq_handler(unsigned int irq, struct irqdesc *desc, struct struct irqdesc *cpld_desc; int cpld_irq = IXP2000_BOARD_IRQ(0) + i; cpld_desc = irq_desc + cpld_irq; - cpld_desc->handle(cpld_irq, cpld_desc, regs); + desc_handle_irq(cpld_irq, cpld_desc, regs); } } diff --git a/arch/arm/mach-ixp2000/ixdp2x01.c b/arch/arm/mach-ixp2000/ixdp2x01.c index 43447dad165..7a510992128 100644 --- a/arch/arm/mach-ixp2000/ixdp2x01.c +++ b/arch/arm/mach-ixp2000/ixdp2x01.c @@ -82,7 +82,7 @@ static void ixdp2x01_irq_handler(unsigned int irq, struct irqdesc *desc, struct struct irqdesc *cpld_desc; int cpld_irq = IXP2000_BOARD_IRQ(0) + i; cpld_desc = irq_desc + cpld_irq; - cpld_desc->handle(cpld_irq, cpld_desc, regs); + desc_handle_irq(cpld_irq, cpld_desc, regs); } } diff --git a/arch/arm/mach-lh7a40x/common.h b/arch/arm/mach-lh7a40x/common.h index beda7c2602f..578a52461fd 100644 --- a/arch/arm/mach-lh7a40x/common.h +++ b/arch/arm/mach-lh7a40x/common.h @@ -13,4 +13,4 @@ extern struct sys_timer lh7a40x_timer; extern void lh7a400_init_irq (void); extern void lh7a404_init_irq (void); -#define IRQ_DISPATCH(irq) irq_desc[irq].handle ((irq), &irq_desc[irq], regs) +#define IRQ_DISPATCH(irq) desc_handle_irq((irq),(irq_desc + irq), regs) diff --git a/arch/arm/mach-omap1/fpga.c b/arch/arm/mach-omap1/fpga.c index 7c08f6c2e1d..c12a7833562 100644 --- a/arch/arm/mach-omap1/fpga.c +++ b/arch/arm/mach-omap1/fpga.c @@ -102,7 +102,7 @@ void innovator_fpga_IRQ_demux(unsigned int irq, struct irqdesc *desc, fpga_irq++, stat >>= 1) { if (stat & 1) { d = irq_desc + fpga_irq; - d->handle(fpga_irq, d, regs); + desc_handle_irq(fpga_irq, d, regs); } } } diff --git a/arch/arm/mach-pxa/irq.c b/arch/arm/mach-pxa/irq.c index 6cf35f67446..539b596005f 100644 --- a/arch/arm/mach-pxa/irq.c +++ b/arch/arm/mach-pxa/irq.c @@ -157,7 +157,7 @@ static void pxa_gpio_demux_handler(unsigned int irq, struct irqdesc *desc, mask >>= 2; do { if (mask & 1) - desc->handle(irq, desc, regs); + desc_handle_irq(irq, desc, regs); irq++; desc++; mask >>= 1; @@ -172,7 +172,7 @@ static void pxa_gpio_demux_handler(unsigned int irq, struct irqdesc *desc, desc = irq_desc + irq; do { if (mask & 1) - desc->handle(irq, desc, regs); + desc_handle_irq(irq, desc, regs); irq++; desc++; mask >>= 1; @@ -187,7 +187,7 @@ static void pxa_gpio_demux_handler(unsigned int irq, struct irqdesc *desc, desc = irq_desc + irq; do { if (mask & 1) - desc->handle(irq, desc, regs); + desc_handle_irq(irq, desc, regs); irq++; desc++; mask >>= 1; @@ -203,7 +203,7 @@ static void pxa_gpio_demux_handler(unsigned int irq, struct irqdesc *desc, desc = irq_desc + irq; do { if (mask & 1) - desc->handle(irq, desc, regs); + desc_handle_irq(irq, desc, regs); irq++; desc++; mask >>= 1; diff --git a/arch/arm/mach-pxa/lubbock.c b/arch/arm/mach-pxa/lubbock.c index 6309853b59b..923f6eb774c 100644 --- a/arch/arm/mach-pxa/lubbock.c +++ b/arch/arm/mach-pxa/lubbock.c @@ -84,7 +84,7 @@ static void lubbock_irq_handler(unsigned int irq, struct irqdesc *desc, if (likely(pending)) { irq = LUBBOCK_IRQ(0) + __ffs(pending); desc = irq_desc + irq; - desc->handle(irq, desc, regs); + desc_handle_irq(irq, desc, regs); } pending = LUB_IRQ_SET_CLR & lubbock_irq_enabled; } while (pending); diff --git a/arch/arm/mach-pxa/mainstone.c b/arch/arm/mach-pxa/mainstone.c index 827b7b5a5be..85fdb5b1470 100644 --- a/arch/arm/mach-pxa/mainstone.c +++ b/arch/arm/mach-pxa/mainstone.c @@ -72,7 +72,7 @@ static void mainstone_irq_handler(unsigned int irq, struct irqdesc *desc, if (likely(pending)) { irq = MAINSTONE_IRQ(0) + __ffs(pending); desc = irq_desc + irq; - desc->handle(irq, desc, regs); + desc_handle_irq(irq, desc, regs); } pending = MST_INTSETCLR & mainstone_irq_enabled; } while (pending); diff --git a/arch/arm/mach-s3c2410/bast-irq.c b/arch/arm/mach-s3c2410/bast-irq.c index 5e5bbe893cb..49914709fa0 100644 --- a/arch/arm/mach-s3c2410/bast-irq.c +++ b/arch/arm/mach-s3c2410/bast-irq.c @@ -124,7 +124,7 @@ bast_irq_pc104_demux(unsigned int irq, irqno = bast_pc104_irqs[i]; desc = irq_desc + irqno; - desc->handle(irqno, desc, regs); + desc_handle_irq(irqno, desc, regs); } stat >>= 1; diff --git a/arch/arm/mach-s3c2410/irq.c b/arch/arm/mach-s3c2410/irq.c index 67138797866..66d8c068e94 100644 --- a/arch/arm/mach-s3c2410/irq.c +++ b/arch/arm/mach-s3c2410/irq.c @@ -496,11 +496,11 @@ static void s3c_irq_demux_adc(unsigned int irq, if (subsrc != 0) { if (subsrc & 1) { mydesc = irq_desc + IRQ_TC; - mydesc->handle( IRQ_TC, mydesc, regs); + desc_handle_irq(IRQ_TC, mydesc, regs); } if (subsrc & 2) { mydesc = irq_desc + IRQ_ADC; - mydesc->handle(IRQ_ADC, mydesc, regs); + desc_handle_irq(IRQ_ADC, mydesc, regs); } } } @@ -529,17 +529,17 @@ static void s3c_irq_demux_uart(unsigned int start, desc = irq_desc + start; if (subsrc & 1) - desc->handle(start, desc, regs); + desc_handle_irq(start, desc, regs); desc++; if (subsrc & 2) - desc->handle(start+1, desc, regs); + desc_handle_irq(start+1, desc, regs); desc++; if (subsrc & 4) - desc->handle(start+2, desc, regs); + desc_handle_irq(start+2, desc, regs); } } diff --git a/arch/arm/mach-s3c2410/s3c2440-irq.c b/arch/arm/mach-s3c2410/s3c2440-irq.c index 7cb9912242a..278d0044c85 100644 --- a/arch/arm/mach-s3c2410/s3c2440-irq.c +++ b/arch/arm/mach-s3c2410/s3c2440-irq.c @@ -64,11 +64,11 @@ static void s3c_irq_demux_wdtac97(unsigned int irq, if (subsrc != 0) { if (subsrc & 1) { mydesc = irq_desc + IRQ_S3C2440_WDT; - mydesc->handle( IRQ_S3C2440_WDT, mydesc, regs); + desc_handle_irq(IRQ_S3C2440_WDT, mydesc, regs); } if (subsrc & 2) { mydesc = irq_desc + IRQ_S3C2440_AC97; - mydesc->handle(IRQ_S3C2440_AC97, mydesc, regs); + desc_handle_irq(IRQ_S3C2440_AC97, mydesc, regs); } } } @@ -122,11 +122,11 @@ static void s3c_irq_demux_cam(unsigned int irq, if (subsrc != 0) { if (subsrc & 1) { mydesc = irq_desc + IRQ_S3C2440_CAM_C; - mydesc->handle( IRQ_S3C2440_WDT, mydesc, regs); + desc_handle_irq(IRQ_S3C2440_CAM_C, mydesc, regs); } if (subsrc & 2) { mydesc = irq_desc + IRQ_S3C2440_CAM_P; - mydesc->handle(IRQ_S3C2440_AC97, mydesc, regs); + desc_handle_irq(IRQ_S3C2440_CAM_P, mydesc, regs); } } } diff --git a/arch/arm/mach-sa1100/irq.c b/arch/arm/mach-sa1100/irq.c index cc349bc1b7c..c131a5201b5 100644 --- a/arch/arm/mach-sa1100/irq.c +++ b/arch/arm/mach-sa1100/irq.c @@ -126,7 +126,7 @@ sa1100_high_gpio_handler(unsigned int irq, struct irqdesc *desc, mask >>= 11; do { if (mask & 1) - desc->handle(irq, desc, regs); + desc_handle_irq(irq, desc, regs); mask >>= 1; irq++; desc++; diff --git a/arch/arm/mach-sa1100/neponset.c b/arch/arm/mach-sa1100/neponset.c index 1405383463e..fc061641b7b 100644 --- a/arch/arm/mach-sa1100/neponset.c +++ b/arch/arm/mach-sa1100/neponset.c @@ -61,12 +61,12 @@ neponset_irq_handler(unsigned int irq, struct irqdesc *desc, struct pt_regs *reg if (irr & IRR_ETHERNET) { d = irq_desc + IRQ_NEPONSET_SMC9196; - d->handle(IRQ_NEPONSET_SMC9196, d, regs); + desc_handle_irq(IRQ_NEPONSET_SMC9196, d, regs); } if (irr & IRR_USAR) { d = irq_desc + IRQ_NEPONSET_USAR; - d->handle(IRQ_NEPONSET_USAR, d, regs); + desc_handle_irq(IRQ_NEPONSET_USAR, d, regs); } desc->chip->unmask(irq); @@ -74,7 +74,7 @@ neponset_irq_handler(unsigned int irq, struct irqdesc *desc, struct pt_regs *reg if (irr & IRR_SA1111) { d = irq_desc + IRQ_NEPONSET_SA1111; - d->handle(IRQ_NEPONSET_SA1111, d, regs); + desc_handle_irq(IRQ_NEPONSET_SA1111, d, regs); } } } diff --git a/arch/arm/mach-versatile/core.c b/arch/arm/mach-versatile/core.c index f01c0f8a2bb..3c8862fde51 100644 --- a/arch/arm/mach-versatile/core.c +++ b/arch/arm/mach-versatile/core.c @@ -108,7 +108,7 @@ sic_handle_irq(unsigned int irq, struct irqdesc *desc, struct pt_regs *regs) irq += IRQ_SIC_START; desc = irq_desc + irq; - desc->handle(irq, desc, regs); + desc_handle_irq(irq, desc, regs); } while (status); } diff --git a/arch/arm/plat-omap/gpio.c b/arch/arm/plat-omap/gpio.c index 1c85b4e536c..aa481ea3d70 100644 --- a/arch/arm/plat-omap/gpio.c +++ b/arch/arm/plat-omap/gpio.c @@ -590,7 +590,7 @@ static void gpio_irq_handler(unsigned int irq, struct irqdesc *desc, if (!(isr & 1)) continue; d = irq_desc + gpio_irq; - d->handle(gpio_irq, d, regs); + desc_handle_irq(gpio_irq, d, regs); } } diff --git a/include/asm-arm/mach/irq.h b/include/asm-arm/mach/irq.h index bc9763db1d3..0ce6ca588d8 100644 --- a/include/asm-arm/mach/irq.h +++ b/include/asm-arm/mach/irq.h @@ -91,6 +91,14 @@ struct irqdesc { extern struct irqdesc irq_desc[]; +/* + * Helpful inline function for calling irq descriptor handlers. + */ +static inline void desc_handle_irq(unsigned int irq, struct irqdesc *desc, struct pt_regs *regs) +{ + desc->handle(irq, desc, regs); +} + /* * This is internal. Do not use it. */ -- cgit v1.2.3-70-g09d2 From 802f192e4a600f7ef84ca25c8b818c8830acef5a Mon Sep 17 00:00:00 2001 From: Bob Picco Date: Sat, 3 Sep 2005 15:54:26 -0700 Subject: [PATCH] SPARSEMEM EXTREME A new option for SPARSEMEM is ARCH_SPARSEMEM_EXTREME. Architecture platforms with a very sparse physical address space would likely want to select this option. For those architecture platforms that don't select the option, the code generated is equivalent to SPARSEMEM currently in -mm. I'll be posting a patch on ia64 ml which uses this new SPARSEMEM feature. ARCH_SPARSEMEM_EXTREME makes mem_section a one dimensional array of pointers to mem_sections. This two level layout scheme is able to achieve smaller memory requirements for SPARSEMEM with the tradeoff of an additional shift and load when fetching the memory section. The current SPARSEMEM -mm implementation is a one dimensional array of mem_sections which is the default SPARSEMEM configuration. The patch attempts isolates the implementation details of the physical layout of the sparsemem section array. ARCH_SPARSEMEM_EXTREME depends on 64BIT and is by default boolean false. I've boot tested under aim load ia64 configured for ARCH_SPARSEMEM_EXTREME. I've also boot tested a 4 way Opteron machine with !ARCH_SPARSEMEM_EXTREME and tested with aim. Signed-off-by: Andy Whitcroft Signed-off-by: Bob Picco Signed-off-by: Dave Hansen Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- arch/ppc64/mm/init.c | 27 +++++++++------------------ arch/ppc64/mm/numa.c | 43 ++++++++++++++++++++++++++++++++++++++++--- include/asm-ppc64/lmb.h | 22 ++++++++++++++++++++++ include/linux/mmzone.h | 30 ++++++++++++++++++++++++++++-- mm/Kconfig | 9 +++++++++ mm/sparse.c | 38 ++++++++++++++++++++++++++++++++------ 6 files changed, 140 insertions(+), 29 deletions(-) (limited to 'include') diff --git a/arch/ppc64/mm/init.c b/arch/ppc64/mm/init.c index c02dc9809ca..b3b1e9c1770 100644 --- a/arch/ppc64/mm/init.c +++ b/arch/ppc64/mm/init.c @@ -552,27 +552,18 @@ void __init do_init_bootmem(void) /* Add all physical memory to the bootmem map, mark each area * present. */ - for (i=0; i < lmb.memory.cnt; i++) { - unsigned long base, size; - unsigned long start_pfn, end_pfn; - - base = lmb.memory.region[i].base; - size = lmb.memory.region[i].size; - - start_pfn = base >> PAGE_SHIFT; - end_pfn = start_pfn + (size >> PAGE_SHIFT); - memory_present(0, start_pfn, end_pfn); - - free_bootmem(base, size); - } + for (i=0; i < lmb.memory.cnt; i++) + free_bootmem(lmb_start_pfn(&lmb.memory, i), + lmb_size_bytes(&lmb.memory, i)); /* reserve the sections we're already using */ - for (i=0; i < lmb.reserved.cnt; i++) { - unsigned long base = lmb.reserved.region[i].base; - unsigned long size = lmb.reserved.region[i].size; + for (i=0; i < lmb.reserved.cnt; i++) + reserve_bootmem(lmb_start_pfn(&lmb.reserved, i), + lmb_size_bytes(&lmb.reserved, i)); - reserve_bootmem(base, size); - } + for (i=0; i < lmb.memory.cnt; i++) + memory_present(0, lmb_start_pfn(&lmb.memory, i), + lmb_end_pfn(&lmb.memory, i)); } /* diff --git a/arch/ppc64/mm/numa.c b/arch/ppc64/mm/numa.c index c3116f0d788..cb864b8f275 100644 --- a/arch/ppc64/mm/numa.c +++ b/arch/ppc64/mm/numa.c @@ -440,8 +440,6 @@ new_range: for (i = start ; i < (start+size); i += MEMORY_INCREMENT) numa_memory_lookup_table[i >> MEMORY_INCREMENT_SHIFT] = numa_domain; - memory_present(numa_domain, start >> PAGE_SHIFT, - (start + size) >> PAGE_SHIFT); if (--ranges) goto new_range; @@ -483,7 +481,6 @@ static void __init setup_nonnuma(void) for (i = 0 ; i < top_of_ram; i += MEMORY_INCREMENT) numa_memory_lookup_table[i >> MEMORY_INCREMENT_SHIFT] = 0; - memory_present(0, 0, init_node_data[0].node_end_pfn); } static void __init dump_numa_topology(void) @@ -695,6 +692,46 @@ new_range: size); } } + /* + * This loop may look famaliar, but we have to do it again + * after marking our reserved memory to mark memory present + * for sparsemem. + */ + addr_cells = get_mem_addr_cells(); + size_cells = get_mem_size_cells(); + memory = NULL; + while ((memory = of_find_node_by_type(memory, "memory")) != NULL) { + unsigned long mem_start, mem_size; + int numa_domain, ranges; + unsigned int *memcell_buf; + unsigned int len; + + memcell_buf = (unsigned int *)get_property(memory, "reg", &len); + if (!memcell_buf || len <= 0) + continue; + + ranges = memory->n_addrs; /* ranges in cell */ +new_range2: + mem_start = read_n_cells(addr_cells, &memcell_buf); + mem_size = read_n_cells(size_cells, &memcell_buf); + if (numa_enabled) { + numa_domain = of_node_numa_domain(memory); + if (numa_domain >= MAX_NUMNODES) + numa_domain = 0; + } else + numa_domain = 0; + + if (numa_domain != nid) + continue; + + mem_size = numa_enforce_memory_limit(mem_start, mem_size); + memory_present(numa_domain, mem_start >> PAGE_SHIFT, + (mem_start + mem_size) >> PAGE_SHIFT); + + if (--ranges) /* process all ranges in cell */ + goto new_range2; + } + } } diff --git a/include/asm-ppc64/lmb.h b/include/asm-ppc64/lmb.h index cb368bf0f26..de91e034bd9 100644 --- a/include/asm-ppc64/lmb.h +++ b/include/asm-ppc64/lmb.h @@ -56,4 +56,26 @@ extern void lmb_dump_all(void); extern unsigned long io_hole_start; +static inline unsigned long +lmb_size_bytes(struct lmb_region *type, unsigned long region_nr) +{ + return type->region[region_nr].size; +} +static inline unsigned long +lmb_size_pages(struct lmb_region *type, unsigned long region_nr) +{ + return lmb_size_bytes(type, region_nr) >> PAGE_SHIFT; +} +static inline unsigned long +lmb_start_pfn(struct lmb_region *type, unsigned long region_nr) +{ + return type->region[region_nr].base >> PAGE_SHIFT; +} +static inline unsigned long +lmb_end_pfn(struct lmb_region *type, unsigned long region_nr) +{ + return lmb_start_pfn(type, region_nr) + + lmb_size_pages(type, region_nr); +} + #endif /* _PPC64_LMB_H */ diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index 6c90461ed99..b97054bbc39 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h @@ -487,6 +487,28 @@ struct mem_section { unsigned long section_mem_map; }; +#ifdef CONFIG_ARCH_SPARSEMEM_EXTREME +/* + * Should we ever require GCC 4 or later then the flat array scheme + * can be eliminated and a uniform solution for EXTREME and !EXTREME can + * be arrived at. + */ +#define SECTION_ROOT_SHIFT (PAGE_SHIFT-3) +#define SECTION_ROOT_MASK ((1UL<> SECTION_ROOT_SHIFT) +#define NR_SECTION_ROOTS (NR_MEM_SECTIONS >> SECTION_ROOT_SHIFT) + +extern struct mem_section *mem_section[NR_SECTION_ROOTS]; + +static inline struct mem_section *__nr_to_section(unsigned long nr) +{ + if (!mem_section[SECTION_TO_ROOT(nr)]) + return NULL; + return &mem_section[SECTION_TO_ROOT(nr)][nr & SECTION_ROOT_MASK]; +} + +#else + extern struct mem_section mem_section[NR_MEM_SECTIONS]; static inline struct mem_section *__nr_to_section(unsigned long nr) @@ -494,6 +516,10 @@ static inline struct mem_section *__nr_to_section(unsigned long nr) return &mem_section[nr]; } +#define sparse_index_init(_sec, _nid) do {} while (0) + +#endif + /* * We use the lower bits of the mem_map pointer to store * a little bit of information. There should be at least @@ -513,12 +539,12 @@ static inline struct page *__section_mem_map_addr(struct mem_section *section) static inline int valid_section(struct mem_section *section) { - return (section->section_mem_map & SECTION_MARKED_PRESENT); + return (section && (section->section_mem_map & SECTION_MARKED_PRESENT)); } static inline int section_has_mem_map(struct mem_section *section) { - return (section->section_mem_map & SECTION_HAS_MEM_MAP); + return (section && (section->section_mem_map & SECTION_HAS_MEM_MAP)); } static inline int valid_section_nr(unsigned long nr) diff --git a/mm/Kconfig b/mm/Kconfig index cd379936cac..fc644c5c065 100644 --- a/mm/Kconfig +++ b/mm/Kconfig @@ -89,3 +89,12 @@ config NEED_MULTIPLE_NODES config HAVE_MEMORY_PRESENT def_bool y depends on ARCH_HAVE_MEMORY_PRESENT || SPARSEMEM + +# +# Architectecture platforms which require a two level mem_section in SPARSEMEM +# must select this option. This is usually for architecture platforms with +# an extremely sparse physical address space. +# +config ARCH_SPARSEMEM_EXTREME + def_bool n + depends on SPARSEMEM && 64BIT diff --git a/mm/sparse.c b/mm/sparse.c index b54e304df4a..b2b456bf0a5 100644 --- a/mm/sparse.c +++ b/mm/sparse.c @@ -13,7 +13,26 @@ * * 1) mem_section - memory sections, mem_map's for valid memory */ -struct mem_section mem_section[NR_MEM_SECTIONS]; +#ifdef CONFIG_ARCH_SPARSEMEM_EXTREME +struct mem_section *mem_section[NR_SECTION_ROOTS] + ____cacheline_maxaligned_in_smp; + +static void sparse_index_init(unsigned long section, int nid) +{ + unsigned long root = SECTION_TO_ROOT(section); + + if (mem_section[root]) + return; + mem_section[root] = alloc_bootmem_node(NODE_DATA(nid), PAGE_SIZE); + if (mem_section[root]) + memset(mem_section[root], 0, PAGE_SIZE); + else + panic("memory_present: NO MEMORY\n"); +} +#else +struct mem_section mem_section[NR_MEM_SECTIONS] + ____cacheline_maxaligned_in_smp; +#endif EXPORT_SYMBOL(mem_section); /* Record a memory area against a node. */ @@ -24,8 +43,13 @@ void memory_present(int nid, unsigned long start, unsigned long end) start &= PAGE_SECTION_MASK; for (pfn = start; pfn < end; pfn += PAGES_PER_SECTION) { unsigned long section = pfn_to_section_nr(pfn); - if (!mem_section[section].section_mem_map) - mem_section[section].section_mem_map = SECTION_MARKED_PRESENT; + struct mem_section *ms; + + sparse_index_init(section, nid); + + ms = __nr_to_section(section); + if (!ms->section_mem_map) + ms->section_mem_map = SECTION_MARKED_PRESENT; } } @@ -85,6 +109,7 @@ static struct page *sparse_early_mem_map_alloc(unsigned long pnum) { struct page *map; int nid = early_pfn_to_nid(section_nr_to_pfn(pnum)); + struct mem_section *ms = __nr_to_section(pnum); map = alloc_remap(nid, sizeof(struct page) * PAGES_PER_SECTION); if (map) @@ -96,7 +121,7 @@ static struct page *sparse_early_mem_map_alloc(unsigned long pnum) return map; printk(KERN_WARNING "%s: allocation failed\n", __FUNCTION__); - mem_section[pnum].section_mem_map = 0; + ms->section_mem_map = 0; return NULL; } @@ -114,8 +139,9 @@ void sparse_init(void) continue; map = sparse_early_mem_map_alloc(pnum); - if (map) - sparse_init_one_section(&mem_section[pnum], pnum, map); + if (!map) + continue; + sparse_init_one_section(__nr_to_section(pnum), pnum, map); } } -- cgit v1.2.3-70-g09d2 From 3e347261a80b57df792ab9464b5f0ed59add53a8 Mon Sep 17 00:00:00 2001 From: Bob Picco Date: Sat, 3 Sep 2005 15:54:28 -0700 Subject: [PATCH] sparsemem extreme implementation With cleanups from Dave Hansen SPARSEMEM_EXTREME makes mem_section a one dimensional array of pointers to mem_sections. This two level layout scheme is able to achieve smaller memory requirements for SPARSEMEM with the tradeoff of an additional shift and load when fetching the memory section. The current SPARSEMEM implementation is a one dimensional array of mem_sections which is the default SPARSEMEM configuration. The patch attempts isolates the implementation details of the physical layout of the sparsemem section array. SPARSEMEM_EXTREME requires bootmem to be functioning at the time of memory_present() calls. This is not always feasible, so architectures which do not need it may allocate everything statically by using SPARSEMEM_STATIC. Signed-off-by: Andy Whitcroft Signed-off-by: Bob Picco Signed-off-by: Dave Hansen Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- arch/i386/Kconfig | 1 + include/linux/mmzone.h | 40 +++++++++++++++------------------------- mm/Kconfig | 19 ++++++++++++++++--- mm/sparse.c | 26 +++++++++++++++++--------- 4 files changed, 49 insertions(+), 37 deletions(-) (limited to 'include') diff --git a/arch/i386/Kconfig b/arch/i386/Kconfig index 619d843ba23..dcb0ad098c6 100644 --- a/arch/i386/Kconfig +++ b/arch/i386/Kconfig @@ -754,6 +754,7 @@ config NUMA depends on SMP && HIGHMEM64G && (X86_NUMAQ || X86_GENERICARCH || (X86_SUMMIT && ACPI)) default n if X86_PC default y if (X86_NUMAQ || X86_SUMMIT) + select SPARSEMEM_STATIC # Need comments to help the hapless user trying to turn on NUMA support comment "NUMA (NUMA-Q) requires SMP, 64GB highmem support" diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index b97054bbc39..79cf578e21b 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h @@ -487,39 +487,29 @@ struct mem_section { unsigned long section_mem_map; }; -#ifdef CONFIG_ARCH_SPARSEMEM_EXTREME -/* - * Should we ever require GCC 4 or later then the flat array scheme - * can be eliminated and a uniform solution for EXTREME and !EXTREME can - * be arrived at. - */ -#define SECTION_ROOT_SHIFT (PAGE_SHIFT-3) -#define SECTION_ROOT_MASK ((1UL<> SECTION_ROOT_SHIFT) -#define NR_SECTION_ROOTS (NR_MEM_SECTIONS >> SECTION_ROOT_SHIFT) +#ifdef CONFIG_SPARSEMEM_EXTREME +#define SECTIONS_PER_ROOT (PAGE_SIZE / sizeof (struct mem_section)) +#else +#define SECTIONS_PER_ROOT 1 +#endif -extern struct mem_section *mem_section[NR_SECTION_ROOTS]; - -static inline struct mem_section *__nr_to_section(unsigned long nr) -{ - if (!mem_section[SECTION_TO_ROOT(nr)]) - return NULL; - return &mem_section[SECTION_TO_ROOT(nr)][nr & SECTION_ROOT_MASK]; -} +#define SECTION_NR_TO_ROOT(sec) ((sec) / SECTIONS_PER_ROOT) +#define NR_SECTION_ROOTS (NR_MEM_SECTIONS / SECTIONS_PER_ROOT) +#define SECTION_ROOT_MASK (SECTIONS_PER_ROOT - 1) +#ifdef CONFIG_SPARSEMEM_EXTREME +extern struct mem_section *mem_section[NR_SECTION_ROOTS]; #else - -extern struct mem_section mem_section[NR_MEM_SECTIONS]; +extern struct mem_section mem_section[NR_SECTION_ROOTS][SECTIONS_PER_ROOT]; +#endif static inline struct mem_section *__nr_to_section(unsigned long nr) { - return &mem_section[nr]; + if (!mem_section[SECTION_NR_TO_ROOT(nr)]) + return NULL; + return &mem_section[SECTION_NR_TO_ROOT(nr)][nr & SECTION_ROOT_MASK]; } -#define sparse_index_init(_sec, _nid) do {} while (0) - -#endif - /* * We use the lower bits of the mem_map pointer to store * a little bit of information. There should be at least diff --git a/mm/Kconfig b/mm/Kconfig index fc644c5c065..4e9937ac352 100644 --- a/mm/Kconfig +++ b/mm/Kconfig @@ -90,11 +90,24 @@ config HAVE_MEMORY_PRESENT def_bool y depends on ARCH_HAVE_MEMORY_PRESENT || SPARSEMEM +# +# SPARSEMEM_EXTREME (which is the default) does some bootmem +# allocations when memory_present() is called. If this can not +# be done on your architecture, select this option. However, +# statically allocating the mem_section[] array can potentially +# consume vast quantities of .bss, so be careful. +# +# This option will also potentially produce smaller runtime code +# with gcc 3.4 and later. +# +config SPARSEMEM_STATIC + def_bool n + # # Architectecture platforms which require a two level mem_section in SPARSEMEM # must select this option. This is usually for architecture platforms with # an extremely sparse physical address space. # -config ARCH_SPARSEMEM_EXTREME - def_bool n - depends on SPARSEMEM && 64BIT +config SPARSEMEM_EXTREME + def_bool y + depends on SPARSEMEM && !SPARSEMEM_STATIC diff --git a/mm/sparse.c b/mm/sparse.c index b2b456bf0a5..fa01292157a 100644 --- a/mm/sparse.c +++ b/mm/sparse.c @@ -13,28 +13,36 @@ * * 1) mem_section - memory sections, mem_map's for valid memory */ -#ifdef CONFIG_ARCH_SPARSEMEM_EXTREME +#ifdef CONFIG_SPARSEMEM_EXTREME struct mem_section *mem_section[NR_SECTION_ROOTS] ____cacheline_maxaligned_in_smp; +#else +struct mem_section mem_section[NR_SECTION_ROOTS][SECTIONS_PER_ROOT] + ____cacheline_maxaligned_in_smp; +#endif +EXPORT_SYMBOL(mem_section); + +static void sparse_alloc_root(unsigned long root, int nid) +{ +#ifdef CONFIG_SPARSEMEM_EXTREME + mem_section[root] = alloc_bootmem_node(NODE_DATA(nid), PAGE_SIZE); +#endif +} static void sparse_index_init(unsigned long section, int nid) { - unsigned long root = SECTION_TO_ROOT(section); + unsigned long root = SECTION_NR_TO_ROOT(section); if (mem_section[root]) return; - mem_section[root] = alloc_bootmem_node(NODE_DATA(nid), PAGE_SIZE); + + sparse_alloc_root(root, nid); + if (mem_section[root]) memset(mem_section[root], 0, PAGE_SIZE); else panic("memory_present: NO MEMORY\n"); } -#else -struct mem_section mem_section[NR_MEM_SECTIONS] - ____cacheline_maxaligned_in_smp; -#endif -EXPORT_SYMBOL(mem_section); - /* Record a memory area against a node. */ void memory_present(int nid, unsigned long start, unsigned long end) { -- cgit v1.2.3-70-g09d2 From 28ae55c98e4d16eac9a05a8a259d7763ef3aeb18 Mon Sep 17 00:00:00 2001 From: Dave Hansen Date: Sat, 3 Sep 2005 15:54:29 -0700 Subject: [PATCH] sparsemem extreme: hotplug preparation This splits up sparse_index_alloc() into two pieces. This is needed because we'll allocate the memory for the second level in a different place from where we actually consume it to keep the allocation from happening underneath a lock Signed-off-by: Dave Hansen Signed-off-by: Bob Picco Cc: Andy Whitcroft Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- include/linux/mmzone.h | 1 + mm/sparse.c | 53 ++++++++++++++++++++++++++++++++++++++------------ 2 files changed, 42 insertions(+), 12 deletions(-) (limited to 'include') diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index 79cf578e21b..5ed471b58f4 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h @@ -588,6 +588,7 @@ static inline int pfn_valid(unsigned long pfn) void sparse_init(void); #else #define sparse_init() do {} while (0) +#define sparse_index_init(_sec, _nid) do {} while (0) #endif /* CONFIG_SPARSEMEM */ #ifdef CONFIG_NODES_SPAN_OTHER_NODES diff --git a/mm/sparse.c b/mm/sparse.c index fa01292157a..347249a4917 100644 --- a/mm/sparse.c +++ b/mm/sparse.c @@ -6,6 +6,7 @@ #include #include #include +#include #include /* @@ -22,27 +23,55 @@ struct mem_section mem_section[NR_SECTION_ROOTS][SECTIONS_PER_ROOT] #endif EXPORT_SYMBOL(mem_section); -static void sparse_alloc_root(unsigned long root, int nid) -{ #ifdef CONFIG_SPARSEMEM_EXTREME - mem_section[root] = alloc_bootmem_node(NODE_DATA(nid), PAGE_SIZE); -#endif +static struct mem_section *sparse_index_alloc(int nid) +{ + struct mem_section *section = NULL; + unsigned long array_size = SECTIONS_PER_ROOT * + sizeof(struct mem_section); + + section = alloc_bootmem_node(NODE_DATA(nid), array_size); + + if (section) + memset(section, 0, array_size); + + return section; } -static void sparse_index_init(unsigned long section, int nid) +static int sparse_index_init(unsigned long section_nr, int nid) { - unsigned long root = SECTION_NR_TO_ROOT(section); + static spinlock_t index_init_lock = SPIN_LOCK_UNLOCKED; + unsigned long root = SECTION_NR_TO_ROOT(section_nr); + struct mem_section *section; + int ret = 0; if (mem_section[root]) - return; + return -EEXIST; - sparse_alloc_root(root, nid); + section = sparse_index_alloc(nid); + /* + * This lock keeps two different sections from + * reallocating for the same index + */ + spin_lock(&index_init_lock); - if (mem_section[root]) - memset(mem_section[root], 0, PAGE_SIZE); - else - panic("memory_present: NO MEMORY\n"); + if (mem_section[root]) { + ret = -EEXIST; + goto out; + } + + mem_section[root] = section; +out: + spin_unlock(&index_init_lock); + return ret; } +#else /* !SPARSEMEM_EXTREME */ +static inline int sparse_index_init(unsigned long section_nr, int nid) +{ + return 0; +} +#endif + /* Record a memory area against a node. */ void memory_present(int nid, unsigned long start, unsigned long end) { -- cgit v1.2.3-70-g09d2 From fd4fd5aac1282825195c6816ed40a2a6d42db5bf Mon Sep 17 00:00:00 2001 From: Stephen Rothwell Date: Sat, 3 Sep 2005 15:54:30 -0700 Subject: [PATCH] mm: consolidate get_order Someone mentioned that almost all the architectures used basically the same implementation of get_order. This patch consolidates them into asm-generic/page.h and includes that in the appropriate places. The exceptions are ia64 and ppc which have their own (presumably optimised) versions. Signed-off-by: Stephen Rothwell Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- include/asm-alpha/page.h | 16 ++-------------- include/asm-arm/page.h | 16 ++-------------- include/asm-arm26/page.h | 16 ++-------------- include/asm-cris/page.h | 15 ++------------- include/asm-frv/page.h | 17 ++--------------- include/asm-generic/page.h | 26 ++++++++++++++++++++++++++ include/asm-h8300/page.h | 16 ++-------------- include/asm-i386/page.h | 16 ++-------------- include/asm-m32r/page.h | 21 ++------------------- include/asm-m68k/page.h | 16 ++-------------- include/asm-m68knommu/page.h | 16 ++-------------- include/asm-mips/page.h | 16 ++-------------- include/asm-parisc/page.h | 16 ++-------------- include/asm-ppc64/page.h | 17 +++-------------- include/asm-s390/page.h | 16 ++-------------- include/asm-sh/page.h | 20 ++------------------ include/asm-sh64/page.h | 20 ++------------------ include/asm-sparc/page.h | 16 ++-------------- include/asm-sparc64/page.h | 16 ++-------------- include/asm-um/page.h | 16 ++-------------- include/asm-v850/page.h | 21 ++------------------- include/asm-x86_64/page.h | 16 ++-------------- 22 files changed, 69 insertions(+), 312 deletions(-) create mode 100644 include/asm-generic/page.h (limited to 'include') diff --git a/include/asm-alpha/page.h b/include/asm-alpha/page.h index 0577daffc72..fa0b41b164a 100644 --- a/include/asm-alpha/page.h +++ b/include/asm-alpha/page.h @@ -63,20 +63,6 @@ typedef unsigned long pgprot_t; #endif /* STRICT_MM_TYPECHECKS */ -/* Pure 2^n version of get_order */ -extern __inline__ int get_order(unsigned long size) -{ - int order; - - size = (size-1) >> (PAGE_SHIFT-1); - order = -1; - do { - size >>= 1; - order++; - } while (size); - return order; -} - #ifdef USE_48_BIT_KSEG #define PAGE_OFFSET 0xffff800000000000UL #else @@ -112,4 +98,6 @@ extern __inline__ int get_order(unsigned long size) #endif /* __KERNEL__ */ +#include + #endif /* _ALPHA_PAGE_H */ diff --git a/include/asm-arm/page.h b/include/asm-arm/page.h index 019c45d7573..4da1d532cbe 100644 --- a/include/asm-arm/page.h +++ b/include/asm-arm/page.h @@ -163,20 +163,6 @@ typedef unsigned long pgprot_t; /* the upper-most page table pointer */ extern pmd_t *top_pmd; -/* Pure 2^n version of get_order */ -static inline int get_order(unsigned long size) -{ - int order; - - size = (size-1) >> (PAGE_SHIFT-1); - order = -1; - do { - size >>= 1; - order++; - } while (size); - return order; -} - #include #endif /* !__ASSEMBLY__ */ @@ -186,4 +172,6 @@ static inline int get_order(unsigned long size) #endif /* __KERNEL__ */ +#include + #endif diff --git a/include/asm-arm26/page.h b/include/asm-arm26/page.h index c334079b082..d3f23ac4d46 100644 --- a/include/asm-arm26/page.h +++ b/include/asm-arm26/page.h @@ -89,20 +89,6 @@ typedef unsigned long pgprot_t; #ifdef __KERNEL__ #ifndef __ASSEMBLY__ -/* Pure 2^n version of get_order */ -static inline int get_order(unsigned long size) -{ - int order; - - size = (size-1) >> (PAGE_SHIFT-1); - order = -1; - do { - size >>= 1; - order++; - } while (size); - return order; -} - #include #endif /* !__ASSEMBLY__ */ @@ -112,4 +98,6 @@ static inline int get_order(unsigned long size) #endif /* __KERNEL__ */ +#include + #endif diff --git a/include/asm-cris/page.h b/include/asm-cris/page.h index bbf17bd3938..c99c478c482 100644 --- a/include/asm-cris/page.h +++ b/include/asm-cris/page.h @@ -70,19 +70,6 @@ typedef struct { unsigned long pgprot; } pgprot_t; #ifndef __ASSEMBLY__ -/* Pure 2^n version of get_order */ -static inline int get_order(unsigned long size) -{ - int order; - - size = (size-1) >> (PAGE_SHIFT-1); - order = -1; - do { - size >>= 1; - order++; - } while (size); - return order; -} #endif /* __ASSEMBLY__ */ #define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \ @@ -90,5 +77,7 @@ static inline int get_order(unsigned long size) #endif /* __KERNEL__ */ +#include + #endif /* _CRIS_PAGE_H */ diff --git a/include/asm-frv/page.h b/include/asm-frv/page.h index f7914f1782b..4feba567e7f 100644 --- a/include/asm-frv/page.h +++ b/include/asm-frv/page.h @@ -45,21 +45,6 @@ typedef struct { unsigned long pgprot; } pgprot_t; /* to align the pointer to the (next) page boundary */ #define PAGE_ALIGN(addr) (((addr) + PAGE_SIZE - 1) & PAGE_MASK) -/* Pure 2^n version of get_order */ -static inline int get_order(unsigned long size) __attribute_const__; -static inline int get_order(unsigned long size) -{ - int order; - - size = (size - 1) >> (PAGE_SHIFT - 1); - order = -1; - do { - size >>= 1; - order++; - } while (size); - return order; -} - #define devmem_is_allowed(pfn) 1 #define __pa(vaddr) virt_to_phys((void *) vaddr) @@ -102,4 +87,6 @@ extern unsigned long max_pfn; #define WANT_PAGE_VIRTUAL 1 #endif +#include + #endif /* _ASM_PAGE_H */ diff --git a/include/asm-generic/page.h b/include/asm-generic/page.h new file mode 100644 index 00000000000..a96b5d986b6 --- /dev/null +++ b/include/asm-generic/page.h @@ -0,0 +1,26 @@ +#ifndef _ASM_GENERIC_PAGE_H +#define _ASM_GENERIC_PAGE_H + +#ifdef __KERNEL__ +#ifndef __ASSEMBLY__ + +#include + +/* Pure 2^n version of get_order */ +static __inline__ __attribute_const__ int get_order(unsigned long size) +{ + int order; + + size = (size - 1) >> (PAGE_SHIFT - 1); + order = -1; + do { + size >>= 1; + order++; + } while (size); + return order; +} + +#endif /* __ASSEMBLY__ */ +#endif /* __KERNEL__ */ + +#endif /* _ASM_GENERIC_PAGE_H */ diff --git a/include/asm-h8300/page.h b/include/asm-h8300/page.h index e3b7960d445..e8c02b8c2d9 100644 --- a/include/asm-h8300/page.h +++ b/include/asm-h8300/page.h @@ -54,20 +54,6 @@ typedef struct { unsigned long pgprot; } pgprot_t; /* to align the pointer to the (next) page boundary */ #define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK) -/* Pure 2^n version of get_order */ -extern __inline__ int get_order(unsigned long size) -{ - int order; - - size = (size-1) >> (PAGE_SHIFT-1); - order = -1; - do { - size >>= 1; - order++; - } while (size); - return order; -} - extern unsigned long memory_start; extern unsigned long memory_end; @@ -101,4 +87,6 @@ extern unsigned long memory_end; #endif /* __KERNEL__ */ +#include + #endif /* _H8300_PAGE_H */ diff --git a/include/asm-i386/page.h b/include/asm-i386/page.h index 8d93f732d72..10045fd8210 100644 --- a/include/asm-i386/page.h +++ b/include/asm-i386/page.h @@ -104,20 +104,6 @@ typedef struct { unsigned long pgprot; } pgprot_t; */ extern unsigned int __VMALLOC_RESERVE; -/* Pure 2^n version of get_order */ -static __inline__ int get_order(unsigned long size) -{ - int order; - - size = (size-1) >> (PAGE_SHIFT-1); - order = -1; - do { - size >>= 1; - order++; - } while (size); - return order; -} - extern int sysctl_legacy_va_layout; extern int page_is_ram(unsigned long pagenr); @@ -156,4 +142,6 @@ extern int page_is_ram(unsigned long pagenr); #endif /* __KERNEL__ */ +#include + #endif /* _I386_PAGE_H */ diff --git a/include/asm-m32r/page.h b/include/asm-m32r/page.h index 1c6abb9f3f1..4ab57887636 100644 --- a/include/asm-m32r/page.h +++ b/include/asm-m32r/page.h @@ -61,25 +61,6 @@ typedef struct { unsigned long pgprot; } pgprot_t; /* This handles the memory map.. */ -#ifndef __ASSEMBLY__ - -/* Pure 2^n version of get_order */ -static __inline__ int get_order(unsigned long size) -{ - int order; - - size = (size - 1) >> (PAGE_SHIFT - 1); - order = -1; - do { - size >>= 1; - order++; - } while (size); - - return order; -} - -#endif /* __ASSEMBLY__ */ - #define __MEMORY_START CONFIG_MEMORY_START #define __MEMORY_SIZE CONFIG_MEMORY_SIZE @@ -111,5 +92,7 @@ static __inline__ int get_order(unsigned long size) #endif /* __KERNEL__ */ +#include + #endif /* _ASM_M32R_PAGE_H */ diff --git a/include/asm-m68k/page.h b/include/asm-m68k/page.h index 206313e2a81..f206dfbc1d4 100644 --- a/include/asm-m68k/page.h +++ b/include/asm-m68k/page.h @@ -107,20 +107,6 @@ typedef struct { unsigned long pgprot; } pgprot_t; /* to align the pointer to the (next) page boundary */ #define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK) -/* Pure 2^n version of get_order */ -static inline int get_order(unsigned long size) -{ - int order; - - size = (size-1) >> (PAGE_SHIFT-1); - order = -1; - do { - size >>= 1; - order++; - } while (size); - return order; -} - #endif /* !__ASSEMBLY__ */ #include @@ -192,4 +178,6 @@ static inline void *__va(unsigned long x) #endif /* __KERNEL__ */ +#include + #endif /* _M68K_PAGE_H */ diff --git a/include/asm-m68knommu/page.h b/include/asm-m68knommu/page.h index ff6a9265ed1..942dfbead27 100644 --- a/include/asm-m68knommu/page.h +++ b/include/asm-m68knommu/page.h @@ -48,20 +48,6 @@ typedef struct { unsigned long pgprot; } pgprot_t; /* to align the pointer to the (next) page boundary */ #define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK) -/* Pure 2^n version of get_order */ -extern __inline__ int get_order(unsigned long size) -{ - int order; - - size = (size-1) >> (PAGE_SHIFT-1); - order = -1; - do { - size >>= 1; - order++; - } while (size); - return order; -} - extern unsigned long memory_start; extern unsigned long memory_end; @@ -93,4 +79,6 @@ extern unsigned long memory_end; #endif /* __KERNEL__ */ +#include + #endif /* _M68KNOMMU_PAGE_H */ diff --git a/include/asm-mips/page.h b/include/asm-mips/page.h index 5cae35cd9ba..652b6d67a57 100644 --- a/include/asm-mips/page.h +++ b/include/asm-mips/page.h @@ -103,20 +103,6 @@ typedef struct { unsigned long pgprot; } pgprot_t; #define __pgd(x) ((pgd_t) { (x) } ) #define __pgprot(x) ((pgprot_t) { (x) } ) -/* Pure 2^n version of get_order */ -static __inline__ int get_order(unsigned long size) -{ - int order; - - size = (size-1) >> (PAGE_SHIFT-1); - order = -1; - do { - size >>= 1; - order++; - } while (size); - return order; -} - #endif /* !__ASSEMBLY__ */ /* to align the pointer to the (next) page boundary */ @@ -148,4 +134,6 @@ static __inline__ int get_order(unsigned long size) #define WANT_PAGE_VIRTUAL #endif +#include + #endif /* _ASM_PAGE_H */ diff --git a/include/asm-parisc/page.h b/include/asm-parisc/page.h index 4a12692f94b..44eae9f8274 100644 --- a/include/asm-parisc/page.h +++ b/include/asm-parisc/page.h @@ -74,20 +74,6 @@ typedef struct { unsigned long pgprot; } pgprot_t; #define __pgd(x) ((pgd_t) { (x) } ) #define __pgprot(x) ((pgprot_t) { (x) } ) -/* Pure 2^n version of get_order */ -extern __inline__ int get_order(unsigned long size) -{ - int order; - - size = (size-1) >> (PAGE_SHIFT-1); - order = -1; - do { - size >>= 1; - order++; - } while (size); - return order; -} - typedef struct __physmem_range { unsigned long start_pfn; unsigned long pages; /* PAGE_SIZE pages */ @@ -159,4 +145,6 @@ extern int npmem_ranges; #endif /* __KERNEL__ */ +#include + #endif /* _PARISC_PAGE_H */ diff --git a/include/asm-ppc64/page.h b/include/asm-ppc64/page.h index a79a08df62b..a15422bcf30 100644 --- a/include/asm-ppc64/page.h +++ b/include/asm-ppc64/page.h @@ -172,20 +172,6 @@ typedef unsigned long pgprot_t; #endif -/* Pure 2^n version of get_order */ -static inline int get_order(unsigned long size) -{ - int order; - - size = (size-1) >> (PAGE_SHIFT-1); - order = -1; - do { - size >>= 1; - order++; - } while (size); - return order; -} - #define __pa(x) ((unsigned long)(x)-PAGE_OFFSET) extern int page_is_ram(unsigned long pfn); @@ -270,4 +256,7 @@ extern u64 ppc64_pft_size; /* Log 2 of page table size */ VM_STACK_DEFAULT_FLAGS32 : VM_STACK_DEFAULT_FLAGS64) #endif /* __KERNEL__ */ + +#include + #endif /* _PPC64_PAGE_H */ diff --git a/include/asm-s390/page.h b/include/asm-s390/page.h index 2be287b9df8..2430c561e02 100644 --- a/include/asm-s390/page.h +++ b/include/asm-s390/page.h @@ -111,20 +111,6 @@ static inline void copy_page(void *to, void *from) #define alloc_zeroed_user_highpage(vma, vaddr) alloc_page_vma(GFP_HIGHUSER | __GFP_ZERO, vma, vaddr) #define __HAVE_ARCH_ALLOC_ZEROED_USER_HIGHPAGE -/* Pure 2^n version of get_order */ -extern __inline__ int get_order(unsigned long size) -{ - int order; - - size = (size-1) >> (PAGE_SHIFT-1); - order = -1; - do { - size >>= 1; - order++; - } while (size); - return order; -} - /* * These are used to make use of C type-checking.. */ @@ -207,4 +193,6 @@ page_get_storage_key(unsigned long addr) #endif /* __KERNEL__ */ +#include + #endif /* _S390_PAGE_H */ diff --git a/include/asm-sh/page.h b/include/asm-sh/page.h index 180467be8e7..324e6cc5ecf 100644 --- a/include/asm-sh/page.h +++ b/include/asm-sh/page.h @@ -122,24 +122,8 @@ typedef struct { unsigned long pgprot; } pgprot_t; #define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \ VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) -#ifndef __ASSEMBLY__ - -/* Pure 2^n version of get_order */ -static __inline__ int get_order(unsigned long size) -{ - int order; - - size = (size-1) >> (PAGE_SHIFT-1); - order = -1; - do { - size >>= 1; - order++; - } while (size); - return order; -} - -#endif - #endif /* __KERNEL__ */ +#include + #endif /* __ASM_SH_PAGE_H */ diff --git a/include/asm-sh64/page.h b/include/asm-sh64/page.h index d6167f1c0e9..c86df90f7cb 100644 --- a/include/asm-sh64/page.h +++ b/include/asm-sh64/page.h @@ -115,24 +115,8 @@ typedef struct { unsigned long pgprot; } pgprot_t; #define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \ VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) -#ifndef __ASSEMBLY__ - -/* Pure 2^n version of get_order */ -extern __inline__ int get_order(unsigned long size) -{ - int order; - - size = (size-1) >> (PAGE_SHIFT-1); - order = -1; - do { - size >>= 1; - order++; - } while (size); - return order; -} - -#endif - #endif /* __KERNEL__ */ +#include + #endif /* __ASM_SH64_PAGE_H */ diff --git a/include/asm-sparc/page.h b/include/asm-sparc/page.h index 383060e90d9..9122684f6c1 100644 --- a/include/asm-sparc/page.h +++ b/include/asm-sparc/page.h @@ -132,20 +132,6 @@ BTFIXUPDEF_SETHI(sparc_unmapped_base) #define TASK_UNMAPPED_BASE BTFIXUP_SETHI(sparc_unmapped_base) -/* Pure 2^n version of get_order */ -extern __inline__ int get_order(unsigned long size) -{ - int order; - - size = (size-1) >> (PAGE_SHIFT-1); - order = -1; - do { - size >>= 1; - order++; - } while (size); - return order; -} - #else /* !(__ASSEMBLY__) */ #define __pgprot(x) (x) @@ -178,4 +164,6 @@ extern unsigned long pfn_base; #endif /* __KERNEL__ */ +#include + #endif /* _SPARC_PAGE_H */ diff --git a/include/asm-sparc64/page.h b/include/asm-sparc64/page.h index b87dbbd64bc..c9f8ef208ea 100644 --- a/include/asm-sparc64/page.h +++ b/include/asm-sparc64/page.h @@ -150,20 +150,6 @@ struct sparc_phys_banks { extern struct sparc_phys_banks sp_banks[SPARC_PHYS_BANKS]; -/* Pure 2^n version of get_order */ -static __inline__ int get_order(unsigned long size) -{ - int order; - - size = (size-1) >> (PAGE_SHIFT-1); - order = -1; - do { - size >>= 1; - order++; - } while (size); - return order; -} - #endif /* !(__ASSEMBLY__) */ #define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \ @@ -171,4 +157,6 @@ static __inline__ int get_order(unsigned long size) #endif /* !(__KERNEL__) */ +#include + #endif /* !(_SPARC64_PAGE_H) */ diff --git a/include/asm-um/page.h b/include/asm-um/page.h index f58aedadeb4..bd850a24918 100644 --- a/include/asm-um/page.h +++ b/include/asm-um/page.h @@ -116,24 +116,12 @@ extern void *to_virt(unsigned long phys); #define pfn_valid(pfn) ((pfn) < max_mapnr) #define virt_addr_valid(v) pfn_valid(phys_to_pfn(__pa(v))) -/* Pure 2^n version of get_order */ -static __inline__ int get_order(unsigned long size) -{ - int order; - - size = (size-1) >> (PAGE_SHIFT-1); - order = -1; - do { - size >>= 1; - order++; - } while (size); - return order; -} - extern struct page *arch_validate(struct page *page, int mask, int order); #define HAVE_ARCH_VALIDATE extern void arch_free_page(struct page *page, int order); #define HAVE_ARCH_FREE_PAGE +#include + #endif diff --git a/include/asm-v850/page.h b/include/asm-v850/page.h index d6091622935..b4bc85e7b91 100644 --- a/include/asm-v850/page.h +++ b/include/asm-v850/page.h @@ -98,25 +98,6 @@ typedef unsigned long pgprot_t; #define PAGE_ALIGN(addr) (((addr) + PAGE_SIZE - 1) & PAGE_MASK) -#ifndef __ASSEMBLY__ - -/* Pure 2^n version of get_order */ -extern __inline__ int get_order (unsigned long size) -{ - int order; - - size = (size-1) >> (PAGE_SHIFT-1); - order = -1; - do { - size >>= 1; - order++; - } while (size); - return order; -} - -#endif /* !__ASSEMBLY__ */ - - /* No current v850 processor has virtual memory. */ #define __virt_to_phys(addr) (addr) #define __phys_to_virt(addr) (addr) @@ -144,4 +125,6 @@ extern __inline__ int get_order (unsigned long size) #endif /* KERNEL */ +#include + #endif /* __V850_PAGE_H__ */ diff --git a/include/asm-x86_64/page.h b/include/asm-x86_64/page.h index 431318764af..fcf890aa8c8 100644 --- a/include/asm-x86_64/page.h +++ b/include/asm-x86_64/page.h @@ -92,20 +92,6 @@ typedef struct { unsigned long pgprot; } pgprot_t; #include -/* Pure 2^n version of get_order */ -extern __inline__ int get_order(unsigned long size) -{ - int order; - - size = (size-1) >> (PAGE_SHIFT-1); - order = -1; - do { - size >>= 1; - order++; - } while (size); - return order; -} - #endif /* __ASSEMBLY__ */ #define PAGE_OFFSET ((unsigned long)__PAGE_OFFSET) @@ -141,4 +127,6 @@ extern __inline__ int get_order(unsigned long size) #endif /* __KERNEL__ */ +#include + #endif /* _X86_64_PAGE_H */ -- cgit v1.2.3-70-g09d2 From 11d31886dbcb61039ed3789e583d21c6e70960fd Mon Sep 17 00:00:00 2001 From: Hugh Dickins Date: Sat, 3 Sep 2005 15:54:34 -0700 Subject: [PATCH] swap: swap extent list is ordered There are several comments that swap's extent_list.prev points to the lowest extent: that's not so, it's extent_list.next which points to it, as you'd expect. And a couple of loops in add_swap_extent which go all the way through the list, when they should just add to the other end. Fix those up, and let map_swap_page search the list forwards: profiles shows it to be twice as quick that way - because prefetch works better on how the structs are typically kmalloc'ed? or because usually more is written to than read from swap, and swap is allocated ascendingly? Signed-off-by: Hugh Dickins Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- include/linux/swap.h | 2 -- mm/swapfile.c | 27 +++++++++------------------ 2 files changed, 9 insertions(+), 20 deletions(-) (limited to 'include') diff --git a/include/linux/swap.h b/include/linux/swap.h index bfe3e763ccf..38f288475e6 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h @@ -116,8 +116,6 @@ enum { /* * The in-memory structure used to track swap areas. - * extent_list.prev points at the lowest-index extent. That list is - * sorted. */ struct swap_info_struct { unsigned int flags; diff --git a/mm/swapfile.c b/mm/swapfile.c index 4b39e9501d4..73521d39e98 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -832,9 +832,9 @@ sector_t map_swap_page(struct swap_info_struct *sis, pgoff_t offset) offset < (se->start_page + se->nr_pages)) { return se->start_block + (offset - se->start_page); } - lh = se->list.prev; + lh = se->list.next; if (lh == &sis->extent_list) - lh = lh->prev; + lh = lh->next; se = list_entry(lh, struct swap_extent, list); sis->curr_swap_extent = se; BUG_ON(se == start_se); /* It *must* be present */ @@ -859,10 +859,9 @@ static void destroy_swap_extents(struct swap_info_struct *sis) /* * Add a block range (and the corresponding page range) into this swapdev's - * extent list. The extent list is kept sorted in block order. + * extent list. The extent list is kept sorted in page order. * - * This function rather assumes that it is called in ascending sector_t order. - * It doesn't look for extent coalescing opportunities. + * This function rather assumes that it is called in ascending page order. */ static int add_swap_extent(struct swap_info_struct *sis, unsigned long start_page, @@ -872,16 +871,15 @@ add_swap_extent(struct swap_info_struct *sis, unsigned long start_page, struct swap_extent *new_se; struct list_head *lh; - lh = sis->extent_list.next; /* The highest-addressed block */ - while (lh != &sis->extent_list) { + lh = sis->extent_list.prev; /* The highest page extent */ + if (lh != &sis->extent_list) { se = list_entry(lh, struct swap_extent, list); - if (se->start_block + se->nr_pages == start_block && - se->start_page + se->nr_pages == start_page) { + BUG_ON(se->start_page + se->nr_pages != start_page); + if (se->start_block + se->nr_pages == start_block) { /* Merge it */ se->nr_pages += nr_pages; return 0; } - lh = lh->next; } /* @@ -894,14 +892,7 @@ add_swap_extent(struct swap_info_struct *sis, unsigned long start_page, new_se->nr_pages = nr_pages; new_se->start_block = start_block; - lh = sis->extent_list.prev; /* The lowest block */ - while (lh != &sis->extent_list) { - se = list_entry(lh, struct swap_extent, list); - if (se->start_block > start_block) - break; - lh = lh->prev; - } - list_add_tail(&new_se->list, lh); + list_add_tail(&new_se->list, &sis->extent_list); sis->nr_extents++; return 0; } -- cgit v1.2.3-70-g09d2 From 53092a7402f227151a681b0c92ec8598c5618b1a Mon Sep 17 00:00:00 2001 From: Hugh Dickins Date: Sat, 3 Sep 2005 15:54:34 -0700 Subject: [PATCH] swap: show span of swap extents The "Adding %dk swap" message shows the number of swap extents, as a guide to how fragmented the swapfile may be. But a useful further guide is what total extent they span across (sometimes scarily large). And there's no need to keep nr_extents in swap_info: it's unused after the initial message, so save a little space by keeping it on stack. Signed-off-by: Hugh Dickins Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- include/linux/swap.h | 1 - mm/swapfile.c | 44 ++++++++++++++++++++++++++++++-------------- 2 files changed, 30 insertions(+), 15 deletions(-) (limited to 'include') diff --git a/include/linux/swap.h b/include/linux/swap.h index 38f288475e6..f2b16ac0b53 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h @@ -123,7 +123,6 @@ struct swap_info_struct { struct file *swap_file; struct block_device *bdev; struct list_head extent_list; - int nr_extents; struct swap_extent *curr_swap_extent; unsigned old_block_size; unsigned short * swap_map; diff --git a/mm/swapfile.c b/mm/swapfile.c index 73521d39e98..d4da84ee392 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -854,7 +854,6 @@ static void destroy_swap_extents(struct swap_info_struct *sis) list_del(&se->list); kfree(se); } - sis->nr_extents = 0; } /* @@ -893,8 +892,7 @@ add_swap_extent(struct swap_info_struct *sis, unsigned long start_page, new_se->start_block = start_block; list_add_tail(&new_se->list, &sis->extent_list); - sis->nr_extents++; - return 0; + return 1; } /* @@ -928,7 +926,7 @@ add_swap_extent(struct swap_info_struct *sis, unsigned long start_page, * This is extremely effective. The average number of iterations in * map_swap_page() has been measured at about 0.3 per page. - akpm. */ -static int setup_swap_extents(struct swap_info_struct *sis) +static int setup_swap_extents(struct swap_info_struct *sis, sector_t *span) { struct inode *inode; unsigned blocks_per_page; @@ -936,11 +934,15 @@ static int setup_swap_extents(struct swap_info_struct *sis) unsigned blkbits; sector_t probe_block; sector_t last_block; + sector_t lowest_block = -1; + sector_t highest_block = 0; + int nr_extents = 0; int ret; inode = sis->swap_file->f_mapping->host; if (S_ISBLK(inode->i_mode)) { ret = add_swap_extent(sis, 0, sis->max, 0); + *span = sis->pages; goto done; } @@ -985,19 +987,28 @@ static int setup_swap_extents(struct swap_info_struct *sis) } } + first_block >>= (PAGE_SHIFT - blkbits); + if (page_no) { /* exclude the header page */ + if (first_block < lowest_block) + lowest_block = first_block; + if (first_block > highest_block) + highest_block = first_block; + } + /* * We found a PAGE_SIZE-length, PAGE_SIZE-aligned run of blocks */ - ret = add_swap_extent(sis, page_no, 1, - first_block >> (PAGE_SHIFT - blkbits)); - if (ret) + ret = add_swap_extent(sis, page_no, 1, first_block); + if (ret < 0) goto out; + nr_extents += ret; page_no++; probe_block += blocks_per_page; reprobe: continue; } - ret = 0; + ret = nr_extents; + *span = 1 + highest_block - lowest_block; if (page_no == 0) page_no = 1; /* force Empty message */ sis->max = page_no; @@ -1265,6 +1276,8 @@ asmlinkage long sys_swapon(const char __user * specialfile, int swap_flags) union swap_header *swap_header = NULL; int swap_header_version; int nr_good_pages = 0; + int nr_extents; + sector_t span; unsigned long maxpages = 1; int swapfilesize; unsigned short *swap_map; @@ -1300,7 +1313,6 @@ asmlinkage long sys_swapon(const char __user * specialfile, int swap_flags) nr_swapfiles = type+1; INIT_LIST_HEAD(&p->extent_list); p->flags = SWP_USED; - p->nr_extents = 0; p->swap_file = NULL; p->old_block_size = 0; p->swap_map = NULL; @@ -1477,9 +1489,11 @@ asmlinkage long sys_swapon(const char __user * specialfile, int swap_flags) p->swap_map[0] = SWAP_MAP_BAD; p->max = maxpages; p->pages = nr_good_pages; - error = setup_swap_extents(p); - if (error) + nr_extents = setup_swap_extents(p, &span); + if (nr_extents < 0) { + error = nr_extents; goto bad_swap; + } nr_good_pages = p->pages; } if (!nr_good_pages) { @@ -1494,9 +1508,11 @@ asmlinkage long sys_swapon(const char __user * specialfile, int swap_flags) p->flags = SWP_ACTIVE; nr_swap_pages += nr_good_pages; total_swap_pages += nr_good_pages; - printk(KERN_INFO "Adding %dk swap on %s. Priority:%d extents:%d\n", - nr_good_pages<<(PAGE_SHIFT-10), name, - p->prio, p->nr_extents); + + printk(KERN_INFO "Adding %dk swap on %s. " + "Priority:%d extents:%d across:%lluk\n", + nr_good_pages<<(PAGE_SHIFT-10), name, p->prio, + nr_extents, (unsigned long long)span<<(PAGE_SHIFT-10)); /* insert swap space into swap_list: */ prev = -1; -- cgit v1.2.3-70-g09d2 From 6eb396dc4a9781c5e7951143ab56ce5710687ab3 Mon Sep 17 00:00:00 2001 From: Hugh Dickins Date: Sat, 3 Sep 2005 15:54:35 -0700 Subject: [PATCH] swap: swap unsigned int consistency The swap header's unsigned int last_page determines the range of swap pages, but swap_info has been using int or unsigned long in some cases: use unsigned int throughout (except, in several places a local unsigned long is useful to avoid overflows when adding). Signed-off-by: Hugh Dickins Signed-off-by: Jens Axboe Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- include/linux/swap.h | 6 +++--- mm/swapfile.c | 19 ++++++++++--------- 2 files changed, 13 insertions(+), 12 deletions(-) (limited to 'include') diff --git a/include/linux/swap.h b/include/linux/swap.h index f2b16ac0b53..93f0eca7f91 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h @@ -130,10 +130,10 @@ struct swap_info_struct { unsigned int highest_bit; unsigned int cluster_next; unsigned int cluster_nr; + unsigned int pages; + unsigned int max; + unsigned int inuse_pages; int prio; /* swap priority */ - int pages; - unsigned long max; - unsigned long inuse_pages; int next; /* next entry on swap list */ }; diff --git a/mm/swapfile.c b/mm/swapfile.c index d4da84ee392..6cc6dfb4d27 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -84,7 +84,7 @@ void swap_unplug_io_fn(struct backing_dev_info *unused_bdi, struct page *page) up_read(&swap_unplug_sem); } -static inline int scan_swap_map(struct swap_info_struct *si) +static inline unsigned long scan_swap_map(struct swap_info_struct *si) { unsigned long offset; /* @@ -531,10 +531,11 @@ static int unuse_mm(struct mm_struct *mm, * Scan swap_map from current position to next entry still in use. * Recycle to start on reaching the end, returning 0 when empty. */ -static int find_next_to_unuse(struct swap_info_struct *si, int prev) +static unsigned int find_next_to_unuse(struct swap_info_struct *si, + unsigned int prev) { - int max = si->max; - int i = prev; + unsigned int max = si->max; + unsigned int i = prev; int count; /* @@ -577,7 +578,7 @@ static int try_to_unuse(unsigned int type) unsigned short swcount; struct page *page; swp_entry_t entry; - int i = 0; + unsigned int i = 0; int retval = 0; int reset_overflow = 0; int shmem; @@ -1216,7 +1217,7 @@ static int swap_show(struct seq_file *swap, void *v) file = ptr->swap_file; len = seq_path(swap, file->f_vfsmnt, file->f_dentry, " \t\n\\"); - seq_printf(swap, "%*s%s\t%d\t%ld\t%d\n", + seq_printf(swap, "%*s%s\t%u\t%u\t%d\n", len < 40 ? 40 - len : 1, " ", S_ISBLK(file->f_dentry->d_inode->i_mode) ? "partition" : "file\t", @@ -1275,8 +1276,8 @@ asmlinkage long sys_swapon(const char __user * specialfile, int swap_flags) static int least_priority; union swap_header *swap_header = NULL; int swap_header_version; - int nr_good_pages = 0; - int nr_extents; + unsigned int nr_good_pages = 0; + int nr_extents = 0; sector_t span; unsigned long maxpages = 1; int swapfilesize; @@ -1509,7 +1510,7 @@ asmlinkage long sys_swapon(const char __user * specialfile, int swap_flags) nr_swap_pages += nr_good_pages; total_swap_pages += nr_good_pages; - printk(KERN_INFO "Adding %dk swap on %s. " + printk(KERN_INFO "Adding %uk swap on %s. " "Priority:%d extents:%d across:%lluk\n", nr_good_pages<<(PAGE_SHIFT-10), name, p->prio, nr_extents, (unsigned long long)span<<(PAGE_SHIFT-10)); -- cgit v1.2.3-70-g09d2 From 52b7efdbe5f5696fc80338560a3fc51e0b0a993c Mon Sep 17 00:00:00 2001 From: Hugh Dickins Date: Sat, 3 Sep 2005 15:54:39 -0700 Subject: [PATCH] swap: scan_swap_map drop swap_device_lock get_swap_page has often shown up on latency traces, doing lengthy scans while holding two spinlocks. swap_list_lock is already dropped, now scan_swap_map drop swap_device_lock before scanning the swap_map. While scanning for an empty cluster, don't worry that racing tasks may allocate what was free and free what was allocated; but when allocating an entry, check it's still free after retaking the lock. Avoid dropping the lock in the expected common path. No barriers beyond the locks, just let the cookie crumble; highest_bit limit is volatile, but benign. Guard against swapoff: must check SWP_WRITEOK before allocating, must raise SWP_SCANNING reference count while in scan_swap_map, swapoff wait for that to fall - just use schedule_timeout, we don't want to burden scan_swap_map itself, and it's very unlikely that anyone can really still be in scan_swap_map once swapoff gets this far. Signed-off-by: Hugh Dickins Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- include/linux/swap.h | 2 ++ mm/swapfile.c | 42 +++++++++++++++++++++++++++++++++++------- 2 files changed, 37 insertions(+), 7 deletions(-) (limited to 'include') diff --git a/include/linux/swap.h b/include/linux/swap.h index 93f0eca7f91..db3b5de7c92 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h @@ -107,6 +107,8 @@ enum { SWP_USED = (1 << 0), /* is slot in swap_info[] used? */ SWP_WRITEOK = (1 << 1), /* ok to write to this swap? */ SWP_ACTIVE = (SWP_USED | SWP_WRITEOK), + /* add others here before... */ + SWP_SCANNING = (1 << 8), /* refcount in scan_swap_map */ }; #define SWAP_CLUSTER_MAX 32 diff --git a/mm/swapfile.c b/mm/swapfile.c index c70248aab53..fdee145afc6 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -98,10 +98,12 @@ static inline unsigned long scan_swap_map(struct swap_info_struct *si) * But we do now try to find an empty cluster. -Andrea */ + si->flags += SWP_SCANNING; if (unlikely(!si->cluster_nr)) { si->cluster_nr = SWAPFILE_CLUSTER - 1; if (si->pages - si->inuse_pages < SWAPFILE_CLUSTER) goto lowest; + swap_device_unlock(si); offset = si->lowest_bit; last_in_cluster = offset + SWAPFILE_CLUSTER - 1; @@ -111,10 +113,12 @@ static inline unsigned long scan_swap_map(struct swap_info_struct *si) if (si->swap_map[offset]) last_in_cluster = offset + SWAPFILE_CLUSTER; else if (offset == last_in_cluster) { + swap_device_lock(si); si->cluster_next = offset-SWAPFILE_CLUSTER-1; goto cluster; } } + swap_device_lock(si); goto lowest; } @@ -123,10 +127,12 @@ cluster: offset = si->cluster_next; if (offset > si->highest_bit) lowest: offset = si->lowest_bit; +checks: if (!(si->flags & SWP_WRITEOK)) + goto no_page; if (!si->highest_bit) goto no_page; if (!si->swap_map[offset]) { -got_page: if (offset == si->lowest_bit) + if (offset == si->lowest_bit) si->lowest_bit++; if (offset == si->highest_bit) si->highest_bit--; @@ -137,16 +143,22 @@ got_page: if (offset == si->lowest_bit) } si->swap_map[offset] = 1; si->cluster_next = offset + 1; + si->flags -= SWP_SCANNING; return offset; } + swap_device_unlock(si); while (++offset <= si->highest_bit) { - if (!si->swap_map[offset]) - goto got_page; + if (!si->swap_map[offset]) { + swap_device_lock(si); + goto checks; + } } + swap_device_lock(si); goto lowest; no_page: + si->flags -= SWP_SCANNING; return 0; } @@ -1111,10 +1123,6 @@ asmlinkage long sys_swapoff(const char __user * specialfile) err = try_to_unuse(type); current->flags &= ~PF_SWAPOFF; - /* wait for any unplug function to finish */ - down_write(&swap_unplug_sem); - up_write(&swap_unplug_sem); - if (err) { /* re-insert swap space back into swap_list */ swap_list_lock(); @@ -1128,10 +1136,28 @@ asmlinkage long sys_swapoff(const char __user * specialfile) swap_info[prev].next = p - swap_info; nr_swap_pages += p->pages; total_swap_pages += p->pages; + swap_device_lock(p); p->flags |= SWP_WRITEOK; + swap_device_unlock(p); swap_list_unlock(); goto out_dput; } + + /* wait for any unplug function to finish */ + down_write(&swap_unplug_sem); + up_write(&swap_unplug_sem); + + /* wait for anyone still in scan_swap_map */ + swap_device_lock(p); + p->highest_bit = 0; /* cuts scans short */ + while (p->flags >= SWP_SCANNING) { + swap_device_unlock(p); + set_current_state(TASK_UNINTERRUPTIBLE); + schedule_timeout(1); + swap_device_lock(p); + } + swap_device_unlock(p); + destroy_swap_extents(p); down(&swapon_sem); swap_list_lock(); @@ -1431,6 +1457,8 @@ asmlinkage long sys_swapon(const char __user * specialfile, int swap_flags) } p->lowest_bit = 1; + p->cluster_next = 1; + /* * Find out how many pages are allowed for a single swap * device. There are two limiting factors: 1) the number of -- cgit v1.2.3-70-g09d2 From 5d337b9194b1ce3b6fd5f3cb2799455ed2f9a3d1 Mon Sep 17 00:00:00 2001 From: Hugh Dickins Date: Sat, 3 Sep 2005 15:54:41 -0700 Subject: [PATCH] swap: swap_lock replace list+device The idea of a swap_device_lock per device, and a swap_list_lock over them all, is appealing; but in practice almost every holder of swap_device_lock must already hold swap_list_lock, which defeats the purpose of the split. The only exceptions have been swap_duplicate, valid_swaphandles and an untrodden path in try_to_unuse (plus a few places added in this series). valid_swaphandles doesn't show up high in profiles, but swap_duplicate does demand attention. However, with the hold time in get_swap_pages so much reduced, I've not yet found a load and set of swap device priorities to show even swap_duplicate benefitting from the split. Certainly the split is mere overhead in the common case of a single swap device. So, replace swap_list_lock and swap_device_lock by spinlock_t swap_lock (generally we seem to prefer an _ in the name, and not hide in a macro). If someone can show a regression in swap_duplicate, then probably we should add a hashlock for the swap_map entries alone (shorts being anatomic), so as to help the case of the single swap device too. Signed-off-by: Hugh Dickins Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- Documentation/vm/locking | 15 +++--- include/linux/swap.h | 11 +---- mm/filemap.c | 7 ++- mm/rmap.c | 3 +- mm/swapfile.c | 125 ++++++++++++++++++++--------------------------- 5 files changed, 66 insertions(+), 95 deletions(-) (limited to 'include') diff --git a/Documentation/vm/locking b/Documentation/vm/locking index c3ef09ae3bb..f366fa95617 100644 --- a/Documentation/vm/locking +++ b/Documentation/vm/locking @@ -83,19 +83,18 @@ single address space optimization, so that the zap_page_range (from vmtruncate) does not lose sending ipi's to cloned threads that might be spawned underneath it and go to user mode to drag in pte's into tlbs. -swap_list_lock/swap_device_lock -------------------------------- +swap_lock +-------------- The swap devices are chained in priority order from the "swap_list" header. The "swap_list" is used for the round-robin swaphandle allocation strategy. The #free swaphandles is maintained in "nr_swap_pages". These two together -are protected by the swap_list_lock. +are protected by the swap_lock. -The swap_device_lock, which is per swap device, protects the reference -counts on the corresponding swaphandles, maintained in the "swap_map" -array, and the "highest_bit" and "lowest_bit" fields. +The swap_lock also protects all the device reference counts on the +corresponding swaphandles, maintained in the "swap_map" array, and the +"highest_bit" and "lowest_bit" fields. -Both of these are spinlocks, and are never acquired from intr level. The -locking hierarchy is swap_list_lock -> swap_device_lock. +The swap_lock is a spinlock, and is never acquired from intr level. To prevent races between swap space deletion or async readahead swapins deciding whether a swap handle is being used, ie worthy of being read in diff --git a/include/linux/swap.h b/include/linux/swap.h index db3b5de7c92..3c9ff004815 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h @@ -121,7 +121,7 @@ enum { */ struct swap_info_struct { unsigned int flags; - spinlock_t sdev_lock; + int prio; /* swap priority */ struct file *swap_file; struct block_device *bdev; struct list_head extent_list; @@ -135,7 +135,6 @@ struct swap_info_struct { unsigned int pages; unsigned int max; unsigned int inuse_pages; - int prio; /* swap priority */ int next; /* next entry on swap list */ }; @@ -221,13 +220,7 @@ extern int can_share_swap_page(struct page *); extern int remove_exclusive_swap_page(struct page *); struct backing_dev_info; -extern struct swap_list_t swap_list; -extern spinlock_t swaplock; - -#define swap_list_lock() spin_lock(&swaplock) -#define swap_list_unlock() spin_unlock(&swaplock) -#define swap_device_lock(p) spin_lock(&p->sdev_lock) -#define swap_device_unlock(p) spin_unlock(&p->sdev_lock) +extern spinlock_t swap_lock; /* linux/mm/thrash.c */ extern struct mm_struct * swap_token_mm; diff --git a/mm/filemap.c b/mm/filemap.c index c11418dd94e..edc54436fa9 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -54,9 +54,8 @@ * * ->i_mmap_lock (vmtruncate) * ->private_lock (__free_pte->__set_page_dirty_buffers) - * ->swap_list_lock - * ->swap_device_lock (exclusive_swap_page, others) - * ->mapping->tree_lock + * ->swap_lock (exclusive_swap_page, others) + * ->mapping->tree_lock * * ->i_sem * ->i_mmap_lock (truncate->unmap_mapping_range) @@ -86,7 +85,7 @@ * ->page_table_lock (anon_vma_prepare and various) * * ->page_table_lock - * ->swap_device_lock (try_to_unmap_one) + * ->swap_lock (try_to_unmap_one) * ->private_lock (try_to_unmap_one) * ->tree_lock (try_to_unmap_one) * ->zone.lru_lock (follow_page->mark_page_accessed) diff --git a/mm/rmap.c b/mm/rmap.c index 08ac5c7fa91..facb8cdca66 100644 --- a/mm/rmap.c +++ b/mm/rmap.c @@ -34,9 +34,8 @@ * anon_vma->lock * mm->page_table_lock * zone->lru_lock (in mark_page_accessed) - * swap_list_lock (in swap_free etc's swap_info_get) + * swap_lock (in swap_duplicate, swap_info_get) * mmlist_lock (in mmput, drain_mmlist and others) - * swap_device_lock (in swap_duplicate, swap_info_get) * mapping->private_lock (in __set_page_dirty_buffers) * inode_lock (in set_page_dirty's __mark_inode_dirty) * sb_lock (within inode_lock in fs/fs-writeback.c) diff --git a/mm/swapfile.c b/mm/swapfile.c index e675ae55f87..4b6e8bf986b 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -31,7 +31,7 @@ #include #include -DEFINE_SPINLOCK(swaplock); +DEFINE_SPINLOCK(swap_lock); unsigned int nr_swapfiles; long total_swap_pages; static int swap_overflow; @@ -51,7 +51,7 @@ static DECLARE_MUTEX(swapon_sem); /* * We need this because the bdev->unplug_fn can sleep and we cannot - * hold swap_list_lock while calling the unplug_fn. And swap_list_lock + * hold swap_lock while calling the unplug_fn. And swap_lock * cannot be turned into a semaphore. */ static DECLARE_RWSEM(swap_unplug_sem); @@ -105,7 +105,7 @@ static inline unsigned long scan_swap_map(struct swap_info_struct *si) si->cluster_nr = SWAPFILE_CLUSTER - 1; if (si->pages - si->inuse_pages < SWAPFILE_CLUSTER) goto lowest; - swap_device_unlock(si); + spin_unlock(&swap_lock); offset = si->lowest_bit; last_in_cluster = offset + SWAPFILE_CLUSTER - 1; @@ -115,7 +115,7 @@ static inline unsigned long scan_swap_map(struct swap_info_struct *si) if (si->swap_map[offset]) last_in_cluster = offset + SWAPFILE_CLUSTER; else if (offset == last_in_cluster) { - swap_device_lock(si); + spin_lock(&swap_lock); si->cluster_next = offset-SWAPFILE_CLUSTER-1; goto cluster; } @@ -124,7 +124,7 @@ static inline unsigned long scan_swap_map(struct swap_info_struct *si) latency_ration = LATENCY_LIMIT; } } - swap_device_lock(si); + spin_lock(&swap_lock); goto lowest; } @@ -153,10 +153,10 @@ checks: if (!(si->flags & SWP_WRITEOK)) return offset; } - swap_device_unlock(si); + spin_unlock(&swap_lock); while (++offset <= si->highest_bit) { if (!si->swap_map[offset]) { - swap_device_lock(si); + spin_lock(&swap_lock); goto checks; } if (unlikely(--latency_ration < 0)) { @@ -164,7 +164,7 @@ checks: if (!(si->flags & SWP_WRITEOK)) latency_ration = LATENCY_LIMIT; } } - swap_device_lock(si); + spin_lock(&swap_lock); goto lowest; no_page: @@ -179,7 +179,7 @@ swp_entry_t get_swap_page(void) int type, next; int wrapped = 0; - swap_list_lock(); + spin_lock(&swap_lock); if (nr_swap_pages <= 0) goto noswap; nr_swap_pages--; @@ -199,19 +199,17 @@ swp_entry_t get_swap_page(void) continue; swap_list.next = next; - swap_device_lock(si); - swap_list_unlock(); offset = scan_swap_map(si); - swap_device_unlock(si); - if (offset) + if (offset) { + spin_unlock(&swap_lock); return swp_entry(type, offset); - swap_list_lock(); + } next = swap_list.next; } nr_swap_pages++; noswap: - swap_list_unlock(); + spin_unlock(&swap_lock); return (swp_entry_t) {0}; } @@ -233,8 +231,7 @@ static struct swap_info_struct * swap_info_get(swp_entry_t entry) goto bad_offset; if (!p->swap_map[offset]) goto bad_free; - swap_list_lock(); - swap_device_lock(p); + spin_lock(&swap_lock); return p; bad_free: @@ -252,12 +249,6 @@ out: return NULL; } -static void swap_info_put(struct swap_info_struct * p) -{ - swap_device_unlock(p); - swap_list_unlock(); -} - static int swap_entry_free(struct swap_info_struct *p, unsigned long offset) { int count = p->swap_map[offset]; @@ -290,7 +281,7 @@ void swap_free(swp_entry_t entry) p = swap_info_get(entry); if (p) { swap_entry_free(p, swp_offset(entry)); - swap_info_put(p); + spin_unlock(&swap_lock); } } @@ -308,7 +299,7 @@ static inline int page_swapcount(struct page *page) if (p) { /* Subtract the 1 for the swap cache itself */ count = p->swap_map[swp_offset(entry)] - 1; - swap_info_put(p); + spin_unlock(&swap_lock); } return count; } @@ -365,7 +356,7 @@ int remove_exclusive_swap_page(struct page *page) } write_unlock_irq(&swapper_space.tree_lock); } - swap_info_put(p); + spin_unlock(&swap_lock); if (retval) { swap_free(entry); @@ -388,7 +379,7 @@ void free_swap_and_cache(swp_entry_t entry) if (p) { if (swap_entry_free(p, swp_offset(entry)) == 1) page = find_trylock_page(&swapper_space, entry.val); - swap_info_put(p); + spin_unlock(&swap_lock); } if (page) { int one_user; @@ -558,10 +549,10 @@ static unsigned int find_next_to_unuse(struct swap_info_struct *si, int count; /* - * No need for swap_device_lock(si) here: we're just looking + * No need for swap_lock here: we're just looking * for whether an entry is in use, not modifying it; false * hits are okay, and sys_swapoff() has already prevented new - * allocations from this area (while holding swap_list_lock()). + * allocations from this area (while holding swap_lock). */ for (;;) { if (++i >= max) { @@ -751,9 +742,9 @@ static int try_to_unuse(unsigned int type) * report them; but do report if we reset SWAP_MAP_MAX. */ if (*swap_map == SWAP_MAP_MAX) { - swap_device_lock(si); + spin_lock(&swap_lock); *swap_map = 1; - swap_device_unlock(si); + spin_unlock(&swap_lock); reset_overflow = 1; } @@ -817,9 +808,9 @@ static int try_to_unuse(unsigned int type) } /* - * After a successful try_to_unuse, if no swap is now in use, we know we - * can empty the mmlist. swap_list_lock must be held on entry and exit. - * Note that mmlist_lock nests inside swap_list_lock, and an mm must be + * After a successful try_to_unuse, if no swap is now in use, we know + * we can empty the mmlist. swap_lock must be held on entry and exit. + * Note that mmlist_lock nests inside swap_lock, and an mm must be * added to the mmlist just after page_duplicate - before would be racy. */ static void drain_mmlist(void) @@ -1092,7 +1083,7 @@ asmlinkage long sys_swapoff(const char __user * specialfile) mapping = victim->f_mapping; prev = -1; - swap_list_lock(); + spin_lock(&swap_lock); for (type = swap_list.head; type >= 0; type = swap_info[type].next) { p = swap_info + type; if ((p->flags & SWP_ACTIVE) == SWP_ACTIVE) { @@ -1103,14 +1094,14 @@ asmlinkage long sys_swapoff(const char __user * specialfile) } if (type < 0) { err = -EINVAL; - swap_list_unlock(); + spin_unlock(&swap_lock); goto out_dput; } if (!security_vm_enough_memory(p->pages)) vm_unacct_memory(p->pages); else { err = -ENOMEM; - swap_list_unlock(); + spin_unlock(&swap_lock); goto out_dput; } if (prev < 0) { @@ -1124,10 +1115,8 @@ asmlinkage long sys_swapoff(const char __user * specialfile) } nr_swap_pages -= p->pages; total_swap_pages -= p->pages; - swap_device_lock(p); p->flags &= ~SWP_WRITEOK; - swap_device_unlock(p); - swap_list_unlock(); + spin_unlock(&swap_lock); current->flags |= PF_SWAPOFF; err = try_to_unuse(type); @@ -1135,7 +1124,7 @@ asmlinkage long sys_swapoff(const char __user * specialfile) if (err) { /* re-insert swap space back into swap_list */ - swap_list_lock(); + spin_lock(&swap_lock); for (prev = -1, i = swap_list.head; i >= 0; prev = i, i = swap_info[i].next) if (p->prio >= swap_info[i].prio) break; @@ -1146,10 +1135,8 @@ asmlinkage long sys_swapoff(const char __user * specialfile) swap_info[prev].next = p - swap_info; nr_swap_pages += p->pages; total_swap_pages += p->pages; - swap_device_lock(p); p->flags |= SWP_WRITEOK; - swap_device_unlock(p); - swap_list_unlock(); + spin_unlock(&swap_lock); goto out_dput; } @@ -1157,30 +1144,27 @@ asmlinkage long sys_swapoff(const char __user * specialfile) down_write(&swap_unplug_sem); up_write(&swap_unplug_sem); + destroy_swap_extents(p); + down(&swapon_sem); + spin_lock(&swap_lock); + drain_mmlist(); + /* wait for anyone still in scan_swap_map */ - swap_device_lock(p); p->highest_bit = 0; /* cuts scans short */ while (p->flags >= SWP_SCANNING) { - swap_device_unlock(p); + spin_unlock(&swap_lock); set_current_state(TASK_UNINTERRUPTIBLE); schedule_timeout(1); - swap_device_lock(p); + spin_lock(&swap_lock); } - swap_device_unlock(p); - destroy_swap_extents(p); - down(&swapon_sem); - swap_list_lock(); - drain_mmlist(); - swap_device_lock(p); swap_file = p->swap_file; p->swap_file = NULL; p->max = 0; swap_map = p->swap_map; p->swap_map = NULL; p->flags = 0; - swap_device_unlock(p); - swap_list_unlock(); + spin_unlock(&swap_lock); up(&swapon_sem); vfree(swap_map); inode = mapping->host; @@ -1324,7 +1308,7 @@ asmlinkage long sys_swapon(const char __user * specialfile, int swap_flags) if (!capable(CAP_SYS_ADMIN)) return -EPERM; - swap_list_lock(); + spin_lock(&swap_lock); p = swap_info; for (type = 0 ; type < nr_swapfiles ; type++,p++) if (!(p->flags & SWP_USED)) @@ -1343,7 +1327,7 @@ asmlinkage long sys_swapon(const char __user * specialfile, int swap_flags) * swp_entry_t or the architecture definition of a swap pte. */ if (type > swp_type(pte_to_swp_entry(swp_entry_to_pte(swp_entry(~0UL,0))))) { - swap_list_unlock(); + spin_unlock(&swap_lock); goto out; } if (type >= nr_swapfiles) @@ -1357,7 +1341,6 @@ asmlinkage long sys_swapon(const char __user * specialfile, int swap_flags) p->highest_bit = 0; p->cluster_nr = 0; p->inuse_pages = 0; - spin_lock_init(&p->sdev_lock); p->next = -1; if (swap_flags & SWAP_FLAG_PREFER) { p->prio = @@ -1365,7 +1348,7 @@ asmlinkage long sys_swapon(const char __user * specialfile, int swap_flags) } else { p->prio = --least_priority; } - swap_list_unlock(); + spin_unlock(&swap_lock); name = getname(specialfile); error = PTR_ERR(name); if (IS_ERR(name)) { @@ -1542,8 +1525,7 @@ asmlinkage long sys_swapon(const char __user * specialfile, int swap_flags) } down(&swapon_sem); - swap_list_lock(); - swap_device_lock(p); + spin_lock(&swap_lock); p->flags = SWP_ACTIVE; nr_swap_pages += nr_good_pages; total_swap_pages += nr_good_pages; @@ -1567,8 +1549,7 @@ asmlinkage long sys_swapon(const char __user * specialfile, int swap_flags) } else { swap_info[prev].next = p - swap_info; } - swap_device_unlock(p); - swap_list_unlock(); + spin_unlock(&swap_lock); up(&swapon_sem); error = 0; goto out; @@ -1579,14 +1560,14 @@ bad_swap: } destroy_swap_extents(p); bad_swap_2: - swap_list_lock(); + spin_lock(&swap_lock); swap_map = p->swap_map; p->swap_file = NULL; p->swap_map = NULL; p->flags = 0; if (!(swap_flags & SWAP_FLAG_PREFER)) ++least_priority; - swap_list_unlock(); + spin_unlock(&swap_lock); vfree(swap_map); if (swap_file) filp_close(swap_file, NULL); @@ -1610,7 +1591,7 @@ void si_swapinfo(struct sysinfo *val) unsigned int i; unsigned long nr_to_be_unused = 0; - swap_list_lock(); + spin_lock(&swap_lock); for (i = 0; i < nr_swapfiles; i++) { if (!(swap_info[i].flags & SWP_USED) || (swap_info[i].flags & SWP_WRITEOK)) @@ -1619,7 +1600,7 @@ void si_swapinfo(struct sysinfo *val) } val->freeswap = nr_swap_pages + nr_to_be_unused; val->totalswap = total_swap_pages + nr_to_be_unused; - swap_list_unlock(); + spin_unlock(&swap_lock); } /* @@ -1640,7 +1621,7 @@ int swap_duplicate(swp_entry_t entry) p = type + swap_info; offset = swp_offset(entry); - swap_device_lock(p); + spin_lock(&swap_lock); if (offset < p->max && p->swap_map[offset]) { if (p->swap_map[offset] < SWAP_MAP_MAX - 1) { p->swap_map[offset]++; @@ -1652,7 +1633,7 @@ int swap_duplicate(swp_entry_t entry) result = 1; } } - swap_device_unlock(p); + spin_unlock(&swap_lock); out: return result; @@ -1668,7 +1649,7 @@ get_swap_info_struct(unsigned type) } /* - * swap_device_lock prevents swap_map being freed. Don't grab an extra + * swap_lock prevents swap_map being freed. Don't grab an extra * reference on the swaphandle, it doesn't matter if it becomes unused. */ int valid_swaphandles(swp_entry_t entry, unsigned long *offset) @@ -1684,7 +1665,7 @@ int valid_swaphandles(swp_entry_t entry, unsigned long *offset) toff++, i--; *offset = toff; - swap_device_lock(swapdev); + spin_lock(&swap_lock); do { /* Don't read-ahead past the end of the swap area */ if (toff >= swapdev->max) @@ -1697,6 +1678,6 @@ int valid_swaphandles(swp_entry_t entry, unsigned long *offset) toff++; ret++; } while (--i); - swap_device_unlock(swapdev); + spin_unlock(&swap_lock); return ret; } -- cgit v1.2.3-70-g09d2 From 6e21c8f145f5052c1c2fb4a4b41bee01c848159b Mon Sep 17 00:00:00 2001 From: Christoph Lameter Date: Sat, 3 Sep 2005 15:54:45 -0700 Subject: [PATCH] /proc//numa_maps to show on which nodes pages reside This patch was recently discussed on linux-mm: http://marc.theaimsgroup.com/?t=112085728500002&r=1&w=2 I inherited a large code base from Ray for page migration. There was a small patch in there that I find to be very useful since it allows the display of the locality of the pages in use by a process. I reworked that patch and came up with a /proc//numa_maps that gives more information about the vma's of a process. numa_maps is indexes by the start address found in /proc//maps. F.e. with this patch you can see the page use of the "getty" process: margin:/proc/12008 # cat maps 00000000-00004000 r--p 00000000 00:00 0 2000000000000000-200000000002c000 r-xp 00000000 08:04 516 /lib/ld-2.3.3.so 2000000000038000-2000000000040000 rw-p 00028000 08:04 516 /lib/ld-2.3.3.so 2000000000040000-2000000000044000 rw-p 2000000000040000 00:00 0 2000000000058000-2000000000260000 r-xp 00000000 08:04 54707842 /lib/tls/libc.so.6.1 2000000000260000-2000000000268000 ---p 00208000 08:04 54707842 /lib/tls/libc.so.6.1 2000000000268000-2000000000274000 rw-p 00200000 08:04 54707842 /lib/tls/libc.so.6.1 2000000000274000-2000000000280000 rw-p 2000000000274000 00:00 0 2000000000280000-20000000002b4000 r--p 00000000 08:04 9126923 /usr/lib/locale/en_US.utf8/LC_CTYPE 2000000000300000-2000000000308000 r--s 00000000 08:04 60071467 /usr/lib/gconv/gconv-modules.cache 2000000000318000-2000000000328000 rw-p 2000000000318000 00:00 0 4000000000000000-4000000000008000 r-xp 00000000 08:04 29576399 /sbin/mingetty 6000000000004000-6000000000008000 rw-p 00004000 08:04 29576399 /sbin/mingetty 6000000000008000-600000000002c000 rw-p 6000000000008000 00:00 0 [heap] 60000fff7fffc000-60000fff80000000 rw-p 60000fff7fffc000 00:00 0 60000ffffff44000-60000ffffff98000 rw-p 60000ffffff44000 00:00 0 [stack] a000000000000000-a000000000020000 ---p 00000000 00:00 0 [vdso] cat numa_maps 2000000000000000 default MaxRef=43 Pages=11 Mapped=11 N0=4 N1=3 N2=2 N3=2 2000000000038000 default MaxRef=1 Pages=2 Mapped=2 Anon=2 N0=2 2000000000040000 default MaxRef=1 Pages=1 Mapped=1 Anon=1 N0=1 2000000000058000 default MaxRef=43 Pages=61 Mapped=61 N0=14 N1=15 N2=16 N3=16 2000000000268000 default MaxRef=1 Pages=2 Mapped=2 Anon=2 N0=2 2000000000274000 default MaxRef=1 Pages=3 Mapped=3 Anon=3 N0=3 2000000000280000 default MaxRef=8 Pages=3 Mapped=3 N0=3 2000000000300000 default MaxRef=8 Pages=2 Mapped=2 N0=2 2000000000318000 default MaxRef=1 Pages=1 Mapped=1 Anon=1 N2=1 4000000000000000 default MaxRef=6 Pages=2 Mapped=2 N1=2 6000000000004000 default MaxRef=1 Pages=1 Mapped=1 Anon=1 N0=1 6000000000008000 default MaxRef=1 Pages=1 Mapped=1 Anon=1 N0=1 60000fff7fffc000 default MaxRef=1 Pages=1 Mapped=1 Anon=1 N0=1 60000ffffff44000 default MaxRef=1 Pages=1 Mapped=1 Anon=1 N0=1 getty uses ld.so. The first vma is the code segment which is used by 43 other processes and the pages are evenly distributed over the 4 nodes. The second vma is the process specific data portion for ld.so. This is only one page. The display format is: Links to information in /proc//map This can be "default" "interleave={}", "prefer=" or "bind={}" MaxRef= Pages= Mapped= Anon= Nx= The content of the proc-file is self-evident. If this would be tied into the sparsemem system then the contents of this file would not be too useful. Signed-off-by: Christoph Lameter Cc: Hugh Dickins Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- fs/proc/base.c | 35 ++++++++++++ fs/proc/task_mmu.c | 132 ++++++++++++++++++++++++++++++++++++++++++++++ include/linux/mempolicy.h | 3 ++ mm/mempolicy.c | 12 ++--- 4 files changed, 176 insertions(+), 6 deletions(-) (limited to 'include') diff --git a/fs/proc/base.c b/fs/proc/base.c index 491f2d9f89a..b796bf90a0b 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c @@ -65,6 +65,7 @@ enum pid_directory_inos { PROC_TGID_STAT, PROC_TGID_STATM, PROC_TGID_MAPS, + PROC_TGID_NUMA_MAPS, PROC_TGID_MOUNTS, PROC_TGID_WCHAN, #ifdef CONFIG_SCHEDSTATS @@ -102,6 +103,7 @@ enum pid_directory_inos { PROC_TID_STAT, PROC_TID_STATM, PROC_TID_MAPS, + PROC_TID_NUMA_MAPS, PROC_TID_MOUNTS, PROC_TID_WCHAN, #ifdef CONFIG_SCHEDSTATS @@ -144,6 +146,9 @@ static struct pid_entry tgid_base_stuff[] = { E(PROC_TGID_STAT, "stat", S_IFREG|S_IRUGO), E(PROC_TGID_STATM, "statm", S_IFREG|S_IRUGO), E(PROC_TGID_MAPS, "maps", S_IFREG|S_IRUGO), +#ifdef CONFIG_NUMA + E(PROC_TGID_NUMA_MAPS, "numa_maps", S_IFREG|S_IRUGO), +#endif E(PROC_TGID_MEM, "mem", S_IFREG|S_IRUSR|S_IWUSR), #ifdef CONFIG_SECCOMP E(PROC_TGID_SECCOMP, "seccomp", S_IFREG|S_IRUSR|S_IWUSR), @@ -180,6 +185,9 @@ static struct pid_entry tid_base_stuff[] = { E(PROC_TID_STAT, "stat", S_IFREG|S_IRUGO), E(PROC_TID_STATM, "statm", S_IFREG|S_IRUGO), E(PROC_TID_MAPS, "maps", S_IFREG|S_IRUGO), +#ifdef CONFIG_NUMA + E(PROC_TID_NUMA_MAPS, "numa_maps", S_IFREG|S_IRUGO), +#endif E(PROC_TID_MEM, "mem", S_IFREG|S_IRUSR|S_IWUSR), #ifdef CONFIG_SECCOMP E(PROC_TID_SECCOMP, "seccomp", S_IFREG|S_IRUSR|S_IWUSR), @@ -515,6 +523,27 @@ static struct file_operations proc_maps_operations = { .release = seq_release, }; +#ifdef CONFIG_NUMA +extern struct seq_operations proc_pid_numa_maps_op; +static int numa_maps_open(struct inode *inode, struct file *file) +{ + struct task_struct *task = proc_task(inode); + int ret = seq_open(file, &proc_pid_numa_maps_op); + if (!ret) { + struct seq_file *m = file->private_data; + m->private = task; + } + return ret; +} + +static struct file_operations proc_numa_maps_operations = { + .open = numa_maps_open, + .read = seq_read, + .llseek = seq_lseek, + .release = seq_release, +}; +#endif + extern struct seq_operations mounts_op; static int mounts_open(struct inode *inode, struct file *file) { @@ -1524,6 +1553,12 @@ static struct dentry *proc_pident_lookup(struct inode *dir, case PROC_TGID_MAPS: inode->i_fop = &proc_maps_operations; break; +#ifdef CONFIG_NUMA + case PROC_TID_NUMA_MAPS: + case PROC_TGID_NUMA_MAPS: + inode->i_fop = &proc_numa_maps_operations; + break; +#endif case PROC_TID_MEM: case PROC_TGID_MEM: inode->i_op = &proc_mem_inode_operations; diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c index 28b4a0253a9..64e84cadfa3 100644 --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c @@ -2,6 +2,8 @@ #include #include #include +#include +#include #include #include #include "internal.h" @@ -233,3 +235,133 @@ struct seq_operations proc_pid_maps_op = { .stop = m_stop, .show = show_map }; + +#ifdef CONFIG_NUMA + +struct numa_maps { + unsigned long pages; + unsigned long anon; + unsigned long mapped; + unsigned long mapcount_max; + unsigned long node[MAX_NUMNODES]; +}; + +/* + * Calculate numa node maps for a vma + */ +static struct numa_maps *get_numa_maps(const struct vm_area_struct *vma) +{ + struct page *page; + unsigned long vaddr; + struct mm_struct *mm = vma->vm_mm; + int i; + struct numa_maps *md = kmalloc(sizeof(struct numa_maps), GFP_KERNEL); + + if (!md) + return NULL; + md->pages = 0; + md->anon = 0; + md->mapped = 0; + md->mapcount_max = 0; + for_each_node(i) + md->node[i] =0; + + spin_lock(&mm->page_table_lock); + for (vaddr = vma->vm_start; vaddr < vma->vm_end; vaddr += PAGE_SIZE) { + page = follow_page(mm, vaddr, 0); + if (page) { + int count = page_mapcount(page); + + if (count) + md->mapped++; + if (count > md->mapcount_max) + md->mapcount_max = count; + md->pages++; + if (PageAnon(page)) + md->anon++; + md->node[page_to_nid(page)]++; + } + } + spin_unlock(&mm->page_table_lock); + return md; +} + +static int show_numa_map(struct seq_file *m, void *v) +{ + struct task_struct *task = m->private; + struct vm_area_struct *vma = v; + struct mempolicy *pol; + struct numa_maps *md; + struct zone **z; + int n; + int first; + + if (!vma->vm_mm) + return 0; + + md = get_numa_maps(vma); + if (!md) + return 0; + + seq_printf(m, "%08lx", vma->vm_start); + pol = get_vma_policy(task, vma, vma->vm_start); + /* Print policy */ + switch (pol->policy) { + case MPOL_PREFERRED: + seq_printf(m, " prefer=%d", pol->v.preferred_node); + break; + case MPOL_BIND: + seq_printf(m, " bind={"); + first = 1; + for (z = pol->v.zonelist->zones; *z; z++) { + + if (!first) + seq_putc(m, ','); + else + first = 0; + seq_printf(m, "%d/%s", (*z)->zone_pgdat->node_id, + (*z)->name); + } + seq_putc(m, '}'); + break; + case MPOL_INTERLEAVE: + seq_printf(m, " interleave={"); + first = 1; + for_each_node(n) { + if (test_bit(n, pol->v.nodes)) { + if (!first) + seq_putc(m,','); + else + first = 0; + seq_printf(m, "%d",n); + } + } + seq_putc(m, '}'); + break; + default: + seq_printf(m," default"); + break; + } + seq_printf(m, " MaxRef=%lu Pages=%lu Mapped=%lu", + md->mapcount_max, md->pages, md->mapped); + if (md->anon) + seq_printf(m," Anon=%lu",md->anon); + + for_each_online_node(n) { + if (md->node[n]) + seq_printf(m, " N%d=%lu", n, md->node[n]); + } + seq_putc(m, '\n'); + kfree(md); + if (m->count < m->size) /* vma is copied successfully */ + m->version = (vma != get_gate_vma(task)) ? vma->vm_start : 0; + return 0; +} + +struct seq_operations proc_pid_numa_maps_op = { + .start = m_start, + .next = m_next, + .stop = m_stop, + .show = show_numa_map +}; +#endif diff --git a/include/linux/mempolicy.h b/include/linux/mempolicy.h index 8480aef10e6..94a46f38c53 100644 --- a/include/linux/mempolicy.h +++ b/include/linux/mempolicy.h @@ -150,6 +150,9 @@ void mpol_free_shared_policy(struct shared_policy *p); struct mempolicy *mpol_shared_policy_lookup(struct shared_policy *sp, unsigned long idx); +struct mempolicy *get_vma_policy(struct task_struct *task, + struct vm_area_struct *vma, unsigned long addr); + extern void numa_default_policy(void); extern void numa_policy_init(void); diff --git a/mm/mempolicy.c b/mm/mempolicy.c index b4eababc819..13492d66b7c 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c @@ -664,10 +664,10 @@ asmlinkage long compat_sys_mbind(compat_ulong_t start, compat_ulong_t len, #endif /* Return effective policy for a VMA */ -static struct mempolicy * -get_vma_policy(struct vm_area_struct *vma, unsigned long addr) +struct mempolicy * +get_vma_policy(struct task_struct *task, struct vm_area_struct *vma, unsigned long addr) { - struct mempolicy *pol = current->mempolicy; + struct mempolicy *pol = task->mempolicy; if (vma) { if (vma->vm_ops && vma->vm_ops->get_policy) @@ -786,7 +786,7 @@ static struct page *alloc_page_interleave(unsigned int __nocast gfp, unsigned or struct page * alloc_page_vma(unsigned int __nocast gfp, struct vm_area_struct *vma, unsigned long addr) { - struct mempolicy *pol = get_vma_policy(vma, addr); + struct mempolicy *pol = get_vma_policy(current, vma, addr); cpuset_update_current_mems_allowed(); @@ -908,7 +908,7 @@ void __mpol_free(struct mempolicy *p) /* Find first node suitable for an allocation */ int mpol_first_node(struct vm_area_struct *vma, unsigned long addr) { - struct mempolicy *pol = get_vma_policy(vma, addr); + struct mempolicy *pol = get_vma_policy(current, vma, addr); switch (pol->policy) { case MPOL_DEFAULT: @@ -928,7 +928,7 @@ int mpol_first_node(struct vm_area_struct *vma, unsigned long addr) /* Find secondary valid nodes for an allocation */ int mpol_node_valid(int nid, struct vm_area_struct *vma, unsigned long addr) { - struct mempolicy *pol = get_vma_policy(vma, addr); + struct mempolicy *pol = get_vma_policy(current, vma, addr); switch (pol->policy) { case MPOL_PREFERRED: -- cgit v1.2.3-70-g09d2 From 242e54686257493f0b10ac557e730419d9af7d24 Mon Sep 17 00:00:00 2001 From: Nick Piggin Date: Sat, 3 Sep 2005 15:54:50 -0700 Subject: [PATCH] mm: remove atomic This bitop does not need to be atomic because it is performed when there will be no references to the page (ie. the page is being freed). Signed-off-by: Nick Piggin Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- include/linux/page-flags.h | 1 + mm/page_alloc.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h index f5a6695d4d2..99f7cc49506 100644 --- a/include/linux/page-flags.h +++ b/include/linux/page-flags.h @@ -194,6 +194,7 @@ extern void __mod_page_state(unsigned long offset, unsigned long delta); #define SetPageDirty(page) set_bit(PG_dirty, &(page)->flags) #define TestSetPageDirty(page) test_and_set_bit(PG_dirty, &(page)->flags) #define ClearPageDirty(page) clear_bit(PG_dirty, &(page)->flags) +#define __ClearPageDirty(page) __clear_bit(PG_dirty, &(page)->flags) #define TestClearPageDirty(page) test_and_clear_bit(PG_dirty, &(page)->flags) #define SetPageLRU(page) set_bit(PG_lru, &(page)->flags) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 8d088371196..620aa11b24e 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -329,7 +329,7 @@ static inline void free_pages_check(const char *function, struct page *page) 1 << PG_writeback ))) bad_page(function, page); if (PageDirty(page)) - ClearPageDirty(page); + __ClearPageDirty(page); } /* -- cgit v1.2.3-70-g09d2 From bce5f6ba340b09d8b29902add204bb95a6d3d88b Mon Sep 17 00:00:00 2001 From: Martin Hicks Date: Sat, 3 Sep 2005 15:54:50 -0700 Subject: [PATCH] VM: add capabilites check to set_zone_reclaim Add a capability check to sys_set_zone_reclaim(). This syscall is not something that should be available to a user. Signed-off-by: Martin Hicks Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- include/linux/capability.h | 1 + mm/vmscan.c | 3 +++ 2 files changed, 4 insertions(+) (limited to 'include') diff --git a/include/linux/capability.h b/include/linux/capability.h index 8d139f4acf2..6b4618902d3 100644 --- a/include/linux/capability.h +++ b/include/linux/capability.h @@ -233,6 +233,7 @@ typedef __u32 kernel_cap_t; /* Allow enabling/disabling tagged queuing on SCSI controllers and sending arbitrary SCSI commands */ /* Allow setting encryption key on loopback filesystem */ +/* Allow setting zone reclaim policy */ #define CAP_SYS_ADMIN 21 diff --git a/mm/vmscan.c b/mm/vmscan.c index cfffe5098d5..ab631a3c62c 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -1375,6 +1375,9 @@ asmlinkage long sys_set_zone_reclaim(unsigned int node, unsigned int zone, struct zone *z; int i; + if (!capable(CAP_SYS_ADMIN)) + return -EACCES; + if (node >= MAX_NUMNODES || !node_online(node)) return -EINVAL; -- cgit v1.2.3-70-g09d2 From e83a9596712eb784e7e6604f43a2c140eb912743 Mon Sep 17 00:00:00 2001 From: Paolo 'Blaisorblade' Giarrusso Date: Sat, 3 Sep 2005 15:54:53 -0700 Subject: [PATCH] comment typo fix smp_entry_t -> swap_entry_t Signed-off-by: Paolo 'Blaisorblade' Giarrusso Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- include/linux/swapops.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/linux/swapops.h b/include/linux/swapops.h index d4c7db35e70..87b9d14c710 100644 --- a/include/linux/swapops.h +++ b/include/linux/swapops.h @@ -4,7 +4,7 @@ * the low-order bits. * * We arrange the `type' and `offset' fields so that `type' is at the five - * high-order bits of the smp_entry_t and `offset' is right-aligned in the + * high-order bits of the swp_entry_t and `offset' is right-aligned in the * remaining bits. * * swp_entry_t's are *never* stored anywhere in their arch-dependent format. -- cgit v1.2.3-70-g09d2 From 9b4ee40ebbbaf3f8c775b023d89ceedda1167d79 Mon Sep 17 00:00:00 2001 From: Paolo 'Blaisorblade' Giarrusso Date: Sat, 3 Sep 2005 15:54:57 -0700 Subject: [PATCH] mm: correct _PAGE_FILE comment _PAGE_FILE does not indicate whether a file is in page / swap cache, it is set just for non-linear PTE's. Correct the comment for i386, x86_64, UML. Also clearify _PAGE_NONE. Signed-off-by: Paolo 'Blaisorblade' Giarrusso Cc: Hugh Dickins Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- include/asm-i386/pgtable.h | 10 +++++----- include/asm-um/pgtable.h | 8 +++++--- include/asm-x86_64/pgtable.h | 2 +- 3 files changed, 11 insertions(+), 9 deletions(-) (limited to 'include') diff --git a/include/asm-i386/pgtable.h b/include/asm-i386/pgtable.h index 77c6497f416..c797286b512 100644 --- a/include/asm-i386/pgtable.h +++ b/include/asm-i386/pgtable.h @@ -86,9 +86,7 @@ void paging_init(void); #endif /* - * The 4MB page is guessing.. Detailed in the infamous "Chapter H" - * of the Pentium details, but assuming intel did the straightforward - * thing, this bit set in the page directory entry just means that + * _PAGE_PSE set in the page directory entry just means that * the page directory entry points directly to a 4MB-aligned block of * memory. */ @@ -119,8 +117,10 @@ void paging_init(void); #define _PAGE_UNUSED2 0x400 #define _PAGE_UNUSED3 0x800 -#define _PAGE_FILE 0x040 /* set:pagecache unset:swap */ -#define _PAGE_PROTNONE 0x080 /* If not present */ +/* If _PAGE_PRESENT is clear, we use these: */ +#define _PAGE_FILE 0x040 /* nonlinear file mapping, saved PTE; unset:swap */ +#define _PAGE_PROTNONE 0x080 /* if the user mapped it with PROT_NONE; + pte_present gives true */ #ifdef CONFIG_X86_PAE #define _PAGE_NX (1ULL<<_PAGE_BIT_NX) #else diff --git a/include/asm-um/pgtable.h b/include/asm-um/pgtable.h index a8804092031..e9336f616f9 100644 --- a/include/asm-um/pgtable.h +++ b/include/asm-um/pgtable.h @@ -16,13 +16,15 @@ #define _PAGE_PRESENT 0x001 #define _PAGE_NEWPAGE 0x002 -#define _PAGE_NEWPROT 0x004 -#define _PAGE_FILE 0x008 /* set:pagecache unset:swap */ -#define _PAGE_PROTNONE 0x010 /* If not present */ +#define _PAGE_NEWPROT 0x004 #define _PAGE_RW 0x020 #define _PAGE_USER 0x040 #define _PAGE_ACCESSED 0x080 #define _PAGE_DIRTY 0x100 +/* If _PAGE_PRESENT is clear, we use these: */ +#define _PAGE_FILE 0x008 /* nonlinear file mapping, saved PTE; unset:swap */ +#define _PAGE_PROTNONE 0x010 /* if the user mapped it with PROT_NONE; + pte_present gives true */ #ifdef CONFIG_3_LEVEL_PGTABLES #include "asm/pgtable-3level.h" diff --git a/include/asm-x86_64/pgtable.h b/include/asm-x86_64/pgtable.h index 4e167b5ea8f..20476d12989 100644 --- a/include/asm-x86_64/pgtable.h +++ b/include/asm-x86_64/pgtable.h @@ -143,7 +143,7 @@ extern inline void pgd_clear (pgd_t * pgd) #define _PAGE_ACCESSED 0x020 #define _PAGE_DIRTY 0x040 #define _PAGE_PSE 0x080 /* 2MB page */ -#define _PAGE_FILE 0x040 /* set:pagecache, unset:swap */ +#define _PAGE_FILE 0x040 /* nonlinear file mapping, saved PTE; unset:swap */ #define _PAGE_GLOBAL 0x100 /* Global TLB entry */ #define _PAGE_PROTNONE 0x080 /* If not present */ -- cgit v1.2.3-70-g09d2 From fd195c49fb17a21e232f50bddb2267150053cf34 Mon Sep 17 00:00:00 2001 From: Deepak Saxena Date: Sat, 3 Sep 2005 15:54:58 -0700 Subject: [PATCH] arm: allow for arch-specific IOREMAP_MAX_ORDER Version 6 of the ARM architecture introduces the concept of 16MB pages (supersections) and 36-bit (40-bit actually, but nobody uses this) physical addresses. 36-bit addressed memory and I/O and ARMv6 can only be mapped using supersections and the requirement on these is that both virtual and physical addresses be 16MB aligned. In trying to add support for ioremap() of 36-bit I/O, we run into the issue that get_vm_area() allows for a maximum of 512K alignment via the IOREMAP_MAX_ORDER constant. To work around this, we can: - Allocate a larger VM area than needed (size + (1ul << IOREMAP_MAX_ORDER)) and then align the pointer ourselves, but this ends up with 512K of wasted VM per ioremap(). - Provide a new __get_vm_area_aligned() API and make __get_vm_area() sit on top of this. I did this and it works but I don't like the idea adding another VM API just for this one case. - My preferred solution which is to allow the architecture to override the IOREMAP_MAX_ORDER constant with it's own version. Signed-off-by: Deepak Saxena Cc: Russell King Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- include/linux/vmalloc.h | 8 ++++++++ mm/vmalloc.c | 2 -- 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h index 6409d9cf596..b244f69ef68 100644 --- a/include/linux/vmalloc.h +++ b/include/linux/vmalloc.h @@ -10,6 +10,14 @@ #define VM_MAP 0x00000004 /* vmap()ed pages */ /* bits [20..32] reserved for arch specific ioremap internals */ +/* + * Maximum alignment for ioremap() regions. + * Can be overriden by arch-specific value. + */ +#ifndef IOREMAP_MAX_ORDER +#define IOREMAP_MAX_ORDER (7 + PAGE_SHIFT) /* 128 pages */ +#endif + struct vm_struct { void *addr; unsigned long size; diff --git a/mm/vmalloc.c b/mm/vmalloc.c index 8ff16a1eee6..67b358e57ef 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c @@ -158,8 +158,6 @@ int map_vm_area(struct vm_struct *area, pgprot_t prot, struct page ***pages) return err; } -#define IOREMAP_MAX_ORDER (7 + PAGE_SHIFT) /* 128 pages */ - struct vm_struct *__get_vm_area(unsigned long size, unsigned long flags, unsigned long start, unsigned long end) { -- cgit v1.2.3-70-g09d2 From 32e51a8c976fc72c3e9bcece9767d9908816bf8e Mon Sep 17 00:00:00 2001 From: Adam Litke Date: Sat, 3 Sep 2005 15:54:59 -0700 Subject: [PATCH] hugetlb: add pte_huge() macro This patch adds a macro pte_huge(pte) for i386/x86_64 which is needed by a patch later in the series. Instead of repeating (_PAGE_PRESENT | _PAGE_PSE), I've added __LARGE_PTE to i386 to match x86_64. Signed-off-by: Adam Litke Cc: Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- include/asm-i386/pgtable.h | 4 +++- include/asm-x86_64/pgtable.h | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/asm-i386/pgtable.h b/include/asm-i386/pgtable.h index c797286b512..f51fd2c956b 100644 --- a/include/asm-i386/pgtable.h +++ b/include/asm-i386/pgtable.h @@ -215,11 +215,13 @@ extern unsigned long pg0[]; * The following only work if pte_present() is true. * Undefined behaviour if not.. */ +#define __LARGE_PTE (_PAGE_PSE | _PAGE_PRESENT) static inline int pte_user(pte_t pte) { return (pte).pte_low & _PAGE_USER; } static inline int pte_read(pte_t pte) { return (pte).pte_low & _PAGE_USER; } static inline int pte_dirty(pte_t pte) { return (pte).pte_low & _PAGE_DIRTY; } static inline int pte_young(pte_t pte) { return (pte).pte_low & _PAGE_ACCESSED; } static inline int pte_write(pte_t pte) { return (pte).pte_low & _PAGE_RW; } +static inline int pte_huge(pte_t pte) { return ((pte).pte_low & __LARGE_PTE) == __LARGE_PTE; } /* * The following only works if pte_present() is not true. @@ -236,7 +238,7 @@ static inline pte_t pte_mkexec(pte_t pte) { (pte).pte_low |= _PAGE_USER; return static inline pte_t pte_mkdirty(pte_t pte) { (pte).pte_low |= _PAGE_DIRTY; return pte; } static inline pte_t pte_mkyoung(pte_t pte) { (pte).pte_low |= _PAGE_ACCESSED; return pte; } static inline pte_t pte_mkwrite(pte_t pte) { (pte).pte_low |= _PAGE_RW; return pte; } -static inline pte_t pte_mkhuge(pte_t pte) { (pte).pte_low |= _PAGE_PRESENT | _PAGE_PSE; return pte; } +static inline pte_t pte_mkhuge(pte_t pte) { (pte).pte_low |= __LARGE_PTE; return pte; } #ifdef CONFIG_X86_PAE # include diff --git a/include/asm-x86_64/pgtable.h b/include/asm-x86_64/pgtable.h index 20476d12989..a1ada852f00 100644 --- a/include/asm-x86_64/pgtable.h +++ b/include/asm-x86_64/pgtable.h @@ -247,6 +247,7 @@ static inline pte_t pfn_pte(unsigned long page_nr, pgprot_t pgprot) * The following only work if pte_present() is true. * Undefined behaviour if not.. */ +#define __LARGE_PTE (_PAGE_PSE|_PAGE_PRESENT) static inline int pte_user(pte_t pte) { return pte_val(pte) & _PAGE_USER; } extern inline int pte_read(pte_t pte) { return pte_val(pte) & _PAGE_USER; } extern inline int pte_exec(pte_t pte) { return pte_val(pte) & _PAGE_USER; } @@ -254,8 +255,8 @@ extern inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; } extern inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; } extern inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_RW; } static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; } +static inline int pte_huge(pte_t pte) { return (pte_val(pte) & __LARGE_PTE) == __LARGE_PTE; } -#define __LARGE_PTE (_PAGE_PSE|_PAGE_PRESENT) extern inline pte_t pte_rdprotect(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_USER)); return pte; } extern inline pte_t pte_exprotect(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_USER)); return pte; } extern inline pte_t pte_mkclean(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_DIRTY)); return pte; } -- cgit v1.2.3-70-g09d2 From 0e5c9f39f64d8a55c5db37a5ea43e37d3422fd92 Mon Sep 17 00:00:00 2001 From: "Chen, Kenneth W" Date: Sat, 3 Sep 2005 15:55:02 -0700 Subject: [PATCH] remove hugetlb_clean_stale_pgtable() and fix huge_pte_alloc() I don't think we need to call hugetlb_clean_stale_pgtable() anymore in 2.6.13 because of the rework with free_pgtables(). It now collect all the pte page at the time of munmap. It used to only collect page table pages when entire one pgd can be freed and left with staled pte pages. Not anymore with 2.6.13. This function will never be called and We should turn it into a BUG_ON. I also spotted two problems here, not Adam's fault :-) (1) in huge_pte_alloc(), it looks like a bug to me that pud is not checked before calling pmd_alloc() (2) in hugetlb_clean_stale_pgtable(), it also missed a call to pmd_free_tlb. I think a tlb flush is required to flush the mapping for the page table itself when we clear out the pmd pointing to a pte page. However, since hugetlb_clean_stale_pgtable() is never called, so it won't trigger the bug. Signed-off-by: Ken Chen Cc: Adam Litke Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- arch/i386/mm/hugetlbpage.c | 23 +++-------------------- include/asm-i386/page.h | 1 - include/asm-x86_64/page.h | 1 - include/linux/hugetlb.h | 6 ------ 4 files changed, 3 insertions(+), 28 deletions(-) (limited to 'include') diff --git a/arch/i386/mm/hugetlbpage.c b/arch/i386/mm/hugetlbpage.c index 24c8a536b58..d524127c9af 100644 --- a/arch/i386/mm/hugetlbpage.c +++ b/arch/i386/mm/hugetlbpage.c @@ -22,20 +22,14 @@ pte_t *huge_pte_alloc(struct mm_struct *mm, unsigned long addr) { pgd_t *pgd; pud_t *pud; - pmd_t *pmd; pte_t *pte = NULL; pgd = pgd_offset(mm, addr); pud = pud_alloc(mm, pgd, addr); - pmd = pmd_alloc(mm, pud, addr); + if (pud) + pte = (pte_t *) pmd_alloc(mm, pud, addr); + BUG_ON(pte && !pte_none(*pte) && !pte_huge(*pte)); - if (!pmd) - goto out; - - pte = (pte_t *) pmd; - if (!pte_none(*pte) && !pte_huge(*pte)) - hugetlb_clean_stale_pgtable(pte); -out: return pte; } @@ -130,17 +124,6 @@ follow_huge_pmd(struct mm_struct *mm, unsigned long address, } #endif -void hugetlb_clean_stale_pgtable(pte_t *pte) -{ - pmd_t *pmd = (pmd_t *) pte; - struct page *page; - - page = pmd_page(*pmd); - pmd_clear(pmd); - dec_page_state(nr_page_table_pages); - page_cache_release(page); -} - /* x86_64 also uses this file */ #ifdef HAVE_ARCH_HUGETLB_UNMAPPED_AREA diff --git a/include/asm-i386/page.h b/include/asm-i386/page.h index 10045fd8210..73296d9924f 100644 --- a/include/asm-i386/page.h +++ b/include/asm-i386/page.h @@ -68,7 +68,6 @@ typedef struct { unsigned long pgprot; } pgprot_t; #define HPAGE_MASK (~(HPAGE_SIZE - 1)) #define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT) #define HAVE_ARCH_HUGETLB_UNMAPPED_AREA -#define ARCH_HAS_HUGETLB_CLEAN_STALE_PGTABLE #endif #define pgd_val(x) ((x).pgd) diff --git a/include/asm-x86_64/page.h b/include/asm-x86_64/page.h index fcf890aa8c8..135ffaa0393 100644 --- a/include/asm-x86_64/page.h +++ b/include/asm-x86_64/page.h @@ -28,7 +28,6 @@ #define HPAGE_SIZE ((1UL) << HPAGE_SHIFT) #define HPAGE_MASK (~(HPAGE_SIZE - 1)) #define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT) -#define ARCH_HAS_HUGETLB_CLEAN_STALE_PGTABLE #ifdef __KERNEL__ #ifndef __ASSEMBLY__ diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h index f529d144281..e670b0d13fe 100644 --- a/include/linux/hugetlb.h +++ b/include/linux/hugetlb.h @@ -70,12 +70,6 @@ pte_t huge_ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, void hugetlb_prefault_arch_hook(struct mm_struct *mm); #endif -#ifndef ARCH_HAS_HUGETLB_CLEAN_STALE_PGTABLE -#define hugetlb_clean_stale_pgtable(pte) BUG() -#else -void hugetlb_clean_stale_pgtable(pte_t *pte); -#endif - #else /* !CONFIG_HUGETLB_PAGE */ static inline int is_vm_hugetlb_page(struct vm_area_struct *vma) -- cgit v1.2.3-70-g09d2 From fa5b08d5f818063d18433194f20359ef2ae50254 Mon Sep 17 00:00:00 2001 From: Kyle Moffett Date: Sat, 3 Sep 2005 15:55:03 -0700 Subject: [PATCH] sab: consolidate kmem_bufctl_t This is used only in slab.c and each architecture gets to define whcih underlying type is to be used. Seems a bit silly - move it to slab.c and use the same type for all architectures: unsigned int. Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- include/asm-alpha/types.h | 2 -- include/asm-arm/types.h | 2 -- include/asm-arm26/types.h | 2 -- include/asm-cris/types.h | 2 -- include/asm-frv/types.h | 2 -- include/asm-h8300/types.h | 2 -- include/asm-i386/types.h | 2 -- include/asm-ia64/types.h | 2 -- include/asm-m32r/types.h | 2 -- include/asm-m68k/types.h | 2 -- include/asm-mips/types.h | 2 -- include/asm-parisc/types.h | 2 -- include/asm-ppc/types.h | 2 -- include/asm-ppc64/types.h | 1 - include/asm-s390/types.h | 2 -- include/asm-sh/types.h | 2 -- include/asm-sh64/types.h | 2 -- include/asm-sparc/types.h | 2 -- include/asm-sparc64/types.h | 2 -- include/asm-v850/types.h | 2 -- include/asm-x86_64/types.h | 2 -- include/asm-xtensa/types.h | 2 -- mm/slab.c | 1 + 23 files changed, 1 insertion(+), 43 deletions(-) (limited to 'include') diff --git a/include/asm-alpha/types.h b/include/asm-alpha/types.h index 43264d21924..f5716139ec8 100644 --- a/include/asm-alpha/types.h +++ b/include/asm-alpha/types.h @@ -56,8 +56,6 @@ typedef unsigned long u64; typedef u64 dma_addr_t; typedef u64 dma64_addr_t; -typedef unsigned short kmem_bufctl_t; - #endif /* __ASSEMBLY__ */ #endif /* __KERNEL__ */ #endif /* _ALPHA_TYPES_H */ diff --git a/include/asm-arm/types.h b/include/asm-arm/types.h index f4c92e4c8c0..22992ee0627 100644 --- a/include/asm-arm/types.h +++ b/include/asm-arm/types.h @@ -52,8 +52,6 @@ typedef unsigned long long u64; typedef u32 dma_addr_t; typedef u32 dma64_addr_t; -typedef unsigned int kmem_bufctl_t; - #endif /* __ASSEMBLY__ */ #endif /* __KERNEL__ */ diff --git a/include/asm-arm26/types.h b/include/asm-arm26/types.h index 56cbe573a23..81bd357ada0 100644 --- a/include/asm-arm26/types.h +++ b/include/asm-arm26/types.h @@ -52,8 +52,6 @@ typedef unsigned long long u64; typedef u32 dma_addr_t; typedef u32 dma64_addr_t; -typedef unsigned int kmem_bufctl_t; - #endif /* __ASSEMBLY__ */ #endif /* __KERNEL__ */ diff --git a/include/asm-cris/types.h b/include/asm-cris/types.h index 8fa6d6c7afc..84557c9bac9 100644 --- a/include/asm-cris/types.h +++ b/include/asm-cris/types.h @@ -52,8 +52,6 @@ typedef unsigned long long u64; typedef u32 dma_addr_t; typedef u32 dma64_addr_t; -typedef unsigned short kmem_bufctl_t; - #endif /* __ASSEMBLY__ */ #endif /* __KERNEL__ */ diff --git a/include/asm-frv/types.h b/include/asm-frv/types.h index 1a5b6546bb4..50605df6d8a 100644 --- a/include/asm-frv/types.h +++ b/include/asm-frv/types.h @@ -65,8 +65,6 @@ typedef u64 u_quad_t; typedef u32 dma_addr_t; -typedef unsigned short kmem_bufctl_t; - #endif /* __ASSEMBLY__ */ #endif /* __KERNEL__ */ diff --git a/include/asm-h8300/types.h b/include/asm-h8300/types.h index 21f4fc07ac0..bf91e0d4dde 100644 --- a/include/asm-h8300/types.h +++ b/include/asm-h8300/types.h @@ -58,8 +58,6 @@ typedef u32 dma_addr_t; #define HAVE_SECTOR_T typedef u64 sector_t; -typedef unsigned int kmem_bufctl_t; - #endif /* __KERNEL__ */ #endif /* __ASSEMBLY__ */ diff --git a/include/asm-i386/types.h b/include/asm-i386/types.h index 901b77c42b8..ced00fe8fe6 100644 --- a/include/asm-i386/types.h +++ b/include/asm-i386/types.h @@ -63,8 +63,6 @@ typedef u64 sector_t; #define HAVE_SECTOR_T #endif -typedef unsigned short kmem_bufctl_t; - #endif /* __ASSEMBLY__ */ #endif /* __KERNEL__ */ diff --git a/include/asm-ia64/types.h b/include/asm-ia64/types.h index a677565aa95..902850d1242 100644 --- a/include/asm-ia64/types.h +++ b/include/asm-ia64/types.h @@ -67,8 +67,6 @@ typedef __u64 u64; typedef u64 dma_addr_t; -typedef unsigned short kmem_bufctl_t; - # endif /* __KERNEL__ */ #endif /* !__ASSEMBLY__ */ diff --git a/include/asm-m32r/types.h b/include/asm-m32r/types.h index ca0a887d223..fcf24c64c3b 100644 --- a/include/asm-m32r/types.h +++ b/include/asm-m32r/types.h @@ -55,8 +55,6 @@ typedef unsigned long long u64; typedef u32 dma_addr_t; typedef u64 dma64_addr_t; -typedef unsigned short kmem_bufctl_t; - #endif /* __ASSEMBLY__ */ #endif /* __KERNEL__ */ diff --git a/include/asm-m68k/types.h b/include/asm-m68k/types.h index f391cbe39b9..b5a1febc97d 100644 --- a/include/asm-m68k/types.h +++ b/include/asm-m68k/types.h @@ -60,8 +60,6 @@ typedef unsigned long long u64; typedef u32 dma_addr_t; typedef u32 dma64_addr_t; -typedef unsigned short kmem_bufctl_t; - #endif /* __ASSEMBLY__ */ #endif /* __KERNEL__ */ diff --git a/include/asm-mips/types.h b/include/asm-mips/types.h index d2f0c76b00a..b949ab33e8e 100644 --- a/include/asm-mips/types.h +++ b/include/asm-mips/types.h @@ -99,8 +99,6 @@ typedef u64 sector_t; #define HAVE_SECTOR_T #endif -typedef unsigned short kmem_bufctl_t; - #endif /* __ASSEMBLY__ */ #endif /* __KERNEL__ */ diff --git a/include/asm-parisc/types.h b/include/asm-parisc/types.h index 8fe7a44ea20..d21b9d0d63e 100644 --- a/include/asm-parisc/types.h +++ b/include/asm-parisc/types.h @@ -56,8 +56,6 @@ typedef unsigned long long u64; typedef u32 dma_addr_t; typedef u64 dma64_addr_t; -typedef unsigned int kmem_bufctl_t; - #endif /* __ASSEMBLY__ */ #endif /* __KERNEL__ */ diff --git a/include/asm-ppc/types.h b/include/asm-ppc/types.h index a787bc03258..77dc24d7d2a 100644 --- a/include/asm-ppc/types.h +++ b/include/asm-ppc/types.h @@ -62,8 +62,6 @@ typedef u64 sector_t; #define HAVE_SECTOR_T #endif -typedef unsigned int kmem_bufctl_t; - #endif /* __ASSEMBLY__ */ #endif /* __KERNEL__ */ diff --git a/include/asm-ppc64/types.h b/include/asm-ppc64/types.h index 5b8c2cfa113..bf294c1761b 100644 --- a/include/asm-ppc64/types.h +++ b/include/asm-ppc64/types.h @@ -72,7 +72,6 @@ typedef struct { unsigned long env; } func_descr_t; -typedef unsigned int kmem_bufctl_t; #endif /* __ASSEMBLY__ */ #endif /* __KERNEL__ */ diff --git a/include/asm-s390/types.h b/include/asm-s390/types.h index 3fefd61416a..d0be3e47701 100644 --- a/include/asm-s390/types.h +++ b/include/asm-s390/types.h @@ -79,8 +79,6 @@ typedef unsigned long u64; typedef u32 dma_addr_t; -typedef unsigned int kmem_bufctl_t; - #ifndef __s390x__ typedef union { unsigned long long pair; diff --git a/include/asm-sh/types.h b/include/asm-sh/types.h index c4dc126c562..cb7e183a0a6 100644 --- a/include/asm-sh/types.h +++ b/include/asm-sh/types.h @@ -58,8 +58,6 @@ typedef u64 sector_t; #define HAVE_SECTOR_T #endif -typedef unsigned int kmem_bufctl_t; - #endif /* __ASSEMBLY__ */ #endif /* __KERNEL__ */ diff --git a/include/asm-sh64/types.h b/include/asm-sh64/types.h index 41d4d2f82aa..8d41db2153b 100644 --- a/include/asm-sh64/types.h +++ b/include/asm-sh64/types.h @@ -65,8 +65,6 @@ typedef u32 dma_addr_t; #endif typedef u64 dma64_addr_t; -typedef unsigned int kmem_bufctl_t; - #endif /* __ASSEMBLY__ */ #define BITS_PER_LONG 32 diff --git a/include/asm-sparc/types.h b/include/asm-sparc/types.h index 9eabf6e61cc..42fc6ed9815 100644 --- a/include/asm-sparc/types.h +++ b/include/asm-sparc/types.h @@ -54,8 +54,6 @@ typedef unsigned long long u64; typedef u32 dma_addr_t; typedef u32 dma64_addr_t; -typedef unsigned short kmem_bufctl_t; - #endif /* __ASSEMBLY__ */ #endif /* __KERNEL__ */ diff --git a/include/asm-sparc64/types.h b/include/asm-sparc64/types.h index 6248ed1a9a7..d0ee7f10583 100644 --- a/include/asm-sparc64/types.h +++ b/include/asm-sparc64/types.h @@ -56,8 +56,6 @@ typedef unsigned long u64; typedef u32 dma_addr_t; typedef u64 dma64_addr_t; -typedef unsigned short kmem_bufctl_t; - #endif /* __ASSEMBLY__ */ #endif /* __KERNEL__ */ diff --git a/include/asm-v850/types.h b/include/asm-v850/types.h index e7cfe5b33a1..dcef5719687 100644 --- a/include/asm-v850/types.h +++ b/include/asm-v850/types.h @@ -59,8 +59,6 @@ typedef unsigned long long u64; typedef u32 dma_addr_t; -typedef unsigned int kmem_bufctl_t; - #endif /* !__ASSEMBLY__ */ #endif /* __KERNEL__ */ diff --git a/include/asm-x86_64/types.h b/include/asm-x86_64/types.h index 32bd1426b52..c86c2e6793e 100644 --- a/include/asm-x86_64/types.h +++ b/include/asm-x86_64/types.h @@ -51,8 +51,6 @@ typedef u64 dma_addr_t; typedef u64 sector_t; #define HAVE_SECTOR_T -typedef unsigned short kmem_bufctl_t; - #endif /* __ASSEMBLY__ */ #endif /* __KERNEL__ */ diff --git a/include/asm-xtensa/types.h b/include/asm-xtensa/types.h index ebac0046985..9d99a8e9e33 100644 --- a/include/asm-xtensa/types.h +++ b/include/asm-xtensa/types.h @@ -58,8 +58,6 @@ typedef unsigned long long u64; typedef u32 dma_addr_t; -typedef unsigned int kmem_bufctl_t; - #endif /* __KERNEL__ */ #endif diff --git a/mm/slab.c b/mm/slab.c index ae6cca04de4..59d382fbca1 100644 --- a/mm/slab.c +++ b/mm/slab.c @@ -189,6 +189,7 @@ * is less than 512 (PAGE_SIZE<<3), but greater than 256. */ +typedef unsigned int kmem_bufctl_t; #define BUFCTL_END (((kmem_bufctl_t)(~0U))-0) #define BUFCTL_FREE (((kmem_bufctl_t)(~0U))-1) #define SLAB_LIMIT (((kmem_bufctl_t)(~0U))-2) -- cgit v1.2.3-70-g09d2 From a600388d28419305aad3c4c0af52c223cf6fa0af Mon Sep 17 00:00:00 2001 From: Zachary Amsden Date: Sat, 3 Sep 2005 15:55:04 -0700 Subject: [PATCH] x86: ptep_clear optimization Add a new accessor for PTEs, which passes the full hint from the mmu_gather struct; this allows architectures with hardware pagetables to optimize away atomic PTE operations when destroying an address space. Removing the locked operation should allow better pipelining of memory access in this loop. I measured an average savings of 30-35 cycles per zap_pte_range on the first 500 destructions on Pentium-M, but I believe the optimization would win more on older processors which still assert the bus lock on xchg for an exclusive cacheline. Update: I made some new measurements, and this saves exactly 26 cycles over ptep_get_and_clear on Pentium M. On P4, with a PAE kernel, this saves 180 cycles per ptep_get_and_clear, for a whopping 92160 cycles savings for a full address space destruction. pte_clear_full is not yet used, but is provided for future optimizations (in particular, when running inside of a hypervisor that queues page table updates, the full hint allows us to avoid queueing unnecessary page table update for an address space in the process of being destroyed. This is not a huge win, but it does help a bit, and sets the stage for further hypervisor optimization of the mm layer on all architectures. Signed-off-by: Zachary Amsden Cc: Christoph Lameter Cc: Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- include/asm-generic/pgtable.h | 16 ++++++++++++++++ include/asm-i386/pgtable.h | 13 +++++++++++++ mm/memory.c | 5 +++-- 3 files changed, 32 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h index f4059356517..f86c1e54946 100644 --- a/include/asm-generic/pgtable.h +++ b/include/asm-generic/pgtable.h @@ -101,6 +101,22 @@ do { \ }) #endif +#ifndef __HAVE_ARCH_PTEP_GET_AND_CLEAR_FULL +#define ptep_get_and_clear_full(__mm, __address, __ptep, __full) \ +({ \ + pte_t __pte; \ + __pte = ptep_get_and_clear((__mm), (__address), (__ptep)); \ + __pte; \ +}) +#endif + +#ifndef __HAVE_ARCH_PTE_CLEAR_FULL +#define pte_clear_full(__mm, __address, __ptep, __full) \ +do { \ + pte_clear((__mm), (__address), (__ptep)); \ +} while (0) +#endif + #ifndef __HAVE_ARCH_PTEP_CLEAR_FLUSH #define ptep_clear_flush(__vma, __address, __ptep) \ ({ \ diff --git a/include/asm-i386/pgtable.h b/include/asm-i386/pgtable.h index f51fd2c956b..d74185aee15 100644 --- a/include/asm-i386/pgtable.h +++ b/include/asm-i386/pgtable.h @@ -260,6 +260,18 @@ static inline int ptep_test_and_clear_young(struct vm_area_struct *vma, unsigned return test_and_clear_bit(_PAGE_BIT_ACCESSED, &ptep->pte_low); } +static inline pte_t ptep_get_and_clear_full(struct mm_struct *mm, unsigned long addr, pte_t *ptep, int full) +{ + pte_t pte; + if (full) { + pte = *ptep; + *ptep = __pte(0); + } else { + pte = ptep_get_and_clear(mm, addr, ptep); + } + return pte; +} + static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr, pte_t *ptep) { clear_bit(_PAGE_BIT_RW, &ptep->pte_low); @@ -417,6 +429,7 @@ extern void noexec_setup(const char *str); #define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG #define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_DIRTY #define __HAVE_ARCH_PTEP_GET_AND_CLEAR +#define __HAVE_ARCH_PTEP_GET_AND_CLEAR_FULL #define __HAVE_ARCH_PTEP_SET_WRPROTECT #define __HAVE_ARCH_PTE_SAME #include diff --git a/mm/memory.c b/mm/memory.c index b25f5e58a14..788a6281034 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -562,7 +562,8 @@ static void zap_pte_range(struct mmu_gather *tlb, pmd_t *pmd, page->index > details->last_index)) continue; } - ptent = ptep_get_and_clear(tlb->mm, addr, pte); + ptent = ptep_get_and_clear_full(tlb->mm, addr, pte, + tlb->fullmm); tlb_remove_tlb_entry(tlb, pte, addr); if (unlikely(!page)) continue; @@ -590,7 +591,7 @@ static void zap_pte_range(struct mmu_gather *tlb, pmd_t *pmd, continue; if (!pte_file(ptent)) free_swap_and_cache(pte_to_swp_entry(ptent)); - pte_clear(tlb->mm, addr, pte); + pte_clear_full(tlb->mm, addr, pte, tlb->fullmm); } while (pte++, addr += PAGE_SIZE, addr != end); pte_unmap(pte - 1); } -- cgit v1.2.3-70-g09d2 From 61e06037e764337da39dff307cbcdbe9cf288349 Mon Sep 17 00:00:00 2001 From: Zachary Amsden Date: Sat, 3 Sep 2005 15:55:06 -0700 Subject: [PATCH] x86_64: avoid some atomic operations during address space destruction Any architecture that has hardware updated A/D bits that require synchronization against other processors during PTE operations can benefit from doing non-atomic PTE updates during address space destruction. Originally done on i386, now ported to x86_64. Doing a read/write pair instead of an xchg() operation saves the implicit lock, which turns out to be a big win on 32-bit (esp w PAE). Signed-off-by: Zachary Amsden Cc: Andi Kleen Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- include/asm-x86_64/pgtable.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'include') diff --git a/include/asm-x86_64/pgtable.h b/include/asm-x86_64/pgtable.h index a1ada852f00..5e0f2fdab0d 100644 --- a/include/asm-x86_64/pgtable.h +++ b/include/asm-x86_64/pgtable.h @@ -104,6 +104,19 @@ extern inline void pgd_clear (pgd_t * pgd) ((unsigned long) __va(pud_val(pud) & PHYSICAL_PAGE_MASK)) #define ptep_get_and_clear(mm,addr,xp) __pte(xchg(&(xp)->pte, 0)) + +static inline pte_t ptep_get_and_clear_full(struct mm_struct *mm, unsigned long addr, pte_t *ptep, int full) +{ + pte_t pte; + if (full) { + pte = *ptep; + *ptep = __pte(0); + } else { + pte = ptep_get_and_clear(mm, addr, ptep); + } + return pte; +} + #define pte_same(a, b) ((a).pte == (b).pte) #define PMD_SIZE (1UL << PMD_SHIFT) @@ -434,6 +447,7 @@ extern int kern_addr_valid(unsigned long addr); #define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG #define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_DIRTY #define __HAVE_ARCH_PTEP_GET_AND_CLEAR +#define __HAVE_ARCH_PTEP_GET_AND_CLEAR_FULL #define __HAVE_ARCH_PTEP_SET_WRPROTECT #define __HAVE_ARCH_PTE_SAME #include -- cgit v1.2.3-70-g09d2 From c07e02db76940c75fc92f2f2c9adcdbb09ed70d0 Mon Sep 17 00:00:00 2001 From: Martin Hicks Date: Sat, 3 Sep 2005 15:55:11 -0700 Subject: [PATCH] VM: add page_state info to per-node meminfo Add page_state info to the per-node meminfo file in sysfs. This is mostly just for informational purposes. The lack of this information was brought up recently during a discussion regarding pagecache clearing, and I put this patch together to test out one of the suggestions. It seems like interesting info to have, so I'm submitting the patch. Signed-off-by: Martin Hicks Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/base/node.c | 24 ++++++++++++++++++++++-- include/linux/page-flags.h | 1 + mm/page_alloc.c | 25 ++++++++++++++++++++----- 3 files changed, 43 insertions(+), 7 deletions(-) (limited to 'include') diff --git a/drivers/base/node.c b/drivers/base/node.c index 904b27caf69..16c513aa4d4 100644 --- a/drivers/base/node.c +++ b/drivers/base/node.c @@ -39,13 +39,25 @@ static ssize_t node_read_meminfo(struct sys_device * dev, char * buf) int n; int nid = dev->id; struct sysinfo i; + struct page_state ps; unsigned long inactive; unsigned long active; unsigned long free; si_meminfo_node(&i, nid); + get_page_state_node(&ps, nid); __get_zone_counts(&active, &inactive, &free, NODE_DATA(nid)); + /* Check for negative values in these approximate counters */ + if ((long)ps.nr_dirty < 0) + ps.nr_dirty = 0; + if ((long)ps.nr_writeback < 0) + ps.nr_writeback = 0; + if ((long)ps.nr_mapped < 0) + ps.nr_mapped = 0; + if ((long)ps.nr_slab < 0) + ps.nr_slab = 0; + n = sprintf(buf, "\n" "Node %d MemTotal: %8lu kB\n" "Node %d MemFree: %8lu kB\n" @@ -55,7 +67,11 @@ static ssize_t node_read_meminfo(struct sys_device * dev, char * buf) "Node %d HighTotal: %8lu kB\n" "Node %d HighFree: %8lu kB\n" "Node %d LowTotal: %8lu kB\n" - "Node %d LowFree: %8lu kB\n", + "Node %d LowFree: %8lu kB\n" + "Node %d Dirty: %8lu kB\n" + "Node %d Writeback: %8lu kB\n" + "Node %d Mapped: %8lu kB\n" + "Node %d Slab: %8lu kB\n", nid, K(i.totalram), nid, K(i.freeram), nid, K(i.totalram - i.freeram), @@ -64,7 +80,11 @@ static ssize_t node_read_meminfo(struct sys_device * dev, char * buf) nid, K(i.totalhigh), nid, K(i.freehigh), nid, K(i.totalram - i.totalhigh), - nid, K(i.freeram - i.freehigh)); + nid, K(i.freeram - i.freehigh), + nid, K(ps.nr_dirty), + nid, K(ps.nr_writeback), + nid, K(ps.nr_mapped), + nid, K(ps.nr_slab)); n += hugetlb_report_node_meminfo(nid, buf + n); return n; } diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h index 99f7cc49506..f34767c5fc7 100644 --- a/include/linux/page-flags.h +++ b/include/linux/page-flags.h @@ -134,6 +134,7 @@ struct page_state { }; extern void get_page_state(struct page_state *ret); +extern void get_page_state_node(struct page_state *ret, int node); extern void get_full_page_state(struct page_state *ret); extern unsigned long __read_page_state(unsigned long offset); extern void __mod_page_state(unsigned long offset, unsigned long delta); diff --git a/mm/page_alloc.c b/mm/page_alloc.c index d157dae8c9f..b06a9636d97 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -1130,19 +1130,20 @@ EXPORT_SYMBOL(nr_pagecache); DEFINE_PER_CPU(long, nr_pagecache_local) = 0; #endif -void __get_page_state(struct page_state *ret, int nr) +void __get_page_state(struct page_state *ret, int nr, cpumask_t *cpumask) { int cpu = 0; memset(ret, 0, sizeof(*ret)); + cpus_and(*cpumask, *cpumask, cpu_online_map); - cpu = first_cpu(cpu_online_map); + cpu = first_cpu(*cpumask); while (cpu < NR_CPUS) { unsigned long *in, *out, off; in = (unsigned long *)&per_cpu(page_states, cpu); - cpu = next_cpu(cpu, cpu_online_map); + cpu = next_cpu(cpu, *cpumask); if (cpu < NR_CPUS) prefetch(&per_cpu(page_states, cpu)); @@ -1153,19 +1154,33 @@ void __get_page_state(struct page_state *ret, int nr) } } +void get_page_state_node(struct page_state *ret, int node) +{ + int nr; + cpumask_t mask = node_to_cpumask(node); + + nr = offsetof(struct page_state, GET_PAGE_STATE_LAST); + nr /= sizeof(unsigned long); + + __get_page_state(ret, nr+1, &mask); +} + void get_page_state(struct page_state *ret) { int nr; + cpumask_t mask = CPU_MASK_ALL; nr = offsetof(struct page_state, GET_PAGE_STATE_LAST); nr /= sizeof(unsigned long); - __get_page_state(ret, nr + 1); + __get_page_state(ret, nr + 1, &mask); } void get_full_page_state(struct page_state *ret) { - __get_page_state(ret, sizeof(*ret) / sizeof(unsigned long)); + cpumask_t mask = CPU_MASK_ALL; + + __get_page_state(ret, sizeof(*ret) / sizeof(unsigned long), &mask); } unsigned long __read_page_state(unsigned long offset) -- cgit v1.2.3-70-g09d2 From f4f1269cb36adfb452c04dcb3d40f51b8a1956bb Mon Sep 17 00:00:00 2001 From: Kumar Gala Date: Sat, 3 Sep 2005 15:55:21 -0700 Subject: [PATCH] ppc32: Remove board support for ASH Support for the ASH board is no longer maintained and thus being removed Signed-off-by: Kumar Gala Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- arch/ppc/boot/simple/embed_config.c | 2 +- arch/ppc/configs/ash_defconfig | 666 ------------------------------------ arch/ppc/platforms/4xx/Kconfig | 5 - arch/ppc/platforms/4xx/Makefile | 1 - arch/ppc/platforms/4xx/ash.c | 250 -------------- arch/ppc/platforms/4xx/ash.h | 83 ----- arch/ppc/syslib/ppc4xx_setup.c | 2 +- include/asm-ppc/ibm4xx.h | 4 - 8 files changed, 2 insertions(+), 1011 deletions(-) delete mode 100644 arch/ppc/configs/ash_defconfig delete mode 100644 arch/ppc/platforms/4xx/ash.c delete mode 100644 arch/ppc/platforms/4xx/ash.h (limited to 'include') diff --git a/arch/ppc/boot/simple/embed_config.c b/arch/ppc/boot/simple/embed_config.c index c342b47e763..8dd5fb0fb77 100644 --- a/arch/ppc/boot/simple/embed_config.c +++ b/arch/ppc/boot/simple/embed_config.c @@ -784,7 +784,7 @@ embed_config(bd_t ** bdp) #ifdef CONFIG_IBM_OPENBIOS /* This could possibly work for all treeboot roms. */ -#if defined(CONFIG_ASH) || defined(CONFIG_BEECH) || defined(CONFIG_BUBINGA) +#if defined(CONFIG_BEECH) || defined(CONFIG_BUBINGA) #define BOARD_INFO_VECTOR 0xFFF80B50 /* openbios 1.19 moved this vector down - armin */ #else #define BOARD_INFO_VECTOR 0xFFFE0B50 diff --git a/arch/ppc/configs/ash_defconfig b/arch/ppc/configs/ash_defconfig deleted file mode 100644 index c4a73cc16cf..00000000000 --- a/arch/ppc/configs/ash_defconfig +++ /dev/null @@ -1,666 +0,0 @@ -# -# Automatically generated make config: don't edit -# -CONFIG_MMU=y -CONFIG_RWSEM_XCHGADD_ALGORITHM=y -CONFIG_HAVE_DEC_LOCK=y -CONFIG_PPC=y -CONFIG_PPC32=y -CONFIG_GENERIC_NVRAM=y - -# -# Code maturity level options -# -CONFIG_EXPERIMENTAL=y -CONFIG_CLEAN_COMPILE=y -CONFIG_STANDALONE=y -CONFIG_BROKEN_ON_SMP=y - -# -# General setup -# -CONFIG_SWAP=y -CONFIG_SYSVIPC=y -# CONFIG_BSD_PROCESS_ACCT is not set -CONFIG_SYSCTL=y -CONFIG_LOG_BUF_SHIFT=14 -# CONFIG_HOTPLUG is not set -# CONFIG_IKCONFIG is not set -CONFIG_EMBEDDED=y -# CONFIG_KALLSYMS is not set -CONFIG_FUTEX=y -# CONFIG_EPOLL is not set -CONFIG_IOSCHED_NOOP=y -CONFIG_IOSCHED_AS=y -CONFIG_IOSCHED_DEADLINE=y -# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set - -# -# Loadable module support -# -CONFIG_MODULES=y -CONFIG_MODULE_UNLOAD=y -# CONFIG_MODULE_FORCE_UNLOAD is not set -CONFIG_OBSOLETE_MODPARM=y -# CONFIG_MODVERSIONS is not set -CONFIG_KMOD=y - -# -# Processor -# -# CONFIG_6xx is not set -CONFIG_40x=y -# CONFIG_44x is not set -# CONFIG_POWER3 is not set -# CONFIG_POWER4 is not set -# CONFIG_8xx is not set -# CONFIG_MATH_EMULATION is not set -# CONFIG_CPU_FREQ is not set -CONFIG_4xx=y - -# -# IBM 4xx options -# -CONFIG_ASH=y -# CONFIG_CPCI405 is not set -# CONFIG_EP405 is not set -# CONFIG_EVB405EP is not set -# CONFIG_OAK is not set -# CONFIG_REDWOOD_5 is not set -# CONFIG_REDWOOD_6 is not set -# CONFIG_SYCAMORE is not set -# CONFIG_WALNUT is not set -CONFIG_NP405H=y -CONFIG_IBM405_ERR77=y -CONFIG_IBM405_ERR51=y -CONFIG_IBM_OCP=y -CONFIG_PPC_OCP=y -CONFIG_IBM_OPENBIOS=y -# CONFIG_PM is not set -CONFIG_UART0_TTYS0=y -# CONFIG_UART0_TTYS1 is not set -CONFIG_NOT_COHERENT_CACHE=y - -# -# Platform options -# -# CONFIG_PC_KEYBOARD is not set -# CONFIG_SMP is not set -# CONFIG_PREEMPT is not set -# CONFIG_HIGHMEM is not set -CONFIG_KERNEL_ELF=y -CONFIG_BINFMT_ELF=y -# CONFIG_BINFMT_MISC is not set -CONFIG_CMDLINE_BOOL=y -CONFIG_CMDLINE="ip=on" - -# -# Bus options -# -CONFIG_PCI=y -CONFIG_PCI_DOMAINS=y -CONFIG_PCI_LEGACY_PROC=y -# CONFIG_PCI_NAMES is not set - -# -# Advanced setup -# -# CONFIG_ADVANCED_OPTIONS is not set - -# -# Default settings for advanced configuration options are used -# -CONFIG_HIGHMEM_START=0xfe000000 -CONFIG_LOWMEM_SIZE=0x30000000 -CONFIG_KERNEL_START=0xc0000000 -CONFIG_TASK_SIZE=0x80000000 -CONFIG_BOOT_LOAD=0x00400000 - -# -# Device Drivers -# - -# -# Generic Driver Options -# - -# -# Memory Technology Devices (MTD) -# -# CONFIG_MTD is not set - -# -# Parallel port support -# -# CONFIG_PARPORT is not set - -# -# Plug and Play support -# - -# -# Block devices -# -# CONFIG_BLK_DEV_FD is not set -# CONFIG_BLK_CPQ_DA is not set -# CONFIG_BLK_CPQ_CISS_DA is not set -# CONFIG_BLK_DEV_DAC960 is not set -# CONFIG_BLK_DEV_UMEM is not set -CONFIG_BLK_DEV_LOOP=y -# CONFIG_BLK_DEV_CRYPTOLOOP is not set -# CONFIG_BLK_DEV_NBD is not set -# CONFIG_BLK_DEV_CARMEL is not set -CONFIG_BLK_DEV_RAM=y -CONFIG_BLK_DEV_RAM_SIZE=4096 -CONFIG_BLK_DEV_INITRD=y -# CONFIG_LBD is not set - -# -# ATA/ATAPI/MFM/RLL support -# -# CONFIG_IDE is not set - -# -# SCSI device support -# -# CONFIG_SCSI is not set - -# -# Multi-device support (RAID and LVM) -# -# CONFIG_MD is not set - -# -# Fusion MPT device support -# -# CONFIG_FUSION is not set - -# -# IEEE 1394 (FireWire) support -# -# CONFIG_IEEE1394 is not set - -# -# I2O device support -# -# CONFIG_I2O is not set - -# -# Macintosh device drivers -# - -# -# Networking support -# -CONFIG_NET=y - -# -# Networking options -# -# CONFIG_PACKET is not set -# CONFIG_NETLINK_DEV is not set -CONFIG_UNIX=y -# CONFIG_NET_KEY is not set -CONFIG_INET=y -CONFIG_IP_MULTICAST=y -# CONFIG_IP_ADVANCED_ROUTER is not set -CONFIG_IP_PNP=y -# CONFIG_IP_PNP_DHCP is not set -CONFIG_IP_PNP_BOOTP=y -# CONFIG_IP_PNP_RARP is not set -# CONFIG_NET_IPIP is not set -# CONFIG_NET_IPGRE is not set -# CONFIG_IP_MROUTE is not set -# CONFIG_ARPD is not set -CONFIG_SYN_COOKIES=y -# CONFIG_INET_AH is not set -# CONFIG_INET_ESP is not set -# CONFIG_INET_IPCOMP is not set -# CONFIG_IPV6 is not set -# CONFIG_DECNET is not set -# CONFIG_BRIDGE is not set -# CONFIG_NETFILTER is not set - -# -# SCTP Configuration (EXPERIMENTAL) -# -# CONFIG_IP_SCTP is not set -# CONFIG_ATM is not set -# CONFIG_VLAN_8021Q is not set -# CONFIG_LLC2 is not set -# CONFIG_IPX is not set -# CONFIG_ATALK is not set -# CONFIG_X25 is not set -# CONFIG_LAPB is not set -# CONFIG_NET_DIVERT is not set -# CONFIG_ECONET is not set -# CONFIG_WAN_ROUTER is not set -# CONFIG_NET_HW_FLOWCONTROL is not set - -# -# QoS and/or fair queueing -# -# CONFIG_NET_SCHED is not set - -# -# Network testing -# -# CONFIG_NET_PKTGEN is not set -CONFIG_NETDEVICES=y - -# -# ARCnet devices -# -# CONFIG_ARCNET is not set -# CONFIG_DUMMY is not set -# CONFIG_BONDING is not set -# CONFIG_EQUALIZER is not set -# CONFIG_TUN is not set - -# -# Ethernet (10 or 100Mbit) -# -# CONFIG_NET_ETHERNET is not set - -# -# Ethernet (1000 Mbit) -# -# CONFIG_ACENIC is not set -# CONFIG_DL2K is not set -# CONFIG_E1000 is not set -# CONFIG_NS83820 is not set -# CONFIG_HAMACHI is not set -# CONFIG_YELLOWFIN is not set -# CONFIG_R8169 is not set -# CONFIG_SIS190 is not set -# CONFIG_SK98LIN is not set -# CONFIG_TIGON3 is not set - -# -# Ethernet (10000 Mbit) -# -# CONFIG_IXGB is not set -CONFIG_IBM_EMAC=y -# CONFIG_IBM_EMAC_ERRMSG is not set -CONFIG_IBM_EMAC_RXB=64 -CONFIG_IBM_EMAC_TXB=8 -CONFIG_IBM_EMAC_FGAP=8 -CONFIG_IBM_EMAC_SKBRES=0 -# CONFIG_FDDI is not set -# CONFIG_HIPPI is not set -# CONFIG_PPP is not set -# CONFIG_SLIP is not set - -# -# Wireless LAN (non-hamradio) -# -# CONFIG_NET_RADIO is not set - -# -# Token Ring devices -# -# CONFIG_TR is not set -# CONFIG_RCPCI is not set -# CONFIG_SHAPER is not set -# CONFIG_NETCONSOLE is not set - -# -# Wan interfaces -# -# CONFIG_WAN is not set - -# -# Amateur Radio support -# -# CONFIG_HAMRADIO is not set - -# -# IrDA (infrared) support -# -# CONFIG_IRDA is not set - -# -# Bluetooth support -# -# CONFIG_BT is not set -# CONFIG_NETPOLL is not set -# CONFIG_NET_POLL_CONTROLLER is not set - -# -# ISDN subsystem -# -# CONFIG_ISDN is not set - -# -# Telephony Support -# -# CONFIG_PHONE is not set - -# -# Input device support -# -CONFIG_INPUT=y - -# -# Userland interfaces -# -CONFIG_INPUT_MOUSEDEV=y -CONFIG_INPUT_MOUSEDEV_PSAUX=y -CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024 -CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 -# CONFIG_INPUT_JOYDEV is not set -# CONFIG_INPUT_TSDEV is not set -# CONFIG_INPUT_EVDEV is not set -# CONFIG_INPUT_EVBUG is not set - -# -# Input I/O drivers -# -# CONFIG_GAMEPORT is not set -CONFIG_SOUND_GAMEPORT=y -CONFIG_SERIO=y -CONFIG_SERIO_I8042=y -CONFIG_SERIO_SERPORT=y -# CONFIG_SERIO_CT82C710 is not set -# CONFIG_SERIO_PCIPS2 is not set - -# -# Input Device Drivers -# -CONFIG_INPUT_KEYBOARD=y -CONFIG_KEYBOARD_ATKBD=y -# CONFIG_KEYBOARD_SUNKBD is not set -# CONFIG_KEYBOARD_LKKBD is not set -# CONFIG_KEYBOARD_XTKBD is not set -# CONFIG_KEYBOARD_NEWTON is not set -CONFIG_INPUT_MOUSE=y -CONFIG_MOUSE_PS2=y -# CONFIG_MOUSE_SERIAL is not set -# CONFIG_MOUSE_VSXXXAA is not set -# CONFIG_INPUT_JOYSTICK is not set -# CONFIG_INPUT_TOUCHSCREEN is not set -# CONFIG_INPUT_MISC is not set - -# -# Character devices -# -# CONFIG_VT is not set -# CONFIG_SERIAL_NONSTANDARD is not set - -# -# Serial drivers -# -CONFIG_SERIAL_8250=y -CONFIG_SERIAL_8250_CONSOLE=y -CONFIG_SERIAL_8250_NR_UARTS=4 -# CONFIG_SERIAL_8250_EXTENDED is not set - -# -# Non-8250 serial port support -# -CONFIG_SERIAL_CORE=y -CONFIG_SERIAL_CORE_CONSOLE=y -CONFIG_UNIX98_PTYS=y -CONFIG_LEGACY_PTYS=y -CONFIG_LEGACY_PTY_COUNT=256 -# CONFIG_QIC02_TAPE is not set - -# -# IPMI -# -# CONFIG_IPMI_HANDLER is not set - -# -# Watchdog Cards -# -CONFIG_WATCHDOG=y -# CONFIG_WATCHDOG_NOWAYOUT is not set - -# -# Watchdog Device Drivers -# -# CONFIG_SOFT_WATCHDOG is not set - -# -# PCI-based Watchdog Cards -# -# CONFIG_PCIPCWATCHDOG is not set -# CONFIG_WDTPCI is not set -# CONFIG_NVRAM is not set -CONFIG_GEN_RTC=y -# CONFIG_GEN_RTC_X is not set -# CONFIG_DTLK is not set -# CONFIG_R3964 is not set -# CONFIG_APPLICOM is not set - -# -# Ftape, the floppy tape device driver -# -# CONFIG_FTAPE is not set -# CONFIG_AGP is not set -# CONFIG_DRM is not set -# CONFIG_RAW_DRIVER is not set - -# -# I2C support -# -CONFIG_I2C=y -# CONFIG_I2C_CHARDEV is not set - -# -# I2C Algorithms -# -# CONFIG_I2C_ALGOBIT is not set -# CONFIG_I2C_ALGOPCF is not set - -# -# I2C Hardware Bus support -# -# CONFIG_I2C_ALI1535 is not set -# CONFIG_I2C_ALI15X3 is not set -# CONFIG_I2C_AMD756 is not set -# CONFIG_I2C_AMD8111 is not set -# CONFIG_I2C_I801 is not set -# CONFIG_I2C_I810 is not set -# CONFIG_I2C_IBM_IIC is not set -# CONFIG_I2C_ISA is not set -# CONFIG_I2C_NFORCE2 is not set -# CONFIG_I2C_PARPORT_LIGHT is not set -# CONFIG_I2C_PIIX4 is not set -# CONFIG_I2C_PROSAVAGE is not set -# CONFIG_I2C_SAVAGE4 is not set -# CONFIG_SCx200_ACB is not set -# CONFIG_I2C_SIS5595 is not set -# CONFIG_I2C_SIS630 is not set -# CONFIG_I2C_SIS96X is not set -# CONFIG_I2C_VIA is not set -# CONFIG_I2C_VIAPRO is not set -# CONFIG_I2C_VOODOO3 is not set - -# -# Hardware Sensors Chip support -# -# CONFIG_I2C_SENSOR is not set -# CONFIG_SENSORS_ADM1021 is not set -# CONFIG_SENSORS_ASB100 is not set -# CONFIG_SENSORS_DS1621 is not set -# CONFIG_SENSORS_FSCHER is not set -# CONFIG_SENSORS_GL518SM is not set -# CONFIG_SENSORS_IT87 is not set -# CONFIG_SENSORS_LM75 is not set -# CONFIG_SENSORS_LM78 is not set -# CONFIG_SENSORS_LM80 is not set -# CONFIG_SENSORS_LM83 is not set -# CONFIG_SENSORS_LM85 is not set -# CONFIG_SENSORS_LM90 is not set -# CONFIG_SENSORS_VIA686A is not set -# CONFIG_SENSORS_W83781D is not set -# CONFIG_SENSORS_W83L785TS is not set -# CONFIG_SENSORS_W83627HF is not set - -# -# Other I2C Chip support -# -# CONFIG_SENSORS_EEPROM is not set -# CONFIG_I2C_DEBUG_CORE is not set -# CONFIG_I2C_DEBUG_ALGO is not set -# CONFIG_I2C_DEBUG_BUS is not set -# CONFIG_I2C_DEBUG_CHIP is not set - -# -# Misc devices -# - -# -# Multimedia devices -# -# CONFIG_VIDEO_DEV is not set - -# -# Digital Video Broadcasting Devices -# -# CONFIG_DVB is not set - -# -# Graphics support -# -# CONFIG_FB is not set - -# -# Sound -# -# CONFIG_SOUND is not set - -# -# USB support -# -# CONFIG_USB is not set - -# -# USB Gadget Support -# -# CONFIG_USB_GADGET is not set - -# -# File systems -# -CONFIG_EXT2_FS=y -# CONFIG_EXT2_FS_XATTR is not set -# CONFIG_EXT3_FS is not set -# CONFIG_JBD is not set -# CONFIG_REISERFS_FS is not set -# CONFIG_JFS_FS is not set -# CONFIG_XFS_FS is not set -# CONFIG_MINIX_FS is not set -# CONFIG_ROMFS_FS is not set -# CONFIG_QUOTA is not set -# CONFIG_AUTOFS_FS is not set -# CONFIG_AUTOFS4_FS is not set - -# -# CD-ROM/DVD Filesystems -# -# CONFIG_ISO9660_FS is not set -# CONFIG_UDF_FS is not set - -# -# DOS/FAT/NT Filesystems -# -# CONFIG_FAT_FS is not set -# CONFIG_NTFS_FS is not set - -# -# Pseudo filesystems -# -CONFIG_PROC_FS=y -CONFIG_PROC_KCORE=y -# CONFIG_DEVFS_FS is not set -# CONFIG_DEVPTS_FS_XATTR is not set -CONFIG_TMPFS=y -# CONFIG_HUGETLB_PAGE is not set -CONFIG_RAMFS=y - -# -# Miscellaneous filesystems -# -# CONFIG_ADFS_FS is not set -# CONFIG_AFFS_FS is not set -# CONFIG_HFS_FS is not set -# CONFIG_HFSPLUS_FS is not set -# CONFIG_BEFS_FS is not set -# CONFIG_BFS_FS is not set -# CONFIG_EFS_FS is not set -# CONFIG_CRAMFS is not set -# CONFIG_VXFS_FS is not set -# CONFIG_HPFS_FS is not set -# CONFIG_QNX4FS_FS is not set -# CONFIG_SYSV_FS is not set -# CONFIG_UFS_FS is not set - -# -# Network File Systems -# -CONFIG_NFS_FS=y -# CONFIG_NFS_V3 is not set -# CONFIG_NFS_V4 is not set -# CONFIG_NFS_DIRECTIO is not set -# CONFIG_NFSD is not set -CONFIG_ROOT_NFS=y -CONFIG_LOCKD=y -# CONFIG_EXPORTFS is not set -CONFIG_SUNRPC=y -# CONFIG_RPCSEC_GSS_KRB5 is not set -# CONFIG_SMB_FS is not set -# CONFIG_CIFS is not set -# CONFIG_NCP_FS is not set -# CONFIG_CODA_FS is not set -# CONFIG_INTERMEZZO_FS is not set -# CONFIG_AFS_FS is not set - -# -# Partition Types -# -CONFIG_PARTITION_ADVANCED=y -# CONFIG_ACORN_PARTITION is not set -# CONFIG_OSF_PARTITION is not set -# CONFIG_AMIGA_PARTITION is not set -# CONFIG_ATARI_PARTITION is not set -# CONFIG_MAC_PARTITION is not set -# CONFIG_MSDOS_PARTITION is not set -# CONFIG_LDM_PARTITION is not set -# CONFIG_NEC98_PARTITION is not set -# CONFIG_SGI_PARTITION is not set -# CONFIG_ULTRIX_PARTITION is not set -# CONFIG_SUN_PARTITION is not set -# CONFIG_EFI_PARTITION is not set - -# -# Native Language Support -# -# CONFIG_NLS is not set - -# -# IBM 40x options -# - -# -# Library routines -# -CONFIG_CRC32=y - -# -# Kernel hacking -# -# CONFIG_DEBUG_KERNEL is not set -# CONFIG_SERIAL_TEXT_DEBUG is not set -CONFIG_OCP=y - -# -# Security options -# -# CONFIG_SECURITY is not set - -# -# Cryptographic options -# -# CONFIG_CRYPTO is not set diff --git a/arch/ppc/platforms/4xx/Kconfig b/arch/ppc/platforms/4xx/Kconfig index 805dd98908a..a7eaba91dfb 100644 --- a/arch/ppc/platforms/4xx/Kconfig +++ b/arch/ppc/platforms/4xx/Kconfig @@ -16,11 +16,6 @@ choice depends on 40x default WALNUT -config ASH - bool "Ash" - help - This option enables support for the IBM NP405H evaluation board. - config BUBINGA bool "Bubinga" select WANT_EARLY_SERIAL diff --git a/arch/ppc/platforms/4xx/Makefile b/arch/ppc/platforms/4xx/Makefile index 844c3b5066e..f00e0d02ee2 100644 --- a/arch/ppc/platforms/4xx/Makefile +++ b/arch/ppc/platforms/4xx/Makefile @@ -1,7 +1,6 @@ # # Makefile for the PowerPC 4xx linux kernel. -obj-$(CONFIG_ASH) += ash.o obj-$(CONFIG_BAMBOO) += bamboo.o obj-$(CONFIG_CPCI405) += cpci405.o obj-$(CONFIG_EBONY) += ebony.o diff --git a/arch/ppc/platforms/4xx/ash.c b/arch/ppc/platforms/4xx/ash.c deleted file mode 100644 index ce291179371..00000000000 --- a/arch/ppc/platforms/4xx/ash.c +++ /dev/null @@ -1,250 +0,0 @@ -/* - * arch/ppc/platforms/4xx/ash.c - * - * Support for the IBM NP405H ash eval board - * - * Author: Armin Kuster - * - * 2001-2002 (c) MontaVista, Software, Inc. This file is licensed under - * the terms of the GNU General Public License version 2. This program - * is licensed "as is" without any warranty of any kind, whether express - * or implied. - */ -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#ifdef DEBUG -#define DBG(x...) printk(x) -#else -#define DBG(x...) -#endif - -void *ash_rtc_base; - -/* Some IRQs unique to Walnut. - * Used by the generic 405 PCI setup functions in ppc4xx_pci.c - */ -int __init -ppc405_map_irq(struct pci_dev *dev, unsigned char idsel, unsigned char pin) -{ - static char pci_irq_table[][4] = - /* - * PCI IDSEL/INTPIN->INTLINE - * A B C D - */ - { - {24, 24, 24, 24}, /* IDSEL 1 - PCI slot 1 */ - {25, 25, 25, 25}, /* IDSEL 2 - PCI slot 2 */ - {26, 26, 26, 26}, /* IDSEL 3 - PCI slot 3 */ - {27, 27, 27, 27}, /* IDSEL 4 - PCI slot 4 */ - }; - - const long min_idsel = 1, max_idsel = 4, irqs_per_slot = 4; - return PCI_IRQ_TABLE_LOOKUP; -} - -void __init -ash_setup_arch(void) -{ - ppc4xx_setup_arch(); - - ibm_ocp_set_emac(0, 3); - -#ifdef CONFIG_DEBUG_BRINGUP - int i; - printk("\n"); - printk("machine\t: %s\n", PPC4xx_MACHINE_NAME); - printk("\n"); - printk("bi_s_version\t %s\n", bip->bi_s_version); - printk("bi_r_version\t %s\n", bip->bi_r_version); - printk("bi_memsize\t 0x%8.8x\t %dMBytes\n", bip->bi_memsize, - bip->bi_memsize / (1024 * 1000)); - for (i = 0; i < EMAC_NUMS; i++) { - printk("bi_enetaddr %d\t %2.2x%2.2x%2.2x-%2.2x%2.2x%2.2x\n", i, - bip->bi_enetaddr[i][0], bip->bi_enetaddr[i][1], - bip->bi_enetaddr[i][2], bip->bi_enetaddr[i][3], - bip->bi_enetaddr[i][4], bip->bi_enetaddr[i][5]); - } - printk("bi_pci_enetaddr %d\t %2.2x%2.2x%2.2x-%2.2x%2.2x%2.2x\n", 0, - bip->bi_pci_enetaddr[0], bip->bi_pci_enetaddr[1], - bip->bi_pci_enetaddr[2], bip->bi_pci_enetaddr[3], - bip->bi_pci_enetaddr[4], bip->bi_pci_enetaddr[5]); - - printk("bi_intfreq\t 0x%8.8x\t clock:\t %dMhz\n", - bip->bi_intfreq, bip->bi_intfreq / 1000000); - - printk("bi_busfreq\t 0x%8.8x\t plb bus clock:\t %dMHz\n", - bip->bi_busfreq, bip->bi_busfreq / 1000000); - printk("bi_pci_busfreq\t 0x%8.8x\t pci bus clock:\t %dMHz\n", - bip->bi_pci_busfreq, bip->bi_pci_busfreq / 1000000); - - printk("\n"); -#endif - /* RTC step for ash */ - ash_rtc_base = (void *) ASH_RTC_VADDR; - TODC_INIT(TODC_TYPE_DS1743, ash_rtc_base, ash_rtc_base, ash_rtc_base, - 8); -} - -void __init -bios_fixup(struct pci_controller *hose, struct pcil0_regs *pcip) -{ - /* - * Expected PCI mapping: - * - * PLB addr PCI memory addr - * --------------------- --------------------- - * 0000'0000 - 7fff'ffff <--- 0000'0000 - 7fff'ffff - * 8000'0000 - Bfff'ffff ---> 8000'0000 - Bfff'ffff - * - * PLB addr PCI io addr - * --------------------- --------------------- - * e800'0000 - e800'ffff ---> 0000'0000 - 0001'0000 - * - * The following code is simplified by assuming that the bootrom - * has been well behaved in following this mapping. - */ - -#ifdef DEBUG - int i; - - printk("ioremap PCLIO_BASE = 0x%x\n", pcip); - printk("PCI bridge regs before fixup \n"); - for (i = 0; i <= 2; i++) { - printk(" pmm%dma\t0x%x\n", i, in_le32(&(pcip->pmm[i].ma))); - printk(" pmm%dla\t0x%x\n", i, in_le32(&(pcip->pmm[i].la))); - printk(" pmm%dpcila\t0x%x\n", i, - in_le32(&(pcip->pmm[i].pcila))); - printk(" pmm%dpciha\t0x%x\n", i, - in_le32(&(pcip->pmm[i].pciha))); - } - printk(" ptm1ms\t0x%x\n", in_le32(&(pcip->ptm1ms))); - printk(" ptm1la\t0x%x\n", in_le32(&(pcip->ptm1la))); - printk(" ptm2ms\t0x%x\n", in_le32(&(pcip->ptm2ms))); - printk(" ptm2la\t0x%x\n", in_le32(&(pcip->ptm2la))); - for (bar = PCI_BASE_ADDRESS_1; bar <= PCI_BASE_ADDRESS_2; bar += 4) { - early_read_config_dword(hose, hose->first_busno, - PCI_FUNC(hose->first_busno), bar, - &bar_response); - DBG("BUS %d, device %d, Function %d bar 0x%8.8x is 0x%8.8x\n", - hose->first_busno, PCI_SLOT(hose->first_busno), - PCI_FUNC(hose->first_busno), bar, bar_response); - } - -#endif - if (ppc_md.progress) - ppc_md.progress("bios_fixup(): enter", 0x800); - - /* added for IBM boot rom version 1.15 bios bar changes -AK */ - - /* Disable region first */ - out_le32((void *) &(pcip->pmm[0].ma), 0x00000000); - /* PLB starting addr, PCI: 0x80000000 */ - out_le32((void *) &(pcip->pmm[0].la), 0x80000000); - /* PCI start addr, 0x80000000 */ - out_le32((void *) &(pcip->pmm[0].pcila), PPC405_PCI_MEM_BASE); - /* 512MB range of PLB to PCI */ - out_le32((void *) &(pcip->pmm[0].pciha), 0x00000000); - /* Enable no pre-fetch, enable region */ - out_le32((void *) &(pcip->pmm[0].ma), ((0xffffffff - - (PPC405_PCI_UPPER_MEM - - PPC405_PCI_MEM_BASE)) | 0x01)); - - /* Disable region one */ - out_le32((void *) &(pcip->pmm[1].ma), 0x00000000); - out_le32((void *) &(pcip->pmm[1].la), 0x00000000); - out_le32((void *) &(pcip->pmm[1].pcila), 0x00000000); - out_le32((void *) &(pcip->pmm[1].pciha), 0x00000000); - out_le32((void *) &(pcip->pmm[1].ma), 0x00000000); - - /* Disable region two */ - out_le32((void *) &(pcip->pmm[2].ma), 0x00000000); - out_le32((void *) &(pcip->pmm[2].la), 0x00000000); - out_le32((void *) &(pcip->pmm[2].pcila), 0x00000000); - out_le32((void *) &(pcip->pmm[2].pciha), 0x00000000); - out_le32((void *) &(pcip->pmm[2].ma), 0x00000000); - - /* Enable PTM1 and PTM2, mapped to PLB address 0. */ - - out_le32((void *) &(pcip->ptm1la), 0x00000000); - out_le32((void *) &(pcip->ptm1ms), 0x00000001); - out_le32((void *) &(pcip->ptm2la), 0x00000000); - out_le32((void *) &(pcip->ptm2ms), 0x00000001); - - /* Write zero to PTM1 BAR. */ - - early_write_config_dword(hose, hose->first_busno, - PCI_FUNC(hose->first_busno), - PCI_BASE_ADDRESS_1, - 0x00000000); - - /* Disable PTM2 (unused) */ - - out_le32((void *) &(pcip->ptm2la), 0x00000000); - out_le32((void *) &(pcip->ptm2ms), 0x00000000); - - /* end work arround */ - if (ppc_md.progress) - ppc_md.progress("bios_fixup(): done", 0x800); - -#ifdef DEBUG - printk("PCI bridge regs after fixup \n"); - for (i = 0; i <= 2; i++) { - printk(" pmm%dma\t0x%x\n", i, in_le32(&(pcip->pmm[i].ma))); - printk(" pmm%dla\t0x%x\n", i, in_le32(&(pcip->pmm[i].la))); - printk(" pmm%dpcila\t0x%x\n", i, - in_le32(&(pcip->pmm[i].pcila))); - printk(" pmm%dpciha\t0x%x\n", i, - in_le32(&(pcip->pmm[i].pciha))); - } - printk(" ptm1ms\t0x%x\n", in_le32(&(pcip->ptm1ms))); - printk(" ptm1la\t0x%x\n", in_le32(&(pcip->ptm1la))); - printk(" ptm2ms\t0x%x\n", in_le32(&(pcip->ptm2ms))); - printk(" ptm2la\t0x%x\n", in_le32(&(pcip->ptm2la))); - - for (bar = PCI_BASE_ADDRESS_1; bar <= PCI_BASE_ADDRESS_2; bar += 4) { - early_read_config_dword(hose, hose->first_busno, - PCI_FUNC(hose->first_busno), bar, - &bar_response); - DBG("BUS %d, device %d, Function %d bar 0x%8.8x is 0x%8.8x\n", - hose->first_busno, PCI_SLOT(hose->first_busno), - PCI_FUNC(hose->first_busno), bar, bar_response); - } - - -#endif -} - -void __init -ash_map_io(void) -{ - ppc4xx_map_io(); - io_block_mapping(ASH_RTC_VADDR, ASH_RTC_PADDR, ASH_RTC_SIZE, _PAGE_IO); -} - -void __init -platform_init(unsigned long r3, unsigned long r4, unsigned long r5, - unsigned long r6, unsigned long r7) -{ - ppc4xx_init(r3, r4, r5, r6, r7); - - ppc_md.setup_arch = ash_setup_arch; - ppc_md.setup_io_mappings = ash_map_io; - -#ifdef CONFIG_PPC_RTC - ppc_md.time_init = todc_time_init; - ppc_md.set_rtc_time = todc_set_rtc_time; - ppc_md.get_rtc_time = todc_get_rtc_time; - ppc_md.nvram_read_val = todc_direct_read_val; - ppc_md.nvram_write_val = todc_direct_write_val; -#endif -} diff --git a/arch/ppc/platforms/4xx/ash.h b/arch/ppc/platforms/4xx/ash.h deleted file mode 100644 index 5f7448ea418..00000000000 --- a/arch/ppc/platforms/4xx/ash.h +++ /dev/null @@ -1,83 +0,0 @@ -/* - * arch/ppc/platforms/4xx/ash.h - * - * Macros, definitions, and data structures specific to the IBM PowerPC - * Ash eval board. - * - * Author: Armin Kuster - * - * 2000-2002 (c) MontaVista, Software, Inc. This file is licensed under - * the terms of the GNU General Public License version 2. This program - * is licensed "as is" without any warranty of any kind, whether express - * or implied. - */ - -#ifdef __KERNEL__ -#ifndef __ASM_ASH_H__ -#define __ASM_ASH_H__ -#include - -#ifndef __ASSEMBLY__ -/* - * Data structure defining board information maintained by the boot - * ROM on IBM's "Ash" evaluation board. An effort has been made to - * keep the field names consistent with the 8xx 'bd_t' board info - * structures. - */ - -typedef struct board_info { - unsigned char bi_s_version[4]; /* Version of this structure */ - unsigned char bi_r_version[30]; /* Version of the IBM ROM */ - unsigned int bi_memsize; /* DRAM installed, in bytes */ - unsigned char bi_enetaddr[4][6]; /* Local Ethernet MAC address */ - unsigned char bi_pci_enetaddr[6]; - unsigned int bi_intfreq; /* Processor speed, in Hz */ - unsigned int bi_busfreq; /* PLB Bus speed, in Hz */ - unsigned int bi_pci_busfreq; /* PCI speed in Hz */ -} bd_t; - -/* Some 4xx parts use a different timebase frequency from the internal clock. -*/ -#define bi_tbfreq bi_intfreq - -/* Memory map for the IBM "Ash" NP405H evaluation board. - */ - -extern void *ash_rtc_base; -#define ASH_RTC_PADDR ((uint)0xf0000000) -#define ASH_RTC_VADDR ASH_RTC_PADDR -#define ASH_RTC_SIZE ((uint)8*1024) - - -/* Early initialization address mapping for block_io. - * Standard 405GP map. - */ -#define PPC4xx_PCI_IO_PADDR ((uint)PPC405_PCI_PHY_IO_BASE) -#define PPC4xx_PCI_IO_VADDR PPC4xx_PCI_IO_PADDR -#define PPC4xx_PCI_IO_SIZE ((uint)64*1024) -#define PPC4xx_PCI_CFG_PADDR ((uint)PPC405_PCI_CONFIG_ADDR) -#define PPC4xx_PCI_CFG_VADDR PPC4xx_PCI_CFG_PADDR -#define PPC4xx_PCI_CFG_SIZE ((uint)4*1024) -#define PPC4xx_PCI_LCFG_PADDR ((uint)0xef400000) -#define PPC4xx_PCI_LCFG_VADDR PPC4xx_PCI_LCFG_PADDR -#define PPC4xx_PCI_LCFG_SIZE ((uint)4*1024) -#define PPC4xx_ONB_IO_PADDR ((uint)0xef600000) -#define PPC4xx_ONB_IO_VADDR PPC4xx_ONB_IO_PADDR -#define PPC4xx_ONB_IO_SIZE ((uint)4*1024) - -#define NR_BOARD_IRQS 32 - -#ifdef CONFIG_PPC405GP_INTERNAL_CLOCK -#define BASE_BAUD 201600 -#else -#define BASE_BAUD 691200 -#endif - -#define PPC4xx_MACHINE_NAME "IBM NP405H Ash" - -extern char pci_irq_table[][4]; - - -#endif /* !__ASSEMBLY__ */ -#endif /* __ASM_ASH_H__ */ -#endif /* __KERNEL__ */ diff --git a/arch/ppc/syslib/ppc4xx_setup.c b/arch/ppc/syslib/ppc4xx_setup.c index e170aebeb69..795b966e696 100644 --- a/arch/ppc/syslib/ppc4xx_setup.c +++ b/arch/ppc/syslib/ppc4xx_setup.c @@ -171,7 +171,7 @@ ppc4xx_calibrate_decr(void) unsigned int freq; bd_t *bip = &__res; -#if defined(CONFIG_WALNUT) || defined(CONFIG_ASH) || defined(CONFIG_SYCAMORE) +#if defined(CONFIG_WALNUT) || defined(CONFIG_SYCAMORE) /* Walnut boot rom sets DCR CHCR1 (aka CPC0_CR1) bit CETE to 1 */ mtdcr(DCRN_CHCR1, mfdcr(DCRN_CHCR1) & ~CHR1_CETE); #endif diff --git a/include/asm-ppc/ibm4xx.h b/include/asm-ppc/ibm4xx.h index e807be96e98..d6852fa9852 100644 --- a/include/asm-ppc/ibm4xx.h +++ b/include/asm-ppc/ibm4xx.h @@ -19,10 +19,6 @@ #ifdef CONFIG_40x -#if defined(CONFIG_ASH) -#include -#endif - #if defined(CONFIG_BUBINGA) #include #endif -- cgit v1.2.3-70-g09d2 From 89d7f53030baa2616eb2fe87cbc19bc73111a78e Mon Sep 17 00:00:00 2001 From: Kumar Gala Date: Sat, 3 Sep 2005 15:55:24 -0700 Subject: [PATCH] ppc32: Remove board support for MCPN765 Support for the MCPN765 board is no longer maintained and thus being removed Signed-off-by: Kumar Gala Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- arch/ppc/Kconfig | 5 +- arch/ppc/boot/simple/Makefile | 2 +- arch/ppc/configs/mcpn765_defconfig | 579 ------------------------------------- arch/ppc/platforms/Makefile | 1 - arch/ppc/platforms/mcpn765.c | 527 --------------------------------- arch/ppc/platforms/mcpn765.h | 122 -------- arch/ppc/syslib/Makefile | 2 - include/asm-ppc/serial.h | 2 - 8 files changed, 2 insertions(+), 1238 deletions(-) delete mode 100644 arch/ppc/configs/mcpn765_defconfig delete mode 100644 arch/ppc/platforms/mcpn765.c delete mode 100644 arch/ppc/platforms/mcpn765.h (limited to 'include') diff --git a/arch/ppc/Kconfig b/arch/ppc/Kconfig index 3f8e003ff88..ad6c362a15b 100644 --- a/arch/ppc/Kconfig +++ b/arch/ppc/Kconfig @@ -613,9 +613,6 @@ config EV64260 config LOPEC bool "Motorola-LoPEC" -config MCPN765 - bool "Motorola-MCPN765" - config MVME5100 bool "Motorola-MVME5100" @@ -790,7 +787,7 @@ config PPC_OF config PPC_GEN550 bool - depends on SANDPOINT || MCPN765 || SPRUCE || PPLUS || PCORE || \ + depends on SANDPOINT || SPRUCE || PPLUS || PCORE || \ PRPMC750 || PRPMC800 || LOPEC || \ (EV64260 && !SERIAL_MPSC) || CHESTNUT || RADSTONE_PPC7D || \ 83xx diff --git a/arch/ppc/boot/simple/Makefile b/arch/ppc/boot/simple/Makefile index 20717193fff..3e187fe0f59 100644 --- a/arch/ppc/boot/simple/Makefile +++ b/arch/ppc/boot/simple/Makefile @@ -106,7 +106,7 @@ zimageinitrd-$(CONFIG_GEMINI) := zImage.initrd-STRIPELF # kconfig 'feature', only one of these will ever be 'y' at a time. # The rest will be unset. -motorola := $(CONFIG_MCPN765)$(CONFIG_MVME5100)$(CONFIG_PRPMC750) \ +motorola := $(CONFIG_MVME5100)$(CONFIG_PRPMC750) \ $(CONFIG_PRPMC800)$(CONFIG_LOPEC)$(CONFIG_PPLUS) motorola := $(strip $(motorola)) pcore := $(CONFIG_PCORE)$(CONFIG_POWERPMC250) diff --git a/arch/ppc/configs/mcpn765_defconfig b/arch/ppc/configs/mcpn765_defconfig deleted file mode 100644 index 899e89a9ea6..00000000000 --- a/arch/ppc/configs/mcpn765_defconfig +++ /dev/null @@ -1,579 +0,0 @@ -# -# Automatically generated make config: don't edit -# -CONFIG_MMU=y -CONFIG_RWSEM_XCHGADD_ALGORITHM=y -CONFIG_HAVE_DEC_LOCK=y -CONFIG_PPC=y -CONFIG_PPC32=y -CONFIG_GENERIC_NVRAM=y - -# -# Code maturity level options -# -# CONFIG_EXPERIMENTAL is not set -CONFIG_CLEAN_COMPILE=y -CONFIG_STANDALONE=y -CONFIG_BROKEN_ON_SMP=y - -# -# General setup -# -# CONFIG_SWAP is not set -CONFIG_SYSVIPC=y -# CONFIG_BSD_PROCESS_ACCT is not set -CONFIG_SYSCTL=y -CONFIG_LOG_BUF_SHIFT=14 -# CONFIG_HOTPLUG is not set -# CONFIG_IKCONFIG is not set -CONFIG_EMBEDDED=y -CONFIG_KALLSYMS=y -CONFIG_FUTEX=y -CONFIG_EPOLL=y -CONFIG_IOSCHED_NOOP=y -CONFIG_IOSCHED_AS=y -CONFIG_IOSCHED_DEADLINE=y -# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set - -# -# Loadable module support -# -CONFIG_MODULES=y -# CONFIG_MODULE_UNLOAD is not set -CONFIG_OBSOLETE_MODPARM=y -# CONFIG_KMOD is not set - -# -# Processor -# -CONFIG_6xx=y -# CONFIG_40x is not set -# CONFIG_44x is not set -# CONFIG_POWER3 is not set -# CONFIG_POWER4 is not set -# CONFIG_8xx is not set -CONFIG_ALTIVEC=y -# CONFIG_TAU is not set -# CONFIG_CPU_FREQ is not set -CONFIG_PPC_STD_MMU=y - -# -# Platform options -# -# CONFIG_PPC_MULTIPLATFORM is not set -# CONFIG_APUS is not set -# CONFIG_WILLOW is not set -# CONFIG_PCORE is not set -# CONFIG_POWERPMC250 is not set -# CONFIG_EV64260 is not set -# CONFIG_SPRUCE is not set -# CONFIG_LOPEC is not set -CONFIG_MCPN765=y -# CONFIG_MVME5100 is not set -# CONFIG_PPLUS is not set -# CONFIG_PRPMC750 is not set -# CONFIG_PRPMC800 is not set -# CONFIG_SANDPOINT is not set -# CONFIG_ADIR is not set -# CONFIG_K2 is not set -# CONFIG_PAL4 is not set -# CONFIG_GEMINI is not set -# CONFIG_EST8260 is not set -# CONFIG_SBS8260 is not set -# CONFIG_RPX6 is not set -# CONFIG_TQM8260 is not set -CONFIG_PPC_GEN550=y -# CONFIG_SMP is not set -# CONFIG_PREEMPT is not set -CONFIG_HIGHMEM=y -CONFIG_KERNEL_ELF=y -CONFIG_BINFMT_ELF=y -# CONFIG_BINFMT_MISC is not set -CONFIG_CMDLINE_BOOL=y -CONFIG_CMDLINE="ip=on" - -# -# Bus options -# -CONFIG_GENERIC_ISA_DMA=y -CONFIG_PCI=y -CONFIG_PCI_DOMAINS=y -# CONFIG_PCI_LEGACY_PROC is not set -# CONFIG_PCI_NAMES is not set - -# -# Advanced setup -# -# CONFIG_ADVANCED_OPTIONS is not set - -# -# Default settings for advanced configuration options are used -# -CONFIG_HIGHMEM_START=0xfe000000 -CONFIG_LOWMEM_SIZE=0x30000000 -CONFIG_KERNEL_START=0xc0000000 -CONFIG_TASK_SIZE=0x80000000 -CONFIG_BOOT_LOAD=0x00800000 - -# -# Device Drivers -# - -# -# Generic Driver Options -# - -# -# Memory Technology Devices (MTD) -# -# CONFIG_MTD is not set - -# -# Parallel port support -# -# CONFIG_PARPORT is not set - -# -# Plug and Play support -# - -# -# Block devices -# -# CONFIG_BLK_DEV_FD is not set -# CONFIG_BLK_CPQ_DA is not set -# CONFIG_BLK_CPQ_CISS_DA is not set -# CONFIG_BLK_DEV_DAC960 is not set -CONFIG_BLK_DEV_LOOP=y -# CONFIG_BLK_DEV_CRYPTOLOOP is not set -# CONFIG_BLK_DEV_NBD is not set -# CONFIG_BLK_DEV_CARMEL is not set -CONFIG_BLK_DEV_RAM=y -CONFIG_BLK_DEV_RAM_SIZE=4096 -CONFIG_BLK_DEV_INITRD=y -# CONFIG_LBD is not set - -# -# ATA/ATAPI/MFM/RLL support -# -CONFIG_IDE=y -CONFIG_BLK_DEV_IDE=y - -# -# Please see Documentation/ide.txt for help/info on IDE drives -# -CONFIG_BLK_DEV_IDEDISK=y -# CONFIG_IDEDISK_MULTI_MODE is not set -# CONFIG_IDEDISK_STROKE is not set -# CONFIG_BLK_DEV_IDECD is not set -# CONFIG_BLK_DEV_IDEFLOPPY is not set -# CONFIG_IDE_TASK_IOCTL is not set - -# -# IDE chipset support/bugfixes -# -# CONFIG_IDE_GENERIC is not set -CONFIG_BLK_DEV_IDEPCI=y -# CONFIG_IDEPCI_SHARE_IRQ is not set -# CONFIG_BLK_DEV_OFFBOARD is not set -# CONFIG_BLK_DEV_GENERIC is not set -# CONFIG_BLK_DEV_SL82C105 is not set -CONFIG_BLK_DEV_IDEDMA_PCI=y -# CONFIG_BLK_DEV_IDEDMA_FORCED is not set -# CONFIG_IDEDMA_PCI_AUTO is not set -CONFIG_BLK_DEV_ADMA=y -# CONFIG_BLK_DEV_AEC62XX is not set -# CONFIG_BLK_DEV_ALI15X3 is not set -# CONFIG_BLK_DEV_AMD74XX is not set -# CONFIG_BLK_DEV_CMD64X is not set -# CONFIG_BLK_DEV_TRIFLEX is not set -# CONFIG_BLK_DEV_CY82C693 is not set -# CONFIG_BLK_DEV_CS5530 is not set -# CONFIG_BLK_DEV_HPT34X is not set -# CONFIG_BLK_DEV_HPT366 is not set -# CONFIG_BLK_DEV_SC1200 is not set -# CONFIG_BLK_DEV_PIIX is not set -# CONFIG_BLK_DEV_NS87415 is not set -# CONFIG_BLK_DEV_PDC202XX_OLD is not set -# CONFIG_BLK_DEV_PDC202XX_NEW is not set -# CONFIG_BLK_DEV_SVWKS is not set -# CONFIG_BLK_DEV_SIIMAGE is not set -# CONFIG_BLK_DEV_SLC90E66 is not set -# CONFIG_BLK_DEV_TRM290 is not set -CONFIG_BLK_DEV_VIA82CXXX=y -CONFIG_BLK_DEV_IDEDMA=y -# CONFIG_IDEDMA_IVB is not set -# CONFIG_IDEDMA_AUTO is not set -# CONFIG_BLK_DEV_HD is not set - -# -# SCSI device support -# -# CONFIG_SCSI is not set - -# -# Multi-device support (RAID and LVM) -# -# CONFIG_MD is not set - -# -# Fusion MPT device support -# -# CONFIG_FUSION is not set - -# -# IEEE 1394 (FireWire) support -# -# CONFIG_IEEE1394 is not set - -# -# I2O device support -# -# CONFIG_I2O is not set - -# -# Macintosh device drivers -# - -# -# Networking support -# -CONFIG_NET=y - -# -# Networking options -# -CONFIG_PACKET=y -# CONFIG_PACKET_MMAP is not set -# CONFIG_NETLINK_DEV is not set -CONFIG_UNIX=y -# CONFIG_NET_KEY is not set -CONFIG_INET=y -# CONFIG_IP_MULTICAST is not set -# CONFIG_IP_ADVANCED_ROUTER is not set -CONFIG_IP_PNP=y -CONFIG_IP_PNP_DHCP=y -# CONFIG_IP_PNP_BOOTP is not set -# CONFIG_IP_PNP_RARP is not set -# CONFIG_NET_IPIP is not set -# CONFIG_NET_IPGRE is not set -# CONFIG_SYN_COOKIES is not set -# CONFIG_INET_AH is not set -# CONFIG_INET_ESP is not set -# CONFIG_INET_IPCOMP is not set -# CONFIG_DECNET is not set -# CONFIG_BRIDGE is not set -# CONFIG_NETFILTER is not set -# CONFIG_VLAN_8021Q is not set -# CONFIG_LLC2 is not set -# CONFIG_IPX is not set -# CONFIG_ATALK is not set - -# -# QoS and/or fair queueing -# -# CONFIG_NET_SCHED is not set - -# -# Network testing -# -# CONFIG_NET_PKTGEN is not set -CONFIG_NETDEVICES=y - -# -# ARCnet devices -# -# CONFIG_ARCNET is not set -# CONFIG_DUMMY is not set -# CONFIG_BONDING is not set -# CONFIG_EQUALIZER is not set -# CONFIG_TUN is not set - -# -# Ethernet (10 or 100Mbit) -# -CONFIG_NET_ETHERNET=y -CONFIG_MII=y -# CONFIG_OAKNET is not set -# CONFIG_HAPPYMEAL is not set -# CONFIG_SUNGEM is not set -# CONFIG_NET_VENDOR_3COM is not set - -# -# Tulip family network device support -# -CONFIG_NET_TULIP=y -CONFIG_TULIP=y -# CONFIG_TULIP_MMIO is not set -# CONFIG_TULIP_NAPI is not set -# CONFIG_DE4X5 is not set -# CONFIG_WINBOND_840 is not set -# CONFIG_DM9102 is not set -# CONFIG_HP100 is not set -# CONFIG_NET_PCI is not set - -# -# Ethernet (1000 Mbit) -# -# CONFIG_ACENIC is not set -# CONFIG_DL2K is not set -# CONFIG_E1000 is not set -# CONFIG_NS83820 is not set -# CONFIG_HAMACHI is not set -# CONFIG_R8169 is not set -# CONFIG_SK98LIN is not set -# CONFIG_TIGON3 is not set - -# -# Ethernet (10000 Mbit) -# -# CONFIG_IXGB is not set -# CONFIG_FDDI is not set -# CONFIG_PPP is not set -# CONFIG_SLIP is not set - -# -# Wireless LAN (non-hamradio) -# -# CONFIG_NET_RADIO is not set - -# -# Token Ring devices -# -# CONFIG_TR is not set - -# -# Wan interfaces -# -# CONFIG_WAN is not set - -# -# Amateur Radio support -# -# CONFIG_HAMRADIO is not set - -# -# IrDA (infrared) support -# -# CONFIG_IRDA is not set - -# -# Bluetooth support -# -# CONFIG_BT is not set -# CONFIG_NETPOLL is not set -# CONFIG_NET_POLL_CONTROLLER is not set - -# -# ISDN subsystem -# -# CONFIG_ISDN is not set - -# -# Telephony Support -# -# CONFIG_PHONE is not set - -# -# Input device support -# -# CONFIG_INPUT is not set - -# -# Userland interfaces -# - -# -# Input I/O drivers -# -# CONFIG_GAMEPORT is not set -CONFIG_SOUND_GAMEPORT=y -# CONFIG_SERIO is not set -# CONFIG_SERIO_I8042 is not set - -# -# Input Device Drivers -# - -# -# Character devices -# -# CONFIG_VT is not set -# CONFIG_SERIAL_NONSTANDARD is not set - -# -# Serial drivers -# -CONFIG_SERIAL_8250=y -CONFIG_SERIAL_8250_CONSOLE=y -CONFIG_SERIAL_8250_NR_UARTS=4 -# CONFIG_SERIAL_8250_EXTENDED is not set - -# -# Non-8250 serial port support -# -CONFIG_SERIAL_CORE=y -CONFIG_SERIAL_CORE_CONSOLE=y -CONFIG_UNIX98_PTYS=y -CONFIG_LEGACY_PTYS=y -CONFIG_LEGACY_PTY_COUNT=256 -# CONFIG_QIC02_TAPE is not set - -# -# IPMI -# -# CONFIG_IPMI_HANDLER is not set - -# -# Watchdog Cards -# -# CONFIG_WATCHDOG is not set -# CONFIG_NVRAM is not set -CONFIG_GEN_RTC=y -# CONFIG_GEN_RTC_X is not set -# CONFIG_DTLK is not set -# CONFIG_R3964 is not set -# CONFIG_APPLICOM is not set - -# -# Ftape, the floppy tape device driver -# -# CONFIG_FTAPE is not set -# CONFIG_AGP is not set -# CONFIG_DRM is not set -# CONFIG_RAW_DRIVER is not set - -# -# I2C support -# -# CONFIG_I2C is not set - -# -# Misc devices -# - -# -# Multimedia devices -# -# CONFIG_VIDEO_DEV is not set - -# -# Digital Video Broadcasting Devices -# -# CONFIG_DVB is not set - -# -# Graphics support -# -# CONFIG_FB is not set - -# -# Sound -# -# CONFIG_SOUND is not set - -# -# USB support -# -# CONFIG_USB is not set - -# -# USB Gadget Support -# -# CONFIG_USB_GADGET is not set - -# -# File systems -# -CONFIG_EXT2_FS=y -# CONFIG_EXT2_FS_XATTR is not set -# CONFIG_EXT3_FS is not set -# CONFIG_JBD is not set -# CONFIG_REISERFS_FS is not set -# CONFIG_JFS_FS is not set -# CONFIG_XFS_FS is not set -# CONFIG_MINIX_FS is not set -# CONFIG_ROMFS_FS is not set -# CONFIG_QUOTA is not set -# CONFIG_AUTOFS_FS is not set -# CONFIG_AUTOFS4_FS is not set - -# -# CD-ROM/DVD Filesystems -# -# CONFIG_ISO9660_FS is not set -# CONFIG_UDF_FS is not set - -# -# DOS/FAT/NT Filesystems -# -# CONFIG_FAT_FS is not set -# CONFIG_NTFS_FS is not set - -# -# Pseudo filesystems -# -CONFIG_PROC_FS=y -CONFIG_PROC_KCORE=y -# CONFIG_DEVPTS_FS_XATTR is not set -CONFIG_TMPFS=y -# CONFIG_HUGETLB_PAGE is not set -CONFIG_RAMFS=y - -# -# Miscellaneous filesystems -# -# CONFIG_HFSPLUS_FS is not set -# CONFIG_CRAMFS is not set -# CONFIG_VXFS_FS is not set -# CONFIG_HPFS_FS is not set -# CONFIG_QNX4FS_FS is not set -# CONFIG_SYSV_FS is not set -# CONFIG_UFS_FS is not set - -# -# Network File Systems -# -CONFIG_NFS_FS=y -# CONFIG_NFS_V3 is not set -# CONFIG_NFSD is not set -CONFIG_ROOT_NFS=y -CONFIG_LOCKD=y -# CONFIG_EXPORTFS is not set -CONFIG_SUNRPC=y -# CONFIG_SMB_FS is not set -# CONFIG_CIFS is not set -# CONFIG_NCP_FS is not set -# CONFIG_CODA_FS is not set - -# -# Partition Types -# -# CONFIG_PARTITION_ADVANCED is not set -CONFIG_MSDOS_PARTITION=y - -# -# Native Language Support -# -# CONFIG_NLS is not set - -# -# Library routines -# -CONFIG_CRC32=y - -# -# Kernel hacking -# -# CONFIG_DEBUG_KERNEL is not set -# CONFIG_SERIAL_TEXT_DEBUG is not set - -# -# Security options -# -# CONFIG_SECURITY is not set - -# -# Cryptographic options -# -# CONFIG_CRYPTO is not set diff --git a/arch/ppc/platforms/Makefile b/arch/ppc/platforms/Makefile index fb52acf5daa..2360bdcc79f 100644 --- a/arch/ppc/platforms/Makefile +++ b/arch/ppc/platforms/Makefile @@ -30,7 +30,6 @@ obj-$(CONFIG_GEMINI) += gemini_pci.o gemini_setup.o gemini_prom.o obj-$(CONFIG_LOPEC) += lopec.o obj-$(CONFIG_KATANA) += katana.o obj-$(CONFIG_HDPU) += hdpu.o -obj-$(CONFIG_MCPN765) += mcpn765.o obj-$(CONFIG_MENF1) += menf1_setup.o menf1_pci.o obj-$(CONFIG_MVME5100) += mvme5100.o obj-$(CONFIG_PAL4) += pal4_setup.o pal4_pci.o diff --git a/arch/ppc/platforms/mcpn765.c b/arch/ppc/platforms/mcpn765.c deleted file mode 100644 index e88d294ea59..00000000000 --- a/arch/ppc/platforms/mcpn765.c +++ /dev/null @@ -1,527 +0,0 @@ -/* - * arch/ppc/platforms/mcpn765.c - * - * Board setup routines for the Motorola MCG MCPN765 cPCI Board. - * - * Author: Mark A. Greer - * mgreer@mvista.com - * - * Modified by Randy Vinson (rvinson@mvista.com) - * - * 2001-2002 (c) MontaVista, Software, Inc. This file is licensed under - * the terms of the GNU General Public License version 2. This program - * is licensed "as is" without any warranty of any kind, whether express - * or implied. - */ - -/* - * This file adds support for the Motorola MCG MCPN765. - */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include /* for linux/serial_core.h */ -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "mcpn765.h" - -static u_char mcpn765_openpic_initsenses[] __initdata = { - (IRQ_SENSE_EDGE | IRQ_POLARITY_POSITIVE),/* 16: i8259 cascade */ - (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE),/* 17: COM1,2,3,4 */ - (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE),/* 18: Enet 1 (front) */ - (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE),/* 19: HAWK WDT XXXX */ - (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE),/* 20: 21554 bridge */ - (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE),/* 21: cPCI INTA# */ - (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE),/* 22: cPCI INTB# */ - (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE),/* 23: cPCI INTC# */ - (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE),/* 24: cPCI INTD# */ - (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE),/* 25: PMC1 INTA#,PMC2 INTB#*/ - (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE),/* 26: PMC1 INTB#,PMC2 INTC#*/ - (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE),/* 27: PMC1 INTC#,PMC2 INTD#*/ - (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE),/* 28: PMC1 INTD#,PMC2 INTA#*/ - (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE),/* 29: Enet 2 (J3) */ - (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE),/* 30: Abort Switch */ - (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE),/* 31: RTC Alarm */ -}; - -extern void mcpn765_set_VIA_IDE_native(void); - -extern u_int openpic_irq(void); -extern char cmd_line[]; - -extern void gen550_progress(char *, unsigned short); -extern void gen550_init(int, struct uart_port *); - -int use_of_interrupt_tree = 0; - -static void mcpn765_halt(void); - -TODC_ALLOC(); - -/* - * Motorola MCG MCPN765 interrupt routing. - */ -static inline int -mcpn765_map_irq(struct pci_dev *dev, unsigned char idsel, unsigned char pin) -{ - static char pci_irq_table[][4] = - /* - * PCI IDSEL/INTPIN->INTLINE - * A B C D - */ - { - { 14, 0, 0, 0 }, /* IDSEL 11 - have to manually set */ - { 0, 0, 0, 0 }, /* IDSEL 12 - unused */ - { 0, 0, 0, 0 }, /* IDSEL 13 - unused */ - { 18, 0, 0, 0 }, /* IDSEL 14 - Enet 0 */ - { 0, 0, 0, 0 }, /* IDSEL 15 - unused */ - { 25, 26, 27, 28 }, /* IDSEL 16 - PMC Slot 1 */ - { 28, 25, 26, 27 }, /* IDSEL 17 - PMC Slot 2 */ - { 0, 0, 0, 0 }, /* IDSEL 18 - PMC 2B Connector XXXX */ - { 29, 0, 0, 0 }, /* IDSEL 19 - Enet 1 */ - { 20, 0, 0, 0 }, /* IDSEL 20 - 21554 cPCI bridge */ - }; - - const long min_idsel = 11, max_idsel = 20, irqs_per_slot = 4; - return PCI_IRQ_TABLE_LOOKUP; -} - -void __init -mcpn765_set_VIA_IDE_legacy(void) -{ - unsigned short vend, dev; - - early_read_config_word(0, 0, PCI_DEVFN(0xb, 1), PCI_VENDOR_ID, &vend); - early_read_config_word(0, 0, PCI_DEVFN(0xb, 1), PCI_DEVICE_ID, &dev); - - if ((vend == PCI_VENDOR_ID_VIA) && - (dev == PCI_DEVICE_ID_VIA_82C586_1)) { - - unsigned char temp; - - /* put back original "standard" port base addresses */ - early_write_config_dword(0, 0, PCI_DEVFN(0xb, 1), - PCI_BASE_ADDRESS_0, 0x1f1); - early_write_config_dword(0, 0, PCI_DEVFN(0xb, 1), - PCI_BASE_ADDRESS_1, 0x3f5); - early_write_config_dword(0, 0, PCI_DEVFN(0xb, 1), - PCI_BASE_ADDRESS_2, 0x171); - early_write_config_dword(0, 0, PCI_DEVFN(0xb, 1), - PCI_BASE_ADDRESS_3, 0x375); - early_write_config_dword(0, 0, PCI_DEVFN(0xb, 1), - PCI_BASE_ADDRESS_4, 0xcc01); - - /* put into legacy mode */ - early_read_config_byte(0, 0, PCI_DEVFN(0xb, 1), PCI_CLASS_PROG, - &temp); - temp &= ~0x05; - early_write_config_byte(0, 0, PCI_DEVFN(0xb, 1), PCI_CLASS_PROG, - temp); - } -} - -void -mcpn765_set_VIA_IDE_native(void) -{ - unsigned short vend, dev; - - early_read_config_word(0, 0, PCI_DEVFN(0xb, 1), PCI_VENDOR_ID, &vend); - early_read_config_word(0, 0, PCI_DEVFN(0xb, 1), PCI_DEVICE_ID, &dev); - - if ((vend == PCI_VENDOR_ID_VIA) && - (dev == PCI_DEVICE_ID_VIA_82C586_1)) { - - unsigned char temp; - - /* put into native mode */ - early_read_config_byte(0, 0, PCI_DEVFN(0xb, 1), PCI_CLASS_PROG, - &temp); - temp |= 0x05; - early_write_config_byte(0, 0, PCI_DEVFN(0xb, 1), PCI_CLASS_PROG, - temp); - } -} - -/* - * Initialize the VIA 82c586b. - */ -static void __init -mcpn765_setup_via_82c586b(void) -{ - struct pci_dev *dev; - u_char c; - - if ((dev = pci_get_device(PCI_VENDOR_ID_VIA, - PCI_DEVICE_ID_VIA_82C586_0, - NULL)) == NULL) { - printk("No VIA ISA bridge found\n"); - mcpn765_halt(); - /* NOTREACHED */ - } - - /* - * If the firmware left the EISA 4d0/4d1 ports enabled, make sure - * IRQ 14 is set for edge. - */ - pci_read_config_byte(dev, 0x47, &c); - - if (c & (1<<5)) { - c = inb(0x4d1); - c &= ~(1<<6); - outb(c, 0x4d1); - } - - /* Disable PNP IRQ routing since we use the Hawk's MPIC */ - pci_write_config_dword(dev, 0x54, 0); - pci_write_config_byte(dev, 0x58, 0); - - pci_dev_put(dev); - if ((dev = pci_get_device(PCI_VENDOR_ID_VIA, - PCI_DEVICE_ID_VIA_82C586_1, - NULL)) == NULL) { - printk("No VIA ISA bridge found\n"); - mcpn765_halt(); - /* NOTREACHED */ - } - - /* - * PPCBug doesn't set the enable bits for the IDE device. - * Turn them on now. - */ - pci_read_config_byte(dev, 0x40, &c); - c |= 0x03; - pci_write_config_byte(dev, 0x40, c); - pci_dev_put(dev); - - return; -} - -void __init -mcpn765_pcibios_fixup(void) -{ - /* Do MCPN765 board specific initialization. */ - mcpn765_setup_via_82c586b(); -} - -void __init -mcpn765_find_bridges(void) -{ - struct pci_controller *hose; - - hose = pcibios_alloc_controller(); - - if (!hose) - return; - - hose->first_busno = 0; - hose->last_busno = 0xff; - hose->pci_mem_offset = MCPN765_PCI_PHY_MEM_OFFSET; - - pci_init_resource(&hose->io_resource, - MCPN765_PCI_IO_START, - MCPN765_PCI_IO_END, - IORESOURCE_IO, - "PCI host bridge"); - - pci_init_resource(&hose->mem_resources[0], - MCPN765_PCI_MEM_START, - MCPN765_PCI_MEM_END, - IORESOURCE_MEM, - "PCI host bridge"); - - hose->io_space.start = MCPN765_PCI_IO_START; - hose->io_space.end = MCPN765_PCI_IO_END; - hose->mem_space.start = MCPN765_PCI_MEM_START; - hose->mem_space.end = MCPN765_PCI_MEM_END - HAWK_MPIC_SIZE; - - if (hawk_init(hose, - MCPN765_HAWK_PPC_REG_BASE, - MCPN765_PROC_PCI_MEM_START, - MCPN765_PROC_PCI_MEM_END - HAWK_MPIC_SIZE, - MCPN765_PROC_PCI_IO_START, - MCPN765_PROC_PCI_IO_END, - MCPN765_PCI_MEM_END - HAWK_MPIC_SIZE + 1) != 0) { - printk("Could not initialize HAWK bridge\n"); - } - - /* VIA IDE BAR decoders are only 16-bits wide. PCI Auto Config - * will reassign the bars outside of 16-bit I/O space, which will - * "break" things. To prevent this, we'll set the IDE chip into - * legacy mode and seed the bars with their legacy addresses (in 16-bit - * I/O space). The Auto Config code will skip the IDE contoller in - * legacy mode, so our bar values will stick. - */ - mcpn765_set_VIA_IDE_legacy(); - - hose->last_busno = pciauto_bus_scan(hose, hose->first_busno); - - /* Now that we've got 16-bit addresses in the bars, we can switch the - * IDE controller back into native mode so we can do "modern" resource - * and interrupt management. - */ - mcpn765_set_VIA_IDE_native(); - - ppc_md.pcibios_fixup = mcpn765_pcibios_fixup; - ppc_md.pcibios_fixup_bus = NULL; - ppc_md.pci_swizzle = common_swizzle; - ppc_md.pci_map_irq = mcpn765_map_irq; - - return; -} -static void __init -mcpn765_setup_arch(void) -{ - struct pci_controller *hose; - - if ( ppc_md.progress ) - ppc_md.progress("mcpn765_setup_arch: enter", 0); - - loops_per_jiffy = 50000000 / HZ; - -#ifdef CONFIG_BLK_DEV_INITRD - if (initrd_start) - ROOT_DEV = Root_RAM0; - else -#endif -#ifdef CONFIG_ROOT_NFS - ROOT_DEV = Root_NFS; -#else - ROOT_DEV = Root_SDA2; -#endif - - if ( ppc_md.progress ) - ppc_md.progress("mcpn765_setup_arch: find_bridges", 0); - - /* Lookup PCI host bridges */ - mcpn765_find_bridges(); - - hose = pci_bus_to_hose(0); - isa_io_base = (ulong)hose->io_base_virt; - - TODC_INIT(TODC_TYPE_MK48T37, - (MCPN765_PHYS_NVRAM_AS0 - isa_io_base), - (MCPN765_PHYS_NVRAM_AS1 - isa_io_base), - (MCPN765_PHYS_NVRAM_DATA - isa_io_base), - 8); - - OpenPIC_InitSenses = mcpn765_openpic_initsenses; - OpenPIC_NumInitSenses = sizeof(mcpn765_openpic_initsenses); - - printk("Motorola MCG MCPN765 cPCI Non-System Board\n"); - printk("MCPN765 port (MontaVista Software, Inc. (source@mvista.com))\n"); - - if ( ppc_md.progress ) - ppc_md.progress("mcpn765_setup_arch: exit", 0); - - return; -} - -static void __init -mcpn765_init2(void) -{ - - request_region(0x00,0x20,"dma1"); - request_region(0x20,0x20,"pic1"); - request_region(0x40,0x20,"timer"); - request_region(0x80,0x10,"dma page reg"); - request_region(0xa0,0x20,"pic2"); - request_region(0xc0,0x20,"dma2"); - - return; -} - -/* - * Interrupt setup and service. - * Have MPIC on HAWK and cascaded 8259s on VIA 82586 cascaded to MPIC. - */ -static void __init -mcpn765_init_IRQ(void) -{ - int i; - - if ( ppc_md.progress ) - ppc_md.progress("init_irq: enter", 0); - - openpic_init(NUM_8259_INTERRUPTS); - openpic_hookup_cascade(NUM_8259_INTERRUPTS, "82c59 cascade", - i8259_irq); - - for(i=0; i < NUM_8259_INTERRUPTS; i++) - irq_desc[i].handler = &i8259_pic; - - i8259_init(0); - - if ( ppc_md.progress ) - ppc_md.progress("init_irq: exit", 0); - - return; -} - -static u32 -mcpn765_irq_canonicalize(u32 irq) -{ - if (irq == 2) - return 9; - else - return irq; -} - -static unsigned long __init -mcpn765_find_end_of_memory(void) -{ - return hawk_get_mem_size(MCPN765_HAWK_SMC_BASE); -} - -static void __init -mcpn765_map_io(void) -{ - io_block_mapping(0xfe800000, 0xfe800000, 0x00800000, _PAGE_IO); -} - -static void -mcpn765_reset_board(void) -{ - local_irq_disable(); - - /* set VIA IDE controller into native mode */ - mcpn765_set_VIA_IDE_native(); - - /* Set exception prefix high - to the firmware */ - _nmask_and_or_msr(0, MSR_IP); - - out_8((u_char *)MCPN765_BOARD_MODRST_REG, 0x01); - - return; -} - -static void -mcpn765_restart(char *cmd) -{ - volatile ulong i = 10000000; - - mcpn765_reset_board(); - - while (i-- > 0); - panic("restart failed\n"); -} - -static void -mcpn765_power_off(void) -{ - mcpn765_halt(); - /* NOTREACHED */ -} - -static void -mcpn765_halt(void) -{ - local_irq_disable(); - while (1); - /* NOTREACHED */ -} - -static int -mcpn765_show_cpuinfo(struct seq_file *m) -{ - seq_printf(m, "vendor\t\t: Motorola MCG\n"); - seq_printf(m, "machine\t\t: MCPN765\n"); - - return 0; -} - -/* - * Set BAT 3 to map 0xf0000000 to end of physical memory space. - */ -static __inline__ void -mcpn765_set_bat(void) -{ - mb(); - mtspr(SPRN_DBAT1U, 0xfe8000fe); - mtspr(SPRN_DBAT1L, 0xfe80002a); - mb(); -} - -void __init -platform_init(unsigned long r3, unsigned long r4, unsigned long r5, - unsigned long r6, unsigned long r7) -{ - parse_bootinfo(find_bootinfo()); - - /* Map in board regs, etc. */ - mcpn765_set_bat(); - - isa_mem_base = MCPN765_ISA_MEM_BASE; - pci_dram_offset = MCPN765_PCI_DRAM_OFFSET; - ISA_DMA_THRESHOLD = 0x00ffffff; - DMA_MODE_READ = 0x44; - DMA_MODE_WRITE = 0x48; - - ppc_md.setup_arch = mcpn765_setup_arch; - ppc_md.show_cpuinfo = mcpn765_show_cpuinfo; - ppc_md.irq_canonicalize = mcpn765_irq_canonicalize; - ppc_md.init_IRQ = mcpn765_init_IRQ; - ppc_md.get_irq = openpic_get_irq; - ppc_md.init = mcpn765_init2; - - ppc_md.restart = mcpn765_restart; - ppc_md.power_off = mcpn765_power_off; - ppc_md.halt = mcpn765_halt; - - ppc_md.find_end_of_memory = mcpn765_find_end_of_memory; - ppc_md.setup_io_mappings = mcpn765_map_io; - - ppc_md.time_init = todc_time_init; - ppc_md.set_rtc_time = todc_set_rtc_time; - ppc_md.get_rtc_time = todc_get_rtc_time; - ppc_md.calibrate_decr = todc_calibrate_decr; - - ppc_md.nvram_read_val = todc_m48txx_read_val; - ppc_md.nvram_write_val = todc_m48txx_write_val; - - ppc_md.heartbeat = NULL; - ppc_md.heartbeat_reset = 0; - ppc_md.heartbeat_count = 0; - -#ifdef CONFIG_SERIAL_TEXT_DEBUG - ppc_md.progress = gen550_progress; -#endif -#ifdef CONFIG_KGDB - ppc_md.kgdb_map_scc = gen550_kgdb_map_scc; -#endif - - return; -} diff --git a/arch/ppc/platforms/mcpn765.h b/arch/ppc/platforms/mcpn765.h deleted file mode 100644 index 4d35ecad097..00000000000 --- a/arch/ppc/platforms/mcpn765.h +++ /dev/null @@ -1,122 +0,0 @@ -/* - * arch/ppc/platforms/mcpn765.h - * - * Definitions for Motorola MCG MCPN765 cPCI Board. - * - * Author: Mark A. Greer - * mgreer@mvista.com - * - * 2001-2004 (c) MontaVista, Software, Inc. This file is licensed under - * the terms of the GNU General Public License version 2. This program - * is licensed "as is" without any warranty of any kind, whether express - * or implied. - */ - -/* - * From Processor to PCI: - * PCI Mem Space: 0x80000000 - 0xc0000000 -> 0x80000000 - 0xc0000000 (1 GB) - * PCI I/O Space: 0xfd800000 - 0xfe000000 -> 0x00000000 - 0x00800000 (8 MB) - * Note: Must skip 0xfe000000-0xfe400000 for CONFIG_HIGHMEM/PKMAP area - * MPIC in PCI Mem Space: 0xfe800000 - 0xfe830000 (not all used by MPIC) - * - * From PCI to Processor: - * System Memory: 0x00000000 -> 0x00000000 - */ - -#ifndef __PPC_PLATFORMS_MCPN765_H -#define __PPC_PLATFORMS_MCPN765_H -#include - -/* PCI Memory space mapping info */ -#define MCPN765_PCI_MEM_SIZE 0x40000000U -#define MCPN765_PROC_PCI_MEM_START 0x80000000U -#define MCPN765_PROC_PCI_MEM_END (MCPN765_PROC_PCI_MEM_START + \ - MCPN765_PCI_MEM_SIZE - 1) -#define MCPN765_PCI_MEM_START 0x80000000U -#define MCPN765_PCI_MEM_END (MCPN765_PCI_MEM_START + \ - MCPN765_PCI_MEM_SIZE - 1) - -/* PCI I/O space mapping info */ -#define MCPN765_PCI_IO_SIZE 0x00800000U -#define MCPN765_PROC_PCI_IO_START 0xfd800000U -#define MCPN765_PROC_PCI_IO_END (MCPN765_PROC_PCI_IO_START + \ - MCPN765_PCI_IO_SIZE - 1) -#define MCPN765_PCI_IO_START 0x00000000U -#define MCPN765_PCI_IO_END (MCPN765_PCI_IO_START + \ - MCPN765_PCI_IO_SIZE - 1) - -/* System memory mapping info */ -#define MCPN765_PCI_DRAM_OFFSET 0x00000000U -#define MCPN765_PCI_PHY_MEM_OFFSET 0x00000000U - -#define MCPN765_ISA_MEM_BASE 0x00000000U -#define MCPN765_ISA_IO_BASE MCPN765_PROC_PCI_IO_START - -/* Define base addresses for important sets of registers */ -#define MCPN765_HAWK_MPIC_BASE 0xfe800000U -#define MCPN765_HAWK_SMC_BASE 0xfef80000U -#define MCPN765_HAWK_PPC_REG_BASE 0xfeff0000U - -/* Define MCPN765 board register addresses. */ -#define MCPN765_BOARD_STATUS_REG 0xfef88080U -#define MCPN765_BOARD_MODFAIL_REG 0xfef88090U -#define MCPN765_BOARD_MODRST_REG 0xfef880a0U -#define MCPN765_BOARD_TBEN_REG 0xfef880c0U -#define MCPN765_BOARD_GEOGRAPHICAL_REG 0xfef880e8U -#define MCPN765_BOARD_EXT_FEATURE_REG 0xfef880f0U -#define MCPN765_BOARD_LAST_RESET_REG 0xfef880f8U - -/* Defines for UART */ - -/* Define the UART base addresses */ -#define MCPN765_SERIAL_1 0xfef88000 -#define MCPN765_SERIAL_2 0xfef88200 -#define MCPN765_SERIAL_3 0xfef88400 -#define MCPN765_SERIAL_4 0xfef88600 - -#ifdef CONFIG_SERIAL_MANY_PORTS -#define RS_TABLE_SIZE 64 -#else -#define RS_TABLE_SIZE 4 -#endif - -/* Rate for the 1.8432 Mhz clock for the onboard serial chip */ -#define BASE_BAUD ( 1843200 / 16 ) -#define UART_CLK 1843200 - -#ifdef CONFIG_SERIAL_DETECT_IRQ -#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF|ASYNC_SKIP_TEST|ASYNC_AUTO_IRQ) -#else -#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF|ASYNC_SKIP_TEST) -#endif - -/* All UART IRQ's are wire-OR'd to IRQ 17 */ -#define STD_SERIAL_PORT_DFNS \ - { 0, BASE_BAUD, MCPN765_SERIAL_1, 17, STD_COM_FLAGS, /* ttyS0 */\ - iomem_base: (u8 *)MCPN765_SERIAL_1, \ - iomem_reg_shift: 4, \ - io_type: SERIAL_IO_MEM }, \ - { 0, BASE_BAUD, MCPN765_SERIAL_2, 17, STD_COM_FLAGS, /* ttyS1 */\ - iomem_base: (u8 *)MCPN765_SERIAL_2, \ - iomem_reg_shift: 4, \ - io_type: SERIAL_IO_MEM }, \ - { 0, BASE_BAUD, MCPN765_SERIAL_3, 17, STD_COM_FLAGS, /* ttyS2 */\ - iomem_base: (u8 *)MCPN765_SERIAL_3, \ - iomem_reg_shift: 4, \ - io_type: SERIAL_IO_MEM }, \ - { 0, BASE_BAUD, MCPN765_SERIAL_4, 17, STD_COM_FLAGS, /* ttyS3 */\ - iomem_base: (u8 *)MCPN765_SERIAL_4, \ - iomem_reg_shift: 4, \ - io_type: SERIAL_IO_MEM }, - -#define SERIAL_PORT_DFNS \ - STD_SERIAL_PORT_DFNS - -/* Define the NVRAM/RTC address strobe & data registers */ -#define MCPN765_PHYS_NVRAM_AS0 0xfef880c8U -#define MCPN765_PHYS_NVRAM_AS1 0xfef880d0U -#define MCPN765_PHYS_NVRAM_DATA 0xfef880d8U - -extern void mcpn765_find_bridges(void); - -#endif /* __PPC_PLATFORMS_MCPN765_H */ diff --git a/arch/ppc/syslib/Makefile b/arch/ppc/syslib/Makefile index 54e5666939b..0c044c51dcc 100644 --- a/arch/ppc/syslib/Makefile +++ b/arch/ppc/syslib/Makefile @@ -54,8 +54,6 @@ obj-$(CONFIG_LOPEC) += i8259.o pci_auto.o todc_time.o obj-$(CONFIG_HDPU) += pci_auto.o obj-$(CONFIG_LUAN) += indirect_pci.o pci_auto.o todc_time.o obj-$(CONFIG_KATANA) += pci_auto.o -obj-$(CONFIG_MCPN765) += todc_time.o indirect_pci.o pci_auto.o \ - open_pic.o i8259.o hawk_common.o obj-$(CONFIG_MENF1) += todc_time.o i8259.o mpc10x_common.o \ pci_auto.o indirect_pci.o obj-$(CONFIG_MV64360) += mv64360_pic.o diff --git a/include/asm-ppc/serial.h b/include/asm-ppc/serial.h index 6d47438be58..485a924e4d0 100644 --- a/include/asm-ppc/serial.h +++ b/include/asm-ppc/serial.h @@ -18,8 +18,6 @@ #include #elif defined(CONFIG_LOPEC) #include -#elif defined(CONFIG_MCPN765) -#include #elif defined(CONFIG_MVME5100) #include #elif defined(CONFIG_PAL4) -- cgit v1.2.3-70-g09d2 From 37330c9146767fd4f5eb147b01cb500eabf773cf Mon Sep 17 00:00:00 2001 From: Kumar Gala Date: Sat, 3 Sep 2005 15:55:26 -0700 Subject: [PATCH] ppc32: Remove board support for OAK Support for the OAK board is no longer maintained and thus being removed Signed-off-by: Kumar Gala Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- arch/ppc/configs/oak_defconfig | 485 ------------------------------------- arch/ppc/platforms/4xx/Kconfig | 6 +- arch/ppc/platforms/4xx/Makefile | 1 - arch/ppc/platforms/4xx/oak.c | 255 ------------------- arch/ppc/platforms/4xx/oak.h | 96 -------- arch/ppc/platforms/4xx/oak_setup.h | 50 ---- include/asm-ppc/ibm4xx.h | 4 - 7 files changed, 1 insertion(+), 896 deletions(-) delete mode 100644 arch/ppc/configs/oak_defconfig delete mode 100644 arch/ppc/platforms/4xx/oak.c delete mode 100644 arch/ppc/platforms/4xx/oak.h delete mode 100644 arch/ppc/platforms/4xx/oak_setup.h (limited to 'include') diff --git a/arch/ppc/configs/oak_defconfig b/arch/ppc/configs/oak_defconfig deleted file mode 100644 index 366cc480cea..00000000000 --- a/arch/ppc/configs/oak_defconfig +++ /dev/null @@ -1,485 +0,0 @@ -# -# Automatically generated make config: don't edit -# -CONFIG_MMU=y -CONFIG_RWSEM_XCHGADD_ALGORITHM=y -CONFIG_HAVE_DEC_LOCK=y - -# -# Code maturity level options -# -CONFIG_EXPERIMENTAL=y - -# -# General setup -# -CONFIG_SWAP=y -CONFIG_SYSVIPC=y -# CONFIG_BSD_PROCESS_ACCT is not set -CONFIG_SYSCTL=y -CONFIG_LOG_BUF_SHIFT=14 -CONFIG_EMBEDDED=y -CONFIG_FUTEX=y -# CONFIG_EPOLL is not set - -# -# Loadable module support -# -CONFIG_MODULES=y -CONFIG_MODULE_UNLOAD=y -# CONFIG_MODULE_FORCE_UNLOAD is not set -CONFIG_OBSOLETE_MODPARM=y -# CONFIG_MODVERSIONS is not set -CONFIG_KMOD=y - -# -# Platform support -# -CONFIG_PPC=y -CONFIG_PPC32=y -# CONFIG_6xx is not set -CONFIG_40x=y -# CONFIG_POWER3 is not set -# CONFIG_8xx is not set -CONFIG_4xx=y - -# -# IBM 4xx options -# -# CONFIG_ASH is not set -# CONFIG_BEECH is not set -# CONFIG_CEDAR is not set -# CONFIG_CPCI405 is not set -# CONFIG_EP405 is not set -CONFIG_OAK=y -# CONFIG_REDWOOD_4 is not set -# CONFIG_REDWOOD_5 is not set -# CONFIG_REDWOOD_6 is not set -# CONFIG_SYCAMORE is not set -# CONFIG_TIVO is not set -# CONFIG_WALNUT is not set -CONFIG_IBM405_ERR51=y -CONFIG_403GCX=y -# CONFIG_405_DMA is not set -# CONFIG_PM is not set -CONFIG_UART0_TTYS0=y -# CONFIG_UART0_TTYS1 is not set -CONFIG_NOT_COHERENT_CACHE=y -# CONFIG_SMP is not set -# CONFIG_PREEMPT is not set -# CONFIG_MATH_EMULATION is not set -# CONFIG_CPU_FREQ is not set - -# -# General setup -# -# CONFIG_HIGHMEM is not set -# CONFIG_PCI is not set -# CONFIG_PCI_DOMAINS is not set -# CONFIG_PC_KEYBOARD is not set -CONFIG_KCORE_ELF=y -CONFIG_BINFMT_ELF=y -CONFIG_KERNEL_ELF=y -# CONFIG_BINFMT_MISC is not set -# CONFIG_HOTPLUG is not set - -# -# Parallel port support -# -# CONFIG_PARPORT is not set -# CONFIG_CMDLINE_BOOL is not set - -# -# Advanced setup -# -# CONFIG_ADVANCED_OPTIONS is not set - -# -# Default settings for advanced configuration options are used -# -CONFIG_HIGHMEM_START=0xfe000000 -CONFIG_LOWMEM_SIZE=0x30000000 -CONFIG_KERNEL_START=0xc0000000 -CONFIG_TASK_SIZE=0x80000000 -CONFIG_BOOT_LOAD=0x00400000 - -# -# Memory Technology Devices (MTD) -# -# CONFIG_MTD is not set - -# -# Plug and Play support -# -# CONFIG_PNP is not set - -# -# Block devices -# -# CONFIG_BLK_DEV_FD is not set -CONFIG_BLK_DEV_LOOP=y -# CONFIG_BLK_DEV_NBD is not set -CONFIG_BLK_DEV_RAM=y -CONFIG_BLK_DEV_RAM_SIZE=4096 -CONFIG_BLK_DEV_INITRD=y - -# -# Multi-device support (RAID and LVM) -# -# CONFIG_MD is not set - -# -# ATA/IDE/MFM/RLL support -# -# CONFIG_IDE is not set - -# -# SCSI support -# -# CONFIG_SCSI is not set - -# -# Fusion MPT device support -# - -# -# I2O device support -# - -# -# Networking support -# -CONFIG_NET=y - -# -# Networking options -# -# CONFIG_PACKET is not set -# CONFIG_NETLINK_DEV is not set -# CONFIG_NETFILTER is not set -CONFIG_UNIX=y -# CONFIG_NET_KEY is not set -CONFIG_INET=y -CONFIG_IP_MULTICAST=y -# CONFIG_IP_ADVANCED_ROUTER is not set -CONFIG_IP_PNP=y -# CONFIG_IP_PNP_DHCP is not set -CONFIG_IP_PNP_BOOTP=y -CONFIG_IP_PNP_RARP=y -# CONFIG_NET_IPIP is not set -# CONFIG_NET_IPGRE is not set -# CONFIG_IP_MROUTE is not set -# CONFIG_ARPD is not set -# CONFIG_INET_ECN is not set -CONFIG_SYN_COOKIES=y -# CONFIG_INET_AH is not set -# CONFIG_INET_ESP is not set -# CONFIG_INET_IPCOMP is not set -# CONFIG_IPV6 is not set -# CONFIG_XFRM_USER is not set - -# -# SCTP Configuration (EXPERIMENTAL) -# -CONFIG_IPV6_SCTP__=y -# CONFIG_IP_SCTP is not set -# CONFIG_ATM is not set -# CONFIG_VLAN_8021Q is not set -# CONFIG_LLC is not set -# CONFIG_DECNET is not set -# CONFIG_BRIDGE is not set -# CONFIG_X25 is not set -# CONFIG_LAPB is not set -# CONFIG_NET_DIVERT is not set -# CONFIG_ECONET is not set -# CONFIG_WAN_ROUTER is not set -# CONFIG_NET_HW_FLOWCONTROL is not set - -# -# QoS and/or fair queueing -# -# CONFIG_NET_SCHED is not set - -# -# Network testing -# -# CONFIG_NET_PKTGEN is not set -CONFIG_NETDEVICES=y -# CONFIG_DUMMY is not set -# CONFIG_BONDING is not set -# CONFIG_EQUALIZER is not set -# CONFIG_TUN is not set -# CONFIG_ETHERTAP is not set - -# -# Ethernet (10 or 100Mbit) -# -CONFIG_NET_ETHERNET=y -# CONFIG_MII is not set -CONFIG_OAKNET=y - -# -# Ethernet (1000 Mbit) -# - -# -# Ethernet (10000 Mbit) -# -# CONFIG_PPP is not set -# CONFIG_SLIP is not set - -# -# Wireless LAN (non-hamradio) -# -# CONFIG_NET_RADIO is not set - -# -# Token Ring devices (depends on LLC=y) -# -# CONFIG_SHAPER is not set - -# -# Wan interfaces -# -# CONFIG_WAN is not set - -# -# Amateur Radio support -# -# CONFIG_HAMRADIO is not set - -# -# IrDA (infrared) support -# -# CONFIG_IRDA is not set - -# -# ISDN subsystem -# -# CONFIG_ISDN_BOOL is not set - -# -# Graphics support -# -# CONFIG_FB is not set - -# -# Old CD-ROM drivers (not SCSI, not IDE) -# -# CONFIG_CD_NO_IDESCSI is not set - -# -# Input device support -# -# CONFIG_INPUT is not set - -# -# Userland interfaces -# - -# -# Input I/O drivers -# -# CONFIG_GAMEPORT is not set -CONFIG_SOUND_GAMEPORT=y -# CONFIG_SERIO is not set - -# -# Input Device Drivers -# - -# -# Macintosh device drivers -# - -# -# Character devices -# -# CONFIG_SERIAL_NONSTANDARD is not set - -# -# Serial drivers -# -CONFIG_SERIAL_8250=y -CONFIG_SERIAL_8250_CONSOLE=y -# CONFIG_SERIAL_8250_EXTENDED is not set - -# -# Non-8250 serial port support -# -CONFIG_SERIAL_CORE=y -CONFIG_SERIAL_CORE_CONSOLE=y -# CONFIG_UNIX98_PTYS is not set - -# -# I2C support -# -# CONFIG_I2C is not set - -# -# I2C Hardware Sensors Mainboard support -# - -# -# I2C Hardware Sensors Chip support -# -# CONFIG_I2C_SENSOR is not set - -# -# Mice -# -# CONFIG_BUSMOUSE is not set -# CONFIG_QIC02_TAPE is not set - -# -# IPMI -# -# CONFIG_IPMI_HANDLER is not set - -# -# Watchdog Cards -# -# CONFIG_WATCHDOG is not set -# CONFIG_NVRAM is not set -CONFIG_GEN_RTC=y -# CONFIG_GEN_RTC_X is not set -# CONFIG_DTLK is not set -# CONFIG_R3964 is not set -# CONFIG_APPLICOM is not set - -# -# Ftape, the floppy tape device driver -# -# CONFIG_FTAPE is not set -# CONFIG_AGP is not set -# CONFIG_DRM is not set -# CONFIG_RAW_DRIVER is not set -# CONFIG_HANGCHECK_TIMER is not set - -# -# Multimedia devices -# -# CONFIG_VIDEO_DEV is not set - -# -# Digital Video Broadcasting Devices -# -# CONFIG_DVB is not set - -# -# File systems -# -CONFIG_EXT2_FS=y -# CONFIG_EXT2_FS_XATTR is not set -# CONFIG_EXT3_FS is not set -# CONFIG_JBD is not set -# CONFIG_REISERFS_FS is not set -# CONFIG_JFS_FS is not set -# CONFIG_XFS_FS is not set -# CONFIG_MINIX_FS is not set -# CONFIG_ROMFS_FS is not set -# CONFIG_QUOTA is not set -# CONFIG_AUTOFS_FS is not set -# CONFIG_AUTOFS4_FS is not set - -# -# CD-ROM/DVD Filesystems -# -# CONFIG_ISO9660_FS is not set -# CONFIG_UDF_FS is not set - -# -# DOS/FAT/NT Filesystems -# -# CONFIG_FAT_FS is not set -# CONFIG_NTFS_FS is not set - -# -# Pseudo filesystems -# -CONFIG_PROC_FS=y -# CONFIG_DEVFS_FS is not set -CONFIG_TMPFS=y -CONFIG_RAMFS=y - -# -# Miscellaneous filesystems -# -# CONFIG_ADFS_FS is not set -# CONFIG_AFFS_FS is not set -# CONFIG_HFS_FS is not set -# CONFIG_BEFS_FS is not set -# CONFIG_BFS_FS is not set -# CONFIG_EFS_FS is not set -# CONFIG_CRAMFS is not set -# CONFIG_VXFS_FS is not set -# CONFIG_HPFS_FS is not set -# CONFIG_QNX4FS_FS is not set -# CONFIG_SYSV_FS is not set -# CONFIG_UFS_FS is not set - -# -# Network File Systems -# -CONFIG_NFS_FS=y -# CONFIG_NFS_V3 is not set -# CONFIG_NFS_V4 is not set -# CONFIG_NFSD is not set -CONFIG_ROOT_NFS=y -CONFIG_LOCKD=y -# CONFIG_EXPORTFS is not set -CONFIG_SUNRPC=y -# CONFIG_SUNRPC_GSS is not set -# CONFIG_SMB_FS is not set -# CONFIG_CIFS is not set -# CONFIG_NCP_FS is not set -# CONFIG_CODA_FS is not set -# CONFIG_INTERMEZZO_FS is not set -# CONFIG_AFS_FS is not set - -# -# Partition Types -# -# CONFIG_PARTITION_ADVANCED is not set -CONFIG_MSDOS_PARTITION=y - -# -# Sound -# -# CONFIG_SOUND is not set - -# -# IBM 40x options -# - -# -# USB support -# -# CONFIG_USB_GADGET is not set - -# -# Bluetooth support -# -# CONFIG_BT is not set - -# -# Library routines -# -# CONFIG_CRC32 is not set - -# -# Kernel hacking -# -# CONFIG_DEBUG_KERNEL is not set -# CONFIG_KALLSYMS is not set -# CONFIG_SERIAL_TEXT_DEBUG is not set - -# -# Security options -# -# CONFIG_SECURITY is not set - -# -# Cryptographic options -# -# CONFIG_CRYPTO is not set diff --git a/arch/ppc/platforms/4xx/Kconfig b/arch/ppc/platforms/4xx/Kconfig index a7eaba91dfb..8772ae11a95 100644 --- a/arch/ppc/platforms/4xx/Kconfig +++ b/arch/ppc/platforms/4xx/Kconfig @@ -32,11 +32,6 @@ config EP405 help This option enables support for the EP405/EP405PC boards. -config OAK - bool "Oak" - help - This option enables support for the IBM 403GCX evaluation board. - config REDWOOD_5 bool "Redwood-5" help @@ -181,6 +176,7 @@ config BIOS_FIXUP depends on BUBINGA || EP405 || SYCAMORE || WALNUT default y +# OAK doesn't exist but wanted to keep this around for any future 403GCX boards config 403GCX bool depends OAK diff --git a/arch/ppc/platforms/4xx/Makefile b/arch/ppc/platforms/4xx/Makefile index f00e0d02ee2..1dd6d7fd6a9 100644 --- a/arch/ppc/platforms/4xx/Makefile +++ b/arch/ppc/platforms/4xx/Makefile @@ -7,7 +7,6 @@ obj-$(CONFIG_EBONY) += ebony.o obj-$(CONFIG_EP405) += ep405.o obj-$(CONFIG_BUBINGA) += bubinga.o obj-$(CONFIG_LUAN) += luan.o -obj-$(CONFIG_OAK) += oak.o obj-$(CONFIG_OCOTEA) += ocotea.o obj-$(CONFIG_REDWOOD_5) += redwood5.o obj-$(CONFIG_REDWOOD_6) += redwood6.o diff --git a/arch/ppc/platforms/4xx/oak.c b/arch/ppc/platforms/4xx/oak.c deleted file mode 100644 index fa25ee1fa73..00000000000 --- a/arch/ppc/platforms/4xx/oak.c +++ /dev/null @@ -1,255 +0,0 @@ -/* - * - * Copyright (c) 1999-2000 Grant Erickson - * - * Module name: oak.c - * - * Description: - * Architecture- / platform-specific boot-time initialization code for - * the IBM PowerPC 403GCX "Oak" evaluation board. Adapted from original - * code by Gary Thomas, Cort Dougan , and Dan Malek - * . - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#include "oak.h" - -/* Function Prototypes */ - -extern void abort(void); - -/* Global Variables */ - -unsigned char __res[sizeof(bd_t)]; - - -/* - * void __init oak_init() - * - * Description: - * This routine... - * - * Input(s): - * r3 - Optional pointer to a board information structure. - * r4 - Optional pointer to the physical starting address of the init RAM - * disk. - * r5 - Optional pointer to the physical ending address of the init RAM - * disk. - * r6 - Optional pointer to the physical starting address of any kernel - * command-line parameters. - * r7 - Optional pointer to the physical ending address of any kernel - * command-line parameters. - * - * Output(s): - * N/A - * - * Returns: - * N/A - * - */ -void __init -platform_init(unsigned long r3, unsigned long r4, unsigned long r5, - unsigned long r6, unsigned long r7) -{ - parse_bootinfo(find_bootinfo()); - - /* - * If we were passed in a board information, copy it into the - * residual data area. - */ - if (r3) { - memcpy((void *)__res, (void *)(r3 + KERNELBASE), sizeof(bd_t)); - } - -#if defined(CONFIG_BLK_DEV_INITRD) - /* - * If the init RAM disk has been configured in, and there's a valid - * starting address for it, set it up. - */ - if (r4) { - initrd_start = r4 + KERNELBASE; - initrd_end = r5 + KERNELBASE; - } -#endif /* CONFIG_BLK_DEV_INITRD */ - - /* Copy the kernel command line arguments to a safe place. */ - - if (r6) { - *(char *)(r7 + KERNELBASE) = 0; - strcpy(cmd_line, (char *)(r6 + KERNELBASE)); - } - - /* Initialize machine-dependency vectors */ - - ppc_md.setup_arch = oak_setup_arch; - ppc_md.show_percpuinfo = oak_show_percpuinfo; - ppc_md.irq_canonicalize = NULL; - ppc_md.init_IRQ = ppc4xx_pic_init; - ppc_md.get_irq = NULL; /* Set in ppc4xx_pic_init() */ - ppc_md.init = NULL; - - ppc_md.restart = oak_restart; - ppc_md.power_off = oak_power_off; - ppc_md.halt = oak_halt; - - ppc_md.time_init = oak_time_init; - ppc_md.set_rtc_time = oak_set_rtc_time; - ppc_md.get_rtc_time = oak_get_rtc_time; - ppc_md.calibrate_decr = oak_calibrate_decr; -} - -/* - * Document me. - */ -void __init -oak_setup_arch(void) -{ - /* XXX - Implement me */ -} - -/* - * int oak_show_percpuinfo() - * - * Description: - * This routine pretty-prints the platform's internal CPU and bus clock - * frequencies into the buffer for usage in /proc/cpuinfo. - * - * Input(s): - * *buffer - Buffer into which CPU and bus clock frequencies are to be - * printed. - * - * Output(s): - * *buffer - Buffer with the CPU and bus clock frequencies. - * - * Returns: - * The number of bytes copied into 'buffer' if OK, otherwise zero or less - * on error. - */ -int -oak_show_percpuinfo(struct seq_file *m, int i) -{ - bd_t *bp = (bd_t *)__res; - - seq_printf(m, "clock\t\t: %dMHz\n" - "bus clock\t\t: %dMHz\n", - bp->bi_intfreq / 1000000, - bp->bi_busfreq / 1000000); - - return 0; -} - -/* - * Document me. - */ -void -oak_restart(char *cmd) -{ - abort(); -} - -/* - * Document me. - */ -void -oak_power_off(void) -{ - oak_restart(NULL); -} - -/* - * Document me. - */ -void -oak_halt(void) -{ - oak_restart(NULL); -} - -/* - * Document me. - */ -long __init -oak_time_init(void) -{ - /* XXX - Implement me */ - return 0; -} - -/* - * Document me. - */ -int __init -oak_set_rtc_time(unsigned long time) -{ - /* XXX - Implement me */ - - return (0); -} - -/* - * Document me. - */ -unsigned long __init -oak_get_rtc_time(void) -{ - /* XXX - Implement me */ - - return (0); -} - -/* - * void __init oak_calibrate_decr() - * - * Description: - * This routine retrieves the internal processor frequency from the board - * information structure, sets up the kernel timer decrementer based on - * that value, enables the 403 programmable interval timer (PIT) and sets - * it up for auto-reload. - * - * Input(s): - * N/A - * - * Output(s): - * N/A - * - * Returns: - * N/A - * - */ -void __init -oak_calibrate_decr(void) -{ - unsigned int freq; - bd_t *bip = (bd_t *)__res; - - freq = bip->bi_intfreq; - - decrementer_count = freq / HZ; - count_period_num = 1; - count_period_den = freq; - - /* Enable the PIT and set auto-reload of its value */ - - mtspr(SPRN_TCR, TCR_PIE | TCR_ARE); - - /* Clear any pending timer interrupts */ - - mtspr(SPRN_TSR, TSR_ENW | TSR_WIS | TSR_PIS | TSR_FIS); -} diff --git a/arch/ppc/platforms/4xx/oak.h b/arch/ppc/platforms/4xx/oak.h deleted file mode 100644 index 1b86a4c66b0..00000000000 --- a/arch/ppc/platforms/4xx/oak.h +++ /dev/null @@ -1,96 +0,0 @@ -/* - * - * Copyright (c) 1999 Grant Erickson - * - * Module name: oak.h - * - * Description: - * Macros, definitions, and data structures specific to the IBM PowerPC - * 403G{A,B,C,CX} "Oak" evaluation board. Anything specific to the pro- - * cessor itself is defined elsewhere. - * - */ - -#ifdef __KERNEL__ -#ifndef __ASM_OAK_H__ -#define __ASM_OAK_H__ - -/* We have an IBM 403G{A,B,C,CX} core */ -#include - -#define _IO_BASE 0 -#define _ISA_MEM_BASE 0 -#define PCI_DRAM_OFFSET 0 - -/* Memory map for the "Oak" evaluation board */ - -#define PPC403SPU_IO_BASE 0x40000000 /* 403 On-chip serial port */ -#define PPC403SPU_IO_SIZE 0x00000008 -#define OAKSERIAL_IO_BASE 0x7E000000 /* NS16550DV serial port */ -#define OAKSERIAL_IO_SIZE 0x00000008 -#define OAKNET_IO_BASE 0xF4000000 /* NS83902AV Ethernet */ -#define OAKNET_IO_SIZE 0x00000040 -#define OAKPROM_IO_BASE 0xFFFE0000 /* AMD 29F010 Flash ROM */ -#define OAKPROM_IO_SIZE 0x00020000 - - -/* Interrupt assignments fixed by the hardware implementation */ - -/* This is annoying kbuild-2.4 problem. -- Tom */ - -#define PPC403SPU_RX_INT 4 /* AIC_INT4 */ -#define PPC403SPU_TX_INT 5 /* AIC_INT5 */ -#define OAKNET_INT 27 /* AIC_INT27 */ -#define OAKSERIAL_INT 28 /* AIC_INT28 */ - -#ifndef __ASSEMBLY__ -/* - * Data structure defining board information maintained by the boot - * ROM on IBM's "Oak" evaluation board. An effort has been made to - * keep the field names consistent with the 8xx 'bd_t' board info - * structures. - */ - -typedef struct board_info { - unsigned char bi_s_version[4]; /* Version of this structure */ - unsigned char bi_r_version[30]; /* Version of the IBM ROM */ - unsigned int bi_memsize; /* DRAM installed, in bytes */ - unsigned char bi_enetaddr[6]; /* Ethernet MAC address */ - unsigned int bi_intfreq; /* Processor speed, in Hz */ - unsigned int bi_busfreq; /* Bus speed, in Hz */ -} bd_t; - -#ifdef __cplusplus -extern "C" { -#endif - -extern void oak_init(unsigned long r3, - unsigned long ird_start, - unsigned long ird_end, - unsigned long cline_start, - unsigned long cline_end); -extern void oak_setup_arch(void); -extern int oak_setup_residual(char *buffer); -extern void oak_init_IRQ(void); -extern int oak_get_irq(struct pt_regs *regs); -extern void oak_restart(char *cmd); -extern void oak_power_off(void); -extern void oak_halt(void); -extern void oak_time_init(void); -extern int oak_set_rtc_time(unsigned long now); -extern unsigned long oak_get_rtc_time(void); -extern void oak_calibrate_decr(void); - -#ifdef __cplusplus -} -#endif - -/* Some 4xx parts use a different timebase frequency from the internal clock. -*/ -#define bi_tbfreq bi_intfreq - -#define PPC4xx_MACHINE_NAME "IBM Oak" - -#endif /* !__ASSEMBLY__ */ -#endif /* __ASM_OAK_H__ */ -#endif /* __KERNEL__ */ diff --git a/arch/ppc/platforms/4xx/oak_setup.h b/arch/ppc/platforms/4xx/oak_setup.h deleted file mode 100644 index 8648bd084df..00000000000 --- a/arch/ppc/platforms/4xx/oak_setup.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * - * Copyright (c) 1999-2000 Grant Erickson - * - * Module name: oak_setup.h - * - * Description: - * Architecture- / platform-specific boot-time initialization code for - * the IBM PowerPC 403GCX "Oak" evaluation board. Adapted from original - * code by Gary Thomas, Cort Dougan , and Dan Malek - * . - * - */ - -#ifndef __OAK_SETUP_H__ -#define __OAK_SETUP_H__ - -#include -#include - - -#ifdef __cplusplus -extern "C" { -#endif - -extern unsigned char __res[sizeof(bd_t)]; - -extern void oak_init(unsigned long r3, - unsigned long ird_start, - unsigned long ird_end, - unsigned long cline_start, - unsigned long cline_end); -extern void oak_setup_arch(void); -extern int oak_setup_residual(char *buffer); -extern void oak_init_IRQ(void); -extern int oak_get_irq(struct pt_regs *regs); -extern void oak_restart(char *cmd); -extern void oak_power_off(void); -extern void oak_halt(void); -extern void oak_time_init(void); -extern int oak_set_rtc_time(unsigned long now); -extern unsigned long oak_get_rtc_time(void); -extern void oak_calibrate_decr(void); - - -#ifdef __cplusplus -} -#endif - -#endif /* __OAK_SETUP_H__ */ diff --git a/include/asm-ppc/ibm4xx.h b/include/asm-ppc/ibm4xx.h index d6852fa9852..7900d52d2a1 100644 --- a/include/asm-ppc/ibm4xx.h +++ b/include/asm-ppc/ibm4xx.h @@ -31,10 +31,6 @@ #include #endif -#if defined(CONFIG_OAK) -#include -#endif - #if defined(CONFIG_REDWOOD_4) #include #endif -- cgit v1.2.3-70-g09d2 From ea08dcfa5439acaf33660e372d44fc049a90b121 Mon Sep 17 00:00:00 2001 From: Kumar Gala Date: Sat, 3 Sep 2005 15:55:28 -0700 Subject: [PATCH] ppc32: Remove board support for REDWOOD Support for the REDWOOD board is no longer maintained and thus being removed Signed-off-by: Kumar Gala Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- arch/ppc/boot/simple/Makefile | 2 - arch/ppc/boot/simple/head.S | 9 - arch/ppc/configs/redwood_defconfig | 540 ------------------------------------- include/asm-ppc/ibm4xx.h | 4 - 4 files changed, 555 deletions(-) delete mode 100644 arch/ppc/configs/redwood_defconfig (limited to 'include') diff --git a/arch/ppc/boot/simple/Makefile b/arch/ppc/boot/simple/Makefile index 3e187fe0f59..7e975aa9840 100644 --- a/arch/ppc/boot/simple/Makefile +++ b/arch/ppc/boot/simple/Makefile @@ -154,8 +154,6 @@ zimageinitrd-$(CONFIG_LITE5200) := zImage.initrd-STRIPELF # This is a treeboot that needs init functions until the # boot rom is sorted out (i.e. this is short lived) -extra-aflags-$(CONFIG_REDWOOD_4) := -Wa,-m405 -extra.o-$(CONFIG_REDWOOD_4) := rw4/rw4_init.o rw4/rw4_init_brd.o EXTRA_AFLAGS := $(extra-aflags-y) # head.o needs to get the cacheflags defined. AFLAGS_head.o += $(cacheflag-y) diff --git a/arch/ppc/boot/simple/head.S b/arch/ppc/boot/simple/head.S index 524053202bb..5e4adc298bf 100644 --- a/arch/ppc/boot/simple/head.S +++ b/arch/ppc/boot/simple/head.S @@ -120,15 +120,6 @@ haveOF: mtspr SPRN_DER,r4 #endif -#ifdef CONFIG_REDWOOD_4 - /* All of this Redwood 4 stuff will soon disappear when the - * boot rom is straightened out. - */ - mr r29, r3 /* Easier than changing the other code */ - bl HdwInit - mr r3, r29 -#endif - #if defined(CONFIG_MBX) || defined(CONFIG_RPX8260) || defined(CONFIG_PPC_PREP) mr r4,r29 /* put the board info pointer where the relocate * routine will find it diff --git a/arch/ppc/configs/redwood_defconfig b/arch/ppc/configs/redwood_defconfig deleted file mode 100644 index 4aa348dcf22..00000000000 --- a/arch/ppc/configs/redwood_defconfig +++ /dev/null @@ -1,540 +0,0 @@ -# -# Automatically generated make config: don't edit -# -CONFIG_MMU=y -CONFIG_RWSEM_XCHGADD_ALGORITHM=y -CONFIG_HAVE_DEC_LOCK=y -CONFIG_PPC=y -CONFIG_PPC32=y - -# -# Code maturity level options -# -CONFIG_EXPERIMENTAL=y -CONFIG_CLEAN_COMPILE=y -# CONFIG_STANDALONE is not set -CONFIG_BROKEN_ON_SMP=y - -# -# General setup -# -CONFIG_SWAP=y -CONFIG_SYSVIPC=y -# CONFIG_BSD_PROCESS_ACCT is not set -CONFIG_SYSCTL=y -CONFIG_LOG_BUF_SHIFT=14 -# CONFIG_IKCONFIG is not set -CONFIG_EMBEDDED=y -# CONFIG_KALLSYMS is not set -CONFIG_FUTEX=y -# CONFIG_EPOLL is not set -CONFIG_IOSCHED_NOOP=y -CONFIG_IOSCHED_AS=y -CONFIG_IOSCHED_DEADLINE=y - -# -# Loadable module support -# -CONFIG_MODULES=y -# CONFIG_MODULE_UNLOAD is not set -CONFIG_OBSOLETE_MODPARM=y -# CONFIG_MODVERSIONS is not set -CONFIG_KMOD=y - -# -# Processor -# -# CONFIG_6xx is not set -CONFIG_40x=y -# CONFIG_44x is not set -# CONFIG_POWER3 is not set -# CONFIG_POWER4 is not set -# CONFIG_8xx is not set -# CONFIG_MATH_EMULATION is not set -# CONFIG_CPU_FREQ is not set -CONFIG_4xx=y - -# -# IBM 4xx options -# -# CONFIG_ASH is not set -# CONFIG_BEECH is not set -# CONFIG_CEDAR is not set -# CONFIG_CPCI405 is not set -# CONFIG_EP405 is not set -# CONFIG_OAK is not set -CONFIG_REDWOOD_4=y -# CONFIG_REDWOOD_5 is not set -# CONFIG_REDWOOD_6 is not set -# CONFIG_SYCAMORE is not set -# CONFIG_TIVO is not set -# CONFIG_WALNUT is not set -CONFIG_IBM405_ERR77=y -CONFIG_IBM405_ERR51=y -CONFIG_IBM_OCP=y -CONFIG_STB03xxx=y -CONFIG_IBM_OPENBIOS=y -# CONFIG_405_DMA is not set -# CONFIG_PM is not set -CONFIG_UART0_TTYS0=y -# CONFIG_UART0_TTYS1 is not set -# CONFIG_SERIAL_SICC is not set -CONFIG_NOT_COHERENT_CACHE=y - -# -# Platform options -# -# CONFIG_PC_KEYBOARD is not set -# CONFIG_SMP is not set -# CONFIG_PREEMPT is not set -# CONFIG_HIGHMEM is not set -CONFIG_KERNEL_ELF=y -CONFIG_BINFMT_ELF=y -# CONFIG_BINFMT_MISC is not set -# CONFIG_CMDLINE_BOOL is not set - -# -# Bus options -# -# CONFIG_PCI is not set -# CONFIG_PCI_DOMAINS is not set -# CONFIG_HOTPLUG is not set - -# -# Parallel port support -# -# CONFIG_PARPORT is not set - -# -# Advanced setup -# -# CONFIG_ADVANCED_OPTIONS is not set - -# -# Default settings for advanced configuration options are used -# -CONFIG_HIGHMEM_START=0xfe000000 -CONFIG_LOWMEM_SIZE=0x30000000 -CONFIG_KERNEL_START=0xc0000000 -CONFIG_TASK_SIZE=0x80000000 -CONFIG_BOOT_LOAD=0x00400000 - -# -# Generic Driver Options -# - -# -# Memory Technology Devices (MTD) -# -# CONFIG_MTD is not set - -# -# Plug and Play support -# -# CONFIG_PNP is not set - -# -# Block devices -# -CONFIG_BLK_DEV_LOOP=y -# CONFIG_BLK_DEV_CRYPTOLOOP is not set -# CONFIG_BLK_DEV_NBD is not set -CONFIG_BLK_DEV_RAM=y -CONFIG_BLK_DEV_RAM_SIZE=4096 -CONFIG_BLK_DEV_INITRD=y -# CONFIG_LBD is not set - -# -# Multi-device support (RAID and LVM) -# -# CONFIG_MD is not set - -# -# ATA/ATAPI/MFM/RLL support -# -# CONFIG_IDE is not set - -# -# SCSI device support -# -# CONFIG_SCSI is not set - -# -# Fusion MPT device support -# - -# -# I2O device support -# - -# -# Networking support -# -CONFIG_NET=y - -# -# Networking options -# -# CONFIG_PACKET is not set -# CONFIG_NETLINK_DEV is not set -CONFIG_UNIX=y -# CONFIG_NET_KEY is not set -CONFIG_INET=y -CONFIG_IP_MULTICAST=y -# CONFIG_IP_ADVANCED_ROUTER is not set -CONFIG_IP_PNP=y -CONFIG_IP_PNP_DHCP=y -CONFIG_IP_PNP_BOOTP=y -CONFIG_IP_PNP_RARP=y -# CONFIG_NET_IPIP is not set -# CONFIG_NET_IPGRE is not set -# CONFIG_IP_MROUTE is not set -# CONFIG_ARPD is not set -# CONFIG_INET_ECN is not set -CONFIG_SYN_COOKIES=y -# CONFIG_INET_AH is not set -# CONFIG_INET_ESP is not set -# CONFIG_INET_IPCOMP is not set -# CONFIG_IPV6 is not set -# CONFIG_DECNET is not set -# CONFIG_BRIDGE is not set -# CONFIG_NETFILTER is not set - -# -# SCTP Configuration (EXPERIMENTAL) -# -CONFIG_IPV6_SCTP__=y -# CONFIG_IP_SCTP is not set -# CONFIG_ATM is not set -# CONFIG_VLAN_8021Q is not set -# CONFIG_LLC2 is not set -# CONFIG_IPX is not set -# CONFIG_ATALK is not set -# CONFIG_X25 is not set -# CONFIG_LAPB is not set -# CONFIG_NET_DIVERT is not set -# CONFIG_ECONET is not set -# CONFIG_WAN_ROUTER is not set -# CONFIG_NET_HW_FLOWCONTROL is not set - -# -# QoS and/or fair queueing -# -# CONFIG_NET_SCHED is not set - -# -# Network testing -# -# CONFIG_NET_PKTGEN is not set -CONFIG_NETDEVICES=y -# CONFIG_DUMMY is not set -# CONFIG_BONDING is not set -# CONFIG_EQUALIZER is not set -# CONFIG_TUN is not set - -# -# Ethernet (10 or 100Mbit) -# -CONFIG_NET_ETHERNET=y -CONFIG_MII=y -CONFIG_OAKNET=y - -# -# Ethernet (1000 Mbit) -# - -# -# Ethernet (10000 Mbit) -# -# CONFIG_PPP is not set -# CONFIG_SLIP is not set - -# -# Wireless LAN (non-hamradio) -# -# CONFIG_NET_RADIO is not set - -# -# Token Ring devices -# -# CONFIG_SHAPER is not set - -# -# Wan interfaces -# -# CONFIG_WAN is not set - -# -# Amateur Radio support -# -# CONFIG_HAMRADIO is not set - -# -# IrDA (infrared) support -# -# CONFIG_IRDA is not set - -# -# Bluetooth support -# -# CONFIG_BT is not set - -# -# ISDN subsystem -# -# CONFIG_ISDN_BOOL is not set - -# -# Graphics support -# -# CONFIG_FB is not set - -# -# Input device support -# -CONFIG_INPUT=y - -# -# Userland interfaces -# -# CONFIG_INPUT_MOUSEDEV is not set -# CONFIG_INPUT_JOYDEV is not set -# CONFIG_INPUT_TSDEV is not set -# CONFIG_INPUT_EVDEV is not set -# CONFIG_INPUT_EVBUG is not set - -# -# Input I/O drivers -# -# CONFIG_GAMEPORT is not set -CONFIG_SOUND_GAMEPORT=y -CONFIG_SERIO=y -# CONFIG_SERIO_I8042 is not set -# CONFIG_SERIO_SERPORT is not set -# CONFIG_SERIO_CT82C710 is not set - -# -# Input Device Drivers -# -# CONFIG_INPUT_KEYBOARD is not set -# CONFIG_INPUT_MOUSE is not set -# CONFIG_INPUT_JOYSTICK is not set -# CONFIG_INPUT_TOUCHSCREEN is not set -# CONFIG_INPUT_MISC is not set - -# -# Macintosh device drivers -# - -# -# Character devices -# -# CONFIG_VT is not set -# CONFIG_SERIAL_NONSTANDARD is not set - -# -# Serial drivers -# -CONFIG_SERIAL_8250=y -CONFIG_SERIAL_8250_CONSOLE=y -CONFIG_SERIAL_8250_NR_UARTS=4 -# CONFIG_SERIAL_8250_EXTENDED is not set - -# -# Non-8250 serial port support -# -CONFIG_SERIAL_CORE=y -CONFIG_SERIAL_CORE_CONSOLE=y -# CONFIG_UNIX98_PTYS is not set - -# -# I2C support -# -CONFIG_I2C=y -# CONFIG_I2C_CHARDEV is not set - -# -# I2C Algorithms -# -# CONFIG_I2C_ALGOBIT is not set -# CONFIG_I2C_ALGOPCF is not set - -# -# I2C Hardware Bus support -# -# CONFIG_I2C_AMD756 is not set -# CONFIG_I2C_AMD8111 is not set -CONFIG_I2C_IBM_IIC=y - -# -# I2C Hardware Sensors Chip support -# -# CONFIG_I2C_SENSOR is not set -# CONFIG_SENSORS_ADM1021 is not set -# CONFIG_SENSORS_EEPROM is not set -# CONFIG_SENSORS_IT87 is not set -# CONFIG_SENSORS_LM75 is not set -# CONFIG_SENSORS_LM78 is not set -# CONFIG_SENSORS_LM85 is not set -# CONFIG_SENSORS_VIA686A is not set -# CONFIG_SENSORS_W83781D is not set - -# -# Mice -# -# CONFIG_BUSMOUSE is not set -# CONFIG_QIC02_TAPE is not set - -# -# IPMI -# -# CONFIG_IPMI_HANDLER is not set - -# -# Watchdog Cards -# -# CONFIG_WATCHDOG is not set -# CONFIG_NVRAM is not set -CONFIG_GEN_RTC=y -# CONFIG_GEN_RTC_X is not set -# CONFIG_DTLK is not set -# CONFIG_R3964 is not set -# CONFIG_APPLICOM is not set - -# -# Ftape, the floppy tape device driver -# -# CONFIG_FTAPE is not set -# CONFIG_AGP is not set -# CONFIG_DRM is not set -# CONFIG_RAW_DRIVER is not set - -# -# Multimedia devices -# -# CONFIG_VIDEO_DEV is not set - -# -# Digital Video Broadcasting Devices -# -# CONFIG_DVB is not set - -# -# File systems -# -CONFIG_EXT2_FS=y -# CONFIG_EXT2_FS_XATTR is not set -CONFIG_EXT3_FS=y -CONFIG_EXT3_FS_XATTR=y -# CONFIG_EXT3_FS_POSIX_ACL is not set -# CONFIG_EXT3_FS_SECURITY is not set -CONFIG_JBD=y -# CONFIG_JBD_DEBUG is not set -CONFIG_FS_MBCACHE=y -# CONFIG_REISERFS_FS is not set -# CONFIG_JFS_FS is not set -# CONFIG_XFS_FS is not set -# CONFIG_MINIX_FS is not set -# CONFIG_ROMFS_FS is not set -# CONFIG_QUOTA is not set -# CONFIG_AUTOFS_FS is not set -# CONFIG_AUTOFS4_FS is not set - -# -# CD-ROM/DVD Filesystems -# -# CONFIG_ISO9660_FS is not set -# CONFIG_UDF_FS is not set - -# -# DOS/FAT/NT Filesystems -# -# CONFIG_FAT_FS is not set -# CONFIG_NTFS_FS is not set - -# -# Pseudo filesystems -# -CONFIG_PROC_FS=y -CONFIG_PROC_KCORE=y -# CONFIG_DEVFS_FS is not set -CONFIG_TMPFS=y -# CONFIG_HUGETLB_PAGE is not set -CONFIG_RAMFS=y - -# -# Miscellaneous filesystems -# -# CONFIG_ADFS_FS is not set -# CONFIG_AFFS_FS is not set -# CONFIG_HFS_FS is not set -# CONFIG_BEFS_FS is not set -# CONFIG_BFS_FS is not set -# CONFIG_EFS_FS is not set -# CONFIG_CRAMFS is not set -# CONFIG_VXFS_FS is not set -# CONFIG_HPFS_FS is not set -# CONFIG_QNX4FS_FS is not set -# CONFIG_SYSV_FS is not set -# CONFIG_UFS_FS is not set - -# -# Network File Systems -# -CONFIG_NFS_FS=y -# CONFIG_NFS_V3 is not set -# CONFIG_NFS_V4 is not set -# CONFIG_NFSD is not set -CONFIG_ROOT_NFS=y -CONFIG_LOCKD=y -# CONFIG_EXPORTFS is not set -CONFIG_SUNRPC=y -# CONFIG_SUNRPC_GSS is not set -# CONFIG_SMB_FS is not set -# CONFIG_CIFS is not set -# CONFIG_NCP_FS is not set -# CONFIG_CODA_FS is not set -# CONFIG_INTERMEZZO_FS is not set -# CONFIG_AFS_FS is not set - -# -# Partition Types -# -# CONFIG_PARTITION_ADVANCED is not set -CONFIG_MSDOS_PARTITION=y - -# -# Sound -# -# CONFIG_SOUND is not set - -# -# IBM 40x options -# - -# -# USB support -# -# CONFIG_USB_GADGET is not set - -# -# Library routines -# -CONFIG_CRC32=y - -# -# Kernel hacking -# -# CONFIG_DEBUG_KERNEL is not set -CONFIG_SERIAL_TEXT_DEBUG=y -CONFIG_OCP=y - -# -# Security options -# -# CONFIG_SECURITY is not set - -# -# Cryptographic options -# -# CONFIG_CRYPTO is not set diff --git a/include/asm-ppc/ibm4xx.h b/include/asm-ppc/ibm4xx.h index 7900d52d2a1..e992369cb8e 100644 --- a/include/asm-ppc/ibm4xx.h +++ b/include/asm-ppc/ibm4xx.h @@ -31,10 +31,6 @@ #include #endif -#if defined(CONFIG_REDWOOD_4) -#include -#endif - #if defined(CONFIG_REDWOOD_5) #include #endif -- cgit v1.2.3-70-g09d2 From f4ad35a34bdc27ae18f97d684ca0e693bbffd5f5 Mon Sep 17 00:00:00 2001 From: Kumar Gala Date: Sat, 3 Sep 2005 15:55:29 -0700 Subject: [PATCH] ppc32: Remove board support for SPD823TS Support for the SPD823TS board is no longer maintained and thus being removed Signed-off-by: Kumar Gala Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- arch/ppc/Kconfig | 15 -- arch/ppc/configs/SPD823TS_defconfig | 520 ------------------------------------ arch/ppc/platforms/spd8xx.h | 92 ------- include/asm-ppc/mpc8xx.h | 4 - 4 files changed, 631 deletions(-) delete mode 100644 arch/ppc/configs/SPD823TS_defconfig delete mode 100644 arch/ppc/platforms/spd8xx.h (limited to 'include') diff --git a/arch/ppc/Kconfig b/arch/ppc/Kconfig index 1a0c98db050..770d8f23f65 100644 --- a/arch/ppc/Kconfig +++ b/arch/ppc/Kconfig @@ -330,14 +330,6 @@ config RPXLITE End of life: end 2000 ? URL: see TQM850L - SPD823TS: - MPC823 based board used in the "Tele Server" product - Manufacturer: Speech Design, - Date of Release: Mid 2000 (?) - End of life: - - URL: - select "English", then "Teleteam Solutions", then "TeleServer" - IVMS8: MPC860 based board used in the "Integrated Voice Mail System", Small Version (8 voice channels) @@ -457,13 +449,6 @@ config TQM860L config FPS850L bool "FPS850L" -config SPD823TS - bool "SPD823TS" - help - Say Y here to support the Speech Design 823 Tele-Server from Speech - Design, released in 2000. The manufacturer's website is at - . - config IVMS8 bool "IVMS8" help diff --git a/arch/ppc/configs/SPD823TS_defconfig b/arch/ppc/configs/SPD823TS_defconfig deleted file mode 100644 index ba60fea2b83..00000000000 --- a/arch/ppc/configs/SPD823TS_defconfig +++ /dev/null @@ -1,520 +0,0 @@ -# -# Automatically generated make config: don't edit -# -CONFIG_MMU=y -CONFIG_RWSEM_XCHGADD_ALGORITHM=y -CONFIG_HAVE_DEC_LOCK=y - -# -# Code maturity level options -# -CONFIG_EXPERIMENTAL=y - -# -# General setup -# -CONFIG_SWAP=y -CONFIG_SYSVIPC=y -# CONFIG_BSD_PROCESS_ACCT is not set -CONFIG_SYSCTL=y -CONFIG_LOG_BUF_SHIFT=14 -CONFIG_EMBEDDED=y -CONFIG_FUTEX=y -# CONFIG_EPOLL is not set - -# -# Loadable module support -# -CONFIG_MODULES=y -CONFIG_MODULE_UNLOAD=y -# CONFIG_MODULE_FORCE_UNLOAD is not set -CONFIG_OBSOLETE_MODPARM=y -# CONFIG_MODVERSIONS is not set -CONFIG_KMOD=y - -# -# Platform support -# -CONFIG_PPC=y -CONFIG_PPC32=y -# CONFIG_6xx is not set -# CONFIG_40x is not set -# CONFIG_POWER3 is not set -CONFIG_8xx=y - -# -# IBM 4xx options -# -CONFIG_EMBEDDEDBOOT=y -CONFIG_SERIAL_CONSOLE=y -CONFIG_NOT_COHERENT_CACHE=y -# CONFIG_RPXLITE is not set -# CONFIG_RPXCLASSIC is not set -# CONFIG_BSEIP is not set -# CONFIG_FADS is not set -# CONFIG_TQM823L is not set -# CONFIG_TQM850L is not set -# CONFIG_TQM855L is not set -# CONFIG_TQM860L is not set -# CONFIG_FPS850L is not set -CONFIG_SPD823TS=y -# CONFIG_IVMS8 is not set -# CONFIG_IVML24 is not set -# CONFIG_SM850 is not set -# CONFIG_HERMES_PRO is not set -# CONFIG_IP860 is not set -# CONFIG_LWMON is not set -# CONFIG_PCU_E is not set -# CONFIG_CCM is not set -# CONFIG_LANTEC is not set -# CONFIG_MBX is not set -# CONFIG_WINCEPT is not set -# CONFIG_SMP is not set -# CONFIG_PREEMPT is not set -CONFIG_MATH_EMULATION=y -# CONFIG_CPU_FREQ is not set - -# -# General setup -# -# CONFIG_HIGHMEM is not set -# CONFIG_PCI is not set -# CONFIG_PCI_DOMAINS is not set -# CONFIG_PCI_QSPAN is not set -CONFIG_KCORE_ELF=y -CONFIG_BINFMT_ELF=y -CONFIG_KERNEL_ELF=y -# CONFIG_BINFMT_MISC is not set -# CONFIG_HOTPLUG is not set - -# -# Parallel port support -# -# CONFIG_PARPORT is not set -# CONFIG_CMDLINE_BOOL is not set - -# -# Advanced setup -# -# CONFIG_ADVANCED_OPTIONS is not set - -# -# Default settings for advanced configuration options are used -# -CONFIG_HIGHMEM_START=0xfe000000 -CONFIG_LOWMEM_SIZE=0x30000000 -CONFIG_KERNEL_START=0xc0000000 -CONFIG_TASK_SIZE=0x80000000 -CONFIG_BOOT_LOAD=0x00400000 - -# -# Memory Technology Devices (MTD) -# -# CONFIG_MTD is not set - -# -# Plug and Play support -# -# CONFIG_PNP is not set - -# -# Block devices -# -# CONFIG_BLK_DEV_FD is not set -# CONFIG_BLK_DEV_LOOP is not set -# CONFIG_BLK_DEV_NBD is not set -# CONFIG_BLK_DEV_RAM is not set -# CONFIG_BLK_DEV_INITRD is not set - -# -# Multi-device support (RAID and LVM) -# -# CONFIG_MD is not set - -# -# ATA/IDE/MFM/RLL support -# -# CONFIG_IDE is not set - -# -# SCSI support -# -# CONFIG_SCSI is not set - -# -# Fusion MPT device support -# - -# -# I2O device support -# - -# -# Networking support -# -CONFIG_NET=y - -# -# Networking options -# -CONFIG_PACKET=y -# CONFIG_PACKET_MMAP is not set -# CONFIG_NETLINK_DEV is not set -# CONFIG_NETFILTER is not set -CONFIG_UNIX=y -# CONFIG_NET_KEY is not set -CONFIG_INET=y -# CONFIG_IP_MULTICAST is not set -# CONFIG_IP_ADVANCED_ROUTER is not set -CONFIG_IP_PNP=y -CONFIG_IP_PNP_DHCP=y -# CONFIG_IP_PNP_BOOTP is not set -# CONFIG_IP_PNP_RARP is not set -# CONFIG_NET_IPIP is not set -# CONFIG_NET_IPGRE is not set -# CONFIG_ARPD is not set -# CONFIG_INET_ECN is not set -# CONFIG_SYN_COOKIES is not set -# CONFIG_INET_AH is not set -# CONFIG_INET_ESP is not set -# CONFIG_INET_IPCOMP is not set -# CONFIG_IPV6 is not set -# CONFIG_XFRM_USER is not set - -# -# SCTP Configuration (EXPERIMENTAL) -# -CONFIG_IPV6_SCTP__=y -# CONFIG_IP_SCTP is not set -# CONFIG_ATM is not set -# CONFIG_VLAN_8021Q is not set -# CONFIG_LLC is not set -# CONFIG_DECNET is not set -# CONFIG_BRIDGE is not set -# CONFIG_X25 is not set -# CONFIG_LAPB is not set -# CONFIG_NET_DIVERT is not set -# CONFIG_ECONET is not set -# CONFIG_WAN_ROUTER is not set -# CONFIG_NET_HW_FLOWCONTROL is not set - -# -# QoS and/or fair queueing -# -# CONFIG_NET_SCHED is not set - -# -# Network testing -# -# CONFIG_NET_PKTGEN is not set -CONFIG_NETDEVICES=y -# CONFIG_DUMMY is not set -# CONFIG_BONDING is not set -# CONFIG_EQUALIZER is not set -# CONFIG_TUN is not set -# CONFIG_ETHERTAP is not set - -# -# Ethernet (10 or 100Mbit) -# -CONFIG_NET_ETHERNET=y -# CONFIG_MII is not set -# CONFIG_OAKNET is not set - -# -# Ethernet (1000 Mbit) -# - -# -# Ethernet (10000 Mbit) -# -# CONFIG_PPP is not set -# CONFIG_SLIP is not set - -# -# Wireless LAN (non-hamradio) -# -# CONFIG_NET_RADIO is not set - -# -# Token Ring devices (depends on LLC=y) -# -# CONFIG_SHAPER is not set - -# -# Wan interfaces -# -# CONFIG_WAN is not set - -# -# Amateur Radio support -# -# CONFIG_HAMRADIO is not set - -# -# IrDA (infrared) support -# -# CONFIG_IRDA is not set - -# -# ISDN subsystem -# -# CONFIG_ISDN_BOOL is not set - -# -# Graphics support -# -# CONFIG_FB is not set - -# -# Old CD-ROM drivers (not SCSI, not IDE) -# -# CONFIG_CD_NO_IDESCSI is not set - -# -# Input device support -# -# CONFIG_INPUT is not set - -# -# Userland interfaces -# - -# -# Input I/O drivers -# -# CONFIG_GAMEPORT is not set -CONFIG_SOUND_GAMEPORT=y -# CONFIG_SERIO is not set - -# -# Input Device Drivers -# - -# -# Macintosh device drivers -# - -# -# Serial drivers -# -# CONFIG_SERIAL_8250 is not set - -# -# Non-8250 serial port support -# -CONFIG_SERIAL_CORE=y -CONFIG_SERIAL_CORE_CONSOLE=y -CONFIG_SERIAL_CPM=y -CONFIG_SERIAL_CPM_CONSOLE=y -# CONFIG_SERIAL_CPM_SCC1 is not set -# CONFIG_SERIAL_CPM_SCC2 is not set -# CONFIG_SERIAL_CPM_SCC3 is not set -# CONFIG_SERIAL_CPM_SCC4 is not set -CONFIG_SERIAL_CPM_SMC1=y -# CONFIG_SERIAL_CPM_SMC2 is not set -CONFIG_SERIAL_CPM_ALT_SMC2=y -CONFIG_UNIX98_PTYS=y -# CONFIG_LEGACY_PTYS is not set - -# -# I2C support -# -# CONFIG_I2C is not set - -# -# I2C Hardware Sensors Mainboard support -# - -# -# I2C Hardware Sensors Chip support -# -# CONFIG_I2C_SENSOR is not set - -# -# Mice -# -# CONFIG_BUSMOUSE is not set -# CONFIG_QIC02_TAPE is not set - -# -# IPMI -# -# CONFIG_IPMI_HANDLER is not set - -# -# Watchdog Cards -# -# CONFIG_WATCHDOG is not set -# CONFIG_NVRAM is not set -CONFIG_GEN_RTC=y -# CONFIG_GEN_RTC_X is not set -# CONFIG_DTLK is not set -# CONFIG_R3964 is not set -# CONFIG_APPLICOM is not set - -# -# Ftape, the floppy tape device driver -# -# CONFIG_FTAPE is not set -# CONFIG_AGP is not set -# CONFIG_DRM is not set -# CONFIG_RAW_DRIVER is not set -# CONFIG_HANGCHECK_TIMER is not set - -# -# Multimedia devices -# -# CONFIG_VIDEO_DEV is not set - -# -# Digital Video Broadcasting Devices -# -# CONFIG_DVB is not set - -# -# File systems -# -# CONFIG_EXT2_FS is not set -CONFIG_EXT3_FS=y -CONFIG_EXT3_FS_XATTR=y -# CONFIG_EXT3_FS_POSIX_ACL is not set -# CONFIG_EXT3_FS_SECURITY is not set -CONFIG_JBD=y -# CONFIG_JBD_DEBUG is not set -CONFIG_FS_MBCACHE=y -# CONFIG_REISERFS_FS is not set -# CONFIG_JFS_FS is not set -# CONFIG_XFS_FS is not set -# CONFIG_MINIX_FS is not set -# CONFIG_ROMFS_FS is not set -# CONFIG_QUOTA is not set -# CONFIG_AUTOFS_FS is not set -# CONFIG_AUTOFS4_FS is not set - -# -# CD-ROM/DVD Filesystems -# -# CONFIG_ISO9660_FS is not set -# CONFIG_UDF_FS is not set - -# -# DOS/FAT/NT Filesystems -# -# CONFIG_FAT_FS is not set -# CONFIG_NTFS_FS is not set - -# -# Pseudo filesystems -# -CONFIG_PROC_FS=y -# CONFIG_DEVFS_FS is not set -CONFIG_DEVPTS_FS=y -# CONFIG_DEVPTS_FS_XATTR is not set -CONFIG_TMPFS=y -CONFIG_RAMFS=y - -# -# Miscellaneous filesystems -# -# CONFIG_ADFS_FS is not set -# CONFIG_AFFS_FS is not set -# CONFIG_HFS_FS is not set -# CONFIG_BEFS_FS is not set -# CONFIG_BFS_FS is not set -# CONFIG_EFS_FS is not set -# CONFIG_CRAMFS is not set -# CONFIG_VXFS_FS is not set -# CONFIG_HPFS_FS is not set -# CONFIG_QNX4FS_FS is not set -# CONFIG_SYSV_FS is not set -# CONFIG_UFS_FS is not set - -# -# Network File Systems -# -CONFIG_NFS_FS=y -# CONFIG_NFS_V3 is not set -# CONFIG_NFS_V4 is not set -# CONFIG_NFSD is not set -CONFIG_ROOT_NFS=y -CONFIG_LOCKD=y -# CONFIG_EXPORTFS is not set -CONFIG_SUNRPC=y -# CONFIG_SUNRPC_GSS is not set -# CONFIG_SMB_FS is not set -# CONFIG_CIFS is not set -# CONFIG_NCP_FS is not set -# CONFIG_CODA_FS is not set -# CONFIG_INTERMEZZO_FS is not set -# CONFIG_AFS_FS is not set - -# -# Partition Types -# -CONFIG_PARTITION_ADVANCED=y -# CONFIG_ACORN_PARTITION is not set -# CONFIG_OSF_PARTITION is not set -# CONFIG_AMIGA_PARTITION is not set -# CONFIG_ATARI_PARTITION is not set -# CONFIG_MAC_PARTITION is not set -# CONFIG_MSDOS_PARTITION is not set -# CONFIG_LDM_PARTITION is not set -# CONFIG_NEC98_PARTITION is not set -# CONFIG_SGI_PARTITION is not set -# CONFIG_ULTRIX_PARTITION is not set -# CONFIG_SUN_PARTITION is not set -# CONFIG_EFI_PARTITION is not set - -# -# Sound -# -# CONFIG_SOUND is not set - -# -# MPC8xx CPM Options -# -CONFIG_SCC_ENET=y -# CONFIG_SCC1_ENET is not set -CONFIG_SCC2_ENET=y -# CONFIG_SCC3_ENET is not set -# CONFIG_FEC_ENET is not set -CONFIG_ENET_BIG_BUFFERS=y - -# -# Generic MPC8xx Options -# -CONFIG_8xx_COPYBACK=y -# CONFIG_8xx_CPU6 is not set -# CONFIG_UCODE_PATCH is not set - -# -# USB support -# -# CONFIG_USB_GADGET is not set - -# -# Bluetooth support -# -# CONFIG_BT is not set - -# -# Library routines -# -# CONFIG_CRC32 is not set - -# -# Kernel hacking -# -# CONFIG_DEBUG_KERNEL is not set -# CONFIG_KALLSYMS is not set - -# -# Security options -# -# CONFIG_SECURITY is not set - -# -# Cryptographic options -# -# CONFIG_CRYPTO is not set diff --git a/arch/ppc/platforms/spd8xx.h b/arch/ppc/platforms/spd8xx.h deleted file mode 100644 index ed48d144f41..00000000000 --- a/arch/ppc/platforms/spd8xx.h +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Speech Design SPD8xxTS board specific definitions - * - * Copyright (c) 2000,2001 Wolfgang Denk (wd@denx.de) - */ - -#ifdef __KERNEL__ -#ifndef __ASM_SPD8XX_H__ -#define __ASM_SPD8XX_H__ - -#include - -#include - -#ifndef __ASSEMBLY__ -#define SPD_IMMR_BASE 0xFFF00000 /* phys. addr of IMMR */ -#define SPD_IMAP_SIZE (64 * 1024) /* size of mapped area */ - -#define IMAP_ADDR SPD_IMMR_BASE /* physical base address of IMMR area */ -#define IMAP_SIZE SPD_IMAP_SIZE /* mapped size of IMMR area */ - -#define PCMCIA_MEM_ADDR ((uint)0xFE100000) -#define PCMCIA_MEM_SIZE ((uint)(64 * 1024)) - -#define IDE0_INTERRUPT 10 /* = IRQ5 */ -#define IDE1_INTERRUPT 12 /* = IRQ6 */ -#define CPM_INTERRUPT 13 /* = SIU_LEVEL6 (was: SIU_LEVEL2) */ - -/* override the default number of IDE hardware interfaces */ -#define MAX_HWIFS 2 - -/* - * Definitions for IDE0 Interface - */ -#define IDE0_BASE_OFFSET 0x0000 /* Offset in PCMCIA memory */ -#define IDE0_DATA_REG_OFFSET 0x0000 -#define IDE0_ERROR_REG_OFFSET 0x0081 -#define IDE0_NSECTOR_REG_OFFSET 0x0082 -#define IDE0_SECTOR_REG_OFFSET 0x0083 -#define IDE0_LCYL_REG_OFFSET 0x0084 -#define IDE0_HCYL_REG_OFFSET 0x0085 -#define IDE0_SELECT_REG_OFFSET 0x0086 -#define IDE0_STATUS_REG_OFFSET 0x0087 -#define IDE0_CONTROL_REG_OFFSET 0x0106 -#define IDE0_IRQ_REG_OFFSET 0x000A /* not used */ - -/* - * Definitions for IDE1 Interface - */ -#define IDE1_BASE_OFFSET 0x0C00 /* Offset in PCMCIA memory */ -#define IDE1_DATA_REG_OFFSET 0x0000 -#define IDE1_ERROR_REG_OFFSET 0x0081 -#define IDE1_NSECTOR_REG_OFFSET 0x0082 -#define IDE1_SECTOR_REG_OFFSET 0x0083 -#define IDE1_LCYL_REG_OFFSET 0x0084 -#define IDE1_HCYL_REG_OFFSET 0x0085 -#define IDE1_SELECT_REG_OFFSET 0x0086 -#define IDE1_STATUS_REG_OFFSET 0x0087 -#define IDE1_CONTROL_REG_OFFSET 0x0106 -#define IDE1_IRQ_REG_OFFSET 0x000A /* not used */ - -/* CPM Ethernet through SCCx. - * - * Bits in parallel I/O port registers that have to be set/cleared - * to configure the pins for SCC2 use. - */ -#define PA_ENET_MDC ((ushort)0x0001) /* PA 15 !!! */ -#define PA_ENET_MDIO ((ushort)0x0002) /* PA 14 !!! */ -#define PA_ENET_RXD ((ushort)0x0004) /* PA 13 */ -#define PA_ENET_TXD ((ushort)0x0008) /* PA 12 */ -#define PA_ENET_RCLK ((ushort)0x0200) /* PA 6 */ -#define PA_ENET_TCLK ((ushort)0x0400) /* PA 5 */ - -#define PB_ENET_TENA ((uint)0x00002000) /* PB 18 */ - -#define PC_ENET_CLSN ((ushort)0x0040) /* PC 9 */ -#define PC_ENET_RENA ((ushort)0x0080) /* PC 8 */ -#define PC_ENET_RESET ((ushort)0x0100) /* PC 7 !!! */ - -/* Control bits in the SICR to route TCLK (CLK3) and RCLK (CLK2) to - * SCC2. Also, make sure GR2 (bit 16) and SC2 (bit 17) are zero. - */ -#define SICR_ENET_MASK ((uint)0x0000ff00) -#define SICR_ENET_CLKRT ((uint)0x00002E00) - -/* We don't use the 8259. -*/ -#define NR_8259_INTS 0 - -#endif /* !__ASSEMBLY__ */ -#endif /* __ASM_SPD8XX_H__ */ -#endif /* __KERNEL__ */ diff --git a/include/asm-ppc/mpc8xx.h b/include/asm-ppc/mpc8xx.h index 7c31f2d564a..dc8e5989605 100644 --- a/include/asm-ppc/mpc8xx.h +++ b/include/asm-ppc/mpc8xx.h @@ -36,10 +36,6 @@ #include #endif -#if defined(CONFIG_SPD823TS) -#include -#endif - #if defined(CONFIG_IVMS8) || defined(CONFIG_IVML24) #include #endif -- cgit v1.2.3-70-g09d2 From d27477c2259488825f2f425d24f209a1b6f8dc7d Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Sat, 3 Sep 2005 15:55:31 -0700 Subject: [PATCH] ppc32: fix asm-ppc/dma-mapping.h sparse warning GFP flags must be passed as unisgned int __nocast these days, else we'll get tons of sparse warnings in every driver. Signed-off-by: Christoph Hellwig Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- include/asm-ppc/dma-mapping.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/asm-ppc/dma-mapping.h b/include/asm-ppc/dma-mapping.h index 6f74f59938d..92b8ee78dcc 100644 --- a/include/asm-ppc/dma-mapping.h +++ b/include/asm-ppc/dma-mapping.h @@ -60,7 +60,8 @@ static inline int dma_set_mask(struct device *dev, u64 dma_mask) } static inline void *dma_alloc_coherent(struct device *dev, size_t size, - dma_addr_t * dma_handle, int gfp) + dma_addr_t * dma_handle, + unsigned int __nocast gfp) { #ifdef CONFIG_NOT_COHERENT_CACHE return __dma_alloc_coherent(size, dma_handle, gfp); -- cgit v1.2.3-70-g09d2 From 8e8fff09756bdb799154d034c63033192d6f8f89 Mon Sep 17 00:00:00 2001 From: Kumar Gala Date: Sat, 3 Sep 2005 15:55:34 -0700 Subject: [PATCH] ppc32: Add ppc_sys descriptions for PowerQUICC II devices Added ppc_sys device and system definitions for PowerQUICC II devices. This will allow drivers for PQ2 to be proper platform device drivers. Which can be shared on PQ3 processors with the same peripherals. Signed-off-by: Matt McClintock Signed-off-by: Kumar Gala Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- arch/ppc/kernel/setup.c | 8 +- arch/ppc/syslib/Makefile | 3 +- arch/ppc/syslib/pq2_devices.c | 389 ++++++++++++++++++++++++++++++++++++++++++ arch/ppc/syslib/pq2_sys.c | 200 ++++++++++++++++++++++ include/asm-ppc/irq.h | 1 + include/asm-ppc/mpc8260.h | 18 ++ include/asm-ppc/ppc_sys.h | 4 +- 7 files changed, 619 insertions(+), 4 deletions(-) create mode 100644 arch/ppc/syslib/pq2_devices.c create mode 100644 arch/ppc/syslib/pq2_sys.c (limited to 'include') diff --git a/arch/ppc/kernel/setup.c b/arch/ppc/kernel/setup.c index cf74a744e37..9c44588f0af 100644 --- a/arch/ppc/kernel/setup.c +++ b/arch/ppc/kernel/setup.c @@ -41,7 +41,11 @@ #include #include -#if defined(CONFIG_85xx) || defined(CONFIG_83xx) || defined(CONFIG_MPC10X_BRIDGE) +#define USES_PPC_SYS (defined(CONFIG_85xx) || defined(CONFIG_83xx) || \ + defined(CONFIG_MPC10X_BRIDGE) || defined(CONFIG_8260) || \ + defined(CONFIG_PPC_MPC52xx)) + +#if USES_PPC_SYS #include #endif @@ -241,7 +245,7 @@ int show_cpuinfo(struct seq_file *m, void *v) seq_printf(m, "bogomips\t: %lu.%02lu\n", lpj / (500000/HZ), (lpj / (5000/HZ)) % 100); -#if defined(CONFIG_85xx) || defined(CONFIG_83xx) || defined(CONFIG_MPC10X_BRIDGE) +#if USES_PPC_SYS if (cur_ppc_sys_spec->ppc_sys_name) seq_printf(m, "chipset\t\t: %s\n", cur_ppc_sys_spec->ppc_sys_name); diff --git a/arch/ppc/syslib/Makefile b/arch/ppc/syslib/Makefile index 400a5d38a1b..8b9b226005d 100644 --- a/arch/ppc/syslib/Makefile +++ b/arch/ppc/syslib/Makefile @@ -73,7 +73,8 @@ obj-$(CONFIG_SANDPOINT) += i8259.o pci_auto.o todc_time.o obj-$(CONFIG_SBC82xx) += todc_time.o obj-$(CONFIG_SPRUCE) += cpc700_pic.o indirect_pci.o pci_auto.o \ todc_time.o -obj-$(CONFIG_8260) += m8260_setup.o +obj-$(CONFIG_8260) += m8260_setup.o pq2_devices.o pq2_sys.o \ + ppc_sys.o obj-$(CONFIG_PCI_8260) += m82xx_pci.o indirect_pci.o pci_auto.o obj-$(CONFIG_8260_PCI9) += m8260_pci_erratum9.o obj-$(CONFIG_CPM2) += cpm2_common.o cpm2_pic.o diff --git a/arch/ppc/syslib/pq2_devices.c b/arch/ppc/syslib/pq2_devices.c new file mode 100644 index 00000000000..1d3869768f9 --- /dev/null +++ b/arch/ppc/syslib/pq2_devices.c @@ -0,0 +1,389 @@ +/* + * arch/ppc/syslib/pq2_devices.c + * + * PQ2 Device descriptions + * + * Maintainer: Kumar Gala + * + * This file is licensed under the terms of the GNU General Public License + * version 2. This program is licensed "as is" without any warranty of any + * kind, whether express or implied. + */ + + +#include +#include +#include +#include +#include +#include +#include + +struct platform_device ppc_sys_platform_devices[] = { + [MPC82xx_CPM_FCC1] = { + .name = "fsl-cpm-fcc", + .id = 1, + .num_resources = 3, + .resource = (struct resource[]) { + { + .name = "fcc_regs", + .start = 0x11300, + .end = 0x1131f, + .flags = IORESOURCE_MEM, + }, + { + .name = "fcc_pram", + .start = 0x8400, + .end = 0x84ff, + .flags = IORESOURCE_MEM, + }, + { + .start = SIU_INT_FCC1, + .end = SIU_INT_FCC1, + .flags = IORESOURCE_IRQ, + }, + }, + }, + [MPC82xx_CPM_FCC2] = { + .name = "fsl-cpm-fcc", + .id = 2, + .num_resources = 3, + .resource = (struct resource[]) { + { + .name = "fcc_regs", + .start = 0x11320, + .end = 0x1133f, + .flags = IORESOURCE_MEM, + }, + { + .name = "fcc_pram", + .start = 0x8500, + .end = 0x85ff, + .flags = IORESOURCE_MEM, + }, + { + .start = SIU_INT_FCC2, + .end = SIU_INT_FCC2, + .flags = IORESOURCE_IRQ, + }, + }, + }, + [MPC82xx_CPM_FCC3] = { + .name = "fsl-cpm-fcc", + .id = 3, + .num_resources = 3, + .resource = (struct resource[]) { + { + .name = "fcc_regs", + .start = 0x11340, + .end = 0x1135f, + .flags = IORESOURCE_MEM, + }, + { + .name = "fcc_pram", + .start = 0x8600, + .end = 0x86ff, + .flags = IORESOURCE_MEM, + }, + { + .start = SIU_INT_FCC3, + .end = SIU_INT_FCC3, + .flags = IORESOURCE_IRQ, + }, + }, + }, + [MPC82xx_CPM_I2C] = { + .name = "fsl-cpm-i2c", + .id = 1, + .num_resources = 3, + .resource = (struct resource[]) { + { + .name = "i2c_mem", + .start = 0x11860, + .end = 0x118BF, + .flags = IORESOURCE_MEM, + }, + { + .name = "i2c_pram", + .start = 0x8afc, + .end = 0x8afd, + .flags = IORESOURCE_MEM, + }, + { + .start = SIU_INT_I2C, + .end = SIU_INT_I2C, + .flags = IORESOURCE_IRQ, + }, + }, + }, + [MPC82xx_CPM_SCC1] = { + .name = "fsl-cpm-scc", + .id = 1, + .num_resources = 3, + .resource = (struct resource[]) { + { + .name = "scc_mem", + .start = 0x11A00, + .end = 0x11A1F, + .flags = IORESOURCE_MEM, + }, + { + .name = "scc_pram", + .start = 0x8000, + .end = 0x80ff, + .flags = IORESOURCE_MEM, + }, + { + .start = SIU_INT_SCC1, + .end = SIU_INT_SCC1, + .flags = IORESOURCE_IRQ, + }, + }, + }, + [MPC82xx_CPM_SCC2] = { + .name = "fsl-cpm-scc", + .id = 2, + .num_resources = 3, + .resource = (struct resource[]) { + { + .name = "scc_mem", + .start = 0x11A20, + .end = 0x11A3F, + .flags = IORESOURCE_MEM, + }, + { + .name = "scc_pram", + .start = 0x8100, + .end = 0x81ff, + .flags = IORESOURCE_MEM, + }, + { + .start = SIU_INT_SCC2, + .end = SIU_INT_SCC2, + .flags = IORESOURCE_IRQ, + }, + }, + }, + [MPC82xx_CPM_SCC3] = { + .name = "fsl-cpm-scc", + .id = 3, + .num_resources = 3, + .resource = (struct resource[]) { + { + .name = "scc_mem", + .start = 0x11A40, + .end = 0x11A5F, + .flags = IORESOURCE_MEM, + }, + { + .name = "scc_pram", + .start = 0x8200, + .end = 0x82ff, + .flags = IORESOURCE_MEM, + }, + { + .start = SIU_INT_SCC3, + .end = SIU_INT_SCC3, + .flags = IORESOURCE_IRQ, + }, + }, + }, + [MPC82xx_CPM_SCC4] = { + .name = "fsl-cpm-scc", + .id = 4, + .num_resources = 3, + .resource = (struct resource[]) { + { + .name = "scc_mem", + .start = 0x11A60, + .end = 0x11A7F, + .flags = IORESOURCE_MEM, + }, + { + .name = "scc_pram", + .start = 0x8300, + .end = 0x83ff, + .flags = IORESOURCE_MEM, + }, + { + .start = SIU_INT_SCC4, + .end = SIU_INT_SCC4, + .flags = IORESOURCE_IRQ, + }, + }, + }, + [MPC82xx_CPM_SPI] = { + .name = "fsl-cpm-spi", + .id = 1, + .num_resources = 3, + .resource = (struct resource[]) { + { + .name = "spi_mem", + .start = 0x11AA0, + .end = 0x11AFF, + .flags = IORESOURCE_MEM, + }, + { + .name = "spi_pram", + .start = 0x89fc, + .end = 0x89fd, + .flags = IORESOURCE_MEM, + }, + { + .start = SIU_INT_SPI, + .end = SIU_INT_SPI, + .flags = IORESOURCE_IRQ, + }, + }, + }, + [MPC82xx_CPM_MCC1] = { + .name = "fsl-cpm-mcc", + .id = 1, + .num_resources = 3, + .resource = (struct resource[]) { + { + .name = "mcc_mem", + .start = 0x11B30, + .end = 0x11B3F, + .flags = IORESOURCE_MEM, + }, + { + .name = "mcc_pram", + .start = 0x8700, + .end = 0x877f, + .flags = IORESOURCE_MEM, + }, + { + .start = SIU_INT_MCC1, + .end = SIU_INT_MCC1, + .flags = IORESOURCE_IRQ, + }, + }, + }, + [MPC82xx_CPM_MCC2] = { + .name = "fsl-cpm-mcc", + .id = 2, + .num_resources = 3, + .resource = (struct resource[]) { + { + .name = "mcc_mem", + .start = 0x11B50, + .end = 0x11B5F, + .flags = IORESOURCE_MEM, + }, + { + .name = "mcc_pram", + .start = 0x8800, + .end = 0x887f, + .flags = IORESOURCE_MEM, + }, + { + .start = SIU_INT_MCC2, + .end = SIU_INT_MCC2, + .flags = IORESOURCE_IRQ, + }, + }, + }, + [MPC82xx_CPM_SMC1] = { + .name = "fsl-cpm-smc", + .id = 1, + .num_resources = 3, + .resource = (struct resource[]) { + { + .name = "smc_mem", + .start = 0x11A80, + .end = 0x11A8F, + .flags = IORESOURCE_MEM, + }, + { + .name = "smc_pram", + .start = 0x87fc, + .end = 0x87fd, + .flags = IORESOURCE_MEM, + }, + { + .start = SIU_INT_SMC1, + .end = SIU_INT_SMC1, + .flags = IORESOURCE_IRQ, + }, + }, + }, + [MPC82xx_CPM_SMC2] = { + .name = "fsl-cpm-smc", + .id = 2, + .num_resources = 3, + .resource = (struct resource[]) { + { + .name = "smc_mem", + .start = 0x11A90, + .end = 0x11A9F, + .flags = IORESOURCE_MEM, + }, + { + .name = "smc_pram", + .start = 0x88fc, + .end = 0x88fd, + .flags = IORESOURCE_MEM, + }, + { + .start = SIU_INT_SMC2, + .end = SIU_INT_SMC2, + .flags = IORESOURCE_IRQ, + }, + }, + }, + [MPC82xx_CPM_USB] = { + .name = "fsl-cpm-usb", + .id = 1, + .num_resources = 3, + .resource = (struct resource[]) { + { + .name = "usb_mem", + .start = 0x11b60, + .end = 0x11b78, + .flags = IORESOURCE_MEM, + }, + { + .name = "usb_pram", + .start = 0x8b00, + .end = 0x8bff, + .flags = IORESOURCE_MEM, + }, + { + .start = SIU_INT_USB, + .end = SIU_INT_USB, + .flags = IORESOURCE_IRQ, + }, + + }, + }, + [MPC82xx_SEC1] = { + .name = "fsl-sec", + .id = 1, + .num_resources = 1, + .resource = (struct resource[]) { + { + .name = "sec_mem", + .start = 0x40000, + .end = 0x52fff, + .flags = IORESOURCE_MEM, + }, + }, + }, +}; + +static int __init mach_mpc82xx_fixup(struct platform_device *pdev) +{ + ppc_sys_fixup_mem_resource(pdev, CPM_MAP_ADDR); + return 0; +} + +static int __init mach_mpc82xx_init(void) +{ + if (ppc_md.progress) + ppc_md.progress("mach_mpc82xx_init:enter", 0); + ppc_sys_device_fixup = mach_mpc82xx_fixup; + return 0; +} + +postcore_initcall(mach_mpc82xx_init); diff --git a/arch/ppc/syslib/pq2_sys.c b/arch/ppc/syslib/pq2_sys.c new file mode 100644 index 00000000000..7b6c9ebdb9e --- /dev/null +++ b/arch/ppc/syslib/pq2_sys.c @@ -0,0 +1,200 @@ +/* + * arch/ppc/syslib/pq2_devices.c + * + * PQ2 System descriptions + * + * Maintainer: Kumar Gala + * + * This file is licensed under the terms of the GNU General Public License + * version 2. This program is licensed "as is" without any warranty of any + * kind, whether express or implied. + */ + +#include +#include +#include + +#include + +struct ppc_sys_spec *cur_ppc_sys_spec; +struct ppc_sys_spec ppc_sys_specs[] = { + /* below is a list of the 8260 family of processors */ + { + .ppc_sys_name = "8250", + .mask = 0x0000ff00, + .value = 0x00000000, + .num_devices = 12, + .device_list = (enum ppc_sys_devices[]) + { + MPC82xx_CPM_FCC1, MPC82xx_CPM_FCC2, MPC82xx_CPM_FCC3, + MPC82xx_CPM_SCC1, MPC82xx_CPM_SCC2, MPC82xx_CPM_SCC3, + MPC82xx_CPM_SCC4, MPC82xx_CPM_MCC1, MPC82xx_CPM_SMC1, + MPC82xx_CPM_SMC2, MPC82xx_CPM_SPI, MPC82xx_CPM_I2C, + } + }, + { + .ppc_sys_name = "8255", + .mask = 0x0000ff00, + .value = 0x00000000, + .num_devices = 11, + .device_list = (enum ppc_sys_devices[]) + { + MPC82xx_CPM_FCC1, MPC82xx_CPM_FCC2, MPC82xx_CPM_SCC1, + MPC82xx_CPM_SCC2, MPC82xx_CPM_SCC3, MPC82xx_CPM_SCC4, + MPC82xx_CPM_MCC1, MPC82xx_CPM_SMC1, MPC82xx_CPM_SMC2, + MPC82xx_CPM_SPI, MPC82xx_CPM_I2C, + } + }, + { + .ppc_sys_name = "8260", + .mask = 0x0000ff00, + .value = 0x00000000, + .num_devices = 12, + .device_list = (enum ppc_sys_devices[]) + { + MPC82xx_CPM_FCC1, MPC82xx_CPM_FCC2, MPC82xx_CPM_FCC3, + MPC82xx_CPM_SCC1, MPC82xx_CPM_SCC2, MPC82xx_CPM_SCC3, + MPC82xx_CPM_SCC4, MPC82xx_CPM_MCC1, MPC82xx_CPM_SMC1, + MPC82xx_CPM_SMC2, MPC82xx_CPM_SPI, MPC82xx_CPM_I2C, + } + }, + { + .ppc_sys_name = "8264", + .mask = 0x0000ff00, + .value = 0x00000000, + .num_devices = 12, + .device_list = (enum ppc_sys_devices[]) + { + MPC82xx_CPM_FCC1, MPC82xx_CPM_FCC2, MPC82xx_CPM_FCC3, + MPC82xx_CPM_SCC1, MPC82xx_CPM_SCC2, MPC82xx_CPM_SCC3, + MPC82xx_CPM_SCC4, MPC82xx_CPM_MCC1, MPC82xx_CPM_SMC1, + MPC82xx_CPM_SMC2, MPC82xx_CPM_SPI, MPC82xx_CPM_I2C, + } + }, + { + .ppc_sys_name = "8265", + .mask = 0x0000ff00, + .value = 0x00000000, + .num_devices = 12, + .device_list = (enum ppc_sys_devices[]) + { + MPC82xx_CPM_FCC1, MPC82xx_CPM_FCC2, MPC82xx_CPM_FCC3, + MPC82xx_CPM_SCC1, MPC82xx_CPM_SCC2, MPC82xx_CPM_SCC3, + MPC82xx_CPM_SCC4, MPC82xx_CPM_MCC1, MPC82xx_CPM_SMC1, + MPC82xx_CPM_SMC2, MPC82xx_CPM_SPI, MPC82xx_CPM_I2C, + } + }, + { + .ppc_sys_name = "8266", + .mask = 0x0000ff00, + .value = 0x00000000, + .num_devices = 12, + .device_list = (enum ppc_sys_devices[]) + { + MPC82xx_CPM_FCC1, MPC82xx_CPM_FCC2, MPC82xx_CPM_FCC3, + MPC82xx_CPM_SCC1, MPC82xx_CPM_SCC2, MPC82xx_CPM_SCC3, + MPC82xx_CPM_SCC4, MPC82xx_CPM_MCC1, MPC82xx_CPM_SMC1, + MPC82xx_CPM_SMC2, MPC82xx_CPM_SPI, MPC82xx_CPM_I2C, + } + }, + /* below is a list of the 8272 family of processors */ + { + .ppc_sys_name = "8247", + .mask = 0x0000ff00, + .value = 0x00000d00, + .num_devices = 10, + .device_list = (enum ppc_sys_devices[]) + { + MPC82xx_CPM_FCC1, MPC82xx_CPM_FCC2, MPC82xx_CPM_SCC1, + MPC82xx_CPM_SCC2, MPC82xx_CPM_SCC3, MPC82xx_CPM_SMC1, + MPC82xx_CPM_SMC2, MPC82xx_CPM_SPI, MPC82xx_CPM_I2C, + MPC82xx_CPM_USB, + }, + }, + { + .ppc_sys_name = "8248", + .mask = 0x0000ff00, + .value = 0x00000c00, + .num_devices = 11, + .device_list = (enum ppc_sys_devices[]) + { + MPC82xx_CPM_FCC1, MPC82xx_CPM_FCC2, MPC82xx_CPM_SCC1, + MPC82xx_CPM_SCC2, MPC82xx_CPM_SCC3, MPC82xx_CPM_SMC1, + MPC82xx_CPM_SMC2, MPC82xx_CPM_SPI, MPC82xx_CPM_I2C, + MPC82xx_CPM_USB, MPC82xx_SEC1, + }, + }, + { + .ppc_sys_name = "8271", + .mask = 0x0000ff00, + .value = 0x00000d00, + .num_devices = 10, + .device_list = (enum ppc_sys_devices[]) + { + MPC82xx_CPM_FCC1, MPC82xx_CPM_FCC2, MPC82xx_CPM_SCC1, + MPC82xx_CPM_SCC2, MPC82xx_CPM_SCC3, MPC82xx_CPM_SMC1, + MPC82xx_CPM_SMC2, MPC82xx_CPM_SPI, MPC82xx_CPM_I2C, + MPC82xx_CPM_USB, + }, + }, + { + .ppc_sys_name = "8272", + .mask = 0x0000ff00, + .value = 0x00000c00, + .num_devices = 11, + .device_list = (enum ppc_sys_devices[]) + { + MPC82xx_CPM_FCC1, MPC82xx_CPM_FCC2, MPC82xx_CPM_SCC1, + MPC82xx_CPM_SCC2, MPC82xx_CPM_SCC3, MPC82xx_CPM_SMC1, + MPC82xx_CPM_SMC2, MPC82xx_CPM_SPI, MPC82xx_CPM_I2C, + MPC82xx_CPM_USB, MPC82xx_SEC1, + }, + }, + /* below is a list of the 8280 family of processors */ + { + .ppc_sys_name = "8270", + .mask = 0x0000ff00, + .value = 0x00000a00, + .num_devices = 12, + .device_list = (enum ppc_sys_devices[]) + { + MPC82xx_CPM_FCC1, MPC82xx_CPM_FCC2, MPC82xx_CPM_FCC3, + MPC82xx_CPM_SCC1, MPC82xx_CPM_SCC2, MPC82xx_CPM_SCC3, + MPC82xx_CPM_SCC4, MPC82xx_CPM_MCC1, MPC82xx_CPM_SMC1, + MPC82xx_CPM_SMC2, MPC82xx_CPM_SPI, MPC82xx_CPM_I2C, + }, + }, + { + .ppc_sys_name = "8275", + .mask = 0x0000ff00, + .value = 0x00000a00, + .num_devices = 12, + .device_list = (enum ppc_sys_devices[]) + { + MPC82xx_CPM_FCC1, MPC82xx_CPM_FCC2, MPC82xx_CPM_FCC3, + MPC82xx_CPM_SCC1, MPC82xx_CPM_SCC2, MPC82xx_CPM_SCC3, + MPC82xx_CPM_SCC4, MPC82xx_CPM_MCC1, MPC82xx_CPM_SMC1, + MPC82xx_CPM_SMC2, MPC82xx_CPM_SPI, MPC82xx_CPM_I2C, + }, + }, + { + .ppc_sys_name = "8280", + .mask = 0x0000ff00, + .value = 0x00000a00, + .num_devices = 13, + .device_list = (enum ppc_sys_devices[]) + { + MPC82xx_CPM_FCC1, MPC82xx_CPM_FCC2, MPC82xx_CPM_FCC3, + MPC82xx_CPM_SCC1, MPC82xx_CPM_SCC2, MPC82xx_CPM_SCC3, + MPC82xx_CPM_SCC4, MPC82xx_CPM_MCC1, MPC82xx_CPM_MCC2, + MPC82xx_CPM_SMC1, MPC82xx_CPM_SMC2, MPC82xx_CPM_SPI, + MPC82xx_CPM_I2C, + }, + }, + { + /* default match */ + .ppc_sys_name = "", + .mask = 0x00000000, + .value = 0x00000000, + }, +}; diff --git a/include/asm-ppc/irq.h b/include/asm-ppc/irq.h index a9b33324f56..a244d93ca95 100644 --- a/include/asm-ppc/irq.h +++ b/include/asm-ppc/irq.h @@ -337,6 +337,7 @@ static __inline__ int irq_canonicalize(int irq) #define SIU_INT_IDMA3 ((uint)0x08 + CPM_IRQ_OFFSET) #define SIU_INT_IDMA4 ((uint)0x09 + CPM_IRQ_OFFSET) #define SIU_INT_SDMA ((uint)0x0a + CPM_IRQ_OFFSET) +#define SIU_INT_USB ((uint)0x0b + CPM_IRQ_OFFSET) #define SIU_INT_TIMER1 ((uint)0x0c + CPM_IRQ_OFFSET) #define SIU_INT_TIMER2 ((uint)0x0d + CPM_IRQ_OFFSET) #define SIU_INT_TIMER3 ((uint)0x0e + CPM_IRQ_OFFSET) diff --git a/include/asm-ppc/mpc8260.h b/include/asm-ppc/mpc8260.h index 89eb8a2ac69..9694eca16e9 100644 --- a/include/asm-ppc/mpc8260.h +++ b/include/asm-ppc/mpc8260.h @@ -67,6 +67,24 @@ #define IO_VIRT_ADDR IO_PHYS_ADDR #endif +enum ppc_sys_devices { + MPC82xx_CPM_FCC1, + MPC82xx_CPM_FCC2, + MPC82xx_CPM_FCC3, + MPC82xx_CPM_I2C, + MPC82xx_CPM_SCC1, + MPC82xx_CPM_SCC2, + MPC82xx_CPM_SCC3, + MPC82xx_CPM_SCC4, + MPC82xx_CPM_SPI, + MPC82xx_CPM_MCC1, + MPC82xx_CPM_MCC2, + MPC82xx_CPM_SMC1, + MPC82xx_CPM_SMC2, + MPC82xx_CPM_USB, + MPC82xx_SEC1, +}; + #ifndef __ASSEMBLY__ /* The "residual" data board information structure the boot loader * hands to us. diff --git a/include/asm-ppc/ppc_sys.h b/include/asm-ppc/ppc_sys.h index 8ea62456623..01acf75735f 100644 --- a/include/asm-ppc/ppc_sys.h +++ b/include/asm-ppc/ppc_sys.h @@ -21,7 +21,9 @@ #include #include -#if defined(CONFIG_83xx) +#if defined(CONFIG_8260) +#include +#elif defined(CONFIG_83xx) #include #elif defined(CONFIG_85xx) #include -- cgit v1.2.3-70-g09d2 From 2698ebcb4338f09206b5accd75bc5cf2ed3dc641 Mon Sep 17 00:00:00 2001 From: Matt Porter Date: Sat, 3 Sep 2005 15:55:35 -0700 Subject: [PATCH] ppc32: add phy excluded features to ocp_func_emac_data This patch adds a field to struct ocp_func_emac_data that allows platform-specific unsupported PHY features to be passed in to the ibm_emac ethernet driver. This patch also adds some logic for the Bamboo eval board to populate this field based on the dip switches on the board. This is a workaround for the improperly biased RJ-45 sockets on the Rev. 0 Bamboo. Signed-off-by: Wade Farnsworth Signed-off-by: Matt Porter Cc: Jeff Garzik Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- arch/ppc/platforms/4xx/bamboo.c | 52 ++++++++++++++++++++++++++++++++++------- include/asm-ppc/ibm_ocp.h | 1 + 2 files changed, 45 insertions(+), 8 deletions(-) (limited to 'include') diff --git a/arch/ppc/platforms/4xx/bamboo.c b/arch/ppc/platforms/4xx/bamboo.c index f116787b0b7..05e2824db71 100644 --- a/arch/ppc/platforms/4xx/bamboo.c +++ b/arch/ppc/platforms/4xx/bamboo.c @@ -123,33 +123,69 @@ bamboo_map_irq(struct pci_dev *dev, unsigned char idsel, unsigned char pin) static void __init bamboo_set_emacdata(void) { - unsigned char * selection1_base; + u8 * base_addr; struct ocp_def *def; struct ocp_func_emac_data *emacdata; - u8 selection1_val; + u8 val; int mode; + u32 excluded = 0; - selection1_base = ioremap64(BAMBOO_FPGA_SELECTION1_REG_ADDR, 16); - selection1_val = readb(selection1_base); - iounmap((void *) selection1_base); - if (BAMBOO_SEL_MII(selection1_val)) + base_addr = ioremap64(BAMBOO_FPGA_SELECTION1_REG_ADDR, 16); + val = readb(base_addr); + iounmap((void *) base_addr); + if (BAMBOO_SEL_MII(val)) mode = PHY_MODE_MII; - else if (BAMBOO_SEL_RMII(selection1_val)) + else if (BAMBOO_SEL_RMII(val)) mode = PHY_MODE_RMII; else mode = PHY_MODE_SMII; - /* Set mac_addr and phy mode for each EMAC */ + /* + * SW2 on the Bamboo is used for ethernet configuration and is accessed + * via the CONFIG2 register in the FPGA. If the ANEG pin is set, + * overwrite the supported features with the settings in SW2. + * + * This is used as a workaround for the improperly biased RJ-45 sockets + * on the Rev. 0 Bamboo. By default only 10baseT is functional. + * Removing inductors L17 and L18 from the board allows 100baseT, but + * disables 10baseT. The Rev. 1 has no such limitations. + */ + + base_addr = ioremap64(BAMBOO_FPGA_CONFIG2_REG_ADDR, 8); + val = readb(base_addr); + iounmap((void *) base_addr); + if (!BAMBOO_AUTONEGOTIATE(val)) { + excluded |= SUPPORTED_Autoneg; + if (BAMBOO_FORCE_100Mbps(val)) { + excluded |= SUPPORTED_10baseT_Full; + excluded |= SUPPORTED_10baseT_Half; + if (BAMBOO_FULL_DUPLEX_EN(val)) + excluded |= SUPPORTED_100baseT_Half; + else + excluded |= SUPPORTED_100baseT_Full; + } else { + excluded |= SUPPORTED_100baseT_Full; + excluded |= SUPPORTED_100baseT_Half; + if (BAMBOO_FULL_DUPLEX_EN(val)) + excluded |= SUPPORTED_10baseT_Half; + else + excluded |= SUPPORTED_10baseT_Full; + } + } + + /* Set mac_addr, phy mode and unsupported phy features for each EMAC */ def = ocp_get_one_device(OCP_VENDOR_IBM, OCP_FUNC_EMAC, 0); emacdata = def->additions; memcpy(emacdata->mac_addr, __res.bi_enetaddr, 6); emacdata->phy_mode = mode; + emacdata->phy_feat_exc = excluded; def = ocp_get_one_device(OCP_VENDOR_IBM, OCP_FUNC_EMAC, 1); emacdata = def->additions; memcpy(emacdata->mac_addr, __res.bi_enet1addr, 6); emacdata->phy_mode = mode; + emacdata->phy_feat_exc = excluded; } static int diff --git a/include/asm-ppc/ibm_ocp.h b/include/asm-ppc/ibm_ocp.h index 3f7b5669e6d..a33053503ed 100644 --- a/include/asm-ppc/ibm_ocp.h +++ b/include/asm-ppc/ibm_ocp.h @@ -67,6 +67,7 @@ struct ocp_func_emac_data { int phy_mode; /* PHY type or configurable mode */ u8 mac_addr[6]; /* EMAC mac address */ u32 phy_map; /* EMAC phy map */ + u32 phy_feat_exc; /* Excluded PHY features */ }; /* Sysfs support */ -- cgit v1.2.3-70-g09d2 From 39cdc4bfb5c587c617ab6a28083c19101154e149 Mon Sep 17 00:00:00 2001 From: Kumar Gala Date: Sat, 3 Sep 2005 15:55:39 -0700 Subject: [PATCH] ppc32: Cleaned up global namespace of Book-E watchdog variables Renamed global variables used to convey if the watchdog is enabled and periodicity of the timer and moved the declarations into a header for these variables Signed-off-by: Matt McClintock Signed-off-by: Kumar Gala Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- arch/ppc/kernel/setup.c | 8 ++------ drivers/char/watchdog/Kconfig | 3 +++ drivers/char/watchdog/booke_wdt.c | 23 ++++++++++++----------- include/asm-ppc/system.h | 4 ++++ 4 files changed, 21 insertions(+), 17 deletions(-) (limited to 'include') diff --git a/arch/ppc/kernel/setup.c b/arch/ppc/kernel/setup.c index 9c44588f0af..545cfd0fab5 100644 --- a/arch/ppc/kernel/setup.c +++ b/arch/ppc/kernel/setup.c @@ -623,10 +623,8 @@ machine_init(unsigned long r3, unsigned long r4, unsigned long r5, /* Checks wdt=x and wdt_period=xx command-line option */ int __init early_parse_wdt(char *p) { - extern u32 wdt_enable; - if (p && strncmp(p, "0", 1) != 0) - wdt_enable = 1; + booke_wdt_enabled = 1; return 0; } @@ -634,10 +632,8 @@ early_param("wdt", early_parse_wdt); int __init early_parse_wdt_period (char *p) { - extern u32 wdt_period; - if (p) - wdt_period = simple_strtoul(p, NULL, 0); + booke_wdt_period = simple_strtoul(p, NULL, 0); return 0; } diff --git a/drivers/char/watchdog/Kconfig b/drivers/char/watchdog/Kconfig index 95335b443a8..c3898afce3a 100644 --- a/drivers/char/watchdog/Kconfig +++ b/drivers/char/watchdog/Kconfig @@ -349,6 +349,9 @@ config 8xx_WDT config BOOKE_WDT tristate "PowerPC Book-E Watchdog Timer" depends on WATCHDOG && (BOOKE || 4xx) + ---help--- + Please see Documentation/watchdog/watchdog-api.txt for + more information. # MIPS Architecture diff --git a/drivers/char/watchdog/booke_wdt.c b/drivers/char/watchdog/booke_wdt.c index 7281f394f68..abc30cca664 100644 --- a/drivers/char/watchdog/booke_wdt.c +++ b/drivers/char/watchdog/booke_wdt.c @@ -23,6 +23,7 @@ #include #include +#include /* If the kernel parameter wdt_enable=1, the watchdog will be enabled at boot. * Also, the wdt_period sets the watchdog timer period timeout. @@ -38,8 +39,8 @@ #define WDT_PERIOD_DEFAULT 4 /* Refer to the PPC40x and PPC4xx manuals */ #endif /* for timing information */ -u32 wdt_enable = 0; -u32 wdt_period = WDT_PERIOD_DEFAULT; +u32 booke_wdt_enabled = 0; +u32 booke_wdt_period = WDT_PERIOD_DEFAULT; #ifdef CONFIG_FSL_BOOKE #define WDTP(x) ((((63-x)&0x3)<<30)|(((63-x)&0x3c)<<15)) @@ -55,7 +56,7 @@ static __inline__ void booke_wdt_enable(void) u32 val; val = mfspr(SPRN_TCR); - val |= (TCR_WIE|TCR_WRC(WRC_CHIP)|WDTP(wdt_period)); + val |= (TCR_WIE|TCR_WRC(WRC_CHIP)|WDTP(booke_wdt_period)); mtspr(SPRN_TCR, val); } @@ -108,12 +109,12 @@ static int booke_wdt_ioctl (struct inode *inode, struct file *file, booke_wdt_ping(); return 0; case WDIOC_SETTIMEOUT: - if (get_user(wdt_period, (u32 *) arg)) + if (get_user(booke_wdt_period, (u32 *) arg)) return -EFAULT; - mtspr(SPRN_TCR, (mfspr(SPRN_TCR)&~WDTP(0))|WDTP(wdt_period)); + mtspr(SPRN_TCR, (mfspr(SPRN_TCR)&~WDTP(0))|WDTP(booke_wdt_period)); return 0; case WDIOC_GETTIMEOUT: - return put_user(wdt_period, (u32 *) arg); + return put_user(booke_wdt_period, (u32 *) arg); case WDIOC_SETOPTIONS: if (get_user(tmp, (u32 *) arg)) return -EINVAL; @@ -134,11 +135,11 @@ static int booke_wdt_ioctl (struct inode *inode, struct file *file, */ static int booke_wdt_open (struct inode *inode, struct file *file) { - if (wdt_enable == 0) { - wdt_enable = 1; + if (booke_wdt_enabled == 0) { + booke_wdt_enabled = 1; booke_wdt_enable(); printk (KERN_INFO "PowerPC Book-E Watchdog Timer Enabled (wdt_period=%d)\n", - wdt_period); + booke_wdt_period); } return 0; @@ -180,9 +181,9 @@ static int __init booke_wdt_init(void) return ret; } - if (wdt_enable == 1) { + if (booke_wdt_enabled == 1) { printk (KERN_INFO "PowerPC Book-E Watchdog Timer Enabled (wdt_period=%d)\n", - wdt_period); + booke_wdt_period); booke_wdt_enable(); } diff --git a/include/asm-ppc/system.h b/include/asm-ppc/system.h index 82395f30004..be6557746ab 100644 --- a/include/asm-ppc/system.h +++ b/include/asm-ppc/system.h @@ -87,6 +87,10 @@ extern void cacheable_memzero(void *p, unsigned int nb); extern int do_page_fault(struct pt_regs *, unsigned long, unsigned long); extern void bad_page_fault(struct pt_regs *, unsigned long, int); extern void die(const char *, struct pt_regs *, long); +#ifdef CONFIG_BOOKE_WDT +extern u32 booke_wdt_enabled; +extern u32 booke_wdt_period; +#endif /* CONFIG_BOOKE_WDT */ struct device_node; extern void note_scsi_host(struct device_node *, void *); -- cgit v1.2.3-70-g09d2 From 5a6a4d4320aed1918bf79dfb6bd841317f33b8e9 Mon Sep 17 00:00:00 2001 From: Roland Dreier Date: Sat, 3 Sep 2005 15:55:43 -0700 Subject: [PATCH] ppc32: Don't sleep in flush_dcache_icache_page() flush_dcache_icache_page() will be called on an instruction page fault. We can't sleep in the fault handler, so use kmap_atomic() instead of just kmap() for the Book-E case. Signed-off-by: Roland Dreier Acked-by: Matt Porter Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- arch/ppc/mm/init.c | 5 +++-- include/asm-ppc/kmap_types.h | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/arch/ppc/mm/init.c b/arch/ppc/mm/init.c index 33ada72c733..32ee4971026 100644 --- a/arch/ppc/mm/init.c +++ b/arch/ppc/mm/init.c @@ -560,8 +560,9 @@ void flush_dcache_page(struct page *page) void flush_dcache_icache_page(struct page *page) { #ifdef CONFIG_BOOKE - __flush_dcache_icache(kmap(page)); - kunmap(page); + void *start = kmap_atomic(page, KM_PPC_SYNC_ICACHE); + __flush_dcache_icache(start); + kunmap_atomic(start, KM_PPC_SYNC_ICACHE); #elif CONFIG_8xx /* On 8xx there is no need to kmap since highmem is not supported */ __flush_dcache_icache(page_address(page)); diff --git a/include/asm-ppc/kmap_types.h b/include/asm-ppc/kmap_types.h index 2589f182a6a..6d6fc78731e 100644 --- a/include/asm-ppc/kmap_types.h +++ b/include/asm-ppc/kmap_types.h @@ -17,6 +17,7 @@ enum km_type { KM_SOFTIRQ0, KM_SOFTIRQ1, KM_PPC_SYNC_PAGE, + KM_PPC_SYNC_ICACHE, KM_TYPE_NR }; -- cgit v1.2.3-70-g09d2 From 88adfe70c667c9e8fe5ec68eba78af566b539e24 Mon Sep 17 00:00:00 2001 From: Kumar Gala Date: Sat, 3 Sep 2005 15:55:46 -0700 Subject: [PATCH] ppc32: ppc_sys system on chip identification additions Add the ability to identify an SOC by a name and id. There are cases in which the integer identifier is not sufficient to specify a specific SOC. In these cases we can use a string to further qualify the match. Signed-off-by: Vitaly Bordug Signed-off-by: Kumar Gala Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- arch/ppc/syslib/ppc_sys.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++- include/asm-ppc/ppc_sys.h | 1 + 2 files changed, 52 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/arch/ppc/syslib/ppc_sys.c b/arch/ppc/syslib/ppc_sys.c index 87920235256..52ba0c68078 100644 --- a/arch/ppc/syslib/ppc_sys.c +++ b/arch/ppc/syslib/ppc_sys.c @@ -6,6 +6,7 @@ * Maintainer: Kumar Gala * * Copyright 2005 Freescale Semiconductor Inc. + * Copyright 2005 MontaVista, Inc. by Vitaly Bordug * * 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 @@ -35,10 +36,59 @@ void __init identify_ppc_sys_by_id(u32 id) void __init identify_ppc_sys_by_name(char *name) { - /* TODO */ + unsigned int i = 0; + while (ppc_sys_specs[i].ppc_sys_name[0]) + { + if (!strcmp(ppc_sys_specs[i].ppc_sys_name, name)) + break; + i++; + } + cur_ppc_sys_spec = &ppc_sys_specs[i]; return; } +static int __init count_sys_specs(void) +{ + int i = 0; + while (ppc_sys_specs[i].ppc_sys_name[0]) + i++; + return i; +} + +static int __init find_chip_by_name_and_id(char *name, u32 id) +{ + int ret = -1; + unsigned int i = 0; + unsigned int j = 0; + unsigned int dups = 0; + + unsigned char matched[count_sys_specs()]; + + while (ppc_sys_specs[i].ppc_sys_name[0]) { + if (!strcmp(ppc_sys_specs[i].ppc_sys_name, name)) + matched[j++] = i; + i++; + } + if (j != 0) { + for (i = 0; i < j; i++) { + if ((ppc_sys_specs[matched[i]].mask & id) == + ppc_sys_specs[matched[i]].value) { + ret = matched[i]; + dups++; + } + } + ret = (dups == 1) ? ret : (-1 * dups); + } + return ret; +} + +void __init identify_ppc_sys_by_name_and_id(char *name, u32 id) +{ + int i = find_chip_by_name_and_id(name, id); + BUG_ON(i < 0); + cur_ppc_sys_spec = &ppc_sys_specs[i]; +} + /* Update all memory resources by paddr, call before platform_device_register */ void __init ppc_sys_fixup_mem_resource(struct platform_device *pdev, phys_addr_t paddr) diff --git a/include/asm-ppc/ppc_sys.h b/include/asm-ppc/ppc_sys.h index 01acf75735f..048f7c8596e 100644 --- a/include/asm-ppc/ppc_sys.h +++ b/include/asm-ppc/ppc_sys.h @@ -52,6 +52,7 @@ extern struct ppc_sys_spec *cur_ppc_sys_spec; /* determine which specific SOC we are */ extern void identify_ppc_sys_by_id(u32 id) __init; extern void identify_ppc_sys_by_name(char *name) __init; +extern void identify_ppc_sys_by_name_and_id(char *name, u32 id) __init; /* describes all devices that may exist in a given family of processors */ extern struct platform_device ppc_sys_platform_devices[]; -- cgit v1.2.3-70-g09d2 From 164ada643ddf4f492a206b9bf2f2b02918b618da Mon Sep 17 00:00:00 2001 From: Kumar Gala Date: Sat, 3 Sep 2005 15:55:47 -0700 Subject: [PATCH] ppc32: add CONFIG_HZ While ppc32 has the CONFIG_HZ Kconfig option, it wasnt actually being used. Connect it up and set all platforms to 250Hz. This pretty much mimics the ppc64 patch from Anton Blanchard. Signed-off-by: Kumar Gala Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- include/asm-ppc/param.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/asm-ppc/param.h b/include/asm-ppc/param.h index b24a4e37196..6198b1657a4 100644 --- a/include/asm-ppc/param.h +++ b/include/asm-ppc/param.h @@ -1,8 +1,10 @@ #ifndef _ASM_PPC_PARAM_H #define _ASM_PPC_PARAM_H +#include + #ifdef __KERNEL__ -#define HZ 1000 /* internal timer frequency */ +#define HZ CONFIG_HZ /* internal timer frequency */ #define USER_HZ 100 /* for user interfaces in "ticks" */ #define CLOCKS_PER_SEC (USER_HZ) /* frequency at which times() counts */ #endif /* __KERNEL__ */ -- cgit v1.2.3-70-g09d2 From 28fa031e765b808520173f750bafbade832ba909 Mon Sep 17 00:00:00 2001 From: Eugene Surovegin Date: Sat, 3 Sep 2005 15:55:53 -0700 Subject: [PATCH] ppc32: move 4xx PHY_MODE_XXX defines to ibm_ocp.h Move 4xx PHY_MODE_XXX defines to asm-ppc/ibm_ocp.h. This is a preparation step for the new EMAC driver. Signed-off-by: Eugene Surovegin Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- arch/ppc/platforms/4xx/bamboo.c | 7 ------- arch/ppc/platforms/4xx/ebony.c | 7 ------- arch/ppc/platforms/4xx/luan.c | 7 ------- arch/ppc/platforms/4xx/ocotea.c | 7 ------- include/asm-ppc/ibm_ocp.h | 13 +++++++++++++ 5 files changed, 13 insertions(+), 28 deletions(-) (limited to 'include') diff --git a/arch/ppc/platforms/4xx/bamboo.c b/arch/ppc/platforms/4xx/bamboo.c index 05e2824db71..ac391d463d7 100644 --- a/arch/ppc/platforms/4xx/bamboo.c +++ b/arch/ppc/platforms/4xx/bamboo.c @@ -52,13 +52,6 @@ #include #include -/* - * This is a horrible kludge, we eventually need to abstract this - * generic PHY stuff, so the standard phy mode defines can be - * easily used from arch code. - */ -#include "../../../../drivers/net/ibm_emac/ibm_emac_phy.h" - bd_t __res; static struct ibm44x_clocks clocks __initdata; diff --git a/arch/ppc/platforms/4xx/ebony.c b/arch/ppc/platforms/4xx/ebony.c index 509e69a095f..0fd3442f513 100644 --- a/arch/ppc/platforms/4xx/ebony.c +++ b/arch/ppc/platforms/4xx/ebony.c @@ -55,13 +55,6 @@ #include #include -/* - * This is a horrible kludge, we eventually need to abstract this - * generic PHY stuff, so the standard phy mode defines can be - * easily used from arch code. - */ -#include "../../../../drivers/net/ibm_emac/ibm_emac_phy.h" - bd_t __res; static struct ibm44x_clocks clocks __initdata; diff --git a/arch/ppc/platforms/4xx/luan.c b/arch/ppc/platforms/4xx/luan.c index 95359f748e7..a38e6f9ef85 100644 --- a/arch/ppc/platforms/4xx/luan.c +++ b/arch/ppc/platforms/4xx/luan.c @@ -53,13 +53,6 @@ #include #include -/* - * This is a horrible kludge, we eventually need to abstract this - * generic PHY stuff, so the standard phy mode defines can be - * easily used from arch code. - */ -#include "../../../../drivers/net/ibm_emac/ibm_emac_phy.h" - bd_t __res; static struct ibm44x_clocks clocks __initdata; diff --git a/arch/ppc/platforms/4xx/ocotea.c b/arch/ppc/platforms/4xx/ocotea.c index 8fc34a34476..80028df1b44 100644 --- a/arch/ppc/platforms/4xx/ocotea.c +++ b/arch/ppc/platforms/4xx/ocotea.c @@ -53,13 +53,6 @@ #include #include -/* - * This is a horrible kludge, we eventually need to abstract this - * generic PHY stuff, so the standard phy mode defines can be - * easily used from arch code. - */ -#include "../../../../drivers/net/ibm_emac/ibm_emac_phy.h" - bd_t __res; static struct ibm44x_clocks clocks __initdata; diff --git a/include/asm-ppc/ibm_ocp.h b/include/asm-ppc/ibm_ocp.h index a33053503ed..7fd4b6ce327 100644 --- a/include/asm-ppc/ibm_ocp.h +++ b/include/asm-ppc/ibm_ocp.h @@ -101,6 +101,19 @@ void ocp_show_emac_data(struct device *dev) \ device_create_file(dev, &dev_attr_emac_phy_map); \ } +/* + * PHY mode settings (EMAC <-> ZMII/RGMII bridge <-> PHY) + */ +#define PHY_MODE_NA 0 +#define PHY_MODE_MII 1 +#define PHY_MODE_RMII 2 +#define PHY_MODE_SMII 3 +#define PHY_MODE_RGMII 4 +#define PHY_MODE_TBI 5 +#define PHY_MODE_GMII 6 +#define PHY_MODE_RTBI 7 +#define PHY_MODE_SGMII 8 + #ifdef CONFIG_40x /* * Helper function to copy MAC addresses from the bd_t to OCP EMAC -- cgit v1.2.3-70-g09d2 From 3a0a401b40abe31b34673a190c57697e7eced149 Mon Sep 17 00:00:00 2001 From: Eugene Surovegin Date: Sat, 3 Sep 2005 15:55:53 -0700 Subject: [PATCH] ppc32: add dcr_base field to ocp_func_mal_data Add dcr_base field to ocp_func_mal_data. This is preparation step for the new EMAC driver. Signed-off-by: Eugene Surovegin Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- arch/ppc/platforms/4xx/ibm405ep.c | 1 + arch/ppc/platforms/4xx/ibm405gp.c | 1 + arch/ppc/platforms/4xx/ibm405gpr.c | 1 + arch/ppc/platforms/4xx/ibm440ep.c | 1 + arch/ppc/platforms/4xx/ibm440gp.c | 1 + arch/ppc/platforms/4xx/ibm440gx.c | 1 + arch/ppc/platforms/4xx/ibm440sp.c | 1 + arch/ppc/platforms/4xx/ibmnp405h.c | 1 + include/asm-ppc/ibm_ocp.h | 3 +++ 9 files changed, 11 insertions(+) (limited to 'include') diff --git a/arch/ppc/platforms/4xx/ibm405ep.c b/arch/ppc/platforms/4xx/ibm405ep.c index 6d44567f4dd..093b28d27a4 100644 --- a/arch/ppc/platforms/4xx/ibm405ep.c +++ b/arch/ppc/platforms/4xx/ibm405ep.c @@ -33,6 +33,7 @@ static struct ocp_func_mal_data ibm405ep_mal0_def = { .txde_irq = 13, /* TX Descriptor Error IRQ */ .rxde_irq = 14, /* RX Descriptor Error IRQ */ .serr_irq = 10, /* MAL System Error IRQ */ + .dcr_base = DCRN_MAL_BASE /* MAL0_CFG DCR number */ }; OCP_SYSFS_MAL_DATA() diff --git a/arch/ppc/platforms/4xx/ibm405gp.c b/arch/ppc/platforms/4xx/ibm405gp.c index dfd7ef3ba5f..e5700469a68 100644 --- a/arch/ppc/platforms/4xx/ibm405gp.c +++ b/arch/ppc/platforms/4xx/ibm405gp.c @@ -46,6 +46,7 @@ static struct ocp_func_mal_data ibm405gp_mal0_def = { .txde_irq = 13, /* TX Descriptor Error IRQ */ .rxde_irq = 14, /* RX Descriptor Error IRQ */ .serr_irq = 10, /* MAL System Error IRQ */ + .dcr_base = DCRN_MAL_BASE /* MAL0_CFG DCR number */ }; OCP_SYSFS_MAL_DATA() diff --git a/arch/ppc/platforms/4xx/ibm405gpr.c b/arch/ppc/platforms/4xx/ibm405gpr.c index 01c8ccbc721..cd0d00d8e8e 100644 --- a/arch/ppc/platforms/4xx/ibm405gpr.c +++ b/arch/ppc/platforms/4xx/ibm405gpr.c @@ -42,6 +42,7 @@ static struct ocp_func_mal_data ibm405gpr_mal0_def = { .txde_irq = 13, /* TX Descriptor Error IRQ */ .rxde_irq = 14, /* RX Descriptor Error IRQ */ .serr_irq = 10, /* MAL System Error IRQ */ + .dcr_base = DCRN_MAL_BASE /* MAL0_CFG DCR number */ }; OCP_SYSFS_MAL_DATA() diff --git a/arch/ppc/platforms/4xx/ibm440ep.c b/arch/ppc/platforms/4xx/ibm440ep.c index 284da01f1ff..4712de8ff80 100644 --- a/arch/ppc/platforms/4xx/ibm440ep.c +++ b/arch/ppc/platforms/4xx/ibm440ep.c @@ -53,6 +53,7 @@ static struct ocp_func_mal_data ibm440ep_mal0_def = { .txde_irq = 33, /* TX Descriptor Error IRQ */ .rxde_irq = 34, /* RX Descriptor Error IRQ */ .serr_irq = 32, /* MAL System Error IRQ */ + .dcr_base = DCRN_MAL_BASE /* MAL0_CFG DCR number */ }; OCP_SYSFS_MAL_DATA() diff --git a/arch/ppc/platforms/4xx/ibm440gp.c b/arch/ppc/platforms/4xx/ibm440gp.c index 27615ef8309..d926245e8b3 100644 --- a/arch/ppc/platforms/4xx/ibm440gp.c +++ b/arch/ppc/platforms/4xx/ibm440gp.c @@ -56,6 +56,7 @@ static struct ocp_func_mal_data ibm440gp_mal0_def = { .txde_irq = 33, /* TX Descriptor Error IRQ */ .rxde_irq = 34, /* RX Descriptor Error IRQ */ .serr_irq = 32, /* MAL System Error IRQ */ + .dcr_base = DCRN_MAL_BASE /* MAL0_CFG DCR number */ }; OCP_SYSFS_MAL_DATA() diff --git a/arch/ppc/platforms/4xx/ibm440gx.c b/arch/ppc/platforms/4xx/ibm440gx.c index 1f38f42835b..956f45e4ef9 100644 --- a/arch/ppc/platforms/4xx/ibm440gx.c +++ b/arch/ppc/platforms/4xx/ibm440gx.c @@ -84,6 +84,7 @@ static struct ocp_func_mal_data ibm440gx_mal0_def = { .txde_irq = 33, /* TX Descriptor Error IRQ */ .rxde_irq = 34, /* RX Descriptor Error IRQ */ .serr_irq = 32, /* MAL System Error IRQ */ + .dcr_base = DCRN_MAL_BASE /* MAL0_CFG DCR number */ }; OCP_SYSFS_MAL_DATA() diff --git a/arch/ppc/platforms/4xx/ibm440sp.c b/arch/ppc/platforms/4xx/ibm440sp.c index fa3e003a0db..feb17e41ef6 100644 --- a/arch/ppc/platforms/4xx/ibm440sp.c +++ b/arch/ppc/platforms/4xx/ibm440sp.c @@ -43,6 +43,7 @@ static struct ocp_func_mal_data ibm440sp_mal0_def = { .txde_irq = 34, /* TX Descriptor Error IRQ */ .rxde_irq = 35, /* RX Descriptor Error IRQ */ .serr_irq = 33, /* MAL System Error IRQ */ + .dcr_base = DCRN_MAL_BASE /* MAL0_CFG DCR number */ }; OCP_SYSFS_MAL_DATA() diff --git a/arch/ppc/platforms/4xx/ibmnp405h.c b/arch/ppc/platforms/4xx/ibmnp405h.c index 4937cfb4b5d..a477a78f490 100644 --- a/arch/ppc/platforms/4xx/ibmnp405h.c +++ b/arch/ppc/platforms/4xx/ibmnp405h.c @@ -73,6 +73,7 @@ static struct ocp_func_mal_data ibmnp405h_mal0_def = { .txde_irq = 46, /* TX Descriptor Error IRQ */ .rxde_irq = 47, /* RX Descriptor Error IRQ */ .serr_irq = 45, /* MAL System Error IRQ */ + .dcr_base = DCRN_MAL_BASE /* MAL0_CFG DCR number */ }; OCP_SYSFS_MAL_DATA() diff --git a/include/asm-ppc/ibm_ocp.h b/include/asm-ppc/ibm_ocp.h index 7fd4b6ce327..bd7656fa202 100644 --- a/include/asm-ppc/ibm_ocp.h +++ b/include/asm-ppc/ibm_ocp.h @@ -147,6 +147,7 @@ struct ocp_func_mal_data { int txde_irq; /* TX Descriptor Error IRQ */ int rxde_irq; /* RX Descriptor Error IRQ */ int serr_irq; /* MAL System Error IRQ */ + int dcr_base; /* MALx_CFG DCR number */ }; #define OCP_SYSFS_MAL_DATA() \ @@ -157,6 +158,7 @@ OCP_SYSFS_ADDTL(struct ocp_func_mal_data, "%d\n", mal, rxeob_irq) \ OCP_SYSFS_ADDTL(struct ocp_func_mal_data, "%d\n", mal, txde_irq) \ OCP_SYSFS_ADDTL(struct ocp_func_mal_data, "%d\n", mal, rxde_irq) \ OCP_SYSFS_ADDTL(struct ocp_func_mal_data, "%d\n", mal, serr_irq) \ +OCP_SYSFS_ADDTL(struct ocp_func_mal_data, "%d\n", mal, dcr_base) \ \ void ocp_show_mal_data(struct device *dev) \ { \ @@ -167,6 +169,7 @@ void ocp_show_mal_data(struct device *dev) \ device_create_file(dev, &dev_attr_mal_txde_irq); \ device_create_file(dev, &dev_attr_mal_rxde_irq); \ device_create_file(dev, &dev_attr_mal_serr_irq); \ + device_create_file(dev, &dev_attr_mal_dcr_base); \ } /* -- cgit v1.2.3-70-g09d2 From e8834801bf9e2ee96c3ac29adf0ff6840afcd841 Mon Sep 17 00:00:00 2001 From: Eugene Surovegin Date: Sat, 3 Sep 2005 15:55:54 -0700 Subject: [PATCH] ppc32: export cacheable_memcpy() Add declaration and cacheable_memcpy(). I'll be needing this function in new 4xx EMAC driver I'm going to submit to netdev soon. IMHO, the better place for the declaration would be asm-powerpc/string.h, unfortunately, ppc64 doesn't have this function, so asm-ppc/system.h is the next best place. Signed-off-by: Eugene Surovegin Signed-off-by: Benjamin Herrenschmidt Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- arch/ppc/kernel/ppc_ksyms.c | 1 + include/asm-ppc/system.h | 1 + 2 files changed, 2 insertions(+) (limited to 'include') diff --git a/arch/ppc/kernel/ppc_ksyms.c b/arch/ppc/kernel/ppc_ksyms.c index e208ef92008..88f6bb7b696 100644 --- a/arch/ppc/kernel/ppc_ksyms.c +++ b/arch/ppc/kernel/ppc_ksyms.c @@ -260,6 +260,7 @@ EXPORT_SYMBOL(__ashrdi3); EXPORT_SYMBOL(__ashldi3); EXPORT_SYMBOL(__lshrdi3); EXPORT_SYMBOL(memcpy); +EXPORT_SYMBOL(cacheable_memcpy); EXPORT_SYMBOL(memset); EXPORT_SYMBOL(memmove); EXPORT_SYMBOL(memscan); diff --git a/include/asm-ppc/system.h b/include/asm-ppc/system.h index be6557746ab..513a334c581 100644 --- a/include/asm-ppc/system.h +++ b/include/asm-ppc/system.h @@ -84,6 +84,7 @@ extern void cvt_fd(float *from, double *to, unsigned long *fpscr); extern void cvt_df(double *from, float *to, unsigned long *fpscr); extern int call_rtas(const char *, int, int, unsigned long *, ...); extern void cacheable_memzero(void *p, unsigned int nb); +extern void *cacheable_memcpy(void *, const void *, unsigned int); extern int do_page_fault(struct pt_regs *, unsigned long, unsigned long); extern void bad_page_fault(struct pt_regs *, unsigned long, int); extern void die(const char *, struct pt_regs *, long); -- cgit v1.2.3-70-g09d2 From d01c08c9ae91c1526d4564b400b3e0e04b49d1ba Mon Sep 17 00:00:00 2001 From: "Mark A. Greer" Date: Sat, 3 Sep 2005 15:55:56 -0700 Subject: [PATCH] ppc32: mv64x60 updates & enhancements Updates and enhancement to the ppc32 mv64x60 code: - move code to get mem size from mem ctlr to bootwrapper - address some errata in the mv64360 pic code - some minor cleanups - export one of the bridge's regs via sysfs so user daemon can watch for extraction events Signed-off-by: Mark A. Greer Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- arch/ppc/Kconfig.debug | 3 +- arch/ppc/boot/simple/misc-mv64x60.c | 27 ++++ arch/ppc/syslib/mv64360_pic.c | 31 +++-- arch/ppc/syslib/mv64x60.c | 246 ++++++++++++++++++++++-------------- include/asm-ppc/mv64x60.h | 7 + include/asm-ppc/mv64x60_defs.h | 9 +- include/linux/mv643xx.h | 2 +- 7 files changed, 212 insertions(+), 113 deletions(-) (limited to 'include') diff --git a/arch/ppc/Kconfig.debug b/arch/ppc/Kconfig.debug index e16c7710d4b..61653cb60c4 100644 --- a/arch/ppc/Kconfig.debug +++ b/arch/ppc/Kconfig.debug @@ -62,7 +62,8 @@ config BOOTX_TEXT config SERIAL_TEXT_DEBUG bool "Support for early boot texts over serial port" - depends on 4xx || GT64260 || LOPEC || PPLUS || PRPMC800 || PPC_GEN550 || PPC_MPC52xx + depends on 4xx || LOPEC || MV64X60 || PPLUS || PRPMC800 || \ + PPC_GEN550 || PPC_MPC52xx config PPC_OCP bool diff --git a/arch/ppc/boot/simple/misc-mv64x60.c b/arch/ppc/boot/simple/misc-mv64x60.c index 7e88fc6d207..258d4599fad 100644 --- a/arch/ppc/boot/simple/misc-mv64x60.c +++ b/arch/ppc/boot/simple/misc-mv64x60.c @@ -19,6 +19,33 @@ extern struct bi_record *decompress_kernel(unsigned long load_addr, int num_words, unsigned long cksum); + +u32 size_reg[MV64x60_CPU2MEM_WINDOWS] = { + MV64x60_CPU2MEM_0_SIZE, MV64x60_CPU2MEM_1_SIZE, + MV64x60_CPU2MEM_2_SIZE, MV64x60_CPU2MEM_3_SIZE +}; + +/* Read mem ctlr to get the amount of mem in system */ +unsigned long +mv64360_get_mem_size(void) +{ + u32 enables, i, v; + u32 mem = 0; + + enables = in_le32((void __iomem *)CONFIG_MV64X60_NEW_BASE + + MV64360_CPU_BAR_ENABLE) & 0xf; + + for (i=0; i 1)) - mask |= 0x1; /* enable DPErr on 64460 */ - /* Clear old errors and register PCI 0 error intr handler */ mv64x60_write(&bh, MV64x60_PCI0_ERR_CAUSE, 0); if ((rc = request_irq(MV64360_IRQ_PCI0 + mv64360_irq_base, @@ -407,7 +402,11 @@ mv64360_register_hdlrs(void) rc); mv64x60_write(&bh, MV64x60_PCI0_ERR_MASK, 0); - mv64x60_write(&bh, MV64x60_PCI0_ERR_MASK, mask); + mv64x60_write(&bh, MV64x60_PCI0_ERR_MASK, MV64360_PCI0_ERR_MASK_VAL); + + /* Erratum FEr PCI-#16 says to clear bit 0 of PCI SERRn Mask reg. */ + mv64x60_write(&bh, MV64x60_PCI0_ERR_SERR_MASK, + mv64x60_read(&bh, MV64x60_PCI0_ERR_SERR_MASK) & ~0x1UL); /* Clear old errors and register PCI 1 error intr handler */ mv64x60_write(&bh, MV64x60_PCI1_ERR_CAUSE, 0); @@ -418,7 +417,11 @@ mv64360_register_hdlrs(void) rc); mv64x60_write(&bh, MV64x60_PCI1_ERR_MASK, 0); - mv64x60_write(&bh, MV64x60_PCI1_ERR_MASK, mask); + mv64x60_write(&bh, MV64x60_PCI1_ERR_MASK, MV64360_PCI0_ERR_MASK_VAL); + + /* Erratum FEr PCI-#16 says to clear bit 0 of PCI Intr Mask reg. */ + mv64x60_write(&bh, MV64x60_PCI1_ERR_SERR_MASK, + mv64x60_read(&bh, MV64x60_PCI1_ERR_SERR_MASK) & ~0x1UL); return 0; } diff --git a/arch/ppc/syslib/mv64x60.c b/arch/ppc/syslib/mv64x60.c index cc77177fa1c..6262b11f366 100644 --- a/arch/ppc/syslib/mv64x60.c +++ b/arch/ppc/syslib/mv64x60.c @@ -30,13 +30,16 @@ #include -u8 mv64x60_pci_exclude_bridge = 1; +u8 mv64x60_pci_exclude_bridge = 1; spinlock_t mv64x60_lock = SPIN_LOCK_UNLOCKED; -static phys_addr_t mv64x60_bridge_pbase = 0; -static void *mv64x60_bridge_vbase = 0; +static phys_addr_t mv64x60_bridge_pbase; +static void *mv64x60_bridge_vbase; static u32 mv64x60_bridge_type = MV64x60_TYPE_INVALID; -static u32 mv64x60_bridge_rev = 0; +static u32 mv64x60_bridge_rev; +#if defined(CONFIG_SYSFS) && !defined(CONFIG_GT64260) +static struct pci_controller sysfs_hose_a; +#endif static u32 gt64260_translate_size(u32 base, u32 size, u32 num_bits); static u32 gt64260_untranslate_size(u32 base, u32 size, u32 num_bits); @@ -432,6 +435,20 @@ static struct platform_device i2c_device = { }; #endif +#if defined(CONFIG_SYSFS) && !defined(CONFIG_GT64260) +static struct mv64xxx_pdata mv64xxx_pdata = { + .hs_reg_valid = 0, +}; + +static struct platform_device mv64xxx_device = { /* general mv64x60 stuff */ + .name = MV64XXX_DEV_NAME, + .id = 0, + .dev = { + .platform_data = &mv64xxx_pdata, + }, +}; +#endif + static struct platform_device *mv64x60_pd_devs[] __initdata = { #ifdef CONFIG_SERIAL_MPSC &mpsc_shared_device, @@ -453,6 +470,9 @@ static struct platform_device *mv64x60_pd_devs[] __initdata = { #ifdef CONFIG_I2C_MV64XXX &i2c_device, #endif +#if defined(CONFIG_SYSFS) && !defined(CONFIG_GT64260) + &mv64xxx_device, +#endif }; /* @@ -574,6 +594,11 @@ mv64x60_early_init(struct mv64x60_handle *bh, struct mv64x60_setup_info *si) bh->hose_a = &hose_a; bh->hose_b = &hose_b; +#if defined(CONFIG_SYSFS) && !defined(CONFIG_GT64260) + /* Save a copy of hose_a for sysfs functions -- hack */ + memcpy(&sysfs_hose_a, &hose_a, sizeof(hose_a)); +#endif + mv64x60_set_bus(bh, 0, 0); mv64x60_set_bus(bh, 1, 0); @@ -590,8 +615,6 @@ mv64x60_early_init(struct mv64x60_handle *bh, struct mv64x60_setup_info *si) mv64x60_set_bits(bh, MV64x60_PCI0_TO_RETRY, 0xffff); mv64x60_set_bits(bh, MV64x60_PCI1_TO_RETRY, 0xffff); - - return; } /* @@ -628,19 +651,15 @@ mv64x60_get_32bit_window(struct mv64x60_handle *bh, u32 window, val = mv64x60_read(bh, size_reg); val = get_from_field(val, size_bits); *size = bh->ci->untranslate_size(*base, val, size_bits); - } - else + } else *size = 0; - } - else { + } else { *base = 0; *size = 0; } pr_debug("get 32bit window: %d, base: 0x%x, size: 0x%x\n", window, *base, *size); - - return; } /* @@ -677,8 +696,6 @@ mv64x60_set_32bit_window(struct mv64x60_handle *bh, u32 window, (void)mv64x60_read(bh, base_reg); /* Flush FIFO */ } - - return; } /* @@ -712,11 +729,9 @@ mv64x60_get_64bit_window(struct mv64x60_handle *bh, u32 window, val = get_from_field(val, size_bits); *size = bh->ci->untranslate_size(*base_lo, val, size_bits); - } - else + } else *size = 0; - } - else { + } else { *base_hi = 0; *base_lo = 0; *size = 0; @@ -724,8 +739,6 @@ mv64x60_get_64bit_window(struct mv64x60_handle *bh, u32 window, pr_debug("get 64bit window: %d, base hi: 0x%x, base lo: 0x%x, " "size: 0x%x\n", window, *base_hi, *base_lo, *size); - - return; } /* @@ -766,8 +779,6 @@ mv64x60_set_64bit_window(struct mv64x60_handle *bh, u32 window, (void)mv64x60_read(bh, base_lo_reg); /* Flush FIFO */ } - - return; } /* @@ -1008,8 +1019,6 @@ mv64x60_get_mem_windows(struct mv64x60_handle *bh, mem_windows[i][0] = 0; mem_windows[i][1] = 0; } - - return; } /* @@ -1077,8 +1086,6 @@ mv64x60_config_cpu2mem_windows(struct mv64x60_handle *bh, } } - - return; } /* @@ -1112,8 +1119,7 @@ mv64x60_config_cpu2pci_windows(struct mv64x60_handle *bh, mv64x60_set_32bit_window(bh, remap_tab[bus][0], pi->pci_io.pci_base_lo, 0, 0); bh->ci->enable_window_32bit(bh, win_tab[bus][0]); - } - else /* Actually, the window should already be disabled */ + } else /* Actually, the window should already be disabled */ bh->ci->disable_window_32bit(bh, win_tab[bus][0]); for (i=0; i<3; i++) @@ -1125,11 +1131,8 @@ mv64x60_config_cpu2pci_windows(struct mv64x60_handle *bh, pi->pci_mem[i].pci_base_hi, pi->pci_mem[i].pci_base_lo, 0, 0); bh->ci->enable_window_32bit(bh, win_tab[bus][i+1]); - } - else /* Actually, the window should already be disabled */ + } else /* Actually, the window should already be disabled */ bh->ci->disable_window_32bit(bh, win_tab[bus][i+1]); - - return; } /* @@ -1206,8 +1209,6 @@ mv64x60_config_pci2mem_windows(struct mv64x60_handle *bh, MV64x60_PCI0_BAR_ENABLE : MV64x60_PCI1_BAR_ENABLE), (1 << i)); } - - return; } /* @@ -1229,7 +1230,6 @@ mv64x60_alloc_hose(struct mv64x60_handle *bh, u32 cfg_addr, u32 cfg_data, *hose = pcibios_alloc_controller(); setup_indirect_pci_nomap(*hose, bh->v_base + cfg_addr, bh->v_base + cfg_data); - return; } /* @@ -1272,7 +1272,6 @@ mv64x60_config_resources(struct pci_controller *hose, pi->pci_mem[0].size - 1; hose->pci_mem_offset = pi->pci_mem[0].cpu_base - pi->pci_mem[0].pci_base_lo; - return; } /* @@ -1309,7 +1308,6 @@ mv64x60_config_pci_params(struct pci_controller *hose, early_write_config_word(hose, 0, devfn, PCI_CACHE_LINE_SIZE, u16_val); mv64x60_pci_exclude_bridge = save_exclude; - return; } /* @@ -1336,8 +1334,7 @@ mv64x60_set_bus(struct mv64x60_handle *bh, u32 bus, u32 child_bus) p2p_cfg = MV64x60_PCI0_P2P_CONFIG; pci_cfg_offset = 0x64; hose = bh->hose_a; - } - else { + } else { pci_mode = bh->pci_mode_b; p2p_cfg = MV64x60_PCI1_P2P_CONFIG; pci_cfg_offset = 0xe4; @@ -1352,8 +1349,7 @@ mv64x60_set_bus(struct mv64x60_handle *bh, u32 bus, u32 child_bus) val |= (child_bus << 16) | 0xff; mv64x60_write(bh, p2p_cfg, val); (void)mv64x60_read(bh, p2p_cfg); /* Flush FIFO */ - } - else { /* PCI-X */ + } else { /* PCI-X */ /* * Need to use the current bus/dev number (that's in the * P2P CONFIG reg) to access the bridge's pci config space. @@ -1365,8 +1361,6 @@ mv64x60_set_bus(struct mv64x60_handle *bh, u32 bus, u32 child_bus) pci_cfg_offset, child_bus << 8); mv64x60_pci_exclude_bridge = save_exclude; } - - return; } /* @@ -1423,8 +1417,6 @@ mv64x60_pd_fixup(struct mv64x60_handle *bh, struct platform_device *pd_devs[], j++; } } - - return; } /* @@ -1498,8 +1490,6 @@ gt64260_set_pci2mem_window(struct pci_controller *hose, u32 bus, u32 window, early_write_config_dword(hose, 0, PCI_DEVFN(0, 0), gt64260_reg_addrs[bus][window], mv64x60_mask(base, 20) | 0x8); mv64x60_pci_exclude_bridge = save_exclude; - - return; } /* @@ -1523,8 +1513,6 @@ gt64260_set_pci2regs_window(struct mv64x60_handle *bh, early_write_config_dword(hose, 0, PCI_DEVFN(0,0), gt64260_offset[bus], (base << 16)); mv64x60_pci_exclude_bridge = save_exclude; - - return; } /* @@ -1561,7 +1549,6 @@ static void __init gt64260_enable_window_32bit(struct mv64x60_handle *bh, u32 window) { pr_debug("enable 32bit window: %d\n", window); - return; } /* @@ -1584,8 +1571,6 @@ gt64260_disable_window_32bit(struct mv64x60_handle *bh, u32 window) mv64x60_write(bh, gt64260_32bit_windows[window].base_reg,0xfff); mv64x60_write(bh, gt64260_32bit_windows[window].size_reg, 0); } - - return; } /* @@ -1599,7 +1584,6 @@ static void __init gt64260_enable_window_64bit(struct mv64x60_handle *bh, u32 window) { pr_debug("enable 64bit window: %d\n", window); - return; /* Enabled when window configured (i.e., when top >= base) */ } /* @@ -1624,8 +1608,6 @@ gt64260_disable_window_64bit(struct mv64x60_handle *bh, u32 window) mv64x60_write(bh, gt64260_64bit_windows[window].base_hi_reg, 0); mv64x60_write(bh, gt64260_64bit_windows[window].size_reg, 0); } - - return; } /* @@ -1712,8 +1694,6 @@ gt64260_disable_all_windows(struct mv64x60_handle *bh, mv64x60_write(bh, GT64260_IC_CPU_INT_1_MASK, 0); mv64x60_write(bh, GT64260_IC_CPU_INT_2_MASK, 0); mv64x60_write(bh, GT64260_IC_CPU_INT_3_MASK, 0); - - return; } /* @@ -1781,14 +1761,11 @@ gt64260a_chip_specific_init(struct mv64x60_handle *bh, mv64x60_mpsc1_pdata.cache_mgmt = 1; if ((r = platform_get_resource(&mpsc1_device, IORESOURCE_IRQ, 0)) - != NULL) { - + != NULL) { r->start = MV64x60_IRQ_SDMA_0; r->end = MV64x60_IRQ_SDMA_0; } #endif - - return; } /* @@ -1861,14 +1838,11 @@ gt64260b_chip_specific_init(struct mv64x60_handle *bh, mv64x60_mpsc1_pdata.cache_mgmt = 1; if ((r = platform_get_resource(&mpsc1_device, IORESOURCE_IRQ, 0)) - != NULL) { - + != NULL) { r->start = MV64x60_IRQ_SDMA_0; r->end = MV64x60_IRQ_SDMA_0; } #endif - - return; } /* @@ -1945,8 +1919,6 @@ mv64360_set_pci2mem_window(struct pci_controller *hose, u32 bus, u32 window, mv64360_reg_addrs[bus][window].base_lo_bar, mv64x60_mask(base,20) | 0xc); mv64x60_pci_exclude_bridge = save_exclude; - - return; } /* @@ -1972,8 +1944,6 @@ mv64360_set_pci2regs_window(struct mv64x60_handle *bh, early_write_config_dword(hose, 0, PCI_DEVFN(0,0), mv64360_offset[bus][1], 0); mv64x60_pci_exclude_bridge = save_exclude; - - return; } /* @@ -2082,8 +2052,6 @@ mv64360_enable_window_32bit(struct mv64x60_handle *bh, u32 window) "32bit table corrupted"); } } - - return; } /* @@ -2139,8 +2107,6 @@ mv64360_disable_window_32bit(struct mv64x60_handle *bh, u32 window) "32bit table corrupted"); } } - - return; } /* @@ -2158,8 +2124,7 @@ mv64360_enable_window_64bit(struct mv64x60_handle *bh, u32 window) (mv64360_64bit_windows[window].size_reg != 0)) { if ((mv64360_64bit_windows[window].extra & MV64x60_EXTRA_MASK) - == MV64x60_EXTRA_PCIACC_ENAB) - + == MV64x60_EXTRA_PCIACC_ENAB) mv64x60_set_bits(bh, mv64360_64bit_windows[window].base_lo_reg, (1 << (mv64360_64bit_windows[window].extra & @@ -2168,8 +2133,6 @@ mv64360_enable_window_64bit(struct mv64x60_handle *bh, u32 window) printk(KERN_ERR "mv64360_enable: %s\n", "64bit table corrupted"); } - - return; } /* @@ -2186,11 +2149,9 @@ mv64360_disable_window_64bit(struct mv64x60_handle *bh, u32 window) mv64360_64bit_windows[window].size_reg); if ((mv64360_64bit_windows[window].base_lo_reg != 0) && - (mv64360_64bit_windows[window].size_reg != 0)) { - + (mv64360_64bit_windows[window].size_reg != 0)) { if ((mv64360_64bit_windows[window].extra & MV64x60_EXTRA_MASK) - == MV64x60_EXTRA_PCIACC_ENAB) - + == MV64x60_EXTRA_PCIACC_ENAB) mv64x60_clr_bits(bh, mv64360_64bit_windows[window].base_lo_reg, (1 << (mv64360_64bit_windows[window].extra & @@ -2199,8 +2160,6 @@ mv64360_disable_window_64bit(struct mv64x60_handle *bh, u32 window) printk(KERN_ERR "mv64360_disable: %s\n", "64bit table corrupted"); } - - return; } /* @@ -2241,8 +2200,6 @@ mv64360_disable_all_windows(struct mv64x60_handle *bh, /* Disable all PCI-> windows */ mv64x60_set_bits(bh, MV64x60_PCI0_BAR_ENABLE, 0x0000f9ff); mv64x60_set_bits(bh, MV64x60_PCI1_BAR_ENABLE, 0x0000f9ff); - - return; } /* @@ -2335,8 +2292,6 @@ mv64360_config_io2mem_windows(struct mv64x60_handle *bh, mv64x60_set_bits(bh, MV64360_IDMA2MEM_ACC_PROT_3, (0x3 << (i << 1))); } - - return; } /* @@ -2350,42 +2305,145 @@ static void __init mv64360_set_mpsc2regs_window(struct mv64x60_handle *bh, u32 base) { pr_debug("set mpsc->internal regs, base: 0x%x\n", base); - mv64x60_write(bh, MV64360_MPSC2REGS_BASE, base & 0xffff0000); - return; } /* * mv64360_chip_specific_init() * - * No errata work arounds for the MV64360 implemented at this point. + * Implement errata work arounds for the MV64360. */ static void __init mv64360_chip_specific_init(struct mv64x60_handle *bh, struct mv64x60_setup_info *si) { +#if !defined(CONFIG_NOT_COHERENT_CACHE) + mv64x60_set_bits(bh, MV64360_D_UNIT_CONTROL_HIGH, (1<<24)); +#endif #ifdef CONFIG_SERIAL_MPSC mv64x60_mpsc0_pdata.brg_can_tune = 1; mv64x60_mpsc0_pdata.cache_mgmt = 1; mv64x60_mpsc1_pdata.brg_can_tune = 1; mv64x60_mpsc1_pdata.cache_mgmt = 1; #endif - - return; } /* * mv64460_chip_specific_init() * - * No errata work arounds for the MV64460 implemented at this point. + * Implement errata work arounds for the MV64460. */ static void __init mv64460_chip_specific_init(struct mv64x60_handle *bh, struct mv64x60_setup_info *si) { +#if !defined(CONFIG_NOT_COHERENT_CACHE) + mv64x60_set_bits(bh, MV64360_D_UNIT_CONTROL_HIGH, (1<<24) | (1<<25)); + mv64x60_set_bits(bh, MV64460_D_UNIT_MMASK, (1<<1) | (1<<4)); +#endif #ifdef CONFIG_SERIAL_MPSC mv64x60_mpsc0_pdata.brg_can_tune = 1; + mv64x60_mpsc0_pdata.cache_mgmt = 1; mv64x60_mpsc1_pdata.brg_can_tune = 1; + mv64x60_mpsc1_pdata.cache_mgmt = 1; #endif - return; } + + +#if defined(CONFIG_SYSFS) && !defined(CONFIG_GT64260) +/* Export the hotswap register via sysfs for enum event monitoring */ +#define VAL_LEN_MAX 11 /* 32-bit hex or dec stringified number + '\n' */ + +DECLARE_MUTEX(mv64xxx_hs_lock); + +static ssize_t +mv64xxx_hs_reg_read(struct kobject *kobj, char *buf, loff_t off, size_t count) +{ + u32 v; + u8 save_exclude; + + if (off > 0) + return 0; + if (count < VAL_LEN_MAX) + return -EINVAL; + + if (down_interruptible(&mv64xxx_hs_lock)) + return -ERESTARTSYS; + save_exclude = mv64x60_pci_exclude_bridge; + mv64x60_pci_exclude_bridge = 0; + early_read_config_dword(&sysfs_hose_a, 0, PCI_DEVFN(0, 0), + MV64360_PCICFG_CPCI_HOTSWAP, &v); + mv64x60_pci_exclude_bridge = save_exclude; + up(&mv64xxx_hs_lock); + + return sprintf(buf, "0x%08x\n", v); +} + +static ssize_t +mv64xxx_hs_reg_write(struct kobject *kobj, char *buf, loff_t off, size_t count) +{ + u32 v; + u8 save_exclude; + + if (off > 0) + return 0; + if (count <= 0) + return -EINVAL; + + if (sscanf(buf, "%i", &v) == 1) { + if (down_interruptible(&mv64xxx_hs_lock)) + return -ERESTARTSYS; + save_exclude = mv64x60_pci_exclude_bridge; + mv64x60_pci_exclude_bridge = 0; + early_write_config_dword(&sysfs_hose_a, 0, PCI_DEVFN(0, 0), + MV64360_PCICFG_CPCI_HOTSWAP, v); + mv64x60_pci_exclude_bridge = save_exclude; + up(&mv64xxx_hs_lock); + } + else + count = -EINVAL; + + return count; +} + +static struct bin_attribute mv64xxx_hs_reg_attr = { /* Hotswap register */ + .attr = { + .name = "hs_reg", + .mode = S_IRUGO | S_IWUSR, + .owner = THIS_MODULE, + }, + .size = VAL_LEN_MAX, + .read = mv64xxx_hs_reg_read, + .write = mv64xxx_hs_reg_write, +}; + +/* Provide sysfs file indicating if this platform supports the hs_reg */ +static ssize_t +mv64xxx_hs_reg_valid_show(struct device *dev, struct device_attribute *attr, + char *buf) +{ + struct platform_device *pdev; + struct mv64xxx_pdata *pdp; + u32 v; + + pdev = container_of(dev, struct platform_device, dev); + pdp = (struct mv64xxx_pdata *)pdev->dev.platform_data; + + if (down_interruptible(&mv64xxx_hs_lock)) + return -ERESTARTSYS; + v = pdp->hs_reg_valid; + up(&mv64xxx_hs_lock); + + return sprintf(buf, "%i\n", v); +} +static DEVICE_ATTR(hs_reg_valid, S_IRUGO, mv64xxx_hs_reg_valid_show, NULL); + +static int __init +mv64xxx_sysfs_init(void) +{ + sysfs_create_bin_file(&mv64xxx_device.dev.kobj, &mv64xxx_hs_reg_attr); + sysfs_create_file(&mv64xxx_device.dev.kobj,&dev_attr_hs_reg_valid.attr); + return 0; +} +subsys_initcall(mv64xxx_sysfs_init); +#endif diff --git a/include/asm-ppc/mv64x60.h b/include/asm-ppc/mv64x60.h index cc25b921ad4..835930d6faa 100644 --- a/include/asm-ppc/mv64x60.h +++ b/include/asm-ppc/mv64x60.h @@ -278,6 +278,13 @@ mv64x60_modify(struct mv64x60_handle *bh, u32 offs, u32 data, u32 mask) #define mv64x60_set_bits(bh, offs, bits) mv64x60_modify(bh, offs, ~0, bits) #define mv64x60_clr_bits(bh, offs, bits) mv64x60_modify(bh, offs, 0, bits) +#if defined(CONFIG_SYSFS) && !defined(CONFIG_GT64260) +#define MV64XXX_DEV_NAME "mv64xxx" + +struct mv64xxx_pdata { + u32 hs_reg_valid; +}; +#endif /* Externally visible function prototypes */ int mv64x60_init(struct mv64x60_handle *bh, struct mv64x60_setup_info *si); diff --git a/include/asm-ppc/mv64x60_defs.h b/include/asm-ppc/mv64x60_defs.h index 2f428746c02..f8f7f16b9b5 100644 --- a/include/asm-ppc/mv64x60_defs.h +++ b/include/asm-ppc/mv64x60_defs.h @@ -333,7 +333,7 @@ /* ***************************************************************************** * - * SRAM Cotnroller Registers + * SRAM Controller Registers * ***************************************************************************** */ @@ -352,7 +352,7 @@ /* ***************************************************************************** * - * SDRAM/MEM Cotnroller Registers + * SDRAM/MEM Controller Registers * ***************************************************************************** */ @@ -375,6 +375,7 @@ /* SDRAM Control Registers */ #define MV64360_D_UNIT_CONTROL_LOW 0x1404 #define MV64360_D_UNIT_CONTROL_HIGH 0x1424 +#define MV64460_D_UNIT_MMASK 0x14b0 /* SDRAM Error Report Registers (64360) */ #define MV64360_SDRAM_ERR_DATA_LO 0x1444 @@ -388,7 +389,7 @@ /* ***************************************************************************** * - * Device/BOOT Cotnroller Registers + * Device/BOOT Controller Registers * ***************************************************************************** */ @@ -680,6 +681,8 @@ #define MV64x60_PCI1_SLAVE_P2P_IO_REMAP 0x0dec #define MV64x60_PCI1_SLAVE_CPU_REMAP 0x0df0 +#define MV64360_PCICFG_CPCI_HOTSWAP 0x68 + /* ***************************************************************************** * diff --git a/include/linux/mv643xx.h b/include/linux/mv643xx.h index 5773ea42f6e..0b08cd69220 100644 --- a/include/linux/mv643xx.h +++ b/include/linux/mv643xx.h @@ -980,7 +980,7 @@ /* I2C Registers */ /****************************************/ -#define MV64XXX_I2C_CTLR_NAME "mv64xxx i2c" +#define MV64XXX_I2C_CTLR_NAME "mv64xxx_i2c" #define MV64XXX_I2C_OFFSET 0xc000 #define MV64XXX_I2C_REG_BLOCK_SIZE 0x0020 -- cgit v1.2.3-70-g09d2 From 233ccd0d0452682edb51725410e0f8c0384e8b34 Mon Sep 17 00:00:00 2001 From: Olof Johansson Date: Sat, 3 Sep 2005 15:55:59 -0700 Subject: [PATCH] ppc64: Add VMX save flag to VPA We need to indicate to the hypervisor that it needs to save our VMX registers when switching partitions on a shared-processor system, just as it needs to for FP and PMC registers. This could be made to be on-demand when VMX is used, but we don't do that for FP nor PMC right now either so let's not overcomplicate things. Signed-off-by: Olof Johansson Acked-by: Paul Mackerras Cc: Anton Blanchard Cc: Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- arch/ppc64/kernel/pSeries_lpar.c | 4 ++++ arch/ppc64/kernel/pacaData.c | 1 + include/asm-ppc64/lppaca.h | 2 +- 3 files changed, 6 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/arch/ppc64/kernel/pSeries_lpar.c b/arch/ppc64/kernel/pSeries_lpar.c index 0a3ddc9227c..a1d5fdfea4a 100644 --- a/arch/ppc64/kernel/pSeries_lpar.c +++ b/arch/ppc64/kernel/pSeries_lpar.c @@ -266,6 +266,10 @@ void vpa_init(int cpu) /* Register the Virtual Processor Area (VPA) */ flags = 1UL << (63 - 18); + + if (cpu_has_feature(CPU_FTR_ALTIVEC)) + paca[cpu].lppaca.vmxregs_in_use = 1; + ret = register_vpa(flags, hwcpu, __pa(vpa)); if (ret) diff --git a/arch/ppc64/kernel/pacaData.c b/arch/ppc64/kernel/pacaData.c index 6182a2cd90a..33a2d8db3f2 100644 --- a/arch/ppc64/kernel/pacaData.c +++ b/arch/ppc64/kernel/pacaData.c @@ -59,6 +59,7 @@ extern unsigned long __toc_start; .fpregs_in_use = 1, \ .end_of_quantum = 0xfffffffffffffffful, \ .slb_count = 64, \ + .vmxregs_in_use = 0, \ }, \ #ifdef CONFIG_PPC_ISERIES diff --git a/include/asm-ppc64/lppaca.h b/include/asm-ppc64/lppaca.h index 70766b5f26c..9e2a6c0649a 100644 --- a/include/asm-ppc64/lppaca.h +++ b/include/asm-ppc64/lppaca.h @@ -108,7 +108,7 @@ struct lppaca volatile u32 virtual_decr; // Virtual DECR for shared procsx78-x7B u16 slb_count; // # of SLBs to maintain x7C-x7D u8 idle; // Indicate OS is idle x7E - u8 reserved5; // Reserved x7F + u8 vmxregs_in_use; // VMX registers in use x7F //============================================================================= -- cgit v1.2.3-70-g09d2 From 979934da9e7a0005bd9c8b1d7d00febb59ff67f7 Mon Sep 17 00:00:00 2001 From: Yoichi Yuasa Date: Sat, 3 Sep 2005 15:56:04 -0700 Subject: [PATCH] mips: update IRQ handling for vr41xx This patch has updated IRQ handling for vr41xx. o added common IRQ dispatch o changed IRQ number in int-handler.S o added resource management to icu.c Signed-off-by: Yoichi Yuasa Cc: Ralf Baechle Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- arch/mips/vr41xx/common/Makefile | 2 +- arch/mips/vr41xx/common/icu.c | 270 ++++++++++++++++------------------ arch/mips/vr41xx/common/int-handler.S | 10 +- arch/mips/vr41xx/common/irq.c | 94 ++++++++++++ include/asm-mips/vr41xx/vr41xx.h | 16 +- 5 files changed, 234 insertions(+), 158 deletions(-) create mode 100644 arch/mips/vr41xx/common/irq.c (limited to 'include') diff --git a/arch/mips/vr41xx/common/Makefile b/arch/mips/vr41xx/common/Makefile index fa98ef3855b..e5039031b69 100644 --- a/arch/mips/vr41xx/common/Makefile +++ b/arch/mips/vr41xx/common/Makefile @@ -2,7 +2,7 @@ # Makefile for common code of the NEC VR4100 series. # -obj-y += bcu.o cmu.o icu.o init.o int-handler.o pmu.o +obj-y += bcu.o cmu.o icu.o init.o int-handler.o irq.o pmu.o obj-$(CONFIG_VRC4173) += vrc4173.o EXTRA_AFLAGS := $(CFLAGS) diff --git a/arch/mips/vr41xx/common/icu.c b/arch/mips/vr41xx/common/icu.c index c842661144c..0b73c5ab3c0 100644 --- a/arch/mips/vr41xx/common/icu.c +++ b/arch/mips/vr41xx/common/icu.c @@ -3,8 +3,7 @@ * * Copyright (C) 2001-2002 MontaVista Software Inc. * Author: Yoichi Yuasa - * Copyright (C) 2003-2004 Yoichi Yuasa - * Copyright (C) 2005 Ralf Baechle (ralf@linux-mips.org) + * Copyright (C) 2003-2005 Yoichi Yuasa * * 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 @@ -31,7 +30,7 @@ */ #include #include -#include +#include #include #include #include @@ -39,34 +38,24 @@ #include #include -#include -#include #include -extern asmlinkage void vr41xx_handle_interrupt(void); - -extern void init_vr41xx_giuint_irq(void); -extern void giuint_irq_dispatch(struct pt_regs *regs); - -static uint32_t icu1_base; -static uint32_t icu2_base; - -static struct irqaction icu_cascade = { - .handler = no_action, - .mask = CPU_MASK_NONE, - .name = "cascade", -}; +static void __iomem *icu1_base; +static void __iomem *icu2_base; static unsigned char sysint1_assign[16] = { 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; static unsigned char sysint2_assign[16] = { - 2, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -#define SYSINT1REG_TYPE1 KSEG1ADDR(0x0b000080) -#define SYSINT2REG_TYPE1 KSEG1ADDR(0x0b000200) +#define ICU1_TYPE1_BASE 0x0b000080UL +#define ICU2_TYPE1_BASE 0x0b000200UL -#define SYSINT1REG_TYPE2 KSEG1ADDR(0x0f000080) -#define SYSINT2REG_TYPE2 KSEG1ADDR(0x0f0000a0) +#define ICU1_TYPE2_BASE 0x0f000080UL +#define ICU2_TYPE2_BASE 0x0f0000a0UL + +#define ICU1_SIZE 0x20 +#define ICU2_SIZE 0x1c #define SYSINT1REG 0x00 #define PIUINTREG 0x02 @@ -106,61 +95,61 @@ static unsigned char sysint2_assign[16] = { #define SYSINT1_IRQ_TO_PIN(x) ((x) - SYSINT1_IRQ_BASE) /* Pin 0-15 */ #define SYSINT2_IRQ_TO_PIN(x) ((x) - SYSINT2_IRQ_BASE) /* Pin 0-15 */ -#define read_icu1(offset) readw(icu1_base + (offset)) -#define write_icu1(val, offset) writew((val), icu1_base + (offset)) +#define INT_TO_IRQ(x) ((x) + 2) /* Int0-4 -> IRQ2-6 */ + +#define icu1_read(offset) readw(icu1_base + (offset)) +#define icu1_write(offset, value) writew((value), icu1_base + (offset)) -#define read_icu2(offset) readw(icu2_base + (offset)) -#define write_icu2(val, offset) writew((val), icu2_base + (offset)) +#define icu2_read(offset) readw(icu2_base + (offset)) +#define icu2_write(offset, value) writew((value), icu2_base + (offset)) #define INTASSIGN_MAX 4 #define INTASSIGN_MASK 0x0007 -static inline uint16_t set_icu1(uint8_t offset, uint16_t set) +static inline uint16_t icu1_set(uint8_t offset, uint16_t set) { - uint16_t res; + uint16_t data; - res = read_icu1(offset); - res |= set; - write_icu1(res, offset); + data = icu1_read(offset); + data |= set; + icu1_write(offset, data); - return res; + return data; } -static inline uint16_t clear_icu1(uint8_t offset, uint16_t clear) +static inline uint16_t icu1_clear(uint8_t offset, uint16_t clear) { - uint16_t res; + uint16_t data; - res = read_icu1(offset); - res &= ~clear; - write_icu1(res, offset); + data = icu1_read(offset); + data &= ~clear; + icu1_write(offset, data); - return res; + return data; } -static inline uint16_t set_icu2(uint8_t offset, uint16_t set) +static inline uint16_t icu2_set(uint8_t offset, uint16_t set) { - uint16_t res; + uint16_t data; - res = read_icu2(offset); - res |= set; - write_icu2(res, offset); + data = icu2_read(offset); + data |= set; + icu2_write(offset, data); - return res; + return data; } -static inline uint16_t clear_icu2(uint8_t offset, uint16_t clear) +static inline uint16_t icu2_clear(uint8_t offset, uint16_t clear) { - uint16_t res; + uint16_t data; - res = read_icu2(offset); - res &= ~clear; - write_icu2(res, offset); + data = icu2_read(offset); + data &= ~clear; + icu2_write(offset, data); - return res; + return data; } -/*=======================================================================*/ - void vr41xx_enable_piuint(uint16_t mask) { irq_desc_t *desc = irq_desc + PIU_IRQ; @@ -169,7 +158,7 @@ void vr41xx_enable_piuint(uint16_t mask) if (current_cpu_data.cputype == CPU_VR4111 || current_cpu_data.cputype == CPU_VR4121) { spin_lock_irqsave(&desc->lock, flags); - set_icu1(MPIUINTREG, mask); + icu1_set(MPIUINTREG, mask); spin_unlock_irqrestore(&desc->lock, flags); } } @@ -184,7 +173,7 @@ void vr41xx_disable_piuint(uint16_t mask) if (current_cpu_data.cputype == CPU_VR4111 || current_cpu_data.cputype == CPU_VR4121) { spin_lock_irqsave(&desc->lock, flags); - clear_icu1(MPIUINTREG, mask); + icu1_clear(MPIUINTREG, mask); spin_unlock_irqrestore(&desc->lock, flags); } } @@ -199,7 +188,7 @@ void vr41xx_enable_aiuint(uint16_t mask) if (current_cpu_data.cputype == CPU_VR4111 || current_cpu_data.cputype == CPU_VR4121) { spin_lock_irqsave(&desc->lock, flags); - set_icu1(MAIUINTREG, mask); + icu1_set(MAIUINTREG, mask); spin_unlock_irqrestore(&desc->lock, flags); } } @@ -214,7 +203,7 @@ void vr41xx_disable_aiuint(uint16_t mask) if (current_cpu_data.cputype == CPU_VR4111 || current_cpu_data.cputype == CPU_VR4121) { spin_lock_irqsave(&desc->lock, flags); - clear_icu1(MAIUINTREG, mask); + icu1_clear(MAIUINTREG, mask); spin_unlock_irqrestore(&desc->lock, flags); } } @@ -229,7 +218,7 @@ void vr41xx_enable_kiuint(uint16_t mask) if (current_cpu_data.cputype == CPU_VR4111 || current_cpu_data.cputype == CPU_VR4121) { spin_lock_irqsave(&desc->lock, flags); - set_icu1(MKIUINTREG, mask); + icu1_set(MKIUINTREG, mask); spin_unlock_irqrestore(&desc->lock, flags); } } @@ -244,7 +233,7 @@ void vr41xx_disable_kiuint(uint16_t mask) if (current_cpu_data.cputype == CPU_VR4111 || current_cpu_data.cputype == CPU_VR4121) { spin_lock_irqsave(&desc->lock, flags); - clear_icu1(MKIUINTREG, mask); + icu1_clear(MKIUINTREG, mask); spin_unlock_irqrestore(&desc->lock, flags); } } @@ -257,7 +246,7 @@ void vr41xx_enable_dsiuint(uint16_t mask) unsigned long flags; spin_lock_irqsave(&desc->lock, flags); - set_icu1(MDSIUINTREG, mask); + icu1_set(MDSIUINTREG, mask); spin_unlock_irqrestore(&desc->lock, flags); } @@ -269,7 +258,7 @@ void vr41xx_disable_dsiuint(uint16_t mask) unsigned long flags; spin_lock_irqsave(&desc->lock, flags); - clear_icu1(MDSIUINTREG, mask); + icu1_clear(MDSIUINTREG, mask); spin_unlock_irqrestore(&desc->lock, flags); } @@ -281,7 +270,7 @@ void vr41xx_enable_firint(uint16_t mask) unsigned long flags; spin_lock_irqsave(&desc->lock, flags); - set_icu2(MFIRINTREG, mask); + icu2_set(MFIRINTREG, mask); spin_unlock_irqrestore(&desc->lock, flags); } @@ -293,7 +282,7 @@ void vr41xx_disable_firint(uint16_t mask) unsigned long flags; spin_lock_irqsave(&desc->lock, flags); - clear_icu2(MFIRINTREG, mask); + icu2_clear(MFIRINTREG, mask); spin_unlock_irqrestore(&desc->lock, flags); } @@ -308,7 +297,7 @@ void vr41xx_enable_pciint(void) current_cpu_data.cputype == CPU_VR4131 || current_cpu_data.cputype == CPU_VR4133) { spin_lock_irqsave(&desc->lock, flags); - write_icu2(PCIINT0, MPCIINTREG); + icu2_write(MPCIINTREG, PCIINT0); spin_unlock_irqrestore(&desc->lock, flags); } } @@ -324,7 +313,7 @@ void vr41xx_disable_pciint(void) current_cpu_data.cputype == CPU_VR4131 || current_cpu_data.cputype == CPU_VR4133) { spin_lock_irqsave(&desc->lock, flags); - write_icu2(0, MPCIINTREG); + icu2_write(MPCIINTREG, 0); spin_unlock_irqrestore(&desc->lock, flags); } } @@ -340,7 +329,7 @@ void vr41xx_enable_scuint(void) current_cpu_data.cputype == CPU_VR4131 || current_cpu_data.cputype == CPU_VR4133) { spin_lock_irqsave(&desc->lock, flags); - write_icu2(SCUINT0, MSCUINTREG); + icu2_write(MSCUINTREG, SCUINT0); spin_unlock_irqrestore(&desc->lock, flags); } } @@ -356,7 +345,7 @@ void vr41xx_disable_scuint(void) current_cpu_data.cputype == CPU_VR4131 || current_cpu_data.cputype == CPU_VR4133) { spin_lock_irqsave(&desc->lock, flags); - write_icu2(0, MSCUINTREG); + icu2_write(MSCUINTREG, 0); spin_unlock_irqrestore(&desc->lock, flags); } } @@ -372,7 +361,7 @@ void vr41xx_enable_csiint(uint16_t mask) current_cpu_data.cputype == CPU_VR4131 || current_cpu_data.cputype == CPU_VR4133) { spin_lock_irqsave(&desc->lock, flags); - set_icu2(MCSIINTREG, mask); + icu2_set(MCSIINTREG, mask); spin_unlock_irqrestore(&desc->lock, flags); } } @@ -388,7 +377,7 @@ void vr41xx_disable_csiint(uint16_t mask) current_cpu_data.cputype == CPU_VR4131 || current_cpu_data.cputype == CPU_VR4133) { spin_lock_irqsave(&desc->lock, flags); - clear_icu2(MCSIINTREG, mask); + icu2_clear(MCSIINTREG, mask); spin_unlock_irqrestore(&desc->lock, flags); } } @@ -404,7 +393,7 @@ void vr41xx_enable_bcuint(void) current_cpu_data.cputype == CPU_VR4131 || current_cpu_data.cputype == CPU_VR4133) { spin_lock_irqsave(&desc->lock, flags); - write_icu2(BCUINTR, MBCUINTREG); + icu2_write(MBCUINTREG, BCUINTR); spin_unlock_irqrestore(&desc->lock, flags); } } @@ -420,30 +409,28 @@ void vr41xx_disable_bcuint(void) current_cpu_data.cputype == CPU_VR4131 || current_cpu_data.cputype == CPU_VR4133) { spin_lock_irqsave(&desc->lock, flags); - write_icu2(0, MBCUINTREG); + icu2_write(MBCUINTREG, 0); spin_unlock_irqrestore(&desc->lock, flags); } } EXPORT_SYMBOL(vr41xx_disable_bcuint); -/*=======================================================================*/ - static unsigned int startup_sysint1_irq(unsigned int irq) { - set_icu1(MSYSINT1REG, (uint16_t)1 << SYSINT1_IRQ_TO_PIN(irq)); + icu1_set(MSYSINT1REG, 1 << SYSINT1_IRQ_TO_PIN(irq)); return 0; /* never anything pending */ } static void shutdown_sysint1_irq(unsigned int irq) { - clear_icu1(MSYSINT1REG, (uint16_t)1 << SYSINT1_IRQ_TO_PIN(irq)); + icu1_clear(MSYSINT1REG, 1 << SYSINT1_IRQ_TO_PIN(irq)); } static void enable_sysint1_irq(unsigned int irq) { - set_icu1(MSYSINT1REG, (uint16_t)1 << SYSINT1_IRQ_TO_PIN(irq)); + icu1_set(MSYSINT1REG, 1 << SYSINT1_IRQ_TO_PIN(irq)); } #define disable_sysint1_irq shutdown_sysint1_irq @@ -452,7 +439,7 @@ static void enable_sysint1_irq(unsigned int irq) static void end_sysint1_irq(unsigned int irq) { if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS))) - set_icu1(MSYSINT1REG, (uint16_t)1 << SYSINT1_IRQ_TO_PIN(irq)); + icu1_set(MSYSINT1REG, 1 << SYSINT1_IRQ_TO_PIN(irq)); } static struct hw_interrupt_type sysint1_irq_type = { @@ -465,23 +452,21 @@ static struct hw_interrupt_type sysint1_irq_type = { .end = end_sysint1_irq, }; -/*=======================================================================*/ - static unsigned int startup_sysint2_irq(unsigned int irq) { - set_icu2(MSYSINT2REG, (uint16_t)1 << SYSINT2_IRQ_TO_PIN(irq)); + icu2_set(MSYSINT2REG, 1 << SYSINT2_IRQ_TO_PIN(irq)); return 0; /* never anything pending */ } static void shutdown_sysint2_irq(unsigned int irq) { - clear_icu2(MSYSINT2REG, (uint16_t)1 << SYSINT2_IRQ_TO_PIN(irq)); + icu2_clear(MSYSINT2REG, 1 << SYSINT2_IRQ_TO_PIN(irq)); } static void enable_sysint2_irq(unsigned int irq) { - set_icu2(MSYSINT2REG, (uint16_t)1 << SYSINT2_IRQ_TO_PIN(irq)); + icu2_set(MSYSINT2REG, 1 << SYSINT2_IRQ_TO_PIN(irq)); } #define disable_sysint2_irq shutdown_sysint2_irq @@ -490,7 +475,7 @@ static void enable_sysint2_irq(unsigned int irq) static void end_sysint2_irq(unsigned int irq) { if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS))) - set_icu2(MSYSINT2REG, (uint16_t)1 << SYSINT2_IRQ_TO_PIN(irq)); + icu2_set(MSYSINT2REG, 1 << SYSINT2_IRQ_TO_PIN(irq)); } static struct hw_interrupt_type sysint2_irq_type = { @@ -503,8 +488,6 @@ static struct hw_interrupt_type sysint2_irq_type = { .end = end_sysint2_irq, }; -/*=======================================================================*/ - static inline int set_sysint1_assign(unsigned int irq, unsigned char assign) { irq_desc_t *desc = irq_desc + irq; @@ -515,8 +498,8 @@ static inline int set_sysint1_assign(unsigned int irq, unsigned char assign) spin_lock_irq(&desc->lock); - intassign0 = read_icu1(INTASSIGN0); - intassign1 = read_icu1(INTASSIGN1); + intassign0 = icu1_read(INTASSIGN0); + intassign1 = icu1_read(INTASSIGN1); switch (pin) { case 0: @@ -556,8 +539,8 @@ static inline int set_sysint1_assign(unsigned int irq, unsigned char assign) } sysint1_assign[pin] = assign; - write_icu1(intassign0, INTASSIGN0); - write_icu1(intassign1, INTASSIGN1); + icu1_write(INTASSIGN0, intassign0); + icu1_write(INTASSIGN1, intassign1); spin_unlock_irq(&desc->lock); @@ -574,8 +557,8 @@ static inline int set_sysint2_assign(unsigned int irq, unsigned char assign) spin_lock_irq(&desc->lock); - intassign2 = read_icu1(INTASSIGN2); - intassign3 = read_icu1(INTASSIGN3); + intassign2 = icu1_read(INTASSIGN2); + intassign3 = icu1_read(INTASSIGN3); switch (pin) { case 0: @@ -623,8 +606,8 @@ static inline int set_sysint2_assign(unsigned int irq, unsigned char assign) } sysint2_assign[pin] = assign; - write_icu1(intassign2, INTASSIGN2); - write_icu1(intassign3, INTASSIGN3); + icu1_write(INTASSIGN2, intassign2); + icu1_write(INTASSIGN3, intassign3); spin_unlock_irq(&desc->lock); @@ -651,88 +634,92 @@ int vr41xx_set_intassign(unsigned int irq, unsigned char intassign) EXPORT_SYMBOL(vr41xx_set_intassign); -/*=======================================================================*/ - -asmlinkage void irq_dispatch(unsigned char intnum, struct pt_regs *regs) +static int icu_get_irq(unsigned int irq, struct pt_regs *regs) { uint16_t pend1, pend2; uint16_t mask1, mask2; int i; - pend1 = read_icu1(SYSINT1REG); - mask1 = read_icu1(MSYSINT1REG); + pend1 = icu1_read(SYSINT1REG); + mask1 = icu1_read(MSYSINT1REG); - pend2 = read_icu2(SYSINT2REG); - mask2 = read_icu2(MSYSINT2REG); + pend2 = icu2_read(SYSINT2REG); + mask2 = icu2_read(MSYSINT2REG); mask1 &= pend1; mask2 &= pend2; if (mask1) { for (i = 0; i < 16; i++) { - if (intnum == sysint1_assign[i] && - (mask1 & ((uint16_t)1 << i))) { - if (i == 8) - giuint_irq_dispatch(regs); - else - do_IRQ(SYSINT1_IRQ(i), regs); - return; - } + if (irq == INT_TO_IRQ(sysint1_assign[i]) && (mask1 & (1 << i))) + return SYSINT1_IRQ(i); } } if (mask2) { for (i = 0; i < 16; i++) { - if (intnum == sysint2_assign[i] && - (mask2 & ((uint16_t)1 << i))) { - do_IRQ(SYSINT2_IRQ(i), regs); - return; - } + if (irq == INT_TO_IRQ(sysint2_assign[i]) && (mask2 & (1 << i))) + return SYSINT2_IRQ(i); } } printk(KERN_ERR "spurious ICU interrupt: %04x,%04x\n", pend1, pend2); atomic_inc(&irq_err_count); -} -/*=======================================================================*/ + return -1; +} static int __init vr41xx_icu_init(void) { + unsigned long icu1_start, icu2_start; + int i; + switch (current_cpu_data.cputype) { case CPU_VR4111: case CPU_VR4121: - icu1_base = SYSINT1REG_TYPE1; - icu2_base = SYSINT2REG_TYPE1; + icu1_start = ICU1_TYPE1_BASE; + icu2_start = ICU2_TYPE1_BASE; break; case CPU_VR4122: case CPU_VR4131: case CPU_VR4133: - icu1_base = SYSINT1REG_TYPE2; - icu2_base = SYSINT2REG_TYPE2; + icu1_start = ICU1_TYPE2_BASE; + icu2_start = ICU2_TYPE2_BASE; break; default: printk(KERN_ERR "ICU: Unexpected CPU of NEC VR4100 series\n"); - return -EINVAL; + return -ENODEV; } - write_icu1(0, MSYSINT1REG); - write_icu1(0xffff, MGIUINTLREG); + if (request_mem_region(icu1_start, ICU1_SIZE, "ICU") == NULL) + return -EBUSY; - write_icu2(0, MSYSINT2REG); - write_icu2(0xffff, MGIUINTHREG); + if (request_mem_region(icu2_start, ICU2_SIZE, "ICU") == NULL) { + release_mem_region(icu1_start, ICU1_SIZE); + return -EBUSY; + } - return 0; -} + icu1_base = ioremap(icu1_start, ICU1_SIZE); + if (icu1_base == NULL) { + release_mem_region(icu1_start, ICU1_SIZE); + release_mem_region(icu2_start, ICU2_SIZE); + return -ENOMEM; + } -early_initcall(vr41xx_icu_init); + icu2_base = ioremap(icu2_start, ICU2_SIZE); + if (icu2_base == NULL) { + iounmap(icu1_base); + release_mem_region(icu1_start, ICU1_SIZE); + release_mem_region(icu2_start, ICU2_SIZE); + return -ENOMEM; + } -/*=======================================================================*/ + icu1_write(MSYSINT1REG, 0); + icu1_write(MGIUINTLREG, 0xffff); -static inline void init_vr41xx_icu_irq(void) -{ - int i; + icu2_write(MSYSINT2REG, 0); + icu2_write(MGIUINTHREG, 0xffff); for (i = SYSINT1_IRQ_BASE; i <= SYSINT1_IRQ_LAST; i++) irq_desc[i].handler = &sysint1_irq_type; @@ -740,18 +727,13 @@ static inline void init_vr41xx_icu_irq(void) for (i = SYSINT2_IRQ_BASE; i <= SYSINT2_IRQ_LAST; i++) irq_desc[i].handler = &sysint2_irq_type; - setup_irq(INT0_CASCADE_IRQ, &icu_cascade); - setup_irq(INT1_CASCADE_IRQ, &icu_cascade); - setup_irq(INT2_CASCADE_IRQ, &icu_cascade); - setup_irq(INT3_CASCADE_IRQ, &icu_cascade); - setup_irq(INT4_CASCADE_IRQ, &icu_cascade); -} + cascade_irq(INT0_IRQ, icu_get_irq); + cascade_irq(INT1_IRQ, icu_get_irq); + cascade_irq(INT2_IRQ, icu_get_irq); + cascade_irq(INT3_IRQ, icu_get_irq); + cascade_irq(INT4_IRQ, icu_get_irq); -void __init arch_init_irq(void) -{ - mips_cpu_irq_init(MIPS_CPU_IRQ_BASE); - init_vr41xx_icu_irq(); - init_vr41xx_giuint_irq(); - - set_except_vector(0, vr41xx_handle_interrupt); + return 0; } + +core_initcall(vr41xx_icu_init); diff --git a/arch/mips/vr41xx/common/int-handler.S b/arch/mips/vr41xx/common/int-handler.S index 38ff89b505f..272c13aee4f 100644 --- a/arch/mips/vr41xx/common/int-handler.S +++ b/arch/mips/vr41xx/common/int-handler.S @@ -71,24 +71,24 @@ andi t1, t0, CAUSEF_IP3 # check for Int1 bnez t1, handle_int - li a0, 1 + li a0, 3 andi t1, t0, CAUSEF_IP4 # check for Int2 bnez t1, handle_int - li a0, 2 + li a0, 4 andi t1, t0, CAUSEF_IP5 # check for Int3 bnez t1, handle_int - li a0, 3 + li a0, 5 andi t1, t0, CAUSEF_IP6 # check for Int4 bnez t1, handle_int - li a0, 4 + li a0, 6 1: andi t1, t0, CAUSEF_IP2 # check for Int0 bnez t1, handle_int - li a0, 0 + li a0, 2 andi t1, t0, CAUSEF_IP0 # check for IP0 bnez t1, handle_irq diff --git a/arch/mips/vr41xx/common/irq.c b/arch/mips/vr41xx/common/irq.c new file mode 100644 index 00000000000..43b214d3943 --- /dev/null +++ b/arch/mips/vr41xx/common/irq.c @@ -0,0 +1,94 @@ +/* + * Interrupt handing routines for NEC VR4100 series. + * + * Copyright (C) 2005 Yoichi Yuasa + * + * 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 +#include + +#include +#include +#include + +typedef struct irq_cascade { + int (*get_irq)(unsigned int, struct pt_regs *); +} irq_cascade_t; + +static irq_cascade_t irq_cascade[NR_IRQS] __cacheline_aligned; + +static struct irqaction cascade_irqaction = { + .handler = no_action, + .mask = CPU_MASK_NONE, + .name = "cascade", +}; + +int cascade_irq(unsigned int irq, int (*get_irq)(unsigned int, struct pt_regs *)) +{ + int retval = 0; + + if (irq >= NR_IRQS) + return -EINVAL; + + if (irq_cascade[irq].get_irq != NULL) + free_irq(irq, NULL); + + irq_cascade[irq].get_irq = get_irq; + + if (get_irq != NULL) { + retval = setup_irq(irq, &cascade_irqaction); + if (retval < 0) + irq_cascade[irq].get_irq = NULL; + } + + return retval; +} + +EXPORT_SYMBOL_GPL(cascade_irq); + +asmlinkage void irq_dispatch(unsigned int irq, struct pt_regs *regs) +{ + irq_cascade_t *cascade; + irq_desc_t *desc; + + if (irq >= NR_IRQS) { + atomic_inc(&irq_err_count); + return; + } + + cascade = irq_cascade + irq; + if (cascade->get_irq != NULL) { + unsigned int source_irq = irq; + desc = irq_desc + source_irq; + desc->handler->ack(source_irq); + irq = cascade->get_irq(irq, regs); + if (irq < 0) + atomic_inc(&irq_err_count); + else + irq_dispatch(irq, regs); + desc->handler->end(source_irq); + } else + do_IRQ(irq, regs); +} + +extern asmlinkage void vr41xx_handle_interrupt(void); + +void __init arch_init_irq(void) +{ + mips_cpu_irq_init(MIPS_CPU_IRQ_BASE); + + set_except_vector(0, vr41xx_handle_interrupt); +} diff --git a/include/asm-mips/vr41xx/vr41xx.h b/include/asm-mips/vr41xx/vr41xx.h index 7d41e44463f..bd2723c3090 100644 --- a/include/asm-mips/vr41xx/vr41xx.h +++ b/include/asm-mips/vr41xx/vr41xx.h @@ -7,7 +7,7 @@ * Copyright (C) 2001, 2002 Paul Mundt * Copyright (C) 2002 MontaVista Software, Inc. * Copyright (C) 2002 TimeSys Corp. - * Copyright (C) 2003-2004 Yoichi Yuasa + * Copyright (C) 2003-2005 Yoichi Yuasa * * 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 @@ -79,11 +79,11 @@ extern void vr41xx_mask_clock(vr41xx_clock_t clock); #define MIPS_CPU_IRQ(x) (MIPS_CPU_IRQ_BASE + (x)) #define MIPS_SOFTINT0_IRQ MIPS_CPU_IRQ(0) #define MIPS_SOFTINT1_IRQ MIPS_CPU_IRQ(1) -#define INT0_CASCADE_IRQ MIPS_CPU_IRQ(2) -#define INT1_CASCADE_IRQ MIPS_CPU_IRQ(3) -#define INT2_CASCADE_IRQ MIPS_CPU_IRQ(4) -#define INT3_CASCADE_IRQ MIPS_CPU_IRQ(5) -#define INT4_CASCADE_IRQ MIPS_CPU_IRQ(6) +#define INT0_IRQ MIPS_CPU_IRQ(2) +#define INT1_IRQ MIPS_CPU_IRQ(3) +#define INT2_IRQ MIPS_CPU_IRQ(4) +#define INT3_IRQ MIPS_CPU_IRQ(5) +#define INT4_IRQ MIPS_CPU_IRQ(6) #define TIMER_IRQ MIPS_CPU_IRQ(7) /* SYINT1 Interrupt Numbers */ @@ -97,7 +97,7 @@ extern void vr41xx_mask_clock(vr41xx_clock_t clock); #define PIU_IRQ SYSINT1_IRQ(5) #define AIU_IRQ SYSINT1_IRQ(6) #define KIU_IRQ SYSINT1_IRQ(7) -#define GIUINT_CASCADE_IRQ SYSINT1_IRQ(8) +#define GIUINT_IRQ SYSINT1_IRQ(8) #define SIU_IRQ SYSINT1_IRQ(9) #define BUSERR_IRQ SYSINT1_IRQ(10) #define SOFTINT_IRQ SYSINT1_IRQ(11) @@ -128,7 +128,7 @@ extern void vr41xx_mask_clock(vr41xx_clock_t clock); #define GIU_IRQ_LAST GIU_IRQ(31) extern int vr41xx_set_intassign(unsigned int irq, unsigned char intassign); -extern int vr41xx_cascade_irq(unsigned int irq, int (*get_irq_number)(int irq)); +extern int cascade_irq(unsigned int irq, int (*get_irq)(unsigned int, struct pt_regs *)); #define PIUINT_COMMAND 0x0040 #define PIUINT_DATA 0x0020 -- cgit v1.2.3-70-g09d2 From 0fdda107e10133583f31c72326959555bfb61042 Mon Sep 17 00:00:00 2001 From: Ralf Baechle Date: Sat, 3 Sep 2005 15:56:06 -0700 Subject: [PATCH] mips: remove VR4181 support There seem to be no more users or interest in the NEC Osprey evaluation system for the NEC VR4181 SOC which is an old part anyway, so remove the code. More information on the Osprey can be found at http://www.linux-mips.org/wiki/Osprey. Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- arch/mips/configs/osprey_defconfig | 618 ---------------------------------- arch/mips/vr4181/common/Makefile | 7 - arch/mips/vr4181/common/int_handler.S | 206 ------------ arch/mips/vr4181/common/irq.c | 239 ------------- arch/mips/vr4181/common/serial.c | 51 --- arch/mips/vr4181/common/time.c | 145 -------- arch/mips/vr4181/osprey/Makefile | 7 - arch/mips/vr4181/osprey/dbg_io.c | 136 -------- arch/mips/vr4181/osprey/prom.c | 49 --- arch/mips/vr4181/osprey/reset.c | 40 --- arch/mips/vr4181/osprey/setup.c | 68 ---- include/asm-mips/vr4181/irq.h | 122 ------- include/asm-mips/vr4181/vr4181.h | 413 ----------------------- 13 files changed, 2101 deletions(-) delete mode 100644 arch/mips/configs/osprey_defconfig delete mode 100644 arch/mips/vr4181/common/Makefile delete mode 100644 arch/mips/vr4181/common/int_handler.S delete mode 100644 arch/mips/vr4181/common/irq.c delete mode 100644 arch/mips/vr4181/common/serial.c delete mode 100644 arch/mips/vr4181/common/time.c delete mode 100644 arch/mips/vr4181/osprey/Makefile delete mode 100644 arch/mips/vr4181/osprey/dbg_io.c delete mode 100644 arch/mips/vr4181/osprey/prom.c delete mode 100644 arch/mips/vr4181/osprey/reset.c delete mode 100644 arch/mips/vr4181/osprey/setup.c delete mode 100644 include/asm-mips/vr4181/irq.h delete mode 100644 include/asm-mips/vr4181/vr4181.h (limited to 'include') diff --git a/arch/mips/configs/osprey_defconfig b/arch/mips/configs/osprey_defconfig deleted file mode 100644 index 989cb9e7ae8..00000000000 --- a/arch/mips/configs/osprey_defconfig +++ /dev/null @@ -1,618 +0,0 @@ -# -# Automatically generated make config: don't edit -# Linux kernel version: 2.6.11-rc2 -# Wed Jan 26 02:49:08 2005 -# -CONFIG_MIPS=y -# CONFIG_MIPS64 is not set -# CONFIG_64BIT is not set -CONFIG_MIPS32=y - -# -# Code maturity level options -# -CONFIG_EXPERIMENTAL=y -CONFIG_CLEAN_COMPILE=y -CONFIG_BROKEN_ON_SMP=y - -# -# General setup -# -CONFIG_LOCALVERSION="" -CONFIG_SWAP=y -CONFIG_SYSVIPC=y -# CONFIG_POSIX_MQUEUE is not set -# CONFIG_BSD_PROCESS_ACCT is not set -CONFIG_SYSCTL=y -# CONFIG_AUDIT is not set -CONFIG_LOG_BUF_SHIFT=14 -# CONFIG_HOTPLUG is not set -CONFIG_KOBJECT_UEVENT=y -# CONFIG_IKCONFIG is not set -CONFIG_EMBEDDED=y -CONFIG_KALLSYMS=y -# CONFIG_KALLSYMS_EXTRA_PASS is not set -CONFIG_FUTEX=y -CONFIG_EPOLL=y -# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set -CONFIG_SHMEM=y -CONFIG_CC_ALIGN_FUNCTIONS=0 -CONFIG_CC_ALIGN_LABELS=0 -CONFIG_CC_ALIGN_LOOPS=0 -CONFIG_CC_ALIGN_JUMPS=0 -# CONFIG_TINY_SHMEM is not set - -# -# Loadable module support -# -CONFIG_MODULES=y -CONFIG_MODULE_UNLOAD=y -# CONFIG_MODULE_FORCE_UNLOAD is not set -CONFIG_OBSOLETE_MODPARM=y -CONFIG_MODVERSIONS=y -CONFIG_MODULE_SRCVERSION_ALL=y -CONFIG_KMOD=y - -# -# Machine selection -# -# CONFIG_MACH_JAZZ is not set -# CONFIG_MACH_VR41XX is not set -# CONFIG_TOSHIBA_JMR3927 is not set -# CONFIG_MIPS_COBALT is not set -# CONFIG_MACH_DECSTATION is not set -# CONFIG_MIPS_EV64120 is not set -# CONFIG_MIPS_EV96100 is not set -# CONFIG_MIPS_IVR is not set -# CONFIG_LASAT is not set -# CONFIG_MIPS_ITE8172 is not set -# CONFIG_MIPS_ATLAS is not set -# CONFIG_MIPS_MALTA is not set -# CONFIG_MIPS_SEAD is not set -# CONFIG_MOMENCO_OCELOT is not set -# CONFIG_MOMENCO_OCELOT_G is not set -# CONFIG_MOMENCO_OCELOT_C is not set -# CONFIG_MOMENCO_OCELOT_3 is not set -# CONFIG_MOMENCO_JAGUAR_ATX is not set -# CONFIG_PMC_YOSEMITE is not set -# CONFIG_DDB5074 is not set -# CONFIG_DDB5476 is not set -# CONFIG_DDB5477 is not set -CONFIG_NEC_OSPREY=y -# CONFIG_SGI_IP22 is not set -# CONFIG_SOC_AU1X00 is not set -# CONFIG_SIBYTE_SB1xxx_SOC is not set -# CONFIG_SNI_RM200_PCI is not set -# CONFIG_TOSHIBA_RBTX4927 is not set -CONFIG_RWSEM_GENERIC_SPINLOCK=y -CONFIG_GENERIC_CALIBRATE_DELAY=y -CONFIG_HAVE_DEC_LOCK=y -CONFIG_DMA_NONCOHERENT=y -CONFIG_CPU_LITTLE_ENDIAN=y -CONFIG_IRQ_CPU=y -CONFIG_MIPS_L1_CACHE_SHIFT=5 -CONFIG_VR4181=y - -# -# CPU selection -# -# CONFIG_CPU_MIPS32 is not set -# CONFIG_CPU_MIPS64 is not set -# CONFIG_CPU_R3000 is not set -# CONFIG_CPU_TX39XX is not set -CONFIG_CPU_VR41XX=y -# CONFIG_CPU_R4300 is not set -# CONFIG_CPU_R4X00 is not set -# CONFIG_CPU_TX49XX is not set -# CONFIG_CPU_R5000 is not set -# CONFIG_CPU_R5432 is not set -# CONFIG_CPU_R6000 is not set -# CONFIG_CPU_NEVADA is not set -# CONFIG_CPU_R8000 is not set -# CONFIG_CPU_R10000 is not set -# CONFIG_CPU_RM7000 is not set -# CONFIG_CPU_RM9000 is not set -# CONFIG_CPU_SB1 is not set -CONFIG_PAGE_SIZE_4KB=y -# CONFIG_PAGE_SIZE_8KB is not set -# CONFIG_PAGE_SIZE_16KB is not set -# CONFIG_PAGE_SIZE_64KB is not set -# CONFIG_CPU_ADVANCED is not set -CONFIG_CPU_HAS_SYNC=y -# CONFIG_PREEMPT is not set - -# -# Bus options (PCI, PCMCIA, EISA, ISA, TC) -# -CONFIG_MMU=y - -# -# PCCARD (PCMCIA/CardBus) support -# -# CONFIG_PCCARD is not set - -# -# PC-card bridges -# - -# -# PCI Hotplug Support -# - -# -# Executable file formats -# -CONFIG_BINFMT_ELF=y -# CONFIG_BINFMT_MISC is not set -CONFIG_TRAD_SIGNALS=y - -# -# Device Drivers -# - -# -# Generic Driver Options -# -CONFIG_STANDALONE=y -CONFIG_PREVENT_FIRMWARE_BUILD=y -# CONFIG_FW_LOADER is not set - -# -# Memory Technology Devices (MTD) -# -# CONFIG_MTD is not set - -# -# Parallel port support -# -# CONFIG_PARPORT is not set - -# -# Plug and Play support -# - -# -# Block devices -# -# CONFIG_BLK_DEV_FD is not set -# CONFIG_BLK_DEV_COW_COMMON is not set -# CONFIG_BLK_DEV_LOOP is not set -# CONFIG_BLK_DEV_NBD is not set -# CONFIG_BLK_DEV_RAM is not set -CONFIG_BLK_DEV_RAM_COUNT=16 -CONFIG_INITRAMFS_SOURCE="" -# CONFIG_LBD is not set -CONFIG_CDROM_PKTCDVD=m -CONFIG_CDROM_PKTCDVD_BUFFERS=8 -# CONFIG_CDROM_PKTCDVD_WCACHE is not set - -# -# IO Schedulers -# -CONFIG_IOSCHED_NOOP=y -CONFIG_IOSCHED_AS=y -CONFIG_IOSCHED_DEADLINE=y -CONFIG_IOSCHED_CFQ=y -CONFIG_ATA_OVER_ETH=m - -# -# ATA/ATAPI/MFM/RLL support -# -# CONFIG_IDE is not set - -# -# SCSI device support -# -# CONFIG_SCSI is not set - -# -# Multi-device support (RAID and LVM) -# -# CONFIG_MD is not set - -# -# Fusion MPT device support -# - -# -# IEEE 1394 (FireWire) support -# - -# -# I2O device support -# - -# -# Networking support -# -CONFIG_NET=y - -# -# Networking options -# -CONFIG_PACKET=y -# CONFIG_PACKET_MMAP is not set -CONFIG_NETLINK_DEV=y -CONFIG_UNIX=y -CONFIG_NET_KEY=y -CONFIG_INET=y -# CONFIG_IP_MULTICAST is not set -# CONFIG_IP_ADVANCED_ROUTER is not set -CONFIG_IP_PNP=y -# CONFIG_IP_PNP_DHCP is not set -CONFIG_IP_PNP_BOOTP=y -# CONFIG_IP_PNP_RARP is not set -# CONFIG_NET_IPIP is not set -# CONFIG_NET_IPGRE is not set -# CONFIG_ARPD is not set -# CONFIG_SYN_COOKIES is not set -# CONFIG_INET_AH is not set -# CONFIG_INET_ESP is not set -# CONFIG_INET_IPCOMP is not set -CONFIG_INET_TUNNEL=m -CONFIG_IP_TCPDIAG=m -# CONFIG_IP_TCPDIAG_IPV6 is not set -# CONFIG_IPV6 is not set -# CONFIG_NETFILTER is not set -CONFIG_XFRM=y -CONFIG_XFRM_USER=m - -# -# SCTP Configuration (EXPERIMENTAL) -# -# CONFIG_IP_SCTP is not set -# CONFIG_ATM is not set -# CONFIG_BRIDGE is not set -# CONFIG_VLAN_8021Q is not set -# CONFIG_DECNET is not set -# CONFIG_LLC2 is not set -# CONFIG_IPX is not set -# CONFIG_ATALK is not set -# CONFIG_X25 is not set -# CONFIG_LAPB is not set -# CONFIG_NET_DIVERT is not set -# CONFIG_ECONET is not set -# CONFIG_WAN_ROUTER is not set - -# -# QoS and/or fair queueing -# -# CONFIG_NET_SCHED is not set -# CONFIG_NET_CLS_ROUTE is not set - -# -# Network testing -# -# CONFIG_NET_PKTGEN is not set -# CONFIG_NETPOLL is not set -# CONFIG_NET_POLL_CONTROLLER is not set -# CONFIG_HAMRADIO is not set -# CONFIG_IRDA is not set -# CONFIG_BT is not set -CONFIG_NETDEVICES=y -# CONFIG_DUMMY is not set -# CONFIG_BONDING is not set -# CONFIG_EQUALIZER is not set -# CONFIG_TUN is not set -# CONFIG_ETHERTAP is not set - -# -# Ethernet (10 or 100Mbit) -# -CONFIG_NET_ETHERNET=y -# CONFIG_MII is not set - -# -# Ethernet (1000 Mbit) -# - -# -# Ethernet (10000 Mbit) -# - -# -# Token Ring devices -# - -# -# Wireless LAN (non-hamradio) -# -# CONFIG_NET_RADIO is not set - -# -# Wan interfaces -# -# CONFIG_WAN is not set -# CONFIG_PPP is not set -# CONFIG_SLIP is not set -# CONFIG_SHAPER is not set -# CONFIG_NETCONSOLE is not set - -# -# ISDN subsystem -# -# CONFIG_ISDN is not set - -# -# Telephony Support -# -# CONFIG_PHONE is not set - -# -# Input device support -# -CONFIG_INPUT=y - -# -# Userland interfaces -# -CONFIG_INPUT_MOUSEDEV=y -CONFIG_INPUT_MOUSEDEV_PSAUX=y -CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024 -CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 -# CONFIG_INPUT_JOYDEV is not set -# CONFIG_INPUT_TSDEV is not set -# CONFIG_INPUT_EVDEV is not set -# CONFIG_INPUT_EVBUG is not set - -# -# Input I/O drivers -# -# CONFIG_GAMEPORT is not set -CONFIG_SOUND_GAMEPORT=y -CONFIG_SERIO=y -# CONFIG_SERIO_I8042 is not set -CONFIG_SERIO_SERPORT=y -# CONFIG_SERIO_CT82C710 is not set -# CONFIG_SERIO_LIBPS2 is not set -CONFIG_SERIO_RAW=m - -# -# Input Device Drivers -# -# CONFIG_INPUT_KEYBOARD is not set -# CONFIG_INPUT_MOUSE is not set -# CONFIG_INPUT_JOYSTICK is not set -# CONFIG_INPUT_TOUCHSCREEN is not set -# CONFIG_INPUT_MISC is not set - -# -# Character devices -# -CONFIG_VT=y -CONFIG_VT_CONSOLE=y -CONFIG_HW_CONSOLE=y -# CONFIG_SERIAL_NONSTANDARD is not set - -# -# Serial drivers -# -CONFIG_SERIAL_8250=y -CONFIG_SERIAL_8250_CONSOLE=y -CONFIG_SERIAL_8250_NR_UARTS=4 -# CONFIG_SERIAL_8250_EXTENDED is not set - -# -# Non-8250 serial port support -# -CONFIG_SERIAL_CORE=y -CONFIG_SERIAL_CORE_CONSOLE=y -CONFIG_UNIX98_PTYS=y -CONFIG_LEGACY_PTYS=y -CONFIG_LEGACY_PTY_COUNT=256 - -# -# IPMI -# -# CONFIG_IPMI_HANDLER is not set - -# -# Watchdog Cards -# -# CONFIG_WATCHDOG is not set -# CONFIG_RTC is not set -# CONFIG_GEN_RTC is not set -# CONFIG_DTLK is not set -# CONFIG_R3964 is not set - -# -# Ftape, the floppy tape device driver -# -# CONFIG_DRM is not set -# CONFIG_RAW_DRIVER is not set - -# -# I2C support -# -# CONFIG_I2C is not set - -# -# Dallas's 1-wire bus -# -# CONFIG_W1 is not set - -# -# Misc devices -# - -# -# Multimedia devices -# -# CONFIG_VIDEO_DEV is not set - -# -# Digital Video Broadcasting Devices -# -# CONFIG_DVB is not set - -# -# Graphics support -# -# CONFIG_FB is not set - -# -# Console display driver support -# -# CONFIG_VGA_CONSOLE is not set -CONFIG_DUMMY_CONSOLE=y -# CONFIG_BACKLIGHT_LCD_SUPPORT is not set - -# -# Sound -# -# CONFIG_SOUND is not set - -# -# USB support -# -# CONFIG_USB_ARCH_HAS_HCD is not set -# CONFIG_USB_ARCH_HAS_OHCI is not set - -# -# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information -# - -# -# USB Gadget Support -# -# CONFIG_USB_GADGET is not set - -# -# MMC/SD Card support -# -# CONFIG_MMC is not set - -# -# InfiniBand support -# -# CONFIG_INFINIBAND is not set - -# -# File systems -# -CONFIG_EXT2_FS=y -# CONFIG_EXT2_FS_XATTR is not set -# CONFIG_EXT3_FS is not set -# CONFIG_JBD is not set -# CONFIG_REISERFS_FS is not set -# CONFIG_JFS_FS is not set -# CONFIG_XFS_FS is not set -# CONFIG_MINIX_FS is not set -# CONFIG_ROMFS_FS is not set -# CONFIG_QUOTA is not set -CONFIG_DNOTIFY=y -# CONFIG_AUTOFS_FS is not set -# CONFIG_AUTOFS4_FS is not set - -# -# CD-ROM/DVD Filesystems -# -# CONFIG_ISO9660_FS is not set -# CONFIG_UDF_FS is not set - -# -# DOS/FAT/NT Filesystems -# -# CONFIG_MSDOS_FS is not set -# CONFIG_VFAT_FS is not set -# CONFIG_NTFS_FS is not set - -# -# Pseudo filesystems -# -CONFIG_PROC_FS=y -CONFIG_PROC_KCORE=y -CONFIG_SYSFS=y -# CONFIG_DEVFS_FS is not set -CONFIG_DEVPTS_FS_XATTR=y -CONFIG_DEVPTS_FS_SECURITY=y -# CONFIG_TMPFS is not set -# CONFIG_HUGETLB_PAGE is not set -CONFIG_RAMFS=y - -# -# Miscellaneous filesystems -# -# CONFIG_ADFS_FS is not set -# CONFIG_AFFS_FS is not set -# CONFIG_HFS_FS is not set -# CONFIG_HFSPLUS_FS is not set -# CONFIG_BEFS_FS is not set -# CONFIG_BFS_FS is not set -# CONFIG_EFS_FS is not set -# CONFIG_CRAMFS is not set -# CONFIG_VXFS_FS is not set -# CONFIG_HPFS_FS is not set -# CONFIG_QNX4FS_FS is not set -# CONFIG_SYSV_FS is not set -# CONFIG_UFS_FS is not set - -# -# Network File Systems -# -CONFIG_NFS_FS=y -# CONFIG_NFS_V3 is not set -# CONFIG_NFS_V4 is not set -# CONFIG_NFS_DIRECTIO is not set -CONFIG_NFSD=y -# CONFIG_NFSD_V3 is not set -# CONFIG_NFSD_TCP is not set -CONFIG_ROOT_NFS=y -CONFIG_LOCKD=y -CONFIG_EXPORTFS=y -CONFIG_SUNRPC=y -# CONFIG_RPCSEC_GSS_KRB5 is not set -# CONFIG_RPCSEC_GSS_SPKM3 is not set -# CONFIG_SMB_FS is not set -# CONFIG_CIFS is not set -# CONFIG_NCP_FS is not set -# CONFIG_CODA_FS is not set -# CONFIG_AFS_FS is not set - -# -# Partition Types -# -# CONFIG_PARTITION_ADVANCED is not set -CONFIG_MSDOS_PARTITION=y - -# -# Native Language Support -# -# CONFIG_NLS is not set - -# -# Profiling support -# -# CONFIG_PROFILING is not set - -# -# Kernel hacking -# -# CONFIG_DEBUG_KERNEL is not set -CONFIG_CROSSCOMPILE=y -CONFIG_CMDLINE="ip=bootp ether=46,0x03fe0300,eth0" - -# -# Security options -# -CONFIG_KEYS=y -CONFIG_KEYS_DEBUG_PROC_KEYS=y -# CONFIG_SECURITY is not set - -# -# Cryptographic options -# -# CONFIG_CRYPTO is not set - -# -# Hardware crypto devices -# - -# -# Library routines -# -# CONFIG_CRC_CCITT is not set -# CONFIG_CRC32 is not set -CONFIG_LIBCRC32C=m -CONFIG_GENERIC_HARDIRQS=y -CONFIG_GENERIC_IRQ_PROBE=y diff --git a/arch/mips/vr4181/common/Makefile b/arch/mips/vr4181/common/Makefile deleted file mode 100644 index f7587ca64ea..00000000000 --- a/arch/mips/vr4181/common/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -# -# Makefile for common code of NEC vr4181 based boards -# - -obj-y := irq.o int_handler.o serial.o time.o - -EXTRA_AFLAGS := $(CFLAGS) diff --git a/arch/mips/vr4181/common/int_handler.S b/arch/mips/vr4181/common/int_handler.S deleted file mode 100644 index 2c041b8ee52..00000000000 --- a/arch/mips/vr4181/common/int_handler.S +++ /dev/null @@ -1,206 +0,0 @@ -/* - * arch/mips/vr4181/common/int_handler.S - * - * Adapted to the VR4181 and almost entirely rewritten: - * Copyright (C) 1999 Bradley D. LaRonde and Michael Klar - * - * Clean up to conform to the new IRQ - * Copyright (C) 2001 MontaVista Software Inc. - * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net - * - * This file is subject to the terms and conditions of the GNU General Public - * License. See the file "COPYING" in the main directory of this archive - * for more details. - * - */ - -#include -#include -#include -#include - -#include - -/* - * [jsun] - * See include/asm/vr4181/irq.h for IRQ assignment and strategy. - */ - - .text - .set noreorder - - .align 5 - NESTED(vr4181_handle_irq, PT_SIZE, ra) - - .set noat - SAVE_ALL - CLI - - .set at - .set noreorder - - mfc0 t0, CP0_CAUSE - mfc0 t2, CP0_STATUS - - and t0, t2 - - /* we check IP3 first; it happens most frequently */ - andi t1, t0, STATUSF_IP3 - bnez t1, ll_cpu_ip3 - andi t1, t0, STATUSF_IP2 - bnez t1, ll_cpu_ip2 - andi t1, t0, STATUSF_IP7 /* cpu timer */ - bnez t1, ll_cputimer_irq - andi t1, t0, STATUSF_IP4 - bnez t1, ll_cpu_ip4 - andi t1, t0, STATUSF_IP5 - bnez t1, ll_cpu_ip5 - andi t1, t0, STATUSF_IP6 - bnez t1, ll_cpu_ip6 - andi t1, t0, STATUSF_IP0 /* software int 0 */ - bnez t1, ll_cpu_ip0 - andi t1, t0, STATUSF_IP1 /* software int 1 */ - bnez t1, ll_cpu_ip1 - nop - - .set reorder -do_spurious: - j spurious_interrupt - -/* - * regular CPU irqs - */ -ll_cputimer_irq: - li a0, VR4181_IRQ_TIMER - move a1, sp - jal do_IRQ - j ret_from_irq - - -ll_cpu_ip0: - li a0, VR4181_IRQ_SW1 - move a1, sp - jal do_IRQ - j ret_from_irq - -ll_cpu_ip1: - li a0, VR4181_IRQ_SW2 - move a1, sp - jal do_IRQ - j ret_from_irq - -ll_cpu_ip3: - li a0, VR4181_IRQ_INT1 - move a1, sp - jal do_IRQ - j ret_from_irq - -ll_cpu_ip4: - li a0, VR4181_IRQ_INT2 - move a1, sp - jal do_IRQ - j ret_from_irq - -ll_cpu_ip5: - li a0, VR4181_IRQ_INT3 - move a1, sp - jal do_IRQ - j ret_from_irq - -ll_cpu_ip6: - li a0, VR4181_IRQ_INT4 - move a1, sp - jal do_IRQ - j ret_from_irq - -/* - * One of the sys irq has happend. - * - * In the interest of speed, we first determine in the following order - * which 16-irq block have pending interrupts: - * sysint1 (16 sources, including cascading intrs from GPIO) - * sysint2 - * gpio (16 intr sources) - * - * Then we do binary search to find the exact interrupt source. - */ -ll_cpu_ip2: - - lui t3,%hi(VR4181_SYSINT1REG) - lhu t0,%lo(VR4181_SYSINT1REG)(t3) - lhu t2,%lo(VR4181_MSYSINT1REG)(t3) - and t0, 0xfffb /* hack - remove RTC Long 1 intr */ - and t0, t2 - beqz t0, check_sysint2 - - /* check for GPIO interrupts */ - andi t1, t0, 0x0100 - bnez t1, check_gpio_int - - /* so we have an interrupt in sysint1 which is not gpio int */ - li a0, VR4181_SYS_IRQ_BASE - 1 - j check_16 - -check_sysint2: - - lhu t0,%lo(VR4181_SYSINT2REG)(t3) - lhu t2,%lo(VR4181_MSYSINT2REG)(t3) - and t0, 0xfffe /* hack - remove RTC Long 2 intr */ - and t0, t2 - li a0, VR4181_SYS_IRQ_BASE + 16 - 1 - j check_16 - -check_gpio_int: - lui t3,%hi(VR4181_GPINTMSK) - lhu t0,%lo(VR4181_GPINTMSK)(t3) - lhu t2,%lo(VR4181_GPINTSTAT)(t3) - xori t0, 0xffff /* why? reverse logic? */ - and t0, t2 - li a0, VR4181_GPIO_IRQ_BASE - 1 - j check_16 - -/* - * When we reach check_16, we have 16-bit status in t0 and base irq number - * in a0. - */ -check_16: - andi t1, t0, 0xff - bnez t1, check_8 - - srl t0, 8 - addi a0, 8 - j check_8 - -/* - * When we reach check_8, we have 8-bit status in t0 and base irq number - * in a0. - */ -check_8: - andi t1, t0, 0xf - bnez t1, check_4 - - srl t0, 4 - addi a0, 4 - j check_4 - -/* - * When we reach check_4, we have 4-bit status in t0 and base irq number - * in a0. - */ -check_4: - andi t0, t0, 0xf - beqz t0, do_spurious - -loop: - andi t2, t0, 0x1 - srl t0, 1 - addi a0, 1 - beqz t2, loop - -found_it: - move a1, sp - jal do_IRQ - - j ret_from_irq - - END(vr4181_handle_irq) diff --git a/arch/mips/vr4181/common/irq.c b/arch/mips/vr4181/common/irq.c deleted file mode 100644 index 2cdf77c5cb3..00000000000 --- a/arch/mips/vr4181/common/irq.c +++ /dev/null @@ -1,239 +0,0 @@ -/* - * Copyright (C) 2001 MontaVista Software Inc. - * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net - * Copyright (C) 2005 Ralf Baechle (ralf@linux-mips.org) - * - * linux/arch/mips/vr4181/common/irq.c - * Completely re-written to use the new irq.c - * - * Credits to Bradley D. LaRonde and Michael Klar for writing the original - * irq.c file which was derived from the common irq.c file. - * - * This file is subject to the terms and conditions of the GNU General Public - * License. See the file "COPYING" in the main directory of this archive - * for more details. - */ -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include - -/* - * Strategy: - * - * We essentially have three irq controllers, CPU, system, and gpio. - * - * CPU irq controller is taken care by arch/mips/kernel/irq_cpu.c and - * CONFIG_IRQ_CPU config option. - * - * We here provide sys_irq and gpio_irq controller code. - */ - -static int sys_irq_base; -static int gpio_irq_base; - -/* ---------------------- sys irq ------------------------ */ -static void -sys_irq_enable(unsigned int irq) -{ - irq -= sys_irq_base; - if (irq < 16) { - *VR4181_MSYSINT1REG |= (u16)(1 << irq); - } else { - irq -= 16; - *VR4181_MSYSINT2REG |= (u16)(1 << irq); - } -} - -static void -sys_irq_disable(unsigned int irq) -{ - irq -= sys_irq_base; - if (irq < 16) { - *VR4181_MSYSINT1REG &= ~((u16)(1 << irq)); - } else { - irq -= 16; - *VR4181_MSYSINT2REG &= ~((u16)(1 << irq)); - } - -} - -static unsigned int -sys_irq_startup(unsigned int irq) -{ - sys_irq_enable(irq); - return 0; -} - -#define sys_irq_shutdown sys_irq_disable -#define sys_irq_ack sys_irq_disable - -static void -sys_irq_end(unsigned int irq) -{ - if(!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS))) - sys_irq_enable(irq); -} - -static hw_irq_controller sys_irq_controller = { - "vr4181_sys_irq", - sys_irq_startup, - sys_irq_shutdown, - sys_irq_enable, - sys_irq_disable, - sys_irq_ack, - sys_irq_end, - NULL /* no affinity stuff for UP */ -}; - -/* ---------------------- gpio irq ------------------------ */ -/* gpio irq lines use reverse logic */ -static void -gpio_irq_enable(unsigned int irq) -{ - irq -= gpio_irq_base; - *VR4181_GPINTMSK &= ~((u16)(1 << irq)); -} - -static void -gpio_irq_disable(unsigned int irq) -{ - irq -= gpio_irq_base; - *VR4181_GPINTMSK |= (u16)(1 << irq); -} - -static unsigned int -gpio_irq_startup(unsigned int irq) -{ - gpio_irq_enable(irq); - - irq -= gpio_irq_base; - *VR4181_GPINTEN |= (u16)(1 << irq ); - - return 0; -} - -static void -gpio_irq_shutdown(unsigned int irq) -{ - gpio_irq_disable(irq); - - irq -= gpio_irq_base; - *VR4181_GPINTEN &= ~((u16)(1 << irq )); -} - -static void -gpio_irq_ack(unsigned int irq) -{ - u16 irqtype; - u16 irqshift; - - gpio_irq_disable(irq); - - /* we clear interrupt if it is edge triggered */ - irq -= gpio_irq_base; - if (irq < 8) { - irqtype = *VR4181_GPINTTYPL; - irqshift = 2 << (irq*2); - } else { - irqtype = *VR4181_GPINTTYPH; - irqshift = 2 << ((irq-8)*2); - } - if ( ! (irqtype & irqshift) ) { - *VR4181_GPINTSTAT = (u16) (1 << irq); - } -} - -static void -gpio_irq_end(unsigned int irq) -{ - if(!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS))) - gpio_irq_enable(irq); -} - -static hw_irq_controller gpio_irq_controller = { - "vr4181_gpio_irq", - gpio_irq_startup, - gpio_irq_shutdown, - gpio_irq_enable, - gpio_irq_disable, - gpio_irq_ack, - gpio_irq_end, - NULL /* no affinity stuff for UP */ -}; - -/* --------------------- IRQ init stuff ---------------------- */ - -extern asmlinkage void vr4181_handle_irq(void); -extern void breakpoint(void); -extern int setup_irq(unsigned int irq, struct irqaction *irqaction); -extern void mips_cpu_irq_init(u32 irq_base); - -static struct irqaction cascade = - { no_action, SA_INTERRUPT, CPU_MASK_NONE, "cascade", NULL, NULL }; -static struct irqaction reserved = - { no_action, SA_INTERRUPT, CPU_MASK_NONE, "cascade", NULL, NULL }; - -void __init arch_init_irq(void) -{ - int i; - - set_except_vector(0, vr4181_handle_irq); - - /* init CPU irqs */ - mips_cpu_irq_init(VR4181_CPU_IRQ_BASE); - - /* init sys irqs */ - sys_irq_base = VR4181_SYS_IRQ_BASE; - for (i=sys_irq_base; i < sys_irq_base + VR4181_NUM_SYS_IRQ; i++) { - irq_desc[i].status = IRQ_DISABLED; - irq_desc[i].action = NULL; - irq_desc[i].depth = 1; - irq_desc[i].handler = &sys_irq_controller; - } - - /* init gpio irqs */ - gpio_irq_base = VR4181_GPIO_IRQ_BASE; - for (i=gpio_irq_base; i < gpio_irq_base + VR4181_NUM_GPIO_IRQ; i++) { - irq_desc[i].status = IRQ_DISABLED; - irq_desc[i].action = NULL; - irq_desc[i].depth = 1; - irq_desc[i].handler = &gpio_irq_controller; - } - - /* Default all ICU IRQs to off ... */ - *VR4181_MSYSINT1REG = 0; - *VR4181_MSYSINT2REG = 0; - - /* We initialize the level 2 ICU registers to all bits disabled. */ - *VR4181_MPIUINTREG = 0; - *VR4181_MAIUINTREG = 0; - *VR4181_MKIUINTREG = 0; - - /* disable all GPIO intrs */ - *VR4181_GPINTMSK = 0xffff; - - /* vector handler. What these do is register the IRQ as non-sharable */ - setup_irq(VR4181_IRQ_INT0, &cascade); - setup_irq(VR4181_IRQ_GIU, &cascade); - - /* - * RTC interrupts are interesting. They have two destinations. - * One is at sys irq controller, and the other is at CPU IP3 and IP4. - * RTC timer is used as system timer. - * We enable them here, but timer routine will register later - * with CPU IP3/IP4. - */ - setup_irq(VR4181_IRQ_RTCL1, &reserved); - setup_irq(VR4181_IRQ_RTCL2, &reserved); -} diff --git a/arch/mips/vr4181/common/serial.c b/arch/mips/vr4181/common/serial.c deleted file mode 100644 index 3f62c62b107..00000000000 --- a/arch/mips/vr4181/common/serial.c +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2001 MontaVista Software Inc. - * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net - * - * arch/mips/vr4181/common/serial.c - * initialize serial port on vr4181. - * - * 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. - * - */ - -/* - * [jsun, 010925] - * You need to make sure rs_table has at least one element in - * drivers/char/serial.c file. There is no good way to do it right - * now. A workaround is to include CONFIG_SERIAL_MANY_PORTS in your - * configure file, which would gives you 64 ports and wastes 11K ram. - */ - -#include -#include -#include -#include - -#include - -void __init vr4181_init_serial(void) -{ - struct serial_struct s; - - /* turn on UART clock */ - *VR4181_CMUCLKMSK |= VR4181_CMUCLKMSK_MSKSIU; - - /* clear memory */ - memset(&s, 0, sizeof(s)); - - s.line = 0; /* we set the first one */ - s.baud_base = 1152000; - s.irq = VR4181_IRQ_SIU; - s.flags = ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST; /* STD_COM_FLAGS */ - s.iomem_base = (u8*)VR4181_SIURB; - s.iomem_reg_shift = 0; - s.io_type = SERIAL_IO_MEM; - if (early_serial_setup(&s) != 0) { - panic("vr4181_init_serial() failed!"); - } -} - diff --git a/arch/mips/vr4181/common/time.c b/arch/mips/vr4181/common/time.c deleted file mode 100644 index 17814076b6f..00000000000 --- a/arch/mips/vr4181/common/time.c +++ /dev/null @@ -1,145 +0,0 @@ -/* - * Copyright 2001 MontaVista Software Inc. - * Author: jsun@mvista.com or jsun@junsun.net - * - * rtc and time ops for vr4181. Part of code is drived from - * linux-vr, originally written by Bradley D. LaRonde & Michael Klar. - * - * 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. - * - */ - -#include -#include -#include /* for HZ */ -#include -#include - -#include -#include - -#include - -#define COUNTS_PER_JIFFY ((32768 + HZ/2) / HZ) - -/* - * RTC ops - */ - -DEFINE_SPINLOCK(rtc_lock); - -/* per VR41xx docs, bad data can be read if between 2 counts */ -static inline unsigned short -read_time_reg(volatile unsigned short *reg) -{ - unsigned short value; - do { - value = *reg; - barrier(); - } while (value != *reg); - return value; -} - -static unsigned long -vr4181_rtc_get_time(void) -{ - unsigned short regh, regm, regl; - - // why this crazy order, you ask? to guarantee that neither m - // nor l wrap before all 3 read - do { - regm = read_time_reg(VR4181_ETIMEMREG); - barrier(); - regh = read_time_reg(VR4181_ETIMEHREG); - barrier(); - regl = read_time_reg(VR4181_ETIMELREG); - } while (regm != read_time_reg(VR4181_ETIMEMREG)); - return ((regh << 17) | (regm << 1) | (regl >> 15)); -} - -static int -vr4181_rtc_set_time(unsigned long timeval) -{ - unsigned short intreg; - unsigned long flags; - - spin_lock_irqsave(&rtc_lock, flags); - intreg = *VR4181_RTCINTREG & 0x05; - barrier(); - *VR4181_ETIMELREG = timeval << 15; - *VR4181_ETIMEMREG = timeval >> 1; - *VR4181_ETIMEHREG = timeval >> 17; - barrier(); - // assume that any ints that just triggered are invalid, since the - // time value is written non-atomically in 3 separate regs - *VR4181_RTCINTREG = 0x05 ^ intreg; - spin_unlock_irqrestore(&rtc_lock, flags); - - return 0; -} - - -/* - * timer interrupt routine (wrapper) - * - * we need our own interrupt routine because we need to clear - * RTC1 interrupt. - */ -static void -vr4181_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs) -{ - /* Clear the interrupt. */ - *VR4181_RTCINTREG = 0x2; - - /* call the generic one */ - timer_interrupt(irq, dev_id, regs); -} - - -/* - * vr4181_time_init: - * - * We pick the following choices: - * . we use elapsed timer as the RTC. We set some reasonable init data since - * it does not persist across reset - * . we use RTC1 as the system timer interrupt source. - * . we use CPU counter for fast_gettimeoffset and we calivrate the cpu - * frequency. In other words, we use calibrate_div64_gettimeoffset(). - * . we use our own timer interrupt routine which clears the interrupt - * and then calls the generic high-level timer interrupt routine. - * - */ - -extern int setup_irq(unsigned int irq, struct irqaction *irqaction); - -static void -vr4181_timer_setup(struct irqaction *irq) -{ - /* over-write the handler to be our own one */ - irq->handler = vr4181_timer_interrupt; - - /* sets up the frequency */ - *VR4181_RTCL1LREG = COUNTS_PER_JIFFY; - *VR4181_RTCL1HREG = 0; - - /* and ack any pending ints */ - *VR4181_RTCINTREG = 0x2; - - /* setup irqaction */ - setup_irq(VR4181_IRQ_INT1, irq); - -} - -void -vr4181_init_time(void) -{ - /* setup hookup functions */ - rtc_get_time = vr4181_rtc_get_time; - rtc_set_time = vr4181_rtc_set_time; - - board_timer_setup = vr4181_timer_setup; -} - diff --git a/arch/mips/vr4181/osprey/Makefile b/arch/mips/vr4181/osprey/Makefile deleted file mode 100644 index 34be0579088..00000000000 --- a/arch/mips/vr4181/osprey/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -# -# Makefile for common code of NEC Osprey board -# - -obj-y := setup.o prom.o reset.o - -obj-$(CONFIG_KGDB) += dbg_io.o diff --git a/arch/mips/vr4181/osprey/dbg_io.c b/arch/mips/vr4181/osprey/dbg_io.c deleted file mode 100644 index 5e8a84072d5..00000000000 --- a/arch/mips/vr4181/osprey/dbg_io.c +++ /dev/null @@ -1,136 +0,0 @@ -/* - * kgdb io functions for osprey. We use the serial port on debug board. - * - * Copyright (C) 2001 MontaVista Software Inc. - * Author: jsun@mvista.com or jsun@junsun.net - * - * 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. - * - */ - -/* ======================= CONFIG ======================== */ - -/* [jsun] we use the second serial port for kdb */ -#define BASE 0xb7fffff0 -#define MAX_BAUD 115200 - -/* distance in bytes between two serial registers */ -#define REG_OFFSET 1 - -/* - * 0 - kgdb does serial init - * 1 - kgdb skip serial init - */ -static int remoteDebugInitialized = 1; - -/* - * the default baud rate *if* kgdb does serial init - */ -#define BAUD_DEFAULT UART16550_BAUD_38400 - -/* ======================= END OF CONFIG ======================== */ - -typedef unsigned char uint8; -typedef unsigned int uint32; - -#define UART16550_BAUD_2400 2400 -#define UART16550_BAUD_4800 4800 -#define UART16550_BAUD_9600 9600 -#define UART16550_BAUD_19200 19200 -#define UART16550_BAUD_38400 38400 -#define UART16550_BAUD_57600 57600 -#define UART16550_BAUD_115200 115200 - -#define UART16550_PARITY_NONE 0 -#define UART16550_PARITY_ODD 0x08 -#define UART16550_PARITY_EVEN 0x18 -#define UART16550_PARITY_MARK 0x28 -#define UART16550_PARITY_SPACE 0x38 - -#define UART16550_DATA_5BIT 0x0 -#define UART16550_DATA_6BIT 0x1 -#define UART16550_DATA_7BIT 0x2 -#define UART16550_DATA_8BIT 0x3 - -#define UART16550_STOP_1BIT 0x0 -#define UART16550_STOP_2BIT 0x4 - -/* register offset */ -#define OFS_RCV_BUFFER 0 -#define OFS_TRANS_HOLD 0 -#define OFS_SEND_BUFFER 0 -#define OFS_INTR_ENABLE (1*REG_OFFSET) -#define OFS_INTR_ID (2*REG_OFFSET) -#define OFS_DATA_FORMAT (3*REG_OFFSET) -#define OFS_LINE_CONTROL (3*REG_OFFSET) -#define OFS_MODEM_CONTROL (4*REG_OFFSET) -#define OFS_RS232_OUTPUT (4*REG_OFFSET) -#define OFS_LINE_STATUS (5*REG_OFFSET) -#define OFS_MODEM_STATUS (6*REG_OFFSET) -#define OFS_RS232_INPUT (6*REG_OFFSET) -#define OFS_SCRATCH_PAD (7*REG_OFFSET) - -#define OFS_DIVISOR_LSB (0*REG_OFFSET) -#define OFS_DIVISOR_MSB (1*REG_OFFSET) - - -/* memory-mapped read/write of the port */ -#define UART16550_READ(y) (*((volatile uint8*)(BASE + y))) -#define UART16550_WRITE(y, z) ((*((volatile uint8*)(BASE + y))) = z) - -void debugInit(uint32 baud, uint8 data, uint8 parity, uint8 stop) -{ - /* disable interrupts */ - UART16550_WRITE(OFS_INTR_ENABLE, 0); - - /* set up buad rate */ - { - uint32 divisor; - - /* set DIAB bit */ - UART16550_WRITE(OFS_LINE_CONTROL, 0x80); - - /* set divisor */ - divisor = MAX_BAUD / baud; - UART16550_WRITE(OFS_DIVISOR_LSB, divisor & 0xff); - UART16550_WRITE(OFS_DIVISOR_MSB, (divisor & 0xff00) >> 8); - - /* clear DIAB bit */ - UART16550_WRITE(OFS_LINE_CONTROL, 0x0); - } - - /* set data format */ - UART16550_WRITE(OFS_DATA_FORMAT, data | parity | stop); -} - - -uint8 getDebugChar(void) -{ - if (!remoteDebugInitialized) { - remoteDebugInitialized = 1; - debugInit(BAUD_DEFAULT, - UART16550_DATA_8BIT, - UART16550_PARITY_NONE, UART16550_STOP_1BIT); - } - - while ((UART16550_READ(OFS_LINE_STATUS) & 0x1) == 0); - return UART16550_READ(OFS_RCV_BUFFER); -} - - -int putDebugChar(uint8 byte) -{ - if (!remoteDebugInitialized) { - remoteDebugInitialized = 1; - debugInit(BAUD_DEFAULT, - UART16550_DATA_8BIT, - UART16550_PARITY_NONE, UART16550_STOP_1BIT); - } - - while ((UART16550_READ(OFS_LINE_STATUS) & 0x20) == 0); - UART16550_WRITE(OFS_SEND_BUFFER, byte); - return 1; -} diff --git a/arch/mips/vr4181/osprey/prom.c b/arch/mips/vr4181/osprey/prom.c deleted file mode 100644 index af0d1456161..00000000000 --- a/arch/mips/vr4181/osprey/prom.c +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright 2001 MontaVista Software Inc. - * Author: jsun@mvista.com or jsun@junsun.net - * - * arch/mips/vr4181/osprey/prom.c - * prom code for osprey. - * - * 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. - * - */ -#include -#include -#include -#include -#include -#include -#include - -const char *get_system_type(void) -{ - return "NEC_Vr41xx Osprey"; -} - -/* - * [jsun] right now we assume it is the nec debug monitor, which does - * not pass any arguments. - */ -void __init prom_init(void) -{ - // cmdline is now set in default config - // strcpy(arcs_cmdline, "ip=bootp "); - // strcat(arcs_cmdline, "ether=46,0x03fe0300,eth0 "); - // strcpy(arcs_cmdline, "ether=0,0x0300,eth0 " - // strcat(arcs_cmdline, "video=vr4181fb:xres:240,yres:320,bpp:8 "); - - mips_machgroup = MACH_GROUP_NEC_VR41XX; - mips_machtype = MACH_NEC_OSPREY; - - /* 16MB fixed */ - add_memory_region(0, 16 << 20, BOOT_MEM_RAM); -} - -unsigned long __init prom_free_prom_memory(void) -{ - return 0; -} diff --git a/arch/mips/vr4181/osprey/reset.c b/arch/mips/vr4181/osprey/reset.c deleted file mode 100644 index 036ae83d89d..00000000000 --- a/arch/mips/vr4181/osprey/reset.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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. - * - * Copyright (C) 1997, 2001 Ralf Baechle - * Copyright 2001 MontaVista Software Inc. - * Author: jsun@mvista.com or jsun@junsun.net - */ -#include -#include -#include -#include -#include -#include -#include - -void nec_osprey_restart(char *command) -{ - set_c0_status(ST0_ERL); - change_c0_config(CONF_CM_CMASK, CONF_CM_UNCACHED); - flush_cache_all(); - write_c0_wired(0); - __asm__ __volatile__("jr\t%0"::"r"(0xbfc00000)); -} - -void nec_osprey_halt(void) -{ - printk(KERN_NOTICE "\n** You can safely turn off the power\n"); - while (1) - __asm__(".set\tmips3\n\t" - "wait\n\t" - ".set\tmips0"); -} - -void nec_osprey_power_off(void) -{ - nec_osprey_halt(); -} diff --git a/arch/mips/vr4181/osprey/setup.c b/arch/mips/vr4181/osprey/setup.c deleted file mode 100644 index 2ff7140e7ed..00000000000 --- a/arch/mips/vr4181/osprey/setup.c +++ /dev/null @@ -1,68 +0,0 @@ -/* - * linux/arch/mips/vr4181/setup.c - * - * VR41xx setup routines - * - * Copyright (C) 1999 Bradley D. LaRonde - * Copyright (C) 1999, 2000 Michael Klar - * - * Copyright 2001 MontaVista Software Inc. - * Author: jsun@mvista.com or jsun@junsun.net - * Copyright (C) 2005 Ralf Baechle (ralf@linux-mips.org) - * - * This file is subject to the terms and conditions of the GNU General Public - * License. See the file "COPYING" in the main directory of this archive - * for more details. - * - */ - -#include -#include -#include -#include -#include -#include - - -extern void nec_osprey_restart(char* c); -extern void nec_osprey_halt(void); -extern void nec_osprey_power_off(void); - -extern void vr4181_init_serial(void); -extern void vr4181_init_time(void); - -static void __init nec_osprey_setup(void) -{ - set_io_port_base(VR4181_PORT_BASE); - isa_slot_offset = VR4181_ISAMEM_BASE; - - vr4181_init_serial(); - vr4181_init_time(); - - _machine_restart = nec_osprey_restart; - _machine_halt = nec_osprey_halt; - _machine_power_off = nec_osprey_power_off; - - /* setup resource limit */ - ioport_resource.end = 0xffffffff; - iomem_resource.end = 0xffffffff; - - /* [jsun] hack */ - /* - printk("[jsun] hack to change external ISA control register, %x -> %x\n", - (*VR4181_XISACTL), - (*VR4181_XISACTL) | 0x2); - *VR4181_XISACTL |= 0x2; - */ - - // *VR4181_GPHIBSTH = 0x2000; - // *VR4181_GPMD0REG = 0x00c0; - // *VR4181_GPINTEN = 1<<6; - - /* [jsun] I believe this will get the interrupt type right - * for the ether port. - */ - *VR4181_GPINTTYPL = 0x3000; -} - -early_initcall(nec_osprey_setup); diff --git a/include/asm-mips/vr4181/irq.h b/include/asm-mips/vr4181/irq.h deleted file mode 100644 index 4bf0ea970ed..00000000000 --- a/include/asm-mips/vr4181/irq.h +++ /dev/null @@ -1,122 +0,0 @@ -/* - * Macros for vr4181 IRQ numbers. - * - * Copyright (C) 2001 MontaVista Software Inc. - * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net - * - * 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. - * - */ - -/* - * Strategy: - * - * Vr4181 has conceptually three levels of interrupt controllers: - * 1. the CPU itself with 8 intr level. - * 2. system interrupt controller, cascaded from int0 pin in CPU, 32 intrs - * 3. GPIO interrupts : forwarding external interrupts to sys intr controller - */ - -/* decide the irq block assignment */ -#define VR4181_NUM_CPU_IRQ 8 -#define VR4181_NUM_SYS_IRQ 32 -#define VR4181_NUM_GPIO_IRQ 16 - -#define VR4181_IRQ_BASE 0 - -#define VR4181_CPU_IRQ_BASE VR4181_IRQ_BASE -#define VR4181_SYS_IRQ_BASE (VR4181_CPU_IRQ_BASE + VR4181_NUM_CPU_IRQ) -#define VR4181_GPIO_IRQ_BASE (VR4181_SYS_IRQ_BASE + VR4181_NUM_SYS_IRQ) - -/* CPU interrupts */ - -/* - IP0 - Software interrupt - IP1 - Software interrupt - IP2 - All but battery, high speed modem, and real time clock - IP3 - RTC Long1 (system timer) - IP4 - RTC Long2 - IP5 - High Speed Modem (unused on VR4181) - IP6 - Unused - IP7 - Timer interrupt from CPO_COMPARE -*/ - -#define VR4181_IRQ_SW1 (VR4181_CPU_IRQ_BASE + 0) -#define VR4181_IRQ_SW2 (VR4181_CPU_IRQ_BASE + 1) -#define VR4181_IRQ_INT0 (VR4181_CPU_IRQ_BASE + 2) -#define VR4181_IRQ_INT1 (VR4181_CPU_IRQ_BASE + 3) -#define VR4181_IRQ_INT2 (VR4181_CPU_IRQ_BASE + 4) -#define VR4181_IRQ_INT3 (VR4181_CPU_IRQ_BASE + 5) -#define VR4181_IRQ_INT4 (VR4181_CPU_IRQ_BASE + 6) -#define VR4181_IRQ_TIMER (VR4181_CPU_IRQ_BASE + 7) - - -/* Cascaded from VR4181_IRQ_INT0 (ICU mapped interrupts) */ - -/* - IP2 - same as VR4181_IRQ_INT1 - IP8 - This is a cascade to GPIO IRQ's. Do not use. - IP16 - same as VR4181_IRQ_INT2 - IP18 - CompactFlash -*/ - -#define VR4181_IRQ_BATTERY (VR4181_SYS_IRQ_BASE + 0) -#define VR4181_IRQ_POWER (VR4181_SYS_IRQ_BASE + 1) -#define VR4181_IRQ_RTCL1 (VR4181_SYS_IRQ_BASE + 2) -#define VR4181_IRQ_ETIMER (VR4181_SYS_IRQ_BASE + 3) -#define VR4181_IRQ_RFU12 (VR4181_SYS_IRQ_BASE + 4) -#define VR4181_IRQ_PIU (VR4181_SYS_IRQ_BASE + 5) -#define VR4181_IRQ_AIU (VR4181_SYS_IRQ_BASE + 6) -#define VR4181_IRQ_KIU (VR4181_SYS_IRQ_BASE + 7) -#define VR4181_IRQ_GIU (VR4181_SYS_IRQ_BASE + 8) -#define VR4181_IRQ_SIU (VR4181_SYS_IRQ_BASE + 9) -#define VR4181_IRQ_RFU18 (VR4181_SYS_IRQ_BASE + 10) -#define VR4181_IRQ_SOFT (VR4181_SYS_IRQ_BASE + 11) -#define VR4181_IRQ_RFU20 (VR4181_SYS_IRQ_BASE + 12) -#define VR4181_IRQ_DOZEPIU (VR4181_SYS_IRQ_BASE + 13) -#define VR4181_IRQ_RFU22 (VR4181_SYS_IRQ_BASE + 14) -#define VR4181_IRQ_RFU23 (VR4181_SYS_IRQ_BASE + 15) -#define VR4181_IRQ_RTCL2 (VR4181_SYS_IRQ_BASE + 16) -#define VR4181_IRQ_LED (VR4181_SYS_IRQ_BASE + 17) -#define VR4181_IRQ_ECU (VR4181_SYS_IRQ_BASE + 18) -#define VR4181_IRQ_CSU (VR4181_SYS_IRQ_BASE + 19) -#define VR4181_IRQ_USB (VR4181_SYS_IRQ_BASE + 20) -#define VR4181_IRQ_DMA (VR4181_SYS_IRQ_BASE + 21) -#define VR4181_IRQ_LCD (VR4181_SYS_IRQ_BASE + 22) -#define VR4181_IRQ_RFU31 (VR4181_SYS_IRQ_BASE + 23) -#define VR4181_IRQ_RFU32 (VR4181_SYS_IRQ_BASE + 24) -#define VR4181_IRQ_RFU33 (VR4181_SYS_IRQ_BASE + 25) -#define VR4181_IRQ_RFU34 (VR4181_SYS_IRQ_BASE + 26) -#define VR4181_IRQ_RFU35 (VR4181_SYS_IRQ_BASE + 27) -#define VR4181_IRQ_RFU36 (VR4181_SYS_IRQ_BASE + 28) -#define VR4181_IRQ_RFU37 (VR4181_SYS_IRQ_BASE + 29) -#define VR4181_IRQ_RFU38 (VR4181_SYS_IRQ_BASE + 30) -#define VR4181_IRQ_RFU39 (VR4181_SYS_IRQ_BASE + 31) - -/* Cascaded from VR4181_IRQ_GIU */ -#define VR4181_IRQ_GPIO0 (VR4181_GPIO_IRQ_BASE + 0) -#define VR4181_IRQ_GPIO1 (VR4181_GPIO_IRQ_BASE + 1) -#define VR4181_IRQ_GPIO2 (VR4181_GPIO_IRQ_BASE + 2) -#define VR4181_IRQ_GPIO3 (VR4181_GPIO_IRQ_BASE + 3) -#define VR4181_IRQ_GPIO4 (VR4181_GPIO_IRQ_BASE + 4) -#define VR4181_IRQ_GPIO5 (VR4181_GPIO_IRQ_BASE + 5) -#define VR4181_IRQ_GPIO6 (VR4181_GPIO_IRQ_BASE + 6) -#define VR4181_IRQ_GPIO7 (VR4181_GPIO_IRQ_BASE + 7) -#define VR4181_IRQ_GPIO8 (VR4181_GPIO_IRQ_BASE + 8) -#define VR4181_IRQ_GPIO9 (VR4181_GPIO_IRQ_BASE + 9) -#define VR4181_IRQ_GPIO10 (VR4181_GPIO_IRQ_BASE + 10) -#define VR4181_IRQ_GPIO11 (VR4181_GPIO_IRQ_BASE + 11) -#define VR4181_IRQ_GPIO12 (VR4181_GPIO_IRQ_BASE + 12) -#define VR4181_IRQ_GPIO13 (VR4181_GPIO_IRQ_BASE + 13) -#define VR4181_IRQ_GPIO14 (VR4181_GPIO_IRQ_BASE + 14) -#define VR4181_IRQ_GPIO15 (VR4181_GPIO_IRQ_BASE + 15) - - -// Alternative to above GPIO IRQ defines -#define VR4181_IRQ_GPIO(pin) ((VR4181_IRQ_GPIO0) + (pin)) - -#define VR4181_IRQ_MAX (VR4181_IRQ_BASE + VR4181_NUM_CPU_IRQ + \ - VR4181_NUM_SYS_IRQ + VR4181_NUM_GPIO_IRQ) diff --git a/include/asm-mips/vr4181/vr4181.h b/include/asm-mips/vr4181/vr4181.h deleted file mode 100644 index 5c5d6074151..00000000000 --- a/include/asm-mips/vr4181/vr4181.h +++ /dev/null @@ -1,413 +0,0 @@ -/* - * This file is subject to the terms and conditions of the GNU General Public - * License. See the file "COPYING" in the main directory of this archive - * for more details. - * - * Copyright (C) 1999 by Michael Klar - * - * Copyright 2001 MontaVista Software Inc. - * Author: jsun@mvista.com or jsun@junsun.net - * - */ -#ifndef __ASM_VR4181_VR4181_H -#define __ASM_VR4181_VR4181_H - -#include - -#include - -#ifndef __ASSEMBLY__ -#define __preg8 (volatile unsigned char*) -#define __preg16 (volatile unsigned short*) -#define __preg32 (volatile unsigned int*) -#else -#define __preg8 -#define __preg16 -#define __preg32 -#endif - -// Embedded CPU peripheral registers -// Note that many of the registers have different physical address for VR4181 - -// Bus Control Unit (BCU) -#define VR4181_BCUCNTREG1 __preg16(KSEG1 + 0x0A000000) /* BCU control register 1 (R/W) */ -#define VR4181_CMUCLKMSK __preg16(KSEG1 + 0x0A000004) /* Clock mask register (R/W) */ -#define VR4181_CMUCLKMSK_MSKCSUPCLK 0x0040 -#define VR4181_CMUCLKMSK_MSKAIUPCLK 0x0020 -#define VR4181_CMUCLKMSK_MSKPIUPCLK 0x0010 -#define VR4181_CMUCLKMSK_MSKADUPCLK 0x0008 -#define VR4181_CMUCLKMSK_MSKSIU18M 0x0004 -#define VR4181_CMUCLKMSK_MSKADU18M 0x0002 -#define VR4181_CMUCLKMSK_MSKUSB 0x0001 -#define VR4181_CMUCLKMSK_MSKSIU VR4181_CMUCLKMSK_MSKSIU18M -#define VR4181_BCUSPEEDREG __preg16(KSEG1 + 0x0A00000C) /* BCU access time parameter (R/W) */ -#define VR4181_BCURFCNTREG __preg16(KSEG1 + 0x0A000010) /* BCU refresh control register (R/W) */ -#define VR4181_REVIDREG __preg16(KSEG1 + 0x0A000014) /* Revision ID register (R) */ -#define VR4181_CLKSPEEDREG __preg16(KSEG1 + 0x0A000018) /* Clock speed register (R) */ -#define VR4181_EDOMCYTREG __preg16(KSEG1 + 0x0A000300) /* Memory cycle timing register (R/W) */ -#define VR4181_MEMCFG_REG __preg16(KSEG1 + 0x0A000304) /* Memory configuration register (R/W) */ -#define VR4181_MODE_REG __preg16(KSEG1 + 0x0A000308) /* SDRAM mode register (R/W) */ -#define VR4181_SDTIMINGREG __preg16(KSEG1 + 0x0A00030C) /* SDRAM timing register (R/W) */ - -// DMA Control Unit (DCU) -#define VR4181_MICDEST1REG1 __preg16(KSEG1 + 0x0A000020) /* Microphone destination 1 address register 1 (R/W) */ -#define VR4181_MICDEST1REG2 __preg16(KSEG1 + 0x0A000022) /* Microphone destination 1 address register 2 (R/W) */ -#define VR4181_MICDEST2REG1 __preg16(KSEG1 + 0x0A000024) /* Microphone destination 2 address register 1 (R/W) */ -#define VR4181_MICDEST2REG2 __preg16(KSEG1 + 0x0A000026) /* Microphone destination 2 address register 2 (R/W) */ -#define VR4181_SPKRRC1REG1 __preg16(KSEG1 + 0x0A000028) /* Speaker Source 1 address register 1 (R/W) */ -#define VR4181_SPKRRC1REG2 __preg16(KSEG1 + 0x0A00002A) /* Speaker Source 1 address register 2 (R/W) */ -#define VR4181_SPKRRC2REG1 __preg16(KSEG1 + 0x0A00002C) /* Speaker Source 2 address register 1 (R/W) */ -#define VR4181_SPKRRC2REG2 __preg16(KSEG1 + 0x0A00002E) /* Speaker Source 2 address register 2 (R/W) */ -#define VR4181_DMARSTREG __preg16(KSEG1 + 0x0A000040) /* DMA Reset register (R/W) */ -#define VR4181_AIUDMAMSKREG __preg16(KSEG1 + 0x0A000046) /* Audio DMA mask register (R/W) */ -#define VR4181_USBDMAMSKREG __preg16(KSEG1 + 0x0A000600) /* USB DMA Mask register (R/W) */ -#define VR4181_USBRXS1AREG1 __preg16(KSEG1 + 0x0A000602) /* USB Rx source 1 address register 1 (R/W) */ -#define VR4181_USBRXS1AREG2 __preg16(KSEG1 + 0x0A000604) /* USB Rx source 1 address register 2 (R/W) */ -#define VR4181_USBRXS2AREG1 __preg16(KSEG1 + 0x0A000606) /* USB Rx source 2 address register 1 (R/W) */ -#define VR4181_USBRXS2AREG2 __preg16(KSEG1 + 0x0A000608) /* USB Rx source 2 address register 2 (R/W) */ -#define VR4181_USBTXS1AREG1 __preg16(KSEG1 + 0x0A00060A) /* USB Tx source 1 address register 1 (R/W) */ -#define VR4181_USBTXS1AREG2 __preg16(KSEG1 + 0x0A00060C) /* USB Tx source 1 address register 2 (R/W) */ -#define VR4181_USBTXS2AREG1 __preg16(KSEG1 + 0x0A00060E) /* USB Tx source 2 address register 1 (R/W) */ -#define VR4181_USBTXS2AREG2 __preg16(KSEG1 + 0x0A000610) /* USB Tx source 2 address register 2 (R/W) */ -#define VR4181_USBRXD1AREG1 __preg16(KSEG1 + 0x0A00062A) /* USB Rx destination 1 address register 1 (R/W) */ -#define VR4181_USBRXD1AREG2 __preg16(KSEG1 + 0x0A00062C) /* USB Rx destination 1 address register 2 (R/W) */ -#define VR4181_USBRXD2AREG1 __preg16(KSEG1 + 0x0A00062E) /* USB Rx destination 2 address register 1 (R/W) */ -#define VR4181_USBRXD2AREG2 __preg16(KSEG1 + 0x0A000630) /* USB Rx destination 2 address register 2 (R/W) */ -#define VR4181_USBTXD1AREG1 __preg16(KSEG1 + 0x0A000632) /* USB Tx destination 1 address register 1 (R/W) */ -#define VR4181_USBTXD1AREG2 __preg16(KSEG1 + 0x0A000634) /* USB Tx destination 1 address register 2 (R/W) */ -#define VR4181_USBTXD2AREG1 __preg16(KSEG1 + 0x0A000636) /* USB Tx destination 2 address register 1 (R/W) */ -#define VR4181_USBTXD2AREG2 __preg16(KSEG1 + 0x0A000638) /* USB Tx destination 2 address register 2 (R/W) */ -#define VR4181_RxRCLENREG __preg16(KSEG1 + 0x0A000652) /* USB Rx record length register (R/W) */ -#define VR4181_TxRCLENREG __preg16(KSEG1 + 0x0A000654) /* USB Tx record length register (R/W) */ -#define VR4181_MICRCLENREG __preg16(KSEG1 + 0x0A000658) /* Microphone record length register (R/W) */ -#define VR4181_SPKRCLENREG __preg16(KSEG1 + 0x0A00065A) /* Speaker record length register (R/W) */ -#define VR4181_USBCFGREG __preg16(KSEG1 + 0x0A00065C) /* USB configuration register (R/W) */ -#define VR4181_MICDMACFGREG __preg16(KSEG1 + 0x0A00065E) /* Microphone DMA configuration register (R/W) */ -#define VR4181_SPKDMACFGREG __preg16(KSEG1 + 0x0A000660) /* Speaker DMA configuration register (R/W) */ -#define VR4181_DMAITRQREG __preg16(KSEG1 + 0x0A000662) /* DMA interrupt request register (R/W) */ -#define VR4181_DMACLTREG __preg16(KSEG1 + 0x0A000664) /* DMA control register (R/W) */ -#define VR4181_DMAITMKREG __preg16(KSEG1 + 0x0A000666) /* DMA interrupt mask register (R/W) */ - -// ISA Bridge -#define VR4181_ISABRGCTL __preg16(KSEG1 + 0x0B0002C0) /* ISA Bridge Control Register (R/W) */ -#define VR4181_ISABRGSTS __preg16(KSEG1 + 0x0B0002C2) /* ISA Bridge Status Register (R/W) */ -#define VR4181_XISACTL __preg16(KSEG1 + 0x0B0002C4) /* External ISA Control Register (R/W) */ - -// Clocked Serial Interface (CSI) -#define VR4181_CSIMODE __preg16(KSEG1 + 0x0B000900) /* CSI Mode Register (R/W) */ -#define VR4181_CSIRXDATA __preg16(KSEG1 + 0x0B000902) /* CSI Receive Data Register (R) */ -#define VR4181_CSITXDATA __preg16(KSEG1 + 0x0B000904) /* CSI Transmit Data Register (R/W) */ -#define VR4181_CSILSTAT __preg16(KSEG1 + 0x0B000906) /* CSI Line Status Register (R/W) */ -#define VR4181_CSIINTMSK __preg16(KSEG1 + 0x0B000908) /* CSI Interrupt Mask Register (R/W) */ -#define VR4181_CSIINTSTAT __preg16(KSEG1 + 0x0B00090a) /* CSI Interrupt Status Register (R/W) */ -#define VR4181_CSITXBLEN __preg16(KSEG1 + 0x0B00090c) /* CSI Transmit Burst Length Register (R/W) */ -#define VR4181_CSIRXBLEN __preg16(KSEG1 + 0x0B00090e) /* CSI Receive Burst Length Register (R/W) */ - -// Interrupt Control Unit (ICU) -#define VR4181_SYSINT1REG __preg16(KSEG1 + 0x0A000080) /* Level 1 System interrupt register 1 (R) */ -#define VR4181_MSYSINT1REG __preg16(KSEG1 + 0x0A00008C) /* Level 1 mask system interrupt register 1 (R/W) */ -#define VR4181_NMIREG __preg16(KSEG1 + 0x0A000098) /* NMI register (R/W) */ -#define VR4181_SOFTINTREG __preg16(KSEG1 + 0x0A00009A) /* Software interrupt register (R/W) */ -#define VR4181_SYSINT2REG __preg16(KSEG1 + 0x0A000200) /* Level 1 System interrupt register 2 (R) */ -#define VR4181_MSYSINT2REG __preg16(KSEG1 + 0x0A000206) /* Level 1 mask system interrupt register 2 (R/W) */ -#define VR4181_PIUINTREGro __preg16(KSEG1 + 0x0B000082) /* Level 2 PIU interrupt register (R) */ -#define VR4181_AIUINTREG __preg16(KSEG1 + 0x0B000084) /* Level 2 AIU interrupt register (R) */ -#define VR4181_MPIUINTREG __preg16(KSEG1 + 0x0B00008E) /* Level 2 mask PIU interrupt register (R/W) */ -#define VR4181_MAIUINTREG __preg16(KSEG1 + 0x0B000090) /* Level 2 mask AIU interrupt register (R/W) */ -#define VR4181_MKIUINTREG __preg16(KSEG1 + 0x0B000092) /* Level 2 mask KIU interrupt register (R/W) */ -#define VR4181_KIUINTREG __preg16(KSEG1 + 0x0B000198) /* Level 2 KIU interrupt register (R) */ - -// Power Management Unit (PMU) -#define VR4181_PMUINTREG __preg16(KSEG1 + 0x0B0000A0) /* PMU Status Register (R/W) */ -#define VR4181_PMUINT_POWERSW 0x1 /* Power switch */ -#define VR4181_PMUINT_BATT 0x2 /* Low batt during normal operation */ -#define VR4181_PMUINT_DEADMAN 0x4 /* Deadman's switch */ -#define VR4181_PMUINT_RESET 0x8 /* Reset switch */ -#define VR4181_PMUINT_RTCRESET 0x10 /* RTC Reset */ -#define VR4181_PMUINT_TIMEOUT 0x20 /* HAL Timer Reset */ -#define VR4181_PMUINT_BATTLOW 0x100 /* Battery low */ -#define VR4181_PMUINT_RTC 0x200 /* RTC Alarm */ -#define VR4181_PMUINT_DCD 0x400 /* DCD# */ -#define VR4181_PMUINT_GPIO0 0x1000 /* GPIO0 */ -#define VR4181_PMUINT_GPIO1 0x2000 /* GPIO1 */ -#define VR4181_PMUINT_GPIO2 0x4000 /* GPIO2 */ -#define VR4181_PMUINT_GPIO3 0x8000 /* GPIO3 */ - -#define VR4181_PMUCNTREG __preg16(KSEG1 + 0x0B0000A2) /* PMU Control Register (R/W) */ -#define VR4181_PMUWAITREG __preg16(KSEG1 + 0x0B0000A8) /* PMU Wait Counter Register (R/W) */ -#define VR4181_PMUDIVREG __preg16(KSEG1 + 0x0B0000AC) /* PMU Divide Mode Register (R/W) */ -#define VR4181_DRAMHIBCTL __preg16(KSEG1 + 0x0B0000B2) /* DRAM Hibernate Control Register (R/W) */ - -// Real Time Clock Unit (RTC) -#define VR4181_ETIMELREG __preg16(KSEG1 + 0x0B0000C0) /* Elapsed Time L Register (R/W) */ -#define VR4181_ETIMEMREG __preg16(KSEG1 + 0x0B0000C2) /* Elapsed Time M Register (R/W) */ -#define VR4181_ETIMEHREG __preg16(KSEG1 + 0x0B0000C4) /* Elapsed Time H Register (R/W) */ -#define VR4181_ECMPLREG __preg16(KSEG1 + 0x0B0000C8) /* Elapsed Compare L Register (R/W) */ -#define VR4181_ECMPMREG __preg16(KSEG1 + 0x0B0000CA) /* Elapsed Compare M Register (R/W) */ -#define VR4181_ECMPHREG __preg16(KSEG1 + 0x0B0000CC) /* Elapsed Compare H Register (R/W) */ -#define VR4181_RTCL1LREG __preg16(KSEG1 + 0x0B0000D0) /* RTC Long 1 L Register (R/W) */ -#define VR4181_RTCL1HREG __preg16(KSEG1 + 0x0B0000D2) /* RTC Long 1 H Register (R/W) */ -#define VR4181_RTCL1CNTLREG __preg16(KSEG1 + 0x0B0000D4) /* RTC Long 1 Count L Register (R) */ -#define VR4181_RTCL1CNTHREG __preg16(KSEG1 + 0x0B0000D6) /* RTC Long 1 Count H Register (R) */ -#define VR4181_RTCL2LREG __preg16(KSEG1 + 0x0B0000D8) /* RTC Long 2 L Register (R/W) */ -#define VR4181_RTCL2HREG __preg16(KSEG1 + 0x0B0000DA) /* RTC Long 2 H Register (R/W) */ -#define VR4181_RTCL2CNTLREG __preg16(KSEG1 + 0x0B0000DC) /* RTC Long 2 Count L Register (R) */ -#define VR4181_RTCL2CNTHREG __preg16(KSEG1 + 0x0B0000DE) /* RTC Long 2 Count H Register (R) */ -#define VR4181_RTCINTREG __preg16(KSEG1 + 0x0B0001DE) /* RTC Interrupt Register (R/W) */ - -// Deadman's Switch Unit (DSU) -#define VR4181_DSUCNTREG __preg16(KSEG1 + 0x0B0000E0) /* DSU Control Register (R/W) */ -#define VR4181_DSUSETREG __preg16(KSEG1 + 0x0B0000E2) /* DSU Dead Time Set Register (R/W) */ -#define VR4181_DSUCLRREG __preg16(KSEG1 + 0x0B0000E4) /* DSU Clear Register (W) */ -#define VR4181_DSUTIMREG __preg16(KSEG1 + 0x0B0000E6) /* DSU Elapsed Time Register (R/W) */ - -// General Purpose I/O Unit (GIU) -#define VR4181_GPMD0REG __preg16(KSEG1 + 0x0B000300) /* GPIO Mode 0 Register (R/W) */ -#define VR4181_GPMD1REG __preg16(KSEG1 + 0x0B000302) /* GPIO Mode 1 Register (R/W) */ -#define VR4181_GPMD2REG __preg16(KSEG1 + 0x0B000304) /* GPIO Mode 2 Register (R/W) */ -#define VR4181_GPMD3REG __preg16(KSEG1 + 0x0B000306) /* GPIO Mode 3 Register (R/W) */ -#define VR4181_GPDATHREG __preg16(KSEG1 + 0x0B000308) /* GPIO Data High Register (R/W) */ -#define VR4181_GPDATHREG_GPIO16 0x0001 -#define VR4181_GPDATHREG_GPIO17 0x0002 -#define VR4181_GPDATHREG_GPIO18 0x0004 -#define VR4181_GPDATHREG_GPIO19 0x0008 -#define VR4181_GPDATHREG_GPIO20 0x0010 -#define VR4181_GPDATHREG_GPIO21 0x0020 -#define VR4181_GPDATHREG_GPIO22 0x0040 -#define VR4181_GPDATHREG_GPIO23 0x0080 -#define VR4181_GPDATHREG_GPIO24 0x0100 -#define VR4181_GPDATHREG_GPIO25 0x0200 -#define VR4181_GPDATHREG_GPIO26 0x0400 -#define VR4181_GPDATHREG_GPIO27 0x0800 -#define VR4181_GPDATHREG_GPIO28 0x1000 -#define VR4181_GPDATHREG_GPIO29 0x2000 -#define VR4181_GPDATHREG_GPIO30 0x4000 -#define VR4181_GPDATHREG_GPIO31 0x8000 -#define VR4181_GPDATLREG __preg16(KSEG1 + 0x0B00030A) /* GPIO Data Low Register (R/W) */ -#define VR4181_GPDATLREG_GPIO0 0x0001 -#define VR4181_GPDATLREG_GPIO1 0x0002 -#define VR4181_GPDATLREG_GPIO2 0x0004 -#define VR4181_GPDATLREG_GPIO3 0x0008 -#define VR4181_GPDATLREG_GPIO4 0x0010 -#define VR4181_GPDATLREG_GPIO5 0x0020 -#define VR4181_GPDATLREG_GPIO6 0x0040 -#define VR4181_GPDATLREG_GPIO7 0x0080 -#define VR4181_GPDATLREG_GPIO8 0x0100 -#define VR4181_GPDATLREG_GPIO9 0x0200 -#define VR4181_GPDATLREG_GPIO10 0x0400 -#define VR4181_GPDATLREG_GPIO11 0x0800 -#define VR4181_GPDATLREG_GPIO12 0x1000 -#define VR4181_GPDATLREG_GPIO13 0x2000 -#define VR4181_GPDATLREG_GPIO14 0x4000 -#define VR4181_GPDATLREG_GPIO15 0x8000 -#define VR4181_GPINTEN __preg16(KSEG1 + 0x0B00030C) /* GPIO Interrupt Enable Register (R/W) */ -#define VR4181_GPINTMSK __preg16(KSEG1 + 0x0B00030E) /* GPIO Interrupt Mask Register (R/W) */ -#define VR4181_GPINTTYPH __preg16(KSEG1 + 0x0B000310) /* GPIO Interrupt Type High Register (R/W) */ -#define VR4181_GPINTTYPL __preg16(KSEG1 + 0x0B000312) /* GPIO Interrupt Type Low Register (R/W) */ -#define VR4181_GPINTSTAT __preg16(KSEG1 + 0x0B000314) /* GPIO Interrupt Status Register (R/W) */ -#define VR4181_GPHIBSTH __preg16(KSEG1 + 0x0B000316) /* GPIO Hibernate Pin State High Register (R/W) */ -#define VR4181_GPHIBSTL __preg16(KSEG1 + 0x0B000318) /* GPIO Hibernate Pin State Low Register (R/W) */ -#define VR4181_GPSICTL __preg16(KSEG1 + 0x0B00031A) /* GPIO Serial Interface Control Register (R/W) */ -#define VR4181_KEYEN __preg16(KSEG1 + 0x0B00031C) /* Keyboard Scan Pin Enable Register (R/W) */ -#define VR4181_PCS0STRA __preg16(KSEG1 + 0x0B000320) /* Programmable Chip Select [0] Start Address Register (R/W) */ -#define VR4181_PCS0STPA __preg16(KSEG1 + 0x0B000322) /* Programmable Chip Select [0] Stop Address Register (R/W) */ -#define VR4181_PCS0HIA __preg16(KSEG1 + 0x0B000324) /* Programmable Chip Select [0] High Address Register (R/W) */ -#define VR4181_PCS1STRA __preg16(KSEG1 + 0x0B000326) /* Programmable Chip Select [1] Start Address Register (R/W) */ -#define VR4181_PCS1STPA __preg16(KSEG1 + 0x0B000328) /* Programmable Chip Select [1] Stop Address Register (R/W) */ -#define VR4181_PCS1HIA __preg16(KSEG1 + 0x0B00032A) /* Programmable Chip Select [1] High Address Register (R/W) */ -#define VR4181_PCSMODE __preg16(KSEG1 + 0x0B00032C) /* Programmable Chip Select Mode Register (R/W) */ -#define VR4181_LCDGPMODE __preg16(KSEG1 + 0x0B00032E) /* LCD General Purpose Mode Register (R/W) */ -#define VR4181_MISCREG0 __preg16(KSEG1 + 0x0B000330) /* Misc. R/W Battery Backed Registers for Non-Volatile Storage (R/W) */ -#define VR4181_MISCREG1 __preg16(KSEG1 + 0x0B000332) /* Misc. R/W Battery Backed Registers for Non-Volatile Storage (R/W) */ -#define VR4181_MISCREG2 __preg16(KSEG1 + 0x0B000334) /* Misc. R/W Battery Backed Registers for Non-Volatile Storage (R/W) */ -#define VR4181_MISCREG3 __preg16(KSEG1 + 0x0B000336) /* Misc. R/W Battery Backed Registers for Non-Volatile Storage (R/W) */ -#define VR4181_MISCREG4 __preg16(KSEG1 + 0x0B000338) /* Misc. R/W Battery Backed Registers for Non-Volatile Storage (R/W) */ -#define VR4181_MISCREG5 __preg16(KSEG1 + 0x0B00033A) /* Misc. R/W Battery Backed Registers for Non-Volatile Storage (R/W) */ -#define VR4181_MISCREG6 __preg16(KSEG1 + 0x0B00033C) /* Misc. R/W Battery Backed Registers for Non-Volatile Storage (R/W) */ -#define VR4181_MISCREG7 __preg16(KSEG1 + 0x0B00033D) /* Misc. R/W Battery Backed Registers for Non-Volatile Storage (R/W) */ -#define VR4181_MISCREG8 __preg16(KSEG1 + 0x0B000340) /* Misc. R/W Battery Backed Registers for Non-Volatile Storage (R/W) */ -#define VR4181_MISCREG9 __preg16(KSEG1 + 0x0B000342) /* Misc. R/W Battery Backed Registers for Non-Volatile Storage (R/W) */ -#define VR4181_MISCREG10 __preg16(KSEG1 + 0x0B000344) /* Misc. R/W Battery Backed Registers for Non-Volatile Storage (R/W) */ -#define VR4181_MISCREG11 __preg16(KSEG1 + 0x0B000346) /* Misc. R/W Battery Backed Registers for Non-Volatile Storage (R/W) */ -#define VR4181_MISCREG12 __preg16(KSEG1 + 0x0B000348) /* Misc. R/W Battery Backed Registers for Non-Volatile Storage (R/W) */ -#define VR4181_MISCREG13 __preg16(KSEG1 + 0x0B00034A) /* Misc. R/W Battery Backed Registers for Non-Volatile Storage (R/W) */ -#define VR4181_MISCREG14 __preg16(KSEG1 + 0x0B00034C) /* Misc. R/W Battery Backed Registers for Non-Volatile Storage (R/W) */ -#define VR4181_MISCREG15 __preg16(KSEG1 + 0x0B00034E) /* Misc. R/W Battery Backed Registers for Non-Volatile Storage (R/W) */ -#define VR4181_SECIRQMASKL VR4181_GPINTEN -// No SECIRQMASKH for VR4181 - -// Touch Panel Interface Unit (PIU) -#define VR4181_PIUCNTREG __preg16(KSEG1 + 0x0B000122) /* PIU Control register (R/W) */ -#define VR4181_PIUCNTREG_PIUSEQEN 0x0004 -#define VR4181_PIUCNTREG_PIUPWR 0x0002 -#define VR4181_PIUCNTREG_PADRST 0x0001 - -#define VR4181_PIUINTREG __preg16(KSEG1 + 0x0B000124) /* PIU Interrupt cause register (R/W) */ -#define VR4181_PIUINTREG_OVP 0x8000 -#define VR4181_PIUINTREG_PADCMD 0x0040 -#define VR4181_PIUINTREG_PADADP 0x0020 -#define VR4181_PIUINTREG_PADPAGE1 0x0010 -#define VR4181_PIUINTREG_PADPAGE0 0x0008 -#define VR4181_PIUINTREG_PADDLOST 0x0004 -#define VR4181_PIUINTREG_PENCHG 0x0001 - -#define VR4181_PIUSIVLREG __preg16(KSEG1 + 0x0B000126) /* PIU Data sampling interval register (R/W) */ -#define VR4181_PIUSTBLREG __preg16(KSEG1 + 0x0B000128) /* PIU A/D converter start delay register (R/W) */ -#define VR4181_PIUCMDREG __preg16(KSEG1 + 0x0B00012A) /* PIU A/D command register (R/W) */ -#define VR4181_PIUASCNREG __preg16(KSEG1 + 0x0B000130) /* PIU A/D port scan register (R/W) */ -#define VR4181_PIUAMSKREG __preg16(KSEG1 + 0x0B000132) /* PIU A/D scan mask register (R/W) */ -#define VR4181_PIUCIVLREG __preg16(KSEG1 + 0x0B00013E) /* PIU Check interval register (R) */ -#define VR4181_PIUPB00REG __preg16(KSEG1 + 0x0B0002A0) /* PIU Page 0 Buffer 0 register (R/W) */ -#define VR4181_PIUPB01REG __preg16(KSEG1 + 0x0B0002A2) /* PIU Page 0 Buffer 1 register (R/W) */ -#define VR4181_PIUPB02REG __preg16(KSEG1 + 0x0B0002A4) /* PIU Page 0 Buffer 2 register (R/W) */ -#define VR4181_PIUPB03REG __preg16(KSEG1 + 0x0B0002A6) /* PIU Page 0 Buffer 3 register (R/W) */ -#define VR4181_PIUPB10REG __preg16(KSEG1 + 0x0B0002A8) /* PIU Page 1 Buffer 0 register (R/W) */ -#define VR4181_PIUPB11REG __preg16(KSEG1 + 0x0B0002AA) /* PIU Page 1 Buffer 1 register (R/W) */ -#define VR4181_PIUPB12REG __preg16(KSEG1 + 0x0B0002AC) /* PIU Page 1 Buffer 2 register (R/W) */ -#define VR4181_PIUPB13REG __preg16(KSEG1 + 0x0B0002AE) /* PIU Page 1 Buffer 3 register (R/W) */ -#define VR4181_PIUAB0REG __preg16(KSEG1 + 0x0B0002B0) /* PIU A/D scan Buffer 0 register (R/W) */ -#define VR4181_PIUAB1REG __preg16(KSEG1 + 0x0B0002B2) /* PIU A/D scan Buffer 1 register (R/W) */ -#define VR4181_PIUAB2REG __preg16(KSEG1 + 0x0B0002B4) /* PIU A/D scan Buffer 2 register (R/W) */ -#define VR4181_PIUAB3REG __preg16(KSEG1 + 0x0B0002B6) /* PIU A/D scan Buffer 3 register (R/W) */ -#define VR4181_PIUPB04REG __preg16(KSEG1 + 0x0B0002BC) /* PIU Page 0 Buffer 4 register (R/W) */ -#define VR4181_PIUPB14REG __preg16(KSEG1 + 0x0B0002BE) /* PIU Page 1 Buffer 4 register (R/W) */ - -// Audio Interface Unit (AIU) -#define VR4181_SODATREG __preg16(KSEG1 + 0x0B000166) /* Speaker Output Data Register (R/W) */ -#define VR4181_SCNTREG __preg16(KSEG1 + 0x0B000168) /* Speaker Output Control Register (R/W) */ -#define VR4181_MIDATREG __preg16(KSEG1 + 0x0B000170) /* Mike Input Data Register (R/W) */ -#define VR4181_MCNTREG __preg16(KSEG1 + 0x0B000172) /* Mike Input Control Register (R/W) */ -#define VR4181_DVALIDREG __preg16(KSEG1 + 0x0B000178) /* Data Valid Register (R/W) */ -#define VR4181_SEQREG __preg16(KSEG1 + 0x0B00017A) /* Sequential Register (R/W) */ -#define VR4181_INTREG __preg16(KSEG1 + 0x0B00017C) /* Interrupt Register (R/W) */ -#define VR4181_SDMADATREG __preg16(KSEG1 + 0x0B000160) /* Speaker DMA Data Register (R/W) */ -#define VR4181_MDMADATREG __preg16(KSEG1 + 0x0B000162) /* Microphone DMA Data Register (R/W) */ -#define VR4181_DAVREF_SETUP __preg16(KSEG1 + 0x0B000164) /* DAC Vref setup register (R/W) */ -#define VR4181_SCNVC_END __preg16(KSEG1 + 0x0B00016E) /* Speaker sample rate control (R/W) */ -#define VR4181_MIDATREG __preg16(KSEG1 + 0x0B000170) /* Microphone Input Data Register (R/W) */ -#define VR4181_MCNTREG __preg16(KSEG1 + 0x0B000172) /* Microphone Input Control Register (R/W) */ -#define VR4181_MCNVC_END __preg16(KSEG1 + 0x0B00017E) /* Microphone sample rate control (R/W) */ - -// Keyboard Interface Unit (KIU) -#define VR4181_KIUDAT0 __preg16(KSEG1 + 0x0B000180) /* KIU Data0 Register (R/W) */ -#define VR4181_KIUDAT1 __preg16(KSEG1 + 0x0B000182) /* KIU Data1 Register (R/W) */ -#define VR4181_KIUDAT2 __preg16(KSEG1 + 0x0B000184) /* KIU Data2 Register (R/W) */ -#define VR4181_KIUDAT3 __preg16(KSEG1 + 0x0B000186) /* KIU Data3 Register (R/W) */ -#define VR4181_KIUDAT4 __preg16(KSEG1 + 0x0B000188) /* KIU Data4 Register (R/W) */ -#define VR4181_KIUDAT5 __preg16(KSEG1 + 0x0B00018A) /* KIU Data5 Register (R/W) */ -#define VR4181_KIUSCANREP __preg16(KSEG1 + 0x0B000190) /* KIU Scan/Repeat Register (R/W) */ -#define VR4181_KIUSCANREP_KEYEN 0x8000 -#define VR4181_KIUSCANREP_SCANSTP 0x0008 -#define VR4181_KIUSCANREP_SCANSTART 0x0004 -#define VR4181_KIUSCANREP_ATSTP 0x0002 -#define VR4181_KIUSCANREP_ATSCAN 0x0001 -#define VR4181_KIUSCANS __preg16(KSEG1 + 0x0B000192) /* KIU Scan Status Register (R) */ -#define VR4181_KIUWKS __preg16(KSEG1 + 0x0B000194) /* KIU Wait Keyscan Stable Register (R/W) */ -#define VR4181_KIUWKI __preg16(KSEG1 + 0x0B000196) /* KIU Wait Keyscan Interval Register (R/W) */ -#define VR4181_KIUINT __preg16(KSEG1 + 0x0B000198) /* KIU Interrupt Register (R/W) */ -#define VR4181_KIUINT_KDATLOST 0x0004 -#define VR4181_KIUINT_KDATRDY 0x0002 -#define VR4181_KIUINT_SCANINT 0x0001 -#define VR4181_KIUDAT6 __preg16(KSEG1 + 0x0B00018C) /* Scan Line 6 Key Data Register (R) */ -#define VR4181_KIUDAT7 __preg16(KSEG1 + 0x0B00018E) /* Scan Line 7 Key Data Register (R) */ - -// CompactFlash Controller -#define VR4181_PCCARDINDEX __preg8(KSEG1 + 0x0B0008E0) /* PC Card Controller Index Register */ -#define VR4181_PCCARDDATA __preg8(KSEG1 + 0x0B0008E1) /* PC Card Controller Data Register */ -#define VR4181_INTSTATREG __preg16(KSEG1 + 0x0B0008F8) /* Interrupt Status Register (R/W) */ -#define VR4181_INTMSKREG __preg16(KSEG1 + 0x0B0008FA) /* Interrupt Mask Register (R/W) */ -#define VR4181_CFG_REG_1 __preg16(KSEG1 + 0x0B0008FE) /* Configuration Register 1 */ - -// LED Control Unit (LED) -#define VR4181_LEDHTSREG __preg16(KSEG1 + 0x0B000240) /* LED H Time Set register (R/W) */ -#define VR4181_LEDLTSREG __preg16(KSEG1 + 0x0B000242) /* LED L Time Set register (R/W) */ -#define VR4181_LEDCNTREG __preg16(KSEG1 + 0x0B000248) /* LED Control register (R/W) */ -#define VR4181_LEDASTCREG __preg16(KSEG1 + 0x0B00024A) /* LED Auto Stop Time Count register (R/W) */ -#define VR4181_LEDINTREG __preg16(KSEG1 + 0x0B00024C) /* LED Interrupt register (R/W) */ - -// Serial Interface Unit (SIU / SIU1 and SIU2) -#define VR4181_SIURB __preg8(KSEG1 + 0x0C000010) /* Receiver Buffer Register (Read) DLAB = 0 (R) */ -#define VR4181_SIUTH __preg8(KSEG1 + 0x0C000010) /* Transmitter Holding Register (Write) DLAB = 0 (W) */ -#define VR4181_SIUDLL __preg8(KSEG1 + 0x0C000010) /* Divisor Latch (Least Significant Byte) DLAB = 1 (R/W) */ -#define VR4181_SIUIE __preg8(KSEG1 + 0x0C000011) /* Interrupt Enable DLAB = 0 (R/W) */ -#define VR4181_SIUDLM __preg8(KSEG1 + 0x0C000011) /* Divisor Latch (Most Significant Byte) DLAB = 1 (R/W) */ -#define VR4181_SIUIID __preg8(KSEG1 + 0x0C000012) /* Interrupt Identification Register (Read) (R) */ -#define VR4181_SIUFC __preg8(KSEG1 + 0x0C000012) /* FIFO Control Register (Write) (W) */ -#define VR4181_SIULC __preg8(KSEG1 + 0x0C000013) /* Line Control Register (R/W) */ -#define VR4181_SIUMC __preg8(KSEG1 + 0x0C000014) /* MODEM Control Register (R/W) */ -#define VR4181_SIULS __preg8(KSEG1 + 0x0C000015) /* Line Status Register (R/W) */ -#define VR4181_SIUMS __preg8(KSEG1 + 0x0C000016) /* MODEM Status Register (R/W) */ -#define VR4181_SIUSC __preg8(KSEG1 + 0x0C000017) /* Scratch Register (R/W) */ -#define VR4181_SIURESET __preg8(KSEG1 + 0x0C000019) /* SIU Reset Register (R/W) */ -#define VR4181_SIUACTMSK __preg8(KSEG1 + 0x0C00001C) /* SIU Activity Mask (R/W) */ -#define VR4181_SIUACTTMR __preg8(KSEG1 + 0x0C00001E) /* SIU Activity Timer (R/W) */ -#define VR4181_SIURB_2 __preg8(KSEG1 + 0x0C000000) /* Receive Buffer Register (Read) (R) */ -#define VR4181_SIUTH_2 __preg8(KSEG1 + 0x0C000000) /* Transmitter Holding Register (Write) (W) */ -#define VR4181_SIUDLL_2 __preg8(KSEG1 + 0x0C000000) /* Divisor Latch (Least Significant Byte) (R/W) */ -#define VR4181_SIUIE_2 __preg8(KSEG1 + 0x0C000001) /* Interrupt Enable (DLAB = 0) (R/W) */ -#define VR4181_SIUDLM_2 __preg8(KSEG1 + 0x0C000001) /* Divisor Latch (Most Significant Byte) (DLAB = 1) (R/W) */ -#define VR4181_SIUIID_2 __preg8(KSEG1 + 0x0C000002) /* Interrupt Identification Register (Read) (R) */ -#define VR4181_SIUFC_2 __preg8(KSEG1 + 0x0C000002) /* FIFO Control Register (Write) (W) */ -#define VR4181_SIULC_2 __preg8(KSEG1 + 0x0C000003) /* Line Control Register (R/W) */ -#define VR4181_SIUMC_2 __preg8(KSEG1 + 0x0C000004) /* Modem Control Register (R/W) */ -#define VR4181_SIULS_2 __preg8(KSEG1 + 0x0C000005) /* Line Status Register (R/W) */ -#define VR4181_SIUMS_2 __preg8(KSEG1 + 0x0C000006) /* Modem Status Register (R/W) */ -#define VR4181_SIUSC_2 __preg8(KSEG1 + 0x0C000007) /* Scratch Register (R/W) */ -#define VR4181_SIUIRSEL_2 __preg8(KSEG1 + 0x0C000008) /* SIU IrDA Selectot (R/W) */ -#define VR4181_SIURESET_2 __preg8(KSEG1 + 0x0C000009) /* SIU Reset Register (R/W) */ -#define VR4181_SIUCSEL_2 __preg8(KSEG1 + 0x0C00000A) /* IrDA Echo-back Control (R/W) */ -#define VR4181_SIUACTMSK_2 __preg8(KSEG1 + 0x0C00000C) /* SIU Activity Mask Register (R/W) */ -#define VR4181_SIUACTTMR_2 __preg8(KSEG1 + 0x0C00000E) /* SIU Activity Timer Register (R/W) */ - - -// USB Module -#define VR4181_USBINFIFO __preg16(KSEG1 + 0x0B000780) /* USB Bulk Input FIFO (Bulk In End Point) (W) */ -#define VR4181_USBOUTFIFO __preg16(KSEG1 + 0x0B000782) /* USB Bulk Output FIFO (Bulk Out End Point) (R) */ -#define VR4181_USBCTLFIFO __preg16(KSEG1 + 0x0B000784) /* USB Control FIFO (Control End Point) (W) */ -#define VR4181_USBSTAT __preg16(KSEG1 + 0x0B000786) /* Interrupt Status Register (R/W) */ -#define VR4181_USBINTMSK __preg16(KSEG1 + 0x0B000788) /* Interrupt Mask Register (R/W) */ -#define VR4181_USBCTLREG __preg16(KSEG1 + 0x0B00078A) /* Control Register (R/W) */ -#define VR4181_USBSTPREG __preg16(KSEG1 + 0x0B00078C) /* USB Transfer Stop Register (R/W) */ - -// LCD Controller -#define VR4181_HRTOTALREG __preg16(KSEG1 + 0x0A000400) /* Horizontal total Register (R/W) */ -#define VR4181_HRVISIBREG __preg16(KSEG1 + 0x0A000402) /* Horizontal Visible Register (R/W) */ -#define VR4181_LDCLKSTREG __preg16(KSEG1 + 0x0A000404) /* Load clock start Register (R/W) */ -#define VR4181_LDCLKNDREG __preg16(KSEG1 + 0x0A000406) /* Load clock end Register (R/W) */ -#define VR4181_VRTOTALREG __preg16(KSEG1 + 0x0A000408) /* Vertical Total Register (R/W) */ -#define VR4181_VRVISIBREG __preg16(KSEG1 + 0x0A00040A) /* Vertical Visible Register (R/W) */ -#define VR4181_FVSTARTREG __preg16(KSEG1 + 0x0A00040C) /* FLM vertical start Register (R/W) */ -#define VR4181_FVENDREG __preg16(KSEG1 + 0x0A00040E) /* FLM vertical end Register (R/W) */ -#define VR4181_LCDCTRLREG __preg16(KSEG1 + 0x0A000410) /* LCD control Register (R/W) */ -#define VR4181_LCDINRQREG __preg16(KSEG1 + 0x0A000412) /* LCD Interrupt request Register (R/W) */ -#define VR4181_LCDCFGREG0 __preg16(KSEG1 + 0x0A000414) /* LCD Configuration Register 0 (R/W) */ -#define VR4181_LCDCFGREG1 __preg16(KSEG1 + 0x0A000416) /* LCD Configuration Register 1 (R/W) */ -#define VR4181_FBSTAD1REG __preg16(KSEG1 + 0x0A000418) /* Frame Buffer Start Address 1 Register (R/W) */ -#define VR4181_FBSTAD2REG __preg16(KSEG1 + 0x0A00041A) /* Frame Buffer Start Address 2 Register (R/W) */ -#define VR4181_FBNDAD1REG __preg16(KSEG1 + 0x0A000420) /* Frame Buffer End Address 1 Register (R/W) */ -#define VR4181_FBNDAD2REG __preg16(KSEG1 + 0x0A000422) /* Frame Buffer End Address 2 register (R/W) */ -#define VR4181_FHSTARTREG __preg16(KSEG1 + 0x0A000424) /* FLM horizontal Start Register (R/W) */ -#define VR4181_FHENDREG __preg16(KSEG1 + 0x0A000426) /* FLM horizontal End Register (R/W) */ -#define VR4181_PWRCONREG1 __preg16(KSEG1 + 0x0A000430) /* Power Control register 1 (R/W) */ -#define VR4181_PWRCONREG2 __preg16(KSEG1 + 0x0A000432) /* Power Control register 2 (R/W) */ -#define VR4181_LCDIMSKREG __preg16(KSEG1 + 0x0A000434) /* LCD Interrupt Mask register (R/W) */ -#define VR4181_CPINDCTREG __preg16(KSEG1 + 0x0A00047E) /* Color palette Index and control Register (R/W) */ -#define VR4181_CPALDATREG __preg32(KSEG1 + 0x0A000480) /* Color palette data register (32bits Register) (R/W) */ - -// physical address spaces -#define VR4181_LCD 0x0a000000 -#define VR4181_INTERNAL_IO_2 0x0b000000 -#define VR4181_INTERNAL_IO_1 0x0c000000 -#define VR4181_ISA_MEM 0x10000000 -#define VR4181_ISA_IO 0x14000000 -#define VR4181_ROM 0x18000000 - -// This is the base address for IO port decoding to which the 16 bit IO port address -// is added. Defining it to 0 will usually cause a kernel oops any time port IO is -// attempted, which can be handy for turning up parts of the kernel that make -// incorrect architecture assumptions (by assuming that everything acts like a PC), -// but we need it correctly defined to use the PCMCIA/CF controller: -#define VR4181_PORT_BASE (KSEG1 + VR4181_ISA_IO) -#define VR4181_ISAMEM_BASE (KSEG1 + VR4181_ISA_MEM) - -#endif /* __ASM_VR4181_VR4181_H */ -- cgit v1.2.3-70-g09d2 From 003b54925e2ac78306f74ac433126ad5de387f7a Mon Sep 17 00:00:00 2001 From: Ralf Baechle Date: Sat, 3 Sep 2005 15:56:08 -0700 Subject: [PATCH] mips: remove HP Laserjet remains Remove the one file which managed to survive the removel of HP Laserjet support. Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- include/asm-mips/hp-lj/asic.h | 7 ------- 1 file changed, 7 deletions(-) delete mode 100644 include/asm-mips/hp-lj/asic.h (limited to 'include') diff --git a/include/asm-mips/hp-lj/asic.h b/include/asm-mips/hp-lj/asic.h deleted file mode 100644 index fc2ca656da0..00000000000 --- a/include/asm-mips/hp-lj/asic.h +++ /dev/null @@ -1,7 +0,0 @@ - -typedef enum { IllegalAsic, UnknownAsic, AndrosAsic, HarmonyAsic } AsicId; - -AsicId GetAsicId(void); - -const char* const GetAsicName(void); - -- cgit v1.2.3-70-g09d2 From af690a948cc545d1eca19acab23016b96e178dcf Mon Sep 17 00:00:00 2001 From: Ralf Baechle Date: Sat, 3 Sep 2005 15:56:09 -0700 Subject: [PATCH] DEC PMAG BA frame buffer update Rewrite PMAG BA frame buffer driver for 2.6. Acked-by: Antonino Daplas Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/video/pmag-ba-fb.c | 285 +++++++++++++++++++++++++++++---------------- include/video/pmag-ba-fb.h | 41 ++++--- 2 files changed, 205 insertions(+), 121 deletions(-) (limited to 'include') diff --git a/drivers/video/pmag-ba-fb.c b/drivers/video/pmag-ba-fb.c index f8095588e99..c98f1c8d7dc 100644 --- a/drivers/video/pmag-ba-fb.c +++ b/drivers/video/pmag-ba-fb.c @@ -1,57 +1,55 @@ /* - * linux/drivers/video/pmag-ba-fb.c + * linux/drivers/video/pmag-ba-fb.c * - * PMAG-BA TurboChannel framebuffer card support ... derived from: + * PMAG-BA TURBOchannel Color Frame Buffer (CFB) card support, + * derived from: * "HP300 Topcat framebuffer support (derived from macfb of all things) * Phil Blundell 1998", the original code can be - * found in the file hpfb.c in the same directory. + * found in the file hpfb.c in the same directory. * * Based on digital document: * "PMAG-BA TURBOchannel Color Frame Buffer * Functional Specification", Revision 1.2, August 27, 1990 * - * DECstation related code Copyright (C) 1999, 2000, 2001 by - * Michael Engel , - * Karsten Merker and + * DECstation related code Copyright (C) 1999, 2000, 2001 by + * Michael Engel , + * Karsten Merker and * Harald Koerfgen. - * This file is subject to the terms and conditions of the GNU General - * Public License. See the file COPYING in the main directory of this - * archive for more details. + * Copyright (c) 2005 Maciej W. Rozycki * + * This file is subject to the terms and conditions of the GNU General + * Public License. See the file COPYING in the main directory of this + * archive for more details. */ -#include -#include -#include + +#include #include -#include -#include -#include -#include -#include -#include -#include #include -#include -#include +#include +#include +#include +#include + +#include +#include +#include + #include + #include