more current params

IDE support for primary and secondary channels.

video support.

improved floppy and ide support.
This commit is contained in:
Ronald G. Minnich 2002-12-16 17:57:49 +00:00
commit 14342bf376
11 changed files with 192 additions and 29 deletions

View file

@ -9,6 +9,21 @@
static unsigned long offset;
/*
* ONE_TRACK is 18 sectors (18*512) which is
* really half the sectors for a track
* on a 2 head floppy. Unfortunately DISK_H1440_TRACK is defined
* in the floppy_subr.c C file and not in a header so we define
* it again here for clarity.
*/
#define DISK_H1440_SECT 18
#define ONE_TRACK DISK_H1440_SECT*512
static unsigned char buffer[ONE_TRACK];
static unsigned int block_num = 0;
static unsigned int first_fill = 1;
static byte_offset_t floppy_read_b(void *vdest, byte_offset_t offset, byte_offset_t count);
static int init_bytes(void)
{
offset = 0;
@ -23,7 +38,7 @@ static void fini_bytes(void)
static byte_offset_t read_bytes(void *vdest, byte_offset_t count)
{
byte_offset_t len;
len = floppy_read(vdest, offset, count);
len = floppy_read_b(vdest, offset, count);
if (len > 0) {
offset += len;
}
@ -42,3 +57,37 @@ static struct stream floppy_bytes __stream = {
.skip = skip_bytes,
.fini = fini_bytes,
};
static byte_offset_t floppy_read_b(void *vdest, byte_offset_t offset, byte_offset_t count)
{
byte_offset_t bytes = 0;
unsigned char *dest = vdest;
//printk_debug("floppy_read count = %x\n", count);
while (bytes < count) {
unsigned int byte_offset, len;
/* The block is not cached in memory or first time called */
if (block_num != offset / (ONE_TRACK) || first_fill) {
block_num = offset / (ONE_TRACK);
floppy_read(buffer, block_num*(ONE_TRACK), (ONE_TRACK));
first_fill = 0;
//printk_debug("floppy_read_b dest= 0x%x offset= %d block_num= %d\n", dest, offset, block_num);
}
byte_offset = offset % (ONE_TRACK);
len = (ONE_TRACK) - byte_offset;
if (len > (count - bytes)) {
len = (count - bytes);
}
memcpy(dest, buffer + byte_offset, len);
offset += len;
bytes += len;
dest += len;
}
return bytes;
}

View file

@ -16,19 +16,25 @@ extern int ide_init(void);
static unsigned long offset;
static int init_bytes(void)
{
int i;
int i,res;
printk_debug ("Trying polled ide\n");
printk_debug ("Waiting for ide disks to spin up\n");
printk_debug ("This is a hard coded delay and longer than necessary.\n");
for (i = 0; i < 15; i++) {
printk_debug(".");
printk_notice ("This is a hard coded delay and longer than necessary.\n");
for (i = 0; i < 2; i++) {
printk_notice (".");
delay(1);
}
printk_debug("\n");
printk_info ("\n");
#ifdef ONE_TRACK
offset = (ONE_TRACK*512);
#else
offset = 0x7e00;
return ide_init();
#endif
res = ide_init();
delay(1);
return res;
}
static void fini_bytes(void)
@ -39,7 +45,9 @@ static void fini_bytes(void)
static unsigned char buffer[512];
static unsigned int block_num = 0;
static unsigned int first_fill = 1;
#ifndef IDE_BOOT_DRIVE
#define IDE_BOOT_DRIVE 0
#endif
static byte_offset_t ide_read(void *vdest, byte_offset_t offset, byte_offset_t count)
{
byte_offset_t bytes = 0;
@ -54,10 +62,11 @@ static byte_offset_t ide_read(void *vdest, byte_offset_t offset, byte_offset_t c
/* The block is not cached in memory or frist time called */
if (block_num != offset / 512 || first_fill) {
block_num = offset / 512;
ide_read_sector(0, buffer, block_num,
printk_notice (".");
ide_read_sector(IDE_BOOT_DRIVE, buffer, block_num,
0, 512);
first_fill = 0;
#if 1
#if 0
//printk_debug("ide_read offset = %x\n", offset);
//printk_debug("ide_read block_num = %x\n", block_num);
for (i = 0; i < 16; i++) {