diff options
author | John Baldwin <jhb@FreeBSD.org> | 2012-10-15 16:09:59 +0000 |
---|---|---|
committer | John Baldwin <jhb@FreeBSD.org> | 2012-10-15 16:09:59 +0000 |
commit | 4bb96a74189d70a5ddb6c5f291d43c6e779997ec (patch) | |
tree | 5829ecb29696b68ee5df08cafc2d610e3430d0bd /sys/dev/aic/aicvar.h | |
parent | e40cc6afc410638f9990b0cfad494f9b58a3c129 (diff) | |
download | src-4bb96a74189d70a5ddb6c5f291d43c6e779997ec.tar.gz src-4bb96a74189d70a5ddb6c5f291d43c6e779997ec.zip |
Add locking to the aic(4) driver and mark it MPSAFE.
- Move 'free_scbs' into the softc rather than having it be a global list
and convert it to an SLIST instead of a hand-rolled linked-list.
- Use device_printf() and device_get_unit() instead of storing the unit
number in the softc.
- Remove use of explicit bus space handles and tags.
- Don't call device_set_desc() in the pccard attach routine, instead
set a default description during the pccard probe if the matching
product doesn't have a name.
Tested by: no one
Notes
Notes:
svn path=/head/; revision=241591
Diffstat (limited to 'sys/dev/aic/aicvar.h')
-rw-r--r-- | sys/dev/aic/aicvar.h | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/sys/dev/aic/aicvar.h b/sys/dev/aic/aicvar.h index 3bce66cb8508..078d74838132 100644 --- a/sys/dev/aic/aicvar.h +++ b/sys/dev/aic/aicvar.h @@ -47,6 +47,8 @@ struct aic_tinfo { struct aic_scb { union ccb *ccb; + SLIST_ENTRY(aic_scb) link; + struct callout timer; u_int8_t flags; u_int8_t tag; u_int8_t target; @@ -70,14 +72,14 @@ enum { AIC6260, AIC6360, AIC6370, GM82C700 }; struct aic_softc { device_t dev; - int unit; - bus_space_tag_t tag; - bus_space_handle_t bsh; + struct mtx lock; + struct resource *res; bus_dma_tag_t dmat; struct cam_sim *sim; struct cam_path *path; TAILQ_HEAD(,ccb_hdr) pending_ccbs, nexus_ccbs; + SLIST_HEAD(,aic_scb) free_scbs; struct aic_scb *nexus; u_int32_t flags; @@ -127,32 +129,28 @@ struct aic_softc { #define AIC_SYNC_OFFSET 8 #define aic_inb(aic, port) \ - bus_space_read_1((aic)->tag, (aic)->bsh, (port)) + bus_read_1((aic)->res, (port)) #define aic_outb(aic, port, value) \ - bus_space_write_1((aic)->tag, (aic)->bsh, (port), (value)) + bus_write_1((aic)->res, (port), (value)) #define aic_insb(aic, port, addr, count) \ - bus_space_read_multi_1((aic)->tag, (aic)->bsh, (port), (addr), (count)) + bus_read_multi_1((aic)->res, (port), (addr), (count)) #define aic_outsb(aic, port, addr, count) \ - bus_space_write_multi_1((aic)->tag, (aic)->bsh, (port), (addr), (count)) + bus_write_multi_1((aic)->res, (port), (addr), (count)) #define aic_insw(aic, port, addr, count) \ - bus_space_read_multi_2((aic)->tag, (aic)->bsh, (port), \ - (u_int16_t *)(addr), (count)) + bus_read_multi_2((aic)->res, (port), (u_int16_t *)(addr), (count)) #define aic_outsw(aic, port, addr, count) \ - bus_space_write_multi_2((aic)->tag, (aic)->bsh, (port), \ - (u_int16_t *)(addr), (count)) + bus_write_multi_2((aic)->res, (port), (u_int16_t *)(addr), (count)) #define aic_insl(aic, port, addr, count) \ - bus_space_read_multi_4((aic)->tag, (aic)->bsh, (port), \ - (u_int32_t *)(addr), (count)) + bus_read_multi_4((aic)->res, (port), (u_int32_t *)(addr), (count)) #define aic_outsl(aic, port, addr, count) \ - bus_space_write_multi_4((aic)->tag, (aic)->bsh, (port), \ - (u_int32_t *)(addr), (count)) + bus_write_multi_4((aic)->res, (port), (u_int32_t *)(addr), (count)) extern int aic_probe(struct aic_softc *); extern int aic_attach(struct aic_softc *); |