diff options
author | simokawa <simokawa@FreeBSD.org> | 2003-08-19 08:47:49 +0000 |
---|---|---|
committer | simokawa <simokawa@FreeBSD.org> | 2003-08-19 08:47:49 +0000 |
commit | c05232c451d50283b8904feb6a4c28d970180d37 (patch) | |
tree | feb80ca7b2dc0043c2e64881f53fba0280c7c358 /sys/dev/firewire | |
parent | 00e9963efb647fd5a8d8eb9037df311d937c6bae (diff) | |
download | FreeBSD-src-c05232c451d50283b8904feb6a4c28d970180d37.zip FreeBSD-src-c05232c451d50283b8904feb6a4c28d970180d37.tar.gz |
Allow to access phy registers via ioctl().
Diffstat (limited to 'sys/dev/firewire')
-rw-r--r-- | sys/dev/firewire/firewire.h | 2 | ||||
-rw-r--r-- | sys/dev/firewire/fwohci.c | 17 |
2 files changed, 18 insertions, 1 deletions
diff --git a/sys/dev/firewire/firewire.h b/sys/dev/firewire/firewire.h index b5f6573..ca9cbac 100644 --- a/sys/dev/firewire/firewire.h +++ b/sys/dev/firewire/firewire.h @@ -381,6 +381,8 @@ struct fw_crom_buf { #define FWOHCI_RDREG _IOWR('S', 80, struct fw_reg_req_t) #define FWOHCI_WRREG _IOWR('S', 81, struct fw_reg_req_t) +#define FWOHCI_RDPHYREG _IOWR('S', 82, struct fw_reg_req_t) +#define FWOHCI_WRPHYREG _IOWR('S', 83, struct fw_reg_req_t) #define DUMPDMA _IOWR('S', 82, u_int32_t) diff --git a/sys/dev/firewire/fwohci.c b/sys/dev/firewire/fwohci.c index 445dd66..ed2b3b5 100644 --- a/sys/dev/firewire/fwohci.c +++ b/sys/dev/firewire/fwohci.c @@ -332,7 +332,7 @@ again: } if (bootverbose || retry >= MAX_RETRY) device_printf(sc->fc.dev, - "fwphy_rddata: loop=%d, retry=%d\n", i, retry); + "fwphy_rddata: 0x%x loop=%d, retry=%d\n", addr, i, retry); #undef MAX_RETRY return((fun >> PHYDEV_RDDATA )& 0xff); } @@ -382,7 +382,22 @@ fwohci_ioctl (dev_t dev, u_long cmd, caddr_t data, int flag, fw_proc *td) err = EINVAL; } break; +/* Read/Write Phy registers */ +#define OHCI_MAX_PHY_REG 0xf + case FWOHCI_RDPHYREG: + if (reg->addr <= OHCI_MAX_PHY_REG) + reg->data = fwphy_rddata(fc, reg->addr); + else + err = EINVAL; + break; + case FWOHCI_WRPHYREG: + if (reg->addr <= OHCI_MAX_PHY_REG) + reg->data = fwphy_wrdata(fc, reg->addr, reg->data); + else + err = EINVAL; + break; default: + err = EINVAL; break; } return err; |