FreeBSD/sys/dev/firewire/firewire.c
/*
 * To candidate Bus Manager election process.
 */
To candidate Bus Manager election process.
To candidate Bus Manager election process .
static void
fw_try_bmr(void *arg)
{
	struct fw_xfer *xfer;
	struct firewire_comm *fc = arg;
	struct fw_pkt *fp;
	int err = 0;
	xfer = fw_xfer_alloc_buf(M_FWXFER, 8, 4);
	if (xfer == NULL)
		return;
	xfer->send.spd = 0;
	fc->status = FWBUSMGRELECT;
	fp = &xfer->send.hdr;
	fp->mode.lreq.dest_hi = 0xffff;
	fp->mode.lreq.tlrt = 0;
	fp->mode.lreq.tcode = FWTCODE_LREQ;
	fp->mode.lreq.pri = 0;
	fp->mode.lreq.src = 0;
	fp->mode.lreq.len = 8;
	fp->mode.lreq.extcode = EXTCODE_CMP_SWAP;
	fp->mode.lreq.dst = FWLOCALBUS | fc->irm;
	fp->mode.lreq.dest_lo = 0xf0000000 | BUS_MGR_ID;
	xfer->send.payload[0] = htonl(0x3f);
	xfer->send.payload[1] = htonl(fc->nodeid);
	xfer->hand = fw_try_bmr_callback;
	err = fw_asyreq(fc, -1, xfer);
	if (err) {
		fw_xfer_free_buf(xfer);
		return;
	}
	return;
}
static void fw_try_bmr ( void * arg ) { struct fw_xfer * xfer ; struct firewire_comm * fc = arg ; struct fw_pkt * fp ; int err = 0 ; xfer = fw_xfer_alloc_buf ( M_FWXFER , 8 , 4 ) ; if ( xfer == NULL ) return ; xfer -> send . spd = 0 ; fc -> status = FWBUSMGRELECT ; fp = & xfer -> send . hdr ; fp -> mode . lreq . dest_hi = 0xffff ; fp -> mode . lreq . tlrt = 0 ; fp -> mode . lreq . tcode = FWTCODE_LREQ ; fp -> mode . lreq . pri = 0 ; fp -> mode . lreq . src = 0 ; fp -> mode . lreq . len = 8 ; fp -> mode . lreq . extcode = EXTCODE_CMP_SWAP ; fp -> mode . lreq . dst = FWLOCALBUS | fc -> irm ; fp -> mode . lreq . dest_lo = 0xf0000000 | BUS_MGR_ID ; xfer -> send . payload [ 0 ] = htonl ( 0x3f ) ; xfer -> send . payload [ 1 ] = htonl ( fc -> nodeid ) ; xfer -> hand = fw_try_bmr_callback ; err = fw_asyreq ( fc , -1 , xfer ) ; if ( err ) { fw_xfer_free_buf ( xfer ) ; return ; } return ; }
To candidate Bus Manager election process.
To candidate Bus Manager election process .