Lines Matching refs:card

87 			     struct fw_card *card, int rcode)  in close_transaction()  argument
92 spin_lock_irqsave(&card->lock, flags); in close_transaction()
93 list_for_each_entry(t, &card->transaction_list, link) { in close_transaction()
96 spin_unlock_irqrestore(&card->lock, flags); in close_transaction()
100 card->tlabel_mask &= ~(1ULL << t->tlabel); in close_transaction()
104 spin_unlock_irqrestore(&card->lock, flags); in close_transaction()
106 if (&t->link != &card->transaction_list) { in close_transaction()
107 t->callback(card, rcode, NULL, 0, t->callback_data); in close_transaction()
119 int fw_cancel_transaction(struct fw_card *card, in fw_cancel_transaction() argument
128 if (card->driver->cancel_packet(card, &transaction->packet) == 0) in fw_cancel_transaction()
136 return close_transaction(transaction, card, RCODE_CANCELLED); in fw_cancel_transaction()
143 struct fw_card *card = t->card; in split_transaction_timeout_callback() local
146 spin_lock_irqsave(&card->lock, flags); in split_transaction_timeout_callback()
148 spin_unlock_irqrestore(&card->lock, flags); in split_transaction_timeout_callback()
152 card->tlabel_mask &= ~(1ULL << t->tlabel); in split_transaction_timeout_callback()
153 spin_unlock_irqrestore(&card->lock, flags); in split_transaction_timeout_callback()
155 t->callback(card, RCODE_CANCELLED, NULL, 0, t->callback_data); in split_transaction_timeout_callback()
159 struct fw_card *card) in start_split_transaction_timeout() argument
163 spin_lock_irqsave(&card->lock, flags); in start_split_transaction_timeout()
166 spin_unlock_irqrestore(&card->lock, flags); in start_split_transaction_timeout()
172 jiffies + card->split_timeout_jiffies); in start_split_transaction_timeout()
174 spin_unlock_irqrestore(&card->lock, flags); in start_split_transaction_timeout()
178 struct fw_card *card, int status) in transmit_complete_callback() argument
185 close_transaction(t, card, RCODE_COMPLETE); in transmit_complete_callback()
188 start_split_transaction_timeout(t, card); in transmit_complete_callback()
193 close_transaction(t, card, RCODE_BUSY); in transmit_complete_callback()
196 close_transaction(t, card, RCODE_DATA_ERROR); in transmit_complete_callback()
199 close_transaction(t, card, RCODE_TYPE_ERROR); in transmit_complete_callback()
206 close_transaction(t, card, status); in transmit_complete_callback()
285 static int allocate_tlabel(struct fw_card *card) in allocate_tlabel() argument
289 tlabel = card->current_tlabel; in allocate_tlabel()
290 while (card->tlabel_mask & (1ULL << tlabel)) { in allocate_tlabel()
292 if (tlabel == card->current_tlabel) in allocate_tlabel()
296 card->current_tlabel = (tlabel + 1) & 0x3f; in allocate_tlabel()
297 card->tlabel_mask |= 1ULL << tlabel; in allocate_tlabel()
350 void fw_send_request(struct fw_card *card, struct fw_transaction *t, int tcode, in fw_send_request() argument
363 spin_lock_irqsave(&card->lock, flags); in fw_send_request()
365 tlabel = allocate_tlabel(card); in fw_send_request()
367 spin_unlock_irqrestore(&card->lock, flags); in fw_send_request()
368 callback(card, RCODE_SEND_ERROR, NULL, 0, callback_data); in fw_send_request()
374 t->card = card; in fw_send_request()
382 destination_id, card->node_id, generation, in fw_send_request()
386 list_add_tail(&t->link, &card->transaction_list); in fw_send_request()
388 spin_unlock_irqrestore(&card->lock, flags); in fw_send_request()
390 card->driver->send_request(card, &t->packet); in fw_send_request()
400 static void transaction_callback(struct fw_card *card, int rcode, in transaction_callback() argument
419 int fw_run_transaction(struct fw_card *card, int tcode, int destination_id, in fw_run_transaction() argument
429 fw_send_request(card, &t, tcode, destination_id, generation, speed, in fw_run_transaction()
442 struct fw_card *card, int status) in transmit_phy_packet_callback() argument
455 void fw_send_phy_config(struct fw_card *card, in fw_send_phy_config() argument
465 gap_count = card->driver->read_phy_reg(card, 1); in fw_send_phy_config()
482 card->driver->send_request(card, &phy_config_packet); in fw_send_phy_config()
631 struct fw_card *card, int status) in free_response_callback() argument
732 static u32 compute_split_timeout_timestamp(struct fw_card *card, in compute_split_timeout_timestamp() argument
738 cycles = card->split_timeout_cycles; in compute_split_timeout_timestamp()
748 static struct fw_request *allocate_request(struct fw_card *card, in allocate_request() argument
779 fw_notice(card, "ERROR - corrupt request received - %08x %08x %08x\n", in allocate_request()
790 compute_split_timeout_timestamp(card, p->timestamp); in allocate_request()
804 void fw_send_response(struct fw_card *card, in fw_send_response() argument
825 card->driver->send_response(card, &request->response); in fw_send_response()
838 static void handle_exclusive_region_request(struct fw_card *card, in handle_exclusive_region_request() argument
856 handler->address_callback(card, request, in handle_exclusive_region_request()
864 fw_send_response(card, request, RCODE_ADDRESS_ERROR); in handle_exclusive_region_request()
867 static void handle_fcp_region_request(struct fw_card *card, in handle_fcp_region_request() argument
878 fw_send_response(card, request, RCODE_ADDRESS_ERROR); in handle_fcp_region_request()
889 fw_send_response(card, request, RCODE_TYPE_ERROR); in handle_fcp_region_request()
897 handler->address_callback(card, NULL, tcode, in handle_fcp_region_request()
906 fw_send_response(card, request, RCODE_COMPLETE); in handle_fcp_region_request()
909 void fw_core_handle_request(struct fw_card *card, struct fw_packet *p) in fw_core_handle_request() argument
918 fw_cdev_handle_phy_packet(card, p); in fw_core_handle_request()
922 request = allocate_request(card, p); in fw_core_handle_request()
932 handle_exclusive_region_request(card, p, request, offset); in fw_core_handle_request()
934 handle_fcp_region_request(card, p, request, offset); in fw_core_handle_request()
939 void fw_core_handle_response(struct fw_card *card, struct fw_packet *p) in fw_core_handle_response() argument
952 spin_lock_irqsave(&card->lock, flags); in fw_core_handle_response()
953 list_for_each_entry(t, &card->transaction_list, link) { in fw_core_handle_response()
956 spin_unlock_irqrestore(&card->lock, flags); in fw_core_handle_response()
960 card->tlabel_mask &= ~(1ULL << t->tlabel); in fw_core_handle_response()
964 spin_unlock_irqrestore(&card->lock, flags); in fw_core_handle_response()
966 if (&t->link == &card->transaction_list) { in fw_core_handle_response()
968 fw_notice(card, "unsolicited response (source %x, tlabel %x)\n", in fw_core_handle_response()
1006 card->driver->cancel_packet(card, &t->packet); in fw_core_handle_response()
1008 t->callback(card, rcode, data, data_length, t->callback_data); in fw_core_handle_response()
1042 static void handle_topology_map(struct fw_card *card, struct fw_request *request, in handle_topology_map() argument
1050 fw_send_response(card, request, RCODE_TYPE_ERROR); in handle_topology_map()
1055 fw_send_response(card, request, RCODE_ADDRESS_ERROR); in handle_topology_map()
1060 memcpy(payload, &card->topology_map[start], length); in handle_topology_map()
1062 fw_send_response(card, request, RCODE_COMPLETE); in handle_topology_map()
1074 static void update_split_timeout(struct fw_card *card) in update_split_timeout() argument
1078 cycles = card->split_timeout_hi * 8000 + (card->split_timeout_lo >> 19); in update_split_timeout()
1083 card->split_timeout_cycles = cycles; in update_split_timeout()
1084 card->split_timeout_jiffies = DIV_ROUND_UP(cycles * HZ, 8000); in update_split_timeout()
1087 static void handle_registers(struct fw_card *card, struct fw_request *request, in handle_registers() argument
1099 if (!card->priority_budget_implemented) { in handle_registers()
1118 *data = cpu_to_be32(card->driver->read_csr(card, reg)); in handle_registers()
1120 card->driver->write_csr(card, reg, be32_to_cpu(*data)); in handle_registers()
1127 card->driver->write_csr(card, CSR_STATE_CLEAR, in handle_registers()
1135 *data = cpu_to_be32(card->split_timeout_hi); in handle_registers()
1137 spin_lock_irqsave(&card->lock, flags); in handle_registers()
1138 card->split_timeout_hi = be32_to_cpu(*data) & 7; in handle_registers()
1139 update_split_timeout(card); in handle_registers()
1140 spin_unlock_irqrestore(&card->lock, flags); in handle_registers()
1148 *data = cpu_to_be32(card->split_timeout_lo); in handle_registers()
1150 spin_lock_irqsave(&card->lock, flags); in handle_registers()
1151 card->split_timeout_lo = in handle_registers()
1153 update_split_timeout(card); in handle_registers()
1154 spin_unlock_irqrestore(&card->lock, flags); in handle_registers()
1162 *data = card->maint_utility_register; in handle_registers()
1164 card->maint_utility_register = *data; in handle_registers()
1171 *data = cpu_to_be32(card->broadcast_channel); in handle_registers()
1173 card->broadcast_channel = in handle_registers()
1199 fw_send_response(card, request, rcode); in handle_registers()
1207 static void handle_low_memory(struct fw_card *card, struct fw_request *request, in handle_low_memory() argument
1216 fw_send_response(card, request, RCODE_TYPE_ERROR); in handle_low_memory()