Changeset View
Changeset View
Standalone View
Standalone View
usr.sbin/fwcontrol/fwcontrol.c
| Show First 20 Lines • Show All 201 Lines • ▼ Show 20 Lines | |||||
| } | } | ||||
| static u_int32_t | static u_int32_t | ||||
| read_write_quad(int fd, struct fw_eui64 eui, u_int32_t addr_lo, int readmode, u_int32_t data) | read_write_quad(int fd, struct fw_eui64 eui, u_int32_t addr_lo, int readmode, u_int32_t data) | ||||
| { | { | ||||
| struct fw_asyreq *asyreq; | struct fw_asyreq *asyreq; | ||||
| u_int32_t *qld, res; | u_int32_t *qld, res; | ||||
| asyreq = (struct fw_asyreq *)malloc(sizeof(struct fw_asyreq_t) + 16); | asyreq = malloc(sizeof(*asyreq)); | ||||
| if (asyreq == NULL) | if (asyreq == NULL) | ||||
| err(EX_SOFTWARE, "%s:asyreq malloc", __func__); | err(EX_SOFTWARE, "%s:asyreq malloc", __func__); | ||||
| asyreq->req.len = 16; | asyreq->req.len = 16; | ||||
| #if 0 | #if 0 | ||||
| asyreq->req.type = FWASREQNODE; | asyreq->req.type = FWASREQNODE; | ||||
| asyreq->pkt.mode.rreqq.dst = FWLOCALBUS | node; | asyreq->pkt.mode.rreqq.dst = FWLOCALBUS | node; | ||||
| #else | #else | ||||
| asyreq->req.type = FWASREQEUI; | asyreq->req.type = FWASREQEUI; | ||||
| Show All 38 Lines | |||||
| * is either ignored or interpreted as an extended | * is either ignored or interpreted as an extended | ||||
| * PHY config Packet as per 1394a-2005 4.3.4.4 | * PHY config Packet as per 1394a-2005 4.3.4.4 | ||||
| */ | */ | ||||
| static void | static void | ||||
| send_phy_config(int fd, int root_node, int gap_count) | send_phy_config(int fd, int root_node, int gap_count) | ||||
| { | { | ||||
| struct fw_asyreq *asyreq; | struct fw_asyreq *asyreq; | ||||
| asyreq = (struct fw_asyreq *)malloc(sizeof(struct fw_asyreq_t) + 12); | asyreq = malloc(sizeof(*asyreq)); | ||||
| if (asyreq == NULL) | if (asyreq == NULL) | ||||
| err(EX_SOFTWARE, "%s:asyreq malloc", __func__); | err(EX_SOFTWARE, "%s:asyreq malloc", __func__); | ||||
| asyreq->req.len = 12; | asyreq->req.len = 12; | ||||
| asyreq->req.type = FWASREQNODE; | asyreq->req.type = FWASREQNODE; | ||||
| asyreq->pkt.mode.ld[0] = 0; | asyreq->pkt.mode.ld[0] = 0; | ||||
| asyreq->pkt.mode.ld[1] = 0; | asyreq->pkt.mode.ld[1] = 0; | ||||
| asyreq->pkt.mode.common.tcode = FWTCODE_PHY; | asyreq->pkt.mode.common.tcode = FWTCODE_PHY; | ||||
| if (root_node >= 0) | if (root_node >= 0) | ||||
| Show All 10 Lines | send_phy_config(int fd, int root_node, int gap_count) | ||||
| free(asyreq); | free(asyreq); | ||||
| } | } | ||||
| static void | static void | ||||
| link_on(int fd, int node) | link_on(int fd, int node) | ||||
| { | { | ||||
| struct fw_asyreq *asyreq; | struct fw_asyreq *asyreq; | ||||
| asyreq = (struct fw_asyreq *)malloc(sizeof(struct fw_asyreq_t) + 12); | asyreq = malloc(sizeof(*asyreq)); | ||||
| if (asyreq == NULL) | if (asyreq == NULL) | ||||
| err(EX_SOFTWARE, "%s:asyreq malloc", __func__); | err(EX_SOFTWARE, "%s:asyreq malloc", __func__); | ||||
| asyreq->req.len = 12; | asyreq->req.len = 12; | ||||
| asyreq->req.type = FWASREQNODE; | asyreq->req.type = FWASREQNODE; | ||||
| asyreq->pkt.mode.common.tcode = FWTCODE_PHY; | asyreq->pkt.mode.common.tcode = FWTCODE_PHY; | ||||
| asyreq->pkt.mode.ld[1] |= (1 << 30) | ((node & 0x3f) << 24); | asyreq->pkt.mode.ld[1] |= (1 << 30) | ((node & 0x3f) << 24); | ||||
| asyreq->pkt.mode.ld[2] = ~asyreq->pkt.mode.ld[1]; | asyreq->pkt.mode.ld[2] = ~asyreq->pkt.mode.ld[1]; | ||||
| if (ioctl(fd, FW_ASYREQ, asyreq) < 0) | if (ioctl(fd, FW_ASYREQ, asyreq) < 0) | ||||
| err(EX_IOERR, "%s: ioctl", __func__); | err(EX_IOERR, "%s: ioctl", __func__); | ||||
| free(asyreq); | free(asyreq); | ||||
| } | } | ||||
| static void | static void | ||||
| reset_start(int fd, int node) | reset_start(int fd, int node) | ||||
| { | { | ||||
| struct fw_asyreq *asyreq; | struct fw_asyreq *asyreq; | ||||
| asyreq = (struct fw_asyreq *)malloc(sizeof(struct fw_asyreq_t) + 16); | asyreq = malloc(sizeof(*asyreq)); | ||||
| if (asyreq == NULL) | if (asyreq == NULL) | ||||
| err(EX_SOFTWARE, "%s:asyreq malloc", __func__); | err(EX_SOFTWARE, "%s:asyreq malloc", __func__); | ||||
| asyreq->req.len = 16; | asyreq->req.len = 16; | ||||
| asyreq->req.type = FWASREQNODE; | asyreq->req.type = FWASREQNODE; | ||||
| asyreq->pkt.mode.wreqq.dst = FWLOCALBUS | (node & 0x3f); | asyreq->pkt.mode.wreqq.dst = FWLOCALBUS | (node & 0x3f); | ||||
| asyreq->pkt.mode.wreqq.tlrt = 0; | asyreq->pkt.mode.wreqq.tlrt = 0; | ||||
| asyreq->pkt.mode.wreqq.tcode = FWTCODE_WREQQ; | asyreq->pkt.mode.wreqq.tcode = FWTCODE_WREQQ; | ||||
| ▲ Show 20 Lines • Show All 771 Lines • Show Last 20 Lines | |||||