Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 4443
b: refs/heads/master
c: 5c23804
h: refs/heads/master
i:
  4441: 7f67920
  4439: 6a57e0d
v: v3
  • Loading branch information
Linus Torvalds committed Jul 10, 2005
1 parent 969ca5d commit 00a2480
Show file tree
Hide file tree
Showing 16 changed files with 261 additions and 81 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ec6bced6c7b92904f5ead39c9c1b8dc734e6eff0
refs/heads/master: 5c23804a0941a111752fdacefe0bea2db1b4d93f
1 change: 0 additions & 1 deletion trunk/arch/xtensa/kernel/syscalls.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
#include <asm/mman.h>
#include <asm/shmparam.h>
#include <asm/page.h>
#include <asm/ipc.h>

extern void do_syscall_trace(void);
typedef int (*syscall_t)(void *a0,...);
Expand Down
12 changes: 12 additions & 0 deletions trunk/drivers/ieee1394/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,18 @@ config IEEE1394_CONFIG_ROM_IP1394
with MacOSX and WinXP IP-over-1394), enable this option and the
eth1394 option below.

config IEEE1394_EXPORT_FULL_API
bool "Export all symbols of ieee1394's API"
depends on IEEE1394
default n
help
Export all symbols of ieee1394's driver programming interface, even
those that are not currently used by the standard IEEE 1394 drivers.
This option does not affect the interface to userspace applications.
Say Y here if you want to compile externally developed drivers that
make extended use of ieee1394's API. It is otherwise safe to say N.

comment "Device Drivers"
depends on IEEE1394

Expand Down
3 changes: 2 additions & 1 deletion trunk/drivers/ieee1394/csr.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include "hosts.h"
#include "ieee1394.h"
#include "highlevel.h"
#include "ieee1394_core.h"

/* Module Parameters */
/* this module parameter can be used to disable mapping of the FCP registers */
Expand Down Expand Up @@ -232,7 +233,7 @@ static void add_host(struct hpsb_host *host)
host->csr.generation = 2;

bus_info[1] = __constant_cpu_to_be32(0x31333934);
bus_info[2] = cpu_to_be32((1 << CSR_IRMC_SHIFT) |
bus_info[2] = cpu_to_be32((hpsb_disable_irm ? 0 : 1 << CSR_IRMC_SHIFT) |
(1 << CSR_CMC_SHIFT) |
(1 << CSR_ISC_SHIFT) |
(0 << CSR_BMC_SHIFT) |
Expand Down
37 changes: 27 additions & 10 deletions trunk/drivers/ieee1394/csr1212.c
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,15 @@ void csr1212_init_local_csr(struct csr1212_csr *csr,
{
static const int mr_map[] = { 4, 64, 1024, 0 };

#ifdef __KERNEL__
BUG_ON(max_rom & ~0x3);
csr->max_rom = mr_map[max_rom];
#else
if (max_rom & ~0x3) /* caller supplied invalid argument */
csr->max_rom = 0;
else
csr->max_rom = mr_map[max_rom];
#endif
memcpy(csr->bus_info_data, bus_info_data, csr->bus_info_len);
}

Expand Down Expand Up @@ -533,12 +541,15 @@ struct csr1212_keyval *csr1212_new_icon_descriptor_leaf(u_int32_t version,
static const int pd[4] = { 0, 4, 16, 256 };
static const int cs[16] = { 4, 2 };
struct csr1212_keyval *kv;
int palette_size = pd[palette_depth] * cs[color_space];
int palette_size;
int pixel_size = (hscan * vscan + 3) & ~0x3;

if ((palette_depth && !palette) || !pixels)
if (!pixels || (!palette && palette_depth) ||
(palette_depth & ~0x3) || (color_space & ~0xf))
return NULL;

palette_size = pd[palette_depth] * cs[color_space];

kv = csr1212_new_descriptor_leaf(1, 0, NULL,
palette_size + pixel_size +
CSR1212_ICON_DESCRIPTOR_LEAF_OVERHEAD);
Expand Down Expand Up @@ -760,9 +771,9 @@ static int csr1212_append_new_cache(struct csr1212_csr *csr, size_t romsize)
struct csr1212_csr_rom_cache *cache;
u_int64_t csr_addr;

if (!csr || !csr->ops->allocate_addr_range ||
!csr->ops->release_addr)
return CSR1212_ENOMEM;
if (!csr || !csr->ops || !csr->ops->allocate_addr_range ||
!csr->ops->release_addr || csr->max_rom < 1)
return CSR1212_EINVAL;

/* ROM size must be a multiple of csr->max_rom */
romsize = (romsize + (csr->max_rom - 1)) & ~(csr->max_rom - 1);
Expand Down Expand Up @@ -1145,6 +1156,8 @@ int csr1212_generate_csr_image(struct csr1212_csr *csr)

/* Make sure the Extended ROM leaf is a multiple of
* max_rom in size. */
if (csr->max_rom < 1)
return CSR1212_EINVAL;
leaf_size = (cache->len + (csr->max_rom - 1)) &
~(csr->max_rom - 1);

Expand Down Expand Up @@ -1409,7 +1422,7 @@ int _csr1212_read_keyval(struct csr1212_csr *csr, struct csr1212_keyval *kv)
u_int32_t *cache_ptr;
u_int16_t kv_len = 0;

if (!csr || !kv)
if (!csr || !kv || csr->max_rom < 1)
return CSR1212_EINVAL;

/* First find which cache the data should be in (or go in if not read
Expand Down Expand Up @@ -1572,7 +1585,7 @@ int csr1212_parse_csr(struct csr1212_csr *csr)
struct csr1212_dentry *dentry;
int ret;

if (!csr || !csr->ops->bus_read)
if (!csr || !csr->ops || !csr->ops->bus_read)
return CSR1212_EINVAL;

ret = csr1212_parse_bus_info_block(csr);
Expand All @@ -1581,9 +1594,13 @@ int csr1212_parse_csr(struct csr1212_csr *csr)

if (!csr->ops->get_max_rom)
csr->max_rom = mr_map[0]; /* default value */
else
csr->max_rom = mr_map[csr->ops->get_max_rom(csr->bus_info_data,
csr->private)];
else {
int i = csr->ops->get_max_rom(csr->bus_info_data,
csr->private);
if (i & ~0x3)
return CSR1212_EINVAL;
csr->max_rom = mr_map[i];
}

csr->cache_head->layout_head = csr->root_kv;
csr->cache_head->layout_tail = csr->root_kv;
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/ieee1394/dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ static inline int dma_region_find(struct dma_region *dma, unsigned long offset,

dma_addr_t dma_region_offset_to_bus(struct dma_region *dma, unsigned long offset)
{
unsigned long rem;
unsigned long rem = 0;

struct scatterlist *sg = &dma->sglist[dma_region_find(dma, offset, &rem)];
return sg_dma_address(sg) + rem;
Expand Down
6 changes: 3 additions & 3 deletions trunk/drivers/ieee1394/eth1394.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
#define TRACE() printk(KERN_ERR "%s:%s[%d] ---- TRACE\n", driver_name, __FUNCTION__, __LINE__)

static char version[] __devinitdata =
"$Rev: 1247 $ Ben Collins <bcollins@debian.org>";
"$Rev: 1264 $ Ben Collins <bcollins@debian.org>";

struct fragment_info {
struct list_head list;
Expand Down Expand Up @@ -706,7 +706,7 @@ static void ether1394_host_reset (struct hpsb_host *host)
return;

dev = hi->dev;
priv = netdev_priv(dev);
priv = (struct eth1394_priv *)netdev_priv(dev);

/* Reset our private host data, but not our mtu */
netif_stop_queue (dev);
Expand Down Expand Up @@ -1770,7 +1770,7 @@ static int ether1394_tx (struct sk_buff *skb, struct net_device *dev)
static void ether1394_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
{
strcpy (info->driver, driver_name);
strcpy (info->version, "$Rev: 1247 $");
strcpy (info->version, "$Rev: 1264 $");
/* FIXME XXX provide sane businfo */
strcpy (info->bus_info, "ieee1394");
}
Expand Down
35 changes: 23 additions & 12 deletions trunk/drivers/ieee1394/ieee1394_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
/*
* Disable the nodemgr detection and config rom reading functionality.
*/
static int disable_nodemgr = 0;
static int disable_nodemgr;
module_param(disable_nodemgr, int, 0444);
MODULE_PARM_DESC(disable_nodemgr, "Disable nodemgr functionality.");

Expand Down Expand Up @@ -520,6 +520,9 @@ int hpsb_send_packet(struct hpsb_packet *packet)

if (!packet->no_waiter || packet->expect_response) {
atomic_inc(&packet->refcnt);
/* Set the initial "sendtime" to 10 seconds from now, to
prevent premature expiry. If a packet takes more than
10 seconds to hit the wire, we have bigger problems :) */
packet->sendtime = jiffies + 10 * HZ;
skb_queue_tail(&host->pending_packet_queue, packet->skb);
}
Expand Down Expand Up @@ -1223,16 +1226,18 @@ EXPORT_SYMBOL(hpsb_protocol_class);
EXPORT_SYMBOL(hpsb_set_packet_complete_task);
EXPORT_SYMBOL(hpsb_alloc_packet);
EXPORT_SYMBOL(hpsb_free_packet);
EXPORT_SYMBOL(hpsb_send_phy_config);
EXPORT_SYMBOL(hpsb_send_packet);
EXPORT_SYMBOL(hpsb_send_packet_and_wait);
EXPORT_SYMBOL(hpsb_reset_bus);
EXPORT_SYMBOL(hpsb_bus_reset);
EXPORT_SYMBOL(hpsb_selfid_received);
EXPORT_SYMBOL(hpsb_selfid_complete);
EXPORT_SYMBOL(hpsb_packet_sent);
EXPORT_SYMBOL(hpsb_packet_received);
EXPORT_SYMBOL_GPL(hpsb_disable_irm);
#ifdef CONFIG_IEEE1394_EXPORT_FULL_API
EXPORT_SYMBOL(hpsb_send_phy_config);
EXPORT_SYMBOL(hpsb_send_packet_and_wait);
#endif

/** ieee1394_transactions.c **/
EXPORT_SYMBOL(hpsb_get_tlabel);
Expand Down Expand Up @@ -1262,17 +1267,21 @@ EXPORT_SYMBOL(hpsb_destroy_hostinfo);
EXPORT_SYMBOL(hpsb_set_hostinfo_key);
EXPORT_SYMBOL(hpsb_get_hostinfo_bykey);
EXPORT_SYMBOL(hpsb_set_hostinfo);
EXPORT_SYMBOL(highlevel_host_reset);
#ifdef CONFIG_IEEE1394_EXPORT_FULL_API
EXPORT_SYMBOL(highlevel_add_host);
EXPORT_SYMBOL(highlevel_remove_host);
EXPORT_SYMBOL(highlevel_host_reset);
#endif

/** nodemgr.c **/
EXPORT_SYMBOL(hpsb_node_fill_packet);
EXPORT_SYMBOL(hpsb_node_write);
EXPORT_SYMBOL(hpsb_register_protocol);
EXPORT_SYMBOL(hpsb_unregister_protocol);
EXPORT_SYMBOL(ieee1394_bus_type);
#ifdef CONFIG_IEEE1394_EXPORT_FULL_API
EXPORT_SYMBOL(nodemgr_for_each_host);
#endif

/** csr.c **/
EXPORT_SYMBOL(hpsb_update_config_rom);
Expand Down Expand Up @@ -1309,19 +1318,21 @@ EXPORT_SYMBOL(hpsb_iso_wake);
EXPORT_SYMBOL(hpsb_iso_recv_flush);

/** csr1212.c **/
EXPORT_SYMBOL(csr1212_create_csr);
EXPORT_SYMBOL(csr1212_init_local_csr);
EXPORT_SYMBOL(csr1212_new_immediate);
EXPORT_SYMBOL(csr1212_new_directory);
EXPORT_SYMBOL(csr1212_associate_keyval);
EXPORT_SYMBOL(csr1212_attach_keyval_to_directory);
EXPORT_SYMBOL(csr1212_new_string_descriptor_leaf);
EXPORT_SYMBOL(csr1212_detach_keyval_from_directory);
EXPORT_SYMBOL(csr1212_release_keyval);
EXPORT_SYMBOL(csr1212_destroy_csr);
EXPORT_SYMBOL(csr1212_read);
EXPORT_SYMBOL(csr1212_generate_csr_image);
EXPORT_SYMBOL(csr1212_parse_keyval);
EXPORT_SYMBOL(csr1212_parse_csr);
EXPORT_SYMBOL(_csr1212_read_keyval);
EXPORT_SYMBOL(_csr1212_destroy_keyval);
#ifdef CONFIG_IEEE1394_EXPORT_FULL_API
EXPORT_SYMBOL(csr1212_create_csr);
EXPORT_SYMBOL(csr1212_init_local_csr);
EXPORT_SYMBOL(csr1212_new_immediate);
EXPORT_SYMBOL(csr1212_associate_keyval);
EXPORT_SYMBOL(csr1212_new_string_descriptor_leaf);
EXPORT_SYMBOL(csr1212_destroy_csr);
EXPORT_SYMBOL(csr1212_generate_csr_image);
EXPORT_SYMBOL(csr1212_parse_csr);
#endif
27 changes: 21 additions & 6 deletions trunk/drivers/ieee1394/iso.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ static struct hpsb_iso* hpsb_iso_common_init(struct hpsb_host *host, enum hpsb_i
if ((dma_mode < HPSB_ISO_DMA_DEFAULT) || (dma_mode > HPSB_ISO_DMA_PACKET_PER_BUFFER))
dma_mode=HPSB_ISO_DMA_DEFAULT;

if ((irq_interval < 0) || (irq_interval > buf_packets / 4))
irq_interval = buf_packets / 4;
if (irq_interval == 0) /* really interrupt for each packet*/
irq_interval = 1;
else if ((irq_interval < 0) || (irq_interval > buf_packets / 4))
irq_interval = buf_packets / 4;

if (channel < -1 || channel >= 64)
return NULL;
Expand Down Expand Up @@ -106,6 +106,7 @@ static struct hpsb_iso* hpsb_iso_common_init(struct hpsb_host *host, enum hpsb_i
}

atomic_set(&iso->overflows, 0);
iso->bytes_discarded = 0;
iso->flags = 0;
iso->prebuffer = 0;

Expand Down Expand Up @@ -241,12 +242,12 @@ int hpsb_iso_xmit_start(struct hpsb_iso *iso, int cycle, int prebuffer)
iso->xmit_cycle = cycle;

if (prebuffer < 0)
prebuffer = iso->buf_packets;
prebuffer = iso->buf_packets - 1;
else if (prebuffer == 0)
prebuffer = 1;

if (prebuffer > iso->buf_packets)
prebuffer = iso->buf_packets;
if (prebuffer >= iso->buf_packets)
prebuffer = iso->buf_packets - 1;

iso->prebuffer = prebuffer;

Expand Down Expand Up @@ -395,18 +396,21 @@ void hpsb_iso_packet_sent(struct hpsb_iso *iso, int cycle, int error)
}

void hpsb_iso_packet_received(struct hpsb_iso *iso, u32 offset, u16 len,
u16 cycle, u8 channel, u8 tag, u8 sy)
u16 total_len, u16 cycle, u8 channel, u8 tag, u8 sy)
{
unsigned long flags;
spin_lock_irqsave(&iso->lock, flags);

if (iso->n_ready_packets == iso->buf_packets) {
/* overflow! */
atomic_inc(&iso->overflows);
/* Record size of this discarded packet */
iso->bytes_discarded += total_len;
} else {
struct hpsb_iso_packet_info *info = &iso->infos[iso->pkt_dma];
info->offset = offset;
info->len = len;
info->total_len = total_len;
info->cycle = cycle;
info->channel = channel;
info->tag = tag;
Expand Down Expand Up @@ -437,6 +441,17 @@ int hpsb_iso_recv_release_packets(struct hpsb_iso *iso, unsigned int n_packets)

iso->first_packet = (iso->first_packet+1) % iso->buf_packets;
iso->n_ready_packets--;

/* release memory from packets discarded when queue was full */
if (iso->n_ready_packets == 0) { /* Release only after all prior packets handled */
if (iso->bytes_discarded != 0) {
struct hpsb_iso_packet_info inf;
inf.total_len = iso->bytes_discarded;
iso->host->driver->isoctl(iso, RECV_RELEASE,
(unsigned long) &inf);
iso->bytes_discarded = 0;
}
}
}
spin_unlock_irqrestore(&iso->lock, flags);
return rv;
Expand Down
13 changes: 12 additions & 1 deletion trunk/drivers/ieee1394/iso.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,14 @@ struct hpsb_iso_packet_info {
/* 2-bit 'tag' and 4-bit 'sy' fields of the isochronous header */
__u8 tag;
__u8 sy;

/*
* length in bytes of the packet including header/trailer.
* MUST be at structure end, since the first part of this structure is also
* defined in raw1394.h (i.e. struct raw1394_iso_packet_info), is copied to
* userspace and is accessed there through libraw1394.
*/
__u16 total_len;
};

enum hpsb_iso_type { HPSB_ISO_RECV = 0, HPSB_ISO_XMIT = 1 };
Expand Down Expand Up @@ -111,6 +119,9 @@ struct hpsb_iso {
/* how many times the buffer has overflowed or underflowed */
atomic_t overflows;

/* Current number of bytes lost in discarded packets */
int bytes_discarded;

/* private flags to track initialization progress */
#define HPSB_ISO_DRIVER_INIT (1<<0)
#define HPSB_ISO_DRIVER_STARTED (1<<1)
Expand Down Expand Up @@ -193,7 +204,7 @@ void hpsb_iso_packet_sent(struct hpsb_iso *iso, int cycle, int error);

/* call after a packet has been received (interrupt context OK) */
void hpsb_iso_packet_received(struct hpsb_iso *iso, u32 offset, u16 len,
u16 cycle, u8 channel, u8 tag, u8 sy);
u16 total_len, u16 cycle, u8 channel, u8 tag, u8 sy);

/* call to wake waiting processes after buffer space has opened up. */
void hpsb_iso_wake(struct hpsb_iso *iso);
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/ieee1394/nodemgr.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#include "csr.h"
#include "nodemgr.h"

static int ignore_drivers = 0;
static int ignore_drivers;
module_param(ignore_drivers, int, 0444);
MODULE_PARM_DESC(ignore_drivers, "Disable automatic probing for drivers.");

Expand Down
Loading

0 comments on commit 00a2480

Please sign in to comment.