Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394-2.6

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394-2.6: (31 commits)
firewire: fw-sbp2: fix DMA mapping of management ORBs
firewire: fw-sbp2: fix DMA mapping of command ORBs
firewire: fw-sbp2: fix DMA mapping of S/G tables
firewire: fw-sbp2: add a boundary check
firewire: fw-sbp2: correctly align page tables
firewire: fw-sbp2: memset wants string.h
firewire: fw-sbp2: use correct speed in sbp2_agent_reset
firewire: fw-sbp2: correctly dereference by container_of
firewire: Document userspace ioctl interface.
firewire: fw-sbp2: implement nonexclusive login
firewire: fw-sbp2: let SCSI shutdown commands through before logout
firewire: fw-sbp2: implement max sectors limit for some old bridges
firewire: simplify a struct type
firewire: support S100B...S400B and link slower than PHY
firewire: optimize gap count with 1394b leaf nodes
firewire: remove unused macro
firewire: missing newline in printk
firewire: fw-sbp2: remove unused struct member
ieee1394: remove old isochronous ABI
ieee1394: sbp2: change some module parameters from int to bool
...

+745 -883
+16
Documentation/ABI/removed/raw1394_legacy_isochronous
··· 1 + What: legacy isochronous ABI of raw1394 (1st generation iso ABI) 2 + Date: June 2007 (scheduled), removed in kernel v2.6.23 3 + Contact: linux1394-devel@lists.sourceforge.net 4 + Description: 5 + The two request types RAW1394_REQ_ISO_SEND, RAW1394_REQ_ISO_LISTEN have 6 + been deprecated for quite some time. They are very inefficient as they 7 + come with high interrupt load and several layers of callbacks for each 8 + packet. Because of these deficiencies, the video1394 and dv1394 drivers 9 + and the 3rd-generation isochronous ABI in raw1394 (rawiso) were created. 10 + 11 + Users: 12 + libraw1394 users via the long deprecated API raw1394_iso_write, 13 + raw1394_start_iso_write, raw1394_start_iso_rcv, raw1394_stop_iso_rcv 14 + 15 + libdc1394, which optionally uses these old libraw1394 calls 16 + alternatively to the more efficient video1394 ABI
-10
Documentation/feature-removal-schedule.txt
··· 49 49 50 50 --------------------------- 51 51 52 - What: raw1394: requests of type RAW1394_REQ_ISO_SEND, RAW1394_REQ_ISO_LISTEN 53 - When: June 2007 54 - Why: Deprecated in favour of the more efficient and robust rawiso interface. 55 - Affected are applications which use the deprecated part of libraw1394 56 - (raw1394_iso_write, raw1394_start_iso_write, raw1394_start_iso_rcv, 57 - raw1394_stop_iso_rcv) or bypass libraw1394. 58 - Who: Dan Dennedy <dan@dennedy.org>, Stefan Richter <stefanr@s5r6.in-berlin.de> 59 - 60 - --------------------------- 61 - 62 52 What: old NCR53C9x driver 63 53 When: October 2007 64 54 Why: Replaced by the much better esp_scsi driver. Actual low-level
+5 -2
drivers/firewire/fw-card.c
··· 336 336 } 337 337 338 338 pick_me: 339 - /* Now figure out what gap count to set. */ 340 - if (card->topology_type == FW_TOPOLOGY_A && 339 + /* 340 + * Pick a gap count from 1394a table E-1. The table doesn't cover 341 + * the typically much larger 1394b beta repeater delays though. 342 + */ 343 + if (!card->beta_repeaters_present && 341 344 card->root_node->max_hops < ARRAY_SIZE(gap_count_table)) 342 345 gap_count = gap_count_table[card->root_node->max_hops]; 343 346 else
+1 -1
drivers/firewire/fw-cdev.c
··· 397 397 request->tcode & 0x1f, 398 398 device->node->node_id, 399 399 request->generation, 400 - device->node->max_speed, 400 + device->max_speed, 401 401 request->offset, 402 402 response->response.data, request->length, 403 403 complete_transaction, response);
+34 -4
drivers/firewire/fw-device.c
··· 401 401 402 402 offset = 0xfffff0000400ULL + index * 4; 403 403 fw_send_request(device->card, &t, TCODE_READ_QUADLET_REQUEST, 404 - device->node_id, 405 - device->generation, SCODE_100, 404 + device->node_id, device->generation, device->max_speed, 406 405 offset, NULL, 4, complete_transaction, &callback_data); 407 406 408 407 wait_for_completion(&callback_data.done); ··· 417 418 u32 stack[16], sp, key; 418 419 int i, end, length; 419 420 421 + device->max_speed = SCODE_100; 422 + 420 423 /* First read the bus info block. */ 421 424 for (i = 0; i < 5; i++) { 422 425 if (read_rom(device, i, &rom[i]) != RCODE_COMPLETE) ··· 433 432 */ 434 433 if (i == 0 && rom[i] == 0) 435 434 return -1; 435 + } 436 + 437 + device->max_speed = device->node->max_speed; 438 + 439 + /* 440 + * Determine the speed of 441 + * - devices with link speed less than PHY speed, 442 + * - devices with 1394b PHY (unless only connected to 1394a PHYs), 443 + * - all devices if there are 1394b repeaters. 444 + * Note, we cannot use the bus info block's link_spd as starting point 445 + * because some buggy firmwares set it lower than necessary and because 446 + * 1394-1995 nodes do not have the field. 447 + */ 448 + if ((rom[2] & 0x7) < device->max_speed || 449 + device->max_speed == SCODE_BETA || 450 + device->card->beta_repeaters_present) { 451 + u32 dummy; 452 + 453 + /* for S1600 and S3200 */ 454 + if (device->max_speed == SCODE_BETA) 455 + device->max_speed = device->card->link_speed; 456 + 457 + while (device->max_speed > SCODE_100) { 458 + if (read_rom(device, 0, &dummy) == RCODE_COMPLETE) 459 + break; 460 + device->max_speed--; 461 + } 436 462 } 437 463 438 464 /* ··· 708 680 FW_DEVICE_RUNNING) == FW_DEVICE_SHUTDOWN) 709 681 fw_device_shutdown(&device->work.work); 710 682 else 711 - fw_notify("created new fw device %s (%d config rom retries)\n", 712 - device->device.bus_id, device->config_rom_retries); 683 + fw_notify("created new fw device %s " 684 + "(%d config rom retries, S%d00)\n", 685 + device->device.bus_id, device->config_rom_retries, 686 + 1 << device->max_speed); 713 687 714 688 /* 715 689 * Reschedule the IRM work if we just finished reading the
+1
drivers/firewire/fw-device.h
··· 40 40 struct fw_node *node; 41 41 int node_id; 42 42 int generation; 43 + unsigned max_speed; 43 44 struct fw_card *card; 44 45 struct device device; 45 46 struct list_head link;
+3 -3
drivers/firewire/fw-ohci.c
··· 1934 1934 free_irq(pdev->irq, ohci); 1935 1935 err = pci_save_state(pdev); 1936 1936 if (err) { 1937 - fw_error("pci_save_state failed with %d", err); 1937 + fw_error("pci_save_state failed\n"); 1938 1938 return err; 1939 1939 } 1940 1940 err = pci_set_power_state(pdev, pci_choose_state(pdev, state)); 1941 1941 if (err) { 1942 - fw_error("pci_set_power_state failed with %d", err); 1942 + fw_error("pci_set_power_state failed\n"); 1943 1943 return err; 1944 1944 } 1945 1945 ··· 1955 1955 pci_restore_state(pdev); 1956 1956 err = pci_enable_device(pdev); 1957 1957 if (err) { 1958 - fw_error("pci_enable_device failed with %d", err); 1958 + fw_error("pci_enable_device failed\n"); 1959 1959 return err; 1960 1960 } 1961 1961
+58 -59
drivers/firewire/fw-sbp2.c
··· 30 30 31 31 #include <linux/kernel.h> 32 32 #include <linux/module.h> 33 + #include <linux/moduleparam.h> 33 34 #include <linux/mod_devicetable.h> 34 35 #include <linux/device.h> 35 36 #include <linux/scatterlist.h> 36 37 #include <linux/dma-mapping.h> 38 + #include <linux/blkdev.h> 39 + #include <linux/string.h> 37 40 #include <linux/timer.h> 38 41 39 42 #include <scsi/scsi.h> ··· 48 45 #include "fw-transaction.h" 49 46 #include "fw-topology.h" 50 47 #include "fw-device.h" 48 + 49 + /* 50 + * So far only bridges from Oxford Semiconductor are known to support 51 + * concurrent logins. Depending on firmware, four or two concurrent logins 52 + * are possible on OXFW911 and newer Oxsemi bridges. 53 + * 54 + * Concurrent logins are useful together with cluster filesystems. 55 + */ 56 + static int sbp2_param_exclusive_login = 1; 57 + module_param_named(exclusive_login, sbp2_param_exclusive_login, bool, 0644); 58 + MODULE_PARM_DESC(exclusive_login, "Exclusive login to sbp2 device " 59 + "(default = Y, use N for concurrent initiators)"); 51 60 52 61 /* I don't know why the SCSI stack doesn't define something like this... */ 53 62 typedef void (*scsi_done_fn_t)(struct scsi_cmnd *); ··· 169 154 #define MANAGEMENT_ORB_LUN(v) ((v)) 170 155 #define MANAGEMENT_ORB_FUNCTION(v) ((v) << 16) 171 156 #define MANAGEMENT_ORB_RECONNECT(v) ((v) << 20) 172 - #define MANAGEMENT_ORB_EXCLUSIVE ((1) << 28) 157 + #define MANAGEMENT_ORB_EXCLUSIVE(v) ((v) ? 1 << 28 : 0) 173 158 #define MANAGEMENT_ORB_REQUEST_FORMAT(v) ((v) << 29) 174 159 #define MANAGEMENT_ORB_NOTIFY ((1) << 31) 175 160 ··· 220 205 scsi_done_fn_t done; 221 206 struct fw_unit *unit; 222 207 223 - struct sbp2_pointer page_table[SG_ALL]; 208 + struct sbp2_pointer page_table[SG_ALL] __attribute__((aligned(8))); 224 209 dma_addr_t page_table_bus; 225 - dma_addr_t request_buffer_bus; 226 210 }; 227 211 228 212 /* ··· 361 347 spin_unlock_irqrestore(&device->card->lock, flags); 362 348 363 349 fw_send_request(device->card, &orb->t, TCODE_WRITE_BLOCK_REQUEST, 364 - node_id, generation, 365 - device->node->max_speed, offset, 350 + node_id, generation, device->max_speed, offset, 366 351 &orb->pointer, sizeof(orb->pointer), 367 352 complete_transaction, orb); 368 353 } ··· 396 383 complete_management_orb(struct sbp2_orb *base_orb, struct sbp2_status *status) 397 384 { 398 385 struct sbp2_management_orb *orb = 399 - (struct sbp2_management_orb *)base_orb; 386 + container_of(base_orb, struct sbp2_management_orb, base); 400 387 401 388 if (status) 402 389 memcpy(&orb->status, status, sizeof(*status)); ··· 416 403 if (orb == NULL) 417 404 return -ENOMEM; 418 405 419 - /* 420 - * The sbp2 device is going to send a block read request to 421 - * read out the request from host memory, so map it for dma. 422 - */ 423 - orb->base.request_bus = 424 - dma_map_single(device->card->device, &orb->request, 425 - sizeof(orb->request), DMA_TO_DEVICE); 426 - if (dma_mapping_error(orb->base.request_bus)) 427 - goto out; 428 - 429 406 orb->response_bus = 430 407 dma_map_single(device->card->device, &orb->response, 431 408 sizeof(orb->response), DMA_FROM_DEVICE); 432 409 if (dma_mapping_error(orb->response_bus)) 433 - goto out; 410 + goto fail_mapping_response; 434 411 435 412 orb->request.response.high = 0; 436 413 orb->request.response.low = orb->response_bus; ··· 435 432 orb->request.status_fifo.high = sd->address_handler.offset >> 32; 436 433 orb->request.status_fifo.low = sd->address_handler.offset; 437 434 438 - /* 439 - * FIXME: Yeah, ok this isn't elegant, we hardwire exclusive 440 - * login and 1 second reconnect time. The reconnect setting 441 - * is probably fine, but the exclusive login should be an option. 442 - */ 443 435 if (function == SBP2_LOGIN_REQUEST) { 444 436 orb->request.misc |= 445 - MANAGEMENT_ORB_EXCLUSIVE | 437 + MANAGEMENT_ORB_EXCLUSIVE(sbp2_param_exclusive_login) | 446 438 MANAGEMENT_ORB_RECONNECT(0); 447 439 } 448 440 ··· 445 447 446 448 init_completion(&orb->done); 447 449 orb->base.callback = complete_management_orb; 450 + 451 + orb->base.request_bus = 452 + dma_map_single(device->card->device, &orb->request, 453 + sizeof(orb->request), DMA_TO_DEVICE); 454 + if (dma_mapping_error(orb->base.request_bus)) 455 + goto fail_mapping_request; 448 456 449 457 sbp2_send_orb(&orb->base, unit, 450 458 node_id, generation, sd->management_agent_address); ··· 483 479 out: 484 480 dma_unmap_single(device->card->device, orb->base.request_bus, 485 481 sizeof(orb->request), DMA_TO_DEVICE); 482 + fail_mapping_request: 486 483 dma_unmap_single(device->card->device, orb->response_bus, 487 484 sizeof(orb->response), DMA_FROM_DEVICE); 488 - 485 + fail_mapping_response: 489 486 if (response) 490 487 fw_memcpy_from_be32(response, 491 488 orb->response, sizeof(orb->response)); ··· 516 511 return -ENOMEM; 517 512 518 513 fw_send_request(device->card, t, TCODE_WRITE_QUADLET_REQUEST, 519 - sd->node_id, sd->generation, SCODE_400, 514 + sd->node_id, sd->generation, device->max_speed, 520 515 sd->command_block_agent_address + SBP2_AGENT_RESET, 521 516 &zero, sizeof(zero), complete_agent_reset_write, t); 522 517 ··· 526 521 static void sbp2_reconnect(struct work_struct *work); 527 522 static struct scsi_host_template scsi_driver_template; 528 523 529 - static void 530 - release_sbp2_device(struct kref *kref) 524 + static void release_sbp2_device(struct kref *kref) 531 525 { 532 526 struct sbp2_device *sd = container_of(kref, struct sbp2_device, kref); 533 527 struct Scsi_Host *host = 534 528 container_of((void *)sd, struct Scsi_Host, hostdata[0]); 535 529 530 + scsi_remove_host(host); 536 531 sbp2_send_management_orb(sd->unit, sd->node_id, sd->generation, 537 532 SBP2_LOGOUT_REQUEST, sd->login_id, NULL); 538 - 539 - scsi_remove_host(host); 540 533 fw_core_remove_address_handler(&sd->address_handler); 541 534 fw_notify("removed sbp2 unit %s\n", sd->unit->device.bus_id); 542 535 put_device(&sd->unit->device); ··· 836 833 static void 837 834 complete_command_orb(struct sbp2_orb *base_orb, struct sbp2_status *status) 838 835 { 839 - struct sbp2_command_orb *orb = (struct sbp2_command_orb *)base_orb; 836 + struct sbp2_command_orb *orb = 837 + container_of(base_orb, struct sbp2_command_orb, base); 840 838 struct fw_unit *unit = orb->unit; 841 839 struct fw_device *device = fw_device(unit->device.parent); 842 840 struct scatterlist *sg; ··· 884 880 885 881 if (orb->page_table_bus != 0) 886 882 dma_unmap_single(device->card->device, orb->page_table_bus, 887 - sizeof(orb->page_table_bus), DMA_TO_DEVICE); 888 - 889 - if (orb->request_buffer_bus != 0) 890 - dma_unmap_single(device->card->device, orb->request_buffer_bus, 891 - sizeof(orb->request_buffer_bus), 892 - DMA_FROM_DEVICE); 883 + sizeof(orb->page_table), DMA_TO_DEVICE); 893 884 894 885 orb->cmd->result = result; 895 886 orb->done(orb->cmd); ··· 899 900 struct fw_device *device = fw_device(unit->device.parent); 900 901 struct scatterlist *sg; 901 902 int sg_len, l, i, j, count; 902 - size_t size; 903 903 dma_addr_t sg_addr; 904 904 905 905 sg = (struct scatterlist *)orb->cmd->request_buffer; ··· 933 935 sg_len = sg_dma_len(sg + i); 934 936 sg_addr = sg_dma_address(sg + i); 935 937 while (sg_len) { 938 + /* FIXME: This won't get us out of the pinch. */ 939 + if (unlikely(j >= ARRAY_SIZE(orb->page_table))) { 940 + fw_error("page table overflow\n"); 941 + goto fail_page_table; 942 + } 936 943 l = min(sg_len, SBP2_MAX_SG_ELEMENT_LENGTH); 937 944 orb->page_table[j].low = sg_addr; 938 945 orb->page_table[j].high = (l << 16); ··· 947 944 } 948 945 } 949 946 950 - size = sizeof(orb->page_table[0]) * j; 947 + fw_memcpy_to_be32(orb->page_table, orb->page_table, 948 + sizeof(orb->page_table[0]) * j); 949 + orb->page_table_bus = 950 + dma_map_single(device->card->device, orb->page_table, 951 + sizeof(orb->page_table), DMA_TO_DEVICE); 952 + if (dma_mapping_error(orb->page_table_bus)) 953 + goto fail_page_table; 951 954 952 955 /* 953 956 * The data_descriptor pointer is the one case where we need ··· 962 953 * initiator (i.e. us), but data_descriptor can refer to data 963 954 * on other nodes so we need to put our ID in descriptor.high. 964 955 */ 965 - 966 - orb->page_table_bus = 967 - dma_map_single(device->card->device, orb->page_table, 968 - size, DMA_TO_DEVICE); 969 - if (dma_mapping_error(orb->page_table_bus)) 970 - goto fail_page_table; 971 956 orb->request.data_descriptor.high = sd->address_high; 972 957 orb->request.data_descriptor.low = orb->page_table_bus; 973 958 orb->request.misc |= 974 959 COMMAND_ORB_PAGE_TABLE_PRESENT | 975 960 COMMAND_ORB_DATA_SIZE(j); 976 - 977 - fw_memcpy_to_be32(orb->page_table, orb->page_table, size); 978 961 979 962 return 0; 980 963 ··· 992 991 * transfer direction not handled. 993 992 */ 994 993 if (cmd->sc_data_direction == DMA_BIDIRECTIONAL) { 995 - fw_error("Cannot handle DMA_BIDIRECTIONAL - rejecting command"); 994 + fw_error("Can't handle DMA_BIDIRECTIONAL, rejecting command\n"); 996 995 cmd->result = DID_ERROR << 16; 997 996 done(cmd); 998 997 return 0; ··· 1006 1005 1007 1006 /* Initialize rcode to something not RCODE_COMPLETE. */ 1008 1007 orb->base.rcode = -1; 1009 - orb->base.request_bus = 1010 - dma_map_single(device->card->device, &orb->request, 1011 - sizeof(orb->request), DMA_TO_DEVICE); 1012 - if (dma_mapping_error(orb->base.request_bus)) 1013 - goto fail_mapping; 1014 1008 1015 1009 orb->unit = unit; 1016 1010 orb->done = done; ··· 1020 1024 * if we set this to max_speed + 7, we get the right value. 1021 1025 */ 1022 1026 orb->request.misc = 1023 - COMMAND_ORB_MAX_PAYLOAD(device->node->max_speed + 7) | 1024 - COMMAND_ORB_SPEED(device->node->max_speed) | 1027 + COMMAND_ORB_MAX_PAYLOAD(device->max_speed + 7) | 1028 + COMMAND_ORB_SPEED(device->max_speed) | 1025 1029 COMMAND_ORB_NOTIFY; 1026 1030 1027 1031 if (cmd->sc_data_direction == DMA_FROM_DEVICE) ··· 1032 1036 COMMAND_ORB_DIRECTION(SBP2_DIRECTION_TO_MEDIA); 1033 1037 1034 1038 if (cmd->use_sg && sbp2_command_orb_map_scatterlist(orb) < 0) 1035 - goto fail_map_payload; 1039 + goto fail_mapping; 1036 1040 1037 1041 fw_memcpy_to_be32(&orb->request, &orb->request, sizeof(orb->request)); 1038 1042 ··· 1041 1045 memcpy(orb->request.command_block, cmd->cmnd, COMMAND_SIZE(*cmd->cmnd)); 1042 1046 1043 1047 orb->base.callback = complete_command_orb; 1048 + orb->base.request_bus = 1049 + dma_map_single(device->card->device, &orb->request, 1050 + sizeof(orb->request), DMA_TO_DEVICE); 1051 + if (dma_mapping_error(orb->base.request_bus)) 1052 + goto fail_mapping; 1044 1053 1045 1054 sbp2_send_orb(&orb->base, unit, sd->node_id, sd->generation, 1046 1055 sd->command_block_agent_address + SBP2_ORB_POINTER); 1047 1056 1048 1057 return 0; 1049 1058 1050 - fail_map_payload: 1051 - dma_unmap_single(device->card->device, orb->base.request_bus, 1052 - sizeof(orb->request), DMA_TO_DEVICE); 1053 1059 fail_mapping: 1054 1060 kfree(orb); 1055 1061 fail_alloc: ··· 1085 1087 fw_notify("setting fix_capacity for %s\n", unit->device.bus_id); 1086 1088 sdev->fix_capacity = 1; 1087 1089 } 1088 - 1090 + if (sd->workarounds & SBP2_WORKAROUND_128K_MAX_TRANS) 1091 + blk_queue_max_sectors(sdev->request_queue, 128 * 1024 / 512); 1089 1092 return 0; 1090 1093 } 1091 1094
+32 -34
drivers/firewire/fw-topology.c
··· 135 135 int i; 136 136 137 137 for (i = 0; i < node->port_count; i++) { 138 - if (node->ports[i].node == NULL) 138 + if (node->ports[i] == NULL) 139 139 continue; 140 140 141 - if (node->ports[i].node->max_hops > max_child_hops) 142 - max_child_hops = node->ports[i].node->max_hops; 141 + if (node->ports[i]->max_hops > max_child_hops) 142 + max_child_hops = node->ports[i]->max_hops; 143 143 144 - if (node->ports[i].node->max_depth > depths[0]) { 144 + if (node->ports[i]->max_depth > depths[0]) { 145 145 depths[1] = depths[0]; 146 - depths[0] = node->ports[i].node->max_depth; 147 - } else if (node->ports[i].node->max_depth > depths[1]) 148 - depths[1] = node->ports[i].node->max_depth; 146 + depths[0] = node->ports[i]->max_depth; 147 + } else if (node->ports[i]->max_depth > depths[1]) 148 + depths[1] = node->ports[i]->max_depth; 149 149 } 150 150 151 151 node->max_depth = depths[0] + 1; ··· 172 172 struct list_head stack, *h; 173 173 u32 *next_sid, *end, q; 174 174 int i, port_count, child_port_count, phy_id, parent_count, stack_depth; 175 - int gap_count, topology_type; 175 + int gap_count; 176 + bool beta_repeaters_present; 176 177 177 178 local_node = NULL; 178 179 node = NULL; ··· 183 182 phy_id = 0; 184 183 irm_node = NULL; 185 184 gap_count = SELF_ID_GAP_COUNT(*sid); 186 - topology_type = 0; 185 + beta_repeaters_present = false; 187 186 188 187 while (sid < end) { 189 188 next_sid = count_ports(sid, &port_count, &child_port_count); ··· 215 214 216 215 node = fw_node_create(q, port_count, card->color); 217 216 if (node == NULL) { 218 - fw_error("Out of memory while building topology."); 217 + fw_error("Out of memory while building topology.\n"); 219 218 return NULL; 220 219 } 221 220 ··· 224 223 225 224 if (SELF_ID_CONTENDER(q)) 226 225 irm_node = node; 227 - 228 - if (node->phy_speed == SCODE_BETA) 229 - topology_type |= FW_TOPOLOGY_B; 230 - else 231 - topology_type |= FW_TOPOLOGY_A; 232 226 233 227 parent_count = 0; 234 228 ··· 245 249 break; 246 250 247 251 case SELFID_PORT_CHILD: 248 - node->ports[i].node = child; 252 + node->ports[i] = child; 249 253 /* 250 254 * Fix up parent reference for this 251 255 * child node. 252 256 */ 253 - child->ports[child->color].node = node; 257 + child->ports[child->color] = node; 254 258 child->color = card->color; 255 259 child = fw_node(child->link.next); 256 260 break; ··· 274 278 list_add_tail(&node->link, &stack); 275 279 stack_depth += 1 - child_port_count; 276 280 281 + if (node->phy_speed == SCODE_BETA && 282 + parent_count + child_port_count > 1) 283 + beta_repeaters_present = true; 284 + 277 285 /* 278 286 * If all PHYs does not report the same gap count 279 287 * setting, we fall back to 63 which will force a gap ··· 295 295 card->root_node = node; 296 296 card->irm_node = irm_node; 297 297 card->gap_count = gap_count; 298 - card->topology_type = topology_type; 298 + card->beta_repeaters_present = beta_repeaters_present; 299 299 300 300 return local_node; 301 301 } ··· 321 321 node->color = card->color; 322 322 323 323 for (i = 0; i < node->port_count; i++) { 324 - child = node->ports[i].node; 324 + child = node->ports[i]; 325 325 if (!child) 326 326 continue; 327 327 if (child->color == card->color) ··· 382 382 struct fw_node *tree; 383 383 int i; 384 384 385 - tree = node1->ports[port].node; 386 - node0->ports[port].node = tree; 385 + tree = node1->ports[port]; 386 + node0->ports[port] = tree; 387 387 for (i = 0; i < tree->port_count; i++) { 388 - if (tree->ports[i].node == node1) { 389 - tree->ports[i].node = node0; 388 + if (tree->ports[i] == node1) { 389 + tree->ports[i] = node0; 390 390 break; 391 391 } 392 392 } ··· 437 437 card->irm_node = node0; 438 438 439 439 for (i = 0; i < node0->port_count; i++) { 440 - if (node0->ports[i].node && node1->ports[i].node) { 440 + if (node0->ports[i] && node1->ports[i]) { 441 441 /* 442 442 * This port didn't change, queue the 443 443 * connected node for further 444 444 * investigation. 445 445 */ 446 - if (node0->ports[i].node->color == card->color) 446 + if (node0->ports[i]->color == card->color) 447 447 continue; 448 - list_add_tail(&node0->ports[i].node->link, 449 - &list0); 450 - list_add_tail(&node1->ports[i].node->link, 451 - &list1); 452 - } else if (node0->ports[i].node) { 448 + list_add_tail(&node0->ports[i]->link, &list0); 449 + list_add_tail(&node1->ports[i]->link, &list1); 450 + } else if (node0->ports[i]) { 453 451 /* 454 452 * The nodes connected here were 455 453 * unplugged; unref the lost nodes and ··· 455 457 * them. 456 458 */ 457 459 458 - for_each_fw_node(card, node0->ports[i].node, 460 + for_each_fw_node(card, node0->ports[i], 459 461 report_lost_node); 460 - node0->ports[i].node = NULL; 461 - } else if (node1->ports[i].node) { 462 + node0->ports[i] = NULL; 463 + } else if (node1->ports[i]) { 462 464 /* 463 465 * One or more node were connected to 464 466 * this port. Move the new nodes into ··· 466 468 * callbacks for them. 467 469 */ 468 470 move_tree(node0, node1, i); 469 - for_each_fw_node(card, node0->ports[i].node, 471 + for_each_fw_node(card, node0->ports[i], 470 472 report_found_node); 471 473 } 472 474 }
+7 -18
drivers/firewire/fw-topology.h
··· 20 20 #define __fw_topology_h 21 21 22 22 enum { 23 - FW_TOPOLOGY_A = 0x01, 24 - FW_TOPOLOGY_B = 0x02, 25 - FW_TOPOLOGY_MIXED = 0x03, 26 - }; 27 - 28 - enum { 29 23 FW_NODE_CREATED = 0x00, 30 24 FW_NODE_UPDATED = 0x01, 31 25 FW_NODE_DESTROYED = 0x02, ··· 27 33 FW_NODE_LINK_OFF = 0x04, 28 34 }; 29 35 30 - struct fw_port { 31 - struct fw_node *node; 32 - unsigned speed : 3; /* S100, S200, ... S3200 */ 33 - }; 34 - 35 36 struct fw_node { 36 37 u16 node_id; 37 38 u8 color; 38 39 u8 port_count; 39 - unsigned link_on : 1; 40 - unsigned initiated_reset : 1; 41 - unsigned b_path : 1; 42 - u8 phy_speed : 3; /* As in the self ID packet. */ 43 - u8 max_speed : 5; /* Minimum of all phy-speeds and port speeds on 44 - * the path from the local node to this node. */ 40 + u8 link_on : 1; 41 + u8 initiated_reset : 1; 42 + u8 b_path : 1; 43 + u8 phy_speed : 2; /* As in the self ID packet. */ 44 + u8 max_speed : 2; /* Minimum of all phy-speeds on the path from the 45 + * local node to this node. */ 45 46 u8 max_depth : 4; /* Maximum depth to any leaf node */ 46 47 u8 max_hops : 4; /* Max hops in this sub tree */ 47 48 atomic_t ref_count; ··· 47 58 /* Upper layer specific data. */ 48 59 void *data; 49 60 50 - struct fw_port ports[0]; 61 + struct fw_node *ports[0]; 51 62 }; 52 63 53 64 static inline struct fw_node *
+1 -2
drivers/firewire/fw-transaction.h
··· 81 81 82 82 #define fw_notify(s, args...) printk(KERN_NOTICE KBUILD_MODNAME ": " s, ## args) 83 83 #define fw_error(s, args...) printk(KERN_ERR KBUILD_MODNAME ": " s, ## args) 84 - #define fw_debug(s, args...) printk(KERN_DEBUG KBUILD_MODNAME ": " s, ## args) 85 84 86 85 static inline void 87 86 fw_memcpy_from_be32(void *_dst, void *_src, size_t size) ··· 245 246 struct fw_node *irm_node; 246 247 int color; 247 248 int gap_count; 248 - int topology_type; 249 + bool beta_repeaters_present; 249 250 250 251 int index; 251 252
+4 -4
drivers/ieee1394/dv1394.c
··· 2280 2280 } while (video); 2281 2281 2282 2282 if (found_ohci_card) 2283 - class_device_destroy(hpsb_protocol_class, MKDEV(IEEE1394_MAJOR, 2283 + device_destroy(hpsb_protocol_class, MKDEV(IEEE1394_MAJOR, 2284 2284 IEEE1394_MINOR_BLOCK_DV1394 * 16 + (host->id << 2))); 2285 2285 } 2286 2286 ··· 2295 2295 2296 2296 ohci = (struct ti_ohci *)host->hostdata; 2297 2297 2298 - class_device_create(hpsb_protocol_class, NULL, MKDEV( 2299 - IEEE1394_MAJOR, IEEE1394_MINOR_BLOCK_DV1394 * 16 + (id<<2)), 2300 - NULL, "dv1394-%d", id); 2298 + device_create(hpsb_protocol_class, NULL, MKDEV( 2299 + IEEE1394_MAJOR, IEEE1394_MINOR_BLOCK_DV1394 * 16 + (id<<2)), 2300 + "dv1394-%d", id); 2301 2301 2302 2302 dv1394_init(ohci, DV1394_NTSC, MODE_RECEIVE); 2303 2303 dv1394_init(ohci, DV1394_NTSC, MODE_TRANSMIT);
+1 -3
drivers/ieee1394/eth1394.c
··· 599 599 } 600 600 601 601 SET_MODULE_OWNER(dev); 602 - 603 - /* This used to be &host->device in Linux 2.6.20 and before. */ 604 - SET_NETDEV_DEV(dev, host->device.parent); 602 + SET_NETDEV_DEV(dev, &host->device); 605 603 606 604 priv = netdev_priv(dev); 607 605 INIT_LIST_HEAD(&priv->ip_node_list);
-45
drivers/ieee1394/highlevel.c
··· 483 483 return retval; 484 484 } 485 485 486 - /** 487 - * hpsb_listen_channel - enable receving a certain isochronous channel 488 - * 489 - * Reception is handled through the @hl's iso_receive op. 490 - */ 491 - int hpsb_listen_channel(struct hpsb_highlevel *hl, struct hpsb_host *host, 492 - unsigned int channel) 493 - { 494 - if (channel > 63) { 495 - HPSB_ERR("%s called with invalid channel", __FUNCTION__); 496 - return -EINVAL; 497 - } 498 - if (host->iso_listen_count[channel]++ == 0) 499 - return host->driver->devctl(host, ISO_LISTEN_CHANNEL, channel); 500 - return 0; 501 - } 502 - 503 - /** 504 - * hpsb_unlisten_channel - disable receving a certain isochronous channel 505 - */ 506 - void hpsb_unlisten_channel(struct hpsb_highlevel *hl, struct hpsb_host *host, 507 - unsigned int channel) 508 - { 509 - if (channel > 63) { 510 - HPSB_ERR("%s called with invalid channel", __FUNCTION__); 511 - return; 512 - } 513 - if (--host->iso_listen_count[channel] == 0) 514 - host->driver->devctl(host, ISO_UNLISTEN_CHANNEL, channel); 515 - } 516 - 517 486 static void init_hpsb_highlevel(struct hpsb_host *host) 518 487 { 519 488 INIT_LIST_HEAD(&dummy_zero_addr.host_list); ··· 535 566 list_for_each_entry(hl, &hl_irqs, irq_list) { 536 567 if (hl->host_reset) 537 568 hl->host_reset(host); 538 - } 539 - read_unlock_irqrestore(&hl_irqs_lock, flags); 540 - } 541 - 542 - void highlevel_iso_receive(struct hpsb_host *host, void *data, size_t length) 543 - { 544 - unsigned long flags; 545 - struct hpsb_highlevel *hl; 546 - int channel = (((quadlet_t *)data)[0] >> 8) & 0x3f; 547 - 548 - read_lock_irqsave(&hl_irqs_lock, flags); 549 - list_for_each_entry(hl, &hl_irqs, irq_list) { 550 - if (hl->iso_receive) 551 - hl->iso_receive(host, channel, data, length); 552 569 } 553 570 read_unlock_irqrestore(&hl_irqs_lock, flags); 554 571 }
+1 -15
drivers/ieee1394/highlevel.h
··· 26 26 struct hpsb_highlevel { 27 27 const char *name; 28 28 29 - /* Any of the following pointers can legally be NULL, except for 30 - * iso_receive which can only be NULL when you don't request 31 - * channels. */ 29 + /* Any of the following pointers can legally be NULL. */ 32 30 33 31 /* New host initialized. Will also be called during 34 32 * hpsb_register_highlevel for all hosts already installed. */ ··· 40 42 * Note that this one may occur during interrupt/bottom half handling. 41 43 * You can not expect to be able to do stock hpsb_reads. */ 42 44 void (*host_reset)(struct hpsb_host *host); 43 - 44 - /* An isochronous packet was received. Channel contains the channel 45 - * number for your convenience, it is also contained in the included 46 - * packet header (first quadlet, CRCs are missing). You may get called 47 - * for channel/host combinations you did not request. */ 48 - void (*iso_receive)(struct hpsb_host *host, int channel, 49 - quadlet_t *data, size_t length); 50 45 51 46 /* A write request was received on either the FCP_COMMAND (direction = 52 47 * 0) or the FCP_RESPONSE (direction = 1) register. The cts arg ··· 100 109 int highlevel_lock64(struct hpsb_host *host, int nodeid, octlet_t *store, 101 110 u64 addr, octlet_t data, octlet_t arg, int ext_tcode, 102 111 u16 flags); 103 - void highlevel_iso_receive(struct hpsb_host *host, void *data, size_t length); 104 112 void highlevel_fcp_request(struct hpsb_host *host, int nodeid, int direction, 105 113 void *data, size_t length); 106 114 ··· 115 125 struct hpsb_address_ops *ops, u64 start, u64 end); 116 126 int hpsb_unregister_addrspace(struct hpsb_highlevel *hl, struct hpsb_host *host, 117 127 u64 start); 118 - int hpsb_listen_channel(struct hpsb_highlevel *hl, struct hpsb_host *host, 119 - unsigned int channel); 120 - void hpsb_unlisten_channel(struct hpsb_highlevel *hl, struct hpsb_host *host, 121 - unsigned int channel); 122 128 123 129 void *hpsb_get_hostinfo(struct hpsb_highlevel *hl, struct hpsb_host *host); 124 130 void *hpsb_create_hostinfo(struct hpsb_highlevel *hl, struct hpsb_host *host,
+6 -5
drivers/ieee1394/hosts.c
··· 154 154 155 155 memcpy(&h->device, &nodemgr_dev_template_host, sizeof(h->device)); 156 156 h->device.parent = dev; 157 + set_dev_node(&h->device, dev_to_node(dev)); 157 158 snprintf(h->device.bus_id, BUS_ID_SIZE, "fw-host%d", h->id); 158 159 159 - h->class_dev.dev = &h->device; 160 - h->class_dev.class = &hpsb_host_class; 161 - snprintf(h->class_dev.class_id, BUS_ID_SIZE, "fw-host%d", h->id); 160 + h->host_dev.parent = &h->device; 161 + h->host_dev.class = &hpsb_host_class; 162 + snprintf(h->host_dev.bus_id, BUS_ID_SIZE, "fw-host%d", h->id); 162 163 163 164 if (device_register(&h->device)) 164 165 goto fail; 165 - if (class_device_register(&h->class_dev)) { 166 + if (device_register(&h->host_dev)) { 166 167 device_unregister(&h->device); 167 168 goto fail; 168 169 } ··· 203 202 host->driver = &dummy_driver; 204 203 highlevel_remove_host(host); 205 204 206 - class_device_unregister(&host->class_dev); 205 + device_unregister(&host->host_dev); 207 206 device_unregister(&host->device); 208 207 } 209 208
+1 -9
drivers/ieee1394/hosts.h
··· 28 28 struct timer_list timeout; 29 29 unsigned long timeout_interval; 30 30 31 - unsigned char iso_listen_count[64]; 32 - 33 31 int node_count; /* number of identified nodes on this bus */ 34 32 int selfid_count; /* total number of SelfIDs received */ 35 33 int nodes_active; /* number of nodes with active link layer */ ··· 55 57 struct hpsb_host_driver *driver; 56 58 struct pci_dev *pdev; 57 59 struct device device; 58 - struct class_device class_dev; 60 + struct device host_dev; 59 61 60 62 struct delayed_work delayed_reset; 61 63 unsigned config_roms:31; ··· 97 99 /* Cancel all outstanding async requests without resetting the bus. 98 100 * Return void. */ 99 101 CANCEL_REQUESTS, 100 - 101 - /* Start or stop receiving isochronous channel in arg. Return void. 102 - * This acts as an optimization hint, hosts are not required not to 103 - * listen on unrequested channels. */ 104 - ISO_LISTEN_CHANNEL, 105 - ISO_UNLISTEN_CHANNEL 106 102 }; 107 103 108 104 enum isoctl_cmd {
-8
drivers/ieee1394/ieee1394_core.c
··· 1028 1028 handle_incoming_packet(host, tcode, data, size, write_acked); 1029 1029 break; 1030 1030 1031 - 1032 - case TCODE_ISO_DATA: 1033 - highlevel_iso_receive(host, data, size); 1034 - break; 1035 - 1036 1031 case TCODE_CYCLE_START: 1037 1032 /* simply ignore this packet if it is passed on */ 1038 1033 break; ··· 1311 1316 EXPORT_SYMBOL(hpsb_make_lockpacket); 1312 1317 EXPORT_SYMBOL(hpsb_make_lock64packet); 1313 1318 EXPORT_SYMBOL(hpsb_make_phypacket); 1314 - EXPORT_SYMBOL(hpsb_make_isopacket); 1315 1319 EXPORT_SYMBOL(hpsb_read); 1316 1320 EXPORT_SYMBOL(hpsb_write); 1317 1321 EXPORT_SYMBOL(hpsb_packet_success); ··· 1321 1327 EXPORT_SYMBOL(hpsb_register_addrspace); 1322 1328 EXPORT_SYMBOL(hpsb_unregister_addrspace); 1323 1329 EXPORT_SYMBOL(hpsb_allocate_and_register_addrspace); 1324 - EXPORT_SYMBOL(hpsb_listen_channel); 1325 - EXPORT_SYMBOL(hpsb_unlisten_channel); 1326 1330 EXPORT_SYMBOL(hpsb_get_hostinfo); 1327 1331 EXPORT_SYMBOL(hpsb_create_hostinfo); 1328 1332 EXPORT_SYMBOL(hpsb_destroy_hostinfo);
+9 -6
drivers/ieee1394/ieee1394_core.h
··· 24 24 25 25 nodeid_t node_id; 26 26 27 - /* Async and Iso types should be clear, raw means send-as-is, do not 28 - * CRC! Byte swapping shall still be done in this case. */ 29 - enum { hpsb_async, hpsb_iso, hpsb_raw } __attribute__((packed)) type; 27 + /* hpsb_raw = send as-is, do not CRC (but still byte-swap it) */ 28 + enum { hpsb_async, hpsb_raw } __attribute__((packed)) type; 30 29 31 30 /* Okay, this is core internal and a no care for hosts. 32 31 * queued = queued for sending ··· 36 37 hpsb_unused, hpsb_queued, hpsb_pending, hpsb_complete 37 38 } __attribute__((packed)) state; 38 39 39 - /* These are core internal. */ 40 + /* These are core-internal. */ 40 41 signed char tlabel; 41 42 signed char ack_code; 42 43 unsigned char tcode; ··· 61 62 /* Store jiffies for implementing bus timeouts. */ 62 63 unsigned long sendtime; 63 64 64 - /* Sizes are in bytes. *data can be DMA-mapped. */ 65 + /* Core-internal. */ 65 66 size_t allocated_data_size; /* as allocated */ 67 + 68 + /* Sizes are in bytes. To be set by caller of hpsb_alloc_packet. */ 66 69 size_t data_size; /* as filled in */ 67 70 size_t header_size; /* as filled in, not counting the CRC */ 68 - quadlet_t *data; 71 + 72 + /* Buffers */ 73 + quadlet_t *data; /* can be DMA-mapped */ 69 74 quadlet_t header[5]; 70 75 quadlet_t embedded_data[0]; /* keep as last member */ 71 76 };
-30
drivers/ieee1394/ieee1394_transactions.c
··· 89 89 packet->expect_response = 1; 90 90 } 91 91 92 - static void fill_iso_packet(struct hpsb_packet *packet, int length, int channel, 93 - int tag, int sync) 94 - { 95 - packet->header[0] = (length << 16) | (tag << 14) | (channel << 8) 96 - | (TCODE_ISO_DATA << 4) | sync; 97 - 98 - packet->header_size = 4; 99 - packet->data_size = length; 100 - packet->type = hpsb_iso; 101 - packet->tcode = TCODE_ISO_DATA; 102 - } 103 - 104 92 static void fill_phy_packet(struct hpsb_packet *packet, quadlet_t data) 105 93 { 106 94 packet->header[0] = data; ··· 475 487 476 488 p->host = host; 477 489 fill_phy_packet(p, data); 478 - 479 - return p; 480 - } 481 - 482 - struct hpsb_packet *hpsb_make_isopacket(struct hpsb_host *host, 483 - int length, int channel, 484 - int tag, int sync) 485 - { 486 - struct hpsb_packet *p; 487 - 488 - p = hpsb_alloc_packet(length); 489 - if (!p) 490 - return NULL; 491 - 492 - p->host = host; 493 - fill_iso_packet(p, length, channel, tag, sync); 494 - 495 - p->generation = get_hpsb_generation(host); 496 490 497 491 return p; 498 492 }
-2
drivers/ieee1394/ieee1394_transactions.h
··· 19 19 nodeid_t node, u64 addr, int extcode, 20 20 octlet_t *data, octlet_t arg); 21 21 struct hpsb_packet *hpsb_make_phypacket(struct hpsb_host *host, quadlet_t data); 22 - struct hpsb_packet *hpsb_make_isopacket(struct hpsb_host *host, int length, 23 - int channel, int tag, int sync); 24 22 struct hpsb_packet *hpsb_make_writepacket(struct hpsb_host *host, 25 23 nodeid_t node, u64 addr, 26 24 quadlet_t *buffer, size_t length);
+102 -83
drivers/ieee1394/nodemgr.c
··· 19 19 #include <linux/mutex.h> 20 20 #include <linux/freezer.h> 21 21 #include <asm/atomic.h> 22 + #include <asm/semaphore.h> 22 23 23 24 #include "csr.h" 24 25 #include "highlevel.h" ··· 146 145 * but now we are much simpler because of the LDM. 147 146 */ 148 147 149 - static DEFINE_MUTEX(nodemgr_serialize); 150 - 151 148 struct host_info { 152 149 struct hpsb_host *host; 153 150 struct list_head list; ··· 153 154 }; 154 155 155 156 static int nodemgr_bus_match(struct device * dev, struct device_driver * drv); 156 - static int nodemgr_uevent(struct class_device *cdev, char **envp, int num_envp, 157 + static int nodemgr_uevent(struct device *dev, char **envp, int num_envp, 157 158 char *buffer, int buffer_size); 158 159 static void nodemgr_resume_ne(struct node_entry *ne); 159 160 static void nodemgr_remove_ne(struct node_entry *ne); ··· 164 165 .match = nodemgr_bus_match, 165 166 }; 166 167 167 - static void host_cls_release(struct class_device *class_dev) 168 + static void host_cls_release(struct device *dev) 168 169 { 169 - put_device(&container_of((class_dev), struct hpsb_host, class_dev)->device); 170 + put_device(&container_of((dev), struct hpsb_host, host_dev)->device); 170 171 } 171 172 172 173 struct class hpsb_host_class = { 173 174 .name = "ieee1394_host", 174 - .release = host_cls_release, 175 + .dev_release = host_cls_release, 175 176 }; 176 177 177 - static void ne_cls_release(struct class_device *class_dev) 178 + static void ne_cls_release(struct device *dev) 178 179 { 179 - put_device(&container_of((class_dev), struct node_entry, class_dev)->device); 180 + put_device(&container_of((dev), struct node_entry, node_dev)->device); 180 181 } 181 182 182 183 static struct class nodemgr_ne_class = { 183 184 .name = "ieee1394_node", 184 - .release = ne_cls_release, 185 + .dev_release = ne_cls_release, 185 186 }; 186 187 187 - static void ud_cls_release(struct class_device *class_dev) 188 + static void ud_cls_release(struct device *dev) 188 189 { 189 - put_device(&container_of((class_dev), struct unit_directory, class_dev)->device); 190 + put_device(&container_of((dev), struct unit_directory, unit_dev)->device); 190 191 } 191 192 192 193 /* The name here is only so that unit directory hotplug works with old 193 - * style hotplug, which only ever did unit directories anyway. */ 194 + * style hotplug, which only ever did unit directories anyway. 195 + */ 194 196 static struct class nodemgr_ud_class = { 195 197 .name = "ieee1394", 196 - .release = ud_cls_release, 197 - .uevent = nodemgr_uevent, 198 + .dev_release = ud_cls_release, 199 + .dev_uevent = nodemgr_uevent, 198 200 }; 199 201 200 202 static struct hpsb_highlevel nodemgr_highlevel; ··· 730 730 731 731 static void nodemgr_remove_uds(struct node_entry *ne) 732 732 { 733 - struct class_device *cdev; 733 + struct device *dev; 734 734 struct unit_directory *tmp, *ud; 735 735 736 - /* Iteration over nodemgr_ud_class.children has to be protected by 737 - * nodemgr_ud_class.sem, but class_device_unregister() will eventually 736 + /* Iteration over nodemgr_ud_class.devices has to be protected by 737 + * nodemgr_ud_class.sem, but device_unregister() will eventually 738 738 * take nodemgr_ud_class.sem too. Therefore pick out one ud at a time, 739 739 * release the semaphore, and then unregister the ud. Since this code 740 740 * may be called from other contexts besides the knodemgrds, protect the ··· 744 744 for (;;) { 745 745 ud = NULL; 746 746 down(&nodemgr_ud_class.sem); 747 - list_for_each_entry(cdev, &nodemgr_ud_class.children, node) { 748 - tmp = container_of(cdev, struct unit_directory, 749 - class_dev); 747 + list_for_each_entry(dev, &nodemgr_ud_class.devices, node) { 748 + tmp = container_of(dev, struct unit_directory, 749 + unit_dev); 750 750 if (tmp->ne == ne) { 751 751 ud = tmp; 752 752 break; ··· 755 755 up(&nodemgr_ud_class.sem); 756 756 if (ud == NULL) 757 757 break; 758 - class_device_unregister(&ud->class_dev); 758 + device_unregister(&ud->unit_dev); 759 759 device_unregister(&ud->device); 760 760 } 761 761 mutex_unlock(&nodemgr_serialize_remove_uds); ··· 772 772 773 773 HPSB_DEBUG("Node removed: ID:BUS[" NODE_BUS_FMT "] GUID[%016Lx]", 774 774 NODE_BUS_ARGS(ne->host, ne->nodeid), (unsigned long long)ne->guid); 775 - 776 775 nodemgr_remove_uds(ne); 777 776 778 - class_device_unregister(&ne->class_dev); 777 + device_unregister(&ne->node_dev); 779 778 device_unregister(dev); 780 779 781 780 put_device(dev); ··· 782 783 783 784 static int __nodemgr_remove_host_dev(struct device *dev, void *data) 784 785 { 785 - nodemgr_remove_ne(container_of(dev, struct node_entry, device)); 786 + if (dev->bus == &ieee1394_bus_type) 787 + nodemgr_remove_ne(container_of(dev, struct node_entry, 788 + device)); 786 789 return 0; 787 790 } 788 791 ··· 851 850 snprintf(ne->device.bus_id, BUS_ID_SIZE, "%016Lx", 852 851 (unsigned long long)(ne->guid)); 853 852 854 - ne->class_dev.dev = &ne->device; 855 - ne->class_dev.class = &nodemgr_ne_class; 856 - snprintf(ne->class_dev.class_id, BUS_ID_SIZE, "%016Lx", 857 - (unsigned long long)(ne->guid)); 853 + ne->node_dev.parent = &ne->device; 854 + ne->node_dev.class = &nodemgr_ne_class; 855 + snprintf(ne->node_dev.bus_id, BUS_ID_SIZE, "%016Lx", 856 + (unsigned long long)(ne->guid)); 858 857 859 858 if (device_register(&ne->device)) 860 859 goto fail_devreg; 861 - if (class_device_register(&ne->class_dev)) 860 + if (device_register(&ne->node_dev)) 862 861 goto fail_classdevreg; 863 862 get_device(&ne->device); 864 863 ··· 886 885 887 886 static struct node_entry *find_entry_by_guid(u64 guid) 888 887 { 889 - struct class_device *cdev; 888 + struct device *dev; 890 889 struct node_entry *ne, *ret_ne = NULL; 891 890 892 891 down(&nodemgr_ne_class.sem); 893 - list_for_each_entry(cdev, &nodemgr_ne_class.children, node) { 894 - ne = container_of(cdev, struct node_entry, class_dev); 892 + list_for_each_entry(dev, &nodemgr_ne_class.devices, node) { 893 + ne = container_of(dev, struct node_entry, node_dev); 895 894 896 895 if (ne->guid == guid) { 897 896 ret_ne = ne; ··· 907 906 static struct node_entry *find_entry_by_nodeid(struct hpsb_host *host, 908 907 nodeid_t nodeid) 909 908 { 910 - struct class_device *cdev; 909 + struct device *dev; 911 910 struct node_entry *ne, *ret_ne = NULL; 912 911 913 912 down(&nodemgr_ne_class.sem); 914 - list_for_each_entry(cdev, &nodemgr_ne_class.children, node) { 915 - ne = container_of(cdev, struct node_entry, class_dev); 913 + list_for_each_entry(dev, &nodemgr_ne_class.devices, node) { 914 + ne = container_of(dev, struct node_entry, node_dev); 916 915 917 916 if (ne->host == host && ne->nodeid == nodeid) { 918 917 ret_ne = ne; ··· 936 935 snprintf(ud->device.bus_id, BUS_ID_SIZE, "%s-%u", 937 936 ne->device.bus_id, ud->id); 938 937 939 - ud->class_dev.dev = &ud->device; 940 - ud->class_dev.class = &nodemgr_ud_class; 941 - snprintf(ud->class_dev.class_id, BUS_ID_SIZE, "%s-%u", 938 + ud->unit_dev.parent = &ud->device; 939 + ud->unit_dev.class = &nodemgr_ud_class; 940 + snprintf(ud->unit_dev.bus_id, BUS_ID_SIZE, "%s-%u", 942 941 ne->device.bus_id, ud->id); 943 942 944 943 if (device_register(&ud->device)) 945 944 goto fail_devreg; 946 - if (class_device_register(&ud->class_dev)) 945 + if (device_register(&ud->unit_dev)) 947 946 goto fail_classdevreg; 948 947 get_device(&ud->device); 949 948 ··· 1160 1159 1161 1160 #ifdef CONFIG_HOTPLUG 1162 1161 1163 - static int nodemgr_uevent(struct class_device *cdev, char **envp, int num_envp, 1162 + static int nodemgr_uevent(struct device *dev, char **envp, int num_envp, 1164 1163 char *buffer, int buffer_size) 1165 1164 { 1166 1165 struct unit_directory *ud; ··· 1170 1169 /* ieee1394:venNmoNspNverN */ 1171 1170 char buf[8 + 1 + 3 + 8 + 2 + 8 + 2 + 8 + 3 + 8 + 1]; 1172 1171 1173 - if (!cdev) 1172 + if (!dev) 1174 1173 return -ENODEV; 1175 1174 1176 - ud = container_of(cdev, struct unit_directory, class_dev); 1175 + ud = container_of(dev, struct unit_directory, unit_dev); 1177 1176 1178 1177 if (ud->ne->in_limbo || ud->ignore_driver) 1179 1178 return -ENODEV; ··· 1208 1207 1209 1208 #else 1210 1209 1211 - static int nodemgr_uevent(struct class_device *cdev, char **envp, int num_envp, 1210 + static int nodemgr_uevent(struct device *dev, char **envp, int num_envp, 1212 1211 char *buffer, int buffer_size) 1213 1212 { 1214 1213 return -ENODEV; ··· 1379 1378 1380 1379 static void nodemgr_suspend_ne(struct node_entry *ne) 1381 1380 { 1382 - struct class_device *cdev; 1381 + struct device *dev; 1383 1382 struct unit_directory *ud; 1383 + struct device_driver *drv; 1384 + int error; 1384 1385 1385 1386 HPSB_DEBUG("Node suspended: ID:BUS[" NODE_BUS_FMT "] GUID[%016Lx]", 1386 1387 NODE_BUS_ARGS(ne->host, ne->nodeid), (unsigned long long)ne->guid); ··· 1391 1388 WARN_ON(device_create_file(&ne->device, &dev_attr_ne_in_limbo)); 1392 1389 1393 1390 down(&nodemgr_ud_class.sem); 1394 - list_for_each_entry(cdev, &nodemgr_ud_class.children, node) { 1395 - ud = container_of(cdev, struct unit_directory, class_dev); 1391 + list_for_each_entry(dev, &nodemgr_ud_class.devices, node) { 1392 + ud = container_of(dev, struct unit_directory, unit_dev); 1396 1393 if (ud->ne != ne) 1397 1394 continue; 1398 1395 1399 - if (ud->device.driver && 1400 - (!ud->device.driver->suspend || 1401 - ud->device.driver->suspend(&ud->device, PMSG_SUSPEND))) 1396 + drv = get_driver(ud->device.driver); 1397 + if (!drv) 1398 + continue; 1399 + 1400 + error = 1; /* release if suspend is not implemented */ 1401 + if (drv->suspend) { 1402 + down(&ud->device.sem); 1403 + error = drv->suspend(&ud->device, PMSG_SUSPEND); 1404 + up(&ud->device.sem); 1405 + } 1406 + if (error) 1402 1407 device_release_driver(&ud->device); 1408 + put_driver(drv); 1403 1409 } 1404 1410 up(&nodemgr_ud_class.sem); 1405 1411 } ··· 1416 1404 1417 1405 static void nodemgr_resume_ne(struct node_entry *ne) 1418 1406 { 1419 - struct class_device *cdev; 1407 + struct device *dev; 1420 1408 struct unit_directory *ud; 1409 + struct device_driver *drv; 1421 1410 1422 1411 ne->in_limbo = 0; 1423 1412 device_remove_file(&ne->device, &dev_attr_ne_in_limbo); 1424 1413 1425 1414 down(&nodemgr_ud_class.sem); 1426 - list_for_each_entry(cdev, &nodemgr_ud_class.children, node) { 1427 - ud = container_of(cdev, struct unit_directory, class_dev); 1415 + list_for_each_entry(dev, &nodemgr_ud_class.devices, node) { 1416 + ud = container_of(dev, struct unit_directory, unit_dev); 1428 1417 if (ud->ne != ne) 1429 1418 continue; 1430 1419 1431 - if (ud->device.driver && ud->device.driver->resume) 1432 - ud->device.driver->resume(&ud->device); 1420 + drv = get_driver(ud->device.driver); 1421 + if (!drv) 1422 + continue; 1423 + 1424 + if (drv->resume) { 1425 + down(&ud->device.sem); 1426 + drv->resume(&ud->device); 1427 + up(&ud->device.sem); 1428 + } 1429 + put_driver(drv); 1433 1430 } 1434 1431 up(&nodemgr_ud_class.sem); 1435 1432 ··· 1449 1428 1450 1429 static void nodemgr_update_pdrv(struct node_entry *ne) 1451 1430 { 1431 + struct device *dev; 1452 1432 struct unit_directory *ud; 1433 + struct device_driver *drv; 1453 1434 struct hpsb_protocol_driver *pdrv; 1454 - struct class_device *cdev; 1435 + int error; 1455 1436 1456 1437 down(&nodemgr_ud_class.sem); 1457 - list_for_each_entry(cdev, &nodemgr_ud_class.children, node) { 1458 - ud = container_of(cdev, struct unit_directory, class_dev); 1438 + list_for_each_entry(dev, &nodemgr_ud_class.devices, node) { 1439 + ud = container_of(dev, struct unit_directory, unit_dev); 1459 1440 if (ud->ne != ne) 1460 1441 continue; 1461 1442 1462 - if (ud->device.driver) { 1463 - pdrv = container_of(ud->device.driver, 1464 - struct hpsb_protocol_driver, 1465 - driver); 1466 - if (pdrv->update && pdrv->update(ud)) 1467 - device_release_driver(&ud->device); 1443 + drv = get_driver(ud->device.driver); 1444 + if (!drv) 1445 + continue; 1446 + 1447 + error = 0; 1448 + pdrv = container_of(drv, struct hpsb_protocol_driver, driver); 1449 + if (pdrv->update) { 1450 + down(&ud->device.sem); 1451 + error = pdrv->update(ud); 1452 + up(&ud->device.sem); 1468 1453 } 1454 + if (error) 1455 + device_release_driver(&ud->device); 1456 + put_driver(drv); 1469 1457 } 1470 1458 up(&nodemgr_ud_class.sem); 1471 1459 } ··· 1539 1509 static void nodemgr_node_probe(struct host_info *hi, int generation) 1540 1510 { 1541 1511 struct hpsb_host *host = hi->host; 1542 - struct class_device *cdev; 1512 + struct device *dev; 1543 1513 struct node_entry *ne; 1544 1514 1545 1515 /* Do some processing of the nodes we've probed. This pulls them ··· 1552 1522 * improvement...) */ 1553 1523 1554 1524 down(&nodemgr_ne_class.sem); 1555 - list_for_each_entry(cdev, &nodemgr_ne_class.children, node) { 1556 - ne = container_of(cdev, struct node_entry, class_dev); 1525 + list_for_each_entry(dev, &nodemgr_ne_class.devices, node) { 1526 + ne = container_of(dev, struct node_entry, node_dev); 1557 1527 if (!ne->needs_probe) 1558 1528 nodemgr_probe_ne(hi, ne, generation); 1559 1529 } 1560 - list_for_each_entry(cdev, &nodemgr_ne_class.children, node) { 1561 - ne = container_of(cdev, struct node_entry, class_dev); 1530 + list_for_each_entry(dev, &nodemgr_ne_class.devices, node) { 1531 + ne = container_of(dev, struct node_entry, node_dev); 1562 1532 if (ne->needs_probe) 1563 1533 nodemgr_probe_ne(hi, ne, generation); 1564 1534 } ··· 1716 1686 if (kthread_should_stop()) 1717 1687 goto exit; 1718 1688 1719 - if (mutex_lock_interruptible(&nodemgr_serialize)) { 1720 - if (try_to_freeze()) 1721 - continue; 1722 - goto exit; 1723 - } 1724 - 1725 1689 /* Pause for 1/4 second in 1/16 second intervals, 1726 1690 * to make sure things settle down. */ 1727 1691 g = get_hpsb_generation(host); 1728 1692 for (i = 0; i < 4 ; i++) { 1729 1693 if (msleep_interruptible(63) || kthread_should_stop()) 1730 - goto unlock_exit; 1694 + goto exit; 1731 1695 1732 1696 /* Now get the generation in which the node ID's we collect 1733 1697 * are valid. During the bus scan we will use this generation ··· 1739 1715 if (!nodemgr_check_irm_capability(host, reset_cycles) || 1740 1716 !nodemgr_do_irm_duties(host, reset_cycles)) { 1741 1717 reset_cycles++; 1742 - mutex_unlock(&nodemgr_serialize); 1743 1718 continue; 1744 1719 } 1745 1720 reset_cycles = 0; ··· 1755 1732 1756 1733 /* Update some of our sysfs symlinks */ 1757 1734 nodemgr_update_host_dev_links(host); 1758 - 1759 - mutex_unlock(&nodemgr_serialize); 1760 1735 } 1761 - unlock_exit: 1762 - mutex_unlock(&nodemgr_serialize); 1763 1736 exit: 1764 1737 HPSB_VERBOSE("NodeMgr: Exiting thread"); 1765 1738 return 0; ··· 1775 1756 */ 1776 1757 int nodemgr_for_each_host(void *data, int (*cb)(struct hpsb_host *, void *)) 1777 1758 { 1778 - struct class_device *cdev; 1759 + struct device *dev; 1779 1760 struct hpsb_host *host; 1780 1761 int error = 0; 1781 1762 1782 1763 down(&hpsb_host_class.sem); 1783 - list_for_each_entry(cdev, &hpsb_host_class.children, node) { 1784 - host = container_of(cdev, struct hpsb_host, class_dev); 1764 + list_for_each_entry(dev, &hpsb_host_class.devices, node) { 1765 + host = container_of(dev, struct hpsb_host, host_dev); 1785 1766 1786 1767 if ((error = cb(host, data))) 1787 1768 break;
+2 -2
drivers/ieee1394/nodemgr.h
··· 84 84 int length; /* Number of quadlets */ 85 85 86 86 struct device device; 87 - struct class_device class_dev; 87 + struct device unit_dev; 88 88 89 89 struct csr1212_keyval *ud_kv; 90 90 u32 lun; /* logical unit number immediate value */ ··· 107 107 u32 capabilities; 108 108 109 109 struct device device; 110 - struct class_device class_dev; 110 + struct device node_dev; 111 111 112 112 /* Means this node is not attached anymore */ 113 113 int in_limbo;
+18 -254
drivers/ieee1394/ohci1394.c
··· 138 138 #define DBGMSG(fmt, args...) do {} while (0) 139 139 #endif 140 140 141 - #ifdef CONFIG_IEEE1394_OHCI_DMA_DEBUG 142 - #define OHCI_DMA_ALLOC(fmt, args...) \ 143 - HPSB_ERR("%s(%s)alloc(%d): "fmt, OHCI1394_DRIVER_NAME, __FUNCTION__, \ 144 - ++global_outstanding_dmas, ## args) 145 - #define OHCI_DMA_FREE(fmt, args...) \ 146 - HPSB_ERR("%s(%s)free(%d): "fmt, OHCI1394_DRIVER_NAME, __FUNCTION__, \ 147 - --global_outstanding_dmas, ## args) 148 - static int global_outstanding_dmas = 0; 149 - #else 150 - #define OHCI_DMA_ALLOC(fmt, args...) do {} while (0) 151 - #define OHCI_DMA_FREE(fmt, args...) do {} while (0) 152 - #endif 153 - 154 141 /* print general (card independent) information */ 155 142 #define PRINT_G(level, fmt, args...) \ 156 143 printk(level "%s: " fmt "\n" , OHCI1394_DRIVER_NAME , ## args) ··· 157 170 static int alloc_dma_rcv_ctx(struct ti_ohci *ohci, struct dma_rcv_ctx *d, 158 171 enum context_type type, int ctx, int num_desc, 159 172 int buf_size, int split_buf_size, int context_base); 160 - static void stop_dma_rcv_ctx(struct dma_rcv_ctx *d); 161 173 static void free_dma_rcv_ctx(struct dma_rcv_ctx *d); 162 174 163 175 static int alloc_dma_trm_ctx(struct ti_ohci *ohci, struct dma_trm_ctx *d, ··· 519 533 initialize_dma_trm_ctx(&ohci->at_req_context); 520 534 initialize_dma_trm_ctx(&ohci->at_resp_context); 521 535 522 - /* Initialize IR Legacy DMA channel mask */ 523 - ohci->ir_legacy_channels = 0; 524 - 525 536 /* Accept AR requests from all nodes */ 526 537 reg_write(ohci, OHCI1394_AsReqFilterHiSet, 0x80000000); 527 538 ··· 716 733 pci_map_single(ohci->dev, packet->data, 717 734 packet->data_size, 718 735 PCI_DMA_TODEVICE)); 719 - OHCI_DMA_ALLOC("single, block transmit packet"); 720 736 721 737 d->prg_cpu[idx]->end.branchAddress = 0; 722 738 d->prg_cpu[idx]->end.status = 0; ··· 765 783 d->prg_cpu[idx]->end.address = cpu_to_le32( 766 784 pci_map_single(ohci->dev, packet->data, 767 785 packet->data_size, PCI_DMA_TODEVICE)); 768 - OHCI_DMA_ALLOC("single, iso transmit packet"); 769 786 770 787 d->prg_cpu[idx]->end.branchAddress = 0; 771 788 d->prg_cpu[idx]->end.status = 0; ··· 865 884 return -EOVERFLOW; 866 885 } 867 886 868 - /* Decide whether we have an iso, a request, or a response packet */ 869 887 if (packet->type == hpsb_raw) 870 888 d = &ohci->at_req_context; 871 - else if ((packet->tcode == TCODE_ISO_DATA) && (packet->type == hpsb_iso)) { 872 - /* The legacy IT DMA context is initialized on first 873 - * use. However, the alloc cannot be run from 874 - * interrupt context, so we bail out if that is the 875 - * case. I don't see anyone sending ISO packets from 876 - * interrupt context anyway... */ 877 - 878 - if (ohci->it_legacy_context.ohci == NULL) { 879 - if (in_interrupt()) { 880 - PRINT(KERN_ERR, 881 - "legacy IT context cannot be initialized during interrupt"); 882 - return -EINVAL; 883 - } 884 - 885 - if (alloc_dma_trm_ctx(ohci, &ohci->it_legacy_context, 886 - DMA_CTX_ISO, 0, IT_NUM_DESC, 887 - OHCI1394_IsoXmitContextBase) < 0) { 888 - PRINT(KERN_ERR, 889 - "error initializing legacy IT context"); 890 - return -ENOMEM; 891 - } 892 - 893 - initialize_dma_trm_ctx(&ohci->it_legacy_context); 894 - } 895 - 896 - d = &ohci->it_legacy_context; 897 - } else if ((packet->tcode & 0x02) && (packet->tcode != TCODE_ISO_DATA)) 889 + else if ((packet->tcode & 0x02) && (packet->tcode != TCODE_ISO_DATA)) 898 890 d = &ohci->at_resp_context; 899 891 else 900 892 d = &ohci->at_req_context; ··· 886 932 static int ohci_devctl(struct hpsb_host *host, enum devctl_cmd cmd, int arg) 887 933 { 888 934 struct ti_ohci *ohci = host->hostdata; 889 - int retval = 0; 890 - unsigned long flags; 891 - int phy_reg; 935 + int retval = 0, phy_reg; 892 936 893 937 switch (cmd) { 894 938 case RESET_BUS: ··· 979 1027 dma_trm_reset(&ohci->at_resp_context); 980 1028 break; 981 1029 982 - case ISO_LISTEN_CHANNEL: 983 - { 984 - u64 mask; 985 - struct dma_rcv_ctx *d = &ohci->ir_legacy_context; 986 - int ir_legacy_active; 987 - 988 - if (arg<0 || arg>63) { 989 - PRINT(KERN_ERR, 990 - "%s: IS0 listen channel %d is out of range", 991 - __FUNCTION__, arg); 992 - return -EFAULT; 993 - } 994 - 995 - mask = (u64)0x1<<arg; 996 - 997 - spin_lock_irqsave(&ohci->IR_channel_lock, flags); 998 - 999 - if (ohci->ISO_channel_usage & mask) { 1000 - PRINT(KERN_ERR, 1001 - "%s: IS0 listen channel %d is already used", 1002 - __FUNCTION__, arg); 1003 - spin_unlock_irqrestore(&ohci->IR_channel_lock, flags); 1004 - return -EFAULT; 1005 - } 1006 - 1007 - ir_legacy_active = ohci->ir_legacy_channels; 1008 - 1009 - ohci->ISO_channel_usage |= mask; 1010 - ohci->ir_legacy_channels |= mask; 1011 - 1012 - spin_unlock_irqrestore(&ohci->IR_channel_lock, flags); 1013 - 1014 - if (!ir_legacy_active) { 1015 - if (ohci1394_register_iso_tasklet(ohci, 1016 - &ohci->ir_legacy_tasklet) < 0) { 1017 - PRINT(KERN_ERR, "No IR DMA context available"); 1018 - return -EBUSY; 1019 - } 1020 - 1021 - /* the IR context can be assigned to any DMA context 1022 - * by ohci1394_register_iso_tasklet */ 1023 - d->ctx = ohci->ir_legacy_tasklet.context; 1024 - d->ctrlSet = OHCI1394_IsoRcvContextControlSet + 1025 - 32*d->ctx; 1026 - d->ctrlClear = OHCI1394_IsoRcvContextControlClear + 1027 - 32*d->ctx; 1028 - d->cmdPtr = OHCI1394_IsoRcvCommandPtr + 32*d->ctx; 1029 - d->ctxtMatch = OHCI1394_IsoRcvContextMatch + 32*d->ctx; 1030 - 1031 - initialize_dma_rcv_ctx(&ohci->ir_legacy_context, 1); 1032 - 1033 - if (printk_ratelimit()) 1034 - DBGMSG("IR legacy activated"); 1035 - } 1036 - 1037 - spin_lock_irqsave(&ohci->IR_channel_lock, flags); 1038 - 1039 - if (arg>31) 1040 - reg_write(ohci, OHCI1394_IRMultiChanMaskHiSet, 1041 - 1<<(arg-32)); 1042 - else 1043 - reg_write(ohci, OHCI1394_IRMultiChanMaskLoSet, 1044 - 1<<arg); 1045 - 1046 - spin_unlock_irqrestore(&ohci->IR_channel_lock, flags); 1047 - DBGMSG("Listening enabled on channel %d", arg); 1048 - break; 1049 - } 1050 - case ISO_UNLISTEN_CHANNEL: 1051 - { 1052 - u64 mask; 1053 - 1054 - if (arg<0 || arg>63) { 1055 - PRINT(KERN_ERR, 1056 - "%s: IS0 unlisten channel %d is out of range", 1057 - __FUNCTION__, arg); 1058 - return -EFAULT; 1059 - } 1060 - 1061 - mask = (u64)0x1<<arg; 1062 - 1063 - spin_lock_irqsave(&ohci->IR_channel_lock, flags); 1064 - 1065 - if (!(ohci->ISO_channel_usage & mask)) { 1066 - PRINT(KERN_ERR, 1067 - "%s: IS0 unlisten channel %d is not used", 1068 - __FUNCTION__, arg); 1069 - spin_unlock_irqrestore(&ohci->IR_channel_lock, flags); 1070 - return -EFAULT; 1071 - } 1072 - 1073 - ohci->ISO_channel_usage &= ~mask; 1074 - ohci->ir_legacy_channels &= ~mask; 1075 - 1076 - if (arg>31) 1077 - reg_write(ohci, OHCI1394_IRMultiChanMaskHiClear, 1078 - 1<<(arg-32)); 1079 - else 1080 - reg_write(ohci, OHCI1394_IRMultiChanMaskLoClear, 1081 - 1<<arg); 1082 - 1083 - spin_unlock_irqrestore(&ohci->IR_channel_lock, flags); 1084 - DBGMSG("Listening disabled on channel %d", arg); 1085 - 1086 - if (ohci->ir_legacy_channels == 0) { 1087 - stop_dma_rcv_ctx(&ohci->ir_legacy_context); 1088 - DBGMSG("ISO legacy receive context stopped"); 1089 - } 1090 - 1091 - break; 1092 - } 1093 1030 default: 1094 1031 PRINT_G(KERN_ERR, "ohci_devctl cmd %d not implemented yet", 1095 1032 cmd); ··· 2710 2869 list_del_init(&packet->driver_list); 2711 2870 hpsb_packet_sent(ohci->host, packet, ack); 2712 2871 2713 - if (datasize) { 2872 + if (datasize) 2714 2873 pci_unmap_single(ohci->dev, 2715 2874 cpu_to_le32(d->prg_cpu[d->sent_ind]->end.address), 2716 2875 datasize, PCI_DMA_TODEVICE); 2717 - OHCI_DMA_FREE("single Xmit data packet"); 2718 - } 2719 2876 2720 2877 d->sent_ind = (d->sent_ind+1)%d->num_desc; 2721 2878 d->free_prgs++; ··· 2723 2884 2724 2885 spin_unlock_irqrestore(&d->lock, flags); 2725 2886 } 2726 - 2727 - static void stop_dma_rcv_ctx(struct dma_rcv_ctx *d) 2728 - { 2729 - if (d->ctrlClear) { 2730 - ohci1394_stop_context(d->ohci, d->ctrlClear, NULL); 2731 - 2732 - if (d->type == DMA_CTX_ISO) { 2733 - /* disable interrupts */ 2734 - reg_write(d->ohci, OHCI1394_IsoRecvIntMaskClear, 1 << d->ctx); 2735 - ohci1394_unregister_iso_tasklet(d->ohci, &d->ohci->ir_legacy_tasklet); 2736 - } else { 2737 - tasklet_kill(&d->task); 2738 - } 2739 - } 2740 - } 2741 - 2742 2887 2743 2888 static void free_dma_rcv_ctx(struct dma_rcv_ctx *d) 2744 2889 { ··· 2736 2913 2737 2914 if (d->buf_cpu) { 2738 2915 for (i=0; i<d->num_desc; i++) 2739 - if (d->buf_cpu[i] && d->buf_bus[i]) { 2916 + if (d->buf_cpu[i] && d->buf_bus[i]) 2740 2917 pci_free_consistent( 2741 2918 ohci->dev, d->buf_size, 2742 2919 d->buf_cpu[i], d->buf_bus[i]); 2743 - OHCI_DMA_FREE("consistent dma_rcv buf[%d]", i); 2744 - } 2745 2920 kfree(d->buf_cpu); 2746 2921 kfree(d->buf_bus); 2747 2922 } 2748 2923 if (d->prg_cpu) { 2749 2924 for (i=0; i<d->num_desc; i++) 2750 - if (d->prg_cpu[i] && d->prg_bus[i]) { 2751 - pci_pool_free(d->prg_pool, d->prg_cpu[i], d->prg_bus[i]); 2752 - OHCI_DMA_FREE("consistent dma_rcv prg[%d]", i); 2753 - } 2925 + if (d->prg_cpu[i] && d->prg_bus[i]) 2926 + pci_pool_free(d->prg_pool, d->prg_cpu[i], 2927 + d->prg_bus[i]); 2754 2928 pci_pool_destroy(d->prg_pool); 2755 - OHCI_DMA_FREE("dma_rcv prg pool"); 2756 2929 kfree(d->prg_cpu); 2757 2930 kfree(d->prg_bus); 2758 2931 } ··· 2817 2998 } 2818 2999 num_allocs++; 2819 3000 2820 - OHCI_DMA_ALLOC("dma_rcv prg pool"); 2821 - 2822 3001 for (i=0; i<d->num_desc; i++) { 2823 3002 d->buf_cpu[i] = pci_alloc_consistent(ohci->dev, 2824 3003 d->buf_size, 2825 3004 d->buf_bus+i); 2826 - OHCI_DMA_ALLOC("consistent dma_rcv buf[%d]", i); 2827 3005 2828 3006 if (d->buf_cpu[i] != NULL) { 2829 3007 memset(d->buf_cpu[i], 0, d->buf_size); ··· 2832 3016 } 2833 3017 2834 3018 d->prg_cpu[i] = pci_pool_alloc(d->prg_pool, GFP_KERNEL, d->prg_bus+i); 2835 - OHCI_DMA_ALLOC("pool dma_rcv prg[%d]", i); 2836 3019 2837 3020 if (d->prg_cpu[i] != NULL) { 2838 3021 memset(d->prg_cpu[i], 0, sizeof(struct dma_cmd)); ··· 2845 3030 2846 3031 spin_lock_init(&d->lock); 2847 3032 2848 - if (type == DMA_CTX_ISO) { 2849 - ohci1394_init_iso_tasklet(&ohci->ir_legacy_tasklet, 2850 - OHCI_ISO_MULTICHANNEL_RECEIVE, 2851 - dma_rcv_tasklet, (unsigned long) d); 2852 - } else { 2853 - d->ctrlSet = context_base + OHCI1394_ContextControlSet; 2854 - d->ctrlClear = context_base + OHCI1394_ContextControlClear; 2855 - d->cmdPtr = context_base + OHCI1394_ContextCommandPtr; 3033 + d->ctrlSet = context_base + OHCI1394_ContextControlSet; 3034 + d->ctrlClear = context_base + OHCI1394_ContextControlClear; 3035 + d->cmdPtr = context_base + OHCI1394_ContextCommandPtr; 2856 3036 2857 - tasklet_init (&d->task, dma_rcv_tasklet, (unsigned long) d); 2858 - } 2859 - 3037 + tasklet_init(&d->task, dma_rcv_tasklet, (unsigned long) d); 2860 3038 return 0; 2861 3039 } 2862 3040 ··· 2865 3057 2866 3058 if (d->prg_cpu) { 2867 3059 for (i=0; i<d->num_desc; i++) 2868 - if (d->prg_cpu[i] && d->prg_bus[i]) { 2869 - pci_pool_free(d->prg_pool, d->prg_cpu[i], d->prg_bus[i]); 2870 - OHCI_DMA_FREE("pool dma_trm prg[%d]", i); 2871 - } 3060 + if (d->prg_cpu[i] && d->prg_bus[i]) 3061 + pci_pool_free(d->prg_pool, d->prg_cpu[i], 3062 + d->prg_bus[i]); 2872 3063 pci_pool_destroy(d->prg_pool); 2873 - OHCI_DMA_FREE("dma_trm prg pool"); 2874 3064 kfree(d->prg_cpu); 2875 3065 kfree(d->prg_bus); 2876 3066 } ··· 2914 3108 } 2915 3109 num_allocs++; 2916 3110 2917 - OHCI_DMA_ALLOC("dma_rcv prg pool"); 2918 - 2919 3111 for (i = 0; i < d->num_desc; i++) { 2920 3112 d->prg_cpu[i] = pci_pool_alloc(d->prg_pool, GFP_KERNEL, d->prg_bus+i); 2921 - OHCI_DMA_ALLOC("pool dma_trm prg[%d]", i); 2922 3113 2923 3114 if (d->prg_cpu[i] != NULL) { 2924 3115 memset(d->prg_cpu[i], 0, sizeof(struct at_dma_prg)); ··· 2930 3127 spin_lock_init(&d->lock); 2931 3128 2932 3129 /* initialize tasklet */ 2933 - if (type == DMA_CTX_ISO) { 2934 - ohci1394_init_iso_tasklet(&ohci->it_legacy_tasklet, OHCI_ISO_TRANSMIT, 2935 - dma_trm_tasklet, (unsigned long) d); 2936 - if (ohci1394_register_iso_tasklet(ohci, 2937 - &ohci->it_legacy_tasklet) < 0) { 2938 - PRINT(KERN_ERR, "No IT DMA context available"); 2939 - free_dma_trm_ctx(d); 2940 - return -EBUSY; 2941 - } 2942 - 2943 - /* IT can be assigned to any context by register_iso_tasklet */ 2944 - d->ctx = ohci->it_legacy_tasklet.context; 2945 - d->ctrlSet = OHCI1394_IsoXmitContextControlSet + 16 * d->ctx; 2946 - d->ctrlClear = OHCI1394_IsoXmitContextControlClear + 16 * d->ctx; 2947 - d->cmdPtr = OHCI1394_IsoXmitCommandPtr + 16 * d->ctx; 2948 - } else { 2949 - d->ctrlSet = context_base + OHCI1394_ContextControlSet; 2950 - d->ctrlClear = context_base + OHCI1394_ContextControlClear; 2951 - d->cmdPtr = context_base + OHCI1394_ContextCommandPtr; 2952 - tasklet_init (&d->task, dma_trm_tasklet, (unsigned long)d); 2953 - } 2954 - 3130 + d->ctrlSet = context_base + OHCI1394_ContextControlSet; 3131 + d->ctrlClear = context_base + OHCI1394_ContextControlClear; 3132 + d->cmdPtr = context_base + OHCI1394_ContextCommandPtr; 3133 + tasklet_init(&d->task, dma_trm_tasklet, (unsigned long)d); 2955 3134 return 0; 2956 3135 } 2957 3136 ··· 3079 3294 ohci->csr_config_rom_cpu = 3080 3295 pci_alloc_consistent(ohci->dev, OHCI_CONFIG_ROM_LEN, 3081 3296 &ohci->csr_config_rom_bus); 3082 - OHCI_DMA_ALLOC("consistent csr_config_rom"); 3083 3297 if (ohci->csr_config_rom_cpu == NULL) 3084 3298 FAIL(-ENOMEM, "Failed to allocate buffer config rom"); 3085 3299 ohci->init_state = OHCI_INIT_HAVE_CONFIG_ROM_BUFFER; ··· 3087 3303 ohci->selfid_buf_cpu = 3088 3304 pci_alloc_consistent(ohci->dev, OHCI1394_SI_DMA_BUF_SIZE, 3089 3305 &ohci->selfid_buf_bus); 3090 - OHCI_DMA_ALLOC("consistent selfid_buf"); 3091 - 3092 3306 if (ohci->selfid_buf_cpu == NULL) 3093 3307 FAIL(-ENOMEM, "Failed to allocate DMA buffer for self-id packets"); 3094 3308 ohci->init_state = OHCI_INIT_HAVE_SELFID_BUFFER; ··· 3159 3377 ohci->ISO_channel_usage = 0; 3160 3378 spin_lock_init(&ohci->IR_channel_lock); 3161 3379 3162 - /* Allocate the IR DMA context right here so we don't have 3163 - * to do it in interrupt path - note that this doesn't 3164 - * waste much memory and avoids the jugglery required to 3165 - * allocate it in IRQ path. */ 3166 - if (alloc_dma_rcv_ctx(ohci, &ohci->ir_legacy_context, 3167 - DMA_CTX_ISO, 0, IR_NUM_DESC, 3168 - IR_BUF_SIZE, IR_SPLIT_BUF_SIZE, 3169 - OHCI1394_IsoRcvContextBase) < 0) { 3170 - FAIL(-ENOMEM, "Cannot allocate IR Legacy DMA context"); 3171 - } 3172 - 3173 - /* We hopefully don't have to pre-allocate IT DMA like we did 3174 - * for IR DMA above. Allocate it on-demand and mark inactive. */ 3175 - ohci->it_legacy_context.ohci = NULL; 3176 3380 spin_lock_init(&ohci->event_lock); 3177 3381 3178 3382 /* ··· 3251 3483 free_dma_rcv_ctx(&ohci->ar_resp_context); 3252 3484 free_dma_trm_ctx(&ohci->at_req_context); 3253 3485 free_dma_trm_ctx(&ohci->at_resp_context); 3254 - free_dma_rcv_ctx(&ohci->ir_legacy_context); 3255 - free_dma_trm_ctx(&ohci->it_legacy_context); 3256 3486 3257 3487 case OHCI_INIT_HAVE_SELFID_BUFFER: 3258 3488 pci_free_consistent(ohci->dev, OHCI1394_SI_DMA_BUF_SIZE, 3259 3489 ohci->selfid_buf_cpu, 3260 3490 ohci->selfid_buf_bus); 3261 - OHCI_DMA_FREE("consistent selfid_buf"); 3262 3491 3263 3492 case OHCI_INIT_HAVE_CONFIG_ROM_BUFFER: 3264 3493 pci_free_consistent(ohci->dev, OHCI_CONFIG_ROM_LEN, 3265 3494 ohci->csr_config_rom_cpu, 3266 3495 ohci->csr_config_rom_bus); 3267 - OHCI_DMA_FREE("consistent csr_config_rom"); 3268 3496 3269 3497 case OHCI_INIT_HAVE_IOMAPPING: 3270 3498 iounmap(ohci->registers);
-14
drivers/ieee1394/ohci1394.h
··· 190 190 unsigned long ir_multichannel_used; /* ditto */ 191 191 spinlock_t IR_channel_lock; 192 192 193 - /* iso receive (legacy API) */ 194 - u64 ir_legacy_channels; /* note: this differs from ISO_channel_usage; 195 - it only accounts for channels listened to 196 - by the legacy API, so that we can know when 197 - it is safe to free the legacy API context */ 198 - 199 - struct dma_rcv_ctx ir_legacy_context; 200 - struct ohci1394_iso_tasklet ir_legacy_tasklet; 201 - 202 193 /* iso transmit */ 203 194 int nb_iso_xmit_ctx; 204 195 unsigned long it_ctx_usage; /* use test_and_set_bit() for atomicity */ 205 - 206 - /* iso transmit (legacy API) */ 207 - struct dma_trm_ctx it_legacy_context; 208 - struct ohci1394_iso_tasklet it_legacy_tasklet; 209 196 210 197 u64 ISO_channel_usage; 211 198 ··· 208 221 209 222 /* Tasklets for iso receive and transmit, used by video1394 210 223 * and dv1394 */ 211 - 212 224 struct list_head iso_tasklet_list; 213 225 spinlock_t iso_tasklet_list_lock; 214 226
+12 -4
drivers/ieee1394/pcilynx.c
··· 477 477 struct lynx_send_data *d; 478 478 struct hpsb_packet *packet; 479 479 480 + #if 0 /* has been removed from ieee1394 core */ 480 481 d = (what == hpsb_iso ? &lynx->iso_send : &lynx->async); 482 + #else 483 + d = &lynx->async; 484 + #endif 481 485 if (!list_empty(&d->pcl_queue)) { 482 486 PRINT(KERN_ERR, lynx->id, "trying to queue a new packet in nonempty fifo"); 483 487 BUG(); ··· 515 511 case hpsb_async: 516 512 pcl.buffer[0].control |= PCL_CMD_XMT; 517 513 break; 514 + #if 0 /* has been removed from ieee1394 core */ 518 515 case hpsb_iso: 519 516 pcl.buffer[0].control |= PCL_CMD_XMT | PCL_ISOMODE; 520 517 break; 518 + #endif 521 519 case hpsb_raw: 522 520 pcl.buffer[0].control |= PCL_CMD_UNFXMT; 523 521 break; ··· 548 542 case hpsb_raw: 549 543 d = &lynx->async; 550 544 break; 545 + #if 0 /* has been removed from ieee1394 core */ 551 546 case hpsb_iso: 552 547 d = &lynx->iso_send; 553 548 break; 549 + #endif 554 550 default: 555 551 PRINT(KERN_ERR, lynx->id, "invalid packet type %d", 556 552 packet->type); ··· 805 797 } 806 798 807 799 break; 808 - 800 + #if 0 /* has been removed from ieee1394 core */ 809 801 case ISO_LISTEN_CHANNEL: 810 802 spin_lock_irqsave(&lynx->iso_rcv.lock, flags); 811 803 ··· 827 819 828 820 spin_unlock_irqrestore(&lynx->iso_rcv.lock, flags); 829 821 break; 830 - 822 + #endif 831 823 default: 832 824 PRINT(KERN_ERR, lynx->id, "unknown devctl command %d", cmd); 833 825 retval = -1; ··· 1017 1009 pci_unmap_single(lynx->dev, lynx->iso_send.data_dma, 1018 1010 packet->data_size, PCI_DMA_TODEVICE); 1019 1011 } 1020 - 1012 + #if 0 /* has been removed from ieee1394 core */ 1021 1013 if (!list_empty(&lynx->iso_send.queue)) { 1022 1014 send_next(lynx, hpsb_iso); 1023 1015 } 1024 - 1016 + #endif 1025 1017 spin_unlock(&lynx->iso_send.queue_lock); 1026 1018 1027 1019 if (pcl.pcl_status & DMA_CHAN_STAT_PKTCMPL) {
-5
drivers/ieee1394/raw1394-private.h
··· 36 36 37 37 u8 __user *fcp_buffer; 38 38 39 - /* old ISO API */ 40 - u64 listen_channels; 41 - quadlet_t __user *iso_buffer; 42 - size_t iso_buffer_length; 43 - 44 39 u8 notification; /* (busreset-notification) RAW1394_NOTIFY_OFF/ON */ 45 40 46 41 /* new rawiso API */
+152 -212
drivers/ieee1394/raw1394.c
··· 98 98 99 99 static void queue_complete_cb(struct pending_request *req); 100 100 101 - #include <asm/current.h> 102 - static void print_old_iso_deprecation(void) 103 - { 104 - static pid_t p; 105 - 106 - if (p == current->pid) 107 - return; 108 - p = current->pid; 109 - printk(KERN_WARNING "raw1394: WARNING - Program \"%s\" uses unsupported" 110 - " isochronous request types which will be removed in a next" 111 - " kernel release\n", current->comm); 112 - printk(KERN_WARNING "raw1394: Update your software to use libraw1394's" 113 - " newer interface\n"); 114 - } 115 - 116 101 static struct pending_request *__alloc_pending_request(gfp_t flags) 117 102 { 118 103 struct pending_request *req; ··· 282 297 spin_unlock_irqrestore(&host_info_lock, flags); 283 298 } 284 299 285 - static void iso_receive(struct hpsb_host *host, int channel, quadlet_t * data, 286 - size_t length) 287 - { 288 - unsigned long flags; 289 - struct host_info *hi; 290 - struct file_info *fi; 291 - struct pending_request *req, *req_next; 292 - struct iso_block_store *ibs = NULL; 293 - LIST_HEAD(reqs); 294 - 295 - if ((atomic_read(&iso_buffer_size) + length) > iso_buffer_max) { 296 - HPSB_INFO("dropped iso packet"); 297 - return; 298 - } 299 - 300 - spin_lock_irqsave(&host_info_lock, flags); 301 - hi = find_host_info(host); 302 - 303 - if (hi != NULL) { 304 - list_for_each_entry(fi, &hi->file_info_list, list) { 305 - if (!(fi->listen_channels & (1ULL << channel))) 306 - continue; 307 - 308 - req = __alloc_pending_request(GFP_ATOMIC); 309 - if (!req) 310 - break; 311 - 312 - if (!ibs) { 313 - ibs = kmalloc(sizeof(*ibs) + length, 314 - GFP_ATOMIC); 315 - if (!ibs) { 316 - kfree(req); 317 - break; 318 - } 319 - 320 - atomic_add(length, &iso_buffer_size); 321 - atomic_set(&ibs->refcount, 0); 322 - ibs->data_size = length; 323 - memcpy(ibs->data, data, length); 324 - } 325 - 326 - atomic_inc(&ibs->refcount); 327 - 328 - req->file_info = fi; 329 - req->ibs = ibs; 330 - req->data = ibs->data; 331 - req->req.type = RAW1394_REQ_ISO_RECEIVE; 332 - req->req.generation = get_hpsb_generation(host); 333 - req->req.misc = 0; 334 - req->req.recvb = ptr2int(fi->iso_buffer); 335 - req->req.length = min(length, fi->iso_buffer_length); 336 - 337 - list_add_tail(&req->list, &reqs); 338 - } 339 - } 340 - spin_unlock_irqrestore(&host_info_lock, flags); 341 - 342 - list_for_each_entry_safe(req, req_next, &reqs, list) 343 - queue_complete_req(req); 344 - } 345 - 346 300 static void fcp_request(struct hpsb_host *host, int nodeid, int direction, 347 301 int cts, u8 * data, size_t length) 348 302 { ··· 358 434 359 435 __u64 sendb; 360 436 __u64 recvb; 361 - } __attribute__((packed)); 437 + } 438 + #if defined(CONFIG_X86_64) || defined(CONFIG_IA64) 439 + __attribute__((packed)) 440 + #endif 441 + ; 362 442 363 443 static const char __user *raw1394_compat_write(const char __user *buf) 364 444 { ··· 387 459 static int 388 460 raw1394_compat_read(const char __user *buf, struct raw1394_request *r) 389 461 { 390 - struct compat_raw1394_req __user *cr = (typeof(cr)) r; 462 + struct compat_raw1394_req __user *cr = (typeof(cr)) buf; 391 463 if (!access_ok(VERIFY_WRITE, cr, sizeof(struct compat_raw1394_req)) || 392 464 P(type) || 393 465 P(error) || ··· 515 587 516 588 req->req.length = 0; 517 589 queue_complete_req(req); 518 - return sizeof(struct raw1394_request); 590 + return 0; 519 591 } 520 592 521 593 static int state_initialized(struct file_info *fi, struct pending_request *req) ··· 529 601 req->req.generation = atomic_read(&internal_generation); 530 602 req->req.length = 0; 531 603 queue_complete_req(req); 532 - return sizeof(struct raw1394_request); 604 + return 0; 533 605 } 534 606 535 607 switch (req->req.type) { ··· 601 673 } 602 674 603 675 queue_complete_req(req); 604 - return sizeof(struct raw1394_request); 605 - } 606 - 607 - static void handle_iso_listen(struct file_info *fi, struct pending_request *req) 608 - { 609 - int channel = req->req.misc; 610 - 611 - if ((channel > 63) || (channel < -64)) { 612 - req->req.error = RAW1394_ERROR_INVALID_ARG; 613 - } else if (channel >= 0) { 614 - /* allocate channel req.misc */ 615 - if (fi->listen_channels & (1ULL << channel)) { 616 - req->req.error = RAW1394_ERROR_ALREADY; 617 - } else { 618 - if (hpsb_listen_channel 619 - (&raw1394_highlevel, fi->host, channel)) { 620 - req->req.error = RAW1394_ERROR_ALREADY; 621 - } else { 622 - fi->listen_channels |= 1ULL << channel; 623 - fi->iso_buffer = int2ptr(req->req.recvb); 624 - fi->iso_buffer_length = req->req.length; 625 - } 626 - } 627 - } else { 628 - /* deallocate channel (one's complement neg) req.misc */ 629 - channel = ~channel; 630 - 631 - if (fi->listen_channels & (1ULL << channel)) { 632 - hpsb_unlisten_channel(&raw1394_highlevel, fi->host, 633 - channel); 634 - fi->listen_channels &= ~(1ULL << channel); 635 - } else { 636 - req->req.error = RAW1394_ERROR_INVALID_ARG; 637 - } 638 - } 639 - 640 - req->req.length = 0; 641 - queue_complete_req(req); 676 + return 0; 642 677 } 643 678 644 679 static void handle_fcp_listen(struct file_info *fi, struct pending_request *req) ··· 756 865 if (req->req.error) { 757 866 req->req.length = 0; 758 867 queue_complete_req(req); 759 - return sizeof(struct raw1394_request); 868 + return 0; 760 869 } 761 870 762 871 hpsb_set_packet_complete_task(packet, ··· 774 883 hpsb_free_tlabel(packet); 775 884 queue_complete_req(req); 776 885 } 777 - return sizeof(struct raw1394_request); 778 - } 779 - 780 - static int handle_iso_send(struct file_info *fi, struct pending_request *req, 781 - int channel) 782 - { 783 - unsigned long flags; 784 - struct hpsb_packet *packet; 785 - 786 - packet = hpsb_make_isopacket(fi->host, req->req.length, channel & 0x3f, 787 - (req->req.misc >> 16) & 0x3, 788 - req->req.misc & 0xf); 789 - if (!packet) 790 - return -ENOMEM; 791 - 792 - packet->speed_code = req->req.address & 0x3; 793 - 794 - req->packet = packet; 795 - 796 - if (copy_from_user(packet->data, int2ptr(req->req.sendb), 797 - req->req.length)) { 798 - req->req.error = RAW1394_ERROR_MEMFAULT; 799 - req->req.length = 0; 800 - queue_complete_req(req); 801 - return sizeof(struct raw1394_request); 802 - } 803 - 804 - req->req.length = 0; 805 - hpsb_set_packet_complete_task(packet, 806 - (void (*)(void *))queue_complete_req, 807 - req); 808 - 809 - spin_lock_irqsave(&fi->reqlists_lock, flags); 810 - list_add_tail(&req->list, &fi->req_pending); 811 - spin_unlock_irqrestore(&fi->reqlists_lock, flags); 812 - 813 - /* Update the generation of the packet just before sending. */ 814 - packet->generation = req->req.generation; 815 - 816 - if (hpsb_send_packet(packet) < 0) { 817 - req->req.error = RAW1394_ERROR_SEND_ERROR; 818 - queue_complete_req(req); 819 - } 820 - 821 - return sizeof(struct raw1394_request); 886 + return 0; 822 887 } 823 888 824 889 static int handle_async_send(struct file_info *fi, struct pending_request *req) ··· 790 943 req->req.error = RAW1394_ERROR_INVALID_ARG; 791 944 req->req.length = 0; 792 945 queue_complete_req(req); 793 - return sizeof(struct raw1394_request); 946 + return 0; 794 947 } 795 948 796 949 data_size = req->req.length - header_length; ··· 804 957 req->req.error = RAW1394_ERROR_MEMFAULT; 805 958 req->req.length = 0; 806 959 queue_complete_req(req); 807 - return sizeof(struct raw1394_request); 960 + return 0; 808 961 } 809 962 810 963 if (copy_from_user ··· 813 966 req->req.error = RAW1394_ERROR_MEMFAULT; 814 967 req->req.length = 0; 815 968 queue_complete_req(req); 816 - return sizeof(struct raw1394_request); 969 + return 0; 817 970 } 818 971 819 972 packet->type = hpsb_async; ··· 841 994 queue_complete_req(req); 842 995 } 843 996 844 - return sizeof(struct raw1394_request); 997 + return 0; 845 998 } 846 999 847 1000 static int arm_read(struct hpsb_host *host, int nodeid, quadlet_t * buffer, ··· 1716 1869 spin_lock_irqsave(&host_info_lock, flags); 1717 1870 list_add_tail(&addr->addr_list, &fi->addr_list); 1718 1871 spin_unlock_irqrestore(&host_info_lock, flags); 1719 - return sizeof(struct raw1394_request); 1872 + return 0; 1720 1873 } 1721 1874 retval = 1722 1875 hpsb_register_addrspace(&raw1394_highlevel, fi->host, &arm_ops, ··· 1734 1887 return (-EALREADY); 1735 1888 } 1736 1889 free_pending_request(req); /* immediate success or fail */ 1737 - return sizeof(struct raw1394_request); 1890 + return 0; 1738 1891 } 1739 1892 1740 1893 static int arm_unregister(struct file_info *fi, struct pending_request *req) ··· 1802 1955 vfree(addr->addr_space_buffer); 1803 1956 kfree(addr); 1804 1957 free_pending_request(req); /* immediate success or fail */ 1805 - return sizeof(struct raw1394_request); 1958 + return 0; 1806 1959 } 1807 1960 retval = 1808 1961 hpsb_unregister_addrspace(&raw1394_highlevel, fi->host, ··· 1818 1971 vfree(addr->addr_space_buffer); 1819 1972 kfree(addr); 1820 1973 free_pending_request(req); /* immediate success or fail */ 1821 - return sizeof(struct raw1394_request); 1974 + return 0; 1822 1975 } 1823 1976 1824 1977 /* Copy data from ARM buffer(s) to user buffer. */ ··· 1860 2013 * queue no response, and therefore nobody 1861 2014 * will free it. */ 1862 2015 free_pending_request(req); 1863 - return sizeof(struct raw1394_request); 2016 + return 0; 1864 2017 } else { 1865 2018 DBGMSG("arm_get_buf request exceeded mapping"); 1866 2019 spin_unlock_irqrestore(&host_info_lock, flags); ··· 1912 2065 * queue no response, and therefore nobody 1913 2066 * will free it. */ 1914 2067 free_pending_request(req); 1915 - return sizeof(struct raw1394_request); 2068 + return 0; 1916 2069 } else { 1917 2070 DBGMSG("arm_set_buf request exceeded mapping"); 1918 2071 spin_unlock_irqrestore(&host_info_lock, flags); ··· 1933 2086 (req->req.misc == RAW1394_NOTIFY_ON)) { 1934 2087 fi->notification = (u8) req->req.misc; 1935 2088 free_pending_request(req); /* we have to free the request, because we queue no response, and therefore nobody will free it */ 1936 - return sizeof(struct raw1394_request); 2089 + return 0; 1937 2090 } 1938 2091 /* error EINVAL (22) invalid argument */ 1939 2092 return (-EINVAL); ··· 1966 2119 req->req.length = 0; 1967 2120 queue_complete_req(req); 1968 2121 } 1969 - return sizeof(struct raw1394_request); 2122 + return 0; 1970 2123 } 1971 2124 1972 2125 static int get_config_rom(struct file_info *fi, struct pending_request *req) 1973 2126 { 1974 - int ret = sizeof(struct raw1394_request); 2127 + int ret = 0; 1975 2128 quadlet_t *data = kmalloc(req->req.length, GFP_KERNEL); 1976 2129 int status; 1977 2130 ··· 2001 2154 2002 2155 static int update_config_rom(struct file_info *fi, struct pending_request *req) 2003 2156 { 2004 - int ret = sizeof(struct raw1394_request); 2157 + int ret = 0; 2005 2158 quadlet_t *data = kmalloc(req->req.length, GFP_KERNEL); 2006 2159 if (!data) 2007 2160 return -ENOMEM; ··· 2068 2221 2069 2222 hpsb_update_config_rom_image(fi->host); 2070 2223 free_pending_request(req); 2071 - return sizeof(struct raw1394_request); 2224 + return 0; 2072 2225 } 2073 2226 } 2074 2227 ··· 2133 2286 /* we have to free the request, because we queue no response, 2134 2287 * and therefore nobody will free it */ 2135 2288 free_pending_request(req); 2136 - return sizeof(struct raw1394_request); 2289 + return 0; 2137 2290 } else { 2138 2291 for (dentry = 2139 2292 fi->csr1212_dirs[dr]->value.directory.dentries_head; ··· 2158 2311 2159 2312 case RAW1394_REQ_ECHO: 2160 2313 queue_complete_req(req); 2161 - return sizeof(struct raw1394_request); 2162 - 2163 - case RAW1394_REQ_ISO_SEND: 2164 - print_old_iso_deprecation(); 2165 - return handle_iso_send(fi, req, node); 2314 + return 0; 2166 2315 2167 2316 case RAW1394_REQ_ARM_REGISTER: 2168 2317 return arm_register(fi, req); ··· 2175 2332 case RAW1394_REQ_RESET_NOTIFY: 2176 2333 return reset_notification(fi, req); 2177 2334 2335 + case RAW1394_REQ_ISO_SEND: 2178 2336 case RAW1394_REQ_ISO_LISTEN: 2179 - print_old_iso_deprecation(); 2180 - handle_iso_listen(fi, req); 2181 - return sizeof(struct raw1394_request); 2337 + printk(KERN_DEBUG "raw1394: old iso ABI has been removed\n"); 2338 + req->req.error = RAW1394_ERROR_COMPAT; 2339 + req->req.misc = RAW1394_KERNELAPI_VERSION; 2340 + queue_complete_req(req); 2341 + return 0; 2182 2342 2183 2343 case RAW1394_REQ_FCP_LISTEN: 2184 2344 handle_fcp_listen(fi, req); 2185 - return sizeof(struct raw1394_request); 2345 + return 0; 2186 2346 2187 2347 case RAW1394_REQ_RESET_BUS: 2188 2348 if (req->req.misc == RAW1394_LONG_RESET) { 2189 2349 DBGMSG("busreset called (type: LONG)"); 2190 2350 hpsb_reset_bus(fi->host, LONG_RESET); 2191 2351 free_pending_request(req); /* we have to free the request, because we queue no response, and therefore nobody will free it */ 2192 - return sizeof(struct raw1394_request); 2352 + return 0; 2193 2353 } 2194 2354 if (req->req.misc == RAW1394_SHORT_RESET) { 2195 2355 DBGMSG("busreset called (type: SHORT)"); 2196 2356 hpsb_reset_bus(fi->host, SHORT_RESET); 2197 2357 free_pending_request(req); /* we have to free the request, because we queue no response, and therefore nobody will free it */ 2198 - return sizeof(struct raw1394_request); 2358 + return 0; 2199 2359 } 2200 2360 /* error EINVAL (22) invalid argument */ 2201 2361 return (-EINVAL); ··· 2217 2371 req->req.generation = get_hpsb_generation(fi->host); 2218 2372 req->req.length = 0; 2219 2373 queue_complete_req(req); 2220 - return sizeof(struct raw1394_request); 2374 + return 0; 2221 2375 } 2222 2376 2223 2377 switch (req->req.type) { ··· 2230 2384 if (req->req.length == 0) { 2231 2385 req->req.error = RAW1394_ERROR_INVALID_ARG; 2232 2386 queue_complete_req(req); 2233 - return sizeof(struct raw1394_request); 2387 + return 0; 2234 2388 } 2235 2389 2236 2390 return handle_async_request(fi, req, node); ··· 2241 2395 { 2242 2396 struct file_info *fi = (struct file_info *)file->private_data; 2243 2397 struct pending_request *req; 2244 - ssize_t retval = 0; 2398 + ssize_t retval = -EBADFD; 2245 2399 2246 2400 #ifdef CONFIG_COMPAT 2247 2401 if (count == sizeof(struct compat_raw1394_req) && ··· 2283 2437 2284 2438 if (retval < 0) { 2285 2439 free_pending_request(req); 2440 + } else { 2441 + BUG_ON(retval); 2442 + retval = count; 2286 2443 } 2287 2444 2288 2445 return retval; ··· 2651 2802 return -EINVAL; 2652 2803 } 2653 2804 2805 + #ifdef CONFIG_COMPAT 2806 + struct raw1394_iso_packets32 { 2807 + __u32 n_packets; 2808 + compat_uptr_t infos; 2809 + } __attribute__((packed)); 2810 + 2811 + struct raw1394_cycle_timer32 { 2812 + __u32 cycle_timer; 2813 + __u64 local_time; 2814 + } 2815 + #if defined(CONFIG_X86_64) || defined(CONFIG_IA64) 2816 + __attribute__((packed)) 2817 + #endif 2818 + ; 2819 + 2820 + #define RAW1394_IOC_ISO_RECV_PACKETS32 \ 2821 + _IOW ('#', 0x25, struct raw1394_iso_packets32) 2822 + #define RAW1394_IOC_ISO_XMIT_PACKETS32 \ 2823 + _IOW ('#', 0x27, struct raw1394_iso_packets32) 2824 + #define RAW1394_IOC_GET_CYCLE_TIMER32 \ 2825 + _IOR ('#', 0x30, struct raw1394_cycle_timer32) 2826 + 2827 + static long raw1394_iso_xmit_recv_packets32(struct file *file, unsigned int cmd, 2828 + struct raw1394_iso_packets32 __user *arg) 2829 + { 2830 + compat_uptr_t infos32; 2831 + void *infos; 2832 + long err = -EFAULT; 2833 + struct raw1394_iso_packets __user *dst = compat_alloc_user_space(sizeof(struct raw1394_iso_packets)); 2834 + 2835 + if (!copy_in_user(&dst->n_packets, &arg->n_packets, sizeof arg->n_packets) && 2836 + !copy_from_user(&infos32, &arg->infos, sizeof infos32)) { 2837 + infos = compat_ptr(infos32); 2838 + if (!copy_to_user(&dst->infos, &infos, sizeof infos)) 2839 + err = raw1394_ioctl(NULL, file, cmd, (unsigned long)dst); 2840 + } 2841 + return err; 2842 + } 2843 + 2844 + static long raw1394_read_cycle_timer32(struct file_info *fi, void __user * uaddr) 2845 + { 2846 + struct raw1394_cycle_timer32 ct; 2847 + int err; 2848 + 2849 + err = hpsb_read_cycle_timer(fi->host, &ct.cycle_timer, &ct.local_time); 2850 + if (!err) 2851 + if (copy_to_user(uaddr, &ct, sizeof(ct))) 2852 + err = -EFAULT; 2853 + return err; 2854 + } 2855 + 2856 + static long raw1394_compat_ioctl(struct file *file, 2857 + unsigned int cmd, unsigned long arg) 2858 + { 2859 + struct file_info *fi = file->private_data; 2860 + void __user *argp = (void __user *)arg; 2861 + long err; 2862 + 2863 + lock_kernel(); 2864 + switch (cmd) { 2865 + /* These requests have same format as long as 'int' has same size. */ 2866 + case RAW1394_IOC_ISO_RECV_INIT: 2867 + case RAW1394_IOC_ISO_RECV_START: 2868 + case RAW1394_IOC_ISO_RECV_LISTEN_CHANNEL: 2869 + case RAW1394_IOC_ISO_RECV_UNLISTEN_CHANNEL: 2870 + case RAW1394_IOC_ISO_RECV_SET_CHANNEL_MASK: 2871 + case RAW1394_IOC_ISO_RECV_RELEASE_PACKETS: 2872 + case RAW1394_IOC_ISO_RECV_FLUSH: 2873 + case RAW1394_IOC_ISO_XMIT_RECV_STOP: 2874 + case RAW1394_IOC_ISO_XMIT_INIT: 2875 + case RAW1394_IOC_ISO_XMIT_START: 2876 + case RAW1394_IOC_ISO_XMIT_SYNC: 2877 + case RAW1394_IOC_ISO_GET_STATUS: 2878 + case RAW1394_IOC_ISO_SHUTDOWN: 2879 + case RAW1394_IOC_ISO_QUEUE_ACTIVITY: 2880 + err = raw1394_ioctl(NULL, file, cmd, arg); 2881 + break; 2882 + /* These request have different format. */ 2883 + case RAW1394_IOC_ISO_RECV_PACKETS32: 2884 + err = raw1394_iso_xmit_recv_packets32(file, RAW1394_IOC_ISO_RECV_PACKETS, argp); 2885 + break; 2886 + case RAW1394_IOC_ISO_XMIT_PACKETS32: 2887 + err = raw1394_iso_xmit_recv_packets32(file, RAW1394_IOC_ISO_XMIT_PACKETS, argp); 2888 + break; 2889 + case RAW1394_IOC_GET_CYCLE_TIMER32: 2890 + err = raw1394_read_cycle_timer32(fi, argp); 2891 + break; 2892 + default: 2893 + err = -EINVAL; 2894 + break; 2895 + } 2896 + unlock_kernel(); 2897 + 2898 + return err; 2899 + } 2900 + #endif 2901 + 2654 2902 static unsigned int raw1394_poll(struct file *file, poll_table * pt) 2655 2903 { 2656 2904 struct file_info *fi = file->private_data; ··· 2807 2861 if (fi->iso_state != RAW1394_ISO_INACTIVE) 2808 2862 raw1394_iso_shutdown(fi); 2809 2863 2810 - for (i = 0; i < 64; i++) { 2811 - if (fi->listen_channels & (1ULL << i)) { 2812 - hpsb_unlisten_channel(&raw1394_highlevel, fi->host, i); 2813 - } 2814 - } 2815 - 2816 2864 spin_lock_irqsave(&host_info_lock, flags); 2817 - fi->listen_channels = 0; 2818 2865 2819 2866 fail = 0; 2820 2867 /* set address-entries invalid */ ··· 2969 3030 .add_host = add_host, 2970 3031 .remove_host = remove_host, 2971 3032 .host_reset = host_reset, 2972 - .iso_receive = iso_receive, 2973 3033 .fcp_request = fcp_request, 2974 3034 }; 2975 3035 ··· 2979 3041 .write = raw1394_write, 2980 3042 .mmap = raw1394_mmap, 2981 3043 .ioctl = raw1394_ioctl, 2982 - // .compat_ioctl = ... someone needs to do this 3044 + #ifdef CONFIG_COMPAT 3045 + .compat_ioctl = raw1394_compat_ioctl, 3046 + #endif 2983 3047 .poll = raw1394_poll, 2984 3048 .open = raw1394_open, 2985 3049 .release = raw1394_release, ··· 2994 3054 hpsb_register_highlevel(&raw1394_highlevel); 2995 3055 2996 3056 if (IS_ERR 2997 - (class_device_create 2998 - (hpsb_protocol_class, NULL, 2999 - MKDEV(IEEE1394_MAJOR, IEEE1394_MINOR_BLOCK_RAW1394 * 16), NULL, 3057 + (device_create( 3058 + hpsb_protocol_class, NULL, 3059 + MKDEV(IEEE1394_MAJOR, IEEE1394_MINOR_BLOCK_RAW1394 * 16), 3000 3060 RAW1394_DEVICE_NAME))) { 3001 3061 ret = -EFAULT; 3002 3062 goto out_unreg; ··· 3023 3083 goto out; 3024 3084 3025 3085 out_dev: 3026 - class_device_destroy(hpsb_protocol_class, 3027 - MKDEV(IEEE1394_MAJOR, 3028 - IEEE1394_MINOR_BLOCK_RAW1394 * 16)); 3086 + device_destroy(hpsb_protocol_class, 3087 + MKDEV(IEEE1394_MAJOR, 3088 + IEEE1394_MINOR_BLOCK_RAW1394 * 16)); 3029 3089 out_unreg: 3030 3090 hpsb_unregister_highlevel(&raw1394_highlevel); 3031 3091 out: ··· 3034 3094 3035 3095 static void __exit cleanup_raw1394(void) 3036 3096 { 3037 - class_device_destroy(hpsb_protocol_class, 3038 - MKDEV(IEEE1394_MAJOR, 3039 - IEEE1394_MINOR_BLOCK_RAW1394 * 16)); 3097 + device_destroy(hpsb_protocol_class, 3098 + MKDEV(IEEE1394_MAJOR, 3099 + IEEE1394_MINOR_BLOCK_RAW1394 * 16)); 3040 3100 cdev_del(&raw1394_cdev); 3041 3101 hpsb_unregister_highlevel(&raw1394_highlevel); 3042 3102 hpsb_unregister_protocol(&raw1394_driver);
+2 -2
drivers/ieee1394/raw1394.h
··· 17 17 #define RAW1394_REQ_ASYNC_WRITE 101 18 18 #define RAW1394_REQ_LOCK 102 19 19 #define RAW1394_REQ_LOCK64 103 20 - #define RAW1394_REQ_ISO_SEND 104 20 + #define RAW1394_REQ_ISO_SEND 104 /* removed ABI, now a no-op */ 21 21 #define RAW1394_REQ_ASYNC_SEND 105 22 22 #define RAW1394_REQ_ASYNC_STREAM 106 23 23 24 - #define RAW1394_REQ_ISO_LISTEN 200 24 + #define RAW1394_REQ_ISO_LISTEN 200 /* removed ABI, now a no-op */ 25 25 #define RAW1394_REQ_FCP_LISTEN 201 26 26 #define RAW1394_REQ_RESET_BUS 202 27 27 #define RAW1394_REQ_GET_ROM 203
+7 -8
drivers/ieee1394/sbp2.c
··· 118 118 "(3 = 800Mb/s, 2 = 400Mb/s, 1 = 200Mb/s, 0 = 100Mb/s)"); 119 119 120 120 /* 121 - * Set serialize_io to 1 if you'd like only one scsi command sent 122 - * down to us at a time (debugging). This might be necessary for very 123 - * badly behaved sbp2 devices. 121 + * Set serialize_io to 0 or N to use dynamically appended lists of command ORBs. 122 + * This is and always has been buggy in multiple subtle ways. See above TODOs. 124 123 */ 125 124 static int sbp2_serialize_io = 1; 126 - module_param_named(serialize_io, sbp2_serialize_io, int, 0444); 127 - MODULE_PARM_DESC(serialize_io, "Serialize I/O coming from scsi drivers " 128 - "(default = 1, faster = 0)"); 125 + module_param_named(serialize_io, sbp2_serialize_io, bool, 0444); 126 + MODULE_PARM_DESC(serialize_io, "Serialize requests coming from SCSI drivers " 127 + "(default = Y, faster but buggy = N)"); 129 128 130 129 /* 131 130 * Bump up max_sectors if you'd like to support very large sized ··· 153 154 * are possible on OXFW911 and newer Oxsemi bridges. 154 155 */ 155 156 static int sbp2_exclusive_login = 1; 156 - module_param_named(exclusive_login, sbp2_exclusive_login, int, 0644); 157 + module_param_named(exclusive_login, sbp2_exclusive_login, bool, 0644); 157 158 MODULE_PARM_DESC(exclusive_login, "Exclusive login to sbp2 device " 158 - "(default = 1)"); 159 + "(default = Y, use N for concurrent initiators)"); 159 160 160 161 /* 161 162 * If any of the following workarounds is required for your device to work,
+1 -1
drivers/ieee1394/sbp2.h
··· 67 67 #define ORB_SET_LUN(v) ((v) & 0xffff) 68 68 #define ORB_SET_FUNCTION(v) (((v) & 0xf) << 16) 69 69 #define ORB_SET_RECONNECT(v) (((v) & 0xf) << 20) 70 - #define ORB_SET_EXCLUSIVE(v) (((v) & 0x1) << 28) 70 + #define ORB_SET_EXCLUSIVE(v) ((v) ? 1 << 28 : 0) 71 71 #define ORB_SET_LOGIN_RESP_LENGTH(v) ((v) & 0xffff) 72 72 #define ORB_SET_PASSWD_LENGTH(v) (((v) & 0xffff) << 16) 73 73
+5 -5
drivers/ieee1394/video1394.c
··· 1340 1340 hpsb_set_hostinfo_key(&video1394_highlevel, host, ohci->host->id); 1341 1341 1342 1342 minor = IEEE1394_MINOR_BLOCK_VIDEO1394 * 16 + ohci->host->id; 1343 - class_device_create(hpsb_protocol_class, NULL, MKDEV( 1344 - IEEE1394_MAJOR, minor), 1345 - NULL, "%s-%d", VIDEO1394_DRIVER_NAME, ohci->host->id); 1343 + device_create(hpsb_protocol_class, NULL, 1344 + MKDEV(IEEE1394_MAJOR, minor), 1345 + "%s-%d", VIDEO1394_DRIVER_NAME, ohci->host->id); 1346 1346 } 1347 1347 1348 1348 ··· 1351 1351 struct ti_ohci *ohci = hpsb_get_hostinfo(&video1394_highlevel, host); 1352 1352 1353 1353 if (ohci) 1354 - class_device_destroy(hpsb_protocol_class, MKDEV(IEEE1394_MAJOR, 1355 - IEEE1394_MINOR_BLOCK_VIDEO1394 * 16 + ohci->host->id)); 1354 + device_destroy(hpsb_protocol_class, MKDEV(IEEE1394_MAJOR, 1355 + IEEE1394_MINOR_BLOCK_VIDEO1394 * 16 + ohci->host->id)); 1356 1356 return; 1357 1357 } 1358 1358
+264 -33
include/linux/firewire-cdev.h
··· 30 30 #define FW_CDEV_EVENT_REQUEST 0x02 31 31 #define FW_CDEV_EVENT_ISO_INTERRUPT 0x03 32 32 33 - /* The 'closure' fields are for user space to use. Data passed in the 34 - * 'closure' field for a request will be returned in the corresponding 35 - * event. It's a 64-bit type so that it's a fixed size type big 36 - * enough to hold a pointer on all platforms. */ 37 - 33 + /** 34 + * struct fw_cdev_event_common - Common part of all fw_cdev_event_ types 35 + * @closure: For arbitrary use by userspace 36 + * @type: Discriminates the fw_cdev_event_ types 37 + * 38 + * This struct may be used to access generic members of all fw_cdev_event_ 39 + * types regardless of the specific type. 40 + * 41 + * Data passed in the @closure field for a request will be returned in the 42 + * corresponding event. It is big enough to hold a pointer on all platforms. 43 + * The ioctl used to set @closure depends on the @type of event. 44 + */ 38 45 struct fw_cdev_event_common { 39 46 __u64 closure; 40 47 __u32 type; 41 48 }; 42 49 50 + /** 51 + * struct fw_cdev_event_bus_reset - Sent when a bus reset occurred 52 + * @closure: See &fw_cdev_event_common; set by %FW_CDEV_IOC_GET_INFO ioctl 53 + * @type: See &fw_cdev_event_common; always %FW_CDEV_EVENT_BUS_RESET 54 + * @node_id: New node ID of this node 55 + * @local_node_id: Node ID of the local node, i.e. of the controller 56 + * @bm_node_id: Node ID of the bus manager 57 + * @irm_node_id: Node ID of the iso resource manager 58 + * @root_node_id: Node ID of the root node 59 + * @generation: New bus generation 60 + * 61 + * This event is sent when the bus the device belongs to goes through a bus 62 + * reset. It provides information about the new bus configuration, such as 63 + * new node ID for this device, new root ID, and others. 64 + */ 43 65 struct fw_cdev_event_bus_reset { 44 66 __u64 closure; 45 67 __u32 type; ··· 73 51 __u32 generation; 74 52 }; 75 53 54 + /** 55 + * struct fw_cdev_event_response - Sent when a response packet was received 56 + * @closure: See &fw_cdev_event_common; 57 + * set by %FW_CDEV_IOC_SEND_REQUEST ioctl 58 + * @type: See &fw_cdev_event_common; always %FW_CDEV_EVENT_RESPONSE 59 + * @rcode: Response code returned by the remote node 60 + * @length: Data length, i.e. the response's payload size in bytes 61 + * @data: Payload data, if any 62 + * 63 + * This event is sent when the stack receives a response to an outgoing request 64 + * sent by %FW_CDEV_IOC_SEND_REQUEST ioctl. The payload data for responses 65 + * carrying data (read and lock responses) follows immediately and can be 66 + * accessed through the @data field. 67 + */ 76 68 struct fw_cdev_event_response { 77 69 __u64 closure; 78 70 __u32 type; ··· 95 59 __u32 data[0]; 96 60 }; 97 61 62 + /** 63 + * struct fw_cdev_event_request - Sent on incoming request to an address region 64 + * @closure: See &fw_cdev_event_common; set by %FW_CDEV_IOC_ALLOCATE ioctl 65 + * @type: See &fw_cdev_event_common; always %FW_CDEV_EVENT_REQUEST 66 + * @tcode: Transaction code of the incoming request 67 + * @offset: The offset into the 48-bit per-node address space 68 + * @handle: Reference to the kernel-side pending request 69 + * @length: Data length, i.e. the request's payload size in bytes 70 + * @data: Incoming data, if any 71 + * 72 + * This event is sent when the stack receives an incoming request to an address 73 + * region registered using the %FW_CDEV_IOC_ALLOCATE ioctl. The request is 74 + * guaranteed to be completely contained in the specified region. Userspace is 75 + * responsible for sending the response by %FW_CDEV_IOC_SEND_RESPONSE ioctl, 76 + * using the same @handle. 77 + * 78 + * The payload data for requests carrying data (write and lock requests) 79 + * follows immediately and can be accessed through the @data field. 80 + */ 98 81 struct fw_cdev_event_request { 99 82 __u64 closure; 100 83 __u32 type; ··· 124 69 __u32 data[0]; 125 70 }; 126 71 72 + /** 73 + * struct fw_cdev_event_iso_interrupt - Sent when an iso packet was completed 74 + * @closure: See &fw_cdev_event_common; 75 + * set by %FW_CDEV_CREATE_ISO_CONTEXT ioctl 76 + * @type: See &fw_cdev_event_common; always %FW_CDEV_EVENT_ISO_INTERRUPT 77 + * @cycle: Cycle counter of the interrupt packet 78 + * @header_length: Total length of following headers, in bytes 79 + * @header: Stripped headers, if any 80 + * 81 + * This event is sent when the controller has completed an &fw_cdev_iso_packet 82 + * with the %FW_CDEV_ISO_INTERRUPT bit set. In the receive case, the headers 83 + * stripped of all packets up until and including the interrupt packet are 84 + * returned in the @header field. 85 + */ 127 86 struct fw_cdev_event_iso_interrupt { 128 87 __u64 closure; 129 88 __u32 type; 130 89 __u32 cycle; 131 - __u32 header_length; /* Length in bytes of following headers. */ 90 + __u32 header_length; 132 91 __u32 header[0]; 133 92 }; 134 93 94 + /** 95 + * union fw_cdev_event - Convenience union of fw_cdev_event_ types 96 + * @common: Valid for all types 97 + * @bus_reset: Valid if @common.type == %FW_CDEV_EVENT_BUS_RESET 98 + * @response: Valid if @common.type == %FW_CDEV_EVENT_RESPONSE 99 + * @request: Valid if @common.type == %FW_CDEV_EVENT_REQUEST 100 + * @iso_interrupt: Valid if @common.type == %FW_CDEV_EVENT_ISO_INTERRUPT 101 + * 102 + * Convenience union for userspace use. Events could be read(2) into a char 103 + * buffer and then cast to this union for further processing. 104 + */ 135 105 union fw_cdev_event { 136 106 struct fw_cdev_event_common common; 137 107 struct fw_cdev_event_bus_reset bus_reset; ··· 185 105 */ 186 106 #define FW_CDEV_VERSION 1 187 107 108 + /** 109 + * struct fw_cdev_get_info - General purpose information ioctl 110 + * @version: The version field is just a running serial number. 111 + * We never break backwards compatibility, but may add more 112 + * structs and ioctls in later revisions. 113 + * @rom_length: If @rom is non-zero, at most rom_length bytes of configuration 114 + * ROM will be copied into that user space address. In either 115 + * case, @rom_length is updated with the actual length of the 116 + * configuration ROM. 117 + * @rom: If non-zero, address of a buffer to be filled by a copy of the 118 + * local node's configuration ROM 119 + * @bus_reset: If non-zero, address of a buffer to be filled by a 120 + * &struct fw_cdev_event_bus_reset with the current state 121 + * of the bus. This does not cause a bus reset to happen. 122 + * @bus_reset_closure: Value of &closure in this and subsequent bus reset events 123 + * @card: The index of the card this device belongs to 124 + */ 188 125 struct fw_cdev_get_info { 189 - /* The version field is just a running serial number. We 190 - * never break backwards compatibility. Userspace passes in 191 - * the version it expects and the kernel passes back the 192 - * highest version it can provide. Even if the structs in 193 - * this interface are extended in a later version, the kernel 194 - * will not copy back more data than what was present in the 195 - * interface version userspace expects. */ 196 126 __u32 version; 197 - 198 - /* If non-zero, at most rom_length bytes of config rom will be 199 - * copied into that user space address. In either case, 200 - * rom_length is updated with the actual length of the config 201 - * rom. */ 202 127 __u32 rom_length; 203 128 __u64 rom; 204 - 205 - /* If non-zero, a fw_cdev_event_bus_reset struct will be 206 - * copied here with the current state of the bus. This does 207 - * not cause a bus reset to happen. The value of closure in 208 - * this and sub-sequent bus reset events is set to 209 - * bus_reset_closure. */ 210 129 __u64 bus_reset; 211 130 __u64 bus_reset_closure; 212 - 213 - /* The index of the card this devices belongs to. */ 214 131 __u32 card; 215 132 }; 216 133 134 + /** 135 + * struct fw_cdev_send_request - Send an asynchronous request packet 136 + * @tcode: Transaction code of the request 137 + * @length: Length of outgoing payload, in bytes 138 + * @offset: 48-bit offset at destination node 139 + * @closure: Passed back to userspace in the response event 140 + * @data: Userspace pointer to payload 141 + * @generation: The bus generation where packet is valid 142 + * 143 + * Send a request to the device. This ioctl implements all outgoing requests. 144 + * Both quadlet and block request specify the payload as a pointer to the data 145 + * in the @data field. Once the transaction completes, the kernel writes an 146 + * &fw_cdev_event_request event back. The @closure field is passed back to 147 + * user space in the response event. 148 + */ 217 149 struct fw_cdev_send_request { 218 150 __u32 tcode; 219 151 __u32 length; ··· 235 143 __u32 generation; 236 144 }; 237 145 146 + /** 147 + * struct fw_cdev_send_response - Send an asynchronous response packet 148 + * @rcode: Response code as determined by the userspace handler 149 + * @length: Length of outgoing payload, in bytes 150 + * @data: Userspace pointer to payload 151 + * @handle: The handle from the &fw_cdev_event_request 152 + * 153 + * Send a response to an incoming request. By setting up an address range using 154 + * the %FW_CDEV_IOC_ALLOCATE ioctl, userspace can listen for incoming requests. An 155 + * incoming request will generate an %FW_CDEV_EVENT_REQUEST, and userspace must 156 + * send a reply using this ioctl. The event has a handle to the kernel-side 157 + * pending transaction, which should be used with this ioctl. 158 + */ 238 159 struct fw_cdev_send_response { 239 160 __u32 rcode; 240 161 __u32 length; ··· 255 150 __u32 handle; 256 151 }; 257 152 153 + /** 154 + * struct fw_cdev_allocate - Allocate a CSR address range 155 + * @offset: Start offset of the address range 156 + * @closure: To be passed back to userspace in request events 157 + * @length: Length of the address range, in bytes 158 + * @handle: Handle to the allocation, written by the kernel 159 + * 160 + * Allocate an address range in the 48-bit address space on the local node 161 + * (the controller). This allows userspace to listen for requests with an 162 + * offset within that address range. When the kernel receives a request 163 + * within the range, an &fw_cdev_event_request event will be written back. 164 + * The @closure field is passed back to userspace in the response event. 165 + * The @handle field is an out parameter, returning a handle to the allocated 166 + * range to be used for later deallocation of the range. 167 + */ 258 168 struct fw_cdev_allocate { 259 169 __u64 offset; 260 170 __u64 closure; ··· 277 157 __u32 handle; 278 158 }; 279 159 160 + /** 161 + * struct fw_cdev_deallocate - Free an address range allocation 162 + * @handle: Handle to the address range, as returned by the kernel when the 163 + * range was allocated 164 + */ 280 165 struct fw_cdev_deallocate { 281 166 __u32 handle; 282 167 }; ··· 289 164 #define FW_CDEV_LONG_RESET 0 290 165 #define FW_CDEV_SHORT_RESET 1 291 166 167 + /** 168 + * struct fw_cdev_initiate_bus_reset - Initiate a bus reset 169 + * @type: %FW_CDEV_SHORT_RESET or %FW_CDEV_LONG_RESET 170 + * 171 + * Initiate a bus reset for the bus this device is on. The bus reset can be 172 + * either the original (long) bus reset or the arbitrated (short) bus reset 173 + * introduced in 1394a-2000. 174 + */ 292 175 struct fw_cdev_initiate_bus_reset { 293 - __u32 type; 176 + __u32 type; /* FW_CDEV_SHORT_RESET or FW_CDEV_LONG_RESET */ 294 177 }; 295 178 179 + /** 180 + * struct fw_cdev_add_descriptor - Add contents to the local node's config ROM 181 + * @immediate: If non-zero, immediate key to insert before pointer 182 + * @key: Upper 8 bits of root directory pointer 183 + * @data: Userspace pointer to contents of descriptor block 184 + * @length: Length of descriptor block data, in bytes 185 + * @handle: Handle to the descriptor, written by the kernel 186 + * 187 + * Add a descriptor block and optionally a preceding immediate key to the local 188 + * node's configuration ROM. 189 + * 190 + * The @key field specifies the upper 8 bits of the descriptor root directory 191 + * pointer and the @data and @length fields specify the contents. The @key 192 + * should be of the form 0xXX000000. The offset part of the root directory entry 193 + * will be filled in by the kernel. 194 + * 195 + * If not 0, the @immediate field specifies an immediate key which will be 196 + * inserted before the root directory pointer. 197 + * 198 + * If successful, the kernel adds the descriptor and writes back a handle to the 199 + * kernel-side object to be used for later removal of the descriptor block and 200 + * immediate key. 201 + */ 296 202 struct fw_cdev_add_descriptor { 297 203 __u32 immediate; 298 204 __u32 key; ··· 332 176 __u32 handle; 333 177 }; 334 178 179 + /** 180 + * struct fw_cdev_remove_descriptor - Remove contents from the configuration ROM 181 + * @handle: Handle to the descriptor, as returned by the kernel when the 182 + * descriptor was added 183 + * 184 + * Remove a descriptor block and accompanying immediate key from the local 185 + * node's configuration ROM. 186 + */ 335 187 struct fw_cdev_remove_descriptor { 336 188 __u32 handle; 337 189 }; ··· 347 183 #define FW_CDEV_ISO_CONTEXT_TRANSMIT 0 348 184 #define FW_CDEV_ISO_CONTEXT_RECEIVE 1 349 185 350 - #define FW_CDEV_ISO_CONTEXT_MATCH_TAG0 1 351 - #define FW_CDEV_ISO_CONTEXT_MATCH_TAG1 2 352 - #define FW_CDEV_ISO_CONTEXT_MATCH_TAG2 4 353 - #define FW_CDEV_ISO_CONTEXT_MATCH_TAG3 8 354 - #define FW_CDEV_ISO_CONTEXT_MATCH_ALL_TAGS 15 355 - 186 + /** 187 + * struct fw_cdev_create_iso_context - Create a context for isochronous IO 188 + * @type: %FW_CDEV_ISO_CONTEXT_TRANSMIT or %FW_CDEV_ISO_CONTEXT_RECEIVE 189 + * @header_size: Header size to strip for receive contexts 190 + * @channel: Channel to bind to 191 + * @speed: Speed to transmit at 192 + * @closure: To be returned in &fw_cdev_event_iso_interrupt 193 + * @handle: Handle to context, written back by kernel 194 + * 195 + * Prior to sending or receiving isochronous I/O, a context must be created. 196 + * The context records information about the transmit or receive configuration 197 + * and typically maps to an underlying hardware resource. A context is set up 198 + * for either sending or receiving. It is bound to a specific isochronous 199 + * channel. 200 + * 201 + * If a context was successfully created, the kernel writes back a handle to the 202 + * context, which must be passed in for subsequent operations on that context. 203 + */ 356 204 struct fw_cdev_create_iso_context { 357 205 __u32 type; 358 206 __u32 header_size; ··· 377 201 #define FW_CDEV_ISO_PAYLOAD_LENGTH(v) (v) 378 202 #define FW_CDEV_ISO_INTERRUPT (1 << 16) 379 203 #define FW_CDEV_ISO_SKIP (1 << 17) 204 + #define FW_CDEV_ISO_SYNC (1 << 17) 380 205 #define FW_CDEV_ISO_TAG(v) ((v) << 18) 381 206 #define FW_CDEV_ISO_SY(v) ((v) << 20) 382 207 #define FW_CDEV_ISO_HEADER_LENGTH(v) ((v) << 24) 383 208 209 + /** 210 + * struct fw_cdev_iso_packet - Isochronous packet 211 + * @control: Contains the header length (8 uppermost bits), the sy field 212 + * (4 bits), the tag field (2 bits), a sync flag (1 bit), 213 + * a skip flag (1 bit), an interrupt flag (1 bit), and the 214 + * payload length (16 lowermost bits) 215 + * @header: Header and payload 216 + * 217 + * &struct fw_cdev_iso_packet is used to describe isochronous packet queues. 218 + * 219 + * Use the FW_CDEV_ISO_ macros to fill in @control. The sy and tag fields are 220 + * specified by IEEE 1394a and IEC 61883. 221 + * 222 + * FIXME - finish this documentation 223 + */ 384 224 struct fw_cdev_iso_packet { 385 225 __u32 control; 386 226 __u32 header[0]; 387 227 }; 388 228 229 + /** 230 + * struct fw_cdev_queue_iso - Queue isochronous packets for I/O 231 + * @packets: Userspace pointer to packet data 232 + * @data: Pointer into mmap()'ed payload buffer 233 + * @size: Size of packet data in bytes 234 + * @handle: Isochronous context handle 235 + * 236 + * Queue a number of isochronous packets for reception or transmission. 237 + * This ioctl takes a pointer to an array of &fw_cdev_iso_packet structs, 238 + * which describe how to transmit from or receive into a contiguous region 239 + * of a mmap()'ed payload buffer. As part of the packet descriptors, 240 + * a series of headers can be supplied, which will be prepended to the 241 + * payload during DMA. 242 + * 243 + * The kernel may or may not queue all packets, but will write back updated 244 + * values of the @packets, @data and @size fields, so the ioctl can be 245 + * resubmitted easily. 246 + */ 389 247 struct fw_cdev_queue_iso { 390 248 __u64 packets; 391 249 __u64 data; ··· 427 217 __u32 handle; 428 218 }; 429 219 220 + #define FW_CDEV_ISO_CONTEXT_MATCH_TAG0 1 221 + #define FW_CDEV_ISO_CONTEXT_MATCH_TAG1 2 222 + #define FW_CDEV_ISO_CONTEXT_MATCH_TAG2 4 223 + #define FW_CDEV_ISO_CONTEXT_MATCH_TAG3 8 224 + #define FW_CDEV_ISO_CONTEXT_MATCH_ALL_TAGS 15 225 + 226 + /** 227 + * struct fw_cdev_start_iso - Start an isochronous transmission or reception 228 + * @cycle: Cycle in which to start I/O. If @cycle is greater than or 229 + * equal to 0, the I/O will start on that cycle. 230 + * @sync: Determines the value to wait for for receive packets that have 231 + * the %FW_CDEV_ISO_SYNC bit set 232 + * @tags: Tag filter bit mask. Only valid for isochronous reception. 233 + * Determines the tag values for which packets will be accepted. 234 + * Use FW_CDEV_ISO_CONTEXT_MATCH_ macros to set @tags. 235 + * @handle: Isochronous context handle within which to transmit or receive 236 + */ 430 237 struct fw_cdev_start_iso { 431 238 __s32 cycle; 432 239 __u32 sync; ··· 451 224 __u32 handle; 452 225 }; 453 226 227 + /** 228 + * struct fw_cdev_stop_iso - Stop an isochronous transmission or reception 229 + * @handle: Handle of isochronous context to stop 230 + */ 454 231 struct fw_cdev_stop_iso { 455 232 __u32 handle; 456 233 };