diff options
-rw-r--r-- | Documentation/feature-removal-schedule.txt | 11 | ||||
-rw-r--r-- | drivers/ieee1394/Kconfig | 23 | ||||
-rw-r--r-- | drivers/ieee1394/Makefile | 2 | ||||
-rw-r--r-- | drivers/ieee1394/csr1212.c | 21 | ||||
-rw-r--r-- | drivers/ieee1394/csr1212.h | 2 | ||||
-rw-r--r-- | drivers/ieee1394/dma.c | 73 | ||||
-rw-r--r-- | drivers/ieee1394/dv1394.c | 13 | ||||
-rw-r--r-- | drivers/ieee1394/eth1394.c | 20 | ||||
-rw-r--r-- | drivers/ieee1394/highlevel.c | 18 | ||||
-rw-r--r-- | drivers/ieee1394/hosts.c | 6 | ||||
-rw-r--r-- | drivers/ieee1394/ieee1394-ioctl.h | 8 | ||||
-rw-r--r-- | drivers/ieee1394/ieee1394_transactions.c | 389 | ||||
-rw-r--r-- | drivers/ieee1394/iso.c | 102 | ||||
-rw-r--r-- | drivers/ieee1394/nodemgr.c | 27 | ||||
-rw-r--r-- | drivers/ieee1394/ohci1394.c | 33 | ||||
-rw-r--r-- | drivers/ieee1394/ohci1394.h | 4 | ||||
-rw-r--r-- | drivers/ieee1394/pcilynx.c | 2 | ||||
-rw-r--r-- | drivers/ieee1394/raw1394.c | 79 | ||||
-rw-r--r-- | drivers/ieee1394/sbp2.c | 637 | ||||
-rw-r--r-- | drivers/ieee1394/sbp2.h | 23 | ||||
-rw-r--r-- | drivers/ieee1394/video1394.c | 106 |
21 files changed, 647 insertions, 952 deletions
diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt index 9b743198f77a..8ae8dad8e150 100644 --- a/Documentation/feature-removal-schedule.txt +++ b/Documentation/feature-removal-schedule.txt | |||
@@ -47,17 +47,6 @@ Who: Paul E. McKenney <paulmck@us.ibm.com> | |||
47 | 47 | ||
48 | --------------------------- | 48 | --------------------------- |
49 | 49 | ||
50 | What: IEEE1394 Audio and Music Data Transmission Protocol driver, | ||
51 | Connection Management Procedures driver | ||
52 | When: November 2005 | ||
53 | Files: drivers/ieee1394/{amdtp,cmp}* | ||
54 | Why: These are incomplete, have never worked, and are better implemented | ||
55 | in userland via raw1394 (see http://freebob.sourceforge.net/ for | ||
56 | example.) | ||
57 | Who: Jody McIntyre <scjody@steamballoon.com> | ||
58 | |||
59 | --------------------------- | ||
60 | |||
61 | What: raw1394: requests of type RAW1394_REQ_ISO_SEND, RAW1394_REQ_ISO_LISTEN | 50 | What: raw1394: requests of type RAW1394_REQ_ISO_SEND, RAW1394_REQ_ISO_LISTEN |
62 | When: November 2005 | 51 | When: November 2005 |
63 | Why: Deprecated in favour of the new ioctl-based rawiso interface, which is | 52 | Why: Deprecated in favour of the new ioctl-based rawiso interface, which is |
diff --git a/drivers/ieee1394/Kconfig b/drivers/ieee1394/Kconfig index 25103a0ef9b3..39142e2f804b 100644 --- a/drivers/ieee1394/Kconfig +++ b/drivers/ieee1394/Kconfig | |||
@@ -169,27 +169,4 @@ config IEEE1394_RAWIO | |||
169 | To compile this driver as a module, say M here: the | 169 | To compile this driver as a module, say M here: the |
170 | module will be called raw1394. | 170 | module will be called raw1394. |
171 | 171 | ||
172 | config IEEE1394_CMP | ||
173 | tristate "IEC61883-1 Plug support" | ||
174 | depends on IEEE1394 | ||
175 | help | ||
176 | This option enables the Connection Management Procedures | ||
177 | (IEC61883-1) driver, which implements input and output plugs. | ||
178 | |||
179 | To compile this driver as a module, say M here: the | ||
180 | module will be called cmp. | ||
181 | |||
182 | config IEEE1394_AMDTP | ||
183 | tristate "IEC61883-6 (Audio transmission) support" | ||
184 | depends on IEEE1394 && IEEE1394_OHCI1394 && IEEE1394_CMP | ||
185 | help | ||
186 | This option enables the Audio & Music Data Transmission Protocol | ||
187 | (IEC61883-6) driver, which implements audio transmission over | ||
188 | IEEE1394. | ||
189 | |||
190 | The userspace interface is documented in amdtp.h. | ||
191 | |||
192 | To compile this driver as a module, say M here: the | ||
193 | module will be called amdtp. | ||
194 | |||
195 | endmenu | 172 | endmenu |
diff --git a/drivers/ieee1394/Makefile b/drivers/ieee1394/Makefile index e8b4d48d376e..6f53611fe255 100644 --- a/drivers/ieee1394/Makefile +++ b/drivers/ieee1394/Makefile | |||
@@ -14,8 +14,6 @@ obj-$(CONFIG_IEEE1394_RAWIO) += raw1394.o | |||
14 | obj-$(CONFIG_IEEE1394_SBP2) += sbp2.o | 14 | obj-$(CONFIG_IEEE1394_SBP2) += sbp2.o |
15 | obj-$(CONFIG_IEEE1394_DV1394) += dv1394.o | 15 | obj-$(CONFIG_IEEE1394_DV1394) += dv1394.o |
16 | obj-$(CONFIG_IEEE1394_ETH1394) += eth1394.o | 16 | obj-$(CONFIG_IEEE1394_ETH1394) += eth1394.o |
17 | obj-$(CONFIG_IEEE1394_AMDTP) += amdtp.o | ||
18 | obj-$(CONFIG_IEEE1394_CMP) += cmp.o | ||
19 | 17 | ||
20 | quiet_cmd_oui2c = OUI2C $@ | 18 | quiet_cmd_oui2c = OUI2C $@ |
21 | cmd_oui2c = $(CONFIG_SHELL) $(srctree)/$(src)/oui2c.sh < $< > $@ | 19 | cmd_oui2c = $(CONFIG_SHELL) $(srctree)/$(src)/oui2c.sh < $< > $@ |
diff --git a/drivers/ieee1394/csr1212.c b/drivers/ieee1394/csr1212.c index 61ddd5d37eff..15773544234b 100644 --- a/drivers/ieee1394/csr1212.c +++ b/drivers/ieee1394/csr1212.c | |||
@@ -1261,7 +1261,7 @@ static int csr1212_parse_bus_info_block(struct csr1212_csr *csr) | |||
1261 | return CSR1212_EINVAL; | 1261 | return CSR1212_EINVAL; |
1262 | #endif | 1262 | #endif |
1263 | 1263 | ||
1264 | cr = CSR1212_MALLOC(sizeof(struct csr1212_cache_region)); | 1264 | cr = CSR1212_MALLOC(sizeof(*cr)); |
1265 | if (!cr) | 1265 | if (!cr) |
1266 | return CSR1212_ENOMEM; | 1266 | return CSR1212_ENOMEM; |
1267 | 1267 | ||
@@ -1393,8 +1393,7 @@ int csr1212_parse_keyval(struct csr1212_keyval *kv, | |||
1393 | case CSR1212_KV_TYPE_LEAF: | 1393 | case CSR1212_KV_TYPE_LEAF: |
1394 | if (kv->key.id != CSR1212_KV_ID_EXTENDED_ROM) { | 1394 | if (kv->key.id != CSR1212_KV_ID_EXTENDED_ROM) { |
1395 | kv->value.leaf.data = CSR1212_MALLOC(quads_to_bytes(kvi_len)); | 1395 | kv->value.leaf.data = CSR1212_MALLOC(quads_to_bytes(kvi_len)); |
1396 | if (!kv->value.leaf.data) | 1396 | if (!kv->value.leaf.data) { |
1397 | { | ||
1398 | ret = CSR1212_ENOMEM; | 1397 | ret = CSR1212_ENOMEM; |
1399 | goto fail; | 1398 | goto fail; |
1400 | } | 1399 | } |
@@ -1462,7 +1461,7 @@ int _csr1212_read_keyval(struct csr1212_csr *csr, struct csr1212_keyval *kv) | |||
1462 | cache->next = NULL; | 1461 | cache->next = NULL; |
1463 | csr->cache_tail = cache; | 1462 | csr->cache_tail = cache; |
1464 | cache->filled_head = | 1463 | cache->filled_head = |
1465 | CSR1212_MALLOC(sizeof(struct csr1212_cache_region)); | 1464 | CSR1212_MALLOC(sizeof(*cache->filled_head)); |
1466 | if (!cache->filled_head) { | 1465 | if (!cache->filled_head) { |
1467 | return CSR1212_ENOMEM; | 1466 | return CSR1212_ENOMEM; |
1468 | } | 1467 | } |
@@ -1484,7 +1483,7 @@ int _csr1212_read_keyval(struct csr1212_csr *csr, struct csr1212_keyval *kv) | |||
1484 | /* Now seach read portions of the cache to see if it is there. */ | 1483 | /* Now seach read portions of the cache to see if it is there. */ |
1485 | for (cr = cache->filled_head; cr; cr = cr->next) { | 1484 | for (cr = cache->filled_head; cr; cr = cr->next) { |
1486 | if (cache_index < cr->offset_start) { | 1485 | if (cache_index < cr->offset_start) { |
1487 | newcr = CSR1212_MALLOC(sizeof(struct csr1212_cache_region)); | 1486 | newcr = CSR1212_MALLOC(sizeof(*newcr)); |
1488 | if (!newcr) | 1487 | if (!newcr) |
1489 | return CSR1212_ENOMEM; | 1488 | return CSR1212_ENOMEM; |
1490 | 1489 | ||
@@ -1508,7 +1507,7 @@ int _csr1212_read_keyval(struct csr1212_csr *csr, struct csr1212_keyval *kv) | |||
1508 | 1507 | ||
1509 | if (!cr) { | 1508 | if (!cr) { |
1510 | cr = cache->filled_tail; | 1509 | cr = cache->filled_tail; |
1511 | newcr = CSR1212_MALLOC(sizeof(struct csr1212_cache_region)); | 1510 | newcr = CSR1212_MALLOC(sizeof(*newcr)); |
1512 | if (!newcr) | 1511 | if (!newcr) |
1513 | return CSR1212_ENOMEM; | 1512 | return CSR1212_ENOMEM; |
1514 | 1513 | ||
@@ -1611,15 +1610,17 @@ int csr1212_parse_csr(struct csr1212_csr *csr) | |||
1611 | csr->root_kv->valid = 0; | 1610 | csr->root_kv->valid = 0; |
1612 | csr->root_kv->next = csr->root_kv; | 1611 | csr->root_kv->next = csr->root_kv; |
1613 | csr->root_kv->prev = csr->root_kv; | 1612 | csr->root_kv->prev = csr->root_kv; |
1614 | csr1212_get_keyval(csr, csr->root_kv); | 1613 | ret = _csr1212_read_keyval(csr, csr->root_kv); |
1614 | if (ret != CSR1212_SUCCESS) | ||
1615 | return ret; | ||
1615 | 1616 | ||
1616 | /* Scan through the Root directory finding all extended ROM regions | 1617 | /* Scan through the Root directory finding all extended ROM regions |
1617 | * and make cache regions for them */ | 1618 | * and make cache regions for them */ |
1618 | for (dentry = csr->root_kv->value.directory.dentries_head; | 1619 | for (dentry = csr->root_kv->value.directory.dentries_head; |
1619 | dentry; dentry = dentry->next) { | 1620 | dentry; dentry = dentry->next) { |
1620 | if (dentry->kv->key.id == CSR1212_KV_ID_EXTENDED_ROM) { | 1621 | if (dentry->kv->key.id == CSR1212_KV_ID_EXTENDED_ROM && |
1621 | csr1212_get_keyval(csr, dentry->kv); | 1622 | !dentry->kv->valid) { |
1622 | 1623 | ret = _csr1212_read_keyval(csr, dentry->kv); | |
1623 | if (ret != CSR1212_SUCCESS) | 1624 | if (ret != CSR1212_SUCCESS) |
1624 | return ret; | 1625 | return ret; |
1625 | } | 1626 | } |
diff --git a/drivers/ieee1394/csr1212.h b/drivers/ieee1394/csr1212.h index 28c5f4b726e2..cecd5871f2de 100644 --- a/drivers/ieee1394/csr1212.h +++ b/drivers/ieee1394/csr1212.h | |||
@@ -646,7 +646,7 @@ static inline struct csr1212_csr_rom_cache *csr1212_rom_cache_malloc(u_int32_t o | |||
646 | { | 646 | { |
647 | struct csr1212_csr_rom_cache *cache; | 647 | struct csr1212_csr_rom_cache *cache; |
648 | 648 | ||
649 | cache = CSR1212_MALLOC(sizeof(struct csr1212_csr_rom_cache) + size); | 649 | cache = CSR1212_MALLOC(sizeof(*cache) + size); |
650 | if (!cache) | 650 | if (!cache) |
651 | return NULL; | 651 | return NULL; |
652 | 652 | ||
diff --git a/drivers/ieee1394/dma.c b/drivers/ieee1394/dma.c index b79ddb43e746..9fb2769d9abc 100644 --- a/drivers/ieee1394/dma.c +++ b/drivers/ieee1394/dma.c | |||
@@ -23,7 +23,8 @@ void dma_prog_region_init(struct dma_prog_region *prog) | |||
23 | prog->bus_addr = 0; | 23 | prog->bus_addr = 0; |
24 | } | 24 | } |
25 | 25 | ||
26 | int dma_prog_region_alloc(struct dma_prog_region *prog, unsigned long n_bytes, struct pci_dev *dev) | 26 | int dma_prog_region_alloc(struct dma_prog_region *prog, unsigned long n_bytes, |
27 | struct pci_dev *dev) | ||
27 | { | 28 | { |
28 | /* round up to page size */ | 29 | /* round up to page size */ |
29 | n_bytes = PAGE_ALIGN(n_bytes); | 30 | n_bytes = PAGE_ALIGN(n_bytes); |
@@ -32,7 +33,8 @@ int dma_prog_region_alloc(struct dma_prog_region *prog, unsigned long n_bytes, | |||
32 | 33 | ||
33 | prog->kvirt = pci_alloc_consistent(dev, n_bytes, &prog->bus_addr); | 34 | prog->kvirt = pci_alloc_consistent(dev, n_bytes, &prog->bus_addr); |
34 | if (!prog->kvirt) { | 35 | if (!prog->kvirt) { |
35 | printk(KERN_ERR "dma_prog_region_alloc: pci_alloc_consistent() failed\n"); | 36 | printk(KERN_ERR |
37 | "dma_prog_region_alloc: pci_alloc_consistent() failed\n"); | ||
36 | dma_prog_region_free(prog); | 38 | dma_prog_region_free(prog); |
37 | return -ENOMEM; | 39 | return -ENOMEM; |
38 | } | 40 | } |
@@ -45,7 +47,8 @@ int dma_prog_region_alloc(struct dma_prog_region *prog, unsigned long n_bytes, | |||
45 | void dma_prog_region_free(struct dma_prog_region *prog) | 47 | void dma_prog_region_free(struct dma_prog_region *prog) |
46 | { | 48 | { |
47 | if (prog->kvirt) { | 49 | if (prog->kvirt) { |
48 | pci_free_consistent(prog->dev, prog->n_pages << PAGE_SHIFT, prog->kvirt, prog->bus_addr); | 50 | pci_free_consistent(prog->dev, prog->n_pages << PAGE_SHIFT, |
51 | prog->kvirt, prog->bus_addr); | ||
49 | } | 52 | } |
50 | 53 | ||
51 | prog->kvirt = NULL; | 54 | prog->kvirt = NULL; |
@@ -65,7 +68,8 @@ void dma_region_init(struct dma_region *dma) | |||
65 | dma->sglist = NULL; | 68 | dma->sglist = NULL; |
66 | } | 69 | } |
67 | 70 | ||
68 | int dma_region_alloc(struct dma_region *dma, unsigned long n_bytes, struct pci_dev *dev, int direction) | 71 | int dma_region_alloc(struct dma_region *dma, unsigned long n_bytes, |
72 | struct pci_dev *dev, int direction) | ||
69 | { | 73 | { |
70 | unsigned int i; | 74 | unsigned int i; |
71 | 75 | ||
@@ -95,14 +99,16 @@ int dma_region_alloc(struct dma_region *dma, unsigned long n_bytes, struct pci_d | |||
95 | 99 | ||
96 | /* fill scatter/gather list with pages */ | 100 | /* fill scatter/gather list with pages */ |
97 | for (i = 0; i < dma->n_pages; i++) { | 101 | for (i = 0; i < dma->n_pages; i++) { |
98 | unsigned long va = (unsigned long) dma->kvirt + (i << PAGE_SHIFT); | 102 | unsigned long va = |
103 | (unsigned long)dma->kvirt + (i << PAGE_SHIFT); | ||
99 | 104 | ||
100 | dma->sglist[i].page = vmalloc_to_page((void *)va); | 105 | dma->sglist[i].page = vmalloc_to_page((void *)va); |
101 | dma->sglist[i].length = PAGE_SIZE; | 106 | dma->sglist[i].length = PAGE_SIZE; |
102 | } | 107 | } |
103 | 108 | ||
104 | /* map sglist to the IOMMU */ | 109 | /* map sglist to the IOMMU */ |
105 | dma->n_dma_pages = pci_map_sg(dev, dma->sglist, dma->n_pages, direction); | 110 | dma->n_dma_pages = |
111 | pci_map_sg(dev, dma->sglist, dma->n_pages, direction); | ||
106 | 112 | ||
107 | if (dma->n_dma_pages == 0) { | 113 | if (dma->n_dma_pages == 0) { |
108 | printk(KERN_ERR "dma_region_alloc: pci_map_sg() failed\n"); | 114 | printk(KERN_ERR "dma_region_alloc: pci_map_sg() failed\n"); |
@@ -114,7 +120,7 @@ int dma_region_alloc(struct dma_region *dma, unsigned long n_bytes, struct pci_d | |||
114 | 120 | ||
115 | return 0; | 121 | return 0; |
116 | 122 | ||
117 | err: | 123 | err: |
118 | dma_region_free(dma); | 124 | dma_region_free(dma); |
119 | return -ENOMEM; | 125 | return -ENOMEM; |
120 | } | 126 | } |
@@ -122,7 +128,8 @@ err: | |||
122 | void dma_region_free(struct dma_region *dma) | 128 | void dma_region_free(struct dma_region *dma) |
123 | { | 129 | { |
124 | if (dma->n_dma_pages) { | 130 | if (dma->n_dma_pages) { |
125 | pci_unmap_sg(dma->dev, dma->sglist, dma->n_pages, dma->direction); | 131 | pci_unmap_sg(dma->dev, dma->sglist, dma->n_pages, |
132 | dma->direction); | ||
126 | dma->n_dma_pages = 0; | 133 | dma->n_dma_pages = 0; |
127 | dma->dev = NULL; | 134 | dma->dev = NULL; |
128 | } | 135 | } |
@@ -137,7 +144,8 @@ void dma_region_free(struct dma_region *dma) | |||
137 | 144 | ||
138 | /* find the scatterlist index and remaining offset corresponding to a | 145 | /* find the scatterlist index and remaining offset corresponding to a |
139 | given offset from the beginning of the buffer */ | 146 | given offset from the beginning of the buffer */ |
140 | static inline int dma_region_find(struct dma_region *dma, unsigned long offset, unsigned long *rem) | 147 | static inline int dma_region_find(struct dma_region *dma, unsigned long offset, |
148 | unsigned long *rem) | ||
141 | { | 149 | { |
142 | int i; | 150 | int i; |
143 | unsigned long off = offset; | 151 | unsigned long off = offset; |
@@ -156,15 +164,18 @@ static inline int dma_region_find(struct dma_region *dma, unsigned long offset, | |||
156 | return i; | 164 | return i; |
157 | } | 165 | } |
158 | 166 | ||
159 | dma_addr_t dma_region_offset_to_bus(struct dma_region *dma, unsigned long offset) | 167 | dma_addr_t dma_region_offset_to_bus(struct dma_region * dma, |
168 | unsigned long offset) | ||
160 | { | 169 | { |
161 | unsigned long rem = 0; | 170 | unsigned long rem = 0; |
162 | 171 | ||
163 | struct scatterlist *sg = &dma->sglist[dma_region_find(dma, offset, &rem)]; | 172 | struct scatterlist *sg = |
173 | &dma->sglist[dma_region_find(dma, offset, &rem)]; | ||
164 | return sg_dma_address(sg) + rem; | 174 | return sg_dma_address(sg) + rem; |
165 | } | 175 | } |
166 | 176 | ||
167 | void dma_region_sync_for_cpu(struct dma_region *dma, unsigned long offset, unsigned long len) | 177 | void dma_region_sync_for_cpu(struct dma_region *dma, unsigned long offset, |
178 | unsigned long len) | ||
168 | { | 179 | { |
169 | int first, last; | 180 | int first, last; |
170 | unsigned long rem; | 181 | unsigned long rem; |
@@ -175,10 +186,12 @@ void dma_region_sync_for_cpu(struct dma_region *dma, unsigned long offset, unsig | |||
175 | first = dma_region_find(dma, offset, &rem); | 186 | first = dma_region_find(dma, offset, &rem); |
176 | last = dma_region_find(dma, offset + len - 1, &rem); | 187 | last = dma_region_find(dma, offset + len - 1, &rem); |
177 | 188 | ||
178 | pci_dma_sync_sg_for_cpu(dma->dev, &dma->sglist[first], last - first + 1, dma->direction); | 189 | pci_dma_sync_sg_for_cpu(dma->dev, &dma->sglist[first], last - first + 1, |
190 | dma->direction); | ||
179 | } | 191 | } |
180 | 192 | ||
181 | void dma_region_sync_for_device(struct dma_region *dma, unsigned long offset, unsigned long len) | 193 | void dma_region_sync_for_device(struct dma_region *dma, unsigned long offset, |
194 | unsigned long len) | ||
182 | { | 195 | { |
183 | int first, last; | 196 | int first, last; |
184 | unsigned long rem; | 197 | unsigned long rem; |
@@ -189,44 +202,47 @@ void dma_region_sync_for_device(struct dma_region *dma, unsigned long offset, un | |||
189 | first = dma_region_find(dma, offset, &rem); | 202 | first = dma_region_find(dma, offset, &rem); |
190 | last = dma_region_find(dma, offset + len - 1, &rem); | 203 | last = dma_region_find(dma, offset + len - 1, &rem); |
191 | 204 | ||
192 | pci_dma_sync_sg_for_device(dma->dev, &dma->sglist[first], last - first + 1, dma->direction); | 205 | pci_dma_sync_sg_for_device(dma->dev, &dma->sglist[first], |
206 | last - first + 1, dma->direction); | ||
193 | } | 207 | } |
194 | 208 | ||
195 | #ifdef CONFIG_MMU | 209 | #ifdef CONFIG_MMU |
196 | 210 | ||
197 | /* nopage() handler for mmap access */ | 211 | /* nopage() handler for mmap access */ |
198 | 212 | ||
199 | static struct page* | 213 | static struct page *dma_region_pagefault(struct vm_area_struct *area, |
200 | dma_region_pagefault(struct vm_area_struct *area, unsigned long address, int *type) | 214 | unsigned long address, int *type) |
201 | { | 215 | { |
202 | unsigned long offset; | 216 | unsigned long offset; |
203 | unsigned long kernel_virt_addr; | 217 | unsigned long kernel_virt_addr; |
204 | struct page *ret = NOPAGE_SIGBUS; | 218 | struct page *ret = NOPAGE_SIGBUS; |
205 | 219 | ||
206 | struct dma_region *dma = (struct dma_region*) area->vm_private_data; | 220 | struct dma_region *dma = (struct dma_region *)area->vm_private_data; |
207 | 221 | ||
208 | if (!dma->kvirt) | 222 | if (!dma->kvirt) |
209 | goto out; | 223 | goto out; |
210 | 224 | ||
211 | if ( (address < (unsigned long) area->vm_start) || | 225 | if ((address < (unsigned long)area->vm_start) || |
212 | (address > (unsigned long) area->vm_start + (dma->n_pages << PAGE_SHIFT)) ) | 226 | (address > |
227 | (unsigned long)area->vm_start + (dma->n_pages << PAGE_SHIFT))) | ||
213 | goto out; | 228 | goto out; |
214 | 229 | ||
215 | if (type) | 230 | if (type) |
216 | *type = VM_FAULT_MINOR; | 231 | *type = VM_FAULT_MINOR; |
217 | offset = address - area->vm_start; | 232 | offset = address - area->vm_start; |
218 | kernel_virt_addr = (unsigned long) dma->kvirt + offset; | 233 | kernel_virt_addr = (unsigned long)dma->kvirt + offset; |
219 | ret = vmalloc_to_page((void*) kernel_virt_addr); | 234 | ret = vmalloc_to_page((void *)kernel_virt_addr); |
220 | get_page(ret); | 235 | get_page(ret); |
221 | out: | 236 | out: |
222 | return ret; | 237 | return ret; |
223 | } | 238 | } |
224 | 239 | ||
225 | static struct vm_operations_struct dma_region_vm_ops = { | 240 | static struct vm_operations_struct dma_region_vm_ops = { |
226 | .nopage = dma_region_pagefault, | 241 | .nopage = dma_region_pagefault, |
227 | }; | 242 | }; |
228 | 243 | ||
229 | int dma_region_mmap(struct dma_region *dma, struct file *file, struct vm_area_struct *vma) | 244 | int dma_region_mmap(struct dma_region *dma, struct file *file, |
245 | struct vm_area_struct *vma) | ||
230 | { | 246 | { |
231 | unsigned long size; | 247 | unsigned long size; |
232 | 248 | ||
@@ -250,11 +266,12 @@ int dma_region_mmap(struct dma_region *dma, struct file *file, struct vm_area_st | |||
250 | return 0; | 266 | return 0; |
251 | } | 267 | } |
252 | 268 | ||
253 | #else /* CONFIG_MMU */ | 269 | #else /* CONFIG_MMU */ |
254 | 270 | ||
255 | int dma_region_mmap(struct dma_region *dma, struct file *file, struct vm_area_struct *vma) | 271 | int dma_region_mmap(struct dma_region *dma, struct file *file, |
272 | struct vm_area_struct *vma) | ||
256 | { | 273 | { |
257 | return -EINVAL; | 274 | return -EINVAL; |
258 | } | 275 | } |
259 | 276 | ||
260 | #endif /* CONFIG_MMU */ | 277 | #endif /* CONFIG_MMU */ |
diff --git a/drivers/ieee1394/dv1394.c b/drivers/ieee1394/dv1394.c index cbbbe14b8849..196db7439272 100644 --- a/drivers/ieee1394/dv1394.c +++ b/drivers/ieee1394/dv1394.c | |||
@@ -123,15 +123,6 @@ | |||
123 | 123 | ||
124 | #include "ohci1394.h" | 124 | #include "ohci1394.h" |
125 | 125 | ||
126 | #ifndef virt_to_page | ||
127 | #define virt_to_page(x) MAP_NR(x) | ||
128 | #endif | ||
129 | |||
130 | #ifndef vmalloc_32 | ||
131 | #define vmalloc_32(x) vmalloc(x) | ||
132 | #endif | ||
133 | |||
134 | |||
135 | /* DEBUG LEVELS: | 126 | /* DEBUG LEVELS: |
136 | 0 - no debugging messages | 127 | 0 - no debugging messages |
137 | 1 - some debugging messages, but none during DMA frame transmission | 128 | 1 - some debugging messages, but none during DMA frame transmission |
@@ -2218,14 +2209,12 @@ static int dv1394_init(struct ti_ohci *ohci, enum pal_or_ntsc format, enum modes | |||
2218 | unsigned long flags; | 2209 | unsigned long flags; |
2219 | int i; | 2210 | int i; |
2220 | 2211 | ||
2221 | video = kmalloc(sizeof(struct video_card), GFP_KERNEL); | 2212 | video = kzalloc(sizeof(*video), GFP_KERNEL); |
2222 | if (!video) { | 2213 | if (!video) { |
2223 | printk(KERN_ERR "dv1394: cannot allocate video_card\n"); | 2214 | printk(KERN_ERR "dv1394: cannot allocate video_card\n"); |
2224 | goto err; | 2215 | goto err; |
2225 | } | 2216 | } |
2226 | 2217 | ||
2227 | memset(video, 0, sizeof(struct video_card)); | ||
2228 | |||
2229 | video->ohci = ohci; | 2218 | video->ohci = ohci; |
2230 | /* lower 2 bits of id indicate which of four "plugs" | 2219 | /* lower 2 bits of id indicate which of four "plugs" |
2231 | per host */ | 2220 | per host */ |
diff --git a/drivers/ieee1394/eth1394.c b/drivers/ieee1394/eth1394.c index c9e92d85c893..30fa0d43a43a 100644 --- a/drivers/ieee1394/eth1394.c +++ b/drivers/ieee1394/eth1394.c | |||
@@ -88,9 +88,6 @@ | |||
88 | printk(KERN_ERR "%s:%s[%d]: " fmt "\n", driver_name, __FUNCTION__, __LINE__, ## args) | 88 | printk(KERN_ERR "%s:%s[%d]: " fmt "\n", driver_name, __FUNCTION__, __LINE__, ## args) |
89 | #define TRACE() printk(KERN_ERR "%s:%s[%d] ---- TRACE\n", driver_name, __FUNCTION__, __LINE__) | 89 | #define TRACE() printk(KERN_ERR "%s:%s[%d] ---- TRACE\n", driver_name, __FUNCTION__, __LINE__) |
90 | 90 | ||
91 | static char version[] __devinitdata = | ||
92 | "$Rev: 1312 $ Ben Collins <bcollins@debian.org>"; | ||
93 | |||
94 | struct fragment_info { | 91 | struct fragment_info { |
95 | struct list_head list; | 92 | struct list_head list; |
96 | int offset; | 93 | int offset; |
@@ -355,12 +352,12 @@ static int eth1394_probe(struct device *dev) | |||
355 | if (!hi) | 352 | if (!hi) |
356 | return -ENOENT; | 353 | return -ENOENT; |
357 | 354 | ||
358 | new_node = kmalloc(sizeof(struct eth1394_node_ref), | 355 | new_node = kmalloc(sizeof(*new_node), |
359 | in_interrupt() ? GFP_ATOMIC : GFP_KERNEL); | 356 | in_interrupt() ? GFP_ATOMIC : GFP_KERNEL); |
360 | if (!new_node) | 357 | if (!new_node) |
361 | return -ENOMEM; | 358 | return -ENOMEM; |
362 | 359 | ||
363 | node_info = kmalloc(sizeof(struct eth1394_node_info), | 360 | node_info = kmalloc(sizeof(*node_info), |
364 | in_interrupt() ? GFP_ATOMIC : GFP_KERNEL); | 361 | in_interrupt() ? GFP_ATOMIC : GFP_KERNEL); |
365 | if (!node_info) { | 362 | if (!node_info) { |
366 | kfree(new_node); | 363 | kfree(new_node); |
@@ -436,12 +433,12 @@ static int eth1394_update(struct unit_directory *ud) | |||
436 | node = eth1394_find_node(&priv->ip_node_list, ud); | 433 | node = eth1394_find_node(&priv->ip_node_list, ud); |
437 | 434 | ||
438 | if (!node) { | 435 | if (!node) { |
439 | node = kmalloc(sizeof(struct eth1394_node_ref), | 436 | node = kmalloc(sizeof(*node), |
440 | in_interrupt() ? GFP_ATOMIC : GFP_KERNEL); | 437 | in_interrupt() ? GFP_ATOMIC : GFP_KERNEL); |
441 | if (!node) | 438 | if (!node) |
442 | return -ENOMEM; | 439 | return -ENOMEM; |
443 | 440 | ||
444 | node_info = kmalloc(sizeof(struct eth1394_node_info), | 441 | node_info = kmalloc(sizeof(*node_info), |
445 | in_interrupt() ? GFP_ATOMIC : GFP_KERNEL); | 442 | in_interrupt() ? GFP_ATOMIC : GFP_KERNEL); |
446 | if (!node_info) { | 443 | if (!node_info) { |
447 | kfree(node); | 444 | kfree(node); |
@@ -566,7 +563,6 @@ static void ether1394_add_host (struct hpsb_host *host) | |||
566 | struct eth1394_host_info *hi = NULL; | 563 | struct eth1394_host_info *hi = NULL; |
567 | struct net_device *dev = NULL; | 564 | struct net_device *dev = NULL; |
568 | struct eth1394_priv *priv; | 565 | struct eth1394_priv *priv; |
569 | static int version_printed = 0; | ||
570 | u64 fifo_addr; | 566 | u64 fifo_addr; |
571 | 567 | ||
572 | if (!(host->config_roms & HPSB_CONFIG_ROM_ENTRY_IP1394)) | 568 | if (!(host->config_roms & HPSB_CONFIG_ROM_ENTRY_IP1394)) |
@@ -581,9 +577,6 @@ static void ether1394_add_host (struct hpsb_host *host) | |||
581 | if (fifo_addr == ~0ULL) | 577 | if (fifo_addr == ~0ULL) |
582 | goto out; | 578 | goto out; |
583 | 579 | ||
584 | if (version_printed++ == 0) | ||
585 | ETH1394_PRINT_G (KERN_INFO, "%s\n", version); | ||
586 | |||
587 | /* We should really have our own alloc_hpsbdev() function in | 580 | /* We should really have our own alloc_hpsbdev() function in |
588 | * net_init.c instead of calling the one for ethernet then hijacking | 581 | * net_init.c instead of calling the one for ethernet then hijacking |
589 | * it for ourselves. That way we'd be a real networking device. */ | 582 | * it for ourselves. That way we'd be a real networking device. */ |
@@ -1021,7 +1014,7 @@ static inline int new_fragment(struct list_head *frag_info, int offset, int len) | |||
1021 | } | 1014 | } |
1022 | } | 1015 | } |
1023 | 1016 | ||
1024 | new = kmalloc(sizeof(struct fragment_info), GFP_ATOMIC); | 1017 | new = kmalloc(sizeof(*new), GFP_ATOMIC); |
1025 | if (!new) | 1018 | if (!new) |
1026 | return -ENOMEM; | 1019 | return -ENOMEM; |
1027 | 1020 | ||
@@ -1040,7 +1033,7 @@ static inline int new_partial_datagram(struct net_device *dev, | |||
1040 | { | 1033 | { |
1041 | struct partial_datagram *new; | 1034 | struct partial_datagram *new; |
1042 | 1035 | ||
1043 | new = kmalloc(sizeof(struct partial_datagram), GFP_ATOMIC); | 1036 | new = kmalloc(sizeof(*new), GFP_ATOMIC); |
1044 | if (!new) | 1037 | if (!new) |
1045 | return -ENOMEM; | 1038 | return -ENOMEM; |
1046 | 1039 | ||
@@ -1768,7 +1761,6 @@ fail: | |||
1768 | static void ether1394_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) | 1761 | static void ether1394_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) |
1769 | { | 1762 | { |
1770 | strcpy (info->driver, driver_name); | 1763 | strcpy (info->driver, driver_name); |
1771 | strcpy (info->version, "$Rev: 1312 $"); | ||
1772 | /* FIXME XXX provide sane businfo */ | 1764 | /* FIXME XXX provide sane businfo */ |
1773 | strcpy (info->bus_info, "ieee1394"); | 1765 | strcpy (info->bus_info, "ieee1394"); |
1774 | } | 1766 | } |
diff --git a/drivers/ieee1394/highlevel.c b/drivers/ieee1394/highlevel.c index 997e1bf6297f..734b121a0554 100644 --- a/drivers/ieee1394/highlevel.c +++ b/drivers/ieee1394/highlevel.c | |||
@@ -101,12 +101,10 @@ void *hpsb_create_hostinfo(struct hpsb_highlevel *hl, struct hpsb_host *host, | |||
101 | return NULL; | 101 | return NULL; |
102 | } | 102 | } |
103 | 103 | ||
104 | hi = kmalloc(sizeof(*hi) + data_size, GFP_ATOMIC); | 104 | hi = kzalloc(sizeof(*hi) + data_size, GFP_ATOMIC); |
105 | if (!hi) | 105 | if (!hi) |
106 | return NULL; | 106 | return NULL; |
107 | 107 | ||
108 | memset(hi, 0, sizeof(*hi) + data_size); | ||
109 | |||
110 | if (data_size) { | 108 | if (data_size) { |
111 | data = hi->data = hi + 1; | 109 | data = hi->data = hi + 1; |
112 | hi->size = data_size; | 110 | hi->size = data_size; |
@@ -326,11 +324,9 @@ u64 hpsb_allocate_and_register_addrspace(struct hpsb_highlevel *hl, | |||
326 | return retval; | 324 | return retval; |
327 | } | 325 | } |
328 | 326 | ||
329 | as = (struct hpsb_address_serve *) | 327 | as = kmalloc(sizeof(*as), GFP_KERNEL); |
330 | kmalloc(sizeof(struct hpsb_address_serve), GFP_KERNEL); | 328 | if (!as) |
331 | if (as == NULL) { | ||
332 | return retval; | 329 | return retval; |
333 | } | ||
334 | 330 | ||
335 | INIT_LIST_HEAD(&as->host_list); | 331 | INIT_LIST_HEAD(&as->host_list); |
336 | INIT_LIST_HEAD(&as->hl_list); | 332 | INIT_LIST_HEAD(&as->hl_list); |
@@ -383,11 +379,9 @@ int hpsb_register_addrspace(struct hpsb_highlevel *hl, struct hpsb_host *host, | |||
383 | return 0; | 379 | return 0; |
384 | } | 380 | } |
385 | 381 | ||
386 | as = (struct hpsb_address_serve *) | 382 | as = kmalloc(sizeof(*as), GFP_ATOMIC); |
387 | kmalloc(sizeof(struct hpsb_address_serve), GFP_ATOMIC); | 383 | if (!as) |
388 | if (as == NULL) { | 384 | return 0; |
389 | return 0; | ||
390 | } | ||
391 | 385 | ||
392 | INIT_LIST_HEAD(&as->host_list); | 386 | INIT_LIST_HEAD(&as->host_list); |
393 | INIT_LIST_HEAD(&as->hl_list); | 387 | INIT_LIST_HEAD(&as->hl_list); |
diff --git a/drivers/ieee1394/hosts.c b/drivers/ieee1394/hosts.c index aeeaeb670d03..d245abe4033c 100644 --- a/drivers/ieee1394/hosts.c +++ b/drivers/ieee1394/hosts.c | |||
@@ -114,9 +114,9 @@ struct hpsb_host *hpsb_alloc_host(struct hpsb_host_driver *drv, size_t extra, | |||
114 | int i; | 114 | int i; |
115 | int hostnum = 0; | 115 | int hostnum = 0; |
116 | 116 | ||
117 | h = kmalloc(sizeof(struct hpsb_host) + extra, SLAB_KERNEL); | 117 | h = kzalloc(sizeof(*h) + extra, SLAB_KERNEL); |
118 | if (!h) return NULL; | 118 | if (!h) |
119 | memset(h, 0, sizeof(struct hpsb_host) + extra); | 119 | return NULL; |
120 | 120 | ||
121 | h->csr.rom = csr1212_create_csr(&csr_bus_ops, CSR_BUS_INFO_SIZE, h); | 121 | h->csr.rom = csr1212_create_csr(&csr_bus_ops, CSR_BUS_INFO_SIZE, h); |
122 | if (!h->csr.rom) { | 122 | if (!h->csr.rom) { |
diff --git a/drivers/ieee1394/ieee1394-ioctl.h b/drivers/ieee1394/ieee1394-ioctl.h index f92b566363d5..156703986348 100644 --- a/drivers/ieee1394/ieee1394-ioctl.h +++ b/drivers/ieee1394/ieee1394-ioctl.h | |||
@@ -7,14 +7,6 @@ | |||
7 | #include <linux/ioctl.h> | 7 | #include <linux/ioctl.h> |
8 | #include <linux/types.h> | 8 | #include <linux/types.h> |
9 | 9 | ||
10 | |||
11 | /* AMDTP Gets 6 */ | ||
12 | #define AMDTP_IOC_CHANNEL _IOW('#', 0x00, struct amdtp_ioctl) | ||
13 | #define AMDTP_IOC_PLUG _IOW('#', 0x01, struct amdtp_ioctl) | ||
14 | #define AMDTP_IOC_PING _IOW('#', 0x02, struct amdtp_ioctl) | ||
15 | #define AMDTP_IOC_ZAP _IO ('#', 0x03) | ||
16 | |||
17 | |||
18 | /* DV1394 Gets 10 */ | 10 | /* DV1394 Gets 10 */ |
19 | 11 | ||
20 | /* Get the driver ready to transmit video. pass a struct dv1394_init* as | 12 | /* Get the driver ready to transmit video. pass a struct dv1394_init* as |
diff --git a/drivers/ieee1394/ieee1394_transactions.c b/drivers/ieee1394/ieee1394_transactions.c index 0aa876360f9b..3fe2f6c4a253 100644 --- a/drivers/ieee1394/ieee1394_transactions.c +++ b/drivers/ieee1394/ieee1394_transactions.c | |||
@@ -22,7 +22,7 @@ | |||
22 | #include "ieee1394_core.h" | 22 | #include "ieee1394_core.h" |
23 | #include "highlevel.h" | 23 | #include "highlevel.h" |
24 | #include "nodemgr.h" | 24 | #include "nodemgr.h" |
25 | 25 | #include "ieee1394_transactions.h" | |
26 | 26 | ||
27 | #define PREP_ASYNC_HEAD_ADDRESS(tc) \ | 27 | #define PREP_ASYNC_HEAD_ADDRESS(tc) \ |
28 | packet->tcode = tc; \ | 28 | packet->tcode = tc; \ |
@@ -31,80 +31,82 @@ | |||
31 | packet->header[1] = (packet->host->node_id << 16) | (addr >> 32); \ | 31 | packet->header[1] = (packet->host->node_id << 16) | (addr >> 32); \ |
32 | packet->header[2] = addr & 0xffffffff | 32 | packet->header[2] = addr & 0xffffffff |
33 | 33 | ||
34 | |||
35 | static void fill_async_readquad(struct hpsb_packet *packet, u64 addr) | 34 | static void fill_async_readquad(struct hpsb_packet *packet, u64 addr) |
36 | { | 35 | { |
37 | PREP_ASYNC_HEAD_ADDRESS(TCODE_READQ); | 36 | PREP_ASYNC_HEAD_ADDRESS(TCODE_READQ); |
38 | packet->header_size = 12; | 37 | packet->header_size = 12; |
39 | packet->data_size = 0; | 38 | packet->data_size = 0; |
40 | packet->expect_response = 1; | 39 | packet->expect_response = 1; |
41 | } | 40 | } |
42 | 41 | ||
43 | static void fill_async_readblock(struct hpsb_packet *packet, u64 addr, int length) | 42 | static void fill_async_readblock(struct hpsb_packet *packet, u64 addr, |
43 | int length) | ||
44 | { | 44 | { |
45 | PREP_ASYNC_HEAD_ADDRESS(TCODE_READB); | 45 | PREP_ASYNC_HEAD_ADDRESS(TCODE_READB); |
46 | packet->header[3] = length << 16; | 46 | packet->header[3] = length << 16; |
47 | packet->header_size = 16; | 47 | packet->header_size = 16; |
48 | packet->data_size = 0; | 48 | packet->data_size = 0; |
49 | packet->expect_response = 1; | 49 | packet->expect_response = 1; |
50 | } | 50 | } |
51 | 51 | ||
52 | static void fill_async_writequad(struct hpsb_packet *packet, u64 addr, quadlet_t data) | 52 | static void fill_async_writequad(struct hpsb_packet *packet, u64 addr, |
53 | quadlet_t data) | ||
53 | { | 54 | { |
54 | PREP_ASYNC_HEAD_ADDRESS(TCODE_WRITEQ); | 55 | PREP_ASYNC_HEAD_ADDRESS(TCODE_WRITEQ); |
55 | packet->header[3] = data; | 56 | packet->header[3] = data; |
56 | packet->header_size = 16; | 57 | packet->header_size = 16; |
57 | packet->data_size = 0; | 58 | packet->data_size = 0; |
58 | packet->expect_response = 1; | 59 | packet->expect_response = 1; |
59 | } | 60 | } |
60 | 61 | ||
61 | static void fill_async_writeblock(struct hpsb_packet *packet, u64 addr, int length) | 62 | static void fill_async_writeblock(struct hpsb_packet *packet, u64 addr, |
63 | int length) | ||
62 | { | 64 | { |
63 | PREP_ASYNC_HEAD_ADDRESS(TCODE_WRITEB); | 65 | PREP_ASYNC_HEAD_ADDRESS(TCODE_WRITEB); |
64 | packet->header[3] = length << 16; | 66 | packet->header[3] = length << 16; |
65 | packet->header_size = 16; | 67 | packet->header_size = 16; |
66 | packet->expect_response = 1; | 68 | packet->expect_response = 1; |
67 | packet->data_size = length + (length % 4 ? 4 - (length % 4) : 0); | 69 | packet->data_size = length + (length % 4 ? 4 - (length % 4) : 0); |
68 | } | 70 | } |
69 | 71 | ||
70 | static void fill_async_lock(struct hpsb_packet *packet, u64 addr, int extcode, | 72 | static void fill_async_lock(struct hpsb_packet *packet, u64 addr, int extcode, |
71 | int length) | 73 | int length) |
72 | { | 74 | { |
73 | PREP_ASYNC_HEAD_ADDRESS(TCODE_LOCK_REQUEST); | 75 | PREP_ASYNC_HEAD_ADDRESS(TCODE_LOCK_REQUEST); |
74 | packet->header[3] = (length << 16) | extcode; | 76 | packet->header[3] = (length << 16) | extcode; |
75 | packet->header_size = 16; | 77 | packet->header_size = 16; |
76 | packet->data_size = length; | 78 | packet->data_size = length; |
77 | packet->expect_response = 1; | 79 | packet->expect_response = 1; |
78 | } | 80 | } |
79 | 81 | ||
80 | static void fill_iso_packet(struct hpsb_packet *packet, int length, int channel, | 82 | static void fill_iso_packet(struct hpsb_packet *packet, int length, int channel, |
81 | int tag, int sync) | 83 | int tag, int sync) |
82 | { | 84 | { |
83 | packet->header[0] = (length << 16) | (tag << 14) | (channel << 8) | 85 | packet->header[0] = (length << 16) | (tag << 14) | (channel << 8) |
84 | | (TCODE_ISO_DATA << 4) | sync; | 86 | | (TCODE_ISO_DATA << 4) | sync; |
85 | 87 | ||
86 | packet->header_size = 4; | 88 | packet->header_size = 4; |
87 | packet->data_size = length; | 89 | packet->data_size = length; |
88 | packet->type = hpsb_iso; | 90 | packet->type = hpsb_iso; |
89 | packet->tcode = TCODE_ISO_DATA; | 91 | packet->tcode = TCODE_ISO_DATA; |
90 | } | 92 | } |
91 | 93 | ||
92 | static void fill_phy_packet(struct hpsb_packet *packet, quadlet_t data) | 94 | static void fill_phy_packet(struct hpsb_packet *packet, quadlet_t data) |
93 | { | 95 | { |
94 | packet->header[0] = data; | 96 | packet->header[0] = data; |
95 | packet->header[1] = ~data; | 97 | packet->header[1] = ~data; |
96 | packet->header_size = 8; | 98 | packet->header_size = 8; |
97 | packet->data_size = 0; | 99 | packet->data_size = 0; |
98 | packet->expect_response = 0; | 100 | packet->expect_response = 0; |
99 | packet->type = hpsb_raw; /* No CRC added */ | 101 | packet->type = hpsb_raw; /* No CRC added */ |
100 | packet->speed_code = IEEE1394_SPEED_100; /* Force speed to be 100Mbps */ | 102 | packet->speed_code = IEEE1394_SPEED_100; /* Force speed to be 100Mbps */ |
101 | } | 103 | } |
102 | 104 | ||
103 | static void fill_async_stream_packet(struct hpsb_packet *packet, int length, | 105 | static void fill_async_stream_packet(struct hpsb_packet *packet, int length, |
104 | int channel, int tag, int sync) | 106 | int channel, int tag, int sync) |
105 | { | 107 | { |
106 | packet->header[0] = (length << 16) | (tag << 14) | (channel << 8) | 108 | packet->header[0] = (length << 16) | (tag << 14) | (channel << 8) |
107 | | (TCODE_STREAM_DATA << 4) | sync; | 109 | | (TCODE_STREAM_DATA << 4) | sync; |
108 | 110 | ||
109 | packet->header_size = 4; | 111 | packet->header_size = 4; |
110 | packet->data_size = length; | 112 | packet->data_size = length; |
@@ -171,99 +173,96 @@ int hpsb_get_tlabel(struct hpsb_packet *packet) | |||
171 | */ | 173 | */ |
172 | void hpsb_free_tlabel(struct hpsb_packet *packet) | 174 | void hpsb_free_tlabel(struct hpsb_packet *packet) |
173 | { | 175 | { |
174 | unsigned long flags; | 176 | unsigned long flags; |
175 | struct hpsb_tlabel_pool *tp; | 177 | struct hpsb_tlabel_pool *tp; |
176 | 178 | ||
177 | tp = &packet->host->tpool[packet->node_id & NODE_MASK]; | 179 | tp = &packet->host->tpool[packet->node_id & NODE_MASK]; |
178 | 180 | ||
179 | BUG_ON(packet->tlabel > 63 || packet->tlabel < 0); | 181 | BUG_ON(packet->tlabel > 63 || packet->tlabel < 0); |
180 | 182 | ||
181 | spin_lock_irqsave(&tp->lock, flags); | 183 | spin_lock_irqsave(&tp->lock, flags); |
182 | BUG_ON(!test_and_clear_bit(packet->tlabel, tp->pool)); | 184 | BUG_ON(!test_and_clear_bit(packet->tlabel, tp->pool)); |
183 | spin_unlock_irqrestore(&tp->lock, flags); | 185 | spin_unlock_irqrestore(&tp->lock, flags); |
184 | 186 | ||
185 | up(&tp->count); | 187 | up(&tp->count); |
186 | } | 188 | } |
187 | 189 | ||
188 | |||
189 | |||
190 | int hpsb_packet_success(struct hpsb_packet *packet) | 190 | int hpsb_packet_success(struct hpsb_packet *packet) |
191 | { | 191 | { |
192 | switch (packet->ack_code) { | 192 | switch (packet->ack_code) { |
193 | case ACK_PENDING: | 193 | case ACK_PENDING: |
194 | switch ((packet->header[1] >> 12) & 0xf) { | 194 | switch ((packet->header[1] >> 12) & 0xf) { |
195 | case RCODE_COMPLETE: | 195 | case RCODE_COMPLETE: |
196 | return 0; | 196 | return 0; |
197 | case RCODE_CONFLICT_ERROR: | 197 | case RCODE_CONFLICT_ERROR: |
198 | return -EAGAIN; | 198 | return -EAGAIN; |
199 | case RCODE_DATA_ERROR: | 199 | case RCODE_DATA_ERROR: |
200 | return -EREMOTEIO; | 200 | return -EREMOTEIO; |
201 | case RCODE_TYPE_ERROR: | 201 | case RCODE_TYPE_ERROR: |
202 | return -EACCES; | 202 | return -EACCES; |
203 | case RCODE_ADDRESS_ERROR: | 203 | case RCODE_ADDRESS_ERROR: |
204 | return -EINVAL; | 204 | return -EINVAL; |
205 | default: | 205 | default: |
206 | HPSB_ERR("received reserved rcode %d from node %d", | 206 | HPSB_ERR("received reserved rcode %d from node %d", |
207 | (packet->header[1] >> 12) & 0xf, | 207 | (packet->header[1] >> 12) & 0xf, |
208 | packet->node_id); | 208 | packet->node_id); |
209 | return -EAGAIN; | 209 | return -EAGAIN; |
210 | } | 210 | } |
211 | HPSB_PANIC("reached unreachable code 1 in %s", __FUNCTION__); | 211 | HPSB_PANIC("reached unreachable code 1 in %s", __FUNCTION__); |
212 | 212 | ||
213 | case ACK_BUSY_X: | 213 | case ACK_BUSY_X: |
214 | case ACK_BUSY_A: | 214 | case ACK_BUSY_A: |
215 | case ACK_BUSY_B: | 215 | case ACK_BUSY_B: |
216 | return -EBUSY; | 216 | return -EBUSY; |
217 | 217 | ||
218 | case ACK_TYPE_ERROR: | 218 | case ACK_TYPE_ERROR: |
219 | return -EACCES; | 219 | return -EACCES; |
220 | 220 | ||
221 | case ACK_COMPLETE: | 221 | case ACK_COMPLETE: |
222 | if (packet->tcode == TCODE_WRITEQ | 222 | if (packet->tcode == TCODE_WRITEQ |
223 | || packet->tcode == TCODE_WRITEB) { | 223 | || packet->tcode == TCODE_WRITEB) { |
224 | return 0; | 224 | return 0; |
225 | } else { | 225 | } else { |
226 | HPSB_ERR("impossible ack_complete from node %d " | 226 | HPSB_ERR("impossible ack_complete from node %d " |
227 | "(tcode %d)", packet->node_id, packet->tcode); | 227 | "(tcode %d)", packet->node_id, packet->tcode); |
228 | return -EAGAIN; | 228 | return -EAGAIN; |
229 | } | 229 | } |
230 | 230 | ||
231 | 231 | case ACK_DATA_ERROR: | |
232 | case ACK_DATA_ERROR: | 232 | if (packet->tcode == TCODE_WRITEB |
233 | if (packet->tcode == TCODE_WRITEB | 233 | || packet->tcode == TCODE_LOCK_REQUEST) { |
234 | || packet->tcode == TCODE_LOCK_REQUEST) { | 234 | return -EAGAIN; |
235 | return -EAGAIN; | 235 | } else { |
236 | } else { | 236 | HPSB_ERR("impossible ack_data_error from node %d " |
237 | HPSB_ERR("impossible ack_data_error from node %d " | 237 | "(tcode %d)", packet->node_id, packet->tcode); |
238 | "(tcode %d)", packet->node_id, packet->tcode); | 238 | return -EAGAIN; |
239 | return -EAGAIN; | 239 | } |
240 | } | 240 | |
241 | 241 | case ACK_ADDRESS_ERROR: | |
242 | case ACK_ADDRESS_ERROR: | 242 | return -EINVAL; |
243 | return -EINVAL; | 243 | |
244 | 244 | case ACK_TARDY: | |
245 | case ACK_TARDY: | 245 | case ACK_CONFLICT_ERROR: |
246 | case ACK_CONFLICT_ERROR: | 246 | case ACKX_NONE: |
247 | case ACKX_NONE: | 247 | case ACKX_SEND_ERROR: |
248 | case ACKX_SEND_ERROR: | 248 | case ACKX_ABORTED: |
249 | case ACKX_ABORTED: | 249 | case ACKX_TIMEOUT: |
250 | case ACKX_TIMEOUT: | 250 | /* error while sending */ |
251 | /* error while sending */ | 251 | return -EAGAIN; |
252 | return -EAGAIN; | 252 | |
253 | 253 | default: | |
254 | default: | 254 | HPSB_ERR("got invalid ack %d from node %d (tcode %d)", |
255 | HPSB_ERR("got invalid ack %d from node %d (tcode %d)", | 255 | packet->ack_code, packet->node_id, packet->tcode); |
256 | packet->ack_code, packet->node_id, packet->tcode); | 256 | return -EAGAIN; |
257 | return -EAGAIN; | 257 | } |
258 | } | 258 | |
259 | 259 | HPSB_PANIC("reached unreachable code 2 in %s", __FUNCTION__); | |
260 | HPSB_PANIC("reached unreachable code 2 in %s", __FUNCTION__); | ||
261 | } | 260 | } |
262 | 261 | ||
263 | struct hpsb_packet *hpsb_make_readpacket(struct hpsb_host *host, nodeid_t node, | 262 | struct hpsb_packet *hpsb_make_readpacket(struct hpsb_host *host, nodeid_t node, |
264 | u64 addr, size_t length) | 263 | u64 addr, size_t length) |
265 | { | 264 | { |
266 | struct hpsb_packet *packet; | 265 | struct hpsb_packet *packet; |
267 | 266 | ||
268 | if (length == 0) | 267 | if (length == 0) |
269 | return NULL; | 268 | return NULL; |
@@ -288,8 +287,9 @@ struct hpsb_packet *hpsb_make_readpacket(struct hpsb_host *host, nodeid_t node, | |||
288 | return packet; | 287 | return packet; |
289 | } | 288 | } |
290 | 289 | ||
291 | struct hpsb_packet *hpsb_make_writepacket (struct hpsb_host *host, nodeid_t node, | 290 | struct hpsb_packet *hpsb_make_writepacket(struct hpsb_host *host, nodeid_t node, |
292 | u64 addr, quadlet_t *buffer, size_t length) | 291 | u64 addr, quadlet_t * buffer, |
292 | size_t length) | ||
293 | { | 293 | { |
294 | struct hpsb_packet *packet; | 294 | struct hpsb_packet *packet; |
295 | 295 | ||
@@ -300,7 +300,7 @@ struct hpsb_packet *hpsb_make_writepacket (struct hpsb_host *host, nodeid_t node | |||
300 | if (!packet) | 300 | if (!packet) |
301 | return NULL; | 301 | return NULL; |
302 | 302 | ||
303 | if (length % 4) { /* zero padding bytes */ | 303 | if (length % 4) { /* zero padding bytes */ |
304 | packet->data[length >> 2] = 0; | 304 | packet->data[length >> 2] = 0; |
305 | } | 305 | } |
306 | packet->host = host; | 306 | packet->host = host; |
@@ -322,8 +322,9 @@ struct hpsb_packet *hpsb_make_writepacket (struct hpsb_host *host, nodeid_t node | |||
322 | return packet; | 322 | return packet; |
323 | } | 323 | } |
324 | 324 | ||
325 | struct hpsb_packet *hpsb_make_streampacket(struct hpsb_host *host, u8 *buffer, int length, | 325 | struct hpsb_packet *hpsb_make_streampacket(struct hpsb_host *host, u8 * buffer, |
326 | int channel, int tag, int sync) | 326 | int length, int channel, int tag, |
327 | int sync) | ||
327 | { | 328 | { |
328 | struct hpsb_packet *packet; | 329 | struct hpsb_packet *packet; |
329 | 330 | ||
@@ -334,7 +335,7 @@ struct hpsb_packet *hpsb_make_streampacket(struct hpsb_host *host, u8 *buffer, i | |||
334 | if (!packet) | 335 | if (!packet) |
335 | return NULL; | 336 | return NULL; |
336 | 337 | ||
337 | if (length % 4) { /* zero padding bytes */ | 338 | if (length % 4) { /* zero padding bytes */ |
338 | packet->data[length >> 2] = 0; | 339 | packet->data[length >> 2] = 0; |
339 | } | 340 | } |
340 | packet->host = host; | 341 | packet->host = host; |
@@ -352,14 +353,15 @@ struct hpsb_packet *hpsb_make_streampacket(struct hpsb_host *host, u8 *buffer, i | |||
352 | } | 353 | } |
353 | 354 | ||
354 | struct hpsb_packet *hpsb_make_lockpacket(struct hpsb_host *host, nodeid_t node, | 355 | struct hpsb_packet *hpsb_make_lockpacket(struct hpsb_host *host, nodeid_t node, |
355 | u64 addr, int extcode, quadlet_t *data, | 356 | u64 addr, int extcode, |
356 | quadlet_t arg) | 357 | quadlet_t * data, quadlet_t arg) |
357 | { | 358 | { |
358 | struct hpsb_packet *p; | 359 | struct hpsb_packet *p; |
359 | u32 length; | 360 | u32 length; |
360 | 361 | ||
361 | p = hpsb_alloc_packet(8); | 362 | p = hpsb_alloc_packet(8); |
362 | if (!p) return NULL; | 363 | if (!p) |
364 | return NULL; | ||
363 | 365 | ||
364 | p->host = host; | 366 | p->host = host; |
365 | p->node_id = node; | 367 | p->node_id = node; |
@@ -388,15 +390,16 @@ struct hpsb_packet *hpsb_make_lockpacket(struct hpsb_host *host, nodeid_t node, | |||
388 | return p; | 390 | return p; |
389 | } | 391 | } |
390 | 392 | ||
391 | struct hpsb_packet *hpsb_make_lock64packet(struct hpsb_host *host, nodeid_t node, | 393 | struct hpsb_packet *hpsb_make_lock64packet(struct hpsb_host *host, |
392 | u64 addr, int extcode, octlet_t *data, | 394 | nodeid_t node, u64 addr, int extcode, |
393 | octlet_t arg) | 395 | octlet_t * data, octlet_t arg) |
394 | { | 396 | { |
395 | struct hpsb_packet *p; | 397 | struct hpsb_packet *p; |
396 | u32 length; | 398 | u32 length; |
397 | 399 | ||
398 | p = hpsb_alloc_packet(16); | 400 | p = hpsb_alloc_packet(16); |
399 | if (!p) return NULL; | 401 | if (!p) |
402 | return NULL; | ||
400 | 403 | ||
401 | p->host = host; | 404 | p->host = host; |
402 | p->node_id = node; | 405 | p->node_id = node; |
@@ -429,18 +432,18 @@ struct hpsb_packet *hpsb_make_lock64packet(struct hpsb_host *host, nodeid_t node | |||
429 | return p; | 432 | return p; |
430 | } | 433 | } |
431 | 434 | ||
432 | struct hpsb_packet *hpsb_make_phypacket(struct hpsb_host *host, | 435 | struct hpsb_packet *hpsb_make_phypacket(struct hpsb_host *host, quadlet_t data) |
433 | quadlet_t data) | ||
434 | { | 436 | { |
435 | struct hpsb_packet *p; | 437 | struct hpsb_packet *p; |
436 | 438 | ||
437 | p = hpsb_alloc_packet(0); | 439 | p = hpsb_alloc_packet(0); |
438 | if (!p) return NULL; | 440 | if (!p) |
441 | return NULL; | ||
439 | 442 | ||
440 | p->host = host; | 443 | p->host = host; |
441 | fill_phy_packet(p, data); | 444 | fill_phy_packet(p, data); |
442 | 445 | ||
443 | return p; | 446 | return p; |
444 | } | 447 | } |
445 | 448 | ||
446 | struct hpsb_packet *hpsb_make_isopacket(struct hpsb_host *host, | 449 | struct hpsb_packet *hpsb_make_isopacket(struct hpsb_host *host, |
@@ -450,7 +453,8 @@ struct hpsb_packet *hpsb_make_isopacket(struct hpsb_host *host, | |||
450 | struct hpsb_packet *p; | 453 | struct hpsb_packet *p; |
451 | 454 | ||
452 | p = hpsb_alloc_packet(length); | 455 | p = hpsb_alloc_packet(length); |
453 | if (!p) return NULL; | 456 | if (!p) |
457 | return NULL; | ||
454 | 458 | ||
455 | p->host = host; | 459 | p->host = host; |
456 | fill_iso_packet(p, length, channel, tag, sync); | 460 | fill_iso_packet(p, length, channel, tag, sync); |
@@ -466,47 +470,46 @@ struct hpsb_packet *hpsb_make_isopacket(struct hpsb_host *host, | |||
466 | */ | 470 | */ |
467 | 471 | ||
468 | int hpsb_read(struct hpsb_host *host, nodeid_t node, unsigned int generation, | 472 | int hpsb_read(struct hpsb_host *host, nodeid_t node, unsigned int generation, |
469 | u64 addr, quadlet_t *buffer, size_t length) | 473 | u64 addr, quadlet_t * buffer, size_t length) |
470 | { | 474 | { |
471 | struct hpsb_packet *packet; | 475 | struct hpsb_packet *packet; |
472 | int retval = 0; | 476 | int retval = 0; |
473 | 477 | ||
474 | if (length == 0) | 478 | if (length == 0) |
475 | return -EINVAL; | 479 | return -EINVAL; |
476 | 480 | ||
477 | BUG_ON(in_interrupt()); // We can't be called in an interrupt, yet | 481 | BUG_ON(in_interrupt()); // We can't be called in an interrupt, yet |
478 | 482 | ||
479 | packet = hpsb_make_readpacket(host, node, addr, length); | 483 | packet = hpsb_make_readpacket(host, node, addr, length); |
480 | 484 | ||
481 | if (!packet) { | 485 | if (!packet) { |
482 | return -ENOMEM; | 486 | return -ENOMEM; |
483 | } | 487 | } |
484 | 488 | ||
485 | packet->generation = generation; | 489 | packet->generation = generation; |
486 | retval = hpsb_send_packet_and_wait(packet); | 490 | retval = hpsb_send_packet_and_wait(packet); |
487 | if (retval < 0) | 491 | if (retval < 0) |
488 | goto hpsb_read_fail; | 492 | goto hpsb_read_fail; |
489 | 493 | ||
490 | retval = hpsb_packet_success(packet); | 494 | retval = hpsb_packet_success(packet); |
491 | 495 | ||
492 | if (retval == 0) { | 496 | if (retval == 0) { |
493 | if (length == 4) { | 497 | if (length == 4) { |
494 | *buffer = packet->header[3]; | 498 | *buffer = packet->header[3]; |
495 | } else { | 499 | } else { |
496 | memcpy(buffer, packet->data, length); | 500 | memcpy(buffer, packet->data, length); |
497 | } | 501 | } |
498 | } | 502 | } |
499 | 503 | ||
500 | hpsb_read_fail: | 504 | hpsb_read_fail: |
501 | hpsb_free_tlabel(packet); | 505 | hpsb_free_tlabel(packet); |
502 | hpsb_free_packet(packet); | 506 | hpsb_free_packet(packet); |
503 | 507 | ||
504 | return retval; | 508 | return retval; |
505 | } | 509 | } |
506 | 510 | ||
507 | |||
508 | int hpsb_write(struct hpsb_host *host, nodeid_t node, unsigned int generation, | 511 | int hpsb_write(struct hpsb_host *host, nodeid_t node, unsigned int generation, |
509 | u64 addr, quadlet_t *buffer, size_t length) | 512 | u64 addr, quadlet_t * buffer, size_t length) |
510 | { | 513 | { |
511 | struct hpsb_packet *packet; | 514 | struct hpsb_packet *packet; |
512 | int retval; | 515 | int retval; |
@@ -514,62 +517,61 @@ int hpsb_write(struct hpsb_host *host, nodeid_t node, unsigned int generation, | |||
514 | if (length == 0) | 517 | if (length == 0) |
515 | return -EINVAL; | 518 | return -EINVAL; |
516 | 519 | ||
517 | BUG_ON(in_interrupt()); // We can't be called in an interrupt, yet | 520 | BUG_ON(in_interrupt()); // We can't be called in an interrupt, yet |
518 | 521 | ||
519 | packet = hpsb_make_writepacket (host, node, addr, buffer, length); | 522 | packet = hpsb_make_writepacket(host, node, addr, buffer, length); |
520 | 523 | ||
521 | if (!packet) | 524 | if (!packet) |
522 | return -ENOMEM; | 525 | return -ENOMEM; |
523 | 526 | ||
524 | packet->generation = generation; | 527 | packet->generation = generation; |
525 | retval = hpsb_send_packet_and_wait(packet); | 528 | retval = hpsb_send_packet_and_wait(packet); |
526 | if (retval < 0) | 529 | if (retval < 0) |
527 | goto hpsb_write_fail; | 530 | goto hpsb_write_fail; |
528 | 531 | ||
529 | retval = hpsb_packet_success(packet); | 532 | retval = hpsb_packet_success(packet); |
530 | 533 | ||
531 | hpsb_write_fail: | 534 | hpsb_write_fail: |
532 | hpsb_free_tlabel(packet); | 535 | hpsb_free_tlabel(packet); |
533 | hpsb_free_packet(packet); | 536 | hpsb_free_packet(packet); |
534 | 537 | ||
535 | return retval; | 538 | return retval; |
536 | } | 539 | } |
537 | 540 | ||
538 | #if 0 | 541 | #if 0 |
539 | 542 | ||
540 | int hpsb_lock(struct hpsb_host *host, nodeid_t node, unsigned int generation, | 543 | int hpsb_lock(struct hpsb_host *host, nodeid_t node, unsigned int generation, |
541 | u64 addr, int extcode, quadlet_t *data, quadlet_t arg) | 544 | u64 addr, int extcode, quadlet_t * data, quadlet_t arg) |
542 | { | 545 | { |
543 | struct hpsb_packet *packet; | 546 | struct hpsb_packet *packet; |
544 | int retval = 0; | 547 | int retval = 0; |
545 | 548 | ||
546 | BUG_ON(in_interrupt()); // We can't be called in an interrupt, yet | 549 | BUG_ON(in_interrupt()); // We can't be called in an interrupt, yet |
547 | 550 | ||
548 | packet = hpsb_make_lockpacket(host, node, addr, extcode, data, arg); | 551 | packet = hpsb_make_lockpacket(host, node, addr, extcode, data, arg); |
549 | if (!packet) | 552 | if (!packet) |
550 | return -ENOMEM; | 553 | return -ENOMEM; |
551 | 554 | ||
552 | packet->generation = generation; | 555 | packet->generation = generation; |
553 | retval = hpsb_send_packet_and_wait(packet); | 556 | retval = hpsb_send_packet_and_wait(packet); |
554 | if (retval < 0) | 557 | if (retval < 0) |
555 | goto hpsb_lock_fail; | 558 | goto hpsb_lock_fail; |
556 | 559 | ||
557 | retval = hpsb_packet_success(packet); | 560 | retval = hpsb_packet_success(packet); |
558 | 561 | ||
559 | if (retval == 0) { | 562 | if (retval == 0) { |
560 | *data = packet->data[0]; | 563 | *data = packet->data[0]; |
561 | } | 564 | } |
562 | 565 | ||
563 | hpsb_lock_fail: | 566 | hpsb_lock_fail: |
564 | hpsb_free_tlabel(packet); | 567 | hpsb_free_tlabel(packet); |
565 | hpsb_free_packet(packet); | 568 | hpsb_free_packet(packet); |
566 | 569 | ||
567 | return retval; | 570 | return retval; |
568 | } | 571 | } |
569 | 572 | ||
570 | |||
571 | int hpsb_send_gasp(struct hpsb_host *host, int channel, unsigned int generation, | 573 | int hpsb_send_gasp(struct hpsb_host *host, int channel, unsigned int generation, |
572 | quadlet_t *buffer, size_t length, u32 specifier_id, | 574 | quadlet_t * buffer, size_t length, u32 specifier_id, |
573 | unsigned int version) | 575 | unsigned int version) |
574 | { | 576 | { |
575 | struct hpsb_packet *packet; | 577 | struct hpsb_packet *packet; |
@@ -586,7 +588,8 @@ int hpsb_send_gasp(struct hpsb_host *host, int channel, unsigned int generation, | |||
586 | return -ENOMEM; | 588 | return -ENOMEM; |
587 | 589 | ||
588 | packet->data[0] = cpu_to_be32((host->node_id << 16) | specifier_id_hi); | 590 | packet->data[0] = cpu_to_be32((host->node_id << 16) | specifier_id_hi); |
589 | packet->data[1] = cpu_to_be32((specifier_id_lo << 24) | (version & 0x00ffffff)); | 591 | packet->data[1] = |
592 | cpu_to_be32((specifier_id_lo << 24) | (version & 0x00ffffff)); | ||
590 | 593 | ||
591 | memcpy(&(packet->data[2]), buffer, length - 8); | 594 | memcpy(&(packet->data[2]), buffer, length - 8); |
592 | 595 | ||
@@ -601,4 +604,4 @@ int hpsb_send_gasp(struct hpsb_host *host, int channel, unsigned int generation, | |||
601 | return retval; | 604 | return retval; |
602 | } | 605 | } |
603 | 606 | ||
604 | #endif /* 0 */ | 607 | #endif /* 0 */ |
diff --git a/drivers/ieee1394/iso.c b/drivers/ieee1394/iso.c index 615541b8b90f..f26680ebef7c 100644 --- a/drivers/ieee1394/iso.c +++ b/drivers/ieee1394/iso.c | |||
@@ -36,20 +36,22 @@ void hpsb_iso_shutdown(struct hpsb_iso *iso) | |||
36 | kfree(iso); | 36 | kfree(iso); |
37 | } | 37 | } |
38 | 38 | ||
39 | static struct hpsb_iso* hpsb_iso_common_init(struct hpsb_host *host, enum hpsb_iso_type type, | 39 | static struct hpsb_iso *hpsb_iso_common_init(struct hpsb_host *host, |
40 | enum hpsb_iso_type type, | ||
40 | unsigned int data_buf_size, | 41 | unsigned int data_buf_size, |
41 | unsigned int buf_packets, | 42 | unsigned int buf_packets, |
42 | int channel, | 43 | int channel, int dma_mode, |
43 | int dma_mode, | ||
44 | int irq_interval, | 44 | int irq_interval, |
45 | void (*callback)(struct hpsb_iso*)) | 45 | void (*callback) (struct hpsb_iso |
46 | *)) | ||
46 | { | 47 | { |
47 | struct hpsb_iso *iso; | 48 | struct hpsb_iso *iso; |
48 | int dma_direction; | 49 | int dma_direction; |
49 | 50 | ||
50 | /* make sure driver supports the ISO API */ | 51 | /* make sure driver supports the ISO API */ |
51 | if (!host->driver->isoctl) { | 52 | if (!host->driver->isoctl) { |
52 | printk(KERN_INFO "ieee1394: host driver '%s' does not support the rawiso API\n", | 53 | printk(KERN_INFO |
54 | "ieee1394: host driver '%s' does not support the rawiso API\n", | ||
53 | host->driver->name); | 55 | host->driver->name); |
54 | return NULL; | 56 | return NULL; |
55 | } | 57 | } |
@@ -59,12 +61,13 @@ static struct hpsb_iso* hpsb_iso_common_init(struct hpsb_host *host, enum hpsb_i | |||
59 | if (buf_packets < 2) | 61 | if (buf_packets < 2) |
60 | buf_packets = 2; | 62 | buf_packets = 2; |
61 | 63 | ||
62 | if ((dma_mode < HPSB_ISO_DMA_DEFAULT) || (dma_mode > HPSB_ISO_DMA_PACKET_PER_BUFFER)) | 64 | if ((dma_mode < HPSB_ISO_DMA_DEFAULT) |
63 | dma_mode=HPSB_ISO_DMA_DEFAULT; | 65 | || (dma_mode > HPSB_ISO_DMA_PACKET_PER_BUFFER)) |
66 | dma_mode = HPSB_ISO_DMA_DEFAULT; | ||
64 | 67 | ||
65 | if ((irq_interval < 0) || (irq_interval > buf_packets / 4)) | 68 | if ((irq_interval < 0) || (irq_interval > buf_packets / 4)) |
66 | irq_interval = buf_packets / 4; | 69 | irq_interval = buf_packets / 4; |
67 | if (irq_interval == 0) /* really interrupt for each packet*/ | 70 | if (irq_interval == 0) /* really interrupt for each packet */ |
68 | irq_interval = 1; | 71 | irq_interval = 1; |
69 | 72 | ||
70 | if (channel < -1 || channel >= 64) | 73 | if (channel < -1 || channel >= 64) |
@@ -76,7 +79,10 @@ static struct hpsb_iso* hpsb_iso_common_init(struct hpsb_host *host, enum hpsb_i | |||
76 | 79 | ||
77 | /* allocate and write the struct hpsb_iso */ | 80 | /* allocate and write the struct hpsb_iso */ |
78 | 81 | ||
79 | iso = kmalloc(sizeof(*iso) + buf_packets * sizeof(struct hpsb_iso_packet_info), GFP_KERNEL); | 82 | iso = |
83 | kmalloc(sizeof(*iso) + | ||
84 | buf_packets * sizeof(struct hpsb_iso_packet_info), | ||
85 | GFP_KERNEL); | ||
80 | if (!iso) | 86 | if (!iso) |
81 | return NULL; | 87 | return NULL; |
82 | 88 | ||
@@ -111,17 +117,18 @@ static struct hpsb_iso* hpsb_iso_common_init(struct hpsb_host *host, enum hpsb_i | |||
111 | iso->prebuffer = 0; | 117 | iso->prebuffer = 0; |
112 | 118 | ||
113 | /* allocate the packet buffer */ | 119 | /* allocate the packet buffer */ |
114 | if (dma_region_alloc(&iso->data_buf, iso->buf_size, host->pdev, dma_direction)) | 120 | if (dma_region_alloc |
121 | (&iso->data_buf, iso->buf_size, host->pdev, dma_direction)) | ||
115 | goto err; | 122 | goto err; |
116 | 123 | ||
117 | return iso; | 124 | return iso; |
118 | 125 | ||
119 | err: | 126 | err: |
120 | hpsb_iso_shutdown(iso); | 127 | hpsb_iso_shutdown(iso); |
121 | return NULL; | 128 | return NULL; |
122 | } | 129 | } |
123 | 130 | ||
124 | int hpsb_iso_n_ready(struct hpsb_iso* iso) | 131 | int hpsb_iso_n_ready(struct hpsb_iso *iso) |
125 | { | 132 | { |
126 | unsigned long flags; | 133 | unsigned long flags; |
127 | int val; | 134 | int val; |
@@ -133,18 +140,19 @@ int hpsb_iso_n_ready(struct hpsb_iso* iso) | |||
133 | return val; | 140 | return val; |
134 | } | 141 | } |
135 | 142 | ||
136 | 143 | struct hpsb_iso *hpsb_iso_xmit_init(struct hpsb_host *host, | |
137 | struct hpsb_iso* hpsb_iso_xmit_init(struct hpsb_host *host, | ||
138 | unsigned int data_buf_size, | 144 | unsigned int data_buf_size, |
139 | unsigned int buf_packets, | 145 | unsigned int buf_packets, |
140 | int channel, | 146 | int channel, |
141 | int speed, | 147 | int speed, |
142 | int irq_interval, | 148 | int irq_interval, |
143 | void (*callback)(struct hpsb_iso*)) | 149 | void (*callback) (struct hpsb_iso *)) |
144 | { | 150 | { |
145 | struct hpsb_iso *iso = hpsb_iso_common_init(host, HPSB_ISO_XMIT, | 151 | struct hpsb_iso *iso = hpsb_iso_common_init(host, HPSB_ISO_XMIT, |
146 | data_buf_size, buf_packets, | 152 | data_buf_size, buf_packets, |
147 | channel, HPSB_ISO_DMA_DEFAULT, irq_interval, callback); | 153 | channel, |
154 | HPSB_ISO_DMA_DEFAULT, | ||
155 | irq_interval, callback); | ||
148 | if (!iso) | 156 | if (!iso) |
149 | return NULL; | 157 | return NULL; |
150 | 158 | ||
@@ -157,22 +165,23 @@ struct hpsb_iso* hpsb_iso_xmit_init(struct hpsb_host *host, | |||
157 | iso->flags |= HPSB_ISO_DRIVER_INIT; | 165 | iso->flags |= HPSB_ISO_DRIVER_INIT; |
158 | return iso; | 166 | return iso; |
159 | 167 | ||
160 | err: | 168 | err: |
161 | hpsb_iso_shutdown(iso); | 169 | hpsb_iso_shutdown(iso); |
162 | return NULL; | 170 | return NULL; |
163 | } | 171 | } |
164 | 172 | ||
165 | struct hpsb_iso* hpsb_iso_recv_init(struct hpsb_host *host, | 173 | struct hpsb_iso *hpsb_iso_recv_init(struct hpsb_host *host, |
166 | unsigned int data_buf_size, | 174 | unsigned int data_buf_size, |
167 | unsigned int buf_packets, | 175 | unsigned int buf_packets, |
168 | int channel, | 176 | int channel, |
169 | int dma_mode, | 177 | int dma_mode, |
170 | int irq_interval, | 178 | int irq_interval, |
171 | void (*callback)(struct hpsb_iso*)) | 179 | void (*callback) (struct hpsb_iso *)) |
172 | { | 180 | { |
173 | struct hpsb_iso *iso = hpsb_iso_common_init(host, HPSB_ISO_RECV, | 181 | struct hpsb_iso *iso = hpsb_iso_common_init(host, HPSB_ISO_RECV, |
174 | data_buf_size, buf_packets, | 182 | data_buf_size, buf_packets, |
175 | channel, dma_mode, irq_interval, callback); | 183 | channel, dma_mode, |
184 | irq_interval, callback); | ||
176 | if (!iso) | 185 | if (!iso) |
177 | return NULL; | 186 | return NULL; |
178 | 187 | ||
@@ -183,7 +192,7 @@ struct hpsb_iso* hpsb_iso_recv_init(struct hpsb_host *host, | |||
183 | iso->flags |= HPSB_ISO_DRIVER_INIT; | 192 | iso->flags |= HPSB_ISO_DRIVER_INIT; |
184 | return iso; | 193 | return iso; |
185 | 194 | ||
186 | err: | 195 | err: |
187 | hpsb_iso_shutdown(iso); | 196 | hpsb_iso_shutdown(iso); |
188 | return NULL; | 197 | return NULL; |
189 | } | 198 | } |
@@ -197,16 +206,17 @@ int hpsb_iso_recv_listen_channel(struct hpsb_iso *iso, unsigned char channel) | |||
197 | 206 | ||
198 | int hpsb_iso_recv_unlisten_channel(struct hpsb_iso *iso, unsigned char channel) | 207 | int hpsb_iso_recv_unlisten_channel(struct hpsb_iso *iso, unsigned char channel) |
199 | { | 208 | { |
200 | if (iso->type != HPSB_ISO_RECV || iso->channel != -1 || channel >= 64) | 209 | if (iso->type != HPSB_ISO_RECV || iso->channel != -1 || channel >= 64) |
201 | return -EINVAL; | 210 | return -EINVAL; |
202 | return iso->host->driver->isoctl(iso, RECV_UNLISTEN_CHANNEL, channel); | 211 | return iso->host->driver->isoctl(iso, RECV_UNLISTEN_CHANNEL, channel); |
203 | } | 212 | } |
204 | 213 | ||
205 | int hpsb_iso_recv_set_channel_mask(struct hpsb_iso *iso, u64 mask) | 214 | int hpsb_iso_recv_set_channel_mask(struct hpsb_iso *iso, u64 mask) |
206 | { | 215 | { |
207 | if (iso->type != HPSB_ISO_RECV || iso->channel != -1) | 216 | if (iso->type != HPSB_ISO_RECV || iso->channel != -1) |
208 | return -EINVAL; | 217 | return -EINVAL; |
209 | return iso->host->driver->isoctl(iso, RECV_SET_CHANNEL_MASK, (unsigned long) &mask); | 218 | return iso->host->driver->isoctl(iso, RECV_SET_CHANNEL_MASK, |
219 | (unsigned long)&mask); | ||
210 | } | 220 | } |
211 | 221 | ||
212 | int hpsb_iso_recv_flush(struct hpsb_iso *iso) | 222 | int hpsb_iso_recv_flush(struct hpsb_iso *iso) |
@@ -283,7 +293,9 @@ int hpsb_iso_recv_start(struct hpsb_iso *iso, int cycle, int tag_mask, int sync) | |||
283 | 293 | ||
284 | isoctl_args[2] = sync; | 294 | isoctl_args[2] = sync; |
285 | 295 | ||
286 | retval = iso->host->driver->isoctl(iso, RECV_START, (unsigned long) &isoctl_args[0]); | 296 | retval = |
297 | iso->host->driver->isoctl(iso, RECV_START, | ||
298 | (unsigned long)&isoctl_args[0]); | ||
287 | if (retval) | 299 | if (retval) |
288 | return retval; | 300 | return retval; |
289 | 301 | ||
@@ -296,7 +308,8 @@ int hpsb_iso_recv_start(struct hpsb_iso *iso, int cycle, int tag_mask, int sync) | |||
296 | 308 | ||
297 | static int hpsb_iso_check_offset_len(struct hpsb_iso *iso, | 309 | static int hpsb_iso_check_offset_len(struct hpsb_iso *iso, |
298 | unsigned int offset, unsigned short len, | 310 | unsigned int offset, unsigned short len, |
299 | unsigned int *out_offset, unsigned short *out_len) | 311 | unsigned int *out_offset, |
312 | unsigned short *out_len) | ||
300 | { | 313 | { |
301 | if (offset >= iso->buf_size) | 314 | if (offset >= iso->buf_size) |
302 | return -EFAULT; | 315 | return -EFAULT; |
@@ -316,8 +329,8 @@ static int hpsb_iso_check_offset_len(struct hpsb_iso *iso, | |||
316 | return 0; | 329 | return 0; |
317 | } | 330 | } |
318 | 331 | ||
319 | 332 | int hpsb_iso_xmit_queue_packet(struct hpsb_iso *iso, u32 offset, u16 len, | |
320 | int hpsb_iso_xmit_queue_packet(struct hpsb_iso *iso, u32 offset, u16 len, u8 tag, u8 sy) | 333 | u8 tag, u8 sy) |
321 | { | 334 | { |
322 | struct hpsb_iso_packet_info *info; | 335 | struct hpsb_iso_packet_info *info; |
323 | unsigned long flags; | 336 | unsigned long flags; |
@@ -334,7 +347,8 @@ int hpsb_iso_xmit_queue_packet(struct hpsb_iso *iso, u32 offset, u16 len, u8 tag | |||
334 | info = &iso->infos[iso->first_packet]; | 347 | info = &iso->infos[iso->first_packet]; |
335 | 348 | ||
336 | /* check for bogus offset/length */ | 349 | /* check for bogus offset/length */ |
337 | if (hpsb_iso_check_offset_len(iso, offset, len, &info->offset, &info->len)) | 350 | if (hpsb_iso_check_offset_len |
351 | (iso, offset, len, &info->offset, &info->len)) | ||
338 | return -EFAULT; | 352 | return -EFAULT; |
339 | 353 | ||
340 | info->tag = tag; | 354 | info->tag = tag; |
@@ -342,13 +356,13 @@ int hpsb_iso_xmit_queue_packet(struct hpsb_iso *iso, u32 offset, u16 len, u8 tag | |||
342 | 356 | ||
343 | spin_lock_irqsave(&iso->lock, flags); | 357 | spin_lock_irqsave(&iso->lock, flags); |
344 | 358 | ||
345 | rv = iso->host->driver->isoctl(iso, XMIT_QUEUE, (unsigned long) info); | 359 | rv = iso->host->driver->isoctl(iso, XMIT_QUEUE, (unsigned long)info); |
346 | if (rv) | 360 | if (rv) |
347 | goto out; | 361 | goto out; |
348 | 362 | ||
349 | /* increment cursors */ | 363 | /* increment cursors */ |
350 | iso->first_packet = (iso->first_packet+1) % iso->buf_packets; | 364 | iso->first_packet = (iso->first_packet + 1) % iso->buf_packets; |
351 | iso->xmit_cycle = (iso->xmit_cycle+1) % 8000; | 365 | iso->xmit_cycle = (iso->xmit_cycle + 1) % 8000; |
352 | iso->n_ready_packets--; | 366 | iso->n_ready_packets--; |
353 | 367 | ||
354 | if (iso->prebuffer != 0) { | 368 | if (iso->prebuffer != 0) { |
@@ -359,7 +373,7 @@ int hpsb_iso_xmit_queue_packet(struct hpsb_iso *iso, u32 offset, u16 len, u8 tag | |||
359 | } | 373 | } |
360 | } | 374 | } |
361 | 375 | ||
362 | out: | 376 | out: |
363 | spin_unlock_irqrestore(&iso->lock, flags); | 377 | spin_unlock_irqrestore(&iso->lock, flags); |
364 | return rv; | 378 | return rv; |
365 | } | 379 | } |
@@ -369,7 +383,9 @@ int hpsb_iso_xmit_sync(struct hpsb_iso *iso) | |||
369 | if (iso->type != HPSB_ISO_XMIT) | 383 | if (iso->type != HPSB_ISO_XMIT) |
370 | return -EINVAL; | 384 | return -EINVAL; |
371 | 385 | ||
372 | return wait_event_interruptible(iso->waitq, hpsb_iso_n_ready(iso) == iso->buf_packets); | 386 | return wait_event_interruptible(iso->waitq, |
387 | hpsb_iso_n_ready(iso) == | ||
388 | iso->buf_packets); | ||
373 | } | 389 | } |
374 | 390 | ||
375 | void hpsb_iso_packet_sent(struct hpsb_iso *iso, int cycle, int error) | 391 | void hpsb_iso_packet_sent(struct hpsb_iso *iso, int cycle, int error) |
@@ -396,7 +412,8 @@ void hpsb_iso_packet_sent(struct hpsb_iso *iso, int cycle, int error) | |||
396 | } | 412 | } |
397 | 413 | ||
398 | void hpsb_iso_packet_received(struct hpsb_iso *iso, u32 offset, u16 len, | 414 | void hpsb_iso_packet_received(struct hpsb_iso *iso, u32 offset, u16 len, |
399 | u16 total_len, u16 cycle, u8 channel, u8 tag, u8 sy) | 415 | u16 total_len, u16 cycle, u8 channel, u8 tag, |
416 | u8 sy) | ||
400 | { | 417 | { |
401 | unsigned long flags; | 418 | unsigned long flags; |
402 | spin_lock_irqsave(&iso->lock, flags); | 419 | spin_lock_irqsave(&iso->lock, flags); |
@@ -416,7 +433,7 @@ void hpsb_iso_packet_received(struct hpsb_iso *iso, u32 offset, u16 len, | |||
416 | info->tag = tag; | 433 | info->tag = tag; |
417 | info->sy = sy; | 434 | info->sy = sy; |
418 | 435 | ||
419 | iso->pkt_dma = (iso->pkt_dma+1) % iso->buf_packets; | 436 | iso->pkt_dma = (iso->pkt_dma + 1) % iso->buf_packets; |
420 | iso->n_ready_packets++; | 437 | iso->n_ready_packets++; |
421 | } | 438 | } |
422 | 439 | ||
@@ -435,20 +452,21 @@ int hpsb_iso_recv_release_packets(struct hpsb_iso *iso, unsigned int n_packets) | |||
435 | spin_lock_irqsave(&iso->lock, flags); | 452 | spin_lock_irqsave(&iso->lock, flags); |
436 | for (i = 0; i < n_packets; i++) { | 453 | for (i = 0; i < n_packets; i++) { |
437 | rv = iso->host->driver->isoctl(iso, RECV_RELEASE, | 454 | rv = iso->host->driver->isoctl(iso, RECV_RELEASE, |
438 | (unsigned long) &iso->infos[iso->first_packet]); | 455 | (unsigned long)&iso->infos[iso-> |
456 | first_packet]); | ||
439 | if (rv) | 457 | if (rv) |
440 | break; | 458 | break; |
441 | 459 | ||
442 | iso->first_packet = (iso->first_packet+1) % iso->buf_packets; | 460 | iso->first_packet = (iso->first_packet + 1) % iso->buf_packets; |
443 | iso->n_ready_packets--; | 461 | iso->n_ready_packets--; |
444 | 462 | ||
445 | /* release memory from packets discarded when queue was full */ | 463 | /* release memory from packets discarded when queue was full */ |
446 | if (iso->n_ready_packets == 0) { /* Release only after all prior packets handled */ | 464 | if (iso->n_ready_packets == 0) { /* Release only after all prior packets handled */ |
447 | if (iso->bytes_discarded != 0) { | 465 | if (iso->bytes_discarded != 0) { |
448 | struct hpsb_iso_packet_info inf; | 466 | struct hpsb_iso_packet_info inf; |
449 | inf.total_len = iso->bytes_discarded; | 467 | inf.total_len = iso->bytes_discarded; |
450 | iso->host->driver->isoctl(iso, RECV_RELEASE, | 468 | iso->host->driver->isoctl(iso, RECV_RELEASE, |
451 | (unsigned long) &inf); | 469 | (unsigned long)&inf); |
452 | iso->bytes_discarded = 0; | 470 | iso->bytes_discarded = 0; |
453 | } | 471 | } |
454 | } | 472 | } |
diff --git a/drivers/ieee1394/nodemgr.c b/drivers/ieee1394/nodemgr.c index 7fff5a1d2ea4..3f0917bbd7f5 100644 --- a/drivers/ieee1394/nodemgr.c +++ b/drivers/ieee1394/nodemgr.c | |||
@@ -743,21 +743,20 @@ static struct node_entry *nodemgr_create_node(octlet_t guid, struct csr1212_csr | |||
743 | unsigned int generation) | 743 | unsigned int generation) |
744 | { | 744 | { |
745 | struct hpsb_host *host = hi->host; | 745 | struct hpsb_host *host = hi->host; |
746 | struct node_entry *ne; | 746 | struct node_entry *ne; |
747 | |||
748 | ne = kmalloc(sizeof(struct node_entry), GFP_KERNEL); | ||
749 | if (!ne) return NULL; | ||
750 | 747 | ||
751 | memset(ne, 0, sizeof(struct node_entry)); | 748 | ne = kzalloc(sizeof(*ne), GFP_KERNEL); |
749 | if (!ne) | ||
750 | return NULL; | ||
752 | 751 | ||
753 | ne->tpool = &host->tpool[nodeid & NODE_MASK]; | 752 | ne->tpool = &host->tpool[nodeid & NODE_MASK]; |
754 | 753 | ||
755 | ne->host = host; | 754 | ne->host = host; |
756 | ne->nodeid = nodeid; | 755 | ne->nodeid = nodeid; |
757 | ne->generation = generation; | 756 | ne->generation = generation; |
758 | ne->needs_probe = 1; | 757 | ne->needs_probe = 1; |
759 | 758 | ||
760 | ne->guid = guid; | 759 | ne->guid = guid; |
761 | ne->guid_vendor_id = (guid >> 40) & 0xffffff; | 760 | ne->guid_vendor_id = (guid >> 40) & 0xffffff; |
762 | ne->guid_vendor_oui = nodemgr_find_oui_name(ne->guid_vendor_id); | 761 | ne->guid_vendor_oui = nodemgr_find_oui_name(ne->guid_vendor_id); |
763 | ne->csr = csr; | 762 | ne->csr = csr; |
@@ -787,7 +786,7 @@ static struct node_entry *nodemgr_create_node(octlet_t guid, struct csr1212_csr | |||
787 | (host->node_id == nodeid) ? "Host" : "Node", | 786 | (host->node_id == nodeid) ? "Host" : "Node", |
788 | NODE_BUS_ARGS(host, nodeid), (unsigned long long)guid); | 787 | NODE_BUS_ARGS(host, nodeid), (unsigned long long)guid); |
789 | 788 | ||
790 | return ne; | 789 | return ne; |
791 | } | 790 | } |
792 | 791 | ||
793 | 792 | ||
@@ -872,12 +871,10 @@ static struct unit_directory *nodemgr_process_unit_directory | |||
872 | struct csr1212_keyval *kv; | 871 | struct csr1212_keyval *kv; |
873 | u8 last_key_id = 0; | 872 | u8 last_key_id = 0; |
874 | 873 | ||
875 | ud = kmalloc(sizeof(struct unit_directory), GFP_KERNEL); | 874 | ud = kzalloc(sizeof(*ud), GFP_KERNEL); |
876 | if (!ud) | 875 | if (!ud) |
877 | goto unit_directory_error; | 876 | goto unit_directory_error; |
878 | 877 | ||
879 | memset (ud, 0, sizeof(struct unit_directory)); | ||
880 | |||
881 | ud->ne = ne; | 878 | ud->ne = ne; |
882 | ud->ignore_driver = ignore_drivers; | 879 | ud->ignore_driver = ignore_drivers; |
883 | ud->address = ud_kv->offset + CSR1212_CONFIG_ROM_SPACE_BASE; | 880 | ud->address = ud_kv->offset + CSR1212_CONFIG_ROM_SPACE_BASE; |
@@ -937,10 +934,10 @@ static struct unit_directory *nodemgr_process_unit_directory | |||
937 | /* Logical Unit Number */ | 934 | /* Logical Unit Number */ |
938 | if (kv->key.type == CSR1212_KV_TYPE_IMMEDIATE) { | 935 | if (kv->key.type == CSR1212_KV_TYPE_IMMEDIATE) { |
939 | if (ud->flags & UNIT_DIRECTORY_HAS_LUN) { | 936 | if (ud->flags & UNIT_DIRECTORY_HAS_LUN) { |
940 | ud_child = kmalloc(sizeof(struct unit_directory), GFP_KERNEL); | 937 | ud_child = kmalloc(sizeof(*ud_child), GFP_KERNEL); |
941 | if (!ud_child) | 938 | if (!ud_child) |
942 | goto unit_directory_error; | 939 | goto unit_directory_error; |
943 | memcpy(ud_child, ud, sizeof(struct unit_directory)); | 940 | memcpy(ud_child, ud, sizeof(*ud_child)); |
944 | nodemgr_register_device(ne, ud_child, &ne->device); | 941 | nodemgr_register_device(ne, ud_child, &ne->device); |
945 | ud_child = NULL; | 942 | ud_child = NULL; |
946 | 943 | ||
@@ -1200,7 +1197,7 @@ static void nodemgr_node_scan_one(struct host_info *hi, | |||
1200 | struct csr1212_csr *csr; | 1197 | struct csr1212_csr *csr; |
1201 | struct nodemgr_csr_info *ci; | 1198 | struct nodemgr_csr_info *ci; |
1202 | 1199 | ||
1203 | ci = kmalloc(sizeof(struct nodemgr_csr_info), GFP_KERNEL); | 1200 | ci = kmalloc(sizeof(*ci), GFP_KERNEL); |
1204 | if (!ci) | 1201 | if (!ci) |
1205 | return; | 1202 | return; |
1206 | 1203 | ||
diff --git a/drivers/ieee1394/ohci1394.c b/drivers/ieee1394/ohci1394.c index 4cf9b8f3e336..97b6f48033c4 100644 --- a/drivers/ieee1394/ohci1394.c +++ b/drivers/ieee1394/ohci1394.c | |||
@@ -161,9 +161,6 @@ printk(level "%s: " fmt "\n" , OHCI1394_DRIVER_NAME , ## args) | |||
161 | #define PRINT(level, fmt, args...) \ | 161 | #define PRINT(level, fmt, args...) \ |
162 | printk(level "%s: fw-host%d: " fmt "\n" , OHCI1394_DRIVER_NAME, ohci->host->id , ## args) | 162 | printk(level "%s: fw-host%d: " fmt "\n" , OHCI1394_DRIVER_NAME, ohci->host->id , ## args) |
163 | 163 | ||
164 | static char version[] __devinitdata = | ||
165 | "$Rev: 1313 $ Ben Collins <bcollins@debian.org>"; | ||
166 | |||
167 | /* Module Parameters */ | 164 | /* Module Parameters */ |
168 | static int phys_dma = 1; | 165 | static int phys_dma = 1; |
169 | module_param(phys_dma, int, 0644); | 166 | module_param(phys_dma, int, 0644); |
@@ -2960,28 +2957,23 @@ alloc_dma_rcv_ctx(struct ti_ohci *ohci, struct dma_rcv_ctx *d, | |||
2960 | d->ctrlClear = 0; | 2957 | d->ctrlClear = 0; |
2961 | d->cmdPtr = 0; | 2958 | d->cmdPtr = 0; |
2962 | 2959 | ||
2963 | d->buf_cpu = kmalloc(d->num_desc * sizeof(quadlet_t*), GFP_ATOMIC); | 2960 | d->buf_cpu = kzalloc(d->num_desc * sizeof(*d->buf_cpu), GFP_ATOMIC); |
2964 | d->buf_bus = kmalloc(d->num_desc * sizeof(dma_addr_t), GFP_ATOMIC); | 2961 | d->buf_bus = kzalloc(d->num_desc * sizeof(*d->buf_bus), GFP_ATOMIC); |
2965 | 2962 | ||
2966 | if (d->buf_cpu == NULL || d->buf_bus == NULL) { | 2963 | if (d->buf_cpu == NULL || d->buf_bus == NULL) { |
2967 | PRINT(KERN_ERR, "Failed to allocate dma buffer"); | 2964 | PRINT(KERN_ERR, "Failed to allocate dma buffer"); |
2968 | free_dma_rcv_ctx(d); | 2965 | free_dma_rcv_ctx(d); |
2969 | return -ENOMEM; | 2966 | return -ENOMEM; |
2970 | } | 2967 | } |
2971 | memset(d->buf_cpu, 0, d->num_desc * sizeof(quadlet_t*)); | ||
2972 | memset(d->buf_bus, 0, d->num_desc * sizeof(dma_addr_t)); | ||
2973 | 2968 | ||
2974 | d->prg_cpu = kmalloc(d->num_desc * sizeof(struct dma_cmd*), | 2969 | d->prg_cpu = kzalloc(d->num_desc * sizeof(*d->prg_cpu), GFP_ATOMIC); |
2975 | GFP_ATOMIC); | 2970 | d->prg_bus = kzalloc(d->num_desc * sizeof(*d->prg_bus), GFP_ATOMIC); |
2976 | d->prg_bus = kmalloc(d->num_desc * sizeof(dma_addr_t), GFP_ATOMIC); | ||
2977 | 2971 | ||
2978 | if (d->prg_cpu == NULL || d->prg_bus == NULL) { | 2972 | if (d->prg_cpu == NULL || d->prg_bus == NULL) { |
2979 | PRINT(KERN_ERR, "Failed to allocate dma prg"); | 2973 | PRINT(KERN_ERR, "Failed to allocate dma prg"); |
2980 | free_dma_rcv_ctx(d); | 2974 | free_dma_rcv_ctx(d); |
2981 | return -ENOMEM; | 2975 | return -ENOMEM; |
2982 | } | 2976 | } |
2983 | memset(d->prg_cpu, 0, d->num_desc * sizeof(struct dma_cmd*)); | ||
2984 | memset(d->prg_bus, 0, d->num_desc * sizeof(dma_addr_t)); | ||
2985 | 2977 | ||
2986 | d->spb = kmalloc(d->split_buf_size, GFP_ATOMIC); | 2978 | d->spb = kmalloc(d->split_buf_size, GFP_ATOMIC); |
2987 | 2979 | ||
@@ -3093,17 +3085,14 @@ alloc_dma_trm_ctx(struct ti_ohci *ohci, struct dma_trm_ctx *d, | |||
3093 | d->ctrlClear = 0; | 3085 | d->ctrlClear = 0; |
3094 | d->cmdPtr = 0; | 3086 | d->cmdPtr = 0; |
3095 | 3087 | ||
3096 | d->prg_cpu = kmalloc(d->num_desc * sizeof(struct at_dma_prg*), | 3088 | d->prg_cpu = kzalloc(d->num_desc * sizeof(*d->prg_cpu), GFP_KERNEL); |
3097 | GFP_KERNEL); | 3089 | d->prg_bus = kzalloc(d->num_desc * sizeof(*d->prg_bus), GFP_KERNEL); |
3098 | d->prg_bus = kmalloc(d->num_desc * sizeof(dma_addr_t), GFP_KERNEL); | ||
3099 | 3090 | ||
3100 | if (d->prg_cpu == NULL || d->prg_bus == NULL) { | 3091 | if (d->prg_cpu == NULL || d->prg_bus == NULL) { |
3101 | PRINT(KERN_ERR, "Failed to allocate at dma prg"); | 3092 | PRINT(KERN_ERR, "Failed to allocate at dma prg"); |
3102 | free_dma_trm_ctx(d); | 3093 | free_dma_trm_ctx(d); |
3103 | return -ENOMEM; | 3094 | return -ENOMEM; |
3104 | } | 3095 | } |
3105 | memset(d->prg_cpu, 0, d->num_desc * sizeof(struct at_dma_prg*)); | ||
3106 | memset(d->prg_bus, 0, d->num_desc * sizeof(dma_addr_t)); | ||
3107 | 3096 | ||
3108 | len = sprintf(pool_name, "ohci1394_trm_prg"); | 3097 | len = sprintf(pool_name, "ohci1394_trm_prg"); |
3109 | sprintf(pool_name+len, "%d", num_allocs); | 3098 | sprintf(pool_name+len, "%d", num_allocs); |
@@ -3201,8 +3190,6 @@ static struct hpsb_host_driver ohci1394_driver = { | |||
3201 | .hw_csr_reg = ohci_hw_csr_reg, | 3190 | .hw_csr_reg = ohci_hw_csr_reg, |
3202 | }; | 3191 | }; |
3203 | 3192 | ||
3204 | |||
3205 | |||
3206 | /*********************************** | 3193 | /*********************************** |
3207 | * PCI Driver Interface functions * | 3194 | * PCI Driver Interface functions * |
3208 | ***********************************/ | 3195 | ***********************************/ |
@@ -3217,15 +3204,10 @@ do { \ | |||
3217 | static int __devinit ohci1394_pci_probe(struct pci_dev *dev, | 3204 | static int __devinit ohci1394_pci_probe(struct pci_dev *dev, |
3218 | const struct pci_device_id *ent) | 3205 | const struct pci_device_id *ent) |
3219 | { | 3206 | { |
3220 | static int version_printed = 0; | ||
3221 | |||
3222 | struct hpsb_host *host; | 3207 | struct hpsb_host *host; |
3223 | struct ti_ohci *ohci; /* shortcut to currently handled device */ | 3208 | struct ti_ohci *ohci; /* shortcut to currently handled device */ |
3224 | unsigned long ohci_base; | 3209 | unsigned long ohci_base; |
3225 | 3210 | ||
3226 | if (version_printed++ == 0) | ||
3227 | PRINT_G(KERN_INFO, "%s", version); | ||
3228 | |||
3229 | if (pci_enable_device(dev)) | 3211 | if (pci_enable_device(dev)) |
3230 | FAIL(-ENXIO, "Failed to enable OHCI hardware"); | 3212 | FAIL(-ENXIO, "Failed to enable OHCI hardware"); |
3231 | pci_set_master(dev); | 3213 | pci_set_master(dev); |
@@ -3606,8 +3588,6 @@ static struct pci_driver ohci1394_pci_driver = { | |||
3606 | .suspend = ohci1394_pci_suspend, | 3588 | .suspend = ohci1394_pci_suspend, |
3607 | }; | 3589 | }; |
3608 | 3590 | ||
3609 | |||
3610 | |||
3611 | /*********************************** | 3591 | /*********************************** |
3612 | * OHCI1394 Video Interface * | 3592 | * OHCI1394 Video Interface * |
3613 | ***********************************/ | 3593 | ***********************************/ |
@@ -3714,7 +3694,6 @@ EXPORT_SYMBOL(ohci1394_init_iso_tasklet); | |||
3714 | EXPORT_SYMBOL(ohci1394_register_iso_tasklet); | 3694 | EXPORT_SYMBOL(ohci1394_register_iso_tasklet); |
3715 | EXPORT_SYMBOL(ohci1394_unregister_iso_tasklet); | 3695 | EXPORT_SYMBOL(ohci1394_unregister_iso_tasklet); |
3716 | 3696 | ||
3717 | |||
3718 | /*********************************** | 3697 | /*********************************** |
3719 | * General module initialization * | 3698 | * General module initialization * |
3720 | ***********************************/ | 3699 | ***********************************/ |
diff --git a/drivers/ieee1394/ohci1394.h b/drivers/ieee1394/ohci1394.h index cc66c1cae250..7df0962144e3 100644 --- a/drivers/ieee1394/ohci1394.h +++ b/drivers/ieee1394/ohci1394.h | |||
@@ -219,8 +219,8 @@ struct ti_ohci { | |||
219 | 219 | ||
220 | int self_id_errors; | 220 | int self_id_errors; |
221 | 221 | ||
222 | /* Tasklets for iso receive and transmit, used by video1394, | 222 | /* Tasklets for iso receive and transmit, used by video1394 |
223 | * amdtp and dv1394 */ | 223 | * and dv1394 */ |
224 | 224 | ||
225 | struct list_head iso_tasklet_list; | 225 | struct list_head iso_tasklet_list; |
226 | spinlock_t iso_tasklet_list_lock; | 226 | spinlock_t iso_tasklet_list_lock; |
diff --git a/drivers/ieee1394/pcilynx.c b/drivers/ieee1394/pcilynx.c index 6b1ab875333b..e2edc41e1b6f 100644 --- a/drivers/ieee1394/pcilynx.c +++ b/drivers/ieee1394/pcilynx.c | |||
@@ -1435,7 +1435,7 @@ static int __devinit add_card(struct pci_dev *dev, | |||
1435 | struct i2c_algo_bit_data i2c_adapter_data; | 1435 | struct i2c_algo_bit_data i2c_adapter_data; |
1436 | 1436 | ||
1437 | error = -ENOMEM; | 1437 | error = -ENOMEM; |
1438 | i2c_ad = kmalloc(sizeof(struct i2c_adapter), SLAB_KERNEL); | 1438 | i2c_ad = kmalloc(sizeof(*i2c_ad), SLAB_KERNEL); |
1439 | if (!i2c_ad) FAIL("failed to allocate I2C adapter memory"); | 1439 | if (!i2c_ad) FAIL("failed to allocate I2C adapter memory"); |
1440 | 1440 | ||
1441 | memcpy(i2c_ad, &bit_ops, sizeof(struct i2c_adapter)); | 1441 | memcpy(i2c_ad, &bit_ops, sizeof(struct i2c_adapter)); |
diff --git a/drivers/ieee1394/raw1394.c b/drivers/ieee1394/raw1394.c index 24411e666b21..b05235639918 100644 --- a/drivers/ieee1394/raw1394.c +++ b/drivers/ieee1394/raw1394.c | |||
@@ -102,12 +102,9 @@ static struct pending_request *__alloc_pending_request(gfp_t flags) | |||
102 | { | 102 | { |
103 | struct pending_request *req; | 103 | struct pending_request *req; |
104 | 104 | ||
105 | req = (struct pending_request *)kmalloc(sizeof(struct pending_request), | 105 | req = kzalloc(sizeof(*req), flags); |
106 | flags); | 106 | if (req) |
107 | if (req != NULL) { | ||
108 | memset(req, 0, sizeof(struct pending_request)); | ||
109 | INIT_LIST_HEAD(&req->list); | 107 | INIT_LIST_HEAD(&req->list); |
110 | } | ||
111 | 108 | ||
112 | return req; | 109 | return req; |
113 | } | 110 | } |
@@ -192,9 +189,9 @@ static void add_host(struct hpsb_host *host) | |||
192 | struct host_info *hi; | 189 | struct host_info *hi; |
193 | unsigned long flags; | 190 | unsigned long flags; |
194 | 191 | ||
195 | hi = (struct host_info *)kmalloc(sizeof(struct host_info), GFP_KERNEL); | 192 | hi = kmalloc(sizeof(*hi), GFP_KERNEL); |
196 | 193 | ||
197 | if (hi != NULL) { | 194 | if (hi) { |
198 | INIT_LIST_HEAD(&hi->list); | 195 | INIT_LIST_HEAD(&hi->list); |
199 | hi->host = host; | 196 | hi->host = host; |
200 | INIT_LIST_HEAD(&hi->file_info_list); | 197 | INIT_LIST_HEAD(&hi->file_info_list); |
@@ -315,8 +312,8 @@ static void iso_receive(struct hpsb_host *host, int channel, quadlet_t * data, | |||
315 | break; | 312 | break; |
316 | 313 | ||
317 | if (!ibs) { | 314 | if (!ibs) { |
318 | ibs = kmalloc(sizeof(struct iso_block_store) | 315 | ibs = kmalloc(sizeof(*ibs) + length, |
319 | + length, SLAB_ATOMIC); | 316 | SLAB_ATOMIC); |
320 | if (!ibs) { | 317 | if (!ibs) { |
321 | kfree(req); | 318 | kfree(req); |
322 | break; | 319 | break; |
@@ -376,8 +373,8 @@ static void fcp_request(struct hpsb_host *host, int nodeid, int direction, | |||
376 | break; | 373 | break; |
377 | 374 | ||
378 | if (!ibs) { | 375 | if (!ibs) { |
379 | ibs = kmalloc(sizeof(struct iso_block_store) | 376 | ibs = kmalloc(sizeof(*ibs) + length, |
380 | + length, SLAB_ATOMIC); | 377 | SLAB_ATOMIC); |
381 | if (!ibs) { | 378 | if (!ibs) { |
382 | kfree(req); | 379 | kfree(req); |
383 | break; | 380 | break; |
@@ -502,10 +499,9 @@ static int state_initialized(struct file_info *fi, struct pending_request *req) | |||
502 | switch (req->req.type) { | 499 | switch (req->req.type) { |
503 | case RAW1394_REQ_LIST_CARDS: | 500 | case RAW1394_REQ_LIST_CARDS: |
504 | spin_lock_irqsave(&host_info_lock, flags); | 501 | spin_lock_irqsave(&host_info_lock, flags); |
505 | khl = kmalloc(sizeof(struct raw1394_khost_list) * host_count, | 502 | khl = kmalloc(sizeof(*khl) * host_count, SLAB_ATOMIC); |
506 | SLAB_ATOMIC); | ||
507 | 503 | ||
508 | if (khl != NULL) { | 504 | if (khl) { |
509 | req->req.misc = host_count; | 505 | req->req.misc = host_count; |
510 | req->data = (quadlet_t *) khl; | 506 | req->data = (quadlet_t *) khl; |
511 | 507 | ||
@@ -517,7 +513,7 @@ static int state_initialized(struct file_info *fi, struct pending_request *req) | |||
517 | } | 513 | } |
518 | spin_unlock_irqrestore(&host_info_lock, flags); | 514 | spin_unlock_irqrestore(&host_info_lock, flags); |
519 | 515 | ||
520 | if (khl != NULL) { | 516 | if (khl) { |
521 | req->req.error = RAW1394_ERROR_NONE; | 517 | req->req.error = RAW1394_ERROR_NONE; |
522 | req->req.length = min(req->req.length, | 518 | req->req.length = min(req->req.length, |
523 | (u32) (sizeof | 519 | (u32) (sizeof |
@@ -1647,13 +1643,13 @@ static int arm_register(struct file_info *fi, struct pending_request *req) | |||
1647 | return (-EINVAL); | 1643 | return (-EINVAL); |
1648 | } | 1644 | } |
1649 | /* addr-list-entry for fileinfo */ | 1645 | /* addr-list-entry for fileinfo */ |
1650 | addr = (struct arm_addr *)kmalloc(sizeof(struct arm_addr), SLAB_KERNEL); | 1646 | addr = kmalloc(sizeof(*addr), SLAB_KERNEL); |
1651 | if (!addr) { | 1647 | if (!addr) { |
1652 | req->req.length = 0; | 1648 | req->req.length = 0; |
1653 | return (-ENOMEM); | 1649 | return (-ENOMEM); |
1654 | } | 1650 | } |
1655 | /* allocation of addr_space_buffer */ | 1651 | /* allocation of addr_space_buffer */ |
1656 | addr->addr_space_buffer = (u8 *) vmalloc(req->req.length); | 1652 | addr->addr_space_buffer = vmalloc(req->req.length); |
1657 | if (!(addr->addr_space_buffer)) { | 1653 | if (!(addr->addr_space_buffer)) { |
1658 | kfree(addr); | 1654 | kfree(addr); |
1659 | req->req.length = 0; | 1655 | req->req.length = 0; |
@@ -2122,8 +2118,7 @@ static int modify_config_rom(struct file_info *fi, struct pending_request *req) | |||
2122 | return -ENOMEM; | 2118 | return -ENOMEM; |
2123 | } | 2119 | } |
2124 | 2120 | ||
2125 | cache->filled_head = | 2121 | cache->filled_head = kmalloc(sizeof(*cache->filled_head), GFP_KERNEL); |
2126 | kmalloc(sizeof(struct csr1212_cache_region), GFP_KERNEL); | ||
2127 | if (!cache->filled_head) { | 2122 | if (!cache->filled_head) { |
2128 | csr1212_release_keyval(fi->csr1212_dirs[dr]); | 2123 | csr1212_release_keyval(fi->csr1212_dirs[dr]); |
2129 | fi->csr1212_dirs[dr] = NULL; | 2124 | fi->csr1212_dirs[dr] = NULL; |
@@ -2136,7 +2131,6 @@ static int modify_config_rom(struct file_info *fi, struct pending_request *req) | |||
2136 | req->req.length)) { | 2131 | req->req.length)) { |
2137 | csr1212_release_keyval(fi->csr1212_dirs[dr]); | 2132 | csr1212_release_keyval(fi->csr1212_dirs[dr]); |
2138 | fi->csr1212_dirs[dr] = NULL; | 2133 | fi->csr1212_dirs[dr] = NULL; |
2139 | CSR1212_FREE(cache); | ||
2140 | ret = -EFAULT; | 2134 | ret = -EFAULT; |
2141 | } else { | 2135 | } else { |
2142 | cache->len = req->req.length; | 2136 | cache->len = req->req.length; |
@@ -2172,7 +2166,7 @@ static int modify_config_rom(struct file_info *fi, struct pending_request *req) | |||
2172 | } | 2166 | } |
2173 | } | 2167 | } |
2174 | kfree(cache->filled_head); | 2168 | kfree(cache->filled_head); |
2175 | kfree(cache); | 2169 | CSR1212_FREE(cache); |
2176 | 2170 | ||
2177 | if (ret >= 0) { | 2171 | if (ret >= 0) { |
2178 | /* we have to free the request, because we queue no response, | 2172 | /* we have to free the request, because we queue no response, |
@@ -2488,8 +2482,8 @@ static int raw1394_iso_recv_packets(struct file_info *fi, void __user * uaddr) | |||
2488 | 2482 | ||
2489 | /* ensure user-supplied buffer is accessible and big enough */ | 2483 | /* ensure user-supplied buffer is accessible and big enough */ |
2490 | if (!access_ok(VERIFY_WRITE, upackets.infos, | 2484 | if (!access_ok(VERIFY_WRITE, upackets.infos, |
2491 | upackets.n_packets * | 2485 | upackets.n_packets * |
2492 | sizeof(struct raw1394_iso_packet_info))) | 2486 | sizeof(struct raw1394_iso_packet_info))) |
2493 | return -EFAULT; | 2487 | return -EFAULT; |
2494 | 2488 | ||
2495 | /* copy the packet_infos out */ | 2489 | /* copy the packet_infos out */ |
@@ -2522,8 +2516,8 @@ static int raw1394_iso_send_packets(struct file_info *fi, void __user * uaddr) | |||
2522 | 2516 | ||
2523 | /* ensure user-supplied buffer is accessible and big enough */ | 2517 | /* ensure user-supplied buffer is accessible and big enough */ |
2524 | if (!access_ok(VERIFY_READ, upackets.infos, | 2518 | if (!access_ok(VERIFY_READ, upackets.infos, |
2525 | upackets.n_packets * | 2519 | upackets.n_packets * |
2526 | sizeof(struct raw1394_iso_packet_info))) | 2520 | sizeof(struct raw1394_iso_packet_info))) |
2527 | return -EFAULT; | 2521 | return -EFAULT; |
2528 | 2522 | ||
2529 | /* copy the infos structs in and queue the packets */ | 2523 | /* copy the infos structs in and queue the packets */ |
@@ -2684,11 +2678,10 @@ static int raw1394_open(struct inode *inode, struct file *file) | |||
2684 | { | 2678 | { |
2685 | struct file_info *fi; | 2679 | struct file_info *fi; |
2686 | 2680 | ||
2687 | fi = kmalloc(sizeof(struct file_info), SLAB_KERNEL); | 2681 | fi = kzalloc(sizeof(*fi), SLAB_KERNEL); |
2688 | if (fi == NULL) | 2682 | if (!fi) |
2689 | return -ENOMEM; | 2683 | return -ENOMEM; |
2690 | 2684 | ||
2691 | memset(fi, 0, sizeof(struct file_info)); | ||
2692 | fi->notification = (u8) RAW1394_NOTIFY_ON; /* busreset notification */ | 2685 | fi->notification = (u8) RAW1394_NOTIFY_ON; /* busreset notification */ |
2693 | 2686 | ||
2694 | INIT_LIST_HEAD(&fi->list); | 2687 | INIT_LIST_HEAD(&fi->list); |
@@ -2748,8 +2741,7 @@ static int raw1394_release(struct inode *inode, struct file *file) | |||
2748 | list) { | 2741 | list) { |
2749 | entry = fi_hlp->addr_list.next; | 2742 | entry = fi_hlp->addr_list.next; |
2750 | while (entry != &(fi_hlp->addr_list)) { | 2743 | while (entry != &(fi_hlp->addr_list)) { |
2751 | arm_addr = list_entry(entry, | 2744 | arm_addr = list_entry(entry, struct |
2752 | struct | ||
2753 | arm_addr, | 2745 | arm_addr, |
2754 | addr_list); | 2746 | addr_list); |
2755 | if (arm_addr->start == | 2747 | if (arm_addr->start == |
@@ -2912,16 +2904,17 @@ static int __init init_raw1394(void) | |||
2912 | 2904 | ||
2913 | hpsb_register_highlevel(&raw1394_highlevel); | 2905 | hpsb_register_highlevel(&raw1394_highlevel); |
2914 | 2906 | ||
2915 | if (IS_ERR(class_device_create(hpsb_protocol_class, NULL, MKDEV( | 2907 | if (IS_ERR |
2916 | IEEE1394_MAJOR, IEEE1394_MINOR_BLOCK_RAW1394 * 16), | 2908 | (class_device_create |
2917 | NULL, RAW1394_DEVICE_NAME))) { | 2909 | (hpsb_protocol_class, NULL, |
2910 | MKDEV(IEEE1394_MAJOR, IEEE1394_MINOR_BLOCK_RAW1394 * 16), NULL, | ||
2911 | RAW1394_DEVICE_NAME))) { | ||
2918 | ret = -EFAULT; | 2912 | ret = -EFAULT; |
2919 | goto out_unreg; | 2913 | goto out_unreg; |
2920 | } | 2914 | } |
2921 | 2915 | ||
2922 | devfs_mk_cdev(MKDEV( | 2916 | devfs_mk_cdev(MKDEV(IEEE1394_MAJOR, IEEE1394_MINOR_BLOCK_RAW1394 * 16), |
2923 | IEEE1394_MAJOR, IEEE1394_MINOR_BLOCK_RAW1394 * 16), | 2917 | S_IFCHR | S_IRUSR | S_IWUSR, RAW1394_DEVICE_NAME); |
2924 | S_IFCHR | S_IRUSR | S_IWUSR, RAW1394_DEVICE_NAME); | ||
2925 | 2918 | ||
2926 | cdev_init(&raw1394_cdev, &raw1394_fops); | 2919 | cdev_init(&raw1394_cdev, &raw1394_fops); |
2927 | raw1394_cdev.owner = THIS_MODULE; | 2920 | raw1394_cdev.owner = THIS_MODULE; |
@@ -2943,20 +2936,22 @@ static int __init init_raw1394(void) | |||
2943 | 2936 | ||
2944 | goto out; | 2937 | goto out; |
2945 | 2938 | ||
2946 | out_dev: | 2939 | out_dev: |
2947 | devfs_remove(RAW1394_DEVICE_NAME); | 2940 | devfs_remove(RAW1394_DEVICE_NAME); |
2948 | class_device_destroy(hpsb_protocol_class, | 2941 | class_device_destroy(hpsb_protocol_class, |
2949 | MKDEV(IEEE1394_MAJOR, IEEE1394_MINOR_BLOCK_RAW1394 * 16)); | 2942 | MKDEV(IEEE1394_MAJOR, |
2950 | out_unreg: | 2943 | IEEE1394_MINOR_BLOCK_RAW1394 * 16)); |
2944 | out_unreg: | ||
2951 | hpsb_unregister_highlevel(&raw1394_highlevel); | 2945 | hpsb_unregister_highlevel(&raw1394_highlevel); |
2952 | out: | 2946 | out: |
2953 | return ret; | 2947 | return ret; |
2954 | } | 2948 | } |
2955 | 2949 | ||
2956 | static void __exit cleanup_raw1394(void) | 2950 | static void __exit cleanup_raw1394(void) |
2957 | { | 2951 | { |
2958 | class_device_destroy(hpsb_protocol_class, | 2952 | class_device_destroy(hpsb_protocol_class, |
2959 | MKDEV(IEEE1394_MAJOR, IEEE1394_MINOR_BLOCK_RAW1394 * 16)); | 2953 | MKDEV(IEEE1394_MAJOR, |
2954 | IEEE1394_MINOR_BLOCK_RAW1394 * 16)); | ||
2960 | cdev_del(&raw1394_cdev); | 2955 | cdev_del(&raw1394_cdev); |
2961 | devfs_remove(RAW1394_DEVICE_NAME); | 2956 | devfs_remove(RAW1394_DEVICE_NAME); |
2962 | hpsb_unregister_highlevel(&raw1394_highlevel); | 2957 | hpsb_unregister_highlevel(&raw1394_highlevel); |
diff --git a/drivers/ieee1394/sbp2.c b/drivers/ieee1394/sbp2.c index f7e18ccc5c0a..f0763b797238 100644 --- a/drivers/ieee1394/sbp2.c +++ b/drivers/ieee1394/sbp2.c | |||
@@ -80,9 +80,6 @@ | |||
80 | #include "ieee1394_transactions.h" | 80 | #include "ieee1394_transactions.h" |
81 | #include "sbp2.h" | 81 | #include "sbp2.h" |
82 | 82 | ||
83 | static char version[] __devinitdata = | ||
84 | "$Rev: 1306 $ Ben Collins <bcollins@debian.org>"; | ||
85 | |||
86 | /* | 83 | /* |
87 | * Module load parameter definitions | 84 | * Module load parameter definitions |
88 | */ | 85 | */ |
@@ -151,18 +148,15 @@ static int force_inquiry_hack; | |||
151 | module_param(force_inquiry_hack, int, 0444); | 148 | module_param(force_inquiry_hack, int, 0444); |
152 | MODULE_PARM_DESC(force_inquiry_hack, "Force SCSI inquiry hack (default = 0)"); | 149 | MODULE_PARM_DESC(force_inquiry_hack, "Force SCSI inquiry hack (default = 0)"); |
153 | 150 | ||
154 | |||
155 | /* | 151 | /* |
156 | * Export information about protocols/devices supported by this driver. | 152 | * Export information about protocols/devices supported by this driver. |
157 | */ | 153 | */ |
158 | static struct ieee1394_device_id sbp2_id_table[] = { | 154 | static struct ieee1394_device_id sbp2_id_table[] = { |
159 | { | 155 | { |
160 | .match_flags =IEEE1394_MATCH_SPECIFIER_ID | | 156 | .match_flags = IEEE1394_MATCH_SPECIFIER_ID | IEEE1394_MATCH_VERSION, |
161 | IEEE1394_MATCH_VERSION, | 157 | .specifier_id = SBP2_UNIT_SPEC_ID_ENTRY & 0xffffff, |
162 | .specifier_id = SBP2_UNIT_SPEC_ID_ENTRY & 0xffffff, | 158 | .version = SBP2_SW_VERSION_ENTRY & 0xffffff}, |
163 | .version = SBP2_SW_VERSION_ENTRY & 0xffffff | 159 | {} |
164 | }, | ||
165 | { } | ||
166 | }; | 160 | }; |
167 | 161 | ||
168 | MODULE_DEVICE_TABLE(ieee1394, sbp2_id_table); | 162 | MODULE_DEVICE_TABLE(ieee1394, sbp2_id_table); |
@@ -221,7 +215,6 @@ static u32 global_outstanding_dmas = 0; | |||
221 | 215 | ||
222 | #define SBP2_ERR(fmt, args...) HPSB_ERR("sbp2: "fmt, ## args) | 216 | #define SBP2_ERR(fmt, args...) HPSB_ERR("sbp2: "fmt, ## args) |
223 | 217 | ||
224 | |||
225 | /* | 218 | /* |
226 | * Globals | 219 | * Globals |
227 | */ | 220 | */ |
@@ -254,8 +247,8 @@ static struct hpsb_address_ops sbp2_ops = { | |||
254 | 247 | ||
255 | #ifdef CONFIG_IEEE1394_SBP2_PHYS_DMA | 248 | #ifdef CONFIG_IEEE1394_SBP2_PHYS_DMA |
256 | static struct hpsb_address_ops sbp2_physdma_ops = { | 249 | static struct hpsb_address_ops sbp2_physdma_ops = { |
257 | .read = sbp2_handle_physdma_read, | 250 | .read = sbp2_handle_physdma_read, |
258 | .write = sbp2_handle_physdma_write, | 251 | .write = sbp2_handle_physdma_write, |
259 | }; | 252 | }; |
260 | #endif | 253 | #endif |
261 | 254 | ||
@@ -287,7 +280,6 @@ static u32 sbp2_broken_inquiry_list[] = { | |||
287 | * General utility functions | 280 | * General utility functions |
288 | **************************************/ | 281 | **************************************/ |
289 | 282 | ||
290 | |||
291 | #ifndef __BIG_ENDIAN | 283 | #ifndef __BIG_ENDIAN |
292 | /* | 284 | /* |
293 | * Converts a buffer from be32 to cpu byte ordering. Length is in bytes. | 285 | * Converts a buffer from be32 to cpu byte ordering. Length is in bytes. |
@@ -324,7 +316,8 @@ static __inline__ void sbp2util_cpu_to_be32_buffer(void *buffer, int length) | |||
324 | /* | 316 | /* |
325 | * Debug packet dump routine. Length is in bytes. | 317 | * Debug packet dump routine. Length is in bytes. |
326 | */ | 318 | */ |
327 | static void sbp2util_packet_dump(void *buffer, int length, char *dump_name, u32 dump_phys_addr) | 319 | static void sbp2util_packet_dump(void *buffer, int length, char *dump_name, |
320 | u32 dump_phys_addr) | ||
328 | { | 321 | { |
329 | int i; | 322 | int i; |
330 | unsigned char *dump = buffer; | 323 | unsigned char *dump = buffer; |
@@ -345,7 +338,7 @@ static void sbp2util_packet_dump(void *buffer, int length, char *dump_name, u32 | |||
345 | printk(" "); | 338 | printk(" "); |
346 | if ((i & 0xf) == 0) | 339 | if ((i & 0xf) == 0) |
347 | printk("\n "); | 340 | printk("\n "); |
348 | printk("%02x ", (int) dump[i]); | 341 | printk("%02x ", (int)dump[i]); |
349 | } | 342 | } |
350 | printk("\n"); | 343 | printk("\n"); |
351 | 344 | ||
@@ -364,9 +357,9 @@ static int sbp2util_down_timeout(atomic_t *done, int timeout) | |||
364 | 357 | ||
365 | for (i = timeout; (i > 0 && atomic_read(done) == 0); i-= HZ/10) { | 358 | for (i = timeout; (i > 0 && atomic_read(done) == 0); i-= HZ/10) { |
366 | if (msleep_interruptible(100)) /* 100ms */ | 359 | if (msleep_interruptible(100)) /* 100ms */ |
367 | return(1); | 360 | return 1; |
368 | } | 361 | } |
369 | return ((i > 0) ? 0:1); | 362 | return (i > 0) ? 0 : 1; |
370 | } | 363 | } |
371 | 364 | ||
372 | /* Free's an allocated packet */ | 365 | /* Free's an allocated packet */ |
@@ -380,21 +373,22 @@ static void sbp2_free_packet(struct hpsb_packet *packet) | |||
380 | * subaction and returns immediately. Can be used from interrupts. | 373 | * subaction and returns immediately. Can be used from interrupts. |
381 | */ | 374 | */ |
382 | static int sbp2util_node_write_no_wait(struct node_entry *ne, u64 addr, | 375 | static int sbp2util_node_write_no_wait(struct node_entry *ne, u64 addr, |
383 | quadlet_t *buffer, size_t length) | 376 | quadlet_t *buffer, size_t length) |
384 | { | 377 | { |
385 | struct hpsb_packet *packet; | 378 | struct hpsb_packet *packet; |
386 | 379 | ||
387 | packet = hpsb_make_writepacket(ne->host, ne->nodeid, | 380 | packet = hpsb_make_writepacket(ne->host, ne->nodeid, |
388 | addr, buffer, length); | 381 | addr, buffer, length); |
389 | if (!packet) | 382 | if (!packet) |
390 | return -ENOMEM; | 383 | return -ENOMEM; |
391 | 384 | ||
392 | hpsb_set_packet_complete_task(packet, (void (*)(void*))sbp2_free_packet, | 385 | hpsb_set_packet_complete_task(packet, |
386 | (void (*)(void *))sbp2_free_packet, | ||
393 | packet); | 387 | packet); |
394 | 388 | ||
395 | hpsb_node_fill_packet(ne, packet); | 389 | hpsb_node_fill_packet(ne, packet); |
396 | 390 | ||
397 | if (hpsb_send_packet(packet) < 0) { | 391 | if (hpsb_send_packet(packet) < 0) { |
398 | sbp2_free_packet(packet); | 392 | sbp2_free_packet(packet); |
399 | return -EIO; | 393 | return -EIO; |
400 | } | 394 | } |
@@ -417,22 +411,22 @@ static int sbp2util_create_command_orb_pool(struct scsi_id_instance_data *scsi_i | |||
417 | 411 | ||
418 | spin_lock_irqsave(&scsi_id->sbp2_command_orb_lock, flags); | 412 | spin_lock_irqsave(&scsi_id->sbp2_command_orb_lock, flags); |
419 | for (i = 0; i < orbs; i++) { | 413 | for (i = 0; i < orbs; i++) { |
420 | command = (struct sbp2_command_info *) | 414 | command = kzalloc(sizeof(*command), GFP_ATOMIC); |
421 | kmalloc(sizeof(struct sbp2_command_info), GFP_ATOMIC); | ||
422 | if (!command) { | 415 | if (!command) { |
423 | spin_unlock_irqrestore(&scsi_id->sbp2_command_orb_lock, flags); | 416 | spin_unlock_irqrestore(&scsi_id->sbp2_command_orb_lock, |
424 | return(-ENOMEM); | 417 | flags); |
418 | return -ENOMEM; | ||
425 | } | 419 | } |
426 | memset(command, '\0', sizeof(struct sbp2_command_info)); | ||
427 | command->command_orb_dma = | 420 | command->command_orb_dma = |
428 | pci_map_single (hi->host->pdev, &command->command_orb, | 421 | pci_map_single(hi->host->pdev, &command->command_orb, |
429 | sizeof(struct sbp2_command_orb), | 422 | sizeof(struct sbp2_command_orb), |
430 | PCI_DMA_BIDIRECTIONAL); | 423 | PCI_DMA_BIDIRECTIONAL); |
431 | SBP2_DMA_ALLOC("single command orb DMA"); | 424 | SBP2_DMA_ALLOC("single command orb DMA"); |
432 | command->sge_dma = | 425 | command->sge_dma = |
433 | pci_map_single (hi->host->pdev, &command->scatter_gather_element, | 426 | pci_map_single(hi->host->pdev, |
434 | sizeof(command->scatter_gather_element), | 427 | &command->scatter_gather_element, |
435 | PCI_DMA_BIDIRECTIONAL); | 428 | sizeof(command->scatter_gather_element), |
429 | PCI_DMA_BIDIRECTIONAL); | ||
436 | SBP2_DMA_ALLOC("scatter_gather_element"); | 430 | SBP2_DMA_ALLOC("scatter_gather_element"); |
437 | INIT_LIST_HEAD(&command->list); | 431 | INIT_LIST_HEAD(&command->list); |
438 | list_add_tail(&command->list, &scsi_id->sbp2_command_orb_completed); | 432 | list_add_tail(&command->list, &scsi_id->sbp2_command_orb_completed); |
@@ -488,7 +482,7 @@ static struct sbp2_command_info *sbp2util_find_command_for_orb( | |||
488 | list_for_each_entry(command, &scsi_id->sbp2_command_orb_inuse, list) { | 482 | list_for_each_entry(command, &scsi_id->sbp2_command_orb_inuse, list) { |
489 | if (command->command_orb_dma == orb) { | 483 | if (command->command_orb_dma == orb) { |
490 | spin_unlock_irqrestore(&scsi_id->sbp2_command_orb_lock, flags); | 484 | spin_unlock_irqrestore(&scsi_id->sbp2_command_orb_lock, flags); |
491 | return (command); | 485 | return command; |
492 | } | 486 | } |
493 | } | 487 | } |
494 | } | 488 | } |
@@ -496,7 +490,7 @@ static struct sbp2_command_info *sbp2util_find_command_for_orb( | |||
496 | 490 | ||
497 | SBP2_ORB_DEBUG("could not match command orb %x", (unsigned int)orb); | 491 | SBP2_ORB_DEBUG("could not match command orb %x", (unsigned int)orb); |
498 | 492 | ||
499 | return(NULL); | 493 | return NULL; |
500 | } | 494 | } |
501 | 495 | ||
502 | /* | 496 | /* |
@@ -513,12 +507,12 @@ static struct sbp2_command_info *sbp2util_find_command_for_SCpnt(struct scsi_id_ | |||
513 | list_for_each_entry(command, &scsi_id->sbp2_command_orb_inuse, list) { | 507 | list_for_each_entry(command, &scsi_id->sbp2_command_orb_inuse, list) { |
514 | if (command->Current_SCpnt == SCpnt) { | 508 | if (command->Current_SCpnt == SCpnt) { |
515 | spin_unlock_irqrestore(&scsi_id->sbp2_command_orb_lock, flags); | 509 | spin_unlock_irqrestore(&scsi_id->sbp2_command_orb_lock, flags); |
516 | return (command); | 510 | return command; |
517 | } | 511 | } |
518 | } | 512 | } |
519 | } | 513 | } |
520 | spin_unlock_irqrestore(&scsi_id->sbp2_command_orb_lock, flags); | 514 | spin_unlock_irqrestore(&scsi_id->sbp2_command_orb_lock, flags); |
521 | return(NULL); | 515 | return NULL; |
522 | } | 516 | } |
523 | 517 | ||
524 | /* | 518 | /* |
@@ -545,7 +539,7 @@ static struct sbp2_command_info *sbp2util_allocate_command_orb( | |||
545 | SBP2_ERR("sbp2util_allocate_command_orb - No orbs available!"); | 539 | SBP2_ERR("sbp2util_allocate_command_orb - No orbs available!"); |
546 | } | 540 | } |
547 | spin_unlock_irqrestore(&scsi_id->sbp2_command_orb_lock, flags); | 541 | spin_unlock_irqrestore(&scsi_id->sbp2_command_orb_lock, flags); |
548 | return (command); | 542 | return command; |
549 | } | 543 | } |
550 | 544 | ||
551 | /* Free our DMA's */ | 545 | /* Free our DMA's */ |
@@ -587,7 +581,8 @@ static void sbp2util_free_command_dma(struct sbp2_command_info *command) | |||
587 | /* | 581 | /* |
588 | * This function moves a command to the completed orb list. | 582 | * This function moves a command to the completed orb list. |
589 | */ | 583 | */ |
590 | static void sbp2util_mark_command_completed(struct scsi_id_instance_data *scsi_id, struct sbp2_command_info *command) | 584 | static void sbp2util_mark_command_completed(struct scsi_id_instance_data *scsi_id, |
585 | struct sbp2_command_info *command) | ||
591 | { | 586 | { |
592 | unsigned long flags; | 587 | unsigned long flags; |
593 | 588 | ||
@@ -606,8 +601,6 @@ static inline int sbp2util_node_is_available(struct scsi_id_instance_data *scsi_ | |||
606 | return scsi_id && scsi_id->ne && !scsi_id->ne->in_limbo; | 601 | return scsi_id && scsi_id->ne && !scsi_id->ne->in_limbo; |
607 | } | 602 | } |
608 | 603 | ||
609 | |||
610 | |||
611 | /********************************************* | 604 | /********************************************* |
612 | * IEEE-1394 core driver stack related section | 605 | * IEEE-1394 core driver stack related section |
613 | *********************************************/ | 606 | *********************************************/ |
@@ -627,14 +620,14 @@ static int sbp2_probe(struct device *dev) | |||
627 | if (ud->flags & UNIT_DIRECTORY_HAS_LUN_DIRECTORY) | 620 | if (ud->flags & UNIT_DIRECTORY_HAS_LUN_DIRECTORY) |
628 | return -ENODEV; | 621 | return -ENODEV; |
629 | 622 | ||
630 | scsi_id = sbp2_alloc_device(ud); | 623 | scsi_id = sbp2_alloc_device(ud); |
631 | 624 | ||
632 | if (!scsi_id) | 625 | if (!scsi_id) |
633 | return -ENOMEM; | 626 | return -ENOMEM; |
634 | 627 | ||
635 | sbp2_parse_unit_directory(scsi_id, ud); | 628 | sbp2_parse_unit_directory(scsi_id, ud); |
636 | 629 | ||
637 | return sbp2_start_device(scsi_id); | 630 | return sbp2_start_device(scsi_id); |
638 | } | 631 | } |
639 | 632 | ||
640 | static int sbp2_remove(struct device *dev) | 633 | static int sbp2_remove(struct device *dev) |
@@ -719,12 +712,11 @@ static struct scsi_id_instance_data *sbp2_alloc_device(struct unit_directory *ud | |||
719 | 712 | ||
720 | SBP2_DEBUG("sbp2_alloc_device"); | 713 | SBP2_DEBUG("sbp2_alloc_device"); |
721 | 714 | ||
722 | scsi_id = kmalloc(sizeof(*scsi_id), GFP_KERNEL); | 715 | scsi_id = kzalloc(sizeof(*scsi_id), GFP_KERNEL); |
723 | if (!scsi_id) { | 716 | if (!scsi_id) { |
724 | SBP2_ERR("failed to create scsi_id"); | 717 | SBP2_ERR("failed to create scsi_id"); |
725 | goto failed_alloc; | 718 | goto failed_alloc; |
726 | } | 719 | } |
727 | memset(scsi_id, 0, sizeof(*scsi_id)); | ||
728 | 720 | ||
729 | scsi_id->ne = ud->ne; | 721 | scsi_id->ne = ud->ne; |
730 | scsi_id->ud = ud; | 722 | scsi_id->ud = ud; |
@@ -735,7 +727,7 @@ static struct scsi_id_instance_data *sbp2_alloc_device(struct unit_directory *ud | |||
735 | INIT_LIST_HEAD(&scsi_id->sbp2_command_orb_completed); | 727 | INIT_LIST_HEAD(&scsi_id->sbp2_command_orb_completed); |
736 | INIT_LIST_HEAD(&scsi_id->scsi_list); | 728 | INIT_LIST_HEAD(&scsi_id->scsi_list); |
737 | spin_lock_init(&scsi_id->sbp2_command_orb_lock); | 729 | spin_lock_init(&scsi_id->sbp2_command_orb_lock); |
738 | scsi_id->sbp2_device_type_and_lun = SBP2_DEVICE_TYPE_LUN_UNINITIALIZED; | 730 | scsi_id->sbp2_lun = 0; |
739 | 731 | ||
740 | ud->device.driver_data = scsi_id; | 732 | ud->device.driver_data = scsi_id; |
741 | 733 | ||
@@ -769,7 +761,7 @@ static struct scsi_id_instance_data *sbp2_alloc_device(struct unit_directory *ud | |||
769 | 761 | ||
770 | /* Register our host with the SCSI stack. */ | 762 | /* Register our host with the SCSI stack. */ |
771 | scsi_host = scsi_host_alloc(&scsi_driver_template, | 763 | scsi_host = scsi_host_alloc(&scsi_driver_template, |
772 | sizeof (unsigned long)); | 764 | sizeof(unsigned long)); |
773 | if (!scsi_host) { | 765 | if (!scsi_host) { |
774 | SBP2_ERR("failed to register scsi host"); | 766 | SBP2_ERR("failed to register scsi host"); |
775 | goto failed_alloc; | 767 | goto failed_alloc; |
@@ -790,7 +782,6 @@ failed_alloc: | |||
790 | return NULL; | 782 | return NULL; |
791 | } | 783 | } |
792 | 784 | ||
793 | |||
794 | static void sbp2_host_reset(struct hpsb_host *host) | 785 | static void sbp2_host_reset(struct hpsb_host *host) |
795 | { | 786 | { |
796 | struct sbp2scsi_host_info *hi; | 787 | struct sbp2scsi_host_info *hi; |
@@ -804,7 +795,6 @@ static void sbp2_host_reset(struct hpsb_host *host) | |||
804 | } | 795 | } |
805 | } | 796 | } |
806 | 797 | ||
807 | |||
808 | /* | 798 | /* |
809 | * This function is where we first pull the node unique ids, and then | 799 | * This function is where we first pull the node unique ids, and then |
810 | * allocate memory and register a SBP-2 device. | 800 | * allocate memory and register a SBP-2 device. |
@@ -818,7 +808,8 @@ static int sbp2_start_device(struct scsi_id_instance_data *scsi_id) | |||
818 | 808 | ||
819 | /* Login FIFO DMA */ | 809 | /* Login FIFO DMA */ |
820 | scsi_id->login_response = | 810 | scsi_id->login_response = |
821 | pci_alloc_consistent(hi->host->pdev, sizeof(struct sbp2_login_response), | 811 | pci_alloc_consistent(hi->host->pdev, |
812 | sizeof(struct sbp2_login_response), | ||
822 | &scsi_id->login_response_dma); | 813 | &scsi_id->login_response_dma); |
823 | if (!scsi_id->login_response) | 814 | if (!scsi_id->login_response) |
824 | goto alloc_fail; | 815 | goto alloc_fail; |
@@ -826,7 +817,8 @@ static int sbp2_start_device(struct scsi_id_instance_data *scsi_id) | |||
826 | 817 | ||
827 | /* Query logins ORB DMA */ | 818 | /* Query logins ORB DMA */ |
828 | scsi_id->query_logins_orb = | 819 | scsi_id->query_logins_orb = |
829 | pci_alloc_consistent(hi->host->pdev, sizeof(struct sbp2_query_logins_orb), | 820 | pci_alloc_consistent(hi->host->pdev, |
821 | sizeof(struct sbp2_query_logins_orb), | ||
830 | &scsi_id->query_logins_orb_dma); | 822 | &scsi_id->query_logins_orb_dma); |
831 | if (!scsi_id->query_logins_orb) | 823 | if (!scsi_id->query_logins_orb) |
832 | goto alloc_fail; | 824 | goto alloc_fail; |
@@ -834,7 +826,8 @@ static int sbp2_start_device(struct scsi_id_instance_data *scsi_id) | |||
834 | 826 | ||
835 | /* Query logins response DMA */ | 827 | /* Query logins response DMA */ |
836 | scsi_id->query_logins_response = | 828 | scsi_id->query_logins_response = |
837 | pci_alloc_consistent(hi->host->pdev, sizeof(struct sbp2_query_logins_response), | 829 | pci_alloc_consistent(hi->host->pdev, |
830 | sizeof(struct sbp2_query_logins_response), | ||
838 | &scsi_id->query_logins_response_dma); | 831 | &scsi_id->query_logins_response_dma); |
839 | if (!scsi_id->query_logins_response) | 832 | if (!scsi_id->query_logins_response) |
840 | goto alloc_fail; | 833 | goto alloc_fail; |
@@ -842,7 +835,8 @@ static int sbp2_start_device(struct scsi_id_instance_data *scsi_id) | |||
842 | 835 | ||
843 | /* Reconnect ORB DMA */ | 836 | /* Reconnect ORB DMA */ |
844 | scsi_id->reconnect_orb = | 837 | scsi_id->reconnect_orb = |
845 | pci_alloc_consistent(hi->host->pdev, sizeof(struct sbp2_reconnect_orb), | 838 | pci_alloc_consistent(hi->host->pdev, |
839 | sizeof(struct sbp2_reconnect_orb), | ||
846 | &scsi_id->reconnect_orb_dma); | 840 | &scsi_id->reconnect_orb_dma); |
847 | if (!scsi_id->reconnect_orb) | 841 | if (!scsi_id->reconnect_orb) |
848 | goto alloc_fail; | 842 | goto alloc_fail; |
@@ -850,7 +844,8 @@ static int sbp2_start_device(struct scsi_id_instance_data *scsi_id) | |||
850 | 844 | ||
851 | /* Logout ORB DMA */ | 845 | /* Logout ORB DMA */ |
852 | scsi_id->logout_orb = | 846 | scsi_id->logout_orb = |
853 | pci_alloc_consistent(hi->host->pdev, sizeof(struct sbp2_logout_orb), | 847 | pci_alloc_consistent(hi->host->pdev, |
848 | sizeof(struct sbp2_logout_orb), | ||
854 | &scsi_id->logout_orb_dma); | 849 | &scsi_id->logout_orb_dma); |
855 | if (!scsi_id->logout_orb) | 850 | if (!scsi_id->logout_orb) |
856 | goto alloc_fail; | 851 | goto alloc_fail; |
@@ -858,7 +853,8 @@ static int sbp2_start_device(struct scsi_id_instance_data *scsi_id) | |||
858 | 853 | ||
859 | /* Login ORB DMA */ | 854 | /* Login ORB DMA */ |
860 | scsi_id->login_orb = | 855 | scsi_id->login_orb = |
861 | pci_alloc_consistent(hi->host->pdev, sizeof(struct sbp2_login_orb), | 856 | pci_alloc_consistent(hi->host->pdev, |
857 | sizeof(struct sbp2_login_orb), | ||
862 | &scsi_id->login_orb_dma); | 858 | &scsi_id->login_orb_dma); |
863 | if (!scsi_id->login_orb) { | 859 | if (!scsi_id->login_orb) { |
864 | alloc_fail: | 860 | alloc_fail: |
@@ -880,25 +876,25 @@ alloc_fail: | |||
880 | 876 | ||
881 | if (scsi_id->logout_orb) { | 877 | if (scsi_id->logout_orb) { |
882 | pci_free_consistent(hi->host->pdev, | 878 | pci_free_consistent(hi->host->pdev, |
883 | sizeof(struct sbp2_logout_orb), | 879 | sizeof(struct sbp2_logout_orb), |
884 | scsi_id->logout_orb, | 880 | scsi_id->logout_orb, |
885 | scsi_id->logout_orb_dma); | 881 | scsi_id->logout_orb_dma); |
886 | SBP2_DMA_FREE("logout ORB DMA"); | 882 | SBP2_DMA_FREE("logout ORB DMA"); |
887 | } | 883 | } |
888 | 884 | ||
889 | if (scsi_id->reconnect_orb) { | 885 | if (scsi_id->reconnect_orb) { |
890 | pci_free_consistent(hi->host->pdev, | 886 | pci_free_consistent(hi->host->pdev, |
891 | sizeof(struct sbp2_reconnect_orb), | 887 | sizeof(struct sbp2_reconnect_orb), |
892 | scsi_id->reconnect_orb, | 888 | scsi_id->reconnect_orb, |
893 | scsi_id->reconnect_orb_dma); | 889 | scsi_id->reconnect_orb_dma); |
894 | SBP2_DMA_FREE("reconnect ORB DMA"); | 890 | SBP2_DMA_FREE("reconnect ORB DMA"); |
895 | } | 891 | } |
896 | 892 | ||
897 | if (scsi_id->login_response) { | 893 | if (scsi_id->login_response) { |
898 | pci_free_consistent(hi->host->pdev, | 894 | pci_free_consistent(hi->host->pdev, |
899 | sizeof(struct sbp2_login_response), | 895 | sizeof(struct sbp2_login_response), |
900 | scsi_id->login_response, | 896 | scsi_id->login_response, |
901 | scsi_id->login_response_dma); | 897 | scsi_id->login_response_dma); |
902 | SBP2_DMA_FREE("login FIFO DMA"); | 898 | SBP2_DMA_FREE("login FIFO DMA"); |
903 | } | 899 | } |
904 | 900 | ||
@@ -906,7 +902,7 @@ alloc_fail: | |||
906 | 902 | ||
907 | kfree(scsi_id); | 903 | kfree(scsi_id); |
908 | 904 | ||
909 | SBP2_ERR ("Could not allocate memory for scsi_id"); | 905 | SBP2_ERR("Could not allocate memory for scsi_id"); |
910 | 906 | ||
911 | return -ENOMEM; | 907 | return -ENOMEM; |
912 | } | 908 | } |
@@ -935,7 +931,7 @@ alloc_fail: | |||
935 | sbp2_remove_device(scsi_id); | 931 | sbp2_remove_device(scsi_id); |
936 | return -EINTR; | 932 | return -EINTR; |
937 | } | 933 | } |
938 | 934 | ||
939 | /* | 935 | /* |
940 | * Login to the sbp-2 device | 936 | * Login to the sbp-2 device |
941 | */ | 937 | */ |
@@ -1054,51 +1050,44 @@ static void sbp2_remove_device(struct scsi_id_instance_data *scsi_id) | |||
1054 | * This function deals with physical dma write requests (for adapters that do not support | 1050 | * This function deals with physical dma write requests (for adapters that do not support |
1055 | * physical dma in hardware). Mostly just here for debugging... | 1051 | * physical dma in hardware). Mostly just here for debugging... |
1056 | */ | 1052 | */ |
1057 | static int sbp2_handle_physdma_write(struct hpsb_host *host, int nodeid, int destid, quadlet_t *data, | 1053 | static int sbp2_handle_physdma_write(struct hpsb_host *host, int nodeid, |
1058 | u64 addr, size_t length, u16 flags) | 1054 | int destid, quadlet_t *data, u64 addr, |
1055 | size_t length, u16 flags) | ||
1059 | { | 1056 | { |
1060 | 1057 | ||
1061 | /* | 1058 | /* |
1062 | * Manually put the data in the right place. | 1059 | * Manually put the data in the right place. |
1063 | */ | 1060 | */ |
1064 | memcpy(bus_to_virt((u32)addr), data, length); | 1061 | memcpy(bus_to_virt((u32) addr), data, length); |
1065 | sbp2util_packet_dump(data, length, "sbp2 phys dma write by device", (u32)addr); | 1062 | sbp2util_packet_dump(data, length, "sbp2 phys dma write by device", |
1066 | return(RCODE_COMPLETE); | 1063 | (u32) addr); |
1064 | return RCODE_COMPLETE; | ||
1067 | } | 1065 | } |
1068 | 1066 | ||
1069 | /* | 1067 | /* |
1070 | * This function deals with physical dma read requests (for adapters that do not support | 1068 | * This function deals with physical dma read requests (for adapters that do not support |
1071 | * physical dma in hardware). Mostly just here for debugging... | 1069 | * physical dma in hardware). Mostly just here for debugging... |
1072 | */ | 1070 | */ |
1073 | static int sbp2_handle_physdma_read(struct hpsb_host *host, int nodeid, quadlet_t *data, | 1071 | static int sbp2_handle_physdma_read(struct hpsb_host *host, int nodeid, |
1074 | u64 addr, size_t length, u16 flags) | 1072 | quadlet_t *data, u64 addr, size_t length, |
1073 | u16 flags) | ||
1075 | { | 1074 | { |
1076 | 1075 | ||
1077 | /* | 1076 | /* |
1078 | * Grab data from memory and send a read response. | 1077 | * Grab data from memory and send a read response. |
1079 | */ | 1078 | */ |
1080 | memcpy(data, bus_to_virt((u32)addr), length); | 1079 | memcpy(data, bus_to_virt((u32) addr), length); |
1081 | sbp2util_packet_dump(data, length, "sbp2 phys dma read by device", (u32)addr); | 1080 | sbp2util_packet_dump(data, length, "sbp2 phys dma read by device", |
1082 | return(RCODE_COMPLETE); | 1081 | (u32) addr); |
1082 | return RCODE_COMPLETE; | ||
1083 | } | 1083 | } |
1084 | #endif | 1084 | #endif |
1085 | 1085 | ||
1086 | |||
1087 | /************************************** | 1086 | /************************************** |
1088 | * SBP-2 protocol related section | 1087 | * SBP-2 protocol related section |
1089 | **************************************/ | 1088 | **************************************/ |
1090 | 1089 | ||
1091 | /* | 1090 | /* |
1092 | * This function determines if we should convert scsi commands for a particular sbp2 device type | ||
1093 | */ | ||
1094 | static __inline__ int sbp2_command_conversion_device_type(u8 device_type) | ||
1095 | { | ||
1096 | return (((device_type == TYPE_DISK) || | ||
1097 | (device_type == TYPE_RBC) || | ||
1098 | (device_type == TYPE_ROM)) ? 1:0); | ||
1099 | } | ||
1100 | |||
1101 | /* | ||
1102 | * This function queries the device for the maximum concurrent logins it | 1091 | * This function queries the device for the maximum concurrent logins it |
1103 | * supports. | 1092 | * supports. |
1104 | */ | 1093 | */ |
@@ -1120,11 +1109,7 @@ static int sbp2_query_logins(struct scsi_id_instance_data *scsi_id) | |||
1120 | 1109 | ||
1121 | scsi_id->query_logins_orb->lun_misc = ORB_SET_FUNCTION(SBP2_QUERY_LOGINS_REQUEST); | 1110 | scsi_id->query_logins_orb->lun_misc = ORB_SET_FUNCTION(SBP2_QUERY_LOGINS_REQUEST); |
1122 | scsi_id->query_logins_orb->lun_misc |= ORB_SET_NOTIFY(1); | 1111 | scsi_id->query_logins_orb->lun_misc |= ORB_SET_NOTIFY(1); |
1123 | if (scsi_id->sbp2_device_type_and_lun != SBP2_DEVICE_TYPE_LUN_UNINITIALIZED) { | 1112 | scsi_id->query_logins_orb->lun_misc |= ORB_SET_LUN(scsi_id->sbp2_lun); |
1124 | scsi_id->query_logins_orb->lun_misc |= ORB_SET_LUN(scsi_id->sbp2_device_type_and_lun); | ||
1125 | SBP2_DEBUG("sbp2_query_logins: set lun to %d", | ||
1126 | ORB_SET_LUN(scsi_id->sbp2_device_type_and_lun)); | ||
1127 | } | ||
1128 | SBP2_DEBUG("sbp2_query_logins: lun_misc initialized"); | 1113 | SBP2_DEBUG("sbp2_query_logins: lun_misc initialized"); |
1129 | 1114 | ||
1130 | scsi_id->query_logins_orb->reserved_resp_length = | 1115 | scsi_id->query_logins_orb->reserved_resp_length = |
@@ -1161,12 +1146,12 @@ static int sbp2_query_logins(struct scsi_id_instance_data *scsi_id) | |||
1161 | 1146 | ||
1162 | if (sbp2util_down_timeout(&scsi_id->sbp2_login_complete, 2*HZ)) { | 1147 | if (sbp2util_down_timeout(&scsi_id->sbp2_login_complete, 2*HZ)) { |
1163 | SBP2_INFO("Error querying logins to SBP-2 device - timed out"); | 1148 | SBP2_INFO("Error querying logins to SBP-2 device - timed out"); |
1164 | return(-EIO); | 1149 | return -EIO; |
1165 | } | 1150 | } |
1166 | 1151 | ||
1167 | if (scsi_id->status_block.ORB_offset_lo != scsi_id->query_logins_orb_dma) { | 1152 | if (scsi_id->status_block.ORB_offset_lo != scsi_id->query_logins_orb_dma) { |
1168 | SBP2_INFO("Error querying logins to SBP-2 device - timed out"); | 1153 | SBP2_INFO("Error querying logins to SBP-2 device - timed out"); |
1169 | return(-EIO); | 1154 | return -EIO; |
1170 | } | 1155 | } |
1171 | 1156 | ||
1172 | if (STATUS_GET_RESP(scsi_id->status_block.ORB_offset_hi_misc) || | 1157 | if (STATUS_GET_RESP(scsi_id->status_block.ORB_offset_hi_misc) || |
@@ -1174,7 +1159,7 @@ static int sbp2_query_logins(struct scsi_id_instance_data *scsi_id) | |||
1174 | STATUS_GET_SBP_STATUS(scsi_id->status_block.ORB_offset_hi_misc)) { | 1159 | STATUS_GET_SBP_STATUS(scsi_id->status_block.ORB_offset_hi_misc)) { |
1175 | 1160 | ||
1176 | SBP2_INFO("Error querying logins to SBP-2 device - timed out"); | 1161 | SBP2_INFO("Error querying logins to SBP-2 device - timed out"); |
1177 | return(-EIO); | 1162 | return -EIO; |
1178 | } | 1163 | } |
1179 | 1164 | ||
1180 | sbp2util_cpu_to_be32_buffer(scsi_id->query_logins_response, sizeof(struct sbp2_query_logins_response)); | 1165 | sbp2util_cpu_to_be32_buffer(scsi_id->query_logins_response, sizeof(struct sbp2_query_logins_response)); |
@@ -1191,7 +1176,7 @@ static int sbp2_query_logins(struct scsi_id_instance_data *scsi_id) | |||
1191 | SBP2_DEBUG("Number of active logins: %d", active_logins); | 1176 | SBP2_DEBUG("Number of active logins: %d", active_logins); |
1192 | 1177 | ||
1193 | if (active_logins >= max_logins) { | 1178 | if (active_logins >= max_logins) { |
1194 | return(-EIO); | 1179 | return -EIO; |
1195 | } | 1180 | } |
1196 | 1181 | ||
1197 | return 0; | 1182 | return 0; |
@@ -1210,13 +1195,13 @@ static int sbp2_login_device(struct scsi_id_instance_data *scsi_id) | |||
1210 | 1195 | ||
1211 | if (!scsi_id->login_orb) { | 1196 | if (!scsi_id->login_orb) { |
1212 | SBP2_DEBUG("sbp2_login_device: login_orb not alloc'd!"); | 1197 | SBP2_DEBUG("sbp2_login_device: login_orb not alloc'd!"); |
1213 | return(-EIO); | 1198 | return -EIO; |
1214 | } | 1199 | } |
1215 | 1200 | ||
1216 | if (!exclusive_login) { | 1201 | if (!exclusive_login) { |
1217 | if (sbp2_query_logins(scsi_id)) { | 1202 | if (sbp2_query_logins(scsi_id)) { |
1218 | SBP2_INFO("Device does not support any more concurrent logins"); | 1203 | SBP2_INFO("Device does not support any more concurrent logins"); |
1219 | return(-EIO); | 1204 | return -EIO; |
1220 | } | 1205 | } |
1221 | } | 1206 | } |
1222 | 1207 | ||
@@ -1233,12 +1218,7 @@ static int sbp2_login_device(struct scsi_id_instance_data *scsi_id) | |||
1233 | scsi_id->login_orb->lun_misc |= ORB_SET_RECONNECT(0); /* One second reconnect time */ | 1218 | scsi_id->login_orb->lun_misc |= ORB_SET_RECONNECT(0); /* One second reconnect time */ |
1234 | scsi_id->login_orb->lun_misc |= ORB_SET_EXCLUSIVE(exclusive_login); /* Exclusive access to device */ | 1219 | scsi_id->login_orb->lun_misc |= ORB_SET_EXCLUSIVE(exclusive_login); /* Exclusive access to device */ |
1235 | scsi_id->login_orb->lun_misc |= ORB_SET_NOTIFY(1); /* Notify us of login complete */ | 1220 | scsi_id->login_orb->lun_misc |= ORB_SET_NOTIFY(1); /* Notify us of login complete */ |
1236 | /* Set the lun if we were able to pull it from the device's unit directory */ | 1221 | scsi_id->login_orb->lun_misc |= ORB_SET_LUN(scsi_id->sbp2_lun); |
1237 | if (scsi_id->sbp2_device_type_and_lun != SBP2_DEVICE_TYPE_LUN_UNINITIALIZED) { | ||
1238 | scsi_id->login_orb->lun_misc |= ORB_SET_LUN(scsi_id->sbp2_device_type_and_lun); | ||
1239 | SBP2_DEBUG("sbp2_query_logins: set lun to %d", | ||
1240 | ORB_SET_LUN(scsi_id->sbp2_device_type_and_lun)); | ||
1241 | } | ||
1242 | SBP2_DEBUG("sbp2_login_device: lun_misc initialized"); | 1222 | SBP2_DEBUG("sbp2_login_device: lun_misc initialized"); |
1243 | 1223 | ||
1244 | scsi_id->login_orb->passwd_resp_lengths = | 1224 | scsi_id->login_orb->passwd_resp_lengths = |
@@ -1288,7 +1268,7 @@ static int sbp2_login_device(struct scsi_id_instance_data *scsi_id) | |||
1288 | */ | 1268 | */ |
1289 | if (sbp2util_down_timeout(&scsi_id->sbp2_login_complete, 20*HZ)) { | 1269 | if (sbp2util_down_timeout(&scsi_id->sbp2_login_complete, 20*HZ)) { |
1290 | SBP2_ERR("Error logging into SBP-2 device - login timed-out"); | 1270 | SBP2_ERR("Error logging into SBP-2 device - login timed-out"); |
1291 | return(-EIO); | 1271 | return -EIO; |
1292 | } | 1272 | } |
1293 | 1273 | ||
1294 | /* | 1274 | /* |
@@ -1296,7 +1276,7 @@ static int sbp2_login_device(struct scsi_id_instance_data *scsi_id) | |||
1296 | */ | 1276 | */ |
1297 | if (scsi_id->status_block.ORB_offset_lo != scsi_id->login_orb_dma) { | 1277 | if (scsi_id->status_block.ORB_offset_lo != scsi_id->login_orb_dma) { |
1298 | SBP2_ERR("Error logging into SBP-2 device - login timed-out"); | 1278 | SBP2_ERR("Error logging into SBP-2 device - login timed-out"); |
1299 | return(-EIO); | 1279 | return -EIO; |
1300 | } | 1280 | } |
1301 | 1281 | ||
1302 | /* | 1282 | /* |
@@ -1307,7 +1287,7 @@ static int sbp2_login_device(struct scsi_id_instance_data *scsi_id) | |||
1307 | STATUS_GET_SBP_STATUS(scsi_id->status_block.ORB_offset_hi_misc)) { | 1287 | STATUS_GET_SBP_STATUS(scsi_id->status_block.ORB_offset_hi_misc)) { |
1308 | 1288 | ||
1309 | SBP2_ERR("Error logging into SBP-2 device - login failed"); | 1289 | SBP2_ERR("Error logging into SBP-2 device - login failed"); |
1310 | return(-EIO); | 1290 | return -EIO; |
1311 | } | 1291 | } |
1312 | 1292 | ||
1313 | /* | 1293 | /* |
@@ -1331,7 +1311,7 @@ static int sbp2_login_device(struct scsi_id_instance_data *scsi_id) | |||
1331 | 1311 | ||
1332 | SBP2_INFO("Logged into SBP-2 device"); | 1312 | SBP2_INFO("Logged into SBP-2 device"); |
1333 | 1313 | ||
1334 | return(0); | 1314 | return 0; |
1335 | 1315 | ||
1336 | } | 1316 | } |
1337 | 1317 | ||
@@ -1385,8 +1365,7 @@ static int sbp2_logout_device(struct scsi_id_instance_data *scsi_id) | |||
1385 | atomic_set(&scsi_id->sbp2_login_complete, 0); | 1365 | atomic_set(&scsi_id->sbp2_login_complete, 0); |
1386 | 1366 | ||
1387 | error = hpsb_node_write(scsi_id->ne, | 1367 | error = hpsb_node_write(scsi_id->ne, |
1388 | scsi_id->sbp2_management_agent_addr, | 1368 | scsi_id->sbp2_management_agent_addr, data, 8); |
1389 | data, 8); | ||
1390 | if (error) | 1369 | if (error) |
1391 | return error; | 1370 | return error; |
1392 | 1371 | ||
@@ -1396,7 +1375,7 @@ static int sbp2_logout_device(struct scsi_id_instance_data *scsi_id) | |||
1396 | 1375 | ||
1397 | SBP2_INFO("Logged out of SBP-2 device"); | 1376 | SBP2_INFO("Logged out of SBP-2 device"); |
1398 | 1377 | ||
1399 | return(0); | 1378 | return 0; |
1400 | 1379 | ||
1401 | } | 1380 | } |
1402 | 1381 | ||
@@ -1456,8 +1435,7 @@ static int sbp2_reconnect_device(struct scsi_id_instance_data *scsi_id) | |||
1456 | atomic_set(&scsi_id->sbp2_login_complete, 0); | 1435 | atomic_set(&scsi_id->sbp2_login_complete, 0); |
1457 | 1436 | ||
1458 | error = hpsb_node_write(scsi_id->ne, | 1437 | error = hpsb_node_write(scsi_id->ne, |
1459 | scsi_id->sbp2_management_agent_addr, | 1438 | scsi_id->sbp2_management_agent_addr, data, 8); |
1460 | data, 8); | ||
1461 | if (error) | 1439 | if (error) |
1462 | return error; | 1440 | return error; |
1463 | 1441 | ||
@@ -1466,7 +1444,7 @@ static int sbp2_reconnect_device(struct scsi_id_instance_data *scsi_id) | |||
1466 | */ | 1444 | */ |
1467 | if (sbp2util_down_timeout(&scsi_id->sbp2_login_complete, HZ)) { | 1445 | if (sbp2util_down_timeout(&scsi_id->sbp2_login_complete, HZ)) { |
1468 | SBP2_ERR("Error reconnecting to SBP-2 device - reconnect timed-out"); | 1446 | SBP2_ERR("Error reconnecting to SBP-2 device - reconnect timed-out"); |
1469 | return(-EIO); | 1447 | return -EIO; |
1470 | } | 1448 | } |
1471 | 1449 | ||
1472 | /* | 1450 | /* |
@@ -1474,7 +1452,7 @@ static int sbp2_reconnect_device(struct scsi_id_instance_data *scsi_id) | |||
1474 | */ | 1452 | */ |
1475 | if (scsi_id->status_block.ORB_offset_lo != scsi_id->reconnect_orb_dma) { | 1453 | if (scsi_id->status_block.ORB_offset_lo != scsi_id->reconnect_orb_dma) { |
1476 | SBP2_ERR("Error reconnecting to SBP-2 device - reconnect timed-out"); | 1454 | SBP2_ERR("Error reconnecting to SBP-2 device - reconnect timed-out"); |
1477 | return(-EIO); | 1455 | return -EIO; |
1478 | } | 1456 | } |
1479 | 1457 | ||
1480 | /* | 1458 | /* |
@@ -1485,12 +1463,12 @@ static int sbp2_reconnect_device(struct scsi_id_instance_data *scsi_id) | |||
1485 | STATUS_GET_SBP_STATUS(scsi_id->status_block.ORB_offset_hi_misc)) { | 1463 | STATUS_GET_SBP_STATUS(scsi_id->status_block.ORB_offset_hi_misc)) { |
1486 | 1464 | ||
1487 | SBP2_ERR("Error reconnecting to SBP-2 device - reconnect failed"); | 1465 | SBP2_ERR("Error reconnecting to SBP-2 device - reconnect failed"); |
1488 | return(-EIO); | 1466 | return -EIO; |
1489 | } | 1467 | } |
1490 | 1468 | ||
1491 | HPSB_DEBUG("Reconnected to SBP-2 device"); | 1469 | HPSB_DEBUG("Reconnected to SBP-2 device"); |
1492 | 1470 | ||
1493 | return(0); | 1471 | return 0; |
1494 | 1472 | ||
1495 | } | 1473 | } |
1496 | 1474 | ||
@@ -1513,10 +1491,9 @@ static int sbp2_set_busy_timeout(struct scsi_id_instance_data *scsi_id) | |||
1513 | SBP2_ERR("sbp2_set_busy_timeout error"); | 1491 | SBP2_ERR("sbp2_set_busy_timeout error"); |
1514 | } | 1492 | } |
1515 | 1493 | ||
1516 | return(0); | 1494 | return 0; |
1517 | } | 1495 | } |
1518 | 1496 | ||
1519 | |||
1520 | /* | 1497 | /* |
1521 | * This function is called to parse sbp2 device's config rom unit | 1498 | * This function is called to parse sbp2 device's config rom unit |
1522 | * directory. Used to determine things like sbp2 management agent offset, | 1499 | * directory. Used to determine things like sbp2 management agent offset, |
@@ -1529,7 +1506,7 @@ static void sbp2_parse_unit_directory(struct scsi_id_instance_data *scsi_id, | |||
1529 | struct csr1212_dentry *dentry; | 1506 | struct csr1212_dentry *dentry; |
1530 | u64 management_agent_addr; | 1507 | u64 management_agent_addr; |
1531 | u32 command_set_spec_id, command_set, unit_characteristics, | 1508 | u32 command_set_spec_id, command_set, unit_characteristics, |
1532 | firmware_revision, workarounds; | 1509 | firmware_revision, workarounds; |
1533 | int i; | 1510 | int i; |
1534 | 1511 | ||
1535 | SBP2_DEBUG("sbp2_parse_unit_directory"); | 1512 | SBP2_DEBUG("sbp2_parse_unit_directory"); |
@@ -1547,13 +1524,14 @@ static void sbp2_parse_unit_directory(struct scsi_id_instance_data *scsi_id, | |||
1547 | if (kv->key.type == CSR1212_KV_TYPE_CSR_OFFSET) { | 1524 | if (kv->key.type == CSR1212_KV_TYPE_CSR_OFFSET) { |
1548 | /* Save off the management agent address */ | 1525 | /* Save off the management agent address */ |
1549 | management_agent_addr = | 1526 | management_agent_addr = |
1550 | CSR1212_REGISTER_SPACE_BASE + | 1527 | CSR1212_REGISTER_SPACE_BASE + |
1551 | (kv->value.csr_offset << 2); | 1528 | (kv->value.csr_offset << 2); |
1552 | 1529 | ||
1553 | SBP2_DEBUG("sbp2_management_agent_addr = %x", | 1530 | SBP2_DEBUG("sbp2_management_agent_addr = %x", |
1554 | (unsigned int) management_agent_addr); | 1531 | (unsigned int)management_agent_addr); |
1555 | } else if (kv->key.type == CSR1212_KV_TYPE_IMMEDIATE) { | 1532 | } else if (kv->key.type == CSR1212_KV_TYPE_IMMEDIATE) { |
1556 | scsi_id->sbp2_device_type_and_lun = kv->value.immediate; | 1533 | scsi_id->sbp2_lun = |
1534 | ORB_SET_LUN(kv->value.immediate); | ||
1557 | } | 1535 | } |
1558 | break; | 1536 | break; |
1559 | 1537 | ||
@@ -1561,14 +1539,14 @@ static void sbp2_parse_unit_directory(struct scsi_id_instance_data *scsi_id, | |||
1561 | /* Command spec organization */ | 1539 | /* Command spec organization */ |
1562 | command_set_spec_id = kv->value.immediate; | 1540 | command_set_spec_id = kv->value.immediate; |
1563 | SBP2_DEBUG("sbp2_command_set_spec_id = %x", | 1541 | SBP2_DEBUG("sbp2_command_set_spec_id = %x", |
1564 | (unsigned int) command_set_spec_id); | 1542 | (unsigned int)command_set_spec_id); |
1565 | break; | 1543 | break; |
1566 | 1544 | ||
1567 | case SBP2_COMMAND_SET_KEY: | 1545 | case SBP2_COMMAND_SET_KEY: |
1568 | /* Command set used by sbp2 device */ | 1546 | /* Command set used by sbp2 device */ |
1569 | command_set = kv->value.immediate; | 1547 | command_set = kv->value.immediate; |
1570 | SBP2_DEBUG("sbp2_command_set = %x", | 1548 | SBP2_DEBUG("sbp2_command_set = %x", |
1571 | (unsigned int) command_set); | 1549 | (unsigned int)command_set); |
1572 | break; | 1550 | break; |
1573 | 1551 | ||
1574 | case SBP2_UNIT_CHARACTERISTICS_KEY: | 1552 | case SBP2_UNIT_CHARACTERISTICS_KEY: |
@@ -1578,7 +1556,7 @@ static void sbp2_parse_unit_directory(struct scsi_id_instance_data *scsi_id, | |||
1578 | */ | 1556 | */ |
1579 | unit_characteristics = kv->value.immediate; | 1557 | unit_characteristics = kv->value.immediate; |
1580 | SBP2_DEBUG("sbp2_unit_characteristics = %x", | 1558 | SBP2_DEBUG("sbp2_unit_characteristics = %x", |
1581 | (unsigned int) unit_characteristics); | 1559 | (unsigned int)unit_characteristics); |
1582 | break; | 1560 | break; |
1583 | 1561 | ||
1584 | case SBP2_FIRMWARE_REVISION_KEY: | 1562 | case SBP2_FIRMWARE_REVISION_KEY: |
@@ -1586,9 +1564,10 @@ static void sbp2_parse_unit_directory(struct scsi_id_instance_data *scsi_id, | |||
1586 | firmware_revision = kv->value.immediate; | 1564 | firmware_revision = kv->value.immediate; |
1587 | if (force_inquiry_hack) | 1565 | if (force_inquiry_hack) |
1588 | SBP2_INFO("sbp2_firmware_revision = %x", | 1566 | SBP2_INFO("sbp2_firmware_revision = %x", |
1589 | (unsigned int) firmware_revision); | 1567 | (unsigned int)firmware_revision); |
1590 | else SBP2_DEBUG("sbp2_firmware_revision = %x", | 1568 | else |
1591 | (unsigned int) firmware_revision); | 1569 | SBP2_DEBUG("sbp2_firmware_revision = %x", |
1570 | (unsigned int)firmware_revision); | ||
1592 | break; | 1571 | break; |
1593 | 1572 | ||
1594 | default: | 1573 | default: |
@@ -1646,7 +1625,7 @@ static void sbp2_parse_unit_directory(struct scsi_id_instance_data *scsi_id, | |||
1646 | scsi_id->sbp2_firmware_revision = firmware_revision; | 1625 | scsi_id->sbp2_firmware_revision = firmware_revision; |
1647 | scsi_id->workarounds = workarounds; | 1626 | scsi_id->workarounds = workarounds; |
1648 | if (ud->flags & UNIT_DIRECTORY_HAS_LUN) | 1627 | if (ud->flags & UNIT_DIRECTORY_HAS_LUN) |
1649 | scsi_id->sbp2_device_type_and_lun = ud->lun; | 1628 | scsi_id->sbp2_lun = ORB_SET_LUN(ud->lun); |
1650 | } | 1629 | } |
1651 | } | 1630 | } |
1652 | 1631 | ||
@@ -1666,8 +1645,9 @@ static int sbp2_max_speed_and_size(struct scsi_id_instance_data *scsi_id) | |||
1666 | SBP2_DEBUG("sbp2_max_speed_and_size"); | 1645 | SBP2_DEBUG("sbp2_max_speed_and_size"); |
1667 | 1646 | ||
1668 | /* Initial setting comes from the hosts speed map */ | 1647 | /* Initial setting comes from the hosts speed map */ |
1669 | scsi_id->speed_code = hi->host->speed_map[NODEID_TO_NODE(hi->host->node_id) * 64 | 1648 | scsi_id->speed_code = |
1670 | + NODEID_TO_NODE(scsi_id->ne->nodeid)]; | 1649 | hi->host->speed_map[NODEID_TO_NODE(hi->host->node_id) * 64 + |
1650 | NODEID_TO_NODE(scsi_id->ne->nodeid)]; | ||
1671 | 1651 | ||
1672 | /* Bump down our speed if the user requested it */ | 1652 | /* Bump down our speed if the user requested it */ |
1673 | if (scsi_id->speed_code > max_speed) { | 1653 | if (scsi_id->speed_code > max_speed) { |
@@ -1678,15 +1658,16 @@ static int sbp2_max_speed_and_size(struct scsi_id_instance_data *scsi_id) | |||
1678 | 1658 | ||
1679 | /* Payload size is the lesser of what our speed supports and what | 1659 | /* Payload size is the lesser of what our speed supports and what |
1680 | * our host supports. */ | 1660 | * our host supports. */ |
1681 | scsi_id->max_payload_size = min(sbp2_speedto_max_payload[scsi_id->speed_code], | 1661 | scsi_id->max_payload_size = |
1682 | (u8)(hi->host->csr.max_rec - 1)); | 1662 | min(sbp2_speedto_max_payload[scsi_id->speed_code], |
1663 | (u8) (hi->host->csr.max_rec - 1)); | ||
1683 | 1664 | ||
1684 | HPSB_DEBUG("Node " NODE_BUS_FMT ": Max speed [%s] - Max payload [%u]", | 1665 | HPSB_DEBUG("Node " NODE_BUS_FMT ": Max speed [%s] - Max payload [%u]", |
1685 | NODE_BUS_ARGS(hi->host, scsi_id->ne->nodeid), | 1666 | NODE_BUS_ARGS(hi->host, scsi_id->ne->nodeid), |
1686 | hpsb_speedto_str[scsi_id->speed_code], | 1667 | hpsb_speedto_str[scsi_id->speed_code], |
1687 | 1 << ((u32)scsi_id->max_payload_size + 2)); | 1668 | 1 << ((u32) scsi_id->max_payload_size + 2)); |
1688 | 1669 | ||
1689 | return(0); | 1670 | return 0; |
1690 | } | 1671 | } |
1691 | 1672 | ||
1692 | /* | 1673 | /* |
@@ -1721,7 +1702,7 @@ static int sbp2_agent_reset(struct scsi_id_instance_data *scsi_id, int wait) | |||
1721 | */ | 1702 | */ |
1722 | scsi_id->last_orb = NULL; | 1703 | scsi_id->last_orb = NULL; |
1723 | 1704 | ||
1724 | return(0); | 1705 | return 0; |
1725 | } | 1706 | } |
1726 | 1707 | ||
1727 | /* | 1708 | /* |
@@ -1735,10 +1716,9 @@ static int sbp2_create_command_orb(struct scsi_id_instance_data *scsi_id, | |||
1735 | unsigned int scsi_request_bufflen, | 1716 | unsigned int scsi_request_bufflen, |
1736 | void *scsi_request_buffer, | 1717 | void *scsi_request_buffer, |
1737 | enum dma_data_direction dma_dir) | 1718 | enum dma_data_direction dma_dir) |
1738 | |||
1739 | { | 1719 | { |
1740 | struct sbp2scsi_host_info *hi = scsi_id->hi; | 1720 | struct sbp2scsi_host_info *hi = scsi_id->hi; |
1741 | struct scatterlist *sgpnt = (struct scatterlist *) scsi_request_buffer; | 1721 | struct scatterlist *sgpnt = (struct scatterlist *)scsi_request_buffer; |
1742 | struct sbp2_command_orb *command_orb = &command->command_orb; | 1722 | struct sbp2_command_orb *command_orb = &command->command_orb; |
1743 | struct sbp2_unrestricted_page_table *scatter_gather_element = | 1723 | struct sbp2_unrestricted_page_table *scatter_gather_element = |
1744 | &command->scatter_gather_element[0]; | 1724 | &command->scatter_gather_element[0]; |
@@ -1758,30 +1738,30 @@ static int sbp2_create_command_orb(struct scsi_id_instance_data *scsi_id, | |||
1758 | command_orb->next_ORB_lo = 0x0; | 1738 | command_orb->next_ORB_lo = 0x0; |
1759 | command_orb->misc = ORB_SET_MAX_PAYLOAD(scsi_id->max_payload_size); | 1739 | command_orb->misc = ORB_SET_MAX_PAYLOAD(scsi_id->max_payload_size); |
1760 | command_orb->misc |= ORB_SET_SPEED(scsi_id->speed_code); | 1740 | command_orb->misc |= ORB_SET_SPEED(scsi_id->speed_code); |
1761 | command_orb->misc |= ORB_SET_NOTIFY(1); /* Notify us when complete */ | 1741 | command_orb->misc |= ORB_SET_NOTIFY(1); /* Notify us when complete */ |
1762 | 1742 | ||
1763 | /* | 1743 | /* |
1764 | * Get the direction of the transfer. If the direction is unknown, then use our | 1744 | * Get the direction of the transfer. If the direction is unknown, then use our |
1765 | * goofy table as a back-up. | 1745 | * goofy table as a back-up. |
1766 | */ | 1746 | */ |
1767 | switch (dma_dir) { | 1747 | switch (dma_dir) { |
1768 | case DMA_NONE: | 1748 | case DMA_NONE: |
1769 | orb_direction = ORB_DIRECTION_NO_DATA_TRANSFER; | 1749 | orb_direction = ORB_DIRECTION_NO_DATA_TRANSFER; |
1770 | break; | 1750 | break; |
1771 | case DMA_TO_DEVICE: | 1751 | case DMA_TO_DEVICE: |
1772 | orb_direction = ORB_DIRECTION_WRITE_TO_MEDIA; | 1752 | orb_direction = ORB_DIRECTION_WRITE_TO_MEDIA; |
1773 | break; | 1753 | break; |
1774 | case DMA_FROM_DEVICE: | 1754 | case DMA_FROM_DEVICE: |
1775 | orb_direction = ORB_DIRECTION_READ_FROM_MEDIA; | 1755 | orb_direction = ORB_DIRECTION_READ_FROM_MEDIA; |
1776 | break; | 1756 | break; |
1777 | case DMA_BIDIRECTIONAL: | 1757 | case DMA_BIDIRECTIONAL: |
1778 | default: | 1758 | default: |
1779 | SBP2_ERR("SCSI data transfer direction not specified. " | 1759 | SBP2_ERR("SCSI data transfer direction not specified. " |
1780 | "Update the SBP2 direction table in sbp2.h if " | 1760 | "Update the SBP2 direction table in sbp2.h if " |
1781 | "necessary for your application"); | 1761 | "necessary for your application"); |
1782 | __scsi_print_command(scsi_cmd); | 1762 | __scsi_print_command(scsi_cmd); |
1783 | orb_direction = sbp2scsi_direction_table[*scsi_cmd]; | 1763 | orb_direction = sbp2scsi_direction_table[*scsi_cmd]; |
1784 | break; | 1764 | break; |
1785 | } | 1765 | } |
1786 | 1766 | ||
1787 | /* | 1767 | /* |
@@ -1884,9 +1864,9 @@ static int sbp2_create_command_orb(struct scsi_id_instance_data *scsi_id, | |||
1884 | command->dma_dir = dma_dir; | 1864 | command->dma_dir = dma_dir; |
1885 | command->dma_size = scsi_request_bufflen; | 1865 | command->dma_size = scsi_request_bufflen; |
1886 | command->dma_type = CMD_DMA_SINGLE; | 1866 | command->dma_type = CMD_DMA_SINGLE; |
1887 | command->cmd_dma = pci_map_single (hi->host->pdev, scsi_request_buffer, | 1867 | command->cmd_dma = |
1888 | command->dma_size, | 1868 | pci_map_single(hi->host->pdev, scsi_request_buffer, |
1889 | command->dma_dir); | 1869 | command->dma_size, command->dma_dir); |
1890 | SBP2_DMA_ALLOC("single bulk"); | 1870 | SBP2_DMA_ALLOC("single bulk"); |
1891 | 1871 | ||
1892 | /* | 1872 | /* |
@@ -1973,7 +1953,7 @@ static int sbp2_create_command_orb(struct scsi_id_instance_data *scsi_id, | |||
1973 | memset(command_orb->cdb, 0, 12); | 1953 | memset(command_orb->cdb, 0, 12); |
1974 | memcpy(command_orb->cdb, scsi_cmd, COMMAND_SIZE(*scsi_cmd)); | 1954 | memcpy(command_orb->cdb, scsi_cmd, COMMAND_SIZE(*scsi_cmd)); |
1975 | 1955 | ||
1976 | return(0); | 1956 | return 0; |
1977 | } | 1957 | } |
1978 | 1958 | ||
1979 | /* | 1959 | /* |
@@ -1989,7 +1969,7 @@ static int sbp2_link_orb_command(struct scsi_id_instance_data *scsi_id, | |||
1989 | 1969 | ||
1990 | outstanding_orb_incr; | 1970 | outstanding_orb_incr; |
1991 | SBP2_ORB_DEBUG("sending command orb %p, total orbs = %x", | 1971 | SBP2_ORB_DEBUG("sending command orb %p, total orbs = %x", |
1992 | command_orb, global_outstanding_command_orbs); | 1972 | command_orb, global_outstanding_command_orbs); |
1993 | 1973 | ||
1994 | pci_dma_sync_single_for_device(hi->host->pdev, command->command_orb_dma, | 1974 | pci_dma_sync_single_for_device(hi->host->pdev, command->command_orb_dma, |
1995 | sizeof(struct sbp2_command_orb), | 1975 | sizeof(struct sbp2_command_orb), |
@@ -2034,10 +2014,11 @@ static int sbp2_link_orb_command(struct scsi_id_instance_data *scsi_id, | |||
2034 | * both by the sbp2 device and us. | 2014 | * both by the sbp2 device and us. |
2035 | */ | 2015 | */ |
2036 | scsi_id->last_orb->next_ORB_lo = | 2016 | scsi_id->last_orb->next_ORB_lo = |
2037 | cpu_to_be32(command->command_orb_dma); | 2017 | cpu_to_be32(command->command_orb_dma); |
2038 | /* Tells hardware that this pointer is valid */ | 2018 | /* Tells hardware that this pointer is valid */ |
2039 | scsi_id->last_orb->next_ORB_hi = 0x0; | 2019 | scsi_id->last_orb->next_ORB_hi = 0x0; |
2040 | pci_dma_sync_single_for_device(hi->host->pdev, scsi_id->last_orb_dma, | 2020 | pci_dma_sync_single_for_device(hi->host->pdev, |
2021 | scsi_id->last_orb_dma, | ||
2041 | sizeof(struct sbp2_command_orb), | 2022 | sizeof(struct sbp2_command_orb), |
2042 | PCI_DMA_BIDIRECTIONAL); | 2023 | PCI_DMA_BIDIRECTIONAL); |
2043 | 2024 | ||
@@ -2051,14 +2032,14 @@ static int sbp2_link_orb_command(struct scsi_id_instance_data *scsi_id, | |||
2051 | 2032 | ||
2052 | if (sbp2util_node_write_no_wait(ne, addr, &data, 4) < 0) { | 2033 | if (sbp2util_node_write_no_wait(ne, addr, &data, 4) < 0) { |
2053 | SBP2_ERR("sbp2util_node_write_no_wait failed"); | 2034 | SBP2_ERR("sbp2util_node_write_no_wait failed"); |
2054 | return(-EIO); | 2035 | return -EIO; |
2055 | } | 2036 | } |
2056 | 2037 | ||
2057 | scsi_id->last_orb = command_orb; | 2038 | scsi_id->last_orb = command_orb; |
2058 | scsi_id->last_orb_dma = command->command_orb_dma; | 2039 | scsi_id->last_orb_dma = command->command_orb_dma; |
2059 | 2040 | ||
2060 | } | 2041 | } |
2061 | return(0); | 2042 | return 0; |
2062 | } | 2043 | } |
2063 | 2044 | ||
2064 | /* | 2045 | /* |
@@ -2085,7 +2066,7 @@ static int sbp2_send_command(struct scsi_id_instance_data *scsi_id, | |||
2085 | */ | 2066 | */ |
2086 | command = sbp2util_allocate_command_orb(scsi_id, SCpnt, done); | 2067 | command = sbp2util_allocate_command_orb(scsi_id, SCpnt, done); |
2087 | if (!command) { | 2068 | if (!command) { |
2088 | return(-EIO); | 2069 | return -EIO; |
2089 | } | 2070 | } |
2090 | 2071 | ||
2091 | /* | 2072 | /* |
@@ -2106,11 +2087,6 @@ static int sbp2_send_command(struct scsi_id_instance_data *scsi_id, | |||
2106 | sbp2_create_command_orb(scsi_id, command, cmd, SCpnt->use_sg, | 2087 | sbp2_create_command_orb(scsi_id, command, cmd, SCpnt->use_sg, |
2107 | request_bufflen, SCpnt->request_buffer, | 2088 | request_bufflen, SCpnt->request_buffer, |
2108 | SCpnt->sc_data_direction); | 2089 | SCpnt->sc_data_direction); |
2109 | /* | ||
2110 | * Update our cdb if necessary (to handle sbp2 RBC command set | ||
2111 | * differences). This is where the command set hacks go! =) | ||
2112 | */ | ||
2113 | sbp2_check_sbp2_command(scsi_id, command->command_orb.cdb); | ||
2114 | 2090 | ||
2115 | sbp2util_packet_dump(&command->command_orb, sizeof(struct sbp2_command_orb), | 2091 | sbp2util_packet_dump(&command->command_orb, sizeof(struct sbp2_command_orb), |
2116 | "sbp2 command orb", command->command_orb_dma); | 2092 | "sbp2 command orb", command->command_orb_dma); |
@@ -2125,112 +2101,7 @@ static int sbp2_send_command(struct scsi_id_instance_data *scsi_id, | |||
2125 | */ | 2101 | */ |
2126 | sbp2_link_orb_command(scsi_id, command); | 2102 | sbp2_link_orb_command(scsi_id, command); |
2127 | 2103 | ||
2128 | return(0); | 2104 | return 0; |
2129 | } | ||
2130 | |||
2131 | |||
2132 | /* | ||
2133 | * This function deals with command set differences between Linux scsi | ||
2134 | * command set and sbp2 RBC command set. | ||
2135 | */ | ||
2136 | static void sbp2_check_sbp2_command(struct scsi_id_instance_data *scsi_id, unchar *cmd) | ||
2137 | { | ||
2138 | unchar new_cmd[16]; | ||
2139 | u8 device_type = SBP2_DEVICE_TYPE (scsi_id->sbp2_device_type_and_lun); | ||
2140 | |||
2141 | SBP2_DEBUG("sbp2_check_sbp2_command"); | ||
2142 | |||
2143 | switch (*cmd) { | ||
2144 | |||
2145 | case READ_6: | ||
2146 | |||
2147 | if (sbp2_command_conversion_device_type(device_type)) { | ||
2148 | |||
2149 | SBP2_DEBUG("Convert READ_6 to READ_10"); | ||
2150 | |||
2151 | /* | ||
2152 | * Need to turn read_6 into read_10 | ||
2153 | */ | ||
2154 | new_cmd[0] = 0x28; | ||
2155 | new_cmd[1] = (cmd[1] & 0xe0); | ||
2156 | new_cmd[2] = 0x0; | ||
2157 | new_cmd[3] = (cmd[1] & 0x1f); | ||
2158 | new_cmd[4] = cmd[2]; | ||
2159 | new_cmd[5] = cmd[3]; | ||
2160 | new_cmd[6] = 0x0; | ||
2161 | new_cmd[7] = 0x0; | ||
2162 | new_cmd[8] = cmd[4]; | ||
2163 | new_cmd[9] = cmd[5]; | ||
2164 | |||
2165 | memcpy(cmd, new_cmd, 10); | ||
2166 | |||
2167 | } | ||
2168 | |||
2169 | break; | ||
2170 | |||
2171 | case WRITE_6: | ||
2172 | |||
2173 | if (sbp2_command_conversion_device_type(device_type)) { | ||
2174 | |||
2175 | SBP2_DEBUG("Convert WRITE_6 to WRITE_10"); | ||
2176 | |||
2177 | /* | ||
2178 | * Need to turn write_6 into write_10 | ||
2179 | */ | ||
2180 | new_cmd[0] = 0x2a; | ||
2181 | new_cmd[1] = (cmd[1] & 0xe0); | ||
2182 | new_cmd[2] = 0x0; | ||
2183 | new_cmd[3] = (cmd[1] & 0x1f); | ||
2184 | new_cmd[4] = cmd[2]; | ||
2185 | new_cmd[5] = cmd[3]; | ||
2186 | new_cmd[6] = 0x0; | ||
2187 | new_cmd[7] = 0x0; | ||
2188 | new_cmd[8] = cmd[4]; | ||
2189 | new_cmd[9] = cmd[5]; | ||
2190 | |||
2191 | memcpy(cmd, new_cmd, 10); | ||
2192 | |||
2193 | } | ||
2194 | |||
2195 | break; | ||
2196 | |||
2197 | case MODE_SENSE: | ||
2198 | |||
2199 | if (sbp2_command_conversion_device_type(device_type)) { | ||
2200 | |||
2201 | SBP2_DEBUG("Convert MODE_SENSE_6 to MODE_SENSE_10"); | ||
2202 | |||
2203 | /* | ||
2204 | * Need to turn mode_sense_6 into mode_sense_10 | ||
2205 | */ | ||
2206 | new_cmd[0] = 0x5a; | ||
2207 | new_cmd[1] = cmd[1]; | ||
2208 | new_cmd[2] = cmd[2]; | ||
2209 | new_cmd[3] = 0x0; | ||
2210 | new_cmd[4] = 0x0; | ||
2211 | new_cmd[5] = 0x0; | ||
2212 | new_cmd[6] = 0x0; | ||
2213 | new_cmd[7] = 0x0; | ||
2214 | new_cmd[8] = cmd[4]; | ||
2215 | new_cmd[9] = cmd[5]; | ||
2216 | |||
2217 | memcpy(cmd, new_cmd, 10); | ||
2218 | |||
2219 | } | ||
2220 | |||
2221 | break; | ||
2222 | |||
2223 | case MODE_SELECT: | ||
2224 | |||
2225 | /* | ||
2226 | * TODO. Probably need to change mode select to 10 byte version | ||
2227 | */ | ||
2228 | |||
2229 | default: | ||
2230 | break; | ||
2231 | } | ||
2232 | |||
2233 | return; | ||
2234 | } | 2105 | } |
2235 | 2106 | ||
2236 | /* | 2107 | /* |
@@ -2260,80 +2131,40 @@ static unsigned int sbp2_status_to_sense_data(unchar *sbp2_status, unchar *sense | |||
2260 | sense_data[14] = sbp2_status[20]; | 2131 | sense_data[14] = sbp2_status[20]; |
2261 | sense_data[15] = sbp2_status[21]; | 2132 | sense_data[15] = sbp2_status[21]; |
2262 | 2133 | ||
2263 | return(sbp2_status[8] & 0x3f); /* return scsi status */ | 2134 | return sbp2_status[8] & 0x3f; /* return scsi status */ |
2264 | } | 2135 | } |
2265 | 2136 | ||
2266 | /* | 2137 | /* |
2267 | * This function is called after a command is completed, in order to do any necessary SBP-2 | 2138 | * This function is called after a command is completed, in order to do any necessary SBP-2 |
2268 | * response data translations for the SCSI stack | 2139 | * response data translations for the SCSI stack |
2269 | */ | 2140 | */ |
2270 | static void sbp2_check_sbp2_response(struct scsi_id_instance_data *scsi_id, | 2141 | static void sbp2_check_sbp2_response(struct scsi_id_instance_data *scsi_id, |
2271 | struct scsi_cmnd *SCpnt) | 2142 | struct scsi_cmnd *SCpnt) |
2272 | { | 2143 | { |
2273 | u8 *scsi_buf = SCpnt->request_buffer; | 2144 | u8 *scsi_buf = SCpnt->request_buffer; |
2274 | u8 device_type = SBP2_DEVICE_TYPE (scsi_id->sbp2_device_type_and_lun); | ||
2275 | 2145 | ||
2276 | SBP2_DEBUG("sbp2_check_sbp2_response"); | 2146 | SBP2_DEBUG("sbp2_check_sbp2_response"); |
2277 | 2147 | ||
2278 | switch (SCpnt->cmnd[0]) { | 2148 | switch (SCpnt->cmnd[0]) { |
2279 | 2149 | ||
2280 | case INQUIRY: | 2150 | case INQUIRY: |
2281 | 2151 | /* | |
2282 | /* | 2152 | * Make sure data length is ok. Minimum length is 36 bytes |
2283 | * If scsi_id->sbp2_device_type_and_lun is uninitialized, then fill | 2153 | */ |
2284 | * this information in from the inquiry response data. Lun is set to zero. | 2154 | if (scsi_buf[4] == 0) { |
2285 | */ | 2155 | scsi_buf[4] = 36 - 5; |
2286 | if (scsi_id->sbp2_device_type_and_lun == SBP2_DEVICE_TYPE_LUN_UNINITIALIZED) { | 2156 | } |
2287 | SBP2_DEBUG("Creating sbp2_device_type_and_lun from scsi inquiry data"); | ||
2288 | scsi_id->sbp2_device_type_and_lun = (scsi_buf[0] & 0x1f) << 16; | ||
2289 | } | ||
2290 | |||
2291 | /* | ||
2292 | * Make sure data length is ok. Minimum length is 36 bytes | ||
2293 | */ | ||
2294 | if (scsi_buf[4] == 0) { | ||
2295 | scsi_buf[4] = 36 - 5; | ||
2296 | } | ||
2297 | |||
2298 | /* | ||
2299 | * Check for Simple Direct Access Device and change it to TYPE_DISK | ||
2300 | */ | ||
2301 | if ((scsi_buf[0] & 0x1f) == TYPE_RBC) { | ||
2302 | SBP2_DEBUG("Changing TYPE_RBC to TYPE_DISK"); | ||
2303 | scsi_buf[0] &= 0xe0; | ||
2304 | } | ||
2305 | |||
2306 | /* | ||
2307 | * Fix ansi revision and response data format | ||
2308 | */ | ||
2309 | scsi_buf[2] |= 2; | ||
2310 | scsi_buf[3] = (scsi_buf[3] & 0xf0) | 2; | ||
2311 | |||
2312 | break; | ||
2313 | |||
2314 | case MODE_SENSE: | ||
2315 | |||
2316 | if (sbp2_command_conversion_device_type(device_type)) { | ||
2317 | |||
2318 | SBP2_DEBUG("Modify mode sense response (10 byte version)"); | ||
2319 | |||
2320 | scsi_buf[0] = scsi_buf[1]; /* Mode data length */ | ||
2321 | scsi_buf[1] = scsi_buf[2]; /* Medium type */ | ||
2322 | scsi_buf[2] = scsi_buf[3]; /* Device specific parameter */ | ||
2323 | scsi_buf[3] = scsi_buf[7]; /* Block descriptor length */ | ||
2324 | memcpy(scsi_buf + 4, scsi_buf + 8, scsi_buf[0]); | ||
2325 | } | ||
2326 | |||
2327 | break; | ||
2328 | 2157 | ||
2329 | case MODE_SELECT: | 2158 | /* |
2159 | * Fix ansi revision and response data format | ||
2160 | */ | ||
2161 | scsi_buf[2] |= 2; | ||
2162 | scsi_buf[3] = (scsi_buf[3] & 0xf0) | 2; | ||
2330 | 2163 | ||
2331 | /* | 2164 | break; |
2332 | * TODO. Probably need to change mode select to 10 byte version | ||
2333 | */ | ||
2334 | 2165 | ||
2335 | default: | 2166 | default: |
2336 | break; | 2167 | break; |
2337 | } | 2168 | } |
2338 | return; | 2169 | return; |
2339 | } | 2170 | } |
@@ -2358,14 +2189,14 @@ static int sbp2_handle_status_write(struct hpsb_host *host, int nodeid, int dest | |||
2358 | 2189 | ||
2359 | if (!host) { | 2190 | if (!host) { |
2360 | SBP2_ERR("host is NULL - this is bad!"); | 2191 | SBP2_ERR("host is NULL - this is bad!"); |
2361 | return(RCODE_ADDRESS_ERROR); | 2192 | return RCODE_ADDRESS_ERROR; |
2362 | } | 2193 | } |
2363 | 2194 | ||
2364 | hi = hpsb_get_hostinfo(&sbp2_highlevel, host); | 2195 | hi = hpsb_get_hostinfo(&sbp2_highlevel, host); |
2365 | 2196 | ||
2366 | if (!hi) { | 2197 | if (!hi) { |
2367 | SBP2_ERR("host info is NULL - this is bad!"); | 2198 | SBP2_ERR("host info is NULL - this is bad!"); |
2368 | return(RCODE_ADDRESS_ERROR); | 2199 | return RCODE_ADDRESS_ERROR; |
2369 | } | 2200 | } |
2370 | 2201 | ||
2371 | /* | 2202 | /* |
@@ -2382,7 +2213,7 @@ static int sbp2_handle_status_write(struct hpsb_host *host, int nodeid, int dest | |||
2382 | 2213 | ||
2383 | if (!scsi_id) { | 2214 | if (!scsi_id) { |
2384 | SBP2_ERR("scsi_id is NULL - device is gone?"); | 2215 | SBP2_ERR("scsi_id is NULL - device is gone?"); |
2385 | return(RCODE_ADDRESS_ERROR); | 2216 | return RCODE_ADDRESS_ERROR; |
2386 | } | 2217 | } |
2387 | 2218 | ||
2388 | /* | 2219 | /* |
@@ -2480,10 +2311,9 @@ static int sbp2_handle_status_write(struct hpsb_host *host, int nodeid, int dest | |||
2480 | SBP2_ORB_DEBUG("command orb completed"); | 2311 | SBP2_ORB_DEBUG("command orb completed"); |
2481 | } | 2312 | } |
2482 | 2313 | ||
2483 | return(RCODE_COMPLETE); | 2314 | return RCODE_COMPLETE; |
2484 | } | 2315 | } |
2485 | 2316 | ||
2486 | |||
2487 | /************************************** | 2317 | /************************************** |
2488 | * SCSI interface related section | 2318 | * SCSI interface related section |
2489 | **************************************/ | 2319 | **************************************/ |
@@ -2616,55 +2446,56 @@ static void sbp2scsi_complete_command(struct scsi_id_instance_data *scsi_id, | |||
2616 | * complete the command, just let it get retried at the end of the | 2446 | * complete the command, just let it get retried at the end of the |
2617 | * bus reset. | 2447 | * bus reset. |
2618 | */ | 2448 | */ |
2619 | if (!hpsb_node_entry_valid(scsi_id->ne) && (scsi_status != SBP2_SCSI_STATUS_GOOD)) { | 2449 | if (!hpsb_node_entry_valid(scsi_id->ne) |
2450 | && (scsi_status != SBP2_SCSI_STATUS_GOOD)) { | ||
2620 | SBP2_ERR("Bus reset in progress - retry command later"); | 2451 | SBP2_ERR("Bus reset in progress - retry command later"); |
2621 | return; | 2452 | return; |
2622 | } | 2453 | } |
2623 | 2454 | ||
2624 | /* | 2455 | /* |
2625 | * Switch on scsi status | 2456 | * Switch on scsi status |
2626 | */ | 2457 | */ |
2627 | switch (scsi_status) { | 2458 | switch (scsi_status) { |
2628 | case SBP2_SCSI_STATUS_GOOD: | 2459 | case SBP2_SCSI_STATUS_GOOD: |
2629 | SCpnt->result = DID_OK; | 2460 | SCpnt->result = DID_OK; |
2630 | break; | 2461 | break; |
2631 | 2462 | ||
2632 | case SBP2_SCSI_STATUS_BUSY: | 2463 | case SBP2_SCSI_STATUS_BUSY: |
2633 | SBP2_ERR("SBP2_SCSI_STATUS_BUSY"); | 2464 | SBP2_ERR("SBP2_SCSI_STATUS_BUSY"); |
2634 | SCpnt->result = DID_BUS_BUSY << 16; | 2465 | SCpnt->result = DID_BUS_BUSY << 16; |
2635 | break; | 2466 | break; |
2636 | 2467 | ||
2637 | case SBP2_SCSI_STATUS_CHECK_CONDITION: | 2468 | case SBP2_SCSI_STATUS_CHECK_CONDITION: |
2638 | SBP2_DEBUG("SBP2_SCSI_STATUS_CHECK_CONDITION"); | 2469 | SBP2_DEBUG("SBP2_SCSI_STATUS_CHECK_CONDITION"); |
2639 | SCpnt->result = CHECK_CONDITION << 1; | 2470 | SCpnt->result = CHECK_CONDITION << 1; |
2640 | 2471 | ||
2641 | /* | 2472 | /* |
2642 | * Debug stuff | 2473 | * Debug stuff |
2643 | */ | 2474 | */ |
2644 | #if CONFIG_IEEE1394_SBP2_DEBUG >= 1 | 2475 | #if CONFIG_IEEE1394_SBP2_DEBUG >= 1 |
2645 | scsi_print_command(SCpnt); | 2476 | scsi_print_command(SCpnt); |
2646 | scsi_print_sense("bh", SCpnt); | 2477 | scsi_print_sense("bh", SCpnt); |
2647 | #endif | 2478 | #endif |
2648 | 2479 | ||
2649 | break; | 2480 | break; |
2650 | 2481 | ||
2651 | case SBP2_SCSI_STATUS_SELECTION_TIMEOUT: | 2482 | case SBP2_SCSI_STATUS_SELECTION_TIMEOUT: |
2652 | SBP2_ERR("SBP2_SCSI_STATUS_SELECTION_TIMEOUT"); | 2483 | SBP2_ERR("SBP2_SCSI_STATUS_SELECTION_TIMEOUT"); |
2653 | SCpnt->result = DID_NO_CONNECT << 16; | 2484 | SCpnt->result = DID_NO_CONNECT << 16; |
2654 | scsi_print_command(SCpnt); | 2485 | scsi_print_command(SCpnt); |
2655 | break; | 2486 | break; |
2656 | 2487 | ||
2657 | case SBP2_SCSI_STATUS_CONDITION_MET: | 2488 | case SBP2_SCSI_STATUS_CONDITION_MET: |
2658 | case SBP2_SCSI_STATUS_RESERVATION_CONFLICT: | 2489 | case SBP2_SCSI_STATUS_RESERVATION_CONFLICT: |
2659 | case SBP2_SCSI_STATUS_COMMAND_TERMINATED: | 2490 | case SBP2_SCSI_STATUS_COMMAND_TERMINATED: |
2660 | SBP2_ERR("Bad SCSI status = %x", scsi_status); | 2491 | SBP2_ERR("Bad SCSI status = %x", scsi_status); |
2661 | SCpnt->result = DID_ERROR << 16; | 2492 | SCpnt->result = DID_ERROR << 16; |
2662 | scsi_print_command(SCpnt); | 2493 | scsi_print_command(SCpnt); |
2663 | break; | 2494 | break; |
2664 | 2495 | ||
2665 | default: | 2496 | default: |
2666 | SBP2_ERR("Unsupported SCSI status = %x", scsi_status); | 2497 | SBP2_ERR("Unsupported SCSI status = %x", scsi_status); |
2667 | SCpnt->result = DID_ERROR << 16; | 2498 | SCpnt->result = DID_ERROR << 16; |
2668 | } | 2499 | } |
2669 | 2500 | ||
2670 | /* | 2501 | /* |
@@ -2678,7 +2509,8 @@ static void sbp2scsi_complete_command(struct scsi_id_instance_data *scsi_id, | |||
2678 | * If a bus reset is in progress and there was an error, complete | 2509 | * If a bus reset is in progress and there was an error, complete |
2679 | * the command as busy so that it will get retried. | 2510 | * the command as busy so that it will get retried. |
2680 | */ | 2511 | */ |
2681 | if (!hpsb_node_entry_valid(scsi_id->ne) && (scsi_status != SBP2_SCSI_STATUS_GOOD)) { | 2512 | if (!hpsb_node_entry_valid(scsi_id->ne) |
2513 | && (scsi_status != SBP2_SCSI_STATUS_GOOD)) { | ||
2682 | SBP2_ERR("Completing command with busy (bus reset)"); | 2514 | SBP2_ERR("Completing command with busy (bus reset)"); |
2683 | SCpnt->result = DID_BUS_BUSY << 16; | 2515 | SCpnt->result = DID_BUS_BUSY << 16; |
2684 | } | 2516 | } |
@@ -2699,31 +2531,29 @@ static void sbp2scsi_complete_command(struct scsi_id_instance_data *scsi_id, | |||
2699 | /* | 2531 | /* |
2700 | * Tell scsi stack that we're done with this command | 2532 | * Tell scsi stack that we're done with this command |
2701 | */ | 2533 | */ |
2702 | done (SCpnt); | 2534 | done(SCpnt); |
2703 | } | 2535 | } |
2704 | 2536 | ||
2705 | |||
2706 | static int sbp2scsi_slave_alloc(struct scsi_device *sdev) | 2537 | static int sbp2scsi_slave_alloc(struct scsi_device *sdev) |
2707 | { | 2538 | { |
2708 | ((struct scsi_id_instance_data *)sdev->host->hostdata[0])->sdev = sdev; | 2539 | ((struct scsi_id_instance_data *)sdev->host->hostdata[0])->sdev = sdev; |
2709 | return 0; | 2540 | return 0; |
2710 | } | 2541 | } |
2711 | 2542 | ||
2712 | |||
2713 | static int sbp2scsi_slave_configure(struct scsi_device *sdev) | 2543 | static int sbp2scsi_slave_configure(struct scsi_device *sdev) |
2714 | { | 2544 | { |
2715 | blk_queue_dma_alignment(sdev->request_queue, (512 - 1)); | 2545 | blk_queue_dma_alignment(sdev->request_queue, (512 - 1)); |
2546 | sdev->use_10_for_rw = 1; | ||
2547 | sdev->use_10_for_ms = 1; | ||
2716 | return 0; | 2548 | return 0; |
2717 | } | 2549 | } |
2718 | 2550 | ||
2719 | |||
2720 | static void sbp2scsi_slave_destroy(struct scsi_device *sdev) | 2551 | static void sbp2scsi_slave_destroy(struct scsi_device *sdev) |
2721 | { | 2552 | { |
2722 | ((struct scsi_id_instance_data *)sdev->host->hostdata[0])->sdev = NULL; | 2553 | ((struct scsi_id_instance_data *)sdev->host->hostdata[0])->sdev = NULL; |
2723 | return; | 2554 | return; |
2724 | } | 2555 | } |
2725 | 2556 | ||
2726 | |||
2727 | /* | 2557 | /* |
2728 | * Called by scsi stack when something has really gone wrong. Usually | 2558 | * Called by scsi stack when something has really gone wrong. Usually |
2729 | * called when a command has timed-out for some reason. | 2559 | * called when a command has timed-out for some reason. |
@@ -2769,7 +2599,7 @@ static int sbp2scsi_abort(struct scsi_cmnd *SCpnt) | |||
2769 | sbp2scsi_complete_all_commands(scsi_id, DID_BUS_BUSY); | 2599 | sbp2scsi_complete_all_commands(scsi_id, DID_BUS_BUSY); |
2770 | } | 2600 | } |
2771 | 2601 | ||
2772 | return(SUCCESS); | 2602 | return SUCCESS; |
2773 | } | 2603 | } |
2774 | 2604 | ||
2775 | /* | 2605 | /* |
@@ -2779,28 +2609,20 @@ static int sbp2scsi_reset(struct scsi_cmnd *SCpnt) | |||
2779 | { | 2609 | { |
2780 | struct scsi_id_instance_data *scsi_id = | 2610 | struct scsi_id_instance_data *scsi_id = |
2781 | (struct scsi_id_instance_data *)SCpnt->device->host->hostdata[0]; | 2611 | (struct scsi_id_instance_data *)SCpnt->device->host->hostdata[0]; |
2782 | unsigned long flags; | ||
2783 | 2612 | ||
2784 | SBP2_ERR("reset requested"); | 2613 | SBP2_ERR("reset requested"); |
2785 | 2614 | ||
2786 | spin_lock_irqsave(SCpnt->device->host->host_lock, flags); | ||
2787 | |||
2788 | if (sbp2util_node_is_available(scsi_id)) { | 2615 | if (sbp2util_node_is_available(scsi_id)) { |
2789 | SBP2_ERR("Generating sbp2 fetch agent reset"); | 2616 | SBP2_ERR("Generating sbp2 fetch agent reset"); |
2790 | sbp2_agent_reset(scsi_id, 0); | 2617 | sbp2_agent_reset(scsi_id, 0); |
2791 | } | 2618 | } |
2792 | 2619 | ||
2793 | spin_unlock_irqrestore(SCpnt->device->host->host_lock, flags); | ||
2794 | |||
2795 | return SUCCESS; | 2620 | return SUCCESS; |
2796 | } | 2621 | } |
2797 | 2622 | ||
2798 | static const char *sbp2scsi_info (struct Scsi_Host *host) | 2623 | static ssize_t sbp2_sysfs_ieee1394_id_show(struct device *dev, |
2799 | { | 2624 | struct device_attribute *attr, |
2800 | return "SCSI emulation for IEEE-1394 SBP-2 Devices"; | 2625 | char *buf) |
2801 | } | ||
2802 | |||
2803 | static ssize_t sbp2_sysfs_ieee1394_id_show(struct device *dev, struct device_attribute *attr, char *buf) | ||
2804 | { | 2626 | { |
2805 | struct scsi_device *sdev; | 2627 | struct scsi_device *sdev; |
2806 | struct scsi_id_instance_data *scsi_id; | 2628 | struct scsi_id_instance_data *scsi_id; |
@@ -2812,10 +2634,7 @@ static ssize_t sbp2_sysfs_ieee1394_id_show(struct device *dev, struct device_att | |||
2812 | if (!(scsi_id = (struct scsi_id_instance_data *)sdev->host->hostdata[0])) | 2634 | if (!(scsi_id = (struct scsi_id_instance_data *)sdev->host->hostdata[0])) |
2813 | return 0; | 2635 | return 0; |
2814 | 2636 | ||
2815 | if (scsi_id->sbp2_device_type_and_lun == SBP2_DEVICE_TYPE_LUN_UNINITIALIZED) | 2637 | lun = ORB_SET_LUN(scsi_id->sbp2_lun); |
2816 | lun = 0; | ||
2817 | else | ||
2818 | lun = ORB_SET_LUN(scsi_id->sbp2_device_type_and_lun); | ||
2819 | 2638 | ||
2820 | return sprintf(buf, "%016Lx:%d:%d\n", (unsigned long long)scsi_id->ne->guid, | 2639 | return sprintf(buf, "%016Lx:%d:%d\n", (unsigned long long)scsi_id->ne->guid, |
2821 | scsi_id->ud->id, lun); | 2640 | scsi_id->ud->id, lun); |
@@ -2837,12 +2656,9 @@ static struct scsi_host_template scsi_driver_template = { | |||
2837 | .module = THIS_MODULE, | 2656 | .module = THIS_MODULE, |
2838 | .name = "SBP-2 IEEE-1394", | 2657 | .name = "SBP-2 IEEE-1394", |
2839 | .proc_name = SBP2_DEVICE_NAME, | 2658 | .proc_name = SBP2_DEVICE_NAME, |
2840 | .info = sbp2scsi_info, | ||
2841 | .queuecommand = sbp2scsi_queuecommand, | 2659 | .queuecommand = sbp2scsi_queuecommand, |
2842 | .eh_abort_handler = sbp2scsi_abort, | 2660 | .eh_abort_handler = sbp2scsi_abort, |
2843 | .eh_device_reset_handler = sbp2scsi_reset, | 2661 | .eh_device_reset_handler = sbp2scsi_reset, |
2844 | .eh_bus_reset_handler = sbp2scsi_reset, | ||
2845 | .eh_host_reset_handler = sbp2scsi_reset, | ||
2846 | .slave_alloc = sbp2scsi_slave_alloc, | 2662 | .slave_alloc = sbp2scsi_slave_alloc, |
2847 | .slave_configure = sbp2scsi_slave_configure, | 2663 | .slave_configure = sbp2scsi_slave_configure, |
2848 | .slave_destroy = sbp2scsi_slave_destroy, | 2664 | .slave_destroy = sbp2scsi_slave_destroy, |
@@ -2861,8 +2677,6 @@ static int sbp2_module_init(void) | |||
2861 | 2677 | ||
2862 | SBP2_DEBUG("sbp2_module_init"); | 2678 | SBP2_DEBUG("sbp2_module_init"); |
2863 | 2679 | ||
2864 | printk(KERN_INFO "sbp2: %s\n", version); | ||
2865 | |||
2866 | /* Module load debug option to force one command at a time (serializing I/O) */ | 2680 | /* Module load debug option to force one command at a time (serializing I/O) */ |
2867 | if (serialize_io) { | 2681 | if (serialize_io) { |
2868 | SBP2_INFO("Driver forced to serialize I/O (serialize_io=1)"); | 2682 | SBP2_INFO("Driver forced to serialize I/O (serialize_io=1)"); |
@@ -2874,7 +2688,6 @@ static int sbp2_module_init(void) | |||
2874 | /* Set max sectors (module load option). Default is 255 sectors. */ | 2688 | /* Set max sectors (module load option). Default is 255 sectors. */ |
2875 | scsi_driver_template.max_sectors = max_sectors; | 2689 | scsi_driver_template.max_sectors = max_sectors; |
2876 | 2690 | ||
2877 | |||
2878 | /* Register our high level driver with 1394 stack */ | 2691 | /* Register our high level driver with 1394 stack */ |
2879 | hpsb_register_highlevel(&sbp2_highlevel); | 2692 | hpsb_register_highlevel(&sbp2_highlevel); |
2880 | 2693 | ||
diff --git a/drivers/ieee1394/sbp2.h b/drivers/ieee1394/sbp2.h index cd425be74841..abc647bae5b1 100644 --- a/drivers/ieee1394/sbp2.h +++ b/drivers/ieee1394/sbp2.h | |||
@@ -119,8 +119,8 @@ struct sbp2_query_logins_response { | |||
119 | struct sbp2_reconnect_orb { | 119 | struct sbp2_reconnect_orb { |
120 | u32 reserved1; | 120 | u32 reserved1; |
121 | u32 reserved2; | 121 | u32 reserved2; |
122 | u32 reserved3; | 122 | u32 reserved3; |
123 | u32 reserved4; | 123 | u32 reserved4; |
124 | u32 login_ID_misc; | 124 | u32 login_ID_misc; |
125 | u32 reserved5; | 125 | u32 reserved5; |
126 | u32 status_FIFO_hi; | 126 | u32 status_FIFO_hi; |
@@ -130,8 +130,8 @@ struct sbp2_reconnect_orb { | |||
130 | struct sbp2_logout_orb { | 130 | struct sbp2_logout_orb { |
131 | u32 reserved1; | 131 | u32 reserved1; |
132 | u32 reserved2; | 132 | u32 reserved2; |
133 | u32 reserved3; | 133 | u32 reserved3; |
134 | u32 reserved4; | 134 | u32 reserved4; |
135 | u32 login_ID_misc; | 135 | u32 login_ID_misc; |
136 | u32 reserved5; | 136 | u32 reserved5; |
137 | u32 status_FIFO_hi; | 137 | u32 status_FIFO_hi; |
@@ -188,7 +188,7 @@ struct sbp2_unrestricted_page_table { | |||
188 | struct sbp2_status_block { | 188 | struct sbp2_status_block { |
189 | u32 ORB_offset_hi_misc; | 189 | u32 ORB_offset_hi_misc; |
190 | u32 ORB_offset_lo; | 190 | u32 ORB_offset_lo; |
191 | u8 command_set_dependent[24]; | 191 | u8 command_set_dependent[24]; |
192 | }; | 192 | }; |
193 | 193 | ||
194 | /* | 194 | /* |
@@ -211,7 +211,7 @@ struct sbp2_status_block { | |||
211 | * specified for write posting, where the ohci controller will | 211 | * specified for write posting, where the ohci controller will |
212 | * automatically send an ack_complete when the status is written by the | 212 | * automatically send an ack_complete when the status is written by the |
213 | * sbp2 device... saving a split transaction. =) | 213 | * sbp2 device... saving a split transaction. =) |
214 | */ | 214 | */ |
215 | #define SBP2_STATUS_FIFO_ADDRESS 0xfffe00000000ULL | 215 | #define SBP2_STATUS_FIFO_ADDRESS 0xfffe00000000ULL |
216 | #define SBP2_STATUS_FIFO_ADDRESS_HI 0xfffe | 216 | #define SBP2_STATUS_FIFO_ADDRESS_HI 0xfffe |
217 | #define SBP2_STATUS_FIFO_ADDRESS_LO 0x0 | 217 | #define SBP2_STATUS_FIFO_ADDRESS_LO 0x0 |
@@ -229,9 +229,6 @@ struct sbp2_status_block { | |||
229 | #define SBP2_DEVICE_TYPE_AND_LUN_KEY 0x14 | 229 | #define SBP2_DEVICE_TYPE_AND_LUN_KEY 0x14 |
230 | #define SBP2_FIRMWARE_REVISION_KEY 0x3c | 230 | #define SBP2_FIRMWARE_REVISION_KEY 0x3c |
231 | 231 | ||
232 | #define SBP2_DEVICE_TYPE(q) (((q) >> 16) & 0x1f) | ||
233 | #define SBP2_DEVICE_LUN(q) ((q) & 0xffff) | ||
234 | |||
235 | #define SBP2_AGENT_STATE_OFFSET 0x00ULL | 232 | #define SBP2_AGENT_STATE_OFFSET 0x00ULL |
236 | #define SBP2_AGENT_RESET_OFFSET 0x04ULL | 233 | #define SBP2_AGENT_RESET_OFFSET 0x04ULL |
237 | #define SBP2_ORB_POINTER_OFFSET 0x08ULL | 234 | #define SBP2_ORB_POINTER_OFFSET 0x08ULL |
@@ -256,8 +253,6 @@ struct sbp2_status_block { | |||
256 | */ | 253 | */ |
257 | #define SBP2_128KB_BROKEN_FIRMWARE 0xa0b800 | 254 | #define SBP2_128KB_BROKEN_FIRMWARE 0xa0b800 |
258 | 255 | ||
259 | #define SBP2_DEVICE_TYPE_LUN_UNINITIALIZED 0xffffffff | ||
260 | |||
261 | /* | 256 | /* |
262 | * SCSI specific stuff | 257 | * SCSI specific stuff |
263 | */ | 258 | */ |
@@ -338,10 +333,8 @@ struct sbp2_command_info { | |||
338 | #define SBP2_BREAKAGE_128K_MAX_TRANSFER 0x1 | 333 | #define SBP2_BREAKAGE_128K_MAX_TRANSFER 0x1 |
339 | #define SBP2_BREAKAGE_INQUIRY_HACK 0x2 | 334 | #define SBP2_BREAKAGE_INQUIRY_HACK 0x2 |
340 | 335 | ||
341 | |||
342 | struct sbp2scsi_host_info; | 336 | struct sbp2scsi_host_info; |
343 | 337 | ||
344 | |||
345 | /* | 338 | /* |
346 | * Information needed on a per scsi id basis (one for each sbp2 device) | 339 | * Information needed on a per scsi id basis (one for each sbp2 device) |
347 | */ | 340 | */ |
@@ -379,7 +372,7 @@ struct scsi_id_instance_data { | |||
379 | u32 sbp2_command_set_spec_id; | 372 | u32 sbp2_command_set_spec_id; |
380 | u32 sbp2_command_set; | 373 | u32 sbp2_command_set; |
381 | u32 sbp2_unit_characteristics; | 374 | u32 sbp2_unit_characteristics; |
382 | u32 sbp2_device_type_and_lun; | 375 | u32 sbp2_lun; |
383 | u32 sbp2_firmware_revision; | 376 | u32 sbp2_firmware_revision; |
384 | 377 | ||
385 | /* | 378 | /* |
@@ -411,7 +404,6 @@ struct scsi_id_instance_data { | |||
411 | u32 workarounds; | 404 | u32 workarounds; |
412 | }; | 405 | }; |
413 | 406 | ||
414 | |||
415 | /* Sbp2 host data structure (one per IEEE1394 host) */ | 407 | /* Sbp2 host data structure (one per IEEE1394 host) */ |
416 | struct sbp2scsi_host_info { | 408 | struct sbp2scsi_host_info { |
417 | struct hpsb_host *host; /* IEEE1394 host */ | 409 | struct hpsb_host *host; /* IEEE1394 host */ |
@@ -469,7 +461,6 @@ static int sbp2_send_command(struct scsi_id_instance_data *scsi_id, | |||
469 | struct scsi_cmnd *SCpnt, | 461 | struct scsi_cmnd *SCpnt, |
470 | void (*done)(struct scsi_cmnd *)); | 462 | void (*done)(struct scsi_cmnd *)); |
471 | static unsigned int sbp2_status_to_sense_data(unchar *sbp2_status, unchar *sense_data); | 463 | static unsigned int sbp2_status_to_sense_data(unchar *sbp2_status, unchar *sense_data); |
472 | static void sbp2_check_sbp2_command(struct scsi_id_instance_data *scsi_id, unchar *cmd); | ||
473 | static void sbp2_check_sbp2_response(struct scsi_id_instance_data *scsi_id, | 464 | static void sbp2_check_sbp2_response(struct scsi_id_instance_data *scsi_id, |
474 | struct scsi_cmnd *SCpnt); | 465 | struct scsi_cmnd *SCpnt); |
475 | static void sbp2_parse_unit_directory(struct scsi_id_instance_data *scsi_id, | 466 | static void sbp2_parse_unit_directory(struct scsi_id_instance_data *scsi_id, |
diff --git a/drivers/ieee1394/video1394.c b/drivers/ieee1394/video1394.c index 23911da50154..608479b2df14 100644 --- a/drivers/ieee1394/video1394.c +++ b/drivers/ieee1394/video1394.c | |||
@@ -19,12 +19,6 @@ | |||
19 | * | 19 | * |
20 | * NOTES: | 20 | * NOTES: |
21 | * | 21 | * |
22 | * jds -- add private data to file to keep track of iso contexts associated | ||
23 | * with each open -- so release won't kill all iso transfers. | ||
24 | * | ||
25 | * Damien Douxchamps: Fix failure when the number of DMA pages per frame is | ||
26 | * one. | ||
27 | * | ||
28 | * ioctl return codes: | 22 | * ioctl return codes: |
29 | * EFAULT is only for invalid address for the argp | 23 | * EFAULT is only for invalid address for the argp |
30 | * EINVAL for out of range values | 24 | * EINVAL for out of range values |
@@ -34,12 +28,6 @@ | |||
34 | * ENOTTY for unsupported ioctl request | 28 | * ENOTTY for unsupported ioctl request |
35 | * | 29 | * |
36 | */ | 30 | */ |
37 | |||
38 | /* Markus Tavenrath <speedygoo@speedygoo.de> : | ||
39 | - fixed checks for valid buffer-numbers in video1394_icotl | ||
40 | - changed the ways the dma prg's are used, now it's possible to use | ||
41 | even a single dma buffer | ||
42 | */ | ||
43 | #include <linux/config.h> | 31 | #include <linux/config.h> |
44 | #include <linux/kernel.h> | 32 | #include <linux/kernel.h> |
45 | #include <linux/list.h> | 33 | #include <linux/list.h> |
@@ -77,14 +65,6 @@ | |||
77 | 65 | ||
78 | #define ISO_CHANNELS 64 | 66 | #define ISO_CHANNELS 64 |
79 | 67 | ||
80 | #ifndef virt_to_page | ||
81 | #define virt_to_page(x) MAP_NR(x) | ||
82 | #endif | ||
83 | |||
84 | #ifndef vmalloc_32 | ||
85 | #define vmalloc_32(x) vmalloc(x) | ||
86 | #endif | ||
87 | |||
88 | struct it_dma_prg { | 68 | struct it_dma_prg { |
89 | struct dma_cmd begin; | 69 | struct dma_cmd begin; |
90 | quadlet_t data[4]; | 70 | quadlet_t data[4]; |
@@ -206,14 +186,12 @@ alloc_dma_iso_ctx(struct ti_ohci *ohci, int type, int num_desc, | |||
206 | struct dma_iso_ctx *d; | 186 | struct dma_iso_ctx *d; |
207 | int i; | 187 | int i; |
208 | 188 | ||
209 | d = kmalloc(sizeof(struct dma_iso_ctx), GFP_KERNEL); | 189 | d = kzalloc(sizeof(*d), GFP_KERNEL); |
210 | if (d == NULL) { | 190 | if (!d) { |
211 | PRINT(KERN_ERR, ohci->host->id, "Failed to allocate dma_iso_ctx"); | 191 | PRINT(KERN_ERR, ohci->host->id, "Failed to allocate dma_iso_ctx"); |
212 | return NULL; | 192 | return NULL; |
213 | } | 193 | } |
214 | 194 | ||
215 | memset(d, 0, sizeof *d); | ||
216 | |||
217 | d->ohci = ohci; | 195 | d->ohci = ohci; |
218 | d->type = type; | 196 | d->type = type; |
219 | d->channel = channel; | 197 | d->channel = channel; |
@@ -251,9 +229,8 @@ alloc_dma_iso_ctx(struct ti_ohci *ohci, int type, int num_desc, | |||
251 | } | 229 | } |
252 | d->ctx = d->iso_tasklet.context; | 230 | d->ctx = d->iso_tasklet.context; |
253 | 231 | ||
254 | d->prg_reg = kmalloc(d->num_desc * sizeof(struct dma_prog_region), | 232 | d->prg_reg = kmalloc(d->num_desc * sizeof(*d->prg_reg), GFP_KERNEL); |
255 | GFP_KERNEL); | 233 | if (!d->prg_reg) { |
256 | if (d->prg_reg == NULL) { | ||
257 | PRINT(KERN_ERR, ohci->host->id, "Failed to allocate ir prg regs"); | 234 | PRINT(KERN_ERR, ohci->host->id, "Failed to allocate ir prg regs"); |
258 | free_dma_iso_ctx(d); | 235 | free_dma_iso_ctx(d); |
259 | return NULL; | 236 | return NULL; |
@@ -268,15 +245,14 @@ alloc_dma_iso_ctx(struct ti_ohci *ohci, int type, int num_desc, | |||
268 | d->cmdPtr = OHCI1394_IsoRcvCommandPtr+32*d->ctx; | 245 | d->cmdPtr = OHCI1394_IsoRcvCommandPtr+32*d->ctx; |
269 | d->ctxMatch = OHCI1394_IsoRcvContextMatch+32*d->ctx; | 246 | d->ctxMatch = OHCI1394_IsoRcvContextMatch+32*d->ctx; |
270 | 247 | ||
271 | d->ir_prg = kmalloc(d->num_desc * sizeof(struct dma_cmd *), | 248 | d->ir_prg = kzalloc(d->num_desc * sizeof(*d->ir_prg), |
272 | GFP_KERNEL); | 249 | GFP_KERNEL); |
273 | 250 | ||
274 | if (d->ir_prg == NULL) { | 251 | if (!d->ir_prg) { |
275 | PRINT(KERN_ERR, ohci->host->id, "Failed to allocate dma ir prg"); | 252 | PRINT(KERN_ERR, ohci->host->id, "Failed to allocate dma ir prg"); |
276 | free_dma_iso_ctx(d); | 253 | free_dma_iso_ctx(d); |
277 | return NULL; | 254 | return NULL; |
278 | } | 255 | } |
279 | memset(d->ir_prg, 0, d->num_desc * sizeof(struct dma_cmd *)); | ||
280 | 256 | ||
281 | d->nb_cmd = d->buf_size / PAGE_SIZE + 1; | 257 | d->nb_cmd = d->buf_size / PAGE_SIZE + 1; |
282 | d->left_size = (d->frame_size % PAGE_SIZE) ? | 258 | d->left_size = (d->frame_size % PAGE_SIZE) ? |
@@ -297,16 +273,15 @@ alloc_dma_iso_ctx(struct ti_ohci *ohci, int type, int num_desc, | |||
297 | d->ctrlClear = OHCI1394_IsoXmitContextControlClear+16*d->ctx; | 273 | d->ctrlClear = OHCI1394_IsoXmitContextControlClear+16*d->ctx; |
298 | d->cmdPtr = OHCI1394_IsoXmitCommandPtr+16*d->ctx; | 274 | d->cmdPtr = OHCI1394_IsoXmitCommandPtr+16*d->ctx; |
299 | 275 | ||
300 | d->it_prg = kmalloc(d->num_desc * sizeof(struct it_dma_prg *), | 276 | d->it_prg = kzalloc(d->num_desc * sizeof(*d->it_prg), |
301 | GFP_KERNEL); | 277 | GFP_KERNEL); |
302 | 278 | ||
303 | if (d->it_prg == NULL) { | 279 | if (!d->it_prg) { |
304 | PRINT(KERN_ERR, ohci->host->id, | 280 | PRINT(KERN_ERR, ohci->host->id, |
305 | "Failed to allocate dma it prg"); | 281 | "Failed to allocate dma it prg"); |
306 | free_dma_iso_ctx(d); | 282 | free_dma_iso_ctx(d); |
307 | return NULL; | 283 | return NULL; |
308 | } | 284 | } |
309 | memset(d->it_prg, 0, d->num_desc*sizeof(struct it_dma_prg *)); | ||
310 | 285 | ||
311 | d->packet_size = packet_size; | 286 | d->packet_size = packet_size; |
312 | 287 | ||
@@ -337,47 +312,24 @@ alloc_dma_iso_ctx(struct ti_ohci *ohci, int type, int num_desc, | |||
337 | } | 312 | } |
338 | } | 313 | } |
339 | 314 | ||
340 | d->buffer_status = kmalloc(d->num_desc * sizeof(unsigned int), | 315 | d->buffer_status = |
341 | GFP_KERNEL); | 316 | kzalloc(d->num_desc * sizeof(*d->buffer_status), GFP_KERNEL); |
342 | d->buffer_prg_assignment = kmalloc(d->num_desc * sizeof(unsigned int), | 317 | d->buffer_prg_assignment = |
343 | GFP_KERNEL); | 318 | kzalloc(d->num_desc * sizeof(*d->buffer_prg_assignment), GFP_KERNEL); |
344 | d->buffer_time = kmalloc(d->num_desc * sizeof(struct timeval), | 319 | d->buffer_time = |
345 | GFP_KERNEL); | 320 | kzalloc(d->num_desc * sizeof(*d->buffer_time), GFP_KERNEL); |
346 | d->last_used_cmd = kmalloc(d->num_desc * sizeof(unsigned int), | 321 | d->last_used_cmd = |
347 | GFP_KERNEL); | 322 | kzalloc(d->num_desc * sizeof(*d->last_used_cmd), GFP_KERNEL); |
348 | d->next_buffer = kmalloc(d->num_desc * sizeof(int), | 323 | d->next_buffer = |
349 | GFP_KERNEL); | 324 | kzalloc(d->num_desc * sizeof(*d->next_buffer), GFP_KERNEL); |
350 | 325 | ||
351 | if (d->buffer_status == NULL) { | 326 | if (!d->buffer_status || !d->buffer_prg_assignment || !d->buffer_time || |
352 | PRINT(KERN_ERR, ohci->host->id, "Failed to allocate buffer_status"); | 327 | !d->last_used_cmd || !d->next_buffer) { |
353 | free_dma_iso_ctx(d); | 328 | PRINT(KERN_ERR, ohci->host->id, |
354 | return NULL; | 329 | "Failed to allocate dma_iso_ctx member"); |
355 | } | ||
356 | if (d->buffer_prg_assignment == NULL) { | ||
357 | PRINT(KERN_ERR, ohci->host->id, "Failed to allocate buffer_prg_assignment"); | ||
358 | free_dma_iso_ctx(d); | ||
359 | return NULL; | ||
360 | } | ||
361 | if (d->buffer_time == NULL) { | ||
362 | PRINT(KERN_ERR, ohci->host->id, "Failed to allocate buffer_time"); | ||
363 | free_dma_iso_ctx(d); | ||
364 | return NULL; | ||
365 | } | ||
366 | if (d->last_used_cmd == NULL) { | ||
367 | PRINT(KERN_ERR, ohci->host->id, "Failed to allocate last_used_cmd"); | ||
368 | free_dma_iso_ctx(d); | ||
369 | return NULL; | ||
370 | } | ||
371 | if (d->next_buffer == NULL) { | ||
372 | PRINT(KERN_ERR, ohci->host->id, "Failed to allocate next_buffer"); | ||
373 | free_dma_iso_ctx(d); | 330 | free_dma_iso_ctx(d); |
374 | return NULL; | 331 | return NULL; |
375 | } | 332 | } |
376 | memset(d->buffer_status, 0, d->num_desc * sizeof(unsigned int)); | ||
377 | memset(d->buffer_prg_assignment, 0, d->num_desc * sizeof(unsigned int)); | ||
378 | memset(d->buffer_time, 0, d->num_desc * sizeof(struct timeval)); | ||
379 | memset(d->last_used_cmd, 0, d->num_desc * sizeof(unsigned int)); | ||
380 | memset(d->next_buffer, -1, d->num_desc * sizeof(int)); | ||
381 | 333 | ||
382 | spin_lock_init(&d->lock); | 334 | spin_lock_init(&d->lock); |
383 | 335 | ||
@@ -539,7 +491,7 @@ static void wakeup_dma_ir_ctx(unsigned long l) | |||
539 | if (d->ir_prg[i][d->nb_cmd-1].status & cpu_to_le32(0xFFFF0000)) { | 491 | if (d->ir_prg[i][d->nb_cmd-1].status & cpu_to_le32(0xFFFF0000)) { |
540 | reset_ir_status(d, i); | 492 | reset_ir_status(d, i); |
541 | d->buffer_status[d->buffer_prg_assignment[i]] = VIDEO1394_BUFFER_READY; | 493 | d->buffer_status[d->buffer_prg_assignment[i]] = VIDEO1394_BUFFER_READY; |
542 | do_gettimeofday(&d->buffer_time[i]); | 494 | do_gettimeofday(&d->buffer_time[d->buffer_prg_assignment[i]]); |
543 | } | 495 | } |
544 | } | 496 | } |
545 | 497 | ||
@@ -1046,7 +998,6 @@ static int __video1394_ioctl(struct file *file, | |||
1046 | 998 | ||
1047 | /* set time of buffer */ | 999 | /* set time of buffer */ |
1048 | v.filltime = d->buffer_time[v.buffer]; | 1000 | v.filltime = d->buffer_time[v.buffer]; |
1049 | // printk("Buffer %d time %d\n", v.buffer, (d->buffer_time[v.buffer]).tv_usec); | ||
1050 | 1001 | ||
1051 | /* | 1002 | /* |
1052 | * Look ahead to see how many more buffers have been received | 1003 | * Look ahead to see how many more buffers have been received |
@@ -1085,7 +1036,7 @@ static int __video1394_ioctl(struct file *file, | |||
1085 | } | 1036 | } |
1086 | 1037 | ||
1087 | if (d->flags & VIDEO1394_VARIABLE_PACKET_SIZE) { | 1038 | if (d->flags & VIDEO1394_VARIABLE_PACKET_SIZE) { |
1088 | int buf_size = d->nb_cmd * sizeof(unsigned int); | 1039 | int buf_size = d->nb_cmd * sizeof(*psizes); |
1089 | struct video1394_queue_variable __user *p = argp; | 1040 | struct video1394_queue_variable __user *p = argp; |
1090 | unsigned int __user *qv; | 1041 | unsigned int __user *qv; |
1091 | 1042 | ||
@@ -1104,7 +1055,7 @@ static int __video1394_ioctl(struct file *file, | |||
1104 | 1055 | ||
1105 | spin_lock_irqsave(&d->lock,flags); | 1056 | spin_lock_irqsave(&d->lock,flags); |
1106 | 1057 | ||
1107 | // last_buffer is last_prg | 1058 | /* last_buffer is last_prg */ |
1108 | next_prg = (d->last_buffer + 1) % d->num_desc; | 1059 | next_prg = (d->last_buffer + 1) % d->num_desc; |
1109 | if (d->buffer_status[v.buffer]!=VIDEO1394_BUFFER_FREE) { | 1060 | if (d->buffer_status[v.buffer]!=VIDEO1394_BUFFER_FREE) { |
1110 | PRINT(KERN_ERR, ohci->host->id, | 1061 | PRINT(KERN_ERR, ohci->host->id, |
@@ -1251,13 +1202,12 @@ static int video1394_open(struct inode *inode, struct file *file) | |||
1251 | if (ohci == NULL) | 1202 | if (ohci == NULL) |
1252 | return -EIO; | 1203 | return -EIO; |
1253 | 1204 | ||
1254 | ctx = kmalloc(sizeof(struct file_ctx), GFP_KERNEL); | 1205 | ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); |
1255 | if (ctx == NULL) { | 1206 | if (!ctx) { |
1256 | PRINT(KERN_ERR, ohci->host->id, "Cannot malloc file_ctx"); | 1207 | PRINT(KERN_ERR, ohci->host->id, "Cannot malloc file_ctx"); |
1257 | return -ENOMEM; | 1208 | return -ENOMEM; |
1258 | } | 1209 | } |
1259 | 1210 | ||
1260 | memset(ctx, 0, sizeof(struct file_ctx)); | ||
1261 | ctx->ohci = ohci; | 1211 | ctx->ohci = ohci; |
1262 | INIT_LIST_HEAD(&ctx->context_list); | 1212 | INIT_LIST_HEAD(&ctx->context_list); |
1263 | ctx->current_ctx = NULL; | 1213 | ctx->current_ctx = NULL; |