Skip to content

Commit

Permalink
make sff page reads work on little endian archs too. like amd64.
Browse files Browse the repository at this point in the history
some modules seem to need more time when waiting for bytes while here.

hrvoje popovski hit the endian issue
  • Loading branch information
dlg committed Apr 16, 2019
1 parent 9262558 commit 5c9c6d7
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions sys/dev/pci/if_myx.c
@@ -1,4 +1,4 @@
/* $OpenBSD: if_myx.c,v 1.105 2019/04/15 03:06:12 dlg Exp $ */
/* $OpenBSD: if_myx.c,v 1.106 2019/04/16 09:40:21 dlg Exp $ */

/*
* Copyright (c) 2007 Reyk Floeter <reyk@openbsd.org>
Expand Down Expand Up @@ -954,9 +954,9 @@ myx_i2c_byte(struct myx_softc *sc, uint8_t off, uint8_t *byte)
uint32_t r;
unsigned int ms;

memset(&mc, 0, sizeof(mc));
mc.mc_data0 = off;
for (ms = 0; ms < 50; ms++) {
for (ms = 0; ms < 600; ms++) {
memset(&mc, 0, sizeof(mc));
mc.mc_data0 = htobe32(off);
result = myx_cmd(sc, MYXCMD_I2C_BYTE, &mc, &r);
switch (result) {
case MYXCMD_OK:
Expand All @@ -982,8 +982,8 @@ myx_get_sffpage(struct myx_softc *sc, struct if_sffpage *sff)
int result;

memset(&mc, 0, sizeof(mc));
mc.mc_data0 = 1; /* get all 256 bytes */
mc.mc_data1 = sff->sff_addr << 8;
mc.mc_data0 = htobe32(1); /* get all 256 bytes */
mc.mc_data1 = htobe32(sff->sff_addr << 8);
result = myx_cmd(sc, MYXCMD_I2C_READ, &mc, NULL);
if (result != 0)
return (EIO);
Expand All @@ -993,7 +993,7 @@ myx_get_sffpage(struct myx_softc *sc, struct if_sffpage *sff)

result = myx_i2c_byte(sc, 127, &page);
if (result != 0)
return (EIO);
return (result);

if (page != sff->sff_page)
return (ENXIO);
Expand Down

0 comments on commit 5c9c6d7

Please sign in to comment.