Lines Matching refs:device

207 unsigned char atapi_issue(int device, unsigned char *ccb, int ccblen,  in atapi_issue()  argument
217 ide_outb(device, ATA_DEV_HD, ATA_LBA | ATA_DEVICE(device)); in atapi_issue()
218 c = atapi_wait_mask(device, ATAPI_TIME_OUT, mask, res); in atapi_issue()
220 printf("ATAPI_ISSUE: device %d not ready status %X\n", device, in atapi_issue()
226 ide_outb(device, ATA_ERROR_REG, 0); /* no DMA, no overlaped */ in atapi_issue()
227 ide_outb(device, ATA_SECT_CNT, 0); in atapi_issue()
228 ide_outb(device, ATA_SECT_NUM, 0); in atapi_issue()
229 ide_outb(device, ATA_CYL_LOW, (unsigned char) (buflen & 0xFF)); in atapi_issue()
230 ide_outb(device, ATA_CYL_HIGH, in atapi_issue()
232 ide_outb(device, ATA_DEV_HD, ATA_LBA | ATA_DEVICE(device)); in atapi_issue()
234 ide_outb(device, ATA_COMMAND, ATAPI_CMD_PACKET); in atapi_issue()
239 c = atapi_wait_mask(device, ATAPI_TIME_OUT, mask, res); in atapi_issue()
243 device, c); in atapi_issue()
249 ide_output_data_shorts(device, (unsigned short *)ccb, ccblen / 2); in atapi_issue()
262 c = atapi_wait_mask(device, ATAPI_TIME_OUT, mask, res); in atapi_issue()
265 err = (ide_inb(device, ATA_ERROR_REG)) >> 4; in atapi_issue()
275 n = ide_inb(device, ATA_CYL_HIGH); in atapi_issue()
277 n += ide_inb(device, ATA_CYL_LOW); in atapi_issue()
298 if ((ide_inb(device, ATA_SECT_CNT) & 0x02) == 0) { in atapi_issue()
300 ide_output_data_shorts(device, (unsigned short *)buffer, in atapi_issue()
304 ide_input_data_shorts(device, (unsigned short *)buffer, in atapi_issue()
311 c = atapi_wait_mask(device, ATAPI_TIME_OUT, mask, res); in atapi_issue()
313 err = (ide_inb(device, ATA_ERROR_REG) >> 4); in atapi_issue()
331 unsigned char atapi_issue_autoreq(int device, in atapi_issue_autoreq() argument
344 res = atapi_issue(device, ccb, ccblen, buffer, buflen); in atapi_issue_autoreq()
358 res = atapi_issue(device, sense_ccb, 12, sense_data, 18); in atapi_issue_autoreq()
412 int device = block_dev->devnum; in atapi_read() local
418 " buffer at %lX\n", device, blknr, blkcnt, (ulong) buffer); in atapi_read()
439 if (atapi_issue_autoreq(device, ccb, 12, in atapi_read()
458 int device; in atapi_inquiry() local
460 device = dev_desc->devnum; in atapi_inquiry()
471 c = atapi_issue_autoreq(device, ccb, 12, (unsigned char *)iobuf, 40); in atapi_inquiry()
498 c = atapi_issue_autoreq(device, ccb, 12, (unsigned char *)iobuf, 0); in atapi_inquiry()
506 c = atapi_issue_autoreq(device, ccb, 12, (unsigned char *)iobuf, 0); in atapi_inquiry()
515 c = atapi_issue_autoreq(device, ccb, 12, (unsigned char *)iobuf, 8); in atapi_inquiry()
548 int device; in ide_ident() local
550 device = dev_desc->devnum; in ide_ident()
551 printf(" Device %d: ", device); in ide_ident()
555 ide_outb(device, ATA_DEV_HD, ATA_LBA | ATA_DEVICE(device)); in ide_ident()
564 if ((ide_inb(device, ATA_SECT_CNT) == 0x01) && in ide_ident()
565 (ide_inb(device, ATA_SECT_NUM) == 0x01) && in ide_ident()
566 (ide_inb(device, ATA_CYL_LOW) == 0x14) && in ide_ident()
567 (ide_inb(device, ATA_CYL_HIGH) == 0xEB)) { in ide_ident()
573 ide_outb(device, ATA_COMMAND, ATAPI_CMD_IDENT); in ide_ident()
578 c = ide_wait(device, ATAPI_TIME_OUT); in ide_ident()
585 ide_outb(device, ATA_COMMAND, ATA_CMD_IDENT); in ide_ident()
590 c = ide_wait(device, IDE_TIME_OUT); in ide_ident()
602 ide_outb(device, ATA_DEV_HD, in ide_ident()
603 ATA_LBA | ATA_DEVICE(device)); in ide_ident()
605 ide_outb(device, ATA_COMMAND, 0x08); in ide_ident()
611 ide_outb(device, ATA_DEV_HD, in ide_ident()
612 ATA_LBA | ATA_DEVICE(device)); in ide_ident()
627 ide_input_swap_data(device, (ulong *)&iop, ATA_SECTORWORDS); in ide_ident()
694 ide_outb(device, ATA_DEV_HD, ATA_LBA | ATA_DEVICE(device)); in ide_ident()
695 c = ide_wait(device, IDE_TIME_OUT); in ide_ident()
696 ide_outb(device, ATA_SECT_CNT, 1); in ide_ident()
697 ide_outb(device, ATA_LBA_LOW, 0); in ide_ident()
698 ide_outb(device, ATA_LBA_MID, 0); in ide_ident()
699 ide_outb(device, ATA_LBA_HIGH, 0); in ide_ident()
700 ide_outb(device, ATA_DEV_HD, ATA_LBA | ATA_DEVICE(device)); in ide_ident()
701 ide_outb(device, ATA_COMMAND, 0xe3); in ide_ident()
703 c = ide_wait(device, IDE_TIME_OUT); /* can't take over 500 ms */ in ide_ident()
941 int device = block_dev->devnum; in ide_read() local
955 device, blknr, blkcnt, (ulong) buffer); in ide_read()
959 ide_outb(device, ATA_DEV_HD, ATA_LBA | ATA_DEVICE(device)); in ide_read()
960 c = ide_wait(device, IDE_TIME_OUT); in ide_read()
963 printf("IDE read: device %d not ready\n", device); in ide_read()
969 ide_outb(device, ATA_COMMAND, ATA_CMD_CHK_PWR); in ide_read()
972 c = ide_wait(device, IDE_TIME_OUT); /* can't take over 500 ms */ in ide_read()
975 printf("IDE read: device %d not ready\n", device); in ide_read()
981 c = ide_inb(device, ATA_SECT_CNT); in ide_read()
989 c = ide_wait(device, IDE_TIME_OUT); in ide_read()
992 printf("IDE read: device %d not ready\n", device); in ide_read()
998 ide_outb(device, ATA_SECT_CNT, 0); in ide_read()
999 ide_outb(device, ATA_LBA_LOW, (blknr >> 24) & 0xFF); in ide_read()
1001 ide_outb(device, ATA_LBA_MID, (blknr >> 32) & 0xFF); in ide_read()
1002 ide_outb(device, ATA_LBA_HIGH, (blknr >> 40) & 0xFF); in ide_read()
1004 ide_outb(device, ATA_LBA_MID, 0); in ide_read()
1005 ide_outb(device, ATA_LBA_HIGH, 0); in ide_read()
1009 ide_outb(device, ATA_SECT_CNT, 1); in ide_read()
1010 ide_outb(device, ATA_LBA_LOW, (blknr >> 0) & 0xFF); in ide_read()
1011 ide_outb(device, ATA_LBA_MID, (blknr >> 8) & 0xFF); in ide_read()
1012 ide_outb(device, ATA_LBA_HIGH, (blknr >> 16) & 0xFF); in ide_read()
1016 ide_outb(device, ATA_DEV_HD, in ide_read()
1017 ATA_LBA | ATA_DEVICE(device)); in ide_read()
1018 ide_outb(device, ATA_COMMAND, ATA_CMD_READ_EXT); in ide_read()
1023 ide_outb(device, ATA_DEV_HD, ATA_LBA | in ide_read()
1024 ATA_DEVICE(device) | ((blknr >> 24) & 0xF)); in ide_read()
1025 ide_outb(device, ATA_COMMAND, ATA_CMD_READ); in ide_read()
1032 c = ide_wait(device, IDE_SPIN_UP_TIME_OUT); in ide_read()
1036 c = ide_wait(device, IDE_TIME_OUT); in ide_read()
1042 ": status %#02x\n", device, blknr, c); in ide_read()
1046 ide_input_data(device, buffer, ATA_SECTORWORDS); in ide_read()
1047 (void) ide_inb(device, ATA_STATUS); /* clear IRQ */ in ide_read()
1068 int device = block_dev->devnum; in ide_write() local
1083 ide_outb(device, ATA_DEV_HD, ATA_LBA | ATA_DEVICE(device)); in ide_write()
1086 c = ide_wait(device, IDE_TIME_OUT); in ide_write()
1089 printf("IDE read: device %d not ready\n", device); in ide_write()
1095 ide_outb(device, ATA_SECT_CNT, 0); in ide_write()
1096 ide_outb(device, ATA_LBA_LOW, (blknr >> 24) & 0xFF); in ide_write()
1098 ide_outb(device, ATA_LBA_MID, (blknr >> 32) & 0xFF); in ide_write()
1099 ide_outb(device, ATA_LBA_HIGH, (blknr >> 40) & 0xFF); in ide_write()
1101 ide_outb(device, ATA_LBA_MID, 0); in ide_write()
1102 ide_outb(device, ATA_LBA_HIGH, 0); in ide_write()
1106 ide_outb(device, ATA_SECT_CNT, 1); in ide_write()
1107 ide_outb(device, ATA_LBA_LOW, (blknr >> 0) & 0xFF); in ide_write()
1108 ide_outb(device, ATA_LBA_MID, (blknr >> 8) & 0xFF); in ide_write()
1109 ide_outb(device, ATA_LBA_HIGH, (blknr >> 16) & 0xFF); in ide_write()
1113 ide_outb(device, ATA_DEV_HD, in ide_write()
1114 ATA_LBA | ATA_DEVICE(device)); in ide_write()
1115 ide_outb(device, ATA_COMMAND, ATA_CMD_WRITE_EXT); in ide_write()
1120 ide_outb(device, ATA_DEV_HD, ATA_LBA | in ide_write()
1121 ATA_DEVICE(device) | ((blknr >> 24) & 0xF)); in ide_write()
1122 ide_outb(device, ATA_COMMAND, ATA_CMD_WRITE); in ide_write()
1128 c = ide_wait(device, IDE_TIME_OUT); in ide_write()
1133 ": status %#02x\n", device, blknr, c); in ide_write()
1137 ide_output_data(device, buffer, ATA_SECTORWORDS); in ide_write()
1138 c = ide_inb(device, ATA_STATUS); /* clear IRQ */ in ide_write()