mirror of https://gitee.com/openkylin/linux.git
Merge branch 'staging-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging
* 'staging-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (466 commits) net/hyperv: Add support for jumbo frame up to 64KB net/hyperv: Add NETVSP protocol version negotiation net/hyperv: Remove unnecessary kmap_atomic in netvsc driver staging/rtl8192e: Register against lib80211 staging/rtl8192e: Convert to lib80211_crypt_info staging/rtl8192e: Convert to lib80211_crypt_data and lib80211_crypt_ops staging/rtl8192e: Add lib80211.h to rtllib.h staging/mei: add watchdog device registration wrappers drm/omap: GEM, deal with cache staging: vt6656: int.c, int.h: Change return of function to void staging: usbip: removed unused definitions from header staging: usbip: removed dead code from receive function staging:iio: Drop {mark,unmark}_in_use callbacks staging:iio: Drop buffer mark_param_change callback staging:iio: Drop the unused buffer enable() and is_enabled() callbacks staging:iio: Drop buffer busy flag staging:iio: Make sure a device is only opened once at a time staging:iio: Disallow modifying buffer size when buffer is enabled staging:iio: Disallow changing scan elements in all buffered modes staging:iio: Use iio_buffer_enabled instead of open coding it ... Fix up conflict in drivers/staging/iio/adc/ad799x_core.c (removal of module_init due to using module_i2c_driver() helper, next to removal of MODULE_ALIAS due to using MODULE_DEVICE_TABLE instead).
This commit is contained in:
commit
12e5550892
|
@ -0,0 +1,9 @@
|
|||
NVIDIA compliant embedded controller
|
||||
|
||||
Required properties:
|
||||
- compatible : should be "nvidia,nvec".
|
||||
- reg : the iomem of the i2c slave controller
|
||||
- interrupts : the interrupt line of the i2c slave controller
|
||||
- clock-frequency : the frequency of the i2c bus
|
||||
- gpios : the gpio used for ec request
|
||||
- slave-addr: the i2c address of the slave controller
|
39
MAINTAINERS
39
MAINTAINERS
|
@ -184,11 +184,6 @@ S: Maintained
|
|||
F: Documentation/filesystems/9p.txt
|
||||
F: fs/9p/
|
||||
|
||||
A2232 SERIAL BOARD DRIVER
|
||||
L: linux-m68k@lists.linux-m68k.org
|
||||
S: Orphan
|
||||
F: drivers/staging/generic_serial/ser_a2232*
|
||||
|
||||
AACRAID SCSI RAID DRIVER
|
||||
M: Adaptec OEM Raid Solutions <aacraid@adaptec.com>
|
||||
L: linux-scsi@vger.kernel.org
|
||||
|
@ -1587,7 +1582,7 @@ M: Franky (Zhenhui) Lin <frankyl@broadcom.com>
|
|||
M: Kan Yan <kanyan@broadcom.com>
|
||||
L: linux-wireless@vger.kernel.org
|
||||
S: Supported
|
||||
F: drivers/staging/brcm80211/
|
||||
F: drivers/net/wireless/brcm80211/
|
||||
|
||||
BROADCOM BNX2FC 10 GIGABIT FCOE DRIVER
|
||||
M: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
|
||||
|
@ -1891,12 +1886,6 @@ L: platform-driver-x86@vger.kernel.org
|
|||
S: Maintained
|
||||
F: drivers/platform/x86/compal-laptop.c
|
||||
|
||||
COMPUTONE INTELLIPORT MULTIPORT CARD
|
||||
W: http://www.wittsend.com/computone.html
|
||||
S: Orphan
|
||||
F: Documentation/serial/computone.txt
|
||||
F: drivers/staging/tty/ip2/
|
||||
|
||||
CONEXANT ACCESSRUNNER USB DRIVER
|
||||
M: Simon Arlott <cxacru@fire.lp0.eu>
|
||||
L: accessrunner-general@lists.sourceforge.net
|
||||
|
@ -2200,15 +2189,6 @@ F: drivers/md/dm*
|
|||
F: include/linux/device-mapper.h
|
||||
F: include/linux/dm-*.h
|
||||
|
||||
DIGI INTL. EPCA DRIVER
|
||||
M: "Digi International, Inc" <Eng.Linux@digi.com>
|
||||
L: Eng.Linux@digi.com
|
||||
W: http://www.digi.com
|
||||
S: Orphan
|
||||
F: Documentation/serial/digiepca.txt
|
||||
F: drivers/staging/tty/epca*
|
||||
F: drivers/staging/tty/digi*
|
||||
|
||||
DIOLAN U2C-12 I2C DRIVER
|
||||
M: Guenter Roeck <guenter.roeck@ericsson.com>
|
||||
L: linux-i2c@vger.kernel.org
|
||||
|
@ -5555,11 +5535,6 @@ M: Maxim Levitsky <maximlevitsky@gmail.com>
|
|||
S: Maintained
|
||||
F: drivers/memstick/host/r592.*
|
||||
|
||||
RISCOM8 DRIVER
|
||||
S: Orphan
|
||||
F: Documentation/serial/riscom8.txt
|
||||
F: drivers/staging/tty/riscom8*
|
||||
|
||||
ROCKETPORT DRIVER
|
||||
P: Comtrol Corp.
|
||||
W: http://www.comtrol.com
|
||||
|
@ -6222,11 +6197,6 @@ F: arch/arm/mach-spear3xx/spear3*0_evb.c
|
|||
F: arch/arm/mach-spear6xx/spear600.c
|
||||
F: arch/arm/mach-spear6xx/spear600_evb.c
|
||||
|
||||
SPECIALIX IO8+ MULTIPORT SERIAL CARD DRIVER
|
||||
S: Orphan
|
||||
F: Documentation/serial/specialix.txt
|
||||
F: drivers/staging/tty/specialix*
|
||||
|
||||
SPI SUBSYSTEM
|
||||
M: Grant Likely <grant.likely@secretlab.ca>
|
||||
L: spi-devel-general@lists.sourceforge.net
|
||||
|
@ -6304,11 +6274,6 @@ M: Manu Abraham <abraham.manu@gmail.com>
|
|||
S: Odd Fixes
|
||||
F: drivers/staging/crystalhd/
|
||||
|
||||
STAGING - CYPRESS WESTBRIDGE SUPPORT
|
||||
M: David Cross <david.cross@cypress.com>
|
||||
S: Odd Fixes
|
||||
F: drivers/staging/westbridge/
|
||||
|
||||
STAGING - ECHO CANCELLER
|
||||
M: Steve Underwood <steveu@coppice.org>
|
||||
M: David Rowe <david@rowetel.com>
|
||||
|
@ -6414,7 +6379,7 @@ S: Odd Fixes
|
|||
F: drivers/staging/winbond/
|
||||
|
||||
STAGING - XGI Z7,Z9,Z11 PCI DISPLAY DRIVER
|
||||
M: Arnaud Patard <apatard@mandriva.com>
|
||||
M: Arnaud Patard <arnaud.patard@rtp-net.org>
|
||||
S: Odd Fixes
|
||||
F: drivers/staging/xgifb/
|
||||
|
||||
|
|
|
@ -342,4 +342,6 @@ config VMXNET3
|
|||
To compile this driver as a module, choose M here: the
|
||||
module will be called vmxnet3.
|
||||
|
||||
source "drivers/net/hyperv/Kconfig"
|
||||
|
||||
endif # NETDEVICES
|
||||
|
|
|
@ -68,3 +68,5 @@ obj-$(CONFIG_USB_USBNET) += usb/
|
|||
obj-$(CONFIG_USB_ZD1201) += usb/
|
||||
obj-$(CONFIG_USB_IPHETH) += usb/
|
||||
obj-$(CONFIG_USB_CDC_PHONET) += usb/
|
||||
|
||||
obj-$(CONFIG_HYPERV_NET) += hyperv/
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
config HYPERV_NET
|
||||
tristate "Microsoft Hyper-V virtual network driver"
|
||||
depends on HYPERV
|
||||
help
|
||||
Select this option to enable the Hyper-V virtual network driver.
|
|
@ -0,0 +1,3 @@
|
|||
obj-$(CONFIG_HYPERV_NET) += hv_netvsc.o
|
||||
|
||||
hv_netvsc-y := netvsc_drv.o netvsc.o rndis_filter.o
|
|
@ -39,9 +39,6 @@ struct xferpage_packet {
|
|||
u32 count;
|
||||
};
|
||||
|
||||
/* The number of pages which are enough to cover jumbo frame buffer. */
|
||||
#define NETVSC_PACKET_MAXPAGE 4
|
||||
|
||||
/*
|
||||
* Represent netvsc packet which contains 1 RNDIS and 1 ethernet frame
|
||||
* within the RNDIS
|
||||
|
@ -77,8 +74,9 @@ struct hv_netvsc_packet {
|
|||
|
||||
u32 total_data_buflen;
|
||||
/* Points to the send/receive buffer where the ethernet frame is */
|
||||
void *data;
|
||||
u32 page_buf_cnt;
|
||||
struct hv_page_buffer page_buf[NETVSC_PACKET_MAXPAGE];
|
||||
struct hv_page_buffer page_buf[0];
|
||||
};
|
||||
|
||||
struct netvsc_device_info {
|
||||
|
@ -87,6 +85,27 @@ struct netvsc_device_info {
|
|||
int ring_size;
|
||||
};
|
||||
|
||||
enum rndis_device_state {
|
||||
RNDIS_DEV_UNINITIALIZED = 0,
|
||||
RNDIS_DEV_INITIALIZING,
|
||||
RNDIS_DEV_INITIALIZED,
|
||||
RNDIS_DEV_DATAINITIALIZED,
|
||||
};
|
||||
|
||||
struct rndis_device {
|
||||
struct netvsc_device *net_dev;
|
||||
|
||||
enum rndis_device_state state;
|
||||
bool link_state;
|
||||
atomic_t new_req_id;
|
||||
|
||||
spinlock_t request_lock;
|
||||
struct list_head req_list;
|
||||
|
||||
unsigned char hw_mac_adr[ETH_ALEN];
|
||||
};
|
||||
|
||||
|
||||
/* Interface */
|
||||
int netvsc_device_add(struct hv_device *device, void *additional_info);
|
||||
int netvsc_device_remove(struct hv_device *device);
|
||||
|
@ -109,11 +128,13 @@ int rndis_filter_receive(struct hv_device *dev,
|
|||
int rndis_filter_send(struct hv_device *dev,
|
||||
struct hv_netvsc_packet *pkt);
|
||||
|
||||
int rndis_filter_set_packet_filter(struct rndis_device *dev, u32 new_filter);
|
||||
|
||||
|
||||
#define NVSP_INVALID_PROTOCOL_VERSION ((u32)0xFFFFFFFF)
|
||||
|
||||
#define NVSP_PROTOCOL_VERSION_1 2
|
||||
#define NVSP_MIN_PROTOCOL_VERSION NVSP_PROTOCOL_VERSION_1
|
||||
#define NVSP_MAX_PROTOCOL_VERSION NVSP_PROTOCOL_VERSION_1
|
||||
#define NVSP_PROTOCOL_VERSION_2 0x30002
|
||||
|
||||
enum {
|
||||
NVSP_MSG_TYPE_NONE = 0,
|
||||
|
@ -138,11 +159,36 @@ enum {
|
|||
NVSP_MSG1_TYPE_SEND_RNDIS_PKT,
|
||||
NVSP_MSG1_TYPE_SEND_RNDIS_PKT_COMPLETE,
|
||||
|
||||
/*
|
||||
* This should be set to the number of messages for the version with
|
||||
* the maximum number of messages.
|
||||
*/
|
||||
NVSP_NUM_MSG_PER_VERSION = 9,
|
||||
/* Version 2 messages */
|
||||
NVSP_MSG2_TYPE_SEND_CHIMNEY_DELEGATED_BUF,
|
||||
NVSP_MSG2_TYPE_SEND_CHIMNEY_DELEGATED_BUF_COMP,
|
||||
NVSP_MSG2_TYPE_REVOKE_CHIMNEY_DELEGATED_BUF,
|
||||
|
||||
NVSP_MSG2_TYPE_RESUME_CHIMNEY_RX_INDICATION,
|
||||
|
||||
NVSP_MSG2_TYPE_TERMINATE_CHIMNEY,
|
||||
NVSP_MSG2_TYPE_TERMINATE_CHIMNEY_COMP,
|
||||
|
||||
NVSP_MSG2_TYPE_INDICATE_CHIMNEY_EVENT,
|
||||
|
||||
NVSP_MSG2_TYPE_SEND_CHIMNEY_PKT,
|
||||
NVSP_MSG2_TYPE_SEND_CHIMNEY_PKT_COMP,
|
||||
|
||||
NVSP_MSG2_TYPE_POST_CHIMNEY_RECV_REQ,
|
||||
NVSP_MSG2_TYPE_POST_CHIMNEY_RECV_REQ_COMP,
|
||||
|
||||
NVSP_MSG2_TYPE_ALLOC_RXBUF,
|
||||
NVSP_MSG2_TYPE_ALLOC_RXBUF_COMP,
|
||||
|
||||
NVSP_MSG2_TYPE_FREE_RXBUF,
|
||||
|
||||
NVSP_MSG2_TYPE_SEND_VMQ_RNDIS_PKT,
|
||||
NVSP_MSG2_TYPE_SEND_VMQ_RNDIS_PKT_COMP,
|
||||
|
||||
NVSP_MSG2_TYPE_SEND_NDIS_CONFIG,
|
||||
|
||||
NVSP_MSG2_TYPE_ALLOC_CHIMNEY_HANDLE,
|
||||
NVSP_MSG2_TYPE_ALLOC_CHIMNEY_HANDLE_COMP,
|
||||
};
|
||||
|
||||
enum {
|
||||
|
@ -153,6 +199,7 @@ enum {
|
|||
NVSP_STAT_PROTOCOL_TOO_OLD,
|
||||
NVSP_STAT_INVALID_RNDIS_PKT,
|
||||
NVSP_STAT_BUSY,
|
||||
NVSP_STAT_PROTOCOL_UNSUPPORTED,
|
||||
NVSP_STAT_MAX,
|
||||
};
|
||||
|
||||
|
@ -337,9 +384,69 @@ union nvsp_1_message_uber {
|
|||
send_rndis_pkt_complete;
|
||||
} __packed;
|
||||
|
||||
|
||||
/*
|
||||
* Network VSP protocol version 2 messages:
|
||||
*/
|
||||
struct nvsp_2_vsc_capability {
|
||||
union {
|
||||
u64 data;
|
||||
struct {
|
||||
u64 vmq:1;
|
||||
u64 chimney:1;
|
||||
u64 sriov:1;
|
||||
u64 ieee8021q:1;
|
||||
u64 correlation_id:1;
|
||||
};
|
||||
};
|
||||
} __packed;
|
||||
|
||||
struct nvsp_2_send_ndis_config {
|
||||
u32 mtu;
|
||||
u32 reserved;
|
||||
struct nvsp_2_vsc_capability capability;
|
||||
} __packed;
|
||||
|
||||
/* Allocate receive buffer */
|
||||
struct nvsp_2_alloc_rxbuf {
|
||||
/* Allocation ID to match the allocation request and response */
|
||||
u32 alloc_id;
|
||||
|
||||
/* Length of the VM shared memory receive buffer that needs to
|
||||
* be allocated
|
||||
*/
|
||||
u32 len;
|
||||
} __packed;
|
||||
|
||||
/* Allocate receive buffer complete */
|
||||
struct nvsp_2_alloc_rxbuf_comp {
|
||||
/* The NDIS_STATUS code for buffer allocation */
|
||||
u32 status;
|
||||
|
||||
u32 alloc_id;
|
||||
|
||||
/* GPADL handle for the allocated receive buffer */
|
||||
u32 gpadl_handle;
|
||||
|
||||
/* Receive buffer ID */
|
||||
u64 recv_buf_id;
|
||||
} __packed;
|
||||
|
||||
struct nvsp_2_free_rxbuf {
|
||||
u64 recv_buf_id;
|
||||
} __packed;
|
||||
|
||||
union nvsp_2_message_uber {
|
||||
struct nvsp_2_send_ndis_config send_ndis_config;
|
||||
struct nvsp_2_alloc_rxbuf alloc_rxbuf;
|
||||
struct nvsp_2_alloc_rxbuf_comp alloc_rxbuf_comp;
|
||||
struct nvsp_2_free_rxbuf free_rxbuf;
|
||||
} __packed;
|
||||
|
||||
union nvsp_all_messages {
|
||||
union nvsp_message_init_uber init_msg;
|
||||
union nvsp_1_message_uber v1_msg;
|
||||
union nvsp_2_message_uber v2_msg;
|
||||
} __packed;
|
||||
|
||||
/* ALL Messages */
|
||||
|
@ -349,12 +456,9 @@ struct nvsp_message {
|
|||
} __packed;
|
||||
|
||||
|
||||
#define NETVSC_MTU 65536
|
||||
|
||||
|
||||
/* #define NVSC_MIN_PROTOCOL_VERSION 1 */
|
||||
/* #define NVSC_MAX_PROTOCOL_VERSION 1 */
|
||||
|
||||
#define NETVSC_RECEIVE_BUFFER_SIZE (1024*1024) /* 1MB */
|
||||
#define NETVSC_RECEIVE_BUFFER_SIZE (1024*1024*2) /* 2MB */
|
||||
|
||||
#define NETVSC_RECEIVE_BUFFER_ID 0xcafe
|
||||
|
||||
|
@ -369,7 +473,10 @@ struct nvsp_message {
|
|||
struct netvsc_device {
|
||||
struct hv_device *dev;
|
||||
|
||||
u32 nvsp_version;
|
||||
|
||||
atomic_t num_outstanding_sends;
|
||||
bool start_remove;
|
||||
bool destroy;
|
||||
/*
|
||||
* List of free preallocated hv_netvsc_packet to represent receive
|
|
@ -28,6 +28,7 @@
|
|||
#include <linux/io.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/netdevice.h>
|
||||
#include <linux/if_ether.h>
|
||||
|
||||
#include "hyperv_net.h"
|
||||
|
||||
|
@ -41,7 +42,7 @@ static struct netvsc_device *alloc_net_device(struct hv_device *device)
|
|||
if (!net_device)
|
||||
return NULL;
|
||||
|
||||
|
||||
net_device->start_remove = false;
|
||||
net_device->destroy = false;
|
||||
net_device->dev = device;
|
||||
net_device->ndev = ndev;
|
||||
|
@ -230,19 +231,16 @@ static int netvsc_init_recv_buf(struct hv_device *device)
|
|||
net_device->recv_section_cnt = init_packet->msg.
|
||||
v1_msg.send_recv_buf_complete.num_sections;
|
||||
|
||||
net_device->recv_section = kmalloc(net_device->recv_section_cnt
|
||||
* sizeof(struct nvsp_1_receive_buffer_section), GFP_KERNEL);
|
||||
net_device->recv_section = kmemdup(
|
||||
init_packet->msg.v1_msg.send_recv_buf_complete.sections,
|
||||
net_device->recv_section_cnt *
|
||||
sizeof(struct nvsp_1_receive_buffer_section),
|
||||
GFP_KERNEL);
|
||||
if (net_device->recv_section == NULL) {
|
||||
ret = -EINVAL;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
memcpy(net_device->recv_section,
|
||||
init_packet->msg.v1_msg.
|
||||
send_recv_buf_complete.sections,
|
||||
net_device->recv_section_cnt *
|
||||
sizeof(struct nvsp_1_receive_buffer_section));
|
||||
|
||||
/*
|
||||
* For 1st release, there should only be 1 section that represents the
|
||||
* entire receive buffer
|
||||
|
@ -263,9 +261,57 @@ static int netvsc_init_recv_buf(struct hv_device *device)
|
|||
}
|
||||
|
||||
|
||||
static int netvsc_connect_vsp(struct hv_device *device)
|
||||
/* Negotiate NVSP protocol version */
|
||||
static int negotiate_nvsp_ver(struct hv_device *device,
|
||||
struct netvsc_device *net_device,
|
||||
struct nvsp_message *init_packet,
|
||||
u32 nvsp_ver)
|
||||
{
|
||||
int ret, t;
|
||||
|
||||
memset(init_packet, 0, sizeof(struct nvsp_message));
|
||||
init_packet->hdr.msg_type = NVSP_MSG_TYPE_INIT;
|
||||
init_packet->msg.init_msg.init.min_protocol_ver = nvsp_ver;
|
||||
init_packet->msg.init_msg.init.max_protocol_ver = nvsp_ver;
|
||||
|
||||
/* Send the init request */
|
||||
ret = vmbus_sendpacket(device->channel, init_packet,
|
||||
sizeof(struct nvsp_message),
|
||||
(unsigned long)init_packet,
|
||||
VM_PKT_DATA_INBAND,
|
||||
VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);
|
||||
|
||||
if (ret != 0)
|
||||
return ret;
|
||||
|
||||
t = wait_for_completion_timeout(&net_device->channel_init_wait, 5*HZ);
|
||||
|
||||
if (t == 0)
|
||||
return -ETIMEDOUT;
|
||||
|
||||
if (init_packet->msg.init_msg.init_complete.status !=
|
||||
NVSP_STAT_SUCCESS)
|
||||
return -EINVAL;
|
||||
|
||||
if (nvsp_ver != NVSP_PROTOCOL_VERSION_2)
|
||||
return 0;
|
||||
|
||||
/* NVSPv2 only: Send NDIS config */
|
||||
memset(init_packet, 0, sizeof(struct nvsp_message));
|
||||
init_packet->hdr.msg_type = NVSP_MSG2_TYPE_SEND_NDIS_CONFIG;
|
||||
init_packet->msg.v2_msg.send_ndis_config.mtu = net_device->ndev->mtu;
|
||||
|
||||
ret = vmbus_sendpacket(device->channel, init_packet,
|
||||
sizeof(struct nvsp_message),
|
||||
(unsigned long)init_packet,
|
||||
VM_PKT_DATA_INBAND, 0);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int netvsc_connect_vsp(struct hv_device *device)
|
||||
{
|
||||
int ret;
|
||||
struct netvsc_device *net_device;
|
||||
struct nvsp_message *init_packet;
|
||||
int ndis_version;
|
||||
|
@ -278,41 +324,20 @@ static int netvsc_connect_vsp(struct hv_device *device)
|
|||
|
||||
init_packet = &net_device->channel_init_pkt;
|
||||
|
||||
memset(init_packet, 0, sizeof(struct nvsp_message));
|
||||
init_packet->hdr.msg_type = NVSP_MSG_TYPE_INIT;
|
||||
init_packet->msg.init_msg.init.min_protocol_ver =
|
||||
NVSP_MIN_PROTOCOL_VERSION;
|
||||
init_packet->msg.init_msg.init.max_protocol_ver =
|
||||
NVSP_MAX_PROTOCOL_VERSION;
|
||||
|
||||
/* Send the init request */
|
||||
ret = vmbus_sendpacket(device->channel, init_packet,
|
||||
sizeof(struct nvsp_message),
|
||||
(unsigned long)init_packet,
|
||||
VM_PKT_DATA_INBAND,
|
||||
VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);
|
||||
|
||||
if (ret != 0)
|
||||
goto cleanup;
|
||||
|
||||
t = wait_for_completion_timeout(&net_device->channel_init_wait, 5*HZ);
|
||||
|
||||
if (t == 0) {
|
||||
ret = -ETIMEDOUT;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (init_packet->msg.init_msg.init_complete.status !=
|
||||
NVSP_STAT_SUCCESS) {
|
||||
ret = -EINVAL;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (init_packet->msg.init_msg.init_complete.
|
||||
negotiated_protocol_ver != NVSP_PROTOCOL_VERSION_1) {
|
||||
/* Negotiate the latest NVSP protocol supported */
|
||||
if (negotiate_nvsp_ver(device, net_device, init_packet,
|
||||
NVSP_PROTOCOL_VERSION_2) == 0) {
|
||||
net_device->nvsp_version = NVSP_PROTOCOL_VERSION_2;
|
||||
} else if (negotiate_nvsp_ver(device, net_device, init_packet,
|
||||
NVSP_PROTOCOL_VERSION_1) == 0) {
|
||||
net_device->nvsp_version = NVSP_PROTOCOL_VERSION_1;
|
||||
} else {
|
||||
ret = -EPROTO;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
pr_debug("Negotiated NVSP version:%x\n", net_device->nvsp_version);
|
||||
|
||||
/* Send the ndis version */
|
||||
memset(init_packet, 0, sizeof(struct nvsp_message));
|
||||
|
||||
|
@ -438,6 +463,9 @@ static void netvsc_send_completion(struct hv_device *device,
|
|||
nvsc_packet->completion.send.send_completion_ctx);
|
||||
|
||||
atomic_dec(&net_device->num_outstanding_sends);
|
||||
|
||||
if (netif_queue_stopped(ndev) && !net_device->start_remove)
|
||||
netif_wake_queue(ndev);
|
||||
} else {
|
||||
netdev_err(ndev, "Unknown send completion packet type- "
|
||||
"%d received!!\n", nvsp_packet->hdr.msg_type);
|
||||
|
@ -488,11 +516,16 @@ int netvsc_send(struct hv_device *device,
|
|||
|
||||
}
|
||||
|
||||
if (ret != 0)
|
||||
if (ret == 0) {
|
||||
atomic_inc(&net_device->num_outstanding_sends);
|
||||
} else if (ret == -EAGAIN) {
|
||||
netif_stop_queue(ndev);
|
||||
if (atomic_read(&net_device->num_outstanding_sends) < 1)
|
||||
netif_wake_queue(ndev);
|
||||
} else {
|
||||
netdev_err(ndev, "Unable to send packet %p ret %d\n",
|
||||
packet, ret);
|
||||
else
|
||||
atomic_inc(&net_device->num_outstanding_sends);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -598,12 +631,10 @@ static void netvsc_receive(struct hv_device *device,
|
|||
struct vmtransfer_page_packet_header *vmxferpage_packet;
|
||||
struct nvsp_message *nvsp_packet;
|
||||
struct hv_netvsc_packet *netvsc_packet = NULL;
|
||||
unsigned long start;
|
||||
unsigned long end, end_virtual;
|
||||
/* struct netvsc_driver *netvscDriver; */
|
||||
struct xferpage_packet *xferpage_packet = NULL;
|
||||
int i, j;
|
||||
int count = 0, bytes_remain = 0;
|
||||
int i;
|
||||
int count = 0;
|
||||
unsigned long flags;
|
||||
struct net_device *ndev;
|
||||
|
||||
|
@ -712,53 +743,10 @@ static void netvsc_receive(struct hv_device *device,
|
|||
netvsc_packet->completion.recv.recv_completion_tid =
|
||||
vmxferpage_packet->d.trans_id;
|
||||
|
||||
netvsc_packet->data = (void *)((unsigned long)net_device->
|
||||
recv_buf + vmxferpage_packet->ranges[i].byte_offset);
|
||||
netvsc_packet->total_data_buflen =
|
||||
vmxferpage_packet->ranges[i].byte_count;
|
||||
netvsc_packet->page_buf_cnt = 1;
|
||||
|
||||
netvsc_packet->page_buf[0].len =
|
||||
vmxferpage_packet->ranges[i].byte_count;
|
||||
|
||||
start = virt_to_phys((void *)((unsigned long)net_device->
|
||||
recv_buf + vmxferpage_packet->ranges[i].byte_offset));
|
||||
|
||||
netvsc_packet->page_buf[0].pfn = start >> PAGE_SHIFT;
|
||||
end_virtual = (unsigned long)net_device->recv_buf
|
||||
+ vmxferpage_packet->ranges[i].byte_offset
|
||||
+ vmxferpage_packet->ranges[i].byte_count - 1;
|
||||
end = virt_to_phys((void *)end_virtual);
|
||||
|
||||
/* Calculate the page relative offset */
|
||||
netvsc_packet->page_buf[0].offset =
|
||||
vmxferpage_packet->ranges[i].byte_offset &
|
||||
(PAGE_SIZE - 1);
|
||||
if ((end >> PAGE_SHIFT) != (start >> PAGE_SHIFT)) {
|
||||
/* Handle frame across multiple pages: */
|
||||
netvsc_packet->page_buf[0].len =
|
||||
(netvsc_packet->page_buf[0].pfn <<
|
||||
PAGE_SHIFT)
|
||||
+ PAGE_SIZE - start;
|
||||
bytes_remain = netvsc_packet->total_data_buflen -
|
||||
netvsc_packet->page_buf[0].len;
|
||||
for (j = 1; j < NETVSC_PACKET_MAXPAGE; j++) {
|
||||
netvsc_packet->page_buf[j].offset = 0;
|
||||
if (bytes_remain <= PAGE_SIZE) {
|
||||
netvsc_packet->page_buf[j].len =
|
||||
bytes_remain;
|
||||
bytes_remain = 0;
|
||||
} else {
|
||||
netvsc_packet->page_buf[j].len =
|
||||
PAGE_SIZE;
|
||||
bytes_remain -= PAGE_SIZE;
|
||||
}
|
||||
netvsc_packet->page_buf[j].pfn =
|
||||
virt_to_phys((void *)(end_virtual -
|
||||
bytes_remain)) >> PAGE_SHIFT;
|
||||
netvsc_packet->page_buf_cnt++;
|
||||
if (bytes_remain == 0)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Pass it to the upper layer */
|
||||
rndis_filter_receive(device, netvsc_packet);
|
|
@ -43,24 +43,59 @@
|
|||
struct net_device_context {
|
||||
/* point back to our device context */
|
||||
struct hv_device *device_ctx;
|
||||
atomic_t avail;
|
||||
struct delayed_work dwork;
|
||||
};
|
||||
|
||||
|
||||
#define PACKET_PAGES_LOWATER 8
|
||||
/* Need this many pages to handle worst case fragmented packet */
|
||||
#define PACKET_PAGES_HIWATER (MAX_SKB_FRAGS + 2)
|
||||
|
||||
static int ring_size = 128;
|
||||
module_param(ring_size, int, S_IRUGO);
|
||||
MODULE_PARM_DESC(ring_size, "Ring buffer size (# of pages)");
|
||||
|
||||
/* no-op so the netdev core doesn't return -EINVAL when modifying the the
|
||||
* multicast address list in SIOCADDMULTI. hv is setup to get all multicast
|
||||
* when it calls RndisFilterOnOpen() */
|
||||
struct set_multicast_work {
|
||||
struct work_struct work;
|
||||
struct net_device *net;
|
||||
};
|
||||
|
||||
static void do_set_multicast(struct work_struct *w)
|
||||
{
|
||||
struct set_multicast_work *swk =
|
||||
container_of(w, struct set_multicast_work, work);
|
||||
struct net_device *net = swk->net;
|
||||
|
||||
struct net_device_context *ndevctx = netdev_priv(net);
|
||||
struct netvsc_device *nvdev;
|
||||
struct rndis_device *rdev;
|
||||
|
||||
nvdev = hv_get_drvdata(ndevctx->device_ctx);
|
||||
if (nvdev == NULL)
|
||||
return;
|
||||
|
||||
rdev = nvdev->extension;
|
||||
if (rdev == NULL)
|
||||
return;
|
||||
|
||||
if (net->flags & IFF_PROMISC)
|
||||
rndis_filter_set_packet_filter(rdev,
|
||||
NDIS_PACKET_TYPE_PROMISCUOUS);
|
||||
else
|
||||
rndis_filter_set_packet_filter(rdev,
|
||||
NDIS_PACKET_TYPE_BROADCAST |
|
||||
NDIS_PACKET_TYPE_ALL_MULTICAST |
|
||||
NDIS_PACKET_TYPE_DIRECTED);
|
||||
|
||||
kfree(w);
|
||||
}
|
||||
|
||||
static void netvsc_set_multicast_list(struct net_device *net)
|
||||
{
|
||||
struct set_multicast_work *swk =
|
||||
kmalloc(sizeof(struct set_multicast_work), GFP_ATOMIC);
|
||||
if (swk == NULL)
|
||||
return;
|
||||
|
||||
swk->net = net;
|
||||
INIT_WORK(&swk->work, do_set_multicast);
|
||||
schedule_work(&swk->work);
|
||||
}
|
||||
|
||||
static int netvsc_open(struct net_device *net)
|
||||
|
@ -104,18 +139,8 @@ static void netvsc_xmit_completion(void *context)
|
|||
|
||||
kfree(packet);
|
||||
|
||||
if (skb) {
|
||||
struct net_device *net = skb->dev;
|
||||
struct net_device_context *net_device_ctx = netdev_priv(net);
|
||||
unsigned int num_pages = skb_shinfo(skb)->nr_frags + 2;
|
||||
|
||||
if (skb)
|
||||
dev_kfree_skb_any(skb);
|
||||
|
||||
atomic_add(num_pages, &net_device_ctx->avail);
|
||||
if (atomic_read(&net_device_ctx->avail) >=
|
||||
PACKET_PAGES_HIWATER)
|
||||
netif_wake_queue(net);
|
||||
}
|
||||
}
|
||||
|
||||
static int netvsc_start_xmit(struct sk_buff *skb, struct net_device *net)
|
||||
|
@ -123,12 +148,12 @@ static int netvsc_start_xmit(struct sk_buff *skb, struct net_device *net)
|
|||
struct net_device_context *net_device_ctx = netdev_priv(net);
|
||||
struct hv_netvsc_packet *packet;
|
||||
int ret;
|
||||
unsigned int i, num_pages;
|
||||
unsigned int i, num_pages, npg_data;
|
||||
|
||||
/* Add 1 for skb->data and additional one for RNDIS */
|
||||
num_pages = skb_shinfo(skb)->nr_frags + 1 + 1;
|
||||
if (num_pages > atomic_read(&net_device_ctx->avail))
|
||||
return NETDEV_TX_BUSY;
|
||||
/* Add multipage for skb->data and additional one for RNDIS */
|
||||
npg_data = (((unsigned long)skb->data + skb_headlen(skb) - 1)
|
||||
>> PAGE_SHIFT) - ((unsigned long)skb->data >> PAGE_SHIFT) + 1;
|
||||
num_pages = skb_shinfo(skb)->nr_frags + npg_data + 1;
|
||||
|
||||
/* Allocate a netvsc packet based on # of frags. */
|
||||
packet = kzalloc(sizeof(struct hv_netvsc_packet) +
|
||||
|
@ -151,21 +176,36 @@ static int netvsc_start_xmit(struct sk_buff *skb, struct net_device *net)
|
|||
packet->page_buf_cnt = num_pages;
|
||||
|
||||
/* Initialize it from the skb */
|
||||
packet->total_data_buflen = skb->len;
|
||||
packet->total_data_buflen = skb->len;
|
||||
|
||||
/* Start filling in the page buffers starting after RNDIS buffer. */
|
||||
packet->page_buf[1].pfn = virt_to_phys(skb->data) >> PAGE_SHIFT;
|
||||
packet->page_buf[1].offset
|
||||
= (unsigned long)skb->data & (PAGE_SIZE - 1);
|
||||
packet->page_buf[1].len = skb_headlen(skb);
|
||||
if (npg_data == 1)
|
||||
packet->page_buf[1].len = skb_headlen(skb);
|
||||
else
|
||||
packet->page_buf[1].len = PAGE_SIZE
|
||||
- packet->page_buf[1].offset;
|
||||
|
||||
for (i = 2; i <= npg_data; i++) {
|
||||
packet->page_buf[i].pfn = virt_to_phys(skb->data
|
||||
+ PAGE_SIZE * (i-1)) >> PAGE_SHIFT;
|
||||
packet->page_buf[i].offset = 0;
|
||||
packet->page_buf[i].len = PAGE_SIZE;
|
||||
}
|
||||
if (npg_data > 1)
|
||||
packet->page_buf[npg_data].len = (((unsigned long)skb->data
|
||||
+ skb_headlen(skb) - 1) & (PAGE_SIZE - 1)) + 1;
|
||||
|
||||
/* Additional fragments are after SKB data */
|
||||
for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
|
||||
const skb_frag_t *f = &skb_shinfo(skb)->frags[i];
|
||||
|
||||
packet->page_buf[i+2].pfn = page_to_pfn(skb_frag_page(f));
|
||||
packet->page_buf[i+2].offset = f->page_offset;
|
||||
packet->page_buf[i+2].len = skb_frag_size(f);
|
||||
packet->page_buf[i+npg_data+1].pfn =
|
||||
page_to_pfn(skb_frag_page(f));
|
||||
packet->page_buf[i+npg_data+1].offset = f->page_offset;
|
||||
packet->page_buf[i+npg_data+1].len = skb_frag_size(f);
|
||||
}
|
||||
|
||||
/* Set the completion routine */
|
||||
|
@ -178,10 +218,6 @@ static int netvsc_start_xmit(struct sk_buff *skb, struct net_device *net)
|
|||
if (ret == 0) {
|
||||
net->stats.tx_bytes += skb->len;
|
||||
net->stats.tx_packets++;
|
||||
|
||||
atomic_sub(num_pages, &net_device_ctx->avail);
|
||||
if (atomic_read(&net_device_ctx->avail) < PACKET_PAGES_LOWATER)
|
||||
netif_stop_queue(net);
|
||||
} else {
|
||||
/* we are shutting down or bus overloaded, just drop packet */
|
||||
net->stats.tx_dropped++;
|
||||
|
@ -232,9 +268,6 @@ int netvsc_recv_callback(struct hv_device *device_obj,
|
|||
{
|
||||
struct net_device *net = dev_get_drvdata(&device_obj->device);
|
||||
struct sk_buff *skb;
|
||||
void *data;
|
||||
int i;
|
||||
unsigned long flags;
|
||||
struct netvsc_device *net_device;
|
||||
|
||||
net_device = hv_get_drvdata(device_obj);
|
||||
|
@ -253,27 +286,12 @@ int netvsc_recv_callback(struct hv_device *device_obj,
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* for kmap_atomic */
|
||||
local_irq_save(flags);
|
||||
|
||||
/*
|
||||
* Copy to skb. This copy is needed here since the memory pointed by
|
||||
* hv_netvsc_packet cannot be deallocated
|
||||
*/
|
||||
for (i = 0; i < packet->page_buf_cnt; i++) {
|
||||
data = kmap_atomic(pfn_to_page(packet->page_buf[i].pfn),
|
||||
KM_IRQ1);
|
||||
data = (void *)(unsigned long)data +
|
||||
packet->page_buf[i].offset;
|
||||
|
||||
memcpy(skb_put(skb, packet->page_buf[i].len), data,
|
||||
packet->page_buf[i].len);
|
||||
|
||||
kunmap_atomic((void *)((unsigned long)data -
|
||||
packet->page_buf[i].offset), KM_IRQ1);
|
||||
}
|
||||
|
||||
local_irq_restore(flags);
|
||||
memcpy(skb_put(skb, packet->total_data_buflen), packet->data,
|
||||
packet->total_data_buflen);
|
||||
|
||||
skb->protocol = eth_type_trans(skb, net);
|
||||
skb->ip_summed = CHECKSUM_NONE;
|
||||
|
@ -299,6 +317,39 @@ static void netvsc_get_drvinfo(struct net_device *net,
|
|||
strcpy(info->fw_version, "N/A");
|
||||
}
|
||||
|
||||
static int netvsc_change_mtu(struct net_device *ndev, int mtu)
|
||||
{
|
||||
struct net_device_context *ndevctx = netdev_priv(ndev);
|
||||
struct hv_device *hdev = ndevctx->device_ctx;
|
||||
struct netvsc_device *nvdev = hv_get_drvdata(hdev);
|
||||
struct netvsc_device_info device_info;
|
||||
int limit = ETH_DATA_LEN;
|
||||
|
||||
if (nvdev == NULL || nvdev->destroy)
|
||||
return -ENODEV;
|
||||
|
||||
if (nvdev->nvsp_version == NVSP_PROTOCOL_VERSION_2)
|
||||
limit = NETVSC_MTU;
|
||||
|
||||
if (mtu < 68 || mtu > limit)
|
||||
return -EINVAL;
|
||||
|
||||
nvdev->start_remove = true;
|
||||
cancel_delayed_work_sync(&ndevctx->dwork);
|
||||
netif_stop_queue(ndev);
|
||||
rndis_filter_device_remove(hdev);
|
||||
|
||||
ndev->mtu = mtu;
|
||||
|
||||
ndevctx->device_ctx = hdev;
|
||||
hv_set_drvdata(hdev, ndev);
|
||||
device_info.ring_size = ring_size;
|
||||
rndis_filter_device_add(hdev, &device_info);
|
||||
netif_wake_queue(ndev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct ethtool_ops ethtool_ops = {
|
||||
.get_drvinfo = netvsc_get_drvinfo,
|
||||
.get_link = ethtool_op_get_link,
|
||||
|
@ -309,7 +360,7 @@ static const struct net_device_ops device_ops = {
|
|||
.ndo_stop = netvsc_close,
|
||||
.ndo_start_xmit = netvsc_start_xmit,
|
||||
.ndo_set_rx_mode = netvsc_set_multicast_list,
|
||||
.ndo_change_mtu = eth_change_mtu,
|
||||
.ndo_change_mtu = netvsc_change_mtu,
|
||||
.ndo_validate_addr = eth_validate_addr,
|
||||
.ndo_set_mac_address = eth_mac_addr,
|
||||
};
|
||||
|
@ -351,7 +402,6 @@ static int netvsc_probe(struct hv_device *dev,
|
|||
|
||||
net_device_ctx = netdev_priv(net);
|
||||
net_device_ctx->device_ctx = dev;
|
||||
atomic_set(&net_device_ctx->avail, ring_size);
|
||||
hv_set_drvdata(dev, net);
|
||||
INIT_DELAYED_WORK(&net_device_ctx->dwork, netvsc_send_garp);
|
||||
|
||||
|
@ -403,6 +453,8 @@ static int netvsc_remove(struct hv_device *dev)
|
|||
return 0;
|
||||
}
|
||||
|
||||
net_device->start_remove = true;
|
||||
|
||||
ndev_ctx = netdev_priv(net);
|
||||
cancel_delayed_work_sync(&ndev_ctx->dwork);
|
||||
|
|
@ -30,26 +30,6 @@
|
|||
#include "hyperv_net.h"
|
||||
|
||||
|
||||
enum rndis_device_state {
|
||||
RNDIS_DEV_UNINITIALIZED = 0,
|
||||
RNDIS_DEV_INITIALIZING,
|
||||
RNDIS_DEV_INITIALIZED,
|
||||
RNDIS_DEV_DATAINITIALIZED,
|
||||
};
|
||||
|
||||
struct rndis_device {
|
||||
struct netvsc_device *net_dev;
|
||||
|
||||
enum rndis_device_state state;
|
||||
bool link_state;
|
||||
atomic_t new_req_id;
|
||||
|
||||
spinlock_t request_lock;
|
||||
struct list_head req_list;
|
||||
|
||||
unsigned char hw_mac_adr[ETH_ALEN];
|
||||
};
|
||||
|
||||
struct rndis_request {
|
||||
struct list_head list_ent;
|
||||
struct completion wait_event;
|
||||
|
@ -329,7 +309,6 @@ static void rndis_filter_receive_data(struct rndis_device *dev,
|
|||
{
|
||||
struct rndis_packet *rndis_pkt;
|
||||
u32 data_offset;
|
||||
int i;
|
||||
|
||||
rndis_pkt = &msg->msg.pkt;
|
||||
|
||||
|
@ -342,17 +321,7 @@ static void rndis_filter_receive_data(struct rndis_device *dev,
|
|||
data_offset = RNDIS_HEADER_SIZE + rndis_pkt->data_offset;
|
||||
|
||||
pkt->total_data_buflen -= data_offset;
|
||||
pkt->page_buf[0].offset += data_offset;
|
||||
pkt->page_buf[0].len -= data_offset;
|
||||
|
||||
/* Drop the 0th page, if rndis data go beyond page boundary */
|
||||
if (pkt->page_buf[0].offset >= PAGE_SIZE) {
|
||||
pkt->page_buf[1].offset = pkt->page_buf[0].offset - PAGE_SIZE;
|
||||
pkt->page_buf[1].len -= pkt->page_buf[1].offset;
|
||||
pkt->page_buf_cnt--;
|
||||
for (i = 0; i < pkt->page_buf_cnt; i++)
|
||||
pkt->page_buf[i] = pkt->page_buf[i+1];
|
||||
}
|
||||
pkt->data = (void *)((unsigned long)pkt->data + data_offset);
|
||||
|
||||
pkt->is_data_pkt = true;
|
||||
|
||||
|
@ -387,11 +356,7 @@ int rndis_filter_receive(struct hv_device *dev,
|
|||
return -ENODEV;
|
||||
}
|
||||
|
||||
rndis_hdr = (struct rndis_message *)kmap_atomic(
|
||||
pfn_to_page(pkt->page_buf[0].pfn), KM_IRQ0);
|
||||
|
||||
rndis_hdr = (void *)((unsigned long)rndis_hdr +
|
||||
pkt->page_buf[0].offset);
|
||||
rndis_hdr = pkt->data;
|
||||
|
||||
/* Make sure we got a valid rndis message */
|
||||
if ((rndis_hdr->ndis_msg_type != REMOTE_NDIS_PACKET_MSG) &&
|
||||
|
@ -407,8 +372,6 @@ int rndis_filter_receive(struct hv_device *dev,
|
|||
sizeof(struct rndis_message) :
|
||||
rndis_hdr->msg_len);
|
||||
|
||||
kunmap_atomic(rndis_hdr - pkt->page_buf[0].offset, KM_IRQ0);
|
||||
|
||||
dump_rndis_message(dev, &rndis_msg);
|
||||
|
||||
switch (rndis_msg.ndis_msg_type) {
|
||||
|
@ -522,8 +485,7 @@ static int rndis_filter_query_device_link_status(struct rndis_device *dev)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int rndis_filter_set_packet_filter(struct rndis_device *dev,
|
||||
u32 new_filter)
|
||||
int rndis_filter_set_packet_filter(struct rndis_device *dev, u32 new_filter)
|
||||
{
|
||||
struct rndis_request *request;
|
||||
struct rndis_set_request *set;
|
|
@ -72,8 +72,6 @@ source "drivers/staging/octeon/Kconfig"
|
|||
|
||||
source "drivers/staging/serqt_usb2/Kconfig"
|
||||
|
||||
source "drivers/staging/spectra/Kconfig"
|
||||
|
||||
source "drivers/staging/quatech_usb2/Kconfig"
|
||||
|
||||
source "drivers/staging/vt6655/Kconfig"
|
||||
|
@ -116,8 +114,6 @@ source "drivers/staging/bcm/Kconfig"
|
|||
|
||||
source "drivers/staging/ft1000/Kconfig"
|
||||
|
||||
source "drivers/staging/intel_sst/Kconfig"
|
||||
|
||||
source "drivers/staging/speakup/Kconfig"
|
||||
|
||||
source "drivers/staging/cptm1217/Kconfig"
|
||||
|
@ -132,4 +128,8 @@ source "drivers/staging/nvec/Kconfig"
|
|||
|
||||
source "drivers/staging/media/Kconfig"
|
||||
|
||||
source "drivers/staging/omapdrm/Kconfig"
|
||||
|
||||
source "drivers/staging/android/Kconfig"
|
||||
|
||||
endif # STAGING
|
||||
|
|
|
@ -21,7 +21,6 @@ obj-$(CONFIG_RTL8192E) += rtl8192e/
|
|||
obj-$(CONFIG_R8712U) += rtl8712/
|
||||
obj-$(CONFIG_RTS_PSTOR) += rts_pstor/
|
||||
obj-$(CONFIG_RTS5139) += rts5139/
|
||||
obj-$(CONFIG_SPECTRA) += spectra/
|
||||
obj-$(CONFIG_TRANZPORT) += frontier/
|
||||
obj-$(CONFIG_POHMELFS) += pohmelfs/
|
||||
obj-$(CONFIG_IDE_PHISON) += phison/
|
||||
|
@ -50,10 +49,11 @@ obj-$(CONFIG_SBE_2T3E3) += sbe-2t3e3/
|
|||
obj-$(CONFIG_USB_ENESTORAGE) += keucr/
|
||||
obj-$(CONFIG_BCM_WIMAX) += bcm/
|
||||
obj-$(CONFIG_FT1000) += ft1000/
|
||||
obj-$(CONFIG_SND_INTEL_SST) += intel_sst/
|
||||
obj-$(CONFIG_SPEAKUP) += speakup/
|
||||
obj-$(CONFIG_TOUCHSCREEN_CLEARPAD_TM1217) += cptm1217/
|
||||
obj-$(CONFIG_TOUCHSCREEN_SYNAPTICS_I2C_RMI4) += ste_rmi4/
|
||||
obj-$(CONFIG_DRM_PSB) += gma500/
|
||||
obj-$(CONFIG_INTEL_MEI) += mei/
|
||||
obj-$(CONFIG_MFD_NVEC) += nvec/
|
||||
obj-$(CONFIG_DRM_OMAP) += omapdrm/
|
||||
obj-$(CONFIG_ANDROID) += android/
|
||||
|
|
|
@ -0,0 +1,110 @@
|
|||
menu "Android"
|
||||
|
||||
config ANDROID
|
||||
bool "Android Drivers"
|
||||
default N
|
||||
---help---
|
||||
Enable support for various drivers needed on the Android platform
|
||||
|
||||
if ANDROID
|
||||
|
||||
config ANDROID_BINDER_IPC
|
||||
bool "Android Binder IPC Driver"
|
||||
default n
|
||||
|
||||
config ASHMEM
|
||||
bool "Enable the Anonymous Shared Memory Subsystem"
|
||||
default n
|
||||
depends on SHMEM || TINY_SHMEM
|
||||
help
|
||||
The ashmem subsystem is a new shared memory allocator, similar to
|
||||
POSIX SHM but with different behavior and sporting a simpler
|
||||
file-based API.
|
||||
|
||||
config ANDROID_LOGGER
|
||||
tristate "Android log driver"
|
||||
default n
|
||||
|
||||
config ANDROID_RAM_CONSOLE
|
||||
bool "Android RAM buffer console"
|
||||
default n
|
||||
|
||||
config ANDROID_RAM_CONSOLE_ENABLE_VERBOSE
|
||||
bool "Enable verbose console messages on Android RAM console"
|
||||
default y
|
||||
depends on ANDROID_RAM_CONSOLE
|
||||
|
||||
menuconfig ANDROID_RAM_CONSOLE_ERROR_CORRECTION
|
||||
bool "Android RAM Console Enable error correction"
|
||||
default n
|
||||
depends on ANDROID_RAM_CONSOLE
|
||||
depends on !ANDROID_RAM_CONSOLE_EARLY_INIT
|
||||
select REED_SOLOMON
|
||||
select REED_SOLOMON_ENC8
|
||||
select REED_SOLOMON_DEC8
|
||||
|
||||
if ANDROID_RAM_CONSOLE_ERROR_CORRECTION
|
||||
|
||||
config ANDROID_RAM_CONSOLE_ERROR_CORRECTION_DATA_SIZE
|
||||
int "Android RAM Console Data data size"
|
||||
default 128
|
||||
help
|
||||
Must be a power of 2.
|
||||
|
||||
config ANDROID_RAM_CONSOLE_ERROR_CORRECTION_ECC_SIZE
|
||||
int "Android RAM Console ECC size"
|
||||
default 16
|
||||
|
||||
config ANDROID_RAM_CONSOLE_ERROR_CORRECTION_SYMBOL_SIZE
|
||||
int "Android RAM Console Symbol size"
|
||||
default 8
|
||||
|
||||
config ANDROID_RAM_CONSOLE_ERROR_CORRECTION_POLYNOMIAL
|
||||
hex "Android RAM Console Polynomial"
|
||||
default 0x19 if (ANDROID_RAM_CONSOLE_ERROR_CORRECTION_SYMBOL_SIZE = 4)
|
||||
default 0x29 if (ANDROID_RAM_CONSOLE_ERROR_CORRECTION_SYMBOL_SIZE = 5)
|
||||
default 0x61 if (ANDROID_RAM_CONSOLE_ERROR_CORRECTION_SYMBOL_SIZE = 6)
|
||||
default 0x89 if (ANDROID_RAM_CONSOLE_ERROR_CORRECTION_SYMBOL_SIZE = 7)
|
||||
default 0x11d if (ANDROID_RAM_CONSOLE_ERROR_CORRECTION_SYMBOL_SIZE = 8)
|
||||
|
||||
endif # ANDROID_RAM_CONSOLE_ERROR_CORRECTION
|
||||
|
||||
config ANDROID_RAM_CONSOLE_EARLY_INIT
|
||||
bool "Start Android RAM console early"
|
||||
default n
|
||||
depends on ANDROID_RAM_CONSOLE
|
||||
|
||||
config ANDROID_RAM_CONSOLE_EARLY_ADDR
|
||||
hex "Android RAM console virtual address"
|
||||
default 0
|
||||
depends on ANDROID_RAM_CONSOLE_EARLY_INIT
|
||||
|
||||
config ANDROID_RAM_CONSOLE_EARLY_SIZE
|
||||
hex "Android RAM console buffer size"
|
||||
default 0
|
||||
depends on ANDROID_RAM_CONSOLE_EARLY_INIT
|
||||
|
||||
config ANDROID_TIMED_OUTPUT
|
||||
bool "Timed output class driver"
|
||||
default y
|
||||
|
||||
config ANDROID_TIMED_GPIO
|
||||
tristate "Android timed gpio driver"
|
||||
depends on GENERIC_GPIO && ANDROID_TIMED_OUTPUT
|
||||
default n
|
||||
|
||||
config ANDROID_LOW_MEMORY_KILLER
|
||||
bool "Android Low Memory Killer"
|
||||
default N
|
||||
---help---
|
||||
Register processes to be killed when memory is low
|
||||
|
||||
config ANDROID_PMEM
|
||||
bool "Android pmem allocator"
|
||||
depends on ARM
|
||||
|
||||
source "drivers/staging/android/switch/Kconfig"
|
||||
|
||||
endif # if ANDROID
|
||||
|
||||
endmenu
|
|
@ -0,0 +1,9 @@
|
|||
obj-$(CONFIG_ANDROID_BINDER_IPC) += binder.o
|
||||
obj-$(CONFIG_ASHMEM) += ashmem.o
|
||||
obj-$(CONFIG_ANDROID_LOGGER) += logger.o
|
||||
obj-$(CONFIG_ANDROID_RAM_CONSOLE) += ram_console.o
|
||||
obj-$(CONFIG_ANDROID_TIMED_OUTPUT) += timed_output.o
|
||||
obj-$(CONFIG_ANDROID_TIMED_GPIO) += timed_gpio.o
|
||||
obj-$(CONFIG_ANDROID_LOW_MEMORY_KILLER) += lowmemorykiller.o
|
||||
obj-$(CONFIG_ANDROID_PMEM) += pmem.o
|
||||
obj-$(CONFIG_ANDROID_SWITCH) += switch/
|
|
@ -0,0 +1,10 @@
|
|||
TODO:
|
||||
- checkpatch.pl cleanups
|
||||
- sparse fixes
|
||||
- rename files to be not so "generic"
|
||||
- make sure things build as modules properly
|
||||
- add proper arch dependancies as needed
|
||||
- audit userspace interfaces to make sure they are sane
|
||||
|
||||
Please send patches to Greg Kroah-Hartman <greg@kroah.com> and Cc:
|
||||
Brian Swetland <swetland@google.com>
|
|
@ -0,0 +1,93 @@
|
|||
/* include/linux/android_pmem.h
|
||||
*
|
||||
* Copyright (C) 2007 Google, Inc.
|
||||
*
|
||||
* This software is licensed under the terms of the GNU General Public
|
||||
* License version 2, as published by the Free Software Foundation, and
|
||||
* may be copied, distributed, and modified under those terms.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _ANDROID_PMEM_H_
|
||||
#define _ANDROID_PMEM_H_
|
||||
|
||||
#define PMEM_IOCTL_MAGIC 'p'
|
||||
#define PMEM_GET_PHYS _IOW(PMEM_IOCTL_MAGIC, 1, unsigned int)
|
||||
#define PMEM_MAP _IOW(PMEM_IOCTL_MAGIC, 2, unsigned int)
|
||||
#define PMEM_GET_SIZE _IOW(PMEM_IOCTL_MAGIC, 3, unsigned int)
|
||||
#define PMEM_UNMAP _IOW(PMEM_IOCTL_MAGIC, 4, unsigned int)
|
||||
/* This ioctl will allocate pmem space, backing the file, it will fail
|
||||
* if the file already has an allocation, pass it the len as the argument
|
||||
* to the ioctl */
|
||||
#define PMEM_ALLOCATE _IOW(PMEM_IOCTL_MAGIC, 5, unsigned int)
|
||||
/* This will connect a one pmem file to another, pass the file that is already
|
||||
* backed in memory as the argument to the ioctl
|
||||
*/
|
||||
#define PMEM_CONNECT _IOW(PMEM_IOCTL_MAGIC, 6, unsigned int)
|
||||
/* Returns the total size of the pmem region it is sent to as a pmem_region
|
||||
* struct (with offset set to 0).
|
||||
*/
|
||||
#define PMEM_GET_TOTAL_SIZE _IOW(PMEM_IOCTL_MAGIC, 7, unsigned int)
|
||||
#define PMEM_CACHE_FLUSH _IOW(PMEM_IOCTL_MAGIC, 8, unsigned int)
|
||||
|
||||
struct android_pmem_platform_data
|
||||
{
|
||||
const char* name;
|
||||
/* starting physical address of memory region */
|
||||
unsigned long start;
|
||||
/* size of memory region */
|
||||
unsigned long size;
|
||||
/* set to indicate the region should not be managed with an allocator */
|
||||
unsigned no_allocator;
|
||||
/* set to indicate maps of this region should be cached, if a mix of
|
||||
* cached and uncached is desired, set this and open the device with
|
||||
* O_SYNC to get an uncached region */
|
||||
unsigned cached;
|
||||
/* The MSM7k has bits to enable a write buffer in the bus controller*/
|
||||
unsigned buffered;
|
||||
};
|
||||
|
||||
struct pmem_region {
|
||||
unsigned long offset;
|
||||
unsigned long len;
|
||||
};
|
||||
|
||||
#ifdef CONFIG_ANDROID_PMEM
|
||||
int is_pmem_file(struct file *file);
|
||||
int get_pmem_file(int fd, unsigned long *start, unsigned long *vstart,
|
||||
unsigned long *end, struct file **filp);
|
||||
int get_pmem_user_addr(struct file *file, unsigned long *start,
|
||||
unsigned long *end);
|
||||
void put_pmem_file(struct file* file);
|
||||
void flush_pmem_file(struct file *file, unsigned long start, unsigned long len);
|
||||
int pmem_setup(struct android_pmem_platform_data *pdata,
|
||||
long (*ioctl)(struct file *, unsigned int, unsigned long),
|
||||
int (*release)(struct inode *, struct file *));
|
||||
int pmem_remap(struct pmem_region *region, struct file *file,
|
||||
unsigned operation);
|
||||
|
||||
#else
|
||||
static inline int is_pmem_file(struct file *file) { return 0; }
|
||||
static inline int get_pmem_file(int fd, unsigned long *start,
|
||||
unsigned long *vstart, unsigned long *end,
|
||||
struct file **filp) { return -ENOSYS; }
|
||||
static inline int get_pmem_user_addr(struct file *file, unsigned long *start,
|
||||
unsigned long *end) { return -ENOSYS; }
|
||||
static inline void put_pmem_file(struct file* file) { return; }
|
||||
static inline void flush_pmem_file(struct file *file, unsigned long start,
|
||||
unsigned long len) { return; }
|
||||
static inline int pmem_setup(struct android_pmem_platform_data *pdata,
|
||||
long (*ioctl)(struct file *, unsigned int, unsigned long),
|
||||
int (*release)(struct inode *, struct file *)) { return -ENOSYS; }
|
||||
|
||||
static inline int pmem_remap(struct pmem_region *region, struct file *file,
|
||||
unsigned operation) { return -ENOSYS; }
|
||||
#endif
|
||||
|
||||
#endif //_ANDROID_PPP_H_
|
||||
|
|
@ -0,0 +1,752 @@
|
|||
/* mm/ashmem.c
|
||||
**
|
||||
** Anonymous Shared Memory Subsystem, ashmem
|
||||
**
|
||||
** Copyright (C) 2008 Google, Inc.
|
||||
**
|
||||
** Robert Love <rlove@google.com>
|
||||
**
|
||||
** This software is licensed under the terms of the GNU General Public
|
||||
** License version 2, as published by the Free Software Foundation, and
|
||||
** may be copied, distributed, and modified under those terms.
|
||||
**
|
||||
** 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.
|
||||
*/
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/file.h>
|
||||
#include <linux/fs.h>
|
||||
#include <linux/miscdevice.h>
|
||||
#include <linux/security.h>
|
||||
#include <linux/mm.h>
|
||||
#include <linux/mman.h>
|
||||
#include <linux/uaccess.h>
|
||||
#include <linux/personality.h>
|
||||
#include <linux/bitops.h>
|
||||
#include <linux/mutex.h>
|
||||
#include <linux/shmem_fs.h>
|
||||
#include "ashmem.h"
|
||||
|
||||
#define ASHMEM_NAME_PREFIX "dev/ashmem/"
|
||||
#define ASHMEM_NAME_PREFIX_LEN (sizeof(ASHMEM_NAME_PREFIX) - 1)
|
||||
#define ASHMEM_FULL_NAME_LEN (ASHMEM_NAME_LEN + ASHMEM_NAME_PREFIX_LEN)
|
||||
|
||||
/*
|
||||
* ashmem_area - anonymous shared memory area
|
||||
* Lifecycle: From our parent file's open() until its release()
|
||||
* Locking: Protected by `ashmem_mutex'
|
||||
* Big Note: Mappings do NOT pin this structure; it dies on close()
|
||||
*/
|
||||
struct ashmem_area {
|
||||
char name[ASHMEM_FULL_NAME_LEN]; /* optional name in /proc/pid/maps */
|
||||
struct list_head unpinned_list; /* list of all ashmem areas */
|
||||
struct file *file; /* the shmem-based backing file */
|
||||
size_t size; /* size of the mapping, in bytes */
|
||||
unsigned long prot_mask; /* allowed prot bits, as vm_flags */
|
||||
};
|
||||
|
||||
/*
|
||||
* ashmem_range - represents an interval of unpinned (evictable) pages
|
||||
* Lifecycle: From unpin to pin
|
||||
* Locking: Protected by `ashmem_mutex'
|
||||
*/
|
||||
struct ashmem_range {
|
||||
struct list_head lru; /* entry in LRU list */
|
||||
struct list_head unpinned; /* entry in its area's unpinned list */
|
||||
struct ashmem_area *asma; /* associated area */
|
||||
size_t pgstart; /* starting page, inclusive */
|
||||
size_t pgend; /* ending page, inclusive */
|
||||
unsigned int purged; /* ASHMEM_NOT or ASHMEM_WAS_PURGED */
|
||||
};
|
||||
|
||||
/* LRU list of unpinned pages, protected by ashmem_mutex */
|
||||
static LIST_HEAD(ashmem_lru_list);
|
||||
|
||||
/* Count of pages on our LRU list, protected by ashmem_mutex */
|
||||
static unsigned long lru_count;
|
||||
|
||||
/*
|
||||
* ashmem_mutex - protects the list of and each individual ashmem_area
|
||||
*
|
||||
* Lock Ordering: ashmex_mutex -> i_mutex -> i_alloc_sem
|
||||
*/
|
||||
static DEFINE_MUTEX(ashmem_mutex);
|
||||
|
||||
static struct kmem_cache *ashmem_area_cachep __read_mostly;
|
||||
static struct kmem_cache *ashmem_range_cachep __read_mostly;
|
||||
|
||||
#define range_size(range) \
|
||||
((range)->pgend - (range)->pgstart + 1)
|
||||
|
||||
#define range_on_lru(range) \
|
||||
((range)->purged == ASHMEM_NOT_PURGED)
|
||||
|
||||
#define page_range_subsumes_range(range, start, end) \
|
||||
(((range)->pgstart >= (start)) && ((range)->pgend <= (end)))
|
||||
|
||||
#define page_range_subsumed_by_range(range, start, end) \
|
||||
(((range)->pgstart <= (start)) && ((range)->pgend >= (end)))
|
||||
|
||||
#define page_in_range(range, page) \
|
||||
(((range)->pgstart <= (page)) && ((range)->pgend >= (page)))
|
||||
|
||||
#define page_range_in_range(range, start, end) \
|
||||
(page_in_range(range, start) || page_in_range(range, end) || \
|
||||
page_range_subsumes_range(range, start, end))
|
||||
|
||||
#define range_before_page(range, page) \
|
||||
((range)->pgend < (page))
|
||||
|
||||
#define PROT_MASK (PROT_EXEC | PROT_READ | PROT_WRITE)
|
||||
|
||||
static inline void lru_add(struct ashmem_range *range)
|
||||
{
|
||||
list_add_tail(&range->lru, &ashmem_lru_list);
|
||||
lru_count += range_size(range);
|
||||
}
|
||||
|
||||
static inline void lru_del(struct ashmem_range *range)
|
||||
{
|
||||
list_del(&range->lru);
|
||||
lru_count -= range_size(range);
|
||||
}
|
||||
|
||||
/*
|
||||
* range_alloc - allocate and initialize a new ashmem_range structure
|
||||
*
|
||||
* 'asma' - associated ashmem_area
|
||||
* 'prev_range' - the previous ashmem_range in the sorted asma->unpinned list
|
||||
* 'purged' - initial purge value (ASMEM_NOT_PURGED or ASHMEM_WAS_PURGED)
|
||||
* 'start' - starting page, inclusive
|
||||
* 'end' - ending page, inclusive
|
||||
*
|
||||
* Caller must hold ashmem_mutex.
|
||||
*/
|
||||
static int range_alloc(struct ashmem_area *asma,
|
||||
struct ashmem_range *prev_range, unsigned int purged,
|
||||
size_t start, size_t end)
|
||||
{
|
||||
struct ashmem_range *range;
|
||||
|
||||
range = kmem_cache_zalloc(ashmem_range_cachep, GFP_KERNEL);
|
||||
if (unlikely(!range))
|
||||
return -ENOMEM;
|
||||
|
||||
range->asma = asma;
|
||||
range->pgstart = start;
|
||||
range->pgend = end;
|
||||
range->purged = purged;
|
||||
|
||||
list_add_tail(&range->unpinned, &prev_range->unpinned);
|
||||
|
||||
if (range_on_lru(range))
|
||||
lru_add(range);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void range_del(struct ashmem_range *range)
|
||||
{
|
||||
list_del(&range->unpinned);
|
||||
if (range_on_lru(range))
|
||||
lru_del(range);
|
||||
kmem_cache_free(ashmem_range_cachep, range);
|
||||
}
|
||||
|
||||
/*
|
||||
* range_shrink - shrinks a range
|
||||
*
|
||||
* Caller must hold ashmem_mutex.
|
||||
*/
|
||||
static inline void range_shrink(struct ashmem_range *range,
|
||||
size_t start, size_t end)
|
||||
{
|
||||
size_t pre = range_size(range);
|
||||
|
||||
range->pgstart = start;
|
||||
range->pgend = end;
|
||||
|
||||
if (range_on_lru(range))
|
||||
lru_count -= pre - range_size(range);
|
||||
}
|
||||
|
||||
static int ashmem_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
struct ashmem_area *asma;
|
||||
int ret;
|
||||
|
||||
ret = generic_file_open(inode, file);
|
||||
if (unlikely(ret))
|
||||
return ret;
|
||||
|
||||
asma = kmem_cache_zalloc(ashmem_area_cachep, GFP_KERNEL);
|
||||
if (unlikely(!asma))
|
||||
return -ENOMEM;
|
||||
|
||||
INIT_LIST_HEAD(&asma->unpinned_list);
|
||||
memcpy(asma->name, ASHMEM_NAME_PREFIX, ASHMEM_NAME_PREFIX_LEN);
|
||||
asma->prot_mask = PROT_MASK;
|
||||
file->private_data = asma;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ashmem_release(struct inode *ignored, struct file *file)
|
||||
{
|
||||
struct ashmem_area *asma = file->private_data;
|
||||
struct ashmem_range *range, *next;
|
||||
|
||||
mutex_lock(&ashmem_mutex);
|
||||
list_for_each_entry_safe(range, next, &asma->unpinned_list, unpinned)
|
||||
range_del(range);
|
||||
mutex_unlock(&ashmem_mutex);
|
||||
|
||||
if (asma->file)
|
||||
fput(asma->file);
|
||||
kmem_cache_free(ashmem_area_cachep, asma);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static ssize_t ashmem_read(struct file *file, char __user *buf,
|
||||
size_t len, loff_t *pos)
|
||||
{
|
||||
struct ashmem_area *asma = file->private_data;
|
||||
int ret = 0;
|
||||
|
||||
mutex_lock(&ashmem_mutex);
|
||||
|
||||
/* If size is not set, or set to 0, always return EOF. */
|
||||
if (asma->size == 0)
|
||||
goto out;
|
||||
|
||||
if (!asma->file) {
|
||||
ret = -EBADF;
|
||||
goto out;
|
||||
}
|
||||
|
||||
ret = asma->file->f_op->read(asma->file, buf, len, pos);
|
||||
if (ret < 0)
|
||||
goto out;
|
||||
|
||||
/** Update backing file pos, since f_ops->read() doesn't */
|
||||
asma->file->f_pos = *pos;
|
||||
|
||||
out:
|
||||
mutex_unlock(&ashmem_mutex);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static loff_t ashmem_llseek(struct file *file, loff_t offset, int origin)
|
||||
{
|
||||
struct ashmem_area *asma = file->private_data;
|
||||
int ret;
|
||||
|
||||
mutex_lock(&ashmem_mutex);
|
||||
|
||||
if (asma->size == 0) {
|
||||
ret = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (!asma->file) {
|
||||
ret = -EBADF;
|
||||
goto out;
|
||||
}
|
||||
|
||||
ret = asma->file->f_op->llseek(asma->file, offset, origin);
|
||||
if (ret < 0)
|
||||
goto out;
|
||||
|
||||
/** Copy f_pos from backing file, since f_ops->llseek() sets it */
|
||||
file->f_pos = asma->file->f_pos;
|
||||
|
||||
out:
|
||||
mutex_unlock(&ashmem_mutex);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static inline unsigned long calc_vm_may_flags(unsigned long prot)
|
||||
{
|
||||
return _calc_vm_trans(prot, PROT_READ, VM_MAYREAD) |
|
||||
_calc_vm_trans(prot, PROT_WRITE, VM_MAYWRITE) |
|
||||
_calc_vm_trans(prot, PROT_EXEC, VM_MAYEXEC);
|
||||
}
|
||||
|
||||
static int ashmem_mmap(struct file *file, struct vm_area_struct *vma)
|
||||
{
|
||||
struct ashmem_area *asma = file->private_data;
|
||||
int ret = 0;
|
||||
|
||||
mutex_lock(&ashmem_mutex);
|
||||
|
||||
/* user needs to SET_SIZE before mapping */
|
||||
if (unlikely(!asma->size)) {
|
||||
ret = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* requested protection bits must match our allowed protection mask */
|
||||
if (unlikely((vma->vm_flags & ~calc_vm_prot_bits(asma->prot_mask)) &
|
||||
calc_vm_prot_bits(PROT_MASK))) {
|
||||
ret = -EPERM;
|
||||
goto out;
|
||||
}
|
||||
vma->vm_flags &= ~calc_vm_may_flags(~asma->prot_mask);
|
||||
|
||||
if (!asma->file) {
|
||||
char *name = ASHMEM_NAME_DEF;
|
||||
struct file *vmfile;
|
||||
|
||||
if (asma->name[ASHMEM_NAME_PREFIX_LEN] != '\0')
|
||||
name = asma->name;
|
||||
|
||||
/* ... and allocate the backing shmem file */
|
||||
vmfile = shmem_file_setup(name, asma->size, vma->vm_flags);
|
||||
if (unlikely(IS_ERR(vmfile))) {
|
||||
ret = PTR_ERR(vmfile);
|
||||
goto out;
|
||||
}
|
||||
asma->file = vmfile;
|
||||
}
|
||||
get_file(asma->file);
|
||||
|
||||
/*
|
||||
* XXX - Reworked to use shmem_zero_setup() instead of
|
||||
* shmem_set_file while we're in staging. -jstultz
|
||||
*/
|
||||
if (vma->vm_flags & VM_SHARED) {
|
||||
ret = shmem_zero_setup(vma);
|
||||
if (ret) {
|
||||
fput(asma->file);
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
if (vma->vm_file)
|
||||
fput(vma->vm_file);
|
||||
vma->vm_file = asma->file;
|
||||
vma->vm_flags |= VM_CAN_NONLINEAR;
|
||||
|
||||
out:
|
||||
mutex_unlock(&ashmem_mutex);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* ashmem_shrink - our cache shrinker, called from mm/vmscan.c :: shrink_slab
|
||||
*
|
||||
* 'nr_to_scan' is the number of objects (pages) to prune, or 0 to query how
|
||||
* many objects (pages) we have in total.
|
||||
*
|
||||
* 'gfp_mask' is the mask of the allocation that got us into this mess.
|
||||
*
|
||||
* Return value is the number of objects (pages) remaining, or -1 if we cannot
|
||||
* proceed without risk of deadlock (due to gfp_mask).
|
||||
*
|
||||
* We approximate LRU via least-recently-unpinned, jettisoning unpinned partial
|
||||
* chunks of ashmem regions LRU-wise one-at-a-time until we hit 'nr_to_scan'
|
||||
* pages freed.
|
||||
*/
|
||||
static int ashmem_shrink(struct shrinker *s, struct shrink_control *sc)
|
||||
{
|
||||
struct ashmem_range *range, *next;
|
||||
|
||||
/* We might recurse into filesystem code, so bail out if necessary */
|
||||
if (sc->nr_to_scan && !(sc->gfp_mask & __GFP_FS))
|
||||
return -1;
|
||||
if (!sc->nr_to_scan)
|
||||
return lru_count;
|
||||
|
||||
mutex_lock(&ashmem_mutex);
|
||||
list_for_each_entry_safe(range, next, &ashmem_lru_list, lru) {
|
||||
struct inode *inode = range->asma->file->f_dentry->d_inode;
|
||||
loff_t start = range->pgstart * PAGE_SIZE;
|
||||
loff_t end = (range->pgend + 1) * PAGE_SIZE - 1;
|
||||
|
||||
vmtruncate_range(inode, start, end);
|
||||
range->purged = ASHMEM_WAS_PURGED;
|
||||
lru_del(range);
|
||||
|
||||
sc->nr_to_scan -= range_size(range);
|
||||
if (sc->nr_to_scan <= 0)
|
||||
break;
|
||||
}
|
||||
mutex_unlock(&ashmem_mutex);
|
||||
|
||||
return lru_count;
|
||||
}
|
||||
|
||||
static struct shrinker ashmem_shrinker = {
|
||||
.shrink = ashmem_shrink,
|
||||
.seeks = DEFAULT_SEEKS * 4,
|
||||
};
|
||||
|
||||
static int set_prot_mask(struct ashmem_area *asma, unsigned long prot)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
mutex_lock(&ashmem_mutex);
|
||||
|
||||
/* the user can only remove, not add, protection bits */
|
||||
if (unlikely((asma->prot_mask & prot) != prot)) {
|
||||
ret = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* does the application expect PROT_READ to imply PROT_EXEC? */
|
||||
if ((prot & PROT_READ) && (current->personality & READ_IMPLIES_EXEC))
|
||||
prot |= PROT_EXEC;
|
||||
|
||||
asma->prot_mask = prot;
|
||||
|
||||
out:
|
||||
mutex_unlock(&ashmem_mutex);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int set_name(struct ashmem_area *asma, void __user *name)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
mutex_lock(&ashmem_mutex);
|
||||
|
||||
/* cannot change an existing mapping's name */
|
||||
if (unlikely(asma->file)) {
|
||||
ret = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (unlikely(copy_from_user(asma->name + ASHMEM_NAME_PREFIX_LEN,
|
||||
name, ASHMEM_NAME_LEN)))
|
||||
ret = -EFAULT;
|
||||
asma->name[ASHMEM_FULL_NAME_LEN-1] = '\0';
|
||||
|
||||
out:
|
||||
mutex_unlock(&ashmem_mutex);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int get_name(struct ashmem_area *asma, void __user *name)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
mutex_lock(&ashmem_mutex);
|
||||
if (asma->name[ASHMEM_NAME_PREFIX_LEN] != '\0') {
|
||||
size_t len;
|
||||
|
||||
/*
|
||||
* Copying only `len', instead of ASHMEM_NAME_LEN, bytes
|
||||
* prevents us from revealing one user's stack to another.
|
||||
*/
|
||||
len = strlen(asma->name + ASHMEM_NAME_PREFIX_LEN) + 1;
|
||||
if (unlikely(copy_to_user(name,
|
||||
asma->name + ASHMEM_NAME_PREFIX_LEN, len)))
|
||||
ret = -EFAULT;
|
||||
} else {
|
||||
if (unlikely(copy_to_user(name, ASHMEM_NAME_DEF,
|
||||
sizeof(ASHMEM_NAME_DEF))))
|
||||
ret = -EFAULT;
|
||||
}
|
||||
mutex_unlock(&ashmem_mutex);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* ashmem_pin - pin the given ashmem region, returning whether it was
|
||||
* previously purged (ASHMEM_WAS_PURGED) or not (ASHMEM_NOT_PURGED).
|
||||
*
|
||||
* Caller must hold ashmem_mutex.
|
||||
*/
|
||||
static int ashmem_pin(struct ashmem_area *asma, size_t pgstart, size_t pgend)
|
||||
{
|
||||
struct ashmem_range *range, *next;
|
||||
int ret = ASHMEM_NOT_PURGED;
|
||||
|
||||
list_for_each_entry_safe(range, next, &asma->unpinned_list, unpinned) {
|
||||
/* moved past last applicable page; we can short circuit */
|
||||
if (range_before_page(range, pgstart))
|
||||
break;
|
||||
|
||||
/*
|
||||
* The user can ask us to pin pages that span multiple ranges,
|
||||
* or to pin pages that aren't even unpinned, so this is messy.
|
||||
*
|
||||
* Four cases:
|
||||
* 1. The requested range subsumes an existing range, so we
|
||||
* just remove the entire matching range.
|
||||
* 2. The requested range overlaps the start of an existing
|
||||
* range, so we just update that range.
|
||||
* 3. The requested range overlaps the end of an existing
|
||||
* range, so we just update that range.
|
||||
* 4. The requested range punches a hole in an existing range,
|
||||
* so we have to update one side of the range and then
|
||||
* create a new range for the other side.
|
||||
*/
|
||||
if (page_range_in_range(range, pgstart, pgend)) {
|
||||
ret |= range->purged;
|
||||
|
||||
/* Case #1: Easy. Just nuke the whole thing. */
|
||||
if (page_range_subsumes_range(range, pgstart, pgend)) {
|
||||
range_del(range);
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Case #2: We overlap from the start, so adjust it */
|
||||
if (range->pgstart >= pgstart) {
|
||||
range_shrink(range, pgend + 1, range->pgend);
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Case #3: We overlap from the rear, so adjust it */
|
||||
if (range->pgend <= pgend) {
|
||||
range_shrink(range, range->pgstart, pgstart-1);
|
||||
continue;
|
||||
}
|
||||
|
||||
/*
|
||||
* Case #4: We eat a chunk out of the middle. A bit
|
||||
* more complicated, we allocate a new range for the
|
||||
* second half and adjust the first chunk's endpoint.
|
||||
*/
|
||||
range_alloc(asma, range, range->purged,
|
||||
pgend + 1, range->pgend);
|
||||
range_shrink(range, range->pgstart, pgstart - 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* ashmem_unpin - unpin the given range of pages. Returns zero on success.
|
||||
*
|
||||
* Caller must hold ashmem_mutex.
|
||||
*/
|
||||
static int ashmem_unpin(struct ashmem_area *asma, size_t pgstart, size_t pgend)
|
||||
{
|
||||
struct ashmem_range *range, *next;
|
||||
unsigned int purged = ASHMEM_NOT_PURGED;
|
||||
|
||||
restart:
|
||||
list_for_each_entry_safe(range, next, &asma->unpinned_list, unpinned) {
|
||||
/* short circuit: this is our insertion point */
|
||||
if (range_before_page(range, pgstart))
|
||||
break;
|
||||
|
||||
/*
|
||||
* The user can ask us to unpin pages that are already entirely
|
||||
* or partially pinned. We handle those two cases here.
|
||||
*/
|
||||
if (page_range_subsumed_by_range(range, pgstart, pgend))
|
||||
return 0;
|
||||
if (page_range_in_range(range, pgstart, pgend)) {
|
||||
pgstart = min_t(size_t, range->pgstart, pgstart),
|
||||
pgend = max_t(size_t, range->pgend, pgend);
|
||||
purged |= range->purged;
|
||||
range_del(range);
|
||||
goto restart;
|
||||
}
|
||||
}
|
||||
|
||||
return range_alloc(asma, range, purged, pgstart, pgend);
|
||||
}
|
||||
|
||||
/*
|
||||
* ashmem_get_pin_status - Returns ASHMEM_IS_UNPINNED if _any_ pages in the
|
||||
* given interval are unpinned and ASHMEM_IS_PINNED otherwise.
|
||||
*
|
||||
* Caller must hold ashmem_mutex.
|
||||
*/
|
||||
static int ashmem_get_pin_status(struct ashmem_area *asma, size_t pgstart,
|
||||
size_t pgend)
|
||||
{
|
||||
struct ashmem_range *range;
|
||||
int ret = ASHMEM_IS_PINNED;
|
||||
|
||||
list_for_each_entry(range, &asma->unpinned_list, unpinned) {
|
||||
if (range_before_page(range, pgstart))
|
||||
break;
|
||||
if (page_range_in_range(range, pgstart, pgend)) {
|
||||
ret = ASHMEM_IS_UNPINNED;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int ashmem_pin_unpin(struct ashmem_area *asma, unsigned long cmd,
|
||||
void __user *p)
|
||||
{
|
||||
struct ashmem_pin pin;
|
||||
size_t pgstart, pgend;
|
||||
int ret = -EINVAL;
|
||||
|
||||
if (unlikely(!asma->file))
|
||||
return -EINVAL;
|
||||
|
||||
if (unlikely(copy_from_user(&pin, p, sizeof(pin))))
|
||||
return -EFAULT;
|
||||
|
||||
/* per custom, you can pass zero for len to mean "everything onward" */
|
||||
if (!pin.len)
|
||||
pin.len = PAGE_ALIGN(asma->size) - pin.offset;
|
||||
|
||||
if (unlikely((pin.offset | pin.len) & ~PAGE_MASK))
|
||||
return -EINVAL;
|
||||
|
||||
if (unlikely(((__u32) -1) - pin.offset < pin.len))
|
||||
return -EINVAL;
|
||||
|
||||
if (unlikely(PAGE_ALIGN(asma->size) < pin.offset + pin.len))
|
||||
return -EINVAL;
|
||||
|
||||
pgstart = pin.offset / PAGE_SIZE;
|
||||
pgend = pgstart + (pin.len / PAGE_SIZE) - 1;
|
||||
|
||||
mutex_lock(&ashmem_mutex);
|
||||
|
||||
switch (cmd) {
|
||||
case ASHMEM_PIN:
|
||||
ret = ashmem_pin(asma, pgstart, pgend);
|
||||
break;
|
||||
case ASHMEM_UNPIN:
|
||||
ret = ashmem_unpin(asma, pgstart, pgend);
|
||||
break;
|
||||
case ASHMEM_GET_PIN_STATUS:
|
||||
ret = ashmem_get_pin_status(asma, pgstart, pgend);
|
||||
break;
|
||||
}
|
||||
|
||||
mutex_unlock(&ashmem_mutex);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static long ashmem_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
|
||||
{
|
||||
struct ashmem_area *asma = file->private_data;
|
||||
long ret = -ENOTTY;
|
||||
|
||||
switch (cmd) {
|
||||
case ASHMEM_SET_NAME:
|
||||
ret = set_name(asma, (void __user *) arg);
|
||||
break;
|
||||
case ASHMEM_GET_NAME:
|
||||
ret = get_name(asma, (void __user *) arg);
|
||||
break;
|
||||
case ASHMEM_SET_SIZE:
|
||||
ret = -EINVAL;
|
||||
if (!asma->file) {
|
||||
ret = 0;
|
||||
asma->size = (size_t) arg;
|
||||
}
|
||||
break;
|
||||
case ASHMEM_GET_SIZE:
|
||||
ret = asma->size;
|
||||
break;
|
||||
case ASHMEM_SET_PROT_MASK:
|
||||
ret = set_prot_mask(asma, arg);
|
||||
break;
|
||||
case ASHMEM_GET_PROT_MASK:
|
||||
ret = asma->prot_mask;
|
||||
break;
|
||||
case ASHMEM_PIN:
|
||||
case ASHMEM_UNPIN:
|
||||
case ASHMEM_GET_PIN_STATUS:
|
||||
ret = ashmem_pin_unpin(asma, cmd, (void __user *) arg);
|
||||
break;
|
||||
case ASHMEM_PURGE_ALL_CACHES:
|
||||
ret = -EPERM;
|
||||
if (capable(CAP_SYS_ADMIN)) {
|
||||
struct shrink_control sc = {
|
||||
.gfp_mask = GFP_KERNEL,
|
||||
.nr_to_scan = 0,
|
||||
};
|
||||
ret = ashmem_shrink(&ashmem_shrinker, &sc);
|
||||
sc.nr_to_scan = ret;
|
||||
ashmem_shrink(&ashmem_shrinker, &sc);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static struct file_operations ashmem_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = ashmem_open,
|
||||
.release = ashmem_release,
|
||||
.read = ashmem_read,
|
||||
.llseek = ashmem_llseek,
|
||||
.mmap = ashmem_mmap,
|
||||
.unlocked_ioctl = ashmem_ioctl,
|
||||
.compat_ioctl = ashmem_ioctl,
|
||||
};
|
||||
|
||||
static struct miscdevice ashmem_misc = {
|
||||
.minor = MISC_DYNAMIC_MINOR,
|
||||
.name = "ashmem",
|
||||
.fops = &ashmem_fops,
|
||||
};
|
||||
|
||||
static int __init ashmem_init(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ashmem_area_cachep = kmem_cache_create("ashmem_area_cache",
|
||||
sizeof(struct ashmem_area),
|
||||
0, 0, NULL);
|
||||
if (unlikely(!ashmem_area_cachep)) {
|
||||
printk(KERN_ERR "ashmem: failed to create slab cache\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
ashmem_range_cachep = kmem_cache_create("ashmem_range_cache",
|
||||
sizeof(struct ashmem_range),
|
||||
0, 0, NULL);
|
||||
if (unlikely(!ashmem_range_cachep)) {
|
||||
printk(KERN_ERR "ashmem: failed to create slab cache\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
ret = misc_register(&ashmem_misc);
|
||||
if (unlikely(ret)) {
|
||||
printk(KERN_ERR "ashmem: failed to register misc device!\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
register_shrinker(&ashmem_shrinker);
|
||||
|
||||
printk(KERN_INFO "ashmem: initialized\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void __exit ashmem_exit(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
unregister_shrinker(&ashmem_shrinker);
|
||||
|
||||
ret = misc_deregister(&ashmem_misc);
|
||||
if (unlikely(ret))
|
||||
printk(KERN_ERR "ashmem: failed to unregister misc device!\n");
|
||||
|
||||
kmem_cache_destroy(ashmem_range_cachep);
|
||||
kmem_cache_destroy(ashmem_area_cachep);
|
||||
|
||||
printk(KERN_INFO "ashmem: unloaded\n");
|
||||
}
|
||||
|
||||
module_init(ashmem_init);
|
||||
module_exit(ashmem_exit);
|
||||
|
||||
MODULE_LICENSE("GPL");
|
|
@ -0,0 +1,48 @@
|
|||
/*
|
||||
* include/linux/ashmem.h
|
||||
*
|
||||
* Copyright 2008 Google Inc.
|
||||
* Author: Robert Love
|
||||
*
|
||||
* This file is dual licensed. It may be redistributed and/or modified
|
||||
* under the terms of the Apache 2.0 License OR version 2 of the GNU
|
||||
* General Public License.
|
||||
*/
|
||||
|
||||
#ifndef _LINUX_ASHMEM_H
|
||||
#define _LINUX_ASHMEM_H
|
||||
|
||||
#include <linux/limits.h>
|
||||
#include <linux/ioctl.h>
|
||||
|
||||
#define ASHMEM_NAME_LEN 256
|
||||
|
||||
#define ASHMEM_NAME_DEF "dev/ashmem"
|
||||
|
||||
/* Return values from ASHMEM_PIN: Was the mapping purged while unpinned? */
|
||||
#define ASHMEM_NOT_PURGED 0
|
||||
#define ASHMEM_WAS_PURGED 1
|
||||
|
||||
/* Return values from ASHMEM_GET_PIN_STATUS: Is the mapping pinned? */
|
||||
#define ASHMEM_IS_UNPINNED 0
|
||||
#define ASHMEM_IS_PINNED 1
|
||||
|
||||
struct ashmem_pin {
|
||||
__u32 offset; /* offset into region, in bytes, page-aligned */
|
||||
__u32 len; /* length forward from offset, in bytes, page-aligned */
|
||||
};
|
||||
|
||||
#define __ASHMEMIOC 0x77
|
||||
|
||||
#define ASHMEM_SET_NAME _IOW(__ASHMEMIOC, 1, char[ASHMEM_NAME_LEN])
|
||||
#define ASHMEM_GET_NAME _IOR(__ASHMEMIOC, 2, char[ASHMEM_NAME_LEN])
|
||||
#define ASHMEM_SET_SIZE _IOW(__ASHMEMIOC, 3, size_t)
|
||||
#define ASHMEM_GET_SIZE _IO(__ASHMEMIOC, 4)
|
||||
#define ASHMEM_SET_PROT_MASK _IOW(__ASHMEMIOC, 5, unsigned long)
|
||||
#define ASHMEM_GET_PROT_MASK _IO(__ASHMEMIOC, 6)
|
||||
#define ASHMEM_PIN _IOW(__ASHMEMIOC, 7, struct ashmem_pin)
|
||||
#define ASHMEM_UNPIN _IOW(__ASHMEMIOC, 8, struct ashmem_pin)
|
||||
#define ASHMEM_GET_PIN_STATUS _IO(__ASHMEMIOC, 9)
|
||||
#define ASHMEM_PURGE_ALL_CACHES _IO(__ASHMEMIOC, 10)
|
||||
|
||||
#endif /* _LINUX_ASHMEM_H */
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,330 @@
|
|||
/*
|
||||
* Copyright (C) 2008 Google, Inc.
|
||||
*
|
||||
* Based on, but no longer compatible with, the original
|
||||
* OpenBinder.org binder driver interface, which is:
|
||||
*
|
||||
* Copyright (c) 2005 Palmsource, Inc.
|
||||
*
|
||||
* This software is licensed under the terms of the GNU General Public
|
||||
* License version 2, as published by the Free Software Foundation, and
|
||||
* may be copied, distributed, and modified under those terms.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _LINUX_BINDER_H
|
||||
#define _LINUX_BINDER_H
|
||||
|
||||
#include <linux/ioctl.h>
|
||||
|
||||
#define B_PACK_CHARS(c1, c2, c3, c4) \
|
||||
((((c1)<<24)) | (((c2)<<16)) | (((c3)<<8)) | (c4))
|
||||
#define B_TYPE_LARGE 0x85
|
||||
|
||||
enum {
|
||||
BINDER_TYPE_BINDER = B_PACK_CHARS('s', 'b', '*', B_TYPE_LARGE),
|
||||
BINDER_TYPE_WEAK_BINDER = B_PACK_CHARS('w', 'b', '*', B_TYPE_LARGE),
|
||||
BINDER_TYPE_HANDLE = B_PACK_CHARS('s', 'h', '*', B_TYPE_LARGE),
|
||||
BINDER_TYPE_WEAK_HANDLE = B_PACK_CHARS('w', 'h', '*', B_TYPE_LARGE),
|
||||
BINDER_TYPE_FD = B_PACK_CHARS('f', 'd', '*', B_TYPE_LARGE),
|
||||
};
|
||||
|
||||
enum {
|
||||
FLAT_BINDER_FLAG_PRIORITY_MASK = 0xff,
|
||||
FLAT_BINDER_FLAG_ACCEPTS_FDS = 0x100,
|
||||
};
|
||||
|
||||
/*
|
||||
* This is the flattened representation of a Binder object for transfer
|
||||
* between processes. The 'offsets' supplied as part of a binder transaction
|
||||
* contains offsets into the data where these structures occur. The Binder
|
||||
* driver takes care of re-writing the structure type and data as it moves
|
||||
* between processes.
|
||||
*/
|
||||
struct flat_binder_object {
|
||||
/* 8 bytes for large_flat_header. */
|
||||
unsigned long type;
|
||||
unsigned long flags;
|
||||
|
||||
/* 8 bytes of data. */
|
||||
union {
|
||||
void *binder; /* local object */
|
||||
signed long handle; /* remote object */
|
||||
};
|
||||
|
||||
/* extra data associated with local object */
|
||||
void *cookie;
|
||||
};
|
||||
|
||||
/*
|
||||
* On 64-bit platforms where user code may run in 32-bits the driver must
|
||||
* translate the buffer (and local binder) addresses apropriately.
|
||||
*/
|
||||
|
||||
struct binder_write_read {
|
||||
signed long write_size; /* bytes to write */
|
||||
signed long write_consumed; /* bytes consumed by driver */
|
||||
unsigned long write_buffer;
|
||||
signed long read_size; /* bytes to read */
|
||||
signed long read_consumed; /* bytes consumed by driver */
|
||||
unsigned long read_buffer;
|
||||
};
|
||||
|
||||
/* Use with BINDER_VERSION, driver fills in fields. */
|
||||
struct binder_version {
|
||||
/* driver protocol version -- increment with incompatible change */
|
||||
signed long protocol_version;
|
||||
};
|
||||
|
||||
/* This is the current protocol version. */
|
||||
#define BINDER_CURRENT_PROTOCOL_VERSION 7
|
||||
|
||||
#define BINDER_WRITE_READ _IOWR('b', 1, struct binder_write_read)
|
||||
#define BINDER_SET_IDLE_TIMEOUT _IOW('b', 3, int64_t)
|
||||
#define BINDER_SET_MAX_THREADS _IOW('b', 5, size_t)
|
||||
#define BINDER_SET_IDLE_PRIORITY _IOW('b', 6, int)
|
||||
#define BINDER_SET_CONTEXT_MGR _IOW('b', 7, int)
|
||||
#define BINDER_THREAD_EXIT _IOW('b', 8, int)
|
||||
#define BINDER_VERSION _IOWR('b', 9, struct binder_version)
|
||||
|
||||
/*
|
||||
* NOTE: Two special error codes you should check for when calling
|
||||
* in to the driver are:
|
||||
*
|
||||
* EINTR -- The operation has been interupted. This should be
|
||||
* handled by retrying the ioctl() until a different error code
|
||||
* is returned.
|
||||
*
|
||||
* ECONNREFUSED -- The driver is no longer accepting operations
|
||||
* from your process. That is, the process is being destroyed.
|
||||
* You should handle this by exiting from your process. Note
|
||||
* that once this error code is returned, all further calls to
|
||||
* the driver from any thread will return this same code.
|
||||
*/
|
||||
|
||||
enum transaction_flags {
|
||||
TF_ONE_WAY = 0x01, /* this is a one-way call: async, no return */
|
||||
TF_ROOT_OBJECT = 0x04, /* contents are the component's root object */
|
||||
TF_STATUS_CODE = 0x08, /* contents are a 32-bit status code */
|
||||
TF_ACCEPT_FDS = 0x10, /* allow replies with file descriptors */
|
||||
};
|
||||
|
||||
struct binder_transaction_data {
|
||||
/* The first two are only used for bcTRANSACTION and brTRANSACTION,
|
||||
* identifying the target and contents of the transaction.
|
||||
*/
|
||||
union {
|
||||
size_t handle; /* target descriptor of command transaction */
|
||||
void *ptr; /* target descriptor of return transaction */
|
||||
} target;
|
||||
void *cookie; /* target object cookie */
|
||||
unsigned int code; /* transaction command */
|
||||
|
||||
/* General information about the transaction. */
|
||||
unsigned int flags;
|
||||
pid_t sender_pid;
|
||||
uid_t sender_euid;
|
||||
size_t data_size; /* number of bytes of data */
|
||||
size_t offsets_size; /* number of bytes of offsets */
|
||||
|
||||
/* If this transaction is inline, the data immediately
|
||||
* follows here; otherwise, it ends with a pointer to
|
||||
* the data buffer.
|
||||
*/
|
||||
union {
|
||||
struct {
|
||||
/* transaction data */
|
||||
const void *buffer;
|
||||
/* offsets from buffer to flat_binder_object structs */
|
||||
const void *offsets;
|
||||
} ptr;
|
||||
uint8_t buf[8];
|
||||
} data;
|
||||
};
|
||||
|
||||
struct binder_ptr_cookie {
|
||||
void *ptr;
|
||||
void *cookie;
|
||||
};
|
||||
|
||||
struct binder_pri_desc {
|
||||
int priority;
|
||||
int desc;
|
||||
};
|
||||
|
||||
struct binder_pri_ptr_cookie {
|
||||
int priority;
|
||||
void *ptr;
|
||||
void *cookie;
|
||||
};
|
||||
|
||||
enum BinderDriverReturnProtocol {
|
||||
BR_ERROR = _IOR('r', 0, int),
|
||||
/*
|
||||
* int: error code
|
||||
*/
|
||||
|
||||
BR_OK = _IO('r', 1),
|
||||
/* No parameters! */
|
||||
|
||||
BR_TRANSACTION = _IOR('r', 2, struct binder_transaction_data),
|
||||
BR_REPLY = _IOR('r', 3, struct binder_transaction_data),
|
||||
/*
|
||||
* binder_transaction_data: the received command.
|
||||
*/
|
||||
|
||||
BR_ACQUIRE_RESULT = _IOR('r', 4, int),
|
||||
/*
|
||||
* not currently supported
|
||||
* int: 0 if the last bcATTEMPT_ACQUIRE was not successful.
|
||||
* Else the remote object has acquired a primary reference.
|
||||
*/
|
||||
|
||||
BR_DEAD_REPLY = _IO('r', 5),
|
||||
/*
|
||||
* The target of the last transaction (either a bcTRANSACTION or
|
||||
* a bcATTEMPT_ACQUIRE) is no longer with us. No parameters.
|
||||
*/
|
||||
|
||||
BR_TRANSACTION_COMPLETE = _IO('r', 6),
|
||||
/*
|
||||
* No parameters... always refers to the last transaction requested
|
||||
* (including replies). Note that this will be sent even for
|
||||
* asynchronous transactions.
|
||||
*/
|
||||
|
||||
BR_INCREFS = _IOR('r', 7, struct binder_ptr_cookie),
|
||||
BR_ACQUIRE = _IOR('r', 8, struct binder_ptr_cookie),
|
||||
BR_RELEASE = _IOR('r', 9, struct binder_ptr_cookie),
|
||||
BR_DECREFS = _IOR('r', 10, struct binder_ptr_cookie),
|
||||
/*
|
||||
* void *: ptr to binder
|
||||
* void *: cookie for binder
|
||||
*/
|
||||
|
||||
BR_ATTEMPT_ACQUIRE = _IOR('r', 11, struct binder_pri_ptr_cookie),
|
||||
/*
|
||||
* not currently supported
|
||||
* int: priority
|
||||
* void *: ptr to binder
|
||||
* void *: cookie for binder
|
||||
*/
|
||||
|
||||
BR_NOOP = _IO('r', 12),
|
||||
/*
|
||||
* No parameters. Do nothing and examine the next command. It exists
|
||||
* primarily so that we can replace it with a BR_SPAWN_LOOPER command.
|
||||
*/
|
||||
|
||||
BR_SPAWN_LOOPER = _IO('r', 13),
|
||||
/*
|
||||
* No parameters. The driver has determined that a process has no
|
||||
* threads waiting to service incomming transactions. When a process
|
||||
* receives this command, it must spawn a new service thread and
|
||||
* register it via bcENTER_LOOPER.
|
||||
*/
|
||||
|
||||
BR_FINISHED = _IO('r', 14),
|
||||
/*
|
||||
* not currently supported
|
||||
* stop threadpool thread
|
||||
*/
|
||||
|
||||
BR_DEAD_BINDER = _IOR('r', 15, void *),
|
||||
/*
|
||||
* void *: cookie
|
||||
*/
|
||||
BR_CLEAR_DEATH_NOTIFICATION_DONE = _IOR('r', 16, void *),
|
||||
/*
|
||||
* void *: cookie
|
||||
*/
|
||||
|
||||
BR_FAILED_REPLY = _IO('r', 17),
|
||||
/*
|
||||
* The the last transaction (either a bcTRANSACTION or
|
||||
* a bcATTEMPT_ACQUIRE) failed (e.g. out of memory). No parameters.
|
||||
*/
|
||||
};
|
||||
|
||||
enum BinderDriverCommandProtocol {
|
||||
BC_TRANSACTION = _IOW('c', 0, struct binder_transaction_data),
|
||||
BC_REPLY = _IOW('c', 1, struct binder_transaction_data),
|
||||
/*
|
||||
* binder_transaction_data: the sent command.
|
||||
*/
|
||||
|
||||
BC_ACQUIRE_RESULT = _IOW('c', 2, int),
|
||||
/*
|
||||
* not currently supported
|
||||
* int: 0 if the last BR_ATTEMPT_ACQUIRE was not successful.
|
||||
* Else you have acquired a primary reference on the object.
|
||||
*/
|
||||
|
||||
BC_FREE_BUFFER = _IOW('c', 3, int),
|
||||
/*
|
||||
* void *: ptr to transaction data received on a read
|
||||
*/
|
||||
|
||||
BC_INCREFS = _IOW('c', 4, int),
|
||||
BC_ACQUIRE = _IOW('c', 5, int),
|
||||
BC_RELEASE = _IOW('c', 6, int),
|
||||
BC_DECREFS = _IOW('c', 7, int),
|
||||
/*
|
||||
* int: descriptor
|
||||
*/
|
||||
|
||||
BC_INCREFS_DONE = _IOW('c', 8, struct binder_ptr_cookie),
|
||||
BC_ACQUIRE_DONE = _IOW('c', 9, struct binder_ptr_cookie),
|
||||
/*
|
||||
* void *: ptr to binder
|
||||
* void *: cookie for binder
|
||||
*/
|
||||
|
||||
BC_ATTEMPT_ACQUIRE = _IOW('c', 10, struct binder_pri_desc),
|
||||
/*
|
||||
* not currently supported
|
||||
* int: priority
|
||||
* int: descriptor
|
||||
*/
|
||||
|
||||
BC_REGISTER_LOOPER = _IO('c', 11),
|
||||
/*
|
||||
* No parameters.
|
||||
* Register a spawned looper thread with the device.
|
||||
*/
|
||||
|
||||
BC_ENTER_LOOPER = _IO('c', 12),
|
||||
BC_EXIT_LOOPER = _IO('c', 13),
|
||||
/*
|
||||
* No parameters.
|
||||
* These two commands are sent as an application-level thread
|
||||
* enters and exits the binder loop, respectively. They are
|
||||
* used so the binder can have an accurate count of the number
|
||||
* of looping threads it has available.
|
||||
*/
|
||||
|
||||
BC_REQUEST_DEATH_NOTIFICATION = _IOW('c', 14, struct binder_ptr_cookie),
|
||||
/*
|
||||
* void *: ptr to binder
|
||||
* void *: cookie
|
||||
*/
|
||||
|
||||
BC_CLEAR_DEATH_NOTIFICATION = _IOW('c', 15, struct binder_ptr_cookie),
|
||||
/*
|
||||
* void *: ptr to binder
|
||||
* void *: cookie
|
||||
*/
|
||||
|
||||
BC_DEAD_BINDER_DONE = _IOW('c', 16, void *),
|
||||
/*
|
||||
* void *: cookie
|
||||
*/
|
||||
};
|
||||
|
||||
#endif /* _LINUX_BINDER_H */
|
||||
|
|
@ -0,0 +1,616 @@
|
|||
/*
|
||||
* drivers/misc/logger.c
|
||||
*
|
||||
* A Logging Subsystem
|
||||
*
|
||||
* Copyright (C) 2007-2008 Google, Inc.
|
||||
*
|
||||
* Robert Love <rlove@google.com>
|
||||
*
|
||||
* This software is licensed under the terms of the GNU General Public
|
||||
* License version 2, as published by the Free Software Foundation, and
|
||||
* may be copied, distributed, and modified under those terms.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include <linux/sched.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/fs.h>
|
||||
#include <linux/miscdevice.h>
|
||||
#include <linux/uaccess.h>
|
||||
#include <linux/poll.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/time.h>
|
||||
#include "logger.h"
|
||||
|
||||
#include <asm/ioctls.h>
|
||||
|
||||
/*
|
||||
* struct logger_log - represents a specific log, such as 'main' or 'radio'
|
||||
*
|
||||
* This structure lives from module insertion until module removal, so it does
|
||||
* not need additional reference counting. The structure is protected by the
|
||||
* mutex 'mutex'.
|
||||
*/
|
||||
struct logger_log {
|
||||
unsigned char *buffer;/* the ring buffer itself */
|
||||
struct miscdevice misc; /* misc device representing the log */
|
||||
wait_queue_head_t wq; /* wait queue for readers */
|
||||
struct list_head readers; /* this log's readers */
|
||||
struct mutex mutex; /* mutex protecting buffer */
|
||||
size_t w_off; /* current write head offset */
|
||||
size_t head; /* new readers start here */
|
||||
size_t size; /* size of the log */
|
||||
};
|
||||
|
||||
/*
|
||||
* struct logger_reader - a logging device open for reading
|
||||
*
|
||||
* This object lives from open to release, so we don't need additional
|
||||
* reference counting. The structure is protected by log->mutex.
|
||||
*/
|
||||
struct logger_reader {
|
||||
struct logger_log *log; /* associated log */
|
||||
struct list_head list; /* entry in logger_log's list */
|
||||
size_t r_off; /* current read head offset */
|
||||
};
|
||||
|
||||
/* logger_offset - returns index 'n' into the log via (optimized) modulus */
|
||||
#define logger_offset(n) ((n) & (log->size - 1))
|
||||
|
||||
/*
|
||||
* file_get_log - Given a file structure, return the associated log
|
||||
*
|
||||
* This isn't aesthetic. We have several goals:
|
||||
*
|
||||
* 1) Need to quickly obtain the associated log during an I/O operation
|
||||
* 2) Readers need to maintain state (logger_reader)
|
||||
* 3) Writers need to be very fast (open() should be a near no-op)
|
||||
*
|
||||
* In the reader case, we can trivially go file->logger_reader->logger_log.
|
||||
* For a writer, we don't want to maintain a logger_reader, so we just go
|
||||
* file->logger_log. Thus what file->private_data points at depends on whether
|
||||
* or not the file was opened for reading. This function hides that dirtiness.
|
||||
*/
|
||||
static inline struct logger_log *file_get_log(struct file *file)
|
||||
{
|
||||
if (file->f_mode & FMODE_READ) {
|
||||
struct logger_reader *reader = file->private_data;
|
||||
return reader->log;
|
||||
} else
|
||||
return file->private_data;
|
||||
}
|
||||
|
||||
/*
|
||||
* get_entry_len - Grabs the length of the payload of the next entry starting
|
||||
* from 'off'.
|
||||
*
|
||||
* Caller needs to hold log->mutex.
|
||||
*/
|
||||
static __u32 get_entry_len(struct logger_log *log, size_t off)
|
||||
{
|
||||
__u16 val;
|
||||
|
||||
switch (log->size - off) {
|
||||
case 1:
|
||||
memcpy(&val, log->buffer + off, 1);
|
||||
memcpy(((char *) &val) + 1, log->buffer, 1);
|
||||
break;
|
||||
default:
|
||||
memcpy(&val, log->buffer + off, 2);
|
||||
}
|
||||
|
||||
return sizeof(struct logger_entry) + val;
|
||||
}
|
||||
|
||||
/*
|
||||
* do_read_log_to_user - reads exactly 'count' bytes from 'log' into the
|
||||
* user-space buffer 'buf'. Returns 'count' on success.
|
||||
*
|
||||
* Caller must hold log->mutex.
|
||||
*/
|
||||
static ssize_t do_read_log_to_user(struct logger_log *log,
|
||||
struct logger_reader *reader,
|
||||
char __user *buf,
|
||||
size_t count)
|
||||
{
|
||||
size_t len;
|
||||
|
||||
/*
|
||||
* We read from the log in two disjoint operations. First, we read from
|
||||
* the current read head offset up to 'count' bytes or to the end of
|
||||
* the log, whichever comes first.
|
||||
*/
|
||||
len = min(count, log->size - reader->r_off);
|
||||
if (copy_to_user(buf, log->buffer + reader->r_off, len))
|
||||
return -EFAULT;
|
||||
|
||||
/*
|
||||
* Second, we read any remaining bytes, starting back at the head of
|
||||
* the log.
|
||||
*/
|
||||
if (count != len)
|
||||
if (copy_to_user(buf + len, log->buffer, count - len))
|
||||
return -EFAULT;
|
||||
|
||||
reader->r_off = logger_offset(reader->r_off + count);
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
/*
|
||||
* logger_read - our log's read() method
|
||||
*
|
||||
* Behavior:
|
||||
*
|
||||
* - O_NONBLOCK works
|
||||
* - If there are no log entries to read, blocks until log is written to
|
||||
* - Atomically reads exactly one log entry
|
||||
*
|
||||
* Optimal read size is LOGGER_ENTRY_MAX_LEN. Will set errno to EINVAL if read
|
||||
* buffer is insufficient to hold next entry.
|
||||
*/
|
||||
static ssize_t logger_read(struct file *file, char __user *buf,
|
||||
size_t count, loff_t *pos)
|
||||
{
|
||||
struct logger_reader *reader = file->private_data;
|
||||
struct logger_log *log = reader->log;
|
||||
ssize_t ret;
|
||||
DEFINE_WAIT(wait);
|
||||
|
||||
start:
|
||||
while (1) {
|
||||
prepare_to_wait(&log->wq, &wait, TASK_INTERRUPTIBLE);
|
||||
|
||||
mutex_lock(&log->mutex);
|
||||
ret = (log->w_off == reader->r_off);
|
||||
mutex_unlock(&log->mutex);
|
||||
if (!ret)
|
||||
break;
|
||||
|
||||
if (file->f_flags & O_NONBLOCK) {
|
||||
ret = -EAGAIN;
|
||||
break;
|
||||
}
|
||||
|
||||
if (signal_pending(current)) {
|
||||
ret = -EINTR;
|
||||
break;
|
||||
}
|
||||
|
||||
schedule();
|
||||
}
|
||||
|
||||
finish_wait(&log->wq, &wait);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
mutex_lock(&log->mutex);
|
||||
|
||||
/* is there still something to read or did we race? */
|
||||
if (unlikely(log->w_off == reader->r_off)) {
|
||||
mutex_unlock(&log->mutex);
|
||||
goto start;
|
||||
}
|
||||
|
||||
/* get the size of the next entry */
|
||||
ret = get_entry_len(log, reader->r_off);
|
||||
if (count < ret) {
|
||||
ret = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* get exactly one entry from the log */
|
||||
ret = do_read_log_to_user(log, reader, buf, ret);
|
||||
|
||||
out:
|
||||
mutex_unlock(&log->mutex);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* get_next_entry - return the offset of the first valid entry at least 'len'
|
||||
* bytes after 'off'.
|
||||
*
|
||||
* Caller must hold log->mutex.
|
||||
*/
|
||||
static size_t get_next_entry(struct logger_log *log, size_t off, size_t len)
|
||||
{
|
||||
size_t count = 0;
|
||||
|
||||
do {
|
||||
size_t nr = get_entry_len(log, off);
|
||||
off = logger_offset(off + nr);
|
||||
count += nr;
|
||||
} while (count < len);
|
||||
|
||||
return off;
|
||||
}
|
||||
|
||||
/*
|
||||
* clock_interval - is a < c < b in mod-space? Put another way, does the line
|
||||
* from a to b cross c?
|
||||
*/
|
||||
static inline int clock_interval(size_t a, size_t b, size_t c)
|
||||
{
|
||||
if (b < a) {
|
||||
if (a < c || b >= c)
|
||||
return 1;
|
||||
} else {
|
||||
if (a < c && b >= c)
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* fix_up_readers - walk the list of all readers and "fix up" any who were
|
||||
* lapped by the writer; also do the same for the default "start head".
|
||||
* We do this by "pulling forward" the readers and start head to the first
|
||||
* entry after the new write head.
|
||||
*
|
||||
* The caller needs to hold log->mutex.
|
||||
*/
|
||||
static void fix_up_readers(struct logger_log *log, size_t len)
|
||||
{
|
||||
size_t old = log->w_off;
|
||||
size_t new = logger_offset(old + len);
|
||||
struct logger_reader *reader;
|
||||
|
||||
if (clock_interval(old, new, log->head))
|
||||
log->head = get_next_entry(log, log->head, len);
|
||||
|
||||
list_for_each_entry(reader, &log->readers, list)
|
||||
if (clock_interval(old, new, reader->r_off))
|
||||
reader->r_off = get_next_entry(log, reader->r_off, len);
|
||||
}
|
||||
|
||||
/*
|
||||
* do_write_log - writes 'len' bytes from 'buf' to 'log'
|
||||
*
|
||||
* The caller needs to hold log->mutex.
|
||||
*/
|
||||
static void do_write_log(struct logger_log *log, const void *buf, size_t count)
|
||||
{
|
||||
size_t len;
|
||||
|
||||
len = min(count, log->size - log->w_off);
|
||||
memcpy(log->buffer + log->w_off, buf, len);
|
||||
|
||||
if (count != len)
|
||||
memcpy(log->buffer, buf + len, count - len);
|
||||
|
||||
log->w_off = logger_offset(log->w_off + count);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* do_write_log_user - writes 'len' bytes from the user-space buffer 'buf' to
|
||||
* the log 'log'
|
||||
*
|
||||
* The caller needs to hold log->mutex.
|
||||
*
|
||||
* Returns 'count' on success, negative error code on failure.
|
||||
*/
|
||||
static ssize_t do_write_log_from_user(struct logger_log *log,
|
||||
const void __user *buf, size_t count)
|
||||
{
|
||||
size_t len;
|
||||
|
||||
len = min(count, log->size - log->w_off);
|
||||
if (len && copy_from_user(log->buffer + log->w_off, buf, len))
|
||||
return -EFAULT;
|
||||
|
||||
if (count != len)
|
||||
if (copy_from_user(log->buffer, buf + len, count - len))
|
||||
return -EFAULT;
|
||||
|
||||
log->w_off = logger_offset(log->w_off + count);
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
/*
|
||||
* logger_aio_write - our write method, implementing support for write(),
|
||||
* writev(), and aio_write(). Writes are our fast path, and we try to optimize
|
||||
* them above all else.
|
||||
*/
|
||||
ssize_t logger_aio_write(struct kiocb *iocb, const struct iovec *iov,
|
||||
unsigned long nr_segs, loff_t ppos)
|
||||
{
|
||||
struct logger_log *log = file_get_log(iocb->ki_filp);
|
||||
size_t orig = log->w_off;
|
||||
struct logger_entry header;
|
||||
struct timespec now;
|
||||
ssize_t ret = 0;
|
||||
|
||||
now = current_kernel_time();
|
||||
|
||||
header.pid = current->tgid;
|
||||
header.tid = current->pid;
|
||||
header.sec = now.tv_sec;
|
||||
header.nsec = now.tv_nsec;
|
||||
header.len = min_t(size_t, iocb->ki_left, LOGGER_ENTRY_MAX_PAYLOAD);
|
||||
|
||||
/* null writes succeed, return zero */
|
||||
if (unlikely(!header.len))
|
||||
return 0;
|
||||
|
||||
mutex_lock(&log->mutex);
|
||||
|
||||
/*
|
||||
* Fix up any readers, pulling them forward to the first readable
|
||||
* entry after (what will be) the new write offset. We do this now
|
||||
* because if we partially fail, we can end up with clobbered log
|
||||
* entries that encroach on readable buffer.
|
||||
*/
|
||||
fix_up_readers(log, sizeof(struct logger_entry) + header.len);
|
||||
|
||||
do_write_log(log, &header, sizeof(struct logger_entry));
|
||||
|
||||
while (nr_segs-- > 0) {
|
||||
size_t len;
|
||||
ssize_t nr;
|
||||
|
||||
/* figure out how much of this vector we can keep */
|
||||
len = min_t(size_t, iov->iov_len, header.len - ret);
|
||||
|
||||
/* write out this segment's payload */
|
||||
nr = do_write_log_from_user(log, iov->iov_base, len);
|
||||
if (unlikely(nr < 0)) {
|
||||
log->w_off = orig;
|
||||
mutex_unlock(&log->mutex);
|
||||
return nr;
|
||||
}
|
||||
|
||||
iov++;
|
||||
ret += nr;
|
||||
}
|
||||
|
||||
mutex_unlock(&log->mutex);
|
||||
|
||||
/* wake up any blocked readers */
|
||||
wake_up_interruptible(&log->wq);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static struct logger_log *get_log_from_minor(int);
|
||||
|
||||
/*
|
||||
* logger_open - the log's open() file operation
|
||||
*
|
||||
* Note how near a no-op this is in the write-only case. Keep it that way!
|
||||
*/
|
||||
static int logger_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
struct logger_log *log;
|
||||
int ret;
|
||||
|
||||
ret = nonseekable_open(inode, file);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
log = get_log_from_minor(MINOR(inode->i_rdev));
|
||||
if (!log)
|
||||
return -ENODEV;
|
||||
|
||||
if (file->f_mode & FMODE_READ) {
|
||||
struct logger_reader *reader;
|
||||
|
||||
reader = kmalloc(sizeof(struct logger_reader), GFP_KERNEL);
|
||||
if (!reader)
|
||||
return -ENOMEM;
|
||||
|
||||
reader->log = log;
|
||||
INIT_LIST_HEAD(&reader->list);
|
||||
|
||||
mutex_lock(&log->mutex);
|
||||
reader->r_off = log->head;
|
||||
list_add_tail(&reader->list, &log->readers);
|
||||
mutex_unlock(&log->mutex);
|
||||
|
||||
file->private_data = reader;
|
||||
} else
|
||||
file->private_data = log;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* logger_release - the log's release file operation
|
||||
*
|
||||
* Note this is a total no-op in the write-only case. Keep it that way!
|
||||
*/
|
||||
static int logger_release(struct inode *ignored, struct file *file)
|
||||
{
|
||||
if (file->f_mode & FMODE_READ) {
|
||||
struct logger_reader *reader = file->private_data;
|
||||
list_del(&reader->list);
|
||||
kfree(reader);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* logger_poll - the log's poll file operation, for poll/select/epoll
|
||||
*
|
||||
* Note we always return POLLOUT, because you can always write() to the log.
|
||||
* Note also that, strictly speaking, a return value of POLLIN does not
|
||||
* guarantee that the log is readable without blocking, as there is a small
|
||||
* chance that the writer can lap the reader in the interim between poll()
|
||||
* returning and the read() request.
|
||||
*/
|
||||
static unsigned int logger_poll(struct file *file, poll_table *wait)
|
||||
{
|
||||
struct logger_reader *reader;
|
||||
struct logger_log *log;
|
||||
unsigned int ret = POLLOUT | POLLWRNORM;
|
||||
|
||||
if (!(file->f_mode & FMODE_READ))
|
||||
return ret;
|
||||
|
||||
reader = file->private_data;
|
||||
log = reader->log;
|
||||
|
||||
poll_wait(file, &log->wq, wait);
|
||||
|
||||
mutex_lock(&log->mutex);
|
||||
if (log->w_off != reader->r_off)
|
||||
ret |= POLLIN | POLLRDNORM;
|
||||
mutex_unlock(&log->mutex);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static long logger_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
|
||||
{
|
||||
struct logger_log *log = file_get_log(file);
|
||||
struct logger_reader *reader;
|
||||
long ret = -ENOTTY;
|
||||
|
||||
mutex_lock(&log->mutex);
|
||||
|
||||
switch (cmd) {
|
||||
case LOGGER_GET_LOG_BUF_SIZE:
|
||||
ret = log->size;
|
||||
break;
|
||||
case LOGGER_GET_LOG_LEN:
|
||||
if (!(file->f_mode & FMODE_READ)) {
|
||||
ret = -EBADF;
|
||||
break;
|
||||
}
|
||||
reader = file->private_data;
|
||||
if (log->w_off >= reader->r_off)
|
||||
ret = log->w_off - reader->r_off;
|
||||
else
|
||||
ret = (log->size - reader->r_off) + log->w_off;
|
||||
break;
|
||||
case LOGGER_GET_NEXT_ENTRY_LEN:
|
||||
if (!(file->f_mode & FMODE_READ)) {
|
||||
ret = -EBADF;
|
||||
break;
|
||||
}
|
||||
reader = file->private_data;
|
||||
if (log->w_off != reader->r_off)
|
||||
ret = get_entry_len(log, reader->r_off);
|
||||
else
|
||||
ret = 0;
|
||||
break;
|
||||
case LOGGER_FLUSH_LOG:
|
||||
if (!(file->f_mode & FMODE_WRITE)) {
|
||||
ret = -EBADF;
|
||||
break;
|
||||
}
|
||||
list_for_each_entry(reader, &log->readers, list)
|
||||
reader->r_off = log->w_off;
|
||||
log->head = log->w_off;
|
||||
ret = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
mutex_unlock(&log->mutex);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static const struct file_operations logger_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.read = logger_read,
|
||||
.aio_write = logger_aio_write,
|
||||
.poll = logger_poll,
|
||||
.unlocked_ioctl = logger_ioctl,
|
||||
.compat_ioctl = logger_ioctl,
|
||||
.open = logger_open,
|
||||
.release = logger_release,
|
||||
};
|
||||
|
||||
/*
|
||||
* Defines a log structure with name 'NAME' and a size of 'SIZE' bytes, which
|
||||
* must be a power of two, greater than LOGGER_ENTRY_MAX_LEN, and less than
|
||||
* LONG_MAX minus LOGGER_ENTRY_MAX_LEN.
|
||||
*/
|
||||
#define DEFINE_LOGGER_DEVICE(VAR, NAME, SIZE) \
|
||||
static unsigned char _buf_ ## VAR[SIZE]; \
|
||||
static struct logger_log VAR = { \
|
||||
.buffer = _buf_ ## VAR, \
|
||||
.misc = { \
|
||||
.minor = MISC_DYNAMIC_MINOR, \
|
||||
.name = NAME, \
|
||||
.fops = &logger_fops, \
|
||||
.parent = NULL, \
|
||||
}, \
|
||||
.wq = __WAIT_QUEUE_HEAD_INITIALIZER(VAR .wq), \
|
||||
.readers = LIST_HEAD_INIT(VAR .readers), \
|
||||
.mutex = __MUTEX_INITIALIZER(VAR .mutex), \
|
||||
.w_off = 0, \
|
||||
.head = 0, \
|
||||
.size = SIZE, \
|
||||
};
|
||||
|
||||
DEFINE_LOGGER_DEVICE(log_main, LOGGER_LOG_MAIN, 256*1024)
|
||||
DEFINE_LOGGER_DEVICE(log_events, LOGGER_LOG_EVENTS, 256*1024)
|
||||
DEFINE_LOGGER_DEVICE(log_radio, LOGGER_LOG_RADIO, 256*1024)
|
||||
DEFINE_LOGGER_DEVICE(log_system, LOGGER_LOG_SYSTEM, 256*1024)
|
||||
|
||||
static struct logger_log *get_log_from_minor(int minor)
|
||||
{
|
||||
if (log_main.misc.minor == minor)
|
||||
return &log_main;
|
||||
if (log_events.misc.minor == minor)
|
||||
return &log_events;
|
||||
if (log_radio.misc.minor == minor)
|
||||
return &log_radio;
|
||||
if (log_system.misc.minor == minor)
|
||||
return &log_system;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static int __init init_log(struct logger_log *log)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = misc_register(&log->misc);
|
||||
if (unlikely(ret)) {
|
||||
printk(KERN_ERR "logger: failed to register misc "
|
||||
"device for log '%s'!\n", log->misc.name);
|
||||
return ret;
|
||||
}
|
||||
|
||||
printk(KERN_INFO "logger: created %luK log '%s'\n",
|
||||
(unsigned long) log->size >> 10, log->misc.name);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int __init logger_init(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = init_log(&log_main);
|
||||
if (unlikely(ret))
|
||||
goto out;
|
||||
|
||||
ret = init_log(&log_events);
|
||||
if (unlikely(ret))
|
||||
goto out;
|
||||
|
||||
ret = init_log(&log_radio);
|
||||
if (unlikely(ret))
|
||||
goto out;
|
||||
|
||||
ret = init_log(&log_system);
|
||||
if (unlikely(ret))
|
||||
goto out;
|
||||
|
||||
out:
|
||||
return ret;
|
||||
}
|
||||
device_initcall(logger_init);
|
|
@ -0,0 +1,49 @@
|
|||
/* include/linux/logger.h
|
||||
*
|
||||
* Copyright (C) 2007-2008 Google, Inc.
|
||||
* Author: Robert Love <rlove@android.com>
|
||||
*
|
||||
* This software is licensed under the terms of the GNU General Public
|
||||
* License version 2, as published by the Free Software Foundation, and
|
||||
* may be copied, distributed, and modified under those terms.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _LINUX_LOGGER_H
|
||||
#define _LINUX_LOGGER_H
|
||||
|
||||
#include <linux/types.h>
|
||||
#include <linux/ioctl.h>
|
||||
|
||||
struct logger_entry {
|
||||
__u16 len; /* length of the payload */
|
||||
__u16 __pad; /* no matter what, we get 2 bytes of padding */
|
||||
__s32 pid; /* generating process's pid */
|
||||
__s32 tid; /* generating process's tid */
|
||||
__s32 sec; /* seconds since Epoch */
|
||||
__s32 nsec; /* nanoseconds */
|
||||
char msg[0]; /* the entry's payload */
|
||||
};
|
||||
|
||||
#define LOGGER_LOG_RADIO "log_radio" /* radio-related messages */
|
||||
#define LOGGER_LOG_EVENTS "log_events" /* system/hardware events */
|
||||
#define LOGGER_LOG_SYSTEM "log_system" /* system/framework messages */
|
||||
#define LOGGER_LOG_MAIN "log_main" /* everything else */
|
||||
|
||||
#define LOGGER_ENTRY_MAX_LEN (4*1024)
|
||||
#define LOGGER_ENTRY_MAX_PAYLOAD \
|
||||
(LOGGER_ENTRY_MAX_LEN - sizeof(struct logger_entry))
|
||||
|
||||
#define __LOGGERIO 0xAE
|
||||
|
||||
#define LOGGER_GET_LOG_BUF_SIZE _IO(__LOGGERIO, 1) /* size of log */
|
||||
#define LOGGER_GET_LOG_LEN _IO(__LOGGERIO, 2) /* used log len */
|
||||
#define LOGGER_GET_NEXT_ENTRY_LEN _IO(__LOGGERIO, 3) /* next entry len */
|
||||
#define LOGGER_FLUSH_LOG _IO(__LOGGERIO, 4) /* flush log */
|
||||
|
||||
#endif /* _LINUX_LOGGER_H */
|
|
@ -0,0 +1,219 @@
|
|||
/* drivers/misc/lowmemorykiller.c
|
||||
*
|
||||
* The lowmemorykiller driver lets user-space specify a set of memory thresholds
|
||||
* where processes with a range of oom_adj values will get killed. Specify the
|
||||
* minimum oom_adj values in /sys/module/lowmemorykiller/parameters/adj and the
|
||||
* number of free pages in /sys/module/lowmemorykiller/parameters/minfree. Both
|
||||
* files take a comma separated list of numbers in ascending order.
|
||||
*
|
||||
* For example, write "0,8" to /sys/module/lowmemorykiller/parameters/adj and
|
||||
* "1024,4096" to /sys/module/lowmemorykiller/parameters/minfree to kill
|
||||
* processes with a oom_adj value of 8 or higher when the free memory drops
|
||||
* below 4096 pages and kill processes with a oom_adj value of 0 or higher
|
||||
* when the free memory drops below 1024 pages.
|
||||
*
|
||||
* The driver considers memory used for caches to be free, but if a large
|
||||
* percentage of the cached memory is locked this can be very inaccurate
|
||||
* and processes may not get killed until the normal oom killer is triggered.
|
||||
*
|
||||
* Copyright (C) 2007-2008 Google, Inc.
|
||||
*
|
||||
* This software is licensed under the terms of the GNU General Public
|
||||
* License version 2, as published by the Free Software Foundation, and
|
||||
* may be copied, distributed, and modified under those terms.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/mm.h>
|
||||
#include <linux/oom.h>
|
||||
#include <linux/sched.h>
|
||||
#include <linux/profile.h>
|
||||
#include <linux/notifier.h>
|
||||
|
||||
static uint32_t lowmem_debug_level = 2;
|
||||
static int lowmem_adj[6] = {
|
||||
0,
|
||||
1,
|
||||
6,
|
||||
12,
|
||||
};
|
||||
static int lowmem_adj_size = 4;
|
||||
static size_t lowmem_minfree[6] = {
|
||||
3 * 512, /* 6MB */
|
||||
2 * 1024, /* 8MB */
|
||||
4 * 1024, /* 16MB */
|
||||
16 * 1024, /* 64MB */
|
||||
};
|
||||
static int lowmem_minfree_size = 4;
|
||||
|
||||
static struct task_struct *lowmem_deathpending;
|
||||
|
||||
#define lowmem_print(level, x...) \
|
||||
do { \
|
||||
if (lowmem_debug_level >= (level)) \
|
||||
printk(x); \
|
||||
} while (0)
|
||||
|
||||
static int
|
||||
task_notify_func(struct notifier_block *self, unsigned long val, void *data);
|
||||
|
||||
static struct notifier_block task_nb = {
|
||||
.notifier_call = task_notify_func,
|
||||
};
|
||||
|
||||
static int
|
||||
task_notify_func(struct notifier_block *self, unsigned long val, void *data)
|
||||
{
|
||||
struct task_struct *task = data;
|
||||
if (task == lowmem_deathpending) {
|
||||
lowmem_deathpending = NULL;
|
||||
task_handoff_unregister(&task_nb);
|
||||
}
|
||||
return NOTIFY_OK;
|
||||
}
|
||||
|
||||
static int lowmem_shrink(struct shrinker *s, struct shrink_control *sc)
|
||||
{
|
||||
struct task_struct *p;
|
||||
struct task_struct *selected = NULL;
|
||||
int rem = 0;
|
||||
int tasksize;
|
||||
int i;
|
||||
int min_adj = OOM_ADJUST_MAX + 1;
|
||||
int selected_tasksize = 0;
|
||||
int selected_oom_adj;
|
||||
int array_size = ARRAY_SIZE(lowmem_adj);
|
||||
int other_free = global_page_state(NR_FREE_PAGES);
|
||||
int other_file = global_page_state(NR_FILE_PAGES) -
|
||||
global_page_state(NR_SHMEM);
|
||||
|
||||
/*
|
||||
* If we already have a death outstanding, then
|
||||
* bail out right away; indicating to vmscan
|
||||
* that we have nothing further to offer on
|
||||
* this pass.
|
||||
*
|
||||
* Note: Currently you need CONFIG_PROFILING
|
||||
* for this to work correctly.
|
||||
*/
|
||||
if (lowmem_deathpending)
|
||||
return 0;
|
||||
|
||||
if (lowmem_adj_size < array_size)
|
||||
array_size = lowmem_adj_size;
|
||||
if (lowmem_minfree_size < array_size)
|
||||
array_size = lowmem_minfree_size;
|
||||
for (i = 0; i < array_size; i++) {
|
||||
if (other_free < lowmem_minfree[i] &&
|
||||
other_file < lowmem_minfree[i]) {
|
||||
min_adj = lowmem_adj[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (sc->nr_to_scan > 0)
|
||||
lowmem_print(3, "lowmem_shrink %lu, %x, ofree %d %d, ma %d\n",
|
||||
sc->nr_to_scan, sc->gfp_mask, other_free,
|
||||
other_file, min_adj);
|
||||
rem = global_page_state(NR_ACTIVE_ANON) +
|
||||
global_page_state(NR_ACTIVE_FILE) +
|
||||
global_page_state(NR_INACTIVE_ANON) +
|
||||
global_page_state(NR_INACTIVE_FILE);
|
||||
if (sc->nr_to_scan <= 0 || min_adj == OOM_ADJUST_MAX + 1) {
|
||||
lowmem_print(5, "lowmem_shrink %lu, %x, return %d\n",
|
||||
sc->nr_to_scan, sc->gfp_mask, rem);
|
||||
return rem;
|
||||
}
|
||||
selected_oom_adj = min_adj;
|
||||
|
||||
read_lock(&tasklist_lock);
|
||||
for_each_process(p) {
|
||||
struct mm_struct *mm;
|
||||
struct signal_struct *sig;
|
||||
int oom_adj;
|
||||
|
||||
task_lock(p);
|
||||
mm = p->mm;
|
||||
sig = p->signal;
|
||||
if (!mm || !sig) {
|
||||
task_unlock(p);
|
||||
continue;
|
||||
}
|
||||
oom_adj = sig->oom_adj;
|
||||
if (oom_adj < min_adj) {
|
||||
task_unlock(p);
|
||||
continue;
|
||||
}
|
||||
tasksize = get_mm_rss(mm);
|
||||
task_unlock(p);
|
||||
if (tasksize <= 0)
|
||||
continue;
|
||||
if (selected) {
|
||||
if (oom_adj < selected_oom_adj)
|
||||
continue;
|
||||
if (oom_adj == selected_oom_adj &&
|
||||
tasksize <= selected_tasksize)
|
||||
continue;
|
||||
}
|
||||
selected = p;
|
||||
selected_tasksize = tasksize;
|
||||
selected_oom_adj = oom_adj;
|
||||
lowmem_print(2, "select %d (%s), adj %d, size %d, to kill\n",
|
||||
p->pid, p->comm, oom_adj, tasksize);
|
||||
}
|
||||
if (selected) {
|
||||
lowmem_print(1, "send sigkill to %d (%s), adj %d, size %d\n",
|
||||
selected->pid, selected->comm,
|
||||
selected_oom_adj, selected_tasksize);
|
||||
/*
|
||||
* If CONFIG_PROFILING is off, then task_handoff_register()
|
||||
* is a nop. In that case we don't want to stall the killer
|
||||
* by setting lowmem_deathpending.
|
||||
*/
|
||||
#ifdef CONFIG_PROFILING
|
||||
lowmem_deathpending = selected;
|
||||
task_handoff_register(&task_nb);
|
||||
#endif
|
||||
force_sig(SIGKILL, selected);
|
||||
rem -= selected_tasksize;
|
||||
}
|
||||
lowmem_print(4, "lowmem_shrink %lu, %x, return %d\n",
|
||||
sc->nr_to_scan, sc->gfp_mask, rem);
|
||||
read_unlock(&tasklist_lock);
|
||||
return rem;
|
||||
}
|
||||
|
||||
static struct shrinker lowmem_shrinker = {
|
||||
.shrink = lowmem_shrink,
|
||||
.seeks = DEFAULT_SEEKS * 16
|
||||
};
|
||||
|
||||
static int __init lowmem_init(void)
|
||||
{
|
||||
register_shrinker(&lowmem_shrinker);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void __exit lowmem_exit(void)
|
||||
{
|
||||
unregister_shrinker(&lowmem_shrinker);
|
||||
}
|
||||
|
||||
module_param_named(cost, lowmem_shrinker.seeks, int, S_IRUGO | S_IWUSR);
|
||||
module_param_array_named(adj, lowmem_adj, int, &lowmem_adj_size,
|
||||
S_IRUGO | S_IWUSR);
|
||||
module_param_array_named(minfree, lowmem_minfree, uint, &lowmem_minfree_size,
|
||||
S_IRUGO | S_IWUSR);
|
||||
module_param_named(debug_level, lowmem_debug_level, uint, S_IRUGO | S_IWUSR);
|
||||
|
||||
module_init(lowmem_init);
|
||||
module_exit(lowmem_exit);
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,443 @@
|
|||
/* drivers/android/ram_console.c
|
||||
*
|
||||
* Copyright (C) 2007-2008 Google, Inc.
|
||||
*
|
||||
* This software is licensed under the terms of the GNU General Public
|
||||
* License version 2, as published by the Free Software Foundation, and
|
||||
* may be copied, distributed, and modified under those terms.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <linux/console.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/proc_fs.h>
|
||||
#include <linux/string.h>
|
||||
#include <linux/uaccess.h>
|
||||
#include <linux/io.h>
|
||||
#include "ram_console.h"
|
||||
|
||||
#ifdef CONFIG_ANDROID_RAM_CONSOLE_ERROR_CORRECTION
|
||||
#include <linux/rslib.h>
|
||||
#endif
|
||||
|
||||
struct ram_console_buffer {
|
||||
uint32_t sig;
|
||||
uint32_t start;
|
||||
uint32_t size;
|
||||
uint8_t data[0];
|
||||
};
|
||||
|
||||
#define RAM_CONSOLE_SIG (0x43474244) /* DBGC */
|
||||
|
||||
#ifdef CONFIG_ANDROID_RAM_CONSOLE_EARLY_INIT
|
||||
static char __initdata
|
||||
ram_console_old_log_init_buffer[CONFIG_ANDROID_RAM_CONSOLE_EARLY_SIZE];
|
||||
#endif
|
||||
static char *ram_console_old_log;
|
||||
static size_t ram_console_old_log_size;
|
||||
|
||||
static struct ram_console_buffer *ram_console_buffer;
|
||||
static size_t ram_console_buffer_size;
|
||||
#ifdef CONFIG_ANDROID_RAM_CONSOLE_ERROR_CORRECTION
|
||||
static char *ram_console_par_buffer;
|
||||
static struct rs_control *ram_console_rs_decoder;
|
||||
static int ram_console_corrected_bytes;
|
||||
static int ram_console_bad_blocks;
|
||||
#define ECC_BLOCK_SIZE CONFIG_ANDROID_RAM_CONSOLE_ERROR_CORRECTION_DATA_SIZE
|
||||
#define ECC_SIZE CONFIG_ANDROID_RAM_CONSOLE_ERROR_CORRECTION_ECC_SIZE
|
||||
#define ECC_SYMSIZE CONFIG_ANDROID_RAM_CONSOLE_ERROR_CORRECTION_SYMBOL_SIZE
|
||||
#define ECC_POLY CONFIG_ANDROID_RAM_CONSOLE_ERROR_CORRECTION_POLYNOMIAL
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ANDROID_RAM_CONSOLE_ERROR_CORRECTION
|
||||
static void ram_console_encode_rs8(uint8_t *data, size_t len, uint8_t *ecc)
|
||||
{
|
||||
int i;
|
||||
uint16_t par[ECC_SIZE];
|
||||
/* Initialize the parity buffer */
|
||||
memset(par, 0, sizeof(par));
|
||||
encode_rs8(ram_console_rs_decoder, data, len, par, 0);
|
||||
for (i = 0; i < ECC_SIZE; i++)
|
||||
ecc[i] = par[i];
|
||||
}
|
||||
|
||||
static int ram_console_decode_rs8(void *data, size_t len, uint8_t *ecc)
|
||||
{
|
||||
int i;
|
||||
uint16_t par[ECC_SIZE];
|
||||
for (i = 0; i < ECC_SIZE; i++)
|
||||
par[i] = ecc[i];
|
||||
return decode_rs8(ram_console_rs_decoder, data, par, len,
|
||||
NULL, 0, NULL, 0, NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void ram_console_update(const char *s, unsigned int count)
|
||||
{
|
||||
struct ram_console_buffer *buffer = ram_console_buffer;
|
||||
#ifdef CONFIG_ANDROID_RAM_CONSOLE_ERROR_CORRECTION
|
||||
uint8_t *buffer_end = buffer->data + ram_console_buffer_size;
|
||||
uint8_t *block;
|
||||
uint8_t *par;
|
||||
int size = ECC_BLOCK_SIZE;
|
||||
#endif
|
||||
memcpy(buffer->data + buffer->start, s, count);
|
||||
#ifdef CONFIG_ANDROID_RAM_CONSOLE_ERROR_CORRECTION
|
||||
block = buffer->data + (buffer->start & ~(ECC_BLOCK_SIZE - 1));
|
||||
par = ram_console_par_buffer +
|
||||
(buffer->start / ECC_BLOCK_SIZE) * ECC_SIZE;
|
||||
do {
|
||||
if (block + ECC_BLOCK_SIZE > buffer_end)
|
||||
size = buffer_end - block;
|
||||
ram_console_encode_rs8(block, size, par);
|
||||
block += ECC_BLOCK_SIZE;
|
||||
par += ECC_SIZE;
|
||||
} while (block < buffer->data + buffer->start + count);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void ram_console_update_header(void)
|
||||
{
|
||||
#ifdef CONFIG_ANDROID_RAM_CONSOLE_ERROR_CORRECTION
|
||||
struct ram_console_buffer *buffer = ram_console_buffer;
|
||||
uint8_t *par;
|
||||
par = ram_console_par_buffer +
|
||||
DIV_ROUND_UP(ram_console_buffer_size, ECC_BLOCK_SIZE) * ECC_SIZE;
|
||||
ram_console_encode_rs8((uint8_t *)buffer, sizeof(*buffer), par);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
ram_console_write(struct console *console, const char *s, unsigned int count)
|
||||
{
|
||||
int rem;
|
||||
struct ram_console_buffer *buffer = ram_console_buffer;
|
||||
|
||||
if (count > ram_console_buffer_size) {
|
||||
s += count - ram_console_buffer_size;
|
||||
count = ram_console_buffer_size;
|
||||
}
|
||||
rem = ram_console_buffer_size - buffer->start;
|
||||
if (rem < count) {
|
||||
ram_console_update(s, rem);
|
||||
s += rem;
|
||||
count -= rem;
|
||||
buffer->start = 0;
|
||||
buffer->size = ram_console_buffer_size;
|
||||
}
|
||||
ram_console_update(s, count);
|
||||
|
||||
buffer->start += count;
|
||||
if (buffer->size < ram_console_buffer_size)
|
||||
buffer->size += count;
|
||||
ram_console_update_header();
|
||||
}
|
||||
|
||||
static struct console ram_console = {
|
||||
.name = "ram",
|
||||
.write = ram_console_write,
|
||||
.flags = CON_PRINTBUFFER | CON_ENABLED,
|
||||
.index = -1,
|
||||
};
|
||||
|
||||
void ram_console_enable_console(int enabled)
|
||||
{
|
||||
if (enabled)
|
||||
ram_console.flags |= CON_ENABLED;
|
||||
else
|
||||
ram_console.flags &= ~CON_ENABLED;
|
||||
}
|
||||
|
||||
static void __init
|
||||
ram_console_save_old(struct ram_console_buffer *buffer, const char *bootinfo,
|
||||
char *dest)
|
||||
{
|
||||
size_t old_log_size = buffer->size;
|
||||
size_t bootinfo_size = 0;
|
||||
size_t total_size = old_log_size;
|
||||
char *ptr;
|
||||
const char *bootinfo_label = "Boot info:\n";
|
||||
|
||||
#ifdef CONFIG_ANDROID_RAM_CONSOLE_ERROR_CORRECTION
|
||||
uint8_t *block;
|
||||
uint8_t *par;
|
||||
char strbuf[80];
|
||||
int strbuf_len = 0;
|
||||
|
||||
block = buffer->data;
|
||||
par = ram_console_par_buffer;
|
||||
while (block < buffer->data + buffer->size) {
|
||||
int numerr;
|
||||
int size = ECC_BLOCK_SIZE;
|
||||
if (block + size > buffer->data + ram_console_buffer_size)
|
||||
size = buffer->data + ram_console_buffer_size - block;
|
||||
numerr = ram_console_decode_rs8(block, size, par);
|
||||
if (numerr > 0) {
|
||||
#if 0
|
||||
printk(KERN_INFO "ram_console: error in block %p, %d\n",
|
||||
block, numerr);
|
||||
#endif
|
||||
ram_console_corrected_bytes += numerr;
|
||||
} else if (numerr < 0) {
|
||||
#if 0
|
||||
printk(KERN_INFO "ram_console: uncorrectable error in "
|
||||
"block %p\n", block);
|
||||
#endif
|
||||
ram_console_bad_blocks++;
|
||||
}
|
||||
block += ECC_BLOCK_SIZE;
|
||||
par += ECC_SIZE;
|
||||
}
|
||||
if (ram_console_corrected_bytes || ram_console_bad_blocks)
|
||||
strbuf_len = snprintf(strbuf, sizeof(strbuf),
|
||||
"\n%d Corrected bytes, %d unrecoverable blocks\n",
|
||||
ram_console_corrected_bytes, ram_console_bad_blocks);
|
||||
else
|
||||
strbuf_len = snprintf(strbuf, sizeof(strbuf),
|
||||
"\nNo errors detected\n");
|
||||
if (strbuf_len >= sizeof(strbuf))
|
||||
strbuf_len = sizeof(strbuf) - 1;
|
||||
total_size += strbuf_len;
|
||||
#endif
|
||||
|
||||
if (bootinfo)
|
||||
bootinfo_size = strlen(bootinfo) + strlen(bootinfo_label);
|
||||
total_size += bootinfo_size;
|
||||
|
||||
if (dest == NULL) {
|
||||
dest = kmalloc(total_size, GFP_KERNEL);
|
||||
if (dest == NULL) {
|
||||
printk(KERN_ERR
|
||||
"ram_console: failed to allocate buffer\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
ram_console_old_log = dest;
|
||||
ram_console_old_log_size = total_size;
|
||||
memcpy(ram_console_old_log,
|
||||
&buffer->data[buffer->start], buffer->size - buffer->start);
|
||||
memcpy(ram_console_old_log + buffer->size - buffer->start,
|
||||
&buffer->data[0], buffer->start);
|
||||
ptr = ram_console_old_log + old_log_size;
|
||||
#ifdef CONFIG_ANDROID_RAM_CONSOLE_ERROR_CORRECTION
|
||||
memcpy(ptr, strbuf, strbuf_len);
|
||||
ptr += strbuf_len;
|
||||
#endif
|
||||
if (bootinfo) {
|
||||
memcpy(ptr, bootinfo_label, strlen(bootinfo_label));
|
||||
ptr += strlen(bootinfo_label);
|
||||
memcpy(ptr, bootinfo, bootinfo_size);
|
||||
ptr += bootinfo_size;
|
||||
}
|
||||
}
|
||||
|
||||
static int __init ram_console_init(struct ram_console_buffer *buffer,
|
||||
size_t buffer_size, const char *bootinfo,
|
||||
char *old_buf)
|
||||
{
|
||||
#ifdef CONFIG_ANDROID_RAM_CONSOLE_ERROR_CORRECTION
|
||||
int numerr;
|
||||
uint8_t *par;
|
||||
#endif
|
||||
ram_console_buffer = buffer;
|
||||
ram_console_buffer_size =
|
||||
buffer_size - sizeof(struct ram_console_buffer);
|
||||
|
||||
if (ram_console_buffer_size > buffer_size) {
|
||||
pr_err("ram_console: buffer %p, invalid size %zu, "
|
||||
"datasize %zu\n", buffer, buffer_size,
|
||||
ram_console_buffer_size);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_ANDROID_RAM_CONSOLE_ERROR_CORRECTION
|
||||
ram_console_buffer_size -= (DIV_ROUND_UP(ram_console_buffer_size,
|
||||
ECC_BLOCK_SIZE) + 1) * ECC_SIZE;
|
||||
|
||||
if (ram_console_buffer_size > buffer_size) {
|
||||
pr_err("ram_console: buffer %p, invalid size %zu, "
|
||||
"non-ecc datasize %zu\n",
|
||||
buffer, buffer_size, ram_console_buffer_size);
|
||||
return 0;
|
||||
}
|
||||
|
||||
ram_console_par_buffer = buffer->data + ram_console_buffer_size;
|
||||
|
||||
|
||||
/* first consecutive root is 0
|
||||
* primitive element to generate roots = 1
|
||||
*/
|
||||
ram_console_rs_decoder = init_rs(ECC_SYMSIZE, ECC_POLY, 0, 1, ECC_SIZE);
|
||||
if (ram_console_rs_decoder == NULL) {
|
||||
printk(KERN_INFO "ram_console: init_rs failed\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
ram_console_corrected_bytes = 0;
|
||||
ram_console_bad_blocks = 0;
|
||||
|
||||
par = ram_console_par_buffer +
|
||||
DIV_ROUND_UP(ram_console_buffer_size, ECC_BLOCK_SIZE) * ECC_SIZE;
|
||||
|
||||
numerr = ram_console_decode_rs8(buffer, sizeof(*buffer), par);
|
||||
if (numerr > 0) {
|
||||
printk(KERN_INFO "ram_console: error in header, %d\n", numerr);
|
||||
ram_console_corrected_bytes += numerr;
|
||||
} else if (numerr < 0) {
|
||||
printk(KERN_INFO
|
||||
"ram_console: uncorrectable error in header\n");
|
||||
ram_console_bad_blocks++;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (buffer->sig == RAM_CONSOLE_SIG) {
|
||||
if (buffer->size > ram_console_buffer_size
|
||||
|| buffer->start > buffer->size)
|
||||
printk(KERN_INFO "ram_console: found existing invalid "
|
||||
"buffer, size %d, start %d\n",
|
||||
buffer->size, buffer->start);
|
||||
else {
|
||||
printk(KERN_INFO "ram_console: found existing buffer, "
|
||||
"size %d, start %d\n",
|
||||
buffer->size, buffer->start);
|
||||
ram_console_save_old(buffer, bootinfo, old_buf);
|
||||
}
|
||||
} else {
|
||||
printk(KERN_INFO "ram_console: no valid data in buffer "
|
||||
"(sig = 0x%08x)\n", buffer->sig);
|
||||
}
|
||||
|
||||
buffer->sig = RAM_CONSOLE_SIG;
|
||||
buffer->start = 0;
|
||||
buffer->size = 0;
|
||||
|
||||
register_console(&ram_console);
|
||||
#ifdef CONFIG_ANDROID_RAM_CONSOLE_ENABLE_VERBOSE
|
||||
console_verbose();
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_ANDROID_RAM_CONSOLE_EARLY_INIT
|
||||
static int __init ram_console_early_init(void)
|
||||
{
|
||||
return ram_console_init((struct ram_console_buffer *)
|
||||
CONFIG_ANDROID_RAM_CONSOLE_EARLY_ADDR,
|
||||
CONFIG_ANDROID_RAM_CONSOLE_EARLY_SIZE,
|
||||
NULL,
|
||||
ram_console_old_log_init_buffer);
|
||||
}
|
||||
#else
|
||||
static int ram_console_driver_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct resource *res = pdev->resource;
|
||||
size_t start;
|
||||
size_t buffer_size;
|
||||
void *buffer;
|
||||
const char *bootinfo = NULL;
|
||||
struct ram_console_platform_data *pdata = pdev->dev.platform_data;
|
||||
|
||||
if (res == NULL || pdev->num_resources != 1 ||
|
||||
!(res->flags & IORESOURCE_MEM)) {
|
||||
printk(KERN_ERR "ram_console: invalid resource, %p %d flags "
|
||||
"%lx\n", res, pdev->num_resources, res ? res->flags : 0);
|
||||
return -ENXIO;
|
||||
}
|
||||
buffer_size = res->end - res->start + 1;
|
||||
start = res->start;
|
||||
printk(KERN_INFO "ram_console: got buffer at %zx, size %zx\n",
|
||||
start, buffer_size);
|
||||
buffer = ioremap(res->start, buffer_size);
|
||||
if (buffer == NULL) {
|
||||
printk(KERN_ERR "ram_console: failed to map memory\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
if (pdata)
|
||||
bootinfo = pdata->bootinfo;
|
||||
|
||||
return ram_console_init(buffer, buffer_size, bootinfo, NULL/* allocate */);
|
||||
}
|
||||
|
||||
static struct platform_driver ram_console_driver = {
|
||||
.probe = ram_console_driver_probe,
|
||||
.driver = {
|
||||
.name = "ram_console",
|
||||
},
|
||||
};
|
||||
|
||||
static int __init ram_console_module_init(void)
|
||||
{
|
||||
int err;
|
||||
err = platform_driver_register(&ram_console_driver);
|
||||
return err;
|
||||
}
|
||||
#endif
|
||||
|
||||
static ssize_t ram_console_read_old(struct file *file, char __user *buf,
|
||||
size_t len, loff_t *offset)
|
||||
{
|
||||
loff_t pos = *offset;
|
||||
ssize_t count;
|
||||
|
||||
if (pos >= ram_console_old_log_size)
|
||||
return 0;
|
||||
|
||||
count = min(len, (size_t)(ram_console_old_log_size - pos));
|
||||
if (copy_to_user(buf, ram_console_old_log + pos, count))
|
||||
return -EFAULT;
|
||||
|
||||
*offset += count;
|
||||
return count;
|
||||
}
|
||||
|
||||
static const struct file_operations ram_console_file_ops = {
|
||||
.owner = THIS_MODULE,
|
||||
.read = ram_console_read_old,
|
||||
};
|
||||
|
||||
static int __init ram_console_late_init(void)
|
||||
{
|
||||
struct proc_dir_entry *entry;
|
||||
|
||||
if (ram_console_old_log == NULL)
|
||||
return 0;
|
||||
#ifdef CONFIG_ANDROID_RAM_CONSOLE_EARLY_INIT
|
||||
ram_console_old_log = kmalloc(ram_console_old_log_size, GFP_KERNEL);
|
||||
if (ram_console_old_log == NULL) {
|
||||
printk(KERN_ERR
|
||||
"ram_console: failed to allocate buffer for old log\n");
|
||||
ram_console_old_log_size = 0;
|
||||
return 0;
|
||||
}
|
||||
memcpy(ram_console_old_log,
|
||||
ram_console_old_log_init_buffer, ram_console_old_log_size);
|
||||
#endif
|
||||
entry = create_proc_entry("last_kmsg", S_IFREG | S_IRUGO, NULL);
|
||||
if (!entry) {
|
||||
printk(KERN_ERR "ram_console: failed to create proc entry\n");
|
||||
kfree(ram_console_old_log);
|
||||
ram_console_old_log = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
entry->proc_fops = &ram_console_file_ops;
|
||||
entry->size = ram_console_old_log_size;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_ANDROID_RAM_CONSOLE_EARLY_INIT
|
||||
console_initcall(ram_console_early_init);
|
||||
#else
|
||||
postcore_initcall(ram_console_module_init);
|
||||
#endif
|
||||
late_initcall(ram_console_late_init);
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* Copyright (C) 2010 Google, Inc.
|
||||
*
|
||||
* This software is licensed under the terms of the GNU General Public
|
||||
* License version 2, as published by the Free Software Foundation, and
|
||||
* may be copied, distributed, and modified under those terms.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _INCLUDE_LINUX_PLATFORM_DATA_RAM_CONSOLE_H_
|
||||
#define _INCLUDE_LINUX_PLATFORM_DATA_RAM_CONSOLE_H_
|
||||
|
||||
struct ram_console_platform_data {
|
||||
const char *bootinfo;
|
||||
};
|
||||
|
||||
#endif /* _INCLUDE_LINUX_PLATFORM_DATA_RAM_CONSOLE_H_ */
|
|
@ -0,0 +1,11 @@
|
|||
menuconfig ANDROID_SWITCH
|
||||
tristate "Android Switch class support"
|
||||
help
|
||||
Say Y here to enable Android switch class support. This allows
|
||||
monitoring switches by userspace via sysfs and uevent.
|
||||
|
||||
config ANDROID_SWITCH_GPIO
|
||||
tristate "Android GPIO Switch support"
|
||||
depends on GENERIC_GPIO && ANDROID_SWITCH
|
||||
help
|
||||
Say Y here to enable GPIO based switch support.
|
|
@ -0,0 +1,4 @@
|
|||
# Android Switch Class Driver
|
||||
obj-$(CONFIG_ANDROID_SWITCH) += switch_class.o
|
||||
obj-$(CONFIG_ANDROID_SWITCH_GPIO) += switch_gpio.o
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
/*
|
||||
* Switch class driver
|
||||
*
|
||||
* Copyright (C) 2008 Google, Inc.
|
||||
* Author: Mike Lockwood <lockwood@android.com>
|
||||
*
|
||||
* This software is licensed under the terms of the GNU General Public
|
||||
* License version 2, as published by the Free Software Foundation, and
|
||||
* may be copied, distributed, and modified under those terms.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __LINUX_SWITCH_H__
|
||||
#define __LINUX_SWITCH_H__
|
||||
|
||||
struct switch_dev {
|
||||
const char *name;
|
||||
struct device *dev;
|
||||
int index;
|
||||
int state;
|
||||
|
||||
ssize_t (*print_name)(struct switch_dev *sdev, char *buf);
|
||||
ssize_t (*print_state)(struct switch_dev *sdev, char *buf);
|
||||
};
|
||||
|
||||
struct gpio_switch_platform_data {
|
||||
const char *name;
|
||||
unsigned gpio;
|
||||
|
||||
/* if NULL, switch_dev.name will be printed */
|
||||
const char *name_on;
|
||||
const char *name_off;
|
||||
/* if NULL, "0" or "1" will be printed */
|
||||
const char *state_on;
|
||||
const char *state_off;
|
||||
};
|
||||
|
||||
extern int switch_dev_register(struct switch_dev *sdev);
|
||||
extern void switch_dev_unregister(struct switch_dev *sdev);
|
||||
|
||||
static inline int switch_get_state(struct switch_dev *sdev)
|
||||
{
|
||||
return sdev->state;
|
||||
}
|
||||
|
||||
extern void switch_set_state(struct switch_dev *sdev, int state);
|
||||
|
||||
#endif /* __LINUX_SWITCH_H__ */
|
|
@ -0,0 +1,174 @@
|
|||
/*
|
||||
* switch_class.c
|
||||
*
|
||||
* Copyright (C) 2008 Google, Inc.
|
||||
* Author: Mike Lockwood <lockwood@android.com>
|
||||
*
|
||||
* This software is licensed under the terms of the GNU General Public
|
||||
* License version 2, as published by the Free Software Foundation, and
|
||||
* may be copied, distributed, and modified under those terms.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/fs.h>
|
||||
#include <linux/err.h>
|
||||
#include "switch.h"
|
||||
|
||||
struct class *switch_class;
|
||||
static atomic_t device_count;
|
||||
|
||||
static ssize_t state_show(struct device *dev, struct device_attribute *attr,
|
||||
char *buf)
|
||||
{
|
||||
struct switch_dev *sdev = (struct switch_dev *)
|
||||
dev_get_drvdata(dev);
|
||||
|
||||
if (sdev->print_state) {
|
||||
int ret = sdev->print_state(sdev, buf);
|
||||
if (ret >= 0)
|
||||
return ret;
|
||||
}
|
||||
return sprintf(buf, "%d\n", sdev->state);
|
||||
}
|
||||
|
||||
static ssize_t name_show(struct device *dev, struct device_attribute *attr,
|
||||
char *buf)
|
||||
{
|
||||
struct switch_dev *sdev = (struct switch_dev *)
|
||||
dev_get_drvdata(dev);
|
||||
|
||||
if (sdev->print_name) {
|
||||
int ret = sdev->print_name(sdev, buf);
|
||||
if (ret >= 0)
|
||||
return ret;
|
||||
}
|
||||
return sprintf(buf, "%s\n", sdev->name);
|
||||
}
|
||||
|
||||
static DEVICE_ATTR(state, S_IRUGO | S_IWUSR, state_show, NULL);
|
||||
static DEVICE_ATTR(name, S_IRUGO | S_IWUSR, name_show, NULL);
|
||||
|
||||
void switch_set_state(struct switch_dev *sdev, int state)
|
||||
{
|
||||
char name_buf[120];
|
||||
char state_buf[120];
|
||||
char *prop_buf;
|
||||
char *envp[3];
|
||||
int env_offset = 0;
|
||||
int length;
|
||||
|
||||
if (sdev->state != state) {
|
||||
sdev->state = state;
|
||||
|
||||
prop_buf = (char *)get_zeroed_page(GFP_KERNEL);
|
||||
if (prop_buf) {
|
||||
length = name_show(sdev->dev, NULL, prop_buf);
|
||||
if (length > 0) {
|
||||
if (prop_buf[length - 1] == '\n')
|
||||
prop_buf[length - 1] = 0;
|
||||
snprintf(name_buf, sizeof(name_buf),
|
||||
"SWITCH_NAME=%s", prop_buf);
|
||||
envp[env_offset++] = name_buf;
|
||||
}
|
||||
length = state_show(sdev->dev, NULL, prop_buf);
|
||||
if (length > 0) {
|
||||
if (prop_buf[length - 1] == '\n')
|
||||
prop_buf[length - 1] = 0;
|
||||
snprintf(state_buf, sizeof(state_buf),
|
||||
"SWITCH_STATE=%s", prop_buf);
|
||||
envp[env_offset++] = state_buf;
|
||||
}
|
||||
envp[env_offset] = NULL;
|
||||
kobject_uevent_env(&sdev->dev->kobj, KOBJ_CHANGE, envp);
|
||||
free_page((unsigned long)prop_buf);
|
||||
} else {
|
||||
printk(KERN_ERR "out of memory in switch_set_state\n");
|
||||
kobject_uevent(&sdev->dev->kobj, KOBJ_CHANGE);
|
||||
}
|
||||
}
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(switch_set_state);
|
||||
|
||||
static int create_switch_class(void)
|
||||
{
|
||||
if (!switch_class) {
|
||||
switch_class = class_create(THIS_MODULE, "switch");
|
||||
if (IS_ERR(switch_class))
|
||||
return PTR_ERR(switch_class);
|
||||
atomic_set(&device_count, 0);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int switch_dev_register(struct switch_dev *sdev)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (!switch_class) {
|
||||
ret = create_switch_class();
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
|
||||
sdev->index = atomic_inc_return(&device_count);
|
||||
sdev->dev = device_create(switch_class, NULL,
|
||||
MKDEV(0, sdev->index), NULL, sdev->name);
|
||||
if (IS_ERR(sdev->dev))
|
||||
return PTR_ERR(sdev->dev);
|
||||
|
||||
ret = device_create_file(sdev->dev, &dev_attr_state);
|
||||
if (ret < 0)
|
||||
goto err_create_file_1;
|
||||
ret = device_create_file(sdev->dev, &dev_attr_name);
|
||||
if (ret < 0)
|
||||
goto err_create_file_2;
|
||||
|
||||
dev_set_drvdata(sdev->dev, sdev);
|
||||
sdev->state = 0;
|
||||
return 0;
|
||||
|
||||
err_create_file_2:
|
||||
device_remove_file(sdev->dev, &dev_attr_state);
|
||||
err_create_file_1:
|
||||
device_destroy(switch_class, MKDEV(0, sdev->index));
|
||||
printk(KERN_ERR "switch: Failed to register driver %s\n", sdev->name);
|
||||
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(switch_dev_register);
|
||||
|
||||
void switch_dev_unregister(struct switch_dev *sdev)
|
||||
{
|
||||
device_remove_file(sdev->dev, &dev_attr_name);
|
||||
device_remove_file(sdev->dev, &dev_attr_state);
|
||||
device_destroy(switch_class, MKDEV(0, sdev->index));
|
||||
dev_set_drvdata(sdev->dev, NULL);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(switch_dev_unregister);
|
||||
|
||||
static int __init switch_class_init(void)
|
||||
{
|
||||
return create_switch_class();
|
||||
}
|
||||
|
||||
static void __exit switch_class_exit(void)
|
||||
{
|
||||
class_destroy(switch_class);
|
||||
}
|
||||
|
||||
module_init(switch_class_init);
|
||||
module_exit(switch_class_exit);
|
||||
|
||||
MODULE_AUTHOR("Mike Lockwood <lockwood@android.com>");
|
||||
MODULE_DESCRIPTION("Switch class driver");
|
||||
MODULE_LICENSE("GPL");
|
|
@ -0,0 +1,172 @@
|
|||
/*
|
||||
* switch_gpio.c
|
||||
*
|
||||
* Copyright (C) 2008 Google, Inc.
|
||||
* Author: Mike Lockwood <lockwood@android.com>
|
||||
*
|
||||
* This software is licensed under the terms of the GNU General Public
|
||||
* License version 2, as published by the Free Software Foundation, and
|
||||
* may be copied, distributed, and modified under those terms.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/workqueue.h>
|
||||
#include <linux/gpio.h>
|
||||
#include "switch.h"
|
||||
|
||||
struct gpio_switch_data {
|
||||
struct switch_dev sdev;
|
||||
unsigned gpio;
|
||||
const char *name_on;
|
||||
const char *name_off;
|
||||
const char *state_on;
|
||||
const char *state_off;
|
||||
int irq;
|
||||
struct work_struct work;
|
||||
};
|
||||
|
||||
static void gpio_switch_work(struct work_struct *work)
|
||||
{
|
||||
int state;
|
||||
struct gpio_switch_data *data =
|
||||
container_of(work, struct gpio_switch_data, work);
|
||||
|
||||
state = gpio_get_value(data->gpio);
|
||||
switch_set_state(&data->sdev, state);
|
||||
}
|
||||
|
||||
static irqreturn_t gpio_irq_handler(int irq, void *dev_id)
|
||||
{
|
||||
struct gpio_switch_data *switch_data =
|
||||
(struct gpio_switch_data *)dev_id;
|
||||
|
||||
schedule_work(&switch_data->work);
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
||||
static ssize_t switch_gpio_print_state(struct switch_dev *sdev, char *buf)
|
||||
{
|
||||
struct gpio_switch_data *switch_data =
|
||||
container_of(sdev, struct gpio_switch_data, sdev);
|
||||
const char *state;
|
||||
if (switch_get_state(sdev))
|
||||
state = switch_data->state_on;
|
||||
else
|
||||
state = switch_data->state_off;
|
||||
|
||||
if (state)
|
||||
return sprintf(buf, "%s\n", state);
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int gpio_switch_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct gpio_switch_platform_data *pdata = pdev->dev.platform_data;
|
||||
struct gpio_switch_data *switch_data;
|
||||
int ret = 0;
|
||||
|
||||
if (!pdata)
|
||||
return -EBUSY;
|
||||
|
||||
switch_data = kzalloc(sizeof(struct gpio_switch_data), GFP_KERNEL);
|
||||
if (!switch_data)
|
||||
return -ENOMEM;
|
||||
|
||||
switch_data->sdev.name = pdata->name;
|
||||
switch_data->gpio = pdata->gpio;
|
||||
switch_data->name_on = pdata->name_on;
|
||||
switch_data->name_off = pdata->name_off;
|
||||
switch_data->state_on = pdata->state_on;
|
||||
switch_data->state_off = pdata->state_off;
|
||||
switch_data->sdev.print_state = switch_gpio_print_state;
|
||||
|
||||
ret = switch_dev_register(&switch_data->sdev);
|
||||
if (ret < 0)
|
||||
goto err_switch_dev_register;
|
||||
|
||||
ret = gpio_request(switch_data->gpio, pdev->name);
|
||||
if (ret < 0)
|
||||
goto err_request_gpio;
|
||||
|
||||
ret = gpio_direction_input(switch_data->gpio);
|
||||
if (ret < 0)
|
||||
goto err_set_gpio_input;
|
||||
|
||||
INIT_WORK(&switch_data->work, gpio_switch_work);
|
||||
|
||||
switch_data->irq = gpio_to_irq(switch_data->gpio);
|
||||
if (switch_data->irq < 0) {
|
||||
ret = switch_data->irq;
|
||||
goto err_detect_irq_num_failed;
|
||||
}
|
||||
|
||||
ret = request_irq(switch_data->irq, gpio_irq_handler,
|
||||
IRQF_TRIGGER_LOW, pdev->name, switch_data);
|
||||
if (ret < 0)
|
||||
goto err_request_irq;
|
||||
|
||||
/* Perform initial detection */
|
||||
gpio_switch_work(&switch_data->work);
|
||||
|
||||
return 0;
|
||||
|
||||
err_request_irq:
|
||||
err_detect_irq_num_failed:
|
||||
err_set_gpio_input:
|
||||
gpio_free(switch_data->gpio);
|
||||
err_request_gpio:
|
||||
switch_dev_unregister(&switch_data->sdev);
|
||||
err_switch_dev_register:
|
||||
kfree(switch_data);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int __devexit gpio_switch_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct gpio_switch_data *switch_data = platform_get_drvdata(pdev);
|
||||
|
||||
cancel_work_sync(&switch_data->work);
|
||||
gpio_free(switch_data->gpio);
|
||||
switch_dev_unregister(&switch_data->sdev);
|
||||
kfree(switch_data);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct platform_driver gpio_switch_driver = {
|
||||
.probe = gpio_switch_probe,
|
||||
.remove = __devexit_p(gpio_switch_remove),
|
||||
.driver = {
|
||||
.name = "switch-gpio",
|
||||
.owner = THIS_MODULE,
|
||||
},
|
||||
};
|
||||
|
||||
static int __init gpio_switch_init(void)
|
||||
{
|
||||
return platform_driver_register(&gpio_switch_driver);
|
||||
}
|
||||
|
||||
static void __exit gpio_switch_exit(void)
|
||||
{
|
||||
platform_driver_unregister(&gpio_switch_driver);
|
||||
}
|
||||
|
||||
module_init(gpio_switch_init);
|
||||
module_exit(gpio_switch_exit);
|
||||
|
||||
MODULE_AUTHOR("Mike Lockwood <lockwood@android.com>");
|
||||
MODULE_DESCRIPTION("GPIO Switch driver");
|
||||
MODULE_LICENSE("GPL");
|
|
@ -0,0 +1,176 @@
|
|||
/* drivers/misc/timed_gpio.c
|
||||
*
|
||||
* Copyright (C) 2008 Google, Inc.
|
||||
* Author: Mike Lockwood <lockwood@android.com>
|
||||
*
|
||||
* This software is licensed under the terms of the GNU General Public
|
||||
* License version 2, as published by the Free Software Foundation, and
|
||||
* may be copied, distributed, and modified under those terms.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/hrtimer.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/gpio.h>
|
||||
|
||||
#include "timed_output.h"
|
||||
#include "timed_gpio.h"
|
||||
|
||||
|
||||
struct timed_gpio_data {
|
||||
struct timed_output_dev dev;
|
||||
struct hrtimer timer;
|
||||
spinlock_t lock;
|
||||
unsigned gpio;
|
||||
int max_timeout;
|
||||
u8 active_low;
|
||||
};
|
||||
|
||||
static enum hrtimer_restart gpio_timer_func(struct hrtimer *timer)
|
||||
{
|
||||
struct timed_gpio_data *data =
|
||||
container_of(timer, struct timed_gpio_data, timer);
|
||||
|
||||
gpio_direction_output(data->gpio, data->active_low ? 1 : 0);
|
||||
return HRTIMER_NORESTART;
|
||||
}
|
||||
|
||||
static int gpio_get_time(struct timed_output_dev *dev)
|
||||
{
|
||||
struct timed_gpio_data *data =
|
||||
container_of(dev, struct timed_gpio_data, dev);
|
||||
|
||||
if (hrtimer_active(&data->timer)) {
|
||||
ktime_t r = hrtimer_get_remaining(&data->timer);
|
||||
struct timeval t = ktime_to_timeval(r);
|
||||
return t.tv_sec * 1000 + t.tv_usec / 1000;
|
||||
} else
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void gpio_enable(struct timed_output_dev *dev, int value)
|
||||
{
|
||||
struct timed_gpio_data *data =
|
||||
container_of(dev, struct timed_gpio_data, dev);
|
||||
unsigned long flags;
|
||||
|
||||
spin_lock_irqsave(&data->lock, flags);
|
||||
|
||||
/* cancel previous timer and set GPIO according to value */
|
||||
hrtimer_cancel(&data->timer);
|
||||
gpio_direction_output(data->gpio, data->active_low ? !value : !!value);
|
||||
|
||||
if (value > 0) {
|
||||
if (value > data->max_timeout)
|
||||
value = data->max_timeout;
|
||||
|
||||
hrtimer_start(&data->timer,
|
||||
ktime_set(value / 1000, (value % 1000) * 1000000),
|
||||
HRTIMER_MODE_REL);
|
||||
}
|
||||
|
||||
spin_unlock_irqrestore(&data->lock, flags);
|
||||
}
|
||||
|
||||
static int timed_gpio_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct timed_gpio_platform_data *pdata = pdev->dev.platform_data;
|
||||
struct timed_gpio *cur_gpio;
|
||||
struct timed_gpio_data *gpio_data, *gpio_dat;
|
||||
int i, j, ret = 0;
|
||||
|
||||
if (!pdata)
|
||||
return -EBUSY;
|
||||
|
||||
gpio_data = kzalloc(sizeof(struct timed_gpio_data) * pdata->num_gpios,
|
||||
GFP_KERNEL);
|
||||
if (!gpio_data)
|
||||
return -ENOMEM;
|
||||
|
||||
for (i = 0; i < pdata->num_gpios; i++) {
|
||||
cur_gpio = &pdata->gpios[i];
|
||||
gpio_dat = &gpio_data[i];
|
||||
|
||||
hrtimer_init(&gpio_dat->timer, CLOCK_MONOTONIC,
|
||||
HRTIMER_MODE_REL);
|
||||
gpio_dat->timer.function = gpio_timer_func;
|
||||
spin_lock_init(&gpio_dat->lock);
|
||||
|
||||
gpio_dat->dev.name = cur_gpio->name;
|
||||
gpio_dat->dev.get_time = gpio_get_time;
|
||||
gpio_dat->dev.enable = gpio_enable;
|
||||
ret = gpio_request(cur_gpio->gpio, cur_gpio->name);
|
||||
if (ret >= 0) {
|
||||
ret = timed_output_dev_register(&gpio_dat->dev);
|
||||
if (ret < 0)
|
||||
gpio_free(cur_gpio->gpio);
|
||||
}
|
||||
if (ret < 0) {
|
||||
for (j = 0; j < i; j++) {
|
||||
timed_output_dev_unregister(&gpio_data[i].dev);
|
||||
gpio_free(gpio_data[i].gpio);
|
||||
}
|
||||
kfree(gpio_data);
|
||||
return ret;
|
||||
}
|
||||
|
||||
gpio_dat->gpio = cur_gpio->gpio;
|
||||
gpio_dat->max_timeout = cur_gpio->max_timeout;
|
||||
gpio_dat->active_low = cur_gpio->active_low;
|
||||
gpio_direction_output(gpio_dat->gpio, gpio_dat->active_low);
|
||||
}
|
||||
|
||||
platform_set_drvdata(pdev, gpio_data);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int timed_gpio_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct timed_gpio_platform_data *pdata = pdev->dev.platform_data;
|
||||
struct timed_gpio_data *gpio_data = platform_get_drvdata(pdev);
|
||||
int i;
|
||||
|
||||
for (i = 0; i < pdata->num_gpios; i++) {
|
||||
timed_output_dev_unregister(&gpio_data[i].dev);
|
||||
gpio_free(gpio_data[i].gpio);
|
||||
}
|
||||
|
||||
kfree(gpio_data);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct platform_driver timed_gpio_driver = {
|
||||
.probe = timed_gpio_probe,
|
||||
.remove = timed_gpio_remove,
|
||||
.driver = {
|
||||
.name = TIMED_GPIO_NAME,
|
||||
.owner = THIS_MODULE,
|
||||
},
|
||||
};
|
||||
|
||||
static int __init timed_gpio_init(void)
|
||||
{
|
||||
return platform_driver_register(&timed_gpio_driver);
|
||||
}
|
||||
|
||||
static void __exit timed_gpio_exit(void)
|
||||
{
|
||||
platform_driver_unregister(&timed_gpio_driver);
|
||||
}
|
||||
|
||||
module_init(timed_gpio_init);
|
||||
module_exit(timed_gpio_exit);
|
||||
|
||||
MODULE_AUTHOR("Mike Lockwood <lockwood@android.com>");
|
||||
MODULE_DESCRIPTION("timed gpio driver");
|
||||
MODULE_LICENSE("GPL");
|
|
@ -0,0 +1,33 @@
|
|||
/* include/linux/timed_gpio.h
|
||||
*
|
||||
* Copyright (C) 2008 Google, Inc.
|
||||
*
|
||||
* This software is licensed under the terms of the GNU General Public
|
||||
* License version 2, as published by the Free Software Foundation, and
|
||||
* may be copied, distributed, and modified under those terms.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _LINUX_TIMED_GPIO_H
|
||||
#define _LINUX_TIMED_GPIO_H
|
||||
|
||||
#define TIMED_GPIO_NAME "timed-gpio"
|
||||
|
||||
struct timed_gpio {
|
||||
const char *name;
|
||||
unsigned gpio;
|
||||
int max_timeout;
|
||||
u8 active_low;
|
||||
};
|
||||
|
||||
struct timed_gpio_platform_data {
|
||||
int num_gpios;
|
||||
struct timed_gpio *gpios;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,123 @@
|
|||
/* drivers/misc/timed_output.c
|
||||
*
|
||||
* Copyright (C) 2009 Google, Inc.
|
||||
* Author: Mike Lockwood <lockwood@android.com>
|
||||
*
|
||||
* This software is licensed under the terms of the GNU General Public
|
||||
* License version 2, as published by the Free Software Foundation, and
|
||||
* may be copied, distributed, and modified under those terms.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/fs.h>
|
||||
#include <linux/err.h>
|
||||
|
||||
#include "timed_output.h"
|
||||
|
||||
static struct class *timed_output_class;
|
||||
static atomic_t device_count;
|
||||
|
||||
static ssize_t enable_show(struct device *dev, struct device_attribute *attr,
|
||||
char *buf)
|
||||
{
|
||||
struct timed_output_dev *tdev = dev_get_drvdata(dev);
|
||||
int remaining = tdev->get_time(tdev);
|
||||
|
||||
return sprintf(buf, "%d\n", remaining);
|
||||
}
|
||||
|
||||
static ssize_t enable_store(
|
||||
struct device *dev, struct device_attribute *attr,
|
||||
const char *buf, size_t size)
|
||||
{
|
||||
struct timed_output_dev *tdev = dev_get_drvdata(dev);
|
||||
int value;
|
||||
|
||||
if (sscanf(buf, "%d", &value) != 1)
|
||||
return -EINVAL;
|
||||
|
||||
tdev->enable(tdev, value);
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
static DEVICE_ATTR(enable, S_IRUGO | S_IWUSR, enable_show, enable_store);
|
||||
|
||||
static int create_timed_output_class(void)
|
||||
{
|
||||
if (!timed_output_class) {
|
||||
timed_output_class = class_create(THIS_MODULE, "timed_output");
|
||||
if (IS_ERR(timed_output_class))
|
||||
return PTR_ERR(timed_output_class);
|
||||
atomic_set(&device_count, 0);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int timed_output_dev_register(struct timed_output_dev *tdev)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (!tdev || !tdev->name || !tdev->enable || !tdev->get_time)
|
||||
return -EINVAL;
|
||||
|
||||
ret = create_timed_output_class();
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
tdev->index = atomic_inc_return(&device_count);
|
||||
tdev->dev = device_create(timed_output_class, NULL,
|
||||
MKDEV(0, tdev->index), NULL, tdev->name);
|
||||
if (IS_ERR(tdev->dev))
|
||||
return PTR_ERR(tdev->dev);
|
||||
|
||||
ret = device_create_file(tdev->dev, &dev_attr_enable);
|
||||
if (ret < 0)
|
||||
goto err_create_file;
|
||||
|
||||
dev_set_drvdata(tdev->dev, tdev);
|
||||
tdev->state = 0;
|
||||
return 0;
|
||||
|
||||
err_create_file:
|
||||
device_destroy(timed_output_class, MKDEV(0, tdev->index));
|
||||
printk(KERN_ERR "timed_output: Failed to register driver %s\n",
|
||||
tdev->name);
|
||||
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(timed_output_dev_register);
|
||||
|
||||
void timed_output_dev_unregister(struct timed_output_dev *tdev)
|
||||
{
|
||||
device_remove_file(tdev->dev, &dev_attr_enable);
|
||||
device_destroy(timed_output_class, MKDEV(0, tdev->index));
|
||||
dev_set_drvdata(tdev->dev, NULL);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(timed_output_dev_unregister);
|
||||
|
||||
static int __init timed_output_init(void)
|
||||
{
|
||||
return create_timed_output_class();
|
||||
}
|
||||
|
||||
static void __exit timed_output_exit(void)
|
||||
{
|
||||
class_destroy(timed_output_class);
|
||||
}
|
||||
|
||||
module_init(timed_output_init);
|
||||
module_exit(timed_output_exit);
|
||||
|
||||
MODULE_AUTHOR("Mike Lockwood <lockwood@android.com>");
|
||||
MODULE_DESCRIPTION("timed output class driver");
|
||||
MODULE_LICENSE("GPL");
|
|
@ -0,0 +1,37 @@
|
|||
/* include/linux/timed_output.h
|
||||
*
|
||||
* Copyright (C) 2008 Google, Inc.
|
||||
*
|
||||
* This software is licensed under the terms of the GNU General Public
|
||||
* License version 2, as published by the Free Software Foundation, and
|
||||
* may be copied, distributed, and modified under those terms.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _LINUX_TIMED_OUTPUT_H
|
||||
#define _LINUX_TIMED_OUTPUT_H
|
||||
|
||||
struct timed_output_dev {
|
||||
const char *name;
|
||||
|
||||
/* enable the output and set the timer */
|
||||
void (*enable)(struct timed_output_dev *sdev, int timeout);
|
||||
|
||||
/* returns the current number of milliseconds remaining on the timer */
|
||||
int (*get_time)(struct timed_output_dev *sdev);
|
||||
|
||||
/* private data */
|
||||
struct device *dev;
|
||||
int index;
|
||||
int state;
|
||||
};
|
||||
|
||||
extern int timed_output_dev_register(struct timed_output_dev *dev);
|
||||
extern void timed_output_dev_unregister(struct timed_output_dev *dev);
|
||||
|
||||
#endif
|
|
@ -201,7 +201,7 @@ static ssize_t set_enabled(struct device *dev, struct device_attribute *attr,
|
|||
struct usb_interface *intf = to_usb_interface(dev);
|
||||
struct asus_oled_dev *odev = usb_get_intfdata(intf);
|
||||
unsigned long value;
|
||||
if (strict_strtoul(buf, 10, &value))
|
||||
if (kstrtoul(buf, 10, &value))
|
||||
return -EINVAL;
|
||||
|
||||
enable_oled(odev, value);
|
||||
|
@ -217,7 +217,7 @@ static ssize_t class_set_enabled(struct device *device,
|
|||
(struct asus_oled_dev *) dev_get_drvdata(device);
|
||||
unsigned long value;
|
||||
|
||||
if (strict_strtoul(buf, 10, &value))
|
||||
if (kstrtoul(buf, 10, &value))
|
||||
return -EINVAL;
|
||||
|
||||
enable_oled(odev, value);
|
||||
|
|
|
@ -161,6 +161,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
|
|||
INT Status = STATUS_FAILURE;
|
||||
int timeout = 0;
|
||||
IOCTL_BUFFER IoBuffer;
|
||||
int bytes;
|
||||
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL, "Parameters Passed to control IOCTL cmd=0x%X arg=0x%lX", cmd, arg);
|
||||
|
||||
|
@ -230,11 +231,16 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
|
|||
if (!temp_buff)
|
||||
return -ENOMEM;
|
||||
|
||||
Status = rdmalt(Adapter, (UINT)sRdmBuffer.Register,
|
||||
bytes = rdmalt(Adapter, (UINT)sRdmBuffer.Register,
|
||||
(PUINT)temp_buff, Bufflen);
|
||||
if (Status == STATUS_SUCCESS) {
|
||||
if (copy_to_user(IoBuffer.OutputBuffer, temp_buff, IoBuffer.OutputLength))
|
||||
Status = -EFAULT;
|
||||
if (bytes > 0) {
|
||||
Status = STATUS_SUCCESS;
|
||||
if (copy_to_user(IoBuffer.OutputBuffer, temp_buff, bytes)) {
|
||||
kfree(temp_buff);
|
||||
return -EFAULT;
|
||||
}
|
||||
} else {
|
||||
Status = bytes;
|
||||
}
|
||||
|
||||
kfree(temp_buff);
|
||||
|
@ -302,7 +308,11 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
|
|||
if (copy_from_user(&sRdmBuffer, IoBuffer.InputBuffer, IoBuffer.InputLength))
|
||||
return -EFAULT;
|
||||
|
||||
/* FIXME: don't trust user supplied length */
|
||||
if (IoBuffer.OutputLength > USHRT_MAX ||
|
||||
IoBuffer.OutputLength == 0) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
temp_buff = kmalloc(IoBuffer.OutputLength, GFP_KERNEL);
|
||||
if (!temp_buff)
|
||||
return STATUS_FAILURE;
|
||||
|
@ -318,11 +328,17 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
|
|||
}
|
||||
|
||||
uiTempVar = sRdmBuffer.Register & EEPROM_REJECT_MASK;
|
||||
Status = rdmaltWithLock(Adapter, (UINT)sRdmBuffer.Register, (PUINT)temp_buff, IoBuffer.OutputLength);
|
||||
bytes = rdmaltWithLock(Adapter, (UINT)sRdmBuffer.Register, (PUINT)temp_buff, IoBuffer.OutputLength);
|
||||
|
||||
if (Status == STATUS_SUCCESS)
|
||||
if (copy_to_user(IoBuffer.OutputBuffer, temp_buff, IoBuffer.OutputLength))
|
||||
Status = -EFAULT;
|
||||
if (bytes > 0) {
|
||||
Status = STATUS_SUCCESS;
|
||||
if (copy_to_user(IoBuffer.OutputBuffer, temp_buff, bytes)) {
|
||||
kfree(temp_buff);
|
||||
return -EFAULT;
|
||||
}
|
||||
} else {
|
||||
Status = bytes;
|
||||
}
|
||||
|
||||
kfree(temp_buff);
|
||||
break;
|
||||
|
@ -437,12 +453,14 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
|
|||
}
|
||||
}
|
||||
|
||||
Status = rdmaltWithLock(Adapter, (UINT)GPIO_MODE_REGISTER, (PUINT)ucResetValue, sizeof(UINT));
|
||||
|
||||
if (STATUS_SUCCESS != Status) {
|
||||
bytes = rdmaltWithLock(Adapter, (UINT)GPIO_MODE_REGISTER, (PUINT)ucResetValue, sizeof(UINT));
|
||||
if (bytes < 0) {
|
||||
Status = bytes;
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL,
|
||||
"GPIO_MODE_REGISTER read failed");
|
||||
break;
|
||||
} else {
|
||||
Status = STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/* Set the gpio mode register to output */
|
||||
|
@ -519,12 +537,15 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
|
|||
uiBit = gpio_info.uiGpioNumber;
|
||||
|
||||
/* Set the gpio output register */
|
||||
Status = rdmaltWithLock(Adapter, (UINT)GPIO_PIN_STATE_REGISTER,
|
||||
bytes = rdmaltWithLock(Adapter, (UINT)GPIO_PIN_STATE_REGISTER,
|
||||
(PUINT)ucRead, sizeof(UINT));
|
||||
|
||||
if (Status != STATUS_SUCCESS) {
|
||||
if (bytes < 0) {
|
||||
Status = bytes;
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "RDM Failed\n");
|
||||
return Status;
|
||||
} else {
|
||||
Status = STATUS_SUCCESS;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -590,11 +611,14 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
|
|||
}
|
||||
|
||||
if (pgpio_multi_info[WIMAX_IDX].uiGPIOMask) {
|
||||
Status = rdmaltWithLock(Adapter, (UINT)GPIO_PIN_STATE_REGISTER, (PUINT)ucResetValue, sizeof(UINT));
|
||||
bytes = rdmaltWithLock(Adapter, (UINT)GPIO_PIN_STATE_REGISTER, (PUINT)ucResetValue, sizeof(UINT));
|
||||
|
||||
if (Status != STATUS_SUCCESS) {
|
||||
if (bytes < 0) {
|
||||
Status = bytes;
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "RDM to GPIO_PIN_STATE_REGISTER Failed.");
|
||||
return Status;
|
||||
} else {
|
||||
Status = STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
pgpio_multi_info[WIMAX_IDX].uiGPIOValue = (*(UINT *)ucResetValue &
|
||||
|
@ -605,7 +629,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
|
|||
if (Status) {
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0,
|
||||
"Failed while copying Content to IOBufer for user space err:%d", Status);
|
||||
break;
|
||||
return -EFAULT;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -629,11 +653,14 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
|
|||
if (copy_from_user(&gpio_multi_mode, IoBuffer.InputBuffer, IoBuffer.InputLength))
|
||||
return -EFAULT;
|
||||
|
||||
Status = rdmaltWithLock(Adapter, (UINT)GPIO_MODE_REGISTER, (PUINT)ucResetValue, sizeof(UINT));
|
||||
bytes = rdmaltWithLock(Adapter, (UINT)GPIO_MODE_REGISTER, (PUINT)ucResetValue, sizeof(UINT));
|
||||
|
||||
if (STATUS_SUCCESS != Status) {
|
||||
if (bytes < 0) {
|
||||
Status = bytes;
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Read of GPIO_MODE_REGISTER failed");
|
||||
return Status;
|
||||
} else {
|
||||
Status = STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/* Validating the request */
|
||||
|
@ -678,7 +705,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
|
|||
if (Status) {
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0,
|
||||
"Failed while copying Content to IOBufer for user space err:%d", Status);
|
||||
break;
|
||||
return -EFAULT;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -706,9 +733,8 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
|
|||
return -ENOMEM;
|
||||
|
||||
if (copy_from_user(pvBuffer, IoBuffer.InputBuffer, IoBuffer.InputLength)) {
|
||||
Status = -EFAULT;
|
||||
kfree(pvBuffer);
|
||||
break;
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
down(&Adapter->LowPowerModeSync);
|
||||
|
@ -733,8 +759,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
|
|||
}
|
||||
|
||||
case IOCTL_BCM_BUFFER_DOWNLOAD_START: {
|
||||
INT NVMAccess = down_trylock(&Adapter->NVMRdmWrmLock);
|
||||
if (NVMAccess) {
|
||||
if (down_trylock(&Adapter->NVMRdmWrmLock)) {
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL,
|
||||
"IOCTL_BCM_CHIP_RESET not allowed as EEPROM Read/Write is in progress\n");
|
||||
return -EACCES;
|
||||
|
@ -743,157 +768,162 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
|
|||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0,
|
||||
"Starting the firmware download PID =0x%x!!!!\n", current->pid);
|
||||
|
||||
if (!down_trylock(&Adapter->fw_download_sema)) {
|
||||
Adapter->bBinDownloaded = FALSE;
|
||||
Adapter->fw_download_process_pid = current->pid;
|
||||
Adapter->bCfgDownloaded = FALSE;
|
||||
Adapter->fw_download_done = FALSE;
|
||||
netif_carrier_off(Adapter->dev);
|
||||
netif_stop_queue(Adapter->dev);
|
||||
Status = reset_card_proc(Adapter);
|
||||
if (Status) {
|
||||
pr_err(PFX "%s: reset_card_proc Failed!\n", Adapter->dev->name);
|
||||
up(&Adapter->fw_download_sema);
|
||||
up(&Adapter->NVMRdmWrmLock);
|
||||
break;
|
||||
}
|
||||
mdelay(10);
|
||||
} else {
|
||||
Status = -EBUSY;
|
||||
if (down_trylock(&Adapter->fw_download_sema))
|
||||
return -EBUSY;
|
||||
|
||||
Adapter->bBinDownloaded = FALSE;
|
||||
Adapter->fw_download_process_pid = current->pid;
|
||||
Adapter->bCfgDownloaded = FALSE;
|
||||
Adapter->fw_download_done = FALSE;
|
||||
netif_carrier_off(Adapter->dev);
|
||||
netif_stop_queue(Adapter->dev);
|
||||
Status = reset_card_proc(Adapter);
|
||||
if (Status) {
|
||||
pr_err(PFX "%s: reset_card_proc Failed!\n", Adapter->dev->name);
|
||||
up(&Adapter->fw_download_sema);
|
||||
up(&Adapter->NVMRdmWrmLock);
|
||||
return Status;
|
||||
}
|
||||
mdelay(10);
|
||||
|
||||
up(&Adapter->NVMRdmWrmLock);
|
||||
break;
|
||||
return Status;
|
||||
}
|
||||
|
||||
case IOCTL_BCM_BUFFER_DOWNLOAD: {
|
||||
FIRMWARE_INFO *psFwInfo = NULL;
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Starting the firmware download PID =0x%x!!!!\n", current->pid);
|
||||
do {
|
||||
if (!down_trylock(&Adapter->fw_download_sema)) {
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0,
|
||||
"Invalid way to download buffer. Use Start and then call this!!!\n");
|
||||
Status = -EINVAL;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Copy Ioctl Buffer structure */
|
||||
if (copy_from_user(&IoBuffer, argp, sizeof(IOCTL_BUFFER)))
|
||||
return -EFAULT;
|
||||
|
||||
if (!down_trylock(&Adapter->fw_download_sema)) {
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0,
|
||||
"Length for FW DLD is : %lx\n", IoBuffer.InputLength);
|
||||
"Invalid way to download buffer. Use Start and then call this!!!\n");
|
||||
up(&Adapter->fw_download_sema);
|
||||
Status = -EINVAL;
|
||||
return Status;
|
||||
}
|
||||
|
||||
if (IoBuffer.InputLength > sizeof(FIRMWARE_INFO))
|
||||
return -EINVAL;
|
||||
/* Copy Ioctl Buffer structure */
|
||||
if (copy_from_user(&IoBuffer, argp, sizeof(IOCTL_BUFFER))) {
|
||||
up(&Adapter->fw_download_sema);
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
psFwInfo = kmalloc(sizeof(*psFwInfo), GFP_KERNEL);
|
||||
if (!psFwInfo)
|
||||
return -ENOMEM;
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0,
|
||||
"Length for FW DLD is : %lx\n", IoBuffer.InputLength);
|
||||
|
||||
if (copy_from_user(psFwInfo, IoBuffer.InputBuffer, IoBuffer.InputLength))
|
||||
return -EFAULT;
|
||||
if (IoBuffer.InputLength > sizeof(FIRMWARE_INFO)) {
|
||||
up(&Adapter->fw_download_sema);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (!psFwInfo->pvMappedFirmwareAddress ||
|
||||
(psFwInfo->u32FirmwareLength == 0)) {
|
||||
psFwInfo = kmalloc(sizeof(*psFwInfo), GFP_KERNEL);
|
||||
if (!psFwInfo) {
|
||||
up(&Adapter->fw_download_sema);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Something else is wrong %lu\n",
|
||||
psFwInfo->u32FirmwareLength);
|
||||
Status = -EINVAL;
|
||||
break;
|
||||
if (copy_from_user(psFwInfo, IoBuffer.InputBuffer, IoBuffer.InputLength)) {
|
||||
up(&Adapter->fw_download_sema);
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
if (!psFwInfo->pvMappedFirmwareAddress ||
|
||||
(psFwInfo->u32FirmwareLength == 0)) {
|
||||
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Something else is wrong %lu\n",
|
||||
psFwInfo->u32FirmwareLength);
|
||||
up(&Adapter->fw_download_sema);
|
||||
Status = -EINVAL;
|
||||
return Status;
|
||||
}
|
||||
|
||||
Status = bcm_ioctl_fw_download(Adapter, psFwInfo);
|
||||
|
||||
if (Status != STATUS_SUCCESS) {
|
||||
if (psFwInfo->u32StartingAddress == CONFIG_BEGIN_ADDR)
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "IOCTL: Configuration File Upload Failed\n");
|
||||
else
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "IOCTL: Firmware File Upload Failed\n");
|
||||
|
||||
/* up(&Adapter->fw_download_sema); */
|
||||
|
||||
if (Adapter->LEDInfo.led_thread_running & BCM_LED_THREAD_RUNNING_ACTIVELY) {
|
||||
Adapter->DriverState = DRIVER_INIT;
|
||||
Adapter->LEDInfo.bLedInitDone = FALSE;
|
||||
wake_up(&Adapter->LEDInfo.notify_led_event);
|
||||
}
|
||||
|
||||
Status = bcm_ioctl_fw_download(Adapter, psFwInfo);
|
||||
|
||||
if (Status != STATUS_SUCCESS) {
|
||||
if (psFwInfo->u32StartingAddress == CONFIG_BEGIN_ADDR)
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "IOCTL: Configuration File Upload Failed\n");
|
||||
else
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "IOCTL: Firmware File Upload Failed\n");
|
||||
|
||||
/* up(&Adapter->fw_download_sema); */
|
||||
|
||||
if (Adapter->LEDInfo.led_thread_running & BCM_LED_THREAD_RUNNING_ACTIVELY) {
|
||||
Adapter->DriverState = DRIVER_INIT;
|
||||
Adapter->LEDInfo.bLedInitDone = FALSE;
|
||||
wake_up(&Adapter->LEDInfo.notify_led_event);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
} while (0);
|
||||
}
|
||||
|
||||
if (Status != STATUS_SUCCESS)
|
||||
up(&Adapter->fw_download_sema);
|
||||
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, OSAL_DBG, DBG_LVL_ALL, "IOCTL: Firmware File Uploaded\n");
|
||||
kfree(psFwInfo);
|
||||
break;
|
||||
return Status;
|
||||
}
|
||||
|
||||
case IOCTL_BCM_BUFFER_DOWNLOAD_STOP: {
|
||||
INT NVMAccess = down_trylock(&Adapter->NVMRdmWrmLock);
|
||||
if (!down_trylock(&Adapter->fw_download_sema)) {
|
||||
up(&Adapter->fw_download_sema);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (NVMAccess) {
|
||||
if (down_trylock(&Adapter->NVMRdmWrmLock)) {
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0,
|
||||
"FW download blocked as EEPROM Read/Write is in progress\n");
|
||||
up(&Adapter->fw_download_sema);
|
||||
return -EACCES;
|
||||
}
|
||||
|
||||
if (down_trylock(&Adapter->fw_download_sema)) {
|
||||
Adapter->bBinDownloaded = TRUE;
|
||||
Adapter->bCfgDownloaded = TRUE;
|
||||
atomic_set(&Adapter->CurrNumFreeTxDesc, 0);
|
||||
Adapter->CurrNumRecvDescs = 0;
|
||||
Adapter->downloadDDR = 0;
|
||||
Adapter->bBinDownloaded = TRUE;
|
||||
Adapter->bCfgDownloaded = TRUE;
|
||||
atomic_set(&Adapter->CurrNumFreeTxDesc, 0);
|
||||
Adapter->CurrNumRecvDescs = 0;
|
||||
Adapter->downloadDDR = 0;
|
||||
|
||||
/* setting the Mips to Run */
|
||||
Status = run_card_proc(Adapter);
|
||||
/* setting the Mips to Run */
|
||||
Status = run_card_proc(Adapter);
|
||||
|
||||
if (Status) {
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Firm Download Failed\n");
|
||||
up(&Adapter->fw_download_sema);
|
||||
up(&Adapter->NVMRdmWrmLock);
|
||||
break;
|
||||
} else {
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG,
|
||||
DBG_LVL_ALL, "Firm Download Over...\n");
|
||||
}
|
||||
|
||||
mdelay(10);
|
||||
|
||||
/* Wait for MailBox Interrupt */
|
||||
if (StartInterruptUrb((PS_INTERFACE_ADAPTER)Adapter->pvInterfaceAdapter))
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Unable to send interrupt...\n");
|
||||
|
||||
timeout = 5*HZ;
|
||||
Adapter->waiting_to_fw_download_done = FALSE;
|
||||
wait_event_timeout(Adapter->ioctl_fw_dnld_wait_queue,
|
||||
Adapter->waiting_to_fw_download_done, timeout);
|
||||
Adapter->fw_download_process_pid = INVALID_PID;
|
||||
Adapter->fw_download_done = TRUE;
|
||||
atomic_set(&Adapter->CurrNumFreeTxDesc, 0);
|
||||
Adapter->CurrNumRecvDescs = 0;
|
||||
Adapter->PrevNumRecvDescs = 0;
|
||||
atomic_set(&Adapter->cntrlpktCnt, 0);
|
||||
Adapter->LinkUpStatus = 0;
|
||||
Adapter->LinkStatus = 0;
|
||||
|
||||
if (Adapter->LEDInfo.led_thread_running & BCM_LED_THREAD_RUNNING_ACTIVELY) {
|
||||
Adapter->DriverState = FW_DOWNLOAD_DONE;
|
||||
wake_up(&Adapter->LEDInfo.notify_led_event);
|
||||
}
|
||||
|
||||
if (!timeout)
|
||||
Status = -ENODEV;
|
||||
if (Status) {
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Firm Download Failed\n");
|
||||
up(&Adapter->fw_download_sema);
|
||||
up(&Adapter->NVMRdmWrmLock);
|
||||
return Status;
|
||||
} else {
|
||||
Status = -EINVAL;
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG,
|
||||
DBG_LVL_ALL, "Firm Download Over...\n");
|
||||
}
|
||||
|
||||
mdelay(10);
|
||||
|
||||
/* Wait for MailBox Interrupt */
|
||||
if (StartInterruptUrb((PS_INTERFACE_ADAPTER)Adapter->pvInterfaceAdapter))
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Unable to send interrupt...\n");
|
||||
|
||||
timeout = 5*HZ;
|
||||
Adapter->waiting_to_fw_download_done = FALSE;
|
||||
wait_event_timeout(Adapter->ioctl_fw_dnld_wait_queue,
|
||||
Adapter->waiting_to_fw_download_done, timeout);
|
||||
Adapter->fw_download_process_pid = INVALID_PID;
|
||||
Adapter->fw_download_done = TRUE;
|
||||
atomic_set(&Adapter->CurrNumFreeTxDesc, 0);
|
||||
Adapter->CurrNumRecvDescs = 0;
|
||||
Adapter->PrevNumRecvDescs = 0;
|
||||
atomic_set(&Adapter->cntrlpktCnt, 0);
|
||||
Adapter->LinkUpStatus = 0;
|
||||
Adapter->LinkStatus = 0;
|
||||
|
||||
if (Adapter->LEDInfo.led_thread_running & BCM_LED_THREAD_RUNNING_ACTIVELY) {
|
||||
Adapter->DriverState = FW_DOWNLOAD_DONE;
|
||||
wake_up(&Adapter->LEDInfo.notify_led_event);
|
||||
}
|
||||
|
||||
if (!timeout)
|
||||
Status = -ENODEV;
|
||||
|
||||
up(&Adapter->fw_download_sema);
|
||||
up(&Adapter->NVMRdmWrmLock);
|
||||
break;
|
||||
return Status;
|
||||
}
|
||||
|
||||
case IOCTL_BE_BUCKET_SIZE:
|
||||
|
@ -969,11 +999,15 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
|
|||
}
|
||||
|
||||
case IOCTL_BCM_GET_DRIVER_VERSION: {
|
||||
ulong len;
|
||||
|
||||
/* Copy Ioctl Buffer structure */
|
||||
if (copy_from_user(&IoBuffer, argp, sizeof(IOCTL_BUFFER)))
|
||||
return -EFAULT;
|
||||
|
||||
if (copy_to_user(IoBuffer.OutputBuffer, VER_FILEVERSION_STR, IoBuffer.OutputLength))
|
||||
len = min_t(ulong, IoBuffer.OutputLength, strlen(VER_FILEVERSION_STR) + 1);
|
||||
|
||||
if (copy_to_user(IoBuffer.OutputBuffer, VER_FILEVERSION_STR, len))
|
||||
return -EFAULT;
|
||||
Status = STATUS_SUCCESS;
|
||||
break;
|
||||
|
@ -985,8 +1019,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
|
|||
/* Copy Ioctl Buffer structure */
|
||||
if (copy_from_user(&IoBuffer, argp, sizeof(IOCTL_BUFFER))) {
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "copy_from_user failed..\n");
|
||||
Status = -EFAULT;
|
||||
break;
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
if (IoBuffer.OutputLength != sizeof(link_state)) {
|
||||
|
@ -1001,8 +1034,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
|
|||
|
||||
if (copy_to_user(IoBuffer.OutputBuffer, &link_state, min_t(size_t, sizeof(link_state), IoBuffer.OutputLength))) {
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Copy_to_user Failed..\n");
|
||||
Status = -EFAULT;
|
||||
break;
|
||||
return -EFAULT;
|
||||
}
|
||||
Status = STATUS_SUCCESS;
|
||||
break;
|
||||
|
@ -1068,8 +1100,10 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
|
|||
GetDroppedAppCntrlPktMibs(temp_buff, pTarang);
|
||||
|
||||
if (Status != STATUS_FAILURE)
|
||||
if (copy_to_user(IoBuffer.OutputBuffer, temp_buff, sizeof(S_MIBS_HOST_STATS_MIBS)))
|
||||
Status = -EFAULT;
|
||||
if (copy_to_user(IoBuffer.OutputBuffer, temp_buff, sizeof(S_MIBS_HOST_STATS_MIBS))) {
|
||||
kfree(temp_buff);
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
kfree(temp_buff);
|
||||
break;
|
||||
|
@ -1103,7 +1137,9 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
|
|||
if (copy_from_user(&IoBuffer, argp, sizeof(IOCTL_BUFFER)))
|
||||
return -EFAULT;
|
||||
|
||||
/* FIXME: restrict length */
|
||||
if (IoBuffer.InputLength < sizeof(ULONG) * 2)
|
||||
return -EINVAL;
|
||||
|
||||
pvBuffer = kmalloc(IoBuffer.InputLength, GFP_KERNEL);
|
||||
if (!pvBuffer)
|
||||
return -ENOMEM;
|
||||
|
@ -1111,8 +1147,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
|
|||
/* Get WrmBuffer structure */
|
||||
if (copy_from_user(pvBuffer, IoBuffer.InputBuffer, IoBuffer.InputLength)) {
|
||||
kfree(pvBuffer);
|
||||
Status = -EFAULT;
|
||||
break;
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
pBulkBuffer = (PBULKWRM_BUFFER)pvBuffer;
|
||||
|
@ -1242,8 +1277,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
|
|||
memset(&tv1, 0, sizeof(struct timeval));
|
||||
if ((Adapter->eNVMType == NVM_FLASH) && (Adapter->uiFlashLayoutMajorVersion == 0)) {
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "The Flash Control Section is Corrupted. Hence Rejection on NVM Read/Write\n");
|
||||
Status = -EFAULT;
|
||||
break;
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
if (IsFlash2x(Adapter)) {
|
||||
|
@ -1252,7 +1286,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
|
|||
(Adapter->eActiveDSD != DSD2)) {
|
||||
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "No DSD is active..hence NVM Command is blocked");
|
||||
return STATUS_FAILURE ;
|
||||
return STATUS_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1271,8 +1305,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
|
|||
|
||||
if ((stNVMReadWrite.uiOffset + stNVMReadWrite.uiNumBytes) > Adapter->uiNVMDSDSize) {
|
||||
/* BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0,"Can't allow access beyond NVM Size: 0x%x 0x%x\n", stNVMReadWrite.uiOffset, stNVMReadWrite.uiNumBytes); */
|
||||
Status = STATUS_FAILURE;
|
||||
break;
|
||||
return STATUS_FAILURE;
|
||||
}
|
||||
|
||||
pReadData = kzalloc(stNVMReadWrite.uiNumBytes, GFP_KERNEL);
|
||||
|
@ -1280,9 +1313,8 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
|
|||
return -ENOMEM;
|
||||
|
||||
if (copy_from_user(pReadData, stNVMReadWrite.pBuffer, stNVMReadWrite.uiNumBytes)) {
|
||||
Status = -EFAULT;
|
||||
kfree(pReadData);
|
||||
break;
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
do_gettimeofday(&tv0);
|
||||
|
@ -1309,7 +1341,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
|
|||
|
||||
if (copy_to_user(stNVMReadWrite.pBuffer, pReadData, stNVMReadWrite.uiNumBytes)) {
|
||||
kfree(pReadData);
|
||||
Status = -EFAULT;
|
||||
return -EFAULT;
|
||||
}
|
||||
} else {
|
||||
down(&Adapter->NVMRdmWrmLock);
|
||||
|
@ -1377,9 +1409,8 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
|
|||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL, " timetaken by Write/read :%ld msec\n", (tv1.tv_sec - tv0.tv_sec)*1000 + (tv1.tv_usec - tv0.tv_usec)/1000);
|
||||
|
||||
kfree(pReadData);
|
||||
Status = STATUS_SUCCESS;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
break;
|
||||
|
||||
case IOCTL_BCM_FLASH2X_SECTION_READ: {
|
||||
FLASH2X_READWRITE sFlash2xRead = {0};
|
||||
|
@ -1456,7 +1487,9 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
|
|||
Status = copy_to_user(OutPutBuff, pReadBuff, ReadBytes);
|
||||
if (Status) {
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL, "Copy to use failed with status :%d", Status);
|
||||
break;
|
||||
up(&Adapter->NVMRdmWrmLock);
|
||||
kfree(pReadBuff);
|
||||
return -EFAULT;
|
||||
}
|
||||
NOB = NOB - ReadBytes;
|
||||
if (NOB) {
|
||||
|
@ -1548,7 +1581,9 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
|
|||
Status = copy_from_user(pWriteBuff, InputAddr, WriteBytes);
|
||||
if (Status) {
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Copy to user failed with status :%d", Status);
|
||||
break;
|
||||
up(&Adapter->NVMRdmWrmLock);
|
||||
kfree(pWriteBuff);
|
||||
return -EFAULT;
|
||||
}
|
||||
BCM_DEBUG_PRINT_BUFFER(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL, pWriteBuff, WriteBytes);
|
||||
|
||||
|
@ -1608,8 +1643,10 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
|
|||
|
||||
BcmGetFlash2xSectionalBitMap(Adapter, psFlash2xBitMap);
|
||||
up(&Adapter->NVMRdmWrmLock);
|
||||
if (copy_to_user(IoBuffer.OutputBuffer, psFlash2xBitMap, sizeof(FLASH2X_BITMAP)))
|
||||
Status = -EFAULT;
|
||||
if (copy_to_user(IoBuffer.OutputBuffer, psFlash2xBitMap, sizeof(FLASH2X_BITMAP))) {
|
||||
kfree(psFlash2xBitMap);
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
kfree(psFlash2xBitMap);
|
||||
}
|
||||
|
@ -1627,13 +1664,13 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
|
|||
Status = copy_from_user(&IoBuffer, argp, sizeof(IOCTL_BUFFER));
|
||||
if (Status) {
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Copy of IOCTL BUFFER failed");
|
||||
return Status;
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
Status = copy_from_user(&eFlash2xSectionVal, IoBuffer.InputBuffer, sizeof(INT));
|
||||
if (Status) {
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Copy of flash section val failed");
|
||||
return Status;
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
down(&Adapter->NVMRdmWrmLock);
|
||||
|
@ -1677,13 +1714,13 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
|
|||
Status = copy_from_user(&IoBuffer, argp, sizeof(IOCTL_BUFFER));
|
||||
if (Status) {
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Copy of IOCTL BUFFER failed Status :%d", Status);
|
||||
return Status;
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
Status = copy_from_user(&sCopySectStrut, IoBuffer.InputBuffer, sizeof(FLASH2X_COPY_SECTION));
|
||||
if (Status) {
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Copy of Copy_Section_Struct failed with Status :%d", Status);
|
||||
return Status;
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL, "Source SEction :%x", sCopySectStrut.SrcSection);
|
||||
|
@ -1744,7 +1781,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
|
|||
Status = copy_from_user(&IoBuffer, argp, sizeof(IOCTL_BUFFER));
|
||||
if (Status) {
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Copy of IOCTL BUFFER failed");
|
||||
break;
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
if (Adapter->eNVMType != NVM_FLASH) {
|
||||
|
@ -1783,12 +1820,12 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
|
|||
Status = copy_from_user(&IoBuffer, argp, sizeof(IOCTL_BUFFER));
|
||||
if (Status) {
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Copy of IOCTL BUFFER failed");
|
||||
return Status;
|
||||
return -EFAULT;
|
||||
}
|
||||
Status = copy_from_user(&eFlash2xSectionVal, IoBuffer.InputBuffer, sizeof(INT));
|
||||
if (Status) {
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Copy of flash section val failed");
|
||||
return Status;
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL, "Read Section :%d", eFlash2xSectionVal);
|
||||
|
@ -1830,8 +1867,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
|
|||
/* Copy Ioctl Buffer structure */
|
||||
if (copy_from_user(&IoBuffer, argp, sizeof(IOCTL_BUFFER))) {
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "copy_from_user 1 failed\n");
|
||||
Status = -EFAULT;
|
||||
break;
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
if (copy_from_user(&stNVMRead, IoBuffer.OutputBuffer, sizeof(NVM_READWRITE)))
|
||||
|
@ -1886,7 +1922,9 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
|
|||
Status = copy_to_user(OutPutBuff, pReadBuff, ReadBytes);
|
||||
if (Status) {
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Copy to use failed with status :%d", Status);
|
||||
break;
|
||||
up(&Adapter->NVMRdmWrmLock);
|
||||
kfree(pReadBuff);
|
||||
return -EFAULT;
|
||||
}
|
||||
NOB = NOB - ReadBytes;
|
||||
if (NOB) {
|
||||
|
@ -1907,8 +1945,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
|
|||
Status = copy_from_user(&IoBuffer, argp, sizeof(IOCTL_BUFFER));
|
||||
if (Status) {
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL, "copy of Ioctl buffer is failed from user space");
|
||||
Status = -EFAULT;
|
||||
break;
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
if (IoBuffer.InputLength != sizeof(unsigned long)) {
|
||||
|
@ -1919,8 +1956,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
|
|||
Status = copy_from_user(&RxCntrlMsgBitMask, IoBuffer.InputBuffer, IoBuffer.InputLength);
|
||||
if (Status) {
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL, "copy of control bit mask failed from user space");
|
||||
Status = -EFAULT;
|
||||
break;
|
||||
return -EFAULT;
|
||||
}
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL, "\n Got user defined cntrl msg bit mask :%lx", RxCntrlMsgBitMask);
|
||||
pTarang->RxCntrlMsgBitMask = RxCntrlMsgBitMask;
|
||||
|
|
|
@ -1,195 +1,208 @@
|
|||
/**
|
||||
@file HandleControlPacket.c
|
||||
This file contains the routines to deal with
|
||||
sending and receiving of control packets.
|
||||
*/
|
||||
* @file HandleControlPacket.c
|
||||
* This file contains the routines to deal with
|
||||
* sending and receiving of control packets.
|
||||
*/
|
||||
#include "headers.h"
|
||||
|
||||
/**
|
||||
When a control packet is received, analyze the
|
||||
"status" and call appropriate response function.
|
||||
Enqueue the control packet for Application.
|
||||
@return None
|
||||
*/
|
||||
* When a control packet is received, analyze the
|
||||
* "status" and call appropriate response function.
|
||||
* Enqueue the control packet for Application.
|
||||
* @return None
|
||||
*/
|
||||
static VOID handle_rx_control_packet(PMINI_ADAPTER Adapter, struct sk_buff *skb)
|
||||
{
|
||||
PPER_TARANG_DATA pTarang = NULL;
|
||||
PPER_TARANG_DATA pTarang = NULL;
|
||||
BOOLEAN HighPriorityMessage = FALSE;
|
||||
struct sk_buff * newPacket = NULL;
|
||||
struct sk_buff *newPacket = NULL;
|
||||
CHAR cntrl_msg_mask_bit = 0;
|
||||
BOOLEAN drop_pkt_flag = TRUE ;
|
||||
BOOLEAN drop_pkt_flag = TRUE;
|
||||
USHORT usStatus = *(PUSHORT)(skb->data);
|
||||
|
||||
if (netif_msg_pktdata(Adapter))
|
||||
print_hex_dump(KERN_DEBUG, PFX "rx control: ", DUMP_PREFIX_NONE,
|
||||
16, 1, skb->data, skb->len, 0);
|
||||
16, 1, skb->data, skb->len, 0);
|
||||
|
||||
switch(usStatus)
|
||||
{
|
||||
case CM_RESPONSES: // 0xA0
|
||||
BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CP_CTRL_PKT, DBG_LVL_ALL, "MAC Version Seems to be Non Multi-Classifier, rejected by Driver");
|
||||
HighPriorityMessage = TRUE ;
|
||||
break;
|
||||
case CM_CONTROL_NEWDSX_MULTICLASSIFIER_RESP:
|
||||
HighPriorityMessage = TRUE ;
|
||||
if(Adapter->LinkStatus==LINKUP_DONE)
|
||||
{
|
||||
CmControlResponseMessage(Adapter,(skb->data +sizeof(USHORT)));
|
||||
}
|
||||
break;
|
||||
case LINK_CONTROL_RESP: //0xA2
|
||||
case STATUS_RSP: //0xA1
|
||||
BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CP_CTRL_PKT, DBG_LVL_ALL,"LINK_CONTROL_RESP");
|
||||
HighPriorityMessage = TRUE ;
|
||||
LinkControlResponseMessage(Adapter,(skb->data + sizeof(USHORT)));
|
||||
break;
|
||||
case STATS_POINTER_RESP: //0xA6
|
||||
HighPriorityMessage = TRUE ;
|
||||
StatisticsResponse(Adapter, (skb->data + sizeof(USHORT)));
|
||||
break;
|
||||
case IDLE_MODE_STATUS: //0xA3
|
||||
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, CP_CTRL_PKT, DBG_LVL_ALL,"IDLE_MODE_STATUS Type Message Got from F/W");
|
||||
InterfaceIdleModeRespond(Adapter, (PUINT)(skb->data +
|
||||
sizeof(USHORT)));
|
||||
HighPriorityMessage = TRUE ;
|
||||
break;
|
||||
switch (usStatus) {
|
||||
case CM_RESPONSES: /* 0xA0 */
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CP_CTRL_PKT,
|
||||
DBG_LVL_ALL,
|
||||
"MAC Version Seems to be Non Multi-Classifier, rejected by Driver");
|
||||
HighPriorityMessage = TRUE;
|
||||
break;
|
||||
case CM_CONTROL_NEWDSX_MULTICLASSIFIER_RESP:
|
||||
HighPriorityMessage = TRUE;
|
||||
if (Adapter->LinkStatus == LINKUP_DONE)
|
||||
CmControlResponseMessage(Adapter,
|
||||
(skb->data + sizeof(USHORT)));
|
||||
break;
|
||||
case LINK_CONTROL_RESP: /* 0xA2 */
|
||||
case STATUS_RSP: /* 0xA1 */
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CP_CTRL_PKT,
|
||||
DBG_LVL_ALL, "LINK_CONTROL_RESP");
|
||||
HighPriorityMessage = TRUE;
|
||||
LinkControlResponseMessage(Adapter,
|
||||
(skb->data + sizeof(USHORT)));
|
||||
break;
|
||||
case STATS_POINTER_RESP: /* 0xA6 */
|
||||
HighPriorityMessage = TRUE;
|
||||
StatisticsResponse(Adapter, (skb->data + sizeof(USHORT)));
|
||||
break;
|
||||
case IDLE_MODE_STATUS: /* 0xA3 */
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CP_CTRL_PKT,
|
||||
DBG_LVL_ALL,
|
||||
"IDLE_MODE_STATUS Type Message Got from F/W");
|
||||
InterfaceIdleModeRespond(Adapter, (PUINT)(skb->data +
|
||||
sizeof(USHORT)));
|
||||
HighPriorityMessage = TRUE;
|
||||
break;
|
||||
|
||||
case AUTH_SS_HOST_MSG:
|
||||
HighPriorityMessage = TRUE ;
|
||||
break;
|
||||
case AUTH_SS_HOST_MSG:
|
||||
HighPriorityMessage = TRUE;
|
||||
break;
|
||||
|
||||
default:
|
||||
BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CP_CTRL_PKT, DBG_LVL_ALL,"Got Default Response");
|
||||
/* Let the Application Deal with This Packet */
|
||||
break;
|
||||
default:
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CP_CTRL_PKT,
|
||||
DBG_LVL_ALL, "Got Default Response");
|
||||
/* Let the Application Deal with This Packet */
|
||||
break;
|
||||
}
|
||||
|
||||
//Queue The Control Packet to The Application Queues
|
||||
/* Queue The Control Packet to The Application Queues */
|
||||
down(&Adapter->RxAppControlQueuelock);
|
||||
|
||||
for (pTarang = Adapter->pTarangs; pTarang; pTarang = pTarang->next)
|
||||
{
|
||||
if(Adapter->device_removed)
|
||||
{
|
||||
for (pTarang = Adapter->pTarangs; pTarang; pTarang = pTarang->next) {
|
||||
if (Adapter->device_removed)
|
||||
break;
|
||||
}
|
||||
|
||||
drop_pkt_flag = TRUE ;
|
||||
drop_pkt_flag = TRUE;
|
||||
/*
|
||||
There are cntrl msg from A0 to AC. It has been mapped to 0 to C bit in the cntrl mask.
|
||||
Also, by default AD to BF has been masked to the rest of the bits... which wil be ON by default.
|
||||
if mask bit is enable to particular pkt status, send it out to app else stop it.
|
||||
*/
|
||||
* There are cntrl msg from A0 to AC. It has been mapped to 0 to
|
||||
* C bit in the cntrl mask.
|
||||
* Also, by default AD to BF has been masked to the rest of the
|
||||
* bits... which wil be ON by default.
|
||||
* if mask bit is enable to particular pkt status, send it out
|
||||
* to app else stop it.
|
||||
*/
|
||||
cntrl_msg_mask_bit = (usStatus & 0x1F);
|
||||
//printk("\ninew msg mask bit which is disable in mask:%X", cntrl_msg_mask_bit);
|
||||
if(pTarang->RxCntrlMsgBitMask & (1<<cntrl_msg_mask_bit))
|
||||
drop_pkt_flag = FALSE;
|
||||
/*
|
||||
* printk("\ninew msg mask bit which is disable in mask:%X",
|
||||
* cntrl_msg_mask_bit);
|
||||
*/
|
||||
if (pTarang->RxCntrlMsgBitMask & (1 << cntrl_msg_mask_bit))
|
||||
drop_pkt_flag = FALSE;
|
||||
|
||||
if ((drop_pkt_flag == TRUE) || (pTarang->AppCtrlQueueLen > MAX_APP_QUEUE_LEN) ||
|
||||
((pTarang->AppCtrlQueueLen > MAX_APP_QUEUE_LEN/2) && (HighPriorityMessage == FALSE)))
|
||||
{
|
||||
if ((drop_pkt_flag == TRUE) ||
|
||||
(pTarang->AppCtrlQueueLen > MAX_APP_QUEUE_LEN)
|
||||
|| ((pTarang->AppCtrlQueueLen >
|
||||
MAX_APP_QUEUE_LEN / 2) &&
|
||||
(HighPriorityMessage == FALSE))) {
|
||||
/*
|
||||
Assumption:-
|
||||
1. every tarang manages it own dropped pkt statitistics
|
||||
2. Total packet dropped per tarang will be equal to the sum of all types of dropped
|
||||
pkt by that tarang only.
|
||||
|
||||
*/
|
||||
switch(*(PUSHORT)skb->data)
|
||||
{
|
||||
case CM_RESPONSES:
|
||||
pTarang->stDroppedAppCntrlMsgs.cm_responses++;
|
||||
break;
|
||||
case CM_CONTROL_NEWDSX_MULTICLASSIFIER_RESP:
|
||||
pTarang->stDroppedAppCntrlMsgs.cm_control_newdsx_multiclassifier_resp++;
|
||||
break;
|
||||
case LINK_CONTROL_RESP:
|
||||
pTarang->stDroppedAppCntrlMsgs.link_control_resp++;
|
||||
break;
|
||||
case STATUS_RSP:
|
||||
pTarang->stDroppedAppCntrlMsgs.status_rsp++;
|
||||
break;
|
||||
case STATS_POINTER_RESP:
|
||||
pTarang->stDroppedAppCntrlMsgs.stats_pointer_resp++;
|
||||
break;
|
||||
case IDLE_MODE_STATUS:
|
||||
pTarang->stDroppedAppCntrlMsgs.idle_mode_status++ ;
|
||||
break;
|
||||
case AUTH_SS_HOST_MSG:
|
||||
pTarang->stDroppedAppCntrlMsgs.auth_ss_host_msg++ ;
|
||||
break;
|
||||
* Assumption:-
|
||||
* 1. every tarang manages it own dropped pkt
|
||||
* statitistics
|
||||
* 2. Total packet dropped per tarang will be equal to
|
||||
* the sum of all types of dropped pkt by that
|
||||
* tarang only.
|
||||
*/
|
||||
switch (*(PUSHORT)skb->data) {
|
||||
case CM_RESPONSES:
|
||||
pTarang->stDroppedAppCntrlMsgs.cm_responses++;
|
||||
break;
|
||||
case CM_CONTROL_NEWDSX_MULTICLASSIFIER_RESP:
|
||||
pTarang->stDroppedAppCntrlMsgs.cm_control_newdsx_multiclassifier_resp++;
|
||||
break;
|
||||
case LINK_CONTROL_RESP:
|
||||
pTarang->stDroppedAppCntrlMsgs.link_control_resp++;
|
||||
break;
|
||||
case STATUS_RSP:
|
||||
pTarang->stDroppedAppCntrlMsgs.status_rsp++;
|
||||
break;
|
||||
case STATS_POINTER_RESP:
|
||||
pTarang->stDroppedAppCntrlMsgs.stats_pointer_resp++;
|
||||
break;
|
||||
case IDLE_MODE_STATUS:
|
||||
pTarang->stDroppedAppCntrlMsgs.idle_mode_status++;
|
||||
break;
|
||||
case AUTH_SS_HOST_MSG:
|
||||
pTarang->stDroppedAppCntrlMsgs.auth_ss_host_msg++;
|
||||
break;
|
||||
default:
|
||||
pTarang->stDroppedAppCntrlMsgs.low_priority_message++ ;
|
||||
break;
|
||||
pTarang->stDroppedAppCntrlMsgs.low_priority_message++;
|
||||
break;
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
newPacket = skb_clone(skb, GFP_KERNEL);
|
||||
if (!newPacket)
|
||||
break;
|
||||
ENQUEUEPACKET(pTarang->RxAppControlHead,pTarang->RxAppControlTail,
|
||||
newPacket);
|
||||
pTarang->AppCtrlQueueLen++;
|
||||
}
|
||||
newPacket = skb_clone(skb, GFP_KERNEL);
|
||||
if (!newPacket)
|
||||
break;
|
||||
ENQUEUEPACKET(pTarang->RxAppControlHead,
|
||||
pTarang->RxAppControlTail, newPacket);
|
||||
pTarang->AppCtrlQueueLen++;
|
||||
}
|
||||
up(&Adapter->RxAppControlQueuelock);
|
||||
wake_up(&Adapter->process_read_wait_queue);
|
||||
dev_kfree_skb(skb);
|
||||
BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CP_CTRL_PKT, DBG_LVL_ALL, "After wake_up_interruptible");
|
||||
wake_up(&Adapter->process_read_wait_queue);
|
||||
dev_kfree_skb(skb);
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CP_CTRL_PKT, DBG_LVL_ALL,
|
||||
"After wake_up_interruptible");
|
||||
}
|
||||
|
||||
/**
|
||||
@ingroup ctrl_pkt_functions
|
||||
Thread to handle control pkt reception
|
||||
*/
|
||||
int control_packet_handler (PMINI_ADAPTER Adapter /**< pointer to adapter object*/
|
||||
)
|
||||
* @ingroup ctrl_pkt_functions
|
||||
* Thread to handle control pkt reception
|
||||
*/
|
||||
int control_packet_handler(PMINI_ADAPTER Adapter /* pointer to adapter object*/)
|
||||
{
|
||||
struct sk_buff *ctrl_packet= NULL;
|
||||
struct sk_buff *ctrl_packet = NULL;
|
||||
unsigned long flags = 0;
|
||||
//struct timeval tv ;
|
||||
//int *puiBuffer = NULL ;
|
||||
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, CP_CTRL_PKT, DBG_LVL_ALL, "Entering to make thread wait on control packet event!");
|
||||
while(1)
|
||||
{
|
||||
/* struct timeval tv; */
|
||||
/* int *puiBuffer = NULL; */
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CP_CTRL_PKT, DBG_LVL_ALL,
|
||||
"Entering to make thread wait on control packet event!");
|
||||
while (1) {
|
||||
wait_event_interruptible(Adapter->process_rx_cntrlpkt,
|
||||
atomic_read(&Adapter->cntrlpktCnt) ||
|
||||
Adapter->bWakeUpDevice ||
|
||||
kthread_should_stop()
|
||||
);
|
||||
atomic_read(&Adapter->cntrlpktCnt) ||
|
||||
Adapter->bWakeUpDevice ||
|
||||
kthread_should_stop());
|
||||
|
||||
|
||||
if(kthread_should_stop())
|
||||
{
|
||||
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, CP_CTRL_PKT, DBG_LVL_ALL, "Exiting \n");
|
||||
if (kthread_should_stop()) {
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CP_CTRL_PKT,
|
||||
DBG_LVL_ALL, "Exiting\n");
|
||||
return 0;
|
||||
}
|
||||
if(TRUE == Adapter->bWakeUpDevice)
|
||||
{
|
||||
if (TRUE == Adapter->bWakeUpDevice) {
|
||||
Adapter->bWakeUpDevice = FALSE;
|
||||
if((FALSE == Adapter->bTriedToWakeUpFromlowPowerMode) &&
|
||||
((TRUE == Adapter->IdleMode)|| (TRUE == Adapter->bShutStatus)))
|
||||
{
|
||||
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, CP_CTRL_PKT, DBG_LVL_ALL, "Calling InterfaceAbortIdlemode\n");
|
||||
// Adapter->bTriedToWakeUpFromlowPowerMode = TRUE;
|
||||
InterfaceIdleModeWakeup (Adapter);
|
||||
if ((FALSE == Adapter->bTriedToWakeUpFromlowPowerMode)
|
||||
&& ((TRUE == Adapter->IdleMode) ||
|
||||
(TRUE == Adapter->bShutStatus))) {
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS,
|
||||
CP_CTRL_PKT, DBG_LVL_ALL,
|
||||
"Calling InterfaceAbortIdlemode\n");
|
||||
/*
|
||||
* Adapter->bTriedToWakeUpFromlowPowerMode
|
||||
* = TRUE;
|
||||
*/
|
||||
InterfaceIdleModeWakeup(Adapter);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
while(atomic_read(&Adapter->cntrlpktCnt))
|
||||
{
|
||||
while (atomic_read(&Adapter->cntrlpktCnt)) {
|
||||
spin_lock_irqsave(&Adapter->control_queue_lock, flags);
|
||||
ctrl_packet = Adapter->RxControlHead;
|
||||
if(ctrl_packet)
|
||||
{
|
||||
DEQUEUEPACKET(Adapter->RxControlHead,Adapter->RxControlTail);
|
||||
// Adapter->RxControlHead=ctrl_packet->next;
|
||||
if (ctrl_packet) {
|
||||
DEQUEUEPACKET(Adapter->RxControlHead,
|
||||
Adapter->RxControlTail);
|
||||
/* Adapter->RxControlHead=ctrl_packet->next; */
|
||||
}
|
||||
|
||||
spin_unlock_irqrestore (&Adapter->control_queue_lock, flags);
|
||||
handle_rx_control_packet(Adapter, ctrl_packet);
|
||||
spin_unlock_irqrestore(&Adapter->control_queue_lock,
|
||||
flags);
|
||||
handle_rx_control_packet(Adapter, ctrl_packet);
|
||||
atomic_dec(&Adapter->cntrlpktCnt);
|
||||
}
|
||||
|
||||
|
@ -201,22 +214,22 @@ int control_packet_handler (PMINI_ADAPTER Adapter /**< pointer to adapter obje
|
|||
INT flushAllAppQ(void)
|
||||
{
|
||||
PMINI_ADAPTER Adapter = GET_BCM_ADAPTER(gblpnetdev);
|
||||
PPER_TARANG_DATA pTarang = NULL;
|
||||
PPER_TARANG_DATA pTarang = NULL;
|
||||
struct sk_buff *PacketToDrop = NULL;
|
||||
for(pTarang = Adapter->pTarangs; pTarang; pTarang = pTarang->next)
|
||||
{
|
||||
while(pTarang->RxAppControlHead != NULL)
|
||||
{
|
||||
PacketToDrop=pTarang->RxAppControlHead;
|
||||
DEQUEUEPACKET(pTarang->RxAppControlHead,pTarang->RxAppControlTail);
|
||||
for (pTarang = Adapter->pTarangs; pTarang; pTarang = pTarang->next) {
|
||||
while (pTarang->RxAppControlHead != NULL) {
|
||||
PacketToDrop = pTarang->RxAppControlHead;
|
||||
DEQUEUEPACKET(pTarang->RxAppControlHead,
|
||||
pTarang->RxAppControlTail);
|
||||
dev_kfree_skb(PacketToDrop);
|
||||
}
|
||||
pTarang->AppCtrlQueueLen = 0;
|
||||
//dropped contrl packet statistics also should be reset.
|
||||
memset((PVOID)&pTarang->stDroppedAppCntrlMsgs, 0, sizeof(S_MIBS_DROPPED_APP_CNTRL_MESSAGES));
|
||||
/* dropped contrl packet statistics also should be reset. */
|
||||
memset((PVOID)&pTarang->stDroppedAppCntrlMsgs, 0,
|
||||
sizeof(S_MIBS_DROPPED_APP_CNTRL_MESSAGES));
|
||||
|
||||
}
|
||||
return STATUS_SUCCESS ;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -62,6 +62,7 @@ int InterfaceFileReadbackFromChip(PVOID arg, struct file *flp, unsigned int on_c
|
|||
static int fw_down;
|
||||
INT Status = STATUS_SUCCESS;
|
||||
PS_INTERFACE_ADAPTER psIntfAdapter = (PS_INTERFACE_ADAPTER)arg;
|
||||
int bytes;
|
||||
|
||||
buff = kmalloc(MAX_TRANSFER_CTRL_BYTE_USB, GFP_DMA);
|
||||
buff_readback = kmalloc(MAX_TRANSFER_CTRL_BYTE_USB , GFP_DMA);
|
||||
|
@ -94,8 +95,9 @@ int InterfaceFileReadbackFromChip(PVOID arg, struct file *flp, unsigned int on_c
|
|||
break;
|
||||
}
|
||||
|
||||
Status = InterfaceRDM(psIntfAdapter, on_chip_loc, buff_readback, len);
|
||||
if (Status) {
|
||||
bytes = InterfaceRDM(psIntfAdapter, on_chip_loc, buff_readback, len);
|
||||
if (bytes < 0) {
|
||||
Status = bytes;
|
||||
BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_INITEXIT, MP_INIT, DBG_LVL_ALL, "RDM of len %d Failed! %d", len, reg);
|
||||
goto exit;
|
||||
}
|
||||
|
@ -302,6 +304,7 @@ static INT buffRdbkVerify(PMINI_ADAPTER Adapter, PUCHAR mappedbuffer, UINT u32Fi
|
|||
UINT len = u32FirmwareLength;
|
||||
INT retval = STATUS_SUCCESS;
|
||||
PUCHAR readbackbuff = kzalloc(MAX_TRANSFER_CTRL_BYTE_USB, GFP_KERNEL);
|
||||
int bytes;
|
||||
|
||||
if (NULL == readbackbuff) {
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_INITEXIT, MP_INIT, DBG_LVL_ALL, "MEMORY ALLOCATION FAILED");
|
||||
|
@ -310,9 +313,10 @@ static INT buffRdbkVerify(PMINI_ADAPTER Adapter, PUCHAR mappedbuffer, UINT u32Fi
|
|||
|
||||
while (u32FirmwareLength && !retval) {
|
||||
len = MIN_VAL(u32FirmwareLength, MAX_TRANSFER_CTRL_BYTE_USB);
|
||||
retval = rdm(Adapter, u32StartingAddress, readbackbuff, len);
|
||||
bytes = rdm(Adapter, u32StartingAddress, readbackbuff, len);
|
||||
|
||||
if (retval) {
|
||||
if (bytes < 0) {
|
||||
retval = bytes;
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_INITEXIT, MP_INIT, DBG_LVL_ALL, "rdm failed with status %d", retval);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -46,6 +46,7 @@ int InterfaceIdleModeRespond(PMINI_ADAPTER Adapter, unsigned int* puiBuffer)
|
|||
{
|
||||
int status = STATUS_SUCCESS;
|
||||
unsigned int uiRegRead = 0;
|
||||
int bytes;
|
||||
|
||||
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, IDLE_MODE, DBG_LVL_ALL,"SubType of Message :0x%X", ntohl(*puiBuffer));
|
||||
|
||||
|
@ -77,16 +78,16 @@ int InterfaceIdleModeRespond(PMINI_ADAPTER Adapter, unsigned int* puiBuffer)
|
|||
else if(Adapter->ulPowerSaveMode != DEVICE_POWERSAVE_MODE_AS_PROTOCOL_IDLE_MODE)
|
||||
{
|
||||
//clear on read Register
|
||||
status = rdmalt(Adapter, DEVICE_INT_OUT_EP_REG0, &uiRegRead, sizeof(uiRegRead));
|
||||
if(status)
|
||||
{
|
||||
bytes = rdmalt(Adapter, DEVICE_INT_OUT_EP_REG0, &uiRegRead, sizeof(uiRegRead));
|
||||
if (bytes < 0) {
|
||||
status = bytes;
|
||||
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "rdm failed while clearing H/W Abort Reg0");
|
||||
return status;
|
||||
}
|
||||
//clear on read Register
|
||||
status = rdmalt (Adapter, DEVICE_INT_OUT_EP_REG1, &uiRegRead, sizeof(uiRegRead));
|
||||
if(status)
|
||||
{
|
||||
bytes = rdmalt(Adapter, DEVICE_INT_OUT_EP_REG1, &uiRegRead, sizeof(uiRegRead));
|
||||
if (bytes < 0) {
|
||||
status = bytes;
|
||||
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "rdm failed while clearing H/W Abort Reg1");
|
||||
return status;
|
||||
}
|
||||
|
@ -117,9 +118,9 @@ int InterfaceIdleModeRespond(PMINI_ADAPTER Adapter, unsigned int* puiBuffer)
|
|||
Adapter->chip_id== BCS220_3)
|
||||
{
|
||||
|
||||
status = rdmalt(Adapter, HPM_CONFIG_MSW, &uiRegRead, sizeof(uiRegRead));
|
||||
if(status)
|
||||
{
|
||||
bytes = rdmalt(Adapter, HPM_CONFIG_MSW, &uiRegRead, sizeof(uiRegRead));
|
||||
if (bytes < 0) {
|
||||
status = bytes;
|
||||
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, IDLE_MODE, DBG_LVL_ALL, "rdm failed while Reading HPM_CONFIG_LDO145 Reg 0\n");
|
||||
return status;
|
||||
}
|
||||
|
@ -266,6 +267,8 @@ void InterfaceHandleShutdownModeWakeup(PMINI_ADAPTER Adapter)
|
|||
{
|
||||
unsigned int uiRegVal = 0;
|
||||
INT Status = 0;
|
||||
int bytes;
|
||||
|
||||
if(Adapter->ulPowerSaveMode == DEVICE_POWERSAVE_MODE_AS_MANUAL_CLOCK_GATING)
|
||||
{
|
||||
// clear idlemode interrupt.
|
||||
|
@ -282,16 +285,16 @@ void InterfaceHandleShutdownModeWakeup(PMINI_ADAPTER Adapter)
|
|||
{
|
||||
|
||||
//clear Interrupt EP registers.
|
||||
Status = rdmalt(Adapter,DEVICE_INT_OUT_EP_REG0, &uiRegVal, sizeof(uiRegVal));
|
||||
if(Status)
|
||||
{
|
||||
bytes = rdmalt(Adapter,DEVICE_INT_OUT_EP_REG0, &uiRegVal, sizeof(uiRegVal));
|
||||
if (bytes < 0) {
|
||||
Status = bytes;
|
||||
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0,"RDM of DEVICE_INT_OUT_EP_REG0 failed with Err :%d", Status);
|
||||
return;
|
||||
}
|
||||
|
||||
Status = rdmalt(Adapter,DEVICE_INT_OUT_EP_REG1, &uiRegVal, sizeof(uiRegVal));
|
||||
if(Status)
|
||||
{
|
||||
bytes = rdmalt(Adapter,DEVICE_INT_OUT_EP_REG1, &uiRegVal, sizeof(uiRegVal));
|
||||
if (bytes < 0) {
|
||||
Status = bytes;
|
||||
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0,"RDM of DEVICE_INT_OUT_EP_REG1 failed with Err :%d", Status);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -68,7 +68,7 @@ static void InterfaceAdapterFree(PS_INTERFACE_ADAPTER psIntfAdapter)
|
|||
static void ConfigureEndPointTypesThroughEEPROM(PMINI_ADAPTER Adapter)
|
||||
{
|
||||
unsigned long ulReg = 0;
|
||||
int ret;
|
||||
int bytes;
|
||||
|
||||
/* Program EP2 MAX_PKT_SIZE */
|
||||
ulReg = ntohl(EP2_MPS_REG);
|
||||
|
@ -94,8 +94,8 @@ static void ConfigureEndPointTypesThroughEEPROM(PMINI_ADAPTER Adapter)
|
|||
BeceemEEPROMBulkWrite(Adapter, (PUCHAR)&ulReg, 0x140, 4, TRUE);
|
||||
|
||||
/* Program TX EP as interrupt(Alternate Setting) */
|
||||
ret = rdmalt(Adapter, 0x0F0110F8, (u32 *)&ulReg, sizeof(u32));
|
||||
if (ret) {
|
||||
bytes = rdmalt(Adapter, 0x0F0110F8, (u32 *)&ulReg, sizeof(u32));
|
||||
if (bytes < 0) {
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_INITEXIT, DRV_ENTRY, DBG_LVL_ALL,
|
||||
"reading of Tx EP failed\n");
|
||||
return;
|
||||
|
@ -430,6 +430,7 @@ static int InterfaceAdapterInit(PS_INTERFACE_ADAPTER psIntfAdapter)
|
|||
int usedIntOutForBulkTransfer = 0 ;
|
||||
BOOLEAN bBcm16 = FALSE;
|
||||
UINT uiData = 0;
|
||||
int bytes;
|
||||
|
||||
/* Store the usb dev into interface adapter */
|
||||
psIntfAdapter->udev = usb_get_dev(interface_to_usbdev(psIntfAdapter->interface));
|
||||
|
@ -438,9 +439,10 @@ static int InterfaceAdapterInit(PS_INTERFACE_ADAPTER psIntfAdapter)
|
|||
psIntfAdapter->psAdapter->interface_rdm = BcmRDM;
|
||||
psIntfAdapter->psAdapter->interface_wrm = BcmWRM;
|
||||
|
||||
retval = rdmalt(psIntfAdapter->psAdapter, CHIP_ID_REG,
|
||||
bytes = rdmalt(psIntfAdapter->psAdapter, CHIP_ID_REG,
|
||||
(u32 *)&(psIntfAdapter->psAdapter->chip_id), sizeof(u32));
|
||||
if (retval) {
|
||||
if (bytes < 0) {
|
||||
retval = bytes;
|
||||
BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_PRINTK, 0, 0, "CHIP ID Read Failed\n");
|
||||
return retval;
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ INT InterfaceRDM(PS_INTERFACE_ADAPTER psIntfAdapter,
|
|||
PVOID buff,
|
||||
INT len)
|
||||
{
|
||||
int retval = 0;
|
||||
int bytes;
|
||||
USHORT usRetries = 0;
|
||||
|
||||
if (psIntfAdapter == NULL) {
|
||||
|
@ -30,7 +30,7 @@ INT InterfaceRDM(PS_INTERFACE_ADAPTER psIntfAdapter,
|
|||
psIntfAdapter->psAdapter->DeviceAccess = TRUE;
|
||||
|
||||
do {
|
||||
retval = usb_control_msg(psIntfAdapter->udev,
|
||||
bytes = usb_control_msg(psIntfAdapter->udev,
|
||||
usb_rcvctrlpipe(psIntfAdapter->udev, 0),
|
||||
0x02,
|
||||
0xC2,
|
||||
|
@ -41,22 +41,20 @@ INT InterfaceRDM(PS_INTERFACE_ADAPTER psIntfAdapter,
|
|||
5000);
|
||||
|
||||
usRetries++;
|
||||
if (-ENODEV == retval) {
|
||||
if (-ENODEV == bytes) {
|
||||
psIntfAdapter->psAdapter->device_removed = TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
} while ((retval < 0) && (usRetries < MAX_RDM_WRM_RETIRES));
|
||||
} while ((bytes < 0) && (usRetries < MAX_RDM_WRM_RETIRES));
|
||||
|
||||
if (retval < 0) {
|
||||
BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, RDM, DBG_LVL_ALL, "RDM failed status :%d, retires :%d", retval, usRetries);
|
||||
psIntfAdapter->psAdapter->DeviceAccess = FALSE;
|
||||
return retval;
|
||||
} else {
|
||||
BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, RDM, DBG_LVL_ALL, "RDM sent %d", retval);
|
||||
psIntfAdapter->psAdapter->DeviceAccess = FALSE;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
if (bytes < 0)
|
||||
BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, RDM, DBG_LVL_ALL, "RDM failed status :%d, retires :%d", bytes, usRetries);
|
||||
else
|
||||
BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, RDM, DBG_LVL_ALL, "RDM sent %d", bytes);
|
||||
|
||||
psIntfAdapter->psAdapter->DeviceAccess = FALSE;
|
||||
return bytes;
|
||||
}
|
||||
|
||||
INT InterfaceWRM(PS_INTERFACE_ADAPTER psIntfAdapter,
|
||||
|
|
|
@ -814,6 +814,7 @@ int reset_card_proc(PMINI_ADAPTER ps_adapter)
|
|||
PMINI_ADAPTER Adapter = GET_BCM_ADAPTER(gblpnetdev);
|
||||
PS_INTERFACE_ADAPTER psIntfAdapter = NULL;
|
||||
unsigned int value = 0, uiResetValue = 0;
|
||||
int bytes;
|
||||
|
||||
psIntfAdapter = ((PS_INTERFACE_ADAPTER)(ps_adapter->pvInterfaceAdapter));
|
||||
ps_adapter->bDDRInitDone = FALSE;
|
||||
|
@ -848,8 +849,9 @@ int reset_card_proc(PMINI_ADAPTER ps_adapter)
|
|||
ps_adapter->chip_id == BCS250_BC ||
|
||||
ps_adapter->chip_id == BCS220_3) {
|
||||
|
||||
retval = rdmalt(ps_adapter, HPM_CONFIG_LDO145, &value, sizeof(value));
|
||||
if (retval < 0) {
|
||||
bytes = rdmalt(ps_adapter, HPM_CONFIG_LDO145, &value, sizeof(value));
|
||||
if (bytes < 0) {
|
||||
retval = bytes;
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "read failed with status :%d", retval);
|
||||
goto err_exit;
|
||||
}
|
||||
|
@ -862,8 +864,9 @@ int reset_card_proc(PMINI_ADAPTER ps_adapter)
|
|||
}
|
||||
}
|
||||
} else {
|
||||
retval = rdmalt(ps_adapter, 0x0f007018, &value, sizeof(value));
|
||||
if (retval < 0) {
|
||||
bytes = rdmalt(ps_adapter, 0x0f007018, &value, sizeof(value));
|
||||
if (bytes < 0) {
|
||||
retval = bytes;
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "read failed with status :%d", retval);
|
||||
goto err_exit;
|
||||
}
|
||||
|
@ -925,11 +928,16 @@ int reset_card_proc(PMINI_ADAPTER ps_adapter)
|
|||
|
||||
int run_card_proc(PMINI_ADAPTER ps_adapter)
|
||||
{
|
||||
int status = STATUS_SUCCESS;
|
||||
int bytes;
|
||||
|
||||
unsigned int value = 0;
|
||||
{
|
||||
if (rdmalt(ps_adapter, CLOCK_RESET_CNTRL_REG_1, &value, sizeof(value)) < 0) {
|
||||
bytes = rdmalt(ps_adapter, CLOCK_RESET_CNTRL_REG_1, &value, sizeof(value));
|
||||
if (bytes < 0) {
|
||||
status = bytes;
|
||||
BCM_DEBUG_PRINT(ps_adapter, DBG_TYPE_INITEXIT, MP_INIT, DBG_LVL_ALL, "%s:%d\n", __func__, __LINE__);
|
||||
return STATUS_FAILURE;
|
||||
return status;
|
||||
}
|
||||
|
||||
if (ps_adapter->bFlashBoot)
|
||||
|
@ -942,7 +950,7 @@ int run_card_proc(PMINI_ADAPTER ps_adapter)
|
|||
return STATUS_FAILURE;
|
||||
}
|
||||
}
|
||||
return STATUS_SUCCESS;
|
||||
return status;
|
||||
}
|
||||
|
||||
int InitCardAndDownloadFirmware(PMINI_ADAPTER ps_adapter)
|
||||
|
@ -1215,6 +1223,7 @@ static unsigned char *ReadMacAddrEEPROM(PMINI_ADAPTER Adapter, ulong dwAddress)
|
|||
int status = 0, i = 0;
|
||||
unsigned int temp = 0;
|
||||
unsigned char *pucmacaddr = kmalloc(MAC_ADDRESS_SIZE, GFP_KERNEL);
|
||||
int bytes;
|
||||
|
||||
if (!pucmacaddr) {
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "No Buffers to Read the EEPROM Address\n");
|
||||
|
@ -1231,8 +1240,9 @@ static unsigned char *ReadMacAddrEEPROM(PMINI_ADAPTER Adapter, ulong dwAddress)
|
|||
}
|
||||
|
||||
for (i = 0; i < MAC_ADDRESS_SIZE; i++) {
|
||||
status = rdmalt(Adapter, EEPROM_READ_DATA_Q_REG, &temp, sizeof(temp));
|
||||
if (status != STATUS_SUCCESS) {
|
||||
bytes = rdmalt(Adapter, EEPROM_READ_DATA_Q_REG, &temp, sizeof(temp));
|
||||
if (bytes < 0) {
|
||||
status = bytes;
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "rdm Failed..\n");
|
||||
kfree(pucmacaddr);
|
||||
pucmacaddr = NULL;
|
||||
|
@ -1574,11 +1584,13 @@ void update_per_sf_desc_cnts(PMINI_ADAPTER Adapter)
|
|||
{
|
||||
INT iIndex = 0;
|
||||
u32 uibuff[MAX_TARGET_DSX_BUFFERS];
|
||||
int bytes;
|
||||
|
||||
if (!atomic_read(&Adapter->uiMBupdate))
|
||||
return;
|
||||
|
||||
if (rdmaltWithLock(Adapter, TARGET_SFID_TXDESC_MAP_LOC, (PUINT)uibuff, sizeof(UINT) * MAX_TARGET_DSX_BUFFERS) < 0) {
|
||||
bytes = rdmaltWithLock(Adapter, TARGET_SFID_TXDESC_MAP_LOC, (PUINT)uibuff, sizeof(UINT) * MAX_TARGET_DSX_BUFFERS);
|
||||
if (bytes < 0) {
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "rdm failed\n");
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
/*
|
||||
* File Name: hostmibs.c
|
||||
*
|
||||
|
@ -6,73 +5,72 @@
|
|||
*
|
||||
* Abstract: This file contains the routines to copy the statistics used by
|
||||
* the driver to the Host MIBS structure and giving the same to Application.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "headers.h"
|
||||
|
||||
INT ProcessGetHostMibs(PMINI_ADAPTER Adapter, S_MIBS_HOST_STATS_MIBS *pstHostMibs)
|
||||
INT ProcessGetHostMibs(PMINI_ADAPTER Adapter, S_MIBS_HOST_STATS_MIBS *pstHostMibs)
|
||||
{
|
||||
S_SERVICEFLOW_ENTRY *pstServiceFlowEntry = NULL;
|
||||
S_PHS_RULE *pstPhsRule = NULL;
|
||||
S_CLASSIFIER_TABLE *pstClassifierTable = NULL;
|
||||
S_CLASSIFIER_ENTRY *pstClassifierRule = NULL;
|
||||
PPHS_DEVICE_EXTENSION pDeviceExtension = (PPHS_DEVICE_EXTENSION)&Adapter->stBCMPhsContext;
|
||||
S_SERVICEFLOW_ENTRY *pstServiceFlowEntry = NULL;
|
||||
S_PHS_RULE *pstPhsRule = NULL;
|
||||
S_CLASSIFIER_TABLE *pstClassifierTable = NULL;
|
||||
S_CLASSIFIER_ENTRY *pstClassifierRule = NULL;
|
||||
PPHS_DEVICE_EXTENSION pDeviceExtension = (PPHS_DEVICE_EXTENSION) &Adapter->stBCMPhsContext;
|
||||
|
||||
UINT nClassifierIndex = 0, nPhsTableIndex = 0,nSfIndex = 0, uiIndex = 0;
|
||||
UINT nClassifierIndex = 0, nPhsTableIndex = 0, nSfIndex = 0, uiIndex = 0;
|
||||
|
||||
if(pDeviceExtension == NULL)
|
||||
{
|
||||
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, HOST_MIBS, DBG_LVL_ALL, "Invalid Device Extension\n");
|
||||
if (pDeviceExtension == NULL) {
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, HOST_MIBS, DBG_LVL_ALL, "Invalid Device Extension\n");
|
||||
return STATUS_FAILURE;
|
||||
}
|
||||
|
||||
//Copy the classifier Table
|
||||
for(nClassifierIndex=0; nClassifierIndex < MAX_CLASSIFIERS;
|
||||
nClassifierIndex++)
|
||||
{
|
||||
if(Adapter->astClassifierTable[nClassifierIndex].bUsed == TRUE)
|
||||
memcpy((PVOID)&pstHostMibs->astClassifierTable[nClassifierIndex],
|
||||
(PVOID)&Adapter->astClassifierTable[nClassifierIndex],
|
||||
sizeof(S_MIBS_CLASSIFIER_RULE));
|
||||
/* Copy the classifier Table */
|
||||
for (nClassifierIndex = 0; nClassifierIndex < MAX_CLASSIFIERS; nClassifierIndex++) {
|
||||
if (Adapter->astClassifierTable[nClassifierIndex].bUsed == TRUE)
|
||||
memcpy((PVOID) & pstHostMibs->
|
||||
astClassifierTable[nClassifierIndex],
|
||||
(PVOID) & Adapter->
|
||||
astClassifierTable[nClassifierIndex],
|
||||
sizeof(S_MIBS_CLASSIFIER_RULE));
|
||||
}
|
||||
|
||||
//Copy the SF Table
|
||||
for(nSfIndex=0; nSfIndex < NO_OF_QUEUES ; nSfIndex++)
|
||||
{
|
||||
if(Adapter->PackInfo[nSfIndex].bValid)
|
||||
{
|
||||
memcpy((PVOID)&pstHostMibs->astSFtable[nSfIndex],(PVOID)&Adapter->PackInfo[nSfIndex],sizeof(S_MIBS_SERVICEFLOW_TABLE));
|
||||
}
|
||||
else
|
||||
{
|
||||
//if index in not valid, don't process this for the PHS table. Go For the next entry.
|
||||
continue ;
|
||||
}
|
||||
|
||||
//Retrieve the SFID Entry Index for requested Service Flow
|
||||
if(PHS_INVALID_TABLE_INDEX == GetServiceFlowEntry(pDeviceExtension->pstServiceFlowPhsRulesTable,
|
||||
Adapter->PackInfo[nSfIndex].usVCID_Value ,&pstServiceFlowEntry))
|
||||
{
|
||||
|
||||
continue;
|
||||
/* Copy the SF Table */
|
||||
for (nSfIndex = 0; nSfIndex < NO_OF_QUEUES; nSfIndex++) {
|
||||
if (Adapter->PackInfo[nSfIndex].bValid) {
|
||||
memcpy((PVOID) & pstHostMibs->astSFtable[nSfIndex],
|
||||
(PVOID) & Adapter->PackInfo[nSfIndex],
|
||||
sizeof(S_MIBS_SERVICEFLOW_TABLE));
|
||||
} else {
|
||||
/* If index in not valid,
|
||||
* don't process this for the PHS table.
|
||||
* Go For the next entry.
|
||||
*/
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Retrieve the SFID Entry Index for requested Service Flow */
|
||||
if (PHS_INVALID_TABLE_INDEX ==
|
||||
GetServiceFlowEntry(pDeviceExtension->
|
||||
pstServiceFlowPhsRulesTable,
|
||||
Adapter->PackInfo[nSfIndex].
|
||||
usVCID_Value, &pstServiceFlowEntry))
|
||||
|
||||
continue;
|
||||
|
||||
pstClassifierTable = pstServiceFlowEntry->pstClassifierTable;
|
||||
|
||||
|
||||
for(uiIndex = 0; uiIndex < MAX_PHSRULE_PER_SF; uiIndex++)
|
||||
{
|
||||
for (uiIndex = 0; uiIndex < MAX_PHSRULE_PER_SF; uiIndex++) {
|
||||
pstClassifierRule = &pstClassifierTable->stActivePhsRulesList[uiIndex];
|
||||
|
||||
if(pstClassifierRule->bUsed)
|
||||
{
|
||||
pstPhsRule = pstClassifierRule->pstPhsRule;
|
||||
if (pstClassifierRule->bUsed) {
|
||||
pstPhsRule = pstClassifierRule->pstPhsRule;
|
||||
|
||||
pstHostMibs->astPhsRulesTable[nPhsTableIndex].ulSFID = Adapter->PackInfo[nSfIndex].ulSFID;
|
||||
pstHostMibs->astPhsRulesTable[nPhsTableIndex].
|
||||
ulSFID = Adapter->PackInfo[nSfIndex].ulSFID;
|
||||
|
||||
memcpy(&pstHostMibs->astPhsRulesTable[nPhsTableIndex].u8PHSI,
|
||||
&pstPhsRule->u8PHSI,
|
||||
sizeof(S_PHS_RULE));
|
||||
memcpy(&pstHostMibs->
|
||||
astPhsRulesTable[nPhsTableIndex].u8PHSI,
|
||||
&pstPhsRule->u8PHSI, sizeof(S_PHS_RULE));
|
||||
nPhsTableIndex++;
|
||||
|
||||
}
|
||||
|
@ -81,65 +79,63 @@ INT ProcessGetHostMibs(PMINI_ADAPTER Adapter, S_MIBS_HOST_STATS_MIBS *pstHostMi
|
|||
|
||||
}
|
||||
|
||||
|
||||
//copy other Host Statistics parameters
|
||||
/* Copy other Host Statistics parameters */
|
||||
pstHostMibs->stHostInfo.GoodTransmits = Adapter->dev->stats.tx_packets;
|
||||
pstHostMibs->stHostInfo.GoodReceives = Adapter->dev->stats.rx_packets;
|
||||
pstHostMibs->stHostInfo.CurrNumFreeDesc =
|
||||
atomic_read(&Adapter->CurrNumFreeTxDesc);
|
||||
pstHostMibs->stHostInfo.CurrNumFreeDesc = atomic_read(&Adapter->CurrNumFreeTxDesc);
|
||||
pstHostMibs->stHostInfo.BEBucketSize = Adapter->BEBucketSize;
|
||||
pstHostMibs->stHostInfo.rtPSBucketSize = Adapter->rtPSBucketSize;
|
||||
pstHostMibs->stHostInfo.TimerActive = Adapter->TimerActive;
|
||||
pstHostMibs->stHostInfo.u32TotalDSD = Adapter->u32TotalDSD;
|
||||
|
||||
memcpy(pstHostMibs->stHostInfo.aTxPktSizeHist,Adapter->aTxPktSizeHist,sizeof(UINT32)*MIBS_MAX_HIST_ENTRIES);
|
||||
memcpy(pstHostMibs->stHostInfo.aRxPktSizeHist,Adapter->aRxPktSizeHist,sizeof(UINT32)*MIBS_MAX_HIST_ENTRIES);
|
||||
memcpy(pstHostMibs->stHostInfo.aTxPktSizeHist, Adapter->aTxPktSizeHist, sizeof(UINT32) * MIBS_MAX_HIST_ENTRIES);
|
||||
memcpy(pstHostMibs->stHostInfo.aRxPktSizeHist, Adapter->aRxPktSizeHist, sizeof(UINT32) * MIBS_MAX_HIST_ENTRIES);
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
VOID GetDroppedAppCntrlPktMibs(S_MIBS_HOST_STATS_MIBS *pstHostMibs, const PPER_TARANG_DATA pTarang)
|
||||
{
|
||||
memcpy(&(pstHostMibs->stDroppedAppCntrlMsgs),
|
||||
&(pTarang->stDroppedAppCntrlMsgs),sizeof(S_MIBS_DROPPED_APP_CNTRL_MESSAGES));
|
||||
&(pTarang->stDroppedAppCntrlMsgs),
|
||||
sizeof(S_MIBS_DROPPED_APP_CNTRL_MESSAGES));
|
||||
}
|
||||
|
||||
|
||||
VOID CopyMIBSExtendedSFParameters(PMINI_ADAPTER Adapter,
|
||||
CServiceFlowParamSI *psfLocalSet, UINT uiSearchRuleIndex)
|
||||
VOID CopyMIBSExtendedSFParameters(PMINI_ADAPTER Adapter, CServiceFlowParamSI *psfLocalSet, UINT uiSearchRuleIndex)
|
||||
{
|
||||
Adapter->PackInfo[uiSearchRuleIndex].stMibsExtServiceFlowTable.wmanIfSfid = psfLocalSet->u32SFID;
|
||||
Adapter->PackInfo[uiSearchRuleIndex].stMibsExtServiceFlowTable.wmanIfCmnCpsMaxSustainedRate = psfLocalSet->u32MaxSustainedTrafficRate;
|
||||
Adapter->PackInfo[uiSearchRuleIndex].stMibsExtServiceFlowTable.wmanIfCmnCpsMaxTrafficBurst = psfLocalSet->u32MaxTrafficBurst;
|
||||
Adapter->PackInfo[uiSearchRuleIndex].stMibsExtServiceFlowTable.wmanIfCmnCpsMinReservedRate = psfLocalSet->u32MinReservedTrafficRate;
|
||||
Adapter->PackInfo[uiSearchRuleIndex].stMibsExtServiceFlowTable.wmanIfCmnCpsToleratedJitter = psfLocalSet->u32ToleratedJitter;
|
||||
Adapter->PackInfo[uiSearchRuleIndex].stMibsExtServiceFlowTable.wmanIfCmnCpsMaxLatency = psfLocalSet->u32MaximumLatency;
|
||||
Adapter->PackInfo[uiSearchRuleIndex].stMibsExtServiceFlowTable.wmanIfCmnCpsFixedVsVariableSduInd = psfLocalSet->u8FixedLengthVSVariableLengthSDUIndicator;
|
||||
Adapter->PackInfo[uiSearchRuleIndex].stMibsExtServiceFlowTable.wmanIfCmnCpsFixedVsVariableSduInd = ntohl(Adapter->PackInfo[uiSearchRuleIndex].stMibsExtServiceFlowTable.wmanIfCmnCpsFixedVsVariableSduInd);
|
||||
Adapter->PackInfo[uiSearchRuleIndex].stMibsExtServiceFlowTable.wmanIfCmnCpsSduSize = psfLocalSet->u8SDUSize;
|
||||
Adapter->PackInfo[uiSearchRuleIndex].stMibsExtServiceFlowTable.wmanIfCmnCpsSduSize = ntohl(Adapter->PackInfo[uiSearchRuleIndex].stMibsExtServiceFlowTable.wmanIfCmnCpsSduSize);
|
||||
Adapter->PackInfo[uiSearchRuleIndex].stMibsExtServiceFlowTable.wmanIfCmnCpsSfSchedulingType = psfLocalSet->u8ServiceFlowSchedulingType;
|
||||
Adapter->PackInfo[uiSearchRuleIndex].stMibsExtServiceFlowTable.wmanIfCmnCpsSfSchedulingType = ntohl(Adapter->PackInfo[uiSearchRuleIndex].stMibsExtServiceFlowTable.wmanIfCmnCpsSfSchedulingType);
|
||||
Adapter->PackInfo[uiSearchRuleIndex].stMibsExtServiceFlowTable.wmanIfCmnCpsArqEnable = psfLocalSet->u8ARQEnable;
|
||||
Adapter->PackInfo[uiSearchRuleIndex].stMibsExtServiceFlowTable.wmanIfCmnCpsArqEnable = ntohl(Adapter->PackInfo[uiSearchRuleIndex].stMibsExtServiceFlowTable.wmanIfCmnCpsArqEnable);
|
||||
Adapter->PackInfo[uiSearchRuleIndex].stMibsExtServiceFlowTable.wmanIfCmnCpsArqWindowSize = ntohs(psfLocalSet->u16ARQWindowSize);
|
||||
Adapter->PackInfo[uiSearchRuleIndex].stMibsExtServiceFlowTable.wmanIfCmnCpsArqWindowSize = ntohl(Adapter->PackInfo[uiSearchRuleIndex].stMibsExtServiceFlowTable.wmanIfCmnCpsArqWindowSize);
|
||||
Adapter->PackInfo[uiSearchRuleIndex].stMibsExtServiceFlowTable.wmanIfCmnCpsArqBlockLifetime = ntohs(psfLocalSet->u16ARQBlockLifeTime);
|
||||
Adapter->PackInfo[uiSearchRuleIndex].stMibsExtServiceFlowTable.wmanIfCmnCpsArqBlockLifetime = ntohl(Adapter->PackInfo[uiSearchRuleIndex].stMibsExtServiceFlowTable.wmanIfCmnCpsArqBlockLifetime);
|
||||
Adapter->PackInfo[uiSearchRuleIndex].stMibsExtServiceFlowTable.wmanIfCmnCpsArqSyncLossTimeout = ntohs(psfLocalSet->u16ARQSyncLossTimeOut);
|
||||
Adapter->PackInfo[uiSearchRuleIndex].stMibsExtServiceFlowTable.wmanIfCmnCpsArqSyncLossTimeout = ntohl(Adapter->PackInfo[uiSearchRuleIndex].stMibsExtServiceFlowTable.wmanIfCmnCpsArqSyncLossTimeout);
|
||||
Adapter->PackInfo[uiSearchRuleIndex].stMibsExtServiceFlowTable.wmanIfCmnCpsArqDeliverInOrder = psfLocalSet->u8ARQDeliverInOrder;
|
||||
Adapter->PackInfo[uiSearchRuleIndex].stMibsExtServiceFlowTable.wmanIfCmnCpsArqDeliverInOrder = ntohl(Adapter->PackInfo[uiSearchRuleIndex].stMibsExtServiceFlowTable.wmanIfCmnCpsArqDeliverInOrder);
|
||||
Adapter->PackInfo[uiSearchRuleIndex].stMibsExtServiceFlowTable.wmanIfCmnCpsArqRxPurgeTimeout = ntohs(psfLocalSet->u16ARQRxPurgeTimeOut);
|
||||
Adapter->PackInfo[uiSearchRuleIndex].stMibsExtServiceFlowTable.wmanIfCmnCpsArqRxPurgeTimeout = ntohl(Adapter->PackInfo[uiSearchRuleIndex].stMibsExtServiceFlowTable.wmanIfCmnCpsArqRxPurgeTimeout);
|
||||
Adapter->PackInfo[uiSearchRuleIndex].stMibsExtServiceFlowTable.wmanIfCmnCpsArqBlockSize = ntohs(psfLocalSet->u16ARQBlockSize);
|
||||
Adapter->PackInfo[uiSearchRuleIndex].stMibsExtServiceFlowTable.wmanIfCmnCpsArqBlockSize = ntohl(Adapter->PackInfo[uiSearchRuleIndex].stMibsExtServiceFlowTable.wmanIfCmnCpsArqBlockSize);
|
||||
Adapter->PackInfo[uiSearchRuleIndex].stMibsExtServiceFlowTable.wmanIfCmnCpsReqTxPolicy = psfLocalSet->u8RequesttransmissionPolicy;
|
||||
Adapter->PackInfo[uiSearchRuleIndex].stMibsExtServiceFlowTable.wmanIfCmnCpsReqTxPolicy = ntohl(Adapter->PackInfo[uiSearchRuleIndex].stMibsExtServiceFlowTable.wmanIfCmnCpsReqTxPolicy);
|
||||
Adapter->PackInfo[uiSearchRuleIndex].stMibsExtServiceFlowTable.wmanIfCmnSfCsSpecification = psfLocalSet->u8CSSpecification;
|
||||
Adapter->PackInfo[uiSearchRuleIndex].stMibsExtServiceFlowTable.wmanIfCmnSfCsSpecification = ntohl(Adapter->PackInfo[uiSearchRuleIndex].stMibsExtServiceFlowTable.wmanIfCmnSfCsSpecification);
|
||||
Adapter->PackInfo[uiSearchRuleIndex].stMibsExtServiceFlowTable.wmanIfCmnCpsTargetSaid = ntohs(psfLocalSet->u16TargetSAID);
|
||||
Adapter->PackInfo[uiSearchRuleIndex].stMibsExtServiceFlowTable.wmanIfCmnCpsTargetSaid = ntohl(Adapter->PackInfo[uiSearchRuleIndex].stMibsExtServiceFlowTable.wmanIfCmnCpsTargetSaid);
|
||||
S_MIBS_EXTSERVICEFLOW_PARAMETERS *t = &Adapter->PackInfo[uiSearchRuleIndex].stMibsExtServiceFlowTable;
|
||||
|
||||
t->wmanIfSfid = psfLocalSet->u32SFID;
|
||||
t->wmanIfCmnCpsMaxSustainedRate = psfLocalSet->u32MaxSustainedTrafficRate;
|
||||
t->wmanIfCmnCpsMaxTrafficBurst = psfLocalSet->u32MaxTrafficBurst;
|
||||
t->wmanIfCmnCpsMinReservedRate = psfLocalSet->u32MinReservedTrafficRate;
|
||||
t->wmanIfCmnCpsToleratedJitter = psfLocalSet->u32ToleratedJitter;
|
||||
t->wmanIfCmnCpsMaxLatency = psfLocalSet->u32MaximumLatency;
|
||||
t->wmanIfCmnCpsFixedVsVariableSduInd = psfLocalSet->u8FixedLengthVSVariableLengthSDUIndicator;
|
||||
t->wmanIfCmnCpsFixedVsVariableSduInd = ntohl(t->wmanIfCmnCpsFixedVsVariableSduInd);
|
||||
t->wmanIfCmnCpsSduSize = psfLocalSet->u8SDUSize;
|
||||
t->wmanIfCmnCpsSduSize = ntohl(t->wmanIfCmnCpsSduSize);
|
||||
t->wmanIfCmnCpsSfSchedulingType = psfLocalSet->u8ServiceFlowSchedulingType;
|
||||
t->wmanIfCmnCpsSfSchedulingType = ntohl(t->wmanIfCmnCpsSfSchedulingType);
|
||||
t->wmanIfCmnCpsArqEnable = psfLocalSet->u8ARQEnable;
|
||||
t->wmanIfCmnCpsArqEnable = ntohl(t->wmanIfCmnCpsArqEnable);
|
||||
t->wmanIfCmnCpsArqWindowSize = ntohs(psfLocalSet->u16ARQWindowSize);
|
||||
t->wmanIfCmnCpsArqWindowSize = ntohl(t->wmanIfCmnCpsArqWindowSize);
|
||||
t->wmanIfCmnCpsArqBlockLifetime = ntohs(psfLocalSet->u16ARQBlockLifeTime);
|
||||
t->wmanIfCmnCpsArqBlockLifetime = ntohl(t->wmanIfCmnCpsArqBlockLifetime);
|
||||
t->wmanIfCmnCpsArqSyncLossTimeout = ntohs(psfLocalSet->u16ARQSyncLossTimeOut);
|
||||
t->wmanIfCmnCpsArqSyncLossTimeout = ntohl(t->wmanIfCmnCpsArqSyncLossTimeout);
|
||||
t->wmanIfCmnCpsArqDeliverInOrder = psfLocalSet->u8ARQDeliverInOrder;
|
||||
t->wmanIfCmnCpsArqDeliverInOrder = ntohl(t->wmanIfCmnCpsArqDeliverInOrder);
|
||||
t->wmanIfCmnCpsArqRxPurgeTimeout = ntohs(psfLocalSet->u16ARQRxPurgeTimeOut);
|
||||
t->wmanIfCmnCpsArqRxPurgeTimeout = ntohl(t->wmanIfCmnCpsArqRxPurgeTimeout);
|
||||
t->wmanIfCmnCpsArqBlockSize = ntohs(psfLocalSet->u16ARQBlockSize);
|
||||
t->wmanIfCmnCpsArqBlockSize = ntohl(t->wmanIfCmnCpsArqBlockSize);
|
||||
t->wmanIfCmnCpsReqTxPolicy = psfLocalSet->u8RequesttransmissionPolicy;
|
||||
t->wmanIfCmnCpsReqTxPolicy = ntohl(t->wmanIfCmnCpsReqTxPolicy);
|
||||
t->wmanIfCmnSfCsSpecification = psfLocalSet->u8CSSpecification;
|
||||
t->wmanIfCmnSfCsSpecification = ntohl(t->wmanIfCmnSfCsSpecification);
|
||||
t->wmanIfCmnCpsTargetSaid = ntohs(psfLocalSet->u16TargetSAID);
|
||||
t->wmanIfCmnCpsTargetSaid = ntohl(t->wmanIfCmnCpsTargetSaid);
|
||||
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -78,7 +78,7 @@ static UCHAR ReadEEPROMStatusRegister( PMINI_ADAPTER Adapter )
|
|||
{
|
||||
value=0;
|
||||
uiStatus = 0 ;
|
||||
rdmalt( Adapter, EEPROM_SPI_Q_STATUS1_REG,&uiStatus, sizeof(uiStatus));
|
||||
rdmalt(Adapter, EEPROM_SPI_Q_STATUS1_REG, &uiStatus, sizeof(uiStatus));
|
||||
if(Adapter->device_removed == TRUE)
|
||||
{
|
||||
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0,"Modem has got removed hence exiting....");
|
||||
|
@ -93,7 +93,7 @@ static UCHAR ReadEEPROMStatusRegister( PMINI_ADAPTER Adapter )
|
|||
wrmalt( Adapter, EEPROM_SPI_Q_STATUS1_REG, &value, sizeof(value));
|
||||
|
||||
value =0;
|
||||
rdmalt(Adapter, EEPROM_READ_DATAQ_REG,&value, sizeof(value));
|
||||
rdmalt(Adapter, EEPROM_READ_DATAQ_REG, &value, sizeof(value));
|
||||
uiData = (UCHAR)value;
|
||||
|
||||
break;
|
||||
|
@ -102,8 +102,8 @@ static UCHAR ReadEEPROMStatusRegister( PMINI_ADAPTER Adapter )
|
|||
dwRetries-- ;
|
||||
if ( dwRetries == 0 )
|
||||
{
|
||||
rdmalt(Adapter, EEPROM_SPI_Q_STATUS1_REG,&value, sizeof(value));
|
||||
rdmalt(Adapter, EEPROM_SPI_Q_STATUS_REG,&value1, sizeof(value1));
|
||||
rdmalt(Adapter, EEPROM_SPI_Q_STATUS1_REG, &value, sizeof(value));
|
||||
rdmalt(Adapter, EEPROM_SPI_Q_STATUS_REG, &value1, sizeof(value1));
|
||||
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0,"0x3004 = %x 0x3008 = %x, retries = %d failed.\n",value,value1, MAX_EEPROM_RETRIES*RETRIES_PER_DELAY);
|
||||
return uiData;
|
||||
}
|
||||
|
@ -158,7 +158,7 @@ INT ReadBeceemEEPROMBulk( PMINI_ADAPTER Adapter,
|
|||
{
|
||||
|
||||
uiStatus = 0;
|
||||
rdmalt( Adapter, EEPROM_SPI_Q_STATUS1_REG, &uiStatus, sizeof(uiStatus));
|
||||
rdmalt(Adapter, EEPROM_SPI_Q_STATUS1_REG, &uiStatus, sizeof(uiStatus));
|
||||
if(Adapter->device_removed == TRUE)
|
||||
{
|
||||
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0,"Modem has got Removed.hence exiting from loop...");
|
||||
|
@ -202,8 +202,8 @@ INT ReadBeceemEEPROMBulk( PMINI_ADAPTER Adapter,
|
|||
{
|
||||
value=0;
|
||||
value1=0;
|
||||
rdmalt(Adapter, EEPROM_SPI_Q_STATUS1_REG,&value, sizeof(value));
|
||||
rdmalt(Adapter, EEPROM_SPI_Q_STATUS_REG,&value1, sizeof(value1));
|
||||
rdmalt(Adapter, EEPROM_SPI_Q_STATUS1_REG, &value, sizeof(value));
|
||||
rdmalt(Adapter, EEPROM_SPI_Q_STATUS_REG, &value1, sizeof(value1));
|
||||
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "dwNumWords %d 0x3004 = %x 0x3008 = %x retries = %d failed.\n", dwNumWords, value, value1, MAX_EEPROM_RETRIES*RETRIES_PER_DELAY);
|
||||
return STATUS_FAILURE;
|
||||
}
|
||||
|
@ -217,22 +217,22 @@ INT ReadBeceemEEPROMBulk( PMINI_ADAPTER Adapter,
|
|||
pvalue = (PUCHAR)(pdwData + dwIndex);
|
||||
|
||||
value =0;
|
||||
rdmalt(Adapter, EEPROM_READ_DATAQ_REG,&value, sizeof(value));
|
||||
rdmalt(Adapter, EEPROM_READ_DATAQ_REG, &value, sizeof(value));
|
||||
|
||||
pvalue[0] = value;
|
||||
|
||||
value = 0;
|
||||
rdmalt(Adapter, EEPROM_READ_DATAQ_REG,&value, sizeof(value));
|
||||
rdmalt(Adapter, EEPROM_READ_DATAQ_REG, &value, sizeof(value));
|
||||
|
||||
pvalue[1] = value;
|
||||
|
||||
value =0;
|
||||
rdmalt(Adapter, EEPROM_READ_DATAQ_REG,&value, sizeof(value));
|
||||
rdmalt(Adapter, EEPROM_READ_DATAQ_REG, &value, sizeof(value));
|
||||
|
||||
pvalue[2] = value;
|
||||
|
||||
value = 0;
|
||||
rdmalt(Adapter, EEPROM_READ_DATAQ_REG,&value, sizeof(value));
|
||||
rdmalt(Adapter, EEPROM_READ_DATAQ_REG, &value, sizeof(value));
|
||||
|
||||
pvalue[3] = value;
|
||||
}
|
||||
|
@ -445,6 +445,7 @@ static INT BeceemFlashBulkRead(
|
|||
UINT uiBytesToRead = uiNumBytes;
|
||||
INT Status = 0;
|
||||
UINT uiPartOffset = 0;
|
||||
int bytes;
|
||||
|
||||
if(Adapter->device_removed )
|
||||
{
|
||||
|
@ -469,9 +470,9 @@ static INT BeceemFlashBulkRead(
|
|||
uiBytesToRead = MAX_RW_SIZE - (uiOffset%MAX_RW_SIZE);
|
||||
uiBytesToRead = MIN(uiNumBytes,uiBytesToRead);
|
||||
|
||||
if(rdm(Adapter,uiPartOffset, (PCHAR)pBuffer+uiIndex,uiBytesToRead))
|
||||
{
|
||||
Status = -1;
|
||||
bytes = rdm(Adapter, uiPartOffset, (PCHAR)pBuffer+uiIndex, uiBytesToRead);
|
||||
if (bytes < 0) {
|
||||
Status = bytes;
|
||||
Adapter->SelectedChip = RESET_CHIP_SELECT;
|
||||
return Status;
|
||||
}
|
||||
|
@ -488,9 +489,9 @@ static INT BeceemFlashBulkRead(
|
|||
|
||||
uiBytesToRead = MIN(uiNumBytes,MAX_RW_SIZE);
|
||||
|
||||
if(rdm(Adapter,uiPartOffset, (PCHAR)pBuffer+uiIndex,uiBytesToRead))
|
||||
{
|
||||
Status = -1;
|
||||
bytes = rdm(Adapter, uiPartOffset, (PCHAR)pBuffer+uiIndex, uiBytesToRead);
|
||||
if (bytes < 0) {
|
||||
Status = bytes;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -613,6 +614,7 @@ static INT FlashSectorErase(PMINI_ADAPTER Adapter,
|
|||
UINT iIndex = 0, iRetries = 0;
|
||||
UINT uiStatus = 0;
|
||||
UINT value;
|
||||
int bytes;
|
||||
|
||||
for(iIndex=0;iIndex<numOfSectors;iIndex++)
|
||||
{
|
||||
|
@ -632,10 +634,11 @@ static INT FlashSectorErase(PMINI_ADAPTER Adapter,
|
|||
return STATUS_FAILURE;
|
||||
}
|
||||
|
||||
if(rdmalt(Adapter, FLASH_SPI_READQ_REG, &uiStatus, sizeof(uiStatus)) < 0 )
|
||||
{
|
||||
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0,"Reading status of FLASH_SPI_READQ_REG fails");
|
||||
return STATUS_FAILURE;
|
||||
bytes = rdmalt(Adapter, FLASH_SPI_READQ_REG, &uiStatus, sizeof(uiStatus));
|
||||
if (bytes < 0) {
|
||||
uiStatus = bytes;
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Reading status of FLASH_SPI_READQ_REG fails");
|
||||
return uiStatus;
|
||||
}
|
||||
iRetries++;
|
||||
//After every try lets make the CPU free for 10 ms. generally time taken by the
|
||||
|
@ -679,6 +682,7 @@ static INT flashByteWrite(
|
|||
|
||||
UINT value;
|
||||
ULONG ulData = *(PUCHAR)pData;
|
||||
int bytes;
|
||||
|
||||
//
|
||||
// need not write 0xFF because write requires an erase and erase will
|
||||
|
@ -720,10 +724,11 @@ static INT flashByteWrite(
|
|||
return STATUS_FAILURE;
|
||||
}
|
||||
//__udelay(1);
|
||||
if(rdmalt(Adapter, FLASH_SPI_READQ_REG, &uiStatus, sizeof(uiStatus)) < 0)
|
||||
{
|
||||
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0,"Reading status of FLASH_SPI_READQ_REG fails");
|
||||
return STATUS_FAILURE;
|
||||
bytes = rdmalt(Adapter, FLASH_SPI_READQ_REG, &uiStatus, sizeof(uiStatus));
|
||||
if (bytes < 0) {
|
||||
uiStatus = bytes;
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Reading status of FLASH_SPI_READQ_REG fails");
|
||||
return uiStatus;
|
||||
}
|
||||
iRetries--;
|
||||
if( iRetries && ((iRetries % FLASH_PER_RETRIES_DELAY) == 0))
|
||||
|
@ -771,6 +776,7 @@ static INT flashWrite(
|
|||
|
||||
UINT value;
|
||||
UINT uiErasePattern[4] = {0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF};
|
||||
int bytes;
|
||||
//
|
||||
// need not write 0xFFFFFFFF because write requires an erase and erase will
|
||||
// make whole sector 0xFFFFFFFF.
|
||||
|
@ -803,10 +809,11 @@ static INT flashWrite(
|
|||
return STATUS_FAILURE;
|
||||
}
|
||||
//__udelay(1);
|
||||
if(rdmalt(Adapter, FLASH_SPI_READQ_REG, &uiStatus, sizeof(uiStatus)) < 0 )
|
||||
{
|
||||
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0,"Reading status of FLASH_SPI_READQ_REG fails");
|
||||
return STATUS_FAILURE;
|
||||
bytes = rdmalt(Adapter, FLASH_SPI_READQ_REG, &uiStatus, sizeof(uiStatus));
|
||||
if (bytes < 0) {
|
||||
uiStatus = bytes;
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Reading status of FLASH_SPI_READQ_REG fails");
|
||||
return uiStatus;
|
||||
}
|
||||
|
||||
iRetries--;
|
||||
|
@ -849,6 +856,7 @@ static INT flashByteWriteStatus(
|
|||
INT iRetries = MAX_FLASH_RETRIES * FLASH_PER_RETRIES_DELAY; //3
|
||||
ULONG ulData = *(PUCHAR)pData;
|
||||
UINT value;
|
||||
int bytes;
|
||||
|
||||
//
|
||||
// need not write 0xFFFFFFFF because write requires an erase and erase will
|
||||
|
@ -891,10 +899,11 @@ static INT flashByteWriteStatus(
|
|||
return STATUS_FAILURE;
|
||||
}
|
||||
//__udelay(1);
|
||||
if(rdmalt(Adapter, FLASH_SPI_READQ_REG, &uiStatus, sizeof(uiStatus)) < 0)
|
||||
{
|
||||
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0,"Reading status of FLASH_SPI_READQ_REG fails");
|
||||
return STATUS_FAILURE;
|
||||
bytes = rdmalt(Adapter, FLASH_SPI_READQ_REG, &uiStatus, sizeof(uiStatus));
|
||||
if (bytes < 0) {
|
||||
uiStatus = bytes;
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Reading status of FLASH_SPI_READQ_REG fails");
|
||||
return uiStatus;
|
||||
}
|
||||
|
||||
iRetries--;
|
||||
|
@ -935,6 +944,7 @@ static INT flashWriteStatus(
|
|||
//UINT uiReadBack = 0;
|
||||
UINT value;
|
||||
UINT uiErasePattern[4] = {0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF};
|
||||
int bytes;
|
||||
|
||||
//
|
||||
// need not write 0xFFFFFFFF because write requires an erase and erase will
|
||||
|
@ -967,10 +977,11 @@ static INT flashWriteStatus(
|
|||
return STATUS_FAILURE;
|
||||
}
|
||||
//__udelay(1);
|
||||
if(rdmalt(Adapter, FLASH_SPI_READQ_REG, &uiStatus, sizeof(uiStatus)) < 0)
|
||||
{
|
||||
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0,"Reading status of FLASH_SPI_READQ_REG fails");
|
||||
return STATUS_FAILURE;
|
||||
bytes = rdmalt(Adapter, FLASH_SPI_READQ_REG, &uiStatus, sizeof(uiStatus));
|
||||
if (bytes < 0) {
|
||||
uiStatus = bytes;
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Reading status of FLASH_SPI_READQ_REG fails");
|
||||
return uiStatus;
|
||||
}
|
||||
iRetries--;
|
||||
//this will ensure that in there will be no changes in the current path.
|
||||
|
@ -1841,7 +1852,7 @@ static INT BeceemEEPROMWritePage( PMINI_ADAPTER Adapter, UINT uiData[], UINT uiO
|
|||
* What we are checking if the previous write has completed, and this
|
||||
* may take time. We should wait till the Empty bit is set. */
|
||||
uiStatus = 0;
|
||||
rdmalt( Adapter, EEPROM_SPI_Q_STATUS1_REG,&uiStatus, sizeof(uiStatus)) ;
|
||||
rdmalt(Adapter, EEPROM_SPI_Q_STATUS1_REG, &uiStatus, sizeof(uiStatus));
|
||||
while ( ( uiStatus & EEPROM_WRITE_QUEUE_EMPTY ) == 0 )
|
||||
{
|
||||
uiRetries--;
|
||||
|
@ -1855,7 +1866,7 @@ static INT BeceemEEPROMWritePage( PMINI_ADAPTER Adapter, UINT uiData[], UINT uiO
|
|||
msleep(1);
|
||||
|
||||
uiStatus = 0;
|
||||
rdmalt( Adapter, EEPROM_SPI_Q_STATUS1_REG,&uiStatus, sizeof(uiStatus)) ;
|
||||
rdmalt(Adapter, EEPROM_SPI_Q_STATUS1_REG, &uiStatus, sizeof(uiStatus));
|
||||
if(Adapter->device_removed == TRUE)
|
||||
{
|
||||
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0,"Modem got removed hence exiting from loop....");
|
||||
|
@ -2500,7 +2511,7 @@ static ULONG BcmReadFlashRDID(PMINI_ADAPTER Adapter)
|
|||
// Read SPI READQ REG. The output will be WWXXYYZZ.
|
||||
// The ID is 3Bytes long and is WWXXYY. ZZ needs to be Ignored.
|
||||
//
|
||||
rdmalt(Adapter, FLASH_SPI_READQ_REG,(PUINT)&ulRDID, sizeof(ulRDID));
|
||||
rdmalt(Adapter, FLASH_SPI_READQ_REG, (PUINT)&ulRDID, sizeof(ulRDID));
|
||||
|
||||
return (ulRDID >>8);
|
||||
|
||||
|
@ -4735,8 +4746,8 @@ static INT BcmDoChipSelect(PMINI_ADAPTER Adapter, UINT offset)
|
|||
Adapter->SelectedChip = ChipNum ;
|
||||
|
||||
//bit[13..12] will select the appropriate chip
|
||||
rdmalt(Adapter,FLASH_CONFIG_REG, &FlashConfig, 4);
|
||||
rdmalt(Adapter,FLASH_GPIO_CONFIG_REG, &GPIOConfig, 4);
|
||||
rdmalt(Adapter, FLASH_CONFIG_REG, &FlashConfig, 4);
|
||||
rdmalt(Adapter, FLASH_GPIO_CONFIG_REG, &GPIOConfig, 4);
|
||||
|
||||
{
|
||||
switch(ChipNum)
|
||||
|
|
|
@ -1479,10 +1479,10 @@ static int comedi_mmap(struct file *file, struct vm_area_struct *vma)
|
|||
|
||||
dev_file_info = comedi_get_device_file_info(minor);
|
||||
if (dev_file_info == NULL)
|
||||
return -ENODEV;
|
||||
return -ENODEV;
|
||||
dev = dev_file_info->device;
|
||||
if (dev == NULL)
|
||||
return -ENODEV;
|
||||
return -ENODEV;
|
||||
|
||||
mutex_lock(&dev->mutex);
|
||||
if (!dev->attached) {
|
||||
|
@ -1556,10 +1556,10 @@ static unsigned int comedi_poll(struct file *file, poll_table * wait)
|
|||
dev_file_info = comedi_get_device_file_info(minor);
|
||||
|
||||
if (dev_file_info == NULL)
|
||||
return -ENODEV;
|
||||
return -ENODEV;
|
||||
dev = dev_file_info->device;
|
||||
if (dev == NULL)
|
||||
return -ENODEV;
|
||||
return -ENODEV;
|
||||
|
||||
mutex_lock(&dev->mutex);
|
||||
if (!dev->attached) {
|
||||
|
@ -1610,10 +1610,10 @@ static ssize_t comedi_write(struct file *file, const char __user *buf,
|
|||
dev_file_info = comedi_get_device_file_info(minor);
|
||||
|
||||
if (dev_file_info == NULL)
|
||||
return -ENODEV;
|
||||
return -ENODEV;
|
||||
dev = dev_file_info->device;
|
||||
if (dev == NULL)
|
||||
return -ENODEV;
|
||||
return -ENODEV;
|
||||
|
||||
if (!dev->attached) {
|
||||
DPRINTK("no driver configured on comedi%i\n", dev->minor);
|
||||
|
@ -1721,10 +1721,10 @@ static ssize_t comedi_read(struct file *file, char __user *buf, size_t nbytes,
|
|||
dev_file_info = comedi_get_device_file_info(minor);
|
||||
|
||||
if (dev_file_info == NULL)
|
||||
return -ENODEV;
|
||||
return -ENODEV;
|
||||
dev = dev_file_info->device;
|
||||
if (dev == NULL)
|
||||
return -ENODEV;
|
||||
return -ENODEV;
|
||||
|
||||
if (!dev->attached) {
|
||||
DPRINTK("no driver configured on comedi%i\n", dev->minor);
|
||||
|
@ -1931,10 +1931,10 @@ static int comedi_close(struct inode *inode, struct file *file)
|
|||
dev_file_info = comedi_get_device_file_info(minor);
|
||||
|
||||
if (dev_file_info == NULL)
|
||||
return -ENODEV;
|
||||
return -ENODEV;
|
||||
dev = dev_file_info->device;
|
||||
if (dev == NULL)
|
||||
return -ENODEV;
|
||||
return -ENODEV;
|
||||
|
||||
mutex_lock(&dev->mutex);
|
||||
|
||||
|
@ -1973,10 +1973,10 @@ static int comedi_fasync(int fd, struct file *file, int on)
|
|||
dev_file_info = comedi_get_device_file_info(minor);
|
||||
|
||||
if (dev_file_info == NULL)
|
||||
return -ENODEV;
|
||||
return -ENODEV;
|
||||
dev = dev_file_info->device;
|
||||
if (dev == NULL)
|
||||
return -ENODEV;
|
||||
return -ENODEV;
|
||||
|
||||
return fasync_helper(fd, file, on, &dev->async_queue);
|
||||
}
|
||||
|
@ -2479,18 +2479,18 @@ static ssize_t store_max_read_buffer_kb(struct device *dev,
|
|||
const char *buf, size_t count)
|
||||
{
|
||||
struct comedi_device_file_info *info = dev_get_drvdata(dev);
|
||||
unsigned long new_max_size_kb;
|
||||
uint64_t new_max_size;
|
||||
unsigned int new_max_size_kb;
|
||||
unsigned int new_max_size;
|
||||
int ret;
|
||||
struct comedi_subdevice *const read_subdevice =
|
||||
comedi_get_read_subdevice(info);
|
||||
|
||||
if (strict_strtoul(buf, 10, &new_max_size_kb))
|
||||
return -EINVAL;
|
||||
if (new_max_size_kb != (uint32_t) new_max_size_kb)
|
||||
return -EINVAL;
|
||||
new_max_size = ((uint64_t) new_max_size_kb) * bytes_per_kibi;
|
||||
if (new_max_size != (uint32_t) new_max_size)
|
||||
ret = kstrtouint(buf, 10, &new_max_size_kb);
|
||||
if (ret)
|
||||
return ret;
|
||||
if (new_max_size_kb > (UINT_MAX / bytes_per_kibi))
|
||||
return -EINVAL;
|
||||
new_max_size = new_max_size_kb * bytes_per_kibi;
|
||||
|
||||
mutex_lock(&info->device->mutex);
|
||||
if (read_subdevice == NULL ||
|
||||
|
@ -2540,19 +2540,19 @@ static ssize_t store_read_buffer_kb(struct device *dev,
|
|||
const char *buf, size_t count)
|
||||
{
|
||||
struct comedi_device_file_info *info = dev_get_drvdata(dev);
|
||||
unsigned long new_size_kb;
|
||||
uint64_t new_size;
|
||||
unsigned int new_size_kb;
|
||||
unsigned int new_size;
|
||||
int retval;
|
||||
int ret;
|
||||
struct comedi_subdevice *const read_subdevice =
|
||||
comedi_get_read_subdevice(info);
|
||||
|
||||
if (strict_strtoul(buf, 10, &new_size_kb))
|
||||
return -EINVAL;
|
||||
if (new_size_kb != (uint32_t) new_size_kb)
|
||||
return -EINVAL;
|
||||
new_size = ((uint64_t) new_size_kb) * bytes_per_kibi;
|
||||
if (new_size != (uint32_t) new_size)
|
||||
ret = kstrtouint(buf, 10, &new_size_kb);
|
||||
if (ret)
|
||||
return ret;
|
||||
if (new_size_kb > (UINT_MAX / bytes_per_kibi))
|
||||
return -EINVAL;
|
||||
new_size = new_size_kb * bytes_per_kibi;
|
||||
|
||||
mutex_lock(&info->device->mutex);
|
||||
if (read_subdevice == NULL ||
|
||||
|
@ -2606,18 +2606,18 @@ static ssize_t store_max_write_buffer_kb(struct device *dev,
|
|||
const char *buf, size_t count)
|
||||
{
|
||||
struct comedi_device_file_info *info = dev_get_drvdata(dev);
|
||||
unsigned long new_max_size_kb;
|
||||
uint64_t new_max_size;
|
||||
unsigned int new_max_size_kb;
|
||||
unsigned int new_max_size;
|
||||
int ret;
|
||||
struct comedi_subdevice *const write_subdevice =
|
||||
comedi_get_write_subdevice(info);
|
||||
|
||||
if (strict_strtoul(buf, 10, &new_max_size_kb))
|
||||
return -EINVAL;
|
||||
if (new_max_size_kb != (uint32_t) new_max_size_kb)
|
||||
return -EINVAL;
|
||||
new_max_size = ((uint64_t) new_max_size_kb) * bytes_per_kibi;
|
||||
if (new_max_size != (uint32_t) new_max_size)
|
||||
ret = kstrtouint(buf, 10, &new_max_size_kb);
|
||||
if (ret)
|
||||
return ret;
|
||||
if (new_max_size_kb > (UINT_MAX / bytes_per_kibi))
|
||||
return -EINVAL;
|
||||
new_max_size = new_max_size_kb * bytes_per_kibi;
|
||||
|
||||
mutex_lock(&info->device->mutex);
|
||||
if (write_subdevice == NULL ||
|
||||
|
@ -2667,19 +2667,19 @@ static ssize_t store_write_buffer_kb(struct device *dev,
|
|||
const char *buf, size_t count)
|
||||
{
|
||||
struct comedi_device_file_info *info = dev_get_drvdata(dev);
|
||||
unsigned long new_size_kb;
|
||||
uint64_t new_size;
|
||||
unsigned int new_size_kb;
|
||||
unsigned int new_size;
|
||||
int retval;
|
||||
int ret;
|
||||
struct comedi_subdevice *const write_subdevice =
|
||||
comedi_get_write_subdevice(info);
|
||||
|
||||
if (strict_strtoul(buf, 10, &new_size_kb))
|
||||
return -EINVAL;
|
||||
if (new_size_kb != (uint32_t) new_size_kb)
|
||||
ret = kstrtouint(buf, 10, &new_size_kb);
|
||||
if (ret)
|
||||
return ret;
|
||||
if (new_size_kb > (UINT_MAX / bytes_per_kibi))
|
||||
return -EINVAL;
|
||||
new_size = ((uint64_t) new_size_kb) * bytes_per_kibi;
|
||||
if (new_size != (uint32_t) new_size)
|
||||
return -EINVAL;
|
||||
|
||||
mutex_lock(&info->device->mutex);
|
||||
if (write_subdevice == NULL ||
|
||||
|
|
|
@ -145,78 +145,77 @@ void fpu_end(void)
|
|||
|
||||
static DEFINE_PCI_DEVICE_TABLE(addi_apci_tbl) = {
|
||||
#ifdef CONFIG_APCI_3120
|
||||
{APCI3120_BOARD_VENDOR_ID, 0x818D, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
|
||||
{PCI_DEVICE(APCI3120_BOARD_VENDOR_ID, 0x818D)},
|
||||
#endif
|
||||
#ifdef CONFIG_APCI_1032
|
||||
{APCI1032_BOARD_VENDOR_ID, 0x1003, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
|
||||
{PCI_DEVICE(APCI1032_BOARD_VENDOR_ID, 0x1003)},
|
||||
#endif
|
||||
#ifdef CONFIG_APCI_1516
|
||||
{APCI1516_BOARD_VENDOR_ID, 0x1001, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
|
||||
{PCI_DEVICE(APCI1516_BOARD_VENDOR_ID, 0x1001)},
|
||||
#endif
|
||||
#ifdef CONFIG_APCI_2016
|
||||
{APCI2016_BOARD_VENDOR_ID, 0x1002, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
|
||||
{PCI_DEVICE(APCI2016_BOARD_VENDOR_ID, 0x1002)},
|
||||
#endif
|
||||
#ifdef CONFIG_APCI_2032
|
||||
{APCI2032_BOARD_VENDOR_ID, 0x1004, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
|
||||
{PCI_DEVICE(APCI2032_BOARD_VENDOR_ID, 0x1004)},
|
||||
#endif
|
||||
#ifdef CONFIG_APCI_2200
|
||||
{APCI2200_BOARD_VENDOR_ID, 0x1005, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
|
||||
{PCI_DEVICE(APCI2200_BOARD_VENDOR_ID, 0x1005)},
|
||||
#endif
|
||||
#ifdef CONFIG_APCI_1564
|
||||
{APCI1564_BOARD_VENDOR_ID, 0x1006, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
|
||||
{PCI_DEVICE(APCI1564_BOARD_VENDOR_ID, 0x1006)},
|
||||
#endif
|
||||
#ifdef CONFIG_APCI_1500
|
||||
{APCI1500_BOARD_VENDOR_ID, 0x80fc, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
|
||||
{PCI_DEVICE(APCI1500_BOARD_VENDOR_ID, 0x80fc)},
|
||||
#endif
|
||||
#ifdef CONFIG_APCI_3001
|
||||
{APCI3120_BOARD_VENDOR_ID, 0x828D, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
|
||||
{PCI_DEVICE(APCI3120_BOARD_VENDOR_ID, 0x828D)},
|
||||
#endif
|
||||
#ifdef CONFIG_APCI_3501
|
||||
{APCI3501_BOARD_VENDOR_ID, 0x3001, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
|
||||
{PCI_DEVICE(APCI3501_BOARD_VENDOR_ID, 0x3001)},
|
||||
#endif
|
||||
#ifdef CONFIG_APCI_035
|
||||
{APCI035_BOARD_VENDOR_ID, 0x0300, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
|
||||
{PCI_DEVICE(APCI035_BOARD_VENDOR_ID, 0x0300)},
|
||||
#endif
|
||||
#ifdef CONFIG_APCI_3200
|
||||
{APCI3200_BOARD_VENDOR_ID, 0x3000, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
|
||||
{PCI_DEVICE(APCI3200_BOARD_VENDOR_ID, 0x3000)},
|
||||
#endif
|
||||
#ifdef CONFIG_APCI_3300
|
||||
{APCI3200_BOARD_VENDOR_ID, 0x3007, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
|
||||
{PCI_DEVICE(APCI3200_BOARD_VENDOR_ID, 0x3007)},
|
||||
#endif
|
||||
#ifdef CONFIG_APCI_1710
|
||||
{APCI1710_BOARD_VENDOR_ID, APCI1710_BOARD_DEVICE_ID,
|
||||
PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
|
||||
{PCI_DEVICE(APCI1710_BOARD_VENDOR_ID, APCI1710_BOARD_DEVICE_ID)},
|
||||
#endif
|
||||
#ifdef CONFIG_APCI_16XX
|
||||
{0x15B8, 0x1009, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
|
||||
{0x15B8, 0x100A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
|
||||
{PCI_DEVICE(PCI_VENDOR_ID_ADDIDATA, 0x1009)},
|
||||
{PCI_DEVICE(PCI_VENDOR_ID_ADDIDATA, 0x100A)},
|
||||
#endif
|
||||
#ifdef CONFIG_APCI_3XXX
|
||||
{0x15B8, 0x3010, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
|
||||
{0x15B8, 0x300F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
|
||||
{0x15B8, 0x300E, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
|
||||
{0x15B8, 0x3013, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
|
||||
{0x15B8, 0x3014, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
|
||||
{0x15B8, 0x3015, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
|
||||
{0x15B8, 0x3016, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
|
||||
{0x15B8, 0x3017, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
|
||||
{0x15B8, 0x3018, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
|
||||
{0x15B8, 0x3019, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
|
||||
{0x15B8, 0x301A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
|
||||
{0x15B8, 0x301B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
|
||||
{0x15B8, 0x301C, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
|
||||
{0x15B8, 0x301D, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
|
||||
{0x15B8, 0x301E, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
|
||||
{0x15B8, 0x301F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
|
||||
{0x15B8, 0x3020, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
|
||||
{0x15B8, 0x3021, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
|
||||
{0x15B8, 0x3022, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
|
||||
{0x15B8, 0x3023, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
|
||||
{0x15B8, 0x300B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
|
||||
{0x15B8, 0x3002, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
|
||||
{0x15B8, 0x3003, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
|
||||
{0x15B8, 0x3004, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
|
||||
{0x15B8, 0x3024, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
|
||||
{PCI_DEVICE(PCI_VENDOR_ID_ADDIDATA, 0x3010)},
|
||||
{PCI_DEVICE(PCI_VENDOR_ID_ADDIDATA, 0x300F)},
|
||||
{PCI_DEVICE(PCI_VENDOR_ID_ADDIDATA, 0x300E)},
|
||||
{PCI_DEVICE(PCI_VENDOR_ID_ADDIDATA, 0x3013)},
|
||||
{PCI_DEVICE(PCI_VENDOR_ID_ADDIDATA, 0x3014)},
|
||||
{PCI_DEVICE(PCI_VENDOR_ID_ADDIDATA, 0x3015)},
|
||||
{PCI_DEVICE(PCI_VENDOR_ID_ADDIDATA, 0x3016)},
|
||||
{PCI_DEVICE(PCI_VENDOR_ID_ADDIDATA, 0x3017)},
|
||||
{PCI_DEVICE(PCI_VENDOR_ID_ADDIDATA, 0x3018)},
|
||||
{PCI_DEVICE(PCI_VENDOR_ID_ADDIDATA, 0x3019)},
|
||||
{PCI_DEVICE(PCI_VENDOR_ID_ADDIDATA, 0x301A)},
|
||||
{PCI_DEVICE(PCI_VENDOR_ID_ADDIDATA, 0x301B)},
|
||||
{PCI_DEVICE(PCI_VENDOR_ID_ADDIDATA, 0x301C)},
|
||||
{PCI_DEVICE(PCI_VENDOR_ID_ADDIDATA, 0x301D)},
|
||||
{PCI_DEVICE(PCI_VENDOR_ID_ADDIDATA, 0x301E)},
|
||||
{PCI_DEVICE(PCI_VENDOR_ID_ADDIDATA, 0x301F)},
|
||||
{PCI_DEVICE(PCI_VENDOR_ID_ADDIDATA, 0x3020)},
|
||||
{PCI_DEVICE(PCI_VENDOR_ID_ADDIDATA, 0x3021)},
|
||||
{PCI_DEVICE(PCI_VENDOR_ID_ADDIDATA, 0x3022)},
|
||||
{PCI_DEVICE(PCI_VENDOR_ID_ADDIDATA, 0x3023)},
|
||||
{PCI_DEVICE(PCI_VENDOR_ID_ADDIDATA, 0x300B)},
|
||||
{PCI_DEVICE(PCI_VENDOR_ID_ADDIDATA, 0x3002)},
|
||||
{PCI_DEVICE(PCI_VENDOR_ID_ADDIDATA, 0x3003)},
|
||||
{PCI_DEVICE(PCI_VENDOR_ID_ADDIDATA, 0x3004)},
|
||||
{PCI_DEVICE(PCI_VENDOR_ID_ADDIDATA, 0x3024)},
|
||||
#endif
|
||||
{0}
|
||||
};
|
||||
|
@ -1019,7 +1018,7 @@ static const struct addi_board boardtypes[] = {
|
|||
#endif
|
||||
#ifdef CONFIG_APCI_16XX
|
||||
{"apci1648",
|
||||
0x15B8,
|
||||
PCI_VENDOR_ID_ADDIDATA,
|
||||
0x1009,
|
||||
128,
|
||||
0,
|
||||
|
@ -1075,7 +1074,7 @@ static const struct addi_board boardtypes[] = {
|
|||
i_APCI16XX_InsnBitsWriteTTLIO},
|
||||
|
||||
{"apci1696",
|
||||
0x15B8,
|
||||
PCI_VENDOR_ID_ADDIDATA,
|
||||
0x100A,
|
||||
128,
|
||||
0,
|
||||
|
@ -1132,7 +1131,7 @@ static const struct addi_board boardtypes[] = {
|
|||
#endif
|
||||
#ifdef CONFIG_APCI_3XXX
|
||||
{"apci3000-16",
|
||||
0x15B8,
|
||||
PCI_VENDOR_ID_ADDIDATA,
|
||||
0x3010,
|
||||
256,
|
||||
256,
|
||||
|
@ -1188,7 +1187,7 @@ static const struct addi_board boardtypes[] = {
|
|||
i_APCI3XXX_InsnWriteTTLIO},
|
||||
|
||||
{"apci3000-8",
|
||||
0x15B8,
|
||||
PCI_VENDOR_ID_ADDIDATA,
|
||||
0x300F,
|
||||
256,
|
||||
256,
|
||||
|
@ -1244,7 +1243,7 @@ static const struct addi_board boardtypes[] = {
|
|||
i_APCI3XXX_InsnWriteTTLIO},
|
||||
|
||||
{"apci3000-4",
|
||||
0x15B8,
|
||||
PCI_VENDOR_ID_ADDIDATA,
|
||||
0x300E,
|
||||
256,
|
||||
256,
|
||||
|
@ -1300,7 +1299,7 @@ static const struct addi_board boardtypes[] = {
|
|||
i_APCI3XXX_InsnWriteTTLIO},
|
||||
|
||||
{"apci3006-16",
|
||||
0x15B8,
|
||||
PCI_VENDOR_ID_ADDIDATA,
|
||||
0x3013,
|
||||
256,
|
||||
256,
|
||||
|
@ -1356,7 +1355,7 @@ static const struct addi_board boardtypes[] = {
|
|||
i_APCI3XXX_InsnWriteTTLIO},
|
||||
|
||||
{"apci3006-8",
|
||||
0x15B8,
|
||||
PCI_VENDOR_ID_ADDIDATA,
|
||||
0x3014,
|
||||
256,
|
||||
256,
|
||||
|
@ -1412,7 +1411,7 @@ static const struct addi_board boardtypes[] = {
|
|||
i_APCI3XXX_InsnWriteTTLIO},
|
||||
|
||||
{"apci3006-4",
|
||||
0x15B8,
|
||||
PCI_VENDOR_ID_ADDIDATA,
|
||||
0x3015,
|
||||
256,
|
||||
256,
|
||||
|
@ -1468,7 +1467,7 @@ static const struct addi_board boardtypes[] = {
|
|||
i_APCI3XXX_InsnWriteTTLIO},
|
||||
|
||||
{"apci3010-16",
|
||||
0x15B8,
|
||||
PCI_VENDOR_ID_ADDIDATA,
|
||||
0x3016,
|
||||
256,
|
||||
256,
|
||||
|
@ -1524,7 +1523,7 @@ static const struct addi_board boardtypes[] = {
|
|||
i_APCI3XXX_InsnWriteTTLIO},
|
||||
|
||||
{"apci3010-8",
|
||||
0x15B8,
|
||||
PCI_VENDOR_ID_ADDIDATA,
|
||||
0x3017,
|
||||
256,
|
||||
256,
|
||||
|
@ -1580,7 +1579,7 @@ static const struct addi_board boardtypes[] = {
|
|||
i_APCI3XXX_InsnWriteTTLIO},
|
||||
|
||||
{"apci3010-4",
|
||||
0x15B8,
|
||||
PCI_VENDOR_ID_ADDIDATA,
|
||||
0x3018,
|
||||
256,
|
||||
256,
|
||||
|
@ -1636,7 +1635,7 @@ static const struct addi_board boardtypes[] = {
|
|||
i_APCI3XXX_InsnWriteTTLIO},
|
||||
|
||||
{"apci3016-16",
|
||||
0x15B8,
|
||||
PCI_VENDOR_ID_ADDIDATA,
|
||||
0x3019,
|
||||
256,
|
||||
256,
|
||||
|
@ -1692,7 +1691,7 @@ static const struct addi_board boardtypes[] = {
|
|||
i_APCI3XXX_InsnWriteTTLIO},
|
||||
|
||||
{"apci3016-8",
|
||||
0x15B8,
|
||||
PCI_VENDOR_ID_ADDIDATA,
|
||||
0x301A,
|
||||
256,
|
||||
256,
|
||||
|
@ -1748,7 +1747,7 @@ static const struct addi_board boardtypes[] = {
|
|||
i_APCI3XXX_InsnWriteTTLIO},
|
||||
|
||||
{"apci3016-4",
|
||||
0x15B8,
|
||||
PCI_VENDOR_ID_ADDIDATA,
|
||||
0x301B,
|
||||
256,
|
||||
256,
|
||||
|
@ -1804,7 +1803,7 @@ static const struct addi_board boardtypes[] = {
|
|||
i_APCI3XXX_InsnWriteTTLIO},
|
||||
|
||||
{"apci3100-16-4",
|
||||
0x15B8,
|
||||
PCI_VENDOR_ID_ADDIDATA,
|
||||
0x301C,
|
||||
256,
|
||||
256,
|
||||
|
@ -1860,7 +1859,7 @@ static const struct addi_board boardtypes[] = {
|
|||
i_APCI3XXX_InsnWriteTTLIO},
|
||||
|
||||
{"apci3100-8-4",
|
||||
0x15B8,
|
||||
PCI_VENDOR_ID_ADDIDATA,
|
||||
0x301D,
|
||||
256,
|
||||
256,
|
||||
|
@ -1916,7 +1915,7 @@ static const struct addi_board boardtypes[] = {
|
|||
i_APCI3XXX_InsnWriteTTLIO},
|
||||
|
||||
{"apci3106-16-4",
|
||||
0x15B8,
|
||||
PCI_VENDOR_ID_ADDIDATA,
|
||||
0x301E,
|
||||
256,
|
||||
256,
|
||||
|
@ -1972,7 +1971,7 @@ static const struct addi_board boardtypes[] = {
|
|||
i_APCI3XXX_InsnWriteTTLIO},
|
||||
|
||||
{"apci3106-8-4",
|
||||
0x15B8,
|
||||
PCI_VENDOR_ID_ADDIDATA,
|
||||
0x301F,
|
||||
256,
|
||||
256,
|
||||
|
@ -2028,7 +2027,7 @@ static const struct addi_board boardtypes[] = {
|
|||
i_APCI3XXX_InsnWriteTTLIO},
|
||||
|
||||
{"apci3110-16-4",
|
||||
0x15B8,
|
||||
PCI_VENDOR_ID_ADDIDATA,
|
||||
0x3020,
|
||||
256,
|
||||
256,
|
||||
|
@ -2084,7 +2083,7 @@ static const struct addi_board boardtypes[] = {
|
|||
i_APCI3XXX_InsnWriteTTLIO},
|
||||
|
||||
{"apci3110-8-4",
|
||||
0x15B8,
|
||||
PCI_VENDOR_ID_ADDIDATA,
|
||||
0x3021,
|
||||
256,
|
||||
256,
|
||||
|
@ -2140,7 +2139,7 @@ static const struct addi_board boardtypes[] = {
|
|||
i_APCI3XXX_InsnWriteTTLIO},
|
||||
|
||||
{"apci3116-16-4",
|
||||
0x15B8,
|
||||
PCI_VENDOR_ID_ADDIDATA,
|
||||
0x3022,
|
||||
256,
|
||||
256,
|
||||
|
@ -2196,7 +2195,7 @@ static const struct addi_board boardtypes[] = {
|
|||
i_APCI3XXX_InsnWriteTTLIO},
|
||||
|
||||
{"apci3116-8-4",
|
||||
0x15B8,
|
||||
PCI_VENDOR_ID_ADDIDATA,
|
||||
0x3023,
|
||||
256,
|
||||
256,
|
||||
|
@ -2252,7 +2251,7 @@ static const struct addi_board boardtypes[] = {
|
|||
i_APCI3XXX_InsnWriteTTLIO},
|
||||
|
||||
{"apci3003",
|
||||
0x15B8,
|
||||
PCI_VENDOR_ID_ADDIDATA,
|
||||
0x300B,
|
||||
256,
|
||||
256,
|
||||
|
@ -2307,7 +2306,7 @@ static const struct addi_board boardtypes[] = {
|
|||
NULL},
|
||||
|
||||
{"apci3002-16",
|
||||
0x15B8,
|
||||
PCI_VENDOR_ID_ADDIDATA,
|
||||
0x3002,
|
||||
256,
|
||||
256,
|
||||
|
@ -2362,7 +2361,7 @@ static const struct addi_board boardtypes[] = {
|
|||
NULL},
|
||||
|
||||
{"apci3002-8",
|
||||
0x15B8,
|
||||
PCI_VENDOR_ID_ADDIDATA,
|
||||
0x3003,
|
||||
256,
|
||||
256,
|
||||
|
@ -2417,7 +2416,7 @@ static const struct addi_board boardtypes[] = {
|
|||
NULL},
|
||||
|
||||
{"apci3002-4",
|
||||
0x15B8,
|
||||
PCI_VENDOR_ID_ADDIDATA,
|
||||
0x3004,
|
||||
256,
|
||||
256,
|
||||
|
@ -2472,7 +2471,7 @@ static const struct addi_board boardtypes[] = {
|
|||
NULL},
|
||||
|
||||
{"apci3500",
|
||||
0x15B8,
|
||||
PCI_VENDOR_ID_ADDIDATA,
|
||||
0x3024,
|
||||
256,
|
||||
256,
|
||||
|
|
|
@ -44,15 +44,7 @@ Configuration Options:
|
|||
#define PCI_DEVICE_ID_PCI7230 0x7230
|
||||
|
||||
static DEFINE_PCI_DEVICE_TABLE(adl_pci7230_pci_table) = {
|
||||
{
|
||||
PCI_VENDOR_ID_ADLINK,
|
||||
PCI_DEVICE_ID_PCI7230,
|
||||
PCI_ANY_ID,
|
||||
PCI_ANY_ID,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
},
|
||||
{ PCI_DEVICE(PCI_VENDOR_ID_ADLINK, PCI_DEVICE_ID_PCI7230) },
|
||||
{0}
|
||||
};
|
||||
|
||||
|
|
|
@ -49,10 +49,8 @@ Configuration Options:
|
|||
#define PCI_DEVICE_ID_PCI7296 0x7296
|
||||
|
||||
static DEFINE_PCI_DEVICE_TABLE(adl_pci7296_pci_table) = {
|
||||
{
|
||||
PCI_VENDOR_ID_ADLINK, PCI_DEVICE_ID_PCI7296, PCI_ANY_ID,
|
||||
PCI_ANY_ID, 0, 0, 0}, {
|
||||
0}
|
||||
{ PCI_DEVICE(PCI_VENDOR_ID_ADLINK, PCI_DEVICE_ID_PCI7296) },
|
||||
{0}
|
||||
};
|
||||
|
||||
MODULE_DEVICE_TABLE(pci, adl_pci7296_pci_table);
|
||||
|
|
|
@ -44,10 +44,8 @@ Configuration Options:
|
|||
#define PCI_DEVICE_ID_PCI7432 0x7432
|
||||
|
||||
static DEFINE_PCI_DEVICE_TABLE(adl_pci7432_pci_table) = {
|
||||
{
|
||||
PCI_VENDOR_ID_ADLINK, PCI_DEVICE_ID_PCI7432, PCI_ANY_ID,
|
||||
PCI_ANY_ID, 0, 0, 0}, {
|
||||
0}
|
||||
{ PCI_DEVICE(PCI_VENDOR_ID_ADLINK, PCI_DEVICE_ID_PCI7432) },
|
||||
{0}
|
||||
};
|
||||
|
||||
MODULE_DEVICE_TABLE(pci, adl_pci7432_pci_table);
|
||||
|
|
|
@ -57,10 +57,8 @@ Configuration Options:
|
|||
#define PCI_DEVICE_ID_PCI8164 0x8164
|
||||
|
||||
static DEFINE_PCI_DEVICE_TABLE(adl_pci8164_pci_table) = {
|
||||
{
|
||||
PCI_VENDOR_ID_ADLINK, PCI_DEVICE_ID_PCI8164, PCI_ANY_ID,
|
||||
PCI_ANY_ID, 0, 0, 0}, {
|
||||
0}
|
||||
{ PCI_DEVICE(PCI_VENDOR_ID_ADLINK, PCI_DEVICE_ID_PCI8164) },
|
||||
{0}
|
||||
};
|
||||
|
||||
MODULE_DEVICE_TABLE(pci, adl_pci8164_pci_table);
|
||||
|
|
|
@ -311,10 +311,8 @@ static const struct comedi_lrange pci9111_hr_ai_range = {
|
|||
};
|
||||
|
||||
static DEFINE_PCI_DEVICE_TABLE(pci9111_pci_table) = {
|
||||
{ PCI_VENDOR_ID_ADLINK, PCI9111_HR_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID,
|
||||
0, 0, 0 },
|
||||
/* { PCI_VENDOR_ID_ADLINK, PCI9111_HG_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID,
|
||||
* 0, 0, 0 }, */
|
||||
{ PCI_DEVICE(PCI_VENDOR_ID_ADLINK, PCI9111_HR_DEVICE_ID) },
|
||||
/* { PCI_DEVICE(PCI_VENDOR_ID_ADLINK, PCI9111_HG_DEVICE_ID) }, */
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
|
|
|
@ -1382,16 +1382,14 @@ static int pci1710_attach(struct comedi_device *dev,
|
|||
int i;
|
||||
int board_index;
|
||||
|
||||
printk("comedi%d: adv_pci1710: ", dev->minor);
|
||||
dev_info(dev->hw_dev, "comedi%d: adv_pci1710:\n", dev->minor);
|
||||
|
||||
opt_bus = it->options[0];
|
||||
opt_slot = it->options[1];
|
||||
|
||||
ret = alloc_private(dev, sizeof(struct pci1710_private));
|
||||
if (ret < 0) {
|
||||
printk(" - Allocation failed!\n");
|
||||
if (ret < 0)
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
/* Look for matching PCI device */
|
||||
errstr = "not found!";
|
||||
|
@ -1436,10 +1434,10 @@ static int pci1710_attach(struct comedi_device *dev,
|
|||
|
||||
if (!pcidev) {
|
||||
if (opt_bus || opt_slot) {
|
||||
printk(" - Card at b:s %d:%d %s\n",
|
||||
opt_bus, opt_slot, errstr);
|
||||
dev_err(dev->hw_dev, "- Card at b:s %d:%d %s\n",
|
||||
opt_bus, opt_slot, errstr);
|
||||
} else {
|
||||
printk(" - Card %s\n", errstr);
|
||||
dev_err(dev->hw_dev, "- Card %s\n", errstr);
|
||||
}
|
||||
return -EIO;
|
||||
}
|
||||
|
@ -1450,8 +1448,8 @@ static int pci1710_attach(struct comedi_device *dev,
|
|||
irq = pcidev->irq;
|
||||
iobase = pci_resource_start(pcidev, 2);
|
||||
|
||||
printk(", b:s:f=%d:%d:%d, io=0x%4lx", pci_bus, pci_slot, pci_func,
|
||||
iobase);
|
||||
dev_dbg(dev->hw_dev, "b:s:f=%d:%d:%d, io=0x%4lx\n", pci_bus, pci_slot,
|
||||
pci_func, iobase);
|
||||
|
||||
dev->iobase = iobase;
|
||||
|
||||
|
@ -1471,10 +1469,8 @@ static int pci1710_attach(struct comedi_device *dev,
|
|||
n_subdevices++;
|
||||
|
||||
ret = alloc_subdevices(dev, n_subdevices);
|
||||
if (ret < 0) {
|
||||
printk(" - Allocation failed!\n");
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
|
||||
pci1710_reset(dev);
|
||||
|
||||
|
@ -1483,24 +1479,20 @@ static int pci1710_attach(struct comedi_device *dev,
|
|||
if (request_irq(irq, interrupt_service_pci1710,
|
||||
IRQF_SHARED, "Advantech PCI-1710",
|
||||
dev)) {
|
||||
printk
|
||||
(", unable to allocate IRQ %d, DISABLING IT",
|
||||
irq);
|
||||
dev_dbg(dev->hw_dev, "unable to allocate IRQ %d, DISABLING IT",
|
||||
irq);
|
||||
irq = 0; /* Can't use IRQ */
|
||||
} else {
|
||||
printk(", irq=%u", irq);
|
||||
dev_dbg(dev->hw_dev, "irq=%u", irq);
|
||||
}
|
||||
} else {
|
||||
printk(", IRQ disabled");
|
||||
dev_dbg(dev->hw_dev, "IRQ disabled");
|
||||
}
|
||||
} else {
|
||||
irq = 0;
|
||||
}
|
||||
|
||||
dev->irq = irq;
|
||||
|
||||
printk(".\n");
|
||||
|
||||
subdev = 0;
|
||||
|
||||
if (this_board->n_aichan) {
|
||||
|
|
|
@ -1106,13 +1106,10 @@ static int pci_dio_attach(struct comedi_device *dev,
|
|||
unsigned long iobase;
|
||||
struct pci_dev *pcidev = NULL;
|
||||
|
||||
printk("comedi%d: adv_pci_dio: ", dev->minor);
|
||||
|
||||
ret = alloc_private(dev, sizeof(struct pci_dio_private));
|
||||
if (ret < 0) {
|
||||
printk(", Error: Cann't allocate private memory!\n");
|
||||
if (ret < 0)
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
for_each_pci_dev(pcidev) {
|
||||
/* loop through cards supported by this driver */
|
||||
|
@ -1140,19 +1137,18 @@ static int pci_dio_attach(struct comedi_device *dev,
|
|||
}
|
||||
|
||||
if (!dev->board_ptr) {
|
||||
printk(", Error: Requested type of the card was not found!\n");
|
||||
dev_err(dev->hw_dev, "Error: Requested type of the card was not found!\n");
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
if (comedi_pci_enable(pcidev, driver_pci_dio.driver_name)) {
|
||||
printk
|
||||
(", Error: Can't enable PCI device and request regions!\n");
|
||||
dev_err(dev->hw_dev, "Error: Can't enable PCI device and request regions!\n");
|
||||
return -EIO;
|
||||
}
|
||||
iobase = pci_resource_start(pcidev, this_board->main_pci_region);
|
||||
printk(", b:s:f=%d:%d:%d, io=0x%4lx",
|
||||
pcidev->bus->number, PCI_SLOT(pcidev->devfn),
|
||||
PCI_FUNC(pcidev->devfn), iobase);
|
||||
dev_dbg(dev->hw_dev, "b:s:f=%d:%d:%d, io=0x%4lx\n",
|
||||
pcidev->bus->number, PCI_SLOT(pcidev->devfn),
|
||||
PCI_FUNC(pcidev->devfn), iobase);
|
||||
|
||||
dev->iobase = iobase;
|
||||
dev->board_name = this_board->name;
|
||||
|
@ -1177,15 +1173,10 @@ static int pci_dio_attach(struct comedi_device *dev,
|
|||
}
|
||||
|
||||
ret = alloc_subdevices(dev, n_subdevices);
|
||||
if (ret < 0) {
|
||||
printk(", Error: Cann't allocate subdevice memory!\n");
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
|
||||
printk(".\n");
|
||||
|
||||
subdev = 0;
|
||||
|
||||
for (i = 0; i < MAX_DI_SUBDEVS; i++)
|
||||
if (this_board->sdi[i].chans) {
|
||||
s = dev->subdevices + subdev;
|
||||
|
|
|
@ -421,12 +421,9 @@ static const struct dio200_layout_struct dio200_layouts[] = {
|
|||
|
||||
#ifdef CONFIG_COMEDI_PCI
|
||||
static DEFINE_PCI_DEVICE_TABLE(dio200_pci_table) = {
|
||||
{
|
||||
PCI_VENDOR_ID_AMPLICON, PCI_DEVICE_ID_AMPLICON_PCI215,
|
||||
PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, {
|
||||
PCI_VENDOR_ID_AMPLICON, PCI_DEVICE_ID_AMPLICON_PCI272,
|
||||
PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, {
|
||||
0}
|
||||
{ PCI_DEVICE(PCI_VENDOR_ID_AMPLICON, PCI_DEVICE_ID_AMPLICON_PCI215) },
|
||||
{ PCI_DEVICE(PCI_VENDOR_ID_AMPLICON, PCI_DEVICE_ID_AMPLICON_PCI272) },
|
||||
{0}
|
||||
};
|
||||
|
||||
MODULE_DEVICE_TABLE(pci, dio200_pci_table);
|
||||
|
|
|
@ -134,10 +134,8 @@ static const struct pc236_board pc236_boards[] = {
|
|||
|
||||
#ifdef CONFIG_COMEDI_PCI
|
||||
static DEFINE_PCI_DEVICE_TABLE(pc236_pci_table) = {
|
||||
{
|
||||
PCI_VENDOR_ID_AMPLICON, PCI_DEVICE_ID_AMPLICON_PCI236,
|
||||
PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, {
|
||||
0}
|
||||
{ PCI_DEVICE(PCI_VENDOR_ID_AMPLICON, PCI_DEVICE_ID_AMPLICON_PCI236) },
|
||||
{0}
|
||||
};
|
||||
|
||||
MODULE_DEVICE_TABLE(pci, pc236_pci_table);
|
||||
|
|
|
@ -101,10 +101,8 @@ static const struct pc263_board pc263_boards[] = {
|
|||
|
||||
#ifdef CONFIG_COMEDI_PCI
|
||||
static DEFINE_PCI_DEVICE_TABLE(pc263_pci_table) = {
|
||||
{
|
||||
PCI_VENDOR_ID_AMPLICON, PCI_DEVICE_ID_AMPLICON_PCI263,
|
||||
PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, {
|
||||
0}
|
||||
{ PCI_DEVICE(PCI_VENDOR_ID_AMPLICON, PCI_DEVICE_ID_AMPLICON_PCI263) },
|
||||
{0}
|
||||
};
|
||||
|
||||
MODULE_DEVICE_TABLE(pci, pc263_pci_table);
|
||||
|
|
|
@ -384,12 +384,9 @@ static const struct pci224_board pci224_boards[] = {
|
|||
*/
|
||||
|
||||
static DEFINE_PCI_DEVICE_TABLE(pci224_pci_table) = {
|
||||
{
|
||||
PCI_VENDOR_ID_AMPLICON, PCI_DEVICE_ID_AMPLICON_PCI224,
|
||||
PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, {
|
||||
PCI_VENDOR_ID_AMPLICON, PCI_DEVICE_ID_AMPLICON_PCI234,
|
||||
PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, {
|
||||
0}
|
||||
{ PCI_DEVICE(PCI_VENDOR_ID_AMPLICON, PCI_DEVICE_ID_AMPLICON_PCI224) },
|
||||
{ PCI_DEVICE(PCI_VENDOR_ID_AMPLICON, PCI_DEVICE_ID_AMPLICON_PCI234) },
|
||||
{0}
|
||||
};
|
||||
|
||||
MODULE_DEVICE_TABLE(pci, pci224_pci_table);
|
||||
|
|
|
@ -501,12 +501,9 @@ static const struct pci230_board pci230_boards[] = {
|
|||
};
|
||||
|
||||
static DEFINE_PCI_DEVICE_TABLE(pci230_pci_table) = {
|
||||
{
|
||||
PCI_VENDOR_ID_AMPLICON, PCI_DEVICE_ID_PCI230, PCI_ANY_ID,
|
||||
PCI_ANY_ID, 0, 0, 0}, {
|
||||
PCI_VENDOR_ID_AMPLICON, PCI_DEVICE_ID_PCI260, PCI_ANY_ID,
|
||||
PCI_ANY_ID, 0, 0, 0}, {
|
||||
0}
|
||||
{ PCI_DEVICE(PCI_VENDOR_ID_AMPLICON, PCI_DEVICE_ID_PCI230) },
|
||||
{ PCI_DEVICE(PCI_VENDOR_ID_AMPLICON, PCI_DEVICE_ID_PCI260) },
|
||||
{0}
|
||||
};
|
||||
|
||||
MODULE_DEVICE_TABLE(pci, pci230_pci_table);
|
||||
|
|
|
@ -99,7 +99,7 @@ static struct comedi_driver driver_das16cs = {
|
|||
.detach = das16cs_detach,
|
||||
};
|
||||
|
||||
static struct pcmcia_device *cur_dev = NULL;
|
||||
static struct pcmcia_device *cur_dev;
|
||||
|
||||
static const struct comedi_lrange das16cs_ai_range = { 4, {
|
||||
RANGE(-10, 10),
|
||||
|
@ -150,7 +150,7 @@ static const struct das16cs_board *das16cs_probe(struct comedi_device *dev,
|
|||
return das16cs_boards + i;
|
||||
}
|
||||
|
||||
printk("unknown board!\n");
|
||||
dev_dbg(dev->hw_dev, "unknown board!\n");
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
@ -163,20 +163,19 @@ static int das16cs_attach(struct comedi_device *dev,
|
|||
int ret;
|
||||
int i;
|
||||
|
||||
printk("comedi%d: cb_das16_cs: ", dev->minor);
|
||||
dev_dbg(dev->hw_dev, "comedi%d: cb_das16_cs: attached\n", dev->minor);
|
||||
|
||||
link = cur_dev; /* XXX hack */
|
||||
if (!link)
|
||||
return -EIO;
|
||||
|
||||
dev->iobase = link->resource[0]->start;
|
||||
printk("I/O base=0x%04lx ", dev->iobase);
|
||||
dev_dbg(dev->hw_dev, "I/O base=0x%04lx\n", dev->iobase);
|
||||
|
||||
printk("fingerprint:\n");
|
||||
dev_dbg(dev->hw_dev, "fingerprint:\n");
|
||||
for (i = 0; i < 48; i += 2)
|
||||
printk("%04x ", inw(dev->iobase + i));
|
||||
dev_dbg(dev->hw_dev, "%04x\n", inw(dev->iobase + i));
|
||||
|
||||
printk("\n");
|
||||
|
||||
ret = request_irq(link->irq, das16cs_interrupt,
|
||||
IRQF_SHARED, "cb_das16_cs", dev);
|
||||
|
@ -185,7 +184,7 @@ static int das16cs_attach(struct comedi_device *dev,
|
|||
|
||||
dev->irq = link->irq;
|
||||
|
||||
printk("irq=%u ", dev->irq);
|
||||
dev_dbg(dev->hw_dev, "irq=%u\n", dev->irq);
|
||||
|
||||
dev->board_ptr = das16cs_probe(dev, link);
|
||||
if (!dev->board_ptr)
|
||||
|
@ -252,14 +251,13 @@ static int das16cs_attach(struct comedi_device *dev,
|
|||
s->type = COMEDI_SUBD_UNUSED;
|
||||
}
|
||||
|
||||
printk("attached\n");
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int das16cs_detach(struct comedi_device *dev)
|
||||
{
|
||||
printk("comedi%d: das16cs: remove\n", dev->minor);
|
||||
dev_dbg(dev->hw_dev, "comedi%d: das16cs: remove\n", dev->minor);
|
||||
|
||||
if (dev->irq)
|
||||
free_irq(dev->irq, dev);
|
||||
|
@ -312,7 +310,7 @@ static int das16cs_ai_rinsn(struct comedi_device *dev,
|
|||
break;
|
||||
}
|
||||
if (to == TIMEOUT) {
|
||||
printk("cb_das16_cs: ai timeout\n");
|
||||
dev_dbg(dev->hw_dev, "cb_das16_cs: ai timeout\n");
|
||||
return -ETIME;
|
||||
}
|
||||
data[i] = (unsigned short)inw(dev->iobase + 0);
|
||||
|
|
|
@ -565,8 +565,6 @@ static int cb_pcidas_attach(struct comedi_device *dev,
|
|||
int index;
|
||||
int i;
|
||||
|
||||
printk("comedi%d: cb_pcidas: ", dev->minor);
|
||||
|
||||
/*
|
||||
* Allocate the private structure area.
|
||||
*/
|
||||
|
@ -576,7 +574,6 @@ static int cb_pcidas_attach(struct comedi_device *dev,
|
|||
/*
|
||||
* Probe the device to determine what device in the series it is.
|
||||
*/
|
||||
printk("\n");
|
||||
|
||||
for_each_pci_dev(pcidev) {
|
||||
/* is it not a computer boards card? */
|
||||
|
@ -600,20 +597,20 @@ static int cb_pcidas_attach(struct comedi_device *dev,
|
|||
}
|
||||
}
|
||||
|
||||
printk("No supported ComputerBoards/MeasurementComputing card found on "
|
||||
"requested position\n");
|
||||
dev_err(dev->hw_dev, "No supported ComputerBoards/MeasurementComputing card found on requested position\n");
|
||||
return -EIO;
|
||||
|
||||
found:
|
||||
|
||||
printk("Found %s on bus %i, slot %i\n", cb_pcidas_boards[index].name,
|
||||
pcidev->bus->number, PCI_SLOT(pcidev->devfn));
|
||||
dev_dbg(dev->hw_dev, "Found %s on bus %i, slot %i\n",
|
||||
cb_pcidas_boards[index].name, pcidev->bus->number,
|
||||
PCI_SLOT(pcidev->devfn));
|
||||
|
||||
/*
|
||||
* Enable PCI device and reserve I/O ports.
|
||||
*/
|
||||
if (comedi_pci_enable(pcidev, "cb_pcidas")) {
|
||||
printk(" Failed to enable PCI device and request regions\n");
|
||||
dev_err(dev->hw_dev, "Failed to enable PCI device and request regions\n");
|
||||
return -EIO;
|
||||
}
|
||||
/*
|
||||
|
@ -639,7 +636,8 @@ static int cb_pcidas_attach(struct comedi_device *dev,
|
|||
/* get irq */
|
||||
if (request_irq(devpriv->pci_dev->irq, cb_pcidas_interrupt,
|
||||
IRQF_SHARED, "cb_pcidas", dev)) {
|
||||
printk(" unable to allocate irq %d\n", devpriv->pci_dev->irq);
|
||||
dev_dbg(dev->hw_dev, "unable to allocate irq %d\n",
|
||||
devpriv->pci_dev->irq);
|
||||
return -EINVAL;
|
||||
}
|
||||
dev->irq = devpriv->pci_dev->irq;
|
||||
|
@ -768,7 +766,6 @@ static int cb_pcidas_attach(struct comedi_device *dev,
|
|||
*/
|
||||
static int cb_pcidas_detach(struct comedi_device *dev)
|
||||
{
|
||||
printk("comedi%d: cb_pcidas: remove\n", dev->minor);
|
||||
|
||||
if (devpriv) {
|
||||
if (devpriv->s5933_config) {
|
||||
|
@ -776,8 +773,8 @@ static int cb_pcidas_detach(struct comedi_device *dev)
|
|||
outl(INTCSR_INBOX_INTR_STATUS,
|
||||
devpriv->s5933_config + AMCC_OP_REG_INTCSR);
|
||||
#ifdef CB_PCIDAS_DEBUG
|
||||
printk("detaching, incsr is 0x%x\n",
|
||||
inl(devpriv->s5933_config + AMCC_OP_REG_INTCSR));
|
||||
dev_dbg(dev->hw_dev, "detaching, incsr is 0x%x\n",
|
||||
inl(devpriv->s5933_config + AMCC_OP_REG_INTCSR));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@ -858,7 +855,8 @@ static int ai_config_calibration_source(struct comedi_device *dev,
|
|||
unsigned int source = data[1];
|
||||
|
||||
if (source >= num_calibration_sources) {
|
||||
printk("invalid calibration source: %i\n", source);
|
||||
dev_err(dev->hw_dev, "invalid calibration source: %i\n",
|
||||
source);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
@ -1279,7 +1277,7 @@ static int cb_pcidas_ai_cmd(struct comedi_device *dev,
|
|||
outw(bits, devpriv->control_status + ADCMUX_CONT);
|
||||
|
||||
#ifdef CB_PCIDAS_DEBUG
|
||||
printk("comedi: sent 0x%x to adcmux control\n", bits);
|
||||
dev_dbg(dev->hw_dev, "comedi: sent 0x%x to adcmux control\n", bits);
|
||||
#endif
|
||||
|
||||
/* load counters */
|
||||
|
@ -1306,7 +1304,8 @@ static int cb_pcidas_ai_cmd(struct comedi_device *dev,
|
|||
devpriv->adc_fifo_bits |= INT_FHF; /* interrupt fifo half full */
|
||||
}
|
||||
#ifdef CB_PCIDAS_DEBUG
|
||||
printk("comedi: adc_fifo_bits are 0x%x\n", devpriv->adc_fifo_bits);
|
||||
dev_dbg(dev->hw_dev, "comedi: adc_fifo_bits are 0x%x\n",
|
||||
devpriv->adc_fifo_bits);
|
||||
#endif
|
||||
/* enable (and clear) interrupts */
|
||||
outw(devpriv->adc_fifo_bits | EOAI | INT | LADFUL,
|
||||
|
@ -1332,7 +1331,7 @@ static int cb_pcidas_ai_cmd(struct comedi_device *dev,
|
|||
bits |= BURSTE;
|
||||
outw(bits, devpriv->control_status + TRIG_CONTSTAT);
|
||||
#ifdef CB_PCIDAS_DEBUG
|
||||
printk("comedi: sent 0x%x to trig control\n", bits);
|
||||
dev_dbg(dev->hw_dev, "comedi: sent 0x%x to trig control\n", bits);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
@ -1549,7 +1548,8 @@ static int cb_pcidas_ao_inttrig(struct comedi_device *dev,
|
|||
spin_lock_irqsave(&dev->spinlock, flags);
|
||||
devpriv->adc_fifo_bits |= DAEMIE | DAHFIE;
|
||||
#ifdef CB_PCIDAS_DEBUG
|
||||
printk("comedi: adc_fifo_bits are 0x%x\n", devpriv->adc_fifo_bits);
|
||||
dev_dbg(dev->hw_dev, "comedi: adc_fifo_bits are 0x%x\n",
|
||||
devpriv->adc_fifo_bits);
|
||||
#endif
|
||||
/* enable and clear interrupts */
|
||||
outw(devpriv->adc_fifo_bits | DAEMI | DAHFI,
|
||||
|
@ -1559,7 +1559,8 @@ static int cb_pcidas_ao_inttrig(struct comedi_device *dev,
|
|||
devpriv->ao_control_bits |= DAC_START | DACEN | DAC_EMPTY;
|
||||
outw(devpriv->ao_control_bits, devpriv->control_status + DAC_CSR);
|
||||
#ifdef CB_PCIDAS_DEBUG
|
||||
printk("comedi: sent 0x%x to dac control\n", devpriv->ao_control_bits);
|
||||
dev_dbg(dev->hw_dev, "comedi: sent 0x%x to dac control\n",
|
||||
devpriv->ao_control_bits);
|
||||
#endif
|
||||
spin_unlock_irqrestore(&dev->spinlock, flags);
|
||||
|
||||
|
@ -1587,8 +1588,9 @@ static irqreturn_t cb_pcidas_interrupt(int irq, void *d)
|
|||
|
||||
s5933_status = inl(devpriv->s5933_config + AMCC_OP_REG_INTCSR);
|
||||
#ifdef CB_PCIDAS_DEBUG
|
||||
printk("intcsr 0x%x\n", s5933_status);
|
||||
printk("mbef 0x%x\n", inl(devpriv->s5933_config + AMCC_OP_REG_MBEF));
|
||||
dev_dbg(dev->hw_dev, "intcsr 0x%x\n", s5933_status);
|
||||
dev_dbg(dev->hw_dev, "mbef 0x%x\n",
|
||||
inl(devpriv->s5933_config + AMCC_OP_REG_MBEF));
|
||||
#endif
|
||||
|
||||
if ((INTCSR_INTR_ASSERTED & s5933_status) == 0)
|
||||
|
|
|
@ -1739,8 +1739,6 @@ static int attach(struct comedi_device *dev, struct comedi_devconfig *it)
|
|||
uint32_t local_range, local_decode;
|
||||
int retval;
|
||||
|
||||
printk("comedi%d: cb_pcidas64\n", dev->minor);
|
||||
|
||||
/*
|
||||
* Allocate the private structure area.
|
||||
*/
|
||||
|
@ -1781,12 +1779,11 @@ static int attach(struct comedi_device *dev, struct comedi_devconfig *it)
|
|||
return -EIO;
|
||||
}
|
||||
|
||||
printk("Found %s on bus %i, slot %i\n", board(dev)->name,
|
||||
pcidev->bus->number, PCI_SLOT(pcidev->devfn));
|
||||
dev_dbg(dev->hw_dev, "Found %s on bus %i, slot %i\n", board(dev)->name,
|
||||
pcidev->bus->number, PCI_SLOT(pcidev->devfn));
|
||||
|
||||
if (comedi_pci_enable(pcidev, driver_cb_pcidas.driver_name)) {
|
||||
printk(KERN_WARNING
|
||||
" failed to enable PCI device and request regions\n");
|
||||
dev_warn(dev->hw_dev, "failed to enable PCI device and request regions\n");
|
||||
return -EIO;
|
||||
}
|
||||
pci_set_master(pcidev);
|
||||
|
@ -1814,7 +1811,7 @@ static int attach(struct comedi_device *dev, struct comedi_devconfig *it)
|
|||
|
||||
if (!priv(dev)->plx9080_iobase || !priv(dev)->main_iobase
|
||||
|| !priv(dev)->dio_counter_iobase) {
|
||||
printk(" failed to remap io memory\n");
|
||||
dev_warn(dev->hw_dev, "failed to remap io memory\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
|
@ -1850,17 +1847,19 @@ static int attach(struct comedi_device *dev, struct comedi_devconfig *it)
|
|||
|
||||
priv(dev)->hw_revision =
|
||||
hw_revision(dev, readw(priv(dev)->main_iobase + HW_STATUS_REG));
|
||||
printk(" stc hardware revision %i\n", priv(dev)->hw_revision);
|
||||
dev_dbg(dev->hw_dev, "stc hardware revision %i\n",
|
||||
priv(dev)->hw_revision);
|
||||
init_plx9080(dev);
|
||||
init_stc_registers(dev);
|
||||
/* get irq */
|
||||
if (request_irq(pcidev->irq, handle_interrupt, IRQF_SHARED,
|
||||
"cb_pcidas64", dev)) {
|
||||
printk(" unable to allocate irq %u\n", pcidev->irq);
|
||||
dev_dbg(dev->hw_dev, "unable to allocate irq %u\n",
|
||||
pcidev->irq);
|
||||
return -EINVAL;
|
||||
}
|
||||
dev->irq = pcidev->irq;
|
||||
printk(" irq %u\n", dev->irq);
|
||||
dev_dbg(dev->hw_dev, "irq %u\n", dev->irq);
|
||||
|
||||
retval = setup_subdevices(dev);
|
||||
if (retval < 0)
|
||||
|
@ -1882,8 +1881,6 @@ static int detach(struct comedi_device *dev)
|
|||
{
|
||||
unsigned int i;
|
||||
|
||||
printk("comedi%d: cb_pcidas: remove\n", dev->minor);
|
||||
|
||||
if (dev->irq)
|
||||
free_irq(dev->irq, dev);
|
||||
if (priv(dev)) {
|
||||
|
@ -2093,7 +2090,8 @@ static int ai_config_calibration_source(struct comedi_device *dev,
|
|||
else
|
||||
num_calibration_sources = 8;
|
||||
if (source >= num_calibration_sources) {
|
||||
printk("invalid calibration source: %i\n", source);
|
||||
dev_dbg(dev->hw_dev, "invalid calibration source: %i\n",
|
||||
source);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
@ -2924,7 +2922,7 @@ static void pio_drain_ai_fifo_16(struct comedi_device *dev)
|
|||
}
|
||||
|
||||
if (num_samples < 0) {
|
||||
printk(" cb_pcidas64: bug! num_samples < 0\n");
|
||||
dev_err(dev->hw_dev, "cb_pcidas64: bug! num_samples < 0\n");
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -282,7 +282,6 @@ static int cb_pcidda_attach(struct comedi_device *dev,
|
|||
struct pci_dev *pcidev = NULL;
|
||||
int index;
|
||||
|
||||
printk("comedi%d: cb_pcidda: ", dev->minor);
|
||||
|
||||
/*
|
||||
* Allocate the private structure area.
|
||||
|
@ -293,7 +292,6 @@ static int cb_pcidda_attach(struct comedi_device *dev,
|
|||
/*
|
||||
* Probe the device to determine what device in the series it is.
|
||||
*/
|
||||
printk("\n");
|
||||
|
||||
for_each_pci_dev(pcidev) {
|
||||
if (pcidev->vendor == PCI_VENDOR_ID_CB) {
|
||||
|
@ -312,22 +310,21 @@ static int cb_pcidda_attach(struct comedi_device *dev,
|
|||
}
|
||||
}
|
||||
if (!pcidev) {
|
||||
printk
|
||||
("Not a ComputerBoards/MeasurementComputing card on requested position\n");
|
||||
dev_err(dev->hw_dev, "Not a ComputerBoards/MeasurementComputing card on requested position\n");
|
||||
return -EIO;
|
||||
}
|
||||
found:
|
||||
devpriv->pci_dev = pcidev;
|
||||
dev->board_ptr = cb_pcidda_boards + index;
|
||||
/* "thisboard" macro can be used from here. */
|
||||
printk("Found %s at requested position\n", thisboard->name);
|
||||
dev_dbg(dev->hw_dev, "Found %s at requested position\n",
|
||||
thisboard->name);
|
||||
|
||||
/*
|
||||
* Enable PCI device and request regions.
|
||||
*/
|
||||
if (comedi_pci_enable(pcidev, thisboard->name)) {
|
||||
printk
|
||||
("cb_pcidda: failed to enable PCI device and request regions\n");
|
||||
dev_err(dev->hw_dev, "cb_pcidda: failed to enable PCI device and request regions\n");
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
|
@ -377,12 +374,11 @@ static int cb_pcidda_attach(struct comedi_device *dev,
|
|||
s = dev->subdevices + 2;
|
||||
subdev_8255_init(dev, s, NULL, devpriv->digitalio + PORT2A);
|
||||
|
||||
printk(" eeprom:");
|
||||
dev_dbg(dev->hw_dev, "eeprom:\n");
|
||||
for (index = 0; index < EEPROM_SIZE; index++) {
|
||||
devpriv->eeprom_data[index] = cb_pcidda_read_eeprom(dev, index);
|
||||
printk(" %i:0x%x ", index, devpriv->eeprom_data[index]);
|
||||
dev_dbg(dev->hw_dev, "%i:0x%x\n", index, devpriv->eeprom_data[index]);
|
||||
}
|
||||
printk("\n");
|
||||
|
||||
/* set calibrations dacs */
|
||||
for (index = 0; index < thisboard->ao_chans; index++)
|
||||
|
@ -417,8 +413,6 @@ static int cb_pcidda_detach(struct comedi_device *dev)
|
|||
subdev_8255_cleanup(dev, dev->subdevices + 2);
|
||||
}
|
||||
|
||||
printk("comedi%d: cb_pcidda: remove\n", dev->minor);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -184,8 +184,6 @@ static int pcidio_attach(struct comedi_device *dev, struct comedi_devconfig *it)
|
|||
int index;
|
||||
int i;
|
||||
|
||||
printk("comedi%d: cb_pcidio: \n", dev->minor);
|
||||
|
||||
/*
|
||||
* Allocate the private structure area. alloc_private() is a
|
||||
* convenient macro defined in comedidev.h.
|
||||
|
@ -223,8 +221,7 @@ static int pcidio_attach(struct comedi_device *dev, struct comedi_devconfig *it)
|
|||
}
|
||||
}
|
||||
|
||||
printk("No supported ComputerBoards/MeasurementComputing card found on "
|
||||
"requested position\n");
|
||||
dev_err(dev->hw_dev, "No supported ComputerBoards/MeasurementComputing card found on requested position\n");
|
||||
return -EIO;
|
||||
|
||||
found:
|
||||
|
@ -236,14 +233,12 @@ static int pcidio_attach(struct comedi_device *dev, struct comedi_devconfig *it)
|
|||
dev->board_name = thisboard->name;
|
||||
|
||||
devpriv->pci_dev = pcidev;
|
||||
printk("Found %s on bus %i, slot %i\n", thisboard->name,
|
||||
devpriv->pci_dev->bus->number,
|
||||
PCI_SLOT(devpriv->pci_dev->devfn));
|
||||
if (comedi_pci_enable(pcidev, thisboard->name)) {
|
||||
printk
|
||||
("cb_pcidio: failed to enable PCI device and request regions\n");
|
||||
dev_dbg(dev->hw_dev, "Found %s on bus %i, slot %i\n", thisboard->name,
|
||||
devpriv->pci_dev->bus->number,
|
||||
PCI_SLOT(devpriv->pci_dev->devfn));
|
||||
if (comedi_pci_enable(pcidev, thisboard->name))
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
devpriv->dio_reg_base
|
||||
=
|
||||
pci_resource_start(devpriv->pci_dev,
|
||||
|
@ -259,11 +254,10 @@ static int pcidio_attach(struct comedi_device *dev, struct comedi_devconfig *it)
|
|||
for (i = 0; i < thisboard->n_8255; i++) {
|
||||
subdev_8255_init(dev, dev->subdevices + i,
|
||||
NULL, devpriv->dio_reg_base + i * 4);
|
||||
printk(" subdev %d: base = 0x%lx\n", i,
|
||||
devpriv->dio_reg_base + i * 4);
|
||||
dev_dbg(dev->hw_dev, "subdev %d: base = 0x%lx\n", i,
|
||||
devpriv->dio_reg_base + i * 4);
|
||||
}
|
||||
|
||||
printk("attached\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -277,7 +271,6 @@ static int pcidio_attach(struct comedi_device *dev, struct comedi_devconfig *it)
|
|||
*/
|
||||
static int pcidio_detach(struct comedi_device *dev)
|
||||
{
|
||||
printk("comedi%d: cb_pcidio: remove\n", dev->minor);
|
||||
if (devpriv) {
|
||||
if (devpriv->pci_dev) {
|
||||
if (devpriv->dio_reg_base)
|
||||
|
|
|
@ -212,8 +212,6 @@ static int cb_pcimdas_attach(struct comedi_device *dev,
|
|||
int index;
|
||||
/* int i; */
|
||||
|
||||
printk("comedi%d: cb_pcimdas: ", dev->minor);
|
||||
|
||||
/*
|
||||
* Allocate the private structure area.
|
||||
*/
|
||||
|
@ -223,7 +221,6 @@ static int cb_pcimdas_attach(struct comedi_device *dev,
|
|||
/*
|
||||
* Probe the device to determine what device in the series it is.
|
||||
*/
|
||||
printk("\n");
|
||||
|
||||
for_each_pci_dev(pcidev) {
|
||||
/* is it not a computer boards card? */
|
||||
|
@ -248,26 +245,26 @@ static int cb_pcimdas_attach(struct comedi_device *dev,
|
|||
}
|
||||
}
|
||||
|
||||
printk("No supported ComputerBoards/MeasurementComputing card found on "
|
||||
"requested position\n");
|
||||
dev_err(dev->hw_dev, "No supported ComputerBoards/MeasurementComputing card found on requested position\n");
|
||||
return -EIO;
|
||||
|
||||
found:
|
||||
|
||||
printk("Found %s on bus %i, slot %i\n", cb_pcimdas_boards[index].name,
|
||||
pcidev->bus->number, PCI_SLOT(pcidev->devfn));
|
||||
dev_dbg(dev->hw_dev, "Found %s on bus %i, slot %i\n",
|
||||
cb_pcimdas_boards[index].name, pcidev->bus->number,
|
||||
PCI_SLOT(pcidev->devfn));
|
||||
|
||||
/* Warn about non-tested features */
|
||||
switch (thisboard->device_id) {
|
||||
case 0x56:
|
||||
break;
|
||||
default:
|
||||
printk("THIS CARD IS UNSUPPORTED.\n"
|
||||
"PLEASE REPORT USAGE TO <mocelet@sucs.org>\n");
|
||||
dev_dbg(dev->hw_dev, "THIS CARD IS UNSUPPORTED.\n"
|
||||
"PLEASE REPORT USAGE TO <mocelet@sucs.org>\n");
|
||||
}
|
||||
|
||||
if (comedi_pci_enable(pcidev, "cb_pcimdas")) {
|
||||
printk(" Failed to enable PCI device and request regions\n");
|
||||
dev_err(dev->hw_dev, "Failed to enable PCI device and request regions\n");
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
|
@ -277,13 +274,11 @@ static int cb_pcimdas_attach(struct comedi_device *dev,
|
|||
devpriv->BADR3 = pci_resource_start(devpriv->pci_dev, 3);
|
||||
devpriv->BADR4 = pci_resource_start(devpriv->pci_dev, 4);
|
||||
|
||||
#ifdef CBPCIMDAS_DEBUG
|
||||
printk("devpriv->BADR0 = 0x%lx\n", devpriv->BADR0);
|
||||
printk("devpriv->BADR1 = 0x%lx\n", devpriv->BADR1);
|
||||
printk("devpriv->BADR2 = 0x%lx\n", devpriv->BADR2);
|
||||
printk("devpriv->BADR3 = 0x%lx\n", devpriv->BADR3);
|
||||
printk("devpriv->BADR4 = 0x%lx\n", devpriv->BADR4);
|
||||
#endif
|
||||
dev_dbg(dev->hw_dev, "devpriv->BADR0 = 0x%lx\n", devpriv->BADR0);
|
||||
dev_dbg(dev->hw_dev, "devpriv->BADR1 = 0x%lx\n", devpriv->BADR1);
|
||||
dev_dbg(dev->hw_dev, "devpriv->BADR2 = 0x%lx\n", devpriv->BADR2);
|
||||
dev_dbg(dev->hw_dev, "devpriv->BADR3 = 0x%lx\n", devpriv->BADR3);
|
||||
dev_dbg(dev->hw_dev, "devpriv->BADR4 = 0x%lx\n", devpriv->BADR4);
|
||||
|
||||
/* Dont support IRQ yet */
|
||||
/* get irq */
|
||||
|
@ -333,8 +328,6 @@ static int cb_pcimdas_attach(struct comedi_device *dev,
|
|||
else
|
||||
s->type = COMEDI_SUBD_UNUSED;
|
||||
|
||||
printk("attached\n");
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -348,16 +341,19 @@ static int cb_pcimdas_attach(struct comedi_device *dev,
|
|||
*/
|
||||
static int cb_pcimdas_detach(struct comedi_device *dev)
|
||||
{
|
||||
#ifdef CBPCIMDAS_DEBUG
|
||||
if (devpriv) {
|
||||
printk("devpriv->BADR0 = 0x%lx\n", devpriv->BADR0);
|
||||
printk("devpriv->BADR1 = 0x%lx\n", devpriv->BADR1);
|
||||
printk("devpriv->BADR2 = 0x%lx\n", devpriv->BADR2);
|
||||
printk("devpriv->BADR3 = 0x%lx\n", devpriv->BADR3);
|
||||
printk("devpriv->BADR4 = 0x%lx\n", devpriv->BADR4);
|
||||
dev_dbg(dev->hw_dev, "devpriv->BADR0 = 0x%lx\n",
|
||||
devpriv->BADR0);
|
||||
dev_dbg(dev->hw_dev, "devpriv->BADR1 = 0x%lx\n",
|
||||
devpriv->BADR1);
|
||||
dev_dbg(dev->hw_dev, "devpriv->BADR2 = 0x%lx\n",
|
||||
devpriv->BADR2);
|
||||
dev_dbg(dev->hw_dev, "devpriv->BADR3 = 0x%lx\n",
|
||||
devpriv->BADR3);
|
||||
dev_dbg(dev->hw_dev, "devpriv->BADR4 = 0x%lx\n",
|
||||
devpriv->BADR4);
|
||||
}
|
||||
#endif
|
||||
printk("comedi%d: cb_pcimdas: remove\n", dev->minor);
|
||||
|
||||
if (dev->irq)
|
||||
free_irq(dev->irq, dev);
|
||||
if (devpriv) {
|
||||
|
|
|
@ -105,7 +105,8 @@ struct board_struct {
|
|||
int ao_bits;
|
||||
int dio_chans;
|
||||
int dio_method;
|
||||
int dio_offset; /* how many bytes into the BADR are the DIO ports */
|
||||
/* how many bytes into the BADR are the DIO ports */
|
||||
int dio_offset;
|
||||
int regs_badrindex; /* IO Region for the control, analog output,
|
||||
and DIO registers */
|
||||
int reg_sz; /* number of bytes of registers in io region */
|
||||
|
@ -144,17 +145,18 @@ static const struct board_struct boards[] = {
|
|||
/* Please add your PCI vendor ID to comedidev.h, and it will be forwarded
|
||||
* upstream. */
|
||||
static DEFINE_PCI_DEVICE_TABLE(pci_table) = {
|
||||
{
|
||||
PCI_VENDOR_ID_COMPUTERBOARDS, PCI_ID_PCIM_DDA06_16, PCI_ANY_ID,
|
||||
PCI_ANY_ID, 0, 0, 0}, {
|
||||
0}
|
||||
{ PCI_DEVICE(PCI_VENDOR_ID_COMPUTERBOARDS, PCI_ID_PCIM_DDA06_16) },
|
||||
{0}
|
||||
};
|
||||
|
||||
MODULE_DEVICE_TABLE(pci, pci_table);
|
||||
|
||||
/* this structure is for data unique to this hardware driver. If
|
||||
several hardware drivers keep similar information in this structure,
|
||||
feel free to suggest moving the variable to the struct comedi_device struct. */
|
||||
/*
|
||||
* this structure is for data unique to this hardware driver. If
|
||||
* several hardware drivers keep similar information in this structure,
|
||||
* feel free to suggest moving the variable to the struct comedi_device
|
||||
* struct.
|
||||
*/
|
||||
struct board_private_struct {
|
||||
unsigned long registers; /* set by probe */
|
||||
unsigned long dio_registers;
|
||||
|
@ -335,7 +337,10 @@ static int attach(struct comedi_device *dev, struct comedi_devconfig *it)
|
|||
if (thisboard->dio_chans) {
|
||||
switch (thisboard->dio_method) {
|
||||
case DIO_8255:
|
||||
/* this is a straight 8255, so register us with the 8255 driver */
|
||||
/*
|
||||
* this is a straight 8255, so register us with
|
||||
* the 8255 driver
|
||||
*/
|
||||
subdev_8255_init(dev, s, NULL, devpriv->dio_registers);
|
||||
devpriv->attached_to_8255 = 1;
|
||||
break;
|
||||
|
@ -436,8 +441,11 @@ static int ao_rinsn(struct comedi_device *dev, struct comedi_subdevice *s,
|
|||
|
||||
for (i = 0; i < insn->n; i++) {
|
||||
inw(devpriv->registers + chan * 2);
|
||||
/* should I set data[i] to the result of the actual read on the register
|
||||
or the cached unsigned int in devpriv->ao_readback[]? */
|
||||
/*
|
||||
* should I set data[i] to the result of the actual read
|
||||
* on the register or the cached unsigned int in
|
||||
* devpriv->ao_readback[]?
|
||||
*/
|
||||
data[i] = devpriv->ao_readback[chan];
|
||||
}
|
||||
|
||||
|
|
|
@ -57,10 +57,9 @@ static const struct contec_board contec_boards[] = {
|
|||
|
||||
#define PCI_DEVICE_ID_PIO1616L 0x8172
|
||||
static DEFINE_PCI_DEVICE_TABLE(contec_pci_table) = {
|
||||
{
|
||||
PCI_VENDOR_ID_CONTEC, PCI_DEVICE_ID_PIO1616L, PCI_ANY_ID,
|
||||
PCI_ANY_ID, 0, 0, PIO1616L}, {
|
||||
0}
|
||||
{ PCI_DEVICE(PCI_VENDOR_ID_CONTEC, PCI_DEVICE_ID_PIO1616L),
|
||||
.driver_data = PIO1616L },
|
||||
{0}
|
||||
};
|
||||
|
||||
MODULE_DEVICE_TABLE(pci, contec_pci_table);
|
||||
|
@ -197,8 +196,8 @@ static int contec_do_insn_bits(struct comedi_device *dev,
|
|||
struct comedi_insn *insn, unsigned int *data)
|
||||
{
|
||||
|
||||
printk("contec_do_insn_bits called\n");
|
||||
printk(" data: %d %d\n", data[0], data[1]);
|
||||
dev_dbg(dev->hw_dev, "contec_do_insn_bits called\n");
|
||||
dev_dbg(dev->hw_dev, "data: %d %d\n", data[0], data[1]);
|
||||
|
||||
if (insn->n != 2)
|
||||
return -EINVAL;
|
||||
|
@ -206,8 +205,8 @@ static int contec_do_insn_bits(struct comedi_device *dev,
|
|||
if (data[0]) {
|
||||
s->state &= ~data[0];
|
||||
s->state |= data[0] & data[1];
|
||||
printk(" out: %d on %lx\n", s->state,
|
||||
dev->iobase + thisboard->out_offs);
|
||||
dev_dbg(dev->hw_dev, "out: %d on %lx\n", s->state,
|
||||
dev->iobase + thisboard->out_offs);
|
||||
outw(s->state, dev->iobase + thisboard->out_offs);
|
||||
}
|
||||
return 2;
|
||||
|
@ -218,8 +217,8 @@ static int contec_di_insn_bits(struct comedi_device *dev,
|
|||
struct comedi_insn *insn, unsigned int *data)
|
||||
{
|
||||
|
||||
printk("contec_di_insn_bits called\n");
|
||||
printk(" data: %d %d\n", data[0], data[1]);
|
||||
dev_dbg(dev->hw_dev, "contec_di_insn_bits called\n");
|
||||
dev_dbg(dev->hw_dev, "data: %d %d\n", data[0], data[1]);
|
||||
|
||||
if (insn->n != 2)
|
||||
return -EINVAL;
|
||||
|
|
|
@ -325,9 +325,8 @@ static const struct daq200_boardtype boardtypes[] = {
|
|||
#define this_board ((const struct daq200_boardtype *)dev->board_ptr)
|
||||
|
||||
static DEFINE_PCI_DEVICE_TABLE(daqboard2000_pci_table) = {
|
||||
{
|
||||
0x1616, 0x0409, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, {
|
||||
0}
|
||||
{ PCI_DEVICE(0x1616, 0x0409) },
|
||||
{0}
|
||||
};
|
||||
|
||||
MODULE_DEVICE_TABLE(pci, daqboard2000_pci_table);
|
||||
|
@ -430,16 +429,14 @@ static int daqboard2000_ai_insn_read(struct comedi_device *dev,
|
|||
/* Enable reading from the scanlist FIFO */
|
||||
fpga->acqControl = DAQBOARD2000_SeqStartScanList;
|
||||
for (timeout = 0; timeout < 20; timeout++) {
|
||||
if (fpga->acqControl & DAQBOARD2000_AcqConfigPipeFull) {
|
||||
if (fpga->acqControl & DAQBOARD2000_AcqConfigPipeFull)
|
||||
break;
|
||||
}
|
||||
/* udelay(2); */
|
||||
}
|
||||
fpga->acqControl = DAQBOARD2000_AdcPacerEnable;
|
||||
for (timeout = 0; timeout < 20; timeout++) {
|
||||
if (fpga->acqControl & DAQBOARD2000_AcqLogicScanning) {
|
||||
if (fpga->acqControl & DAQBOARD2000_AcqLogicScanning)
|
||||
break;
|
||||
}
|
||||
/* udelay(2); */
|
||||
}
|
||||
for (timeout = 0; timeout < 20; timeout++) {
|
||||
|
@ -465,9 +462,8 @@ static int daqboard2000_ao_insn_read(struct comedi_device *dev,
|
|||
int i;
|
||||
int chan = CR_CHAN(insn->chanspec);
|
||||
|
||||
for (i = 0; i < insn->n; i++) {
|
||||
for (i = 0; i < insn->n; i++)
|
||||
data[i] = devpriv->ao_readback[chan];
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
||||
|
@ -490,9 +486,8 @@ static int daqboard2000_ao_insn_write(struct comedi_device *dev,
|
|||
/* fpga->dacControl = (chan + 2) * 0x0010 | 0x0001; udelay(1000); */
|
||||
fpga->dacSetting[chan] = data[i];
|
||||
for (timeout = 0; timeout < 20; timeout++) {
|
||||
if ((fpga->dacControl & ((chan + 1) * 0x0010)) == 0) {
|
||||
if ((fpga->dacControl & ((chan + 1) * 0x0010)) == 0)
|
||||
break;
|
||||
}
|
||||
/* udelay(2); */
|
||||
}
|
||||
devpriv->ao_readback[chan] = data[i];
|
||||
|
@ -507,7 +502,7 @@ static int daqboard2000_ao_insn_write(struct comedi_device *dev,
|
|||
|
||||
static void daqboard2000_resetLocalBus(struct comedi_device *dev)
|
||||
{
|
||||
printk("daqboard2000_resetLocalBus\n");
|
||||
dev_dbg(dev->hw_dev, "daqboard2000_resetLocalBus\n");
|
||||
writel(DAQBOARD2000_SECRLocalBusHi, devpriv->plx + 0x6c);
|
||||
udelay(10000);
|
||||
writel(DAQBOARD2000_SECRLocalBusLo, devpriv->plx + 0x6c);
|
||||
|
@ -516,7 +511,7 @@ static void daqboard2000_resetLocalBus(struct comedi_device *dev)
|
|||
|
||||
static void daqboard2000_reloadPLX(struct comedi_device *dev)
|
||||
{
|
||||
printk("daqboard2000_reloadPLX\n");
|
||||
dev_dbg(dev->hw_dev, "daqboard2000_reloadPLX\n");
|
||||
writel(DAQBOARD2000_SECRReloadLo, devpriv->plx + 0x6c);
|
||||
udelay(10000);
|
||||
writel(DAQBOARD2000_SECRReloadHi, devpriv->plx + 0x6c);
|
||||
|
@ -527,7 +522,7 @@ static void daqboard2000_reloadPLX(struct comedi_device *dev)
|
|||
|
||||
static void daqboard2000_pulseProgPin(struct comedi_device *dev)
|
||||
{
|
||||
printk("daqboard2000_pulseProgPin 1\n");
|
||||
dev_dbg(dev->hw_dev, "daqboard2000_pulseProgPin 1\n");
|
||||
writel(DAQBOARD2000_SECRProgPinHi, devpriv->plx + 0x6c);
|
||||
udelay(10000);
|
||||
writel(DAQBOARD2000_SECRProgPinLo, devpriv->plx + 0x6c);
|
||||
|
@ -579,14 +574,14 @@ static int initialize_daqboard2000(struct comedi_device *dev,
|
|||
secr = readl(devpriv->plx + 0x6c);
|
||||
if (!(secr & DAQBOARD2000_EEPROM_PRESENT)) {
|
||||
#ifdef DEBUG_EEPROM
|
||||
printk("no serial eeprom\n");
|
||||
dev_dbg(dev->hw_dev, "no serial eeprom\n");
|
||||
#endif
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
for (retry = 0; retry < 3; retry++) {
|
||||
#ifdef DEBUG_EEPROM
|
||||
printk("Programming EEPROM try %x\n", retry);
|
||||
dev_dbg(dev->hw_dev, "Programming EEPROM try %x\n", retry);
|
||||
#endif
|
||||
|
||||
daqboard2000_resetLocalBus(dev);
|
||||
|
@ -597,7 +592,8 @@ static int initialize_daqboard2000(struct comedi_device *dev,
|
|||
if (cpld_array[i] == 0xff
|
||||
&& cpld_array[i + 1] == 0x20) {
|
||||
#ifdef DEBUG_EEPROM
|
||||
printk("Preamble found at %d\n", i);
|
||||
dev_dbg(dev->hw_dev, "Preamble found at %d\n",
|
||||
i);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
@ -605,13 +601,12 @@ static int initialize_daqboard2000(struct comedi_device *dev,
|
|||
for (; i < len; i += 2) {
|
||||
int data =
|
||||
(cpld_array[i] << 8) + cpld_array[i + 1];
|
||||
if (!daqboard2000_writeCPLD(dev, data)) {
|
||||
if (!daqboard2000_writeCPLD(dev, data))
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (i >= len) {
|
||||
#ifdef DEBUG_EEPROM
|
||||
printk("Programmed\n");
|
||||
dev_dbg(dev->hw_dev, "Programmed\n");
|
||||
#endif
|
||||
daqboard2000_resetLocalBus(dev);
|
||||
daqboard2000_reloadPLX(dev);
|
||||
|
@ -658,9 +653,8 @@ static void daqboard2000_activateReferenceDacs(struct comedi_device *dev)
|
|||
/* Set the + reference dac value in the FPGA */
|
||||
fpga->refDacs = 0x80 | DAQBOARD2000_PosRefDacSelect;
|
||||
for (timeout = 0; timeout < 20; timeout++) {
|
||||
if ((fpga->dacControl & DAQBOARD2000_RefBusy) == 0) {
|
||||
if ((fpga->dacControl & DAQBOARD2000_RefBusy) == 0)
|
||||
break;
|
||||
}
|
||||
udelay(2);
|
||||
}
|
||||
/* printk("DAQBOARD2000_PosRefDacSelect %d\n", timeout);*/
|
||||
|
@ -668,9 +662,8 @@ static void daqboard2000_activateReferenceDacs(struct comedi_device *dev)
|
|||
/* Set the - reference dac value in the FPGA */
|
||||
fpga->refDacs = 0x80 | DAQBOARD2000_NegRefDacSelect;
|
||||
for (timeout = 0; timeout < 20; timeout++) {
|
||||
if ((fpga->dacControl & DAQBOARD2000_RefBusy) == 0) {
|
||||
if ((fpga->dacControl & DAQBOARD2000_RefBusy) == 0)
|
||||
break;
|
||||
}
|
||||
udelay(2);
|
||||
}
|
||||
/* printk("DAQBOARD2000_NegRefDacSelect %d\n", timeout);*/
|
||||
|
@ -737,15 +730,13 @@ static int daqboard2000_attach(struct comedi_device *dev,
|
|||
unsigned int aux_len;
|
||||
int bus, slot;
|
||||
|
||||
printk("comedi%d: daqboard2000:", dev->minor);
|
||||
|
||||
bus = it->options[0];
|
||||
slot = it->options[1];
|
||||
|
||||
result = alloc_private(dev, sizeof(struct daqboard2000_private));
|
||||
if (result < 0) {
|
||||
if (result < 0)
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
for (card = pci_get_device(0x1616, 0x0409, NULL);
|
||||
card != NULL; card = pci_get_device(0x1616, 0x0409, card)) {
|
||||
if (bus || slot) {
|
||||
|
@ -759,10 +750,10 @@ static int daqboard2000_attach(struct comedi_device *dev,
|
|||
}
|
||||
if (!card) {
|
||||
if (bus || slot)
|
||||
printk(" no daqboard2000 found at bus/slot: %d/%d\n",
|
||||
bus, slot);
|
||||
dev_err(dev->hw_dev, "no daqboard2000 found at bus/slot: %d/%d\n",
|
||||
bus, slot);
|
||||
else
|
||||
printk(" no daqboard2000 found\n");
|
||||
dev_err(dev->hw_dev, "no daqboard2000 found\n");
|
||||
return -EIO;
|
||||
} else {
|
||||
u32 id;
|
||||
|
@ -772,7 +763,8 @@ static int daqboard2000_attach(struct comedi_device *dev,
|
|||
subsystem_device << 16) | card->subsystem_vendor;
|
||||
for (i = 0; i < n_boardtypes; i++) {
|
||||
if (boardtypes[i].id == id) {
|
||||
printk(" %s", boardtypes[i].name);
|
||||
dev_dbg(dev->hw_dev, "%s\n",
|
||||
boardtypes[i].name);
|
||||
dev->board_ptr = boardtypes + i;
|
||||
}
|
||||
}
|
||||
|
@ -786,7 +778,7 @@ static int daqboard2000_attach(struct comedi_device *dev,
|
|||
|
||||
result = comedi_pci_enable(card, "daqboard2000");
|
||||
if (result < 0) {
|
||||
printk(" failed to enable PCI device and request regions\n");
|
||||
dev_err(dev->hw_dev, "failed to enable PCI device and request regions\n");
|
||||
return -EIO;
|
||||
}
|
||||
devpriv->got_regions = 1;
|
||||
|
@ -794,9 +786,8 @@ static int daqboard2000_attach(struct comedi_device *dev,
|
|||
ioremap(pci_resource_start(card, 0), DAQBOARD2000_PLX_SIZE);
|
||||
devpriv->daq =
|
||||
ioremap(pci_resource_start(card, 2), DAQBOARD2000_DAQ_SIZE);
|
||||
if (!devpriv->plx || !devpriv->daq) {
|
||||
if (!devpriv->plx || !devpriv->daq)
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
result = alloc_subdevices(dev, 3);
|
||||
if (result < 0)
|
||||
|
@ -817,7 +808,7 @@ static int daqboard2000_attach(struct comedi_device *dev,
|
|||
if (aux_data && aux_len) {
|
||||
result = initialize_daqboard2000(dev, aux_data, aux_len);
|
||||
} else {
|
||||
printk("no FPGA initialization code, aborting\n");
|
||||
dev_dbg(dev->hw_dev, "no FPGA initialization code, aborting\n");
|
||||
result = -EIO;
|
||||
}
|
||||
if (result < 0)
|
||||
|
@ -857,30 +848,26 @@ static int daqboard2000_attach(struct comedi_device *dev,
|
|||
result = subdev_8255_init(dev, s, daqboard2000_8255_cb,
|
||||
(unsigned long)(dev->iobase + 0x40));
|
||||
|
||||
printk("\n");
|
||||
out:
|
||||
return result;
|
||||
}
|
||||
|
||||
static int daqboard2000_detach(struct comedi_device *dev)
|
||||
{
|
||||
printk("comedi%d: daqboard2000: remove\n", dev->minor);
|
||||
|
||||
if (dev->subdevices)
|
||||
subdev_8255_cleanup(dev, dev->subdevices + 2);
|
||||
|
||||
if (dev->irq) {
|
||||
if (dev->irq)
|
||||
free_irq(dev->irq, dev);
|
||||
}
|
||||
|
||||
if (devpriv) {
|
||||
if (devpriv->daq)
|
||||
iounmap(devpriv->daq);
|
||||
if (devpriv->plx)
|
||||
iounmap(devpriv->plx);
|
||||
if (devpriv->pci_dev) {
|
||||
if (devpriv->got_regions) {
|
||||
if (devpriv->got_regions)
|
||||
comedi_pci_disable(devpriv->pci_dev);
|
||||
}
|
||||
pci_dev_put(devpriv->pci_dev);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -506,10 +506,8 @@ struct das08_board_struct das08_cs_boards[NUM_DAS08_CS_BOARDS] = {
|
|||
|
||||
#ifdef CONFIG_COMEDI_PCI
|
||||
static DEFINE_PCI_DEVICE_TABLE(das08_pci_table) = {
|
||||
{
|
||||
PCI_VENDOR_ID_COMPUTERBOARDS, PCI_DEVICE_ID_PCIDAS08,
|
||||
PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, {
|
||||
0}
|
||||
{ PCI_DEVICE(PCI_VENDOR_ID_COMPUTERBOARDS, PCI_DEVICE_ID_PCIDAS08) },
|
||||
{0}
|
||||
};
|
||||
|
||||
MODULE_DEVICE_TABLE(pci, das08_pci_table);
|
||||
|
|
|
@ -79,22 +79,20 @@ static int das08_cs_attach(struct comedi_device *dev,
|
|||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
printk("comedi%d: das08_cs: ", dev->minor);
|
||||
dev_info(dev->hw_dev, "comedi%d: das08_cs:\n", dev->minor);
|
||||
/* deal with a pci board */
|
||||
|
||||
if (thisboard->bustype == pcmcia) {
|
||||
if (link == NULL) {
|
||||
printk(" no pcmcia cards found\n");
|
||||
dev_err(dev->hw_dev, "no pcmcia cards found\n");
|
||||
return -EIO;
|
||||
}
|
||||
iobase = link->resource[0]->start;
|
||||
} else {
|
||||
printk(" bug! board does not have PCMCIA bustype\n");
|
||||
dev_err(dev->hw_dev, "bug! board does not have PCMCIA bustype\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
printk("\n");
|
||||
|
||||
return das08_common_attach(dev, iobase);
|
||||
}
|
||||
|
||||
|
|
|
@ -384,20 +384,20 @@ static int das16m1_cmd_exec(struct comedi_device *dev,
|
|||
byte = 0;
|
||||
/* if we are using external start trigger (also board dislikes having
|
||||
* both start and conversion triggers external simultaneously) */
|
||||
if (cmd->start_src == TRIG_EXT && cmd->convert_src != TRIG_EXT) {
|
||||
if (cmd->start_src == TRIG_EXT && cmd->convert_src != TRIG_EXT)
|
||||
byte |= EXT_TRIG_BIT;
|
||||
}
|
||||
|
||||
outb(byte, dev->iobase + DAS16M1_CS);
|
||||
/* clear interrupt bit */
|
||||
outb(0, dev->iobase + DAS16M1_CLEAR_INTR);
|
||||
|
||||
/* enable interrupts and internal pacer */
|
||||
devpriv->control_state &= ~PACER_MASK;
|
||||
if (cmd->convert_src == TRIG_TIMER) {
|
||||
if (cmd->convert_src == TRIG_TIMER)
|
||||
devpriv->control_state |= INT_PACER;
|
||||
} else {
|
||||
else
|
||||
devpriv->control_state |= EXT_PACER;
|
||||
}
|
||||
|
||||
devpriv->control_state |= INTE;
|
||||
outb(devpriv->control_state, dev->iobase + DAS16M1_INTR_CONTROL);
|
||||
|
||||
|
@ -531,9 +531,8 @@ static void munge_sample_array(short *array, unsigned int num_elements)
|
|||
{
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < num_elements; i++) {
|
||||
for (i = 0; i < num_elements; i++)
|
||||
array[i] = munge_sample(array[i]);
|
||||
}
|
||||
}
|
||||
|
||||
static void das16m1_handler(struct comedi_device *dev, unsigned int status)
|
||||
|
@ -668,25 +667,20 @@ static int das16m1_attach(struct comedi_device *dev,
|
|||
|
||||
iobase = it->options[0];
|
||||
|
||||
printk("comedi%d: das16m1:", dev->minor);
|
||||
|
||||
ret = alloc_private(dev, sizeof(struct das16m1_private_struct));
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
dev->board_name = thisboard->name;
|
||||
|
||||
printk(" io 0x%lx-0x%lx 0x%lx-0x%lx",
|
||||
iobase, iobase + DAS16M1_SIZE,
|
||||
iobase + DAS16M1_82C55, iobase + DAS16M1_82C55 + DAS16M1_SIZE2);
|
||||
if (!request_region(iobase, DAS16M1_SIZE, driver_das16m1.driver_name)) {
|
||||
printk(" I/O port conflict\n");
|
||||
comedi_error(dev, "I/O port conflict\n");
|
||||
return -EIO;
|
||||
}
|
||||
if (!request_region(iobase + DAS16M1_82C55, DAS16M1_SIZE2,
|
||||
driver_das16m1.driver_name)) {
|
||||
release_region(iobase, DAS16M1_SIZE);
|
||||
printk(" I/O port conflict\n");
|
||||
comedi_error(dev, "I/O port conflict\n");
|
||||
return -EIO;
|
||||
}
|
||||
dev->iobase = iobase;
|
||||
|
@ -697,17 +691,17 @@ static int das16m1_attach(struct comedi_device *dev,
|
|||
if (das16m1_irq_bits(irq) >= 0) {
|
||||
ret = request_irq(irq, das16m1_interrupt, 0,
|
||||
driver_das16m1.driver_name, dev);
|
||||
if (ret < 0) {
|
||||
printk(", irq unavailable\n");
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
dev->irq = irq;
|
||||
printk(", irq %u\n", irq);
|
||||
printk
|
||||
("irq %u\n", irq);
|
||||
} else if (irq == 0) {
|
||||
printk(", no irq\n");
|
||||
printk
|
||||
(", no irq\n");
|
||||
} else {
|
||||
printk(", invalid irq\n"
|
||||
" valid irqs are 2, 3, 5, 7, 10, 11, 12, or 15\n");
|
||||
comedi_error(dev, "invalid irq\n"
|
||||
" valid irqs are 2, 3, 5, 7, 10, 11, 12, or 15\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
@ -771,7 +765,6 @@ static int das16m1_attach(struct comedi_device *dev,
|
|||
|
||||
static int das16m1_detach(struct comedi_device *dev)
|
||||
{
|
||||
printk("comedi%d: das16m1: remove\n", dev->minor);
|
||||
|
||||
/* das16m1_reset(dev); */
|
||||
|
||||
|
|
|
@ -573,22 +573,23 @@ static int das1800_init_dma(struct comedi_device *dev, unsigned int dma0,
|
|||
devpriv->dma_bits |= DMA_CH7_CH5;
|
||||
break;
|
||||
default:
|
||||
printk(" only supports dma channels 5 through 7\n"
|
||||
" Dual dma only allows the following combinations:\n"
|
||||
" dma 5,6 / 6,7 / or 7,5\n");
|
||||
dev_err(dev->hw_dev, " only supports dma channels 5 through 7\n"
|
||||
" Dual dma only allows the following combinations:\n"
|
||||
" dma 5,6 / 6,7 / or 7,5\n");
|
||||
return -EINVAL;
|
||||
break;
|
||||
}
|
||||
if (request_dma(dma0, driver_das1800.driver_name)) {
|
||||
printk(" failed to allocate dma channel %i\n", dma0);
|
||||
dev_err(dev->hw_dev, "failed to allocate dma channel %i\n",
|
||||
dma0);
|
||||
return -EINVAL;
|
||||
}
|
||||
devpriv->dma0 = dma0;
|
||||
devpriv->dma_current = dma0;
|
||||
if (dma1) {
|
||||
if (request_dma(dma1, driver_das1800.driver_name)) {
|
||||
printk(" failed to allocate dma channel %i\n",
|
||||
dma1);
|
||||
dev_err(dev->hw_dev, "failed to allocate dma channel %i\n",
|
||||
dma1);
|
||||
return -EINVAL;
|
||||
}
|
||||
devpriv->dma1 = dma1;
|
||||
|
@ -631,20 +632,20 @@ static int das1800_attach(struct comedi_device *dev,
|
|||
if (alloc_private(dev, sizeof(struct das1800_private)) < 0)
|
||||
return -ENOMEM;
|
||||
|
||||
printk("comedi%d: %s: io 0x%lx", dev->minor, driver_das1800.driver_name,
|
||||
iobase);
|
||||
printk(KERN_DEBUG "comedi%d: %s: io 0x%lx", dev->minor,
|
||||
driver_das1800.driver_name, iobase);
|
||||
if (irq) {
|
||||
printk(", irq %u", irq);
|
||||
printk(KERN_CONT ", irq %u", irq);
|
||||
if (dma0) {
|
||||
printk(", dma %u", dma0);
|
||||
printk(KERN_CONT ", dma %u", dma0);
|
||||
if (dma1)
|
||||
printk(" and %u", dma1);
|
||||
printk(KERN_CONT " and %u", dma1);
|
||||
}
|
||||
}
|
||||
printk("\n");
|
||||
printk(KERN_CONT "\n");
|
||||
|
||||
if (iobase == 0) {
|
||||
printk(" io base address required\n");
|
||||
dev_err(dev->hw_dev, "io base address required\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
@ -659,7 +660,7 @@ static int das1800_attach(struct comedi_device *dev,
|
|||
|
||||
board = das1800_probe(dev);
|
||||
if (board < 0) {
|
||||
printk(" unable to determine board type\n");
|
||||
dev_err(dev->hw_dev, "unable to determine board type\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
|
@ -683,7 +684,8 @@ static int das1800_attach(struct comedi_device *dev,
|
|||
if (irq) {
|
||||
if (request_irq(irq, das1800_interrupt, 0,
|
||||
driver_das1800.driver_name, dev)) {
|
||||
printk(" unable to allocate irq %u\n", irq);
|
||||
dev_dbg(dev->hw_dev, "unable to allocate irq %u\n",
|
||||
irq);
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
|
@ -712,7 +714,7 @@ static int das1800_attach(struct comedi_device *dev,
|
|||
devpriv->irq_dma_bits |= 0x38;
|
||||
break;
|
||||
default:
|
||||
printk(" irq out of range\n");
|
||||
dev_err(dev->hw_dev, "irq out of range\n");
|
||||
return -EINVAL;
|
||||
break;
|
||||
}
|
||||
|
@ -813,8 +815,8 @@ static int das1800_detach(struct comedi_device *dev)
|
|||
kfree(devpriv->ai_buf1);
|
||||
}
|
||||
|
||||
printk("comedi%d: %s: remove\n", dev->minor,
|
||||
driver_das1800.driver_name);
|
||||
dev_dbg(dev->hw_dev, "comedi%d: %s: remove\n", dev->minor,
|
||||
driver_das1800.driver_name);
|
||||
|
||||
return 0;
|
||||
};
|
||||
|
@ -833,8 +835,8 @@ static int das1800_probe(struct comedi_device *dev)
|
|||
case 0x3:
|
||||
if (board == das1801st_da || board == das1802st_da ||
|
||||
board == das1701st_da || board == das1702st_da) {
|
||||
printk(" Board model: %s\n",
|
||||
das1800_boards[board].name);
|
||||
dev_dbg(dev->hw_dev, "Board model: %s\n",
|
||||
das1800_boards[board].name);
|
||||
return board;
|
||||
}
|
||||
printk
|
||||
|
@ -843,8 +845,8 @@ static int das1800_probe(struct comedi_device *dev)
|
|||
break;
|
||||
case 0x4:
|
||||
if (board == das1802hr_da || board == das1702hr_da) {
|
||||
printk(" Board model: %s\n",
|
||||
das1800_boards[board].name);
|
||||
dev_dbg(dev->hw_dev, "Board model: %s\n",
|
||||
das1800_boards[board].name);
|
||||
return board;
|
||||
}
|
||||
printk
|
||||
|
@ -854,8 +856,8 @@ static int das1800_probe(struct comedi_device *dev)
|
|||
case 0x5:
|
||||
if (board == das1801ao || board == das1802ao ||
|
||||
board == das1701ao || board == das1702ao) {
|
||||
printk(" Board model: %s\n",
|
||||
das1800_boards[board].name);
|
||||
dev_dbg(dev->hw_dev, "Board model: %s\n",
|
||||
das1800_boards[board].name);
|
||||
return board;
|
||||
}
|
||||
printk
|
||||
|
@ -864,18 +866,19 @@ static int das1800_probe(struct comedi_device *dev)
|
|||
break;
|
||||
case 0x6:
|
||||
if (board == das1802hr || board == das1702hr) {
|
||||
printk(" Board model: %s\n",
|
||||
das1800_boards[board].name);
|
||||
dev_dbg(dev->hw_dev, "Board model: %s\n",
|
||||
das1800_boards[board].name);
|
||||
return board;
|
||||
}
|
||||
printk(" Board model (probed, not recommended): das-1802hr\n");
|
||||
printk
|
||||
(" Board model (probed, not recommended): das-1802hr\n");
|
||||
return das1802hr;
|
||||
break;
|
||||
case 0x7:
|
||||
if (board == das1801st || board == das1802st ||
|
||||
board == das1701st || board == das1702st) {
|
||||
printk(" Board model: %s\n",
|
||||
das1800_boards[board].name);
|
||||
dev_dbg(dev->hw_dev, "Board model: %s\n",
|
||||
das1800_boards[board].name);
|
||||
return board;
|
||||
}
|
||||
printk
|
||||
|
@ -884,8 +887,8 @@ static int das1800_probe(struct comedi_device *dev)
|
|||
break;
|
||||
case 0x8:
|
||||
if (board == das1801hc || board == das1802hc) {
|
||||
printk(" Board model: %s\n",
|
||||
das1800_boards[board].name);
|
||||
dev_dbg(dev->hw_dev, "Board model: %s\n",
|
||||
das1800_boards[board].name);
|
||||
return board;
|
||||
}
|
||||
printk
|
||||
|
|
|
@ -171,7 +171,7 @@ static irqreturn_t intr_handler(int irq, void *d)
|
|||
struct comedi_subdevice *s = dev->subdevices;
|
||||
|
||||
if (!dev->attached || devpriv->das6402_ignoreirq) {
|
||||
printk("das6402: BUG: spurious interrupt\n");
|
||||
dev_warn(dev->hw_dev, "BUG: spurious interrupt\n");
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
#ifdef DEBUG
|
||||
|
@ -228,9 +228,7 @@ static int das6402_ai_cancel(struct comedi_device *dev,
|
|||
*/
|
||||
|
||||
devpriv->das6402_ignoreirq = 1;
|
||||
#ifdef DEBUG
|
||||
printk("das6402: Stopping acquisition\n");
|
||||
#endif
|
||||
dev_dbg(dev->hw_dev, "Stopping acquisition\n");
|
||||
devpriv->das6402_ignoreirq = 1;
|
||||
outb_p(0x02, dev->iobase + 10); /* disable external trigging */
|
||||
outw_p(SCANL, dev->iobase + 2); /* resets the card fifo */
|
||||
|
@ -246,10 +244,7 @@ static int das6402_ai_mode2(struct comedi_device *dev,
|
|||
struct comedi_subdevice *s, comedi_trig * it)
|
||||
{
|
||||
devpriv->das6402_ignoreirq = 1;
|
||||
|
||||
#ifdef DEBUG
|
||||
printk("das6402: Starting acquisition\n");
|
||||
#endif
|
||||
dev_dbg(dev->hw_dev, "Starting acquisition\n");
|
||||
outb_p(0x03, dev->iobase + 10); /* enable external trigging */
|
||||
outw_p(SCANL, dev->iobase + 2); /* resets the card fifo */
|
||||
outb_p(IRQ | CONVSRC | BURSTEN | INTE, dev->iobase + 9);
|
||||
|
@ -329,10 +324,8 @@ static int das6402_attach(struct comedi_device *dev,
|
|||
if (iobase == 0)
|
||||
iobase = 0x300;
|
||||
|
||||
printk("comedi%d: das6402: 0x%04lx", dev->minor, iobase);
|
||||
|
||||
if (!request_region(iobase, DAS6402_SIZE, "das6402")) {
|
||||
printk(" I/O port conflict\n");
|
||||
dev_err(dev->hw_dev, "I/O port conflict\n");
|
||||
return -EIO;
|
||||
}
|
||||
dev->iobase = iobase;
|
||||
|
@ -340,14 +333,12 @@ static int das6402_attach(struct comedi_device *dev,
|
|||
/* should do a probe here */
|
||||
|
||||
irq = it->options[0];
|
||||
printk(" ( irq = %u )", irq);
|
||||
dev_dbg(dev->hw_dev, "( irq = %u )\n", irq);
|
||||
ret = request_irq(irq, intr_handler, 0, "das6402", dev);
|
||||
if (ret < 0) {
|
||||
printk("irq conflict\n");
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
dev->irq = irq;
|
||||
|
||||
dev->irq = irq;
|
||||
ret = alloc_private(dev, sizeof(struct das6402_private));
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
|
|
@ -296,47 +296,47 @@ static int das800_probe(struct comedi_device *dev)
|
|||
switch (id_bits) {
|
||||
case 0x0:
|
||||
if (board == das800) {
|
||||
printk(" Board model: DAS-800\n");
|
||||
dev_dbg(dev->hw_dev, "Board model: DAS-800\n");
|
||||
return board;
|
||||
}
|
||||
if (board == ciodas800) {
|
||||
printk(" Board model: CIO-DAS800\n");
|
||||
dev_dbg(dev->hw_dev, "Board model: CIO-DAS800\n");
|
||||
return board;
|
||||
}
|
||||
printk(" Board model (probed): DAS-800\n");
|
||||
dev_dbg(dev->hw_dev, "Board model (probed): DAS-800\n");
|
||||
return das800;
|
||||
break;
|
||||
case 0x2:
|
||||
if (board == das801) {
|
||||
printk(" Board model: DAS-801\n");
|
||||
dev_dbg(dev->hw_dev, "Board model: DAS-801\n");
|
||||
return board;
|
||||
}
|
||||
if (board == ciodas801) {
|
||||
printk(" Board model: CIO-DAS801\n");
|
||||
dev_dbg(dev->hw_dev, "Board model: CIO-DAS801\n");
|
||||
return board;
|
||||
}
|
||||
printk(" Board model (probed): DAS-801\n");
|
||||
dev_dbg(dev->hw_dev, "Board model (probed): DAS-801\n");
|
||||
return das801;
|
||||
break;
|
||||
case 0x3:
|
||||
if (board == das802) {
|
||||
printk(" Board model: DAS-802\n");
|
||||
dev_dbg(dev->hw_dev, "Board model: DAS-802\n");
|
||||
return board;
|
||||
}
|
||||
if (board == ciodas802) {
|
||||
printk(" Board model: CIO-DAS802\n");
|
||||
dev_dbg(dev->hw_dev, "Board model: CIO-DAS802\n");
|
||||
return board;
|
||||
}
|
||||
if (board == ciodas80216) {
|
||||
printk(" Board model: CIO-DAS802/16\n");
|
||||
dev_dbg(dev->hw_dev, "Board model: CIO-DAS802/16\n");
|
||||
return board;
|
||||
}
|
||||
printk(" Board model (probed): DAS-802\n");
|
||||
dev_dbg(dev->hw_dev, "Board model (probed): DAS-802\n");
|
||||
return das802;
|
||||
break;
|
||||
default:
|
||||
printk(" Board model: probe returned 0x%x (unknown)\n",
|
||||
id_bits);
|
||||
dev_dbg(dev->hw_dev, "Board model: probe returned 0x%x (unknown)\n",
|
||||
id_bits);
|
||||
return board;
|
||||
break;
|
||||
}
|
||||
|
@ -466,42 +466,43 @@ static int das800_attach(struct comedi_device *dev, struct comedi_devconfig *it)
|
|||
unsigned long irq_flags;
|
||||
int board;
|
||||
|
||||
printk("comedi%d: das800: io 0x%lx", dev->minor, iobase);
|
||||
dev_info(dev->hw_dev, "comedi%d: das800: io 0x%lx\n", dev->minor,
|
||||
iobase);
|
||||
if (irq)
|
||||
printk(", irq %u", irq);
|
||||
printk("\n");
|
||||
dev_dbg(dev->hw_dev, "irq %u\n", irq);
|
||||
|
||||
/* allocate and initialize dev->private */
|
||||
if (alloc_private(dev, sizeof(struct das800_private)) < 0)
|
||||
return -ENOMEM;
|
||||
|
||||
if (iobase == 0) {
|
||||
printk("io base address required for das800\n");
|
||||
dev_err(dev->hw_dev, "io base address required for das800\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* check if io addresses are available */
|
||||
if (!request_region(iobase, DAS800_SIZE, "das800")) {
|
||||
printk("I/O port conflict\n");
|
||||
dev_err(dev->hw_dev, "I/O port conflict\n");
|
||||
return -EIO;
|
||||
}
|
||||
dev->iobase = iobase;
|
||||
|
||||
board = das800_probe(dev);
|
||||
if (board < 0) {
|
||||
printk("unable to determine board type\n");
|
||||
dev_dbg(dev->hw_dev, "unable to determine board type\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
dev->board_ptr = das800_boards + board;
|
||||
|
||||
/* grab our IRQ */
|
||||
if (irq == 1 || irq > 7) {
|
||||
printk("irq out of range\n");
|
||||
dev_err(dev->hw_dev, "irq out of range\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
if (irq) {
|
||||
if (request_irq(irq, das800_interrupt, 0, "das800", dev)) {
|
||||
printk("unable to allocate irq %u\n", irq);
|
||||
dev_err(dev->hw_dev, "unable to allocate irq %u\n",
|
||||
irq);
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
|
@ -557,7 +558,7 @@ static int das800_attach(struct comedi_device *dev, struct comedi_devconfig *it)
|
|||
|
||||
static int das800_detach(struct comedi_device *dev)
|
||||
{
|
||||
printk("comedi%d: das800: remove\n", dev->minor);
|
||||
dev_info(dev->hw_dev, "comedi%d: das800: remove\n", dev->minor);
|
||||
|
||||
/* only free stuff if it has been allocated by _attach */
|
||||
if (dev->iobase)
|
||||
|
|
|
@ -352,7 +352,8 @@ static int dt3k_send_cmd(struct comedi_device *dev, unsigned int cmd)
|
|||
if ((status & DT3000_COMPLETION_MASK) == DT3000_NOERROR)
|
||||
return 0;
|
||||
|
||||
printk("dt3k_send_cmd() timeout/error status=0x%04x\n", status);
|
||||
dev_dbg(dev->hw_dev, "dt3k_send_cmd() timeout/error status=0x%04x\n",
|
||||
status);
|
||||
|
||||
return -ETIME;
|
||||
}
|
||||
|
@ -383,7 +384,7 @@ static void dt3k_writesingle(struct comedi_device *dev, unsigned int subsys,
|
|||
dt3k_send_cmd(dev, CMD_WRITESINGLE);
|
||||
}
|
||||
|
||||
static int debug_n_ints = 0;
|
||||
static int debug_n_ints;
|
||||
|
||||
/* FIXME! Assumes shared interrupt is for this card. */
|
||||
/* What's this debug_n_ints stuff? Obviously needs some work... */
|
||||
|
@ -429,12 +430,12 @@ static char *intr_flags[] = {
|
|||
static void debug_intr_flags(unsigned int flags)
|
||||
{
|
||||
int i;
|
||||
printk("dt3k: intr_flags:");
|
||||
printk(KERN_DEBUG "dt3k: intr_flags:");
|
||||
for (i = 0; i < 8; i++) {
|
||||
if (flags & (1 << i))
|
||||
printk(" %s", intr_flags[i]);
|
||||
printk(KERN_CONT " %s", intr_flags[i]);
|
||||
}
|
||||
printk("\n");
|
||||
printk(KERN_CONT "\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -452,7 +453,7 @@ static void dt3k_ai_empty_fifo(struct comedi_device *dev,
|
|||
if (count < 0)
|
||||
count += AI_FIFO_DEPTH;
|
||||
|
||||
printk("reading %d samples\n", count);
|
||||
dev_dbg(dev->hw_dev, "reading %d samples\n", count);
|
||||
|
||||
rear = devpriv->ai_rear;
|
||||
|
||||
|
@ -640,7 +641,7 @@ static int dt3k_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
|
|||
int ret;
|
||||
unsigned int mode;
|
||||
|
||||
printk("dt3k_ai_cmd:\n");
|
||||
dev_dbg(dev->hw_dev, "dt3k_ai_cmd:\n");
|
||||
for (i = 0; i < cmd->chanlist_len; i++) {
|
||||
chan = CR_CHAN(cmd->chanlist[i]);
|
||||
range = CR_RANGE(cmd->chanlist[i]);
|
||||
|
@ -651,15 +652,15 @@ static int dt3k_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
|
|||
aref = CR_AREF(cmd->chanlist[0]);
|
||||
|
||||
writew(cmd->scan_end_arg, devpriv->io_addr + DPR_Params(0));
|
||||
printk("param[0]=0x%04x\n", cmd->scan_end_arg);
|
||||
dev_dbg(dev->hw_dev, "param[0]=0x%04x\n", cmd->scan_end_arg);
|
||||
|
||||
if (cmd->convert_src == TRIG_TIMER) {
|
||||
divider = dt3k_ns_to_timer(50, &cmd->convert_arg,
|
||||
cmd->flags & TRIG_ROUND_MASK);
|
||||
writew((divider >> 16), devpriv->io_addr + DPR_Params(1));
|
||||
printk("param[1]=0x%04x\n", divider >> 16);
|
||||
dev_dbg(dev->hw_dev, "param[1]=0x%04x\n", divider >> 16);
|
||||
writew((divider & 0xffff), devpriv->io_addr + DPR_Params(2));
|
||||
printk("param[2]=0x%04x\n", divider & 0xffff);
|
||||
dev_dbg(dev->hw_dev, "param[2]=0x%04x\n", divider & 0xffff);
|
||||
} else {
|
||||
/* not supported */
|
||||
}
|
||||
|
@ -668,21 +669,21 @@ static int dt3k_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
|
|||
tscandiv = dt3k_ns_to_timer(100, &cmd->scan_begin_arg,
|
||||
cmd->flags & TRIG_ROUND_MASK);
|
||||
writew((tscandiv >> 16), devpriv->io_addr + DPR_Params(3));
|
||||
printk("param[3]=0x%04x\n", tscandiv >> 16);
|
||||
dev_dbg(dev->hw_dev, "param[3]=0x%04x\n", tscandiv >> 16);
|
||||
writew((tscandiv & 0xffff), devpriv->io_addr + DPR_Params(4));
|
||||
printk("param[4]=0x%04x\n", tscandiv & 0xffff);
|
||||
dev_dbg(dev->hw_dev, "param[4]=0x%04x\n", tscandiv & 0xffff);
|
||||
} else {
|
||||
/* not supported */
|
||||
}
|
||||
|
||||
mode = DT3000_AD_RETRIG_INTERNAL | 0 | 0;
|
||||
writew(mode, devpriv->io_addr + DPR_Params(5));
|
||||
printk("param[5]=0x%04x\n", mode);
|
||||
dev_dbg(dev->hw_dev, "param[5]=0x%04x\n", mode);
|
||||
writew(aref == AREF_DIFF, devpriv->io_addr + DPR_Params(6));
|
||||
printk("param[6]=0x%04x\n", aref == AREF_DIFF);
|
||||
dev_dbg(dev->hw_dev, "param[6]=0x%04x\n", aref == AREF_DIFF);
|
||||
|
||||
writew(AI_FIFO_DEPTH / 2, devpriv->io_addr + DPR_Params(7));
|
||||
printk("param[7]=0x%04x\n", AI_FIFO_DEPTH / 2);
|
||||
dev_dbg(dev->hw_dev, "param[7]=0x%04x\n", AI_FIFO_DEPTH / 2);
|
||||
|
||||
writew(SUBS_AI, devpriv->io_addr + DPR_SubSys);
|
||||
ret = dt3k_send_cmd(dev, CMD_CONFIG);
|
||||
|
@ -848,7 +849,7 @@ static int dt3000_attach(struct comedi_device *dev, struct comedi_devconfig *it)
|
|||
int bus, slot;
|
||||
int ret = 0;
|
||||
|
||||
printk("dt3000:");
|
||||
dev_dbg(dev->hw_dev, "dt3000:\n");
|
||||
bus = it->options[0];
|
||||
slot = it->options[1];
|
||||
|
||||
|
@ -860,7 +861,7 @@ static int dt3000_attach(struct comedi_device *dev, struct comedi_devconfig *it)
|
|||
if (ret < 0)
|
||||
return ret;
|
||||
if (ret == 0) {
|
||||
printk(" no DT board found\n");
|
||||
dev_warn(dev->hw_dev, "no DT board found\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
|
@ -868,7 +869,8 @@ static int dt3000_attach(struct comedi_device *dev, struct comedi_devconfig *it)
|
|||
|
||||
if (request_irq(devpriv->pci_dev->irq, dt3k_interrupt, IRQF_SHARED,
|
||||
"dt3000", dev)) {
|
||||
printk(" unable to allocate IRQ %u\n", devpriv->pci_dev->irq);
|
||||
dev_err(dev->hw_dev, "unable to allocate IRQ %u\n",
|
||||
devpriv->pci_dev->irq);
|
||||
return -EINVAL;
|
||||
}
|
||||
dev->irq = devpriv->pci_dev->irq;
|
||||
|
|
|
@ -71,18 +71,12 @@ static struct comedi_driver driver_jr3_pci = {
|
|||
};
|
||||
|
||||
static DEFINE_PCI_DEVICE_TABLE(jr3_pci_pci_table) = {
|
||||
{
|
||||
PCI_VENDOR_ID_JR3, PCI_DEVICE_ID_JR3_1_CHANNEL,
|
||||
PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, {
|
||||
PCI_VENDOR_ID_JR3, PCI_DEVICE_ID_JR3_1_CHANNEL_NEW,
|
||||
PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, {
|
||||
PCI_VENDOR_ID_JR3, PCI_DEVICE_ID_JR3_2_CHANNEL,
|
||||
PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, {
|
||||
PCI_VENDOR_ID_JR3, PCI_DEVICE_ID_JR3_3_CHANNEL,
|
||||
PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, {
|
||||
PCI_VENDOR_ID_JR3, PCI_DEVICE_ID_JR3_4_CHANNEL,
|
||||
PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, {
|
||||
0}
|
||||
{ PCI_DEVICE(PCI_VENDOR_ID_JR3, PCI_DEVICE_ID_JR3_1_CHANNEL) },
|
||||
{ PCI_DEVICE(PCI_VENDOR_ID_JR3, PCI_DEVICE_ID_JR3_1_CHANNEL_NEW) },
|
||||
{ PCI_DEVICE(PCI_VENDOR_ID_JR3, PCI_DEVICE_ID_JR3_2_CHANNEL) },
|
||||
{ PCI_DEVICE(PCI_VENDOR_ID_JR3, PCI_DEVICE_ID_JR3_3_CHANNEL) },
|
||||
{ PCI_DEVICE(PCI_VENDOR_ID_JR3, PCI_DEVICE_ID_JR3_4_CHANNEL) },
|
||||
{0}
|
||||
};
|
||||
|
||||
MODULE_DEVICE_TABLE(pci, jr3_pci_pci_table);
|
||||
|
@ -378,14 +372,14 @@ static int jr3_pci_open(struct comedi_device *dev)
|
|||
int i;
|
||||
struct jr3_pci_dev_private *devpriv = dev->private;
|
||||
|
||||
printk("jr3_pci_open\n");
|
||||
dev_dbg(dev->hw_dev, "jr3_pci_open\n");
|
||||
for (i = 0; i < devpriv->n_channels; i++) {
|
||||
struct jr3_pci_subdev_private *p;
|
||||
|
||||
p = dev->subdevices[i].private;
|
||||
if (p) {
|
||||
printk("serial: %p %d (%d)\n", p, p->serial_no,
|
||||
p->channel_no);
|
||||
dev_dbg(dev->hw_dev, "serial: %p %d (%d)\n", p,
|
||||
p->serial_no, p->channel_no);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
@ -463,8 +457,8 @@ static int jr3_download_firmware(struct comedi_device *dev, const u8 * data,
|
|||
break;
|
||||
more = more
|
||||
&& read_idm_word(data, size, &pos, &addr);
|
||||
printk("Loading#%d %4.4x bytes at %4.4x\n", i,
|
||||
count, addr);
|
||||
dev_dbg(dev->hw_dev, "Loading#%d %4.4x bytes at %4.4x\n",
|
||||
i, count, addr);
|
||||
while (more && count > 0) {
|
||||
if (addr & 0x4000) {
|
||||
/* 16 bit data, never seen in real life!! */
|
||||
|
@ -599,24 +593,24 @@ static struct poll_delay_t jr3_pci_poll_subdevice(struct comedi_subdevice *s)
|
|||
min_full_scale =
|
||||
get_min_full_scales(channel);
|
||||
printk("Obtained Min. Full Scales:\n");
|
||||
printk("%i ", (min_full_scale).fx);
|
||||
printk("%i ", (min_full_scale).fy);
|
||||
printk("%i ", (min_full_scale).fz);
|
||||
printk("%i ", (min_full_scale).mx);
|
||||
printk("%i ", (min_full_scale).my);
|
||||
printk("%i ", (min_full_scale).mz);
|
||||
printk("\n");
|
||||
printk(KERN_DEBUG "%i ", (min_full_scale).fx);
|
||||
printk(KERN_CONT "%i ", (min_full_scale).fy);
|
||||
printk(KERN_CONT "%i ", (min_full_scale).fz);
|
||||
printk(KERN_CONT "%i ", (min_full_scale).mx);
|
||||
printk(KERN_CONT "%i ", (min_full_scale).my);
|
||||
printk(KERN_CONT "%i ", (min_full_scale).mz);
|
||||
printk(KERN_CONT "\n");
|
||||
|
||||
max_full_scale =
|
||||
get_max_full_scales(channel);
|
||||
printk("Obtained Max. Full Scales:\n");
|
||||
printk("%i ", (max_full_scale).fx);
|
||||
printk("%i ", (max_full_scale).fy);
|
||||
printk("%i ", (max_full_scale).fz);
|
||||
printk("%i ", (max_full_scale).mx);
|
||||
printk("%i ", (max_full_scale).my);
|
||||
printk("%i ", (max_full_scale).mz);
|
||||
printk("\n");
|
||||
printk(KERN_DEBUG "%i ", (max_full_scale).fx);
|
||||
printk(KERN_CONT "%i ", (max_full_scale).fy);
|
||||
printk(KERN_CONT "%i ", (max_full_scale).fz);
|
||||
printk(KERN_CONT "%i ", (max_full_scale).mx);
|
||||
printk(KERN_CONT "%i ", (max_full_scale).my);
|
||||
printk(KERN_CONT "%i ", (max_full_scale).mz);
|
||||
printk(KERN_CONT "\n");
|
||||
|
||||
set_full_scales(channel,
|
||||
max_full_scale);
|
||||
|
@ -779,14 +773,12 @@ static int jr3_pci_attach(struct comedi_device *dev,
|
|||
int opt_bus, opt_slot, i;
|
||||
struct jr3_pci_dev_private *devpriv;
|
||||
|
||||
printk("comedi%d: jr3_pci\n", dev->minor);
|
||||
|
||||
opt_bus = it->options[0];
|
||||
opt_slot = it->options[1];
|
||||
|
||||
if (sizeof(struct jr3_channel) != 0xc00) {
|
||||
printk("sizeof(struct jr3_channel) = %x [expected %x]\n",
|
||||
(unsigned)sizeof(struct jr3_channel), 0xc00);
|
||||
dev_err(dev->hw_dev, "sizeof(struct jr3_channel) = %x [expected %x]\n",
|
||||
(unsigned)sizeof(struct jr3_channel), 0xc00);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
@ -840,7 +832,7 @@ static int jr3_pci_attach(struct comedi_device *dev,
|
|||
}
|
||||
}
|
||||
if (!card) {
|
||||
printk(" no jr3_pci found\n");
|
||||
dev_err(dev->hw_dev, "no jr3_pci found\n");
|
||||
return -EIO;
|
||||
} else {
|
||||
devpriv->pci_dev = card;
|
||||
|
@ -875,10 +867,10 @@ static int jr3_pci_attach(struct comedi_device *dev,
|
|||
|
||||
p = dev->subdevices[i].private;
|
||||
p->channel = &devpriv->iobase->channel[i].data;
|
||||
printk("p->channel %p %p (%tx)\n",
|
||||
p->channel, devpriv->iobase,
|
||||
((char *)(p->channel) -
|
||||
(char *)(devpriv->iobase)));
|
||||
dev_dbg(dev->hw_dev, "p->channel %p %p (%tx)\n",
|
||||
p->channel, devpriv->iobase,
|
||||
((char *)(p->channel) -
|
||||
(char *)(devpriv->iobase)));
|
||||
p->channel_no = i;
|
||||
for (j = 0; j < 8; j++) {
|
||||
int k;
|
||||
|
@ -916,7 +908,7 @@ static int jr3_pci_attach(struct comedi_device *dev,
|
|||
devpriv->iobase->channel[0].reset = 0;
|
||||
|
||||
result = comedi_load_firmware(dev, "jr3pci.idm", jr3_download_firmware);
|
||||
printk("Firmare load %d\n", result);
|
||||
dev_dbg(dev->hw_dev, "Firmare load %d\n", result);
|
||||
|
||||
if (result < 0)
|
||||
goto out;
|
||||
|
@ -934,9 +926,9 @@ static int jr3_pci_attach(struct comedi_device *dev,
|
|||
*/
|
||||
msleep_interruptible(25);
|
||||
for (i = 0; i < 0x18; i++) {
|
||||
printk("%c",
|
||||
get_u16(&devpriv->iobase->channel[0].
|
||||
data.copyright[i]) >> 8);
|
||||
dev_dbg(dev->hw_dev, "%c\n",
|
||||
get_u16(&devpriv->iobase->channel[0].
|
||||
data.copyright[i]) >> 8);
|
||||
}
|
||||
|
||||
/* Start card timer */
|
||||
|
@ -963,7 +955,6 @@ static int jr3_pci_detach(struct comedi_device *dev)
|
|||
int i;
|
||||
struct jr3_pci_dev_private *devpriv = dev->private;
|
||||
|
||||
printk("comedi%d: jr3_pci: remove\n", dev->minor);
|
||||
if (devpriv) {
|
||||
del_timer_sync(&devpriv->timer);
|
||||
|
||||
|
|
|
@ -52,10 +52,8 @@ static int cnt_attach(struct comedi_device *dev, struct comedi_devconfig *it);
|
|||
static int cnt_detach(struct comedi_device *dev);
|
||||
|
||||
static DEFINE_PCI_DEVICE_TABLE(cnt_pci_table) = {
|
||||
{
|
||||
PCI_VENDOR_ID_KOLTER, CNT_CARD_DEVICE_ID, PCI_ANY_ID,
|
||||
PCI_ANY_ID, 0, 0, 0}, {
|
||||
0}
|
||||
{ PCI_DEVICE(PCI_VENDOR_ID_KOLTER, CNT_CARD_DEVICE_ID) },
|
||||
{0}
|
||||
};
|
||||
|
||||
MODULE_DEVICE_TABLE(pci, cnt_pci_table);
|
||||
|
|
|
@ -188,12 +188,9 @@ static const struct comedi_lrange me2600_ao_range = {
|
|||
};
|
||||
|
||||
static DEFINE_PCI_DEVICE_TABLE(me_pci_table) = {
|
||||
{
|
||||
PCI_VENDOR_ID_MEILHAUS, ME2600_DEVICE_ID, PCI_ANY_ID,
|
||||
PCI_ANY_ID, 0, 0, 0}, {
|
||||
PCI_VENDOR_ID_MEILHAUS, ME2000_DEVICE_ID, PCI_ANY_ID,
|
||||
PCI_ANY_ID, 0, 0, 0}, {
|
||||
0}
|
||||
{ PCI_DEVICE(PCI_VENDOR_ID_MEILHAUS, ME2600_DEVICE_ID) },
|
||||
{ PCI_DEVICE(PCI_VENDOR_ID_MEILHAUS, ME2000_DEVICE_ID) },
|
||||
{0}
|
||||
};
|
||||
|
||||
MODULE_DEVICE_TABLE(pci, me_pci_table);
|
||||
|
|
|
@ -731,9 +731,8 @@ static int a2150_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
|
|||
outw(trigger_bits, dev->iobase + TRIGGER_REG);
|
||||
|
||||
/* start acquisition for soft trigger */
|
||||
if (cmd->start_src == TRIG_NOW) {
|
||||
if (cmd->start_src == TRIG_NOW)
|
||||
outw(0, dev->iobase + FIFO_START_REG);
|
||||
}
|
||||
#ifdef A2150_DEBUG
|
||||
ni_dump_regs(dev);
|
||||
#endif
|
||||
|
@ -860,11 +859,10 @@ static int a2150_get_timing(struct comedi_device *dev, unsigned int *period,
|
|||
case TRIG_ROUND_NEAREST:
|
||||
default:
|
||||
/* if least upper bound is better approximation */
|
||||
if (lub - *period < *period - glb) {
|
||||
if (lub - *period < *period - glb)
|
||||
*period = lub;
|
||||
} else {
|
||||
else
|
||||
*period = glb;
|
||||
}
|
||||
break;
|
||||
case TRIG_ROUND_UP:
|
||||
*period = lub;
|
||||
|
|
|
@ -52,7 +52,7 @@ the PCMCIA interface.
|
|||
#include <pcmcia/cisreg.h>
|
||||
#include <pcmcia/ds.h>
|
||||
|
||||
static struct pcmcia_device *pcmcia_cur_dev = NULL;
|
||||
static struct pcmcia_device *pcmcia_cur_dev;
|
||||
|
||||
#define DIO24_SIZE 4 /* size of io region used by board */
|
||||
|
||||
|
@ -133,22 +133,19 @@ static int dio24_attach(struct comedi_device *dev, struct comedi_devconfig *it)
|
|||
#endif
|
||||
break;
|
||||
default:
|
||||
printk("bug! couldn't determine board type\n");
|
||||
pr_err("bug! couldn't determine board type\n");
|
||||
return -EINVAL;
|
||||
break;
|
||||
}
|
||||
printk("comedi%d: ni_daq_dio24: %s, io 0x%lx", dev->minor,
|
||||
thisboard->name, iobase);
|
||||
pr_debug("comedi%d: ni_daq_dio24: %s, io 0x%lx", dev->minor,
|
||||
thisboard->name, iobase);
|
||||
#ifdef incomplete
|
||||
if (irq) {
|
||||
printk(", irq %u", irq);
|
||||
}
|
||||
if (irq)
|
||||
pr_debug("irq %u\n", irq);
|
||||
#endif
|
||||
|
||||
printk("\n");
|
||||
|
||||
if (iobase == 0) {
|
||||
printk("io base address is zero!\n");
|
||||
pr_err("io base address is zero!\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
@ -173,7 +170,7 @@ static int dio24_attach(struct comedi_device *dev, struct comedi_devconfig *it)
|
|||
|
||||
static int dio24_detach(struct comedi_device *dev)
|
||||
{
|
||||
printk("comedi%d: ni_daq_dio24: remove\n", dev->minor);
|
||||
dev_info(dev->hw_dev, "comedi%d: ni_daq_dio24: remove\n", dev->minor);
|
||||
|
||||
if (dev->subdevices)
|
||||
subdev_8255_cleanup(dev, dev->subdevices + 0);
|
||||
|
|
|
@ -145,7 +145,7 @@ static int labpc_attach(struct comedi_device *dev, struct comedi_devconfig *it)
|
|||
irq = link->irq;
|
||||
break;
|
||||
default:
|
||||
printk("bug! couldn't determine board type\n");
|
||||
pr_err("bug! couldn't determine board type\n");
|
||||
return -EINVAL;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -1470,7 +1470,7 @@ static void m_series_stc_writew(struct comedi_device *dev, uint16_t data,
|
|||
/* FIXME: DIO_Output_Register (16 bit reg) is replaced by M_Offset_Static_Digital_Output (32 bit)
|
||||
and M_Offset_SCXI_Serial_Data_Out (8 bit) */
|
||||
default:
|
||||
printk("%s: bug! unhandled register=0x%x in switch.\n",
|
||||
printk(KERN_WARNING "%s: bug! unhandled register=0x%x in switch.\n",
|
||||
__func__, reg);
|
||||
BUG();
|
||||
return;
|
||||
|
@ -1505,7 +1505,7 @@ static uint16_t m_series_stc_readw(struct comedi_device *dev, int reg)
|
|||
offset = M_Offset_G01_Status;
|
||||
break;
|
||||
default:
|
||||
printk("%s: bug! unhandled register=0x%x in switch.\n",
|
||||
printk(KERN_WARNING "%s: bug! unhandled register=0x%x in switch.\n",
|
||||
__func__, reg);
|
||||
BUG();
|
||||
return 0;
|
||||
|
@ -1547,7 +1547,7 @@ static void m_series_stc_writel(struct comedi_device *dev, uint32_t data,
|
|||
offset = M_Offset_G1_Load_B;
|
||||
break;
|
||||
default:
|
||||
printk("%s: bug! unhandled register=0x%x in switch.\n",
|
||||
printk(KERN_WARNING "%s: bug! unhandled register=0x%x in switch.\n",
|
||||
__func__, reg);
|
||||
BUG();
|
||||
return;
|
||||
|
@ -1573,7 +1573,7 @@ static uint32_t m_series_stc_readl(struct comedi_device *dev, int reg)
|
|||
offset = M_Offset_G1_Save;
|
||||
break;
|
||||
default:
|
||||
printk("%s: bug! unhandled register=0x%x in switch.\n",
|
||||
printk(KERN_WARNING "%s: bug! unhandled register=0x%x in switch.\n",
|
||||
__func__, reg);
|
||||
BUG();
|
||||
return 0;
|
||||
|
@ -1632,9 +1632,8 @@ static void m_series_init_eeprom_buffer(struct comedi_device *dev)
|
|||
}
|
||||
devpriv->serial_number = be32_to_cpu(devpriv->serial_number);
|
||||
|
||||
for (i = 0; i < M_SERIES_EEPROM_SIZE; ++i) {
|
||||
for (i = 0; i < M_SERIES_EEPROM_SIZE; ++i)
|
||||
devpriv->eeprom_buffer[i] = ni_readb(Start_Cal_EEPROM + i);
|
||||
}
|
||||
|
||||
writel(old_iodwbsr1_bits, devpriv->mite->mite_io_addr + MITE_IODWBSR_1);
|
||||
writel(old_iodwbsr_bits, devpriv->mite->mite_io_addr + MITE_IODWBSR);
|
||||
|
@ -1665,9 +1664,9 @@ static void init_6143(struct comedi_device *dev)
|
|||
static int pcimio_detach(struct comedi_device *dev)
|
||||
{
|
||||
mio_common_detach(dev);
|
||||
if (dev->irq) {
|
||||
if (dev->irq)
|
||||
free_irq(dev->irq, dev);
|
||||
}
|
||||
|
||||
if (dev->private) {
|
||||
mite_free_ring(devpriv->ai_mite_ring);
|
||||
mite_free_ring(devpriv->ao_mite_ring);
|
||||
|
@ -1685,7 +1684,7 @@ static int pcimio_attach(struct comedi_device *dev, struct comedi_devconfig *it)
|
|||
{
|
||||
int ret;
|
||||
|
||||
printk("comedi%d: ni_pcimio:", dev->minor);
|
||||
dev_info(dev->hw_dev, "comedi%d: ni_pcimio:\n", dev->minor);
|
||||
|
||||
ret = ni_alloc_private(dev);
|
||||
if (ret < 0)
|
||||
|
@ -1695,7 +1694,7 @@ static int pcimio_attach(struct comedi_device *dev, struct comedi_devconfig *it)
|
|||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
printk(" %s", boardtype.name);
|
||||
dev_dbg(dev->hw_dev, "%s\n", boardtype.name);
|
||||
dev->board_name = boardtype.name;
|
||||
|
||||
if (boardtype.reg_type & ni_reg_m_series_mask) {
|
||||
|
@ -1712,7 +1711,7 @@ static int pcimio_attach(struct comedi_device *dev, struct comedi_devconfig *it)
|
|||
|
||||
ret = mite_setup(devpriv->mite);
|
||||
if (ret < 0) {
|
||||
printk(" error setting up mite\n");
|
||||
pr_warn("error setting up mite\n");
|
||||
return ret;
|
||||
}
|
||||
comedi_set_hw_dev(dev, &devpriv->mite->pcidev->dev);
|
||||
|
@ -1740,13 +1739,13 @@ static int pcimio_attach(struct comedi_device *dev, struct comedi_devconfig *it)
|
|||
dev->irq = mite_irq(devpriv->mite);
|
||||
|
||||
if (dev->irq == 0) {
|
||||
printk(" unknown irq (bad)\n");
|
||||
pr_warn("unknown irq (bad)\n");
|
||||
} else {
|
||||
printk(" ( irq = %u )", dev->irq);
|
||||
pr_debug("( irq = %u )\n", dev->irq);
|
||||
ret = request_irq(dev->irq, ni_E_interrupt, NI_E_IRQ_FLAGS,
|
||||
DRV_NAME, dev);
|
||||
if (ret < 0) {
|
||||
printk(" irq not available\n");
|
||||
pr_warn("irq not available\n");
|
||||
dev->irq = 0;
|
||||
}
|
||||
}
|
||||
|
@ -1787,7 +1786,7 @@ static int pcimio_find_device(struct comedi_device *dev, int bus, int slot)
|
|||
}
|
||||
}
|
||||
}
|
||||
printk("no device found\n");
|
||||
pr_warn("no device found\n");
|
||||
mite_list_devices();
|
||||
return -EIO;
|
||||
}
|
||||
|
|
|
@ -155,8 +155,8 @@ static int pcl816_attach(struct comedi_device *dev,
|
|||
static int pcl816_detach(struct comedi_device *dev);
|
||||
|
||||
#ifdef unused
|
||||
static int RTC_lock = 0; /* RTC lock */
|
||||
static int RTC_timer_lock = 0; /* RTC int lock */
|
||||
static int RTC_lock; /* RTC lock */
|
||||
static int RTC_timer_lock; /* RTC int lock */
|
||||
#endif
|
||||
|
||||
static struct comedi_driver driver_pcl816 = {
|
||||
|
|
|
@ -252,8 +252,8 @@ static int pcl818_attach(struct comedi_device *dev,
|
|||
static int pcl818_detach(struct comedi_device *dev);
|
||||
|
||||
#ifdef unused
|
||||
static int RTC_lock = 0; /* RTC lock */
|
||||
static int RTC_timer_lock = 0; /* RTC int lock */
|
||||
static int RTC_lock; /* RTC lock */
|
||||
static int RTC_timer_lock; /* RTC int lock */
|
||||
#endif
|
||||
|
||||
struct pcl818_board {
|
||||
|
@ -463,9 +463,8 @@ static int pcl818_ao_insn_read(struct comedi_device *dev,
|
|||
int n;
|
||||
int chan = CR_CHAN(insn->chanspec);
|
||||
|
||||
for (n = 0; n < insn->n; n++) {
|
||||
for (n = 0; n < insn->n; n++)
|
||||
data[n] = devpriv->ao_readback[chan];
|
||||
}
|
||||
|
||||
return n;
|
||||
}
|
||||
|
@ -571,9 +570,9 @@ static irqreturn_t interrupt_pcl818_ai_mode13_int(int irq, void *d)
|
|||
return IRQ_HANDLED;
|
||||
}
|
||||
devpriv->act_chanlist_pos++;
|
||||
if (devpriv->act_chanlist_pos >= devpriv->act_chanlist_len) {
|
||||
if (devpriv->act_chanlist_pos >= devpriv->act_chanlist_len)
|
||||
devpriv->act_chanlist_pos = 0;
|
||||
}
|
||||
|
||||
s->async->cur_chan++;
|
||||
if (s->async->cur_chan >= devpriv->ai_n_chan) {
|
||||
/* printk("E"); */
|
||||
|
@ -645,9 +644,9 @@ static irqreturn_t interrupt_pcl818_ai_mode13_dma(int irq, void *d)
|
|||
comedi_buf_put(s->async, ptr[bufptr++] >> 4); /* get one sample */
|
||||
|
||||
devpriv->act_chanlist_pos++;
|
||||
if (devpriv->act_chanlist_pos >= devpriv->act_chanlist_len) {
|
||||
if (devpriv->act_chanlist_pos >= devpriv->act_chanlist_len)
|
||||
devpriv->act_chanlist_pos = 0;
|
||||
}
|
||||
|
||||
s->async->cur_chan++;
|
||||
if (s->async->cur_chan >= devpriv->ai_n_chan) {
|
||||
s->async->cur_chan = 0;
|
||||
|
@ -805,11 +804,10 @@ static irqreturn_t interrupt_pcl818_ai_mode13_fifo(int irq, void *d)
|
|||
return IRQ_HANDLED;
|
||||
}
|
||||
|
||||
if (lo & 2) {
|
||||
if (lo & 2)
|
||||
len = 512;
|
||||
} else {
|
||||
else
|
||||
len = 0;
|
||||
}
|
||||
|
||||
for (i = 0; i < len; i++) {
|
||||
lo = inb(dev->iobase + PCL818_FI_DATALO);
|
||||
|
@ -827,9 +825,9 @@ static irqreturn_t interrupt_pcl818_ai_mode13_fifo(int irq, void *d)
|
|||
comedi_buf_put(s->async, (lo >> 4) | (inb(dev->iobase + PCL818_FI_DATAHI) << 4)); /* get one sample */
|
||||
|
||||
devpriv->act_chanlist_pos++;
|
||||
if (devpriv->act_chanlist_pos >= devpriv->act_chanlist_len) {
|
||||
if (devpriv->act_chanlist_pos >= devpriv->act_chanlist_len)
|
||||
devpriv->act_chanlist_pos = 0;
|
||||
}
|
||||
|
||||
s->async->cur_chan++;
|
||||
if (s->async->cur_chan >= devpriv->ai_n_chan) {
|
||||
s->async->cur_chan = 0;
|
||||
|
@ -1009,7 +1007,7 @@ static int pcl818_ai_cmd_mode(int mode, struct comedi_device *dev,
|
|||
int divisor1 = 0, divisor2 = 0;
|
||||
unsigned int seglen;
|
||||
|
||||
printk("pcl818_ai_cmd_mode()\n");
|
||||
dev_dbg(dev->hw_dev, "pcl818_ai_cmd_mode()\n");
|
||||
if ((!dev->irq) && (!devpriv->dma_rtc)) {
|
||||
comedi_error(dev, "IRQ not defined!");
|
||||
return -EINVAL;
|
||||
|
@ -1112,7 +1110,7 @@ static int pcl818_ai_cmd_mode(int mode, struct comedi_device *dev,
|
|||
break;
|
||||
}
|
||||
#endif
|
||||
printk("pcl818_ai_cmd_mode() end\n");
|
||||
dev_dbg(dev->hw_dev, "pcl818_ai_cmd_mode() end\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1309,11 +1307,9 @@ static void setup_channel_list(struct comedi_device *dev,
|
|||
*/
|
||||
static int check_single_ended(unsigned int port)
|
||||
{
|
||||
if (inb(port + PCL818_STATUS) & 0x20) {
|
||||
if (inb(port + PCL818_STATUS) & 0x20)
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1352,9 +1348,8 @@ static int ai_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s,
|
|||
if (!cmd->stop_src || tmp != cmd->stop_src)
|
||||
err++;
|
||||
|
||||
if (err) {
|
||||
if (err)
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* step 2: make sure trigger sources are unique and mutually compatible */
|
||||
|
||||
|
@ -1377,9 +1372,8 @@ static int ai_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s,
|
|||
if (cmd->stop_src != TRIG_NONE && cmd->stop_src != TRIG_COUNT)
|
||||
err++;
|
||||
|
||||
if (err) {
|
||||
if (err)
|
||||
return 2;
|
||||
}
|
||||
|
||||
/* step 3: make sure arguments are trivially compatible */
|
||||
|
||||
|
@ -1421,9 +1415,8 @@ static int ai_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s,
|
|||
}
|
||||
}
|
||||
|
||||
if (err) {
|
||||
if (err)
|
||||
return 3;
|
||||
}
|
||||
|
||||
/* step 4: fix up any arguments */
|
||||
|
||||
|
@ -1438,9 +1431,8 @@ static int ai_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s,
|
|||
err++;
|
||||
}
|
||||
|
||||
if (err) {
|
||||
if (err)
|
||||
return 4;
|
||||
}
|
||||
|
||||
/* step 5: complain about special chanlist considerations */
|
||||
|
||||
|
@ -1461,7 +1453,7 @@ static int ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
|
|||
struct comedi_cmd *cmd = &s->async->cmd;
|
||||
int retval;
|
||||
|
||||
printk("pcl818_ai_cmd()\n");
|
||||
dev_dbg(dev->hw_dev, "pcl818_ai_cmd()\n");
|
||||
devpriv->ai_n_chan = cmd->chanlist_len;
|
||||
devpriv->ai_chanlist = cmd->chanlist;
|
||||
devpriv->ai_flags = cmd->flags;
|
||||
|
@ -1470,17 +1462,16 @@ static int ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
|
|||
devpriv->ai_timer1 = 0;
|
||||
devpriv->ai_timer2 = 0;
|
||||
|
||||
if (cmd->stop_src == TRIG_COUNT) {
|
||||
if (cmd->stop_src == TRIG_COUNT)
|
||||
devpriv->ai_scans = cmd->stop_arg;
|
||||
} else {
|
||||
else
|
||||
devpriv->ai_scans = 0;
|
||||
}
|
||||
|
||||
if (cmd->scan_begin_src == TRIG_FOLLOW) { /* mode 1, 3 */
|
||||
if (cmd->convert_src == TRIG_TIMER) { /* mode 1 */
|
||||
devpriv->ai_timer1 = cmd->convert_arg;
|
||||
retval = pcl818_ai_cmd_mode(1, dev, s);
|
||||
printk("pcl818_ai_cmd() end\n");
|
||||
dev_dbg(dev->hw_dev, "pcl818_ai_cmd() end\n");
|
||||
return retval;
|
||||
}
|
||||
if (cmd->convert_src == TRIG_EXT) { /* mode 3 */
|
||||
|
@ -1499,7 +1490,7 @@ static int pcl818_ai_cancel(struct comedi_device *dev,
|
|||
struct comedi_subdevice *s)
|
||||
{
|
||||
if (devpriv->irq_blocked > 0) {
|
||||
printk("pcl818_ai_cancel()\n");
|
||||
dev_dbg(dev->hw_dev, "pcl818_ai_cancel()\n");
|
||||
devpriv->irq_was_now_closed = 1;
|
||||
|
||||
switch (devpriv->ai_mode) {
|
||||
|
@ -1549,7 +1540,7 @@ static int pcl818_ai_cancel(struct comedi_device *dev,
|
|||
}
|
||||
|
||||
end:
|
||||
printk("pcl818_ai_cancel() end\n");
|
||||
dev_dbg(dev->hw_dev, "pcl818_ai_cancel() end\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1633,11 +1624,11 @@ static int set_rtc_irq_bit(unsigned char bit)
|
|||
save_flags(flags);
|
||||
cli();
|
||||
val = CMOS_READ(RTC_CONTROL);
|
||||
if (bit) {
|
||||
if (bit)
|
||||
val |= RTC_PIE;
|
||||
} else {
|
||||
else
|
||||
val &= ~RTC_PIE;
|
||||
}
|
||||
|
||||
CMOS_WRITE(val, RTC_CONTROL);
|
||||
CMOS_READ(RTC_INTR_FLAGS);
|
||||
restore_flags(flags);
|
||||
|
@ -1754,22 +1745,23 @@ static int pcl818_attach(struct comedi_device *dev, struct comedi_devconfig *it)
|
|||
|
||||
/* claim our I/O space */
|
||||
iobase = it->options[0];
|
||||
printk("comedi%d: pcl818: board=%s, ioport=0x%03lx",
|
||||
dev->minor, this_board->name, iobase);
|
||||
printk
|
||||
("comedi%d: pcl818: board=%s, ioport=0x%03lx",
|
||||
dev->minor, this_board->name, iobase);
|
||||
devpriv->io_range = this_board->io_range;
|
||||
if ((this_board->fifo) && (it->options[2] == -1)) { /* we've board with FIFO and we want to use FIFO */
|
||||
devpriv->io_range = PCLx1xFIFO_RANGE;
|
||||
devpriv->usefifo = 1;
|
||||
}
|
||||
if (!request_region(iobase, devpriv->io_range, "pcl818")) {
|
||||
printk("I/O port conflict\n");
|
||||
comedi_error(dev, "I/O port conflict\n");
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
dev->iobase = iobase;
|
||||
|
||||
if (pcl818_check(iobase)) {
|
||||
printk(", I can't detect board. FAIL!\n");
|
||||
comedi_error(dev, "I can't detect board. FAIL!\n");
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
|
@ -1793,19 +1785,18 @@ static int pcl818_attach(struct comedi_device *dev, struct comedi_devconfig *it)
|
|||
irq);
|
||||
irq = 0; /* Can't use IRQ */
|
||||
} else {
|
||||
printk(", irq=%u", irq);
|
||||
printk(KERN_DEBUG "irq=%u", irq);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dev->irq = irq;
|
||||
if (irq) {
|
||||
devpriv->irq_free = 1;
|
||||
} /* 1=we have allocated irq */
|
||||
else {
|
||||
if (irq)
|
||||
devpriv->irq_free = 1; /* 1=we have allocated irq */
|
||||
else
|
||||
devpriv->irq_free = 0;
|
||||
}
|
||||
|
||||
devpriv->irq_blocked = 0; /* number of subdevice which use IRQ */
|
||||
devpriv->ai_mode = 0; /* mode of irq */
|
||||
|
||||
|
@ -1825,7 +1816,7 @@ static int pcl818_attach(struct comedi_device *dev, struct comedi_devconfig *it)
|
|||
"pcl818 DMA (RTC)", dev)) {
|
||||
devpriv->dma_rtc = 1;
|
||||
devpriv->rtc_irq = RTC_IRQ;
|
||||
printk(", dma_irq=%u", devpriv->rtc_irq);
|
||||
printk(KERN_DEBUG "dma_irq=%u", devpriv->rtc_irq);
|
||||
} else {
|
||||
RTC_lock--;
|
||||
if (RTC_lock == 0) {
|
||||
|
@ -1850,34 +1841,26 @@ static int pcl818_attach(struct comedi_device *dev, struct comedi_devconfig *it)
|
|||
if (dma < 1)
|
||||
goto no_dma; /* DMA disabled */
|
||||
if (((1 << dma) & this_board->DMAbits) == 0) {
|
||||
printk(", DMA is out of allowed range, FAIL!\n");
|
||||
printk(KERN_ERR "DMA is out of allowed range, FAIL!\n");
|
||||
return -EINVAL; /* Bad DMA */
|
||||
}
|
||||
ret = request_dma(dma, "pcl818");
|
||||
if (ret) {
|
||||
printk(", unable to allocate DMA %u, FAIL!\n", dma);
|
||||
if (ret)
|
||||
return -EBUSY; /* DMA isn't free */
|
||||
}
|
||||
devpriv->dma = dma;
|
||||
printk(", dma=%u", dma);
|
||||
pages = 2; /* we need 16KB */
|
||||
devpriv->dmabuf[0] = __get_dma_pages(GFP_KERNEL, pages);
|
||||
if (!devpriv->dmabuf[0]) {
|
||||
printk(", unable to allocate DMA buffer, FAIL!\n");
|
||||
if (!devpriv->dmabuf[0])
|
||||
/* maybe experiment with try_to_free_pages() will help .... */
|
||||
return -EBUSY; /* no buffer :-( */
|
||||
}
|
||||
devpriv->dmapages[0] = pages;
|
||||
devpriv->hwdmaptr[0] = virt_to_bus((void *)devpriv->dmabuf[0]);
|
||||
devpriv->hwdmasize[0] = (1 << pages) * PAGE_SIZE;
|
||||
/* printk("%d %d %ld, ",devpriv->dmapages[0],devpriv->hwdmasize[0],PAGE_SIZE); */
|
||||
if (devpriv->dma_rtc == 0) { /* we must do duble buff :-( */
|
||||
devpriv->dmabuf[1] = __get_dma_pages(GFP_KERNEL, pages);
|
||||
if (!devpriv->dmabuf[1]) {
|
||||
printk
|
||||
(", unable to allocate DMA buffer, FAIL!\n");
|
||||
if (!devpriv->dmabuf[1])
|
||||
return -EBUSY;
|
||||
}
|
||||
devpriv->dmapages[1] = pages;
|
||||
devpriv->hwdmaptr[1] =
|
||||
virt_to_bus((void *)devpriv->dmabuf[1]);
|
||||
|
@ -2017,11 +2000,10 @@ static int pcl818_attach(struct comedi_device *dev, struct comedi_devconfig *it)
|
|||
}
|
||||
|
||||
/* select 1/10MHz oscilator */
|
||||
if ((it->options[3] == 0) || (it->options[3] == 10)) {
|
||||
if ((it->options[3] == 0) || (it->options[3] == 10))
|
||||
devpriv->i8253_osc_base = 100;
|
||||
} else {
|
||||
else
|
||||
devpriv->i8253_osc_base = 1000;
|
||||
}
|
||||
|
||||
/* max sampling speed */
|
||||
devpriv->ns_min = this_board->ns_min;
|
||||
|
|
|
@ -371,15 +371,15 @@ static int pcmmio_attach(struct comedi_device *dev, struct comedi_devconfig *it)
|
|||
iobase = it->options[0];
|
||||
irq[0] = it->options[1];
|
||||
|
||||
printk(KERN_INFO "comedi%d: %s: io: %lx ", dev->minor, driver.driver_name,
|
||||
iobase);
|
||||
printk(KERN_INFO "comedi%d: %s: io: %lx attaching...\n", dev->minor,
|
||||
driver.driver_name, iobase);
|
||||
|
||||
dev->iobase = iobase;
|
||||
|
||||
if (!iobase || !request_region(iobase,
|
||||
thisboard->total_iosize,
|
||||
driver.driver_name)) {
|
||||
printk(KERN_ERR "I/O port conflict\n");
|
||||
printk(KERN_ERR "comedi%d: I/O port conflict\n", dev->minor);
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
|
@ -394,7 +394,8 @@ static int pcmmio_attach(struct comedi_device *dev, struct comedi_devconfig *it)
|
|||
* convenient macro defined in comedidev.h.
|
||||
*/
|
||||
if (alloc_private(dev, sizeof(struct pcmmio_private)) < 0) {
|
||||
printk(KERN_ERR "cannot allocate private data structure\n");
|
||||
printk(KERN_ERR "comedi%d: cannot allocate private data structure\n",
|
||||
dev->minor);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
|
@ -417,7 +418,8 @@ static int pcmmio_attach(struct comedi_device *dev, struct comedi_devconfig *it)
|
|||
kcalloc(n_subdevs, sizeof(struct pcmmio_subdev_private),
|
||||
GFP_KERNEL);
|
||||
if (!devpriv->sprivs) {
|
||||
printk(KERN_ERR "cannot allocate subdevice private data structures\n");
|
||||
printk(KERN_ERR "comedi%d: cannot allocate subdevice private data structures\n",
|
||||
dev->minor);
|
||||
return -ENOMEM;
|
||||
}
|
||||
/*
|
||||
|
@ -427,7 +429,8 @@ static int pcmmio_attach(struct comedi_device *dev, struct comedi_devconfig *it)
|
|||
* Allocate 1 AI + 1 AO + 2 DIO subdevs (24 lines per DIO)
|
||||
*/
|
||||
if (alloc_subdevices(dev, n_subdevs) < 0) {
|
||||
printk(KERN_ERR "cannot allocate subdevice data structures\n");
|
||||
printk(KERN_ERR "comedi%d: cannot allocate subdevice data structures\n",
|
||||
dev->minor);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
|
@ -557,14 +560,15 @@ static int pcmmio_attach(struct comedi_device *dev, struct comedi_devconfig *it)
|
|||
*/
|
||||
|
||||
if (irq[0]) {
|
||||
printk(KERN_DEBUG "irq: %u ", irq[0]);
|
||||
printk(KERN_DEBUG "comedi%d: irq: %u\n", dev->minor, irq[0]);
|
||||
if (thisboard->dio_num_asics == 2 && irq[1])
|
||||
printk(KERN_DEBUG "second ASIC irq: %u ", irq[1]);
|
||||
printk(KERN_DEBUG "comedi%d: second ASIC irq: %u\n",
|
||||
dev->minor, irq[1]);
|
||||
} else {
|
||||
printk(KERN_INFO "(IRQ mode disabled) ");
|
||||
printk(KERN_INFO "comedi%d: (IRQ mode disabled)\n", dev->minor);
|
||||
}
|
||||
|
||||
printk(KERN_INFO "attached\n");
|
||||
printk(KERN_INFO "comedi%d: attached\n", dev->minor);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -663,7 +667,7 @@ static int pcmmio_dio_insn_bits(struct comedi_device *dev,
|
|||
}
|
||||
#ifdef DAMMIT_ITS_BROKEN
|
||||
/* DEBUG */
|
||||
printk(KERN_DEBUG "data_out_byte %02x\n", (unsigned)byte);
|
||||
printk("data_out_byte %02x\n", (unsigned)byte);
|
||||
#endif
|
||||
/* save the digital input lines for this byte.. */
|
||||
s->state |= ((unsigned int)byte) << offset;
|
||||
|
|
|
@ -295,15 +295,15 @@ static int pcmuio_attach(struct comedi_device *dev, struct comedi_devconfig *it)
|
|||
irq[0] = it->options[1];
|
||||
irq[1] = it->options[2];
|
||||
|
||||
printk("comedi%d: %s: io: %lx ", dev->minor, driver.driver_name,
|
||||
iobase);
|
||||
dev_dbg(dev->hw_dev, "comedi%d: %s: io: %lx attached\n", dev->minor,
|
||||
driver.driver_name, iobase);
|
||||
|
||||
dev->iobase = iobase;
|
||||
|
||||
if (!iobase || !request_region(iobase,
|
||||
thisboard->num_asics * ASIC_IOSIZE,
|
||||
driver.driver_name)) {
|
||||
printk("I/O port conflict\n");
|
||||
dev_err(dev->hw_dev, "I/O port conflict\n");
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
|
@ -318,7 +318,7 @@ static int pcmuio_attach(struct comedi_device *dev, struct comedi_devconfig *it)
|
|||
* convenient macro defined in comedidev.h.
|
||||
*/
|
||||
if (alloc_private(dev, sizeof(struct pcmuio_private)) < 0) {
|
||||
printk("cannot allocate private data structure\n");
|
||||
dev_warn(dev->hw_dev, "cannot allocate private data structure\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
|
@ -337,7 +337,7 @@ static int pcmuio_attach(struct comedi_device *dev, struct comedi_devconfig *it)
|
|||
kcalloc(n_subdevs, sizeof(struct pcmuio_subdev_private),
|
||||
GFP_KERNEL);
|
||||
if (!devpriv->sprivs) {
|
||||
printk("cannot allocate subdevice private data structures\n");
|
||||
dev_warn(dev->hw_dev, "cannot allocate subdevice private data structures\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
/*
|
||||
|
@ -348,7 +348,7 @@ static int pcmuio_attach(struct comedi_device *dev, struct comedi_devconfig *it)
|
|||
* 96-channel version of the board.
|
||||
*/
|
||||
if (alloc_subdevices(dev, n_subdevs) < 0) {
|
||||
printk("cannot allocate subdevice data structures\n");
|
||||
dev_dbg(dev->hw_dev, "cannot allocate subdevice data structures\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
|
@ -436,14 +436,13 @@ static int pcmuio_attach(struct comedi_device *dev, struct comedi_devconfig *it)
|
|||
irqs.. */
|
||||
|
||||
if (irq[0]) {
|
||||
printk("irq: %u ", irq[0]);
|
||||
dev_dbg(dev->hw_dev, "irq: %u\n", irq[0]);
|
||||
if (irq[1] && thisboard->num_asics == 2)
|
||||
printk("second ASIC irq: %u ", irq[1]);
|
||||
dev_dbg(dev->hw_dev, "second ASIC irq: %u\n", irq[1]);
|
||||
} else {
|
||||
printk("(IRQ mode disabled) ");
|
||||
dev_dbg(dev->hw_dev, "(IRQ mode disabled)\n");
|
||||
}
|
||||
|
||||
printk("attached\n");
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -460,7 +459,8 @@ static int pcmuio_detach(struct comedi_device *dev)
|
|||
{
|
||||
int i;
|
||||
|
||||
printk("comedi%d: %s: remove\n", dev->minor, driver.driver_name);
|
||||
dev_dbg(dev->hw_dev, "comedi%d: %s: remove\n", dev->minor,
|
||||
driver.driver_name);
|
||||
if (dev->iobase)
|
||||
release_region(dev->iobase, ASIC_IOSIZE * thisboard->num_asics);
|
||||
|
||||
|
@ -501,7 +501,8 @@ static int pcmuio_dio_insn_bits(struct comedi_device *dev,
|
|||
|
||||
#ifdef DAMMIT_ITS_BROKEN
|
||||
/* DEBUG */
|
||||
printk("write mask: %08x data: %08x\n", data[0], data[1]);
|
||||
dev_dbg(dev->hw_dev, "write mask: %08x data: %08x\n", data[0],
|
||||
data[1]);
|
||||
#endif
|
||||
|
||||
s->state = 0;
|
||||
|
@ -537,7 +538,7 @@ static int pcmuio_dio_insn_bits(struct comedi_device *dev,
|
|||
}
|
||||
#ifdef DAMMIT_ITS_BROKEN
|
||||
/* DEBUG */
|
||||
printk("data_out_byte %02x\n", (unsigned)byte);
|
||||
dev_dbg(dev->hw_dev, "data_out_byte %02x\n", (unsigned)byte);
|
||||
#endif
|
||||
/* save the digital input lines for this byte.. */
|
||||
s->state |= ((unsigned int)byte) << offset;
|
||||
|
@ -548,7 +549,8 @@ static int pcmuio_dio_insn_bits(struct comedi_device *dev,
|
|||
|
||||
#ifdef DAMMIT_ITS_BROKEN
|
||||
/* DEBUG */
|
||||
printk("s->state %08x data_out %08x\n", s->state, data[1]);
|
||||
dev_dbg(dev->hw_dev, "s->state %08x data_out %08x\n", s->state,
|
||||
data[1]);
|
||||
#endif
|
||||
|
||||
return 2;
|
||||
|
@ -951,14 +953,13 @@ pcmuio_inttrig_start_intr(struct comedi_device *dev, struct comedi_subdevice *s,
|
|||
|
||||
spin_lock_irqsave(&subpriv->intr.spinlock, flags);
|
||||
s->async->inttrig = 0;
|
||||
if (subpriv->intr.active) {
|
||||
if (subpriv->intr.active)
|
||||
event = pcmuio_start_intr(dev, s);
|
||||
}
|
||||
|
||||
spin_unlock_irqrestore(&subpriv->intr.spinlock, flags);
|
||||
|
||||
if (event) {
|
||||
if (event)
|
||||
comedi_event(dev, s);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -1000,9 +1001,8 @@ static int pcmuio_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
|
|||
}
|
||||
spin_unlock_irqrestore(&subpriv->intr.spinlock, flags);
|
||||
|
||||
if (event) {
|
||||
if (event)
|
||||
comedi_event(dev, s);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -824,7 +824,7 @@ static int serial2002_attach(struct comedi_device *dev,
|
|||
{
|
||||
struct comedi_subdevice *s;
|
||||
|
||||
printk("comedi%d: serial2002: ", dev->minor);
|
||||
dev_dbg(dev->hw_dev, "comedi%d: attached\n", dev->minor);
|
||||
dev->board_name = thisboard->name;
|
||||
if (alloc_private(dev, sizeof(struct serial2002_private)) < 0)
|
||||
return -ENOMEM;
|
||||
|
@ -832,7 +832,8 @@ static int serial2002_attach(struct comedi_device *dev,
|
|||
dev->close = serial_2002_close;
|
||||
devpriv->port = it->options[0];
|
||||
devpriv->speed = it->options[1];
|
||||
printk("/dev/ttyS%d @ %d\n", devpriv->port, devpriv->speed);
|
||||
dev_dbg(dev->hw_dev, "/dev/ttyS%d @ %d\n", devpriv->port,
|
||||
devpriv->speed);
|
||||
|
||||
if (alloc_subdevices(dev, 5) < 0)
|
||||
return -ENOMEM;
|
||||
|
@ -891,7 +892,7 @@ static int serial2002_detach(struct comedi_device *dev)
|
|||
struct comedi_subdevice *s;
|
||||
int i;
|
||||
|
||||
printk("comedi%d: serial2002: remove\n", dev->minor);
|
||||
dev_dbg(dev->hw_dev, "comedi%d: remove\n", dev->minor);
|
||||
for (i = 0; i < 5; i++) {
|
||||
s = &dev->subdevices[i];
|
||||
kfree(s->maxdata_list);
|
||||
|
|
|
@ -1524,15 +1524,17 @@ static int usbdux_ao_inttrig(struct comedi_device *dev,
|
|||
return -EFAULT;
|
||||
|
||||
down(&this_usbduxsub->sem);
|
||||
|
||||
if (!(this_usbduxsub->probed)) {
|
||||
up(&this_usbduxsub->sem);
|
||||
return -ENODEV;
|
||||
ret = -ENODEV;
|
||||
goto out;
|
||||
}
|
||||
if (trignum != 0) {
|
||||
dev_err(&this_usbduxsub->interface->dev,
|
||||
"comedi%d: usbdux_ao_inttrig: invalid trignum\n",
|
||||
dev->minor);
|
||||
return -EINVAL;
|
||||
ret = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
if (!(this_usbduxsub->ao_cmd_running)) {
|
||||
this_usbduxsub->ao_cmd_running = 1;
|
||||
|
@ -1542,8 +1544,7 @@ static int usbdux_ao_inttrig(struct comedi_device *dev,
|
|||
"comedi%d: usbdux_ao_inttrig: submitURB: "
|
||||
"err=%d\n", dev->minor, ret);
|
||||
this_usbduxsub->ao_cmd_running = 0;
|
||||
up(&this_usbduxsub->sem);
|
||||
return ret;
|
||||
goto out;
|
||||
}
|
||||
s->async->inttrig = NULL;
|
||||
} else {
|
||||
|
@ -1551,8 +1552,10 @@ static int usbdux_ao_inttrig(struct comedi_device *dev,
|
|||
"comedi%d: ao_inttrig but acqu is already running.\n",
|
||||
dev->minor);
|
||||
}
|
||||
ret = 1;
|
||||
out:
|
||||
up(&this_usbduxsub->sem);
|
||||
return 1;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int usbdux_ao_cmdtest(struct comedi_device *dev,
|
||||
|
@ -2689,6 +2692,7 @@ static int usbduxsigma_attach(struct comedi_device *dev,
|
|||
if (ret < 0) {
|
||||
dev_err(&udev->interface->dev,
|
||||
"comedi%d: no space for subdev\n", dev->minor);
|
||||
up(&udev->sem);
|
||||
up(&start_stop_sem);
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -296,43 +296,79 @@ enum {
|
|||
vdecColourPrimariesSMPTE240M,
|
||||
vdecColourPrimariesGenericFilm,
|
||||
};
|
||||
|
||||
/**
|
||||
* @vdecRESOLUTION_CUSTOM: custom
|
||||
* @vdecRESOLUTION_480i: 480i
|
||||
* @vdecRESOLUTION_1080i: 1080i (1920x1080, 60i)
|
||||
* @vdecRESOLUTION_NTSC: NTSC (720x483, 60i)
|
||||
* @vdecRESOLUTION_480p: 480p (720x480, 60p)
|
||||
* @vdecRESOLUTION_720p: 720p (1280x720, 60p)
|
||||
* @vdecRESOLUTION_PAL1: PAL_1 (720x576, 50i)
|
||||
* @vdecRESOLUTION_1080i25: 1080i25 (1920x1080, 50i)
|
||||
* @vdecRESOLUTION_720p50: 720p50 (1280x720, 50p)
|
||||
* @vdecRESOLUTION_576p: 576p (720x576, 50p)
|
||||
* @vdecRESOLUTION_1080i29_97: 1080i (1920x1080, 59.94i)
|
||||
* @vdecRESOLUTION_720p59_94: 720p (1280x720, 59.94p)
|
||||
* @vdecRESOLUTION_SD_DVD: SD DVD (720x483, 60i)
|
||||
* @vdecRESOLUTION_480p656: 480p (720x480, 60p),
|
||||
* output bus width 8 bit, clock 74.25MHz
|
||||
* @vdecRESOLUTION_1080p23_976: 1080p23_976 (1920x1080, 23.976p)
|
||||
* @vdecRESOLUTION_720p23_976: 720p23_976 (1280x720p, 23.976p)
|
||||
* @vdecRESOLUTION_240p29_97: 240p (1440x240, 29.97p )
|
||||
* @vdecRESOLUTION_240p30: 240p (1440x240, 30p)
|
||||
* @vdecRESOLUTION_288p25: 288p (1440x288p, 25p)
|
||||
* @vdecRESOLUTION_1080p29_97: 1080p29_97 (1920x1080, 29.97p)
|
||||
* @vdecRESOLUTION_1080p30: 1080p30 (1920x1080, 30p)
|
||||
* @vdecRESOLUTION_1080p24: 1080p24 (1920x1080, 24p)
|
||||
* @vdecRESOLUTION_1080p25: 1080p25 (1920x1080, 25p)
|
||||
* @vdecRESOLUTION_720p24: 720p24 (1280x720, 25p)
|
||||
* @vdecRESOLUTION_720p29_97: 720p29.97 (1280x720, 29.97p)
|
||||
* @vdecRESOLUTION_480p23_976: 480p23.976 (720*480, 23.976)
|
||||
* @vdecRESOLUTION_480p29_97: 480p29.976 (720*480, 29.97p)
|
||||
* @vdecRESOLUTION_576p25: 576p25 (720*576, 25p)
|
||||
* @vdecRESOLUTION_480p0: 480p (720x480, 0p)
|
||||
* @vdecRESOLUTION_480i0: 480i (720x480, 0i)
|
||||
* @vdecRESOLUTION_576p0: 576p (720x576, 0p)
|
||||
* @vdecRESOLUTION_720p0: 720p (1280x720, 0p)
|
||||
* @vdecRESOLUTION_1080p0: 1080p (1920x1080, 0p)
|
||||
* @vdecRESOLUTION_1080i0: 1080i (1920x1080, 0i)
|
||||
*/
|
||||
enum {
|
||||
vdecRESOLUTION_CUSTOM = 0x00000000, /* custom */
|
||||
vdecRESOLUTION_480i = 0x00000001, /* 480i */
|
||||
vdecRESOLUTION_1080i = 0x00000002, /* 1080i (1920x1080, 60i) */
|
||||
vdecRESOLUTION_NTSC = 0x00000003, /* NTSC (720x483, 60i) */
|
||||
vdecRESOLUTION_480p = 0x00000004, /* 480p (720x480, 60p) */
|
||||
vdecRESOLUTION_720p = 0x00000005, /* 720p (1280x720, 60p) */
|
||||
vdecRESOLUTION_PAL1 = 0x00000006, /* PAL_1 (720x576, 50i) */
|
||||
vdecRESOLUTION_1080i25 = 0x00000007, /* 1080i25 (1920x1080, 50i) */
|
||||
vdecRESOLUTION_720p50 = 0x00000008, /* 720p50 (1280x720, 50p) */
|
||||
vdecRESOLUTION_576p = 0x00000009, /* 576p (720x576, 50p) */
|
||||
vdecRESOLUTION_1080i29_97 = 0x0000000A, /* 1080i (1920x1080, 59.94i) */
|
||||
vdecRESOLUTION_720p59_94 = 0x0000000B, /* 720p (1280x720, 59.94p) */
|
||||
vdecRESOLUTION_SD_DVD = 0x0000000C, /* SD DVD (720x483, 60i) */
|
||||
vdecRESOLUTION_480p656 = 0x0000000D, /* 480p (720x480, 60p), output bus width 8 bit, clock 74.25MHz */
|
||||
vdecRESOLUTION_1080p23_976 = 0x0000000E, /* 1080p23_976 (1920x1080, 23.976p) */
|
||||
vdecRESOLUTION_720p23_976 = 0x0000000F, /* 720p23_976 (1280x720p, 23.976p) */
|
||||
vdecRESOLUTION_240p29_97 = 0x00000010, /* 240p (1440x240, 29.97p ) */
|
||||
vdecRESOLUTION_240p30 = 0x00000011, /* 240p (1440x240, 30p) */
|
||||
vdecRESOLUTION_288p25 = 0x00000012, /* 288p (1440x288p, 25p) */
|
||||
vdecRESOLUTION_1080p29_97 = 0x00000013, /* 1080p29_97 (1920x1080, 29.97p) */
|
||||
vdecRESOLUTION_1080p30 = 0x00000014, /* 1080p30 (1920x1080, 30p) */
|
||||
vdecRESOLUTION_1080p24 = 0x00000015, /* 1080p24 (1920x1080, 24p) */
|
||||
vdecRESOLUTION_1080p25 = 0x00000016, /* 1080p25 (1920x1080, 25p) */
|
||||
vdecRESOLUTION_720p24 = 0x00000017, /* 720p24 (1280x720, 25p) */
|
||||
vdecRESOLUTION_720p29_97 = 0x00000018, /* 720p29.97 (1280x720, 29.97p) */
|
||||
vdecRESOLUTION_480p23_976 = 0x00000019, /* 480p23.976 (720*480, 23.976) */
|
||||
vdecRESOLUTION_480p29_97 = 0x0000001A, /* 480p29.976 (720*480, 29.97p) */
|
||||
vdecRESOLUTION_576p25 = 0x0000001B, /* 576p25 (720*576, 25p) */
|
||||
vdecRESOLUTION_CUSTOM = 0x00000000,
|
||||
vdecRESOLUTION_480i = 0x00000001,
|
||||
vdecRESOLUTION_1080i = 0x00000002,
|
||||
vdecRESOLUTION_NTSC = 0x00000003,
|
||||
vdecRESOLUTION_480p = 0x00000004,
|
||||
vdecRESOLUTION_720p = 0x00000005,
|
||||
vdecRESOLUTION_PAL1 = 0x00000006,
|
||||
vdecRESOLUTION_1080i25 = 0x00000007,
|
||||
vdecRESOLUTION_720p50 = 0x00000008,
|
||||
vdecRESOLUTION_576p = 0x00000009,
|
||||
vdecRESOLUTION_1080i29_97 = 0x0000000A,
|
||||
vdecRESOLUTION_720p59_94 = 0x0000000B,
|
||||
vdecRESOLUTION_SD_DVD = 0x0000000C,
|
||||
vdecRESOLUTION_480p656 = 0x0000000D,
|
||||
vdecRESOLUTION_1080p23_976 = 0x0000000E,
|
||||
vdecRESOLUTION_720p23_976 = 0x0000000F,
|
||||
vdecRESOLUTION_240p29_97 = 0x00000010,
|
||||
vdecRESOLUTION_240p30 = 0x00000011,
|
||||
vdecRESOLUTION_288p25 = 0x00000012,
|
||||
vdecRESOLUTION_1080p29_97 = 0x00000013,
|
||||
vdecRESOLUTION_1080p30 = 0x00000014,
|
||||
vdecRESOLUTION_1080p24 = 0x00000015,
|
||||
vdecRESOLUTION_1080p25 = 0x00000016,
|
||||
vdecRESOLUTION_720p24 = 0x00000017,
|
||||
vdecRESOLUTION_720p29_97 = 0x00000018,
|
||||
vdecRESOLUTION_480p23_976 = 0x00000019,
|
||||
vdecRESOLUTION_480p29_97 = 0x0000001A,
|
||||
vdecRESOLUTION_576p25 = 0x0000001B,
|
||||
/* For Zero Frame Rate */
|
||||
vdecRESOLUTION_480p0 = 0x0000001C, /* 480p (720x480, 0p) */
|
||||
vdecRESOLUTION_480i0 = 0x0000001D, /* 480i (720x480, 0i) */
|
||||
vdecRESOLUTION_576p0 = 0x0000001E, /* 576p (720x576, 0p) */
|
||||
vdecRESOLUTION_720p0 = 0x0000001F, /* 720p (1280x720, 0p) */
|
||||
vdecRESOLUTION_1080p0 = 0x00000020, /* 1080p (1920x1080, 0p) */
|
||||
vdecRESOLUTION_1080i0 = 0x00000021, /* 1080i (1920x1080, 0i) */
|
||||
vdecRESOLUTION_480p0 = 0x0000001C,
|
||||
vdecRESOLUTION_480i0 = 0x0000001D,
|
||||
vdecRESOLUTION_576p0 = 0x0000001E,
|
||||
vdecRESOLUTION_720p0 = 0x0000001F,
|
||||
vdecRESOLUTION_1080p0 = 0x00000020,
|
||||
vdecRESOLUTION_1080i0 = 0x00000021,
|
||||
};
|
||||
|
||||
/* Bit definitions for 'flags' field */
|
||||
|
@ -359,14 +395,23 @@ enum _BC_OUTPUT_FORMAT {
|
|||
MODE422_YUY2 = 0x1,
|
||||
MODE422_UYVY = 0x2,
|
||||
};
|
||||
|
||||
/**
|
||||
* struct BC_PIC_INFO_BLOCK
|
||||
* @timeStam;: Timestamp
|
||||
* @picture_number: Ordinal display number
|
||||
* @width: pixels
|
||||
* @height: pixels
|
||||
* @chroma_format: 0x420, 0x422 or 0x444
|
||||
* @n_drop;: number of non-reference frames
|
||||
* remaining to be dropped
|
||||
*/
|
||||
struct BC_PIC_INFO_BLOCK {
|
||||
/* Common fields. */
|
||||
uint64_t timeStamp; /* Timestamp */
|
||||
uint32_t picture_number; /* Ordinal display number */
|
||||
uint32_t width; /* pixels */
|
||||
uint32_t height; /* pixels */
|
||||
uint32_t chroma_format; /* 0x420, 0x422 or 0x444 */
|
||||
uint64_t timeStamp;
|
||||
uint32_t picture_number;
|
||||
uint32_t width;
|
||||
uint32_t height;
|
||||
uint32_t chroma_format;
|
||||
uint32_t pulldown;
|
||||
uint32_t flags;
|
||||
uint32_t frame_rate;
|
||||
|
@ -376,7 +421,8 @@ struct BC_PIC_INFO_BLOCK {
|
|||
uint32_t sess_num;
|
||||
uint32_t ycom;
|
||||
uint32_t custom_aspect_ratio_width_height;
|
||||
uint32_t n_drop; /* number of non-reference frames remaining to be dropped */
|
||||
uint32_t n_drop; /* number of non-reference frames
|
||||
remaining to be dropped */
|
||||
|
||||
/* Protocol-specific extensions. */
|
||||
union {
|
||||
|
@ -390,43 +436,71 @@ struct BC_PIC_INFO_BLOCK {
|
|||
/*------------------------------------------------------*
|
||||
* ProcOut Info *
|
||||
*------------------------------------------------------*/
|
||||
/* Optional flags for ProcOut Interface.*/
|
||||
|
||||
/**
|
||||
* enum POUT_OPTIONAL_IN_FLAGS - Optional flags for ProcOut Interface.
|
||||
* @BC_POUT_FLAGS_YV12: Copy Data in YV12 format
|
||||
* @BC_POUT_FLAGS_STRIDE: Stride size is valid.
|
||||
* @BC_POUT_FLAGS_SIZE: Take size information from Application
|
||||
* @BC_POUT_FLAGS_INTERLACED: copy only half the bytes
|
||||
* @BC_POUT_FLAGS_INTERLEAVED: interleaved frame
|
||||
* @: * @BC_POUT_FLAGS_FMT_CHANGE: Data is not VALID when this flag is set
|
||||
* @BC_POUT_FLAGS_PIB_VALID: PIB Information valid
|
||||
* @BC_POUT_FLAGS_ENCRYPTED: Data is encrypted.
|
||||
* @BC_POUT_FLAGS_FLD_BOT: Bottom Field data
|
||||
*/
|
||||
enum POUT_OPTIONAL_IN_FLAGS_ {
|
||||
/* Flags from App to Device */
|
||||
BC_POUT_FLAGS_YV12 = 0x01, /* Copy Data in YV12 format */
|
||||
BC_POUT_FLAGS_STRIDE = 0x02, /* Stride size is valid. */
|
||||
BC_POUT_FLAGS_SIZE = 0x04, /* Take size information from Application */
|
||||
BC_POUT_FLAGS_INTERLACED = 0x08, /* copy only half the bytes */
|
||||
BC_POUT_FLAGS_INTERLEAVED = 0x10, /* interleaved frame */
|
||||
BC_POUT_FLAGS_YV12 = 0x01,
|
||||
BC_POUT_FLAGS_STRIDE = 0x02,
|
||||
BC_POUT_FLAGS_SIZE = 0x04,
|
||||
BC_POUT_FLAGS_INTERLACED = 0x08,
|
||||
BC_POUT_FLAGS_INTERLEAVED = 0x10,
|
||||
|
||||
/* Flags from Device to APP */
|
||||
BC_POUT_FLAGS_FMT_CHANGE = 0x10000, /* Data is not VALID when this flag is set */
|
||||
BC_POUT_FLAGS_PIB_VALID = 0x20000, /* PIB Information valid */
|
||||
BC_POUT_FLAGS_ENCRYPTED = 0x40000, /* Data is encrypted. */
|
||||
BC_POUT_FLAGS_FLD_BOT = 0x80000, /* Bottom Field data */
|
||||
BC_POUT_FLAGS_FMT_CHANGE = 0x10000,
|
||||
BC_POUT_FLAGS_PIB_VALID = 0x20000,
|
||||
BC_POUT_FLAGS_ENCRYPTED = 0x40000,
|
||||
BC_POUT_FLAGS_FLD_BOT = 0x80000,
|
||||
};
|
||||
|
||||
typedef enum BC_STATUS(*dts_pout_callback)(void *shnd, uint32_t width, uint32_t height, uint32_t stride, void *pOut);
|
||||
typedef enum BC_STATUS(*dts_pout_callback)(void *shnd, uint32_t width,
|
||||
uint32_t height, uint32_t stride, void *pOut);
|
||||
|
||||
/* Line 21 Closed Caption */
|
||||
/* User Data */
|
||||
#define MAX_UD_SIZE 1792 /* 1920 - 128 */
|
||||
|
||||
/**
|
||||
* struct BC_DTS_PROC_OUT
|
||||
* @Ybuff: Caller Supplied buffer for Y data
|
||||
* @YbuffSz: Caller Supplied Y buffer size
|
||||
* @YBuffDoneSz: Transferred Y datasize
|
||||
* @*UVbuff: Caller Supplied buffer for UV data
|
||||
* @UVbuffSz: Caller Supplied UV buffer size
|
||||
* @UVBuffDoneSz: Transferred UV data size
|
||||
* @StrideSz: Caller supplied Stride Size
|
||||
* @PoutFlags: Call IN Flags
|
||||
* @discCnt: Picture discontinuity count
|
||||
* @PicInfo: Picture Information Block Data
|
||||
* @b422Mode: Picture output Mode
|
||||
* @bPibEnc: PIB encrypted
|
||||
*/
|
||||
struct BC_DTS_PROC_OUT {
|
||||
uint8_t *Ybuff; /* Caller Supplied buffer for Y data */
|
||||
uint32_t YbuffSz; /* Caller Supplied Y buffer size */
|
||||
uint32_t YBuffDoneSz; /* Transferred Y datasize */
|
||||
uint8_t *Ybuff;
|
||||
uint32_t YbuffSz;
|
||||
uint32_t YBuffDoneSz;
|
||||
|
||||
uint8_t *UVbuff; /* Caller Supplied buffer for UV data */
|
||||
uint32_t UVbuffSz; /* Caller Supplied UV buffer size */
|
||||
uint32_t UVBuffDoneSz; /* Transferred UV data size */
|
||||
uint8_t *UVbuff;
|
||||
uint32_t UVbuffSz;
|
||||
uint32_t UVBuffDoneSz;
|
||||
|
||||
uint32_t StrideSz; /* Caller supplied Stride Size */
|
||||
uint32_t PoutFlags; /* Call IN Flags */
|
||||
uint32_t StrideSz;
|
||||
uint32_t PoutFlags;
|
||||
|
||||
uint32_t discCnt; /* Picture discontinuity count */
|
||||
uint32_t discCnt;
|
||||
|
||||
struct BC_PIC_INFO_BLOCK PicInfo; /* Picture Information Block Data */
|
||||
struct BC_PIC_INFO_BLOCK PicInfo;
|
||||
|
||||
/* Line 21 Closed Caption */
|
||||
/* User Data */
|
||||
|
@ -436,39 +510,47 @@ struct BC_DTS_PROC_OUT {
|
|||
void *hnd;
|
||||
dts_pout_callback AppCallBack;
|
||||
uint8_t DropFrames;
|
||||
uint8_t b422Mode; /* Picture output Mode */
|
||||
uint8_t bPibEnc; /* PIB encrypted */
|
||||
uint8_t b422Mode;
|
||||
uint8_t bPibEnc;
|
||||
uint8_t bRevertScramble;
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* struct BC_DTS_STATUS
|
||||
* @ReadyListCount: Number of frames in ready list (reported by driver)
|
||||
* @PowerStateChange: Number of active state power
|
||||
* transitions (reported by driver)
|
||||
* @FramesDropped: Number of frames dropped. (reported by DIL)
|
||||
* @FramesCaptured: Number of frames captured. (reported by DIL)
|
||||
* @FramesRepeated: Number of frames repeated. (reported by DIL)
|
||||
* @InputCount: Times compressed video has been sent to the HW.
|
||||
* i.e. Successful DtsProcInput() calls (reported by DIL)
|
||||
* @InputTotalSize: Amount of compressed video that has been sent to the HW.
|
||||
* (reported by DIL)
|
||||
* @InputBusyCount: Times compressed video has attempted to be sent to the HW
|
||||
* but the input FIFO was full. (reported by DIL)
|
||||
* @PIBMissCount: Amount of times a PIB is invalid. (reported by DIL)
|
||||
* @cpbEmptySize: supported only for H.264, specifically changed for
|
||||
* Adobe. Report size of CPB buffer available. (reported by DIL)
|
||||
* @NextTimeStamp: TimeStamp of the next picture that will be returned
|
||||
* by a call to ProcOutput. Added for Adobe. Reported
|
||||
* back from the driver
|
||||
*/
|
||||
struct BC_DTS_STATUS {
|
||||
uint8_t ReadyListCount; /* Number of frames in ready list (reported by driver) */
|
||||
uint8_t FreeListCount; /* Number of frame buffers free. (reported by driver) */
|
||||
uint8_t PowerStateChange; /* Number of active state power transitions (reported by driver) */
|
||||
uint8_t ReadyListCount;
|
||||
uint8_t FreeListCount;
|
||||
uint8_t PowerStateChange;
|
||||
uint8_t reserved_[1];
|
||||
|
||||
uint32_t FramesDropped; /* Number of frames dropped. (reported by DIL) */
|
||||
uint32_t FramesCaptured; /* Number of frames captured. (reported by DIL) */
|
||||
uint32_t FramesRepeated; /* Number of frames repeated. (reported by DIL) */
|
||||
|
||||
uint32_t InputCount; /* Times compressed video has been sent to the HW.
|
||||
* i.e. Successful DtsProcInput() calls (reported by DIL) */
|
||||
uint64_t InputTotalSize; /* Amount of compressed video that has been sent to the HW.
|
||||
* (reported by DIL) */
|
||||
uint32_t InputBusyCount; /* Times compressed video has attempted to be sent to the HW
|
||||
* but the input FIFO was full. (reported by DIL) */
|
||||
|
||||
uint32_t PIBMissCount; /* Amount of times a PIB is invalid. (reported by DIL) */
|
||||
|
||||
uint32_t cpbEmptySize; /* supported only for H.264, specifically changed for
|
||||
* Adobe. Report size of CPB buffer available.
|
||||
* Reported by DIL */
|
||||
uint64_t NextTimeStamp; /* TimeStamp of the next picture that will be returned
|
||||
* by a call to ProcOutput. Added for Adobe. Reported
|
||||
* back from the driver */
|
||||
uint32_t FramesDropped;
|
||||
uint32_t FramesCaptured;
|
||||
uint32_t FramesRepeated;
|
||||
uint32_t InputCount;
|
||||
uint64_t InputTotalSize;
|
||||
uint32_t InputBusyCount;
|
||||
uint32_t PIBMissCount;
|
||||
uint32_t cpbEmptySize;
|
||||
uint64_t NextTimeStamp;
|
||||
uint8_t reserved__[16];
|
||||
|
||||
};
|
||||
|
||||
#define BC_SWAP32(_v) \
|
||||
|
|
|
@ -1,7 +1,3 @@
|
|||
/*
|
||||
* $Id: comet.h,v 1.3 2005/09/28 00:10:07 rickd PMCC4_3_1B $
|
||||
*/
|
||||
|
||||
#ifndef _INC_COMET_H_
|
||||
#define _INC_COMET_H_
|
||||
|
||||
|
@ -23,27 +19,9 @@
|
|||
* For further information, contact via email: support@sbei.com
|
||||
* SBE, Inc. San Ramon, California U.S.A.
|
||||
*-----------------------------------------------------------------------------
|
||||
* RCS info:
|
||||
* RCS revision: $Revision: 1.3 $
|
||||
* Last changed on $Date: 2005/09/28 00:10:07 $
|
||||
* Changed by $Author: rickd $
|
||||
*-----------------------------------------------------------------------------
|
||||
* $Log: comet.h,v $
|
||||
* Revision 1.3 2005/09/28 00:10:07 rickd
|
||||
* Add RCS header. Switch to structure usage.
|
||||
*
|
||||
* Revision 1.2 2005/04/28 23:43:03 rickd
|
||||
* Add RCS tracking heading.
|
||||
*
|
||||
*-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#if defined(__FreeBSD__) || defined (__NetBSD__)
|
||||
#include <sys/types.h>
|
||||
#else
|
||||
#include <linux/types.h>
|
||||
#endif
|
||||
|
||||
|
||||
#define VINT32 volatile u_int32_t
|
||||
|
||||
|
|
|
@ -1,7 +1,3 @@
|
|||
/*
|
||||
* $Id: comet_tables.c,v 1.2 2005/10/17 23:55:27 rickd PMCC4_3_1B $
|
||||
*/
|
||||
|
||||
/*-----------------------------------------------------------------------------
|
||||
* comet_tables.c - waveform tables for the PM4351 'COMET'
|
||||
*
|
||||
|
@ -20,28 +16,8 @@
|
|||
* For further information, contact via email: support@sbei.com
|
||||
* SBE, Inc. San Ramon, California U.S.A.
|
||||
*-----------------------------------------------------------------------------
|
||||
* RCS info:
|
||||
* RCS revision: $Revision: 1.2 $
|
||||
* Last changed on $Date: 2005/10/17 23:55:27 $
|
||||
* Changed by $Author: rickd $
|
||||
*-----------------------------------------------------------------------------
|
||||
* $Log: comet_tables.c,v $
|
||||
* Revision 1.2 2005/10/17 23:55:27 rickd
|
||||
* Note that 75 Ohm transmit waveform is not supported on PMCC4.
|
||||
*
|
||||
* Revision 1.1 2005/09/28 00:10:05 rickd
|
||||
* Cosmetic alignment of tables for readability.
|
||||
*
|
||||
* Revision 1.0 2005/05/10 22:47:53 rickd
|
||||
* Initial revision
|
||||
*
|
||||
*-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
char SBEid_pmcc4_comet_tblc[] =
|
||||
"@(#)comet_tables.c - $Revision: 1.2 $ (c) Copyright 2004-2005 SBE, Inc.";
|
||||
|
||||
|
||||
#include <linux/types.h>
|
||||
|
||||
/*****************************************************************************
|
||||
|
|
|
@ -1,7 +1,3 @@
|
|||
/*
|
||||
* $Id: comet_tables.h,v 1.5 2006/01/02 22:37:31 rickd PMCC4_3_1B $
|
||||
*/
|
||||
|
||||
#ifndef _INC_COMET_TBLS_H_
|
||||
#define _INC_COMET_TBLS_H_
|
||||
|
||||
|
@ -23,26 +19,6 @@
|
|||
* For further information, contact via email: support@sbei.com
|
||||
* SBE, Inc. San Ramon, California U.S.A.
|
||||
*-----------------------------------------------------------------------------
|
||||
* RCS info:
|
||||
* RCS revision: $Revision: 1.5 $
|
||||
* Last changed on $Date: 2006/01/02 22:37:31 $
|
||||
* Changed by $Author: rickd $
|
||||
*-----------------------------------------------------------------------------
|
||||
* $Log: comet_tables.h,v $
|
||||
* Revision 1.5 2006/01/02 22:37:31 rickd
|
||||
* Double indexed arrays need sizings to avoid CC errors under
|
||||
* gcc 4.0.0
|
||||
*
|
||||
* Revision 1.4 2005/10/17 23:55:28 rickd
|
||||
* The 75 Ohm transmit waveform is not supported on PMCC4.
|
||||
*
|
||||
* Revision 1.3 2005/09/28 00:10:08 rickd
|
||||
* Add GNU License info. Structures moved to -C- file.
|
||||
*
|
||||
* Revision 1.2 2005/04/28 23:43:04 rickd
|
||||
* Add RCS tracking heading.
|
||||
*
|
||||
*-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
|
|
|
@ -1,7 +1,3 @@
|
|||
/*
|
||||
* $Id: libsbew.h,v 2.1 2005/10/27 18:54:19 rickd PMCC4_3_1B $
|
||||
*/
|
||||
|
||||
#ifndef _INC_LIBSBEW_H_
|
||||
#define _INC_LIBSBEW_H_
|
||||
|
||||
|
@ -25,32 +21,8 @@
|
|||
* For further information, contact via email: support@sbei.com
|
||||
* SBE, Inc. San Ramon, California U.S.A.
|
||||
*-----------------------------------------------------------------------------
|
||||
* RCS info:
|
||||
* RCS revision: $Revision: 2.1 $
|
||||
* Last changed on $Date: 2005/10/27 18:54:19 $
|
||||
* Changed by $Author: rickd $
|
||||
*-----------------------------------------------------------------------------
|
||||
* $Log: libsbew.h,v $
|
||||
* Revision 2.1 2005/10/27 18:54:19 rickd
|
||||
* Add E1PLAIN support.
|
||||
*
|
||||
* Revision 2.0 2005/09/28 00:10:08 rickd
|
||||
* Customized for PMCC4 comet-per-port design.
|
||||
*
|
||||
* Revision 1.15 2005/03/29 00:51:31 rickd
|
||||
* File imported from C1T3 port, Revision 1.15
|
||||
*-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef __KERNEL__
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/********************************/
|
||||
/** set driver logging level **/
|
||||
/********************************/
|
||||
|
@ -574,8 +546,4 @@ struct sbecom_port_param
|
|||
extern int wancfg_set_tsioc (wcfg_t *, struct wanc1t3_ts_param *);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /*** _INC_LIBSBEW_H_ ***/
|
||||
|
|
|
@ -1,7 +1,3 @@
|
|||
/*
|
||||
* $Id: musycc.c,v 2.1 2007/08/15 23:32:17 rickd PMCC4_3_1B $
|
||||
*/
|
||||
|
||||
unsigned int max_intcnt = 0;
|
||||
unsigned int max_bh = 0;
|
||||
|
||||
|
@ -24,53 +20,8 @@ unsigned int max_bh = 0;
|
|||
* For further information, contact via email: support@onestopsystems.com
|
||||
* One Stop Systems, Inc. Escondido, California U.S.A.
|
||||
*-----------------------------------------------------------------------------
|
||||
* RCS info:
|
||||
* RCS revision: $Revision: 2.1 $
|
||||
* Last changed on $Date: 2007/08/15 23:32:17 $
|
||||
* Changed by $Author: rickd $
|
||||
*-----------------------------------------------------------------------------
|
||||
* $Log: musycc.c,v $
|
||||
* Revision 2.1 2007/08/15 23:32:17 rickd
|
||||
* Use 'if 0' instead of GNU comment delimeter to avoid line wrap induced compiler errors.
|
||||
*
|
||||
* Revision 2.0 2007/08/15 22:13:20 rickd
|
||||
* Update to printf pointer %p usage and correct some UINT to ULONG for
|
||||
* 64bit comptibility.
|
||||
*
|
||||
* Revision 1.7 2006/04/21 00:56:40 rickd
|
||||
* workqueue files now prefixed with <sbecom> prefix.
|
||||
*
|
||||
* Revision 1.6 2005/10/27 18:54:19 rickd
|
||||
* Clean out old code. Default to HDLC_FCS16, not TRANS.
|
||||
*
|
||||
* Revision 1.5 2005/10/17 23:55:28 rickd
|
||||
* Initial port of NCOMM support patches from original work found
|
||||
* in pmc_c4t1e1 as updated by NCOMM. Ref: CONFIG_SBE_PMCC4_NCOMM.
|
||||
*
|
||||
* Revision 1.4 2005/10/13 20:35:25 rickd
|
||||
* Cleanup warning for unused <flags> variable.
|
||||
*
|
||||
* Revision 1.3 2005/10/13 19:19:22 rickd
|
||||
* Disable redundant driver removal cleanup code.
|
||||
*
|
||||
* Revision 1.2 2005/10/11 18:36:16 rickd
|
||||
* Clean up warning messages caused by de-implemented some <flags> associated
|
||||
* with spin_lock() removals.
|
||||
*
|
||||
* Revision 1.1 2005/10/05 00:45:28 rickd
|
||||
* Re-enable xmit on flow-controlled and full channel to fix restart hang.
|
||||
* Add some temp spin-lock debug code (rld_spin_owner).
|
||||
*
|
||||
* Revision 1.0 2005/09/28 00:10:06 rickd
|
||||
* Initial release for C4T1E1 support. Lots of transparent
|
||||
* mode updates.
|
||||
*
|
||||
*-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
char SBEid_pmcc4_musyccc[] =
|
||||
"@(#)musycc.c - $Revision: 2.1 $ (c) Copyright 2004-2006 SBE, Inc.";
|
||||
|
||||
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
||||
|
||||
#include <linux/types.h>
|
||||
|
|
|
@ -1,7 +1,3 @@
|
|||
/*
|
||||
* $Id: musycc.h,v 1.3 2005/09/28 00:10:08 rickd PMCC4_3_1B $
|
||||
*/
|
||||
|
||||
#ifndef _INC_MUSYCC_H_
|
||||
#define _INC_MUSYCC_H_
|
||||
|
||||
|
@ -24,36 +20,13 @@
|
|||
* For further information, contact via email: support@sbei.com
|
||||
* SBE, Inc. San Ramon, California U.S.A.
|
||||
*-----------------------------------------------------------------------------
|
||||
* RCS info:
|
||||
* RCS revision: $Revision: 1.3 $
|
||||
* Last changed on $Date: 2005/09/28 00:10:08 $
|
||||
* Changed by $Author: rickd $
|
||||
*-----------------------------------------------------------------------------
|
||||
* $Log: musycc.h,v $
|
||||
* Revision 1.3 2005/09/28 00:10:08 rickd
|
||||
* Add GNU license info. Add PMCC4 PCI/DevIDs. Implement new
|
||||
* musycc reg&bits namings. Use PORTMAP_0 GCD grouping.
|
||||
*
|
||||
* Revision 1.2 2005/04/28 23:43:04 rickd
|
||||
* Add RCS tracking heading.
|
||||
*
|
||||
*-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#if defined (__FreeBSD__) || defined (__NetBSD__)
|
||||
#include <sys/types.h>
|
||||
#else
|
||||
#include <linux/types.h>
|
||||
#endif
|
||||
|
||||
#define VINT8 volatile u_int8_t
|
||||
#define VINT32 volatile u_int32_t
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#include "pmcc4_defs.h"
|
||||
|
||||
|
||||
|
@ -448,10 +421,6 @@ extern "C"
|
|||
/* This must be defined on an entire channel group (Port) basis */
|
||||
#define SUERM_THRESHOLD 0x1f
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#undef VINT32
|
||||
#undef VINT8
|
||||
|
||||
|
|
|
@ -1,7 +1,3 @@
|
|||
/*
|
||||
* $Id: ossiRelease.c,v 1.2 2008/05/08 20:14:03 rdobbs PMCC4_3_1B $
|
||||
*/
|
||||
|
||||
/*-----------------------------------------------------------------------------
|
||||
* ossiRelease.c -
|
||||
*
|
||||
|
@ -26,14 +22,8 @@
|
|||
* One Stop Systems, Inc. Escondido, California U.S.A.
|
||||
*
|
||||
*-----------------------------------------------------------------------------
|
||||
* RCS info:
|
||||
* RCS revision: $Revision: 1.2 $
|
||||
* Last changed on $Date: 2008/05/08 20:14:03 $
|
||||
* Changed by $Author: rdobbs $
|
||||
*-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
char pmcc4_OSSI_release[] = "$Release: PMCC4_3_1B, Copyright (c) 2008 One Stop Systems$";
|
||||
|
||||
/*** End-of-File ***/
|
||||
|
|
|
@ -1,7 +1,3 @@
|
|||
/*
|
||||
* $Id: pmc93x6_eeprom.h,v 1.1 2005/09/28 00:10:08 rickd PMCC4_3_1B $
|
||||
*/
|
||||
|
||||
#ifndef _INC_PMC93X6_EEPROM_H_
|
||||
#define _INC_PMC93X6_EEPROM_H_
|
||||
|
||||
|
@ -23,26 +19,9 @@
|
|||
* For further information, contact via email: support@sbei.com
|
||||
* SBE, Inc. San Ramon, California U.S.A.
|
||||
*-----------------------------------------------------------------------------
|
||||
* RCS info:
|
||||
*-----------------------------------------------------------------------------
|
||||
* $Log: pmc93x6_eeprom.h,v $
|
||||
* Revision 1.1 2005/09/28 00:10:08 rickd
|
||||
* pmc_verify_cksum return value is char.
|
||||
*
|
||||
* Revision 1.0 2005/05/04 17:20:51 rickd
|
||||
* Initial revision
|
||||
*
|
||||
* Revision 1.0 2005/04/22 23:48:48 rickd
|
||||
* Initial revision
|
||||
*
|
||||
*-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#if defined (__FreeBSD__) || defined (__NetBSD__)
|
||||
#include <sys/types.h>
|
||||
#else
|
||||
#include <linux/types.h>
|
||||
#endif
|
||||
|
||||
#ifdef __KERNEL__
|
||||
|
||||
|
|
|
@ -1,7 +1,3 @@
|
|||
/*
|
||||
* $Id: pmcc4.h,v 1.4 2005/11/01 19:24:48 rickd PMCC4_3_1B $
|
||||
*/
|
||||
|
||||
#ifndef _INC_PMCC4_H_
|
||||
#define _INC_PMCC4_H_
|
||||
|
||||
|
@ -23,49 +19,15 @@
|
|||
* For further information, contact via email: support@sbei.com
|
||||
* SBE, Inc. San Ramon, California U.S.A.
|
||||
*-----------------------------------------------------------------------------
|
||||
* RCS info:
|
||||
* RCS revision: $Revision: 1.4 $
|
||||
* Last changed on $Date: 2005/11/01 19:24:48 $
|
||||
* Changed by $Author: rickd $
|
||||
*-----------------------------------------------------------------------------
|
||||
* $Log: pmcc4.h,v $
|
||||
* Revision 1.4 2005/11/01 19:24:48 rickd
|
||||
* Remove de-implement function prototypes. Several <int> to
|
||||
* <status_t> changes for consistent usage of same.
|
||||
*
|
||||
* Revision 1.3 2005/09/28 00:10:08 rickd
|
||||
* Add GNU license info. Use config params from libsbew.h
|
||||
*
|
||||
* Revision 1.2 2005/04/28 23:43:03 rickd
|
||||
* Add RCS tracking heading.
|
||||
*
|
||||
*-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
#if defined(__FreeBSD__) || defined(__NetBSD__)
|
||||
#include <sys/types.h>
|
||||
#else
|
||||
#ifndef __KERNEL__
|
||||
#include <sys/types.h>
|
||||
#else
|
||||
#include <linux/types.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
typedef int status_t;
|
||||
|
||||
#define SBE_DRVR_FAIL 0
|
||||
#define SBE_DRVR_SUCCESS 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
|
||||
/********************/
|
||||
/* PMCC4 memory Map */
|
||||
/********************/
|
||||
|
@ -105,10 +67,6 @@ extern "C"
|
|||
#define sbeE1errSMF 0x02
|
||||
#define sbeE1CRC 0x01
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __KERNEL__
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,7 +1,3 @@
|
|||
/*
|
||||
* $Id: pmcc4_cpld.h,v 1.0 2005/09/28 00:10:08 rickd PMCC4_3_1B $
|
||||
*/
|
||||
|
||||
#ifndef _INC_PMCC4_CPLD_H_
|
||||
#define _INC_PMCC4_CPLD_H_
|
||||
|
||||
|
@ -23,34 +19,9 @@
|
|||
* For further information, contact via email: support@sbei.com
|
||||
* SBE, Inc. San Ramon, California U.S.A.
|
||||
*-----------------------------------------------------------------------------
|
||||
* RCS info:
|
||||
* RCS revision: $Revision: 1.0 $
|
||||
* Last changed on $Date: 2005/09/28 00:10:08 $
|
||||
* Changed by $Author: rickd $
|
||||
*-----------------------------------------------------------------------------
|
||||
* $Log: pmcc4_cpld.h,v $
|
||||
* Revision 1.0 2005/09/28 00:10:08 rickd
|
||||
* Initial revision
|
||||
*
|
||||
*-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
#if defined(__FreeBSD__) || defined(__NetBSD__)
|
||||
#include <sys/types.h>
|
||||
#else
|
||||
#ifndef __KERNEL__
|
||||
#include <sys/types.h>
|
||||
#else
|
||||
#include <linux/types.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
|
||||
/********************************/
|
||||
/* iSPLD control chip registers */
|
||||
|
@ -117,8 +88,4 @@ extern "C"
|
|||
#define PMCC4_CPLD_INTR_CMT_3 0x04
|
||||
#define PMCC4_CPLD_INTR_CMT_4 0x08
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _INC_PMCC4_CPLD_H_ */
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue