summaryrefslogtreecommitdiff
path: root/sys/pci
diff options
context:
space:
mode:
Diffstat (limited to 'sys/pci')
-rw-r--r--sys/pci/alpm.c666
-rw-r--r--sys/pci/intpmreg.h77
-rw-r--r--sys/pci/xmaciireg.h393
3 files changed, 1136 insertions, 0 deletions
diff --git a/sys/pci/alpm.c b/sys/pci/alpm.c
new file mode 100644
index 000000000000..ff4c5d3fb435
--- /dev/null
+++ b/sys/pci/alpm.c
@@ -0,0 +1,666 @@
+/*-
+ * Copyright (c) 1998, 1999 Nicolas Souchu
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ *
+ */
+
+/*
+ * Power Management support for the Acer M15x3 chipsets
+ */
+#include <sys/param.h>
+#include <sys/kernel.h>
+#include <sys/systm.h>
+#include <sys/module.h>
+#include <sys/bus.h>
+#include <sys/conf.h>
+#include <sys/buf.h>
+#include <sys/uio.h>
+#include <sys/malloc.h>
+
+#include <machine/clock.h>
+
+#include <machine/bus_pio.h>
+#include <machine/bus_memio.h>
+#include <machine/bus.h>
+
+#include <pci/pcivar.h>
+#include <pci/pcireg.h>
+
+#include <dev/iicbus/iiconf.h>
+#include <dev/smbus/smbconf.h>
+#include "smbus_if.h"
+
+#include "alpm.h"
+
+#define ALPM_DEBUG(x) if (alpm_debug) (x)
+
+#ifdef DEBUG
+static int alpm_debug = 1;
+#else
+static int alpm_debug = 0;
+#endif
+
+#define ACER_M1543_PMU_ID 0x710110b9
+
+/* Uncomment this line to force another I/O base address for SMB */
+/* #define ALPM_SMBIO_BASE_ADDR 0x3a80 */
+
+/* I/O registers offsets - the base address is programmed via the
+ * SMBBA PCI configuration register
+ */
+#define SMBSTS 0x0 /* SMBus host/slave status register */
+#define SMBCMD 0x1 /* SMBus host/slave command register */
+#define SMBSTART 0x2 /* start to generate programmed cycle */
+#define SMBHADDR 0x3 /* host address register */
+#define SMBHDATA 0x4 /* data A register for host controller */
+#define SMBHDATB 0x5 /* data B register for host controller */
+#define SMBHBLOCK 0x6 /* block register for host controller */
+#define SMBHCMD 0x7 /* command register for host controller */
+
+/* SMBSTS masks */
+#define TERMINATE 0x80
+#define BUS_COLLI 0x40
+#define DEVICE_ERR 0x20
+#define SMI_I_STS 0x10
+#define HST_BSY 0x08
+#define IDL_STS 0x04
+#define HSTSLV_STS 0x02
+#define HSTSLV_BSY 0x01
+
+/* SMBCMD masks */
+#define SMB_BLK_CLR 0x80
+#define T_OUT_CMD 0x08
+#define ABORT_HOST 0x04
+
+/* SMBus commands */
+#define SMBQUICK 0x00
+#define SMBSRBYTE 0x10 /* send/receive byte */
+#define SMBWRBYTE 0x20 /* write/read byte */
+#define SMBWRWORD 0x30 /* write/read word */
+#define SMBWRBLOCK 0x40 /* write/read block */
+
+/* PCI configuration registers and masks
+ */
+#define COM 0x4
+#define COM_ENABLE_IO 0x1
+
+#define SMBBA 0x14
+
+#define ATPC 0x5b
+#define ATPC_SMBCTRL 0x04
+
+#define SMBHSI 0xe0
+#define SMBHSI_SLAVE 0x2
+#define SMBHSI_HOST 0x1
+
+#define SMBHCBC 0xe2
+#define SMBHCBC_CLOCK 0x70
+
+#define SMBCLOCK_149K 0x0
+#define SMBCLOCK_74K 0x20
+#define SMBCLOCK_37K 0x40
+#define SMBCLOCK_223K 0x80
+#define SMBCLOCK_111K 0xa0
+#define SMBCLOCK_55K 0xc0
+
+struct alpm_data {
+ int base;
+ bus_space_tag_t smbst;
+ bus_space_handle_t smbsh;
+ pcici_t tag;
+};
+struct alpm_data alpmdata[NALPM];
+
+struct alsmb_softc {
+ int base;
+ device_t smbus;
+ struct alpm_data *alpm;
+};
+
+#define ALPM_SMBINB(alsmb,register) \
+ (bus_space_read_1(alsmb->alpm->smbst, alsmb->alpm->smbsh, register))
+#define ALPM_SMBOUTB(alsmb,register,value) \
+ (bus_space_write_1(alsmb->alpm->smbst, alsmb->alpm->smbsh, register, value))
+
+static int alsmb_probe(device_t);
+static int alsmb_attach(device_t);
+static int alsmb_smb_callback(device_t, int, caddr_t *);
+static int alsmb_smb_quick(device_t dev, u_char slave, int how);
+static int alsmb_smb_sendb(device_t dev, u_char slave, char byte);
+static int alsmb_smb_recvb(device_t dev, u_char slave, char *byte);
+static int alsmb_smb_writeb(device_t dev, u_char slave, char cmd, char byte);
+static int alsmb_smb_readb(device_t dev, u_char slave, char cmd, char *byte);
+static int alsmb_smb_writew(device_t dev, u_char slave, char cmd, short word);
+static int alsmb_smb_readw(device_t dev, u_char slave, char cmd, short *word);
+static int alsmb_smb_bwrite(device_t dev, u_char slave, char cmd, u_char count, char *buf);
+static int alsmb_smb_bread(device_t dev, u_char slave, char cmd, u_char count, char *byte);
+
+static devclass_t alsmb_devclass;
+
+static device_method_t alsmb_methods[] = {
+ /* device interface */
+ DEVMETHOD(device_probe, alsmb_probe),
+ DEVMETHOD(device_attach, alsmb_attach),
+
+ /* bus interface */
+ DEVMETHOD(bus_print_child, bus_generic_print_child),
+
+ /* smbus interface */
+ DEVMETHOD(smbus_callback, alsmb_smb_callback),
+ DEVMETHOD(smbus_quick, alsmb_smb_quick),
+ DEVMETHOD(smbus_sendb, alsmb_smb_sendb),
+ DEVMETHOD(smbus_recvb, alsmb_smb_recvb),
+ DEVMETHOD(smbus_writeb, alsmb_smb_writeb),
+ DEVMETHOD(smbus_readb, alsmb_smb_readb),
+ DEVMETHOD(smbus_writew, alsmb_smb_writew),
+ DEVMETHOD(smbus_readw, alsmb_smb_readw),
+ DEVMETHOD(smbus_bwrite, alsmb_smb_bwrite),
+ DEVMETHOD(smbus_bread, alsmb_smb_bread),
+
+ { 0, 0 }
+};
+
+static driver_t alsmb_driver = {
+ "alsmb",
+ alsmb_methods,
+ sizeof(struct alsmb_softc),
+};
+
+static const char* alpm_pci_probe(pcici_t tag, pcidi_t type);
+static void alpm_pci_attach(pcici_t tag, int unit);
+
+static u_long alpm_count;
+
+static struct pci_device alpm_device = {
+ "alpm",
+ alpm_pci_probe,
+ alpm_pci_attach,
+ &alpm_count
+};
+
+COMPAT_PCI_DRIVER (alpm, alpm_device);
+
+static const char*
+alpm_pci_probe(pcici_t tag, pcidi_t type)
+{
+ if (type == ACER_M1543_PMU_ID)
+ return ("AcerLabs M15x3 Power Management Unit");
+
+ return ((char *)0);
+}
+
+static void
+alpm_pci_attach(pcici_t tag, int unit)
+{
+ struct alpm_data *alpm;
+ u_long l;
+
+ if (unit >= NALPM) {
+ printf("alpm%d: attach: only %d units configured.\n",
+ unit, NALPM);
+ return;
+ }
+ alpm = &alpmdata[unit];
+
+ alpm->tag = tag;
+
+ /* Unlock SMBIO base register access */
+ l = pci_cfgread(tag, ATPC, 1);
+ pci_cfgwrite(tag, ATPC, l & ~ATPC_SMBCTRL, 1);
+
+ if (bootverbose) {
+ l = pci_cfgread(tag, SMBHSI, 1);
+ printf("alsmb%d: %s/%s", unit,
+ (l & SMBHSI_HOST) ? "host":"nohost",
+ (l & SMBHSI_SLAVE) ? "slave":"noslave");
+
+ l = pci_cfgread(tag, SMBHCBC, 1);
+ switch (l & SMBHCBC_CLOCK) {
+ case SMBCLOCK_149K:
+ printf(" 149K");
+ break;
+ case SMBCLOCK_74K:
+ printf(" 74K");
+ break;
+ case SMBCLOCK_37K:
+ printf(" 37K");
+ break;
+ case SMBCLOCK_223K:
+ printf(" 223K");
+ break;
+ case SMBCLOCK_111K:
+ printf(" 111K");
+ break;
+ case SMBCLOCK_55K:
+ printf(" 55K");
+ break;
+ }
+ }
+
+ alpm->smbst = I386_BUS_SPACE_IO;
+
+#ifdef ALPM_SMBIO_BASE_ADDR
+ /* disable I/O */
+ l = pci_cfgread(tag, COM, 2);
+ pci_cfgwrite(tag, COM, l & ~COM_ENABLE_IO, 2);
+
+ /* set the I/O base address */
+ pci_cfgwrite(tag, SMBBA, ALPM_SMBIO_BASE_ADDR | 0x1, 4);
+
+ /* enable I/O */
+ pci_cfgwrite(tag, COM, l | COM_ENABLE_IO, 2);
+
+ alpm->smbsh = ALPM_SMBIO_BASE_ADDR;
+#else
+ alpm->smbsh = pci_cfgread(tag, SMBBA, 4) & ~0x1;
+#endif
+ if (bootverbose)
+ printf(" at 0x%x\n", alpm->smbsh);
+
+ /* XXX add the I2C interface to the root_bus until pcibus is ready */
+ device_add_child(root_bus, "alsmb", unit, NULL);
+
+ return;
+}
+
+/*
+ * Not a real probe, we know the device exists since the device has
+ * been added after the successfull pci probe.
+ */
+static int
+alsmb_probe(device_t dev)
+{
+ struct alsmb_softc *sc = (struct alsmb_softc *)device_get_softc(dev);
+
+ sc->alpm = &alpmdata[device_get_unit(dev)];
+
+ device_set_desc(dev, "Aladdin IV/V/Pro2 SMBus controller");
+
+ return (0);
+}
+
+static int
+alsmb_attach(device_t dev)
+{
+ struct alsmb_softc *sc = (struct alsmb_softc *)device_get_softc(dev);
+
+ /* allocate a new smbus device */
+ sc->smbus = smbus_alloc_bus(dev);
+
+ /* probe and attach the smbus */
+ device_probe_and_attach(sc->smbus);
+
+ return (0);
+}
+
+static int
+alsmb_smb_callback(device_t dev, int index, caddr_t *data)
+{
+ int error = 0;
+
+ switch (index) {
+ case SMB_REQUEST_BUS:
+ case SMB_RELEASE_BUS:
+ /* ok, bus allocation accepted */
+ break;
+ default:
+ error = EINVAL;
+ }
+
+ return (error);
+}
+
+static int
+alsmb_clear(struct alsmb_softc *sc)
+{
+ ALPM_SMBOUTB(sc, SMBSTS, 0xff);
+ DELAY(10);
+
+ return (0);
+}
+
+#if 0
+static int
+alsmb_abort(struct alsmb_softc *sc)
+{
+ ALPM_SMBOUTB(sc, SMBCMD, T_OUT_CMD | ABORT_HOST);
+
+ return (0);
+}
+#endif
+
+static int
+alsmb_idle(struct alsmb_softc *sc)
+{
+ u_char sts;
+
+ sts = ALPM_SMBINB(sc, SMBSTS);
+
+ ALPM_DEBUG(printf("alpm: idle? STS=0x%x\n", sts));
+
+ return (sts & IDL_STS);
+}
+
+/*
+ * Poll the SMBus controller
+ */
+static int
+alsmb_wait(struct alsmb_softc *sc)
+{
+ int count = 10000;
+ u_char sts;
+ int error;
+
+ /* wait for command to complete and SMBus controller is idle */
+ while(count--) {
+ DELAY(10);
+ sts = ALPM_SMBINB(sc, SMBSTS);
+ if (sts & SMI_I_STS)
+ break;
+ }
+
+ ALPM_DEBUG(printf("alpm: STS=0x%x\n", sts));
+
+ error = SMB_ENOERR;
+
+ if (!count)
+ error |= SMB_ETIMEOUT;
+
+ if (sts & TERMINATE)
+ error |= SMB_EABORT;
+
+ if (sts & BUS_COLLI)
+ error |= SMB_ENOACK;
+
+ if (sts & DEVICE_ERR)
+ error |= SMB_EBUSERR;
+
+ if (error != SMB_ENOERR)
+ alsmb_clear(sc);
+
+ return (error);
+}
+
+static int
+alsmb_smb_quick(device_t dev, u_char slave, int how)
+{
+ struct alsmb_softc *sc = (struct alsmb_softc *)device_get_softc(dev);
+ int error;
+
+ alsmb_clear(sc);
+ if (!alsmb_idle(sc))
+ return (EBUSY);
+
+ switch (how) {
+ case SMB_QWRITE:
+ ALPM_DEBUG(printf("alpm: QWRITE to 0x%x", slave));
+ ALPM_SMBOUTB(sc, SMBHADDR, slave & ~LSB);
+ break;
+ case SMB_QREAD:
+ ALPM_DEBUG(printf("alpm: QREAD to 0x%x", slave));
+ ALPM_SMBOUTB(sc, SMBHADDR, slave | LSB);
+ break;
+ default:
+ panic("%s: unknown QUICK command (%x)!", __FUNCTION__,
+ how);
+ }
+ ALPM_SMBOUTB(sc, SMBCMD, SMBQUICK);
+ ALPM_SMBOUTB(sc, SMBSTART, 0xff);
+
+ error = alsmb_wait(sc);
+
+ ALPM_DEBUG(printf(", error=0x%x\n", error));
+
+ return (error);
+}
+
+static int
+alsmb_smb_sendb(device_t dev, u_char slave, char byte)
+{
+ struct alsmb_softc *sc = (struct alsmb_softc *)device_get_softc(dev);
+ int error;
+
+ alsmb_clear(sc);
+ if (!alsmb_idle(sc))
+ return (SMB_EBUSY);
+
+ ALPM_SMBOUTB(sc, SMBHADDR, slave & ~LSB);
+ ALPM_SMBOUTB(sc, SMBCMD, SMBSRBYTE);
+ ALPM_SMBOUTB(sc, SMBHDATA, byte);
+ ALPM_SMBOUTB(sc, SMBSTART, 0xff);
+
+ error = alsmb_wait(sc);
+
+ ALPM_DEBUG(printf("alpm: SENDB to 0x%x, byte=0x%x, error=0x%x\n", slave, byte, error));
+
+ return (error);
+}
+
+static int
+alsmb_smb_recvb(device_t dev, u_char slave, char *byte)
+{
+ struct alsmb_softc *sc = (struct alsmb_softc *)device_get_softc(dev);
+ int error;
+
+ alsmb_clear(sc);
+ if (!alsmb_idle(sc))
+ return (SMB_EBUSY);
+
+ ALPM_SMBOUTB(sc, SMBHADDR, slave | LSB);
+ ALPM_SMBOUTB(sc, SMBCMD, SMBSRBYTE);
+ ALPM_SMBOUTB(sc, SMBSTART, 0xff);
+
+ if ((error = alsmb_wait(sc)) == SMB_ENOERR)
+ *byte = ALPM_SMBINB(sc, SMBHDATA);
+
+ ALPM_DEBUG(printf("alpm: RECVB from 0x%x, byte=0x%x, error=0x%x\n", slave, *byte, error));
+
+ return (error);
+}
+
+static int
+alsmb_smb_writeb(device_t dev, u_char slave, char cmd, char byte)
+{
+ struct alsmb_softc *sc = (struct alsmb_softc *)device_get_softc(dev);
+ int error;
+
+ alsmb_clear(sc);
+ if (!alsmb_idle(sc))
+ return (SMB_EBUSY);
+
+ ALPM_SMBOUTB(sc, SMBHADDR, slave & ~LSB);
+ ALPM_SMBOUTB(sc, SMBCMD, SMBWRBYTE);
+ ALPM_SMBOUTB(sc, SMBHDATA, byte);
+ ALPM_SMBOUTB(sc, SMBHCMD, cmd);
+ ALPM_SMBOUTB(sc, SMBSTART, 0xff);
+
+ error = alsmb_wait(sc);
+
+ ALPM_DEBUG(printf("alpm: WRITEB to 0x%x, cmd=0x%x, byte=0x%x, error=0x%x\n", slave, cmd, byte, error));
+
+ return (error);
+}
+
+static int
+alsmb_smb_readb(device_t dev, u_char slave, char cmd, char *byte)
+{
+ struct alsmb_softc *sc = (struct alsmb_softc *)device_get_softc(dev);
+ int error;
+
+ alsmb_clear(sc);
+ if (!alsmb_idle(sc))
+ return (SMB_EBUSY);
+
+ ALPM_SMBOUTB(sc, SMBHADDR, slave | LSB);
+ ALPM_SMBOUTB(sc, SMBCMD, SMBWRBYTE);
+ ALPM_SMBOUTB(sc, SMBHCMD, cmd);
+ ALPM_SMBOUTB(sc, SMBSTART, 0xff);
+
+ if ((error = alsmb_wait(sc)) == SMB_ENOERR)
+ *byte = ALPM_SMBINB(sc, SMBHDATA);
+
+ ALPM_DEBUG(printf("alpm: READB from 0x%x, cmd=0x%x, byte=0x%x, error=0x%x\n", slave, cmd, *byte, error));
+
+ return (error);
+}
+
+static int
+alsmb_smb_writew(device_t dev, u_char slave, char cmd, short word)
+{
+ struct alsmb_softc *sc = (struct alsmb_softc *)device_get_softc(dev);
+ int error;
+
+ alsmb_clear(sc);
+ if (!alsmb_idle(sc))
+ return (SMB_EBUSY);
+
+ ALPM_SMBOUTB(sc, SMBHADDR, slave & ~LSB);
+ ALPM_SMBOUTB(sc, SMBCMD, SMBWRWORD);
+ ALPM_SMBOUTB(sc, SMBHDATA, word & 0x00ff);
+ ALPM_SMBOUTB(sc, SMBHDATB, (word & 0xff00) >> 8);
+ ALPM_SMBOUTB(sc, SMBHCMD, cmd);
+ ALPM_SMBOUTB(sc, SMBSTART, 0xff);
+
+ error = alsmb_wait(sc);
+
+ ALPM_DEBUG(printf("alpm: WRITEW to 0x%x, cmd=0x%x, word=0x%x, error=0x%x\n", slave, cmd, word, error));
+
+ return (error);
+}
+
+static int
+alsmb_smb_readw(device_t dev, u_char slave, char cmd, short *word)
+{
+ struct alsmb_softc *sc = (struct alsmb_softc *)device_get_softc(dev);
+ int error;
+ u_char high, low;
+
+ alsmb_clear(sc);
+ if (!alsmb_idle(sc))
+ return (SMB_EBUSY);
+
+ ALPM_SMBOUTB(sc, SMBHADDR, slave | LSB);
+ ALPM_SMBOUTB(sc, SMBCMD, SMBWRWORD);
+ ALPM_SMBOUTB(sc, SMBHCMD, cmd);
+ ALPM_SMBOUTB(sc, SMBSTART, 0xff);
+
+ if ((error = alsmb_wait(sc)) == SMB_ENOERR) {
+ low = ALPM_SMBINB(sc, SMBHDATA);
+ high = ALPM_SMBINB(sc, SMBHDATB);
+
+ *word = ((high & 0xff) << 8) | (low & 0xff);
+ }
+
+ ALPM_DEBUG(printf("alpm: READW from 0x%x, cmd=0x%x, word=0x%x, error=0x%x\n", slave, cmd, *word, error));
+
+ return (error);
+}
+
+static int
+alsmb_smb_bwrite(device_t dev, u_char slave, char cmd, u_char count, char *buf)
+{
+ struct alsmb_softc *sc = (struct alsmb_softc *)device_get_softc(dev);
+ u_char remain, len, i;
+ int error = SMB_ENOERR;
+
+ alsmb_clear(sc);
+ if(!alsmb_idle(sc))
+ return (SMB_EBUSY);
+
+ remain = count;
+ while (remain) {
+ len = min(remain, 32);
+
+ ALPM_SMBOUTB(sc, SMBHADDR, slave & ~LSB);
+
+ /* set the cmd and reset the
+ * 32-byte long internal buffer */
+ ALPM_SMBOUTB(sc, SMBCMD, SMBWRBLOCK | SMB_BLK_CLR);
+
+ ALPM_SMBOUTB(sc, SMBHDATA, len);
+
+ /* fill the 32-byte internal buffer */
+ for (i=0; i<len; i++) {
+ ALPM_SMBOUTB(sc, SMBHBLOCK, buf[count-remain+i]);
+ DELAY(2);
+ }
+ ALPM_SMBOUTB(sc, SMBHCMD, cmd);
+ ALPM_SMBOUTB(sc, SMBSTART, 0xff);
+
+ if ((error = alsmb_wait(sc)) != SMB_ENOERR)
+ goto error;
+
+ remain -= len;
+ }
+
+error:
+ ALPM_DEBUG(printf("alpm: WRITEBLK to 0x%x, count=0x%x, cmd=0x%x, error=0x%x", slave, count, cmd, error));
+
+ return (error);
+}
+
+static int
+alsmb_smb_bread(device_t dev, u_char slave, char cmd, u_char count, char *buf)
+{
+ struct alsmb_softc *sc = (struct alsmb_softc *)device_get_softc(dev);
+ u_char remain, len, i;
+ int error = SMB_ENOERR;
+
+ alsmb_clear(sc);
+ if (!alsmb_idle(sc))
+ return (SMB_EBUSY);
+
+ remain = count;
+ while (remain) {
+ ALPM_SMBOUTB(sc, SMBHADDR, slave | LSB);
+
+ /* set the cmd and reset the
+ * 32-byte long internal buffer */
+ ALPM_SMBOUTB(sc, SMBCMD, SMBWRBLOCK | SMB_BLK_CLR);
+
+ ALPM_SMBOUTB(sc, SMBHCMD, cmd);
+ ALPM_SMBOUTB(sc, SMBSTART, 0xff);
+
+ if ((error = alsmb_wait(sc)) != SMB_ENOERR)
+ goto error;
+
+ len = ALPM_SMBINB(sc, SMBHDATA);
+
+ /* read the 32-byte internal buffer */
+ for (i=0; i<len; i++) {
+ buf[count-remain+i] = ALPM_SMBINB(sc, SMBHBLOCK);
+ DELAY(2);
+ }
+
+ remain -= len;
+ }
+error:
+ ALPM_DEBUG(printf("alpm: READBLK to 0x%x, count=0x%x, cmd=0x%x, error=0x%x", slave, count, cmd, error));
+
+ return (error);
+}
+
+DRIVER_MODULE(alsmb, root, alsmb_driver, alsmb_devclass, 0, 0);
diff --git a/sys/pci/intpmreg.h b/sys/pci/intpmreg.h
new file mode 100644
index 000000000000..73816e7748d5
--- /dev/null
+++ b/sys/pci/intpmreg.h
@@ -0,0 +1,77 @@
+/*-
+ * Copyright (c) 1998, 1999 Takanori Watanabe
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+/*Register Difinition for Intel Chipset with ACPI Support*/
+#define PCI_BASE_ADDR_SMB 0x90 /*Where to MAP IO*/
+#define PCI_BASE_ADDR_PM 0x40
+#define PCI_HST_CFG_SMB 0xd2 /*Host Configuration*/
+#define PCI_INTR_SMB_SMI 0
+#define PCI_INTR_SMB_IRQ9 8
+#define PCI_INTR_SMB_ENABLE 1
+#define PCI_SLV_CMD_SMB 0xd3 /*SLAVE COMMAND*/
+#define PCI_SLV_SDW_SMB_1 0xd4 /*SLAVE SHADOW PORT 1*/
+#define PCI_SLV_SDW_SMB_2 0xd5 /*SLAVE SHADOW PORT 2*/
+#define PCI_REVID_SMB 0xd6
+#define LSB 0x1
+#define PIIX4_SMBHSTSTS 0x00
+#define PIIX4_SMBHSTSTAT_BUSY (1<<0)
+#define PIIX4_SMBHSTSTAT_INTR (1<<1)
+#define PIIX4_SMBHSTSTAT_ERR (1<<2)
+#define PIIX4_SMBHSTSTAT_BUSC (1<<3)
+#define PIIX4_SMBHSTSTAT_FAIL (1<<4)
+#define PIIX4_SMBSLVSTS 0x01
+#define PIIX4_SMBSLVSTS_ALART (1<<5)
+#define PIIX4_SMBSLVSTS_SDW2 (1<<4)
+#define PIIX4_SMBSLVSTS_SDW1 (1<<3)
+#define PIIX4_SMBSLVSTS_SLV (1<<2)
+#define PIIX4_SMBSLVSTS_BUSY (1<<0)
+#define PIIX4_SMBHSTCNT 0x02
+#define PIIX4_SMBHSTCNT_START (1<<6)
+#define PIIX4_SMBHSTCNT_PROT_QUICK 0
+#define PIIX4_SMBHSTCNT_PROT_BYTE (1<<2)
+#define PIIX4_SMBHSTCNT_PROT_BDATA (2<<2)
+#define PIIX4_SMBHSTCNT_PROT_WDATA (3<<2)
+#define PIIX4_SMBHSTCNT_PROT_BLOCK (5<<2)
+#define SMBBLOCKTRANS_MAX 32
+#define PIIX4_SMBHSTCNT_KILL (1<<1)
+#define PIIX4_SMBHSTCNT_INTREN (1)
+#define PIIX4_SMBHSTCMD 0x03
+#define PIIX4_SMBHSTADD 0x04
+#define PIIX4_SMBHSTDAT0 0x05
+#define PIIX4_SMBHSTDAT1 0x06
+#define PIIX4_SMBBLKDAT 0x07
+#define PIIX4_SMBSLVCNT 0x08
+#define PIIX4_SMBSLVCNT_ALTEN (1<<3)
+#define PIIX4_SMBSLVCNT_SD2EN (1<<2)
+#define PIIX4_SMBSLVCNT_SD1EN (1<<1)
+#define PIIX4_SMBSLVCNT_SLVEN (1)
+#define PIIX4_SMBSLVCMD 0x09
+#define PIIX4_SMBSLVEVT 0x0a
+#define PIIX4_SMBSLVDAT 0x0c
+/*This is SMBus alart response address*/
+#define SMBALTRESP 0x18
diff --git a/sys/pci/xmaciireg.h b/sys/pci/xmaciireg.h
new file mode 100644
index 000000000000..f649e93a044e
--- /dev/null
+++ b/sys/pci/xmaciireg.h
@@ -0,0 +1,393 @@
+/*
+ * Copyright (c) 1997, 1998, 1999
+ * Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by Bill Paul.
+ * 4. Neither the name of the author nor the names of any co-contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+/*
+ * Registers and data structures for the XaQti Corporation XMAC II
+ * Gigabit Ethernet MAC. Datasheet is available from http://www.xaqti.com.
+ * The XMAC can be programmed for 16-bit or 32-bit register access modes.
+ * The SysKonnect gigabit ethernet adapters use 16-bit mode, so that's
+ * how the registers are laid out here.
+ */
+
+#define XM_DEVICEID 0x00E0AE20
+#define XM_XAQTI_OUI 0x00E0AE
+
+#define XM_XMAC_REV(x) (((x) & 0x000000E0) >> 5)
+
+#define XM_XMAC_REV_B2 0x0
+#define XM_XMAC_REV_C1 0x1
+
+#define XM_MMUCMD 0x0000
+#define XM_POFF 0x0008
+#define XM_BURST 0x000C
+#define XM_VLAN_TAGLEV1 0x0010
+#define XM_VLAN_TAGLEV2 0x0014
+#define XM_TXCMD 0x0020
+#define XM_TX_RETRYLIMIT 0x0024
+#define XM_TX_SLOTTIME 0x0028
+#define XM_TX_IPG 0x003C
+#define XM_RXCMD 0x0030
+#define XM_PHY_ADDR 0x0034
+#define XM_PHY_DATA 0x0038
+#define XM_GPIO 0x0040
+#define XM_IMR 0x0044
+#define XM_ISR 0x0048
+#define XM_HWCFG 0x004C
+#define XM_TX_LOWAT 0x0060
+#define XM_TX_HIWAT 0x0062
+#define XM_TX_REQTHRESH_LO 0x0064
+#define XM_TX_REQTHRESH_HI 0x0066
+#define XM_TX_REQTHRESH XM_TX_REQTHRESH_LO
+#define XM_PAUSEDST0 0x0068
+#define XM_PAUSEDST1 0x006A
+#define XM_PAUSEDST2 0x006C
+#define XM_CTLPARM_LO 0x0070
+#define XM_CTLPARM_HI 0x0072
+#define XM_CTLPARM XM_CTLPARM_LO
+#define XM_OPCODE_PAUSE_TIMER 0x0074
+#define XM_TXSTAT_LIFO 0x0078
+
+/*
+ * Perfect filter registers. The XMAC has a table of 16 perfect
+ * filter entries, spaced 8 bytes apart. This is in addition to
+ * the station address registers, which appear below.
+ */
+#define XM_RXFILT_BASE 0x0080
+#define XM_RXFILT_END 0x0107
+#define XM_RXFILT_MAX 16
+#define XM_RXFILT_ENTRY(ent) (XM_RXFILT_BASE + ((ent * 8)))
+
+/* Primary station address. */
+#define XM_PAR0 0x0108
+#define XM_PAR1 0x010A
+#define XM_PAR2 0x010C
+
+/* 64-bit multicast hash table registers */
+#define XM_MAR0 0x0110
+#define XM_MAR1 0x0112
+#define XM_MAR2 0x0114
+#define XM_MAR3 0x0116
+#define XM_RX_LOWAT 0x0118
+#define XM_RX_HIWAT 0x011A
+#define XM_RX_REQTHRESH_LO 0x011C
+#define XM_RX_REQTHRESH_HI 0x011E
+#define XM_RX_REQTHRESH XM_RX_REQTHRESH_LO
+#define XM_DEVID_LO 0x0120
+#define XM_DEVID_HI 0x0122
+#define XM_DEVID XM_DEVID_LO
+#define XM_MODE_LO 0x0124
+#define XM_MODE_HI 0x0126
+#define XM_MODE XM_MODE_LO
+#define XM_LASTSRC0 0x0128
+#define XM_LASTSRC1 0x012A
+#define XM_LASTSRC2 0x012C
+#define XM_TSTAMP_READ 0x0130
+#define XM_TSTAMP_LOAD 0x0134
+#define XM_STATS_CMD 0x0200
+#define XM_RXCNT_EVENT_LO 0x0204
+#define XM_RXCNT_EVENT_HI 0x0206
+#define XM_RXCNT_EVENT XM_RXCNT_EVENT_LO
+#define XM_TXCNT_EVENT_LO 0x0208
+#define XM_TXCNT_EVENT_HI 0x020A
+#define XM_TXCNT_EVENT XM_TXCNT_EVENT_LO
+#define XM_RXCNT_EVMASK_LO 0x020C
+#define XM_RXCNT_EVMASK_HI 0x020E
+#define XM_RXCNT_EVMASK XM_RXCNT_EVMASK_LO
+#define XM_TXCNT_EVMASK_LO 0x0210
+#define XM_TXCNT_EVMASK_HI 0x0212
+#define XM_TXCNT_EVMASK XM_TXCNT_EVMASK_LO
+
+/* Statistics command register */
+#define XM_STATCMD_CLR_TX 0x0001
+#define XM_STATCMD_CLR_RX 0x0002
+#define XM_STATCMD_COPY_TX 0x0004
+#define XM_STATCMD_COPY_RX 0x0008
+#define XM_STATCMD_SNAP_TX 0x0010
+#define XM_STATCMD_SNAP_RX 0x0020
+
+/* TX statistics registers */
+#define XM_TXSTATS_PKTSOK 0x280
+#define XM_TXSTATS_BYTESOK_HI 0x284
+#define XM_TXSTATS_BYTESOK_LO 0x288
+#define XM_TXSTATS_BCASTSOK 0x28C
+#define XM_TXSTATS_MCASTSOK 0x290
+#define XM_TXSTATS_UCASTSOK 0x294
+#define XM_TXSTATS_GIANTS 0x298
+#define XM_TXSTATS_BURSTCNT 0x29C
+#define XM_TXSTATS_PAUSEPKTS 0x2A0
+#define XM_TXSTATS_MACCTLPKTS 0x2A4
+#define XM_TXSTATS_SINGLECOLS 0x2A8
+#define XM_TXSTATS_MULTICOLS 0x2AC
+#define XM_TXSTATS_EXCESSCOLS 0x2B0
+#define XM_TXSTATS_LATECOLS 0x2B4
+#define XM_TXSTATS_DEFER 0x2B8
+#define XM_TXSTATS_EXCESSDEFER 0x2BC
+#define XM_TXSTATS_UNDERRUN 0x2C0
+#define XM_TXSTATS_CARRIERSENSE 0x2C4
+#define XM_TXSTATS_UTILIZATION 0x2C8
+#define XM_TXSTATS_64 0x2D0
+#define XM_TXSTATS_65_127 0x2D4
+#define XM_TXSTATS_128_255 0x2D8
+#define XM_TXSTATS_256_511 0x2DC
+#define XM_TXSTATS_512_1023 0x2E0
+#define XM_TXSTATS_1024_MAX 0x2E4
+
+/* RX statistics registers */
+#define XM_RXSTATS_PKTSOK 0x300
+#define XM_RXSTATS_BYTESOK_HI 0x304
+#define XM_RXSTATS_BYTESOK_LO 0x308
+#define XM_RXSTATS_BCASTSOK 0x30C
+#define XM_RXSTATS_MCASTSOK 0x310
+#define XM_RXSTATS_UCASTSOK 0x314
+#define XM_RXSTATS_PAUSEPKTS 0x318
+#define XM_RXSTATS_MACCTLPKTS 0x31C
+#define XM_RXSTATS_BADPAUSEPKTS 0x320
+#define XM_RXSTATS_BADMACCTLPKTS 0x324
+#define XM_RXSTATS_BURSTCNT 0x328
+#define XM_RXSTATS_MISSEDPKTS 0x32C
+#define XM_RXSTATS_FRAMEERRS 0x330
+#define XM_RXSTATS_OVERRUN 0x334
+#define XM_RXSTATS_JABBER 0x338
+#define XM_RXSTATS_CARRLOSS 0x33C
+#define XM_RXSTATS_INRNGLENERR 0x340
+#define XM_RXSTATS_SYMERR 0x344
+#define XM_RXSTATS_SHORTEVENT 0x348
+#define XM_RXSTATS_RUNTS 0x34C
+#define XM_RXSTATS_GIANTS 0x350
+#define XM_RXSTATS_CRCERRS 0x354
+#define XM_RXSTATS_CEXTERRS 0x35C
+#define XM_RXSTATS_UTILIZATION 0x360
+#define XM_RXSTATS_64 0x368
+#define XM_RXSTATS_65_127 0x36C
+#define XM_RXSTATS_128_255 0x370
+#define XM_RXSTATS_256_511 0x374
+#define XM_RXSTATS_512_1023 0x378
+#define XM_RXSTATS_1024_MAX 0x37C
+
+#define XM_MMUCMD_TX_ENB 0x0001
+#define XM_MMUCMD_RX_ENB 0x0002
+#define XM_MMUCMD_GMIILOOP 0x0004
+#define XM_MMUCMD_RATECTL 0x0008
+#define XM_MMUCMD_GMIIFDX 0x0010
+#define XM_MMUCMD_NO_MGMT_PRMB 0x0020
+#define XM_MMUCMD_SIMCOL 0x0040
+#define XM_MMUCMD_FORCETX 0x0080
+#define XM_MMUCMD_LOOPENB 0x0200
+#define XM_MMUCMD_IGNPAUSE 0x0400
+#define XM_MMUCMD_PHYBUSY 0x0800
+#define XM_MMUCMD_PHYDATARDY 0x1000
+
+#define XM_TXCMD_AUTOPAD 0x0001
+#define XM_TXCMD_NOCRC 0x0002
+#define XM_TXCMD_NOPREAMBLE 0x0004
+#define XM_TXCMD_NOGIGAMODE 0x0008
+#define XM_TXCMD_SAMPLELINE 0x0010
+#define XM_TXCMD_ENCBYPASS 0x0020
+#define XM_TXCMD_XMITBK2BK 0x0040
+#define XM_TXCMD_FAIRSHARE 0x0080
+
+#define XM_RXCMD_DISABLE_CEXT 0x0001
+#define XM_RXCMD_STRIPPAD 0x0002
+#define XM_RXCMD_SAMPLELINE 0x0004
+#define XM_RXCMD_SELFRX 0x0008
+#define XM_RXCMD_STRIPFCS 0x0010
+#define XM_RXCMD_TRANSPARENT 0x0020
+#define XM_RXCMD_IPGCAPTURE 0x0040
+#define XM_RXCMD_BIGPKTOK 0x0080
+#define XM_RXCMD_LENERROK 0x0100
+
+#define XM_IMR_RX_EOF 0x0001
+#define XM_IMR_TX_EOF 0x0002
+#define XM_IMR_TX_UNDERRUN 0x0004
+#define XM_IMR_RX_OVERRUN 0x0008
+#define XM_IMR_TX_STATS_OFLOW 0x0010
+#define XM_IMR_RX_STATS_OFLOW 0x0020
+#define XM_IMR_TSTAMP_OFLOW 0x0040
+#define XM_IMR_AUTONEG_DONE 0x0080
+#define XM_IMR_NEXTPAGE_RDY 0x0100
+#define XM_IMR_PAGE_RECEIVED 0x0200
+#define XM_IMR_LP_REQCFG 0x0400
+#define XM_IMR_GP0_SET 0x0800
+#define XM_IMR_FORCEINTR 0x1000
+#define XM_IMR_TX_ABORT 0x2000
+#define XM_IMR_LINKEVENT 0x4000
+
+#define XM_INTRS \
+ (~(XM_IMR_LINKEVENT|XM_IMR_AUTONEG_DONE|XM_IMR_TX_UNDERRUN))
+
+#define XM_ISR_RX_EOF 0x0001
+#define XM_ISR_TX_EOF 0x0002
+#define XM_ISR_TX_UNDERRUN 0x0004
+#define XM_ISR_RX_OVERRUN 0x0008
+#define XM_ISR_TX_STATS_OFLOW 0x0010
+#define XM_ISR_RX_STATS_OFLOW 0x0020
+#define XM_ISR_TSTAMP_OFLOW 0x0040
+#define XM_ISR_AUTONEG_DONE 0x0080
+#define XM_ISR_NEXTPAGE_RDY 0x0100
+#define XM_ISR_PAGE_RECEIVED 0x0200
+#define XM_ISR_LP_REQCFG 0x0400
+#define XM_ISR_GP0_SET 0x0800
+#define XM_ISR_FORCEINTR 0x1000
+#define XM_ISR_TX_ABORT 0x2000
+#define XM_ISR_LINKEVENT 0x4000
+
+#define XM_MODE_FLUSH_RXFIFO 0x00000001
+#define XM_MODE_FLUSH_TXFIFO 0x00000002
+#define XM_MODE_BIGENDIAN 0x00000004
+#define XM_MODE_RX_PROMISC 0x00000008
+#define XM_MODE_RX_NOBROAD 0x00000010
+#define XM_MODE_RX_NOMULTI 0x00000020
+#define XM_MODE_RX_NOUNI 0x00000040
+#define XM_MODE_RX_BADFRAMES 0x00000080
+#define XM_MODE_RX_CRCERRS 0x00000100
+#define XM_MODE_RX_GIANTS 0x00000200
+#define XM_MODE_RX_INRANGELEN 0x00000400
+#define XM_MODE_RX_RUNTS 0x00000800
+#define XM_MODE_RX_MACCTL 0x00001000
+#define XM_MODE_RX_USE_PERFECT 0x00002000
+#define XM_MODE_RX_USE_STATION 0x00004000
+#define XM_MODE_RX_USE_HASH 0x00008000
+#define XM_MODE_RX_ADDRPAIR 0x00010000
+#define XM_MODE_PAUSEONHI 0x00020000
+#define XM_MODE_PAUSEONLO 0x00040000
+#define XM_MODE_TIMESTAMP 0x00080000
+#define XM_MODE_SENDPAUSE 0x00100000
+#define XM_MODE_SENDCONTINUOUS 0x00200000
+#define XM_MODE_LE_STATUSWORD 0x00400000
+#define XM_MODE_AUTOFIFOPAUSE 0x00800000
+#define XM_MODE_EXPAUSEGEN 0x02000000
+#define XM_MODE_RX_INVERSE 0x04000000
+
+#define XM_RXSTAT_MACCTL 0x00000001
+#define XM_RXSTAT_ERRFRAME 0x00000002
+#define XM_RXSTAT_CRCERR 0x00000004
+#define XM_RXSTAT_GIANT 0x00000008
+#define XM_RXSTAT_RUNT 0x00000010
+#define XM_RXSTAT_FRAMEERR 0x00000020
+#define XM_RXSTAT_INRANGEERR 0x00000040
+#define XM_RXSTAT_CARRIERERR 0x00000080
+#define XM_RXSTAT_COLLERR 0x00000100
+#define XM_RXSTAT_802_3 0x00000200
+#define XM_RXSTAT_CARREXTERR 0x00000400
+#define XM_RXSTAT_BURSTMODE 0x00000800
+#define XM_RXSTAT_UNICAST 0x00002000
+#define XM_RXSTAT_MULTICAST 0x00004000
+#define XM_RXSTAT_BROADCAST 0x00008000
+#define XM_RXSTAT_VLAN_LEV1 0x00010000
+#define XM_RXSTAT_VLAN_LEV2 0x00020000
+#define XM_RXSTAT_LEN 0xFFFC0000
+
+/*
+ * XMAC PHY registers, indirectly accessed through
+ * XM_PHY_ADDR and XM_PHY_REG.
+ */
+
+#define XM_PHY_BMCR 0x0000 /* control */
+#define XM_PHY_BMSR 0x0001 /* status */
+#define XM_PHY_VENID 0x0002 /* vendor id */
+#define XM_PHY_DEVID 0x0003 /* device id */
+#define XM_PHY_ANAR 0x0004 /* autoneg advertisenemt */
+#define XM_PHY_LPAR 0x0005 /* link partner ability */
+#define XM_PHY_ANEXP 0x0006 /* autoneg expansion */
+#define XM_PHY_NEXTP 0x0007 /* nextpage */
+#define XM_PHY_LPNEXTP 0x0008 /* link partner's nextpage */
+#define XM_PHY_EXTSTS 0x000F /* extented status */
+#define XM_PHY_RESAB 0x0010 /* resolved ability */
+
+#define XM_BMCR_DUPLEX 0x0100
+#define XM_BMCR_RENEGOTIATE 0x0200
+#define XM_BMCR_AUTONEGENBL 0x1000
+#define XM_BMCR_LOOPBACK 0x4000
+#define XM_BMCR_RESET 0x8000
+
+#define XM_BMSR_EXTCAP 0x0001
+#define XM_BMSR_LINKSTAT 0x0004
+#define XM_BMSR_AUTONEGABLE 0x0008
+#define XM_BMSR_REMFAULT 0x0010
+#define XM_BMSR_AUTONEGDONE 0x0020
+#define XM_BMSR_EXTSTAT 0x0100
+
+#define XM_VENID_XAQTI 0xD14C
+#define XM_DEVID_XMAC 0x0002
+
+#define XM_ANAR_FULLDUPLEX 0x0020
+#define XM_ANAR_HALFDUPLEX 0x0040
+#define XM_ANAR_PAUSEBITS 0x0180
+#define XM_ANAR_REMFAULTBITS 0x1800
+#define XM_ANAR_ACK 0x4000
+#define XM_ANAR_NEXTPAGE 0x8000
+
+#define XM_LPAR_FULLDUPLEX 0x0020
+#define XM_LPAR_HALFDUPLEX 0x0040
+#define XM_LPAR_PAUSEBITS 0x0180
+#define XM_LPAR_REMFAULTBITS 0x1800
+#define XM_LPAR_ACK 0x4000
+#define XM_LPAR_NEXTPAGE 0x8000
+
+#define XM_PAUSE_NOPAUSE 0x0000
+#define XM_PAUSE_SYMPAUSE 0x0080
+#define XM_PAUSE_ASYMPAUSE 0x0100
+#define XM_PAUSE_BOTH 0x0180
+
+#define XM_REMFAULT_LINKOK 0x0000
+#define XM_REMFAULT_LINKFAIL 0x0800
+#define XM_REMFAULT_OFFLINE 0x1000
+#define XM_REMFAULT_ANEGERR 0x1800
+
+#define XM_ANEXP_GOTPAGE 0x0002
+#define XM_ANEXP_NEXTPAGE_SELF 0x0004
+#define XM_ANEXP_NEXTPAGE_LP 0x0008
+
+#define XM_NEXTP_MESSAGE 0x07FF
+#define XM_NEXTP_TOGGLE 0x0800
+#define XM_NEXTP_ACK2 0x1000
+#define XM_NEXTP_MPAGE 0x2000
+#define XM_NEXTP_ACK1 0x4000
+#define XM_NEXTP_NPAGE 0x8000
+
+#define XM_LPNEXTP_MESSAGE 0x07FF
+#define XM_LPNEXTP_TOGGLE 0x0800
+#define XM_LPNEXTP_ACK2 0x1000
+#define XM_LPNEXTP_MPAGE 0x2000
+#define XM_LPNEXTP_ACK1 0x4000
+#define XM_LPNEXTP_NPAGE 0x8000
+
+#define XM_EXTSTS_HALFDUPLEX 0x4000
+#define XM_EXTSTS_FULLDUPLEX 0x8000
+
+#define XM_RESAB_PAUSEMISMATCH 0x0008
+#define XM_RESAB_ABLMISMATCH 0x0010
+#define XM_RESAB_FDMODESEL 0x0020
+#define XM_RESAB_HDMODESEL 0x0040
+#define XM_RESAB_PAUSEBITS 0x0180