diff options
author | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2006-07-03 12:02:28 -0400 |
---|---|---|
committer | Ben Collins <bcollins@ubuntu.com> | 2006-07-03 12:02:28 -0400 |
commit | e1d118f16dca0f54faba3e8dd5b6adbbf7ac68c8 (patch) | |
tree | fffc9d2b1fbe3fe6bb55758e2a6951ad9c581e63 /drivers/ieee1394 | |
parent | 2b01b80b944b3abf623c8acc2b5537a85b5ebd3c (diff) |
[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: Stefan Richter <stefanr@s5r6.in-berlin.de>
Signed-off-by: Ben Collins <bcollins@ubuntu.com>
Diffstat (limited to 'drivers/ieee1394')
-rw-r--r-- | drivers/ieee1394/csr.h | 98 | ||||
-rw-r--r-- | drivers/ieee1394/dma.h | 81 | ||||
-rw-r--r-- | drivers/ieee1394/highlevel.h | 197 | ||||
-rw-r--r-- | drivers/ieee1394/hosts.h | 15 | ||||
-rw-r--r-- | drivers/ieee1394/ieee1394-ioctl.h | 9 | ||||
-rw-r--r-- | drivers/ieee1394/ieee1394.h | 314 | ||||
-rw-r--r-- | drivers/ieee1394/ieee1394_core.h | 17 | ||||
-rw-r--r-- | drivers/ieee1394/ieee1394_transactions.h | 32 | ||||
-rw-r--r-- | drivers/ieee1394/ieee1394_types.h | 31 | ||||
-rw-r--r-- | drivers/ieee1394/iso.h | 80 | ||||
-rw-r--r-- | drivers/ieee1394/nodemgr.h | 16 |
11 files changed, 449 insertions, 441 deletions
diff --git a/drivers/ieee1394/csr.h b/drivers/ieee1394/csr.h index ea9aa4f53ab6..0655596f25d3 100644 --- a/drivers/ieee1394/csr.h +++ b/drivers/ieee1394/csr.h | |||
@@ -8,68 +8,68 @@ | |||
8 | 8 | ||
9 | #include "csr1212.h" | 9 | #include "csr1212.h" |
10 | 10 | ||
11 | #define CSR_REGISTER_BASE 0xfffff0000000ULL | 11 | #define CSR_REGISTER_BASE 0xfffff0000000ULL |
12 | 12 | ||
13 | /* register offsets relative to CSR_REGISTER_BASE */ | 13 | /* register offsets relative to CSR_REGISTER_BASE */ |
14 | #define CSR_STATE_CLEAR 0x0 | 14 | #define CSR_STATE_CLEAR 0x0 |
15 | #define CSR_STATE_SET 0x4 | 15 | #define CSR_STATE_SET 0x4 |
16 | #define CSR_NODE_IDS 0x8 | 16 | #define CSR_NODE_IDS 0x8 |
17 | #define CSR_RESET_START 0xc | 17 | #define CSR_RESET_START 0xc |
18 | #define CSR_SPLIT_TIMEOUT_HI 0x18 | 18 | #define CSR_SPLIT_TIMEOUT_HI 0x18 |
19 | #define CSR_SPLIT_TIMEOUT_LO 0x1c | 19 | #define CSR_SPLIT_TIMEOUT_LO 0x1c |
20 | #define CSR_CYCLE_TIME 0x200 | 20 | #define CSR_CYCLE_TIME 0x200 |
21 | #define CSR_BUS_TIME 0x204 | 21 | #define CSR_BUS_TIME 0x204 |
22 | #define CSR_BUSY_TIMEOUT 0x210 | 22 | #define CSR_BUSY_TIMEOUT 0x210 |
23 | #define CSR_BUS_MANAGER_ID 0x21c | 23 | #define CSR_BUS_MANAGER_ID 0x21c |
24 | #define CSR_BANDWIDTH_AVAILABLE 0x220 | 24 | #define CSR_BANDWIDTH_AVAILABLE 0x220 |
25 | #define CSR_CHANNELS_AVAILABLE 0x224 | 25 | #define CSR_CHANNELS_AVAILABLE 0x224 |
26 | #define CSR_CHANNELS_AVAILABLE_HI 0x224 | 26 | #define CSR_CHANNELS_AVAILABLE_HI 0x224 |
27 | #define CSR_CHANNELS_AVAILABLE_LO 0x228 | 27 | #define CSR_CHANNELS_AVAILABLE_LO 0x228 |
28 | #define CSR_BROADCAST_CHANNEL 0x234 | 28 | #define CSR_BROADCAST_CHANNEL 0x234 |
29 | #define CSR_CONFIG_ROM 0x400 | 29 | #define CSR_CONFIG_ROM 0x400 |
30 | #define CSR_CONFIG_ROM_END 0x800 | 30 | #define CSR_CONFIG_ROM_END 0x800 |
31 | #define CSR_FCP_COMMAND 0xB00 | 31 | #define CSR_FCP_COMMAND 0xB00 |
32 | #define CSR_FCP_RESPONSE 0xD00 | 32 | #define CSR_FCP_RESPONSE 0xD00 |
33 | #define CSR_FCP_END 0xF00 | 33 | #define CSR_FCP_END 0xF00 |
34 | #define CSR_TOPOLOGY_MAP 0x1000 | 34 | #define CSR_TOPOLOGY_MAP 0x1000 |
35 | #define CSR_TOPOLOGY_MAP_END 0x1400 | 35 | #define CSR_TOPOLOGY_MAP_END 0x1400 |
36 | #define CSR_SPEED_MAP 0x2000 | 36 | #define CSR_SPEED_MAP 0x2000 |
37 | #define CSR_SPEED_MAP_END 0x3000 | 37 | #define CSR_SPEED_MAP_END 0x3000 |
38 | 38 | ||
39 | /* IEEE 1394 bus specific Configuration ROM Key IDs */ | 39 | /* IEEE 1394 bus specific Configuration ROM Key IDs */ |
40 | #define IEEE1394_KV_ID_POWER_REQUIREMENTS (0x30) | 40 | #define IEEE1394_KV_ID_POWER_REQUIREMENTS (0x30) |
41 | 41 | ||
42 | /* IEEE 1394 Bus Inforamation Block specifics */ | 42 | /* IEEE 1394 Bus Information Block specifics */ |
43 | #define CSR_BUS_INFO_SIZE (5 * sizeof(quadlet_t)) | 43 | #define CSR_BUS_INFO_SIZE (5 * sizeof(quadlet_t)) |
44 | 44 | ||
45 | #define CSR_IRMC_SHIFT 31 | 45 | #define CSR_IRMC_SHIFT 31 |
46 | #define CSR_CMC_SHIFT 30 | 46 | #define CSR_CMC_SHIFT 30 |
47 | #define CSR_ISC_SHIFT 29 | 47 | #define CSR_ISC_SHIFT 29 |
48 | #define CSR_BMC_SHIFT 28 | 48 | #define CSR_BMC_SHIFT 28 |
49 | #define CSR_PMC_SHIFT 27 | 49 | #define CSR_PMC_SHIFT 27 |
50 | #define CSR_CYC_CLK_ACC_SHIFT 16 | 50 | #define CSR_CYC_CLK_ACC_SHIFT 16 |
51 | #define CSR_MAX_REC_SHIFT 12 | 51 | #define CSR_MAX_REC_SHIFT 12 |
52 | #define CSR_MAX_ROM_SHIFT 8 | 52 | #define CSR_MAX_ROM_SHIFT 8 |
53 | #define CSR_GENERATION_SHIFT 4 | 53 | #define CSR_GENERATION_SHIFT 4 |
54 | 54 | ||
55 | #define CSR_SET_BUS_INFO_GENERATION(csr, gen) \ | 55 | #define CSR_SET_BUS_INFO_GENERATION(csr, gen) \ |
56 | ((csr)->bus_info_data[2] = \ | 56 | ((csr)->bus_info_data[2] = \ |
57 | cpu_to_be32((be32_to_cpu((csr)->bus_info_data[2]) & \ | 57 | cpu_to_be32((be32_to_cpu((csr)->bus_info_data[2]) & \ |
58 | ~(0xf << CSR_GENERATION_SHIFT)) | \ | 58 | ~(0xf << CSR_GENERATION_SHIFT)) | \ |
59 | (gen) << CSR_GENERATION_SHIFT)) | 59 | (gen) << CSR_GENERATION_SHIFT)) |
60 | 60 | ||
61 | struct csr_control { | 61 | struct csr_control { |
62 | spinlock_t lock; | 62 | spinlock_t lock; |
63 | 63 | ||
64 | quadlet_t state; | 64 | quadlet_t state; |
65 | quadlet_t node_ids; | 65 | quadlet_t node_ids; |
66 | quadlet_t split_timeout_hi, split_timeout_lo; | 66 | quadlet_t split_timeout_hi, split_timeout_lo; |
67 | unsigned long expire; // Calculated from split_timeout | 67 | unsigned long expire; /* Calculated from split_timeout */ |
68 | quadlet_t cycle_time; | 68 | quadlet_t cycle_time; |
69 | quadlet_t bus_time; | 69 | quadlet_t bus_time; |
70 | quadlet_t bus_manager_id; | 70 | quadlet_t bus_manager_id; |
71 | quadlet_t bandwidth_available; | 71 | quadlet_t bandwidth_available; |
72 | quadlet_t channels_available_hi, channels_available_lo; | 72 | quadlet_t channels_available_hi, channels_available_lo; |
73 | quadlet_t broadcast_channel; | 73 | quadlet_t broadcast_channel; |
74 | 74 | ||
75 | /* Bus Info */ | 75 | /* Bus Info */ |
@@ -84,8 +84,8 @@ struct csr_control { | |||
84 | 84 | ||
85 | struct csr1212_csr *rom; | 85 | struct csr1212_csr *rom; |
86 | 86 | ||
87 | quadlet_t topology_map[256]; | 87 | quadlet_t topology_map[256]; |
88 | quadlet_t speed_map[1024]; | 88 | quadlet_t speed_map[1024]; |
89 | }; | 89 | }; |
90 | 90 | ||
91 | extern struct csr1212_bus_ops csr_bus_ops; | 91 | extern struct csr1212_bus_ops csr_bus_ops; |
diff --git a/drivers/ieee1394/dma.h b/drivers/ieee1394/dma.h index 061550a6fb99..b0f0885c4551 100644 --- a/drivers/ieee1394/dma.h +++ b/drivers/ieee1394/dma.h | |||
@@ -13,66 +13,85 @@ | |||
13 | #include <linux/pci.h> | 13 | #include <linux/pci.h> |
14 | #include <asm/scatterlist.h> | 14 | #include <asm/scatterlist.h> |
15 | 15 | ||
16 | /* struct dma_prog_region | 16 | /** |
17 | 17 | * struct dma_prog_region - small contiguous DMA buffer | |
18 | a small, physically-contiguous DMA buffer with random-access, | 18 | * @kvirt: kernel virtual address |
19 | synchronous usage characteristics | 19 | * @dev: PCI device |
20 | */ | 20 | * @n_pages: number of kernel pages |
21 | 21 | * @bus_addr: base bus address | |
22 | * | ||
23 | * a small, physically contiguous DMA buffer with random-access, synchronous | ||
24 | * usage characteristics | ||
25 | */ | ||
22 | struct dma_prog_region { | 26 | struct dma_prog_region { |
23 | unsigned char *kvirt; /* kernel virtual address */ | 27 | unsigned char *kvirt; |
24 | struct pci_dev *dev; /* PCI device */ | 28 | struct pci_dev *dev; |
25 | unsigned int n_pages; /* # of kernel pages */ | 29 | unsigned int n_pages; |
26 | dma_addr_t bus_addr; /* base bus address */ | 30 | dma_addr_t bus_addr; |
27 | }; | 31 | }; |
28 | 32 | ||
29 | /* clear out all fields but do not allocate any memory */ | 33 | /* clear out all fields but do not allocate any memory */ |
30 | void dma_prog_region_init(struct dma_prog_region *prog); | 34 | void dma_prog_region_init(struct dma_prog_region *prog); |
31 | int dma_prog_region_alloc(struct dma_prog_region *prog, unsigned long n_bytes, struct pci_dev *dev); | 35 | int dma_prog_region_alloc(struct dma_prog_region *prog, unsigned long n_bytes, |
36 | struct pci_dev *dev); | ||
32 | void dma_prog_region_free(struct dma_prog_region *prog); | 37 | void dma_prog_region_free(struct dma_prog_region *prog); |
33 | 38 | ||
34 | static inline dma_addr_t dma_prog_region_offset_to_bus(struct dma_prog_region *prog, unsigned long offset) | 39 | static inline dma_addr_t dma_prog_region_offset_to_bus( |
40 | struct dma_prog_region *prog, unsigned long offset) | ||
35 | { | 41 | { |
36 | return prog->bus_addr + offset; | 42 | return prog->bus_addr + offset; |
37 | } | 43 | } |
38 | 44 | ||
39 | /* struct dma_region | 45 | /** |
40 | 46 | * struct dma_region - large non-contiguous DMA buffer | |
41 | a large, non-physically-contiguous DMA buffer with streaming, | 47 | * @virt: kernel virtual address |
42 | asynchronous usage characteristics | 48 | * @dev: PCI device |
43 | */ | 49 | * @n_pages: number of kernel pages |
44 | 50 | * @n_dma_pages: number of IOMMU pages | |
51 | * @sglist: IOMMU mapping | ||
52 | * @direction: PCI_DMA_TODEVICE, etc. | ||
53 | * | ||
54 | * a large, non-physically-contiguous DMA buffer with streaming, asynchronous | ||
55 | * usage characteristics | ||
56 | */ | ||
45 | struct dma_region { | 57 | struct dma_region { |
46 | unsigned char *kvirt; /* kernel virtual address */ | 58 | unsigned char *kvirt; |
47 | struct pci_dev *dev; /* PCI device */ | 59 | struct pci_dev *dev; |
48 | unsigned int n_pages; /* # of kernel pages */ | 60 | unsigned int n_pages; |
49 | unsigned int n_dma_pages; /* # of IOMMU pages */ | 61 | unsigned int n_dma_pages; |
50 | struct scatterlist *sglist; /* IOMMU mapping */ | 62 | struct scatterlist *sglist; |
51 | int direction; /* PCI_DMA_TODEVICE, etc */ | 63 | int direction; |
52 | }; | 64 | }; |
53 | 65 | ||
54 | /* clear out all fields but do not allocate anything */ | 66 | /* clear out all fields but do not allocate anything */ |
55 | void dma_region_init(struct dma_region *dma); | 67 | void dma_region_init(struct dma_region *dma); |
56 | 68 | ||
57 | /* allocate the buffer and map it to the IOMMU */ | 69 | /* allocate the buffer and map it to the IOMMU */ |
58 | int dma_region_alloc(struct dma_region *dma, unsigned long n_bytes, struct pci_dev *dev, int direction); | 70 | int dma_region_alloc(struct dma_region *dma, unsigned long n_bytes, |
71 | struct pci_dev *dev, int direction); | ||
59 | 72 | ||
60 | /* unmap and free the buffer */ | 73 | /* unmap and free the buffer */ |
61 | void dma_region_free(struct dma_region *dma); | 74 | void dma_region_free(struct dma_region *dma); |
62 | 75 | ||
63 | /* sync the CPU's view of the buffer */ | 76 | /* sync the CPU's view of the buffer */ |
64 | void dma_region_sync_for_cpu(struct dma_region *dma, unsigned long offset, unsigned long len); | 77 | void dma_region_sync_for_cpu(struct dma_region *dma, unsigned long offset, |
78 | unsigned long len); | ||
79 | |||
65 | /* sync the IO bus' view of the buffer */ | 80 | /* sync the IO bus' view of the buffer */ |
66 | void dma_region_sync_for_device(struct dma_region *dma, unsigned long offset, unsigned long len); | 81 | void dma_region_sync_for_device(struct dma_region *dma, unsigned long offset, |
82 | unsigned long len); | ||
67 | 83 | ||
68 | /* map the buffer into a user space process */ | 84 | /* map the buffer into a user space process */ |
69 | int dma_region_mmap(struct dma_region *dma, struct file *file, struct vm_area_struct *vma); | 85 | int dma_region_mmap(struct dma_region *dma, struct file *file, |
86 | struct vm_area_struct *vma); | ||
70 | 87 | ||
71 | /* macro to index into a DMA region (or dma_prog_region) */ | 88 | /* macro to index into a DMA region (or dma_prog_region) */ |
72 | #define dma_region_i(_dma, _type, _index) ( ((_type*) ((_dma)->kvirt)) + (_index) ) | 89 | #define dma_region_i(_dma, _type, _index) \ |
90 | ( ((_type*) ((_dma)->kvirt)) + (_index) ) | ||
73 | 91 | ||
74 | /* return the DMA bus address of the byte with the given offset | 92 | /* return the DMA bus address of the byte with the given offset |
75 | relative to the beginning of the dma_region */ | 93 | * relative to the beginning of the dma_region */ |
76 | dma_addr_t dma_region_offset_to_bus(struct dma_region *dma, unsigned long offset); | 94 | dma_addr_t dma_region_offset_to_bus(struct dma_region *dma, |
95 | unsigned long offset); | ||
77 | 96 | ||
78 | #endif /* IEEE1394_DMA_H */ | 97 | #endif /* IEEE1394_DMA_H */ |
diff --git a/drivers/ieee1394/highlevel.h b/drivers/ieee1394/highlevel.h index e119fb87e5b5..134bb6c3eadb 100644 --- a/drivers/ieee1394/highlevel.h +++ b/drivers/ieee1394/highlevel.h | |||
@@ -1,60 +1,51 @@ | |||
1 | |||
2 | #ifndef IEEE1394_HIGHLEVEL_H | 1 | #ifndef IEEE1394_HIGHLEVEL_H |
3 | #define IEEE1394_HIGHLEVEL_H | 2 | #define IEEE1394_HIGHLEVEL_H |
4 | 3 | ||
5 | 4 | /* internal to ieee1394 core */ | |
6 | struct hpsb_address_serve { | 5 | struct hpsb_address_serve { |
7 | struct list_head host_list; /* per host list */ | 6 | struct list_head host_list; /* per host list */ |
8 | 7 | struct list_head hl_list; /* hpsb_highlevel list */ | |
9 | struct list_head hl_list; /* hpsb_highlevel list */ | 8 | struct hpsb_address_ops *op; |
10 | |||
11 | struct hpsb_address_ops *op; | ||
12 | |||
13 | struct hpsb_host *host; | 9 | struct hpsb_host *host; |
14 | 10 | u64 start; /* first address handled, quadlet aligned */ | |
15 | /* first address handled and first address behind, quadlet aligned */ | 11 | u64 end; /* first address behind, quadlet aligned */ |
16 | u64 start, end; | ||
17 | }; | 12 | }; |
18 | 13 | ||
19 | 14 | /* Only the following structures are of interest to actual highlevel drivers. */ | |
20 | /* | ||
21 | * The above structs are internal to highlevel driver handling. Only the | ||
22 | * following structures are of interest to actual highlevel drivers. | ||
23 | */ | ||
24 | 15 | ||
25 | struct hpsb_highlevel { | 16 | struct hpsb_highlevel { |
26 | struct module *owner; | 17 | struct module *owner; |
27 | const char *name; | 18 | const char *name; |
28 | 19 | ||
29 | /* Any of the following pointers can legally be NULL, except for | 20 | /* Any of the following pointers can legally be NULL, except for |
30 | * iso_receive which can only be NULL when you don't request | 21 | * iso_receive which can only be NULL when you don't request |
31 | * channels. */ | 22 | * channels. */ |
32 | 23 | ||
33 | /* New host initialized. Will also be called during | 24 | /* New host initialized. Will also be called during |
34 | * hpsb_register_highlevel for all hosts already installed. */ | 25 | * hpsb_register_highlevel for all hosts already installed. */ |
35 | void (*add_host) (struct hpsb_host *host); | 26 | void (*add_host)(struct hpsb_host *host); |
36 | 27 | ||
37 | /* Host about to be removed. Will also be called during | 28 | /* Host about to be removed. Will also be called during |
38 | * hpsb_unregister_highlevel once for each host. */ | 29 | * hpsb_unregister_highlevel once for each host. */ |
39 | void (*remove_host) (struct hpsb_host *host); | 30 | void (*remove_host)(struct hpsb_host *host); |
40 | 31 | ||
41 | /* Host experienced bus reset with possible configuration changes. | 32 | /* Host experienced bus reset with possible configuration changes. |
42 | * Note that this one may occur during interrupt/bottom half handling. | 33 | * Note that this one may occur during interrupt/bottom half handling. |
43 | * You can not expect to be able to do stock hpsb_reads. */ | 34 | * You can not expect to be able to do stock hpsb_reads. */ |
44 | void (*host_reset) (struct hpsb_host *host); | 35 | void (*host_reset)(struct hpsb_host *host); |
45 | 36 | ||
46 | /* An isochronous packet was received. Channel contains the channel | 37 | /* An isochronous packet was received. Channel contains the channel |
47 | * number for your convenience, it is also contained in the included | 38 | * number for your convenience, it is also contained in the included |
48 | * packet header (first quadlet, CRCs are missing). You may get called | 39 | * packet header (first quadlet, CRCs are missing). You may get called |
49 | * for channel/host combinations you did not request. */ | 40 | * for channel/host combinations you did not request. */ |
50 | void (*iso_receive) (struct hpsb_host *host, int channel, | 41 | void (*iso_receive)(struct hpsb_host *host, int channel, |
51 | quadlet_t *data, size_t length); | 42 | quadlet_t *data, size_t length); |
52 | 43 | ||
53 | /* A write request was received on either the FCP_COMMAND (direction = | 44 | /* A write request was received on either the FCP_COMMAND (direction = |
54 | * 0) or the FCP_RESPONSE (direction = 1) register. The cts arg | 45 | * 0) or the FCP_RESPONSE (direction = 1) register. The cts arg |
55 | * contains the cts field (first byte of data). */ | 46 | * contains the cts field (first byte of data). */ |
56 | void (*fcp_request) (struct hpsb_host *host, int nodeid, int direction, | 47 | void (*fcp_request)(struct hpsb_host *host, int nodeid, int direction, |
57 | int cts, u8 *data, size_t length); | 48 | int cts, u8 *data, size_t length); |
58 | 49 | ||
59 | /* These are initialized by the subsystem when the | 50 | /* These are initialized by the subsystem when the |
60 | * hpsb_higlevel is registered. */ | 51 | * hpsb_higlevel is registered. */ |
@@ -67,61 +58,62 @@ struct hpsb_highlevel { | |||
67 | }; | 58 | }; |
68 | 59 | ||
69 | struct hpsb_address_ops { | 60 | struct hpsb_address_ops { |
70 | /* | 61 | /* |
71 | * Null function pointers will make the respective operation complete | 62 | * Null function pointers will make the respective operation complete |
72 | * with RCODE_TYPE_ERROR. Makes for easy to implement read-only | 63 | * with RCODE_TYPE_ERROR. Makes for easy to implement read-only |
73 | * registers (just leave everything but read NULL). | 64 | * registers (just leave everything but read NULL). |
74 | * | 65 | * |
75 | * All functions shall return appropriate IEEE 1394 rcodes. | 66 | * All functions shall return appropriate IEEE 1394 rcodes. |
76 | */ | 67 | */ |
77 | 68 | ||
78 | /* These functions have to implement block reads for themselves. */ | 69 | /* These functions have to implement block reads for themselves. |
79 | /* These functions either return a response code | 70 | * |
80 | or a negative number. In the first case a response will be generated; in the | 71 | * These functions either return a response code or a negative number. |
81 | later case, no response will be sent and the driver, that handled the request | 72 | * In the first case a response will be generated. In the latter case, |
82 | will send the response itself | 73 | * no response will be sent and the driver which handled the request |
83 | */ | 74 | * will send the response itself. */ |
84 | int (*read) (struct hpsb_host *host, int nodeid, quadlet_t *buffer, | 75 | int (*read)(struct hpsb_host *host, int nodeid, quadlet_t *buffer, |
85 | u64 addr, size_t length, u16 flags); | 76 | u64 addr, size_t length, u16 flags); |
86 | int (*write) (struct hpsb_host *host, int nodeid, int destid, | 77 | int (*write)(struct hpsb_host *host, int nodeid, int destid, |
87 | quadlet_t *data, u64 addr, size_t length, u16 flags); | 78 | quadlet_t *data, u64 addr, size_t length, u16 flags); |
88 | 79 | ||
89 | /* Lock transactions: write results of ext_tcode operation into | 80 | /* Lock transactions: write results of ext_tcode operation into |
90 | * *store. */ | 81 | * *store. */ |
91 | int (*lock) (struct hpsb_host *host, int nodeid, quadlet_t *store, | 82 | int (*lock)(struct hpsb_host *host, int nodeid, quadlet_t *store, |
92 | u64 addr, quadlet_t data, quadlet_t arg, int ext_tcode, u16 flags); | 83 | u64 addr, quadlet_t data, quadlet_t arg, int ext_tcode, |
93 | int (*lock64) (struct hpsb_host *host, int nodeid, octlet_t *store, | 84 | u16 flags); |
94 | u64 addr, octlet_t data, octlet_t arg, int ext_tcode, u16 flags); | 85 | int (*lock64)(struct hpsb_host *host, int nodeid, octlet_t *store, |
86 | u64 addr, octlet_t data, octlet_t arg, int ext_tcode, | ||
87 | u16 flags); | ||
95 | }; | 88 | }; |
96 | 89 | ||
97 | |||
98 | void highlevel_add_host(struct hpsb_host *host); | 90 | void highlevel_add_host(struct hpsb_host *host); |
99 | void highlevel_remove_host(struct hpsb_host *host); | 91 | void highlevel_remove_host(struct hpsb_host *host); |
100 | void highlevel_host_reset(struct hpsb_host *host); | 92 | void highlevel_host_reset(struct hpsb_host *host); |
101 | 93 | ||
102 | 94 | /* | |
103 | /* these functions are called to handle transactions. They are called, when | 95 | * These functions are called to handle transactions. They are called when a |
104 | a packet arrives. The flags argument contains the second word of the first header | 96 | * packet arrives. The flags argument contains the second word of the first |
105 | quadlet of the incoming packet (containing transaction label, retry code, | 97 | * header quadlet of the incoming packet (containing transaction label, retry |
106 | transaction code and priority). These functions either return a response code | 98 | * code, transaction code and priority). These functions either return a |
107 | or a negative number. In the first case a response will be generated; in the | 99 | * response code or a negative number. In the first case a response will be |
108 | later case, no response will be sent and the driver, that handled the request | 100 | * generated. In the latter case, no response will be sent and the driver which |
109 | will send the response itself. | 101 | * handled the request will send the response itself. |
110 | */ | 102 | */ |
111 | int highlevel_read(struct hpsb_host *host, int nodeid, void *data, | 103 | int highlevel_read(struct hpsb_host *host, int nodeid, void *data, u64 addr, |
112 | u64 addr, unsigned int length, u16 flags); | 104 | unsigned int length, u16 flags); |
113 | int highlevel_write(struct hpsb_host *host, int nodeid, int destid, | 105 | int highlevel_write(struct hpsb_host *host, int nodeid, int destid, void *data, |
114 | void *data, u64 addr, unsigned int length, u16 flags); | 106 | u64 addr, unsigned int length, u16 flags); |
115 | int highlevel_lock(struct hpsb_host *host, int nodeid, quadlet_t *store, | 107 | int highlevel_lock(struct hpsb_host *host, int nodeid, quadlet_t *store, |
116 | u64 addr, quadlet_t data, quadlet_t arg, int ext_tcode, u16 flags); | 108 | u64 addr, quadlet_t data, quadlet_t arg, int ext_tcode, |
109 | u16 flags); | ||
117 | int highlevel_lock64(struct hpsb_host *host, int nodeid, octlet_t *store, | 110 | int highlevel_lock64(struct hpsb_host *host, int nodeid, octlet_t *store, |
118 | u64 addr, octlet_t data, octlet_t arg, int ext_tcode, u16 flags); | 111 | u64 addr, octlet_t data, octlet_t arg, int ext_tcode, |
112 | u16 flags); | ||
119 | 113 | ||
120 | void highlevel_iso_receive(struct hpsb_host *host, void *data, | 114 | void highlevel_iso_receive(struct hpsb_host *host, void *data, size_t length); |
121 | size_t length); | ||
122 | void highlevel_fcp_request(struct hpsb_host *host, int nodeid, int direction, | 115 | void highlevel_fcp_request(struct hpsb_host *host, int nodeid, int direction, |
123 | void *data, size_t length); | 116 | void *data, size_t length); |
124 | |||
125 | 117 | ||
126 | /* | 118 | /* |
127 | * Register highlevel driver. The name pointer has to stay valid at all times | 119 | * Register highlevel driver. The name pointer has to stay valid at all times |
@@ -132,13 +124,15 @@ void hpsb_unregister_highlevel(struct hpsb_highlevel *hl); | |||
132 | 124 | ||
133 | /* | 125 | /* |
134 | * Register handlers for host address spaces. Start and end are 48 bit pointers | 126 | * Register handlers for host address spaces. Start and end are 48 bit pointers |
135 | * and have to be quadlet aligned (end points to the first address behind the | 127 | * and have to be quadlet aligned. Argument "end" points to the first address |
136 | * handled addresses. This function can be called multiple times for a single | 128 | * behind the handled addresses. This function can be called multiple times for |
137 | * hpsb_highlevel to implement sparse register sets. The requested region must | 129 | * a single hpsb_highlevel to implement sparse register sets. The requested |
138 | * not overlap any previously allocated region, otherwise registering will fail. | 130 | * region must not overlap any previously allocated region, otherwise |
131 | * registering will fail. | ||
139 | * | 132 | * |
140 | * It returns true for successful allocation. There is no unregister function, | 133 | * It returns true for successful allocation. Address spaces can be |
141 | * all address spaces are deallocated together with the hpsb_highlevel. | 134 | * unregistered with hpsb_unregister_addrspace. All remaining address spaces |
135 | * are automatically deallocated together with the hpsb_highlevel. | ||
142 | */ | 136 | */ |
143 | u64 hpsb_allocate_and_register_addrspace(struct hpsb_highlevel *hl, | 137 | u64 hpsb_allocate_and_register_addrspace(struct hpsb_highlevel *hl, |
144 | struct hpsb_host *host, | 138 | struct hpsb_host *host, |
@@ -146,20 +140,18 @@ u64 hpsb_allocate_and_register_addrspace(struct hpsb_highlevel *hl, | |||
146 | u64 size, u64 alignment, | 140 | u64 size, u64 alignment, |
147 | u64 start, u64 end); | 141 | u64 start, u64 end); |
148 | int hpsb_register_addrspace(struct hpsb_highlevel *hl, struct hpsb_host *host, | 142 | int hpsb_register_addrspace(struct hpsb_highlevel *hl, struct hpsb_host *host, |
149 | struct hpsb_address_ops *ops, u64 start, u64 end); | 143 | struct hpsb_address_ops *ops, u64 start, u64 end); |
150 | |||
151 | int hpsb_unregister_addrspace(struct hpsb_highlevel *hl, struct hpsb_host *host, | 144 | int hpsb_unregister_addrspace(struct hpsb_highlevel *hl, struct hpsb_host *host, |
152 | u64 start); | 145 | u64 start); |
153 | 146 | ||
154 | /* | 147 | /* |
155 | * Enable or disable receving a certain isochronous channel through the | 148 | * Enable or disable receving a certain isochronous channel through the |
156 | * iso_receive op. | 149 | * iso_receive op. |
157 | */ | 150 | */ |
158 | int hpsb_listen_channel(struct hpsb_highlevel *hl, struct hpsb_host *host, | 151 | int hpsb_listen_channel(struct hpsb_highlevel *hl, struct hpsb_host *host, |
159 | unsigned int channel); | 152 | unsigned int channel); |
160 | void hpsb_unlisten_channel(struct hpsb_highlevel *hl, struct hpsb_host *host, | 153 | void hpsb_unlisten_channel(struct hpsb_highlevel *hl, struct hpsb_host *host, |
161 | unsigned int channel); | 154 | unsigned int channel); |
162 | |||
163 | 155 | ||
164 | /* Retrieve a hostinfo pointer bound to this driver/host */ | 156 | /* Retrieve a hostinfo pointer bound to this driver/host */ |
165 | void *hpsb_get_hostinfo(struct hpsb_highlevel *hl, struct hpsb_host *host); | 157 | 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 | void hpsb_destroy_hostinfo(struct hpsb_highlevel *hl, struct hpsb_host *host); | 164 | void hpsb_destroy_hostinfo(struct hpsb_highlevel *hl, struct hpsb_host *host); |
173 | 165 | ||
174 | /* Set an alternate lookup key for the hostinfo bound to this driver/host */ | 166 | /* Set an alternate lookup key for the hostinfo bound to this driver/host */ |
175 | void hpsb_set_hostinfo_key(struct hpsb_highlevel *hl, struct hpsb_host *host, unsigned long key); | 167 | void hpsb_set_hostinfo_key(struct hpsb_highlevel *hl, struct hpsb_host *host, |
168 | unsigned long key); | ||
176 | 169 | ||
177 | /* Retrieve the alternate lookup key for the hostinfo bound to this driver/host */ | 170 | /* Retrieve the alternate lookup key for the hostinfo bound to this |
178 | unsigned long hpsb_get_hostinfo_key(struct hpsb_highlevel *hl, struct hpsb_host *host); | 171 | * driver/host */ |
172 | unsigned long hpsb_get_hostinfo_key(struct hpsb_highlevel *hl, | ||
173 | struct hpsb_host *host); | ||
179 | 174 | ||
180 | /* Retrieve a hostinfo pointer bound to this driver using its alternate key */ | 175 | /* Retrieve a hostinfo pointer bound to this driver using its alternate key */ |
181 | void *hpsb_get_hostinfo_bykey(struct hpsb_highlevel *hl, unsigned long key); | 176 | void *hpsb_get_hostinfo_bykey(struct hpsb_highlevel *hl, unsigned long key); |
182 | 177 | ||
183 | /* Set the hostinfo pointer to something useful. Usually follows a call to | 178 | /* Set the hostinfo pointer to something useful. Usually follows a call to |
184 | * hpsb_create_hostinfo, where the size is 0. */ | 179 | * hpsb_create_hostinfo, where the size is 0. */ |
185 | int hpsb_set_hostinfo(struct hpsb_highlevel *hl, struct hpsb_host *host, void *data); | 180 | int hpsb_set_hostinfo(struct hpsb_highlevel *hl, struct hpsb_host *host, |
181 | void *data); | ||
186 | 182 | ||
187 | /* Retrieve hpsb_host using a highlevel handle and a key */ | 183 | /* Retrieve hpsb_host using a highlevel handle and a key */ |
188 | struct hpsb_host *hpsb_get_host_bykey(struct hpsb_highlevel *hl, unsigned long key); | 184 | struct hpsb_host *hpsb_get_host_bykey(struct hpsb_highlevel *hl, |
185 | unsigned long key); | ||
189 | 186 | ||
190 | #endif /* IEEE1394_HIGHLEVEL_H */ | 187 | #endif /* IEEE1394_HIGHLEVEL_H */ |
diff --git a/drivers/ieee1394/hosts.h b/drivers/ieee1394/hosts.h index 9ad4b2463077..857d7d80bc87 100644 --- a/drivers/ieee1394/hosts.h +++ b/drivers/ieee1394/hosts.h | |||
@@ -112,7 +112,7 @@ enum devctl_cmd { | |||
112 | 112 | ||
113 | enum isoctl_cmd { | 113 | enum isoctl_cmd { |
114 | /* rawiso API - see iso.h for the meanings of these commands | 114 | /* rawiso API - see iso.h for the meanings of these commands |
115 | (they correspond exactly to the hpsb_iso_* API functions) | 115 | * (they correspond exactly to the hpsb_iso_* API functions) |
116 | * INIT = allocate resources | 116 | * INIT = allocate resources |
117 | * START = begin transmission/reception | 117 | * START = begin transmission/reception |
118 | * STOP = halt transmission/reception | 118 | * STOP = halt transmission/reception |
@@ -160,7 +160,8 @@ struct hpsb_host_driver { | |||
160 | /* The hardware driver may optionally support a function that is used | 160 | /* The hardware driver may optionally support a function that is used |
161 | * to set the hardware ConfigROM if the hardware supports handling | 161 | * to set the hardware ConfigROM if the hardware supports handling |
162 | * reads to the ConfigROM on its own. */ | 162 | * reads to the ConfigROM on its own. */ |
163 | void (*set_hw_config_rom) (struct hpsb_host *host, quadlet_t *config_rom); | 163 | void (*set_hw_config_rom)(struct hpsb_host *host, |
164 | quadlet_t *config_rom); | ||
164 | 165 | ||
165 | /* This function shall implement packet transmission based on | 166 | /* This function shall implement packet transmission based on |
166 | * packet->type. It shall CRC both parts of the packet (unless | 167 | * packet->type. It shall CRC both parts of the packet (unless |
@@ -170,20 +171,21 @@ struct hpsb_host_driver { | |||
170 | * called. Return 0 on success, negative errno on failure. | 171 | * called. Return 0 on success, negative errno on failure. |
171 | * NOTE: The function must be callable in interrupt context. | 172 | * NOTE: The function must be callable in interrupt context. |
172 | */ | 173 | */ |
173 | int (*transmit_packet) (struct hpsb_host *host, | 174 | int (*transmit_packet)(struct hpsb_host *host, |
174 | struct hpsb_packet *packet); | 175 | struct hpsb_packet *packet); |
175 | 176 | ||
176 | /* This function requests miscellanous services from the driver, see | 177 | /* This function requests miscellanous services from the driver, see |
177 | * above for command codes and expected actions. Return -1 for unknown | 178 | * above for command codes and expected actions. Return -1 for unknown |
178 | * command, though that should never happen. | 179 | * command, though that should never happen. |
179 | */ | 180 | */ |
180 | int (*devctl) (struct hpsb_host *host, enum devctl_cmd command, int arg); | 181 | int (*devctl)(struct hpsb_host *host, enum devctl_cmd command, int arg); |
181 | 182 | ||
182 | /* ISO transmission/reception functions. Return 0 on success, -1 | 183 | /* ISO transmission/reception functions. Return 0 on success, -1 |
183 | * (or -EXXX errno code) on failure. If the low-level driver does not | 184 | * (or -EXXX errno code) on failure. If the low-level driver does not |
184 | * support the new ISO API, set isoctl to NULL. | 185 | * support the new ISO API, set isoctl to NULL. |
185 | */ | 186 | */ |
186 | int (*isoctl) (struct hpsb_iso *iso, enum isoctl_cmd command, unsigned long arg); | 187 | int (*isoctl)(struct hpsb_iso *iso, enum isoctl_cmd command, |
188 | unsigned long arg); | ||
187 | 189 | ||
188 | /* This function is mainly to redirect local CSR reads/locks to the iso | 190 | /* This function is mainly to redirect local CSR reads/locks to the iso |
189 | * management registers (bus manager id, bandwidth available, channels | 191 | * management registers (bus manager id, bandwidth available, channels |
@@ -196,7 +198,6 @@ struct hpsb_host_driver { | |||
196 | quadlet_t data, quadlet_t compare); | 198 | quadlet_t data, quadlet_t compare); |
197 | }; | 199 | }; |
198 | 200 | ||
199 | |||
200 | struct hpsb_host *hpsb_alloc_host(struct hpsb_host_driver *drv, size_t extra, | 201 | struct hpsb_host *hpsb_alloc_host(struct hpsb_host_driver *drv, size_t extra, |
201 | struct device *dev); | 202 | struct device *dev); |
202 | int hpsb_add_host(struct hpsb_host *host); | 203 | int hpsb_add_host(struct hpsb_host *host); |
diff --git a/drivers/ieee1394/ieee1394-ioctl.h b/drivers/ieee1394/ieee1394-ioctl.h index 156703986348..8f207508ed1d 100644 --- a/drivers/ieee1394/ieee1394-ioctl.h +++ b/drivers/ieee1394/ieee1394-ioctl.h | |||
@@ -1,5 +1,7 @@ | |||
1 | /* Base file for all ieee1394 ioctl's. Linux-1394 has allocated base '#' | 1 | /* |
2 | * with a range of 0x00-0x3f. */ | 2 | * Base file for all ieee1394 ioctl's. |
3 | * Linux-1394 has allocated base '#' with a range of 0x00-0x3f. | ||
4 | */ | ||
3 | 5 | ||
4 | #ifndef __IEEE1394_IOCTL_H | 6 | #ifndef __IEEE1394_IOCTL_H |
5 | #define __IEEE1394_IOCTL_H | 7 | #define __IEEE1394_IOCTL_H |
@@ -96,8 +98,7 @@ | |||
96 | _IOW ('#', 0x27, struct raw1394_iso_packets) | 98 | _IOW ('#', 0x27, struct raw1394_iso_packets) |
97 | #define RAW1394_IOC_ISO_XMIT_SYNC \ | 99 | #define RAW1394_IOC_ISO_XMIT_SYNC \ |
98 | _IO ('#', 0x28) | 100 | _IO ('#', 0x28) |
99 | #define RAW1394_IOC_ISO_RECV_FLUSH \ | 101 | #define RAW1394_IOC_ISO_RECV_FLUSH \ |
100 | _IO ('#', 0x29) | 102 | _IO ('#', 0x29) |
101 | 103 | ||
102 | |||
103 | #endif /* __IEEE1394_IOCTL_H */ | 104 | #endif /* __IEEE1394_IOCTL_H */ |
diff --git a/drivers/ieee1394/ieee1394.h b/drivers/ieee1394/ieee1394.h index d911abe3a35e..40492074c013 100644 --- a/drivers/ieee1394/ieee1394.h +++ b/drivers/ieee1394/ieee1394.h | |||
@@ -5,77 +5,76 @@ | |||
5 | #ifndef _IEEE1394_IEEE1394_H | 5 | #ifndef _IEEE1394_IEEE1394_H |
6 | #define _IEEE1394_IEEE1394_H | 6 | #define _IEEE1394_IEEE1394_H |
7 | 7 | ||
8 | #define TCODE_WRITEQ 0x0 | 8 | #define TCODE_WRITEQ 0x0 |
9 | #define TCODE_WRITEB 0x1 | 9 | #define TCODE_WRITEB 0x1 |
10 | #define TCODE_WRITE_RESPONSE 0x2 | 10 | #define TCODE_WRITE_RESPONSE 0x2 |
11 | #define TCODE_READQ 0x4 | 11 | #define TCODE_READQ 0x4 |
12 | #define TCODE_READB 0x5 | 12 | #define TCODE_READB 0x5 |
13 | #define TCODE_READQ_RESPONSE 0x6 | 13 | #define TCODE_READQ_RESPONSE 0x6 |
14 | #define TCODE_READB_RESPONSE 0x7 | 14 | #define TCODE_READB_RESPONSE 0x7 |
15 | #define TCODE_CYCLE_START 0x8 | 15 | #define TCODE_CYCLE_START 0x8 |
16 | #define TCODE_LOCK_REQUEST 0x9 | 16 | #define TCODE_LOCK_REQUEST 0x9 |
17 | #define TCODE_ISO_DATA 0xa | 17 | #define TCODE_ISO_DATA 0xa |
18 | #define TCODE_STREAM_DATA 0xa | 18 | #define TCODE_STREAM_DATA 0xa |
19 | #define TCODE_LOCK_RESPONSE 0xb | 19 | #define TCODE_LOCK_RESPONSE 0xb |
20 | 20 | ||
21 | #define RCODE_COMPLETE 0x0 | 21 | #define RCODE_COMPLETE 0x0 |
22 | #define RCODE_CONFLICT_ERROR 0x4 | 22 | #define RCODE_CONFLICT_ERROR 0x4 |
23 | #define RCODE_DATA_ERROR 0x5 | 23 | #define RCODE_DATA_ERROR 0x5 |
24 | #define RCODE_TYPE_ERROR 0x6 | 24 | #define RCODE_TYPE_ERROR 0x6 |
25 | #define RCODE_ADDRESS_ERROR 0x7 | 25 | #define RCODE_ADDRESS_ERROR 0x7 |
26 | 26 | ||
27 | #define EXTCODE_MASK_SWAP 0x1 | 27 | #define EXTCODE_MASK_SWAP 0x1 |
28 | #define EXTCODE_COMPARE_SWAP 0x2 | 28 | #define EXTCODE_COMPARE_SWAP 0x2 |
29 | #define EXTCODE_FETCH_ADD 0x3 | 29 | #define EXTCODE_FETCH_ADD 0x3 |
30 | #define EXTCODE_LITTLE_ADD 0x4 | 30 | #define EXTCODE_LITTLE_ADD 0x4 |
31 | #define EXTCODE_BOUNDED_ADD 0x5 | 31 | #define EXTCODE_BOUNDED_ADD 0x5 |
32 | #define EXTCODE_WRAP_ADD 0x6 | 32 | #define EXTCODE_WRAP_ADD 0x6 |
33 | 33 | ||
34 | #define ACK_COMPLETE 0x1 | 34 | #define ACK_COMPLETE 0x1 |
35 | #define ACK_PENDING 0x2 | 35 | #define ACK_PENDING 0x2 |
36 | #define ACK_BUSY_X 0x4 | 36 | #define ACK_BUSY_X 0x4 |
37 | #define ACK_BUSY_A 0x5 | 37 | #define ACK_BUSY_A 0x5 |
38 | #define ACK_BUSY_B 0x6 | 38 | #define ACK_BUSY_B 0x6 |
39 | #define ACK_TARDY 0xb | 39 | #define ACK_TARDY 0xb |
40 | #define ACK_CONFLICT_ERROR 0xc | 40 | #define ACK_CONFLICT_ERROR 0xc |
41 | #define ACK_DATA_ERROR 0xd | 41 | #define ACK_DATA_ERROR 0xd |
42 | #define ACK_TYPE_ERROR 0xe | 42 | #define ACK_TYPE_ERROR 0xe |
43 | #define ACK_ADDRESS_ERROR 0xf | 43 | #define ACK_ADDRESS_ERROR 0xf |
44 | 44 | ||
45 | /* Non-standard "ACK codes" for internal use */ | 45 | /* Non-standard "ACK codes" for internal use */ |
46 | #define ACKX_NONE (-1) | 46 | #define ACKX_NONE (-1) |
47 | #define ACKX_SEND_ERROR (-2) | 47 | #define ACKX_SEND_ERROR (-2) |
48 | #define ACKX_ABORTED (-3) | 48 | #define ACKX_ABORTED (-3) |
49 | #define ACKX_TIMEOUT (-4) | 49 | #define ACKX_TIMEOUT (-4) |
50 | 50 | ||
51 | 51 | #define IEEE1394_SPEED_100 0x00 | |
52 | #define IEEE1394_SPEED_100 0x00 | 52 | #define IEEE1394_SPEED_200 0x01 |
53 | #define IEEE1394_SPEED_200 0x01 | 53 | #define IEEE1394_SPEED_400 0x02 |
54 | #define IEEE1394_SPEED_400 0x02 | 54 | #define IEEE1394_SPEED_800 0x03 |
55 | #define IEEE1394_SPEED_800 0x03 | 55 | #define IEEE1394_SPEED_1600 0x04 |
56 | #define IEEE1394_SPEED_1600 0x04 | 56 | #define IEEE1394_SPEED_3200 0x05 |
57 | #define IEEE1394_SPEED_3200 0x05 | 57 | |
58 | /* The current highest tested speed supported by the subsystem */ | 58 | /* The current highest tested speed supported by the subsystem */ |
59 | #define IEEE1394_SPEED_MAX IEEE1394_SPEED_800 | 59 | #define IEEE1394_SPEED_MAX IEEE1394_SPEED_800 |
60 | 60 | ||
61 | /* Maps speed values above to a string representation */ | 61 | /* Maps speed values above to a string representation */ |
62 | extern const char *hpsb_speedto_str[]; | 62 | extern const char *hpsb_speedto_str[]; |
63 | 63 | ||
64 | |||
65 | /* 1394a cable PHY packets */ | 64 | /* 1394a cable PHY packets */ |
66 | #define SELFID_PWRCL_NO_POWER 0x0 | 65 | #define SELFID_PWRCL_NO_POWER 0x0 |
67 | #define SELFID_PWRCL_PROVIDE_15W 0x1 | 66 | #define SELFID_PWRCL_PROVIDE_15W 0x1 |
68 | #define SELFID_PWRCL_PROVIDE_30W 0x2 | 67 | #define SELFID_PWRCL_PROVIDE_30W 0x2 |
69 | #define SELFID_PWRCL_PROVIDE_45W 0x3 | 68 | #define SELFID_PWRCL_PROVIDE_45W 0x3 |
70 | #define SELFID_PWRCL_USE_1W 0x4 | 69 | #define SELFID_PWRCL_USE_1W 0x4 |
71 | #define SELFID_PWRCL_USE_3W 0x5 | 70 | #define SELFID_PWRCL_USE_3W 0x5 |
72 | #define SELFID_PWRCL_USE_6W 0x6 | 71 | #define SELFID_PWRCL_USE_6W 0x6 |
73 | #define SELFID_PWRCL_USE_10W 0x7 | 72 | #define SELFID_PWRCL_USE_10W 0x7 |
74 | 73 | ||
75 | #define SELFID_PORT_CHILD 0x3 | 74 | #define SELFID_PORT_CHILD 0x3 |
76 | #define SELFID_PORT_PARENT 0x2 | 75 | #define SELFID_PORT_PARENT 0x2 |
77 | #define SELFID_PORT_NCONN 0x1 | 76 | #define SELFID_PORT_NCONN 0x1 |
78 | #define SELFID_PORT_NONE 0x0 | 77 | #define SELFID_PORT_NONE 0x0 |
79 | 78 | ||
80 | #define SELFID_SPEED_UNKNOWN 0x3 /* 1394b PHY */ | 79 | #define SELFID_SPEED_UNKNOWN 0x3 /* 1394b PHY */ |
81 | 80 | ||
@@ -93,76 +92,76 @@ extern const char *hpsb_speedto_str[]; | |||
93 | 92 | ||
94 | #define EXTPHYPACKET_TYPEMASK 0xC0FC0000 | 93 | #define EXTPHYPACKET_TYPEMASK 0xC0FC0000 |
95 | 94 | ||
96 | #define PHYPACKET_PORT_SHIFT 24 | 95 | #define PHYPACKET_PORT_SHIFT 24 |
97 | #define PHYPACKET_GAPCOUNT_SHIFT 16 | 96 | #define PHYPACKET_GAPCOUNT_SHIFT 16 |
98 | 97 | ||
99 | /* 1394a PHY register map bitmasks */ | 98 | /* 1394a PHY register map bitmasks */ |
100 | #define PHY_00_PHYSICAL_ID 0xFC | 99 | #define PHY_00_PHYSICAL_ID 0xFC |
101 | #define PHY_00_R 0x02 /* Root */ | 100 | #define PHY_00_R 0x02 /* Root */ |
102 | #define PHY_00_PS 0x01 /* Power Status*/ | 101 | #define PHY_00_PS 0x01 /* Power Status*/ |
103 | #define PHY_01_RHB 0x80 /* Root Hold-Off */ | 102 | #define PHY_01_RHB 0x80 /* Root Hold-Off */ |
104 | #define PHY_01_IBR 0x80 /* Initiate Bus Reset */ | 103 | #define PHY_01_IBR 0x80 /* Initiate Bus Reset */ |
105 | #define PHY_01_GAP_COUNT 0x3F | 104 | #define PHY_01_GAP_COUNT 0x3F |
106 | #define PHY_02_EXTENDED 0xE0 /* 0x7 for 1394a-compliant PHY */ | 105 | #define PHY_02_EXTENDED 0xE0 /* 0x7 for 1394a-compliant PHY */ |
107 | #define PHY_02_TOTAL_PORTS 0x1F | 106 | #define PHY_02_TOTAL_PORTS 0x1F |
108 | #define PHY_03_MAX_SPEED 0xE0 | 107 | #define PHY_03_MAX_SPEED 0xE0 |
109 | #define PHY_03_DELAY 0x0F | 108 | #define PHY_03_DELAY 0x0F |
110 | #define PHY_04_LCTRL 0x80 /* Link Active Report Control */ | 109 | #define PHY_04_LCTRL 0x80 /* Link Active Report Control */ |
111 | #define PHY_04_CONTENDER 0x40 | 110 | #define PHY_04_CONTENDER 0x40 |
112 | #define PHY_04_JITTER 0x38 | 111 | #define PHY_04_JITTER 0x38 |
113 | #define PHY_04_PWR_CLASS 0x07 /* Power Class */ | 112 | #define PHY_04_PWR_CLASS 0x07 /* Power Class */ |
114 | #define PHY_05_WATCHDOG 0x80 | 113 | #define PHY_05_WATCHDOG 0x80 |
115 | #define PHY_05_ISBR 0x40 /* Initiate Short Bus Reset */ | 114 | #define PHY_05_ISBR 0x40 /* Initiate Short Bus Reset */ |
116 | #define PHY_05_LOOP 0x20 /* Loop Detect */ | 115 | #define PHY_05_LOOP 0x20 /* Loop Detect */ |
117 | #define PHY_05_PWR_FAIL 0x10 /* Cable Power Failure Detect */ | 116 | #define PHY_05_PWR_FAIL 0x10 /* Cable Power Failure Detect */ |
118 | #define PHY_05_TIMEOUT 0x08 /* Arbitration State Machine Timeout */ | 117 | #define PHY_05_TIMEOUT 0x08 /* Arbitration State Machine Timeout */ |
119 | #define PHY_05_PORT_EVENT 0x04 /* Port Event Detect */ | 118 | #define PHY_05_PORT_EVENT 0x04 /* Port Event Detect */ |
120 | #define PHY_05_ENAB_ACCEL 0x02 /* Enable Arbitration Acceleration */ | 119 | #define PHY_05_ENAB_ACCEL 0x02 /* Enable Arbitration Acceleration */ |
121 | #define PHY_05_ENAB_MULTI 0x01 /* Ena. Multispeed Packet Concatenation */ | 120 | #define PHY_05_ENAB_MULTI 0x01 /* Ena. Multispeed Packet Concatenation */ |
122 | 121 | ||
123 | #include <asm/byteorder.h> | 122 | #include <asm/byteorder.h> |
124 | 123 | ||
125 | #ifdef __BIG_ENDIAN_BITFIELD | 124 | #ifdef __BIG_ENDIAN_BITFIELD |
126 | 125 | ||
127 | struct selfid { | 126 | struct selfid { |
128 | u32 packet_identifier:2; /* always binary 10 */ | 127 | u32 packet_identifier:2; /* always binary 10 */ |
129 | u32 phy_id:6; | 128 | u32 phy_id:6; |
130 | /* byte */ | 129 | /* byte */ |
131 | u32 extended:1; /* if true is struct ext_selfid */ | 130 | u32 extended:1; /* if true is struct ext_selfid */ |
132 | u32 link_active:1; | 131 | u32 link_active:1; |
133 | u32 gap_count:6; | 132 | u32 gap_count:6; |
134 | /* byte */ | 133 | /* byte */ |
135 | u32 speed:2; | 134 | u32 speed:2; |
136 | u32 phy_delay:2; | 135 | u32 phy_delay:2; |
137 | u32 contender:1; | 136 | u32 contender:1; |
138 | u32 power_class:3; | 137 | u32 power_class:3; |
139 | /* byte */ | 138 | /* byte */ |
140 | u32 port0:2; | 139 | u32 port0:2; |
141 | u32 port1:2; | 140 | u32 port1:2; |
142 | u32 port2:2; | 141 | u32 port2:2; |
143 | u32 initiated_reset:1; | 142 | u32 initiated_reset:1; |
144 | u32 more_packets:1; | 143 | u32 more_packets:1; |
145 | } __attribute__((packed)); | 144 | } __attribute__((packed)); |
146 | 145 | ||
147 | struct ext_selfid { | 146 | struct ext_selfid { |
148 | u32 packet_identifier:2; /* always binary 10 */ | 147 | u32 packet_identifier:2; /* always binary 10 */ |
149 | u32 phy_id:6; | 148 | u32 phy_id:6; |
150 | /* byte */ | 149 | /* byte */ |
151 | u32 extended:1; /* if false is struct selfid */ | 150 | u32 extended:1; /* if false is struct selfid */ |
152 | u32 seq_nr:3; | 151 | u32 seq_nr:3; |
153 | u32 reserved:2; | 152 | u32 reserved:2; |
154 | u32 porta:2; | 153 | u32 porta:2; |
155 | /* byte */ | 154 | /* byte */ |
156 | u32 portb:2; | 155 | u32 portb:2; |
157 | u32 portc:2; | 156 | u32 portc:2; |
158 | u32 portd:2; | 157 | u32 portd:2; |
159 | u32 porte:2; | 158 | u32 porte:2; |
160 | /* byte */ | 159 | /* byte */ |
161 | u32 portf:2; | 160 | u32 portf:2; |
162 | u32 portg:2; | 161 | u32 portg:2; |
163 | u32 porth:2; | 162 | u32 porth:2; |
164 | u32 reserved2:1; | 163 | u32 reserved2:1; |
165 | u32 more_packets:1; | 164 | u32 more_packets:1; |
166 | } __attribute__((packed)); | 165 | } __attribute__((packed)); |
167 | 166 | ||
168 | #elif defined __LITTLE_ENDIAN_BITFIELD /* __BIG_ENDIAN_BITFIELD */ | 167 | #elif defined __LITTLE_ENDIAN_BITFIELD /* __BIG_ENDIAN_BITFIELD */ |
@@ -173,49 +172,48 @@ struct ext_selfid { | |||
173 | */ | 172 | */ |
174 | 173 | ||
175 | struct selfid { | 174 | struct selfid { |
176 | u32 phy_id:6; | 175 | u32 phy_id:6; |
177 | u32 packet_identifier:2; /* always binary 10 */ | 176 | u32 packet_identifier:2; /* always binary 10 */ |
178 | /* byte */ | 177 | /* byte */ |
179 | u32 gap_count:6; | 178 | u32 gap_count:6; |
180 | u32 link_active:1; | 179 | u32 link_active:1; |
181 | u32 extended:1; /* if true is struct ext_selfid */ | 180 | u32 extended:1; /* if true is struct ext_selfid */ |
182 | /* byte */ | 181 | /* byte */ |
183 | u32 power_class:3; | 182 | u32 power_class:3; |
184 | u32 contender:1; | 183 | u32 contender:1; |
185 | u32 phy_delay:2; | 184 | u32 phy_delay:2; |
186 | u32 speed:2; | 185 | u32 speed:2; |
187 | /* byte */ | 186 | /* byte */ |
188 | u32 more_packets:1; | 187 | u32 more_packets:1; |
189 | u32 initiated_reset:1; | 188 | u32 initiated_reset:1; |
190 | u32 port2:2; | 189 | u32 port2:2; |
191 | u32 port1:2; | 190 | u32 port1:2; |
192 | u32 port0:2; | 191 | u32 port0:2; |
193 | } __attribute__((packed)); | 192 | } __attribute__((packed)); |
194 | 193 | ||
195 | struct ext_selfid { | 194 | struct ext_selfid { |
196 | u32 phy_id:6; | 195 | u32 phy_id:6; |
197 | u32 packet_identifier:2; /* always binary 10 */ | 196 | u32 packet_identifier:2; /* always binary 10 */ |
198 | /* byte */ | 197 | /* byte */ |
199 | u32 porta:2; | 198 | u32 porta:2; |
200 | u32 reserved:2; | 199 | u32 reserved:2; |
201 | u32 seq_nr:3; | 200 | u32 seq_nr:3; |
202 | u32 extended:1; /* if false is struct selfid */ | 201 | u32 extended:1; /* if false is struct selfid */ |
203 | /* byte */ | 202 | /* byte */ |
204 | u32 porte:2; | 203 | u32 porte:2; |
205 | u32 portd:2; | 204 | u32 portd:2; |
206 | u32 portc:2; | 205 | u32 portc:2; |
207 | u32 portb:2; | 206 | u32 portb:2; |
208 | /* byte */ | 207 | /* byte */ |
209 | u32 more_packets:1; | 208 | u32 more_packets:1; |
210 | u32 reserved2:1; | 209 | u32 reserved2:1; |
211 | u32 porth:2; | 210 | u32 porth:2; |
212 | u32 portg:2; | 211 | u32 portg:2; |
213 | u32 portf:2; | 212 | u32 portf:2; |
214 | } __attribute__((packed)); | 213 | } __attribute__((packed)); |
215 | 214 | ||
216 | #else | 215 | #else |
217 | #error What? PDP endian? | 216 | #error What? PDP endian? |
218 | #endif /* __BIG_ENDIAN_BITFIELD */ | 217 | #endif /* __BIG_ENDIAN_BITFIELD */ |
219 | 218 | ||
220 | |||
221 | #endif /* _IEEE1394_IEEE1394_H */ | 219 | #endif /* _IEEE1394_IEEE1394_H */ |
diff --git a/drivers/ieee1394/ieee1394_core.h b/drivers/ieee1394/ieee1394_core.h index 0ecbf335c64f..31d9efccdc0d 100644 --- a/drivers/ieee1394/ieee1394_core.h +++ b/drivers/ieee1394/ieee1394_core.h | |||
@@ -58,7 +58,6 @@ struct hpsb_packet { | |||
58 | size_t header_size; | 58 | size_t header_size; |
59 | size_t data_size; | 59 | size_t data_size; |
60 | 60 | ||
61 | |||
62 | struct hpsb_host *host; | 61 | struct hpsb_host *host; |
63 | unsigned int generation; | 62 | unsigned int generation; |
64 | 63 | ||
@@ -80,7 +79,7 @@ struct hpsb_packet { | |||
80 | 79 | ||
81 | /* Set a task for when a packet completes */ | 80 | /* Set a task for when a packet completes */ |
82 | void hpsb_set_packet_complete_task(struct hpsb_packet *packet, | 81 | void hpsb_set_packet_complete_task(struct hpsb_packet *packet, |
83 | void (*routine)(void *), void *data); | 82 | void (*routine)(void *), void *data); |
84 | 83 | ||
85 | static inline struct hpsb_packet *driver_packet(struct list_head *l) | 84 | static inline struct hpsb_packet *driver_packet(struct list_head *l) |
86 | { | 85 | { |
@@ -92,7 +91,6 @@ void abort_timedouts(unsigned long __opaque); | |||
92 | struct hpsb_packet *hpsb_alloc_packet(size_t data_size); | 91 | struct hpsb_packet *hpsb_alloc_packet(size_t data_size); |
93 | void hpsb_free_packet(struct hpsb_packet *packet); | 92 | void hpsb_free_packet(struct hpsb_packet *packet); |
94 | 93 | ||
95 | |||
96 | /* | 94 | /* |
97 | * Generation counter for the complete 1394 subsystem. Generation gets | 95 | * Generation counter for the complete 1394 subsystem. Generation gets |
98 | * incremented on every change in the subsystem (e.g. bus reset). | 96 | * 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 | #define IEEE1394_MINOR_BLOCK_EXPERIMENTAL 15 | 202 | #define IEEE1394_MINOR_BLOCK_EXPERIMENTAL 15 |
205 | 203 | ||
206 | #define IEEE1394_CORE_DEV MKDEV(IEEE1394_MAJOR, 0) | 204 | #define IEEE1394_CORE_DEV MKDEV(IEEE1394_MAJOR, 0) |
207 | #define IEEE1394_RAW1394_DEV MKDEV(IEEE1394_MAJOR, IEEE1394_MINOR_BLOCK_RAW1394 * 16) | 205 | #define IEEE1394_RAW1394_DEV MKDEV(IEEE1394_MAJOR, \ |
208 | #define IEEE1394_VIDEO1394_DEV MKDEV(IEEE1394_MAJOR, IEEE1394_MINOR_BLOCK_VIDEO1394 * 16) | 206 | IEEE1394_MINOR_BLOCK_RAW1394 * 16) |
209 | #define IEEE1394_DV1394_DEV MKDEV(IEEE1394_MAJOR, IEEE1394_MINOR_BLOCK_DV1394 * 16) | 207 | #define IEEE1394_VIDEO1394_DEV MKDEV(IEEE1394_MAJOR, \ |
210 | #define IEEE1394_EXPERIMENTAL_DEV MKDEV(IEEE1394_MAJOR, IEEE1394_MINOR_BLOCK_EXPERIMENTAL * 16) | 208 | IEEE1394_MINOR_BLOCK_VIDEO1394 * 16) |
209 | #define IEEE1394_DV1394_DEV MKDEV(IEEE1394_MAJOR, \ | ||
210 | IEEE1394_MINOR_BLOCK_DV1394 * 16) | ||
211 | #define IEEE1394_EXPERIMENTAL_DEV MKDEV(IEEE1394_MAJOR, \ | ||
212 | IEEE1394_MINOR_BLOCK_EXPERIMENTAL * 16) | ||
211 | 213 | ||
212 | /* return the index (within a minor number block) of a file */ | 214 | /* return the index (within a minor number block) of a file */ |
213 | static inline unsigned char ieee1394_file_to_instance(struct file *file) | 215 | static inline unsigned char ieee1394_file_to_instance(struct file *file) |
@@ -223,4 +225,3 @@ extern struct class hpsb_host_class; | |||
223 | extern struct class *hpsb_protocol_class; | 225 | extern struct class *hpsb_protocol_class; |
224 | 226 | ||
225 | #endif /* _IEEE1394_CORE_H */ | 227 | #endif /* _IEEE1394_CORE_H */ |
226 | |||
diff --git a/drivers/ieee1394/ieee1394_transactions.h b/drivers/ieee1394/ieee1394_transactions.h index 45ba784fe6da..5f809f50845f 100644 --- a/drivers/ieee1394/ieee1394_transactions.h +++ b/drivers/ieee1394/ieee1394_transactions.h | |||
@@ -3,30 +3,25 @@ | |||
3 | 3 | ||
4 | #include "ieee1394_core.h" | 4 | #include "ieee1394_core.h" |
5 | 5 | ||
6 | |||
7 | /* | ||
8 | * Get and free transaction labels. | ||
9 | */ | ||
10 | int hpsb_get_tlabel(struct hpsb_packet *packet); | 6 | int hpsb_get_tlabel(struct hpsb_packet *packet); |
11 | void hpsb_free_tlabel(struct hpsb_packet *packet); | 7 | void hpsb_free_tlabel(struct hpsb_packet *packet); |
12 | |||
13 | struct hpsb_packet *hpsb_make_readpacket(struct hpsb_host *host, nodeid_t node, | 8 | struct hpsb_packet *hpsb_make_readpacket(struct hpsb_host *host, nodeid_t node, |
14 | u64 addr, size_t length); | 9 | u64 addr, size_t length); |
15 | struct hpsb_packet *hpsb_make_lockpacket(struct hpsb_host *host, nodeid_t node, | 10 | struct hpsb_packet *hpsb_make_lockpacket(struct hpsb_host *host, nodeid_t node, |
16 | u64 addr, int extcode, quadlet_t *data, | 11 | u64 addr, int extcode, quadlet_t *data, |
17 | quadlet_t arg); | 12 | quadlet_t arg); |
18 | struct hpsb_packet *hpsb_make_lock64packet(struct hpsb_host *host, nodeid_t node, | 13 | struct hpsb_packet *hpsb_make_lock64packet(struct hpsb_host *host, |
19 | u64 addr, int extcode, octlet_t *data, | 14 | nodeid_t node, u64 addr, int extcode, |
20 | octlet_t arg); | 15 | octlet_t *data, octlet_t arg); |
21 | struct hpsb_packet *hpsb_make_phypacket(struct hpsb_host *host, | 16 | struct hpsb_packet *hpsb_make_phypacket(struct hpsb_host *host, quadlet_t data); |
22 | quadlet_t data) ; | 17 | struct hpsb_packet *hpsb_make_isopacket(struct hpsb_host *host, int length, |
23 | struct hpsb_packet *hpsb_make_isopacket(struct hpsb_host *host, | 18 | int channel, int tag, int sync); |
24 | int length, int channel, | 19 | struct hpsb_packet *hpsb_make_writepacket(struct hpsb_host *host, |
25 | int tag, int sync); | 20 | nodeid_t node, u64 addr, |
26 | struct hpsb_packet *hpsb_make_writepacket (struct hpsb_host *host, nodeid_t node, | 21 | quadlet_t *buffer, size_t length); |
27 | u64 addr, quadlet_t *buffer, size_t length); | ||
28 | struct hpsb_packet *hpsb_make_streampacket(struct hpsb_host *host, u8 *buffer, | 22 | struct hpsb_packet *hpsb_make_streampacket(struct hpsb_host *host, u8 *buffer, |
29 | int length, int channel, int tag, int sync); | 23 | int length, int channel, int tag, |
24 | int sync); | ||
30 | 25 | ||
31 | /* | 26 | /* |
32 | * hpsb_packet_success - Make sense of the ack and reply codes and | 27 | * 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 | */ | 35 | */ |
41 | int hpsb_packet_success(struct hpsb_packet *packet); | 36 | int hpsb_packet_success(struct hpsb_packet *packet); |
42 | 37 | ||
43 | |||
44 | /* | 38 | /* |
45 | * The generic read, write and lock functions. All recognize the local node ID | 39 | * The generic read and write functions. All recognize the local node ID |
46 | * and act accordingly. Read and write automatically use quadlet commands if | 40 | * and act accordingly. Read and write automatically use quadlet commands if |
47 | * length == 4 and and block commands otherwise (however, they do not yet | 41 | * length == 4 and and block commands otherwise (however, they do not yet |
48 | * support lengths that are not a multiple of 4). You must explicitly specifiy | 42 | * support lengths that are not a multiple of 4). You must explicitly specifiy |
diff --git a/drivers/ieee1394/ieee1394_types.h b/drivers/ieee1394/ieee1394_types.h index 440d977031e3..ed6fdd811a09 100644 --- a/drivers/ieee1394/ieee1394_types.h +++ b/drivers/ieee1394/ieee1394_types.h | |||
@@ -31,7 +31,6 @@ do { \ | |||
31 | sema_init(&(_tp)->count, 63); \ | 31 | sema_init(&(_tp)->count, 63); \ |
32 | } while (0) | 32 | } while (0) |
33 | 33 | ||
34 | |||
35 | typedef u32 quadlet_t; | 34 | typedef u32 quadlet_t; |
36 | typedef u64 octlet_t; | 35 | typedef u64 octlet_t; |
37 | typedef u16 nodeid_t; | 36 | typedef u16 nodeid_t; |
@@ -54,16 +53,17 @@ typedef u16 arm_length_t; | |||
54 | #define NODE_BUS_ARGS(__host, __nodeid) \ | 53 | #define NODE_BUS_ARGS(__host, __nodeid) \ |
55 | __host->id, NODEID_TO_NODE(__nodeid), NODEID_TO_BUS(__nodeid) | 54 | __host->id, NODEID_TO_NODE(__nodeid), NODEID_TO_BUS(__nodeid) |
56 | 55 | ||
57 | #define HPSB_PRINT(level, fmt, args...) printk(level "ieee1394: " fmt "\n" , ## args) | 56 | #define HPSB_PRINT(level, fmt, args...) \ |
57 | printk(level "ieee1394: " fmt "\n" , ## args) | ||
58 | 58 | ||
59 | #define HPSB_DEBUG(fmt, args...) HPSB_PRINT(KERN_DEBUG, fmt , ## args) | 59 | #define HPSB_DEBUG(fmt, args...) HPSB_PRINT(KERN_DEBUG, fmt , ## args) |
60 | #define HPSB_INFO(fmt, args...) HPSB_PRINT(KERN_INFO, fmt , ## args) | 60 | #define HPSB_INFO(fmt, args...) HPSB_PRINT(KERN_INFO, fmt , ## args) |
61 | #define HPSB_NOTICE(fmt, args...) HPSB_PRINT(KERN_NOTICE, fmt , ## args) | 61 | #define HPSB_NOTICE(fmt, args...) HPSB_PRINT(KERN_NOTICE, fmt , ## args) |
62 | #define HPSB_WARN(fmt, args...) HPSB_PRINT(KERN_WARNING, fmt , ## args) | 62 | #define HPSB_WARN(fmt, args...) HPSB_PRINT(KERN_WARNING, fmt , ## args) |
63 | #define HPSB_ERR(fmt, args...) HPSB_PRINT(KERN_ERR, fmt , ## args) | 63 | #define HPSB_ERR(fmt, args...) HPSB_PRINT(KERN_ERR, fmt , ## args) |
64 | 64 | ||
65 | #ifdef CONFIG_IEEE1394_VERBOSEDEBUG | 65 | #ifdef CONFIG_IEEE1394_VERBOSEDEBUG |
66 | #define HPSB_VERBOSE(fmt, args...) HPSB_PRINT(KERN_DEBUG, fmt , ## args) | 66 | #define HPSB_VERBOSE(fmt, args...) HPSB_PRINT(KERN_DEBUG, fmt , ## args) |
67 | #else | 67 | #else |
68 | #define HPSB_VERBOSE(fmt, args...) | 68 | #define HPSB_VERBOSE(fmt, args...) |
69 | #endif | 69 | #endif |
@@ -77,23 +77,20 @@ typedef u16 arm_length_t; | |||
77 | 77 | ||
78 | static inline void *memcpy_le32(u32 *dest, const u32 *__src, size_t count) | 78 | static inline void *memcpy_le32(u32 *dest, const u32 *__src, size_t count) |
79 | { | 79 | { |
80 | void *tmp = dest; | 80 | void *tmp = dest; |
81 | u32 *src = (u32 *)__src; | 81 | u32 *src = (u32 *)__src; |
82 | 82 | ||
83 | count /= 4; | 83 | count /= 4; |
84 | 84 | while (count--) | |
85 | while (count--) { | 85 | *dest++ = swab32p(src++); |
86 | *dest++ = swab32p(src++); | 86 | return tmp; |
87 | } | ||
88 | |||
89 | return tmp; | ||
90 | } | 87 | } |
91 | 88 | ||
92 | #else | 89 | #else |
93 | 90 | ||
94 | static __inline__ void *memcpy_le32(u32 *dest, const u32 *src, size_t count) | 91 | static __inline__ void *memcpy_le32(u32 *dest, const u32 *src, size_t count) |
95 | { | 92 | { |
96 | return memcpy(dest, src, count); | 93 | return memcpy(dest, src, count); |
97 | } | 94 | } |
98 | 95 | ||
99 | #endif /* __BIG_ENDIAN */ | 96 | #endif /* __BIG_ENDIAN */ |
diff --git a/drivers/ieee1394/iso.h b/drivers/ieee1394/iso.h index 3efc60b33a88..ed639c4c510f 100644 --- a/drivers/ieee1394/iso.h +++ b/drivers/ieee1394/iso.h | |||
@@ -17,28 +17,30 @@ | |||
17 | 17 | ||
18 | /* high-level ISO interface */ | 18 | /* high-level ISO interface */ |
19 | 19 | ||
20 | /* This API sends and receives isochronous packets on a large, | 20 | /* |
21 | virtually-contiguous kernel memory buffer. The buffer may be mapped | 21 | * This API sends and receives isochronous packets on a large, |
22 | into a user-space process for zero-copy transmission and reception. | 22 | * virtually-contiguous kernel memory buffer. The buffer may be mapped |
23 | 23 | * into a user-space process for zero-copy transmission and reception. | |
24 | There are no explicit boundaries between packets in the buffer. A | 24 | * |
25 | packet may be transmitted or received at any location. However, | 25 | * There are no explicit boundaries between packets in the buffer. A |
26 | low-level drivers may impose certain restrictions on alignment or | 26 | * packet may be transmitted or received at any location. However, |
27 | size of packets. (e.g. in OHCI no packet may cross a page boundary, | 27 | * low-level drivers may impose certain restrictions on alignment or |
28 | and packets should be quadlet-aligned) | 28 | * size of packets. (e.g. in OHCI no packet may cross a page boundary, |
29 | */ | 29 | * and packets should be quadlet-aligned) |
30 | */ | ||
30 | 31 | ||
31 | /* Packet descriptor - the API maintains a ring buffer of these packet | 32 | /* Packet descriptor - the API maintains a ring buffer of these packet |
32 | descriptors in kernel memory (hpsb_iso.infos[]). */ | 33 | * descriptors in kernel memory (hpsb_iso.infos[]). */ |
33 | |||
34 | struct hpsb_iso_packet_info { | 34 | struct hpsb_iso_packet_info { |
35 | /* offset of data payload relative to the first byte of the buffer */ | 35 | /* offset of data payload relative to the first byte of the buffer */ |
36 | __u32 offset; | 36 | __u32 offset; |
37 | 37 | ||
38 | /* length of the data payload, in bytes (not including the isochronous header) */ | 38 | /* length of the data payload, in bytes (not including the isochronous |
39 | * header) */ | ||
39 | __u16 len; | 40 | __u16 len; |
40 | 41 | ||
41 | /* (recv only) the cycle number (mod 8000) on which the packet was received */ | 42 | /* (recv only) the cycle number (mod 8000) on which the packet was |
43 | * received */ | ||
42 | __u16 cycle; | 44 | __u16 cycle; |
43 | 45 | ||
44 | /* (recv only) channel on which the packet was received */ | 46 | /* (recv only) channel on which the packet was received */ |
@@ -48,12 +50,10 @@ struct hpsb_iso_packet_info { | |||
48 | __u8 tag; | 50 | __u8 tag; |
49 | __u8 sy; | 51 | __u8 sy; |
50 | 52 | ||
51 | /* | 53 | /* length in bytes of the packet including header/trailer. |
52 | * length in bytes of the packet including header/trailer. | 54 | * MUST be at structure end, since the first part of this structure is |
53 | * MUST be at structure end, since the first part of this structure is also | 55 | * also defined in raw1394.h (i.e. struct raw1394_iso_packet_info), is |
54 | * defined in raw1394.h (i.e. struct raw1394_iso_packet_info), is copied to | 56 | * copied to userspace and is accessed there through libraw1394. */ |
55 | * userspace and is accessed there through libraw1394. | ||
56 | */ | ||
57 | __u16 total_len; | 57 | __u16 total_len; |
58 | }; | 58 | }; |
59 | 59 | ||
@@ -75,8 +75,8 @@ struct hpsb_iso { | |||
75 | void *hostdata; | 75 | void *hostdata; |
76 | 76 | ||
77 | /* a function to be called (from interrupt context) after | 77 | /* a function to be called (from interrupt context) after |
78 | outgoing packets have been sent, or incoming packets have | 78 | * outgoing packets have been sent, or incoming packets have |
79 | arrived */ | 79 | * arrived */ |
80 | void (*callback)(struct hpsb_iso*); | 80 | void (*callback)(struct hpsb_iso*); |
81 | 81 | ||
82 | /* wait for buffer space */ | 82 | /* wait for buffer space */ |
@@ -88,7 +88,7 @@ struct hpsb_iso { | |||
88 | 88 | ||
89 | 89 | ||
90 | /* greatest # of packets between interrupts - controls | 90 | /* greatest # of packets between interrupts - controls |
91 | the maximum latency of the buffer */ | 91 | * the maximum latency of the buffer */ |
92 | int irq_interval; | 92 | int irq_interval; |
93 | 93 | ||
94 | /* the buffer for packet data payloads */ | 94 | /* the buffer for packet data payloads */ |
@@ -112,8 +112,8 @@ struct hpsb_iso { | |||
112 | int pkt_dma; | 112 | int pkt_dma; |
113 | 113 | ||
114 | /* how many packets, starting at first_packet: | 114 | /* how many packets, starting at first_packet: |
115 | (transmit) are ready to be filled with data | 115 | * (transmit) are ready to be filled with data |
116 | (receive) contain received data */ | 116 | * (receive) contain received data */ |
117 | int n_ready_packets; | 117 | int n_ready_packets; |
118 | 118 | ||
119 | /* how many times the buffer has overflowed or underflowed */ | 119 | /* how many times the buffer has overflowed or underflowed */ |
@@ -134,7 +134,7 @@ struct hpsb_iso { | |||
134 | int start_cycle; | 134 | int start_cycle; |
135 | 135 | ||
136 | /* cycle at which next packet will be transmitted, | 136 | /* cycle at which next packet will be transmitted, |
137 | -1 if not known */ | 137 | * -1 if not known */ |
138 | int xmit_cycle; | 138 | int xmit_cycle; |
139 | 139 | ||
140 | /* ringbuffer of packet descriptors in regular kernel memory | 140 | /* 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 | int hpsb_iso_recv_set_channel_mask(struct hpsb_iso *iso, u64 mask); | 170 | int hpsb_iso_recv_set_channel_mask(struct hpsb_iso *iso, u64 mask); |
171 | 171 | ||
172 | /* start/stop DMA */ | 172 | /* start/stop DMA */ |
173 | int hpsb_iso_xmit_start(struct hpsb_iso *iso, int start_on_cycle, int prebuffer); | 173 | int hpsb_iso_xmit_start(struct hpsb_iso *iso, int start_on_cycle, |
174 | int hpsb_iso_recv_start(struct hpsb_iso *iso, int start_on_cycle, int tag_mask, int sync); | 174 | int prebuffer); |
175 | int hpsb_iso_recv_start(struct hpsb_iso *iso, int start_on_cycle, | ||
176 | int tag_mask, int sync); | ||
175 | void hpsb_iso_stop(struct hpsb_iso *iso); | 177 | void hpsb_iso_stop(struct hpsb_iso *iso); |
176 | 178 | ||
177 | /* deallocate buffer and DMA context */ | 179 | /* deallocate buffer and DMA context */ |
178 | void hpsb_iso_shutdown(struct hpsb_iso *iso); | 180 | void hpsb_iso_shutdown(struct hpsb_iso *iso); |
179 | 181 | ||
180 | /* queue a packet for transmission. 'offset' is relative to the beginning of the | 182 | /* queue a packet for transmission. |
181 | DMA buffer, where the packet's data payload should already have been placed */ | 183 | * 'offset' is relative to the beginning of the DMA buffer, where the packet's |
182 | int hpsb_iso_xmit_queue_packet(struct hpsb_iso *iso, u32 offset, u16 len, u8 tag, u8 sy); | 184 | * data payload should already have been placed. */ |
185 | int hpsb_iso_xmit_queue_packet(struct hpsb_iso *iso, u32 offset, u16 len, | ||
186 | u8 tag, u8 sy); | ||
183 | 187 | ||
184 | /* wait until all queued packets have been transmitted to the bus */ | 188 | /* wait until all queued packets have been transmitted to the bus */ |
185 | int hpsb_iso_xmit_sync(struct hpsb_iso *iso); | 189 | int hpsb_iso_xmit_sync(struct hpsb_iso *iso); |
186 | 190 | ||
187 | /* N packets have been read out of the buffer, re-use the buffer space */ | 191 | /* N packets have been read out of the buffer, re-use the buffer space */ |
188 | int hpsb_iso_recv_release_packets(struct hpsb_iso *recv, unsigned int n_packets); | 192 | int hpsb_iso_recv_release_packets(struct hpsb_iso *recv, |
193 | unsigned int n_packets); | ||
189 | 194 | ||
190 | /* check for arrival of new packets immediately (even if irq_interval | 195 | /* check for arrival of new packets immediately (even if irq_interval |
191 | has not yet been reached) */ | 196 | * has not yet been reached) */ |
192 | int hpsb_iso_recv_flush(struct hpsb_iso *iso); | 197 | int hpsb_iso_recv_flush(struct hpsb_iso *iso); |
193 | 198 | ||
194 | /* returns # of packets ready to send or receive */ | 199 | /* returns # of packets ready to send or receive */ |
@@ -197,14 +202,15 @@ int hpsb_iso_n_ready(struct hpsb_iso *iso); | |||
197 | /* the following are callbacks available to low-level drivers */ | 202 | /* the following are callbacks available to low-level drivers */ |
198 | 203 | ||
199 | /* call after a packet has been transmitted to the bus (interrupt context is OK) | 204 | /* call after a packet has been transmitted to the bus (interrupt context is OK) |
200 | 'cycle' is the _exact_ cycle the packet was sent on | 205 | * 'cycle' is the _exact_ cycle the packet was sent on |
201 | 'error' should be non-zero if some sort of error occurred when sending the packet | 206 | * 'error' should be non-zero if some sort of error occurred when sending the |
202 | */ | 207 | * packet */ |
203 | void hpsb_iso_packet_sent(struct hpsb_iso *iso, int cycle, int error); | 208 | void hpsb_iso_packet_sent(struct hpsb_iso *iso, int cycle, int error); |
204 | 209 | ||
205 | /* call after a packet has been received (interrupt context OK) */ | 210 | /* call after a packet has been received (interrupt context OK) */ |
206 | void hpsb_iso_packet_received(struct hpsb_iso *iso, u32 offset, u16 len, | 211 | void hpsb_iso_packet_received(struct hpsb_iso *iso, u32 offset, u16 len, |
207 | u16 total_len, u16 cycle, u8 channel, u8 tag, u8 sy); | 212 | u16 total_len, u16 cycle, u8 channel, u8 tag, |
213 | u8 sy); | ||
208 | 214 | ||
209 | /* call to wake waiting processes after buffer space has opened up. */ | 215 | /* call to wake waiting processes after buffer space has opened up. */ |
210 | void hpsb_iso_wake(struct hpsb_iso *iso); | 216 | void hpsb_iso_wake(struct hpsb_iso *iso); |
diff --git a/drivers/ieee1394/nodemgr.h b/drivers/ieee1394/nodemgr.h index 0b26616e16c3..b35c1b5c8d86 100644 --- a/drivers/ieee1394/nodemgr.h +++ b/drivers/ieee1394/nodemgr.h | |||
@@ -44,7 +44,6 @@ struct bus_options { | |||
44 | u16 max_rec; /* Maximum packet size node can receive */ | 44 | u16 max_rec; /* Maximum packet size node can receive */ |
45 | }; | 45 | }; |
46 | 46 | ||
47 | |||
48 | #define UNIT_DIRECTORY_VENDOR_ID 0x01 | 47 | #define UNIT_DIRECTORY_VENDOR_ID 0x01 |
49 | #define UNIT_DIRECTORY_MODEL_ID 0x02 | 48 | #define UNIT_DIRECTORY_MODEL_ID 0x02 |
50 | #define UNIT_DIRECTORY_SPECIFIER_ID 0x04 | 49 | #define UNIT_DIRECTORY_SPECIFIER_ID 0x04 |
@@ -59,8 +58,8 @@ struct bus_options { | |||
59 | * unit directory for each of these protocols. | 58 | * unit directory for each of these protocols. |
60 | */ | 59 | */ |
61 | struct unit_directory { | 60 | struct unit_directory { |
62 | struct node_entry *ne; /* The node which this directory belongs to */ | 61 | struct node_entry *ne; /* The node which this directory belongs to */ |
63 | octlet_t address; /* Address of the unit directory on the node */ | 62 | octlet_t address; /* Address of the unit directory on the node */ |
64 | u8 flags; /* Indicates which entries were read */ | 63 | u8 flags; /* Indicates which entries were read */ |
65 | 64 | ||
66 | quadlet_t vendor_id; | 65 | quadlet_t vendor_id; |
@@ -79,11 +78,10 @@ struct unit_directory { | |||
79 | int length; /* Number of quadlets */ | 78 | int length; /* Number of quadlets */ |
80 | 79 | ||
81 | struct device device; | 80 | struct device device; |
82 | |||
83 | struct class_device class_dev; | 81 | struct class_device class_dev; |
84 | 82 | ||
85 | struct csr1212_keyval *ud_kv; | 83 | struct csr1212_keyval *ud_kv; |
86 | u32 lun; /* logical unit number immediate value */ | 84 | u32 lun; /* logical unit number immediate value */ |
87 | }; | 85 | }; |
88 | 86 | ||
89 | struct node_entry { | 87 | struct node_entry { |
@@ -106,7 +104,6 @@ struct node_entry { | |||
106 | struct hpsb_tlabel_pool *tpool; | 104 | struct hpsb_tlabel_pool *tpool; |
107 | 105 | ||
108 | struct device device; | 106 | struct device device; |
109 | |||
110 | struct class_device class_dev; | 107 | struct class_device class_dev; |
111 | 108 | ||
112 | /* Means this node is not attached anymore */ | 109 | /* Means this node is not attached anymore */ |
@@ -153,8 +150,8 @@ static inline int hpsb_node_entry_valid(struct node_entry *ne) | |||
153 | /* | 150 | /* |
154 | * This will fill in the given, pre-initialised hpsb_packet with the current | 151 | * This will fill in the given, pre-initialised hpsb_packet with the current |
155 | * information from the node entry (host, node ID, generation number). It will | 152 | * information from the node entry (host, node ID, generation number). It will |
156 | * return false if the node owning the GUID is not accessible (and not modify the | 153 | * return false if the node owning the GUID is not accessible (and not modify |
157 | * hpsb_packet) and return true otherwise. | 154 | * the hpsb_packet) and return true otherwise. |
158 | * | 155 | * |
159 | * Note that packet sending may still fail in hpsb_send_packet if a bus reset | 156 | * Note that packet sending may still fail in hpsb_send_packet if a bus reset |
160 | * happens while you are trying to set up the packet (due to obsolete generation | 157 | * 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 | int hpsb_node_lock(struct node_entry *ne, u64 addr, | 167 | int hpsb_node_lock(struct node_entry *ne, u64 addr, |
171 | int extcode, quadlet_t *data, quadlet_t arg); | 168 | int extcode, quadlet_t *data, quadlet_t arg); |
172 | 169 | ||
173 | |||
174 | /* Iterate the hosts, calling a given function with supplied data for each | 170 | /* Iterate the hosts, calling a given function with supplied data for each |
175 | * host. */ | 171 | * host. */ |
176 | int nodemgr_for_each_host(void *__data, int (*cb)(struct hpsb_host *, void *)); | 172 | int nodemgr_for_each_host(void *__data, int (*cb)(struct hpsb_host *, void *)); |
177 | 173 | ||
178 | |||
179 | int init_ieee1394_nodemgr(void); | 174 | int init_ieee1394_nodemgr(void); |
180 | void cleanup_ieee1394_nodemgr(void); | 175 | void cleanup_ieee1394_nodemgr(void); |
181 | 176 | ||
182 | |||
183 | /* The template for a host device */ | 177 | /* The template for a host device */ |
184 | extern struct device nodemgr_dev_template_host; | 178 | extern struct device nodemgr_dev_template_host; |
185 | 179 | ||