Lines Matching refs:host

181 int hpsb_reset_bus(struct hpsb_host *host, int type)  in hpsb_reset_bus()  argument
183 if (!host->in_bus_reset) { in hpsb_reset_bus()
184 host->driver->devctl(host, RESET_BUS, type); in hpsb_reset_bus()
192 int hpsb_bus_reset(struct hpsb_host *host) in hpsb_bus_reset() argument
194 if (host->in_bus_reset) { in hpsb_bus_reset()
200 abort_requests(host); in hpsb_bus_reset()
201 host->in_bus_reset = 1; in hpsb_bus_reset()
202 host->irm_id = -1; in hpsb_bus_reset()
203 host->is_irm = 0; in hpsb_bus_reset()
204 host->busmgr_id = -1; in hpsb_bus_reset()
205 host->is_busmgr = 0; in hpsb_bus_reset()
206 host->is_cycmst = 0; in hpsb_bus_reset()
207 host->node_count = 0; in hpsb_bus_reset()
208 host->selfid_count = 0; in hpsb_bus_reset()
218 static int check_selfids(struct hpsb_host *host) in check_selfids() argument
221 int rest_of_selfids = host->selfid_count; in check_selfids()
222 struct selfid *sid = (struct selfid *)host->topology_map; in check_selfids()
226 host->nodes_active = 0; in check_selfids()
240 host->nodes_active++; in check_selfids()
242 host->irm_id = LOCAL_BUS | sid->phy_id; in check_selfids()
277 host->node_count = nodeid + 1; in check_selfids()
281 static void build_speed_map(struct hpsb_host *host, int nodecount) in build_speed_map() argument
285 u8 *map = host->speed_map; in build_speed_map()
301 for (sid = (struct selfid *)&host->topology_map[host->selfid_count-1], in build_speed_map()
303 (void *)sid >= (void *)host->topology_map; sid--) { in build_speed_map()
355 void hpsb_selfid_received(struct hpsb_host *host, quadlet_t sid) in hpsb_selfid_received() argument
357 if (host->in_bus_reset) { in hpsb_selfid_received()
359 host->topology_map[host->selfid_count++] = sid; in hpsb_selfid_received()
362 sid, NODEID_TO_BUS(host->node_id)); in hpsb_selfid_received()
366 void hpsb_selfid_complete(struct hpsb_host *host, int phyid, int isroot) in hpsb_selfid_complete() argument
368 if (!host->in_bus_reset) in hpsb_selfid_complete()
371 host->node_id = LOCAL_BUS | phyid; in hpsb_selfid_complete()
372 host->is_root = isroot; in hpsb_selfid_complete()
374 if (!check_selfids(host)) { in hpsb_selfid_complete()
375 if (host->reset_retries++ < 20) { in hpsb_selfid_complete()
378 host->in_bus_reset = 0; in hpsb_selfid_complete()
380 hpsb_reset_bus(host, LONG_RESET); in hpsb_selfid_complete()
385 host->reset_retries = 0; in hpsb_selfid_complete()
388 host->reset_retries = 0; in hpsb_selfid_complete()
389 build_speed_map(host, host->node_count); in hpsb_selfid_complete()
393 "... irm_id: 0x%X node_id: 0x%X",host->irm_id,host->node_id); in hpsb_selfid_complete()
396 if (host->irm_id == host->node_id) { in hpsb_selfid_complete()
397 host->is_irm = 1; in hpsb_selfid_complete()
399 host->is_busmgr = 0; in hpsb_selfid_complete()
400 host->is_irm = 0; in hpsb_selfid_complete()
404 host->driver->devctl(host, ACT_CYCLE_MASTER, 1); in hpsb_selfid_complete()
405 host->is_cycmst = 1; in hpsb_selfid_complete()
407 atomic_inc(&host->generation); in hpsb_selfid_complete()
408 host->in_bus_reset = 0; in hpsb_selfid_complete()
409 highlevel_host_reset(host); in hpsb_selfid_complete()
413 void hpsb_packet_sent(struct hpsb_host *host, struct hpsb_packet *packet, in hpsb_packet_sent() argument
437 spin_lock_irqsave(&host->pending_pkt_lock, flags); in hpsb_packet_sent()
438 list_add_tail(&packet->list, &host->pending_packets); in hpsb_packet_sent()
439 spin_unlock_irqrestore(&host->pending_pkt_lock, flags); in hpsb_packet_sent()
442 mod_timer(&host->timeout, jiffies + host->timeout_interval); in hpsb_packet_sent()
455 int hpsb_send_phy_config(struct hpsb_host *host, int rootid, int gapcnt) in hpsb_send_phy_config() argument
471 packet->host = host; in hpsb_send_phy_config()
485 packet->generation = get_hpsb_generation(host); in hpsb_send_phy_config()
517 struct hpsb_host *host = packet->host; in hpsb_send_packet() local
519 if (host->is_shutdown || host->in_bus_reset in hpsb_send_packet()
520 || (packet->generation != get_hpsb_generation(host))) { in hpsb_send_packet()
526 if (packet->node_id == host->node_id) in hpsb_send_packet()
555 hpsb_packet_sent(host, packet, packet->expect_response?ACK_PENDING:ACK_COMPLETE); in hpsb_send_packet()
556 hpsb_packet_received(host, data, size, 0); in hpsb_send_packet()
565 host->speed_map[NODEID_TO_NODE(host->node_id) * 64 in hpsb_send_packet()
583 return host->driver->transmit_packet(host, packet); in hpsb_send_packet()
594 void handle_packet_response(struct hpsb_host *host, int tcode, quadlet_t *data, in handle_packet_response() argument
605 spin_lock_irqsave(&host->pending_pkt_lock, flags); in handle_packet_response()
607 list_for_each(lh, &host->pending_packets) { in handle_packet_response()
615 if (lh == &host->pending_packets) { in handle_packet_response()
618 spin_unlock_irqrestore(&host->pending_pkt_lock, flags); in handle_packet_response()
643 spin_unlock_irqrestore(&host->pending_pkt_lock, flags); in handle_packet_response()
649 spin_unlock_irqrestore(&host->pending_pkt_lock, flags); in handle_packet_response()
675 static struct hpsb_packet *create_reply_packet(struct hpsb_host *host, in create_reply_packet() argument
690 p->host = host; in create_reply_packet()
695 p->generation = get_hpsb_generation(host); in create_reply_packet()
708 packet->header[1] = (packet->host->node_id << 16) | (rcode << 12); \
753 packet = create_reply_packet(host, data, length); \
756 static void handle_incoming_packet(struct hpsb_host *host, int tcode, in handle_incoming_packet() argument
772 rcode = highlevel_write(host, source, dest, data+3, in handle_incoming_packet()
787 rcode = highlevel_write(host, source, dest, data+4, in handle_incoming_packet()
802 rcode = highlevel_read(host, source, &buffer, addr, 4, flags); in handle_incoming_packet()
816 rcode = highlevel_read(host, source, packet->data, addr, in handle_incoming_packet()
841 rcode = highlevel_lock(host, source, packet->data, addr, in handle_incoming_packet()
848 rcode = highlevel_lock(host, source, in handle_incoming_packet()
854 rcode = highlevel_lock64(host, source, in handle_incoming_packet()
862 rcode = highlevel_lock64(host, source, in handle_incoming_packet()
887 void hpsb_packet_received(struct hpsb_host *host, quadlet_t *data, size_t size, in hpsb_packet_received() argument
892 if (host->in_bus_reset) { in hpsb_packet_received()
906 handle_packet_response(host, tcode, data, size); in hpsb_packet_received()
914 handle_incoming_packet(host, tcode, data, size, write_acked); in hpsb_packet_received()
919 highlevel_iso_receive(host, data, size); in hpsb_packet_received()
934 void abort_requests(struct hpsb_host *host) in abort_requests() argument
941 host->driver->devctl(host, CANCEL_REQUESTS, 0); in abort_requests()
943 spin_lock_irqsave(&host->pending_pkt_lock, flags); in abort_requests()
944 list_splice(&host->pending_packets, &llist); in abort_requests()
945 INIT_LIST_HEAD(&host->pending_packets); in abort_requests()
946 spin_unlock_irqrestore(&host->pending_pkt_lock, flags); in abort_requests()
960 struct hpsb_host *host = (struct hpsb_host *)__opaque; in abort_timedouts() local
967 spin_lock_irqsave(&host->csr.lock, flags); in abort_timedouts()
968 expire = host->csr.expire; in abort_timedouts()
969 spin_unlock_irqrestore(&host->csr.lock, flags); in abort_timedouts()
971 spin_lock_irqsave(&host->pending_pkt_lock, flags); in abort_timedouts()
973 list_for_each_safe(lh, tlh, &host->pending_packets) { in abort_timedouts()
981 if (!list_empty(&host->pending_packets)) in abort_timedouts()
982 mod_timer(&host->timeout, jiffies + host->timeout_interval); in abort_timedouts()
984 spin_unlock_irqrestore(&host->pending_pkt_lock, flags); in abort_timedouts()