#include <errno.h>
#include <time.h>
#include <arpa/inet.h>
-#include "../../../config_file/config_file.h"
+#include "config_file/config_file.h"
#include "ide.h"
#define IDE_IDLE 0
#define IDE_CMD 1
#define IDE_DATA_IN 2
#define IDE_DATA_OUT 3
-
+
#define DCR_NIEN 2
#define DCR_SRST 4
uint16_t cyl;
if (d->controller->lba4 & DEVH_LBA) {
-/* fprintf(stderr, "XLATE LBA %02X:%02X:%02X:%02X\n",
+/* fprintf(stderr, "XLATE LBA %02X:%02X:%02X:%02X\n",
t->lba4, t->lba3, t->lba2, t->lba1);*/
if (d->lba)
return ((d->header_present) ? 2 : 0) + (((t->drive->controller->lba4 & DEVH_HEAD) << 24) | (t->drive->controller->lba3 << 16) | (t->drive->controller->lba2 << 8) | t->drive->controller->lba1);
c->drive[0].taskfile.status |= ST_BSY;
if (c->drive[1].present)
c->drive[1].taskfile.status |= ST_BSY;
-}
+}
static void ide_srst_end(struct ide_controller *c)
{
if (d->dptr == d->data + 512) {
if (ide_write_sector(d) < 0) {
ide_set_error(d);
- return;
+ return;
}
d->length--;
d->intrq = 1;
t->status |= ST_BSY;
t->error = 0;
t->drive->state = IDE_CMD;
-
+
/* We could complete with delays but don't do so yet */
switch(t->command) {
case IDE_CMD_EDD: /* 0x90 */
c->lba4 = v & (DEVH_HEAD|/*DEVH_DEV|*/DEVH_LBA);
break;
case ide_command_w:
- t->command = v;
+ t->command = v;
ide_issue_command(t);
break;
case ide_devctrl_w:
/*
* Free up and release and IDE controller
- */
+ */
void ide_free(struct ide_controller *c)
{
if (c->drive[0].present)
}
if (reg == ide_data)
d |= (c->data_latch << 8);
- ide_write16(c, reg, d);
+ ide_write16(c, reg, d);
}
static void make_ascii(uint16_t *p, const char *t, int len)
*d = d[1];
d[1] = c;
d += 2;
- }
+ }
}
static void make_serial(uint16_t *p)
if (type < 1 || type > MAX_DRIVE_TYPE)
return -2;
-
+
memset(ident, 0, 512);
memcpy(ident, ide_magic, 8);
if (write(fd, ident, 512) != 512)
ident[47] = 0; /* no read multi for now */
ident[51] = le16(240 /* PIO2 */ << 8); /* PIO cycle time */
ident[53] = le16(1); /* Geometry words are valid */
-
+
switch(type) {
case ACME_ROADRUNNER:
/* 504MB drive with LBA support */
make_ascii(ident + 23, "A001.001", 8);
make_ascii(ident + 27, "ACME ROADRUNNER v0.1", 40);
ident[49] = le16(1 << 9); /* LBA */
- break;
+ break;
case ACME_ULTRASONICUS:
/* 40MB drive with LBA support */
c = 977;
s = 16;
make_ascii(ident + 23, "A001.001", 8);
make_ascii(ident + 27, "ACME COYOTE v0.1", 40);
- break;
+ break;
case ACME_ACCELLERATTI:
c = 1024;
h = 16;
ident[61] = ident[58];
if (write(fd, ident, 512) != 512)
return -1;
-
+
memset(ident, 0xE5, 512);
while(sectors--)
if (write(fd, ident, 512) != 512)
- return -1;
+ return -1;
return 0;
}