summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2004-10-24 04:28:34 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2004-10-24 04:28:34 +0000
commit10473c5dd07cc508055717dff73133e6484646cb (patch)
tree3d2be814b8adfb2386a7c8afc59dbb5e7e45c902 /sys
parenta4d587e7f6817b629a844da6991326ee9e9aa706 (diff)
Shuffle defines around so that ahc and ahd use the aic_ names that
come with the freebsd sources, rather than duplicating those names in the ahd_ and ahc_ namespaces. Big reduction in delta to freebsd sources, which reduces noise when updating the code. No .o differences found on i386. ok marco@.
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/ic/aic79xx.c120
-rw-r--r--sys/dev/ic/aic79xx.h4
-rw-r--r--sys/dev/ic/aic7xxx.c66
-rw-r--r--sys/dev/ic/aic7xxx_cam.h18
-rw-r--r--sys/dev/ic/aic7xxx_inline.h6
-rw-r--r--sys/dev/ic/aic7xxx_openbsd.c14
-rw-r--r--sys/dev/ic/aic7xxx_openbsd.h18
-rw-r--r--sys/dev/ic/aic7xxx_seeprom.c6
8 files changed, 126 insertions, 126 deletions
diff --git a/sys/dev/ic/aic79xx.c b/sys/dev/ic/aic79xx.c
index 37b399df993..bd4b8c3c9d8 100644
--- a/sys/dev/ic/aic79xx.c
+++ b/sys/dev/ic/aic79xx.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: aic79xx.c,v 1.10 2004/10/24 01:36:49 krw Exp $ */
+/* $OpenBSD: aic79xx.c,v 1.11 2004/10/24 04:28:33 krw Exp $ */
/*
* Copyright (c) 2004 Milos Urbanek, Kenneth R. Westerback & Marco Peereboom
@@ -475,7 +475,7 @@ rescan_fifos:
* also delay a bit so that status has a chance
* to change before we look at this FIFO again.
*/
- ahd_delay(200);
+ aic_delay(200);
goto rescan_fifos;
}
ahd_set_modes(ahd, AHD_MODE_SCSI, AHD_MODE_SCSI);
@@ -532,7 +532,7 @@ rescan_fifos:
break;
} else if ((ccscbctl & CCSCBDONE) != 0)
break;
- ahd_delay(200);
+ aic_delay(200);
}
/*
* We leave the sequencer to cleanup in the case of DMA's to
@@ -904,7 +904,7 @@ ahd_run_qoutfifo(struct ahd_softc *ahd)
if (completion->valid_tag != ahd->qoutfifonext_valid_tag)
break;
- scb_index = ahd_le16toh(completion->tag);
+ scb_index = aic_le16toh(completion->tag);
scb = ahd_lookup_scb(ahd, scb_index);
if (scb == NULL) {
printf("%s: WARNING no command for scb %d "
@@ -2648,7 +2648,7 @@ ahd_clear_critical_section(struct ahd_softc *ahd)
ahd_set_modes(ahd, ahd->saved_src_mode, ahd->saved_dst_mode);
ahd_outb(ahd, HCNTRL, ahd->unpause);
while (!ahd_is_paused(ahd))
- ahd_delay(200);
+ aic_delay(200);
ahd_update_modes(ahd);
}
if (stepping) {
@@ -2724,10 +2724,10 @@ ahd_print_scb(struct scb *scb)
for (i = 0; i < sizeof(hscb->shared_data.idata.cdb); i++)
printf("%#02x", hscb->shared_data.idata.cdb[i]);
printf(" dataptr:%#x%x datacnt:%#x sgptr:%#x tag:%#x\n",
- (uint32_t)((ahd_le64toh(hscb->dataptr) >> 32) & 0xFFFFFFFF),
- (uint32_t)(ahd_le64toh(hscb->dataptr) & 0xFFFFFFFF),
- ahd_le32toh(hscb->datacnt),
- ahd_le32toh(hscb->sgptr),
+ (uint32_t)((aic_le64toh(hscb->dataptr) >> 32) & 0xFFFFFFFF),
+ (uint32_t)(aic_le64toh(hscb->dataptr) & 0xFFFFFFFF),
+ aic_le32toh(hscb->datacnt),
+ aic_le32toh(hscb->sgptr),
SCB_GET_TAG(scb));
ahd_dump_sglist(scb);
}
@@ -2746,8 +2746,8 @@ ahd_dump_sglist(struct scb *scb)
uint64_t addr;
uint32_t len;
- addr = ahd_le64toh(sg_list[i].addr);
- len = ahd_le32toh(sg_list[i].len);
+ addr = aic_le64toh(sg_list[i].addr);
+ len = aic_le32toh(sg_list[i].len);
printf("sg[%d] - Addr 0x%x%x : Length %d%s\n",
i,
(uint32_t)((addr >> 32) & 0xFFFFFFFF),
@@ -2763,11 +2763,11 @@ ahd_dump_sglist(struct scb *scb)
for (i = 0; i < scb->sg_count; i++) {
uint32_t len;
- len = ahd_le32toh(sg_list[i].len);
+ len = aic_le32toh(sg_list[i].len);
printf("sg[%d] - Addr 0x%x%x : Length %d%s\n",
i,
(len & AHD_SG_HIGH_ADDR_MASK) >> 24,
- ahd_le32toh(sg_list[i].addr),
+ aic_le32toh(sg_list[i].addr),
len & AHD_SG_LEN_MASK,
len & AHD_DMA_LAST_SEG ? " Last" : "");
}
@@ -4920,18 +4920,18 @@ ahd_handle_ign_wide_residue(struct ahd_softc *ahd, struct ahd_devinfo *devinfo)
* to load so we must go back one.
*/
sg--;
- sglen = ahd_le32toh(sg->len) & AHD_SG_LEN_MASK;
+ sglen = aic_le32toh(sg->len) & AHD_SG_LEN_MASK;
if (sg != (struct ahd_dma64_seg *)scb->sg_list
&& sglen < (data_cnt & AHD_SG_LEN_MASK)) {
sg--;
- sglen = ahd_le32toh(sg->len);
+ sglen = aic_le32toh(sg->len);
/*
* Preserve High Address and SG_LIST
* bits while setting the count to 1.
*/
data_cnt = 1|(sglen&(~AHD_SG_LEN_MASK));
- data_addr = ahd_le64toh(sg->addr)
+ data_addr = aic_le64toh(sg->addr)
+ (sglen & AHD_SG_LEN_MASK)
- 1;
@@ -4953,18 +4953,18 @@ ahd_handle_ign_wide_residue(struct ahd_softc *ahd, struct ahd_devinfo *devinfo)
* to load so we must go back one.
*/
sg--;
- sglen = ahd_le32toh(sg->len) & AHD_SG_LEN_MASK;
+ sglen = aic_le32toh(sg->len) & AHD_SG_LEN_MASK;
if (sg != scb->sg_list
&& sglen < (data_cnt & AHD_SG_LEN_MASK)) {
sg--;
- sglen = ahd_le32toh(sg->len);
+ sglen = aic_le32toh(sg->len);
/*
* Preserve High Address and SG_LIST
* bits while setting the count to 1.
*/
data_cnt = 1|(sglen&(~AHD_SG_LEN_MASK));
- data_addr = ahd_le32toh(sg->addr)
+ data_addr = aic_le32toh(sg->addr)
+ (sglen & AHD_SG_LEN_MASK)
- 1;
@@ -5026,7 +5026,7 @@ ahd_reinitialize_dataptrs(struct ahd_softc *ahd)
ahd_outb(ahd, DFFSXFRCTL, CLRCHN);
wait = 1000;
while (--wait && !(ahd_inb(ahd, MDFFSTAT) & FIFOFREE))
- ahd_delay(100);
+ aic_delay(100);
if (wait == 0) {
ahd_print_path(ahd, scb);
printf("ahd_reinitialize_dataptrs: Forcing FIFO free.\n");
@@ -5057,8 +5057,8 @@ ahd_reinitialize_dataptrs(struct ahd_softc *ahd)
/* The residual sg_ptr always points to the next sg */
sg--;
- dataptr = ahd_le64toh(sg->addr)
- + (ahd_le32toh(sg->len) & AHD_SG_LEN_MASK)
+ dataptr = aic_le64toh(sg->addr)
+ + (aic_le32toh(sg->len) & AHD_SG_LEN_MASK)
- resid;
ahd_outl(ahd, HADDR + 4, dataptr >> 32);
} else {
@@ -5069,11 +5069,11 @@ ahd_reinitialize_dataptrs(struct ahd_softc *ahd)
/* The residual sg_ptr always points to the next sg */
sg--;
- dataptr = ahd_le32toh(sg->addr)
- + (ahd_le32toh(sg->len) & AHD_SG_LEN_MASK)
+ dataptr = aic_le32toh(sg->addr)
+ + (aic_le32toh(sg->len) & AHD_SG_LEN_MASK)
- resid;
ahd_outb(ahd, HADDR + 4,
- (ahd_le32toh(sg->len) & ~AHD_SG_LEN_MASK) >> 24);
+ (aic_le32toh(sg->len) & ~AHD_SG_LEN_MASK) >> 24);
}
ahd_outl(ahd, HADDR, dataptr);
ahd_outb(ahd, HCNT + 2, resid >> 16);
@@ -5455,7 +5455,7 @@ ahd_reset(struct ahd_softc *ahd, int reinit)
*/
wait = 1000;
do {
- ahd_delay(1000);
+ aic_delay(1000);
} while (--wait && !(ahd_inb(ahd, HCNTRL) & CHIPRSTACK));
if (wait == 0) {
@@ -6069,7 +6069,7 @@ ahd_alloc_scbs(struct ahd_softc *ahd)
next_scb->hscb = hscb;
KASSERT((vaddr_t)hscb >= (vaddr_t)hscb_map->vaddr &&
(vaddr_t)hscb < (vaddr_t)hscb_map->vaddr + PAGE_SIZE);
- hscb->hscb_busaddr = ahd_htole32(hscb_busaddr);
+ hscb->hscb_busaddr = aic_htole32(hscb_busaddr);
/*
* The sequencer always starts with the second entry.
@@ -6094,7 +6094,7 @@ ahd_alloc_scbs(struct ahd_softc *ahd)
free(pdata, M_DEVBUF);
break;
}
- next_scb->hscb->tag = ahd_htole16(scb_data->numscbs);
+ next_scb->hscb->tag = aic_htole16(scb_data->numscbs);
col_tag = scb_data->numscbs ^ 0x100;
next_scb->col_scb = ahd_find_scb_by_tag(ahd, col_tag);
if (next_scb->col_scb != NULL)
@@ -6236,7 +6236,7 @@ ahd_init(struct ahd_softc *ahd)
*/
ahd->next_queued_hscb = (struct hardware_scb *)next_vaddr;
ahd->next_queued_hscb_map = &ahd->shared_data_map;
- ahd->next_queued_hscb->hscb_busaddr = ahd_htole32(next_baddr);
+ ahd->next_queued_hscb->hscb_busaddr = aic_htole32(next_baddr);
/* Allocate SCB data now that buffer_dmat is initialized */
if (ahd_init_scbdata(ahd) != 0)
@@ -6391,7 +6391,7 @@ ahd_chip_init(struct ahd_softc *ahd)
for (wait = 10000;
(ahd_inb(ahd, SBLKCTL) & (ENAB40|ENAB20)) == 0 && wait;
wait--)
- ahd_delay(100);
+ aic_delay(100);
/* Clear any false bus resets due to the transceivers settling */
ahd_outb(ahd, CLRSINT1, CLRSCSIRSTI);
@@ -6643,7 +6643,7 @@ ahd_chip_init(struct ahd_softc *ahd)
/*
* Tell the sequencer which SCB will be the next one it receives.
*/
- busaddr = ahd_le32toh(ahd->next_queued_hscb->hscb_busaddr);
+ busaddr = aic_le32toh(ahd->next_queued_hscb->hscb_busaddr);
ahd_outl(ahd, NEXT_QUEUED_SCB_ADDR, busaddr);
/*
@@ -6967,7 +6967,7 @@ ahd_pause_and_flushwork(struct ahd_softc *ahd)
* Give the sequencer some time to service
* any active selections.
*/
- ahd_delay(500);
+ aic_delay(500);
ahd_intr(ahd);
ahd_pause(ahd);
@@ -7159,7 +7159,7 @@ ahd_qinfifo_requeue(struct ahd_softc *ahd, struct scb *prev_scb,
if (prev_scb == NULL) {
uint32_t busaddr;
- busaddr = ahd_le32toh(scb->hscb->hscb_busaddr);
+ busaddr = aic_le32toh(scb->hscb->hscb_busaddr);
ahd_outl(ahd, NEXT_QUEUED_SCB_ADDR, busaddr);
} else {
prev_scb->hscb->next_hscb_busaddr = scb->hscb->hscb_busaddr;
@@ -7266,7 +7266,7 @@ ahd_search_qinfifo(struct ahd_softc *ahd, int target, char channel,
* for removal will be re-added to the queue as we go.
*/
ahd->qinfifonext = qinstart;
- busaddr = ahd_le32toh(ahd->next_queued_hscb->hscb_busaddr);
+ busaddr = aic_le32toh(ahd->next_queued_hscb->hscb_busaddr);
ahd_outl(ahd, NEXT_QUEUED_SCB_ADDR, busaddr);
while (qinpos != qintail) {
@@ -7657,11 +7657,11 @@ ahd_reset_current_bus(struct ahd_softc *ahd)
scsiseq = ahd_inb(ahd, SCSISEQ0) & ~(ENSELO|ENARBO|SCSIRSTO);
ahd_outb(ahd, SCSISEQ0, scsiseq | SCSIRSTO);
ahd_flush_device_writes(ahd);
- ahd_delay(AHD_BUSRESET_DELAY);
+ aic_delay(AHD_BUSRESET_DELAY);
/* Turn off the bus reset */
ahd_outb(ahd, SCSISEQ0, scsiseq);
ahd_flush_device_writes(ahd);
- ahd_delay(AHD_BUSRESET_DELAY);
+ aic_delay(AHD_BUSRESET_DELAY);
if ((ahd->bugs & AHD_SCSIRST_BUG) != 0) {
/*
* 2A Razor #474
@@ -7729,7 +7729,7 @@ ahd_reset_channel(struct ahd_softc *ahd, char channel, int initiate_reset)
ahd_outb(ahd, DFCNTRL,
ahd_inb(ahd, DFCNTRL) & ~(SCSIEN|HDMAEN));
while ((ahd_inb(ahd, DFCNTRL) & HDMAENACK) != 0)
- ahd_delay(10);
+ aic_delay(10);
/*
* Set CURRFIFO to the now inactive channel.
*/
@@ -8175,7 +8175,7 @@ ahd_calc_residual(struct ahd_softc *ahd, struct scb *scb)
*/
hscb = scb->hscb;
- sgptr = ahd_le32toh(hscb->sgptr);
+ sgptr = aic_le32toh(hscb->sgptr);
if ((sgptr & SG_STATUS_VALID) == 0)
/* Case 1 */
return;
@@ -8192,7 +8192,7 @@ ahd_calc_residual(struct ahd_softc *ahd, struct scb *scb)
* regardless of the role for this SCB.
*/
spkt = &hscb->shared_data.istatus;
- resid_sgptr = ahd_le32toh(spkt->residual_sgptr);
+ resid_sgptr = aic_le32toh(spkt->residual_sgptr);
if ((sgptr & SG_FULL_RESID) != 0) {
/* Case 3 */
resid = ahd_get_transfer_length(scb);
@@ -8217,7 +8217,7 @@ ahd_calc_residual(struct ahd_softc *ahd, struct scb *scb)
* Remainder of the SG where the transfer
* stopped.
*/
- resid = ahd_le32toh(spkt->residual_datacnt) & AHD_SG_LEN_MASK;
+ resid = aic_le32toh(spkt->residual_datacnt) & AHD_SG_LEN_MASK;
sg = ahd_sg_bus_to_virt(ahd, scb, resid_sgptr & SG_PTR_MASK);
/* The residual sg_ptr always points to the next sg */
@@ -8228,9 +8228,9 @@ ahd_calc_residual(struct ahd_softc *ahd, struct scb *scb)
* SG segments that are after the SG where
* the transfer stopped.
*/
- while ((ahd_le32toh(sg->len) & AHD_DMA_LAST_SEG) == 0) {
+ while ((aic_le32toh(sg->len) & AHD_DMA_LAST_SEG) == 0) {
sg++;
- resid += ahd_le32toh(sg->len) & AHD_SG_LEN_MASK;
+ resid += aic_le32toh(sg->len) & AHD_SG_LEN_MASK;
}
}
if ((scb->flags & SCB_SENSE) == 0)
@@ -8597,7 +8597,7 @@ ahd_download_instr(struct ahd_softc *ahd, u_int instrptr, uint8_t *dconsts)
/*
* The firmware is always compiled into a little endian format.
*/
- instr.integer = ahd_le32toh(*(uint32_t*)&seqprog[instrptr * 4]);
+ instr.integer = aic_le32toh(*(uint32_t*)&seqprog[instrptr * 4]);
fmt1_ins = &instr.format1;
fmt3_ins = NULL;
@@ -8645,7 +8645,7 @@ ahd_download_instr(struct ahd_softc *ahd, u_int instrptr, uint8_t *dconsts)
instr.format1.parity = 1;
/* The sequencer is a little endian cpu */
- instr.integer = ahd_htole32(instr.integer);
+ instr.integer = aic_htole32(instr.integer);
ahd_outsb(ahd, SEQRAM, instr.bytes, 4);
break;
}
@@ -9440,7 +9440,7 @@ ahd_wait_seeprom(struct ahd_softc *ahd)
cnt = 5000;
while ((ahd_inb(ahd, SEESTAT) & (SEEARBACK|SEEBUSY)) != 0 && --cnt)
- ahd_delay(5);
+ aic_delay(5);
if (cnt == 0)
return (ETIMEDOUT);
@@ -9582,7 +9582,7 @@ ahd_wait_flexport(struct ahd_softc *ahd)
AHD_ASSERT_MODES(ahd, AHD_MODE_SCSI_MSK, AHD_MODE_SCSI_MSK);
cnt = 1000000 * 2 / 5;
while ((ahd_inb(ahd, BRDCTL) & FLXARBACK) == 0 && --cnt)
- ahd_delay(5);
+ aic_delay(5);
if (cnt == 0)
return (ETIMEDOUT);
@@ -10387,15 +10387,15 @@ ahd_sg_setup(struct ahd_softc *ahd, struct scb *scb,
struct ahd_dma64_seg *sg;
sg = (struct ahd_dma64_seg *)sgptr;
- sg->addr = ahd_htole64(addr);
- sg->len = ahd_htole32(len | (last ? AHD_DMA_LAST_SEG : 0));
+ sg->addr = aic_htole64(addr);
+ sg->len = aic_htole32(len | (last ? AHD_DMA_LAST_SEG : 0));
return (sg + 1);
} else {
struct ahd_dma_seg *sg;
sg = (struct ahd_dma_seg *)sgptr;
- sg->addr = ahd_htole32(addr & 0xFFFFFFFF);
- sg->len = ahd_htole32(len | ((addr >> 8) & 0x7F000000)
+ sg->addr = aic_htole32(addr & 0xFFFFFFFF);
+ sg->len = aic_htole32(len | ((addr >> 8) & 0x7F000000)
| (last ? AHD_DMA_LAST_SEG : 0));
return (sg + 1);
}
@@ -10419,7 +10419,7 @@ ahd_setup_scb_common(struct ahd_softc *ahd, struct scb *scb)
if (scb->hscb->cdb_len <= MAX_CDB_LEN_WITH_SENSE_ADDR
|| (scb->hscb->cdb_len & SCB_CDB_LEN_PTR) != 0)
scb->hscb->shared_data.idata.cdb_plus_saddr.sense_addr =
- ahd_htole32(scb->sense_busaddr);
+ aic_htole32(scb->sense_busaddr);
}
void
@@ -10445,8 +10445,8 @@ ahd_setup_data_scb(struct ahd_softc *ahd, struct scb *scb)
if ((ahd->flags & AHD_39BIT_ADDRESSING) != 0) {
uint64_t high_addr;
- high_addr = ahd_le32toh(sg->len) & 0x7F000000;
- scb->hscb->dataptr |= ahd_htole64(high_addr << 8);
+ high_addr = aic_le32toh(sg->len) & 0x7F000000;
+ scb->hscb->dataptr |= aic_htole64(high_addr << 8);
}
scb->hscb->datacnt = sg->len;
}
@@ -10456,13 +10456,13 @@ ahd_setup_data_scb(struct ahd_softc *ahd, struct scb *scb)
* sequencer will clear as soon as a data transfer
* occurs.
*/
- scb->hscb->sgptr = ahd_htole32(scb->sg_list_busaddr|SG_FULL_RESID);
+ scb->hscb->sgptr = aic_htole32(scb->sg_list_busaddr|SG_FULL_RESID);
}
void
ahd_setup_noxfer_scb(struct ahd_softc *ahd, struct scb *scb)
{
- scb->hscb->sgptr = ahd_htole32(SG_LIST_NULL);
+ scb->hscb->sgptr = aic_htole32(SG_LIST_NULL);
scb->hscb->dataptr = 0;
scb->hscb->datacnt = 0;
}
@@ -10538,7 +10538,7 @@ ahd_complete_scb(struct ahd_softc *ahd, struct scb *scb)
{
uint32_t sgptr;
- sgptr = ahd_le32toh(scb->hscb->sgptr);
+ sgptr = aic_le32toh(scb->hscb->sgptr);
if ((sgptr & SG_STATUS_VALID) != 0)
ahd_handle_scb_status(ahd, scb);
else
@@ -10554,7 +10554,7 @@ ahd_update_residual(struct ahd_softc *ahd, struct scb *scb)
{
uint32_t sgptr;
- sgptr = ahd_le32toh(scb->hscb->sgptr);
+ sgptr = aic_le32toh(scb->hscb->sgptr);
if ((sgptr & SG_STATUS_VALID) != 0)
ahd_calc_residual(ahd, scb);
}
@@ -10869,13 +10869,13 @@ ahd_queue_scb(struct ahd_softc *ahd, struct scb *scb)
if ((ahd_debug & AHD_SHOW_QUEUE) != 0) {
uint64_t host_dataptr;
- host_dataptr = ahd_le64toh(scb->hscb->dataptr);
+ host_dataptr = aic_le64toh(scb->hscb->dataptr);
printf("%s: Queueing SCB 0x%x bus addr 0x%x - 0x%x%x/0x%x\n",
ahd_name(ahd),
- SCB_GET_TAG(scb), ahd_le32toh(scb->hscb->hscb_busaddr),
+ SCB_GET_TAG(scb), aic_le32toh(scb->hscb->hscb_busaddr),
(u_int)((host_dataptr >> 32) & 0xFFFFFFFF),
(u_int)(host_dataptr & 0xFFFFFFFF),
- ahd_le32toh(scb->hscb->datacnt));
+ aic_le32toh(scb->hscb->datacnt));
}
#endif
/* Tell the adapter about the newly queued SCB */
diff --git a/sys/dev/ic/aic79xx.h b/sys/dev/ic/aic79xx.h
index 915254f195c..5ada733834e 100644
--- a/sys/dev/ic/aic79xx.h
+++ b/sys/dev/ic/aic79xx.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: aic79xx.h,v 1.6 2004/08/23 20:16:01 marco Exp $ */
+/* $OpenBSD: aic79xx.h,v 1.7 2004/10/24 04:28:33 krw Exp $ */
/*
* Copyright (c) 2004 Milos Urbanek, Kenneth R. Westerback & Marco Peereboom
@@ -148,7 +148,7 @@ struct scb_platform_data;
((lun) | ((target) << 8))
#define SCB_GET_TAG(scb) \
- ahd_le16toh(scb->hscb->tag)
+ aic_le16toh(scb->hscb->tag)
#ifndef AHD_TARGET_MODE
#undef AHD_TMODE_ENABLE
diff --git a/sys/dev/ic/aic7xxx.c b/sys/dev/ic/aic7xxx.c
index 52496ee1724..d8d58197d10 100644
--- a/sys/dev/ic/aic7xxx.c
+++ b/sys/dev/ic/aic7xxx.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: aic7xxx.c,v 1.59 2004/08/13 23:38:54 krw Exp $ */
+/* $OpenBSD: aic7xxx.c,v 1.60 2004/10/24 04:28:33 krw Exp $ */
/* $NetBSD: aic7xxx.c,v 1.108 2003/11/02 11:07:44 wiz Exp $ */
/*
@@ -40,7 +40,7 @@
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES.
*
- * $Id: aic7xxx.c,v 1.59 2004/08/13 23:38:54 krw Exp $
+ * $Id: aic7xxx.c,v 1.60 2004/10/24 04:28:33 krw Exp $
*/
/*
* Ported from FreeBSD by Pascal Renauld, Network Storage Solutions, Inc. - April 2003
@@ -565,8 +565,8 @@ ahc_handle_seqint(struct ahc_softc *ahc, u_int intstat)
sg->len |= AHC_DMA_LAST_SEG;
/* Fixup byte order */
- sg->addr = ahc_htole32(sg->addr);
- sg->len = ahc_htole32(sg->len);
+ sg->addr = aic_htole32(sg->addr);
+ sg->len = aic_htole32(sg->len);
sc->opcode = REQUEST_SENSE;
sc->byte2 = 0;
@@ -610,7 +610,7 @@ ahc_handle_seqint(struct ahc_softc *ahc, u_int intstat)
hscb->dataptr = sg->addr;
hscb->datacnt = sg->len;
hscb->sgptr = scb->sg_list_phys | SG_FULL_RESID;
- hscb->sgptr = ahc_htole32(hscb->sgptr);
+ hscb->sgptr = aic_htole32(hscb->sgptr);
#ifdef __OpenBSD__
bus_dmamap_sync(ahc->parent_dmat,
ahc->scb_data->sense_dmamap,
@@ -836,7 +836,7 @@ ahc_handle_seqint(struct ahc_softc *ahc, u_int intstat)
if ((ahc_inb(ahc, SCSISIGI)
& (CDI|MSGI)) != 0)
break;
- ahc_delay(100);
+ aic_delay(100);
}
ahc_outb(ahc, SXFRCTL1,
ahc_inb(ahc, SXFRCTL1) & ~BITBUCKET);
@@ -894,10 +894,10 @@ ahc_handle_seqint(struct ahc_softc *ahc, u_int intstat)
printf("sg[%d] - Addr 0x%x%x : Length %d\n",
i,
- (ahc_le32toh(scb->sg_list[i].len) >> 24
+ (aic_le32toh(scb->sg_list[i].len) >> 24
& SG_HIGH_ADDR_BITS),
- ahc_le32toh(scb->sg_list[i].addr),
- ahc_le32toh(scb->sg_list[i].len)
+ aic_le32toh(scb->sg_list[i].addr),
+ aic_le32toh(scb->sg_list[i].len)
& AHC_SG_LEN_MASK);
}
}
@@ -1551,7 +1551,7 @@ ahc_clear_critical_section(struct ahc_softc *ahc)
}
ahc_outb(ahc, HCNTRL, ahc->unpause);
while (!ahc_is_paused(ahc))
- ahc_delay(200);
+ aic_delay(200);
}
if (stepping) {
ahc_outb(ahc, SIMODE0, simode0);
@@ -1599,18 +1599,18 @@ ahc_print_scb(struct scb *scb)
for (i = 0; i < sizeof(hscb->shared_data.cdb); i++)
printf("%#02x", hscb->shared_data.cdb[i]);
printf(" dataptr:%#x datacnt:%#x sgptr:%#x tag:%#x\n",
- ahc_le32toh(hscb->dataptr),
- ahc_le32toh(hscb->datacnt),
- ahc_le32toh(hscb->sgptr),
+ aic_le32toh(hscb->dataptr),
+ aic_le32toh(hscb->datacnt),
+ aic_le32toh(hscb->sgptr),
hscb->tag);
if (scb->sg_count > 0) {
for (i = 0; i < scb->sg_count; i++) {
printf("sg[%d] - Addr 0x%x%x : Length %d\n",
i,
- (ahc_le32toh(scb->sg_list[i].len) >> 24
+ (aic_le32toh(scb->sg_list[i].len) >> 24
& SG_HIGH_ADDR_BITS),
- ahc_le32toh(scb->sg_list[i].addr),
- ahc_le32toh(scb->sg_list[i].len));
+ aic_le32toh(scb->sg_list[i].addr),
+ aic_le32toh(scb->sg_list[i].len));
}
}
}
@@ -3695,18 +3695,18 @@ ahc_handle_ign_wide_residue(struct ahc_softc *ahc, struct ahc_devinfo *devinfo)
* to load so we must go back one.
*/
sg--;
- sglen = ahc_le32toh(sg->len) & AHC_SG_LEN_MASK;
+ sglen = aic_le32toh(sg->len) & AHC_SG_LEN_MASK;
if (sg != scb->sg_list
&& sglen < (data_cnt & AHC_SG_LEN_MASK)) {
sg--;
- sglen = ahc_le32toh(sg->len);
+ sglen = aic_le32toh(sg->len);
/*
* Preserve High Address and SG_LIST bits
* while setting the count to 1.
*/
data_cnt = 1 | (sglen & (~AHC_SG_LEN_MASK));
- data_addr = ahc_le32toh(sg->addr)
+ data_addr = aic_le32toh(sg->addr)
+ (sglen & AHC_SG_LEN_MASK) - 1;
/*
@@ -3762,8 +3762,8 @@ ahc_reinitialize_dataptrs(struct ahc_softc *ahc)
| (ahc_inb(ahc, SCB_RESIDUAL_DATACNT + 1) << 8)
| ahc_inb(ahc, SCB_RESIDUAL_DATACNT);
- dataptr = ahc_le32toh(sg->addr)
- + (ahc_le32toh(sg->len) & AHC_SG_LEN_MASK)
+ dataptr = aic_le32toh(sg->addr)
+ + (aic_le32toh(sg->len) & AHC_SG_LEN_MASK)
- resid;
if ((ahc->flags & AHC_39BIT_ADDRESSING) != 0) {
u_int dscommand1;
@@ -3771,7 +3771,7 @@ ahc_reinitialize_dataptrs(struct ahc_softc *ahc)
dscommand1 = ahc_inb(ahc, DSCOMMAND1);
ahc_outb(ahc, DSCOMMAND1, dscommand1 | HADDLDSEL0);
ahc_outb(ahc, HADDR,
- (ahc_le32toh(sg->len) >> 24) & SG_HIGH_ADDR_BITS);
+ (aic_le32toh(sg->len) >> 24) & SG_HIGH_ADDR_BITS);
ahc_outb(ahc, DSCOMMAND1, dscommand1);
}
ahc_outb(ahc, HADDR + 3, dataptr >> 24);
@@ -4104,7 +4104,7 @@ ahc_reset(struct ahc_softc *ahc, int reinit)
*/
wait = 1000;
do {
- ahc_delay(1000);
+ aic_delay(1000);
} while (--wait && !(ahc_inb(ahc, HCNTRL) & CHIPRSTACK));
if (wait == 0) {
@@ -4682,7 +4682,7 @@ ahc_chip_init(struct ahc_softc *ahc)
for (wait = 5000;
(ahc_inb(ahc, SBLKCTL) & (ENAB40|ENAB20)) == 0 && wait;
wait--)
- ahc_delay(100);
+ aic_delay(100);
}
ahc_restart(ahc);
return (0);
@@ -5025,7 +5025,7 @@ ahc_pause_and_flushwork(struct ahc_softc *ahc)
* Give the sequencer some time to service
* any active selections.
*/
- ahc_delay(500);
+ aic_delay(500);
}
ahc_intr(ahc);
ahc_pause(ahc);
@@ -5871,7 +5871,7 @@ ahc_reset_current_bus(struct ahc_softc *ahc)
scsiseq = ahc_inb(ahc, SCSISEQ);
ahc_outb(ahc, SCSISEQ, scsiseq | SCSIRSTO);
ahc_flush_device_writes(ahc);
- ahc_delay(AHC_BUSRESET_DELAY);
+ aic_delay(AHC_BUSRESET_DELAY);
/* Turn off the bus reset */
ahc_outb(ahc, SCSISEQ, scsiseq & ~SCSIRSTO);
@@ -6078,7 +6078,7 @@ ahc_calc_residual(struct ahc_softc *ahc, struct scb *scb)
*/
hscb = scb->hscb;
- sgptr = ahc_le32toh(hscb->sgptr);
+ sgptr = aic_le32toh(hscb->sgptr);
if ((sgptr & SG_RESID_VALID) == 0)
/* Case 1 */
return;
@@ -6089,7 +6089,7 @@ ahc_calc_residual(struct ahc_softc *ahc, struct scb *scb)
return;
spkt = &hscb->shared_data.status;
- resid_sgptr = ahc_le32toh(spkt->residual_sg_ptr);
+ resid_sgptr = aic_le32toh(spkt->residual_sg_ptr);
if ((sgptr & SG_FULL_RESID) != 0) {
/* Case 3 */
resid = ahc_get_transfer_length(scb);
@@ -6105,7 +6105,7 @@ ahc_calc_residual(struct ahc_softc *ahc, struct scb *scb)
* Remainder of the SG where the transfer
* stopped.
*/
- resid = ahc_le32toh(spkt->residual_datacnt) & AHC_SG_LEN_MASK;
+ resid = aic_le32toh(spkt->residual_datacnt) & AHC_SG_LEN_MASK;
sg = ahc_sg_bus_to_virt(scb, resid_sgptr & SG_PTR_MASK);
/* The residual sg_ptr always points to the next sg */
@@ -6116,9 +6116,9 @@ ahc_calc_residual(struct ahc_softc *ahc, struct scb *scb)
* SG segments that are after the SG where
* the transfer stopped.
*/
- while ((ahc_le32toh(sg->len) & AHC_DMA_LAST_SEG) == 0) {
+ while ((aic_le32toh(sg->len) & AHC_DMA_LAST_SEG) == 0) {
sg++;
- resid += ahc_le32toh(sg->len) & AHC_SG_LEN_MASK;
+ resid += aic_le32toh(sg->len) & AHC_SG_LEN_MASK;
}
}
if ((scb->flags & SCB_SENSE) == 0)
@@ -6404,7 +6404,7 @@ ahc_download_instr(struct ahc_softc *ahc, u_int instrptr, uint8_t *dconsts)
/*
* The firmware is always compiled into a little endian format.
*/
- instr.integer = ahc_le32toh(*(uint32_t*)&seqprog[instrptr * 4]);
+ instr.integer = aic_le32toh(*(uint32_t*)&seqprog[instrptr * 4]);
fmt1_ins = &instr.format1;
fmt3_ins = NULL;
@@ -6509,7 +6509,7 @@ ahc_download_instr(struct ahc_softc *ahc, u_int instrptr, uint8_t *dconsts)
}
}
/* The sequencer is a little endian cpu */
- instr.integer = ahc_htole32(instr.integer);
+ instr.integer = aic_htole32(instr.integer);
ahc_outsb(ahc, SEQRAM, instr.bytes, 4);
break;
default:
diff --git a/sys/dev/ic/aic7xxx_cam.h b/sys/dev/ic/aic7xxx_cam.h
index 9c4ae863c10..3e53cd288c8 100644
--- a/sys/dev/ic/aic7xxx_cam.h
+++ b/sys/dev/ic/aic7xxx_cam.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: aic7xxx_cam.h,v 1.3 2004/10/24 01:36:49 krw Exp $ */
+/* $OpenBSD: aic7xxx_cam.h,v 1.4 2004/10/24 04:28:33 krw Exp $ */
/* $NetBSD: aic7xxx_cam.h,v 1.3 2003/04/20 11:17:20 fvdl Exp $ */
/*
@@ -97,6 +97,22 @@
timeout_add((timer), (timeout)); \
} while (0)
+#define aic_delay DELAY
+
+#define aic_htobe16(x) htobe16(x)
+#define aic_htobe32(x) htobe32(x)
+#define aic_htobe64(x) htobe64(x)
+#define aic_htole16(x) htole16(x)
+#define aic_htole32(x) htole32(x)
+#define aic_htole64(x) htole64(x)
+
+#define aic_be16toh(x) be16toh(x)
+#define aic_be32toh(x) be32toh(x)
+#define aic_be64toh(x) be64toh(x)
+#define aic_le16toh(x) letoh16(x)
+#define aic_le32toh(x) letoh32(x)
+#define aic_le64toh(x) letoh64(x)
+
#define xs_control flags
#define xs_callout stimeout
#define xs_status status
diff --git a/sys/dev/ic/aic7xxx_inline.h b/sys/dev/ic/aic7xxx_inline.h
index 46a1631b52c..4d61cf86356 100644
--- a/sys/dev/ic/aic7xxx_inline.h
+++ b/sys/dev/ic/aic7xxx_inline.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: aic7xxx_inline.h,v 1.8 2004/08/01 01:36:23 krw Exp $ */
+/* $OpenBSD: aic7xxx_inline.h,v 1.9 2004/10/24 04:28:33 krw Exp $ */
/* $NetBSD: aic7xxx_inline.h,v 1.4 2003/11/02 11:07:44 wiz Exp $ */
/*
@@ -278,7 +278,7 @@ ahc_update_residual(struct ahc_softc *ahc, struct scb *scb)
{
uint32_t sgptr;
- sgptr = ahc_le32toh(scb->hscb->sgptr);
+ sgptr = aic_le32toh(scb->hscb->sgptr);
if ((sgptr & SG_RESID_VALID) != 0)
ahc_calc_residual(ahc, scb);
}
@@ -433,7 +433,7 @@ ahc_swap_with_next_hscb(struct ahc_softc *ahc, struct scb *scb)
memcpy(q_hscb, scb->hscb, sizeof(*scb->hscb));
if ((scb->flags & SCB_CDB32_PTR) != 0) {
q_hscb->shared_data.cdb_ptr =
- ahc_htole32(ahc_hscb_busaddr(ahc, q_hscb->tag)
+ aic_htole32(ahc_hscb_busaddr(ahc, q_hscb->tag)
+ offsetof(struct hardware_scb, cdb32));
}
q_hscb->tag = saved_tag;
diff --git a/sys/dev/ic/aic7xxx_openbsd.c b/sys/dev/ic/aic7xxx_openbsd.c
index 82c5ef6e1c1..664fe3f1dfe 100644
--- a/sys/dev/ic/aic7xxx_openbsd.c
+++ b/sys/dev/ic/aic7xxx_openbsd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: aic7xxx_openbsd.c,v 1.24 2004/09/24 14:56:56 henning Exp $ */
+/* $OpenBSD: aic7xxx_openbsd.c,v 1.25 2004/10/24 04:28:33 krw Exp $ */
/* $NetBSD: aic7xxx_osm.c,v 1.14 2003/11/02 11:07:44 wiz Exp $ */
/*
@@ -302,7 +302,7 @@ ahc_done(struct ahc_softc *ahc, struct scb *scb)
*/
memset(&xs->sense, 0, sizeof(struct scsi_sense_data));
memcpy(&xs->sense, ahc_get_sense_buf(ahc, scb),
- ahc_le32toh(scb->sg_list->len) & AHC_SG_LEN_MASK);
+ aic_le32toh(scb->sg_list->len) & AHC_SG_LEN_MASK);
xs->error = XS_SENSE;
}
@@ -414,10 +414,10 @@ ahc_execute_scb(void *arg, bus_dma_segment_t *dm_segs, int nsegments)
while (dm_segs < end_seg) {
uint32_t len;
- sg->addr = ahc_htole32(dm_segs->ds_addr);
+ sg->addr = aic_htole32(dm_segs->ds_addr);
len = dm_segs->ds_len
| ((dm_segs->ds_addr >> 8) & 0x7F000000);
- sg->len = ahc_htole32(len);
+ sg->len = aic_htole32(len);
sg++;
dm_segs++;
}
@@ -428,7 +428,7 @@ ahc_execute_scb(void *arg, bus_dma_segment_t *dm_segs, int nsegments)
* sequencer will clear as soon as a data transfer
* occurs.
*/
- scb->hscb->sgptr = ahc_htole32(scb->sg_list_phys|SG_FULL_RESID);
+ scb->hscb->sgptr = aic_htole32(scb->sg_list_phys|SG_FULL_RESID);
if ((xs->flags & SCSI_DATA_IN) != 0)
op = BUS_DMASYNC_PREREAD;
@@ -439,7 +439,7 @@ ahc_execute_scb(void *arg, bus_dma_segment_t *dm_segs, int nsegments)
scb->dmamap->dm_mapsize, op);
sg--;
- sg->len |= ahc_htole32(AHC_DMA_LAST_SEG);
+ sg->len |= aic_htole32(AHC_DMA_LAST_SEG);
bus_dmamap_sync(ahc->parent_dmat, scb->sg_map->sg_dmamap,
0, scb->sg_map->sg_dmamap->dm_mapsize,
@@ -449,7 +449,7 @@ ahc_execute_scb(void *arg, bus_dma_segment_t *dm_segs, int nsegments)
scb->hscb->dataptr = scb->sg_list->addr;
scb->hscb->datacnt = scb->sg_list->len;
} else {
- scb->hscb->sgptr = ahc_htole32(SG_LIST_NULL);
+ scb->hscb->sgptr = aic_htole32(SG_LIST_NULL);
scb->hscb->dataptr = 0;
scb->hscb->datacnt = 0;
}
diff --git a/sys/dev/ic/aic7xxx_openbsd.h b/sys/dev/ic/aic7xxx_openbsd.h
index c772ea9d309..ea58e6d688a 100644
--- a/sys/dev/ic/aic7xxx_openbsd.h
+++ b/sys/dev/ic/aic7xxx_openbsd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: aic7xxx_openbsd.h,v 1.12 2004/08/01 01:36:23 krw Exp $ */
+/* $OpenBSD: aic7xxx_openbsd.h,v 1.13 2004/10/24 04:28:33 krw Exp $ */
/* $NetBSD: aic7xxx_osm.h,v 1.7 2003/11/02 11:07:44 wiz Exp $ */
/*
@@ -141,21 +141,6 @@ struct scb_platform_data {
#define ISABUS_DMA_32BIT BUS_DMA_BUS1
#endif
-/********************************* Byte Order *********************************/
-#define ahc_htobe16(x) htobe16(x)
-#define ahc_htobe32(x) htobe32(x)
-#define ahc_htobe64(x) htobe64(x)
-#define ahc_htole16(x) htole16(x)
-#define ahc_htole32(x) htole32(x)
-#define ahc_htole64(x) htole64(x)
-
-#define ahc_be16toh(x) betoh16(x)
-#define ahc_be32toh(x) betoh32(x)
-#define ahc_be64toh(x) betoh64(x)
-#define ahc_le16toh(x) letoh16(x)
-#define ahc_le32toh(x) letoh32(x)
-#define ahc_le64toh(x) letoh64(x)
-
/************************** Timer DataStructures ******************************/
typedef struct timeout ahc_timer_t;
@@ -274,7 +259,6 @@ ahc_list_unlock(int *flags)
{
}
/****************************** OS Primitives *********************************/
-#define ahc_delay DELAY
/************************** Transaction Operations ****************************/
static __inline void ahc_set_transaction_status(struct scb *, uint32_t);
diff --git a/sys/dev/ic/aic7xxx_seeprom.c b/sys/dev/ic/aic7xxx_seeprom.c
index 7bfeeb6c567..1e8e231c8d3 100644
--- a/sys/dev/ic/aic7xxx_seeprom.c
+++ b/sys/dev/ic/aic7xxx_seeprom.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: aic7xxx_seeprom.c,v 1.2 2004/10/12 22:09:37 krw Exp $ */
+/* $OpenBSD: aic7xxx_seeprom.c,v 1.3 2004/10/24 04:28:33 krw Exp $ */
/* $NetBSD: aic7xxx_seeprom.c,v 1.8 2003/05/02 19:12:19 dyoung Exp $ */
/*
@@ -47,7 +47,7 @@
* from the FreeBSD source file aic7xxx_pci.c by Frank van der Linden
* <fvdl@netbsd.org>
*
- * $Id: aic7xxx_seeprom.c,v 1.2 2004/10/12 22:09:37 krw Exp $
+ * $Id: aic7xxx_seeprom.c,v 1.3 2004/10/24 04:28:33 krw Exp $
*
* $FreeBSD: src/sys/dev/aic7xxx/aic7xxx_pci.c,v 1.22 2003/01/20 20:44:55 gibbs Exp $
*/
@@ -683,7 +683,7 @@ ahc_acquire_seeprom(struct ahc_softc *ahc, struct seeprom_descriptor *sd)
SEEPROM_OUTB(sd, sd->sd_MS);
wait = 1000; /* 1 second timeout in msec */
while (--wait && ((SEEPROM_STATUS_INB(sd) & sd->sd_RDY) == 0)) {
- ahc_delay(1000); /* delay 1 msec */
+ aic_delay(1000); /* delay 1 msec */
}
if ((SEEPROM_STATUS_INB(sd) & sd->sd_RDY) == 0) {
SEEPROM_OUTB(sd, 0);