Subversion Repositories shark

Compare Revisions

Ignore whitespace Rev 433 → Rev 434

/shark/trunk/drivers/linuxc26/include/media/id.h
0,0 → 1,35
/* FIXME: this temporarely, until these are included in linux/i2c-id.h */
 
/* drivers */
#ifndef I2C_DRIVERID_TVMIXER
# define I2C_DRIVERID_TVMIXER I2C_DRIVERID_EXP0
#endif
#ifndef I2C_DRIVERID_TVAUDIO
# define I2C_DRIVERID_TVAUDIO I2C_DRIVERID_EXP1
#endif
 
/* chips */
#ifndef I2C_DRIVERID_DPL3518
# define I2C_DRIVERID_DPL3518 I2C_DRIVERID_EXP2
#endif
#ifndef I2C_DRIVERID_TDA9873
# define I2C_DRIVERID_TDA9873 I2C_DRIVERID_EXP3
#endif
#ifndef I2C_DRIVERID_TDA9875
# define I2C_DRIVERID_TDA9875 I2C_DRIVERID_EXP0+4
#endif
#ifndef I2C_DRIVERID_PIC16C54_PV951
# define I2C_DRIVERID_PIC16C54_PV951 I2C_DRIVERID_EXP0+5
#endif
#ifndef I2C_DRIVERID_TDA7432
# define I2C_DRIVERID_TDA7432 I2C_DRIVERID_EXP0+6
#endif
#ifndef I2C_DRIVERID_TDA9874
# define I2C_DRIVERID_TDA9874 I2C_DRIVERID_EXP0+7
#endif
 
/* algorithms */
#ifndef I2C_ALGO_SAA7134
# define I2C_ALGO_SAA7134 0x090000
#endif
 
/shark/trunk/drivers/linuxc26/include/media/tuner.h
0,0 → 1,95
/*
tuner.h - definition for different tuners
 
Copyright (C) 1997 Markus Schroeder (schroedm@uni-duesseldorf.de)
minor modifications by Ralph Metzler (rjkm@thp.uni-koeln.de)
 
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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
 
#ifndef _TUNER_H
#define _TUNER_H
 
#include "id.h"
 
#define TUNER_TEMIC_PAL 0 /* 4002 FH5 (3X 7756, 9483) */
#define TUNER_PHILIPS_PAL_I 1
#define TUNER_PHILIPS_NTSC 2
#define TUNER_PHILIPS_SECAM 3 /* you must actively select B/G, L, L` */
#define TUNER_ABSENT 4
#define TUNER_PHILIPS_PAL 5
#define TUNER_TEMIC_NTSC 6 /* 4032 FY5 (3X 7004, 9498, 9789) */
#define TUNER_TEMIC_PAL_I 7 /* 4062 FY5 (3X 8501, 9957) */
#define TUNER_TEMIC_4036FY5_NTSC 8 /* 4036 FY5 (3X 1223, 1981, 7686) */
#define TUNER_ALPS_TSBH1_NTSC 9
#define TUNER_ALPS_TSBE1_PAL 10
#define TUNER_ALPS_TSBB5_PAL_I 11
#define TUNER_ALPS_TSBE5_PAL 12
#define TUNER_ALPS_TSBC5_PAL 13
#define TUNER_TEMIC_4006FH5_PAL 14 /* 4006 FH5 (3X 9500, 9501, 7291) */
#define TUNER_ALPS_TSHC6_NTSC 15
#define TUNER_TEMIC_PAL_DK 16 /* 4016 FY5 (3X 1392, 1393) */
#define TUNER_PHILIPS_NTSC_M 17
#define TUNER_TEMIC_4066FY5_PAL_I 18 /* 4066 FY5 (3X 7032, 7035) */
#define TUNER_TEMIC_4006FN5_MULTI_PAL 19 /* B/G, I and D/K autodetected (3X 7595, 7606, 7657)*/
#define TUNER_TEMIC_4009FR5_PAL 20 /* incl. FM radio (3X 7607, 7488, 7711)*/
#define TUNER_TEMIC_4039FR5_NTSC 21 /* incl. FM radio (3X 7246, 7578, 7732)*/
#define TUNER_TEMIC_4046FM5 22 /* you must actively select B/G, D/K, I, L, L` ! (3X 7804, 7806, 8103, 8104)*/
#define TUNER_PHILIPS_PAL_DK 23
#define TUNER_PHILIPS_FQ1216ME 24 /* you must actively select B/G/D/K, I, L, L` */
#define TUNER_LG_PAL_I_FM 25
#define TUNER_LG_PAL_I 26
#define TUNER_LG_NTSC_FM 27
#define TUNER_LG_PAL_FM 28
#define TUNER_LG_PAL 29
#define TUNER_TEMIC_4009FN5_MULTI_PAL_FM 30 /* B/G, I and D/K autodetected (3X 8155, 8160, 8163)*/
#define TUNER_SHARP_2U5JF5540_NTSC 31
#define TUNER_Samsung_PAL_TCPM9091PD27 32
#define TUNER_MT2032 33
#define TUNER_TEMIC_4106FH5 34 /* 4106 FH5 (3X 7808, 7865)*/
#define TUNER_TEMIC_4012FY5 35 /* 4012 FY5 (3X 0971, 1099)*/
#define TUNER_TEMIC_4136FY5 36 /* 4136 FY5 (3X 7708, 7746)*/
#define TUNER_LG_PAL_NEW_TAPC 37
#define TUNER_PHILIPS_FM1216ME_MK3 38
#define TUNER_LG_NTSC_NEW_TAPC 39
#define TUNER_HITACHI_NTSC 40
 
 
 
#define NOTUNER 0
#define PAL 1 /* PAL_BG */
#define PAL_I 2
#define NTSC 3
#define SECAM 4
 
#define NoTuner 0
#define Philips 1
#define TEMIC 2
#define Sony 3
#define Alps 4
#define LGINNOTEK 5
#define SHARP 6
#define Samsung 7
#define Microtune 8
#define HITACHI 9
 
#define TUNER_SET_TYPE _IOW('t',1,int) /* set tuner type */
#define TUNER_SET_TVFREQ _IOW('t',2,int) /* set tv freq */
#if 0 /* obsolete */
# define TUNER_SET_RADIOFREQ _IOW('t',3,int) /* set radio freq */
# define TUNER_SET_MODE _IOW('t',4,int) /* set tuner mode */
#endif
 
#endif
/shark/trunk/drivers/linuxc26/include/media/video-buf.h
0,0 → 1,244
/*
* generic helper functions for video4linux capture buffers, to handle
* memory management and PCI DMA. Right now bttv + saa7134 use it.
*
* The functions expect the hardware being able to scatter gatter
* (i.e. the buffers are not linear in physical memory, but fragmented
* into PAGE_SIZE chunks). They also assume the driver does not need
* to touch the video data (thus it is probably not useful for USB as
* data often must be uncompressed by the drivers).
*
* (c) 2001,02 Gerd Knorr <kraxel@bytesex.org>
*
* 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 <linux/videodev.h>
 
/* --------------------------------------------------------------------- */
 
/*
* Return a scatterlist for some page-aligned vmalloc()'ed memory
* block (NULL on errors). Memory for the scatterlist is allocated
* using kmalloc. The caller must free the memory.
*/
struct scatterlist* videobuf_vmalloc_to_sg(unsigned char *virt, int nr_pages);
 
/*
* Return a scatterlist for a an array of userpages (NULL on errors).
* Memory for the scatterlist is allocated using kmalloc. The caller
* must free the memory.
*/
struct scatterlist* videobuf_pages_to_sg(struct page **pages, int nr_pages,
int offset);
int videobuf_lock(struct page **pages, int nr_pages);
int videobuf_unlock(struct page **pages, int nr_pages);
 
/* --------------------------------------------------------------------- */
 
/*
* A small set of helper functions to manage buffers (both userland
* and kernel) for DMA.
*
* videobuf_dma_init_*()
* creates a buffer. The userland version takes a userspace
* pointer + length. The kernel version just wants the size and
* does memory allocation too using vmalloc_32().
*
* videobuf_dma_pci_*()
* see Documentation/DMA-mapping.txt, these functions to
* basically the same. The map function does also build a
* scatterlist for the buffer (and unmap frees it ...)
*
* videobuf_dma_free()
* no comment ...
*
*/
 
struct videobuf_dmabuf {
/* for userland buffer */
int offset;
struct page **pages;
 
/* for kernel buffers */
void *vmalloc;
 
/* for overlay buffers (pci-pci dma) */
dma_addr_t bus_addr;
 
/* common */
struct scatterlist *sglist;
int sglen;
int nr_pages;
int direction;
};
 
int videobuf_dma_init_user(struct videobuf_dmabuf *dma, int direction,
unsigned long data, unsigned long size);
int videobuf_dma_init_kernel(struct videobuf_dmabuf *dma, int direction,
int nr_pages);
int videobuf_dma_init_overlay(struct videobuf_dmabuf *dma, int direction,
dma_addr_t addr, int nr_pages);
int videobuf_dma_pci_map(struct pci_dev *dev, struct videobuf_dmabuf *dma);
int videobuf_dma_pci_sync(struct pci_dev *dev,
struct videobuf_dmabuf *dma);
int videobuf_dma_pci_unmap(struct pci_dev *dev, struct videobuf_dmabuf *dma);
int videobuf_dma_free(struct videobuf_dmabuf *dma);
 
/* --------------------------------------------------------------------- */
 
/*
* A small set of helper functions to manage video4linux buffers.
*
* struct videobuf_buffer holds the data structures used by the helper
* functions, additionally some commonly used fields for v4l buffers
* (width, height, lists, waitqueue) are in there. That struct should
* be used as first element in the drivers buffer struct.
*
* about the mmap helpers (videobuf_mmap_*):
*
* The mmaper function allows to map any subset of contingous buffers.
* This includes one mmap() call for all buffers (which the original
* video4linux API uses) as well as one mmap() for every single buffer
* (which v4l2 uses).
*
* If there is a valid mapping for a buffer, buffer->baddr/bsize holds
* userspace address + size which can be feeded into the
* videobuf_dma_init_user function listed above.
*
*/
 
struct videobuf_buffer;
struct videobuf_queue;
 
struct videobuf_mapping {
unsigned int count;
int highmem_ok;
unsigned long start;
unsigned long end;
struct videobuf_queue *q;
};
 
enum videobuf_state {
STATE_NEEDS_INIT = 0,
STATE_PREPARED = 1,
STATE_QUEUED = 2,
STATE_ACTIVE = 3,
STATE_DONE = 4,
STATE_ERROR = 5,
STATE_IDLE = 6,
};
 
struct videobuf_buffer {
unsigned int i;
 
/* info about the buffer */
unsigned int width;
unsigned int height;
unsigned int bytesperline; /* use only if != 0 */
unsigned long size;
enum v4l2_field field;
enum videobuf_state state;
struct videobuf_dmabuf dma;
struct list_head stream; /* QBUF/DQBUF list */
 
/* for mmap'ed buffers */
enum v4l2_memory memory;
size_t boff; /* buffer offset (mmap + overlay) */
size_t bsize; /* buffer size */
unsigned long baddr; /* buffer addr (userland ptr!) */
struct videobuf_mapping *map;
 
/* touched by irq handler */
struct list_head queue;
wait_queue_head_t done;
unsigned int field_count;
struct timeval ts;
};
 
struct videobuf_queue_ops {
int (*buf_setup)(struct file *file,
unsigned int *count, unsigned int *size);
int (*buf_prepare)(struct file *file,struct videobuf_buffer *vb,
enum v4l2_field field);
void (*buf_queue)(struct file *file,struct videobuf_buffer *vb);
void (*buf_release)(struct file *file,struct videobuf_buffer *vb);
};
 
struct videobuf_queue {
struct semaphore lock;
spinlock_t *irqlock;
struct pci_dev *pci;
 
enum v4l2_buf_type type;
unsigned int msize;
enum v4l2_field field;
enum v4l2_field last; /* for field=V4L2_FIELD_ALTERNATE */
struct videobuf_buffer *bufs[VIDEO_MAX_FRAME];
struct videobuf_queue_ops *ops;
 
/* capture via mmap() + ioctl(QBUF/DQBUF) */
unsigned int streaming;
struct list_head stream;
 
/* capture via read() */
unsigned int reading;
unsigned int read_off;
struct videobuf_buffer *read_buf;
};
 
void* videobuf_alloc(unsigned int size);
int videobuf_waiton(struct videobuf_buffer *vb, int non_blocking, int intr);
int videobuf_iolock(struct pci_dev *pci, struct videobuf_buffer *vb,
struct v4l2_framebuffer *fbuf);
 
void videobuf_queue_init(struct videobuf_queue *q,
struct videobuf_queue_ops *ops,
struct pci_dev *pci, spinlock_t *irqlock,
enum v4l2_buf_type type,
enum v4l2_field field,
unsigned int msize);
int videobuf_queue_is_busy(struct videobuf_queue *q);
void videobuf_queue_cancel(struct file *file, struct videobuf_queue *q);
 
enum v4l2_field videobuf_next_field(struct videobuf_queue *q);
void videobuf_status(struct v4l2_buffer *b, struct videobuf_buffer *vb,
enum v4l2_buf_type type);
int videobuf_reqbufs(struct file *file, struct videobuf_queue *q,
struct v4l2_requestbuffers *req);
int videobuf_querybuf(struct videobuf_queue *q, struct v4l2_buffer *b);
int videobuf_qbuf(struct file *file, struct videobuf_queue *q,
struct v4l2_buffer *b);
int videobuf_dqbuf(struct file *file, struct videobuf_queue *q,
struct v4l2_buffer *b);
int videobuf_streamon(struct file *file, struct videobuf_queue *q);
int videobuf_streamoff(struct file *file, struct videobuf_queue *q);
 
int videobuf_read_start(struct file *file, struct videobuf_queue *q);
void videobuf_read_stop(struct file *file, struct videobuf_queue *q);
ssize_t videobuf_read_stream(struct file *file, struct videobuf_queue *q,
char *data, size_t count, loff_t *ppos,
int vbihack);
ssize_t videobuf_read_one(struct file *file, struct videobuf_queue *q,
char *data, size_t count, loff_t *ppos);
unsigned int videobuf_poll_stream(struct file *file,
struct videobuf_queue *q,
poll_table *wait);
 
int videobuf_mmap_setup(struct file *file, struct videobuf_queue *q,
unsigned int bcount, unsigned int bsize,
enum v4l2_memory memory);
int videobuf_mmap_free(struct file *file, struct videobuf_queue *q);
int videobuf_mmap_mapper(struct vm_area_struct *vma,
struct videobuf_queue *q);
 
/* --------------------------------------------------------------------- */
 
/*
* Local variables:
* c-basic-offset: 8
* End:
*/
/shark/trunk/drivers/linuxc26/include/media/saa7146_vv.h
0,0 → 1,252
#ifndef __SAA7146_VV__
#define __SAA7146_VV__
 
#include <linux/videodev2.h>
 
#include <media/saa7146.h>
#include <media/video-buf.h>
 
#define MAX_SAA7146_CAPTURE_BUFFERS 32 /* arbitrary */
#define BUFFER_TIMEOUT (HZ/2) /* 0.5 seconds */
 
#define WRITE_RPS0(x) do { \
dev->d_rps0.cpu_addr[ count++ ] = cpu_to_le32(x); \
} while (0);
 
#define WRITE_RPS1(x) do { \
dev->d_rps1.cpu_addr[ count++ ] = cpu_to_le32(x); \
} while (0);
 
struct saa7146_video_dma {
u32 base_odd;
u32 base_even;
u32 prot_addr;
u32 pitch;
u32 base_page;
u32 num_line_byte;
};
 
struct saa7146_format {
char *name;
int pixelformat;
u32 trans;
u8 depth;
int swap;
};
 
struct saa7146_standard
{
char *name;
v4l2_std_id id;
 
int v_offset; /* number of lines of vertical offset before processing */
int v_field; /* number of lines in a field for HPS to process */
int v_calc; /* number of vertical active lines */
int h_offset; /* horizontal offset of processing window */
int h_pixels; /* number of horizontal pixels to process */
int h_calc; /* number of horizontal active pixels */
int v_max_out;
int h_max_out;
};
 
/* buffer for one video/vbi frame */
struct saa7146_buf {
/* common v4l buffer stuff -- must be first */
struct videobuf_buffer vb;
 
/* saa7146 specific */
struct v4l2_pix_format *fmt;
int (*activate)(struct saa7146_dev *dev,
struct saa7146_buf *buf,
struct saa7146_buf *next);
 
/* page tables */
struct saa7146_pgtable pt[3];
};
 
struct saa7146_dmaqueue {
struct saa7146_dev *dev;
struct saa7146_buf *curr;
struct list_head queue;
struct timer_list timeout;
};
 
struct saa7146_overlay {
struct saa7146_fh *fh;
struct v4l2_window win;
struct v4l2_clip clips[16];
int nclips;
};
 
/* per open data */
struct saa7146_fh {
struct saa7146_dev *dev;
/* if this is a vbi or capture open */
enum v4l2_buf_type type;
 
/* video overlay */
struct saa7146_overlay ov;
/* video capture */
struct videobuf_queue video_q;
struct v4l2_pix_format video_fmt;
 
/* vbi capture */
struct videobuf_queue vbi_q;
struct v4l2_vbi_format vbi_fmt;
struct timer_list vbi_read_timeout;
};
 
struct saa7146_vv
{
int vbi_minor;
 
/* vbi capture */
struct saa7146_dmaqueue vbi_q;
/* vbi workaround interrupt queue */
wait_queue_head_t vbi_wq;
int vbi_fieldcount;
struct saa7146_fh *vbi_streaming;
 
int video_minor;
 
/* video overlay */
struct v4l2_framebuffer ov_fb;
struct saa7146_format *ov_fmt;
struct saa7146_overlay *ov_data;
 
/* video capture */
struct saa7146_dmaqueue video_q;
struct saa7146_fh *streaming;
enum v4l2_field last_field;
 
/* common: fixme? shouldn't this be in saa7146_fh?
(this leads to a more complicated question: shall the driver
store the different settings (for example S_INPUT) for every open
and restore it appropriately, or should all settings be common for
all opens? currently, we do the latter, like all other
drivers do... */
struct saa7146_standard *standard;
int vflip;
int hflip;
int current_hps_source;
int current_hps_sync;
 
struct saa7146_dma d_clipping; /* pointer to clipping memory */
};
 
#define SAA7146_EXCLUSIVE 0x1
#define SAA7146_BEFORE 0x2
#define SAA7146_AFTER 0x4
 
struct saa7146_extension_ioctls
{
unsigned int cmd;
int flags;
};
 
/* flags */
#define SAA7146_EXT_SWAP_ODD_EVEN 0x1 /* needs odd/even fields swapped */
#define SAA7146_USE_PORT_B_FOR_VBI 0x2 /* use input port b for vbi hardware bug workaround */
 
struct saa7146_ext_vv
{
/* informations about the video capabilities of the device */
int inputs;
int audios;
u32 capabilities;
int flags;
 
/* additionally supported transmission standards */
struct saa7146_standard *stds;
int num_stds;
int (*std_callback)(struct saa7146_dev*, struct saa7146_standard *);
struct saa7146_extension_ioctls *ioctls;
int (*ioctl)(struct saa7146_fh*, unsigned int cmd, void *arg);
};
 
struct saa7146_use_ops {
void (*init)(struct saa7146_dev *, struct saa7146_vv *);
void(*open)(struct saa7146_dev *, struct saa7146_fh *);
void (*release)(struct saa7146_dev *, struct saa7146_fh *,struct file *);
void (*irq_done)(struct saa7146_dev *, unsigned long status);
ssize_t (*read)(struct file *, char *, size_t, loff_t *);
int (*capture_begin)(struct saa7146_fh *);
int (*capture_end)(struct saa7146_fh *);
};
 
/* from saa7146_fops.c */
int saa7146_register_device(struct video_device *vid, struct saa7146_dev* dev, char *name, int type);
int saa7146_unregister_device(struct video_device *vid, struct saa7146_dev* dev);
void saa7146_buffer_finish(struct saa7146_dev *dev, struct saa7146_dmaqueue *q, int state);
void saa7146_buffer_next(struct saa7146_dev *dev, struct saa7146_dmaqueue *q,int vbi);
int saa7146_buffer_queue(struct saa7146_dev *dev, struct saa7146_dmaqueue *q, struct saa7146_buf *buf);
void saa7146_buffer_timeout(unsigned long data);
void saa7146_dma_free(struct saa7146_dev *dev,struct saa7146_buf *buf);
 
int saa7146_vv_init(struct saa7146_dev* dev, struct saa7146_ext_vv *ext_vv);
int saa7146_vv_release(struct saa7146_dev* dev);
 
 
/* from saa7146_hlp.c */
void saa7146_set_overlay(struct saa7146_dev *dev, struct saa7146_fh *fh, int v);
void saa7146_set_capture(struct saa7146_dev *dev, struct saa7146_buf *buf, struct saa7146_buf *next);
void saa7146_write_out_dma(struct saa7146_dev* dev, int which, struct saa7146_video_dma* vdma) ;
void saa7146_set_hps_source_and_sync(struct saa7146_dev *saa, int source, int sync);
void saa7146_set_gpio(struct saa7146_dev *saa, u8 pin, u8 data);
 
/* from saa7146_video.c */
extern struct saa7146_use_ops saa7146_video_uops;
int saa7146_start_preview(struct saa7146_fh *fh);
int saa7146_stop_preview(struct saa7146_fh *fh);
 
/* from saa7146_vbi.c */
extern struct saa7146_use_ops saa7146_vbi_uops;
 
/* saa7146 source inputs */
#define SAA7146_HPS_SOURCE_PORT_A 0x00
#define SAA7146_HPS_SOURCE_PORT_B 0x01
#define SAA7146_HPS_SOURCE_YPB_CPA 0x02
#define SAA7146_HPS_SOURCE_YPA_CPB 0x03
 
/* sync inputs */
#define SAA7146_HPS_SYNC_PORT_A 0x00
#define SAA7146_HPS_SYNC_PORT_B 0x01
 
/* some memory sizes */
#define SAA7146_CLIPPING_MEM (14*PAGE_SIZE)
 
/* some defines for the various clipping-modes */
#define SAA7146_CLIPPING_RECT 0x4
#define SAA7146_CLIPPING_RECT_INVERTED 0x5
#define SAA7146_CLIPPING_MASK 0x6
#define SAA7146_CLIPPING_MASK_INVERTED 0x7
 
/* output formats: each entry holds four informations */
#define RGB08_COMPOSED 0x0217 /* composed is used in the sense of "not-planar" */
/* this means: planar?=0, yuv2rgb-conversation-mode=2, dither=yes(=1), format-mode = 7 */
#define RGB15_COMPOSED 0x0213
#define RGB16_COMPOSED 0x0210
#define RGB24_COMPOSED 0x0201
#define RGB32_COMPOSED 0x0202
 
#define Y8 0x0006
#define YUV411_COMPOSED 0x0003
#define YUV422_COMPOSED 0x0000
/* this means: planar?=1, yuv2rgb-conversion-mode=0, dither=no(=0), format-mode = b */
#define YUV411_DECOMPOSED 0x100b
#define YUV422_DECOMPOSED 0x1009
#define YUV420_DECOMPOSED 0x100a
 
#define IS_PLANAR(x) (x & 0xf000)
 
/* misc defines */
#define SAA7146_NO_SWAP (0x0)
#define SAA7146_TWO_BYTE_SWAP (0x1)
#define SAA7146_FOUR_BYTE_SWAP (0x2)
 
#endif
/shark/trunk/drivers/linuxc26/include/media/saa6752hs.h
0,0 → 1,58
/*
saa6752hs.h - definition for saa6752hs MPEG encoder
 
Copyright (C) 2003 Andrew de Quincey <adq@lidskialf.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.
 
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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
 
#ifndef _SAA6752HS_H
#define _SAA6752HS_H
 
enum mpeg_bitrate_mode {
MPEG_BITRATE_MODE_VBR = 0, /* Variable bitrate */
MPEG_BITRATE_MODE_CBR = 1, /* Constant bitrate */
 
MPEG_BITRATE_MODE_MAX
};
 
enum mpeg_audio_bitrate {
MPEG_AUDIO_BITRATE_256 = 0, /* 256 kBit/sec */
MPEG_AUDIO_BITRATE_384 = 1, /* 384 kBit/sec */
MPEG_AUDIO_BITRATE_MAX
};
 
#define MPEG_VIDEO_TARGET_BITRATE_MAX 27000
#define MPEG_VIDEO_MAX_BITRATE_MAX 27000
#define MPEG_TOTAL_BITRATE_MAX 27000
struct mpeg_params {
enum mpeg_bitrate_mode bitrate_mode;
unsigned int video_target_bitrate;
unsigned int video_max_bitrate; // only used for VBR
enum mpeg_audio_bitrate audio_bitrate;
unsigned int total_bitrate;
};
 
#define MPEG_SETPARAMS _IOW('6',100,struct mpeg_params)
 
#endif // _SAA6752HS_H
 
/*
* Local variables:
* c-basic-offset: 8
* End:
*/
/shark/trunk/drivers/linuxc26/include/media/audiochip.h
0,0 → 1,33
#ifndef AUDIOCHIP_H
#define AUDIOCHIP_H
 
/* ---------------------------------------------------------------------- */
 
/* v4l device was opened in Radio mode */
#define AUDC_SET_RADIO _IO('m',2)
/* select from TV,radio,extern,MUTE */
#define AUDC_SET_INPUT _IOW('m',17,int)
 
/* audio inputs */
#define AUDIO_TUNER 0x00
#define AUDIO_RADIO 0x01
#define AUDIO_EXTERN 0x02
#define AUDIO_INTERN 0x03
#define AUDIO_OFF 0x04
#define AUDIO_ON 0x05
#define AUDIO_MUTE 0x80
#define AUDIO_UNMUTE 0x81
 
/* all the stuff below is obsolete and just here for reference. I'll
* remove it once the driver is tested and works fine.
*
* Instead creating alot of tiny API's for all kinds of different
* chips, we'll just pass throuth the v4l ioctl structs (v4l2 not
* yet...). It is a bit less flexible, but most/all used i2c chips
* make sense in v4l context only. So I think that's acceptable...
*/
 
/* misc stuff to pass around config info to i2c chips */
#define AUDC_CONFIG_PINNACLE _IOW('m',32,int)
 
#endif /* AUDIOCHIP_H */
/shark/trunk/drivers/linuxc26/include/media/saa7146.h
0,0 → 1,444
#ifndef __SAA7146__
#define __SAA7146__
 
#include <linux/version.h> /* for version macros */
#include <linux/module.h> /* for module-version */
#include <linux/delay.h> /* for delay-stuff */
#include <linux/slab.h> /* for kmalloc/kfree */
#include <linux/pci.h> /* for pci-config-stuff, vendor ids etc. */
#include <linux/init.h> /* for "__init" */
#include <linux/interrupt.h> /* for IMMEDIATE_BH */
#include <linux/kmod.h> /* for kernel module loader */
#include <linux/i2c.h> /* for i2c subsystem */
#include <asm/io.h> /* for accessing devices */
#include <linux/stringify.h>
#include <linux/vmalloc.h> /* for vmalloc() */
#include <linux/mm.h> /* for vmalloc_to_page() */
 
/* ugly, but necessary to build the dvb stuff under 2.4. */
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,51)
#include "dvb_functions.h"
#endif
 
#define SAA7146_VERSION_CODE KERNEL_VERSION(0,5,0)
 
#define saa7146_write(sxy,adr,dat) writel((dat),(sxy->mem+(adr)))
#define saa7146_read(sxy,adr) readl(sxy->mem+(adr))
 
extern unsigned int saa7146_debug;
 
//#define DEBUG_PROLOG printk("(0x%08x)(0x%08x) %s: %s(): ",(dev==0?-1:(dev->mem==0?-1:saa7146_read(dev,RPS_ADDR0))),(dev==0?-1:(dev->mem==0?-1:saa7146_read(dev,IER))),__stringify(KBUILD_MODNAME),__FUNCTION__)
 
#ifndef DEBUG_VARIABLE
#define DEBUG_VARIABLE saa7146_debug
#endif
 
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,51)
#define DEBUG_PROLOG printk("%s: %s(): ",__stringify(KBUILD_BASENAME),__FUNCTION__)
#define INFO(x) { printk("%s: ",__stringify(KBUILD_BASENAME)); printk x; }
#else
#define DEBUG_PROLOG printk("%s: %s(): ",__stringify(KBUILD_MODNAME),__FUNCTION__)
#define INFO(x) { printk("%s: ",__stringify(KBUILD_MODNAME)); printk x; }
#endif
 
#define ERR(x) { DEBUG_PROLOG; printk x; }
 
#define DEB_S(x) if (0!=(DEBUG_VARIABLE&0x01)) { DEBUG_PROLOG; printk x; } /* simple debug messages */
#define DEB_D(x) if (0!=(DEBUG_VARIABLE&0x02)) { DEBUG_PROLOG; printk x; } /* more detailed debug messages */
#define DEB_EE(x) if (0!=(DEBUG_VARIABLE&0x04)) { DEBUG_PROLOG; printk x; } /* print enter and exit of functions */
#define DEB_I2C(x) if (0!=(DEBUG_VARIABLE&0x08)) { DEBUG_PROLOG; printk x; } /* i2c debug messages */
#define DEB_VBI(x) if (0!=(DEBUG_VARIABLE&0x10)) { DEBUG_PROLOG; printk x; } /* vbi debug messages */
#define DEB_INT(x) if (0!=(DEBUG_VARIABLE&0x20)) { DEBUG_PROLOG; printk x; } /* interrupt debug messages */
#define DEB_CAP(x) if (0!=(DEBUG_VARIABLE&0x40)) { DEBUG_PROLOG; printk x; } /* capture debug messages */
 
#define IER_DISABLE(x,y) \
saa7146_write(x, IER, saa7146_read(x, IER) & ~(y));
#define IER_ENABLE(x,y) \
saa7146_write(x, IER, saa7146_read(x, IER) | (y));
 
struct saa7146_dev;
struct saa7146_extension;
struct saa7146_vv;
 
/* saa7146 page table */
struct saa7146_pgtable {
unsigned int size;
u32 *cpu;
dma_addr_t dma;
/* used for offsets for u,v planes for planar capture modes */
unsigned long offset;
};
 
struct saa7146_pci_extension_data {
struct saa7146_extension *ext;
void *ext_priv; /* most likely a name string */
};
 
#define MAKE_EXTENSION_PCI(x_var, x_vendor, x_device) \
{ \
.vendor = PCI_VENDOR_ID_PHILIPS, \
.device = PCI_DEVICE_ID_PHILIPS_SAA7146, \
.subvendor = x_vendor, \
.subdevice = x_device, \
.driver_data = (unsigned long)& x_var, \
}
 
struct saa7146_extension
{
char name[32]; /* name of the device */
#define SAA7146_USE_I2C_IRQ 0x1
int flags;
/* pairs of subvendor and subdevice ids for
supported devices, last entry 0xffff, 0xfff */
struct module *module;
struct pci_driver driver;
struct pci_device_id *pci_tbl;
/* extension functions */
int (*probe)(struct saa7146_dev *);
int (*attach)(struct saa7146_dev *, struct saa7146_pci_extension_data *);
int (*detach)(struct saa7146_dev*);
 
u32 irq_mask; /* mask to indicate, which irq-events are handled by the extension */
void (*irq_func)(struct saa7146_dev*, u32* irq_mask);
};
 
struct saa7146_dma
{
dma_addr_t dma_handle;
u32 *cpu_addr;
};
 
struct saa7146_dev
{
struct module *module;
 
struct list_head item;
 
/* different device locks */
spinlock_t slock;
struct semaphore lock;
 
unsigned char *mem; /* pointer to mapped IO memory */
int revision; /* chip revision; needed for bug-workarounds*/
 
/* pci-device & irq stuff*/
char name[32];
struct pci_dev *pci;
u32 int_todo;
spinlock_t int_slock;
/* extension handling */
struct saa7146_extension *ext; /* indicates if handled by extension */
void *ext_priv; /* pointer for extension private use (most likely some private data) */
struct saa7146_ext_vv *ext_vv_data;
 
/* per device video/vbi informations (if available) */
struct saa7146_vv *vv_data;
void (*vv_callback)(struct saa7146_dev *dev, unsigned long status);
 
/* i2c-stuff */
struct semaphore i2c_lock;
u32 i2c_bitrate;
struct saa7146_dma d_i2c; /* pointer to i2c memory */
wait_queue_head_t i2c_wq;
int i2c_op;
/* memories */
struct saa7146_dma d_rps0;
struct saa7146_dma d_rps1;
};
 
/* from saa7146_i2c.c */
int saa7146_i2c_adapter_prepare(struct saa7146_dev *dev, struct i2c_adapter *i2c_adapter, u32 bitrate);
int saa7146_i2c_transfer(struct saa7146_dev *saa, const struct i2c_msg msgs[], int num, int retries);
 
/* from saa7146_core.c */
extern struct list_head saa7146_devices;
extern struct semaphore saa7146_devices_lock;
int saa7146_register_extension(struct saa7146_extension*);
int saa7146_unregister_extension(struct saa7146_extension*);
struct saa7146_format* format_by_fourcc(struct saa7146_dev *dev, int fourcc);
int saa7146_pgtable_alloc(struct pci_dev *pci, struct saa7146_pgtable *pt);
void saa7146_pgtable_free(struct pci_dev *pci, struct saa7146_pgtable *pt);
void saa7146_pgtable_build_single(struct pci_dev *pci, struct saa7146_pgtable *pt, struct scatterlist *list, int length );
char *saa7146_vmalloc_build_pgtable(struct pci_dev *pci, long length, struct saa7146_pgtable *pt);
void saa7146_setgpio(struct saa7146_dev *dev, int port, u32 data);
 
/* some memory sizes */
#define SAA7146_I2C_MEM ( 1*PAGE_SIZE)
#define SAA7146_RPS_MEM ( 1*PAGE_SIZE)
 
/* some i2c constants */
#define SAA7146_I2C_TIMEOUT 100 /* i2c-timeout-value in ms */
#define SAA7146_I2C_RETRIES 3 /* how many times shall we retry an i2c-operation? */
#define SAA7146_I2C_DELAY 5 /* time we wait after certain i2c-operations */
 
/* unsorted defines */
#define ME1 0x0000000800
#define PV1 0x0000000008
 
/* gpio defines */
#define SAA7146_GPIO_INPUT 0x00
#define SAA7146_GPIO_IRQHI 0x10
#define SAA7146_GPIO_IRQLO 0x20
#define SAA7146_GPIO_IRQHL 0x30
#define SAA7146_GPIO_OUTLO 0x40
#define SAA7146_GPIO_OUTHI 0x50
 
/* define for the register programming sequencer (rps) */
#define CMD_NOP 0x00000000 /* No operation */
#define CMD_CLR_EVENT 0x00000000 /* Clear event */
#define CMD_SET_EVENT 0x10000000 /* Set signal event */
#define CMD_PAUSE 0x20000000 /* Pause */
#define CMD_CHECK_LATE 0x30000000 /* Check late */
#define CMD_UPLOAD 0x40000000 /* Upload */
#define CMD_STOP 0x50000000 /* Stop */
#define CMD_INTERRUPT 0x60000000 /* Interrupt */
#define CMD_JUMP 0x80000000 /* Jump */
#define CMD_WR_REG 0x90000000 /* Write (load) register */
#define CMD_RD_REG 0xa0000000 /* Read (store) register */
#define CMD_WR_REG_MASK 0xc0000000 /* Write register with mask */
 
#define CMD_OAN MASK_27
#define CMD_INV MASK_26
#define CMD_SIG4 MASK_25
#define CMD_SIG3 MASK_24
#define CMD_SIG2 MASK_23
#define CMD_SIG1 MASK_22
#define CMD_SIG0 MASK_21
#define CMD_O_FID_B MASK_14
#define CMD_E_FID_B MASK_13
#define CMD_O_FID_A MASK_12
#define CMD_E_FID_A MASK_11
 
/* some events and command modifiers for rps1 squarewave generator */
#define EVT_HS (1<<15) // Source Line Threshold reached
#define EVT_VBI_B (1<<9) // VSYNC Event
#define RPS_OAN (1<<27) // 1: OR events, 0: AND events
#define RPS_INV (1<<26) // Invert (compound) event
#define GPIO3_MSK 0xFF000000 // GPIO #3 control bits
 
/* Bit mask constants */
#define MASK_00 0x00000001 /* Mask value for bit 0 */
#define MASK_01 0x00000002 /* Mask value for bit 1 */
#define MASK_02 0x00000004 /* Mask value for bit 2 */
#define MASK_03 0x00000008 /* Mask value for bit 3 */
#define MASK_04 0x00000010 /* Mask value for bit 4 */
#define MASK_05 0x00000020 /* Mask value for bit 5 */
#define MASK_06 0x00000040 /* Mask value for bit 6 */
#define MASK_07 0x00000080 /* Mask value for bit 7 */
#define MASK_08 0x00000100 /* Mask value for bit 8 */
#define MASK_09 0x00000200 /* Mask value for bit 9 */
#define MASK_10 0x00000400 /* Mask value for bit 10 */
#define MASK_11 0x00000800 /* Mask value for bit 11 */
#define MASK_12 0x00001000 /* Mask value for bit 12 */
#define MASK_13 0x00002000 /* Mask value for bit 13 */
#define MASK_14 0x00004000 /* Mask value for bit 14 */
#define MASK_15 0x00008000 /* Mask value for bit 15 */
#define MASK_16 0x00010000 /* Mask value for bit 16 */
#define MASK_17 0x00020000 /* Mask value for bit 17 */
#define MASK_18 0x00040000 /* Mask value for bit 18 */
#define MASK_19 0x00080000 /* Mask value for bit 19 */
#define MASK_20 0x00100000 /* Mask value for bit 20 */
#define MASK_21 0x00200000 /* Mask value for bit 21 */
#define MASK_22 0x00400000 /* Mask value for bit 22 */
#define MASK_23 0x00800000 /* Mask value for bit 23 */
#define MASK_24 0x01000000 /* Mask value for bit 24 */
#define MASK_25 0x02000000 /* Mask value for bit 25 */
#define MASK_26 0x04000000 /* Mask value for bit 26 */
#define MASK_27 0x08000000 /* Mask value for bit 27 */
#define MASK_28 0x10000000 /* Mask value for bit 28 */
#define MASK_29 0x20000000 /* Mask value for bit 29 */
#define MASK_30 0x40000000 /* Mask value for bit 30 */
#define MASK_31 0x80000000 /* Mask value for bit 31 */
 
#define MASK_B0 0x000000ff /* Mask value for byte 0 */
#define MASK_B1 0x0000ff00 /* Mask value for byte 1 */
#define MASK_B2 0x00ff0000 /* Mask value for byte 2 */
#define MASK_B3 0xff000000 /* Mask value for byte 3 */
 
#define MASK_W0 0x0000ffff /* Mask value for word 0 */
#define MASK_W1 0xffff0000 /* Mask value for word 1 */
 
#define MASK_PA 0xfffffffc /* Mask value for physical address */
#define MASK_PR 0xfffffffe /* Mask value for protection register */
#define MASK_ER 0xffffffff /* Mask value for the entire register */
 
#define MASK_NONE 0x00000000 /* No mask */
 
/* register aliases */
#define BASE_ODD1 0x00 /* Video DMA 1 registers */
#define BASE_EVEN1 0x04
#define PROT_ADDR1 0x08
#define PITCH1 0x0C
#define BASE_PAGE1 0x10 /* Video DMA 1 base page */
#define NUM_LINE_BYTE1 0x14
 
#define BASE_ODD2 0x18 /* Video DMA 2 registers */
#define BASE_EVEN2 0x1C
#define PROT_ADDR2 0x20
#define PITCH2 0x24
#define BASE_PAGE2 0x28 /* Video DMA 2 base page */
#define NUM_LINE_BYTE2 0x2C
 
#define BASE_ODD3 0x30 /* Video DMA 3 registers */
#define BASE_EVEN3 0x34
#define PROT_ADDR3 0x38
#define PITCH3 0x3C
#define BASE_PAGE3 0x40 /* Video DMA 3 base page */
#define NUM_LINE_BYTE3 0x44
 
#define PCI_BT_V1 0x48 /* Video/FIFO 1 */
#define PCI_BT_V2 0x49 /* Video/FIFO 2 */
#define PCI_BT_V3 0x4A /* Video/FIFO 3 */
#define PCI_BT_DEBI 0x4B /* DEBI */
#define PCI_BT_A 0x4C /* Audio */
 
#define DD1_INIT 0x50 /* Init setting of DD1 interface */
 
#define DD1_STREAM_B 0x54 /* DD1 B video data stream handling */
#define DD1_STREAM_A 0x56 /* DD1 A video data stream handling */
 
#define BRS_CTRL 0x58 /* BRS control register */
#define HPS_CTRL 0x5C /* HPS control register */
#define HPS_V_SCALE 0x60 /* HPS vertical scale */
#define HPS_V_GAIN 0x64 /* HPS vertical ACL and gain */
#define HPS_H_PRESCALE 0x68 /* HPS horizontal prescale */
#define HPS_H_SCALE 0x6C /* HPS horizontal scale */
#define BCS_CTRL 0x70 /* BCS control */
#define CHROMA_KEY_RANGE 0x74
#define CLIP_FORMAT_CTRL 0x78 /* HPS outputs formats & clipping */
 
#define DEBI_CONFIG 0x7C
#define DEBI_COMMAND 0x80
#define DEBI_PAGE 0x84
#define DEBI_AD 0x88
 
#define I2C_TRANSFER 0x8C
#define I2C_STATUS 0x90
 
#define BASE_A1_IN 0x94 /* Audio 1 input DMA */
#define PROT_A1_IN 0x98
#define PAGE_A1_IN 0x9C
#define BASE_A1_OUT 0xA0 /* Audio 1 output DMA */
#define PROT_A1_OUT 0xA4
#define PAGE_A1_OUT 0xA8
 
#define BASE_A2_IN 0xAC /* Audio 2 input DMA */
#define PROT_A2_IN 0xB0
#define PAGE_A2_IN 0xB4
 
#define BASE_A2_OUT 0xB8 /* Audio 2 output DMA */
#define PROT_A2_OUT 0xBC
#define PAGE_A2_OUT 0xC0
 
#define RPS_PAGE0 0xC4 /* RPS task 0 page register */
#define RPS_PAGE1 0xC8 /* RPS task 1 page register */
 
#define RPS_THRESH0 0xCC /* HBI threshold for task 0 */
#define RPS_THRESH1 0xD0 /* HBI threshold for task 1 */
 
#define RPS_TOV0 0xD4 /* RPS timeout for task 0 */
#define RPS_TOV1 0xD8 /* RPS timeout for task 1 */
 
#define IER 0xDC /* Interrupt enable register */
 
#define GPIO_CTRL 0xE0 /* GPIO 0-3 register */
 
#define EC1SSR 0xE4 /* Event cnt set 1 source select */
#define EC2SSR 0xE8 /* Event cnt set 2 source select */
#define ECT1R 0xEC /* Event cnt set 1 thresholds */
#define ECT2R 0xF0 /* Event cnt set 2 thresholds */
 
#define ACON1 0xF4
#define ACON2 0xF8
 
#define MC1 0xFC /* Main control register 1 */
#define MC2 0x100 /* Main control register 2 */
 
#define RPS_ADDR0 0x104 /* RPS task 0 address register */
#define RPS_ADDR1 0x108 /* RPS task 1 address register */
 
#define ISR 0x10C /* Interrupt status register */
#define PSR 0x110 /* Primary status register */
#define SSR 0x114 /* Secondary status register */
 
#define EC1R 0x118 /* Event counter set 1 register */
#define EC2R 0x11C /* Event counter set 2 register */
 
#define PCI_VDP1 0x120 /* Video DMA pointer of FIFO 1 */
#define PCI_VDP2 0x124 /* Video DMA pointer of FIFO 2 */
#define PCI_VDP3 0x128 /* Video DMA pointer of FIFO 3 */
#define PCI_ADP1 0x12C /* Audio DMA pointer of audio out 1 */
#define PCI_ADP2 0x130 /* Audio DMA pointer of audio in 1 */
#define PCI_ADP3 0x134 /* Audio DMA pointer of audio out 2 */
#define PCI_ADP4 0x138 /* Audio DMA pointer of audio in 2 */
#define PCI_DMA_DDP 0x13C /* DEBI DMA pointer */
 
#define LEVEL_REP 0x140,
#define A_TIME_SLOT1 0x180, /* from 180 - 1BC */
#define A_TIME_SLOT2 0x1C0, /* from 1C0 - 1FC */
 
/* isr masks */
#define SPCI_PPEF 0x80000000 /* PCI parity error */
#define SPCI_PABO 0x40000000 /* PCI access error (target or master abort) */
#define SPCI_PPED 0x20000000 /* PCI parity error on 'real time data' */
#define SPCI_RPS_I1 0x10000000 /* Interrupt issued by RPS1 */
#define SPCI_RPS_I0 0x08000000 /* Interrupt issued by RPS0 */
#define SPCI_RPS_LATE1 0x04000000 /* RPS task 1 is late */
#define SPCI_RPS_LATE0 0x02000000 /* RPS task 0 is late */
#define SPCI_RPS_E1 0x01000000 /* RPS error from task 1 */
#define SPCI_RPS_E0 0x00800000 /* RPS error from task 0 */
#define SPCI_RPS_TO1 0x00400000 /* RPS timeout task 1 */
#define SPCI_RPS_TO0 0x00200000 /* RPS timeout task 0 */
#define SPCI_UPLD 0x00100000 /* RPS in upload */
#define SPCI_DEBI_S 0x00080000 /* DEBI status */
#define SPCI_DEBI_E 0x00040000 /* DEBI error */
#define SPCI_IIC_S 0x00020000 /* I2C status */
#define SPCI_IIC_E 0x00010000 /* I2C error */
#define SPCI_A2_IN 0x00008000 /* Audio 2 input DMA protection / limit */
#define SPCI_A2_OUT 0x00004000 /* Audio 2 output DMA protection / limit */
#define SPCI_A1_IN 0x00002000 /* Audio 1 input DMA protection / limit */
#define SPCI_A1_OUT 0x00001000 /* Audio 1 output DMA protection / limit */
#define SPCI_AFOU 0x00000800 /* Audio FIFO over- / underflow */
#define SPCI_V_PE 0x00000400 /* Video protection address */
#define SPCI_VFOU 0x00000200 /* Video FIFO over- / underflow */
#define SPCI_FIDA 0x00000100 /* Field ID video port A */
#define SPCI_FIDB 0x00000080 /* Field ID video port B */
#define SPCI_PIN3 0x00000040 /* GPIO pin 3 */
#define SPCI_PIN2 0x00000020 /* GPIO pin 2 */
#define SPCI_PIN1 0x00000010 /* GPIO pin 1 */
#define SPCI_PIN0 0x00000008 /* GPIO pin 0 */
#define SPCI_ECS 0x00000004 /* Event counter 1, 2, 4, 5 */
#define SPCI_EC3S 0x00000002 /* Event counter 3 */
#define SPCI_EC0S 0x00000001 /* Event counter 0 */
 
/* i2c */
#define SAA7146_I2C_ABORT (1<<7)
#define SAA7146_I2C_SPERR (1<<6)
#define SAA7146_I2C_APERR (1<<5)
#define SAA7146_I2C_DTERR (1<<4)
#define SAA7146_I2C_DRERR (1<<3)
#define SAA7146_I2C_AL (1<<2)
#define SAA7146_I2C_ERR (1<<1)
#define SAA7146_I2C_BUSY (1<<0)
 
#define SAA7146_I2C_START (0x3)
#define SAA7146_I2C_CONT (0x2)
#define SAA7146_I2C_STOP (0x1)
#define SAA7146_I2C_NOP (0x0)
 
#define SAA7146_I2C_BUS_BIT_RATE_6400 (0x500)
#define SAA7146_I2C_BUS_BIT_RATE_3200 (0x100)
#define SAA7146_I2C_BUS_BIT_RATE_480 (0x400)
#define SAA7146_I2C_BUS_BIT_RATE_320 (0x600)
#define SAA7146_I2C_BUS_BIT_RATE_240 (0x700)
#define SAA7146_I2C_BUS_BIT_RATE_120 (0x000)
#define SAA7146_I2C_BUS_BIT_RATE_80 (0x200)
#define SAA7146_I2C_BUS_BIT_RATE_60 (0x300)
 
#endif
 
/shark/trunk/drivers/linuxc26/include/asm/apicdef.h
1,377 → 1,11
#ifndef __ASM_APICDEF_H
#define __ASM_APICDEF_H
#ifndef _GENAPIC_MACH_APICDEF_H
#define _GENAPIC_MACH_APICDEF_H 1
 
/*
* Constants for various Intel APICs. (local APIC, IOAPIC, etc.)
*
* Alan Cox <Alan.Cox@linux.org>, 1995.
* Ingo Molnar <mingo@redhat.com>, 1999, 2000
*/
#ifndef APIC_DEFINITION
#include <asm/genapic.h>
 
#define APIC_DEFAULT_PHYS_BASE 0xfee00000
#define APIC_ID 0x20
#define APIC_LVR 0x30
#define APIC_LVR_MASK 0xFF00FF
#define GET_APIC_VERSION(x) ((x)&0xFF)
#define GET_APIC_MAXLVT(x) (((x)>>16)&0xFF)
#define APIC_INTEGRATED(x) ((x)&0xF0)
#define APIC_TASKPRI 0x80
#define APIC_TPRI_MASK 0xFF
#define APIC_ARBPRI 0x90
#define APIC_ARBPRI_MASK 0xFF
#define APIC_PROCPRI 0xA0
#define APIC_EOI 0xB0
#define APIC_EIO_ACK 0x0 /* Write this to the EOI register */
#define APIC_RRR 0xC0
#define APIC_LDR 0xD0
#define APIC_LDR_MASK (0xFF<<24)
#define GET_APIC_LOGICAL_ID(x) (((x)>>24)&0xFF)
#define SET_APIC_LOGICAL_ID(x) (((x)<<24))
#define APIC_ALL_CPUS 0xFF
#define APIC_DFR 0xE0
#define APIC_DFR_CLUSTER 0x0FFFFFFFul
#define APIC_DFR_FLAT 0xFFFFFFFFul
#define APIC_SPIV 0xF0
#define APIC_SPIV_FOCUS_DISABLED (1<<9)
#define APIC_SPIV_APIC_ENABLED (1<<8)
#define APIC_ISR 0x100
#define APIC_TMR 0x180
#define APIC_IRR 0x200
#define APIC_ESR 0x280
#define APIC_ESR_SEND_CS 0x00001
#define APIC_ESR_RECV_CS 0x00002
#define APIC_ESR_SEND_ACC 0x00004
#define APIC_ESR_RECV_ACC 0x00008
#define APIC_ESR_SENDILL 0x00020
#define APIC_ESR_RECVILL 0x00040
#define APIC_ESR_ILLREGA 0x00080
#define APIC_ICR 0x300
#define APIC_DEST_SELF 0x40000
#define APIC_DEST_ALLINC 0x80000
#define APIC_DEST_ALLBUT 0xC0000
#define APIC_ICR_RR_MASK 0x30000
#define APIC_ICR_RR_INVALID 0x00000
#define APIC_ICR_RR_INPROG 0x10000
#define APIC_ICR_RR_VALID 0x20000
#define APIC_INT_LEVELTRIG 0x08000
#define APIC_INT_ASSERT 0x04000
#define APIC_ICR_BUSY 0x01000
#define APIC_DEST_LOGICAL 0x00800
#define APIC_DM_FIXED 0x00000
#define APIC_DM_LOWEST 0x00100
#define APIC_DM_SMI 0x00200
#define APIC_DM_REMRD 0x00300
#define APIC_DM_NMI 0x00400
#define APIC_DM_INIT 0x00500
#define APIC_DM_STARTUP 0x00600
#define APIC_DM_EXTINT 0x00700
#define APIC_VECTOR_MASK 0x000FF
#define APIC_ICR2 0x310
#define GET_APIC_DEST_FIELD(x) (((x)>>24)&0xFF)
#define SET_APIC_DEST_FIELD(x) ((x)<<24)
#define APIC_LVTT 0x320
#define APIC_LVTTHMR 0x330
#define APIC_LVTPC 0x340
#define APIC_LVT0 0x350
#define APIC_LVT_TIMER_BASE_MASK (0x3<<18)
#define GET_APIC_TIMER_BASE(x) (((x)>>18)&0x3)
#define SET_APIC_TIMER_BASE(x) (((x)<<18))
#define APIC_TIMER_BASE_CLKIN 0x0
#define APIC_TIMER_BASE_TMBASE 0x1
#define APIC_TIMER_BASE_DIV 0x2
#define APIC_LVT_TIMER_PERIODIC (1<<17)
#define APIC_LVT_MASKED (1<<16)
#define APIC_LVT_LEVEL_TRIGGER (1<<15)
#define APIC_LVT_REMOTE_IRR (1<<14)
#define APIC_INPUT_POLARITY (1<<13)
#define APIC_SEND_PENDING (1<<12)
#define GET_APIC_DELIVERY_MODE(x) (((x)>>8)&0x7)
#define SET_APIC_DELIVERY_MODE(x,y) (((x)&~0x700)|((y)<<8))
#define APIC_MODE_FIXED 0x0
#define APIC_MODE_NMI 0x4
#define APIC_MODE_EXINT 0x7
#define APIC_LVT1 0x360
#define APIC_LVTERR 0x370
#define APIC_TMICT 0x380
#define APIC_TMCCT 0x390
#define APIC_TDCR 0x3E0
#define APIC_TDR_DIV_TMBASE (1<<2)
#define APIC_TDR_DIV_1 0xB
#define APIC_TDR_DIV_2 0x0
#define APIC_TDR_DIV_4 0x1
#define APIC_TDR_DIV_8 0x2
#define APIC_TDR_DIV_16 0x3
#define APIC_TDR_DIV_32 0x8
#define APIC_TDR_DIV_64 0x9
#define APIC_TDR_DIV_128 0xA
 
#define APIC_BASE (fix_to_virt(FIX_APIC_BASE))
 
#ifdef CONFIG_NUMA
#define MAX_IO_APICS 32
#else
#define MAX_IO_APICS 8
#define GET_APIC_ID (genapic->get_apic_id)
#define APIC_ID_MASK (genapic->apic_id_mask)
#endif
 
/*
* the local APIC register structure, memory mapped. Not terribly well
* tested, but we might eventually use this one in the future - the
* problem why we cannot use it right now is the P5 APIC, it has an
* errata which cannot take 8-bit reads and writes, only 32-bit ones ...
*/
#define u32 unsigned int
 
#define lapic ((volatile struct local_apic *)APIC_BASE)
 
struct local_apic {
 
/*000*/ struct { u32 __reserved[4]; } __reserved_01;
 
/*010*/ struct { u32 __reserved[4]; } __reserved_02;
 
/*020*/ struct { /* APIC ID Register */
u32 __reserved_1 : 24,
phys_apic_id : 4,
__reserved_2 : 4;
u32 __reserved[3];
} id;
 
/*030*/ const
struct { /* APIC Version Register */
u32 version : 8,
__reserved_1 : 8,
max_lvt : 8,
__reserved_2 : 8;
u32 __reserved[3];
} version;
 
/*040*/ struct { u32 __reserved[4]; } __reserved_03;
 
/*050*/ struct { u32 __reserved[4]; } __reserved_04;
 
/*060*/ struct { u32 __reserved[4]; } __reserved_05;
 
/*070*/ struct { u32 __reserved[4]; } __reserved_06;
 
/*080*/ struct { /* Task Priority Register */
u32 priority : 8,
__reserved_1 : 24;
u32 __reserved_2[3];
} tpr;
 
/*090*/ const
struct { /* Arbitration Priority Register */
u32 priority : 8,
__reserved_1 : 24;
u32 __reserved_2[3];
} apr;
 
/*0A0*/ const
struct { /* Processor Priority Register */
u32 priority : 8,
__reserved_1 : 24;
u32 __reserved_2[3];
} ppr;
 
/*0B0*/ struct { /* End Of Interrupt Register */
u32 eoi;
u32 __reserved[3];
} eoi;
 
/*0C0*/ struct { u32 __reserved[4]; } __reserved_07;
 
/*0D0*/ struct { /* Logical Destination Register */
u32 __reserved_1 : 24,
logical_dest : 8;
u32 __reserved_2[3];
} ldr;
 
/*0E0*/ struct { /* Destination Format Register */
u32 __reserved_1 : 28,
model : 4;
u32 __reserved_2[3];
} dfr;
 
/*0F0*/ struct { /* Spurious Interrupt Vector Register */
u32 spurious_vector : 8,
apic_enabled : 1,
focus_cpu : 1,
__reserved_2 : 22;
u32 __reserved_3[3];
} svr;
 
/*100*/ struct { /* In Service Register */
/*170*/ u32 bitfield;
u32 __reserved[3];
} isr [8];
 
/*180*/ struct { /* Trigger Mode Register */
/*1F0*/ u32 bitfield;
u32 __reserved[3];
} tmr [8];
 
/*200*/ struct { /* Interrupt Request Register */
/*270*/ u32 bitfield;
u32 __reserved[3];
} irr [8];
 
/*280*/ union { /* Error Status Register */
struct {
u32 send_cs_error : 1,
receive_cs_error : 1,
send_accept_error : 1,
receive_accept_error : 1,
__reserved_1 : 1,
send_illegal_vector : 1,
receive_illegal_vector : 1,
illegal_register_address : 1,
__reserved_2 : 24;
u32 __reserved_3[3];
} error_bits;
struct {
u32 errors;
u32 __reserved_3[3];
} all_errors;
} esr;
 
/*290*/ struct { u32 __reserved[4]; } __reserved_08;
 
/*2A0*/ struct { u32 __reserved[4]; } __reserved_09;
 
/*2B0*/ struct { u32 __reserved[4]; } __reserved_10;
 
/*2C0*/ struct { u32 __reserved[4]; } __reserved_11;
 
/*2D0*/ struct { u32 __reserved[4]; } __reserved_12;
 
/*2E0*/ struct { u32 __reserved[4]; } __reserved_13;
 
/*2F0*/ struct { u32 __reserved[4]; } __reserved_14;
 
/*300*/ struct { /* Interrupt Command Register 1 */
u32 vector : 8,
delivery_mode : 3,
destination_mode : 1,
delivery_status : 1,
__reserved_1 : 1,
level : 1,
trigger : 1,
__reserved_2 : 2,
shorthand : 2,
__reserved_3 : 12;
u32 __reserved_4[3];
} icr1;
 
/*310*/ struct { /* Interrupt Command Register 2 */
union {
u32 __reserved_1 : 24,
phys_dest : 4,
__reserved_2 : 4;
u32 __reserved_3 : 24,
logical_dest : 8;
} dest;
u32 __reserved_4[3];
} icr2;
 
/*320*/ struct { /* LVT - Timer */
u32 vector : 8,
__reserved_1 : 4,
delivery_status : 1,
__reserved_2 : 3,
mask : 1,
timer_mode : 1,
__reserved_3 : 14;
u32 __reserved_4[3];
} lvt_timer;
 
/*330*/ struct { /* LVT - Thermal Sensor */
u32 vector : 8,
delivery_mode : 3,
__reserved_1 : 1,
delivery_status : 1,
__reserved_2 : 3,
mask : 1,
__reserved_3 : 15;
u32 __reserved_4[3];
} lvt_thermal;
 
/*340*/ struct { /* LVT - Performance Counter */
u32 vector : 8,
delivery_mode : 3,
__reserved_1 : 1,
delivery_status : 1,
__reserved_2 : 3,
mask : 1,
__reserved_3 : 15;
u32 __reserved_4[3];
} lvt_pc;
 
/*350*/ struct { /* LVT - LINT0 */
u32 vector : 8,
delivery_mode : 3,
__reserved_1 : 1,
delivery_status : 1,
polarity : 1,
remote_irr : 1,
trigger : 1,
mask : 1,
__reserved_2 : 15;
u32 __reserved_3[3];
} lvt_lint0;
 
/*360*/ struct { /* LVT - LINT1 */
u32 vector : 8,
delivery_mode : 3,
__reserved_1 : 1,
delivery_status : 1,
polarity : 1,
remote_irr : 1,
trigger : 1,
mask : 1,
__reserved_2 : 15;
u32 __reserved_3[3];
} lvt_lint1;
 
/*370*/ struct { /* LVT - Error */
u32 vector : 8,
__reserved_1 : 4,
delivery_status : 1,
__reserved_2 : 3,
mask : 1,
__reserved_3 : 15;
u32 __reserved_4[3];
} lvt_error;
 
/*380*/ struct { /* Timer Initial Count Register */
u32 initial_count;
u32 __reserved_2[3];
} timer_icr;
 
/*390*/ const
struct { /* Timer Current Count Register */
u32 curr_count;
u32 __reserved_2[3];
} timer_ccr;
 
/*3A0*/ struct { u32 __reserved[4]; } __reserved_16;
 
/*3B0*/ struct { u32 __reserved[4]; } __reserved_17;
 
/*3C0*/ struct { u32 __reserved[4]; } __reserved_18;
 
/*3D0*/ struct { u32 __reserved[4]; } __reserved_19;
 
/*3E0*/ struct { /* Timer Divide Configuration Register */
u32 divisor : 4,
__reserved_1 : 28;
u32 __reserved_2[3];
} timer_dcr;
 
/*3F0*/ struct { u32 __reserved[4]; } __reserved_20;
 
} __attribute__ ((packed));
 
#undef u32
 
#endif
/shark/trunk/drivers/linuxc26/include/asm/mpparse.h
0,0 → 1,12
#ifndef _MACH_MPPARSE_H
#define _MACH_MPPARSE_H 1
 
#include <asm/genapic.h>
 
#define mpc_oem_bus_info (genapic->mpc_oem_bus_info)
#define mpc_oem_pci_bus (genapic->mpc_oem_pci_bus)
 
int mps_oem_check(struct mp_config_table *mpc, char *oem, char *productid);
int acpi_madt_oem_check(char *oem_id, char *oem_table_id);
 
#endif
/shark/trunk/drivers/linuxc26/include/asm/ipi.h
0,0 → 1,10
#ifndef _MACH_IPI_H
#define _MACH_IPI_H 1
 
#include <asm/genapic.h>
 
#define send_IPI_mask (genapic->send_IPI_mask)
#define send_IPI_allbutself (genapic->send_IPI_allbutself)
#define send_IPI_all (genapic->send_IPI_all)
 
#endif
/shark/trunk/drivers/linuxc26/include/asm/apic.h
1,104 → 1,31
#ifndef __ASM_APIC_H
#define __ASM_APIC_H
#ifndef __ASM_MACH_APIC_H
#define __ASM_MACH_APIC_H
 
#include <linux/config.h>
#include <linux/pm.h>
#include <asm/fixmap.h>
#include <asm/apicdef.h>
#include <asm/system.h>
#include <asm/genapic.h>
 
#define APIC_DEBUG 0
#define esr_disable (genapic->esr_disable)
#define NO_BALANCE_IRQ (genapic->no_balance_irq)
#define NO_IOAPIC_CHECK (genapic->no_ioapic_check)
#define APIC_BROADCAST_ID (genapic->apic_broadcast_id)
#define INT_DELIVERY_MODE (genapic->int_delivery_mode)
#define INT_DEST_MODE (genapic->int_dest_mode)
#define TARGET_CPUS (genapic->target_cpus())
#define apic_id_registered (genapic->apic_id_registered)
#define apic_id_registered (genapic->apic_id_registered)
#define init_apic_ldr (genapic->init_apic_ldr)
#define ioapic_phys_id_map (genapic->ioapic_phys_id_map)
#define clustered_apic_check (genapic->clustered_apic_check)
#define multi_timer_check (genapic->multi_timer_check)
#define apicid_to_node (genapic->apicid_to_node)
#define cpu_to_logical_apicid (genapic->cpu_to_logical_apicid)
#define cpu_present_to_apicid (genapic->cpu_present_to_apicid)
#define apicid_to_cpu_present (genapic->apicid_to_cpu_present)
#define mpc_apic_id (genapic->mpc_apic_id)
#define setup_portio_remap (genapic->setup_portio_remap)
#define check_apicid_present (genapic->check_apicid_present)
#define check_phys_apicid_present (genapic->check_phys_apicid_present)
#define check_apicid_used (genapic->check_apicid_used)
#define cpu_mask_to_apicid (genapic->cpu_mask_to_apicid)
#define enable_apic_mode (genapic->enable_apic_mode)
 
#if APIC_DEBUG
#define Dprintk(x...) printk(x)
#else
#define Dprintk(x...)
#endif
 
#ifdef CONFIG_X86_LOCAL_APIC
 
/*
* Basic functions accessing APICs.
*/
 
static __inline void apic_write(unsigned long reg, unsigned long v)
{
*((volatile unsigned long *)(APIC_BASE+reg)) = v;
}
 
static __inline void apic_write_atomic(unsigned long reg, unsigned long v)
{
xchg((volatile unsigned long *)(APIC_BASE+reg), v);
}
 
static __inline unsigned long apic_read(unsigned long reg)
{
return *((volatile unsigned long *)(APIC_BASE+reg));
}
 
static __inline__ void apic_wait_icr_idle(void)
{
do { } while ( apic_read( APIC_ICR ) & APIC_ICR_BUSY );
}
 
#ifdef CONFIG_X86_GOOD_APIC
# define FORCE_READ_AROUND_WRITE 0
# define apic_read_around(x)
# define apic_write_around(x,y) apic_write((x),(y))
#else
# define FORCE_READ_AROUND_WRITE 1
# define apic_read_around(x) apic_read(x)
# define apic_write_around(x,y) apic_write_atomic((x),(y))
#endif
 
static inline void ack_APIC_irq(void)
{
/*
* ack_APIC_irq() actually gets compiled as a single instruction:
* - a single rmw on Pentium/82489DX
* - a single write on P6+ cores (CONFIG_X86_GOOD_APIC)
* ... yummie.
*/
 
/* Docs say use 0 for future compatibility */
apic_write_around(APIC_EOI, 0);
}
 
extern void (*wait_timer_tick)(void);
 
extern int get_maxlvt(void);
extern void clear_local_APIC(void);
extern void connect_bsp_APIC (void);
extern void disconnect_bsp_APIC (void);
extern void disable_local_APIC (void);
extern int verify_local_APIC (void);
extern void cache_APIC_registers (void);
extern void sync_Arb_IDs (void);
extern void init_bsp_APIC (void);
extern void setup_local_APIC (void);
extern void init_apic_mappings (void);
extern void smp_local_timer_interrupt (struct pt_regs * regs);
extern void setup_boot_APIC_clock (void);
extern void setup_secondary_APIC_clock (void);
extern void setup_apic_nmi_watchdog (void);
extern void disable_lapic_nmi_watchdog(void);
extern void enable_lapic_nmi_watchdog(void);
extern void disable_timer_nmi_watchdog(void);
extern void enable_timer_nmi_watchdog(void);
extern inline void nmi_watchdog_tick (struct pt_regs * regs);
extern int APIC_init_uniprocessor (void);
extern void disable_APIC_timer(void);
extern void enable_APIC_timer(void);
 
extern int check_nmi_watchdog (void);
extern void enable_NMI_through_LVT0 (void * dummy);
 
extern unsigned int nmi_watchdog;
#define NMI_NONE 0
#define NMI_IO_APIC 1
#define NMI_LOCAL_APIC 2
#define NMI_INVALID 3
 
#endif /* CONFIG_X86_LOCAL_APIC */
 
#endif /* __ASM_APIC_H */
#endif /* __ASM_MACH_APIC_H */
/shark/trunk/drivers/linuxc26/include/asm/mpspec.h
1,95 → 1,13
#ifndef __ASM_MPSPEC_H
#define __ASM_MPSPEC_H
#ifndef __ASM_MACH_MPSPEC_H
#define __ASM_MACH_MPSPEC_H
 
#include <linux/cpumask.h>
#include <asm/mpspec_def.h>
#include <mach_mpspec.h>
/*
* a maximum of 256 APICs with the current APIC ID architecture.
*/
#define MAX_APICS 256
 
extern int mp_bus_id_to_type [MAX_MP_BUSSES];
extern int mp_bus_id_to_node [MAX_MP_BUSSES];
extern int mp_bus_id_to_local [MAX_MP_BUSSES];
extern int quad_local_to_mp_bus_id [NR_CPUS/4][4];
extern int mp_bus_id_to_pci_bus [MAX_MP_BUSSES];
#define MAX_IRQ_SOURCES 256
 
extern unsigned int boot_cpu_physical_apicid;
extern int smp_found_config;
extern void find_smp_config (void);
extern void get_smp_config (void);
extern int nr_ioapics;
extern int apic_version [MAX_APICS];
extern int mp_bus_id_to_type [MAX_MP_BUSSES];
extern int mp_irq_entries;
extern struct mpc_config_intsrc mp_irqs [MAX_IRQ_SOURCES];
extern int mpc_default_type;
extern int mp_bus_id_to_pci_bus [MAX_MP_BUSSES];
extern int mp_current_pci_id;
extern unsigned long mp_lapic_addr;
extern int pic_mode;
extern int using_apic_timer;
#define MAX_MP_BUSSES 32
 
#ifdef CONFIG_X86_SUMMIT
extern void setup_summit (void);
#endif
 
#ifdef CONFIG_ACPI_BOOT
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 irq_base);
extern void mp_override_legacy_irq (u8 bus_irq, u8 polarity, u8 trigger, u32 global_irq);
extern void mp_config_acpi_legacy_irqs (void);
extern void mp_parse_prt (void);
 
#ifdef CONFIG_X86_IO_APIC
extern void mp_config_ioapic_for_sci(int irq);
#else
static inline void mp_config_ioapic_for_sci(int irq)
{ }
#endif
#endif /*CONFIG_ACPI_BOOT*/
 
#define PHYSID_ARRAY_SIZE BITS_TO_LONGS(MAX_APICS)
 
struct physid_mask
{
unsigned long mask[PHYSID_ARRAY_SIZE];
};
 
typedef struct physid_mask physid_mask_t;
 
#define physid_set(physid, map) set_bit(physid, (map).mask)
#define physid_clear(physid, map) clear_bit(physid, (map).mask)
#define physid_isset(physid, map) test_bit(physid, (map).mask)
#define physid_test_and_set(physid, map) test_and_set_bit(physid, (map).mask)
 
#define physids_and(dst, src1, src2) bitmap_and((dst).mask, (src1).mask, (src2).mask, MAX_APICS)
#define physids_or(dst, src1, src2) bitmap_or((dst).mask, (src1).mask, (src2).mask, MAX_APICS)
#define physids_clear(map) bitmap_clear((map).mask, MAX_APICS)
#define physids_complement(map) bitmap_complement((map).mask, MAX_APICS)
#define physids_empty(map) bitmap_empty((map).mask, MAX_APICS)
#define physids_equal(map1, map2) bitmap_equal((map1).mask, (map2).mask, MAX_APICS)
#define physids_weight(map) bitmap_weight((map).mask, MAX_APICS)
#define physids_shift_right(d, s, n) bitmap_shift_right((d).mask, (s).mask, n, MAX_APICS)
#define physids_shift_left(d, s, n) bitmap_shift_left((d).mask, (s).mask, n, MAX_APICS)
#define physids_coerce(map) ((map).mask[0])
 
#define physids_promote(physids) \
({ \
physid_mask_t __physid_mask = PHYSID_MASK_NONE; \
__physid_mask.mask[0] = physids; \
__physid_mask; \
})
 
#define physid_mask_of_physid(physid) \
({ \
physid_mask_t __physid_mask = PHYSID_MASK_NONE; \
physid_set(physid, __physid_mask); \
__physid_mask; \
})
 
#define PHYSID_MASK_ALL { {[0 ... PHYSID_ARRAY_SIZE-1] = ~0UL} }
#define PHYSID_MASK_NONE { {[0 ... PHYSID_ARRAY_SIZE-1] = 0UL} }
 
extern physid_mask_t phys_cpu_present_map;
 
#endif
 
#endif /* __ASM_MACH_MPSPEC_H */
/shark/trunk/drivers/linuxc26/include/linuxcomp.h
13,6 → 13,7
#define NR_IRQS 15
#define NR_IRQ_VECTORS 15
 
#define APIC_DEFINITION
#define __BIT_TYPES_DEFINED__
 
#include <ll/i386/mem.h>
/shark/trunk/drivers/linuxc26/include/acpi/acdebug.h
0,0 → 1,469
/******************************************************************************
*
* Name: acdebug.h - ACPI/AML debugger
*
*****************************************************************************/
 
/*
* Copyright (C) 2000 - 2003, 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.
*/
 
#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 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) {\
acpi_os_printf PARAM_LIST(fp);}
 
#define EX_NO_SINGLE_STEP 1
#define EX_SINGLE_STEP 2
 
 
/* Prototypes */
 
 
/*
* dbxface - external debugger interfaces
*/
 
acpi_status
acpi_db_initialize (
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_status
acpi_db_start_command (
struct acpi_walk_state *walk_state,
union acpi_parse_object *op);
 
void
acpi_db_method_end (
struct acpi_walk_state *walk_state);
 
 
/*
* dbcmds - debug commands and output routines
*/
 
void
acpi_db_display_table_info (
char *table_arg);
 
void
acpi_db_unload_acpi_table (
char *table_arg,
char *instance_arg);
 
void
acpi_db_set_method_breakpoint (
char *location,
struct acpi_walk_state *walk_state,
union acpi_parse_object *op);
 
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_dump_namespace (
char *start_arg,
char *depth_arg);
 
void
acpi_db_dump_namespace_by_owner (
char *owner_arg,
char *depth_arg);
 
void
acpi_db_send_notify (
char *name,
u32 value);
 
void
acpi_db_set_method_data (
char *type_arg,
char *index_arg,
char *value_arg);
 
acpi_status
acpi_db_display_objects (
char *obj_type_arg,
char *display_count_arg);
 
acpi_status
acpi_db_find_name_in_namespace (
char *name_arg);
 
void
acpi_db_set_scope (
char *name);
 
void
acpi_db_find_references (
char *object_arg);
 
void
acpi_db_display_locks (void);
 
 
void
acpi_db_display_resources (
char *object_arg);
 
void
acpi_db_display_gpes (void);
 
void
acpi_db_check_integrity (
void);
 
acpi_status
acpi_db_integrity_walk (
acpi_handle obj_handle,
u32 nesting_level,
void *context,
void **return_value);
 
acpi_status
acpi_db_walk_and_match_name (
acpi_handle obj_handle,
u32 nesting_level,
void *context,
void **return_value);
 
acpi_status
acpi_db_walk_for_references (
acpi_handle obj_handle,
u32 nesting_level,
void *context,
void **return_value);
 
acpi_status
acpi_db_walk_for_specific_objects (
acpi_handle obj_handle,
u32 nesting_level,
void *context,
void **return_value);
 
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_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_status
acpi_db_display_all_methods (
char *display_count_arg);
 
void
acpi_db_display_arguments (
void);
 
void
acpi_db_display_locals (
void);
 
void
acpi_db_display_results (
void);
 
void
acpi_db_display_calling_tree (
void);
 
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);
 
void
acpi_db_dump_parser_descriptor (
union acpi_parse_object *op);
 
void *
acpi_db_get_pointer (
void *target);
 
 
/*
* dbexec - debugger control method execution
*/
 
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_status
acpi_db_execute_method (
struct acpi_db_method_info *info,
struct acpi_buffer *return_obj);
 
void
acpi_db_execute_setup (
struct acpi_db_method_info *info);
 
u32
acpi_db_get_outstanding_allocations (
void);
 
void ACPI_SYSTEM_XFACE
acpi_db_method_thread (
void *context);
 
acpi_status
acpi_db_execution_walk (
acpi_handle obj_handle,
u32 nesting_level,
void *context,
void **return_value);
 
 
/*
* dbfileio - Debugger file I/O commands
*/
 
acpi_object_type
acpi_db_match_argument (
char *user_argument,
struct argument_info *arguments);
 
acpi_status
ae_local_load_table (
struct acpi_table_header *table_ptr);
 
void
acpi_db_close_debug_file (
void);
 
void
acpi_db_open_debug_file (
char *name);
 
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_status
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_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_status
acpi_db_user_commands (
char prompt,
union acpi_parse_object *op);
 
void
acpi_db_display_help (
char *help_type);
 
char *
acpi_db_get_next_token (
char *string,
char **next);
 
u32
acpi_db_get_line (
char *input_buffer);
 
u32
acpi_db_match_command (
char *user_command);
 
void
acpi_db_single_thread (
void);
 
 
/*
* 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);
 
acpi_status
acpi_db_classify_one_object (
acpi_handle obj_handle,
u32 nesting_level,
void *context,
void **return_value);
 
void
acpi_db_count_namespace_objects (
void);
 
void
acpi_db_enumerate_object (
union acpi_operand_object *obj_desc);
 
 
/*
* dbutils - AML debugger utilities
*/
 
void
acpi_db_set_output_destination (
u32 where);
 
void
acpi_db_dump_buffer (
u32 address);
 
void
acpi_db_dump_object (
union acpi_object *obj_desc,
u32 level);
 
void
acpi_db_prep_namestring (
char *name);
 
 
acpi_status
acpi_db_second_pass_parse (
union acpi_parse_object *root);
 
struct acpi_namespace_node *
acpi_db_local_ns_lookup (
char *name);
 
 
#endif /* __ACDEBUG_H__ */
/shark/trunk/drivers/linuxc26/include/acpi/actbl71.h
0,0 → 1,144
/******************************************************************************
*
* Name: actbl71.h - IA-64 Extensions to the ACPI Spec Rev. 0.71
* This file includes tables specific to this
* specification revision.
*
*****************************************************************************/
 
/*
* Copyright (C) 2000 - 2003, R. Byron Moore
*
* 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
*/
 
#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 */
 
#define SMI_CMD_ADDRESS_SPACE 0x01
#define PM1_BLK_ADDRESS_SPACE 0x02
#define PM2_CNT_BLK_ADDRESS_SPACE 0x04
#define PM_TMR_BLK_ADDRESS_SPACE 0x08
#define GPE0_BLK_ADDRESS_SPACE 0x10
#define GPE1_BLK_ADDRESS_SPACE 0x20
 
/* Only for clarity in declarations */
 
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 */
};
 
 
/*****************************************/
/* 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 */
};
 
 
/*******************************************/
/* 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 */
};
 
 
/******************************************/
/* 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 */
};
 
#pragma pack()
 
#endif /* __ACTBL71_H__ */
 
/shark/trunk/drivers/linuxc26/include/acpi/platform/acenv.h
0,0 → 1,367
/******************************************************************************
*
* Name: acenv.h - Generation environment specific items
*
*****************************************************************************/
 
/*
* Copyright (C) 2000 - 2003, 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.
*/
 
#ifndef __ACENV_H__
#define __ACENV_H__
 
 
/*
* Configuration for ACPI tools and utilities
*/
 
#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
#endif
 
#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
#endif
 
#ifdef _ACPI_ASL_COMPILER
#define ACPI_DEBUG_OUTPUT
#define ACPI_APPLICATION
#define ACPI_DISASSEMBLER
#define ACPI_CONSTANT_EVAL_ONLY
#define ACPI_USE_SYSTEM_CLIBRARY
#endif
 
/*
* Environment configuration. The purpose of this file is to interface to the
* local generation environment.
*
* 1) ACPI_USE_SYSTEM_CLIBRARY - Define this if linking to an actual C library.
* Otherwise, local versions of string/memory functions will be used.
* 2) ACPI_USE_STANDARD_HEADERS - Define this if linking to a C library and
* the standard header files may be used.
*
* The ACPI subsystem only uses low level C library functions that do not call
* operating system services and may therefore be inlined in the code.
*
* It may be necessary to tailor these include files to the target
* generation environment.
*
*
* Functions and constants used from each header:
*
* string.h: memcpy
* memset
* strcat
* strcmp
* strcpy
* strlen
* strncmp
* strncat
* strncpy
*
* stdlib.h: strtoul
*
* stdarg.h: va_list
* va_arg
* va_start
* va_end
*
*/
 
/*! [Begin] no source code translation */
 
#if defined(__linux__)
#include "aclinux.h"
 
#elif defined(_AED_EFI)
#include "acefi.h"
 
#elif defined(WIN32)
#include "acwin.h"
 
#elif defined(WIN64)
#include "acwin64.h"
 
#elif defined(MSDOS) /* Must appear after WIN32 and WIN64 check */
#include "acdos16.h"
 
#elif defined(__FreeBSD__)
#include "acfreebsd.h"
 
#elif defined(__NetBSD__)
#include "acnetbsd.h"
 
#elif defined(MODESTO)
#include "acmodesto.h"
 
#elif defined(NETWARE)
#include "acnetware.h"
 
#else
 
/* All other environments */
 
#define ACPI_USE_STANDARD_HEADERS
 
#define COMPILER_DEPENDENT_INT64 long long
#define COMPILER_DEPENDENT_UINT64 unsigned long long
 
 
/* Name of host operating system (returned by the _OS_ namespace object) */
 
#define ACPI_OS_NAME "Intel ACPI/CA Core Subsystem"
 
/* This macro is used to tag functions as "printf-like" because
* some compilers can catch printf format string problems. MSVC
* doesn't, so this is proprocessed away.
*/
#define ACPI_PRINTF_LIKE_FUNC
 
#endif
 
/*
* Memory allocation tracking. Used only if
* 1) This is the debug version
* 2) This is NOT a 16-bit version of the code (not enough real-mode memory)
*/
#ifdef ACPI_DEBUG_OUTPUT
#if ACPI_MACHINE_WIDTH != 16
#define ACPI_DBG_TRACK_ALLOCATIONS
#endif
#endif
 
/*! [End] no source code translation !*/
 
 
/*
* Debugger threading model
* Use single threaded if the entire subsystem is contained in an application
* Use multiple threaded when the subsystem is running in the kernel.
*
* By default the model is single threaded if ACPI_APPLICATION is set,
* multi-threaded if ACPI_APPLICATION is not set.
*/
#define DEBUGGER_SINGLE_THREADED 0
#define DEBUGGER_MULTI_THREADED 1
 
#ifndef DEBUGGER_THREADING
#ifdef ACPI_APPLICATION
#define DEBUGGER_THREADING DEBUGGER_SINGLE_THREADED
 
#else
#define DEBUGGER_THREADING DEBUGGER_MULTI_THREADED
#endif
#endif /* !DEBUGGER_THREADING */
 
/******************************************************************************
*
* C library configuration
*
*****************************************************************************/
 
#ifdef ACPI_USE_SYSTEM_CLIBRARY
/*
* Use the standard C library headers.
* We want to keep these to a minimum.
*/
 
#ifdef ACPI_USE_STANDARD_HEADERS
/*
* Use the standard headers from the standard locations
*/
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
 
#endif /* ACPI_USE_STANDARD_HEADERS */
 
/*
* We will be linking to the standard Clib functions
*/
 
#define ACPI_STRSTR(s1,s2) strstr((s1), (s2))
#define ACPI_STRUPR(s) (void) acpi_ut_strupr ((s))
#define ACPI_STRLEN(s) (acpi_size) strlen((s))
#define ACPI_STRCPY(d,s) (void) strcpy((d), (s))
#define ACPI_STRNCPY(d,s,n) (void) strncpy((d), (s), (acpi_size)(n))
#define ACPI_STRNCMP(d,s,n) strncmp((d), (s), (acpi_size)(n))
#define ACPI_STRCMP(d,s) strcmp((d), (s))
#define ACPI_STRCAT(d,s) (void) strcat((d), (s))
#define ACPI_STRNCAT(d,s,n) strncat((d), (s), (acpi_size)(n))
#define ACPI_STRTOUL(d,s,n) strtoul((d), (s), (acpi_size)(n))
#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
 
/******************************************************************************
*
* Not using native C library, use local implementations
*
*****************************************************************************/
#else
 
/*
* 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 */
 
/*
* Storage alignment properties
*/
 
#define _AUPBND (sizeof (acpi_native_int) - 1)
#define _ADNBND (sizeof (acpi_native_int) - 1)
 
/*
* Variable argument list macro definitions
*/
 
#define _bnd(X, bnd) (((sizeof (X)) + (bnd)) & (~(bnd)))
#define va_arg(ap, T) (*(T *)(((ap) += (_bnd (T, _AUPBND))) - (_bnd (T,_ADNBND))))
#define va_end(ap) (void) 0
#define va_start(ap, A) (void) ((ap) = (((char *) &(A)) + (_bnd (A,_AUPBND))))
 
#endif /* va_arg */
 
 
#define ACPI_STRSTR(s1,s2) acpi_ut_strstr ((s1), (s2))
#define ACPI_STRUPR(s) (void) acpi_ut_strupr ((s))
#define ACPI_STRLEN(s) (acpi_size) acpi_ut_strlen ((s))
#define ACPI_STRCPY(d,s) (void) acpi_ut_strcpy ((d), (s))
#define ACPI_STRNCPY(d,s,n) (void) acpi_ut_strncpy ((d), (s), (acpi_size)(n))
#define ACPI_STRNCMP(d,s,n) acpi_ut_strncmp ((d), (s), (acpi_size)(n))
#define ACPI_STRCMP(d,s) acpi_ut_strcmp ((d), (s))
#define ACPI_STRCAT(d,s) (void) acpi_ut_strcat ((d), (s))
#define ACPI_STRNCAT(d,s,n) acpi_ut_strncat ((d), (s), (acpi_size)(n))
#define ACPI_STRTOUL(d,s,n) acpi_ut_strtoul ((d), (s), (acpi_size)(n))
#define ACPI_MEMCPY(d,s,n) (void) acpi_ut_memcpy ((d), (s), (acpi_size)(n))
#define ACPI_MEMSET(d,v,n) (void) acpi_ut_memset ((d), (v), (acpi_size)(n))
#define ACPI_TOUPPER acpi_ut_to_upper
#define ACPI_TOLOWER acpi_ut_to_lower
 
#endif /* ACPI_USE_SYSTEM_CLIBRARY */
 
 
/******************************************************************************
*
* Assembly code macros
*
*****************************************************************************/
 
/*
* Handle platform- and compiler-specific assembly language differences.
* These should already have been defined by the platform includes above.
*
* Notes:
* 1) Interrupt 3 is used to break into a debugger
* 2) Interrupts are turned off during ACPI register setup
*/
 
/* Unrecognized compiler, use defaults */
 
#ifndef ACPI_ASM_MACROS
 
/*
* Calling conventions:
*
* ACPI_SYSTEM_XFACE - Interfaces to host OS (handlers, threads)
* ACPI_EXTERNAL_XFACE - External ACPI interfaces
* ACPI_INTERNAL_XFACE - Internal ACPI interfaces
* ACPI_INTERNAL_VAR_XFACE - Internal variable-parameter list interfaces
*/
#define ACPI_SYSTEM_XFACE
#define ACPI_EXTERNAL_XFACE
#define ACPI_INTERNAL_XFACE
#define ACPI_INTERNAL_VAR_XFACE
 
#define ACPI_ASM_MACROS
#define BREAKPOINT3
#define ACPI_DISABLE_IRQS()
#define ACPI_ENABLE_IRQS()
#define ACPI_ACQUIRE_GLOBAL_LOCK(Glptr, acq)
#define ACPI_RELEASE_GLOBAL_LOCK(Glptr, acq)
 
#endif /* ACPI_ASM_MACROS */
 
 
#ifdef ACPI_APPLICATION
 
/* Don't want software interrupts within a ring3 application */
 
#undef BREAKPOINT3
#define BREAKPOINT3
#endif
 
 
/******************************************************************************
*
* Compiler-specific information is contained in the compiler-specific
* headers.
*
*****************************************************************************/
#endif /* __ACENV_H__ */
/shark/trunk/drivers/linuxc26/include/acpi/platform/acgcc.h
0,0 → 1,59
/******************************************************************************
*
* Name: acgcc.h - GCC specific defines, etc.
*
*****************************************************************************/
 
/*
* Copyright (C) 2000 - 2003, 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.
*/
 
#ifndef __ACGCC_H__
#define __ACGCC_H__
 
/* 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)))
 
/* Some compilers complain about unused variables. Sometimes we don't want to
* use all the variables (most specifically for _THIS_MODULE). This allow us
* to to tell the compiler warning in a per-variable manner that a variable
* is unused.
*/
#define ACPI_UNUSED_VAR __attribute__ ((unused))
 
#endif /* __ACGCC_H__ */
/shark/trunk/drivers/linuxc26/include/acpi/platform/aclinux.h
0,0 → 1,92
/******************************************************************************
*
* Name: aclinux.h - OS specific defines, etc.
*
*****************************************************************************/
 
/*
* Copyright (C) 2000 - 2003, 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.
*/
 
#ifndef __ACLINUX_H__
#define __ACLINUX_H__
 
#define ACPI_OS_NAME "Linux"
 
#define ACPI_USE_SYSTEM_CLIBRARY
#define ACPI_USE_DO_WHILE_0
 
#ifdef __KERNEL__
 
#include <linux/config.h>
#include <linux/string.h>
#include <linux/kernel.h>
#include <linux/ctype.h>
#include <asm/system.h>
#include <asm/atomic.h>
#include <asm/div64.h>
#include <asm/acpi.h>
 
#define strtoul simple_strtoul
 
#define ACPI_MACHINE_WIDTH BITS_PER_LONG
 
#else /* !__KERNEL__ */
 
#include <stdarg.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#include <unistd.h>
 
#if defined(__ia64__) || defined(__x86_64__)
#define ACPI_MACHINE_WIDTH 64
#define COMPILER_DEPENDENT_INT64 long
#define COMPILER_DEPENDENT_UINT64 unsigned long
#else
#define ACPI_MACHINE_WIDTH 32
#define COMPILER_DEPENDENT_INT64 long long
#define COMPILER_DEPENDENT_UINT64 unsigned long long
#define ACPI_USE_NATIVE_DIVIDE
#endif
 
#endif /* __KERNEL__ */
 
/* Linux uses GCC */
 
#include "acgcc.h"
 
#endif /* __ACLINUX_H__ */
/shark/trunk/drivers/linuxc26/include/acpi/aclocal.h
0,0 → 1,972
/******************************************************************************
*
* Name: aclocal.h - Internal data types used across the ACPI subsystem
*
*****************************************************************************/
 
/*
* Copyright (C) 2000 - 2003, 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.
*/
 
#ifndef __ACLOCAL_H__
#define __ACLOCAL_H__
 
 
#define ACPI_WAIT_FOREVER 0xFFFF /* u16, as per ACPI spec */
 
typedef void * acpi_mutex;
typedef u32 acpi_mutex_handle;
 
 
/* Total number of aml opcodes defined */
 
#define AML_NUM_OPCODES 0x7E
 
 
/*****************************************************************************
*
* Mutex typedefs and structs
*
****************************************************************************/
 
 
/*
* Predefined handles for the mutex objects used within the subsystem
* All mutex objects are automatically created by acpi_ut_mutex_initialize.
*
* The acquire/release ordering protocol is implied via this list. Mutexes
* with a lower value must be acquired before mutexes with a higher value.
*
* NOTE: any changes here must be reflected in the acpi_gbl_mutex_names table also!
*/
 
#define ACPI_MTX_EXECUTE 0
#define ACPI_MTX_INTERPRETER 1
#define ACPI_MTX_PARSER 2
#define ACPI_MTX_DISPATCHER 3
#define ACPI_MTX_TABLES 4
#define ACPI_MTX_OP_REGIONS 5
#define ACPI_MTX_NAMESPACE 6
#define ACPI_MTX_EVENTS 7
#define ACPI_MTX_HARDWARE 8
#define ACPI_MTX_CACHES 9
#define ACPI_MTX_MEMORY 10
#define ACPI_MTX_DEBUG_CMD_COMPLETE 11
#define ACPI_MTX_DEBUG_CMD_READY 12
 
#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[] =
{
"ACPI_MTX_Execute",
"ACPI_MTX_Interpreter",
"ACPI_MTX_Parser",
"ACPI_MTX_Dispatcher",
"ACPI_MTX_Tables",
"ACPI_MTX_op_regions",
"ACPI_MTX_Namespace",
"ACPI_MTX_Events",
"ACPI_MTX_Hardware",
"ACPI_MTX_Caches",
"ACPI_MTX_Memory",
"ACPI_MTX_debug_cmd_complete",
"ACPI_MTX_debug_cmd_ready",
};
 
#endif
#endif
 
 
/* Table for the global mutexes */
 
struct acpi_mutex_info
{
acpi_mutex mutex;
u32 use_count;
u32 owner_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 */
 
#define ACPI_MTX_DO_NOT_LOCK 0
#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
#define ACPI_FIELD_WORD_GRANULARITY 2
#define ACPI_FIELD_DWORD_GRANULARITY 4
#define ACPI_FIELD_QWORD_GRANULARITY 8
 
/*****************************************************************************
*
* Namespace typedefs and structs
*
****************************************************************************/
 
 
/* Operational modes of the AML interpreter/scanner */
 
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.
*
* 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 owner_id;
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 flags;
};
 
 
#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_METHOD_ARG 0x08
#define ANOBJ_METHOD_LOCAL 0x10
#define ANOBJ_METHOD_NO_RETVAL 0x20
#define ANOBJ_METHOD_SOME_NO_RETVAL 0x40
 
#define ANOBJ_IS_BIT_OFFSET 0x80
 
 
/*
* 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 table_id;
u8 type;
u8 allocation;
u8 loaded_into_namespace;
};
 
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_ns_search_data
{
struct acpi_namespace_node *node;
};
 
 
/*
* Predefined Namespace items
*/
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;
};
 
 
/* 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;
};
 
 
/*****************************************************************************
*
* Event typedefs and structs
*
****************************************************************************/
 
/* Information about a GPE, one per each GPE in an array */
 
struct acpi_gpe_event_info
{
struct acpi_namespace_node *method_node; /* Method node for this GPE level */
acpi_gpe_handler handler; /* Address of handler, if any */
void *context; /* Context to be passed to handler */
struct acpi_gpe_register_info *register_info; /* Backpointer to register info */
u8 flags; /* Level or Edge */
u8 bit_mask; /* This GPE 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 status; /* Current value of status reg */
u8 enable; /* Current value of enable reg */
u8 wake_enable; /* Mask of bits to keep enabled when sleeping */
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_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_level; /* System interrupt level */
};
 
 
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_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;
};
 
 
/*****************************************************************************
*
* Generic "state" object for stacks
*
****************************************************************************/
 
 
#define ACPI_CONTROL_NORMAL 0xC0
#define ACPI_CONTROL_CONDITIONAL_EXECUTING 0xC1
#define ACPI_CONTROL_PREDICATE_EXECUTING 0xC2
#define ACPI_CONTROL_PREDICATE_FALSE 0xC3
#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; \
u16 value; \
u16 state; \
u16 reserved; \
void *next; \
 
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;
};
 
 
/*
* 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;
};
 
 
/*
* 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;
};
 
 
/*
* Scope state - current scope during namespace lookups
*/
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 */
};
 
 
/*
* 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 */
u16 current_sync_level; /* Mutex Sync (nested acquire) level */
};
 
 
/*
* Result values - used to accumulate the results of nested
* AML arguments
*/
struct acpi_result_values
{
ACPI_STATE_COMMON
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);
 
 
/*
* 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;
};
 
 
/* 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;
};
 
 
/*****************************************************************************
*
* Interpreter typedefs and structs
*
****************************************************************************/
 
typedef
acpi_status (*ACPI_EXECUTE_OP) (
struct acpi_walk_state *walk_state);
 
 
/*****************************************************************************
*
* Parser typedefs and structs
*
****************************************************************************/
 
/*
* AML opcode, name, and argument layout
*/
struct acpi_opcode_info
{
#if defined(ACPI_DISASSEMBLER) || defined(ACPI_DEBUG_OUTPUT)
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 */
};
 
 
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 \
u8 data_type; /* To differentiate various internal objs */\
u8 flags; /* Type of Op */\
u16 aml_opcode; /* AML opcode */\
u32 aml_offset; /* Offset of declaration in AML */\
union acpi_parse_object *parent; /* Parent op */\
union acpi_parse_object *next; /* Next op */\
ACPI_DISASM_ONLY_MEMBERS (\
u8 disasm_flags; /* Used during AML disassembly */\
u8 disasm_opcode; /* Subtype used for disassembly */\
char aml_op_name[16]) /* Op name (debug only) */\
/* NON-DEBUG members below: */\
struct acpi_namespace_node *node; /* For use by interpreter */\
union acpi_parse_value value; /* Value or args associated with the opcode */\
 
 
#define ACPI_DASM_BUFFER 0x00
#define ACPI_DASM_RESOURCE 0x01
#define ACPI_DASM_STRING 0x02
#define ACPI_DASM_UNICODE 0x03
#define ACPI_DASM_EISAID 0x04
#define ACPI_DASM_MATCHOP 0x05
 
/*
* generic operation (for example: If, While, Store)
*/
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 */
};
 
 
/* 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;
};
 
 
/*
* 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;
};
 
 
/* Parse object flags */
 
#define ACPI_PARSEOP_GENERIC 0x01
#define ACPI_PARSEOP_NAMED 0x02
#define ACPI_PARSEOP_DEFERRED 0x04
#define ACPI_PARSEOP_BYTELIST 0x08
#define ACPI_PARSEOP_IN_CACHE 0x80
 
/* Parse object disasm_flags */
 
#define ACPI_PARSEOP_IGNORE 0x01
#define ACPI_PARSEOP_PARAMLIST 0x02
#define ACPI_PARSEOP_EMPTY_TERMLIST 0x04
#define ACPI_PARSEOP_SPECIAL 0x10
 
 
/*****************************************************************************
*
* Hardware (ACPI registers) and PNP
*
****************************************************************************/
 
#define PCI_ROOT_HID_STRING "PNP0A03"
 
struct acpi_bit_register_info
{
u8 parent_register;
u8 bit_position;
u16 access_bit_mask;
};
 
 
/*
* Register IDs
* These are the full ACPI registers
*/
#define ACPI_REGISTER_PM1_STATUS 0x01
#define ACPI_REGISTER_PM1_ENABLE 0x02
#define ACPI_REGISTER_PM1_CONTROL 0x03
#define ACPI_REGISTER_PM1A_CONTROL 0x04
#define ACPI_REGISTER_PM1B_CONTROL 0x05
#define ACPI_REGISTER_PM2_CONTROL 0x06
#define ACPI_REGISTER_PM_TIMER 0x07
#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
#define ACPI_BITMASK_BUS_MASTER_STATUS 0x0010
#define ACPI_BITMASK_GLOBAL_LOCK_STATUS 0x0020
#define ACPI_BITMASK_POWER_BUTTON_STATUS 0x0100
#define ACPI_BITMASK_SLEEP_BUTTON_STATUS 0x0200
#define ACPI_BITMASK_RT_CLOCK_STATUS 0x0400
#define ACPI_BITMASK_WAKE_STATUS 0x8000
 
#define ACPI_BITMASK_ALL_FIXED_STATUS (ACPI_BITMASK_TIMER_STATUS | \
ACPI_BITMASK_BUS_MASTER_STATUS | \
ACPI_BITMASK_GLOBAL_LOCK_STATUS | \
ACPI_BITMASK_POWER_BUTTON_STATUS | \
ACPI_BITMASK_SLEEP_BUTTON_STATUS | \
ACPI_BITMASK_RT_CLOCK_STATUS | \
ACPI_BITMASK_WAKE_STATUS)
 
#define ACPI_BITMASK_TIMER_ENABLE 0x0001
#define ACPI_BITMASK_GLOBAL_LOCK_ENABLE 0x0020
#define ACPI_BITMASK_POWER_BUTTON_ENABLE 0x0100
#define ACPI_BITMASK_SLEEP_BUTTON_ENABLE 0x0200
#define ACPI_BITMASK_RT_CLOCK_ENABLE 0x0400
 
#define ACPI_BITMASK_SCI_ENABLE 0x0001
#define ACPI_BITMASK_BUS_MASTER_RLD 0x0002
#define ACPI_BITMASK_GLOBAL_LOCK_RELEASE 0x0004
#define ACPI_BITMASK_SLEEP_TYPE_X 0x1C00
#define ACPI_BITMASK_SLEEP_ENABLE 0x2000
 
#define ACPI_BITMASK_ARB_DISABLE 0x0001
 
 
/* Raw bit position of each bit_register */
 
#define ACPI_BITPOSITION_TIMER_STATUS 0x00
#define ACPI_BITPOSITION_BUS_MASTER_STATUS 0x04
#define ACPI_BITPOSITION_GLOBAL_LOCK_STATUS 0x05
#define ACPI_BITPOSITION_POWER_BUTTON_STATUS 0x08
#define ACPI_BITPOSITION_SLEEP_BUTTON_STATUS 0x09
#define ACPI_BITPOSITION_RT_CLOCK_STATUS 0x0A
#define ACPI_BITPOSITION_WAKE_STATUS 0x0F
 
#define ACPI_BITPOSITION_TIMER_ENABLE 0x00
#define ACPI_BITPOSITION_GLOBAL_LOCK_ENABLE 0x05
#define ACPI_BITPOSITION_POWER_BUTTON_ENABLE 0x08
#define ACPI_BITPOSITION_SLEEP_BUTTON_ENABLE 0x09
#define ACPI_BITPOSITION_RT_CLOCK_ENABLE 0x0A
 
#define ACPI_BITPOSITION_SCI_ENABLE 0x00
#define ACPI_BITPOSITION_BUS_MASTER_RLD 0x01
#define ACPI_BITPOSITION_GLOBAL_LOCK_RELEASE 0x02
#define ACPI_BITPOSITION_SLEEP_TYPE_X 0x0A
#define ACPI_BITPOSITION_SLEEP_ENABLE 0x0D
 
#define ACPI_BITPOSITION_ARB_DISABLE 0x00
 
 
/*****************************************************************************
*
* Resource descriptors
*
****************************************************************************/
 
 
/* resource_type values */
 
#define ACPI_RESOURCE_TYPE_MEMORY_RANGE 0
#define ACPI_RESOURCE_TYPE_IO_RANGE 1
#define ACPI_RESOURCE_TYPE_BUS_NUMBER_RANGE 2
 
/* Resource descriptor types and masks */
 
#define ACPI_RDESC_TYPE_LARGE 0x80
#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 */
 
 
/*
* Small resource descriptor types
* Note: The 3 length bits (2:0) must be zero
*/
#define ACPI_RDESC_TYPE_IRQ_FORMAT 0x20
#define ACPI_RDESC_TYPE_DMA_FORMAT 0x28
#define ACPI_RDESC_TYPE_START_DEPENDENT 0x30
#define ACPI_RDESC_TYPE_END_DEPENDENT 0x38
#define ACPI_RDESC_TYPE_IO_PORT 0x40
#define ACPI_RDESC_TYPE_FIXED_IO_PORT 0x48
#define ACPI_RDESC_TYPE_SMALL_VENDOR 0x70
#define ACPI_RDESC_TYPE_END_TAG 0x78
 
/*
* Large resource descriptor types
*/
 
#define ACPI_RDESC_TYPE_MEMORY_24 0x81
#define ACPI_RDESC_TYPE_GENERAL_REGISTER 0x82
#define ACPI_RDESC_TYPE_LARGE_VENDOR 0x84
#define ACPI_RDESC_TYPE_MEMORY_32 0x85
#define ACPI_RDESC_TYPE_FIXED_MEMORY_32 0x86
#define ACPI_RDESC_TYPE_DWORD_ADDRESS_SPACE 0x87
#define ACPI_RDESC_TYPE_WORD_ADDRESS_SPACE 0x88
#define ACPI_RDESC_TYPE_EXTENDED_XRUPT 0x89
#define ACPI_RDESC_TYPE_QWORD_ADDRESS_SPACE 0x8A
 
 
/*****************************************************************************
*
* Miscellaneous
*
****************************************************************************/
 
#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_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
*
****************************************************************************/
 
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
#define ACPI_MEM_CALLOC 1
#define ACPI_MAX_MODULE_NAME 16
 
#define ACPI_COMMON_DEBUG_MEM_HEADER \
struct acpi_debug_mem_block *previous; \
struct acpi_debug_mem_block *next; \
u32 size; \
u32 component; \
u32 line; \
char module[ACPI_MAX_MODULE_NAME]; \
u8 alloc_type;
 
struct acpi_debug_mem_header
{
ACPI_COMMON_DEBUG_MEM_HEADER
};
 
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_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
 
 
struct acpi_memory_list
{
void *list_head;
u16 link_offset;
u16 max_cache_depth;
u16 cache_depth;
u16 object_size;
 
#ifdef ACPI_DBG_TRACK_ALLOCATIONS
 
/* Statistics for debug memory tracking only */
 
u32 total_allocated;
u32 total_freed;
u32 current_total_size;
u32 cache_requests;
u32 cache_hits;
char *list_name;
#endif
};
 
 
#endif /* __ACLOCAL_H__ */
/shark/trunk/drivers/linuxc26/include/acpi/acglobal.h
0,0 → 1,307
/******************************************************************************
*
* Name: acglobal.h - Declarations for global variables
*
*****************************************************************************/
 
/*
* Copyright (C) 2000 - 2003, 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.
*/
 
#ifndef __ACGLOBAL_H__
#define __ACGLOBAL_H__
 
 
/*
* Ensure that the globals are actually defined only once.
*
* The use of these defines allows a single list of globals (here) in order
* to simplify maintenance of the code.
*/
#ifdef DEFINE_ACPI_GLOBALS
#define ACPI_EXTERN
#else
#define ACPI_EXTERN extern
#endif
 
 
/*****************************************************************************
*
* Debug support
*
****************************************************************************/
 
/* Runtime configuration of debug print levels */
 
extern u32 acpi_dbg_level;
extern u32 acpi_dbg_layer;
 
/* Procedure nesting level for debug output */
 
extern u32 acpi_gbl_nesting_level;
 
 
/*****************************************************************************
*
* ACPI Table globals
*
****************************************************************************/
 
/*
* Table pointers.
* Although these pointers are somewhat redundant with the global acpi_table,
* they are convenient because they are typed pointers.
*
* 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;
 
/*
* Handle both ACPI 1.0 and ACPI 2.0 Integer widths
* If we are running a method that exists in a 32-bit ACPI table.
* Use only 32 bits of the Integer for conversion.
*/
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 struct acpi_generic_address acpi_gbl_xpm1a_enable;
ACPI_EXTERN struct acpi_generic_address acpi_gbl_xpm1b_enable;
 
/*
* Since there may be multiple SSDTs and PSDTS, a single pointer is not
* sufficient; Therefore, there isn't one!
*/
 
 
/*
* 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];
 
/*
* 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];
 
 
/*****************************************************************************
*
* Miscellaneous globals
*
****************************************************************************/
 
 
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_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 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 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;
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;
 
extern u8 acpi_gbl_shutdown;
extern u32 acpi_gbl_startup_flags;
extern const u8 acpi_gbl_decode_to8bit[8];
extern const char *acpi_gbl_db_sleep_states[ACPI_S_STATE_COUNT];
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];
 
 
/*****************************************************************************
*
* Namespace globals
*
****************************************************************************/
 
#define NUM_NS_TYPES ACPI_TYPE_INVALID+1
 
#if defined (ACPI_NO_METHOD_EXECUTION) || defined (ACPI_CONSTANT_EVAL_ONLY)
#define NUM_PREDEFINED_NAMES 10
#else
#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;
 
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;
#endif
 
/*****************************************************************************
*
* Interpreter globals
*
****************************************************************************/
 
 
ACPI_EXTERN struct acpi_thread_state *acpi_gbl_current_walk_list;
 
/* Control method single step flag */
 
ACPI_EXTERN u8 acpi_gbl_cm_single_step;
 
 
/*****************************************************************************
*
* Parser globals
*
****************************************************************************/
 
ACPI_EXTERN union acpi_parse_object *acpi_gbl_parsed_namespace_root;
 
/*****************************************************************************
*
* Hardware globals
*
****************************************************************************/
 
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;
 
 
/*****************************************************************************
*
* Event and GPE globals
*
****************************************************************************/
 
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;
 
 
/*****************************************************************************
*
* Debugger globals
*
****************************************************************************/
 
 
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;
#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;
 
/*
* 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 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 /* __ACGLOBAL_H__ */
/shark/trunk/drivers/linuxc26/include/acpi/acevents.h
0,0 → 1,263
/******************************************************************************
*
* Name: acevents.h - Event subcomponent prototypes and defines
*
*****************************************************************************/
 
/*
* Copyright (C) 2000 - 2003, 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.
*/
 
#ifndef __ACEVENTS_H__
#define __ACEVENTS_H__
 
 
acpi_status
acpi_ev_initialize (
void);
 
acpi_status
acpi_ev_handler_initialize (
void);
 
 
/*
* Evfixed - Fixed event handling
*/
 
acpi_status
acpi_ev_fixed_event_initialize (
void);
 
u32
acpi_ev_fixed_event_detect (
void);
 
u32
acpi_ev_fixed_event_dispatch (
u32 event);
 
 
/*
* Evmisc
*/
 
u8
acpi_ev_is_notify_object (
struct acpi_namespace_node *node);
 
acpi_status
acpi_ev_acquire_global_lock(
u16 timeout);
 
acpi_status
acpi_ev_release_global_lock(
void);
 
acpi_status
acpi_ev_init_global_lock_handler (
void);
 
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);
 
void ACPI_SYSTEM_XFACE
acpi_ev_notify_dispatch (
void *context);
 
 
/*
* Evgpe - GPE handling and dispatch
*/
 
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);
 
struct acpi_gpe_event_info *
acpi_ev_get_gpe_event_info (
acpi_handle gpe_device,
u32 gpe_number);
 
acpi_status
acpi_ev_gpe_initialize (
void);
 
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_level,
struct acpi_gpe_block_info **return_gpe_block);
 
acpi_status
acpi_ev_delete_gpe_block (
struct acpi_gpe_block_info *gpe_block);
 
u32
acpi_ev_gpe_dispatch (
struct acpi_gpe_event_info *gpe_event_info,
u32 gpe_number);
 
u32
acpi_ev_gpe_detect (
struct acpi_gpe_xrupt_info *gpe_xrupt_list);
 
/*
* Evregion - Address Space handling
*/
 
acpi_status
acpi_ev_init_address_spaces (
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_status
acpi_ev_install_handler (
acpi_handle obj_handle,
u32 level,
void *context,
void **return_value);
 
acpi_status
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);
 
 
/*
* 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_status
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_status
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_status
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);
 
 
/*
* 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);
 
acpi_status
acpi_ev_remove_sci_handler (
void);
 
u32
acpi_ev_initialize_sCI (
u32 program_sCI);
 
void
acpi_ev_terminate (
void);
 
 
#endif /* __ACEVENTS_H__ */
/shark/trunk/drivers/linuxc26/include/acpi/acpi_drivers.h
0,0 → 1,167
/*
* acpi_drivers.h ($Revision: 1.1 $)
*
* Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com>
* Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
*
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*
* 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.
*
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
 
#ifndef __ACPI_DRIVERS_H__
#define __ACPI_DRIVERS_H__
 
#include <linux/acpi.h>
#include <acpi/acpi_bus.h>
 
 
#define ACPI_MAX_STRING 80
 
#define ACPI_BUS_COMPONENT 0x00010000
#define ACPI_SYSTEM_COMPONENT 0x02000000
 
/* _HID definitions */
 
#define ACPI_POWER_HID "ACPI_PWR"
#define ACPI_PROCESSOR_HID "ACPI_CPU"
#define ACPI_SYSTEM_HID "ACPI_SYS"
#define ACPI_THERMAL_HID "ACPI_THM"
#define ACPI_BUTTON_HID_POWERF "ACPI_FPB"
#define ACPI_BUTTON_HID_SLEEPF "ACPI_FSB"
 
 
/* --------------------------------------------------------------------------
PCI
-------------------------------------------------------------------------- */
 
#ifdef CONFIG_ACPI_PCI
 
#define ACPI_PCI_COMPONENT 0x00400000
 
/* ACPI PCI Root Bridge (pci_root.c) */
 
void acpi_pci_get_translations (struct acpi_pci_id* id, u64* mem_tra, u64* io_tra);
 
/* ACPI PCI Interrupt Link (pci_link.c) */
 
int acpi_pci_link_check (void);
int acpi_pci_link_get_irq (acpi_handle handle, int index, int* edge_level, int* active_high_low);
 
/* ACPI PCI Interrupt Routing (pci_irq.c) */
 
int acpi_pci_irq_add_prt (acpi_handle handle, int segment, int bus);
 
/* ACPI PCI Device Binding (pci_bind.c) */
 
struct pci_bus;
 
int acpi_pci_bind (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*/
 
 
/* --------------------------------------------------------------------------
Power Resource
-------------------------------------------------------------------------- */
 
#ifdef CONFIG_ACPI_POWER
 
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);
#endif
 
/* --------------------------------------------------------------------------
Processor
-------------------------------------------------------------------------- */
 
#define ACPI_PROCESSOR_LIMIT_NONE 0x00
#define ACPI_PROCESSOR_LIMIT_INCREMENT 0x01
#define ACPI_PROCESSOR_LIMIT_DECREMENT 0x02
 
int acpi_processor_set_thermal_limit(acpi_handle handle, int type);
 
 
/* --------------------------------------------------------------------------
Debug Support
-------------------------------------------------------------------------- */
 
#define ACPI_DEBUG_RESTORE 0
#define ACPI_DEBUG_LOW 1
#define ACPI_DEBUG_MEDIUM 2
#define ACPI_DEBUG_HIGH 3
#define ACPI_DEBUG_DRIVERS 4
 
extern u32 acpi_dbg_level;
extern u32 acpi_dbg_layer;
 
static inline void
acpi_set_debug (
u32 flag)
{
static u32 layer_save;
static u32 level_save;
 
switch (flag) {
case ACPI_DEBUG_RESTORE:
acpi_dbg_layer = layer_save;
acpi_dbg_level = level_save;
break;
case ACPI_DEBUG_LOW:
case ACPI_DEBUG_MEDIUM:
case ACPI_DEBUG_HIGH:
case ACPI_DEBUG_DRIVERS:
layer_save = acpi_dbg_layer;
level_save = acpi_dbg_level;
break;
}
 
switch (flag) {
case ACPI_DEBUG_LOW:
acpi_dbg_layer = ACPI_COMPONENT_DEFAULT | ACPI_ALL_DRIVERS;
acpi_dbg_level = ACPI_DEBUG_DEFAULT;
break;
case ACPI_DEBUG_MEDIUM:
acpi_dbg_layer = ACPI_COMPONENT_DEFAULT | ACPI_ALL_DRIVERS;
acpi_dbg_level = ACPI_LV_FUNCTIONS | ACPI_LV_ALL_EXCEPTIONS;
break;
case ACPI_DEBUG_HIGH:
acpi_dbg_layer = 0xFFFFFFFF;
acpi_dbg_level = 0xFFFFFFFF;
break;
case ACPI_DEBUG_DRIVERS:
acpi_dbg_layer = ACPI_ALL_DRIVERS;
acpi_dbg_level = 0xFFFFFFFF;
break;
}
}
 
 
#endif /*__ACPI_DRIVERS_H__*/
/shark/trunk/drivers/linuxc26/include/acpi/acpi.h
0,0 → 1,69
/******************************************************************************
*
* Name: acpi.h - Master include file, Publics and external data.
*
*****************************************************************************/
 
/*
* Copyright (C) 2000 - 2003, 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.
*/
 
#ifndef __ACPI_H__
#define __ACPI_H__
 
/*
* Common includes for all ACPI driver files
* We put them here because we don't want to duplicate them
* in the rest of the source code again and again.
*/
#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__ */
/shark/trunk/drivers/linuxc26/include/acpi/actables.h
0,0 → 1,233
/******************************************************************************
*
* Name: actables.h - ACPI table management
*
*****************************************************************************/
 
/*
* Copyright (C) 2000 - 2003, 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.
*/
 
#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
 
 
acpi_status
acpi_tb_handle_to_object (
u16 table_id,
struct acpi_table_desc **table_desc);
 
/*
* tbconvrt - Table conversion routines
*/
 
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_build_common_facs (
struct acpi_table_desc *table_info);
 
u32
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_status
acpi_tb_get_table_body (
struct acpi_pointer *address,
struct acpi_table_header *header,
struct acpi_table_desc *table_info);
 
acpi_status
acpi_tb_get_this_table (
struct acpi_pointer *address,
struct acpi_table_header *header,
struct acpi_table_desc *table_info);
 
acpi_status
acpi_tb_table_override (
struct acpi_table_header *header,
struct acpi_table_desc *table_info);
 
acpi_status
acpi_tb_get_table_ptr (
acpi_table_type table_type,
u32 instance,
struct acpi_table_header **table_ptr_loc);
 
acpi_status
acpi_tb_verify_rsdp (
struct acpi_pointer *address);
 
void
acpi_tb_get_rsdt_address (
struct acpi_pointer *out_address);
 
acpi_status
acpi_tb_validate_rsdt (
struct acpi_table_header *table_ptr);
 
acpi_status
acpi_tb_get_required_tables (
void);
 
acpi_status
acpi_tb_get_primary_table (
struct acpi_pointer *address,
struct acpi_table_desc *table_info);
 
acpi_status
acpi_tb_get_secondary_table (
struct acpi_pointer *address,
acpi_string signature,
struct acpi_table_desc *table_info);
 
/*
* tbinstall - Table installation
*/
 
acpi_status
acpi_tb_install_table (
struct acpi_table_desc *table_info);
 
acpi_status
acpi_tb_match_signature (
char *signature,
struct acpi_table_desc *table_info,
u8 search_type);
 
acpi_status
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);
 
 
/*
* 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_single_table (
struct acpi_table_desc *table_desc);
 
struct acpi_table_desc *
acpi_tb_uninstall_table (
struct acpi_table_desc *table_desc);
 
 
/*
* tbrsd - RSDP, RSDT utilities
*/
 
acpi_status
acpi_tb_get_table_rsdt (
void);
 
u8 *
acpi_tb_scan_memory_for_rsdp (
u8 *start_address,
u32 length);
 
acpi_status
acpi_tb_find_rsdp (
struct acpi_table_desc *table_info,
u32 flags);
 
 
/*
* tbutils - common table utilities
*/
 
acpi_status
acpi_tb_find_table (
char *signature,
char *oem_id,
char *oem_table_id,
struct acpi_table_header **table_ptr);
 
acpi_status
acpi_tb_verify_table_checksum (
struct acpi_table_header *table_header);
 
u8
acpi_tb_checksum (
void *buffer,
u32 length);
 
acpi_status
acpi_tb_validate_table_header (
struct acpi_table_header *table_header);
 
 
#endif /* __ACTABLES_H__ */
/shark/trunk/drivers/linuxc26/include/acpi/processor.h
0,0 → 1,141
#ifndef __ACPI_PROCESSOR_H
#define __ACPI_PROCESSOR_H
 
#include <linux/kernel.h>
 
#define ACPI_PROCESSOR_BUSY_METRIC 10
 
#define ACPI_PROCESSOR_MAX_POWER ACPI_C_STATE_COUNT
#define ACPI_PROCESSOR_MAX_C2_LATENCY 100
#define ACPI_PROCESSOR_MAX_C3_LATENCY 1000
 
#define ACPI_PROCESSOR_MAX_PERFORMANCE 8
 
#define ACPI_PROCESSOR_MAX_THROTTLING 16
#define ACPI_PROCESSOR_MAX_THROTTLE 250 /* 25% */
#define ACPI_PROCESSOR_MAX_DUTY_WIDTH 4
 
/* Power Management */
 
struct acpi_processor_cx_policy {
u32 count;
int state;
struct {
u32 time;
u32 ticks;
u32 count;
u32 bm;
} threshold;
};
 
struct acpi_processor_cx {
u8 valid;
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 {
int state;
int default_state;
u32 bm_activity;
struct acpi_processor_cx states[ACPI_PROCESSOR_MAX_POWER];
};
 
/* Performance Management */
 
struct acpi_pct_register {
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 */
};
 
struct acpi_processor_performance {
int state;
int platform_limit;
u16 control_register;
u16 status_register;
int state_count;
struct acpi_processor_px states[ACPI_PROCESSOR_MAX_PERFORMANCE];
struct cpufreq_frequency_table freq_table[ACPI_PROCESSOR_MAX_PERFORMANCE];
struct acpi_processor *pr;
};
 
 
/* Throttling Control */
 
struct acpi_processor_tx {
u16 power;
u16 performance;
};
 
struct acpi_processor_throttling {
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 */
};
 
struct acpi_processor_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_flags {
u8 power:1;
u8 performance:1;
u8 throttling:1;
u8 limit:1;
u8 bm_control:1;
u8 bm_check:1;
u8 reserved:2;
};
 
struct acpi_processor {
acpi_handle handle;
u32 acpi_id;
u32 id;
int performance_platform_limit;
struct acpi_processor_flags flags;
struct acpi_processor_power power;
struct acpi_processor_performance *performance;
struct acpi_processor_throttling throttling;
struct acpi_processor_limit limit;
};
 
extern int acpi_processor_get_platform_limit (
struct acpi_processor* pr);
extern int acpi_processor_register_performance (
struct acpi_processor_performance * performance,
struct acpi_processor ** pr,
unsigned int cpu);
 
#endif
/shark/trunk/drivers/linuxc26/include/acpi/acmacros.h
0,0 → 1,690
/******************************************************************************
*
* Name: acmacros.h - C macros for the entire subsystem.
*
*****************************************************************************/
 
/*
* Copyright (C) 2000 - 2003, 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.
*/
 
#ifndef __ACMACROS_H__
#define __ACMACROS_H__
 
 
/*
* Data manipulation macros
*/
 
#define ACPI_LOWORD(l) ((u16)(u32)(l))
#define ACPI_HIWORD(l) ((u16)((((u32)(l)) >> 16) & 0xFFFF))
#define ACPI_LOBYTE(l) ((u8)(u16)(l))
#define ACPI_HIBYTE(l) ((u8)((((u16)(l)) >> 8) & 0xFF))
 
 
#if ACPI_MACHINE_WIDTH == 16
 
/*
* For 16-bit addresses, we have to assume that the upper 32 bits
* are zero.
*/
#define ACPI_LODWORD(l) ((u32)(l))
#define ACPI_HIDWORD(l) ((u32)(0))
 
#define ACPI_GET_ADDRESS(a) ((a).lo)
#define ACPI_STORE_ADDRESS(a,b) {(a).hi=0;(a).lo=(u32)(b);}
#define ACPI_VALID_ADDRESS(a) ((a).hi | (a).lo)
 
#else
#ifdef ACPI_NO_INTEGER64_SUPPORT
/*
* acpi_integer is 32-bits, no 64-bit support on this platform
*/
#define ACPI_LODWORD(l) ((u32)(l))
#define ACPI_HIDWORD(l) ((u32)(0))
 
#define ACPI_GET_ADDRESS(a) (a)
#define ACPI_STORE_ADDRESS(a,b) ((a)=(b))
#define ACPI_VALID_ADDRESS(a) (a)
 
#else
 
/*
* Full 64-bit address/integer on both 32-bit and 64-bit platforms
*/
#define ACPI_LODWORD(l) ((u32)(u64)(l))
#define ACPI_HIDWORD(l) ((u32)(((*(struct uint64_struct *)(void *)(&l))).hi))
 
#define ACPI_GET_ADDRESS(a) (a)
#define ACPI_STORE_ADDRESS(a,b) ((a)=(acpi_physical_address)(b))
#define ACPI_VALID_ADDRESS(a) (a)
#endif
#endif
 
/*
* Extract a byte of data using a pointer. Any more than a byte and we
* get into potential aligment issues -- see the STORE macros below
*/
#define ACPI_GET8(addr) (*(u8*)(addr))
 
/* Pointer arithmetic */
 
#define ACPI_PTR_ADD(t,a,b) (t *) (void *)((char *)(a) + (acpi_native_uint)(b))
#define ACPI_PTR_DIFF(a,b) (acpi_native_uint) ((char *)(a) - (char *)(b))
 
/* Pointer/Integer type conversions */
 
#define ACPI_TO_POINTER(i) ACPI_PTR_ADD (void, (void *) NULL,(acpi_native_uint)i)
#define ACPI_TO_INTEGER(p) ACPI_PTR_DIFF (p,(void *) NULL)
#define ACPI_OFFSET(d,f) (acpi_size) ACPI_PTR_DIFF (&(((d *)0)->f),(void *) NULL)
#define ACPI_FADT_OFFSET(f) ACPI_OFFSET (FADT_DESCRIPTOR, f)
 
#define ACPI_CAST_PTR(t, p) ((t *)(void *)(p))
#define ACPI_CAST_INDIRECT_PTR(t, p) ((t **)(void *)(p))
 
#if ACPI_MACHINE_WIDTH == 16
#define ACPI_STORE_POINTER(d,s) ACPI_MOVE_32_TO_32(d,s)
#define ACPI_PHYSADDR_TO_PTR(i) (void *)(i)
#define ACPI_PTR_TO_PHYSADDR(i) (u32) (char *)(i)
#else
#define ACPI_PHYSADDR_TO_PTR(i) ACPI_TO_POINTER(i)
#define ACPI_PTR_TO_PHYSADDR(i) ACPI_TO_INTEGER(i)
#endif
 
/*
* Macros for moving data around to/from buffers that are possibly unaligned.
* If the hardware supports the transfer of unaligned data, just do the store.
* Otherwise, we have to move one byte at a time.
*/
 
#ifdef ACPI_BIG_ENDIAN
/*
* Macros for big-endian machines
*/
 
/* This macro sets a buffer index, starting from the end of the buffer */
 
#define ACPI_BUFFER_INDEX(buf_len,buf_offset,byte_gran) ((buf_len) - (((buf_offset)+1) * (byte_gran)))
 
/* These macros reverse the bytes during the move, converting little-endian to big endian */
 
/* Big Endian <== Little Endian */
/* Hi...Lo Lo...Hi */
/* 16-bit source, 16/32/64 destination */
 
#define ACPI_MOVE_16_TO_16(d,s) {(( u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[1];\
(( u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[0];}
 
#define ACPI_MOVE_16_TO_32(d,s) {(*(u32 *)(void *)(d))=0;\
((u8 *)(void *)(d))[2] = ((u8 *)(void *)(s))[1];\
((u8 *)(void *)(d))[3] = ((u8 *)(void *)(s))[0];}
 
#define ACPI_MOVE_16_TO_64(d,s) {(*(u64 *)(void *)(d))=0;\
((u8 *)(void *)(d))[6] = ((u8 *)(void *)(s))[1];\
((u8 *)(void *)(d))[7] = ((u8 *)(void *)(s))[0];}
 
/* 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_32(d,s) {(( u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[3];\
(( u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[2];\
(( u8 *)(void *)(d))[2] = ((u8 *)(void *)(s))[1];\
(( u8 *)(void *)(d))[3] = ((u8 *)(void *)(s))[0];}
 
#define ACPI_MOVE_32_TO_64(d,s) {(*(u64 *)(void *)(d))=0;\
((u8 *)(void *)(d))[4] = ((u8 *)(void *)(s))[3];\
((u8 *)(void *)(d))[5] = ((u8 *)(void *)(s))[2];\
((u8 *)(void *)(d))[6] = ((u8 *)(void *)(s))[1];\
((u8 *)(void *)(d))[7] = ((u8 *)(void *)(s))[0];}
 
/* 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_64(d,s) {(( u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[7];\
(( u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[6];\
(( u8 *)(void *)(d))[2] = ((u8 *)(void *)(s))[5];\
(( u8 *)(void *)(d))[3] = ((u8 *)(void *)(s))[4];\
(( u8 *)(void *)(d))[4] = ((u8 *)(void *)(s))[3];\
(( u8 *)(void *)(d))[5] = ((u8 *)(void *)(s))[2];\
(( u8 *)(void *)(d))[6] = ((u8 *)(void *)(s))[1];\
(( u8 *)(void *)(d))[7] = ((u8 *)(void *)(s))[0];}
#else
/*
* Macros for little-endian machines
*/
 
/* This macro sets a buffer index, starting from the beginning of the buffer */
 
#define ACPI_BUFFER_INDEX(buf_len,buf_offset,byte_gran) (buf_offset)
 
#ifdef ACPI_MISALIGNED_TRANSFERS
 
/* The hardware supports unaligned transfers, just do the little-endian move */
 
#if ACPI_MACHINE_WIDTH == 16
 
/* No 64-bit integers */
/* 16-bit source, 16/32/64 destination */
 
#define ACPI_MOVE_16_TO_16(d,s) *(u16 *)(void *)(d) = *(u16 *)(void *)(s)
#define ACPI_MOVE_16_TO_32(d,s) *(u32 *)(void *)(d) = *(u16 *)(void *)(s)
#define ACPI_MOVE_16_TO_64(d,s) ACPI_MOVE_16_TO_32(d,s)
 
/* 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_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_64(d,s) ACPI_MOVE_32_TO_32(d,s)
 
#else
/* 16-bit source, 16/32/64 destination */
 
#define ACPI_MOVE_16_TO_16(d,s) *(u16 *)(void *)(d) = *(u16 *)(void *)(s)
#define ACPI_MOVE_16_TO_32(d,s) *(u32 *)(void *)(d) = *(u16 *)(void *)(s)
#define ACPI_MOVE_16_TO_64(d,s) *(u64 *)(void *)(d) = *(u16 *)(void *)(s)
 
/* 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_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_64(d,s) *(u64 *)(void *)(d) = *(u64 *)(void *)(s)
#endif
 
#else
/*
* The hardware does not support unaligned transfers. We must move the
* data one byte at a time. These macros work whether the source or
* the destination (or both) is/are unaligned. (Little-endian move)
*/
 
/* 16-bit source, 16/32/64 destination */
 
#define ACPI_MOVE_16_TO_16(d,s) {(( u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[0];\
(( u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[1];}
 
#define ACPI_MOVE_16_TO_32(d,s) {(*(u32 *)(void *)(d)) = 0; ACPI_MOVE_16_TO_16(d,s);}
#define ACPI_MOVE_16_TO_64(d,s) {(*(u64 *)(void *)(d)) = 0; ACPI_MOVE_16_TO_16(d,s);}
 
/* 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_32(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];\
(( u8 *)(void *)(d))[3] = ((u8 *)(void *)(s))[3];}
 
#define ACPI_MOVE_32_TO_64(d,s) {(*(u64 *)(void *)(d)) = 0; 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_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];\
(( u8 *)(void *)(d))[3] = ((u8 *)(void *)(s))[3];\
(( u8 *)(void *)(d))[4] = ((u8 *)(void *)(s))[4];\
(( u8 *)(void *)(d))[5] = ((u8 *)(void *)(s))[5];\
(( u8 *)(void *)(d))[6] = ((u8 *)(void *)(s))[6];\
(( u8 *)(void *)(d))[7] = ((u8 *)(void *)(s))[7];}
#endif
#endif
 
/* Macros based on machine integer width */
 
#if ACPI_MACHINE_WIDTH == 16
#define ACPI_MOVE_SIZE_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s)
 
#elif ACPI_MACHINE_WIDTH == 32
#define ACPI_MOVE_SIZE_TO_16(d,s) ACPI_MOVE_32_TO_16(d,s)
 
#elif ACPI_MACHINE_WIDTH == 64
#define ACPI_MOVE_SIZE_TO_16(d,s) ACPI_MOVE_64_TO_16(d,s)
 
#else
#error unknown ACPI_MACHINE_WIDTH
#endif
 
 
/*
* Fast power-of-two math macros for non-optimized compilers
*/
 
#define _ACPI_DIV(value,power_of2) ((u32) ((value) >> (power_of2)))
#define _ACPI_MUL(value,power_of2) ((u32) ((value) << (power_of2)))
#define _ACPI_MOD(value,divisor) ((u32) ((value) & ((divisor) -1)))
 
#define ACPI_DIV_2(a) _ACPI_DIV(a,1)
#define ACPI_MUL_2(a) _ACPI_MUL(a,1)
#define ACPI_MOD_2(a) _ACPI_MOD(a,2)
 
#define ACPI_DIV_4(a) _ACPI_DIV(a,2)
#define ACPI_MUL_4(a) _ACPI_MUL(a,2)
#define ACPI_MOD_4(a) _ACPI_MOD(a,4)
 
#define ACPI_DIV_8(a) _ACPI_DIV(a,3)
#define ACPI_MUL_8(a) _ACPI_MUL(a,3)
#define ACPI_MOD_8(a) _ACPI_MOD(a,8)
 
#define ACPI_DIV_16(a) _ACPI_DIV(a,4)
#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)
*/
#define ACPI_ROUND_DOWN(value,boundary) (((acpi_native_uint)(value)) & (~(((acpi_native_uint) boundary)-1)))
#define ACPI_ROUND_UP(value,boundary) ((((acpi_native_uint)(value)) + (((acpi_native_uint) boundary)-1)) & (~(((acpi_native_uint) boundary)-1)))
 
#define ACPI_ROUND_DOWN_TO_32_BITS(a) ACPI_ROUND_DOWN(a,4)
#define ACPI_ROUND_DOWN_TO_64_BITS(a) ACPI_ROUND_DOWN(a,8)
#define ACPI_ROUND_DOWN_TO_NATIVE_WORD(a) ACPI_ROUND_DOWN(a,ALIGNED_ADDRESS_BOUNDARY)
 
#define ACPI_ROUND_UP_to_32_bITS(a) ACPI_ROUND_UP(a,4)
#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))
 
#define ACPI_ROUND_UP_TO_1K(a) (((a) + 1023) >> 10)
 
/* Generic (non-power-of-two) rounding */
 
#define ACPI_ROUND_UP_TO(value,boundary) (((value) + ((boundary)-1)) / (boundary))
 
/*
* Bitmask creation
* Bit positions start at zero.
* MASK_BITS_ABOVE creates a mask starting AT the position and above
* MASK_BITS_BELOW creates a mask starting one bit BELOW the position
*/
#define ACPI_MASK_BITS_ABOVE(position) (~((ACPI_INTEGER_MAX) << ((u32) (position))))
#define ACPI_MASK_BITS_BELOW(position) ((ACPI_INTEGER_MAX) << ((u32) (position)))
 
#define ACPI_IS_OCTAL_DIGIT(d) (((char)(d) >= '0') && ((char)(d) <= '7'))
 
/* Macros for GAS addressing */
 
#if ACPI_MACHINE_WIDTH != 16
 
#define ACPI_PCI_DEVICE(a) (u16) ((ACPI_HIDWORD ((a))) & 0x0000FFFF)
#define ACPI_PCI_FUNCTION(a) (u16) ((ACPI_LODWORD ((a))) >> 16)
#define ACPI_PCI_REGISTER(a) (u16) ((ACPI_LODWORD ((a))) & 0x0000FFFF)
 
#else
 
/* No support for GAS and PCI IDs in 16-bit mode */
 
#define ACPI_PCI_FUNCTION(a) (u16) ((a) & 0xFFFF0000)
#define ACPI_PCI_DEVICE(a) (u16) ((a) & 0x0000FFFF)
#define ACPI_PCI_REGISTER(a) (u16) ((a) & 0x0000FFFF)
 
#endif
 
 
/* Bitfields within ACPI registers */
 
#define ACPI_REGISTER_PREPARE_BITS(val, pos, mask) ((val << pos) & mask)
#define ACPI_REGISTER_INSERT_VALUE(reg, pos, mask, val) reg = (reg & (~(mask))) | ACPI_REGISTER_PREPARE_BITS(val, pos, mask)
 
/*
* An struct acpi_namespace_node * can appear in some contexts,
* where a pointer to an union acpi_operand_object can also
* appear. This macro is used to distinguish them.
*
* The "Descriptor" field is the first field in both structures.
*/
#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)
 
/* Macro to check the table flags for SINGLE or MULTIPLE tables are allowed */
 
#define ACPI_IS_SINGLE_TABLE(x) (((x) & 0x01) == ACPI_TABLE_SINGLE ? 1 : 0)
 
/*
* Macros for the master AML opcode table
*/
#if defined(ACPI_DISASSEMBLER) || defined (ACPI_DEBUG_OUTPUT)
#define ACPI_OP(name,Pargs,Iargs,obj_type,class,type,flags) {name,(u32)(Pargs),(u32)(Iargs),(u32)(flags),obj_type,class,type}
#else
#define ACPI_OP(name,Pargs,Iargs,obj_type,class,type,flags) {(u32)(Pargs),(u32)(Iargs),(u32)(flags),obj_type,class,type}
#endif
 
#ifdef ACPI_DISASSEMBLER
#define ACPI_DISASM_ONLY_MEMBERS(a) a;
#else
#define ACPI_DISASM_ONLY_MEMBERS(a)
#endif
 
#define ARG_TYPE_WIDTH 5
#define ARG_1(x) ((u32)(x))
#define ARG_2(x) ((u32)(x) << (1 * ARG_TYPE_WIDTH))
#define ARG_3(x) ((u32)(x) << (2 * ARG_TYPE_WIDTH))
#define ARG_4(x) ((u32)(x) << (3 * ARG_TYPE_WIDTH))
#define ARG_5(x) ((u32)(x) << (4 * ARG_TYPE_WIDTH))
#define ARG_6(x) ((u32)(x) << (5 * ARG_TYPE_WIDTH))
 
#define ARGI_LIST1(a) (ARG_1(a))
#define ARGI_LIST2(a,b) (ARG_1(b)|ARG_2(a))
#define ARGI_LIST3(a,b,c) (ARG_1(c)|ARG_2(b)|ARG_3(a))
#define ARGI_LIST4(a,b,c,d) (ARG_1(d)|ARG_2(c)|ARG_3(b)|ARG_4(a))
#define ARGI_LIST5(a,b,c,d,e) (ARG_1(e)|ARG_2(d)|ARG_3(c)|ARG_4(b)|ARG_5(a))
#define ARGI_LIST6(a,b,c,d,e,f) (ARG_1(f)|ARG_2(e)|ARG_3(d)|ARG_4(c)|ARG_5(b)|ARG_6(a))
 
#define ARGP_LIST1(a) (ARG_1(a))
#define ARGP_LIST2(a,b) (ARG_1(a)|ARG_2(b))
#define ARGP_LIST3(a,b,c) (ARG_1(a)|ARG_2(b)|ARG_3(c))
#define ARGP_LIST4(a,b,c,d) (ARG_1(a)|ARG_2(b)|ARG_3(c)|ARG_4(d))
#define ARGP_LIST5(a,b,c,d,e) (ARG_1(a)|ARG_2(b)|ARG_3(c)|ARG_4(d)|ARG_5(e))
#define ARGP_LIST6(a,b,c,d,e,f) (ARG_1(a)|ARG_2(b)|ARG_3(c)|ARG_4(d)|ARG_5(e)|ARG_6(f))
 
#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
*/
 
#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.
*/
 
#ifdef ACPI_DEBUG_OUTPUT
 
#define ACPI_REPORT_INFO(fp) {acpi_ut_report_info(_THIS_MODULE,__LINE__,_COMPONENT); \
acpi_os_printf ACPI_PARAM_LIST(fp);}
#define ACPI_REPORT_ERROR(fp) {acpi_ut_report_error(_THIS_MODULE,__LINE__,_COMPONENT); \
acpi_os_printf ACPI_PARAM_LIST(fp);}
#define ACPI_REPORT_WARNING(fp) {acpi_ut_report_warning(_THIS_MODULE,__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_METHOD_ERROR(s,n,p,e) acpi_ns_report_method_error(_THIS_MODULE,__LINE__,_COMPONENT, s, n, p, e);
 
#else
 
#define ACPI_REPORT_INFO(fp) {acpi_ut_report_info("ACPI",__LINE__,_COMPONENT); \
acpi_os_printf ACPI_PARAM_LIST(fp);}
#define ACPI_REPORT_ERROR(fp) {acpi_ut_report_error("ACPI",__LINE__,_COMPONENT); \
acpi_os_printf ACPI_PARAM_LIST(fp);}
#define ACPI_REPORT_WARNING(fp) {acpi_ut_report_warning("ACPI",__LINE__,_COMPONENT); \
acpi_os_printf ACPI_PARAM_LIST(fp);}
#define ACPI_REPORT_NSERROR(s,e) acpi_ns_report_error("ACPI",__LINE__,_COMPONENT, s, e);
 
#define ACPI_REPORT_METHOD_ERROR(s,n,p,e) acpi_ns_report_method_error("ACPI",__LINE__,_COMPONENT, s, n, p, e);
 
#endif
 
/* Error reporting. These versions pass thru the module and line# */
 
#define _ACPI_REPORT_INFO(a,b,c,fp) {acpi_ut_report_info(a,b,c); \
acpi_os_printf ACPI_PARAM_LIST(fp);}
#define _ACPI_REPORT_ERROR(a,b,c,fp) {acpi_ut_report_error(a,b,c); \
acpi_os_printf ACPI_PARAM_LIST(fp);}
#define _ACPI_REPORT_WARNING(a,b,c,fp) {acpi_ut_report_warning(a,b,c); \
acpi_os_printf ACPI_PARAM_LIST(fp);}
 
/*
* Debug macros that are conditionally compiled
*/
 
#ifdef ACPI_DEBUG_OUTPUT
 
#define ACPI_MODULE_NAME(name) static char ACPI_UNUSED_VAR *_THIS_MODULE = name;
 
/*
* 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.
*/
 
#define ACPI_FUNCTION_NAME(a) struct acpi_debug_print_info _dbg; \
_dbg.component_id = _COMPONENT; \
_dbg.proc_name = a; \
_dbg.module_name = _THIS_MODULE;
 
#define ACPI_FUNCTION_TRACE(a) ACPI_FUNCTION_NAME(a) \
acpi_ut_trace(__LINE__,&_dbg)
#define ACPI_FUNCTION_TRACE_PTR(a,b) ACPI_FUNCTION_NAME(a) \
acpi_ut_trace_ptr(__LINE__,&_dbg,(void *)b)
#define ACPI_FUNCTION_TRACE_U32(a,b) ACPI_FUNCTION_NAME(a) \
acpi_ut_trace_u32(__LINE__,&_dbg,(u32)b)
#define ACPI_FUNCTION_TRACE_STR(a,b) ACPI_FUNCTION_NAME(a) \
acpi_ut_trace_str(__LINE__,&_dbg,(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.
*/
#ifdef ACPI_USE_DO_WHILE_0
#define ACPI_DO_WHILE0(a) do a while(0)
#else
#define ACPI_DO_WHILE0(a) a
#endif
 
#define return_VOID ACPI_DO_WHILE0 ({acpi_ut_exit(__LINE__,&_dbg);return;})
#define return_ACPI_STATUS(s) ACPI_DO_WHILE0 ({acpi_ut_status_exit(__LINE__,&_dbg,(s));return((s));})
#define return_VALUE(s) ACPI_DO_WHILE0 ({acpi_ut_value_exit(__LINE__,&_dbg,(acpi_integer)(s));return((s));})
#define return_PTR(s) ACPI_DO_WHILE0 ({acpi_ut_ptr_exit(__LINE__,&_dbg,(u8 *)(s));return((s));})
 
/* Conditional execution */
 
#define ACPI_DEBUG_EXEC(a) a
#define ACPI_NORMAL_EXEC(a)
 
#define ACPI_DEBUG_DEFINE(a) a;
#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)
#define ACPI_DUMP_OPERANDS(a,b,c,d,e) acpi_ex_dump_operands(a,b,c,d,e,_THIS_MODULE,__LINE__)
 
 
#define ACPI_DUMP_ENTRY(a,b) acpi_ns_dump_entry (a,b)
#define ACPI_DUMP_TABLES(a,b) acpi_ns_dump_tables(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!)
*/
 
#define ACPI_ERROR_BREAK
#ifdef ACPI_ERROR_BREAK
#define ACPI_BREAK_ON_ERROR(lvl) if ((lvl)&ACPI_ERROR) \
acpi_os_signal(ACPI_SIGNAL_BREAKPOINT,"Fatal error encountered\n")
#else
#define ACPI_BREAK_ON_ERROR(lvl)
#endif
 
/*
* Master debug print macros
* Print iff:
* 1) Debug print for the current component is enabled
* 2) Debug error level or trace level for the print statement is enabled
*/
 
#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,
* leaving no executable debug code!
*/
 
#define ACPI_MODULE_NAME(name)
#define _THIS_MODULE ""
 
#define ACPI_DEBUG_EXEC(a)
#define ACPI_NORMAL_EXEC(a) a;
 
#define ACPI_DEBUG_DEFINE(a)
#define ACPI_DEBUG_ONLY_MEMBERS(a)
#define ACPI_FUNCTION_NAME(a)
#define ACPI_FUNCTION_TRACE(a)
#define ACPI_FUNCTION_TRACE_PTR(a,b)
#define ACPI_FUNCTION_TRACE_U32(a,b)
#define ACPI_FUNCTION_TRACE_STR(a,b)
#define ACPI_FUNCTION_EXIT
#define ACPI_FUNCTION_STATUS_EXIT(s)
#define ACPI_FUNCTION_VALUE_EXIT(s)
#define ACPI_FUNCTION_ENTRY()
#define ACPI_DUMP_STACK_ENTRY(a)
#define ACPI_DUMP_OPERANDS(a,b,c,d,e)
#define ACPI_DUMP_ENTRY(a,b)
#define ACPI_DUMP_TABLES(a,b)
#define ACPI_DUMP_PATHNAME(a,b,c,d)
#define ACPI_DUMP_RESOURCE_LIST(a)
#define ACPI_DUMP_BUFFER(a,b)
#define ACPI_DEBUG_PRINT(pl)
#define ACPI_DEBUG_PRINT_RAW(pl)
#define ACPI_BREAK_MSG(a)
 
#define return_VOID return
#define return_ACPI_STATUS(s) return(s)
#define return_VALUE(s) return(s)
#define return_PTR(s) return(s)
 
#endif
 
/*
* Some code only gets executed when the debugger is built in.
* Note that this is entirely independent of whether the
* DEBUG_PRINT stuff (set by ACPI_DEBUG_OUTPUT) is on, or not.
*/
#ifdef ACPI_DEBUGGER
#define ACPI_DEBUGGER_EXEC(a) a
#else
#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
*/
#if ACPI_MACHINE_WIDTH == 16
#undef ACPI_DEBUG_ONLY_MEMBERS
#undef _VERBOSE_STRUCTURES
#define ACPI_DEBUG_ONLY_MEMBERS(a)
#endif
 
 
#ifdef ACPI_DEBUG_OUTPUT
/*
* 1) Set name to blanks
* 2) Copy the object name
*/
#define ACPI_ADD_OBJECT_NAME(a,b) ACPI_MEMSET (a->common.name, ' ', sizeof (a->common.name));\
ACPI_STRNCPY (a->common.name, acpi_gbl_ns_type_names[b], sizeof (a->common.name))
#else
 
#define ACPI_ADD_OBJECT_NAME(a,b)
#endif
 
 
/*
* Memory allocation tracking (DEBUG ONLY)
*/
 
#ifndef ACPI_DBG_TRACK_ALLOCATIONS
 
/* 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_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_TRACKING(a) a
 
#endif /* ACPI_DBG_TRACK_ALLOCATIONS */
 
 
#define ACPI_GET_STACK_POINTER _asm {mov eax, ebx}
 
#endif /* ACMACROS_H */
/shark/trunk/drivers/linuxc26/include/acpi/acstruct.h
0,0 → 1,203
/******************************************************************************
*
* Name: acstruct.h - Internal structs
*
*****************************************************************************/
 
/*
* Copyright (C) 2000 - 2003, 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.
*/
 
#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.
*/
 
#define ACPI_NEXT_OP_DOWNWARD 1
#define ACPI_NEXT_OP_UPWARD 2
 
#define ACPI_WALK_NON_METHOD 0
#define ACPI_WALK_METHOD 1
#define ACPI_WALK_METHOD_RESTART 2
#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!*/\
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;
u8 walk_type;
u16 opcode; /* Current AML opcode */
u8 scope_depth;
u8 reserved1;
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_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;
};
 
 
/* 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;
};
 
 
/* TBD: [Restructure] Merge with struct above */
 
struct acpi_walk_info
{
u32 debug_level;
u32 owner_id;
u8 display_type;
};
 
/* Display Types */
 
#define ACPI_DISPLAY_SUMMARY 0
#define ACPI_DISPLAY_OBJECTS 1
 
struct acpi_get_devices_info
{
acpi_walk_callback user_function;
void *context;
char *hid;
};
 
 
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;
 
} fatal;
 
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;
 
} mid;
};
 
 
#endif
/shark/trunk/drivers/linuxc26/include/acpi/acparser.h
0,0 → 1,347
/******************************************************************************
*
* Module Name: acparser.h - AML Parser subcomponent prototypes and defines
*
*****************************************************************************/
 
/*
* Copyright (C) 2000 - 2003, 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.
*/
 
 
#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
 
#define ACPI_PARSE_LOAD_PASS1 0x0010
#define ACPI_PARSE_LOAD_PASS2 0x0020
#define ACPI_PARSE_EXECUTE 0x0030
#define ACPI_PARSE_MODE_MASK 0x0030
 
#define ACPI_PARSE_DEFERRED_OP 0x0100
 
/* Parser external interfaces */
 
acpi_status
acpi_psx_load_table (
u8 *pcode_addr,
u32 pcode_length);
 
acpi_status
acpi_psx_execute (
struct acpi_namespace_node *method_node,
union acpi_operand_object **params,
union acpi_operand_object **return_obj_desc);
 
 
/******************************************************************************
*
* Parser interfaces
*
*****************************************************************************/
 
 
/* psargs - Parse AML opcode arguments */
 
u8 *
acpi_ps_get_next_package_end (
struct acpi_parse_state *parser_state);
 
u32
acpi_ps_get_next_package_length (
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_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);
 
union acpi_parse_object *
acpi_ps_get_next_field (
struct acpi_parse_state *parser_state);
 
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);
 
 
/* 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);
 
 
/* psopcode - AML Opcode information */
 
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 */
 
u32
acpi_ps_get_opcode_size (
u32 opcode);
 
void
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_status
acpi_ps_find_object (
struct acpi_walk_state *walk_state,
union acpi_parse_object **out_op);
 
void
acpi_ps_delete_parse_tree (
union acpi_parse_object *root);
 
acpi_status
acpi_ps_parse_loop (
struct acpi_walk_state *walk_state);
 
acpi_status
acpi_ps_parse_aml (
struct acpi_walk_state *walk_state);
 
acpi_status
acpi_ps_parse_table (
u8 *aml,
u32 aml_size,
acpi_parse_downwards descending_callback,
acpi_parse_upwards ascending_callback,
union acpi_parse_object **root_object);
 
u16
acpi_ps_peek_opcode (
struct acpi_parse_state *state);
 
 
/* psscope - Scope stack management routines */
 
 
acpi_status
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);
 
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_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);
 
 
/* 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);
 
union acpi_parse_object *
acpi_ps_get_child (
union acpi_parse_object *op);
 
union acpi_parse_object *
acpi_ps_get_depth_next (
union acpi_parse_object *origin,
union acpi_parse_object *op);
 
 
/* 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_status
acpi_ps_delete_completed_op (
struct acpi_walk_state *walk_state);
 
 
/* psutils - parser utilities */
 
union acpi_parse_object *
acpi_ps_create_scope_op (
void);
 
void
acpi_ps_init_op (
union acpi_parse_object *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_delete_parse_cache (
void);
 
u8
acpi_ps_is_leading_char (
u32 c);
 
u8
acpi_ps_is_prefix_char (
u32 c);
 
u32
acpi_ps_get_name(
union acpi_parse_object *op);
 
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);
 
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);
 
 
#endif /* __ACPARSER_H__ */
/shark/trunk/drivers/linuxc26/include/acpi/acutils.h
0,0 → 1,836
/******************************************************************************
*
* Name: acutils.h -- prototypes for the common (subsystem-wide) procedures
*
*****************************************************************************/
 
/*
* Copyright (C) 2000 - 2003, 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.
*/
 
#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);
 
 
acpi_status
acpi_ut_walk_package_tree (
union acpi_operand_object *source_object,
void *target_object,
acpi_pkg_callback walk_callback,
void *context);
 
 
struct acpi_pkg_info
{
u8 *free_space;
acpi_size length;
u32 object_space;
u32 num_packages;
};
 
#define REF_INCREMENT (u16) 0
#define REF_DECREMENT (u16) 1
#define REF_FORCE_DELETE (u16) 2
 
/* acpi_ut_dump_buffer */
 
#define DB_BYTE_DISPLAY 1
#define DB_WORD_DISPLAY 2
#define DB_DWORD_DISPLAY 4
#define DB_QWORD_DISPLAY 8
 
 
/* Global initialization interfaces */
 
void
acpi_ut_init_globals (
void);
 
void
acpi_ut_terminate (
void);
 
 
/*
* ut_init - miscellaneous initialization and shutdown
*/
 
acpi_status
acpi_ut_hardware_initialize (
void);
 
void
acpi_ut_subsystem_shutdown (
void);
 
acpi_status
acpi_ut_validate_fadt (
void);
 
/*
* ut_global - Global data structures and procedures
*/
 
#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
 
char *
acpi_ut_get_mutex_name (
u32 mutex_id);
 
#endif
 
char *
acpi_ut_get_type_name (
acpi_object_type type);
 
char *
acpi_ut_get_object_type_name (
union acpi_operand_object *obj_desc);
 
char *
acpi_ut_get_region_name (
u8 space_id);
 
char *
acpi_ut_get_event_name (
u32 event_id);
 
char
acpi_ut_hex_to_ascii_char (
acpi_integer integer,
u32 position);
 
u8
acpi_ut_valid_object_type (
acpi_object_type type);
 
acpi_owner_id
acpi_ut_allocate_owner_id (
u32 id_type);
 
 
/*
* ut_clib - 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_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_IS_DIGIT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_DI))
#define ACPI_IS_SPACE(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_SP))
#define ACPI_IS_XDIGIT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_XD))
#define ACPI_IS_UPPER(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_UP))
#define ACPI_IS_LOWER(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO))
#define ACPI_IS_PRINT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP | _ACPI_DI | _ACPI_SP | _ACPI_PU))
#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 */
 
/*
* ut_copy - 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_status
acpi_ut_build_package_object (
union acpi_operand_object *obj,
u8 *buffer,
u32 *space_used);
 
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_status
acpi_ut_copy_ielement_to_ielement (
u8 object_type,
union acpi_operand_object *source_object,
union acpi_generic_state *state,
void *context);
 
acpi_status
acpi_ut_copy_iobject_to_eobject (
union acpi_operand_object *obj,
struct acpi_buffer *ret_buffer);
 
acpi_status
acpi_ut_copy_esimple_to_isimple(
union acpi_object *user_obj,
union acpi_operand_object **return_obj);
 
acpi_status
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_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_status
acpi_ut_copy_simple_object (
union acpi_operand_object *source_desc,
union acpi_operand_object *dest_desc);
 
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);
 
 
/*
* ut_create - Object creation
*/
 
acpi_status
acpi_ut_update_object_reference (
union acpi_operand_object *object,
u16 action);
 
 
/*
* ut_debug - Debug interfaces
*/
 
void
acpi_ut_init_stack_ptr_trace (
void);
 
void
acpi_ut_track_stack_ptr (
void);
 
void
acpi_ut_trace (
u32 line_number,
struct acpi_debug_print_info *dbg_info);
 
void
acpi_ut_trace_ptr (
u32 line_number,
struct acpi_debug_print_info *dbg_info,
void *pointer);
 
void
acpi_ut_trace_u32 (
u32 line_number,
struct acpi_debug_print_info *dbg_info,
u32 integer);
 
void
acpi_ut_trace_str (
u32 line_number,
struct acpi_debug_print_info *dbg_info,
char *string);
 
void
acpi_ut_exit (
u32 line_number,
struct acpi_debug_print_info *dbg_info);
 
void
acpi_ut_status_exit (
u32 line_number,
struct acpi_debug_print_info *dbg_info,
acpi_status status);
 
void
acpi_ut_value_exit (
u32 line_number,
struct acpi_debug_print_info *dbg_info,
acpi_integer value);
 
void
acpi_ut_ptr_exit (
u32 line_number,
struct acpi_debug_print_info *dbg_info,
u8 *ptr);
 
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_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_INTERNAL_VAR_XFACE
acpi_ut_debug_print (
u32 requested_debug_level,
u32 line_number,
struct acpi_debug_print_info *dbg_info,
char *format,
...) ACPI_PRINTF_LIKE_FUNC;
 
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 *format,
...) ACPI_PRINTF_LIKE_FUNC;
 
 
/*
* ut_delete - Object deletion
*/
 
void
acpi_ut_delete_internal_obj (
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_object_list (
union acpi_operand_object **obj_list);
 
 
/*
* ut_eval - object evaluation
*/
 
/* Method name strings */
 
#define METHOD_NAME__HID "_HID"
#define METHOD_NAME__CID "_CID"
#define METHOD_NAME__UID "_UID"
#define METHOD_NAME__ADR "_ADR"
#define METHOD_NAME__STA "_STA"
#define METHOD_NAME__REG "_REG"
#define METHOD_NAME__SEG "_SEG"
#define METHOD_NAME__BBN "_BBN"
#define METHOD_NAME__PRT "_PRT"
#define METHOD_NAME__CRS "_CRS"
#define METHOD_NAME__PRS "_PRS"
 
 
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_status
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_status
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_status
acpi_ut_execute_UID (
struct acpi_namespace_node *device_node,
struct acpi_device_id *uid);
 
 
/*
* ut_mutex - mutual exclusion interfaces
*/
 
acpi_status
acpi_ut_mutex_initialize (
void);
 
void
acpi_ut_mutex_terminate (
void);
 
acpi_status
acpi_ut_create_mutex (
acpi_mutex_handle mutex_id);
 
acpi_status
acpi_ut_delete_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);
 
 
/*
* ut_object - 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);
 
#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)
 
void
acpi_ut_delete_object_desc (
union acpi_operand_object *object);
 
u8
acpi_ut_valid_internal_object (
void *object);
 
union acpi_operand_object *
acpi_ut_create_buffer_object (
acpi_size buffer_size);
 
 
/*
* ut_ref_cnt - Object reference count management
*/
 
void
acpi_ut_add_reference (
union acpi_operand_object *object);
 
void
acpi_ut_remove_reference (
union acpi_operand_object *object);
 
/*
* ut_size - Object size routines
*/
 
acpi_status
acpi_ut_get_simple_object_size (
union acpi_operand_object *obj,
acpi_size *obj_length);
 
acpi_status
acpi_ut_get_package_object_size (
union acpi_operand_object *obj,
acpi_size *obj_length);
 
acpi_status
acpi_ut_get_object_size(
union acpi_operand_object *obj,
acpi_size *obj_length);
 
acpi_status
acpi_ut_get_element_length (
u8 object_type,
union acpi_operand_object *source_object,
union acpi_generic_state *state,
void *context);
 
 
/*
* ut_state - 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);
 
 
union acpi_generic_state *
acpi_ut_create_generic_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_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_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 *
acpi_ut_create_control_state (
void);
 
void
acpi_ut_delete_generic_state (
union acpi_generic_state *state);
 
void
acpi_ut_delete_generic_state_cache (
void);
 
void
acpi_ut_delete_object_cache (
void);
 
/*
* utmisc
*/
 
void
acpi_ut_print_string (
char *string,
u8 max_length);
 
acpi_status
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);
 
u8
acpi_ut_valid_acpi_name (
u32 name);
 
u8
acpi_ut_valid_acpi_character (
char character);
 
acpi_status
acpi_ut_strtoul64 (
char *string,
u32 base,
acpi_integer *ret_integer);
 
char *
acpi_ut_strupr (
char *src_string);
 
u8 *
acpi_ut_get_resource_end_tag (
union acpi_operand_object *obj_desc);
 
u8
acpi_ut_generate_checksum (
u8 *buffer,
u32 length);
 
u32
acpi_ut_dword_byte_swap (
u32 value);
 
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);
 
#endif
 
 
/*
* Utalloc - memory allocation and object caching
*/
 
void *
acpi_ut_acquire_from_cache (
u32 list_id);
 
void
acpi_ut_release_to_cache (
u32 list_id,
void *object);
 
void
acpi_ut_delete_generic_cache (
u32 list_id);
 
acpi_status
acpi_ut_validate_buffer (
struct acpi_buffer *buffer);
 
acpi_status
acpi_ut_initialize_buffer (
struct acpi_buffer *buffer,
acpi_size required_length);
 
 
/* Memory allocation functions */
 
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_free_and_track (
void *address,
u32 component,
char *module,
u32 line);
 
struct acpi_debug_mem_block *
acpi_ut_find_allocation (
u32 list_id,
void *allocation);
 
acpi_status
acpi_ut_track_allocation (
u32 list_id,
struct acpi_debug_mem_block *address,
acpi_size size,
u8 alloc_type,
u32 component,
char *module,
u32 line);
 
acpi_status
acpi_ut_remove_allocation (
u32 list_id,
struct acpi_debug_mem_block *address,
u32 component,
char *module,
u32 line);
 
void
acpi_ut_dump_allocation_info (
void);
 
void
acpi_ut_dump_allocations (
u32 component,
char *module);
#endif
 
 
#endif /* _ACUTILS_H */
/shark/trunk/drivers/linuxc26/include/acpi/acoutput.h
0,0 → 1,185
/******************************************************************************
*
* Name: acoutput.h -- debug output
*
*****************************************************************************/
 
/*
* Copyright (C) 2000 - 2003, 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.
*/
 
#ifndef __ACOUTPUT_H__
#define __ACOUTPUT_H__
 
/*
* Debug levels and component IDs. These are used to control the
* granularity of the output of the DEBUG_PRINT macro -- on a per-
* component basis and a per-exception-type basis.
*/
 
/* Component IDs are used in the global "debug_layer" */
 
#define ACPI_UTILITIES 0x00000001
#define ACPI_HARDWARE 0x00000002
#define ACPI_EVENTS 0x00000004
#define ACPI_TABLES 0x00000008
#define ACPI_NAMESPACE 0x00000010
#define ACPI_PARSER 0x00000020
#define ACPI_DISPATCHER 0x00000040
#define ACPI_EXECUTER 0x00000080
#define ACPI_RESOURCES 0x00000100
#define ACPI_CA_DEBUGGER 0x00000200
#define ACPI_OS_SERVICES 0x00000400
#define ACPI_CA_DISASSEMBLER 0x00000800
 
/* Component IDs for ACPI tools and utilities */
 
#define ACPI_COMPILER 0x00001000
#define ACPI_TOOLS 0x00002000
 
#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
*/
#define ACPI_LV_ERROR 0x00000001
#define ACPI_LV_WARN 0x00000002
#define ACPI_LV_INIT 0x00000004
#define ACPI_LV_DEBUG_OBJECT 0x00000008
#define ACPI_LV_INFO 0x00000010
#define ACPI_LV_ALL_EXCEPTIONS 0x0000001F
 
/* Trace verbosity level 1 [Standard Trace Level] */
 
#define ACPI_LV_INIT_NAMES 0x00000020
#define ACPI_LV_PARSE 0x00000040
#define ACPI_LV_LOAD 0x00000080
#define ACPI_LV_DISPATCH 0x00000100
#define ACPI_LV_EXEC 0x00000200
#define ACPI_LV_NAMES 0x00000400
#define ACPI_LV_OPREGION 0x00000800
#define ACPI_LV_BFIELD 0x00001000
#define ACPI_LV_TABLES 0x00002000
#define ACPI_LV_VALUES 0x00004000
#define ACPI_LV_OBJECTS 0x00008000
#define ACPI_LV_RESOURCES 0x00010000
#define ACPI_LV_USER_REQUESTS 0x00020000
#define ACPI_LV_PACKAGE 0x00040000
#define ACPI_LV_VERBOSITY1 0x0007FF40 | ACPI_LV_ALL_EXCEPTIONS
 
/* Trace verbosity level 2 [Function tracing and memory allocation] */
 
#define ACPI_LV_ALLOCATIONS 0x00100000
#define ACPI_LV_FUNCTIONS 0x00200000
#define ACPI_LV_OPTIMIZATIONS 0x00400000
#define ACPI_LV_VERBOSITY2 0x00700000 | ACPI_LV_VERBOSITY1
#define ACPI_LV_ALL ACPI_LV_VERBOSITY2
 
/* Trace verbosity level 3 [Threading, I/O, and Interrupts] */
 
#define ACPI_LV_MUTEX 0x01000000
#define ACPI_LV_THREADS 0x02000000
#define ACPI_LV_IO 0x04000000
#define ACPI_LV_INTERRUPTS 0x08000000
#define ACPI_LV_VERBOSITY3 0x0F000000 | ACPI_LV_VERBOSITY2
 
/* Exceptionally verbose output -- also used in the global "debug_level" */
 
#define ACPI_LV_AML_DISASSEMBLE 0x10000000
#define ACPI_LV_VERBOSE_INFO 0x20000000
#define ACPI_LV_FULL_TABLES 0x40000000
#define ACPI_LV_EVENTS 0x80000000
 
#define ACPI_LV_VERBOSE 0xF0000000
 
 
/*
* Debug level macros that are used in the DEBUG_PRINT macros
*/
#define ACPI_DEBUG_LEVEL(dl) (u32) dl,__LINE__,&_dbg
 
/* Exception level -- used in the global "debug_level" */
 
#define ACPI_DB_ERROR ACPI_DEBUG_LEVEL (ACPI_LV_ERROR)
#define ACPI_DB_WARN ACPI_DEBUG_LEVEL (ACPI_LV_WARN)
#define ACPI_DB_INIT ACPI_DEBUG_LEVEL (ACPI_LV_INIT)
#define ACPI_DB_DEBUG_OBJECT ACPI_DEBUG_LEVEL (ACPI_LV_DEBUG_OBJECT)
#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)
#define ACPI_DB_THREADS ACPI_DEBUG_LEVEL (ACPI_LV_THREADS)
#define ACPI_DB_PARSE ACPI_DEBUG_LEVEL (ACPI_LV_PARSE)
#define ACPI_DB_DISPATCH ACPI_DEBUG_LEVEL (ACPI_LV_DISPATCH)
#define ACPI_DB_LOAD ACPI_DEBUG_LEVEL (ACPI_LV_LOAD)
#define ACPI_DB_EXEC ACPI_DEBUG_LEVEL (ACPI_LV_EXEC)
#define ACPI_DB_NAMES ACPI_DEBUG_LEVEL (ACPI_LV_NAMES)
#define ACPI_DB_OPREGION ACPI_DEBUG_LEVEL (ACPI_LV_OPREGION)
#define ACPI_DB_BFIELD ACPI_DEBUG_LEVEL (ACPI_LV_BFIELD)
#define ACPI_DB_TABLES ACPI_DEBUG_LEVEL (ACPI_LV_TABLES)
#define ACPI_DB_FUNCTIONS ACPI_DEBUG_LEVEL (ACPI_LV_FUNCTIONS)
#define ACPI_DB_OPTIMIZATIONS ACPI_DEBUG_LEVEL (ACPI_LV_OPTIMIZATIONS)
#define ACPI_DB_VALUES ACPI_DEBUG_LEVEL (ACPI_LV_VALUES)
#define ACPI_DB_OBJECTS ACPI_DEBUG_LEVEL (ACPI_LV_OBJECTS)
#define ACPI_DB_ALLOCATIONS ACPI_DEBUG_LEVEL (ACPI_LV_ALLOCATIONS)
#define ACPI_DB_RESOURCES ACPI_DEBUG_LEVEL (ACPI_LV_RESOURCES)
#define ACPI_DB_IO ACPI_DEBUG_LEVEL (ACPI_LV_IO)
#define ACPI_DB_INTERRUPTS ACPI_DEBUG_LEVEL (ACPI_LV_INTERRUPTS)
#define ACPI_DB_USER_REQUESTS ACPI_DEBUG_LEVEL (ACPI_LV_USER_REQUESTS)
#define ACPI_DB_PACKAGE ACPI_DEBUG_LEVEL (ACPI_LV_PACKAGE)
#define ACPI_DB_MUTEX ACPI_DEBUG_LEVEL (ACPI_LV_MUTEX)
 
#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__ */
/shark/trunk/drivers/linuxc26/include/acpi/amlcode.h
0,0 → 1,506
/******************************************************************************
*
* Name: amlcode.h - Definitions for AML, as included in "definition blocks"
* Declarations and definitions contained herein are derived
* directly from the ACPI specification.
*
*****************************************************************************/
 
/*
* Copyright (C) 2000 - 2003, 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.
*/
 
#ifndef __AMLCODE_H__
#define __AMLCODE_H__
 
/* primary opcodes */
 
#define AML_NULL_CHAR (u16) 0x00
 
#define AML_ZERO_OP (u16) 0x00
#define AML_ONE_OP (u16) 0x01
#define AML_UNASSIGNED (u16) 0x02
#define AML_ALIAS_OP (u16) 0x06
#define AML_NAME_OP (u16) 0x08
#define AML_BYTE_OP (u16) 0x0a
#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_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_METHOD_OP (u16) 0x14
#define AML_DUAL_NAME_PREFIX (u16) 0x2e
#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_ROOT_PREFIX (u16) 0x5c
#define AML_PARENT_PREFIX (u16) 0x5e
#define AML_LOCAL_OP (u16) 0x60
#define AML_LOCAL0 (u16) 0x60
#define AML_LOCAL1 (u16) 0x61
#define AML_LOCAL2 (u16) 0x62
#define AML_LOCAL3 (u16) 0x63
#define AML_LOCAL4 (u16) 0x64
#define AML_LOCAL5 (u16) 0x65
#define AML_LOCAL6 (u16) 0x66
#define AML_LOCAL7 (u16) 0x67
#define AML_ARG_OP (u16) 0x68
#define AML_ARG0 (u16) 0x68
#define AML_ARG1 (u16) 0x69
#define AML_ARG2 (u16) 0x6a
#define AML_ARG3 (u16) 0x6b
#define AML_ARG4 (u16) 0x6c
#define AML_ARG5 (u16) 0x6d
#define AML_ARG6 (u16) 0x6e
#define AML_STORE_OP (u16) 0x70
#define AML_REF_OF_OP (u16) 0x71
#define AML_ADD_OP (u16) 0x72
#define AML_CONCAT_OP (u16) 0x73
#define AML_SUBTRACT_OP (u16) 0x74
#define AML_INCREMENT_OP (u16) 0x75
#define AML_DECREMENT_OP (u16) 0x76
#define AML_MULTIPLY_OP (u16) 0x77
#define AML_DIVIDE_OP (u16) 0x78
#define AML_SHIFT_LEFT_OP (u16) 0x79
#define AML_SHIFT_RIGHT_OP (u16) 0x7a
#define AML_BIT_AND_OP (u16) 0x7b
#define AML_BIT_NAND_OP (u16) 0x7c
#define AML_BIT_OR_OP (u16) 0x7d
#define AML_BIT_NOR_OP (u16) 0x7e
#define AML_BIT_XOR_OP (u16) 0x7f
#define AML_BIT_NOT_OP (u16) 0x80
#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_NOTIFY_OP (u16) 0x86
#define AML_SIZE_OF_OP (u16) 0x87
#define AML_INDEX_OP (u16) 0x88
#define AML_MATCH_OP (u16) 0x89
#define AML_CREATE_DWORD_FIELD_OP (u16) 0x8a
#define AML_CREATE_WORD_FIELD_OP (u16) 0x8b
#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_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_IF_OP (u16) 0xa0
#define AML_ELSE_OP (u16) 0xa1
#define AML_WHILE_OP (u16) 0xa2
#define AML_NOOP_OP (u16) 0xa3
#define AML_RETURN_OP (u16) 0xa4
#define AML_BREAK_OP (u16) 0xa5
#define AML_BREAK_POINT_OP (u16) 0xcc
#define AML_ONES_OP (u16) 0xff
 
/* prefixed opcodes */
 
#define AML_EXTOP (u16) 0x005b
 
 
#define AML_MUTEX_OP (u16) 0x5b01
#define AML_EVENT_OP (u16) 0x5b02
#define AML_SHIFT_RIGHT_BIT_OP (u16) 0x5b10
#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_OP (u16) 0x5b20
#define AML_STALL_OP (u16) 0x5b21
#define AML_SLEEP_OP (u16) 0x5b22
#define AML_ACQUIRE_OP (u16) 0x5b23
#define AML_SIGNAL_OP (u16) 0x5b24
#define AML_WAIT_OP (u16) 0x5b25
#define AML_RESET_OP (u16) 0x5b26
#define AML_RELEASE_OP (u16) 0x5b27
#define AML_FROM_BCD_OP (u16) 0x5b28
#define AML_TO_BCD_OP (u16) 0x5b29
#define AML_UNLOAD_OP (u16) 0x5b2a
#define AML_REVISION_OP (u16) 0x5b30
#define AML_DEBUG_OP (u16) 0x5b31
#define AML_FATAL_OP (u16) 0x5b32
#define AML_REGION_OP (u16) 0x5b80
#define AML_FIELD_OP (u16) 0x5b81
#define AML_DEVICE_OP (u16) 0x5b82
#define AML_PROCESSOR_OP (u16) 0x5b83
#define AML_POWER_RES_OP (u16) 0x5b84
#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 */
 
 
/* Bogus opcodes (they are actually two separate opcodes) */
 
#define AML_LGREATEREQUAL_OP (u16) 0x9295
#define AML_LLESSEQUAL_OP (u16) 0x9294
#define AML_LNOTEQUAL_OP (u16) 0x9293
 
 
/*
* Internal opcodes
* Use only "Unknown" AML opcodes, don't attempt to use
* any valid ACPI ASCII values (A-Z, 0-9, '-')
*/
 
#define AML_INT_NAMEPATH_OP (u16) 0x002d
#define AML_INT_NAMEDFIELD_OP (u16) 0x0030
#define AML_INT_RESERVEDFIELD_OP (u16) 0x0031
#define AML_INT_ACCESSFIELD_OP (u16) 0x0032
#define AML_INT_BYTELIST_OP (u16) 0x0033
#define AML_INT_STATICSTRING_OP (u16) 0x0034
#define AML_INT_METHODCALL_OP (u16) 0x0035
#define AML_INT_RETURN_VALUE_OP (u16) 0x0036
#define AML_INT_EVAL_SUBTREE_OP (u16) 0x0037
 
 
#define ARG_NONE 0x0
 
/*
* Argument types for the AML Parser
* Each field in the arg_types u32 is 5 bits, allowing for a maximum of 6 arguments.
* There can be up to 31 unique argument types
* Zero is reserved as end-of-list indicator
*/
 
#define ARGP_BYTEDATA 0x01
#define ARGP_BYTELIST 0x02
#define ARGP_CHARLIST 0x03
#define ARGP_DATAOBJ 0x04
#define ARGP_DATAOBJLIST 0x05
#define ARGP_DWORDDATA 0x06
#define ARGP_FIELDLIST 0x07
#define ARGP_NAME 0x08
#define ARGP_NAMESTRING 0x09
#define ARGP_OBJLIST 0x0A
#define ARGP_PKGLENGTH 0x0B
#define ARGP_SUPERNAME 0x0C
#define ARGP_TARGET 0x0D
#define ARGP_TERMARG 0x0E
#define ARGP_TERMLIST 0x0F
#define ARGP_WORDDATA 0x10
#define ARGP_QWORDDATA 0x11
#define ARGP_SIMPLENAME 0x12
 
/*
* Resolved argument types for the AML Interpreter
* Each field in the arg_types u32 is 5 bits, allowing for a maximum of 6 arguments.
* There can be up to 31 unique argument types (0 is end-of-arg-list indicator)
*
* Note1: These values are completely independent from the ACPI_TYPEs
* i.e., ARGI_INTEGER != ACPI_TYPE_INTEGER
*
* Note2: If and when 5 bits becomes insufficient, it would probably be best
* to convert to a 6-byte array of argument types, allowing 8 bits per argument.
*/
 
/* Single, simple types */
 
#define ARGI_ANYTYPE 0x01 /* Don't care */
#define ARGI_PACKAGE 0x02
#define ARGI_EVENT 0x03
#define ARGI_MUTEX 0x04
#define ARGI_DDBHANDLE 0x05
 
/* Interchangeable types (via implicit conversion) */
 
#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 */
 
/* Reference objects */
 
#define ARGI_INTEGER_REF 0x0B
#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 */
 
/* 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 */
 
/* 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
*/
 
#define OPGRP_NAMED 0x01
#define OPGRP_FIELD 0x02
#define OPGRP_BYTELIST 0x04
 
 
/*
* Opcode information
*/
 
/* Opcode flags */
 
#define AML_HAS_ARGS 0x0800
#define AML_HAS_TARGET 0x0400
#define AML_HAS_RETVAL 0x0200
#define AML_NSOBJECT 0x0100
#define AML_NSOPCODE 0x0080
#define AML_NSNODE 0x0040
#define AML_NAMED 0x0020
#define AML_DEFER 0x0010
#define AML_FIELD 0x0008
#define AML_CREATE 0x0004
#define AML_MATH 0x0002
#define AML_LOGICAL 0x0001
#define AML_CONSTANT 0x1000
 
/* Convenient flag groupings */
 
#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_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_1A_0T_0R 0x00 /* Monadic1 */
#define AML_TYPE_EXEC_1A_0T_1R 0x01 /* Monadic2 */
#define AML_TYPE_EXEC_1A_1T_0R 0x02
#define AML_TYPE_EXEC_1A_1T_1R 0x03 /* monadic2_r */
#define AML_TYPE_EXEC_2A_0T_0R 0x04 /* Dyadic1 */
#define AML_TYPE_EXEC_2A_0T_1R 0x05 /* Dyadic2 */
#define AML_TYPE_EXEC_2A_1T_1R 0x06 /* dyadic2_r */
#define AML_TYPE_EXEC_2A_2T_1R 0x07
#define AML_TYPE_EXEC_3A_0T_0R 0x08
#define AML_TYPE_EXEC_3A_1T_1R 0x09
#define AML_TYPE_EXEC_6A_0T_1R 0x0A
/* End of types used in dispatch table */
 
#define AML_TYPE_LITERAL 0x0B
#define AML_TYPE_CONSTANT 0x0C
#define AML_TYPE_METHOD_ARGUMENT 0x0D
#define AML_TYPE_LOCAL_VARIABLE 0x0E
#define AML_TYPE_DATA_TERM 0x0F
 
/* Generic for an op that returns a value */
 
#define AML_TYPE_METHOD_CALL 0x10
 
/* Misc */
 
#define AML_TYPE_CREATE_FIELD 0x11
#define AML_TYPE_CREATE_OBJECT 0x12
#define AML_TYPE_CONTROL 0x13
#define AML_TYPE_NAMED_NO_OBJ 0x14
#define AML_TYPE_NAMED_FIELD 0x15
#define AML_TYPE_NAMED_SIMPLE 0x16
#define AML_TYPE_NAMED_COMPLEX 0x17
#define AML_TYPE_RETURN 0x18
 
#define AML_TYPE_UNDEFINED 0x19
#define AML_TYPE_BOGUS 0x1A
 
 
/*
* Opcode classes
*/
#define AML_CLASS_EXECUTE 0x00
#define AML_CLASS_CREATE 0x01
#define AML_CLASS_ARGUMENT 0x02
#define AML_CLASS_NAMED_OBJECT 0x03
#define AML_CLASS_CONTROL 0x04
#define AML_CLASS_ASCII 0x05
#define AML_CLASS_PREFIX 0x06
#define AML_CLASS_INTERNAL 0x07
#define AML_CLASS_RETURN_VALUE 0x08
#define AML_CLASS_METHOD_CALL 0x09
#define AML_CLASS_UNKNOWN 0x0A
 
 
/* Predefined Operation Region space_iDs */
 
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
 
} 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
 
} AML_MATCH_OPERATOR;
 
#define MAX_MATCH_OPERATOR 5
 
 
/*
* field_flags
*
* This byte is extracted from the AML and includes three separate
* pieces of information about the field:
* 1) The field access type
* 2) The field update rule
* 3) The lock rule for the field
*
* Bits 00 - 03 : access_type (any_acc, byte_acc, etc.)
* 04 : lock_rule (1 == Lock)
* 05 - 06 : update_rule
*/
#define AML_FIELD_ACCESS_TYPE_MASK 0x0F
#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 */
 
} AML_ACCESS_TYPE;
 
 
/* 2) Field Lock Rules */
 
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,
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,
AML_FIELD_ATTRIB_SMB_BLOCK_CALL = 0x0D
 
} AML_ACCESS_ATTRIBUTE;
 
 
/* bit fields in method_flags byte */
 
#define METHOD_FLAGS_ARG_COUNT 0x07
#define METHOD_FLAGS_SERIALIZED 0x08
#define METHOD_FLAGS_SYNCH_LEVEL 0xF0
 
 
#endif /* __AMLCODE_H__ */
/shark/trunk/drivers/linuxc26/include/acpi/acinterp.h
0,0 → 1,738
/******************************************************************************
*
* Name: acinterp.h - Interpreter subcomponent prototypes and defines
*
*****************************************************************************/
 
/*
* Copyright (C) 2000 - 2003, 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.
*/
 
#ifndef __ACINTERP_H__
#define __ACINTERP_H__
 
 
#define ACPI_WALK_OPERANDS (&(walk_state->operands [walk_state->num_operands -1]))
 
 
acpi_status
acpi_ex_resolve_operands (
u16 opcode,
union acpi_operand_object **stack_ptr,
struct acpi_walk_state *walk_state);
 
acpi_status
acpi_ex_check_object_type (
acpi_object_type type_needed,
acpi_object_type this_type,
void *object);
 
/*
* exxface - External interpreter interfaces
*/
 
acpi_status
acpi_ex_load_table (
acpi_table_type table_id);
 
acpi_status
acpi_ex_execute_method (
struct acpi_namespace_node *method_node,
union acpi_operand_object **params,
union acpi_operand_object **return_obj_desc);
 
 
/*
* exconvrt - object conversion
*/
 
acpi_status
acpi_ex_convert_to_integer (
union acpi_operand_object *obj_desc,
union acpi_operand_object **result_desc,
struct acpi_walk_state *walk_state);
 
acpi_status
acpi_ex_convert_to_buffer (
union acpi_operand_object *obj_desc,
union acpi_operand_object **result_desc,
struct acpi_walk_state *walk_state);
 
acpi_status
acpi_ex_convert_to_string (
union acpi_operand_object *obj_desc,
union acpi_operand_object **result_desc,
u32 base,
u32 max_length,
struct acpi_walk_state *walk_state);
 
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);
 
u32
acpi_ex_convert_to_ascii (
acpi_integer integer,
u32 base,
u8 *string,
u8 max_length);
 
/*
* exfield - ACPI AML (p-code) execution - field manipulation
*/
 
acpi_status
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_status
acpi_ex_setup_region (
union acpi_operand_object *obj_desc,
u32 field_datum_byte_offset);
 
acpi_status
acpi_ex_access_region (
union acpi_operand_object *obj_desc,
u32 field_datum_byte_offset,
acpi_integer *value,
u32 read_write);
 
u8
acpi_ex_register_overflow (
union acpi_operand_object *obj_desc,
acpi_integer value);
 
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_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);
 
void
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_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_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);
 
/*
* exmisc - ACPI AML (p-code) execution - specific opcodes
*/
 
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_6A_0T_1R (
struct acpi_walk_state *walk_state);
 
u8
acpi_ex_do_match (
u32 match_op,
acpi_integer package_value,
acpi_integer match_value);
 
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_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_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_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);
 
u8
acpi_ex_do_logical_op (
u16 opcode,
acpi_integer operand0,
acpi_integer operand1);
 
acpi_integer
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_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_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_event (
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);
 
 
/*
* exconfig - dynamic table load/unload
*/
 
acpi_status
acpi_ex_add_table (
struct acpi_table_header *table,
struct acpi_namespace_node *parent_node,
union acpi_operand_object **ddb_handle);
 
acpi_status
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);
 
 
/*
* 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_status
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_link_mutex (
union acpi_operand_object *obj_desc,
struct acpi_thread_state *thread);
 
/*
* exprep - ACPI AML (p-code) 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);
 
/*
* 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_status
acpi_ex_system_do_suspend(
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_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_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);
 
 
/*
* exmonadic - ACPI AML (p-code) execution, monadic operators
*/
 
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_1T_1R (
struct acpi_walk_state *walk_state);
 
acpi_status
acpi_ex_opcode_1A_1T_0R (
struct acpi_walk_state *walk_state);
 
/*
* exdyadic - ACPI AML (p-code) execution, dyadic operators
*/
 
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_1T_1R (
struct acpi_walk_state *walk_state);
 
acpi_status
acpi_ex_opcode_2A_2T_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_status
acpi_ex_resolve_node_to_value (
struct acpi_namespace_node **stack_ptr,
struct acpi_walk_state *walk_state);
 
acpi_status
acpi_ex_resolve_object_to_value (
union acpi_operand_object **stack_ptr,
struct acpi_walk_state *walk_state);
 
 
/*
* exdump - Scanner debug output routines
*/
 
void
acpi_ex_dump_operand (
union acpi_operand_object *entry_desc);
 
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);
 
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);
 
void
acpi_ex_out_string (
char *title,
char *value);
 
void
acpi_ex_out_pointer (
char *title,
void *value);
 
void
acpi_ex_out_integer (
char *title,
u32 value);
 
void
acpi_ex_out_address (
char *title,
acpi_physical_address value);
 
 
/*
* exnames - interpreter/scanner name load/execute
*/
 
char *
acpi_ex_allocate_name_string (
u32 prefix_count,
u32 num_name_segs);
 
u32
acpi_ex_good_char (
u32 character);
 
acpi_status
acpi_ex_name_segment (
u8 **in_aml_address,
char *name_string);
 
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_status
acpi_ex_do_name (
acpi_object_type data_type,
acpi_interpreter_mode load_exec_mode);
 
 
/*
* 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_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_status
acpi_ex_store_object_to_node (
union acpi_operand_object *source_desc,
struct acpi_namespace_node *node,
struct acpi_walk_state *walk_state);
 
 
/*
* exstoren
*/
 
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_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);
 
 
/*
* excopy - object copy
*/
 
acpi_status
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_status
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_status
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);
 
/*
* exutils - interpreter/scanner utilities
*/
 
acpi_status
acpi_ex_enter_interpreter (
void);
 
void
acpi_ex_exit_interpreter (
void);
 
void
acpi_ex_truncate_for32bit_table (
union acpi_operand_object *obj_desc);
 
u8
acpi_ex_acquire_global_lock (
u32 rule);
 
void
acpi_ex_release_global_lock (
u8 locked);
 
u32
acpi_ex_digits_needed (
acpi_integer value,
u32 base);
 
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__ */
/shark/trunk/drivers/linuxc26/include/acpi/actbl1.h
0,0 → 1,136
/******************************************************************************
*
* Name: actbl1.h - ACPI 1.0 tables
*
*****************************************************************************/
 
/*
* Copyright (C) 2000 - 2003, 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.
*/
 
#ifndef __ACTBL1_H__
#define __ACTBL1_H__
 
#pragma pack(1)
 
/*
* 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 other */
/* ACPI tables */
};
 
 
/*
* ACPI 1.0 Firmware ACPI Control Structure (FACS)
*/
struct facs_descriptor_rev1
{
char signature[4]; /* ACPI 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 */
};
 
 
/*
* 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 */
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 */
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; /* 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 */
};
 
#pragma pack()
 
#endif /* __ACTBL1_H__ */
 
 
/shark/trunk/drivers/linuxc26/include/acpi/actbl2.h
0,0 → 1,214
/******************************************************************************
*
* Name: actbl2.h - ACPI Specification Revision 2.0 Tables
*
*****************************************************************************/
 
/*
* Copyright (C) 2000 - 2003, 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.
*/
 
#ifndef __ACTBL2_H__
#define __ACTBL2_H__
 
/*
* Prefered Power Management Profiles
*/
#define PM_UNSPECIFIED 0
#define PM_DESKTOP 1
#define PM_MOBILE 2
#define PM_WORKSTATION 3
#define PM_ENTERPRISE_SERVER 4
#define PM_SOHO_SERVER 5
#define PM_APPLIANCE_PC 6
 
/*
* ACPI Boot Arch Flags
*/
#define BAF_LEGACY_DEVICES 0x0001
#define BAF_8042_KEYBOARD_CONTROLLER 0x0002
 
#define FADT2_REVISION_ID 3
 
 
#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 table headers */
};
 
 
/*
* 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 table headers */
};
 
 
/*
* ACPI 2.0 Firmware ACPI Control Structure (FACS)
*/
struct facs_descriptor_rev2
{
char signature[4]; /* ACPI 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 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. */
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 reserved; /* Must be 0 */
u64 address; /* 64-bit address of struct or register */
};
 
 
/*
* ACPI 2.0 Fixed ACPI Description Table (FADT)
*/
struct fadt_descriptor_rev2
{
ACPI_TABLE_HEADER_DEF /* ACPI common table header */
u32 V1_firmware_ctrl; /* 32-bit physical address of FACS */
u32 V1_dsdt; /* 32-bit physical address of DSDT */
u8 reserved1; /* System Interrupt Model isn't used in ACPI 2.0*/
u8 prefer_PM_profile; /* Conveys preferred power management profile to OSPM. */
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 pstate_cnt; /* Processor performance state control*/
u32 V1_pm1a_evt_blk; /* Port address of Power Mgt 1a acpi_event Reg Blk */
u32 V1_pm1b_evt_blk; /* Port address of Power Mgt 1b acpi_event Reg Blk */
u32 V1_pm1a_cnt_blk; /* Port address of Power Mgt 1a Control Reg Blk */
u32 V1_pm1b_cnt_blk; /* Port address of Power Mgt 1b Control Reg Blk */
u32 V1_pm2_cnt_blk; /* Port address of Power Mgt 2 Control Reg Blk */
u32 V1_pm_tmr_blk; /* Port address of Power Mgt Timer Ctrl Reg Blk */
u32 V1_gpe0_blk; /* Port addr of General Purpose acpi_event 0 Reg Blk */
u32 V1_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 cst_cnt; /* Support for the _CST object and C States change notification.*/
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; /* Number of flush strides that need to be read */
u16 flush_stride; /* Processor's memory cache line width, in bytes */
u8 duty_offset; /* Processor's duty cycle index in processor's P_CNT reg*/
u8 duty_width; /* Processor's duty cycle value bit width in P_CNT register.*/
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 */
u16 iapc_boot_arch; /* IA-PC Boot Architecture Flags. See Table 5-10 for description*/
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. */
u32 reserved6 : 18; /* 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 */
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 */
};
 
 
/* Embedded Controller */
 
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 */
};
 
 
#pragma pack()
 
#endif /* __ACTBL2_H__ */
 
/shark/trunk/drivers/linuxc26/include/acpi/acexcep.h
0,0 → 1,306
/******************************************************************************
*
* Name: acexcep.h - Exception codes returned by the ACPI subsystem
*
*****************************************************************************/
 
/*
* Copyright (C) 2000 - 2003, 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.
*/
 
#ifndef __ACEXCEP_H__
#define __ACEXCEP_H__
 
 
/*
* Exceptions returned by external ACPI interfaces
*/
 
#define AE_CODE_ENVIRONMENTAL 0x0000
#define AE_CODE_PROGRAMMER 0x1000
#define AE_CODE_ACPI_TABLES 0x2000
#define AE_CODE_AML 0x3000
#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
 
/*
* Environmental exceptions
*/
#define AE_ERROR (acpi_status) (0x0001 | AE_CODE_ENVIRONMENTAL)
#define AE_NO_ACPI_TABLES (acpi_status) (0x0002 | AE_CODE_ENVIRONMENTAL)
#define AE_NO_NAMESPACE (acpi_status) (0x0003 | AE_CODE_ENVIRONMENTAL)
#define AE_NO_MEMORY (acpi_status) (0x0004 | AE_CODE_ENVIRONMENTAL)
#define AE_NOT_FOUND (acpi_status) (0x0005 | AE_CODE_ENVIRONMENTAL)
#define AE_NOT_EXIST (acpi_status) (0x0006 | AE_CODE_ENVIRONMENTAL)
#define AE_ALREADY_EXISTS (acpi_status) (0x0007 | AE_CODE_ENVIRONMENTAL)
#define AE_TYPE (acpi_status) (0x0008 | AE_CODE_ENVIRONMENTAL)
#define AE_NULL_OBJECT (acpi_status) (0x0009 | AE_CODE_ENVIRONMENTAL)
#define AE_NULL_ENTRY (acpi_status) (0x000A | AE_CODE_ENVIRONMENTAL)
#define AE_BUFFER_OVERFLOW (acpi_status) (0x000B | AE_CODE_ENVIRONMENTAL)
#define AE_STACK_OVERFLOW (acpi_status) (0x000C | AE_CODE_ENVIRONMENTAL)
#define AE_STACK_UNDERFLOW (acpi_status) (0x000D | AE_CODE_ENVIRONMENTAL)
#define AE_NOT_IMPLEMENTED (acpi_status) (0x000E | AE_CODE_ENVIRONMENTAL)
#define AE_VERSION_MISMATCH (acpi_status) (0x000F | AE_CODE_ENVIRONMENTAL)
#define AE_SUPPORT (acpi_status) (0x0010 | AE_CODE_ENVIRONMENTAL)
#define AE_SHARE (acpi_status) (0x0011 | AE_CODE_ENVIRONMENTAL)
#define AE_LIMIT (acpi_status) (0x0012 | AE_CODE_ENVIRONMENTAL)
#define AE_TIME (acpi_status) (0x0013 | AE_CODE_ENVIRONMENTAL)
#define AE_UNKNOWN_STATUS (acpi_status) (0x0014 | AE_CODE_ENVIRONMENTAL)
#define AE_ACQUIRE_DEADLOCK (acpi_status) (0x0015 | AE_CODE_ENVIRONMENTAL)
#define AE_RELEASE_DEADLOCK (acpi_status) (0x0016 | AE_CODE_ENVIRONMENTAL)
#define AE_NOT_ACQUIRED (acpi_status) (0x0017 | AE_CODE_ENVIRONMENTAL)
#define AE_ALREADY_ACQUIRED (acpi_status) (0x0018 | AE_CODE_ENVIRONMENTAL)
#define AE_NO_HARDWARE_RESPONSE (acpi_status) (0x0019 | AE_CODE_ENVIRONMENTAL)
#define AE_NO_GLOBAL_LOCK (acpi_status) (0x001A | AE_CODE_ENVIRONMENTAL)
#define AE_LOGICAL_ADDRESS (acpi_status) (0x001B | AE_CODE_ENVIRONMENTAL)
#define AE_ABORT_METHOD (acpi_status) (0x001C | AE_CODE_ENVIRONMENTAL)
#define AE_SAME_HANDLER (acpi_status) (0x001D | AE_CODE_ENVIRONMENTAL)
 
#define AE_CODE_ENV_MAX 0x001D
 
/*
* Programmer exceptions
*/
#define AE_BAD_PARAMETER (acpi_status) (0x0001 | AE_CODE_PROGRAMMER)
#define AE_BAD_CHARACTER (acpi_status) (0x0002 | AE_CODE_PROGRAMMER)
#define AE_BAD_PATHNAME (acpi_status) (0x0003 | AE_CODE_PROGRAMMER)
#define AE_BAD_DATA (acpi_status) (0x0004 | AE_CODE_PROGRAMMER)
#define AE_BAD_ADDRESS (acpi_status) (0x0005 | AE_CODE_PROGRAMMER)
#define AE_ALIGNMENT (acpi_status) (0x0006 | AE_CODE_PROGRAMMER)
#define AE_BAD_HEX_CONSTANT (acpi_status) (0x0007 | AE_CODE_PROGRAMMER)
#define AE_BAD_OCTAL_CONSTANT (acpi_status) (0x0008 | AE_CODE_PROGRAMMER)
#define AE_BAD_DECIMAL_CONSTANT (acpi_status) (0x0009 | AE_CODE_PROGRAMMER)
 
#define AE_CODE_PGM_MAX 0x0009
 
 
/*
* Acpi table exceptions
*/
#define AE_BAD_SIGNATURE (acpi_status) (0x0001 | AE_CODE_ACPI_TABLES)
#define AE_BAD_HEADER (acpi_status) (0x0002 | AE_CODE_ACPI_TABLES)
#define AE_BAD_CHECKSUM (acpi_status) (0x0003 | AE_CODE_ACPI_TABLES)
#define AE_BAD_VALUE (acpi_status) (0x0004 | AE_CODE_ACPI_TABLES)
#define AE_TABLE_NOT_SUPPORTED (acpi_status) (0x0005 | AE_CODE_ACPI_TABLES)
#define AE_INVALID_TABLE_LENGTH (acpi_status) (0x0006 | AE_CODE_ACPI_TABLES)
 
#define AE_CODE_TBL_MAX 0x0006
 
 
/*
* AML exceptions. These are caused by problems with
* the actual AML byte stream
*/
#define AE_AML_ERROR (acpi_status) (0x0001 | AE_CODE_AML)
#define AE_AML_PARSE (acpi_status) (0x0002 | AE_CODE_AML)
#define AE_AML_BAD_OPCODE (acpi_status) (0x0003 | AE_CODE_AML)
#define AE_AML_NO_OPERAND (acpi_status) (0x0004 | AE_CODE_AML)
#define AE_AML_OPERAND_TYPE (acpi_status) (0x0005 | AE_CODE_AML)
#define AE_AML_OPERAND_VALUE (acpi_status) (0x0006 | AE_CODE_AML)
#define AE_AML_UNINITIALIZED_LOCAL (acpi_status) (0x0007 | AE_CODE_AML)
#define AE_AML_UNINITIALIZED_ARG (acpi_status) (0x0008 | AE_CODE_AML)
#define AE_AML_UNINITIALIZED_ELEMENT (acpi_status) (0x0009 | AE_CODE_AML)
#define AE_AML_NUMERIC_OVERFLOW (acpi_status) (0x000A | AE_CODE_AML)
#define AE_AML_REGION_LIMIT (acpi_status) (0x000B | AE_CODE_AML)
#define AE_AML_BUFFER_LIMIT (acpi_status) (0x000C | AE_CODE_AML)
#define AE_AML_PACKAGE_LIMIT (acpi_status) (0x000D | AE_CODE_AML)
#define AE_AML_DIVIDE_BY_ZERO (acpi_status) (0x000E | AE_CODE_AML)
#define AE_AML_BAD_NAME (acpi_status) (0x000F | AE_CODE_AML)
#define AE_AML_NAME_NOT_FOUND (acpi_status) (0x0010 | AE_CODE_AML)
#define AE_AML_INTERNAL (acpi_status) (0x0011 | AE_CODE_AML)
#define AE_AML_INVALID_SPACE_ID (acpi_status) (0x0012 | AE_CODE_AML)
#define AE_AML_STRING_LIMIT (acpi_status) (0x0013 | AE_CODE_AML)
#define AE_AML_NO_RETURN_VALUE (acpi_status) (0x0014 | AE_CODE_AML)
#define AE_AML_METHOD_LIMIT (acpi_status) (0x0015 | AE_CODE_AML)
#define AE_AML_NOT_OWNER (acpi_status) (0x0016 | AE_CODE_AML)
#define AE_AML_MUTEX_ORDER (acpi_status) (0x0017 | AE_CODE_AML)
#define AE_AML_MUTEX_NOT_ACQUIRED (acpi_status) (0x0018 | AE_CODE_AML)
#define AE_AML_INVALID_RESOURCE_TYPE (acpi_status) (0x0019 | AE_CODE_AML)
#define AE_AML_INVALID_INDEX (acpi_status) (0x001A | AE_CODE_AML)
#define AE_AML_REGISTER_LIMIT (acpi_status) (0x001B | AE_CODE_AML)
#define AE_AML_NO_WHILE (acpi_status) (0x001C | AE_CODE_AML)
#define AE_AML_ALIGNMENT (acpi_status) (0x001D | AE_CODE_AML)
#define AE_AML_NO_RESOURCE_END_TAG (acpi_status) (0x001E | AE_CODE_AML)
#define AE_AML_BAD_RESOURCE_VALUE (acpi_status) (0x001F | AE_CODE_AML)
#define AE_AML_CIRCULAR_REFERENCE (acpi_status) (0x0020 | AE_CODE_AML)
#define AE_AML_BAD_RESOURCE_LENGTH (acpi_status) (0x0021 | AE_CODE_AML)
 
#define AE_CODE_AML_MAX 0x0020
 
/*
* Internal exceptions used for control
*/
#define AE_CTRL_RETURN_VALUE (acpi_status) (0x0001 | AE_CODE_CONTROL)
#define AE_CTRL_PENDING (acpi_status) (0x0002 | AE_CODE_CONTROL)
#define AE_CTRL_TERMINATE (acpi_status) (0x0003 | AE_CODE_CONTROL)
#define AE_CTRL_TRUE (acpi_status) (0x0004 | AE_CODE_CONTROL)
#define AE_CTRL_FALSE (acpi_status) (0x0005 | AE_CODE_CONTROL)
#define AE_CTRL_DEPTH (acpi_status) (0x0006 | AE_CODE_CONTROL)
#define AE_CTRL_END (acpi_status) (0x0007 | AE_CODE_CONTROL)
#define AE_CTRL_TRANSFER (acpi_status) (0x0008 | AE_CODE_CONTROL)
#define AE_CTRL_BREAK (acpi_status) (0x0009 | AE_CODE_CONTROL)
#define AE_CTRL_CONTINUE (acpi_status) (0x000A | AE_CODE_CONTROL)
#define AE_CTRL_SKIP (acpi_status) (0x000B | AE_CODE_CONTROL)
 
#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[] =
{
"AE_OK",
"AE_ERROR",
"AE_NO_ACPI_TABLES",
"AE_NO_NAMESPACE",
"AE_NO_MEMORY",
"AE_NOT_FOUND",
"AE_NOT_EXIST",
"AE_ALREADY_EXISTS",
"AE_TYPE",
"AE_NULL_OBJECT",
"AE_NULL_ENTRY",
"AE_BUFFER_OVERFLOW",
"AE_STACK_OVERFLOW",
"AE_STACK_UNDERFLOW",
"AE_NOT_IMPLEMENTED",
"AE_VERSION_MISMATCH",
"AE_SUPPORT",
"AE_SHARE",
"AE_LIMIT",
"AE_TIME",
"AE_UNKNOWN_STATUS",
"AE_ACQUIRE_DEADLOCK",
"AE_RELEASE_DEADLOCK",
"AE_NOT_ACQUIRED",
"AE_ALREADY_ACQUIRED",
"AE_NO_HARDWARE_RESPONSE",
"AE_NO_GLOBAL_LOCK",
"AE_LOGICAL_ADDRESS",
"AE_ABORT_METHOD",
"AE_SAME_HANDLER"
};
 
char const *acpi_gbl_exception_names_pgm[] =
{
"AE_BAD_PARAMETER",
"AE_BAD_CHARACTER",
"AE_BAD_PATHNAME",
"AE_BAD_DATA",
"AE_BAD_ADDRESS",
"AE_ALIGNMENT",
"AE_BAD_HEX_CONSTANT",
"AE_BAD_OCTAL_CONSTANT",
"AE_BAD_DECIMAL_CONSTANT"
};
 
char const *acpi_gbl_exception_names_tbl[] =
{
"AE_BAD_SIGNATURE",
"AE_BAD_HEADER",
"AE_BAD_CHECKSUM",
"AE_BAD_VALUE",
"AE_TABLE_NOT_SUPPORTED",
"AE_INVALID_TABLE_LENGTH"
};
 
char const *acpi_gbl_exception_names_aml[] =
{
"AE_AML_ERROR",
"AE_AML_PARSE",
"AE_AML_BAD_OPCODE",
"AE_AML_NO_OPERAND",
"AE_AML_OPERAND_TYPE",
"AE_AML_OPERAND_VALUE",
"AE_AML_UNINITIALIZED_LOCAL",
"AE_AML_UNINITIALIZED_ARG",
"AE_AML_UNINITIALIZED_ELEMENT",
"AE_AML_NUMERIC_OVERFLOW",
"AE_AML_REGION_LIMIT",
"AE_AML_BUFFER_LIMIT",
"AE_AML_PACKAGE_LIMIT",
"AE_AML_DIVIDE_BY_ZERO",
"AE_AML_BAD_NAME",
"AE_AML_NAME_NOT_FOUND",
"AE_AML_INTERNAL",
"AE_AML_INVALID_SPACE_ID",
"AE_AML_STRING_LIMIT",
"AE_AML_NO_RETURN_VALUE",
"AE_AML_METHOD_LIMIT",
"AE_AML_NOT_OWNER",
"AE_AML_MUTEX_ORDER",
"AE_AML_MUTEX_NOT_ACQUIRED",
"AE_AML_INVALID_RESOURCE_TYPE",
"AE_AML_INVALID_INDEX",
"AE_AML_REGISTER_LIMIT",
"AE_AML_NO_WHILE",
"AE_AML_ALIGNMENT",
"AE_AML_NO_RESOURCE_END_TAG",
"AE_AML_BAD_RESOURCE_VALUE",
"AE_AML_CIRCULAR_REFERENCE",
"AE_AML_BAD_RESOURCE_LENGTH"
};
 
char const *acpi_gbl_exception_names_ctrl[] =
{
"AE_CTRL_RETURN_VALUE",
"AE_CTRL_PENDING",
"AE_CTRL_TERMINATE",
"AE_CTRL_TRUE",
"AE_CTRL_FALSE",
"AE_CTRL_DEPTH",
"AE_CTRL_END",
"AE_CTRL_TRANSFER",
"AE_CTRL_BREAK",
"AE_CTRL_CONTINUE",
"AE_CTRL_SKIP"
};
 
#endif /* ACPI GLOBALS */
 
 
#endif /* __ACEXCEP_H__ */
/shark/trunk/drivers/linuxc26/include/acpi/amlresrc.h
0,0 → 1,329
 
/******************************************************************************
*
* Module Name: amlresrc.h - AML resource descriptors
*
*****************************************************************************/
 
/*
* Copyright (C) 2000 - 2003, 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.
*/
 
 
#ifndef __AMLRESRC_H
#define __AMLRESRC_H
 
 
#define ASL_RESNAME_ADDRESS "_ADR"
#define ASL_RESNAME_ALIGNMENT "_ALN"
#define ASL_RESNAME_ADDRESSSPACE "_ASI"
#define ASL_RESNAME_BASEADDRESS "_BAS"
#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_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_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_MAXADDR "_MAX"
#define ASL_RESNAME_MINADDR "_MIN"
#define ASL_RESNAME_MAXTYPE "_MAF"
#define ASL_RESNAME_MINTYPE "_MIF"
#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_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) */
 
 
/* Default sizes for "small" resource descriptors */
 
#define ASL_RDESC_IRQ_SIZE 0x02
#define ASL_RDESC_DMA_SIZE 0x02
#define ASL_RDESC_ST_DEPEND_SIZE 0x00
#define ASL_RDESC_END_DEPEND_SIZE 0x00
#define ASL_RDESC_IO_SIZE 0x07
#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;
};
 
 
/*
* Resource descriptors defined in the ACPI specification.
*
* Alignment must be BYTE because these descriptors
* are used to overlay the AML byte stream.
*/
#pragma pack(1)
 
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_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_noprio_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_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_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_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_fixed_memory_32_desc
{
u8 descriptor_type;
u16 length;
u8 information;
u32 base_address;
u32 range_length;
};
 
 
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_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];
/* 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 reserved;
u64 address;
};
 
/* restore default alignment */
 
#pragma pack()
 
/* Union of all resource descriptors, sow 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_xrupt_desc exx;
struct asl_general_register_desc grg;
u32 u32_item;
u16 u16_item;
u8 U8item;
};
 
 
#endif
 
/shark/trunk/drivers/linuxc26/include/acpi/actypes.h
0,0 → 1,1248
/******************************************************************************
*
* Name: actypes.h - Common data types for the entire ACPI subsystem
*
*****************************************************************************/
 
/*
* Copyright (C) 2000 - 2003, 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.
*/
 
#ifndef __ACTYPES_H__
#define __ACTYPES_H__
 
/*! [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_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;
 
#endif
 
 
/*
* Data types - Fixed across all compilation models (16/32/64)
*
* BOOLEAN Logical Boolean.
* INT8 8-bit (1 byte) signed value
* UINT8 8-bit (1 byte) unsigned value
* INT16 16-bit (2 byte) signed value
* UINT16 16-bit (2 byte) unsigned value
* INT32 32-bit (4 byte) signed value
* UINT32 32-bit (4 byte) unsigned value
* INT64 64-bit (8 byte) signed value
* UINT64 64-bit (8 byte) unsigned value
* ACPI_NATIVE_INT 32-bit on IA-32, 64-bit on IA-64 signed value
* ACPI_NATIVE_UINT 32-bit on IA-32, 64-bit on IA-64 unsigned value
*/
 
#ifndef ACPI_MACHINE_WIDTH
#error ACPI_MACHINE_WIDTH not defined
#endif
 
#if ACPI_MACHINE_WIDTH == 64
 
/*! [Begin] no source code translation (keep the typedefs) */
 
/*
* 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;
 
/*! [End] no source code translation !*/
 
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;
 
#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) */
 
/*
* 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;
};
 
/*! [End] no source code translation !*/
 
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;
 
#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_MAX_PTR ACPI_UINT16_MAX
#define ACPI_SIZE_MAX ACPI_UINT16_MAX
 
/*
* (16-bit only) internal integers must be 32-bits, so
* 64-bit integers cannot be supported
*/
#define ACPI_NO_INTEGER64_SUPPORT
 
 
#elif ACPI_MACHINE_WIDTH == 32
 
/*! [Begin] no source code translation (keep the typedefs) */
 
/*
* 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;
 
/*! [End] no source code translation !*/
 
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;
 
#define ALIGNED_ADDRESS_BOUNDARY 0x00000004
#define ACPI_MISALIGNED_TRANSFERS
#define ACPI_MAX_PTR ACPI_UINT32_MAX
#define ACPI_SIZE_MAX ACPI_UINT32_MAX
 
#else
#error unknown ACPI_MACHINE_WIDTH
#endif
 
 
/*
* Miscellaneous common types
*/
typedef u16 UINT16_BIT;
typedef u32 UINT32_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;
};
 
struct acpi_pointer
{
u32 pointer_type;
union acpi_pointers pointer;
};
 
/* pointer_types for above */
 
#define ACPI_PHYSICAL_POINTER 0x01
#define ACPI_LOGICAL_POINTER 0x02
 
/* Processor mode */
 
#define ACPI_PHYSICAL_ADDRESSING 0x04
#define ACPI_LOGICAL_ADDRESSING 0x08
#define ACPI_MEMORY_MODE 0x0C
 
#define ACPI_PHYSMODE_PHYSPTR ACPI_PHYSICAL_ADDRESSING | ACPI_PHYSICAL_POINTER
#define ACPI_LOGMODE_PHYSPTR ACPI_LOGICAL_ADDRESSING | ACPI_PHYSICAL_POINTER
#define ACPI_LOGMODE_LOGPTR ACPI_LOGICAL_ADDRESSING | ACPI_LOGICAL_POINTER
 
 
/*
* Useful defines
*/
#ifdef FALSE
#undef FALSE
#endif
#define FALSE (1 == 0)
 
#ifdef TRUE
#undef TRUE
#endif
#define TRUE (1 == 1)
 
#ifndef NULL
#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;
};
 
union uint64_overlay
{
u64 full;
struct uint64_struct part;
};
 
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.
* Note that this pertains to the ACPI integer type only, not
* other integers used in the implementation of the ACPI CA
* subsystem.
*/
#ifdef ACPI_NO_INTEGER64_SUPPORT
 
/* 32-bit integers only, no 64-bit support */
 
typedef u32 acpi_integer;
#define ACPI_INTEGER_MAX ACPI_UINT32_MAX
#define ACPI_INTEGER_BIT_SIZE 32
#define ACPI_MAX_DECIMAL_DIGITS 10
 
#define ACPI_USE_NATIVE_DIVIDE /* Use compiler native 32-bit divide */
 
 
#else
 
/* 64-bit integers */
 
typedef u64 acpi_integer;
#define ACPI_INTEGER_MAX ACPI_UINT64_MAX
#define ACPI_INTEGER_BIT_SIZE 64
#define ACPI_MAX_DECIMAL_DIGITS 19
 
#if ACPI_MACHINE_WIDTH == 64
#define ACPI_USE_NATIVE_DIVIDE /* Use compiler native 64-bit divide */
#endif
#endif
 
 
/*
* Constants with special meanings
*/
#define ACPI_ROOT_OBJECT (acpi_handle) ACPI_PTR_ADD (char, NULL, ACPI_MAX_PTR)
 
 
/*
* Initialization sequence
*/
#define ACPI_FULL_INITIALIZATION 0x00
#define ACPI_NO_ADDRESS_SPACE_INIT 0x01
#define ACPI_NO_HARDWARE_INIT 0x02
#define ACPI_NO_EVENT_INIT 0x04
#define ACPI_NO_HANDLER_INIT 0x08
#define ACPI_NO_ACPI_ENABLE 0x10
#define ACPI_NO_DEVICE_INIT 0x20
#define ACPI_NO_OBJECT_INIT 0x40
 
/*
* Initialization state
*/
#define ACPI_INITIALIZED_OK 0x01
 
/*
* Power state values
*/
 
#define ACPI_STATE_UNKNOWN (u8) 0xFF
 
#define ACPI_STATE_S0 (u8) 0
#define ACPI_STATE_S1 (u8) 1
#define ACPI_STATE_S2 (u8) 2
#define ACPI_STATE_S3 (u8) 3
#define ACPI_STATE_S4 (u8) 4
#define ACPI_STATE_S5 (u8) 5
#define ACPI_S_STATES_MAX ACPI_STATE_S5
#define ACPI_S_STATE_COUNT 6
 
#define ACPI_STATE_D0 (u8) 0
#define ACPI_STATE_D1 (u8) 1
#define ACPI_STATE_D2 (u8) 2
#define ACPI_STATE_D3 (u8) 3
#define ACPI_D_STATES_MAX ACPI_STATE_D3
#define ACPI_D_STATE_COUNT 4
 
#define ACPI_STATE_C0 (u8) 0
#define ACPI_STATE_C1 (u8) 1
#define ACPI_STATE_C2 (u8) 2
#define ACPI_STATE_C3 (u8) 3
#define ACPI_C_STATES_MAX ACPI_STATE_C3
#define ACPI_C_STATE_COUNT 4
 
/*
* Sleep type invalid value
*/
#define ACPI_SLEEP_TYPE_MAX 0x7
#define ACPI_SLEEP_TYPE_INVALID 0xFF
 
/*
* Standard notify values
*/
#define ACPI_NOTIFY_BUS_CHECK (u8) 0
#define ACPI_NOTIFY_DEVICE_CHECK (u8) 1
#define ACPI_NOTIFY_DEVICE_WAKE (u8) 2
#define ACPI_NOTIFY_EJECT_REQUEST (u8) 3
#define ACPI_NOTIFY_DEVICE_CHECK_LIGHT (u8) 4
#define ACPI_NOTIFY_FREQUENCY_MISMATCH (u8) 5
#define ACPI_NOTIFY_BUS_MODE_MISMATCH (u8) 6
#define ACPI_NOTIFY_POWER_FAULT (u8) 7
 
 
/*
* Table types. These values are passed to the table related APIs
*/
typedef u32 acpi_table_type;
 
#define ACPI_TABLE_RSDP (acpi_table_type) 0
#define ACPI_TABLE_DSDT (acpi_table_type) 1
#define ACPI_TABLE_FADT (acpi_table_type) 2
#define ACPI_TABLE_FACS (acpi_table_type) 3
#define ACPI_TABLE_PSDT (acpi_table_type) 4
#define ACPI_TABLE_SSDT (acpi_table_type) 5
#define ACPI_TABLE_XSDT (acpi_table_type) 6
#define ACPI_TABLE_MAX 6
#define NUM_ACPI_TABLE_TYPES (ACPI_TABLE_MAX+1)
 
 
/*
* Types associated with ACPI names and objects. The first group of
* values (up to ACPI_TYPE_EXTERNAL_MAX) correspond to the definition
* of the ACPI object_type() operator (See the ACPI Spec). Therefore,
* only add to the first group if the spec changes.
*
* Types must be kept in sync with the global acpi_ns_properties
* and acpi_ns_type_names arrays.
*/
typedef u32 acpi_object_type;
 
#define ACPI_TYPE_ANY 0x00
#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_FIELD_UNIT 0x05
#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_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_BUFFER_FIELD 0x0E
#define ACPI_TYPE_DDB_HANDLE 0x0F
#define ACPI_TYPE_DEBUG_OBJECT 0x10
 
#define ACPI_TYPE_EXTERNAL_MAX 0x10
 
/*
* These are object types that do not map directly to the ACPI
* object_type() operator. They are used for various internal purposes only.
* If new predefined ACPI_TYPEs are added (via the ACPI specification), these
* internal types must move upwards. (There is code that depends on these
* values being contiguous with the external types above.)
*/
#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_ALIAS 0x15
#define ACPI_TYPE_LOCAL_NOTIFY 0x16
#define ACPI_TYPE_LOCAL_ADDRESS_HANDLER 0x17
#define ACPI_TYPE_LOCAL_RESOURCE 0x18
#define ACPI_TYPE_LOCAL_RESOURCE_FIELD 0x19
#define ACPI_TYPE_LOCAL_SCOPE 0x1A /* 1 Name, multiple object_list Nodes */
 
#define ACPI_TYPE_NS_NODE_MAX 0x1A /* Last typecode used within a NS Node */
 
/*
* These are special object types that never appear in
* a Namespace node, only in an union acpi_operand_object
*/
#define ACPI_TYPE_LOCAL_EXTRA 0x1B
#define ACPI_TYPE_LOCAL_DATA 0x1C
 
#define ACPI_TYPE_LOCAL_MAX 0x1C
 
/* All types above here are invalid */
 
#define ACPI_TYPE_INVALID 0x1D
#define ACPI_TYPE_NOT_FOUND 0xFF
 
 
/*
* Bitmapped ACPI types. Used internally only
*/
#define ACPI_BTYPE_ANY 0x00000000
#define ACPI_BTYPE_INTEGER 0x00000001
#define ACPI_BTYPE_STRING 0x00000002
#define ACPI_BTYPE_BUFFER 0x00000004
#define ACPI_BTYPE_PACKAGE 0x00000008
#define ACPI_BTYPE_FIELD_UNIT 0x00000010
#define ACPI_BTYPE_DEVICE 0x00000020
#define ACPI_BTYPE_EVENT 0x00000040
#define ACPI_BTYPE_METHOD 0x00000080
#define ACPI_BTYPE_MUTEX 0x00000100
#define ACPI_BTYPE_REGION 0x00000200
#define ACPI_BTYPE_POWER 0x00000400
#define ACPI_BTYPE_PROCESSOR 0x00000800
#define ACPI_BTYPE_THERMAL 0x00001000
#define ACPI_BTYPE_BUFFER_FIELD 0x00002000
#define ACPI_BTYPE_DDB_HANDLE 0x00004000
#define ACPI_BTYPE_DEBUG_OBJECT 0x00008000
#define ACPI_BTYPE_REFERENCE 0x00010000
#define ACPI_BTYPE_RESOURCE 0x00020000
 
#define ACPI_BTYPE_COMPUTE_DATA (ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER)
 
#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_ALL_OBJECTS 0x0000FFFF
 
/*
* All I/O
*/
#define ACPI_READ 0
#define ACPI_WRITE 1
#define ACPI_IO_MASK 1
 
 
/*
* Acpi Event Types: Fixed & General Purpose
*/
typedef u32 acpi_event_type;
 
/*
* Fixed events
*/
#define ACPI_EVENT_PMTIMER 0
#define ACPI_EVENT_GLOBAL 1
#define ACPI_EVENT_POWER_BUTTON 2
#define ACPI_EVENT_SLEEP_BUTTON 3
#define ACPI_EVENT_RTC 4
#define ACPI_EVENT_MAX 4
#define ACPI_NUM_FIXED_EVENTS ACPI_EVENT_MAX + 1
 
#define ACPI_GPE_INVALID 0xFF
#define ACPI_GPE_MAX 0xFF
#define ACPI_NUM_GPE 256
 
#define ACPI_EVENT_LEVEL_TRIGGERED 1
#define ACPI_EVENT_EDGE_TRIGGERED 2
 
/*
* Flags for GPE and Lock interfaces
*/
#define ACPI_EVENT_WAKE_ENABLE 0x2
#define ACPI_EVENT_WAKE_DISABLE 0x2
 
#define ACPI_NOT_ISR 0x1
#define ACPI_ISR 0x0
 
 
/*
* acpi_event Status:
* -------------
* The encoding of acpi_event_status is illustrated below.
* Note that a set bit (1) indicates the property is TRUE
* (e.g. if bit 0 is set then the event is enabled).
* +-------------+-+-+-+
* | Bits 31:3 |2|1|0|
* +-------------+-+-+-+
* | | | |
* | | | +- Enabled?
* | | +--- Enabled for wake?
* | +----- Set?
* +----------- <Reserved>
*/
typedef u32 acpi_event_status;
 
#define ACPI_EVENT_FLAG_DISABLED (acpi_event_status) 0x00
#define ACPI_EVENT_FLAG_ENABLED (acpi_event_status) 0x01
#define ACPI_EVENT_FLAG_WAKE_ENABLED (acpi_event_status) 0x02
#define ACPI_EVENT_FLAG_SET (acpi_event_status) 0x04
 
 
/* Notify types */
 
#define ACPI_SYSTEM_NOTIFY 0
#define ACPI_DEVICE_NOTIFY 1
#define ACPI_MAX_NOTIFY_HANDLER_TYPE 1
 
#define ACPI_MAX_SYS_NOTIFY 0x7f
 
 
/* Address Space (Operation Region) Types */
 
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
#define ACPI_ADR_SPACE_PCI_CONFIG (acpi_adr_space_type) 2
#define ACPI_ADR_SPACE_EC (acpi_adr_space_type) 3
#define ACPI_ADR_SPACE_SMBUS (acpi_adr_space_type) 4
#define ACPI_ADR_SPACE_CMOS (acpi_adr_space_type) 5
#define ACPI_ADR_SPACE_PCI_BAR_TARGET (acpi_adr_space_type) 6
#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
*/
#define ACPI_BITREG_TIMER_STATUS 0x00
#define ACPI_BITREG_BUS_MASTER_STATUS 0x01
#define ACPI_BITREG_GLOBAL_LOCK_STATUS 0x02
#define ACPI_BITREG_POWER_BUTTON_STATUS 0x03
#define ACPI_BITREG_SLEEP_BUTTON_STATUS 0x04
#define ACPI_BITREG_RT_CLOCK_STATUS 0x05
#define ACPI_BITREG_WAKE_STATUS 0x06
 
#define ACPI_BITREG_TIMER_ENABLE 0x07
#define ACPI_BITREG_GLOBAL_LOCK_ENABLE 0x08
#define ACPI_BITREG_POWER_BUTTON_ENABLE 0x09
#define ACPI_BITREG_SLEEP_BUTTON_ENABLE 0x0A
#define ACPI_BITREG_RT_CLOCK_ENABLE 0x0B
#define ACPI_BITREG_WAKE_ENABLE 0x0C
 
#define ACPI_BITREG_SCI_ENABLE 0x0D
#define ACPI_BITREG_BUS_MASTER_RLD 0x0E
#define ACPI_BITREG_GLOBAL_LOCK_RELEASE 0x0F
#define ACPI_BITREG_SLEEP_TYPE_A 0x10
#define ACPI_BITREG_SLEEP_TYPE_B 0x11
#define ACPI_BITREG_SLEEP_ENABLE 0x12
 
#define ACPI_BITREG_ARB_DISABLE 0x13
 
#define ACPI_BITREG_MAX 0x13
#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 */
} integer;
 
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 */
} buffer;
 
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 */
} package;
 
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;
} power_resource;
};
 
 
/*
* List of objects, used as a parameter list for control method evaluation
*/
struct acpi_object_list
{
u32 count;
union acpi_object *pointer;
};
 
 
/*
* Miscellaneous common Data Structures used by the interfaces
*/
#define ACPI_NO_BUFFER 0
#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 */
};
 
 
/*
* name_type for acpi_get_name
*/
#define ACPI_FULL_PATHNAME 0
#define ACPI_SINGLE_NAME 1
#define ACPI_NAME_TYPE_MAX 1
 
 
/*
* Structure and flags for acpi_get_system_info
*/
#define ACPI_SYS_MODE_UNKNOWN 0x0000
#define ACPI_SYS_MODE_ACPI 0x0001
#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;
};
 
 
/*
* 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];
};
 
 
/*
* Types specific to the OS service interfaces
*/
 
typedef u32
(ACPI_SYSTEM_XFACE *OSD_HANDLER) (
void *context);
 
typedef void
(ACPI_SYSTEM_XFACE *OSD_EXECUTION_CALLBACK) (
void *context);
 
/*
* Various handlers and callback procedures
*/
typedef
u32 (*acpi_event_handler) (
void *context);
 
typedef
void (*acpi_gpe_handler) (
void *context);
 
typedef
void (*acpi_notify_handler) (
acpi_handle device,
u32 value,
void *context);
 
typedef
void (*acpi_object_handler) (
acpi_handle object,
u32 function,
void *data);
 
typedef
acpi_status (*acpi_init_handler) (
acpi_handle object,
u32 function);
 
#define ACPI_INIT_DEVICE_INI 1
 
 
/* Address Spaces (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);
 
#define ACPI_DEFAULT_HANDLER NULL
 
 
typedef
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);
 
 
/* 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];
};
 
/* Common string version of device CIDs */
 
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];
};
 
 
/* Structure and flags for acpi_get_object_info */
 
#define ACPI_VALID_STA 0x0001
#define ACPI_VALID_ADR 0x0002
#define ACPI_VALID_HID 0x0004
#define ACPI_VALID_UID 0x0008
#define ACPI_VALID_CID 0x0010
 
 
#define ACPI_COMMON_OBJ_INFO \
acpi_object_type type; /* ACPI object type */ \
acpi_name name /* ACPI object Name */
 
 
struct acpi_obj_info_header
{
ACPI_COMMON_OBJ_INFO;
};
 
 
/* Structure returned from Get Object Info */
 
struct acpi_device_info
{
ACPI_COMMON_OBJ_INFO;
 
u32 valid; /* Indicates which fields 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 */
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_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
*/
 
/*
* Memory Attributes
*/
#define ACPI_READ_ONLY_MEMORY (u8) 0x00
#define ACPI_READ_WRITE_MEMORY (u8) 0x01
 
#define ACPI_NON_CACHEABLE_MEMORY (u8) 0x00
#define ACPI_CACHABLE_MEMORY (u8) 0x01
#define ACPI_WRITE_COMBINING_MEMORY (u8) 0x02
#define ACPI_PREFETCHABLE_MEMORY (u8) 0x03
 
/*
* IO Attributes
* The ISA Io ranges are: n000-n0_ffh, n400-n4_ffh, n800-n8_ffh, n_c00-n_cFFh.
* The non-ISA Io ranges are: n100-n3_ffh, n500-n7_ffh, n900-n_bFfh, n_cd0-n_fFFh.
*/
#define ACPI_NON_ISA_ONLY_RANGES (u8) 0x01
#define ACPI_ISA_ONLY_RANGES (u8) 0x02
#define ACPI_ENTIRE_RANGE (ACPI_NON_ISA_ONLY_RANGES | ACPI_ISA_ONLY_RANGES)
 
#define ACPI_SPARSE_TRANSLATION (u8) 0x03
 
/*
* 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 */
 
/*
* IRQ Attributes
*/
#define ACPI_EDGE_SENSITIVE (u8) 0x00
#define ACPI_LEVEL_SENSITIVE (u8) 0x01
 
#define ACPI_ACTIVE_HIGH (u8) 0x00
#define ACPI_ACTIVE_LOW (u8) 0x01
 
#define ACPI_EXCLUSIVE (u8) 0x00
#define ACPI_SHARED (u8) 0x01
 
/*
* DMA Attributes
*/
#define ACPI_COMPATIBILITY (u8) 0x00
#define ACPI_TYPE_A (u8) 0x01
#define ACPI_TYPE_B (u8) 0x02
#define ACPI_TYPE_F (u8) 0x03
 
#define ACPI_NOT_BUS_MASTER (u8) 0x00
#define ACPI_BUS_MASTER (u8) 0x01
 
#define ACPI_TRANSFER_8 (u8) 0x00
#define ACPI_TRANSFER_8_16 (u8) 0x01
#define ACPI_TRANSFER_16 (u8) 0x02
 
/*
* Start Dependent Functions Priority definitions
*/
#define ACPI_GOOD_CONFIGURATION (u8) 0x00
#define ACPI_ACCEPTABLE_CONFIGURATION (u8) 0x01
#define ACPI_SUB_OPTIMAL_CONFIGURATION (u8) 0x02
 
/*
* 16, 32 and 64-bit Address Descriptor resource types
*/
#define ACPI_MEMORY_RANGE (u8) 0x00
#define ACPI_IO_RANGE (u8) 0x01
#define ACPI_BUS_NUMBER_RANGE (u8) 0x02
 
#define ACPI_ADDRESS_NOT_FIXED (u8) 0x00
#define ACPI_ADDRESS_FIXED (u8) 0x01
 
#define ACPI_POS_DECODE (u8) 0x00
#define ACPI_SUB_DECODE (u8) 0x01
 
#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_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;
};
 
/*
* END_DEPENDENT_FUNCTIONS_RESOURCE struct is not
* 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_fixed_io
{
u32 base_address;
u32 range_length;
};
 
struct acpi_resource_vendor
{
u32 length;
u8 reserved[1];
};
 
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_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_memory_attribute
{
u16 cache_attribute;
u16 read_write_attribute;
};
 
struct acpi_io_attribute
{
u16 range_attribute;
u16 translation_attribute;
};
 
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;
};
 
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_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;
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];
};
 
 
/* ACPI_RESOURCE_TYPEs */
 
#define ACPI_RSTYPE_IRQ 0
#define ACPI_RSTYPE_DMA 1
#define ACPI_RSTYPE_START_DPF 2
#define ACPI_RSTYPE_END_DPF 3
#define ACPI_RSTYPE_IO 4
#define ACPI_RSTYPE_FIXED_IO 5
#define ACPI_RSTYPE_VENDOR 6
#define ACPI_RSTYPE_END_TAG 7
#define ACPI_RSTYPE_MEM24 8
#define ACPI_RSTYPE_MEM32 9
#define ACPI_RSTYPE_FIXED_MEM32 10
#define ACPI_RSTYPE_ADDRESS16 11
#define ACPI_RSTYPE_ADDRESS32 12
#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;
};
 
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_SIZEOF_RESOURCE(type) (ACPI_RESOURCE_LENGTH_NO_DATA + sizeof (type))
 
#define ACPI_NEXT_RESOURCE(res) (struct acpi_resource *)((u8 *) res + res->length)
 
#ifdef ACPI_MISALIGNED_TRANSFERS
#define ACPI_ALIGN_RESOURCE_SIZE(length) (length)
#else
#define ACPI_ALIGN_RESOURCE_SIZE(length) ACPI_ROUND_UP_TO_NATIVE_WORD(length)
#endif
 
/*
* 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 */
};
 
/*
* END: of definitions for PCI Routing tables
*/
 
 
#endif /* __ACTYPES_H__ */
/shark/trunk/drivers/linuxc26/include/acpi/acconfig.h
0,0 → 1,202
/******************************************************************************
*
* Name: acconfig.h - Global configuration constants
*
*****************************************************************************/
 
/*
* Copyright (C) 2000 - 2003, 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.
*/
 
#ifndef _ACCONFIG_H
#define _ACCONFIG_H
 
 
/******************************************************************************
*
* Configuration options
*
*****************************************************************************/
 
/*
* ACPI_DEBUG_OUTPUT - This switch enables all the debug facilities of the
* ACPI subsystem. This includes the DEBUG_PRINT output
* statements. When disabled, all DEBUG_PRINT
* statements are compiled out.
*
* ACPI_APPLICATION - Use this switch if the subsystem is going to be run
* at the application level.
*
*/
 
/* Version string */
 
#define ACPI_CA_VERSION 0x20031002
 
/* Maximum objects in the various object caches */
 
#define ACPI_MAX_STATE_CACHE_DEPTH 64 /* State objects for stacks */
#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 */
 
/*
* Should the subystem abort the loading of an ACPI table if the
* table checksum is incorrect?
*/
#define ACPI_CHECKSUM_ABORT FALSE
 
 
/******************************************************************************
*
* Subsystem Constants
*
*****************************************************************************/
 
/* Version of ACPI supported */
 
#define ACPI_CA_SUPPORT_LEVEL 2
 
/* String size constants */
 
#define ACPI_MAX_STRING_LENGTH 512
#define ACPI_PATHNAME_MAX 256 /* A full namespace pathname */
 
/* Maximum count for a semaphore object */
 
#define ACPI_MAX_SEMAPHORE_COUNT 256
 
/* Max reference count (for debug only) */
 
#define ACPI_MAX_REFERENCE_COUNT 0x400
 
/* Size of cached memory mapping for system memory operation region */
 
#define ACPI_SYSMEM_REGION_WINDOW_SIZE 4096
 
 
/******************************************************************************
*
* ACPI Specification constants (Do not change unless the specification changes)
*
*****************************************************************************/
 
/* Number of distinct GPE register blocks and register width */
 
#define ACPI_MAX_GPE_BLOCKS 2
#define ACPI_GPE_REGISTER_WIDTH 8
 
/*
* Method info (in WALK_STATE), containing local variables and argumetns
*/
#define ACPI_METHOD_NUM_LOCALS 8
#define ACPI_METHOD_MAX_LOCAL 7
 
#define ACPI_METHOD_NUM_ARGS 7
#define ACPI_METHOD_MAX_ARG 6
 
/* Maximum length of resulting string when converting from a buffer */
 
#define ACPI_MAX_STRING_CONVERSION 200
 
/* Length of _HID, _UID, and _CID values */
 
#define ACPI_DEVICE_ID_LENGTH 0x09
#define ACPI_MAX_CID_LENGTH 48
 
/*
* Operand Stack (in WALK_STATE), Must be large enough to contain METHOD_MAX_ARG
*/
#define ACPI_OBJ_NUM_OPERANDS 8
#define ACPI_OBJ_MAX_OPERAND 7
 
/* 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_SEPARATOR '.'
 
/* Constants used in searching for the RSDP in low memory */
 
#define ACPI_LO_RSDP_WINDOW_BASE 0 /* Physical Address */
#define ACPI_HI_RSDP_WINDOW_BASE 0xE0000 /* Physical Address */
#define ACPI_LO_RSDP_WINDOW_SIZE 0x400
#define ACPI_HI_RSDP_WINDOW_SIZE 0x20000
#define ACPI_RSDP_SCAN_STEP 16
 
/* Operation regions */
 
#define ACPI_NUM_PREDEFINED_REGIONS 8
#define ACPI_USER_REGION_BEGIN 0x80
 
/* Maximum space_ids for Operation Regions */
 
#define ACPI_MAX_ADDRESS_SPACE 255
 
/* Array sizes. Used for range checking also */
 
#define ACPI_NUM_ACCESS_TYPES 6
#define ACPI_NUM_UPDATE_RULES 3
#define ACPI_NUM_LOCK_RULES 2
#define ACPI_NUM_MATCH_OPS 6
#define ACPI_NUM_OPCODES 256
#define ACPI_NUM_FIELD_NAMES 2
 
/* RSDP checksums */
 
#define ACPI_RSDP_CHECKSUM_LENGTH 20
#define ACPI_RSDP_XCHECKSUM_LENGTH 36
 
/* SMBus bidirectional buffer size */
 
#define ACPI_SMBUS_BUFFER_SIZE 34
 
 
/******************************************************************************
*
* ACPI AML Debugger
*
*****************************************************************************/
 
#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 */
 
/shark/trunk/drivers/linuxc26/include/acpi/achware.h
0,0 → 1,177
/******************************************************************************
*
* Name: achware.h -- hardware specific interfaces
*
*****************************************************************************/
 
/*
* Copyright (C) 2000 - 2003, 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.
*/
 
#ifndef __ACHWARE_H__
#define __ACHWARE_H__
 
 
/* PM Timer ticks per second (HZ) */
#define PM_TIMER_FREQUENCY 3579545
 
 
/* Prototypes */
 
 
acpi_status
acpi_hw_initialize (
void);
 
acpi_status
acpi_hw_shutdown (
void);
 
acpi_status
acpi_hw_initialize_system_info (
void);
 
acpi_status
acpi_hw_set_mode (
u32 mode);
 
u32
acpi_hw_get_mode (
void);
 
u32
acpi_hw_get_mode_capabilities (
void);
 
/* Register I/O Prototypes */
 
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);
 
acpi_status
acpi_hw_register_write (
u8 use_lock,
u32 register_id,
u32 value);
 
acpi_status
acpi_hw_low_level_read (
u32 width,
u32 *value,
struct acpi_generic_address *reg);
 
acpi_status
acpi_hw_low_level_write (
u32 width,
u32 value,
struct acpi_generic_address *reg);
 
acpi_status
acpi_hw_clear_acpi_status (
u32 flags);
 
 
/* GPE support */
 
acpi_status
acpi_hw_enable_gpe (
struct acpi_gpe_event_info *gpe_event_info);
 
void
acpi_hw_enable_gpe_for_wakeup (
struct acpi_gpe_event_info *gpe_event_info);
 
acpi_status
acpi_hw_disable_gpe (
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);
 
void
acpi_hw_disable_gpe_for_wakeup (
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_status
acpi_hw_get_gpe_status (
struct acpi_gpe_event_info *gpe_event_info,
acpi_event_status *event_status);
 
acpi_status
acpi_hw_disable_non_wakeup_gpes (
void);
 
acpi_status
acpi_hw_enable_non_wakeup_gpes (
void);
 
 
/* ACPI Timer prototypes */
 
acpi_status
acpi_get_timer_resolution (
u32 *resolution);
 
acpi_status
acpi_get_timer (
u32 *ticks);
 
acpi_status
acpi_get_timer_duration (
u32 start_ticks,
u32 end_ticks,
u32 *time_elapsed);
 
 
#endif /* __ACHWARE_H__ */
/shark/trunk/drivers/linuxc26/include/acpi/acpixf.h
0,0 → 1,462
 
/******************************************************************************
*
* Name: acpixf.h - External interfaces to the ACPI subsystem
*
*****************************************************************************/
 
/*
* Copyright (C) 2000 - 2003, 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.
*/
 
 
#ifndef __ACXFACE_H__
#define __ACXFACE_H__
 
#include "actypes.h"
#include "actbl.h"
 
 
/*
* Global interfaces
*/
 
acpi_status
acpi_initialize_subsystem (
void);
 
acpi_status
acpi_enable_subsystem (
u32 flags);
 
acpi_status
acpi_initialize_objects (
u32 flags);
 
acpi_status
acpi_terminate (
void);
 
acpi_status
acpi_subsystem_status (
void);
 
acpi_status
acpi_enable (
void);
 
acpi_status
acpi_disable (
void);
 
acpi_status
acpi_get_system_info (
struct acpi_buffer *ret_buffer);
 
const char *
acpi_format_exception (
acpi_status exception);
 
acpi_status
acpi_purge_cached_objects (
void);
 
acpi_status
acpi_install_initialization_handler (
acpi_init_handler handler,
u32 function);
 
/*
* ACPI Memory manager
*/
 
void *
acpi_allocate (
u32 size);
 
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_status
acpi_load_tables (
void);
 
acpi_status
acpi_load_table (
struct acpi_table_header *table_ptr);
 
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);
 
acpi_status
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);
 
 
/*
* 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_status
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_status
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_status
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);
 
 
/*
* 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_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_status
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_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_status
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_status
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_status
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_gpe_handler handler,
void *context);
 
acpi_status
acpi_acquire_global_lock (
u16 timeout,
u32 *handle);
 
acpi_status
acpi_release_global_lock (
u32 handle);
 
acpi_status
acpi_remove_gpe_handler (
acpi_handle gpe_device,
u32 gpe_number,
acpi_gpe_handler handler);
 
acpi_status
acpi_enable_event (
u32 event,
u32 flags);
 
acpi_status
acpi_disable_event (
u32 event,
u32 flags);
 
acpi_status
acpi_clear_event (
u32 event);
 
acpi_status
acpi_get_event_status (
u32 event,
acpi_event_status *event_status);
 
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_clear_gpe (
acpi_handle gpe_device,
u32 gpe_number,
u32 flags);
 
acpi_status
acpi_get_gpe_status (
acpi_handle gpe_device,
u32 gpe_number,
u32 flags,
acpi_event_status *event_status);
 
acpi_status
acpi_install_gpe_block (
acpi_handle gpe_device,
struct acpi_generic_address *gpe_block_address,
u32 register_count,
u32 interrupt_level);
 
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_get_current_resources(
acpi_handle device_handle,
struct acpi_buffer *ret_buffer);
 
acpi_status
acpi_get_possible_resources(
acpi_handle device_handle,
struct acpi_buffer *ret_buffer);
 
acpi_status
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_status
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);
 
/*
* Hardware (ACPI device) interfaces
*/
 
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_firmware_waking_vector (
acpi_physical_address physical_address);
 
acpi_status
acpi_get_firmware_waking_vector (
acpi_physical_address *physical_address);
 
acpi_status
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 (
u8 sleep_state);
 
acpi_status
acpi_enter_sleep_state_s4bios (
void);
 
acpi_status
acpi_leave_sleep_state (
u8 sleep_state);
 
 
#endif /* __ACXFACE_H__ */
/shark/trunk/drivers/linuxc26/include/acpi/acobject.h
0,0 → 1,493
 
/******************************************************************************
*
* Name: acobject.h - Definition of union acpi_operand_object (Internal object only)
*
*****************************************************************************/
 
/*
* Copyright (C) 2000 - 2003, 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.
*/
 
#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
* address space handlers and notify handlers. The object is a constant
* size in order to allow it to be cached and reused.
*/
 
/*******************************************************************************
*
* Common Descriptors
*
******************************************************************************/
 
/*
* Common area for all objects.
*
* data_type is used to differentiate between internal descriptors, and MUST
* be the first byte in this structure.
*/
#define ACPI_OBJECT_COMMON_HEADER /* SIZE/ALIGNMENT: 32 bits, one ptr plus trailing 8-bit flag */\
u8 descriptor; /* To differentiate various internal objs */\
u8 type; /* acpi_object_type */\
u16 reference_count; /* For object deletion management */\
union acpi_operand_object *next_object; /* Objects linked to parent NS node */\
u8 flags; \
 
/* Values for flag byte above */
 
#define AOPOBJ_AML_CONSTANT 0x01
#define AOPOBJ_STATIC_POINTER 0x02
#define AOPOBJ_DATA_VALID 0x04
#define AOPOBJ_OBJECT_INITIALIZED 0x08
#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
* "Buffer Datum" -- a datum from a user buffer, read from or to be written to the field
*/
#define ACPI_COMMON_FIELD_INFO /* SIZE/ALIGNMENT: 24 bits + three 32-bit values */\
u8 field_flags; /* Access, update, and lock bits */\
u8 attribute; /* From access_as keyword */\
u8 access_byte_width; /* Read/Write size in bytes */\
u32 bit_length; /* Length of field in bits */\
u32 base_byte_offset; /* Byte offset within containing object */\
u8 start_field_bit_offset;/* Bit offset within first field datum (0-63) */\
u8 datum_valid_bits; /* Valid bit in first "Field datum" */\
u8 end_field_valid_bits; /* Valid bits in the last "field datum" */\
u8 end_buffer_valid_bits; /* Valid bits in the last "buffer datum" */\
u32 value; /* Value to store into the Bank or Index register */\
struct acpi_namespace_node *node; /* Link back to parent node */
 
 
/*
* Fields common to both Strings and Buffers
*/
#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 *address_space; /* Handler for Address space */
 
 
/******************************************************************************
*
* Basic data types
*
*****************************************************************************/
 
struct acpi_object_common
{
ACPI_OBJECT_COMMON_HEADER
};
 
 
struct acpi_object_integer
{
ACPI_OBJECT_COMMON_HEADER
acpi_integer value;
};
 
 
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_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;
};
 
 
#define INFINITE_CONCURRENCY 0xFF
 
struct acpi_object_method
{
ACPI_OBJECT_COMMON_HEADER
u8 method_flags;
u8 param_count;
u32 aml_length;
void *semaphore;
u8 *aml_start;
u8 concurrency;
u8 thread_count;
acpi_owner_id owning_id;
};
 
 
struct acpi_object_mutex
{
ACPI_OBJECT_COMMON_HEADER
u16 sync_level;
u16 acquisition_depth;
struct acpi_thread_state *owner_thread;
void *semaphore;
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 object */
};
 
 
struct acpi_object_region
{
ACPI_OBJECT_COMMON_HEADER
 
u8 space_id;
union acpi_operand_object *address_space; /* Handler for region access */
struct acpi_namespace_node *node; /* containing object */
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_power_resource
{
ACPI_OBJECT_COMMON_HEADER
ACPI_COMMON_NOTIFY_INFO
u32 system_level;
u32 resource_order;
};
 
 
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
};
 
 
/******************************************************************************
*
* Fields. All share a common header/info field.
*
*****************************************************************************/
 
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_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 */
};
 
 
/* 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 */
};
 
 
/******************************************************************************
*
* 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;
};
 
 
/* 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;
};
 
 
/******************************************************************************
*
* Special internal objects
*
*****************************************************************************/
 
/*
* 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;
};
 
 
/*
* Extra object is used as additional storage for types that
* have AML code in their declarations (term_args) that must be
* evaluated at run time.
*
* 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 */
};
 
 
/* Additional data that can be attached to namespace nodes */
 
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*/
};
 
 
/******************************************************************************
*
* 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_descriptor - objects that share a common descriptor identifier
*
*****************************************************************************/
 
 
/* Object descriptor types */
 
#define ACPI_DESC_TYPE_CACHED 0x11 /* Used only when object is cached */
#define ACPI_DESC_TYPE_STATE 0x20
#define ACPI_DESC_TYPE_STATE_UPDATE 0x21
#define ACPI_DESC_TYPE_STATE_PACKAGE 0x22
#define ACPI_DESC_TYPE_STATE_CONTROL 0x23
#define ACPI_DESC_TYPE_STATE_RPSCOPE 0x24
#define ACPI_DESC_TYPE_STATE_PSCOPE 0x25
#define ACPI_DESC_TYPE_STATE_WSCOPE 0x26
#define ACPI_DESC_TYPE_STATE_RESULT 0x27
#define ACPI_DESC_TYPE_STATE_NOTIFY 0x28
#define ACPI_DESC_TYPE_STATE_THREAD 0x29
#define ACPI_DESC_TYPE_WALK 0x44
#define ACPI_DESC_TYPE_PARSER 0x66
#define ACPI_DESC_TYPE_OPERAND 0x88
#define ACPI_DESC_TYPE_NAMED 0xAA
 
 
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 */
/shark/trunk/drivers/linuxc26/include/acpi/acpiosxf.h
0,0 → 1,373
 
/******************************************************************************
*
* Name: acpiosxf.h - All interfaces to the OS Services Layer (OSL). These
* interfaces must be implemented by OSL to interface the
* ACPI components to the host operating system.
*
*****************************************************************************/
 
 
/*
* Copyright (C) 2000 - 2003, 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.
*/
 
#ifndef __ACPIOSXF_H__
#define __ACPIOSXF_H__
 
#include "platform/acenv.h"
#include "actypes.h"
 
 
/* Priorities for acpi_os_queue_for_execution */
 
#define OSD_PRIORITY_GPE 1
#define OSD_PRIORITY_HIGH 2
#define OSD_PRIORITY_MED 3
#define OSD_PRIORITY_LO 4
 
#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;
};
 
 
/*
* OSL Initialization and shutdown primitives
*/
 
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_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);
 
 
/*
* 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_status
acpi_os_wait_semaphore (
acpi_handle handle,
u32 units,
u16 timeout);
 
acpi_status
acpi_os_signal_semaphore (
acpi_handle handle,
u32 units);
 
acpi_status
acpi_os_create_lock (
acpi_handle *out_handle);
 
void
acpi_os_delete_lock (
acpi_handle handle);
 
void
acpi_os_acquire_lock (
acpi_handle handle,
u32 flags);
 
void
acpi_os_release_lock (
acpi_handle handle,
u32 flags);
 
 
/*
* Memory allocation and mapping
*/
 
void *
acpi_os_allocate (
acpi_size size);
 
void
acpi_os_free (
void * memory);
 
acpi_status
acpi_os_map_memory (
acpi_physical_address physical_address,
acpi_size size,
void **logical_address);
 
void
acpi_os_unmap_memory (
void *logical_address,
acpi_size size);
 
acpi_status
acpi_os_get_physical_address (
void *logical_address,
acpi_physical_address *physical_address);
 
 
/*
* Interrupt handlers
*/
 
acpi_status
acpi_os_install_interrupt_handler (
u32 interrupt_number,
OSD_HANDLER service_routine,
void *context);
 
acpi_status
acpi_os_remove_interrupt_handler (
u32 interrupt_number,
OSD_HANDLER service_routine);
 
 
/*
* Threads and Scheduling
*/
 
u32
acpi_os_get_thread_id (
void);
 
acpi_status
acpi_os_queue_for_execution (
u32 priority,
OSD_EXECUTION_CALLBACK function,
void *context);
 
void
acpi_os_sleep (
u32 seconds,
u32 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);
 
 
/*
* Platform and hardware-independent physical memory interfaces
*/
 
acpi_status
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);
 
 
/*
* Platform and hardware-independent PCI configuration space access
*/
 
acpi_status
acpi_os_read_pci_configuration (
struct acpi_pci_id *pci_id,
u32 register,
void *value,
u32 width);
 
acpi_status
acpi_os_write_pci_configuration (
struct acpi_pci_id *pci_id,
u32 register,
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);
 
/*
* Miscellaneous
*/
 
u8
acpi_os_readable (
void *pointer,
acpi_size length);
 
u8
acpi_os_writable (
void *pointer,
acpi_size length);
 
u32
acpi_os_get_timer (
void);
 
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_os_redirect_output (
void *destination);
 
 
/*
* Debug input
*/
 
u32
acpi_os_get_line (
char *buffer);
 
 
/*
* Directory manipulation
*/
 
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);
 
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);
 
 
#endif /* __ACPIOSXF_H__ */
/shark/trunk/drivers/linuxc26/include/acpi/acresrc.h
0,0 → 1,391
/******************************************************************************
*
* Name: acresrc.h - Resource Manager function prototypes
*
*****************************************************************************/
 
/*
* Copyright (C) 2000 - 2003, 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.
*/
 
#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_status
acpi_rs_get_crs_method_data (
acpi_handle handle,
struct acpi_buffer *ret_buffer);
 
acpi_status
acpi_rs_get_prs_method_data (
acpi_handle handle,
struct acpi_buffer *ret_buffer);
 
acpi_status
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_status
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_status
acpi_rs_create_pci_routing_table (
union acpi_operand_object *package_object,
struct acpi_buffer *output_buffer);
 
 
/*
* Function prototypes called from acpi_rs_create*
*/
void
acpi_rs_dump_irq (
union acpi_resource_data *data);
 
void
acpi_rs_dump_address16 (
union acpi_resource_data *data);
 
void
acpi_rs_dump_address32 (
union acpi_resource_data *data);
 
void
acpi_rs_dump_address64 (
union acpi_resource_data *data);
 
void
acpi_rs_dump_dma (
union acpi_resource_data *data);
 
void
acpi_rs_dump_io (
union acpi_resource_data *data);
 
void
acpi_rs_dump_extended_irq (
union acpi_resource_data *data);
 
void
acpi_rs_dump_fixed_io (
union acpi_resource_data *data);
 
void
acpi_rs_dump_fixed_memory32 (
union acpi_resource_data *data);
 
void
acpi_rs_dump_memory24 (
union acpi_resource_data *data);
 
void
acpi_rs_dump_memory32 (
union acpi_resource_data *data);
 
void
acpi_rs_dump_start_depend_fns (
union acpi_resource_data *data);
 
void
acpi_rs_dump_vendor_specific (
union acpi_resource_data *data);
 
void
acpi_rs_dump_resource_list (
struct acpi_resource *resource);
 
void
acpi_rs_dump_irq_list (
u8 *route_table);
 
acpi_status
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_status
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_status
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_status
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_status
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_status
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_status
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_status
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_status
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_status
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_status
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_status
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_status
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_status
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_status
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_status
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_status
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_status
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);
 
u8
acpi_rs_get_resource_type (
u8 resource_start_byte);
 
#endif /* __ACRESRC_H__ */
/shark/trunk/drivers/linuxc26/include/acpi/acdisasm.h
0,0 → 1,402
/******************************************************************************
*
* Name: acdisasm.h - AML disassembler
*
*****************************************************************************/
 
/*
* Copyright (C) 2000 - 2003, 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.
*/
 
#ifndef __ACDISASM_H__
#define __ACDISASM_H__
 
#include "amlresrc.h"
 
 
#define BLOCK_NONE 0
#define BLOCK_PAREN 1
#define BLOCK_BRACE 2
#define BLOCK_COMMA_LIST 4
 
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_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;
};
 
typedef
acpi_status (*asl_walk_callback) (
union acpi_parse_object *op,
u32 level,
void *context);
 
 
/*
* dmwalk
*/
 
void
acpi_dm_walk_parse_tree (
union acpi_parse_object *op,
asl_walk_callback descending_callback,
asl_walk_callback ascending_callback,
void *context);
 
acpi_status
acpi_dm_descending_op (
union acpi_parse_object *op,
u32 level,
void *context);
 
acpi_status
acpi_dm_ascending_op (
union acpi_parse_object *op,
u32 level,
void *context);
 
 
/*
* dmopcode
*/
 
void
acpi_dm_validate_name (
char *name,
union acpi_parse_object *op);
 
u32
acpi_dm_dump_name (
char *name);
 
void
acpi_dm_unicode (
union acpi_parse_object *op);
 
void
acpi_dm_disassemble (
struct acpi_walk_state *walk_state,
union acpi_parse_object *origin,
u32 num_opcodes);
 
void
acpi_dm_namestring (
char *name);
 
void
acpi_dm_display_path (
union acpi_parse_object *op);
 
void
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);
 
u32
acpi_dm_block_type (
union acpi_parse_object *op);
 
u32
acpi_dm_list_type (
union acpi_parse_object *op);
 
acpi_status
acpi_ps_display_object_pathname (
struct acpi_walk_state *walk_state,
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_address_space (
u8 space_id);
 
void
acpi_dm_region_flags (
union acpi_parse_object *op);
 
void
acpi_dm_match_op (
union acpi_parse_object *op);
 
void
acpi_dm_match_keyword (
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);
 
 
/*
* dmobject
*/
 
void
acpi_dm_decode_node (
struct acpi_namespace_node *node);
 
void
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_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);
 
 
/*
* dmbuffer
*/
 
void
acpi_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);
 
u8
acpi_dm_is_string_buffer (
union acpi_parse_object *op);
 
 
/*
* dmresrc
*/
 
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);
 
void
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);
 
void
acpi_dm_indent (
u32 level);
 
void
acpi_dm_bit_list (
u16 mask);
 
void
acpi_dm_decode_attribute (
u8 attribute);
 
/*
* dmresrcl
*/
 
void
acpi_dm_io_flags (
u8 flags);
 
void
acpi_dm_memory_flags (
u8 flags,
u8 specific_flags);
 
void
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);
 
void
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);
 
void
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);
 
void
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);
 
void
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);
 
void
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);
 
void
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);
 
void
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);
 
 
#endif /* __ACDISASM_H__ */
/shark/trunk/drivers/linuxc26/include/acpi/acpi_bus.h
0,0 → 1,312
/*
* acpi_bus.h - ACPI Bus Driver ($Revision: 1.1 $)
*
* Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com>
* Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
*
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*
* 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.
*
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
 
#ifndef __ACPI_BUS_H__
#define __ACPI_BUS_H__
 
#include <linux/kobject.h>
 
#include <acpi/acpi.h>
 
#define PREFIX "ACPI: "
 
extern int acpi_disabled;
 
/* TBD: Make dynamic */
#define ACPI_MAX_HANDLES 10
struct acpi_handle_list {
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_status
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);
 
 
#ifdef CONFIG_ACPI_BUS
 
#include <linux/proc_fs.h>
 
#define ACPI_BUS_FILE_ROOT "acpi"
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_EJECT,
ACPI_BUS_REMOVAL_SUPRISE,
ACPI_BUS_REMOVAL_TYPE_COUNT
};
 
enum acpi_bus_device_type {
ACPI_BUS_TYPE_DEVICE = 0,
ACPI_BUS_TYPE_POWER,
ACPI_BUS_TYPE_PROCESSOR,
ACPI_BUS_TYPE_THERMAL,
ACPI_BUS_TYPE_SYSTEM,
ACPI_BUS_TYPE_POWER_BUTTON,
ACPI_BUS_TYPE_SLEEP_BUTTON,
ACPI_BUS_DEVICE_TYPE_COUNT
};
 
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);
 
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;
};
 
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;
};
 
/*
* ACPI Device
* -----------
*/
 
/* 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;
};
 
 
/* 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 reserved:21;
};
 
 
/* File System */
 
struct acpi_device_dir {
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];
 
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; /* " */
};
 
#define acpi_device_bid(d) ((d)->pnp.bus_id)
#define acpi_device_adr(d) ((d)->pnp.bus_address)
#define acpi_device_hid(d) ((d)->pnp.hardware_id)
#define acpi_device_uid(d) ((d)->pnp.unique_id)
#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 wake_capable:1; /* Wakeup supported? */
u32 wake_enabled:1; /* Enabled for wakeup */
u32 power_removed:1; /* Optimize Dx->D0 */
u32 reserved:26;
};
 
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 */
};
 
struct acpi_device_power {
int state; /* Current state */
struct acpi_device_power_flags flags;
struct acpi_device_power_state states[4]; /* Power states (D0-D3) */
};
 
 
/* Performance Management */
 
struct acpi_device_perf_flags {
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) */
};
 
struct acpi_device_perf {
int state;
struct acpi_device_perf_flags flags;
int state_count;
struct acpi_device_perf_state *states;
};
 
 
/* Device */
 
struct acpi_device {
acpi_handle handle;
struct acpi_device *parent;
struct list_head children;
struct list_head node;
struct list_head g_list;
struct acpi_device_status status;
struct acpi_device_flags flags;
struct acpi_device_pnp pnp;
struct acpi_device_power power;
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;
};
 
extern struct subsystem acpi_subsys;
 
/*
* External Functions
*/
 
int acpi_bus_get_device(acpi_handle, struct acpi_device **device);
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_create_dir(struct acpi_device *);
void acpi_remove_dir(struct acpi_device *);
 
#endif /*CONFIG_ACPI_BUS*/
 
#endif /*__ACPI_BUS_H__*/
/shark/trunk/drivers/linuxc26/include/acpi/actbl.h
0,0 → 1,342
/******************************************************************************
*
* Name: actbl.h - Table data structures defined in ACPI specification
*
*****************************************************************************/
 
/*
* Copyright (C) 2000 - 2003, 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.
*/
 
#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 */
 
 
/*
* Common table types. The base code can remain
* constant if the underlying tables are changed
*/
#define RSDT_DESCRIPTOR struct rsdt_descriptor_rev2
#define XSDT_DESCRIPTOR struct xsdt_descriptor_rev2
#define FACS_DESCRIPTOR struct facs_descriptor_rev2
#define FADT_DESCRIPTOR struct fadt_descriptor_rev2
 
 
#pragma pack(1)
 
/*
* ACPI Version-independent tables
*
* 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; /* 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 */
};
 
 
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]; /* ACPI signature (4 ASCII characters) */\
u32 length; /* Length of table, in bytes, including 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 */\
u32 oem_revision; /* OEM revision number */\
char asl_compiler_id [4]; /* ASL compiler vendor ID */\
u32 asl_compiler_revision; /* ASL compiler revision number */
 
 
struct acpi_table_header /* ACPI common table header */
{
ACPI_TABLE_HEADER_DEF
};
 
 
/*
* MADT values and structures
*/
 
/* Values for MADT PCATCompat */
 
#define DUAL_PIC 0
#define MULTIPLE_APIC 1
 
 
/* Master MADT */
 
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;
};
 
 
/* Values for Type in APIC_HEADER_DEF */
 
#define APIC_PROCESSOR 0
#define APIC_IO 1
#define APIC_XRUPT_OVERRIDE 2
#define APIC_NMI 3
#define APIC_LOCAL_NMI 4
#define APIC_ADDRESS_OVERRIDE 5
#define APIC_IO_SAPIC 6
#define APIC_LOCAL_SAPIC 7
#define APIC_XRUPT_SOURCE 8
#define APIC_RESERVED 9 /* 9 and greater are reserved */
 
/*
* MADT sub-structures (Follow MULTIPLE_APIC_DESCRIPTION_TABLE)
*/
#define APIC_HEADER_DEF /* Common APIC sub-structure header */\
u8 type; \
u8 length;
 
/* Values for MPS INTI flags */
 
#define POLARITY_CONFORMS 0
#define POLARITY_ACTIVE_HIGH 1
#define POLARITY_RESERVED 2
#define POLARITY_ACTIVE_LOW 3
 
#define TRIGGER_CONFORMS 0
#define TRIGGER_EDGE 1
#define TRIGGER_RESERVED 2
#define TRIGGER_LEVEL 3
 
/* Common flag definitions */
 
#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 */
 
#define LOCAL_APIC_FLAGS \
u32 processor_enabled: 1; /* Processor is usable if set */\
u32 reserved2 : 31; /* 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_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_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_address_override
{
APIC_HEADER_DEF
u16 reserved; /* Reserved - must be zero */
u32 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_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
};
 
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 reserved; /* Reserved - must be zero */
};
 
 
/*
* Smart Battery
*/
struct smart_battery_table
{
ACPI_TABLE_HEADER_DEF
u32 warning_level;
u32 low_level;
u32 critical_level;
};
 
 
/*
* High performance timer
*/
struct hpet_table
{
ACPI_TABLE_HEADER_DEF
u32 hardware_id;
u32 base_address [3];
u8 hpet_number;
u16 clock_tick;
u8 attributes;
};
 
#pragma pack()
 
 
/*
* ACPI Table information. We save the table address, length,
* and type of memory allocation (mapped or allocated) for each
* table for 1) when we exit, and 2) if a new table is installed
*/
#define ACPI_MEM_NOT_ALLOCATED 0
#define ACPI_MEM_ALLOCATED 1
#define ACPI_MEM_MAPPED 2
 
/* Definitions for the Flags bitfield member of struct acpi_table_support */
 
#define ACPI_TABLE_SINGLE 0x00
#define ACPI_TABLE_MULTIPLE 0x01
#define ACPI_TABLE_EXECUTABLE 0x02
 
#define ACPI_TABLE_ROOT 0x00
#define ACPI_TABLE_PRIMARY 0x10
#define ACPI_TABLE_SECONDARY 0x20
#define ACPI_TABLE_ALL 0x30
#define ACPI_TABLE_TYPE_MASK 0x30
 
/* Data about each known table type */
 
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 */
 
 
#endif /* __ACTBL_H__ */
/shark/trunk/drivers/linuxc26/include/acpi/acnamesp.h
0,0 → 1,513
/******************************************************************************
*
* Name: acnamesp.h - Namespace subcomponent prototypes and defines
*
*****************************************************************************/
 
/*
* Copyright (C) 2000 - 2003, 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.
*/
 
#ifndef __ACNAMESP_H__
#define __ACNAMESP_H__
 
 
/* To search the entire name space, pass this as search_base */
 
#define ACPI_NS_ALL ((acpi_handle)0)
 
/*
* Elements of acpi_ns_properties are bit significant
* 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 */
 
 
/* 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_NS_ROOT_PATH "\\"
#define ACPI_NS_SYSTEM_BUS "_SB_"
 
 
/* Flags for acpi_ns_lookup, acpi_ns_search_and_enter */
 
#define ACPI_NS_NO_UPSEARCH 0
#define ACPI_NS_SEARCH_PARENT 0x01
#define ACPI_NS_DONT_OPEN_SCOPE 0x02
#define ACPI_NS_NO_PEER_SEARCH 0x04
#define ACPI_NS_ERROR_IF_FOUND 0x08
 
#define ACPI_NS_WALK_UNLOCK TRUE
#define ACPI_NS_WALK_NO_UNLOCK FALSE
 
 
acpi_status
acpi_ns_load_namespace (
void);
 
acpi_status
acpi_ns_initialize_objects (
void);
 
acpi_status
acpi_ns_initialize_devices (
void);
 
 
/* Namespace init - nsxfinit */
 
acpi_status
acpi_ns_init_one_device (
acpi_handle obj_handle,
u32 nesting_level,
void *context,
void **return_value);
 
acpi_status
acpi_ns_init_one_object (
acpi_handle obj_handle,
u32 level,
void *context,
void **return_value);
 
 
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);
 
void
acpi_ns_delete_namespace_by_owner (
u16 table_id);
 
 
/* Namespace loading - nsload */
 
acpi_status
acpi_ns_one_complete_parse (
u32 pass_number,
struct acpi_table_desc *table_desc);
 
acpi_status
acpi_ns_parse_table (
struct acpi_table_desc *table_desc,
struct acpi_namespace_node *scope);
 
acpi_status
acpi_ns_load_table (
struct acpi_table_desc *table_desc,
struct acpi_namespace_node *node);
 
acpi_status
acpi_ns_load_table_by_type (
acpi_table_type table_type);
 
 
/*
* Top-level namespace access - nsaccess
*/
 
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);
 
 
/*
* Named object allocation/deallocation - nsalloc
*/
 
struct acpi_namespace_node *
acpi_ns_create_node (
u32 name);
 
void
acpi_ns_delete_node (
struct acpi_namespace_node *node);
 
void
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_children (
struct acpi_namespace_node *parent);
 
int
acpi_ns_compare_names (
char *name1,
char *name2);
 
void
acpi_ns_remove_reference (
struct acpi_namespace_node *node);
 
 
/*
* Namespace modification - nsmodify
*/
 
acpi_status
acpi_ns_unload_namespace (
acpi_handle handle);
 
acpi_status
acpi_ns_delete_subtree (
acpi_handle start_handle);
 
 
/*
* Namespace dump/print utilities - nsdump
*/
 
void
acpi_ns_dump_tables (
acpi_handle search_base,
u32 max_depth);
 
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);
 
void
acpi_ns_print_pathname (
u32 num_segments,
char *pathname);
 
acpi_status
acpi_ns_dump_one_device (
acpi_handle obj_handle,
u32 level,
void *context,
void **return_value);
 
void
acpi_ns_dump_root_devices (
void);
 
acpi_status
acpi_ns_dump_one_object (
acpi_handle obj_handle,
u32 level,
void *context,
void **return_value);
 
void
acpi_ns_dump_objects (
acpi_object_type type,
u8 display_type,
u32 max_depth,
u32 ownder_id,
acpi_handle start_handle);
 
 
/*
* Namespace evaluation functions - nseval
*/
 
acpi_status
acpi_ns_evaluate_by_handle (
struct acpi_namespace_node *prefix_node,
union acpi_operand_object **params,
union acpi_operand_object **return_object);
 
acpi_status
acpi_ns_evaluate_by_name (
char *pathname,
union acpi_operand_object **params,
union acpi_operand_object **return_object);
 
acpi_status
acpi_ns_evaluate_relative (
struct acpi_namespace_node *prefix_node,
char *pathname,
union acpi_operand_object **params,
union acpi_operand_object **return_object);
 
acpi_status
acpi_ns_execute_control_method (
struct acpi_namespace_node *method_node,
union acpi_operand_object **params,
union acpi_operand_object **return_obj_desc);
 
acpi_status
acpi_ns_get_object_value (
struct acpi_namespace_node *object_node,
union acpi_operand_object **return_obj_desc);
 
 
/*
* Parent/Child/Peer utility functions
*/
 
acpi_name
acpi_ns_find_parent_name (
struct acpi_namespace_node *node_to_search);
 
 
/*
* Name and Scope manipulation - nsnames
*/
 
u32
acpi_ns_opens_scope (
acpi_object_type type);
 
void
acpi_ns_build_external_path (
struct acpi_namespace_node *node,
acpi_size size,
char *name_buffer);
 
char *
acpi_ns_get_external_pathname (
struct acpi_namespace_node *node);
 
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);
 
u8
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);
 
 
/*
* Object management for namespace nodes - nsobject
*/
 
acpi_status
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_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_status
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);
 
 
/*
* Namespace searching and entry - nssearch
*/
 
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_status
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);
 
 
/*
* Utility functions - nsutils
*/
 
u8
acpi_ns_valid_root_prefix (
char prefix);
 
u8
acpi_ns_valid_path_separator (
char sep);
 
acpi_object_type
acpi_ns_get_type (
struct acpi_namespace_node *node);
 
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);
 
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);
 
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);
 
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_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);
 
acpi_handle
acpi_ns_convert_entry_to_handle(
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);
 
 
#endif /* __ACNAMESP_H__ */
/shark/trunk/drivers/linuxc26/include/acpi/acdispat.h
0,0 → 1,513
/******************************************************************************
*
* Name: acdispat.h - dispatcher (parser to interpreter interface)
*
*****************************************************************************/
 
/*
* Copyright (C) 2000 - 2003, 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.
*/
 
 
#ifndef _ACDISPAT_H_
#define _ACDISPAT_H_
 
 
#define NAMEOF_LOCAL_NTE "__L0"
#define NAMEOF_ARG_NTE "__A0"
 
 
/* Common interfaces */
 
acpi_status
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);
 
void *
acpi_ds_obj_stack_get_value (
u32 index,
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);
 
 
/* dsopcode - support for late evaluation */
 
acpi_status
acpi_ds_execute_arguments (
struct acpi_namespace_node *node,
struct acpi_namespace_node *scope_node,
u32 aml_length,
u8 *aml_start);
 
acpi_status
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_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_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_status
acpi_ds_eval_buffer_field_operands (
struct acpi_walk_state *walk_state,
union acpi_parse_object *op);
 
acpi_status
acpi_ds_eval_region_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_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_status
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_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);
 
 
/* dsfield - Parser/Interpreter interface for AML fields */
 
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_status
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_status
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_status
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_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_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);
 
 
/* 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_status
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);
 
u8
acpi_ds_is_method_value (
union acpi_operand_object *obj_desc);
 
acpi_object_type
acpi_ds_method_data_get_type (
u16 opcode,
u32 index,
struct acpi_walk_state *walk_state);
 
acpi_status
acpi_ds_method_data_get_value (
u16 opcode,
u32 index,
struct acpi_walk_state *walk_state,
union acpi_operand_object **dest_desc);
 
void
acpi_ds_method_data_delete_value (
u16 opcode,
u32 index,
struct acpi_walk_state *walk_state);
 
acpi_status
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_status
acpi_ds_method_data_set_value (
u16 opcode,
u32 index,
union acpi_operand_object *object,
struct acpi_walk_state *walk_state);
 
 
/* dsmethod - Parser/Interpreter interface - control method parsing */
 
acpi_status
acpi_ds_parse_method (
acpi_handle obj_handle);
 
acpi_status
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_status
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);
 
 
/* dsobj - Parser/Interpreter interface - object initialization and conversion */
 
acpi_status
acpi_ds_init_one_object (
acpi_handle obj_handle,
u32 level,
void *context,
void **return_value);
 
acpi_status
acpi_ds_initialize_objects (
struct acpi_table_desc *table_desc,
struct acpi_namespace_node *start_node);
 
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_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_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_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_status
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 */
 
u8
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_status
acpi_ds_create_operands (
struct acpi_walk_state *walk_state,
union acpi_parse_object *first_arg);
 
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_status
acpi_ds_scope_stack_pop (
struct acpi_walk_state *walk_state);
 
void
acpi_ds_scope_stack_clear (
struct acpi_walk_state *walk_state);
 
 
/* dswstate - parser WALK_STATE management routines */
 
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,
union acpi_operand_object **params,
union acpi_operand_object **return_obj_desc,
u32 pass_number);
 
acpi_status
acpi_ds_obj_stack_delete_all (
struct acpi_walk_state *walk_state);
 
acpi_status
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);
 
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_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_clear (
struct acpi_walk_state *walk_state);
 
struct acpi_walk_state *
acpi_ds_get_current_walk_state (
struct acpi_thread_state *thread);
 
void
acpi_ds_delete_walk_state_cache (
void);
 
acpi_status
acpi_ds_result_insert (
void *object,
u32 index,
struct acpi_walk_state *walk_state);
 
acpi_status
acpi_ds_result_remove (
union acpi_operand_object **object,
u32 index,
struct acpi_walk_state *walk_state);
 
acpi_status
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_status
acpi_ds_result_pop_from_bottom (
union acpi_operand_object **object,
struct acpi_walk_state *walk_state);
 
#endif /* _ACDISPAT_H_ */