- Make tables, device ID strings etc const. This includes #ifdef'ing 0

aac_command_status_table, which is actually unused since r111532.
  While at it, make aac_if a pointer to the now const interface tables
  instead of copying them over to the softc (this alone already reduces the
  size of aac.ko on amd64 by ~1 KiB).
- Remove redundant softc members.
- Use DEVMETHOD_END.
- Use NULL instead of 0 for pointers.
- Remove redundant bzero(9)'ing of the softc.
- Use pci_enable_busmaster(9) instead of duplicating it.
- Remove redundant checking for PCIM_CMD_MEMEN (resource allocation will
  just fail).
- Canonicalize the error messages in case of resource allocation failures.
- Add support for using MSI instead of INTx, controllable via the tunable
  hw.aac.enable_msi (defaulting to on).

MFC after:	1 month
This commit is contained in:
Marius Strobl 2013-03-01 19:55:10 +00:00
parent 499e58864a
commit da4882c200
6 changed files with 109 additions and 111 deletions

View File

@ -117,7 +117,7 @@ static void aac_sa_set_mailbox(struct aac_softc *sc, u_int32_t command,
static int aac_sa_get_mailbox(struct aac_softc *sc, int mb);
static void aac_sa_set_interrupts(struct aac_softc *sc, int enable);
struct aac_interface aac_sa_interface = {
const struct aac_interface aac_sa_interface = {
aac_sa_get_fwstatus,
aac_sa_qnotify,
aac_sa_get_istatus,
@ -142,7 +142,7 @@ static int aac_rx_send_command(struct aac_softc *sc, struct aac_command *cm);
static int aac_rx_get_outb_queue(struct aac_softc *sc);
static void aac_rx_set_outb_queue(struct aac_softc *sc, int index);
struct aac_interface aac_rx_interface = {
const struct aac_interface aac_rx_interface = {
aac_rx_get_fwstatus,
aac_rx_qnotify,
aac_rx_get_istatus,
@ -169,7 +169,7 @@ static int aac_rkt_send_command(struct aac_softc *sc, struct aac_command *cm);
static int aac_rkt_get_outb_queue(struct aac_softc *sc);
static void aac_rkt_set_outb_queue(struct aac_softc *sc, int index);
struct aac_interface aac_rkt_interface = {
const struct aac_interface aac_rkt_interface = {
aac_rkt_get_fwstatus,
aac_rkt_qnotify,
aac_rkt_get_istatus,
@ -183,8 +183,8 @@ struct aac_interface aac_rkt_interface = {
};
/* Debugging and Diagnostics */
static void aac_describe_controller(struct aac_softc *sc);
static char *aac_describe_code(struct aac_code_lookup *table,
static void aac_describe_controller(struct aac_softc *sc);
static const char *aac_describe_code(const struct aac_code_lookup *table,
u_int32_t code);
/* Management Interface */
@ -222,7 +222,7 @@ static struct cdevsw aac_cdevsw = {
static MALLOC_DEFINE(M_AACBUF, "aacbuf", "Buffers for the AAC driver");
/* sysctl node */
static SYSCTL_NODE(_hw, OID_AUTO, aac, CTLFLAG_RD, 0, "AAC driver parameters");
SYSCTL_NODE(_hw, OID_AUTO, aac, CTLFLAG_RD, 0, "AAC driver parameters");
/*
* Device Interface
@ -634,8 +634,8 @@ aac_free(struct aac_softc *sc)
if (sc->aac_intr)
bus_teardown_intr(sc->aac_dev, sc->aac_irq, sc->aac_intr);
if (sc->aac_irq != NULL)
bus_release_resource(sc->aac_dev, SYS_RES_IRQ, sc->aac_irq_rid,
sc->aac_irq);
bus_release_resource(sc->aac_dev, SYS_RES_IRQ,
rman_get_rid(sc->aac_irq), sc->aac_irq);
/* destroy data-transfer DMA tag */
if (sc->aac_buffer_dmat)
@ -648,10 +648,10 @@ aac_free(struct aac_softc *sc)
/* release the register window mapping */
if (sc->aac_regs_res0 != NULL)
bus_release_resource(sc->aac_dev, SYS_RES_MEMORY,
sc->aac_regs_rid0, sc->aac_regs_res0);
rman_get_rid(sc->aac_regs_res0), sc->aac_regs_res0);
if (sc->aac_hwif == AAC_HWIF_NARK && sc->aac_regs_res1 != NULL)
bus_release_resource(sc->aac_dev, SYS_RES_MEMORY,
sc->aac_regs_rid1, sc->aac_regs_res1);
rman_get_rid(sc->aac_regs_res1), sc->aac_regs_res1);
}
/*
@ -1333,9 +1333,6 @@ aac_bio_complete(struct aac_command *cm)
} else {
bp->bio_error = EIO;
bp->bio_flags |= BIO_ERROR;
/* pass an error string out to the disk layer */
bp->bio_driver1 = aac_describe_code(aac_command_status_table,
status);
}
aac_biodone(bp);
}
@ -1687,7 +1684,7 @@ static int
aac_check_firmware(struct aac_softc *sc)
{
u_int32_t code, major, minor, options = 0, atu_size = 0;
int status;
int rid, status;
time_t then;
fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
@ -1765,7 +1762,7 @@ aac_check_firmware(struct aac_softc *sc)
sc->flags |= AAC_FLAGS_SG_64BIT;
}
if ((options & AAC_SUPPORTED_NEW_COMM)
&& sc->aac_if.aif_send_command)
&& sc->aac_if->aif_send_command)
sc->flags |= AAC_FLAGS_NEW_COMM;
if (options & AAC_SUPPORTED_64BIT_ARRAYSIZE)
sc->flags |= AAC_FLAGS_ARRAY_64BIT;
@ -1776,17 +1773,15 @@ aac_check_firmware(struct aac_softc *sc)
/* Remap mem. resource, if required */
if ((sc->flags & AAC_FLAGS_NEW_COMM) &&
atu_size > rman_get_size(sc->aac_regs_res1)) {
bus_release_resource(
sc->aac_dev, SYS_RES_MEMORY,
sc->aac_regs_rid1, sc->aac_regs_res1);
sc->aac_regs_res1 = bus_alloc_resource(
sc->aac_dev, SYS_RES_MEMORY, &sc->aac_regs_rid1,
0ul, ~0ul, atu_size, RF_ACTIVE);
atu_size > rman_get_size(sc->aac_regs_res1)) {
rid = rman_get_rid(sc->aac_regs_res1);
bus_release_resource(sc->aac_dev, SYS_RES_MEMORY, rid,
sc->aac_regs_res1);
sc->aac_regs_res1 = bus_alloc_resource(sc->aac_dev,
SYS_RES_MEMORY, &rid, 0ul, ~0ul, atu_size, RF_ACTIVE);
if (sc->aac_regs_res1 == NULL) {
sc->aac_regs_res1 = bus_alloc_resource_any(
sc->aac_dev, SYS_RES_MEMORY,
&sc->aac_regs_rid1, RF_ACTIVE);
sc->aac_dev, SYS_RES_MEMORY, &rid, RF_ACTIVE);
if (sc->aac_regs_res1 == NULL) {
device_printf(sc->aac_dev,
"couldn't allocate register window\n");
@ -1799,7 +1794,6 @@ aac_check_firmware(struct aac_softc *sc)
if (sc->aac_hwif == AAC_HWIF_NARK) {
sc->aac_regs_res0 = sc->aac_regs_res1;
sc->aac_regs_rid0 = sc->aac_regs_rid1;
sc->aac_btag0 = sc->aac_btag1;
sc->aac_bhandle0 = sc->aac_bhandle1;
}
@ -2003,14 +1997,7 @@ aac_init(struct aac_softc *sc)
static int
aac_setup_intr(struct aac_softc *sc)
{
sc->aac_irq_rid = 0;
if ((sc->aac_irq = bus_alloc_resource_any(sc->aac_dev, SYS_RES_IRQ,
&sc->aac_irq_rid,
RF_SHAREABLE |
RF_ACTIVE)) == NULL) {
device_printf(sc->aac_dev, "can't allocate interrupt\n");
return (EINVAL);
}
if (sc->flags & AAC_FLAGS_NEW_COMM) {
if (bus_setup_intr(sc->aac_dev, sc->aac_irq,
INTR_MPSAFE|INTR_TYPE_BIO, NULL,
@ -2119,7 +2106,7 @@ aac_sync_fib(struct aac_softc *sc, u_int32_t command, u_int32_t xferstate,
* Note that the queue implementation here is a little funky; neither the PI or
* CI will ever be zero. This behaviour is a controller feature.
*/
static struct {
static const struct {
int size;
int notify;
} aac_qinfo[] = {
@ -2786,8 +2773,8 @@ aac_describe_controller(struct aac_softc *sc)
* Look up a text description of a numeric error code and return a pointer to
* same.
*/
static char *
aac_describe_code(struct aac_code_lookup *table, u_int32_t code)
static const char *
aac_describe_code(const struct aac_code_lookup *table, u_int32_t code)
{
int i;

View File

@ -92,7 +92,7 @@ static device_method_t aac_pass_methods[] = {
DEVMETHOD(device_probe, aac_cam_probe),
DEVMETHOD(device_attach, aac_cam_attach),
DEVMETHOD(device_detach, aac_cam_detach),
{ 0, 0 }
DEVMETHOD_END
};
static driver_t aac_pass_driver = {
@ -101,7 +101,7 @@ static driver_t aac_pass_driver = {
sizeof(struct aac_cam)
};
DRIVER_MODULE(aacp, aac, aac_pass_driver, aac_pass_devclass, 0, 0);
DRIVER_MODULE(aacp, aac, aac_pass_driver, aac_pass_devclass, NULL, NULL);
MODULE_DEPEND(aacp, cam, 1, 1, 1);
static MALLOC_DEFINE(M_AACCAM, "aaccam", "AAC CAM info");
@ -685,4 +685,3 @@ aac_cam_term_io(struct cam_sim *sim, union ccb *ccb)
{
return (CAM_UA_TERMIO);
}

View File

@ -73,7 +73,7 @@ static device_method_t aac_disk_methods[] = {
DEVMETHOD(device_probe, aac_disk_probe),
DEVMETHOD(device_attach, aac_disk_attach),
DEVMETHOD(device_detach, aac_disk_detach),
{ 0, 0 }
DEVMETHOD_END
};
static driver_t aac_disk_driver = {
@ -82,7 +82,7 @@ static driver_t aac_disk_driver = {
sizeof(struct aac_disk)
};
DRIVER_MODULE(aacd, aac, aac_disk_driver, aac_disk_devclass, 0, 0);
DRIVER_MODULE(aacd, aac, aac_disk_driver, aac_disk_devclass, NULL, NULL);
/*
* Handle open from generic layer.

View File

@ -60,6 +60,11 @@ __FBSDID("$FreeBSD$");
static int aac_pci_probe(device_t dev);
static int aac_pci_attach(device_t dev);
static int aac_enable_msi = 1;
TUNABLE_INT("hw.aac.enable_msi", &aac_enable_msi);
SYSCTL_INT(_hw_aac, OID_AUTO, enable_msi, CTLFLAG_RDTUN, &aac_enable_msi, 0,
"Enable MSI interrupts");
static device_method_t aac_methods[] = {
/* Device interface */
DEVMETHOD(device_probe, aac_pci_probe),
@ -79,11 +84,10 @@ static driver_t aac_pci_driver = {
static devclass_t aac_devclass;
DRIVER_MODULE(aac, pci, aac_pci_driver, aac_devclass, 0, 0);
DRIVER_MODULE(aac, pci, aac_pci_driver, aac_devclass, NULL, NULL);
MODULE_DEPEND(aac, pci, 1, 1, 1);
struct aac_ident
static const struct aac_ident
{
u_int16_t vendor;
u_int16_t device;
@ -91,7 +95,7 @@ struct aac_ident
u_int16_t subdevice;
int hwif;
int quirks;
char *desc;
const char *desc;
} aac_identifiers[] = {
{0x1028, 0x0001, 0x1028, 0x0001, AAC_HWIF_I960RX, 0,
"Dell PERC 2/Si"},
@ -139,7 +143,6 @@ struct aac_ident
"Adaptec SCSI RAID 2230S"},
{0x9005, 0x0286, 0x9005, 0x028d, AAC_HWIF_RKT, 0,
"Adaptec SCSI RAID 2130S"},
{0x9005, 0x0285, 0x9005, 0x0287, AAC_HWIF_I960RX, AAC_FLAGS_NO4GB |
AAC_FLAGS_256FIBS, "Adaptec SCSI RAID 2200S"},
{0x9005, 0x0285, 0x17aa, 0x0286, AAC_HWIF_I960RX, AAC_FLAGS_NO4GB |
@ -276,7 +279,8 @@ struct aac_ident
"AOC-USAS-S8iR-LP"},
{0, 0, 0, 0, 0, 0, 0}
};
struct aac_ident
static const struct aac_ident
aac_family_identifiers[] = {
{0x9005, 0x0285, 0, 0, AAC_HWIF_I960RX, 0,
"Adaptec RAID Controller"},
@ -285,10 +289,10 @@ aac_family_identifiers[] = {
{0, 0, 0, 0, 0, 0, 0}
};
static struct aac_ident *
static const struct aac_ident *
aac_find_ident(device_t dev)
{
struct aac_ident *m;
const struct aac_ident *m;
u_int16_t vendid, devid, sub_vendid, sub_devid;
vendid = pci_get_vendor(dev);
@ -317,7 +321,7 @@ aac_find_ident(device_t dev)
static int
aac_pci_probe(device_t dev)
{
struct aac_ident *id;
const struct aac_ident *id;
fwprintf(NULL, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
@ -335,9 +339,8 @@ static int
aac_pci_attach(device_t dev)
{
struct aac_softc *sc;
struct aac_ident *id;
int error;
u_int32_t command;
const struct aac_ident *id;
int count, error, reg, rid;
fwprintf(NULL, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
@ -345,7 +348,6 @@ aac_pci_attach(device_t dev)
* Initialise softc.
*/
sc = device_get_softc(dev);
bzero(sc, sizeof(*sc));
sc->aac_dev = dev;
/* assume failure is 'not configured' */
@ -354,55 +356,65 @@ aac_pci_attach(device_t dev)
/*
* Verify that the adapter is correctly set up in PCI space.
*/
command = pci_read_config(sc->aac_dev, PCIR_COMMAND, 2);
command |= PCIM_CMD_BUSMASTEREN;
pci_write_config(dev, PCIR_COMMAND, command, 2);
command = pci_read_config(sc->aac_dev, PCIR_COMMAND, 2);
if (!(command & PCIM_CMD_BUSMASTEREN)) {
device_printf(sc->aac_dev, "can't enable bus-master feature\n");
goto out;
}
if ((command & PCIM_CMD_MEMEN) == 0) {
device_printf(sc->aac_dev, "memory window not available\n");
pci_enable_busmaster(dev);
if (!(pci_read_config(dev, PCIR_COMMAND, 2) & PCIM_CMD_BUSMASTEREN)) {
device_printf(dev, "can't enable bus-master feature\n");
goto out;
}
/*
* Allocate the PCI register window.
* Allocate the PCI register window(s).
*/
sc->aac_regs_rid0 = PCIR_BAR(0);
if ((sc->aac_regs_res0 = bus_alloc_resource_any(sc->aac_dev,
SYS_RES_MEMORY, &sc->aac_regs_rid0, RF_ACTIVE)) == NULL) {
device_printf(sc->aac_dev,
"couldn't allocate register window 0\n");
rid = PCIR_BAR(0);
if ((sc->aac_regs_res0 = bus_alloc_resource_any(dev,
SYS_RES_MEMORY, &rid, RF_ACTIVE)) == NULL) {
device_printf(dev, "can't allocate register window 0\n");
goto out;
}
sc->aac_btag0 = rman_get_bustag(sc->aac_regs_res0);
sc->aac_bhandle0 = rman_get_bushandle(sc->aac_regs_res0);
if (sc->aac_hwif == AAC_HWIF_NARK) {
sc->aac_regs_rid1 = PCIR_BAR(1);
if ((sc->aac_regs_res1 = bus_alloc_resource_any(sc->aac_dev,
SYS_RES_MEMORY, &sc->aac_regs_rid1, RF_ACTIVE)) == NULL) {
device_printf(sc->aac_dev,
"couldn't allocate register window 1\n");
rid = PCIR_BAR(1);
if ((sc->aac_regs_res1 = bus_alloc_resource_any(dev,
SYS_RES_MEMORY, &rid, RF_ACTIVE)) == NULL) {
device_printf(dev,
"can't allocate register window 1\n");
goto out;
}
sc->aac_btag1 = rman_get_bustag(sc->aac_regs_res1);
sc->aac_bhandle1 = rman_get_bushandle(sc->aac_regs_res1);
} else {
sc->aac_regs_res1 = sc->aac_regs_res0;
sc->aac_regs_rid1 = sc->aac_regs_rid0;
sc->aac_btag1 = sc->aac_btag0;
sc->aac_bhandle1 = sc->aac_bhandle0;
}
/*
* Allocate the interrupt.
*/
rid = 0;
if (aac_enable_msi != 0 && pci_find_cap(dev, PCIY_MSI, &reg) == 0) {
count = pci_msi_count(dev);
if (count > 1)
count = 1;
else
count = 0;
if (count == 1 && pci_alloc_msi(dev, &count) == 0)
rid = 1;
}
if ((sc->aac_irq = bus_alloc_resource_any(sc->aac_dev, SYS_RES_IRQ,
&rid, RF_ACTIVE | (count != 0 ? 0 : RF_SHAREABLE))) == NULL) {
device_printf(dev, "can't allocate interrupt\n");
goto out;
}
/*
* Allocate the parent bus DMA tag appropriate for our PCI interface.
*
* Note that some of these controllers are 64-bit capable.
*/
if (bus_dma_tag_create(bus_get_dma_tag(sc->aac_dev), /* parent */
if (bus_dma_tag_create(bus_get_dma_tag(dev), /* parent */
PAGE_SIZE, 0, /* algnmnt, boundary */
BUS_SPACE_MAXADDR, /* lowaddr */
BUS_SPACE_MAXADDR, /* highaddr */
@ -413,7 +425,7 @@ aac_pci_attach(device_t dev)
0, /* flags */
NULL, NULL, /* No locking needed */
&sc->aac_parent_dmat)) {
device_printf(sc->aac_dev, "can't allocate parent DMA tag\n");
device_printf(dev, "can't allocate parent DMA tag\n");
goto out;
}
@ -427,19 +439,19 @@ aac_pci_attach(device_t dev)
case AAC_HWIF_I960RX:
case AAC_HWIF_NARK:
fwprintf(sc, HBA_FLAGS_DBG_INIT_B, "set hardware up for i960Rx/NARK");
sc->aac_if = aac_rx_interface;
sc->aac_if = &aac_rx_interface;
break;
case AAC_HWIF_STRONGARM:
fwprintf(sc, HBA_FLAGS_DBG_INIT_B, "set hardware up for StrongARM");
sc->aac_if = aac_sa_interface;
sc->aac_if = &aac_sa_interface;
break;
case AAC_HWIF_RKT:
fwprintf(sc, HBA_FLAGS_DBG_INIT_B, "set hardware up for Rocket/MIPS");
sc->aac_if = aac_rkt_interface;
sc->aac_if = &aac_rkt_interface;
break;
default:
sc->aac_hwif = AAC_HWIF_UNKNOWN;
device_printf(sc->aac_dev, "unknown hardware type\n");
device_printf(dev, "unknown hardware type\n");
error = ENXIO;
goto out;
}
@ -472,7 +484,7 @@ static device_method_t aacch_methods[] = {
DEVMETHOD(device_probe, aacch_probe),
DEVMETHOD(device_attach, aacch_attach),
DEVMETHOD(device_detach, aacch_detach),
{ 0, 0 }
DEVMETHOD_END
};
struct aacch_softc {
@ -486,7 +498,7 @@ static driver_t aacch_driver = {
};
static devclass_t aacch_devclass;
DRIVER_MODULE(aacch, pci, aacch_driver, aacch_devclass, 0, 0);
DRIVER_MODULE(aacch, pci, aacch_driver, aacch_devclass, NULL, NULL);
static int
aacch_probe(device_t dev)

View File

@ -27,13 +27,14 @@
* $FreeBSD$
*/
#if 0
/*
* Status codes for block read/write commands, etc.
*
* XXX many of these would not normally be returned, as they are
* relevant only to FSA operations.
*/
static struct aac_code_lookup aac_command_status_table[] = {
static const struct aac_code_lookup aac_command_status_table[] = {
{"OK", ST_OK},
{"operation not permitted", ST_PERM},
{"not found", ST_NOENT},
@ -75,8 +76,9 @@ static struct aac_code_lookup aac_command_status_table[] = {
};
#define AAC_COMMAND_STATUS(x) aac_describe_code(aac_command_status_table, x)
#endif
static struct aac_code_lookup aac_cpu_variant[] = {
static const struct aac_code_lookup aac_cpu_variant[] = {
{"i960JX", CPUI960_JX},
{"i960CX", CPUI960_CX},
{"i960HX", CPUI960_HX},
@ -93,7 +95,7 @@ static struct aac_code_lookup aac_cpu_variant[] = {
{"Unknown processor", 0}
};
static struct aac_code_lookup aac_battery_platform[] = {
static const struct aac_code_lookup aac_battery_platform[] = {
{"required battery present", PLATFORM_BAT_REQ_PRESENT},
{"REQUIRED BATTERY NOT PRESENT", PLATFORM_BAT_REQ_NOTPRESENT},
{"optional battery present", PLATFORM_BAT_OPT_PRESENT},
@ -103,7 +105,7 @@ static struct aac_code_lookup aac_battery_platform[] = {
{"unknown battery platform", 0}
};
static struct aac_code_lookup aac_container_types[] = {
static const struct aac_code_lookup aac_container_types[] = {
{"Volume", CT_VOLUME},
{"RAID 1 (Mirror)", CT_MIRROR},
{"RAID 0 (Stripe)", CT_STRIPE},
@ -126,4 +128,3 @@ static struct aac_code_lookup aac_container_types[] = {
{NULL, 0},
{"unknown", 0}
};

View File

@ -33,10 +33,13 @@
#include <sys/callout.h>
#include <sys/lock.h>
#include <sys/mutex.h>
#include <sys/taskqueue.h>
#include <sys/selinfo.h>
#include <sys/sysctl.h>
#include <sys/taskqueue.h>
#include <geom/geom_disk.h>
SYSCTL_DECL(_hw_aac);
#define AAC_TYPE_DEVO 1
#define AAC_TYPE_ALPHA 2
#define AAC_TYPE_BETA 3
@ -242,28 +245,28 @@ struct aac_interface
int (*aif_get_outb_queue)(struct aac_softc *sc);
void (*aif_set_outb_queue)(struct aac_softc *sc, int index);
};
extern struct aac_interface aac_rx_interface;
extern struct aac_interface aac_sa_interface;
extern struct aac_interface aac_fa_interface;
extern struct aac_interface aac_rkt_interface;
extern const struct aac_interface aac_rx_interface;
extern const struct aac_interface aac_sa_interface;
extern const struct aac_interface aac_fa_interface;
extern const struct aac_interface aac_rkt_interface;
#define AAC_GET_FWSTATUS(sc) ((sc)->aac_if.aif_get_fwstatus((sc)))
#define AAC_QNOTIFY(sc, qbit) ((sc)->aac_if.aif_qnotify((sc), (qbit)))
#define AAC_GET_ISTATUS(sc) ((sc)->aac_if.aif_get_istatus((sc)))
#define AAC_CLEAR_ISTATUS(sc, mask) ((sc)->aac_if.aif_clr_istatus((sc), \
#define AAC_GET_FWSTATUS(sc) ((sc)->aac_if->aif_get_fwstatus((sc)))
#define AAC_QNOTIFY(sc, qbit) ((sc)->aac_if->aif_qnotify((sc), (qbit)))
#define AAC_GET_ISTATUS(sc) ((sc)->aac_if->aif_get_istatus((sc)))
#define AAC_CLEAR_ISTATUS(sc, mask) ((sc)->aac_if->aif_clr_istatus((sc), \
(mask)))
#define AAC_SET_MAILBOX(sc, command, arg0, arg1, arg2, arg3) \
((sc)->aac_if.aif_set_mailbox((sc), (command), (arg0), (arg1), (arg2), \
((sc)->aac_if->aif_set_mailbox((sc), (command), (arg0), (arg1), (arg2), \
(arg3)))
#define AAC_GET_MAILBOX(sc, mb) ((sc)->aac_if.aif_get_mailbox((sc), \
#define AAC_GET_MAILBOX(sc, mb) ((sc)->aac_if->aif_get_mailbox((sc), \
(mb)))
#define AAC_MASK_INTERRUPTS(sc) ((sc)->aac_if.aif_set_interrupts((sc), \
#define AAC_MASK_INTERRUPTS(sc) ((sc)->aac_if->aif_set_interrupts((sc), \
0))
#define AAC_UNMASK_INTERRUPTS(sc) ((sc)->aac_if.aif_set_interrupts((sc), \
#define AAC_UNMASK_INTERRUPTS(sc) ((sc)->aac_if->aif_set_interrupts((sc), \
1))
#define AAC_SEND_COMMAND(sc, cm) ((sc)->aac_if.aif_send_command((sc), (cm)))
#define AAC_GET_OUTB_QUEUE(sc) ((sc)->aac_if.aif_get_outb_queue((sc)))
#define AAC_SET_OUTB_QUEUE(sc, idx) ((sc)->aac_if.aif_set_outb_queue((sc), (idx)))
#define AAC_SEND_COMMAND(sc, cm) ((sc)->aac_if->aif_send_command((sc), (cm)))
#define AAC_GET_OUTB_QUEUE(sc) ((sc)->aac_if->aif_get_outb_queue((sc)))
#define AAC_SET_OUTB_QUEUE(sc, idx) ((sc)->aac_if->aif_set_outb_queue((sc), (idx)))
#define AAC_MEM0_SETREG4(sc, reg, val) bus_space_write_4(sc->aac_btag0, \
sc->aac_bhandle0, reg, val)
@ -307,14 +310,12 @@ struct aac_softc
/* bus connections */
device_t aac_dev;
struct resource *aac_regs_res0, *aac_regs_res1; /* reg. if. window */
int aac_regs_rid0, aac_regs_rid1; /* resource ID */
bus_space_handle_t aac_bhandle0, aac_bhandle1; /* bus space handle */
bus_space_tag_t aac_btag0, aac_btag1; /* bus space tag */
bus_dma_tag_t aac_parent_dmat; /* parent DMA tag */
bus_dma_tag_t aac_buffer_dmat; /* data buffer/command
* DMA tag */
struct resource *aac_irq; /* interrupt */
int aac_irq_rid;
void *aac_intr; /* interrupt handle */
eventhandler_tag eh;
@ -339,7 +340,7 @@ struct aac_softc
* DMA map */
struct aac_common *aac_common;
u_int32_t aac_common_busaddr;
struct aac_interface aac_if;
const struct aac_interface *aac_if;
/* command/fib resources */
bus_dma_tag_t aac_fib_dmat; /* DMA tag for allocing FIBs */
@ -499,7 +500,7 @@ extern void aac_print_aif(struct aac_softc *sc,
#endif
struct aac_code_lookup {
char *string;
const char *string;
u_int32_t code;
};
@ -581,7 +582,6 @@ aac_remove_ ## name (struct aac_command *cm) \
cm->cm_flags &= ~AAC_ON_ ## index; \
AACQ_REMOVE(cm->cm_sc, index); \
} \
struct hack
AACQ_COMMAND_QUEUE(free, AACQ_FREE);
AACQ_COMMAND_QUEUE(ready, AACQ_READY);
@ -644,4 +644,3 @@ aac_release_sync_fib(struct aac_softc *sc)
mtx_assert(&sc->aac_io_lock, MA_OWNED);
}