summaryrefslogtreecommitdiffstats
path: root/sys/dev/firewire/fwcrom.c
diff options
context:
space:
mode:
authorsimokawa <simokawa@FreeBSD.org>2003-10-02 04:06:56 +0000
committersimokawa <simokawa@FreeBSD.org>2003-10-02 04:06:56 +0000
commitdb5d831317931b7bb1d2ea7b34c895d5de9e931e (patch)
tree7f27d60f89b5c06e7ea329138d86ab46f08532d4 /sys/dev/firewire/fwcrom.c
parent1c522512fd8b855dc3d6dbd26fed59bda6e9f0e4 (diff)
downloadFreeBSD-src-db5d831317931b7bb1d2ea7b34c895d5de9e931e.zip
FreeBSD-src-db5d831317931b7bb1d2ea7b34c895d5de9e931e.tar.gz
MFp4: Change struct fw_xfer to reduce memory copy in fwmem_*() functions.
And many changes. * all - Major change of struct fw_xfer. o {send,recv}.buf is splitted into hdr and payload. o Remove unnecessary fields. o spd is moved under send and recv. - Remove unnecessary 'volatile' keyword. - Add definition of rtcode and extcode. * firewire.c - Ignore FWDEVINVAL devices in fw_noderesolve_nodeid(). - Check the existance of the bind before call STAILQ_REMOVE(). - Fix bug in the fw_bindadd(). - Change element of struct fw_bind for simplicity. - Check rtcode of response packet. - Reduce split transaction timeout to 200 msec. (100msec is the default value in the spec.) - Set watchdog timer cycle to 10 Hz. - Set xfer->tv just before calling fw_get_tlabel(). * fwohci.c - Simplifies fwohci_get_plen(). * sbp.c - Fix byte order of multibyte scsi_status informations. - Split sbp.c and sbp.h. - Unit number is not necessary for FIFO¤ address. - Reduce LOGIN_DELAY and SCAN_DELAY to 1 sec. - Add some constants defineded in SBP-2 spec. * fwmem.c - Introduce fwmem_strategy() and reduce memory copy.
Diffstat (limited to 'sys/dev/firewire/fwcrom.c')
-rw-r--r--sys/dev/firewire/fwcrom.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/sys/dev/firewire/fwcrom.c b/sys/dev/firewire/fwcrom.c
index ce7dfd3..15dd818 100644
--- a/sys/dev/firewire/fwcrom.c
+++ b/sys/dev/firewire/fwcrom.c
@@ -424,6 +424,7 @@ crom_add_chunk(struct crom_src *src, struct crom_chunk *parent,
return(index);
}
+#define MAX_TEXT ((CROM_MAX_CHUNK_LEN + 1) * 4 - sizeof(struct csrtext))
int
crom_add_simple_text(struct crom_src *src, struct crom_chunk *parent,
struct crom_chunk *chunk, char *buf)
@@ -431,9 +432,9 @@ crom_add_simple_text(struct crom_src *src, struct crom_chunk *parent,
struct csrtext *tl;
u_int32_t *p;
int len, i;
+ char t[MAX_TEXT];
len = strlen(buf);
-#define MAX_TEXT ((CROM_MAX_CHUNK_LEN + 1) * 4 - sizeof(struct csrtext))
if (len > MAX_TEXT) {
#if __FreeBSD_version < 500000
printf("text(%d) trancated to %d.\n", len, MAX_TEXT);
@@ -448,7 +449,9 @@ crom_add_simple_text(struct crom_src *src, struct crom_chunk *parent,
tl->spec_id = 0;
tl->spec_type = 0;
tl->lang_id = 0;
- p = (u_int32_t *) buf;
+ bzero(&t[0], roundup2(len, sizeof(u_int32_t)));
+ bcopy(buf, &t[0], len);
+ p = (u_int32_t *)&t[0];
for (i = 0; i < howmany(len, sizeof(u_int32_t)); i ++)
tl->text[i] = ntohl(*p++);
return (crom_add_chunk(src, parent, chunk, CROM_TEXTLEAF));
OpenPOWER on IntegriCloud