Date: Wed, 5 Mar 2008 11:13:33 +0900 From: "Hidetoshi Shimokawa" <simokawa@FreeBSD.ORG> To: "Sean Bruno" <sbruno@miralink.com> Cc: freebsd-firewire@freebsd.org Subject: Re: Implementation of the AGENT_STATE Register Message-ID: <626eb4530803041813h4fd52094g742a7394b3c25b46@mail.gmail.com> In-Reply-To: <47ACC44B.9090504@miralink.com> References: <47A79E13.5040706@miralink.com> <626eb4530802042020n78001c00kddbdedb907902691@mail.gmail.com> <47A7E550.7060500@miralink.com> <626eb4530802042043t3e0ce8d1l83f64b2d3ea48b1c@mail.gmail.com> <47AA13FB.4080209@miralink.com> <47AA1C78.1080305@miralink.com> <47ACC44B.9090504@miralink.com>
index | next in thread | previous in thread | raw e-mail
Sorry for the late response.
On Sat, Feb 9, 2008 at 6:06 AM, Sean Bruno <sbruno@miralink.com> wrote:
> Hidetoshi:
>
> Can you review this and correct it where needed? I am sure that it is
> wrong, but I haven't tested it yet.
>
>
> struct agent_state {
> uint32_t fetch_agent_state;
> #define AGENT_STATE_RESET 0
> #define AGENT_STATE_ACTIVE 1
> #define AGENT_STATE_SUSPENDED 2
> #define AGENT_STATE_DEAD 3
> uint32_t bus_reset_command_reset_init_vals;
> uint32_t read_vals;
> uint32_t write_effects;
>
> };
>
> static void
> sbp_targ_send_agent_state(struct fw_xfer *xfer)
> {
> struct agent_state *current_state;
> struct fw_pkt *rfp; /* response to request --> from target */
>
> xfer->send.payload = malloc(sizeof(struct agent_state),
>
> M_SBP_TARG, M_NOWAIT | M_ZERO);
> xfer->send.pay_len = ntohs(sizeof(struct agent_state));
I don't think you need ntohs() here.
> xfer->send.spd = FWSPD_S400;
>
> current_state = (struct agent_state *)xfer->send.payload;
>
> current_state->fetch_agent_state = AGENT_STATE_ACTIVE;
I'm not sure whether byteswapping is required here or not.
> rfp = &xfer->recv.hdr;
>
> rfp->mode.rresb.tcode = FWTCODE_RRESB;
> rfp->mode.rresb.rtcode = 0;
> rfp->mode.rresb.extcode = 0;
> xfer->send.hdr.mode.hdr.dst = ntohs(rfp->mode.hdr.src);
>
>
> xfer->hand = fw_xfer_free_buf;
> rfp->mode.hdr.pri = 0;
> fw_asyreq(xfer->fc, -1, xfer);
>
> }
>
>
> Sean
>
>
--
/\ Hidetoshi Shimokawa
\/ simokawa@FreeBSD.ORG
help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?626eb4530803041813h4fd52094g742a7394b3c25b46>
