Merge branch 'upstream'

This commit is contained in:
Jeff Garzik
2005-10-30 01:59:10 -05:00
1675 changed files with 92860 additions and 45843 deletions

View File

@@ -126,8 +126,8 @@ BUFFER_FNS(Eopnotsupp, eopnotsupp)
/* If we *know* page->private refers to buffer_heads */
#define page_buffers(page) \
({ \
BUG_ON(!PagePrivate(page)); \
((struct buffer_head *)(page)->private); \
BUG_ON(!PagePrivate(page)); \
((struct buffer_head *)page_private(page)); \
})
#define page_has_buffers(page) PagePrivate(page)
@@ -219,7 +219,7 @@ static inline void attach_page_buffers(struct page *page,
{
page_cache_get(page);
SetPagePrivate(page);
page->private = (unsigned long)head;
set_page_private(page, (unsigned long)head);
}
static inline void get_bh(struct buffer_head *bh)

View File

@@ -28,19 +28,6 @@
#define BUS_ID_SIZE KOBJ_NAME_LEN
enum {
SUSPEND_NOTIFY,
SUSPEND_SAVE_STATE,
SUSPEND_DISABLE,
SUSPEND_POWER_DOWN,
};
enum {
RESUME_POWER_ON,
RESUME_RESTORE_STATE,
RESUME_ENABLE,
};
struct device;
struct device_driver;
struct class;
@@ -115,8 +102,8 @@ struct device_driver {
int (*probe) (struct device * dev);
int (*remove) (struct device * dev);
void (*shutdown) (struct device * dev);
int (*suspend) (struct device * dev, pm_message_t state, u32 level);
int (*resume) (struct device * dev, u32 level);
int (*suspend) (struct device * dev, pm_message_t state);
int (*resume) (struct device * dev);
};
@@ -190,7 +177,43 @@ struct class_attribute class_attr_##_name = __ATTR(_name,_mode,_show,_store)
extern int class_create_file(struct class *, const struct class_attribute *);
extern void class_remove_file(struct class *, const struct class_attribute *);
struct class_device_attribute {
struct attribute attr;
ssize_t (*show)(struct class_device *, char * buf);
ssize_t (*store)(struct class_device *, const char * buf, size_t count);
};
#define CLASS_DEVICE_ATTR(_name,_mode,_show,_store) \
struct class_device_attribute class_device_attr_##_name = \
__ATTR(_name,_mode,_show,_store)
extern int class_device_create_file(struct class_device *,
const struct class_device_attribute *);
/**
* struct class_device - class devices
* @class: pointer to the parent class for this class device. This is required.
* @devt: for internal use by the driver core only.
* @node: for internal use by the driver core only.
* @kobj: for internal use by the driver core only.
* @devt_attr: for internal use by the driver core only.
* @dev: if set, a symlink to the struct device is created in the sysfs
* directory for this struct class device.
* @class_data: pointer to whatever you want to store here for this struct
* class_device. Use class_get_devdata() and class_set_devdata() to get and
* set this pointer.
* @parent: pointer to a struct class_device that is the parent of this struct
* class_device. If NULL, this class_device will show up at the root of the
* struct class in sysfs (which is probably what you want to have happen.)
* @release: pointer to a release function for this struct class_device. If
* set, this will be called instead of the class specific release function.
* Only use this if you want to override the default release function, like
* when you are nesting class_device structures.
* @hotplug: pointer to a hotplug function for this struct class_device. If
* set, this will be called instead of the class specific hotplug function.
* Only use this if you want to override the default hotplug function, like
* when you are nesting class_device structures.
*/
struct class_device {
struct list_head node;
@@ -198,9 +221,14 @@ struct class_device {
struct class * class; /* required */
dev_t devt; /* dev_t, creates the sysfs "dev" */
struct class_device_attribute *devt_attr;
struct class_device_attribute uevent_attr;
struct device * dev; /* not necessary, but nice to have */
void * class_data; /* class-specific data */
struct class_device *parent; /* parent of this child device, if there is one */
void (*release)(struct class_device *dev);
int (*hotplug)(struct class_device *dev, char **envp,
int num_envp, char *buffer, int buffer_size);
char class_id[BUS_ID_SIZE]; /* unique to this class */
};
@@ -228,18 +256,6 @@ extern int class_device_rename(struct class_device *, char *);
extern struct class_device * class_device_get(struct class_device *);
extern void class_device_put(struct class_device *);
struct class_device_attribute {
struct attribute attr;
ssize_t (*show)(struct class_device *, char * buf);
ssize_t (*store)(struct class_device *, const char * buf, size_t count);
};
#define CLASS_DEVICE_ATTR(_name,_mode,_show,_store) \
struct class_device_attribute class_device_attr_##_name = \
__ATTR(_name,_mode,_show,_store)
extern int class_device_create_file(struct class_device *,
const struct class_device_attribute *);
extern void class_device_remove_file(struct class_device *,
const struct class_device_attribute *);
extern int class_device_create_bin_file(struct class_device *,
@@ -251,8 +267,8 @@ struct class_interface {
struct list_head node;
struct class *class;
int (*add) (struct class_device *);
void (*remove) (struct class_device *);
int (*add) (struct class_device *, struct class_interface *);
void (*remove) (struct class_device *, struct class_interface *);
};
extern int class_interface_register(struct class_interface *);
@@ -260,12 +276,29 @@ extern void class_interface_unregister(struct class_interface *);
extern struct class *class_create(struct module *owner, char *name);
extern void class_destroy(struct class *cls);
extern struct class_device *class_device_create(struct class *cls, dev_t devt,
struct device *device, char *fmt, ...)
__attribute__((format(printf,4,5)));
extern struct class_device *class_device_create(struct class *cls,
struct class_device *parent,
dev_t devt,
struct device *device,
char *fmt, ...)
__attribute__((format(printf,5,6)));
extern void class_device_destroy(struct class *cls, dev_t devt);
/* interface for exporting device attributes */
struct device_attribute {
struct attribute attr;
ssize_t (*show)(struct device *dev, struct device_attribute *attr,
char *buf);
ssize_t (*store)(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count);
};
#define DEVICE_ATTR(_name,_mode,_show,_store) \
struct device_attribute dev_attr_##_name = __ATTR(_name,_mode,_show,_store)
extern int device_create_file(struct device *device, struct device_attribute * entry);
extern void device_remove_file(struct device * dev, struct device_attribute * attr);
struct device {
struct klist klist_children;
struct klist_node knode_parent; /* node in sibling list */
@@ -275,6 +308,7 @@ struct device {
struct kobject kobj;
char bus_id[BUS_ID_SIZE]; /* position on parent bus */
struct device_attribute uevent_attr;
struct semaphore sem; /* semaphore to synchronize calls to
* its driver.
@@ -343,23 +377,6 @@ extern int device_attach(struct device * dev);
extern void driver_attach(struct device_driver * drv);
/* driverfs interface for exporting device attributes */
struct device_attribute {
struct attribute attr;
ssize_t (*show)(struct device *dev, struct device_attribute *attr,
char *buf);
ssize_t (*store)(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count);
};
#define DEVICE_ATTR(_name,_mode,_show,_store) \
struct device_attribute dev_attr_##_name = __ATTR(_name,_mode,_show,_store)
extern int device_create_file(struct device *device, struct device_attribute * entry);
extern void device_remove_file(struct device * dev, struct device_attribute * attr);
/*
* Platform "fixup" functions - allow the platform to have their say
* about devices and actions that the general device layer doesn't

View File

@@ -104,6 +104,22 @@ static inline void random_ether_addr(u8 *addr)
addr [0] &= 0xfe; /* clear multicast bit */
addr [0] |= 0x02; /* set local assignment bit (IEEE802) */
}
/**
* compare_ether_addr - Compare two Ethernet addresses
* @addr1: Pointer to a six-byte array containing the Ethernet address
* @addr2 Pointer other six-byte array containing the Ethernet address
*
* Compare two ethernet addresses, returns 0 if equal
*/
static inline unsigned compare_ether_addr(const u8 *_a, const u8 *_b)
{
const u16 *a = (const u16 *) _a;
const u16 *b = (const u16 *) _b;
BUILD_BUG_ON(ETH_ALEN != 6);
return ((a[0] ^ b[0]) | (a[1] ^ b[1]) | (a[2] ^ b[2])) != 0;
}
#endif /* __KERNEL__ */
#endif /* _LINUX_ETHERDEVICE_H */

View File

@@ -269,6 +269,8 @@ u32 ethtool_op_get_tso(struct net_device *dev);
int ethtool_op_set_tso(struct net_device *dev, u32 data);
int ethtool_op_get_perm_addr(struct net_device *dev,
struct ethtool_perm_addr *addr, u8 *data);
u32 ethtool_op_get_ufo(struct net_device *dev);
int ethtool_op_set_ufo(struct net_device *dev, u32 data);
/**
* &ethtool_ops - Alter and report network device settings
@@ -298,6 +300,8 @@ int ethtool_op_get_perm_addr(struct net_device *dev,
* set_sg: Turn scatter-gather on or off
* get_tso: Report whether TCP segmentation offload is enabled
* set_tso: Turn TCP segmentation offload on or off
* get_ufo: Report whether UDP fragmentation offload is enabled
* set_ufo: Turn UDP fragmentation offload on or off
* self_test: Run specified self-tests
* get_strings: Return a set of strings that describe the requested objects
* phys_id: Identify the device
@@ -364,6 +368,8 @@ struct ethtool_ops {
int (*get_perm_addr)(struct net_device *, struct ethtool_perm_addr *, u8 *);
int (*begin)(struct net_device *);
void (*complete)(struct net_device *);
u32 (*get_ufo)(struct net_device *);
int (*set_ufo)(struct net_device *, u32);
};
/* CMDs currently supported */
@@ -400,6 +406,8 @@ struct ethtool_ops {
#define ETHTOOL_GTSO 0x0000001e /* Get TSO enable (ethtool_value) */
#define ETHTOOL_STSO 0x0000001f /* Set TSO enable (ethtool_value) */
#define ETHTOOL_GPERMADDR 0x00000020 /* Get permanent hardware address */
#define ETHTOOL_GUFO 0x00000021 /* Get UFO enable (ethtool_value) */
#define ETHTOOL_SUFO 0x00000022 /* Set UFO enable (ethtool_value) */
/* compatibility with older code */
#define SPARC_ETH_GSET ETHTOOL_GSET

136
include/linux/fs_enet_pd.h Normal file
View File

@@ -0,0 +1,136 @@
/*
* Platform information definitions for the
* universal Freescale Ethernet driver.
*
* Copyright (c) 2003 Intracom S.A.
* by Pantelis Antoniou <panto@intracom.gr>
*
* 2005 (c) MontaVista Software, Inc.
* Vitaly Bordug <vbordug@ru.mvista.com>
*
* This file is licensed under the terms of the GNU General Public License
* version 2. This program is licensed "as is" without any warranty of any
* kind, whether express or implied.
*/
#ifndef FS_ENET_PD_H
#define FS_ENET_PD_H
#include <linux/version.h>
#include <asm/types.h>
#define FS_ENET_NAME "fs_enet"
enum fs_id {
fsid_fec1,
fsid_fec2,
fsid_fcc1,
fsid_fcc2,
fsid_fcc3,
fsid_scc1,
fsid_scc2,
fsid_scc3,
fsid_scc4,
};
#define FS_MAX_INDEX 9
static inline int fs_get_fec_index(enum fs_id id)
{
if (id >= fsid_fec1 && id <= fsid_fec2)
return id - fsid_fec1;
return -1;
}
static inline int fs_get_fcc_index(enum fs_id id)
{
if (id >= fsid_fcc1 && id <= fsid_fcc3)
return id - fsid_fcc1;
return -1;
}
static inline int fs_get_scc_index(enum fs_id id)
{
if (id >= fsid_scc1 && id <= fsid_scc4)
return id - fsid_scc1;
return -1;
}
enum fs_mii_method {
fsmii_fixed,
fsmii_fec,
fsmii_bitbang,
};
enum fs_ioport {
fsiop_porta,
fsiop_portb,
fsiop_portc,
fsiop_portd,
fsiop_porte,
};
struct fs_mii_bus_info {
int method; /* mii method */
int id; /* the id of the mii_bus */
int disable_aneg; /* if the controller needs to negothiate speed & duplex */
int lpa; /* the default board-specific vallues will be applied otherwise */
union {
struct {
int duplex;
int speed;
} fixed;
struct {
/* nothing */
} fec;
struct {
/* nothing */
} scc;
struct {
int mdio_port; /* port & bit for MDIO */
int mdio_bit;
int mdc_port; /* port & bit for MDC */
int mdc_bit;
int delay; /* delay in us */
} bitbang;
} i;
};
struct fs_platform_info {
void(*init_ioports)(void);
/* device specific information */
int fs_no; /* controller index */
u32 cp_page; /* CPM page */
u32 cp_block; /* CPM sblock */
u32 clk_trx; /* some stuff for pins & mux configuration*/
u32 clk_route;
u32 clk_mask;
u32 mem_offset;
u32 dpram_offset;
u32 fcc_regs_c;
u32 device_flags;
int phy_addr; /* the phy address (-1 no phy) */
int phy_irq; /* the phy irq (if it exists) */
const struct fs_mii_bus_info *bus_info;
int rx_ring, tx_ring; /* number of buffers on rx */
__u8 macaddr[6]; /* mac address */
int rx_copybreak; /* limit we copy small frames */
int use_napi; /* use NAPI */
int napi_weight; /* NAPI weight */
int use_rmii; /* use RMII mode */
};
#endif

View File

@@ -132,6 +132,7 @@ struct gendisk {
struct disk_attribute {
struct attribute attr;
ssize_t (*show)(struct gendisk *, char *);
ssize_t (*store)(struct gendisk *, const char *, size_t);
};
/*

483
include/linux/hil.h Normal file
View File

@@ -0,0 +1,483 @@
#ifndef _HIL_H_
#define _HIL_H_
/*
* Hewlett Packard Human Interface Loop (HP-HIL) Protocol -- header.
*
* Copyright (c) 2001 Brian S. Julin
* 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. The name of the author may not 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").
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, 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
*
* References:
* HP-HIL Technical Reference Manual. Hewlett Packard Product No. 45918A
*
* A note of thanks to HP for providing and shipping reference materials
* free of charge to help in the development of HIL support for Linux.
*
*/
#include <asm/types.h>
/* Physical constants relevant to raw loop/device timing.
*/
#define HIL_CLOCK 8MHZ
#define HIL_EK1_CLOCK 30HZ
#define HIL_EK2_CLOCK 60HZ
#define HIL_TIMEOUT_DEV 5 /* ms */
#define HIL_TIMEOUT_DEVS 10 /* ms */
#define HIL_TIMEOUT_NORESP 10 /* ms */
#define HIL_TIMEOUT_DEVS_DATA 16 /* ms */
#define HIL_TIMEOUT_SELFTEST 200 /* ms */
/* Actual wire line coding. These will only be useful if someone is
* implementing a software MLC to run HIL devices on a non-parisc machine.
*/
#define HIL_WIRE_PACKET_LEN 15
enum hil_wire_bitpos {
HIL_WIRE_START = 0,
HIL_WIRE_ADDR2,
HIL_WIRE_ADDR1,
HIL_WIRE_ADDR0,
HIL_WIRE_COMMAND,
HIL_WIRE_DATA7,
HIL_WIRE_DATA6,
HIL_WIRE_DATA5,
HIL_WIRE_DATA4,
HIL_WIRE_DATA3,
HIL_WIRE_DATA2,
HIL_WIRE_DATA1,
HIL_WIRE_DATA0,
HIL_WIRE_PARITY,
HIL_WIRE_STOP
};
/* HP documentation uses these bit positions to refer to commands;
* we will call these "packets".
*/
enum hil_pkt_bitpos {
HIL_PKT_CMD = 0x00000800,
HIL_PKT_ADDR2 = 0x00000400,
HIL_PKT_ADDR1 = 0x00000200,
HIL_PKT_ADDR0 = 0x00000100,
HIL_PKT_ADDR_MASK = 0x00000700,
HIL_PKT_ADDR_SHIFT = 8,
HIL_PKT_DATA7 = 0x00000080,
HIL_PKT_DATA6 = 0x00000040,
HIL_PKT_DATA5 = 0x00000020,
HIL_PKT_DATA4 = 0x00000010,
HIL_PKT_DATA3 = 0x00000008,
HIL_PKT_DATA2 = 0x00000004,
HIL_PKT_DATA1 = 0x00000002,
HIL_PKT_DATA0 = 0x00000001,
HIL_PKT_DATA_MASK = 0x000000FF,
HIL_PKT_DATA_SHIFT = 0
};
/* The HIL MLC also has several error/status/control bits. We extend the
* "packet" to include these when direct access to the MLC is available,
* or emulate them in cases where they are not available.
*
* This way the device driver knows that the underlying MLC driver
* has had to deal with loop errors.
*/
enum hil_error_bitpos {
HIL_ERR_OB = 0x00000800, /* MLC is busy sending an auto-poll,
or we have filled up the output
buffer and must wait. */
HIL_ERR_INT = 0x00010000, /* A normal interrupt has occurred. */
HIL_ERR_NMI = 0x00020000, /* An NMI has occurred. */
HIL_ERR_LERR = 0x00040000, /* A poll didn't come back. */
HIL_ERR_PERR = 0x01000000, /* There was a Parity Error. */
HIL_ERR_FERR = 0x02000000, /* There was a Framing Error. */
HIL_ERR_FOF = 0x04000000 /* Input FIFO Overflowed. */
};
enum hil_control_bitpos {
HIL_CTRL_TEST = 0x00010000,
HIL_CTRL_IPF = 0x00040000,
HIL_CTRL_APE = 0x02000000
};
/* Bits 30,31 are unused, we use them to control write behavior. */
#define HIL_DO_ALTER_CTRL 0x40000000 /* Write MSW of packet to control
before writing LSW to loop */
#define HIL_CTRL_ONLY 0xc0000000 /* *Only* alter the control registers */
/* This gives us a 32-bit "packet"
*/
typedef u32 hil_packet;
/* HIL Loop commands
*/
enum hil_command {
HIL_CMD_IFC = 0x00, /* Interface Clear */
HIL_CMD_EPT = 0x01, /* Enter Pass-Thru Mode */
HIL_CMD_ELB = 0x02, /* Enter Loop-Back Mode */
HIL_CMD_IDD = 0x03, /* Identify and Describe */
HIL_CMD_DSR = 0x04, /* Device Soft Reset */
HIL_CMD_PST = 0x05, /* Perform Self Test */
HIL_CMD_RRG = 0x06, /* Read Register */
HIL_CMD_WRG = 0x07, /* Write Register */
HIL_CMD_ACF = 0x08, /* Auto Configure */
HIL_CMDID_ACF = 0x07, /* Auto Configure bits with incremented ID */
HIL_CMD_POL = 0x10, /* Poll */
HIL_CMDCT_POL = 0x0f, /* Poll command bits with item count */
HIL_CMD_RPL = 0x20, /* RePoll */
HIL_CMDCT_RPL = 0x0f, /* RePoll command bits with item count */
HIL_CMD_RNM = 0x30, /* Report Name */
HIL_CMD_RST = 0x31, /* Report Status */
HIL_CMD_EXD = 0x32, /* Extended Describe */
HIL_CMD_RSC = 0x33, /* Report Security Code */
/* 0x34 to 0x3c reserved for future use */
HIL_CMD_DKA = 0x3d, /* Disable Keyswitch Autorepeat */
HIL_CMD_EK1 = 0x3e, /* Enable Keyswitch Autorepeat 1 */
HIL_CMD_EK2 = 0x3f, /* Enable Keyswitch Autorepeat 2 */
HIL_CMD_PR1 = 0x40, /* Prompt1 */
HIL_CMD_PR2 = 0x41, /* Prompt2 */
HIL_CMD_PR3 = 0x42, /* Prompt3 */
HIL_CMD_PR4 = 0x43, /* Prompt4 */
HIL_CMD_PR5 = 0x44, /* Prompt5 */
HIL_CMD_PR6 = 0x45, /* Prompt6 */
HIL_CMD_PR7 = 0x46, /* Prompt7 */
HIL_CMD_PRM = 0x47, /* Prompt (General Purpose) */
HIL_CMD_AK1 = 0x48, /* Acknowlege1 */
HIL_CMD_AK2 = 0x49, /* Acknowlege2 */
HIL_CMD_AK3 = 0x4a, /* Acknowlege3 */
HIL_CMD_AK4 = 0x4b, /* Acknowlege4 */
HIL_CMD_AK5 = 0x4c, /* Acknowlege5 */
HIL_CMD_AK6 = 0x4d, /* Acknowlege6 */
HIL_CMD_AK7 = 0x4e, /* Acknowlege7 */
HIL_CMD_ACK = 0x4f, /* Acknowlege (General Purpose) */
/* 0x50 to 0x78 reserved for future use */
/* 0x80 to 0xEF device-specific commands */
/* 0xf0 to 0xf9 reserved for future use */
HIL_CMD_RIO = 0xfa, /* Register I/O Error */
HIL_CMD_SHR = 0xfb, /* System Hard Reset */
HIL_CMD_TER = 0xfc, /* Transmission Error */
HIL_CMD_CAE = 0xfd, /* Configuration Address Error */
HIL_CMD_DHR = 0xfe, /* Device Hard Reset */
/* 0xff is prohibited from use. */
};
/*
* Response "records" to HIL commands
*/
/* Device ID byte
*/
#define HIL_IDD_DID_TYPE_MASK 0xe0 /* Primary type bits */
#define HIL_IDD_DID_TYPE_KB_INTEGRAL 0xa0 /* Integral keyboard */
#define HIL_IDD_DID_TYPE_KB_ITF 0xc0 /* ITD keyboard */
#define HIL_IDD_DID_TYPE_KB_RSVD 0xe0 /* Reserved keyboard type */
#define HIL_IDD_DID_TYPE_KB_LANG_MASK 0x1f /* Keyboard locale bits */
#define HIL_IDD_DID_KBLANG_USE_ESD 0x00 /* Use ESD Locale instead */
#define HIL_IDD_DID_TYPE_ABS 0x80 /* Absolute Positioners */
#define HIL_IDD_DID_ABS_RSVD1_MASK 0xf8 /* Reserved */
#define HIL_IDD_DID_ABS_RSVD1 0x98
#define HIL_IDD_DID_ABS_TABLET_MASK 0xf8 /* Tablets and digitizers */
#define HIL_IDD_DID_ABS_TABLET 0x90
#define HIL_IDD_DID_ABS_TSCREEN_MASK 0xfc /* Touch screens */
#define HIL_IDD_DID_ABS_TSCREEN 0x8c
#define HIL_IDD_DID_ABS_RSVD2_MASK 0xfc /* Reserved */
#define HIL_IDD_DID_ABS_RSVD2 0x88
#define HIL_IDD_DID_ABS_RSVD3_MASK 0xfc /* Reserved */
#define HIL_IDD_DID_ABS_RSVD3 0x80
#define HIL_IDD_DID_TYPE_REL 0x60 /* Relative Positioners */
#define HIL_IDD_DID_REL_RSVD1_MASK 0xf0 /* Reserved */
#define HIL_IDD_DID_REL_RSVD1 0x70
#define HIL_IDD_DID_REL_RSVD2_MASK 0xfc /* Reserved */
#define HIL_IDD_DID_REL_RSVD2 0x6c
#define HIL_IDD_DID_REL_MOUSE_MASK 0xfc /* Mouse */
#define HIL_IDD_DID_REL_MOUSE 0x68
#define HIL_IDD_DID_REL_QUAD_MASK 0xf8 /* Other Quadrature Devices */
#define HIL_IDD_DID_REL_QUAD 0x60
#define HIL_IDD_DID_TYPE_CHAR 0x40 /* Character Entry */
#define HIL_IDD_DID_CHAR_BARCODE_MASK 0xfc /* Barcode Reader */
#define HIL_IDD_DID_CHAR_BARCODE 0x5c
#define HIL_IDD_DID_CHAR_RSVD1_MASK 0xfc /* Reserved */
#define HIL_IDD_DID_CHAR_RSVD1 0x58
#define HIL_IDD_DID_CHAR_RSVD2_MASK 0xf8 /* Reserved */
#define HIL_IDD_DID_CHAR_RSVD2 0x50
#define HIL_IDD_DID_CHAR_RSVD3_MASK 0xf0 /* Reserved */
#define HIL_IDD_DID_CHAR_RSVD3 0x40
#define HIL_IDD_DID_TYPE_OTHER 0x20 /* Miscellaneous */
#define HIL_IDD_DID_OTHER_RSVD1_MASK 0xf0 /* Reserved */
#define HIL_IDD_DID_OTHER_RSVD1 0x30
#define HIL_IDD_DID_OTHER_BARCODE_MASK 0xfc /* Tone Generator */
#define HIL_IDD_DID_OTHER_BARCODE 0x2c
#define HIL_IDD_DID_OTHER_RSVD2_MASK 0xfc /* Reserved */
#define HIL_IDD_DID_OTHER_RSVD2 0x28
#define HIL_IDD_DID_OTHER_RSVD3_MASK 0xf8 /* Reserved */
#define HIL_IDD_DID_OTHER_RSVD3 0x20
#define HIL_IDD_DID_TYPE_KEYPAD 0x00 /* Vectra Keyboard */
/* IDD record header
*/
#define HIL_IDD_HEADER_AXSET_MASK 0x03 /* Number of axis in a set */
#define HIL_IDD_HEADER_RSC 0x04 /* Supports RSC command */
#define HIL_IDD_HEADER_EXD 0x08 /* Supports EXD command */
#define HIL_IDD_HEADER_IOD 0x10 /* IOD byte to follow */
#define HIL_IDD_HEADER_16BIT 0x20 /* 16 (vs. 8) bit resolution */
#define HIL_IDD_HEADER_ABS 0x40 /* Reports Absolute Position */
#define HIL_IDD_HEADER_2X_AXIS 0x80 /* Two sets of 1-3 axis */
/* I/O Descriptor
*/
#define HIL_IDD_IOD_NBUTTON_MASK 0x07 /* Number of buttons */
#define HIL_IDD_IOD_PROXIMITY 0x08 /* Proximity in/out events */
#define HIL_IDD_IOD_PROMPT_MASK 0x70 /* Number of prompts/acks */
#define HIL_IDD_IOD_PROMPT_SHIFT 4
#define HIL_IDD_IOD_PROMPT 0x80 /* Generic prompt/ack */
#define HIL_IDD_NUM_AXES_PER_SET(header_packet) \
((header_packet) & HIL_IDD_HEADER_AXSET_MASK)
#define HIL_IDD_NUM_AXSETS(header_packet) \
(2 - !((header_packet) & HIL_IDD_HEADER_2X_AXIS))
#define HIL_IDD_LEN(header_packet) \
((4 - !(header_packet & HIL_IDD_HEADER_IOD) - \
2 * !(HIL_IDD_NUM_AXES_PER_SET(header_packet))) + \
2 * HIL_IDD_NUM_AXES_PER_SET(header_packet) * \
!!((header_packet) & HIL_IDD_HEADER_ABS))
/* The following HIL_IDD_* macros assume you have an array of
* packets and/or unpacked 8-bit data in the order that they
* were received.
*/
#define HIL_IDD_AXIS_COUNTS_PER_M(header_ptr) \
(!(HIL_IDD_NUM_AXSETS(*(header_ptr))) ? -1 : \
(((*(header_ptr + 1) & HIL_PKT_DATA_MASK) + \
((*(header_ptr + 2) & HIL_PKT_DATA_MASK)) << 8) \
* ((*(header_ptr) & HIL_IDD_HEADER_16BIT) ? 100 : 1)))
#define HIL_IDD_AXIS_MAX(header_ptr, __axnum) \
((!(*(header_ptr) & HIL_IDD_HEADER_ABS) || \
(HIL_IDD_NUM_AXES_PER_SET(*(header_ptr)) <= __axnum)) ? 0 : \
((HIL_PKT_DATA_MASK & *((header_ptr) + 3 + 2 * __axnum)) + \
((HIL_PKT_DATA_MASK & *((header_ptr) + 4 + 2 * __axnum)) << 8)))
#define HIL_IDD_IOD(header_ptr) \
(*(header_ptr + HIL_IDD_LEN((*header_ptr)) - 1))
#define HIL_IDD_HAS_GEN_PROMPT(header_ptr) \
((*header_ptr & HIL_IDD_HEADER_IOD) && \
(HIL_IDD_IOD(header_ptr) & HIL_IDD_IOD_PROMPT))
#define HIL_IDD_HAS_GEN_PROXIMITY(header_ptr) \
((*header_ptr & HIL_IDD_HEADER_IOD) && \
(HIL_IDD_IOD(header_ptr) & HIL_IDD_IOD_PROXIMITY))
#define HIL_IDD_NUM_BUTTONS(header_ptr) \
((*header_ptr & HIL_IDD_HEADER_IOD) ? \
(HIL_IDD_IOD(header_ptr) & HIL_IDD_IOD_NBUTTON_MASK) : 0)
#define HIL_IDD_NUM_PROMPTS(header_ptr) \
((*header_ptr & HIL_IDD_HEADER_IOD) ? \
((HIL_IDD_IOD(header_ptr) & HIL_IDD_IOD_NPROMPT_MASK) \
>> HIL_IDD_IOD_PROMPT_SHIFT) : 0)
/* The response to HIL EXD commands -- the "extended describe record" */
#define HIL_EXD_HEADER_WRG 0x03 /* Supports type2 WRG */
#define HIL_EXD_HEADER_WRG_TYPE1 0x01 /* Supports type1 WRG */
#define HIL_EXD_HEADER_WRG_TYPE2 0x02 /* Supports type2 WRG */
#define HIL_EXD_HEADER_RRG 0x04 /* Supports RRG command */
#define HIL_EXD_HEADER_RNM 0x10 /* Supports RNM command */
#define HIL_EXD_HEADER_RST 0x20 /* Supports RST command */
#define HIL_EXD_HEADER_LOCALE 0x40 /* Contains locale code */
#define HIL_EXD_NUM_RRG(header_ptr) \
((*header_ptr & HIL_EXD_HEADER_RRG) ? \
(*(header_ptr + 1) & HIL_PKT_DATA_MASK) : 0)
#define HIL_EXD_NUM_WWG(header_ptr) \
((*header_ptr & HIL_EXD_HEADER_WRG) ? \
(*(header_ptr + 2 - !(*header_ptr & HIL_EXD_HEADER_RRG)) & \
HIL_PKT_DATA_MASK) : 0)
#define HIL_EXD_LEN(header_ptr) \
(!!(*header_ptr & HIL_EXD_HEADER_RRG) + \
!!(*header_ptr & HIL_EXD_HEADER_WRG) + \
!!(*header_ptr & HIL_EXD_HEADER_LOCALE) + \
2 * !!(*header_ptr & HIL_EXD_HEADER_WRG_TYPE2) + 1)
#define HIL_EXD_LOCALE(header_ptr) \
(!(*header_ptr & HIL_EXD_HEADER_LOCALE) ? -1 : \
(*(header_ptr + HIL_EXD_LEN(header_ptr) - 1) & HIL_PKT_DATA_MASK))
#define HIL_EXD_WRG_TYPE2_LEN(header_ptr) \
(!(*header_ptr & HIL_EXD_HEADER_WRG_TYPE2) ? -1 : \
(*(header_ptr + HIL_EXD_LEN(header_ptr) - 2 - \
!!(*header_ptr & HIL_EXD_HEADER_LOCALE)) & HIL_PKT_DATA_MASK) + \
((*(header_ptr + HIL_EXD_LEN(header_ptr) - 1 - \
!!(*header_ptr & HIL_EXD_HEADER_LOCALE)) & HIL_PKT_DATA_MASK) << 8))
/* Device locale codes. */
/* Last defined locale code. Everything above this is "Reserved",
and note that this same table applies to the Device ID Byte where
keyboards may have a nationality code which is only 5 bits. */
#define HIL_LOCALE_MAX 0x1f
/* Map to hopefully useful strings. I was trying to make these look
like locale.aliases strings do; maybe that isn't the right table to
emulate. In either case, I didn't have much to work on. */
#define HIL_LOCALE_MAP \
"", /* 0x00 Reserved */ \
"", /* 0x01 Reserved */ \
"", /* 0x02 Reserved */ \
"swiss.french", /* 0x03 Swiss/French */ \
"portuguese", /* 0x04 Portuguese */ \
"arabic", /* 0x05 Arabic */ \
"hebrew", /* 0x06 Hebrew */ \
"english.canadian", /* 0x07 Canadian English */ \
"turkish", /* 0x08 Turkish */ \
"greek", /* 0x09 Greek */ \
"thai", /* 0x0a Thai (Thailand) */ \
"italian", /* 0x0b Italian */ \
"korean", /* 0x0c Hangul (Korea) */ \
"dutch", /* 0x0d Dutch */ \
"swedish", /* 0x0e Swedish */ \
"german", /* 0x0f German */ \
"chinese", /* 0x10 Chinese-PRC */ \
"chinese", /* 0x11 Chinese-ROC */ \
"swiss.french", /* 0x12 Swiss/French II */ \
"spanish", /* 0x13 Spanish */ \
"swiss.german", /* 0x14 Swiss/German II */ \
"flemish", /* 0x15 Belgian (Flemish) */ \
"finnish", /* 0x16 Finnish */ \
"english.uk", /* 0x17 United Kingdom */ \
"french.canadian", /* 0x18 French/Canadian */ \
"swiss.german", /* 0x19 Swiss/German */ \
"norwegian", /* 0x1a Norwegian */ \
"french", /* 0x1b French */ \
"danish", /* 0x1c Danish */ \
"japanese", /* 0x1d Katakana */ \
"spanish", /* 0x1e Latin American/Spanish*/\
"english.us" /* 0x1f United States */ \
/* HIL keycodes */
#define HIL_KEYCODES_SET1_TBLSIZE 128
#define HIL_KEYCODES_SET1 \
KEY_5, KEY_RESERVED, KEY_RIGHTALT, KEY_LEFTALT, \
KEY_RIGHTSHIFT, KEY_LEFTSHIFT, KEY_LEFTCTRL, KEY_SYSRQ, \
KEY_KP4, KEY_KP8, KEY_KP5, KEY_KP9, \
KEY_KP6, KEY_KP7, KEY_KPCOMMA, KEY_KPENTER, \
KEY_KP1, KEY_KPSLASH, KEY_KP2, KEY_KPPLUS, \
KEY_KP3, KEY_KPASTERISK, KEY_KP0, KEY_KPMINUS, \
KEY_B, KEY_V, KEY_C, KEY_X, \
KEY_Z, KEY_RESERVED, KEY_RESERVED, KEY_ESC, \
KEY_6, KEY_F10, KEY_3, KEY_F11, \
KEY_KPDOT, KEY_F9, KEY_TAB /*KP*/, KEY_F12, \
KEY_H, KEY_G, KEY_F, KEY_D, \
KEY_S, KEY_A, KEY_RESERVED, KEY_CAPSLOCK, \
KEY_U, KEY_Y, KEY_T, KEY_R, \
KEY_E, KEY_W, KEY_Q, KEY_TAB, \
KEY_7, KEY_6, KEY_5, KEY_4, \
KEY_3, KEY_2, KEY_1, KEY_GRAVE, \
KEY_F13, KEY_F14, KEY_F15, KEY_F16, \
KEY_F17, KEY_F18, KEY_F19, KEY_F20, \
KEY_MENU, KEY_F4, KEY_F3, KEY_F2, \
KEY_F1, KEY_VOLUMEUP, KEY_STOP, KEY_SENDFILE, \
KEY_SYSRQ, KEY_F5, KEY_F6, KEY_F7, \
KEY_F8, KEY_VOLUMEDOWN, KEY_DEL_EOL, KEY_DEL_EOS, \
KEY_8, KEY_9, KEY_0, KEY_MINUS, \
KEY_EQUAL, KEY_BACKSPACE, KEY_INS_LINE, KEY_DEL_LINE, \
KEY_I, KEY_O, KEY_P, KEY_LEFTBRACE, \
KEY_RIGHTBRACE, KEY_BACKSLASH, KEY_INSERT, KEY_DELETE, \
KEY_J, KEY_K, KEY_L, KEY_SEMICOLON, \
KEY_APOSTROPHE, KEY_ENTER, KEY_HOME, KEY_PAGEUP, \
KEY_M, KEY_COMMA, KEY_DOT, KEY_SLASH, \
KEY_BACKSLASH, KEY_SELECT, KEY_102ND, KEY_PAGEDOWN, \
KEY_N, KEY_SPACE, KEY_NEXT, KEY_RESERVED, \
KEY_LEFT, KEY_DOWN, KEY_UP, KEY_RIGHT
#define HIL_KEYCODES_SET3_TBLSIZE 128
#define HIL_KEYCODES_SET3 \
KEY_RESERVED, KEY_ESC, KEY_1, KEY_2, \
KEY_3, KEY_4, KEY_5, KEY_6, \
KEY_7, KEY_8, KEY_9, KEY_0, \
KEY_MINUS, KEY_EQUAL, KEY_BACKSPACE, KEY_TAB, \
KEY_Q, KEY_W, KEY_E, KEY_R, \
KEY_T, KEY_Y, KEY_U, KEY_I, \
KEY_O, KEY_P, KEY_LEFTBRACE, KEY_RIGHTBRACE, \
KEY_ENTER, KEY_LEFTCTRL, KEY_A, KEY_S, \
KEY_D, KEY_F, KEY_G, KEY_H, \
KEY_J, KEY_K, KEY_L, KEY_SEMICOLON, \
KEY_APOSTROPHE,KEY_GRAVE, KEY_LEFTSHIFT, KEY_BACKSLASH, \
KEY_Z, KEY_X, KEY_C, KEY_V, \
KEY_B, KEY_N, KEY_M, KEY_COMMA, \
KEY_DOT, KEY_SLASH, KEY_RIGHTSHIFT, KEY_KPASTERISK, \
KEY_LEFTALT, KEY_SPACE, KEY_CAPSLOCK, KEY_F1, \
KEY_F2, KEY_F3, KEY_F4, KEY_F5, \
KEY_F6, KEY_F7, KEY_F8, KEY_F9, \
KEY_F10, KEY_NUMLOCK, KEY_SCROLLLOCK, KEY_KP7, \
KEY_KP8, KEY_KP9, KEY_KPMINUS, KEY_KP4, \
KEY_KP5, KEY_KP6, KEY_KPPLUS, KEY_KP1, \
KEY_KP2, KEY_KP3, KEY_KP0, KEY_KPDOT, \
KEY_SYSRQ, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, \
KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, \
KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, \
KEY_UP, KEY_LEFT, KEY_DOWN, KEY_RIGHT, \
KEY_HOME, KEY_PAGEUP, KEY_END, KEY_PAGEDOWN, \
KEY_INSERT, KEY_DELETE, KEY_102ND, KEY_RESERVED, \
KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, \
KEY_F1, KEY_F2, KEY_F3, KEY_F4, \
KEY_F5, KEY_F6, KEY_F7, KEY_F8, \
KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, \
KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED
/* Response to POL command, the "poll record header" */
#define HIL_POL_NUM_AXES_MASK 0x03 /* Number of axis reported */
#define HIL_POL_CTS 0x04 /* Device ready to receive data */
#define HIL_POL_STATUS_PENDING 0x08 /* Device has status to report */
#define HIL_POL_CHARTYPE_MASK 0x70 /* Type of character data to follow */
#define HIL_POL_CHARTYPE_NONE 0x00 /* No character data to follow */
#define HIL_POL_CHARTYPE_RSVD1 0x10 /* Reserved Set 1 */
#define HIL_POL_CHARTYPE_ASCII 0x20 /* U.S. ASCII */
#define HIL_POL_CHARTYPE_BINARY 0x30 /* Binary data */
#define HIL_POL_CHARTYPE_SET1 0x40 /* Keycode Set 1 */
#define HIL_POL_CHARTYPE_RSVD2 0x50 /* Reserved Set 2 */
#define HIL_POL_CHARTYPE_SET2 0x60 /* Keycode Set 2 */
#define HIL_POL_CHARTYPE_SET3 0x70 /* Keycode Set 3 */
#define HIL_POL_AXIS_ALT 0x80 /* Data is from axis set 2 */
#endif /* _HIL_H_ */

168
include/linux/hil_mlc.h Normal file
View File

@@ -0,0 +1,168 @@
/*
* HP Human Interface Loop Master Link Controller driver.
*
* Copyright (c) 2001 Brian S. Julin
* 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. The name of the author may not 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").
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, 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
*
* References:
* HP-HIL Technical Reference Manual. Hewlett Packard Product No. 45918A
*
*/
#include <linux/hil.h>
#include <linux/time.h>
#include <linux/interrupt.h>
#include <asm/semaphore.h>
#include <linux/serio.h>
#include <linux/list.h>
typedef struct hil_mlc hil_mlc;
/* The HIL has a complicated state engine.
* We define the structure of nodes in the state engine here.
*/
enum hilse_act {
/* HILSE_OUT prepares to receive input if the next node
* is an IN or EXPECT, and then sends the given packet.
*/
HILSE_OUT = 0,
/* HILSE_CTS checks if the loop is busy. */
HILSE_CTS,
/* HILSE_OUT_LAST sends the given command packet to
* the last configured/running device on the loop.
*/
HILSE_OUT_LAST,
/* HILSE_OUT_DISC sends the given command packet to
* the next device past the last configured/running one.
*/
HILSE_OUT_DISC,
/* HILSE_FUNC runs a callback function with given arguments.
* a positive return value causes the "ugly" branch to be taken.
*/
HILSE_FUNC,
/* HILSE_IN simply expects any non-errored packet to arrive
* within arg usecs.
*/
HILSE_IN = 0x100,
/* HILSE_EXPECT expects a particular packet to arrive
* within arg usecs, any other packet is considered an error.
*/
HILSE_EXPECT,
/* HILSE_EXPECT_LAST as above but dev field should be last
* discovered/operational device.
*/
HILSE_EXPECT_LAST,
/* HILSE_EXPECT_LAST as above but dev field should be first
* undiscovered/inoperational device.
*/
HILSE_EXPECT_DISC
};
typedef int (hilse_func) (hil_mlc *mlc, int arg);
struct hilse_node {
enum hilse_act act; /* How to process this node */
union {
hilse_func *func; /* Function to call if HILSE_FUNC */
hil_packet packet; /* Packet to send or to compare */
} object;
int arg; /* Timeout in usec or parm for func */
int good; /* Node to jump to on success */
int bad; /* Node to jump to on error */
int ugly; /* Node to jump to on timeout */
};
/* Methods for back-end drivers, e.g. hp_sdc_mlc */
typedef int (hil_mlc_cts) (hil_mlc *mlc);
typedef void (hil_mlc_out) (hil_mlc *mlc);
typedef int (hil_mlc_in) (hil_mlc *mlc, suseconds_t timeout);
struct hil_mlc_devinfo {
uint8_t idd[16]; /* Device ID Byte and Describe Record */
uint8_t rsc[16]; /* Security Code Header and Record */
uint8_t exd[16]; /* Extended Describe Record */
uint8_t rnm[16]; /* Device name as returned by RNM command */
};
struct hil_mlc_serio_map {
hil_mlc *mlc;
int di_revmap;
int didx;
};
/* How many (possibly old/detached) devices the we try to keep track of */
#define HIL_MLC_DEVMEM 16
struct hil_mlc {
struct list_head list; /* hil_mlc is organized as linked list */
rwlock_t lock;
void *priv; /* Data specific to a particular type of MLC */
int seidx; /* Current node in state engine */
int istarted, ostarted;
hil_mlc_cts *cts;
struct semaphore csem; /* Raised when loop idle */
hil_mlc_out *out;
struct semaphore osem; /* Raised when outpacket dispatched */
hil_packet opacket;
hil_mlc_in *in;
struct semaphore isem; /* Raised when a packet arrives */
hil_packet ipacket[16];
hil_packet imatch;
int icount;
struct timeval instart;
suseconds_t intimeout;
int ddi; /* Last operational device id */
int lcv; /* LCV to throttle loops */
struct timeval lcv_tv; /* Time loop was started */
int di_map[7]; /* Maps below items to live devs */
struct hil_mlc_devinfo di[HIL_MLC_DEVMEM];
struct serio *serio[HIL_MLC_DEVMEM];
struct hil_mlc_serio_map serio_map[HIL_MLC_DEVMEM];
hil_packet serio_opacket[HIL_MLC_DEVMEM];
int serio_oidx[HIL_MLC_DEVMEM];
struct hil_mlc_devinfo di_scratch; /* Temporary area */
int opercnt;
struct tasklet_struct *tasklet;
};
int hil_mlc_register(hil_mlc *mlc);
int hil_mlc_unregister(hil_mlc *mlc);

300
include/linux/hp_sdc.h Normal file
View File

@@ -0,0 +1,300 @@
/*
* HP i8042 System Device Controller -- header
*
* Copyright (c) 2001 Brian S. Julin
* 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. The name of the author may not 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").
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, 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
*
* References:
*
* HP-HIL Technical Reference Manual. Hewlett Packard Product No. 45918A
*
* System Device Controller Microprocessor Firmware Theory of Operation
* for Part Number 1820-4784 Revision B. Dwg No. A-1820-4784-2
*
*/
#ifndef _LINUX_HP_SDC_H
#define _LINUX_HP_SDC_H
#include <linux/interrupt.h>
#include <linux/types.h>
#include <linux/time.h>
#include <linux/timer.h>
#if defined(__hppa__)
#include <asm/hardware.h>
#endif
/* No 4X status reads take longer than this (in usec).
*/
#define HP_SDC_MAX_REG_DELAY 20000
typedef void (hp_sdc_irqhook) (int irq, void *dev_id,
uint8_t status, uint8_t data);
int hp_sdc_request_timer_irq(hp_sdc_irqhook *callback);
int hp_sdc_request_hil_irq(hp_sdc_irqhook *callback);
int hp_sdc_request_cooked_irq(hp_sdc_irqhook *callback);
int hp_sdc_release_timer_irq(hp_sdc_irqhook *callback);
int hp_sdc_release_hil_irq(hp_sdc_irqhook *callback);
int hp_sdc_release_cooked_irq(hp_sdc_irqhook *callback);
typedef struct {
int actidx; /* Start of act. Acts are atomic WRT I/O to SDC */
int idx; /* Index within the act */
int endidx; /* transaction is over and done if idx == endidx */
uint8_t *seq; /* commands/data for the transaction */
union {
hp_sdc_irqhook *irqhook; /* Callback, isr or tasklet context */
struct semaphore *semaphore; /* Semaphore to sleep on. */
} act;
} hp_sdc_transaction;
int hp_sdc_enqueue_transaction(hp_sdc_transaction *this);
int hp_sdc_dequeue_transaction(hp_sdc_transaction *this);
/* The HP_SDC_ACT* values are peculiar to this driver.
* Nuance: never HP_SDC_ACT_DATAIN | HP_SDC_ACT_DEALLOC, use another
* act to perform the dealloc.
*/
#define HP_SDC_ACT_PRECMD 0x01 /* Send a command first */
#define HP_SDC_ACT_DATAREG 0x02 /* Set data registers */
#define HP_SDC_ACT_DATAOUT 0x04 /* Send data bytes */
#define HP_SDC_ACT_POSTCMD 0x08 /* Send command after */
#define HP_SDC_ACT_DATAIN 0x10 /* Collect data after */
#define HP_SDC_ACT_DURING 0x1f
#define HP_SDC_ACT_SEMAPHORE 0x20 /* Raise semaphore after */
#define HP_SDC_ACT_CALLBACK 0x40 /* Pass data to IRQ handler */
#define HP_SDC_ACT_DEALLOC 0x80 /* Destroy transaction after */
#define HP_SDC_ACT_AFTER 0xe0
#define HP_SDC_ACT_DEAD 0x60 /* Act timed out. */
/* Rest of the flags are straightforward representation of the SDC interface */
#define HP_SDC_STATUS_IBF 0x02 /* Input buffer full */
#define HP_SDC_STATUS_IRQMASK 0xf0 /* Bits containing "level 1" irq */
#define HP_SDC_STATUS_PERIODIC 0x10 /* Periodic 10ms timer */
#define HP_SDC_STATUS_USERTIMER 0x20 /* "Special purpose" timer */
#define HP_SDC_STATUS_TIMER 0x30 /* Both PERIODIC and USERTIMER */
#define HP_SDC_STATUS_REG 0x40 /* Data from an i8042 register */
#define HP_SDC_STATUS_HILCMD 0x50 /* Command from HIL MLC */
#define HP_SDC_STATUS_HILDATA 0x60 /* Data from HIL MLC */
#define HP_SDC_STATUS_PUP 0x70 /* Sucessful power-up self test */
#define HP_SDC_STATUS_KCOOKED 0x80 /* Key from cooked kbd */
#define HP_SDC_STATUS_KRPG 0xc0 /* Key from Repeat Gen */
#define HP_SDC_STATUS_KMOD_SUP 0x10 /* Shift key is up */
#define HP_SDC_STATUS_KMOD_CUP 0x20 /* Control key is up */
#define HP_SDC_NMISTATUS_FHS 0x40 /* NMI is a fast handshake irq */
/* Internal i8042 registers (there are more, but they are not too useful). */
#define HP_SDC_USE 0x02 /* Resource usage (including OB bit) */
#define HP_SDC_IM 0x04 /* Interrupt mask */
#define HP_SDC_CFG 0x11 /* Configuration register */
#define HP_SDC_KBLANGUAGE 0x12 /* Keyboard language */
#define HP_SDC_D0 0x70 /* General purpose data buffer 0 */
#define HP_SDC_D1 0x71 /* General purpose data buffer 1 */
#define HP_SDC_D2 0x72 /* General purpose data buffer 2 */
#define HP_SDC_D3 0x73 /* General purpose data buffer 3 */
#define HP_SDC_VT1 0x74 /* Timer for voice 1 */
#define HP_SDC_VT2 0x75 /* Timer for voice 2 */
#define HP_SDC_VT3 0x76 /* Timer for voice 3 */
#define HP_SDC_VT4 0x77 /* Timer for voice 4 */
#define HP_SDC_KBN 0x78 /* Which HIL devs are Nimitz */
#define HP_SDC_KBC 0x79 /* Which HIL devs are cooked kbds */
#define HP_SDC_LPS 0x7a /* i8042's view of HIL status */
#define HP_SDC_LPC 0x7b /* i8042's view of HIL "control" */
#define HP_SDC_RSV 0x7c /* Reserved "for testing" */
#define HP_SDC_LPR 0x7d /* i8042 count of HIL reconfigs */
#define HP_SDC_XTD 0x7e /* "Extended Configuration" register */
#define HP_SDC_STR 0x7f /* i8042 self-test result */
/* Bitfields for above registers */
#define HP_SDC_USE_LOOP 0x04 /* Command is currently on the loop. */
#define HP_SDC_IM_MASK 0x1f /* these bits not part of cmd/status */
#define HP_SDC_IM_FH 0x10 /* Mask the fast handshake irq */
#define HP_SDC_IM_PT 0x08 /* Mask the periodic timer irq */
#define HP_SDC_IM_TIMERS 0x04 /* Mask the MT/DT/CT irq */
#define HP_SDC_IM_RESET 0x02 /* Mask the reset key irq */
#define HP_SDC_IM_HIL 0x01 /* Mask the HIL MLC irq */
#define HP_SDC_CFG_ROLLOVER 0x08 /* WTF is "N-key rollover"? */
#define HP_SDC_CFG_KBD 0x10 /* There is a keyboard */
#define HP_SDC_CFG_NEW 0x20 /* Supports/uses HIL MLC */
#define HP_SDC_CFG_KBD_OLD 0x03 /* keyboard code for non-HIL */
#define HP_SDC_CFG_KBD_NEW 0x07 /* keyboard code from HIL autoconfig */
#define HP_SDC_CFG_REV 0x40 /* Code revision bit */
#define HP_SDC_CFG_IDPROM 0x80 /* IDPROM present in kbd (not HIL) */
#define HP_SDC_LPS_NDEV 0x07 /* # devices autoconfigured on HIL */
#define HP_SDC_LPS_ACSUCC 0x08 /* loop autoconfigured successfully */
#define HP_SDC_LPS_ACFAIL 0x80 /* last loop autoconfigure failed */
#define HP_SDC_LPC_APE_IPF 0x01 /* HIL MLC APE/IPF (autopoll) set */
#define HP_SDC_LPC_ARCONERR 0x02 /* i8042 autoreconfigs loop on err */
#define HP_SDC_LPC_ARCQUIET 0x03 /* i8042 doesn't report autoreconfigs*/
#define HP_SDC_LPC_COOK 0x10 /* i8042 cooks devices in _KBN */
#define HP_SDC_LPC_RC 0x80 /* causes autoreconfig */
#define HP_SDC_XTD_REV 0x07 /* contains revision code */
#define HP_SDC_XTD_REV_STRINGS(val, str) \
switch (val) { \
case 0x1: str = "1820-3712"; break; \
case 0x2: str = "1820-4379"; break; \
case 0x3: str = "1820-4784"; break; \
default: str = "unknown"; \
};
#define HP_SDC_XTD_BEEPER 0x08 /* TI SN76494 beeper available */
#define HP_SDC_XTD_BBRTC 0x20 /* OKI MSM-58321 BBRTC present */
#define HP_SDC_CMD_LOAD_RT 0x31 /* Load real time (from 8042) */
#define HP_SDC_CMD_LOAD_FHS 0x36 /* Load the fast handshake timer */
#define HP_SDC_CMD_LOAD_MT 0x38 /* Load the match timer */
#define HP_SDC_CMD_LOAD_DT 0x3B /* Load the delay timer */
#define HP_SDC_CMD_LOAD_CT 0x3E /* Load the cycle timer */
#define HP_SDC_CMD_SET_IM 0x40 /* 010xxxxx == set irq mask */
/* The documents provided do not explicitly state that all registers betweem
* 0x01 and 0x1f inclusive can be read by sending their register index as a
* command, but this is implied and appears to be the case.
*/
#define HP_SDC_CMD_READ_RAM 0x00 /* Load from i8042 RAM (autoinc) */
#define HP_SDC_CMD_READ_USE 0x02 /* Undocumented! Load from usage reg */
#define HP_SDC_CMD_READ_IM 0x04 /* Load current interrupt mask */
#define HP_SDC_CMD_READ_KCC 0x11 /* Load primary kbd config code */
#define HP_SDC_CMD_READ_KLC 0x12 /* Load primary kbd language code */
#define HP_SDC_CMD_READ_T1 0x13 /* Load timer output buffer byte 1 */
#define HP_SDC_CMD_READ_T2 0x14 /* Load timer output buffer byte 1 */
#define HP_SDC_CMD_READ_T3 0x15 /* Load timer output buffer byte 1 */
#define HP_SDC_CMD_READ_T4 0x16 /* Load timer output buffer byte 1 */
#define HP_SDC_CMD_READ_T5 0x17 /* Load timer output buffer byte 1 */
#define HP_SDC_CMD_READ_D0 0xf0 /* Load from i8042 RAM location 0x70 */
#define HP_SDC_CMD_READ_D1 0xf1 /* Load from i8042 RAM location 0x71 */
#define HP_SDC_CMD_READ_D2 0xf2 /* Load from i8042 RAM location 0x72 */
#define HP_SDC_CMD_READ_D3 0xf3 /* Load from i8042 RAM location 0x73 */
#define HP_SDC_CMD_READ_VT1 0xf4 /* Load from i8042 RAM location 0x74 */
#define HP_SDC_CMD_READ_VT2 0xf5 /* Load from i8042 RAM location 0x75 */
#define HP_SDC_CMD_READ_VT3 0xf6 /* Load from i8042 RAM location 0x76 */
#define HP_SDC_CMD_READ_VT4 0xf7 /* Load from i8042 RAM location 0x77 */
#define HP_SDC_CMD_READ_KBN 0xf8 /* Load from i8042 RAM location 0x78 */
#define HP_SDC_CMD_READ_KBC 0xf9 /* Load from i8042 RAM location 0x79 */
#define HP_SDC_CMD_READ_LPS 0xfa /* Load from i8042 RAM location 0x7a */
#define HP_SDC_CMD_READ_LPC 0xfb /* Load from i8042 RAM location 0x7b */
#define HP_SDC_CMD_READ_RSV 0xfc /* Load from i8042 RAM location 0x7c */
#define HP_SDC_CMD_READ_LPR 0xfd /* Load from i8042 RAM location 0x7d */
#define HP_SDC_CMD_READ_XTD 0xfe /* Load from i8042 RAM location 0x7e */
#define HP_SDC_CMD_READ_STR 0xff /* Load from i8042 RAM location 0x7f */
#define HP_SDC_CMD_SET_ARD 0xA0 /* Set emulated autorepeat delay */
#define HP_SDC_CMD_SET_ARR 0xA2 /* Set emulated autorepeat rate */
#define HP_SDC_CMD_SET_BELL 0xA3 /* Set voice 3 params for "beep" cmd */
#define HP_SDC_CMD_SET_RPGR 0xA6 /* Set "RPG" irq rate (doesn't work) */
#define HP_SDC_CMD_SET_RTMS 0xAD /* Set the RTC time (milliseconds) */
#define HP_SDC_CMD_SET_RTD 0xAF /* Set the RTC time (days) */
#define HP_SDC_CMD_SET_FHS 0xB2 /* Set fast handshake timer */
#define HP_SDC_CMD_SET_MT 0xB4 /* Set match timer */
#define HP_SDC_CMD_SET_DT 0xB7 /* Set delay timer */
#define HP_SDC_CMD_SET_CT 0xBA /* Set cycle timer */
#define HP_SDC_CMD_SET_RAMP 0xC1 /* Reset READ_RAM autoinc counter */
#define HP_SDC_CMD_SET_D0 0xe0 /* Load to i8042 RAM location 0x70 */
#define HP_SDC_CMD_SET_D1 0xe1 /* Load to i8042 RAM location 0x71 */
#define HP_SDC_CMD_SET_D2 0xe2 /* Load to i8042 RAM location 0x72 */
#define HP_SDC_CMD_SET_D3 0xe3 /* Load to i8042 RAM location 0x73 */
#define HP_SDC_CMD_SET_VT1 0xe4 /* Load to i8042 RAM location 0x74 */
#define HP_SDC_CMD_SET_VT2 0xe5 /* Load to i8042 RAM location 0x75 */
#define HP_SDC_CMD_SET_VT3 0xe6 /* Load to i8042 RAM location 0x76 */
#define HP_SDC_CMD_SET_VT4 0xe7 /* Load to i8042 RAM location 0x77 */
#define HP_SDC_CMD_SET_KBN 0xe8 /* Load to i8042 RAM location 0x78 */
#define HP_SDC_CMD_SET_KBC 0xe9 /* Load to i8042 RAM location 0x79 */
#define HP_SDC_CMD_SET_LPS 0xea /* Load to i8042 RAM location 0x7a */
#define HP_SDC_CMD_SET_LPC 0xeb /* Load to i8042 RAM location 0x7b */
#define HP_SDC_CMD_SET_RSV 0xec /* Load to i8042 RAM location 0x7c */
#define HP_SDC_CMD_SET_LPR 0xed /* Load to i8042 RAM location 0x7d */
#define HP_SDC_CMD_SET_XTD 0xee /* Load to i8042 RAM location 0x7e */
#define HP_SDC_CMD_SET_STR 0xef /* Load to i8042 RAM location 0x7f */
#define HP_SDC_CMD_DO_RTCW 0xc2 /* i8042 RAM 0x70 --> RTC */
#define HP_SDC_CMD_DO_RTCR 0xc3 /* RTC[0x70 0:3] --> irq/status/data */
#define HP_SDC_CMD_DO_BEEP 0xc4 /* i8042 RAM 0x70-74 --> beeper,VT3 */
#define HP_SDC_CMD_DO_HIL 0xc5 /* i8042 RAM 0x70-73 -->
HIL MLC R0,R1 i8042 HIL watchdog */
/* Values used to (de)mangle input/output to/from the HIL MLC */
#define HP_SDC_DATA 0x40 /* Data from an 8042 register */
#define HP_SDC_HIL_CMD 0x50 /* Data from HIL MLC R1/8042 */
#define HP_SDC_HIL_R1MASK 0x0f /* Contents of HIL MLC R1 0:3 */
#define HP_SDC_HIL_AUTO 0x10 /* Set if POL results from i8042 */
#define HP_SDC_HIL_ISERR 0x80 /* Has meaning as in next 4 values */
#define HP_SDC_HIL_RC_DONE 0x80 /* i8042 auto-configured loop */
#define HP_SDC_HIL_ERR 0x81 /* HIL MLC R2 had a bit set */
#define HP_SDC_HIL_TO 0x82 /* i8042 HIL watchdog expired */
#define HP_SDC_HIL_RC 0x84 /* i8042 is auto-configuring loop */
#define HP_SDC_HIL_DAT 0x60 /* Data from HIL MLC R0 */
typedef struct {
rwlock_t ibf_lock;
rwlock_t lock; /* user/tasklet lock */
rwlock_t rtq_lock; /* isr/tasklet lock */
rwlock_t hook_lock; /* isr/user lock for handler add/del */
unsigned int irq, nmi; /* Our IRQ lines */
unsigned long base_io, status_io, data_io; /* Our IO ports */
uint8_t im; /* Interrupt mask */
int set_im; /* Interrupt mask needs to be set. */
int ibf; /* Last known status of IBF flag */
uint8_t wi; /* current i8042 write index */
uint8_t r7[4]; /* current i8042[0x70 - 0x74] values */
uint8_t r11, r7e; /* Values from version/revision regs */
hp_sdc_irqhook *timer, *reg, *hil, *pup, *cooked;
#define HP_SDC_QUEUE_LEN 16
hp_sdc_transaction *tq[HP_SDC_QUEUE_LEN]; /* All pending read/writes */
int rcurr, rqty; /* Current read transact in process */
struct timeval rtv; /* Time when current read started */
int wcurr; /* Current write transact in process */
int dev_err; /* carries status from registration */
#if defined(__hppa__)
struct parisc_device *dev;
#elif defined(__mc68000__)
void *dev;
#else
#error No support for device registration on this arch yet.
#endif
struct timer_list kicker; /* Keeps below task alive */
struct tasklet_struct task;
} hp_i8042_sdc;
#endif /* _LINUX_HP_SDC_H */

View File

@@ -16,7 +16,6 @@ static inline int is_vm_hugetlb_page(struct vm_area_struct *vma)
int hugetlb_sysctl_handler(struct ctl_table *, int, struct file *, void __user *, size_t *, loff_t *);
int copy_hugetlb_page_range(struct mm_struct *, struct mm_struct *, struct vm_area_struct *);
int follow_hugetlb_page(struct mm_struct *, struct vm_area_struct *, struct page **, struct vm_area_struct **, unsigned long *, int *, int);
void zap_hugepage_range(struct vm_area_struct *, unsigned long, unsigned long);
void unmap_hugepage_range(struct vm_area_struct *, unsigned long, unsigned long);
int hugetlb_prefault(struct address_space *, struct vm_area_struct *);
int hugetlb_report_meminfo(char *);
@@ -87,7 +86,6 @@ static inline unsigned long hugetlb_total_pages(void)
#define follow_huge_addr(mm, addr, write) ERR_PTR(-EINVAL)
#define copy_hugetlb_page_range(src, dst, vma) ({ BUG(); 0; })
#define hugetlb_prefault(mapping, vma) ({ BUG(); 0; })
#define zap_hugepage_range(vma, start, len) BUG()
#define unmap_hugepage_range(vma, start, end) BUG()
#define is_hugepage_mem_enough(size) 0
#define hugetlb_report_meminfo(buf) 0

View File

@@ -21,8 +21,6 @@
/* With some changes from Ky<4B>sti M<>lkki <kmalkki@cc.hut.fi> and even
Frodo Looijaard <frodol@dds.nl> */
/* $Id: i2c-algo-bit.h,v 1.10 2003/01/21 08:08:16 kmalkki Exp $ */
#ifndef _LINUX_I2C_ALGO_BIT_H
#define _LINUX_I2C_ALGO_BIT_H
@@ -46,8 +44,6 @@ struct i2c_algo_bit_data {
int timeout; /* in jiffies */
};
#define I2C_BIT_ADAP_MAX 16
int i2c_bit_add_bus(struct i2c_adapter *);
int i2c_bit_del_bus(struct i2c_adapter *);

View File

@@ -9,8 +9,6 @@ struct i2c_algo_pca_data {
int (*wait_for_interrupt) (struct i2c_algo_pca_data *adap);
};
#define I2C_PCA_ADAP_MAX 16
int i2c_pca_add_bus(struct i2c_adapter *);
int i2c_pca_del_bus(struct i2c_adapter *);

View File

@@ -22,8 +22,6 @@
/* With some changes from Ky<4B>sti M<>lkki <kmalkki@cc.hut.fi> and even
Frodo Looijaard <frodol@dds.nl> */
/* $Id: i2c-algo-pcf.h,v 1.8 2003/01/21 08:08:16 kmalkki Exp $ */
#ifndef _LINUX_I2C_ALGO_PCF_H
#define _LINUX_I2C_ALGO_PCF_H
@@ -41,8 +39,6 @@ struct i2c_algo_pcf_data {
int timeout;
};
#define I2C_PCF_ADAP_MAX 16
int i2c_pcf_add_bus(struct i2c_adapter *);
int i2c_pcf_del_bus(struct i2c_adapter *);

View File

@@ -19,8 +19,6 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: i2c-dev.h,v 1.13 2003/01/21 08:08:16 kmalkki Exp $ */
#ifndef _LINUX_I2C_DEV_H
#define _LINUX_I2C_DEV_H

View File

@@ -164,10 +164,7 @@
/* --- Bit algorithm adapters */
#define I2C_HW_B_LP 0x010000 /* Parallel port Philips style */
#define I2C_HW_B_LPC 0x010001 /* Parallel port control reg. */
#define I2C_HW_B_SER 0x010002 /* Serial line interface */
#define I2C_HW_B_ELV 0x010003 /* ELV Card */
#define I2C_HW_B_VELLE 0x010004 /* Vellemann K8000 */
#define I2C_HW_B_BT848 0x010005 /* BT848 video boards */
#define I2C_HW_B_WNV 0x010006 /* Winnov Videums */
#define I2C_HW_B_VIA 0x010007 /* Via vt82c586b */

View File

@@ -23,14 +23,13 @@
/* With some changes from Ky<4B>sti M<>lkki <kmalkki@cc.hut.fi> and
Frodo Looijaard <frodol@dds.nl> */
/* $Id: i2c.h,v 1.68 2003/01/21 08:08:16 kmalkki Exp $ */
#ifndef _LINUX_I2C_H
#define _LINUX_I2C_H
#include <linux/module.h>
#include <linux/types.h>
#include <linux/i2c-id.h>
#include <linux/mod_devicetable.h>
#include <linux/device.h> /* for struct device */
#include <asm/semaphore.h>
@@ -94,10 +93,10 @@ extern s32 i2c_smbus_write_byte_data(struct i2c_client * client,
extern s32 i2c_smbus_read_word_data(struct i2c_client * client, u8 command);
extern s32 i2c_smbus_write_word_data(struct i2c_client * client,
u8 command, u16 value);
/* Returns the number of bytes transferred */
extern s32 i2c_smbus_write_block_data(struct i2c_client * client,
u8 command, u8 length,
u8 *values);
/* Returns the number of read bytes */
extern s32 i2c_smbus_read_i2c_block_data(struct i2c_client * client,
u8 command, u8 *values);
@@ -391,10 +390,6 @@ struct i2c_msg {
#define I2C_FUNC_10BIT_ADDR 0x00000002
#define I2C_FUNC_PROTOCOL_MANGLING 0x00000004 /* I2C_M_{REV_DIR_ADDR,NOSTART,..} */
#define I2C_FUNC_SMBUS_HWPEC_CALC 0x00000008 /* SMBus 2.0 */
#define I2C_FUNC_SMBUS_READ_WORD_DATA_PEC 0x00000800 /* SMBus 2.0 */
#define I2C_FUNC_SMBUS_WRITE_WORD_DATA_PEC 0x00001000 /* SMBus 2.0 */
#define I2C_FUNC_SMBUS_PROC_CALL_PEC 0x00002000 /* SMBus 2.0 */
#define I2C_FUNC_SMBUS_BLOCK_PROC_CALL_PEC 0x00004000 /* SMBus 2.0 */
#define I2C_FUNC_SMBUS_BLOCK_PROC_CALL 0x00008000 /* SMBus 2.0 */
#define I2C_FUNC_SMBUS_QUICK 0x00010000
#define I2C_FUNC_SMBUS_READ_BYTE 0x00020000
@@ -410,8 +405,6 @@ struct i2c_msg {
#define I2C_FUNC_SMBUS_WRITE_I2C_BLOCK 0x08000000 /* w/ 1-byte reg. addr. */
#define I2C_FUNC_SMBUS_READ_I2C_BLOCK_2 0x10000000 /* I2C-like block xfer */
#define I2C_FUNC_SMBUS_WRITE_I2C_BLOCK_2 0x20000000 /* w/ 2-byte reg. addr. */
#define I2C_FUNC_SMBUS_READ_BLOCK_DATA_PEC 0x40000000 /* SMBus 2.0 */
#define I2C_FUNC_SMBUS_WRITE_BLOCK_DATA_PEC 0x80000000 /* SMBus 2.0 */
#define I2C_FUNC_SMBUS_BYTE (I2C_FUNC_SMBUS_READ_BYTE | \
I2C_FUNC_SMBUS_WRITE_BYTE)
@@ -425,17 +418,6 @@ struct i2c_msg {
I2C_FUNC_SMBUS_WRITE_I2C_BLOCK)
#define I2C_FUNC_SMBUS_I2C_BLOCK_2 (I2C_FUNC_SMBUS_READ_I2C_BLOCK_2 | \
I2C_FUNC_SMBUS_WRITE_I2C_BLOCK_2)
#define I2C_FUNC_SMBUS_BLOCK_DATA_PEC (I2C_FUNC_SMBUS_READ_BLOCK_DATA_PEC | \
I2C_FUNC_SMBUS_WRITE_BLOCK_DATA_PEC)
#define I2C_FUNC_SMBUS_WORD_DATA_PEC (I2C_FUNC_SMBUS_READ_WORD_DATA_PEC | \
I2C_FUNC_SMBUS_WRITE_WORD_DATA_PEC)
#define I2C_FUNC_SMBUS_READ_BYTE_PEC I2C_FUNC_SMBUS_READ_BYTE_DATA
#define I2C_FUNC_SMBUS_WRITE_BYTE_PEC I2C_FUNC_SMBUS_WRITE_BYTE_DATA
#define I2C_FUNC_SMBUS_READ_BYTE_DATA_PEC I2C_FUNC_SMBUS_READ_WORD_DATA
#define I2C_FUNC_SMBUS_WRITE_BYTE_DATA_PEC I2C_FUNC_SMBUS_WRITE_WORD_DATA
#define I2C_FUNC_SMBUS_BYTE_PEC I2C_FUNC_SMBUS_BYTE_DATA
#define I2C_FUNC_SMBUS_BYTE_DATA_PEC I2C_FUNC_SMBUS_WORD_DATA
#define I2C_FUNC_SMBUS_EMUL (I2C_FUNC_SMBUS_QUICK | \
I2C_FUNC_SMBUS_BYTE | \
@@ -443,20 +425,17 @@ struct i2c_msg {
I2C_FUNC_SMBUS_WORD_DATA | \
I2C_FUNC_SMBUS_PROC_CALL | \
I2C_FUNC_SMBUS_WRITE_BLOCK_DATA | \
I2C_FUNC_SMBUS_WRITE_BLOCK_DATA_PEC | \
I2C_FUNC_SMBUS_I2C_BLOCK)
/*
* Data for SMBus Messages
*/
#define I2C_SMBUS_BLOCK_MAX 32 /* As specified in SMBus standard */
#define I2C_SMBUS_I2C_BLOCK_MAX 32 /* Not specified but we use same structure */
union i2c_smbus_data {
__u8 byte;
__u16 word;
__u8 block[I2C_SMBUS_BLOCK_MAX + 3]; /* block[0] is used for length */
/* one more for read length in block process call */
/* and one more for PEC */
__u8 block[I2C_SMBUS_BLOCK_MAX + 2]; /* block[0] is used for length */
/* and one more for user-space compatibility */
};
/* smbus_access read or write markers */
@@ -473,10 +452,6 @@ union i2c_smbus_data {
#define I2C_SMBUS_BLOCK_DATA 5
#define I2C_SMBUS_I2C_BLOCK_DATA 6
#define I2C_SMBUS_BLOCK_PROC_CALL 7 /* SMBus 2.0 */
#define I2C_SMBUS_BLOCK_DATA_PEC 8 /* SMBus 2.0 */
#define I2C_SMBUS_PROC_CALL_PEC 9 /* SMBus 2.0 */
#define I2C_SMBUS_BLOCK_PROC_CALL_PEC 10 /* SMBus 2.0 */
#define I2C_SMBUS_WORD_DATA_PEC 11 /* SMBus 2.0 */
/* ----- commands for the ioctl like i2c_command call:
@@ -506,11 +481,6 @@ union i2c_smbus_data {
#define I2C_SMBUS 0x0720 /* SMBus-level access */
/* ... algo-bit.c recognizes */
#define I2C_UDELAY 0x0705 /* set delay in microsecs between each */
/* written byte (except address) */
#define I2C_MDELAY 0x0706 /* millisec delay between written bytes */
/* ----- I2C-DEV: char device interface stuff ------------------------- */
#define I2C_MAJOR 89 /* Device major number */

View File

@@ -66,8 +66,6 @@ struct i2o_device {
struct device device;
struct semaphore lock; /* device lock */
struct class_device classdev; /* i2o device class */
};
/*
@@ -194,7 +192,7 @@ struct i2o_controller {
struct resource mem_resource; /* Mem resource allocated to the IOP */
struct device device;
struct class_device classdev; /* I2O controller class */
struct class_device *classdev; /* I2O controller class device */
struct i2o_device *exec; /* Executive */
#if BITS_PER_LONG == 64
spinlock_t context_list_lock; /* lock for context_list */

View File

@@ -218,7 +218,7 @@ typedef enum { ide_unknown, ide_generic, ide_pci,
ide_rz1000, ide_trm290,
ide_cmd646, ide_cy82c693, ide_4drives,
ide_pmac, ide_etrax100, ide_acorn,
ide_forced
ide_au1xxx, ide_forced
} hwif_chipset_t;
/*

View File

@@ -12,6 +12,7 @@
#ifdef __KERNEL__
#include <linux/time.h>
#include <linux/list.h>
#include <linux/device.h>
#else
#include <sys/time.h>
#include <sys/ioctl.h>
@@ -644,6 +645,7 @@ struct input_absinfo {
#define BUS_ADB 0x17
#define BUS_I2C 0x18
#define BUS_HOST 0x19
#define BUS_GSC 0x1A
/*
* Values describing the status of an effect
@@ -889,11 +891,15 @@ struct input_dev {
struct semaphore sem; /* serializes open and close operations */
unsigned int users;
struct device *dev;
struct class_device cdev;
struct device *dev; /* will be removed soon */
int dynalloc; /* temporarily */
struct list_head h_list;
struct list_head node;
};
#define to_input_dev(d) container_of(d, struct input_dev, cdev)
/*
* Structure for hotplug & device<->driver matching.
@@ -984,6 +990,23 @@ static inline void init_input_dev(struct input_dev *dev)
INIT_LIST_HEAD(&dev->node);
}
struct input_dev *input_allocate_device(void);
static inline void input_free_device(struct input_dev *dev)
{
kfree(dev);
}
static inline struct input_dev *input_get_device(struct input_dev *dev)
{
return to_input_dev(class_device_get(&dev->cdev));
}
static inline void input_put_device(struct input_dev *dev)
{
class_device_put(&dev->cdev);
}
void input_register_device(struct input_dev *);
void input_unregister_device(struct input_dev *);
@@ -1052,7 +1075,7 @@ static inline void input_set_abs_params(struct input_dev *dev, int axis, int min
dev->absbit[LONG(axis)] |= BIT(axis);
}
extern struct class *input_class;
extern struct class input_class;
#endif
#endif

View File

@@ -347,7 +347,6 @@ struct ata_port_operations {
void (*exec_command)(struct ata_port *ap, const struct ata_taskfile *tf);
u8 (*check_status)(struct ata_port *ap);
u8 (*check_altstatus)(struct ata_port *ap);
u8 (*check_err)(struct ata_port *ap);
void (*dev_select)(struct ata_port *ap, unsigned int device);
void (*phy_reset) (struct ata_port *ap);
@@ -434,7 +433,6 @@ extern void ata_noop_dev_select (struct ata_port *ap, unsigned int device);
extern void ata_std_dev_select (struct ata_port *ap, unsigned int device);
extern u8 ata_check_status(struct ata_port *ap);
extern u8 ata_altstatus(struct ata_port *ap);
extern u8 ata_chk_err(struct ata_port *ap);
extern void ata_exec_command(struct ata_port *ap, const struct ata_taskfile *tf);
extern int ata_port_start (struct ata_port *ap);
extern void ata_port_stop (struct ata_port *ap);

94
include/linux/memory.h Normal file
View File

@@ -0,0 +1,94 @@
/*
* include/linux/memory.h - generic memory definition
*
* This is mainly for topological representation. We define the
* basic "struct memory_block" here, which can be embedded in per-arch
* definitions or NUMA information.
*
* Basic handling of the devices is done in drivers/base/memory.c
* and system devices are handled in drivers/base/sys.c.
*
* Memory block are exported via sysfs in the class/memory/devices/
* directory.
*
*/
#ifndef _LINUX_MEMORY_H_
#define _LINUX_MEMORY_H_
#include <linux/sysdev.h>
#include <linux/node.h>
#include <linux/compiler.h>
#include <asm/semaphore.h>
struct memory_block {
unsigned long phys_index;
unsigned long state;
/*
* This serializes all state change requests. It isn't
* held during creation because the control files are
* created long after the critical areas during
* initialization.
*/
struct semaphore state_sem;
int phys_device; /* to which fru does this belong? */
void *hw; /* optional pointer to fw/hw data */
int (*phys_callback)(struct memory_block *);
struct sys_device sysdev;
};
/* These states are exposed to userspace as text strings in sysfs */
#define MEM_ONLINE (1<<0) /* exposed to userspace */
#define MEM_GOING_OFFLINE (1<<1) /* exposed to userspace */
#define MEM_OFFLINE (1<<2) /* exposed to userspace */
/*
* All of these states are currently kernel-internal for notifying
* kernel components and architectures.
*
* For MEM_MAPPING_INVALID, all notifier chains with priority >0
* are called before pfn_to_page() becomes invalid. The priority=0
* entry is reserved for the function that actually makes
* pfn_to_page() stop working. Any notifiers that want to be called
* after that should have priority <0.
*/
#define MEM_MAPPING_INVALID (1<<3)
#ifndef CONFIG_MEMORY_HOTPLUG
static inline int memory_dev_init(void)
{
return 0;
}
static inline int register_memory_notifier(struct notifier_block *nb)
{
return 0;
}
static inline void unregister_memory_notifier(struct notifier_block *nb)
{
}
#else
extern int register_memory(struct memory_block *, struct mem_section *section, struct node *);
extern int register_new_memory(struct mem_section *);
extern int unregister_memory_section(struct mem_section *);
extern int memory_dev_init(void);
extern int register_memory_notifier(struct notifier_block *nb);
extern void unregister_memory_notifier(struct notifier_block *nb);
#define CONFIG_MEM_BLOCK_SIZE (PAGES_PER_SECTION<<PAGE_SHIFT)
extern int invalidate_phys_mapping(unsigned long, unsigned long);
struct notifier_block;
extern int register_memory_notifier(struct notifier_block *nb);
extern void unregister_memory_notifier(struct notifier_block *nb);
extern struct sysdev_class memory_sysdev_class;
#endif /* CONFIG_MEMORY_HOTPLUG */
#define hotplug_memory_notifier(fn, pri) { \
static struct notifier_block fn##_mem_nb = \
{ .notifier_call = fn, .priority = pri }; \
register_memory_notifier(&fn##_mem_nb); \
}
#endif /* _LINUX_MEMORY_H_ */

View File

@@ -0,0 +1,104 @@
#ifndef __LINUX_MEMORY_HOTPLUG_H
#define __LINUX_MEMORY_HOTPLUG_H
#include <linux/mmzone.h>
#include <linux/spinlock.h>
#include <linux/mmzone.h>
#include <linux/notifier.h>
#ifdef CONFIG_MEMORY_HOTPLUG
/*
* pgdat resizing functions
*/
static inline
void pgdat_resize_lock(struct pglist_data *pgdat, unsigned long *flags)
{
spin_lock_irqsave(&pgdat->node_size_lock, *flags);
}
static inline
void pgdat_resize_unlock(struct pglist_data *pgdat, unsigned long *flags)
{
spin_unlock_irqrestore(&pgdat->node_size_lock, *flags);
}
static inline
void pgdat_resize_init(struct pglist_data *pgdat)
{
spin_lock_init(&pgdat->node_size_lock);
}
/*
* Zone resizing functions
*/
static inline unsigned zone_span_seqbegin(struct zone *zone)
{
return read_seqbegin(&zone->span_seqlock);
}
static inline int zone_span_seqretry(struct zone *zone, unsigned iv)
{
return read_seqretry(&zone->span_seqlock, iv);
}
static inline void zone_span_writelock(struct zone *zone)
{
write_seqlock(&zone->span_seqlock);
}
static inline void zone_span_writeunlock(struct zone *zone)
{
write_sequnlock(&zone->span_seqlock);
}
static inline void zone_seqlock_init(struct zone *zone)
{
seqlock_init(&zone->span_seqlock);
}
extern int zone_grow_free_lists(struct zone *zone, unsigned long new_nr_pages);
extern int zone_grow_waitqueues(struct zone *zone, unsigned long nr_pages);
extern int add_one_highpage(struct page *page, int pfn, int bad_ppro);
/* need some defines for these for archs that don't support it */
extern void online_page(struct page *page);
/* VM interface that may be used by firmware interface */
extern int add_memory(u64 start, u64 size);
extern int remove_memory(u64 start, u64 size);
extern int online_pages(unsigned long, unsigned long);
/* reasonably generic interface to expand the physical pages in a zone */
extern int __add_pages(struct zone *zone, unsigned long start_pfn,
unsigned long nr_pages);
#else /* ! CONFIG_MEMORY_HOTPLUG */
/*
* Stub functions for when hotplug is off
*/
static inline void pgdat_resize_lock(struct pglist_data *p, unsigned long *f) {}
static inline void pgdat_resize_unlock(struct pglist_data *p, unsigned long *f) {}
static inline void pgdat_resize_init(struct pglist_data *pgdat) {}
static inline unsigned zone_span_seqbegin(struct zone *zone)
{
return 0;
}
static inline int zone_span_seqretry(struct zone *zone, unsigned iv)
{
return 0;
}
static inline void zone_span_writelock(struct zone *zone) {}
static inline void zone_span_writeunlock(struct zone *zone) {}
static inline void zone_seqlock_init(struct zone *zone) {}
static inline int mhp_notimplemented(const char *func)
{
printk(KERN_WARNING "%s() called, with CONFIG_MEMORY_HOTPLUG disabled\n", func);
dump_stack();
return -ENOSYS;
}
static inline int __add_pages(struct zone *zone, unsigned long start_pfn,
unsigned long nr_pages)
{
return mhp_notimplemented(__FUNCTION__);
}
#endif /* ! CONFIG_MEMORY_HOTPLUG */
static inline int __remove_pages(struct zone *zone, unsigned long start_pfn,
unsigned long nr_pages)
{
printk(KERN_WARNING "%s() called, not yet supported\n", __FUNCTION__);
dump_stack();
return -ENOSYS;
}
#endif /* __LINUX_MEMORY_HOTPLUG_H */

View File

@@ -27,10 +27,10 @@
#include <linux/config.h>
#include <linux/mmzone.h>
#include <linux/bitmap.h>
#include <linux/slab.h>
#include <linux/rbtree.h>
#include <linux/spinlock.h>
#include <linux/nodemask.h>
struct vm_area_struct;
@@ -47,8 +47,7 @@ struct vm_area_struct;
* Locking policy for interlave:
* In process context there is no locking because only the process accesses
* its own state. All vma manipulation is somewhat protected by a down_read on
* mmap_sem. For allocating in the interleave policy the page_table_lock
* must be also aquired to protect il_next.
* mmap_sem.
*
* Freeing policy:
* When policy is MPOL_BIND v.zonelist is kmalloc'ed and must be kfree'd.
@@ -63,7 +62,7 @@ struct mempolicy {
union {
struct zonelist *zonelist; /* bind */
short preferred_node; /* preferred */
DECLARE_BITMAP(nodes, MAX_NUMNODES); /* interleave */
nodemask_t nodes; /* interleave */
/* undefined for default */
} v;
};

View File

@@ -157,7 +157,7 @@ extern unsigned int kobjsize(const void *objp);
#define VM_DONTCOPY 0x00020000 /* Do not copy this vma on fork */
#define VM_DONTEXPAND 0x00040000 /* Cannot expand with mremap() */
#define VM_RESERVED 0x00080000 /* Don't unmap it from swap_out */
#define VM_RESERVED 0x00080000 /* Pages managed in a special way */
#define VM_ACCOUNT 0x00100000 /* Is a VM accounted object */
#define VM_HUGETLB 0x00400000 /* Huge TLB Page VM */
#define VM_NONLINEAR 0x00800000 /* Is non-linear (remap_file_pages) */
@@ -226,13 +226,18 @@ struct page {
* to show when page is mapped
* & limit reverse map searches.
*/
unsigned long private; /* Mapping-private opaque data:
union {
unsigned long private; /* Mapping-private opaque data:
* usually used for buffer_heads
* if PagePrivate set; used for
* swp_entry_t if PageSwapCache
* When page is free, this indicates
* order in the buddy system.
*/
#if NR_CPUS >= CONFIG_SPLIT_PTLOCK_CPUS
spinlock_t ptl;
#endif
} u;
struct address_space *mapping; /* If low bit clear, points to
* inode address_space, or NULL.
* If page mapped as anonymous
@@ -260,6 +265,9 @@ struct page {
#endif /* WANT_PAGE_VIRTUAL */
};
#define page_private(page) ((page)->u.private)
#define set_page_private(page, v) ((page)->u.private = (v))
/*
* FIXME: take this include out, include page-flags.h in
* files which need it (119 of them)
@@ -311,17 +319,17 @@ extern void FASTCALL(__page_cache_release(struct page *));
#ifdef CONFIG_HUGETLB_PAGE
static inline int page_count(struct page *p)
static inline int page_count(struct page *page)
{
if (PageCompound(p))
p = (struct page *)p->private;
return atomic_read(&(p)->_count) + 1;
if (PageCompound(page))
page = (struct page *)page_private(page);
return atomic_read(&page->_count) + 1;
}
static inline void get_page(struct page *page)
{
if (unlikely(PageCompound(page)))
page = (struct page *)page->private;
page = (struct page *)page_private(page);
atomic_inc(&page->_count);
}
@@ -338,7 +346,7 @@ static inline void get_page(struct page *page)
static inline void put_page(struct page *page)
{
if (!PageReserved(page) && put_page_testzero(page))
if (put_page_testzero(page))
__page_cache_release(page);
}
@@ -587,7 +595,7 @@ static inline int PageAnon(struct page *page)
static inline pgoff_t page_index(struct page *page)
{
if (unlikely(PageSwapCache(page)))
return page->private;
return page_private(page);
return page->index;
}
@@ -682,7 +690,7 @@ struct zap_details {
unsigned long zap_page_range(struct vm_area_struct *vma, unsigned long address,
unsigned long size, struct zap_details *);
unsigned long unmap_vmas(struct mmu_gather **tlb, struct mm_struct *mm,
unsigned long unmap_vmas(struct mmu_gather **tlb,
struct vm_area_struct *start_vma, unsigned long start_addr,
unsigned long end_addr, unsigned long *nr_accounted,
struct zap_details *);
@@ -704,10 +712,6 @@ static inline void unmap_shared_mapping_range(struct address_space *mapping,
}
extern int vmtruncate(struct inode * inode, loff_t offset);
extern pud_t *FASTCALL(__pud_alloc(struct mm_struct *mm, pgd_t *pgd, unsigned long address));
extern pmd_t *FASTCALL(__pmd_alloc(struct mm_struct *mm, pud_t *pud, unsigned long address));
extern pte_t *FASTCALL(pte_alloc_kernel(struct mm_struct *mm, pmd_t *pmd, unsigned long address));
extern pte_t *FASTCALL(pte_alloc_map(struct mm_struct *mm, pmd_t *pmd, unsigned long address));
extern int install_page(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long addr, struct page *page, pgprot_t prot);
extern int install_file_pte(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long addr, unsigned long pgoff, pgprot_t prot);
extern int __handle_mm_fault(struct mm_struct *mm,struct vm_area_struct *vma, unsigned long address, int write_access);
@@ -723,6 +727,7 @@ void install_arg_page(struct vm_area_struct *, struct page *, unsigned long);
int get_user_pages(struct task_struct *tsk, struct mm_struct *mm, unsigned long start,
int len, int write, int force, struct page **pages, struct vm_area_struct **vmas);
void print_bad_pte(struct vm_area_struct *, pte_t, unsigned long);
int __set_page_dirty_buffers(struct page *page);
int __set_page_dirty_nobuffers(struct page *page);
@@ -759,38 +764,83 @@ struct shrinker;
extern struct shrinker *set_shrinker(int, shrinker_t);
extern void remove_shrinker(struct shrinker *shrinker);
/*
* On a two-level or three-level page table, this ends up being trivial. Thus
* the inlining and the symmetry break with pte_alloc_map() that does all
* of this out-of-line.
*/
int __pud_alloc(struct mm_struct *mm, pgd_t *pgd, unsigned long address);
int __pmd_alloc(struct mm_struct *mm, pud_t *pud, unsigned long address);
int __pte_alloc(struct mm_struct *mm, pmd_t *pmd, unsigned long address);
int __pte_alloc_kernel(pmd_t *pmd, unsigned long address);
/*
* The following ifdef needed to get the 4level-fixup.h header to work.
* Remove it when 4level-fixup.h has been removed.
*/
#ifdef CONFIG_MMU
#ifndef __ARCH_HAS_4LEVEL_HACK
#if defined(CONFIG_MMU) && !defined(__ARCH_HAS_4LEVEL_HACK)
static inline pud_t *pud_alloc(struct mm_struct *mm, pgd_t *pgd, unsigned long address)
{
if (pgd_none(*pgd))
return __pud_alloc(mm, pgd, address);
return pud_offset(pgd, address);
return (unlikely(pgd_none(*pgd)) && __pud_alloc(mm, pgd, address))?
NULL: pud_offset(pgd, address);
}
static inline pmd_t *pmd_alloc(struct mm_struct *mm, pud_t *pud, unsigned long address)
{
if (pud_none(*pud))
return __pmd_alloc(mm, pud, address);
return pmd_offset(pud, address);
return (unlikely(pud_none(*pud)) && __pmd_alloc(mm, pud, address))?
NULL: pmd_offset(pud, address);
}
#endif
#endif /* CONFIG_MMU */
#endif /* CONFIG_MMU && !__ARCH_HAS_4LEVEL_HACK */
#if NR_CPUS >= CONFIG_SPLIT_PTLOCK_CPUS
/*
* We tuck a spinlock to guard each pagetable page into its struct page,
* at page->private, with BUILD_BUG_ON to make sure that this will not
* overflow into the next struct page (as it might with DEBUG_SPINLOCK).
* When freeing, reset page->mapping so free_pages_check won't complain.
*/
#define __pte_lockptr(page) &((page)->u.ptl)
#define pte_lock_init(_page) do { \
spin_lock_init(__pte_lockptr(_page)); \
} while (0)
#define pte_lock_deinit(page) ((page)->mapping = NULL)
#define pte_lockptr(mm, pmd) ({(void)(mm); __pte_lockptr(pmd_page(*(pmd)));})
#else
/*
* We use mm->page_table_lock to guard all pagetable pages of the mm.
*/
#define pte_lock_init(page) do {} while (0)
#define pte_lock_deinit(page) do {} while (0)
#define pte_lockptr(mm, pmd) ({(void)(pmd); &(mm)->page_table_lock;})
#endif /* NR_CPUS < CONFIG_SPLIT_PTLOCK_CPUS */
#define pte_offset_map_lock(mm, pmd, address, ptlp) \
({ \
spinlock_t *__ptl = pte_lockptr(mm, pmd); \
pte_t *__pte = pte_offset_map(pmd, address); \
*(ptlp) = __ptl; \
spin_lock(__ptl); \
__pte; \
})
#define pte_unmap_unlock(pte, ptl) do { \
spin_unlock(ptl); \
pte_unmap(pte); \
} while (0)
#define pte_alloc_map(mm, pmd, address) \
((unlikely(!pmd_present(*(pmd))) && __pte_alloc(mm, pmd, address))? \
NULL: pte_offset_map(pmd, address))
#define pte_alloc_map_lock(mm, pmd, address, ptlp) \
((unlikely(!pmd_present(*(pmd))) && __pte_alloc(mm, pmd, address))? \
NULL: pte_offset_map_lock(mm, pmd, address, ptlp))
#define pte_alloc_kernel(pmd, address) \
((unlikely(!pmd_present(*(pmd))) && __pte_alloc_kernel(pmd, address))? \
NULL: pte_offset_kernel(pmd, address))
extern void free_area_init(unsigned long * zones_size);
extern void free_area_init_node(int nid, pg_data_t *pgdat,
unsigned long * zones_size, unsigned long zone_start_pfn,
unsigned long *zholes_size);
extern void memmap_init_zone(unsigned long, int, unsigned long, unsigned long);
extern void setup_per_zone_pages_min(void);
extern void mem_init(void);
extern void show_mem(void);
extern void si_meminfo(struct sysinfo * val);
@@ -834,6 +884,7 @@ extern int split_vma(struct mm_struct *,
extern int insert_vm_struct(struct mm_struct *, struct vm_area_struct *);
extern void __vma_link_rb(struct mm_struct *, struct vm_area_struct *,
struct rb_node **, struct rb_node *);
extern void unlink_file_vma(struct vm_area_struct *);
extern struct vm_area_struct *copy_vma(struct vm_area_struct **,
unsigned long addr, unsigned long len, pgoff_t pgoff);
extern void exit_mmap(struct mm_struct *);
@@ -894,7 +945,8 @@ void handle_ra_miss(struct address_space *mapping,
unsigned long max_sane_readahead(unsigned long nr);
/* Do stack extension */
extern int expand_stack(struct vm_area_struct * vma, unsigned long address);
extern int expand_stack(struct vm_area_struct *vma, unsigned long address);
extern int expand_upwards(struct vm_area_struct *vma, unsigned long address);
/* Look up the first VMA which satisfies addr < vm_end, NULL if none. */
extern struct vm_area_struct * find_vma(struct mm_struct * mm, unsigned long addr);
@@ -917,40 +969,28 @@ static inline unsigned long vma_pages(struct vm_area_struct *vma)
return (vma->vm_end - vma->vm_start) >> PAGE_SHIFT;
}
extern struct vm_area_struct *find_extend_vma(struct mm_struct *mm, unsigned long addr);
struct vm_area_struct *find_extend_vma(struct mm_struct *, unsigned long addr);
struct page *vmalloc_to_page(void *addr);
unsigned long vmalloc_to_pfn(void *addr);
int remap_pfn_range(struct vm_area_struct *, unsigned long addr,
unsigned long pfn, unsigned long size, pgprot_t);
extern struct page * vmalloc_to_page(void *addr);
extern unsigned long vmalloc_to_pfn(void *addr);
extern struct page * follow_page(struct mm_struct *mm, unsigned long address,
int write);
extern int check_user_page_readable(struct mm_struct *mm, unsigned long address);
int remap_pfn_range(struct vm_area_struct *, unsigned long,
unsigned long, unsigned long, pgprot_t);
struct page *follow_page(struct mm_struct *, unsigned long address,
unsigned int foll_flags);
#define FOLL_WRITE 0x01 /* check pte is writable */
#define FOLL_TOUCH 0x02 /* mark page accessed */
#define FOLL_GET 0x04 /* do get_page on page */
#define FOLL_ANON 0x08 /* give ZERO_PAGE if no pgtable */
#ifdef CONFIG_PROC_FS
void __vm_stat_account(struct mm_struct *, unsigned long, struct file *, long);
void vm_stat_account(struct mm_struct *, unsigned long, struct file *, long);
#else
static inline void __vm_stat_account(struct mm_struct *mm,
static inline void vm_stat_account(struct mm_struct *mm,
unsigned long flags, struct file *file, long pages)
{
}
#endif /* CONFIG_PROC_FS */
static inline void vm_stat_account(struct vm_area_struct *vma)
{
__vm_stat_account(vma->vm_mm, vma->vm_flags, vma->vm_file,
vma_pages(vma));
}
static inline void vm_stat_unaccount(struct vm_area_struct *vma)
{
__vm_stat_account(vma->vm_mm, vma->vm_flags, vma->vm_file,
-vma_pages(vma));
}
/* update per process rss and vm hiwater data */
extern void update_mem_hiwater(struct task_struct *tsk);
#ifndef CONFIG_DEBUG_PAGEALLOC
static inline void
kernel_map_pages(struct page *page, int numpages, int enable)

View File

@@ -50,7 +50,7 @@ struct mmc_command {
#define MMC_ERR_INVALID 5
struct mmc_data *data; /* data segment associated with cmd */
struct mmc_request *mrq; /* assoicated request */
struct mmc_request *mrq; /* associated request */
};
struct mmc_data {
@@ -68,7 +68,7 @@ struct mmc_data {
unsigned int bytes_xfered;
struct mmc_command *stop; /* stop command */
struct mmc_request *mrq; /* assoicated request */
struct mmc_request *mrq; /* associated request */
unsigned int sg_len; /* size of scatter list */
struct scatterlist *sg; /* I/O scatter list */

View File

@@ -12,6 +12,7 @@
#include <linux/threads.h>
#include <linux/numa.h>
#include <linux/init.h>
#include <linux/seqlock.h>
#include <asm/atomic.h>
/* Free memory management - zoned buddy allocator. */
@@ -137,6 +138,10 @@ struct zone {
* free areas of different sizes
*/
spinlock_t lock;
#ifdef CONFIG_MEMORY_HOTPLUG
/* see spanned/present_pages for more description */
seqlock_t span_seqlock;
#endif
struct free_area free_area[MAX_ORDER];
@@ -220,6 +225,16 @@ struct zone {
/* zone_start_pfn == zone_start_paddr >> PAGE_SHIFT */
unsigned long zone_start_pfn;
/*
* zone_start_pfn, spanned_pages and present_pages are all
* protected by span_seqlock. It is a seqlock because it has
* to be read outside of zone->lock, and it is done in the main
* allocator path. But, it is written quite infrequently.
*
* The lock is declared along with zone->lock because it is
* frequently read in proximity to zone->lock. It's good to
* give them a chance of being in the same cacheline.
*/
unsigned long spanned_pages; /* total size, including holes */
unsigned long present_pages; /* amount of memory (excluding holes) */
@@ -273,6 +288,16 @@ typedef struct pglist_data {
struct page *node_mem_map;
#endif
struct bootmem_data *bdata;
#ifdef CONFIG_MEMORY_HOTPLUG
/*
* Must be held any time you expect node_start_pfn, node_present_pages
* or node_spanned_pages stay constant. Holding this will also
* guarantee that any pfn_valid() stays that way.
*
* Nests above zone->lock and zone->size_seqlock.
*/
spinlock_t node_size_lock;
#endif
unsigned long node_start_pfn;
unsigned long node_present_pages; /* total number of physical pages */
unsigned long node_spanned_pages; /* total size of physical page
@@ -293,6 +318,8 @@ typedef struct pglist_data {
#endif
#define nid_page_nr(nid, pagenr) pgdat_page_nr(NODE_DATA(nid),(pagenr))
#include <linux/memory_hotplug.h>
extern struct pglist_data *pgdat_list;
void __get_zone_counts(unsigned long *active, unsigned long *inactive,
@@ -509,6 +536,7 @@ static inline struct mem_section *__nr_to_section(unsigned long nr)
return NULL;
return &mem_section[SECTION_NR_TO_ROOT(nr)][nr & SECTION_ROOT_MASK];
}
extern int __section_nr(struct mem_section* ms);
/*
* We use the lower bits of the mem_map pointer to store

View File

@@ -244,4 +244,9 @@ struct pcmcia_device_id {
#define PCMCIA_DEV_ID_MATCH_FAKE_CIS 0x0200
#define PCMCIA_DEV_ID_MATCH_ANONYMOUS 0x0400
/* I2C */
struct i2c_device_id {
__u16 id;
};
#endif /* LINUX_MOD_DEVICETABLE_H */

View File

@@ -308,6 +308,7 @@ struct net_device
#define NETIF_F_VLAN_CHALLENGED 1024 /* Device cannot handle VLAN packets */
#define NETIF_F_TSO 2048 /* Can offload TCP/IP segmentation */
#define NETIF_F_LLTX 4096 /* LockLess TX */
#define NETIF_F_UFO 8192 /* Can offload UDP Large Send*/
struct net_device *next_sched;

View File

@@ -132,6 +132,7 @@ struct pci_dev {
unsigned int is_enabled:1; /* pci_enable_device has been called */
unsigned int is_busmaster:1; /* device is busmaster */
unsigned int no_msi:1; /* device may not use msi */
unsigned int block_ucfg_access:1; /* userspace config space access is blocked */
u32 saved_config_space[16]; /* config space saved at suspend time */
struct bin_attribute *rom_attr; /* attribute descriptor for sysfs ROM entry */
@@ -490,6 +491,9 @@ extern void pci_disable_msix(struct pci_dev *dev);
extern void msi_remove_pci_irq_vectors(struct pci_dev *dev);
#endif
extern void pci_block_user_cfg_access(struct pci_dev *dev);
extern void pci_unblock_user_cfg_access(struct pci_dev *dev);
/*
* PCI domain support. Sometimes called PCI segment (eg by ACPI),
* a PCI domain is defined to be a set of PCI busses which share
@@ -560,6 +564,9 @@ static inline int pci_enable_wake(struct pci_dev *dev, pci_power_t state, int en
#define pci_dma_burst_advice(pdev, strat, strategy_parameter) do { } while (0)
static inline void pci_block_user_cfg_access(struct pci_dev *dev) { }
static inline void pci_unblock_user_cfg_access(struct pci_dev *dev) { }
#endif /* CONFIG_PCI */
/* Include architecture-dependent settings and functions */

File diff suppressed because it is too large Load Diff

View File

@@ -219,10 +219,11 @@ typedef struct pm_message {
struct dev_pm_info {
pm_message_t power_state;
unsigned can_wakeup:1;
#ifdef CONFIG_PM
unsigned should_wakeup:1;
pm_message_t prev_state;
void * saved_state;
atomic_t pm_users;
struct device * pm_parent;
struct list_head entry;
#endif
@@ -236,13 +237,48 @@ extern void device_resume(void);
#ifdef CONFIG_PM
extern int device_suspend(pm_message_t state);
#else
#define device_set_wakeup_enable(dev,val) \
((dev)->power.should_wakeup = !!(val))
#define device_may_wakeup(dev) \
(device_can_wakeup(dev) && (dev)->power.should_wakeup)
extern int dpm_runtime_suspend(struct device *, pm_message_t);
extern void dpm_runtime_resume(struct device *);
#else /* !CONFIG_PM */
static inline int device_suspend(pm_message_t state)
{
return 0;
}
#define device_set_wakeup_enable(dev,val) do{}while(0)
#define device_may_wakeup(dev) (0)
static inline int dpm_runtime_suspend(struct device * dev, pm_message_t state)
{
return 0;
}
static inline void dpm_runtime_resume(struct device * dev)
{
}
#endif
/* changes to device_may_wakeup take effect on the next pm state change.
* by default, devices should wakeup if they can.
*/
#define device_can_wakeup(dev) \
((dev)->power.can_wakeup)
#define device_init_wakeup(dev,val) \
do { \
device_can_wakeup(dev) = !!(val); \
device_set_wakeup_enable(dev,val); \
} while(0)
#endif /* __KERNEL__ */
#endif /* _LINUX_PM_H */

View File

@@ -95,8 +95,8 @@ int try_to_unmap(struct page *);
/*
* Called from mm/filemap_xip.c to unmap empty zero page
*/
pte_t *page_check_address(struct page *, struct mm_struct *, unsigned long);
pte_t *page_check_address(struct page *, struct mm_struct *,
unsigned long, spinlock_t **);
/*
* Used by swapoff to help locate where page is expected in vma.

View File

@@ -61,5 +61,10 @@ extern void FASTCALL(__up_read(struct rw_semaphore *sem));
extern void FASTCALL(__up_write(struct rw_semaphore *sem));
extern void FASTCALL(__downgrade_write(struct rw_semaphore *sem));
static inline int rwsem_is_locked(struct rw_semaphore *sem)
{
return (sem->activity != 0);
}
#endif /* __KERNEL__ */
#endif /* _LINUX_RWSEM_SPINLOCK_H */

View File

@@ -1,14 +1,23 @@
#ifndef _LINUX_SCATTERLIST_H
#define _LINUX_SCATTERLIST_H
static inline void sg_init_one(struct scatterlist *sg,
u8 *buf, unsigned int buflen)
{
memset(sg, 0, sizeof(*sg));
#include <asm/scatterlist.h>
#include <linux/mm.h>
#include <linux/string.h>
static inline void sg_set_buf(struct scatterlist *sg, void *buf,
unsigned int buflen)
{
sg->page = virt_to_page(buf);
sg->offset = offset_in_page(buf);
sg->length = buflen;
}
static inline void sg_init_one(struct scatterlist *sg, void *buf,
unsigned int buflen)
{
memset(sg, 0, sizeof(*sg));
sg_set_buf(sg, buf, buflen);
}
#endif /* _LINUX_SCATTERLIST_H */

View File

@@ -249,6 +249,36 @@ arch_get_unmapped_area_topdown(struct file *filp, unsigned long addr,
extern void arch_unmap_area(struct mm_struct *, unsigned long);
extern void arch_unmap_area_topdown(struct mm_struct *, unsigned long);
#if NR_CPUS >= CONFIG_SPLIT_PTLOCK_CPUS
/*
* The mm counters are not protected by its page_table_lock,
* so must be incremented atomically.
*/
#ifdef ATOMIC64_INIT
#define set_mm_counter(mm, member, value) atomic64_set(&(mm)->_##member, value)
#define get_mm_counter(mm, member) ((unsigned long)atomic64_read(&(mm)->_##member))
#define add_mm_counter(mm, member, value) atomic64_add(value, &(mm)->_##member)
#define inc_mm_counter(mm, member) atomic64_inc(&(mm)->_##member)
#define dec_mm_counter(mm, member) atomic64_dec(&(mm)->_##member)
typedef atomic64_t mm_counter_t;
#else /* !ATOMIC64_INIT */
/*
* The counters wrap back to 0 at 2^32 * PAGE_SIZE,
* that is, at 16TB if using 4kB page size.
*/
#define set_mm_counter(mm, member, value) atomic_set(&(mm)->_##member, value)
#define get_mm_counter(mm, member) ((unsigned long)atomic_read(&(mm)->_##member))
#define add_mm_counter(mm, member, value) atomic_add(value, &(mm)->_##member)
#define inc_mm_counter(mm, member) atomic_inc(&(mm)->_##member)
#define dec_mm_counter(mm, member) atomic_dec(&(mm)->_##member)
typedef atomic_t mm_counter_t;
#endif /* !ATOMIC64_INIT */
#else /* NR_CPUS < CONFIG_SPLIT_PTLOCK_CPUS */
/*
* The mm counters are protected by its page_table_lock,
* so can be incremented directly.
*/
#define set_mm_counter(mm, member, value) (mm)->_##member = (value)
#define get_mm_counter(mm, member) ((mm)->_##member)
#define add_mm_counter(mm, member, value) (mm)->_##member += (value)
@@ -256,6 +286,20 @@ extern void arch_unmap_area_topdown(struct mm_struct *, unsigned long);
#define dec_mm_counter(mm, member) (mm)->_##member--
typedef unsigned long mm_counter_t;
#endif /* NR_CPUS < CONFIG_SPLIT_PTLOCK_CPUS */
#define get_mm_rss(mm) \
(get_mm_counter(mm, file_rss) + get_mm_counter(mm, anon_rss))
#define update_hiwater_rss(mm) do { \
unsigned long _rss = get_mm_rss(mm); \
if ((mm)->hiwater_rss < _rss) \
(mm)->hiwater_rss = _rss; \
} while (0)
#define update_hiwater_vm(mm) do { \
if ((mm)->hiwater_vm < (mm)->total_vm) \
(mm)->hiwater_vm = (mm)->total_vm; \
} while (0)
struct mm_struct {
struct vm_area_struct * mmap; /* list of VMAs */
struct rb_root mm_rb;
@@ -279,15 +323,20 @@ struct mm_struct {
* by mmlist_lock
*/
/* Special counters, in some configurations protected by the
* page_table_lock, in other configurations by being atomic.
*/
mm_counter_t _file_rss;
mm_counter_t _anon_rss;
unsigned long hiwater_rss; /* High-watermark of RSS usage */
unsigned long hiwater_vm; /* High-water virtual memory usage */
unsigned long total_vm, locked_vm, shared_vm, exec_vm;
unsigned long stack_vm, reserved_vm, def_flags, nr_ptes;
unsigned long start_code, end_code, start_data, end_data;
unsigned long start_brk, brk, start_stack;
unsigned long arg_start, arg_end, env_start, env_end;
unsigned long total_vm, locked_vm, shared_vm;
unsigned long exec_vm, stack_vm, reserved_vm, def_flags, nr_ptes;
/* Special counters protected by the page_table_lock */
mm_counter_t _rss;
mm_counter_t _anon_rss;
unsigned long saved_auxv[AT_VECTOR_SIZE]; /* for /proc/PID/auxv */
@@ -308,11 +357,7 @@ struct mm_struct {
/* aio bits */
rwlock_t ioctx_list_lock;
struct kioctx *ioctx_list;
struct kioctx default_kioctx;
unsigned long hiwater_rss; /* High-water RSS usage */
unsigned long hiwater_vm; /* High-water virtual memory usage */
};
struct sighand_struct {

View File

@@ -39,7 +39,8 @@
#define PORT_RSA 13
#define PORT_NS16550A 14
#define PORT_XSCALE 15
#define PORT_MAX_8250 15 /* max port ID */
#define PORT_IP3106 16
#define PORT_MAX_8250 16 /* max port ID */
/*
* ARM specific type numbers. These are not currently guaranteed

View File

@@ -0,0 +1,81 @@
/*
* Embedded Alley Solutions, source@embeddedalley.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 _LINUX_SERIAL_IP3106_H
#define _LINUX_SERIAL_IP3106_H
#include <linux/serial_core.h>
#include <linux/device.h>
#define IP3106_NR_PORTS 2
struct ip3106_port {
struct uart_port port;
struct timer_list timer;
unsigned int old_status;
};
/* register offsets */
#define IP3106_LCR 0
#define IP3106_MCR 0x004
#define IP3106_BAUD 0x008
#define IP3106_CFG 0x00c
#define IP3106_FIFO 0x028
#define IP3106_ISTAT 0xfe0
#define IP3106_IEN 0xfe4
#define IP3106_ICLR 0xfe8
#define IP3106_ISET 0xfec
#define IP3106_PD 0xff4
#define IP3106_MID 0xffc
#define IP3106_UART_LCR_TXBREAK (1<<30)
#define IP3106_UART_LCR_PAREVN 0x10000000
#define IP3106_UART_LCR_PAREN 0x08000000
#define IP3106_UART_LCR_2STOPB 0x04000000
#define IP3106_UART_LCR_8BIT 0x01000000
#define IP3106_UART_LCR_TX_RST 0x00040000
#define IP3106_UART_LCR_RX_RST 0x00020000
#define IP3106_UART_LCR_RX_NEXT 0x00010000
#define IP3106_UART_MCR_SCR 0xFF000000
#define IP3106_UART_MCR_DCD 0x00800000
#define IP3106_UART_MCR_CTS 0x00100000
#define IP3106_UART_MCR_LOOP 0x00000010
#define IP3106_UART_MCR_RTS 0x00000002
#define IP3106_UART_MCR_DTR 0x00000001
#define IP3106_UART_INT_TX 0x00000080
#define IP3106_UART_INT_EMPTY 0x00000040
#define IP3106_UART_INT_RCVTO 0x00000020
#define IP3106_UART_INT_RX 0x00000010
#define IP3106_UART_INT_RXOVRN 0x00000008
#define IP3106_UART_INT_FRERR 0x00000004
#define IP3106_UART_INT_BREAK 0x00000002
#define IP3106_UART_INT_PARITY 0x00000001
#define IP3106_UART_INT_ALLRX 0x0000003F
#define IP3106_UART_INT_ALLTX 0x000000C0
#define IP3106_UART_FIFO_TXFIFO 0x001F0000
#define IP3106_UART_FIFO_TXFIFO_STA (0x1f<<16)
#define IP3106_UART_FIFO_RXBRK 0x00008000
#define IP3106_UART_FIFO_RXFE 0x00004000
#define IP3106_UART_FIFO_RXPAR 0x00002000
#define IP3106_UART_FIFO_RXFIFO 0x00001F00
#define IP3106_UART_FIFO_RBRTHR 0x000000FF
#endif

View File

@@ -137,6 +137,8 @@ struct skb_shared_info {
unsigned int nr_frags;
unsigned short tso_size;
unsigned short tso_segs;
unsigned short ufo_size;
unsigned int ip6_frag_id;
struct sk_buff *frag_list;
skb_frag_t frags[MAX_SKB_FRAGS];
};
@@ -341,6 +343,11 @@ extern void skb_over_panic(struct sk_buff *skb, int len,
extern void skb_under_panic(struct sk_buff *skb, int len,
void *here);
extern int skb_append_datato_frags(struct sock *sk, struct sk_buff *skb,
int getfrag(void *from, char *to, int offset,
int len,int odd, struct sk_buff *skb),
void *from, int length);
struct skb_seq_state
{
__u32 lower_offset;

View File

@@ -57,6 +57,7 @@ struct usb_host_endpoint {
struct usb_endpoint_descriptor desc;
struct list_head urb_list;
void *hcpriv;
struct kobject *kobj; /* For sysfs info */
unsigned char *extra; /* Extra descriptors */
int extralen;
@@ -136,7 +137,8 @@ struct usb_interface {
* active alternate setting */
unsigned num_altsetting; /* number of alternate settings */
int minor; /* minor number this interface is bound to */
int minor; /* minor number this interface is
* bound to */
enum usb_interface_condition condition; /* state of binding */
struct device dev; /* interface specific device info */
struct class_device *class_dev;
@@ -229,7 +231,7 @@ struct usb_interface_cache {
struct usb_host_config {
struct usb_config_descriptor desc;
char *string;
char *string; /* iConfiguration string, if present */
/* the interfaces associated with this configuration,
* stored in no particular order */
struct usb_interface *interface[USB_MAXINTERFACES];
@@ -248,7 +250,7 @@ int __usb_get_extra_descriptor(char *buffer, unsigned size,
__usb_get_extra_descriptor((ifpoint)->extra,(ifpoint)->extralen,\
type,(void**)ptr)
/* -------------------------------------------------------------------------- */
/* ----------------------------------------------------------------------- */
struct usb_operations;
@@ -268,7 +270,8 @@ struct usb_bus {
unsigned is_b_host:1; /* true during some HNP roleswitches */
unsigned b_hnp_enable:1; /* OTG: did A-Host enable HNP? */
int devnum_next; /* Next open device number in round-robin allocation */
int devnum_next; /* Next open device number in
* round-robin allocation */
struct usb_devmap devmap; /* device address allocation map */
struct usb_operations *op; /* Operations (specific to the HC) */
@@ -289,15 +292,16 @@ struct usb_bus {
struct dentry *usbfs_dentry; /* usbfs dentry entry for the bus */
struct class_device *class_dev; /* class device for this bus */
struct kref kref; /* handles reference counting this bus */
void (*release)(struct usb_bus *bus); /* function to destroy this bus's memory */
struct kref kref; /* reference counting for this bus */
void (*release)(struct usb_bus *bus);
#if defined(CONFIG_USB_MON)
struct mon_bus *mon_bus; /* non-null when associated */
int monitored; /* non-zero when monitored */
#endif
};
/* -------------------------------------------------------------------------- */
/* ----------------------------------------------------------------------- */
/* This is arbitrary.
* From USB 2.0 spec Table 11-13, offset 7, a hub can
@@ -326,7 +330,8 @@ struct usb_device {
struct semaphore serialize;
unsigned int toggle[2]; /* one bit for each endpoint ([0] = IN, [1] = OUT) */
unsigned int toggle[2]; /* one bit for each endpoint
* ([0] = IN, [1] = OUT) */
struct usb_device *parent; /* our hub, unless we're the root */
struct usb_bus *bus; /* Bus we're part of */
@@ -343,12 +348,14 @@ struct usb_device {
char **rawdescriptors; /* Raw descriptors for each config */
int have_langid; /* whether string_langid is valid yet */
int have_langid; /* whether string_langid is valid */
int string_langid; /* language ID for strings */
char *product;
char *manufacturer;
char *serial; /* static strings from the device */
/* static strings from the device */
char *product; /* iProduct string, if present */
char *manufacturer; /* iManufacturer string, if present */
char *serial; /* iSerialNumber string, if present */
struct list_head filelist;
struct class_device *class_dev;
struct dentry *usbfs_dentry; /* usbfs dentry entry for the device */
@@ -440,22 +447,31 @@ extern struct usb_host_interface *usb_altnum_to_altsetting(
* USB 2.0 root hubs (EHCI host controllers) will get one path ID if they are
* high speed, and a different one if they are full or low speed.
*/
static inline int usb_make_path (struct usb_device *dev, char *buf, size_t size)
static inline int usb_make_path (struct usb_device *dev, char *buf,
size_t size)
{
int actual;
actual = snprintf (buf, size, "usb-%s-%s", dev->bus->bus_name, dev->devpath);
actual = snprintf (buf, size, "usb-%s-%s", dev->bus->bus_name,
dev->devpath);
return (actual >= (int)size) ? -1 : actual;
}
/*-------------------------------------------------------------------------*/
#define USB_DEVICE_ID_MATCH_DEVICE (USB_DEVICE_ID_MATCH_VENDOR | USB_DEVICE_ID_MATCH_PRODUCT)
#define USB_DEVICE_ID_MATCH_DEV_RANGE (USB_DEVICE_ID_MATCH_DEV_LO | USB_DEVICE_ID_MATCH_DEV_HI)
#define USB_DEVICE_ID_MATCH_DEVICE_AND_VERSION (USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_DEV_RANGE)
#define USB_DEVICE_ID_MATCH_DEVICE \
(USB_DEVICE_ID_MATCH_VENDOR | USB_DEVICE_ID_MATCH_PRODUCT)
#define USB_DEVICE_ID_MATCH_DEV_RANGE \
(USB_DEVICE_ID_MATCH_DEV_LO | USB_DEVICE_ID_MATCH_DEV_HI)
#define USB_DEVICE_ID_MATCH_DEVICE_AND_VERSION \
(USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_DEV_RANGE)
#define USB_DEVICE_ID_MATCH_DEV_INFO \
(USB_DEVICE_ID_MATCH_DEV_CLASS | USB_DEVICE_ID_MATCH_DEV_SUBCLASS | USB_DEVICE_ID_MATCH_DEV_PROTOCOL)
(USB_DEVICE_ID_MATCH_DEV_CLASS | \
USB_DEVICE_ID_MATCH_DEV_SUBCLASS | \
USB_DEVICE_ID_MATCH_DEV_PROTOCOL)
#define USB_DEVICE_ID_MATCH_INT_INFO \
(USB_DEVICE_ID_MATCH_INT_CLASS | USB_DEVICE_ID_MATCH_INT_SUBCLASS | USB_DEVICE_ID_MATCH_INT_PROTOCOL)
(USB_DEVICE_ID_MATCH_INT_CLASS | \
USB_DEVICE_ID_MATCH_INT_SUBCLASS | \
USB_DEVICE_ID_MATCH_INT_PROTOCOL)
/**
* USB_DEVICE - macro used to describe a specific usb device
@@ -466,9 +482,11 @@ static inline int usb_make_path (struct usb_device *dev, char *buf, size_t size)
* specific device.
*/
#define USB_DEVICE(vend,prod) \
.match_flags = USB_DEVICE_ID_MATCH_DEVICE, .idVendor = (vend), .idProduct = (prod)
.match_flags = USB_DEVICE_ID_MATCH_DEVICE, .idVendor = (vend), \
.idProduct = (prod)
/**
* USB_DEVICE_VER - macro used to describe a specific usb device with a version range
* USB_DEVICE_VER - macro used to describe a specific usb device with a
* version range
* @vend: the 16 bit USB Vendor ID
* @prod: the 16 bit USB Product ID
* @lo: the bcdDevice_lo value
@@ -478,7 +496,9 @@ static inline int usb_make_path (struct usb_device *dev, char *buf, size_t size)
* specific device, with a version range.
*/
#define USB_DEVICE_VER(vend,prod,lo,hi) \
.match_flags = USB_DEVICE_ID_MATCH_DEVICE_AND_VERSION, .idVendor = (vend), .idProduct = (prod), .bcdDevice_lo = (lo), .bcdDevice_hi = (hi)
.match_flags = USB_DEVICE_ID_MATCH_DEVICE_AND_VERSION, \
.idVendor = (vend), .idProduct = (prod), \
.bcdDevice_lo = (lo), .bcdDevice_hi = (hi)
/**
* USB_DEVICE_INFO - macro used to describe a class of usb devices
@@ -490,7 +510,8 @@ static inline int usb_make_path (struct usb_device *dev, char *buf, size_t size)
* specific class of devices.
*/
#define USB_DEVICE_INFO(cl,sc,pr) \
.match_flags = USB_DEVICE_ID_MATCH_DEV_INFO, .bDeviceClass = (cl), .bDeviceSubClass = (sc), .bDeviceProtocol = (pr)
.match_flags = USB_DEVICE_ID_MATCH_DEV_INFO, .bDeviceClass = (cl), \
.bDeviceSubClass = (sc), .bDeviceProtocol = (pr)
/**
* USB_INTERFACE_INFO - macro used to describe a class of usb interfaces
@@ -502,9 +523,10 @@ static inline int usb_make_path (struct usb_device *dev, char *buf, size_t size)
* specific class of interfaces.
*/
#define USB_INTERFACE_INFO(cl,sc,pr) \
.match_flags = USB_DEVICE_ID_MATCH_INT_INFO, .bInterfaceClass = (cl), .bInterfaceSubClass = (sc), .bInterfaceProtocol = (pr)
.match_flags = USB_DEVICE_ID_MATCH_INT_INFO, .bInterfaceClass = (cl), \
.bInterfaceSubClass = (sc), .bInterfaceProtocol = (pr)
/* -------------------------------------------------------------------------- */
/* ----------------------------------------------------------------------- */
/**
* struct usb_driver - identifies USB driver to usbcore
@@ -557,7 +579,8 @@ struct usb_driver {
void (*disconnect) (struct usb_interface *intf);
int (*ioctl) (struct usb_interface *intf, unsigned int code, void *buf);
int (*ioctl) (struct usb_interface *intf, unsigned int code,
void *buf);
int (*suspend) (struct usb_interface *intf, pm_message_t message);
int (*resume) (struct usb_interface *intf);
@@ -572,10 +595,8 @@ extern struct bus_type usb_bus_type;
/**
* struct usb_class_driver - identifies a USB driver that wants to use the USB major number
* @name: devfs name for this driver. Will also be used by the driver
* class code to create a usb class device.
* @name: the usb class device name for this driver. Will show up in sysfs.
* @fops: pointer to the struct file_operations of this driver.
* @mode: the mode for the devfs file to be created for this driver.
* @minor_base: the start of the minor range for this driver.
*
* This structure is used for the usb_register_dev() and
@@ -585,8 +606,7 @@ extern struct bus_type usb_bus_type;
struct usb_class_driver {
char *name;
struct file_operations *fops;
mode_t mode;
int minor_base;
int minor_base;
};
/*
@@ -603,7 +623,7 @@ extern void usb_deregister_dev(struct usb_interface *intf,
extern int usb_disabled(void);
/* -------------------------------------------------------------------------- */
/* ----------------------------------------------------------------------- */
/*
* URB support, for asynchronous request completions
@@ -613,12 +633,14 @@ extern int usb_disabled(void);
* urb->transfer_flags:
*/
#define URB_SHORT_NOT_OK 0x0001 /* report short reads as errors */
#define URB_ISO_ASAP 0x0002 /* iso-only, urb->start_frame ignored */
#define URB_ISO_ASAP 0x0002 /* iso-only, urb->start_frame
* ignored */
#define URB_NO_TRANSFER_DMA_MAP 0x0004 /* urb->transfer_dma valid on submit */
#define URB_NO_SETUP_DMA_MAP 0x0008 /* urb->setup_dma valid on submit */
#define URB_NO_FSBR 0x0020 /* UHCI-specific */
#define URB_ZERO_PACKET 0x0040 /* Finish bulk OUTs with short packet */
#define URB_NO_INTERRUPT 0x0080 /* HINT: no non-error interrupt needed */
#define URB_ZERO_PACKET 0x0040 /* Finish bulk OUT with short packet */
#define URB_NO_INTERRUPT 0x0080 /* HINT: no non-error interrupt
* needed */
struct usb_iso_packet_descriptor {
unsigned int offset;
@@ -806,7 +828,8 @@ struct urb
u8 reject; /* submissions will fail */
/* public, documented fields in the urb that can be used by drivers */
struct list_head urb_list; /* list head for use by the urb owner */
struct list_head urb_list; /* list head for use by the urb's
* current owner */
struct usb_device *dev; /* (in) pointer to associated device */
unsigned int pipe; /* (in) pipe information */
int status; /* (return) non-ISO status */
@@ -819,14 +842,16 @@ struct urb
dma_addr_t setup_dma; /* (in) dma addr for setup_packet */
int start_frame; /* (modify) start frame (ISO) */
int number_of_packets; /* (in) number of ISO packets */
int interval; /* (modify) transfer interval (INT/ISO) */
int interval; /* (modify) transfer interval
* (INT/ISO) */
int error_count; /* (return) number of ISO errors */
void *context; /* (in) context for completion */
usb_complete_t complete; /* (in) completion routine */
struct usb_iso_packet_descriptor iso_frame_desc[0]; /* (in) ISO ONLY */
struct usb_iso_packet_descriptor iso_frame_desc[0];
/* (in) ISO ONLY */
};
/* -------------------------------------------------------------------------- */
/* ----------------------------------------------------------------------- */
/**
* usb_fill_control_urb - initializes a control urb
@@ -974,11 +999,6 @@ extern int usb_bulk_msg(struct usb_device *usb_dev, unsigned int pipe,
void *data, int len, int *actual_length,
int timeout);
/* selective suspend/resume */
extern int usb_suspend_device(struct usb_device *dev, pm_message_t message);
extern int usb_resume_device(struct usb_device *dev);
/* wrappers around usb_control_msg() for the most common standard requests */
extern int usb_get_descriptor(struct usb_device *dev, unsigned char desctype,
unsigned char descindex, void *buf, int size);
@@ -1056,7 +1076,7 @@ void usb_sg_cancel (struct usb_sg_request *io);
void usb_sg_wait (struct usb_sg_request *io);
/* -------------------------------------------------------------------------- */
/* ----------------------------------------------------------------------- */
/*
* For various legacy reasons, Linux has a small cookie that's paired with
@@ -1097,23 +1117,34 @@ void usb_sg_wait (struct usb_sg_request *io);
/* The D0/D1 toggle bits ... USE WITH CAUTION (they're almost hcd-internal) */
#define usb_gettoggle(dev, ep, out) (((dev)->toggle[out] >> (ep)) & 1)
#define usb_dotoggle(dev, ep, out) ((dev)->toggle[out] ^= (1 << (ep)))
#define usb_settoggle(dev, ep, out, bit) ((dev)->toggle[out] = ((dev)->toggle[out] & ~(1 << (ep))) | ((bit) << (ep)))
#define usb_settoggle(dev, ep, out, bit) \
((dev)->toggle[out] = ((dev)->toggle[out] & ~(1 << (ep))) | \
((bit) << (ep)))
static inline unsigned int __create_pipe(struct usb_device *dev, unsigned int endpoint)
static inline unsigned int __create_pipe(struct usb_device *dev,
unsigned int endpoint)
{
return (dev->devnum << 8) | (endpoint << 15);
}
/* Create various pipes... */
#define usb_sndctrlpipe(dev,endpoint) ((PIPE_CONTROL << 30) | __create_pipe(dev,endpoint))
#define usb_rcvctrlpipe(dev,endpoint) ((PIPE_CONTROL << 30) | __create_pipe(dev,endpoint) | USB_DIR_IN)
#define usb_sndisocpipe(dev,endpoint) ((PIPE_ISOCHRONOUS << 30) | __create_pipe(dev,endpoint))
#define usb_rcvisocpipe(dev,endpoint) ((PIPE_ISOCHRONOUS << 30) | __create_pipe(dev,endpoint) | USB_DIR_IN)
#define usb_sndbulkpipe(dev,endpoint) ((PIPE_BULK << 30) | __create_pipe(dev,endpoint))
#define usb_rcvbulkpipe(dev,endpoint) ((PIPE_BULK << 30) | __create_pipe(dev,endpoint) | USB_DIR_IN)
#define usb_sndintpipe(dev,endpoint) ((PIPE_INTERRUPT << 30) | __create_pipe(dev,endpoint))
#define usb_rcvintpipe(dev,endpoint) ((PIPE_INTERRUPT << 30) | __create_pipe(dev,endpoint) | USB_DIR_IN)
#define usb_sndctrlpipe(dev,endpoint) \
((PIPE_CONTROL << 30) | __create_pipe(dev,endpoint))
#define usb_rcvctrlpipe(dev,endpoint) \
((PIPE_CONTROL << 30) | __create_pipe(dev,endpoint) | USB_DIR_IN)
#define usb_sndisocpipe(dev,endpoint) \
((PIPE_ISOCHRONOUS << 30) | __create_pipe(dev,endpoint))
#define usb_rcvisocpipe(dev,endpoint) \
((PIPE_ISOCHRONOUS << 30) | __create_pipe(dev,endpoint) | USB_DIR_IN)
#define usb_sndbulkpipe(dev,endpoint) \
((PIPE_BULK << 30) | __create_pipe(dev,endpoint))
#define usb_rcvbulkpipe(dev,endpoint) \
((PIPE_BULK << 30) | __create_pipe(dev,endpoint) | USB_DIR_IN)
#define usb_sndintpipe(dev,endpoint) \
((PIPE_INTERRUPT << 30) | __create_pipe(dev,endpoint))
#define usb_rcvintpipe(dev,endpoint) \
((PIPE_INTERRUPT << 30) | __create_pipe(dev,endpoint) | USB_DIR_IN)
/*-------------------------------------------------------------------------*/
@@ -1137,17 +1168,29 @@ usb_maxpacket(struct usb_device *udev, int pipe, int is_out)
return le16_to_cpu(ep->desc.wMaxPacketSize);
}
/* -------------------------------------------------------------------------- */
/* ----------------------------------------------------------------------- */
/* Events from the usb core */
#define USB_DEVICE_ADD 0x0001
#define USB_DEVICE_REMOVE 0x0002
#define USB_BUS_ADD 0x0003
#define USB_BUS_REMOVE 0x0004
extern void usb_register_notify(struct notifier_block *nb);
extern void usb_unregister_notify(struct notifier_block *nb);
#ifdef DEBUG
#define dbg(format, arg...) printk(KERN_DEBUG "%s: " format "\n" , __FILE__ , ## arg)
#define dbg(format, arg...) printk(KERN_DEBUG "%s: " format "\n" , \
__FILE__ , ## arg)
#else
#define dbg(format, arg...) do {} while (0)
#endif
#define err(format, arg...) printk(KERN_ERR "%s: " format "\n" , __FILE__ , ## arg)
#define info(format, arg...) printk(KERN_INFO "%s: " format "\n" , __FILE__ , ## arg)
#define warn(format, arg...) printk(KERN_WARNING "%s: " format "\n" , __FILE__ , ## arg)
#define err(format, arg...) printk(KERN_ERR "%s: " format "\n" , \
__FILE__ , ## arg)
#define info(format, arg...) printk(KERN_INFO "%s: " format "\n" , \
__FILE__ , ## arg)
#define warn(format, arg...) printk(KERN_WARNING "%s: " format "\n" , \
__FILE__ , ## arg)
#endif /* __KERNEL__ */

View File

@@ -63,6 +63,10 @@ struct otg_transceiver {
int (*set_power)(struct otg_transceiver *otg,
unsigned mA);
/* for non-OTG B devices: set transceiver into suspend mode */
int (*set_suspend)(struct otg_transceiver *otg,
int suspend);
/* for B devices only: start session with A-Host */
int (*start_srp)(struct otg_transceiver *otg);
@@ -107,6 +111,15 @@ otg_set_power(struct otg_transceiver *otg, unsigned mA)
return otg->set_power(otg, mA);
}
static inline int
otg_set_suspend(struct otg_transceiver *otg, int suspend)
{
if (otg->set_suspend != NULL)
return otg->set_suspend(otg, suspend);
else
return 0;
}
static inline int
otg_start_srp(struct otg_transceiver *otg)
{

View File

@@ -140,6 +140,12 @@ struct usbdevfs_urb32 {
compat_caddr_t usercontext; /* unused */
struct usbdevfs_iso_packet_desc iso_frame_desc[0];
};
struct usbdevfs_ioctl32 {
s32 ifno;
s32 ioctl_code;
compat_caddr_t data;
};
#endif
#define USBDEVFS_CONTROL _IOWR('U', 0, struct usbdevfs_ctrltransfer)
@@ -160,6 +166,7 @@ struct usbdevfs_urb32 {
#define USBDEVFS_RELEASEINTERFACE _IOR('U', 16, unsigned int)
#define USBDEVFS_CONNECTINFO _IOW('U', 17, struct usbdevfs_connectinfo)
#define USBDEVFS_IOCTL _IOWR('U', 18, struct usbdevfs_ioctl)
#define USBDEVFS_IOCTL32 _IOWR('U', 18, struct usbdevfs_ioctl32)
#define USBDEVFS_HUB_PORTINFO _IOR('U', 19, struct usbdevfs_hub_portinfo)
#define USBDEVFS_RESET _IO('U', 20)
#define USBDEVFS_CLEAR_HALT _IOR('U', 21, unsigned int)

View File

@@ -32,10 +32,14 @@ struct vm_struct {
* Highlevel APIs for driver use
*/
extern void *vmalloc(unsigned long size);
extern void *vmalloc_node(unsigned long size, int node);
extern void *vmalloc_exec(unsigned long size);
extern void *vmalloc_32(unsigned long size);
extern void *__vmalloc(unsigned long size, gfp_t gfp_mask, pgprot_t prot);
extern void *__vmalloc_area(struct vm_struct *area, gfp_t gfp_mask, pgprot_t prot);
extern void *__vmalloc_area(struct vm_struct *area, gfp_t gfp_mask,
pgprot_t prot);
extern void *__vmalloc_node(unsigned long size, gfp_t gfp_mask,
pgprot_t prot, int node);
extern void vfree(void *addr);
extern void *vmap(struct page **pages, unsigned int count,
@@ -48,6 +52,8 @@ extern void vunmap(void *addr);
extern struct vm_struct *get_vm_area(unsigned long size, unsigned long flags);
extern struct vm_struct *__get_vm_area(unsigned long size, unsigned long flags,
unsigned long start, unsigned long end);
extern struct vm_struct *get_vm_area_node(unsigned long size,
unsigned long flags, int node);
extern struct vm_struct *remove_vm_area(void *addr);
extern struct vm_struct *__remove_vm_area(void *addr);
extern int map_vm_area(struct vm_struct *area, pgprot_t prot,

31
include/linux/x1205.h Normal file
View File

@@ -0,0 +1,31 @@
/*
* x1205.h - defines for drivers/i2c/chips/x1205.c
* Copyright 2004 Karen Spearel
* Copyright 2005 Alessandro Zummo
*
* 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.
*/
#ifndef __LINUX_X1205_H__
#define __LINUX_X1205_H__
/* commands */
#define X1205_CMD_GETDATETIME 0
#define X1205_CMD_SETTIME 1
#define X1205_CMD_SETDATETIME 2
#define X1205_CMD_GETALARM 3
#define X1205_CMD_SETALARM 4
#define X1205_CMD_GETDTRIM 5
#define X1205_CMD_SETDTRIM 6
#define X1205_CMD_GETATRIM 7
#define X1205_CMD_SETATRIM 8
extern int x1205_do_command(unsigned int cmd, void *arg);
extern int x1205_direct_attach(int adapter_id,
struct i2c_client_address_data *address_data);
#endif /* __LINUX_X1205_H__ */