Commit e1d118f1 authored by Stefan Richter's avatar Stefan Richter Committed by Ben Collins

[PATCH] ieee1394: coding style and comment fixes in midlayer header files

Adjust tabulators, line wraps, empty lines, and comment style.
Update comments in ieee1394_transactions.h and highlevel.h.
Fix typo in comment in csr.h.
Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
Signed-off-by: default avatarBen Collins <bcollins@ubuntu.com>
parent 2b01b80b
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
/* IEEE 1394 bus specific Configuration ROM Key IDs */ /* IEEE 1394 bus specific Configuration ROM Key IDs */
#define IEEE1394_KV_ID_POWER_REQUIREMENTS (0x30) #define IEEE1394_KV_ID_POWER_REQUIREMENTS (0x30)
/* IEEE 1394 Bus Inforamation Block specifics */ /* IEEE 1394 Bus Information Block specifics */
#define CSR_BUS_INFO_SIZE (5 * sizeof(quadlet_t)) #define CSR_BUS_INFO_SIZE (5 * sizeof(quadlet_t))
#define CSR_IRMC_SHIFT 31 #define CSR_IRMC_SHIFT 31
...@@ -64,7 +64,7 @@ struct csr_control { ...@@ -64,7 +64,7 @@ struct csr_control {
quadlet_t state; quadlet_t state;
quadlet_t node_ids; quadlet_t node_ids;
quadlet_t split_timeout_hi, split_timeout_lo; quadlet_t split_timeout_hi, split_timeout_lo;
unsigned long expire; // Calculated from split_timeout unsigned long expire; /* Calculated from split_timeout */
quadlet_t cycle_time; quadlet_t cycle_time;
quadlet_t bus_time; quadlet_t bus_time;
quadlet_t bus_manager_id; quadlet_t bus_manager_id;
......
...@@ -13,66 +13,85 @@ ...@@ -13,66 +13,85 @@
#include <linux/pci.h> #include <linux/pci.h>
#include <asm/scatterlist.h> #include <asm/scatterlist.h>
/* struct dma_prog_region /**
* struct dma_prog_region - small contiguous DMA buffer
a small, physically-contiguous DMA buffer with random-access, * @kvirt: kernel virtual address
synchronous usage characteristics * @dev: PCI device
*/ * @n_pages: number of kernel pages
* @bus_addr: base bus address
*
* a small, physically contiguous DMA buffer with random-access, synchronous
* usage characteristics
*/
struct dma_prog_region { struct dma_prog_region {
unsigned char *kvirt; /* kernel virtual address */ unsigned char *kvirt;
struct pci_dev *dev; /* PCI device */ struct pci_dev *dev;
unsigned int n_pages; /* # of kernel pages */ unsigned int n_pages;
dma_addr_t bus_addr; /* base bus address */ dma_addr_t bus_addr;
}; };
/* clear out all fields but do not allocate any memory */ /* clear out all fields but do not allocate any memory */
void dma_prog_region_init(struct dma_prog_region *prog); void dma_prog_region_init(struct dma_prog_region *prog);
int dma_prog_region_alloc(struct dma_prog_region *prog, unsigned long n_bytes, struct pci_dev *dev); int dma_prog_region_alloc(struct dma_prog_region *prog, unsigned long n_bytes,
struct pci_dev *dev);
void dma_prog_region_free(struct dma_prog_region *prog); void dma_prog_region_free(struct dma_prog_region *prog);
static inline dma_addr_t dma_prog_region_offset_to_bus(struct dma_prog_region *prog, unsigned long offset) static inline dma_addr_t dma_prog_region_offset_to_bus(
struct dma_prog_region *prog, unsigned long offset)
{ {
return prog->bus_addr + offset; return prog->bus_addr + offset;
} }
/* struct dma_region /**
* struct dma_region - large non-contiguous DMA buffer
a large, non-physically-contiguous DMA buffer with streaming, * @virt: kernel virtual address
asynchronous usage characteristics * @dev: PCI device
*/ * @n_pages: number of kernel pages
* @n_dma_pages: number of IOMMU pages
* @sglist: IOMMU mapping
* @direction: PCI_DMA_TODEVICE, etc.
*
* a large, non-physically-contiguous DMA buffer with streaming, asynchronous
* usage characteristics
*/
struct dma_region { struct dma_region {
unsigned char *kvirt; /* kernel virtual address */ unsigned char *kvirt;
struct pci_dev *dev; /* PCI device */ struct pci_dev *dev;
unsigned int n_pages; /* # of kernel pages */ unsigned int n_pages;
unsigned int n_dma_pages; /* # of IOMMU pages */ unsigned int n_dma_pages;
struct scatterlist *sglist; /* IOMMU mapping */ struct scatterlist *sglist;
int direction; /* PCI_DMA_TODEVICE, etc */ int direction;
}; };
/* clear out all fields but do not allocate anything */ /* clear out all fields but do not allocate anything */
void dma_region_init(struct dma_region *dma); void dma_region_init(struct dma_region *dma);
/* allocate the buffer and map it to the IOMMU */ /* allocate the buffer and map it to the IOMMU */
int dma_region_alloc(struct dma_region *dma, unsigned long n_bytes, struct pci_dev *dev, int direction); int dma_region_alloc(struct dma_region *dma, unsigned long n_bytes,
struct pci_dev *dev, int direction);
/* unmap and free the buffer */ /* unmap and free the buffer */
void dma_region_free(struct dma_region *dma); void dma_region_free(struct dma_region *dma);
/* sync the CPU's view of the buffer */ /* sync the CPU's view of the buffer */
void dma_region_sync_for_cpu(struct dma_region *dma, unsigned long offset, unsigned long len); void dma_region_sync_for_cpu(struct dma_region *dma, unsigned long offset,
unsigned long len);
/* sync the IO bus' view of the buffer */ /* sync the IO bus' view of the buffer */
void dma_region_sync_for_device(struct dma_region *dma, unsigned long offset, unsigned long len); void dma_region_sync_for_device(struct dma_region *dma, unsigned long offset,
unsigned long len);
/* map the buffer into a user space process */ /* map the buffer into a user space process */
int dma_region_mmap(struct dma_region *dma, struct file *file, struct vm_area_struct *vma); int dma_region_mmap(struct dma_region *dma, struct file *file,
struct vm_area_struct *vma);
/* macro to index into a DMA region (or dma_prog_region) */ /* macro to index into a DMA region (or dma_prog_region) */
#define dma_region_i(_dma, _type, _index) ( ((_type*) ((_dma)->kvirt)) + (_index) ) #define dma_region_i(_dma, _type, _index) \
( ((_type*) ((_dma)->kvirt)) + (_index) )
/* return the DMA bus address of the byte with the given offset /* return the DMA bus address of the byte with the given offset
relative to the beginning of the dma_region */ * relative to the beginning of the dma_region */
dma_addr_t dma_region_offset_to_bus(struct dma_region *dma, unsigned long offset); dma_addr_t dma_region_offset_to_bus(struct dma_region *dma,
unsigned long offset);
#endif /* IEEE1394_DMA_H */ #endif /* IEEE1394_DMA_H */
#ifndef IEEE1394_HIGHLEVEL_H #ifndef IEEE1394_HIGHLEVEL_H
#define IEEE1394_HIGHLEVEL_H #define IEEE1394_HIGHLEVEL_H
/* internal to ieee1394 core */
struct hpsb_address_serve { struct hpsb_address_serve {
struct list_head host_list; /* per host list */ struct list_head host_list; /* per host list */
struct list_head hl_list; /* hpsb_highlevel list */ struct list_head hl_list; /* hpsb_highlevel list */
struct hpsb_address_ops *op; struct hpsb_address_ops *op;
struct hpsb_host *host; struct hpsb_host *host;
u64 start; /* first address handled, quadlet aligned */
/* first address handled and first address behind, quadlet aligned */ u64 end; /* first address behind, quadlet aligned */
u64 start, end;
}; };
/* Only the following structures are of interest to actual highlevel drivers. */
/*
* The above structs are internal to highlevel driver handling. Only the
* following structures are of interest to actual highlevel drivers.
*/
struct hpsb_highlevel { struct hpsb_highlevel {
struct module *owner; struct module *owner;
...@@ -32,28 +23,28 @@ struct hpsb_highlevel { ...@@ -32,28 +23,28 @@ struct hpsb_highlevel {
/* New host initialized. Will also be called during /* New host initialized. Will also be called during
* hpsb_register_highlevel for all hosts already installed. */ * hpsb_register_highlevel for all hosts already installed. */
void (*add_host) (struct hpsb_host *host); void (*add_host)(struct hpsb_host *host);
/* Host about to be removed. Will also be called during /* Host about to be removed. Will also be called during
* hpsb_unregister_highlevel once for each host. */ * hpsb_unregister_highlevel once for each host. */
void (*remove_host) (struct hpsb_host *host); void (*remove_host)(struct hpsb_host *host);
/* Host experienced bus reset with possible configuration changes. /* Host experienced bus reset with possible configuration changes.
* Note that this one may occur during interrupt/bottom half handling. * Note that this one may occur during interrupt/bottom half handling.
* You can not expect to be able to do stock hpsb_reads. */ * You can not expect to be able to do stock hpsb_reads. */
void (*host_reset) (struct hpsb_host *host); void (*host_reset)(struct hpsb_host *host);
/* An isochronous packet was received. Channel contains the channel /* An isochronous packet was received. Channel contains the channel
* number for your convenience, it is also contained in the included * number for your convenience, it is also contained in the included
* packet header (first quadlet, CRCs are missing). You may get called * packet header (first quadlet, CRCs are missing). You may get called
* for channel/host combinations you did not request. */ * for channel/host combinations you did not request. */
void (*iso_receive) (struct hpsb_host *host, int channel, void (*iso_receive)(struct hpsb_host *host, int channel,
quadlet_t *data, size_t length); quadlet_t *data, size_t length);
/* A write request was received on either the FCP_COMMAND (direction = /* A write request was received on either the FCP_COMMAND (direction =
* 0) or the FCP_RESPONSE (direction = 1) register. The cts arg * 0) or the FCP_RESPONSE (direction = 1) register. The cts arg
* contains the cts field (first byte of data). */ * contains the cts field (first byte of data). */
void (*fcp_request) (struct hpsb_host *host, int nodeid, int direction, void (*fcp_request)(struct hpsb_host *host, int nodeid, int direction,
int cts, u8 *data, size_t length); int cts, u8 *data, size_t length);
/* These are initialized by the subsystem when the /* These are initialized by the subsystem when the
...@@ -75,54 +66,55 @@ struct hpsb_address_ops { ...@@ -75,54 +66,55 @@ struct hpsb_address_ops {
* All functions shall return appropriate IEEE 1394 rcodes. * All functions shall return appropriate IEEE 1394 rcodes.
*/ */
/* These functions have to implement block reads for themselves. */ /* These functions have to implement block reads for themselves.
/* These functions either return a response code *
or a negative number. In the first case a response will be generated; in the * These functions either return a response code or a negative number.
later case, no response will be sent and the driver, that handled the request * In the first case a response will be generated. In the latter case,
will send the response itself * no response will be sent and the driver which handled the request
*/ * will send the response itself. */
int (*read) (struct hpsb_host *host, int nodeid, quadlet_t *buffer, int (*read)(struct hpsb_host *host, int nodeid, quadlet_t *buffer,
u64 addr, size_t length, u16 flags); u64 addr, size_t length, u16 flags);
int (*write) (struct hpsb_host *host, int nodeid, int destid, int (*write)(struct hpsb_host *host, int nodeid, int destid,
quadlet_t *data, u64 addr, size_t length, u16 flags); quadlet_t *data, u64 addr, size_t length, u16 flags);
/* Lock transactions: write results of ext_tcode operation into /* Lock transactions: write results of ext_tcode operation into
* *store. */ * *store. */
int (*lock) (struct hpsb_host *host, int nodeid, quadlet_t *store, int (*lock)(struct hpsb_host *host, int nodeid, quadlet_t *store,
u64 addr, quadlet_t data, quadlet_t arg, int ext_tcode, u16 flags); u64 addr, quadlet_t data, quadlet_t arg, int ext_tcode,
int (*lock64) (struct hpsb_host *host, int nodeid, octlet_t *store, u16 flags);
u64 addr, octlet_t data, octlet_t arg, int ext_tcode, u16 flags); int (*lock64)(struct hpsb_host *host, int nodeid, octlet_t *store,
u64 addr, octlet_t data, octlet_t arg, int ext_tcode,
u16 flags);
}; };
void highlevel_add_host(struct hpsb_host *host); void highlevel_add_host(struct hpsb_host *host);
void highlevel_remove_host(struct hpsb_host *host); void highlevel_remove_host(struct hpsb_host *host);
void highlevel_host_reset(struct hpsb_host *host); void highlevel_host_reset(struct hpsb_host *host);
/*
/* these functions are called to handle transactions. They are called, when * These functions are called to handle transactions. They are called when a
a packet arrives. The flags argument contains the second word of the first header * packet arrives. The flags argument contains the second word of the first
quadlet of the incoming packet (containing transaction label, retry code, * header quadlet of the incoming packet (containing transaction label, retry
transaction code and priority). These functions either return a response code * code, transaction code and priority). These functions either return a
or a negative number. In the first case a response will be generated; in the * response code or a negative number. In the first case a response will be
later case, no response will be sent and the driver, that handled the request * generated. In the latter case, no response will be sent and the driver which
will send the response itself. * handled the request will send the response itself.
*/ */
int highlevel_read(struct hpsb_host *host, int nodeid, void *data, int highlevel_read(struct hpsb_host *host, int nodeid, void *data, u64 addr,
unsigned int length, u16 flags);
int highlevel_write(struct hpsb_host *host, int nodeid, int destid, void *data,
u64 addr, unsigned int length, u16 flags); u64 addr, unsigned int length, u16 flags);
int highlevel_write(struct hpsb_host *host, int nodeid, int destid,
void *data, u64 addr, unsigned int length, u16 flags);
int highlevel_lock(struct hpsb_host *host, int nodeid, quadlet_t *store, int highlevel_lock(struct hpsb_host *host, int nodeid, quadlet_t *store,
u64 addr, quadlet_t data, quadlet_t arg, int ext_tcode, u16 flags); u64 addr, quadlet_t data, quadlet_t arg, int ext_tcode,
u16 flags);
int highlevel_lock64(struct hpsb_host *host, int nodeid, octlet_t *store, int highlevel_lock64(struct hpsb_host *host, int nodeid, octlet_t *store,
u64 addr, octlet_t data, octlet_t arg, int ext_tcode, u16 flags); u64 addr, octlet_t data, octlet_t arg, int ext_tcode,
u16 flags);
void highlevel_iso_receive(struct hpsb_host *host, void *data, void highlevel_iso_receive(struct hpsb_host *host, void *data, size_t length);
size_t length);
void highlevel_fcp_request(struct hpsb_host *host, int nodeid, int direction, void highlevel_fcp_request(struct hpsb_host *host, int nodeid, int direction,
void *data, size_t length); void *data, size_t length);
/* /*
* Register highlevel driver. The name pointer has to stay valid at all times * Register highlevel driver. The name pointer has to stay valid at all times
* because the string is not copied. * because the string is not copied.
...@@ -132,13 +124,15 @@ void hpsb_unregister_highlevel(struct hpsb_highlevel *hl); ...@@ -132,13 +124,15 @@ void hpsb_unregister_highlevel(struct hpsb_highlevel *hl);
/* /*
* Register handlers for host address spaces. Start and end are 48 bit pointers * Register handlers for host address spaces. Start and end are 48 bit pointers
* and have to be quadlet aligned (end points to the first address behind the * and have to be quadlet aligned. Argument "end" points to the first address
* handled addresses. This function can be called multiple times for a single * behind the handled addresses. This function can be called multiple times for
* hpsb_highlevel to implement sparse register sets. The requested region must * a single hpsb_highlevel to implement sparse register sets. The requested
* not overlap any previously allocated region, otherwise registering will fail. * region must not overlap any previously allocated region, otherwise
* registering will fail.
* *
* It returns true for successful allocation. There is no unregister function, * It returns true for successful allocation. Address spaces can be
* all address spaces are deallocated together with the hpsb_highlevel. * unregistered with hpsb_unregister_addrspace. All remaining address spaces
* are automatically deallocated together with the hpsb_highlevel.
*/ */
u64 hpsb_allocate_and_register_addrspace(struct hpsb_highlevel *hl, u64 hpsb_allocate_and_register_addrspace(struct hpsb_highlevel *hl,
struct hpsb_host *host, struct hpsb_host *host,
...@@ -147,7 +141,6 @@ u64 hpsb_allocate_and_register_addrspace(struct hpsb_highlevel *hl, ...@@ -147,7 +141,6 @@ u64 hpsb_allocate_and_register_addrspace(struct hpsb_highlevel *hl,
u64 start, u64 end); u64 start, u64 end);
int hpsb_register_addrspace(struct hpsb_highlevel *hl, struct hpsb_host *host, int hpsb_register_addrspace(struct hpsb_highlevel *hl, struct hpsb_host *host,
struct hpsb_address_ops *ops, u64 start, u64 end); struct hpsb_address_ops *ops, u64 start, u64 end);
int hpsb_unregister_addrspace(struct hpsb_highlevel *hl, struct hpsb_host *host, int hpsb_unregister_addrspace(struct hpsb_highlevel *hl, struct hpsb_host *host,
u64 start); u64 start);
...@@ -160,7 +153,6 @@ int hpsb_listen_channel(struct hpsb_highlevel *hl, struct hpsb_host *host, ...@@ -160,7 +153,6 @@ int hpsb_listen_channel(struct hpsb_highlevel *hl, struct hpsb_host *host,
void hpsb_unlisten_channel(struct hpsb_highlevel *hl, struct hpsb_host *host, void hpsb_unlisten_channel(struct hpsb_highlevel *hl, struct hpsb_host *host,
unsigned int channel); unsigned int channel);
/* Retrieve a hostinfo pointer bound to this driver/host */ /* Retrieve a hostinfo pointer bound to this driver/host */
void *hpsb_get_hostinfo(struct hpsb_highlevel *hl, struct hpsb_host *host); void *hpsb_get_hostinfo(struct hpsb_highlevel *hl, struct hpsb_host *host);
...@@ -172,19 +164,24 @@ void *hpsb_create_hostinfo(struct hpsb_highlevel *hl, struct hpsb_host *host, ...@@ -172,19 +164,24 @@ void *hpsb_create_hostinfo(struct hpsb_highlevel *hl, struct hpsb_host *host,
void hpsb_destroy_hostinfo(struct hpsb_highlevel *hl, struct hpsb_host *host); void hpsb_destroy_hostinfo(struct hpsb_highlevel *hl, struct hpsb_host *host);
/* Set an alternate lookup key for the hostinfo bound to this driver/host */ /* Set an alternate lookup key for the hostinfo bound to this driver/host */
void hpsb_set_hostinfo_key(struct hpsb_highlevel *hl, struct hpsb_host *host, unsigned long key); void hpsb_set_hostinfo_key(struct hpsb_highlevel *hl, struct hpsb_host *host,
unsigned long key);
/* Retrieve the alternate lookup key for the hostinfo bound to this driver/host */ /* Retrieve the alternate lookup key for the hostinfo bound to this
unsigned long hpsb_get_hostinfo_key(struct hpsb_highlevel *hl, struct hpsb_host *host); * driver/host */
unsigned long hpsb_get_hostinfo_key(struct hpsb_highlevel *hl,
struct hpsb_host *host);
/* Retrieve a hostinfo pointer bound to this driver using its alternate key */ /* Retrieve a hostinfo pointer bound to this driver using its alternate key */
void *hpsb_get_hostinfo_bykey(struct hpsb_highlevel *hl, unsigned long key); void *hpsb_get_hostinfo_bykey(struct hpsb_highlevel *hl, unsigned long key);
/* Set the hostinfo pointer to something useful. Usually follows a call to /* Set the hostinfo pointer to something useful. Usually follows a call to
* hpsb_create_hostinfo, where the size is 0. */ * hpsb_create_hostinfo, where the size is 0. */
int hpsb_set_hostinfo(struct hpsb_highlevel *hl, struct hpsb_host *host, void *data); int hpsb_set_hostinfo(struct hpsb_highlevel *hl, struct hpsb_host *host,
void *data);
/* Retrieve hpsb_host using a highlevel handle and a key */ /* Retrieve hpsb_host using a highlevel handle and a key */
struct hpsb_host *hpsb_get_host_bykey(struct hpsb_highlevel *hl, unsigned long key); struct hpsb_host *hpsb_get_host_bykey(struct hpsb_highlevel *hl,
unsigned long key);
#endif /* IEEE1394_HIGHLEVEL_H */ #endif /* IEEE1394_HIGHLEVEL_H */
...@@ -112,7 +112,7 @@ enum devctl_cmd { ...@@ -112,7 +112,7 @@ enum devctl_cmd {
enum isoctl_cmd { enum isoctl_cmd {
/* rawiso API - see iso.h for the meanings of these commands /* rawiso API - see iso.h for the meanings of these commands
(they correspond exactly to the hpsb_iso_* API functions) * (they correspond exactly to the hpsb_iso_* API functions)
* INIT = allocate resources * INIT = allocate resources
* START = begin transmission/reception * START = begin transmission/reception
* STOP = halt transmission/reception * STOP = halt transmission/reception
...@@ -160,7 +160,8 @@ struct hpsb_host_driver { ...@@ -160,7 +160,8 @@ struct hpsb_host_driver {
/* The hardware driver may optionally support a function that is used /* The hardware driver may optionally support a function that is used
* to set the hardware ConfigROM if the hardware supports handling * to set the hardware ConfigROM if the hardware supports handling
* reads to the ConfigROM on its own. */ * reads to the ConfigROM on its own. */
void (*set_hw_config_rom) (struct hpsb_host *host, quadlet_t *config_rom); void (*set_hw_config_rom)(struct hpsb_host *host,
quadlet_t *config_rom);
/* This function shall implement packet transmission based on /* This function shall implement packet transmission based on
* packet->type. It shall CRC both parts of the packet (unless * packet->type. It shall CRC both parts of the packet (unless
...@@ -170,20 +171,21 @@ struct hpsb_host_driver { ...@@ -170,20 +171,21 @@ struct hpsb_host_driver {
* called. Return 0 on success, negative errno on failure. * called. Return 0 on success, negative errno on failure.
* NOTE: The function must be callable in interrupt context. * NOTE: The function must be callable in interrupt context.
*/ */
int (*transmit_packet) (struct hpsb_host *host, int (*transmit_packet)(struct hpsb_host *host,
struct hpsb_packet *packet); struct hpsb_packet *packet);
/* This function requests miscellanous services from the driver, see /* This function requests miscellanous services from the driver, see
* above for command codes and expected actions. Return -1 for unknown * above for command codes and expected actions. Return -1 for unknown
* command, though that should never happen. * command, though that should never happen.
*/ */
int (*devctl) (struct hpsb_host *host, enum devctl_cmd command, int arg); int (*devctl)(struct hpsb_host *host, enum devctl_cmd command, int arg);
/* ISO transmission/reception functions. Return 0 on success, -1 /* ISO transmission/reception functions. Return 0 on success, -1
* (or -EXXX errno code) on failure. If the low-level driver does not * (or -EXXX errno code) on failure. If the low-level driver does not
* support the new ISO API, set isoctl to NULL. * support the new ISO API, set isoctl to NULL.
*/ */
int (*isoctl) (struct hpsb_iso *iso, enum isoctl_cmd command, unsigned long arg); int (*isoctl)(struct hpsb_iso *iso, enum isoctl_cmd command,
unsigned long arg);
/* This function is mainly to redirect local CSR reads/locks to the iso /* This function is mainly to redirect local CSR reads/locks to the iso
* management registers (bus manager id, bandwidth available, channels * management registers (bus manager id, bandwidth available, channels
...@@ -196,7 +198,6 @@ struct hpsb_host_driver { ...@@ -196,7 +198,6 @@ struct hpsb_host_driver {
quadlet_t data, quadlet_t compare); quadlet_t data, quadlet_t compare);
}; };
struct hpsb_host *hpsb_alloc_host(struct hpsb_host_driver *drv, size_t extra, struct hpsb_host *hpsb_alloc_host(struct hpsb_host_driver *drv, size_t extra,
struct device *dev); struct device *dev);
int hpsb_add_host(struct hpsb_host *host); int hpsb_add_host(struct hpsb_host *host);
......
/* Base file for all ieee1394 ioctl's. Linux-1394 has allocated base '#' /*
* with a range of 0x00-0x3f. */ * Base file for all ieee1394 ioctl's.
* Linux-1394 has allocated base '#' with a range of 0x00-0x3f.
*/
#ifndef __IEEE1394_IOCTL_H #ifndef __IEEE1394_IOCTL_H
#define __IEEE1394_IOCTL_H #define __IEEE1394_IOCTL_H
...@@ -99,5 +101,4 @@ ...@@ -99,5 +101,4 @@
#define RAW1394_IOC_ISO_RECV_FLUSH \ #define RAW1394_IOC_ISO_RECV_FLUSH \
_IO ('#', 0x29) _IO ('#', 0x29)
#endif /* __IEEE1394_IOCTL_H */ #endif /* __IEEE1394_IOCTL_H */
...@@ -48,20 +48,19 @@ ...@@ -48,20 +48,19 @@
#define ACKX_ABORTED (-3) #define ACKX_ABORTED (-3)
#define ACKX_TIMEOUT (-4) #define ACKX_TIMEOUT (-4)
#define IEEE1394_SPEED_100 0x00 #define IEEE1394_SPEED_100 0x00
#define IEEE1394_SPEED_200 0x01 #define IEEE1394_SPEED_200 0x01
#define IEEE1394_SPEED_400 0x02 #define IEEE1394_SPEED_400 0x02
#define IEEE1394_SPEED_800 0x03 #define IEEE1394_SPEED_800 0x03
#define IEEE1394_SPEED_1600 0x04 #define IEEE1394_SPEED_1600 0x04
#define IEEE1394_SPEED_3200 0x05 #define IEEE1394_SPEED_3200 0x05
/* The current highest tested speed supported by the subsystem */ /* The current highest tested speed supported by the subsystem */
#define IEEE1394_SPEED_MAX IEEE1394_SPEED_800 #define IEEE1394_SPEED_MAX IEEE1394_SPEED_800
/* Maps speed values above to a string representation */ /* Maps speed values above to a string representation */
extern const char *hpsb_speedto_str[]; extern const char *hpsb_speedto_str[];
/* 1394a cable PHY packets */ /* 1394a cable PHY packets */
#define SELFID_PWRCL_NO_POWER 0x0 #define SELFID_PWRCL_NO_POWER 0x0
#define SELFID_PWRCL_PROVIDE_15W 0x1 #define SELFID_PWRCL_PROVIDE_15W 0x1
...@@ -217,5 +216,4 @@ struct ext_selfid { ...@@ -217,5 +216,4 @@ struct ext_selfid {
#error What? PDP endian? #error What? PDP endian?
#endif /* __BIG_ENDIAN_BITFIELD */ #endif /* __BIG_ENDIAN_BITFIELD */
#endif /* _IEEE1394_IEEE1394_H */ #endif /* _IEEE1394_IEEE1394_H */
...@@ -58,7 +58,6 @@ struct hpsb_packet { ...@@ -58,7 +58,6 @@ struct hpsb_packet {
size_t header_size; size_t header_size;
size_t data_size; size_t data_size;
struct hpsb_host *host; struct hpsb_host *host;
unsigned int generation; unsigned int generation;
...@@ -92,7 +91,6 @@ void abort_timedouts(unsigned long __opaque); ...@@ -92,7 +91,6 @@ void abort_timedouts(unsigned long __opaque);
struct hpsb_packet *hpsb_alloc_packet(size_t data_size); struct hpsb_packet *hpsb_alloc_packet(size_t data_size);
void hpsb_free_packet(struct hpsb_packet *packet); void hpsb_free_packet(struct hpsb_packet *packet);
/* /*
* Generation counter for the complete 1394 subsystem. Generation gets * Generation counter for the complete 1394 subsystem. Generation gets
* incremented on every change in the subsystem (e.g. bus reset). * incremented on every change in the subsystem (e.g. bus reset).
...@@ -204,10 +202,14 @@ void hpsb_packet_received(struct hpsb_host *host, quadlet_t *data, size_t size, ...@@ -204,10 +202,14 @@ void hpsb_packet_received(struct hpsb_host *host, quadlet_t *data, size_t size,
#define IEEE1394_MINOR_BLOCK_EXPERIMENTAL 15 #define IEEE1394_MINOR_BLOCK_EXPERIMENTAL 15
#define IEEE1394_CORE_DEV MKDEV(IEEE1394_MAJOR, 0) #define IEEE1394_CORE_DEV MKDEV(IEEE1394_MAJOR, 0)
#define IEEE1394_RAW1394_DEV MKDEV(IEEE1394_MAJOR, IEEE1394_MINOR_BLOCK_RAW1394 * 16) #define IEEE1394_RAW1394_DEV MKDEV(IEEE1394_MAJOR, \
#define IEEE1394_VIDEO1394_DEV MKDEV(IEEE1394_MAJOR, IEEE1394_MINOR_BLOCK_VIDEO1394 * 16) IEEE1394_MINOR_BLOCK_RAW1394 * 16)
#define IEEE1394_DV1394_DEV MKDEV(IEEE1394_MAJOR, IEEE1394_MINOR_BLOCK_DV1394 * 16) #define IEEE1394_VIDEO1394_DEV MKDEV(IEEE1394_MAJOR, \
#define IEEE1394_EXPERIMENTAL_DEV MKDEV(IEEE1394_MAJOR, IEEE1394_MINOR_BLOCK_EXPERIMENTAL * 16) IEEE1394_MINOR_BLOCK_VIDEO1394 * 16)
#define IEEE1394_DV1394_DEV MKDEV(IEEE1394_MAJOR, \
IEEE1394_MINOR_BLOCK_DV1394 * 16)
#define IEEE1394_EXPERIMENTAL_DEV MKDEV(IEEE1394_MAJOR, \
IEEE1394_MINOR_BLOCK_EXPERIMENTAL * 16)
/* return the index (within a minor number block) of a file */ /* return the index (within a minor number block) of a file */
static inline unsigned char ieee1394_file_to_instance(struct file *file) static inline unsigned char ieee1394_file_to_instance(struct file *file)
...@@ -223,4 +225,3 @@ extern struct class hpsb_host_class; ...@@ -223,4 +225,3 @@ extern struct class hpsb_host_class;
extern struct class *hpsb_protocol_class; extern struct class *hpsb_protocol_class;
#endif /* _IEEE1394_CORE_H */ #endif /* _IEEE1394_CORE_H */
...@@ -3,30 +3,25 @@ ...@@ -3,30 +3,25 @@
#include "ieee1394_core.h" #include "ieee1394_core.h"
/*
* Get and free transaction labels.
*/
int hpsb_get_tlabel(struct hpsb_packet *packet); int hpsb_get_tlabel(struct hpsb_packet *packet);
void hpsb_free_tlabel(struct hpsb_packet *packet); void hpsb_free_tlabel(struct hpsb_packet *packet);
struct hpsb_packet *hpsb_make_readpacket(struct hpsb_host *host, nodeid_t node, struct hpsb_packet *hpsb_make_readpacket(struct hpsb_host *host, nodeid_t node,
u64 addr, size_t length); u64 addr, size_t length);
struct hpsb_packet *hpsb_make_lockpacket(struct hpsb_host *host, nodeid_t node, struct hpsb_packet *hpsb_make_lockpacket(struct hpsb_host *host, nodeid_t node,
u64 addr, int extcode, quadlet_t *data, u64 addr, int extcode, quadlet_t *data,
quadlet_t arg); quadlet_t arg);
struct hpsb_packet *hpsb_make_lock64packet(struct hpsb_host *host, nodeid_t node, struct hpsb_packet *hpsb_make_lock64packet(struct hpsb_host *host,
u64 addr, int extcode, octlet_t *data, nodeid_t node, u64 addr, int extcode,
octlet_t arg); octlet_t *data, octlet_t arg);
struct hpsb_packet *hpsb_make_phypacket(struct hpsb_host *host, struct hpsb_packet *hpsb_make_phypacket(struct hpsb_host *host, quadlet_t data);
quadlet_t data) ; struct hpsb_packet *hpsb_make_isopacket(struct hpsb_host *host, int length,
struct hpsb_packet *hpsb_make_isopacket(struct hpsb_host *host, int channel, int tag, int sync);
int length, int channel, struct hpsb_packet *hpsb_make_writepacket(struct hpsb_host *host,
int tag, int sync); nodeid_t node, u64 addr,
struct hpsb_packet *hpsb_make_writepacket (struct hpsb_host *host, nodeid_t node, quadlet_t *buffer, size_t length);
u64 addr, quadlet_t *buffer, size_t length);
struct hpsb_packet *hpsb_make_streampacket(struct hpsb_host *host, u8 *buffer, struct hpsb_packet *hpsb_make_streampacket(struct hpsb_host *host, u8 *buffer,
int length, int channel, int tag, int sync); int length, int channel, int tag,
int sync);
/* /*
* hpsb_packet_success - Make sense of the ack and reply codes and * hpsb_packet_success - Make sense of the ack and reply codes and
...@@ -40,9 +35,8 @@ struct hpsb_packet *hpsb_make_streampacket(struct hpsb_host *host, u8 *buffer, ...@@ -40,9 +35,8 @@ struct hpsb_packet *hpsb_make_streampacket(struct hpsb_host *host, u8 *buffer,
*/ */
int hpsb_packet_success(struct hpsb_packet *packet); int hpsb_packet_success(struct hpsb_packet *packet);
/* /*
* The generic read, write and lock functions. All recognize the local node ID * The generic read and write functions. All recognize the local node ID
* and act accordingly. Read and write automatically use quadlet commands if * and act accordingly. Read and write automatically use quadlet commands if
* length == 4 and and block commands otherwise (however, they do not yet * length == 4 and and block commands otherwise (however, they do not yet
* support lengths that are not a multiple of 4). You must explicitly specifiy * support lengths that are not a multiple of 4). You must explicitly specifiy
......
...@@ -31,7 +31,6 @@ do { \ ...@@ -31,7 +31,6 @@ do { \
sema_init(&(_tp)->count, 63); \ sema_init(&(_tp)->count, 63); \
} while (0) } while (0)
typedef u32 quadlet_t; typedef u32 quadlet_t;
typedef u64 octlet_t; typedef u64 octlet_t;
typedef u16 nodeid_t; typedef u16 nodeid_t;
...@@ -54,7 +53,8 @@ typedef u16 arm_length_t; ...@@ -54,7 +53,8 @@ typedef u16 arm_length_t;
#define NODE_BUS_ARGS(__host, __nodeid) \ #define NODE_BUS_ARGS(__host, __nodeid) \
__host->id, NODEID_TO_NODE(__nodeid), NODEID_TO_BUS(__nodeid) __host->id, NODEID_TO_NODE(__nodeid), NODEID_TO_BUS(__nodeid)
#define HPSB_PRINT(level, fmt, args...) printk(level "ieee1394: " fmt "\n" , ## args) #define HPSB_PRINT(level, fmt, args...) \
printk(level "ieee1394: " fmt "\n" , ## args)
#define HPSB_DEBUG(fmt, args...) HPSB_PRINT(KERN_DEBUG, fmt , ## args) #define HPSB_DEBUG(fmt, args...) HPSB_PRINT(KERN_DEBUG, fmt , ## args)
#define HPSB_INFO(fmt, args...) HPSB_PRINT(KERN_INFO, fmt , ## args) #define HPSB_INFO(fmt, args...) HPSB_PRINT(KERN_INFO, fmt , ## args)
...@@ -81,11 +81,8 @@ static inline void *memcpy_le32(u32 *dest, const u32 *__src, size_t count) ...@@ -81,11 +81,8 @@ static inline void *memcpy_le32(u32 *dest, const u32 *__src, size_t count)
u32 *src = (u32 *)__src; u32 *src = (u32 *)__src;
count /= 4; count /= 4;
while (count--)
while (count--) {
*dest++ = swab32p(src++); *dest++ = swab32p(src++);
}
return tmp; return tmp;
} }
......
...@@ -17,28 +17,30 @@ ...@@ -17,28 +17,30 @@
/* high-level ISO interface */ /* high-level ISO interface */
/* This API sends and receives isochronous packets on a large, /*
virtually-contiguous kernel memory buffer. The buffer may be mapped * This API sends and receives isochronous packets on a large,
into a user-space process for zero-copy transmission and reception. * virtually-contiguous kernel memory buffer. The buffer may be mapped
* into a user-space process for zero-copy transmission and reception.
There are no explicit boundaries between packets in the buffer. A *
packet may be transmitted or received at any location. However, * There are no explicit boundaries between packets in the buffer. A
low-level drivers may impose certain restrictions on alignment or * packet may be transmitted or received at any location. However,
size of packets. (e.g. in OHCI no packet may cross a page boundary, * low-level drivers may impose certain restrictions on alignment or
and packets should be quadlet-aligned) * size of packets. (e.g. in OHCI no packet may cross a page boundary,
*/ * and packets should be quadlet-aligned)
*/
/* Packet descriptor - the API maintains a ring buffer of these packet /* Packet descriptor - the API maintains a ring buffer of these packet
descriptors in kernel memory (hpsb_iso.infos[]). */ * descriptors in kernel memory (hpsb_iso.infos[]). */
struct hpsb_iso_packet_info { struct hpsb_iso_packet_info {
/* offset of data payload relative to the first byte of the buffer */ /* offset of data payload relative to the first byte of the buffer */
__u32 offset; __u32 offset;
/* length of the data payload, in bytes (not including the isochronous header) */ /* length of the data payload, in bytes (not including the isochronous
* header) */
__u16 len; __u16 len;
/* (recv only) the cycle number (mod 8000) on which the packet was received */ /* (recv only) the cycle number (mod 8000) on which the packet was
* received */
__u16 cycle; __u16 cycle;
/* (recv only) channel on which the packet was received */ /* (recv only) channel on which the packet was received */
...@@ -48,12 +50,10 @@ struct hpsb_iso_packet_info { ...@@ -48,12 +50,10 @@ struct hpsb_iso_packet_info {
__u8 tag; __u8 tag;
__u8 sy; __u8 sy;
/* /* length in bytes of the packet including header/trailer.
* length in bytes of the packet including header/trailer. * MUST be at structure end, since the first part of this structure is
* MUST be at structure end, since the first part of this structure is also * also defined in raw1394.h (i.e. struct raw1394_iso_packet_info), is
* defined in raw1394.h (i.e. struct raw1394_iso_packet_info), is copied to * copied to userspace and is accessed there through libraw1394. */
* userspace and is accessed there through libraw1394.
*/
__u16 total_len; __u16 total_len;
}; };
...@@ -75,8 +75,8 @@ struct hpsb_iso { ...@@ -75,8 +75,8 @@ struct hpsb_iso {
void *hostdata; void *hostdata;
/* a function to be called (from interrupt context) after /* a function to be called (from interrupt context) after
outgoing packets have been sent, or incoming packets have * outgoing packets have been sent, or incoming packets have
arrived */ * arrived */
void (*callback)(struct hpsb_iso*); void (*callback)(struct hpsb_iso*);
/* wait for buffer space */ /* wait for buffer space */
...@@ -88,7 +88,7 @@ struct hpsb_iso { ...@@ -88,7 +88,7 @@ struct hpsb_iso {
/* greatest # of packets between interrupts - controls /* greatest # of packets between interrupts - controls
the maximum latency of the buffer */ * the maximum latency of the buffer */
int irq_interval; int irq_interval;
/* the buffer for packet data payloads */ /* the buffer for packet data payloads */
...@@ -112,8 +112,8 @@ struct hpsb_iso { ...@@ -112,8 +112,8 @@ struct hpsb_iso {
int pkt_dma; int pkt_dma;
/* how many packets, starting at first_packet: /* how many packets, starting at first_packet:
(transmit) are ready to be filled with data * (transmit) are ready to be filled with data
(receive) contain received data */ * (receive) contain received data */
int n_ready_packets; int n_ready_packets;
/* how many times the buffer has overflowed or underflowed */ /* how many times the buffer has overflowed or underflowed */
...@@ -134,7 +134,7 @@ struct hpsb_iso { ...@@ -134,7 +134,7 @@ struct hpsb_iso {
int start_cycle; int start_cycle;
/* cycle at which next packet will be transmitted, /* cycle at which next packet will be transmitted,
-1 if not known */ * -1 if not known */
int xmit_cycle; int xmit_cycle;
/* ringbuffer of packet descriptors in regular kernel memory /* ringbuffer of packet descriptors in regular kernel memory
...@@ -170,25 +170,30 @@ int hpsb_iso_recv_unlisten_channel(struct hpsb_iso *iso, unsigned char channel); ...@@ -170,25 +170,30 @@ int hpsb_iso_recv_unlisten_channel(struct hpsb_iso *iso, unsigned char channel);
int hpsb_iso_recv_set_channel_mask(struct hpsb_iso *iso, u64 mask); int hpsb_iso_recv_set_channel_mask(struct hpsb_iso *iso, u64 mask);
/* start/stop DMA */ /* start/stop DMA */
int hpsb_iso_xmit_start(struct hpsb_iso *iso, int start_on_cycle, int prebuffer); int hpsb_iso_xmit_start(struct hpsb_iso *iso, int start_on_cycle,
int hpsb_iso_recv_start(struct hpsb_iso *iso, int start_on_cycle, int tag_mask, int sync); int prebuffer);
int hpsb_iso_recv_start(struct hpsb_iso *iso, int start_on_cycle,
int tag_mask, int sync);
void hpsb_iso_stop(struct hpsb_iso *iso); void hpsb_iso_stop(struct hpsb_iso *iso);
/* deallocate buffer and DMA context */ /* deallocate buffer and DMA context */
void hpsb_iso_shutdown(struct hpsb_iso *iso); void hpsb_iso_shutdown(struct hpsb_iso *iso);
/* queue a packet for transmission. 'offset' is relative to the beginning of the /* queue a packet for transmission.
DMA buffer, where the packet's data payload should already have been placed */ * 'offset' is relative to the beginning of the DMA buffer, where the packet's
int hpsb_iso_xmit_queue_packet(struct hpsb_iso *iso, u32 offset, u16 len, u8 tag, u8 sy); * data payload should already have been placed. */
int hpsb_iso_xmit_queue_packet(struct hpsb_iso *iso, u32 offset, u16 len,
u8 tag, u8 sy);
/* wait until all queued packets have been transmitted to the bus */ /* wait until all queued packets have been transmitted to the bus */
int hpsb_iso_xmit_sync(struct hpsb_iso *iso); int hpsb_iso_xmit_sync(struct hpsb_iso *iso);
/* N packets have been read out of the buffer, re-use the buffer space */ /* N packets have been read out of the buffer, re-use the buffer space */
int hpsb_iso_recv_release_packets(struct hpsb_iso *recv, unsigned int n_packets); int hpsb_iso_recv_release_packets(struct hpsb_iso *recv,
unsigned int n_packets);
/* check for arrival of new packets immediately (even if irq_interval /* check for arrival of new packets immediately (even if irq_interval
has not yet been reached) */ * has not yet been reached) */
int hpsb_iso_recv_flush(struct hpsb_iso *iso); int hpsb_iso_recv_flush(struct hpsb_iso *iso);
/* returns # of packets ready to send or receive */ /* returns # of packets ready to send or receive */
...@@ -197,14 +202,15 @@ int hpsb_iso_n_ready(struct hpsb_iso *iso); ...@@ -197,14 +202,15 @@ int hpsb_iso_n_ready(struct hpsb_iso *iso);
/* the following are callbacks available to low-level drivers */ /* the following are callbacks available to low-level drivers */
/* call after a packet has been transmitted to the bus (interrupt context is OK) /* call after a packet has been transmitted to the bus (interrupt context is OK)
'cycle' is the _exact_ cycle the packet was sent on * 'cycle' is the _exact_ cycle the packet was sent on
'error' should be non-zero if some sort of error occurred when sending the packet * 'error' should be non-zero if some sort of error occurred when sending the
*/ * packet */
void hpsb_iso_packet_sent(struct hpsb_iso *iso, int cycle, int error); void hpsb_iso_packet_sent(struct hpsb_iso *iso, int cycle, int error);
/* call after a packet has been received (interrupt context OK) */ /* call after a packet has been received (interrupt context OK) */
void hpsb_iso_packet_received(struct hpsb_iso *iso, u32 offset, u16 len, void hpsb_iso_packet_received(struct hpsb_iso *iso, u32 offset, u16 len,
u16 total_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. */ /* call to wake waiting processes after buffer space has opened up. */
void hpsb_iso_wake(struct hpsb_iso *iso); void hpsb_iso_wake(struct hpsb_iso *iso);
......
...@@ -44,7 +44,6 @@ struct bus_options { ...@@ -44,7 +44,6 @@ struct bus_options {
u16 max_rec; /* Maximum packet size node can receive */ u16 max_rec; /* Maximum packet size node can receive */
}; };
#define UNIT_DIRECTORY_VENDOR_ID 0x01 #define UNIT_DIRECTORY_VENDOR_ID 0x01
#define UNIT_DIRECTORY_MODEL_ID 0x02 #define UNIT_DIRECTORY_MODEL_ID 0x02
#define UNIT_DIRECTORY_SPECIFIER_ID 0x04 #define UNIT_DIRECTORY_SPECIFIER_ID 0x04
...@@ -79,7 +78,6 @@ struct unit_directory { ...@@ -79,7 +78,6 @@ struct unit_directory {
int length; /* Number of quadlets */ int length; /* Number of quadlets */
struct device device; struct device device;
struct class_device class_dev; struct class_device class_dev;
struct csr1212_keyval *ud_kv; struct csr1212_keyval *ud_kv;
...@@ -106,7 +104,6 @@ struct node_entry { ...@@ -106,7 +104,6 @@ struct node_entry {
struct hpsb_tlabel_pool *tpool; struct hpsb_tlabel_pool *tpool;
struct device device; struct device device;
struct class_device class_dev; struct class_device class_dev;
/* Means this node is not attached anymore */ /* Means this node is not attached anymore */
...@@ -153,8 +150,8 @@ static inline int hpsb_node_entry_valid(struct node_entry *ne) ...@@ -153,8 +150,8 @@ static inline int hpsb_node_entry_valid(struct node_entry *ne)
/* /*
* This will fill in the given, pre-initialised hpsb_packet with the current * This will fill in the given, pre-initialised hpsb_packet with the current
* information from the node entry (host, node ID, generation number). It will * information from the node entry (host, node ID, generation number). It will
* return false if the node owning the GUID is not accessible (and not modify the * return false if the node owning the GUID is not accessible (and not modify
* hpsb_packet) and return true otherwise. * the hpsb_packet) and return true otherwise.
* *
* Note that packet sending may still fail in hpsb_send_packet if a bus reset * Note that packet sending may still fail in hpsb_send_packet if a bus reset
* happens while you are trying to set up the packet (due to obsolete generation * happens while you are trying to set up the packet (due to obsolete generation
...@@ -170,16 +167,13 @@ int hpsb_node_write(struct node_entry *ne, u64 addr, ...@@ -170,16 +167,13 @@ int hpsb_node_write(struct node_entry *ne, u64 addr,
int hpsb_node_lock(struct node_entry *ne, u64 addr, int hpsb_node_lock(struct node_entry *ne, u64 addr,
int extcode, quadlet_t *data, quadlet_t arg); int extcode, quadlet_t *data, quadlet_t arg);
/* Iterate the hosts, calling a given function with supplied data for each /* Iterate the hosts, calling a given function with supplied data for each
* host. */ * host. */
int nodemgr_for_each_host(void *__data, int (*cb)(struct hpsb_host *, void *)); int nodemgr_for_each_host(void *__data, int (*cb)(struct hpsb_host *, void *));
int init_ieee1394_nodemgr(void); int init_ieee1394_nodemgr(void);
void cleanup_ieee1394_nodemgr(void); void cleanup_ieee1394_nodemgr(void);
/* The template for a host device */ /* The template for a host device */
extern struct device nodemgr_dev_template_host; extern struct device nodemgr_dev_template_host;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment