1/*- 2 * Copyright (c) 1998 - 2007 S�ren Schmidt <sos@FreeBSD.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> |
28__FBSDID("$FreeBSD: head/sys/dev/ata/ata-all.c 166909 2007-02-23 16:25:08Z jhb $"); |
29 30#include "opt_ata.h" 31#include <sys/param.h> 32#include <sys/systm.h> 33#include <sys/ata.h> 34#include <sys/kernel.h> 35#include <sys/module.h> 36#include <sys/endian.h> --- 80 unchanged lines hidden (view full) --- 117 bzero(&ch->state_mtx, sizeof(struct mtx)); 118 mtx_init(&ch->state_mtx, "ATA state lock", NULL, MTX_DEF); 119 bzero(&ch->queue_mtx, sizeof(struct mtx)); 120 mtx_init(&ch->queue_mtx, "ATA queue lock", NULL, MTX_DEF); 121 TAILQ_INIT(&ch->ata_queue); 122 123 /* reset the controller HW, the channel and device(s) */ 124 while (ATA_LOCKING(dev, ATA_LF_LOCK) != ch->unit) |
125 pause("ataatch", 1); |
126 ATA_RESET(dev); 127 ATA_LOCKING(dev, ATA_LF_UNLOCK); 128 129 /* setup interrupt delivery */ 130 rid = ATA_IRQ_RID; 131 ch->r_irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, 132 RF_SHAREABLE | RF_ACTIVE); 133 if (!ch->r_irq) { --- 57 unchanged lines hidden (view full) --- 191 if (!ch || !ch->r_irq) 192 return ENXIO; 193 194 if (bootverbose) 195 device_printf(dev, "reiniting channel ..\n"); 196 197 /* poll for locking the channel */ 198 while (ATA_LOCKING(dev, ATA_LF_LOCK) != ch->unit) |
199 pause("atarini", 1); |
200 201 /* catch eventual request in ch->running */ 202 mtx_lock(&ch->state_mtx); 203 if ((request = ch->running)) 204 callout_stop(&request->callout); 205 ch->running = NULL; 206 207 /* unconditionally grap the channel lock */ --- 611 unchanged lines hidden (view full) --- 819 820void 821ata_udelay(int interval) 822{ 823 /* for now just use DELAY, the timer/sleep subsytems are not there yet */ 824 if (1 || interval < (1000000/hz) || ata_delayed_attach) 825 DELAY(interval); 826 else |
827 pause("ataslp", interval/(1000000/hz)); |
828} 829 830char * 831ata_mode2str(int mode) 832{ 833 switch (mode) { 834 case -1: return "UNSUPPORTED"; 835 case ATA_PIO0: return "PIO0"; --- 211 unchanged lines hidden --- |