2009-10-15 Chris Johns <chrisj@rtems.org>

* ne2000/ne2000.c: Add --ne2k-irq and --ne2k-port boot command
        line configure options.

        * ide/ide.c: Fix a bug which left 4 words in the buffer of the
        disk. Some devices do not follow the standard and terminate the
        command which a new command occurs and/or low data ready when data
        is still to be read.
This commit is contained in:
Chris Johns
2009-10-15 06:30:08 +00:00
parent ccf89a6209
commit 4c397641a8
3 changed files with 86 additions and 44 deletions

View File

@@ -1,3 +1,13 @@
2009-10-15 Chris Johns <chrisj@rtems.org>
* ne2000/ne2000.c: Add --ne2k-irq and --ne2k-port boot command
line configure options.
* ide/ide.c: Fix a bug which left 4 words in the buffer of the
disk. Some devices do not follow the standard and terminate the
command which a new command occurs and/or low data ready when data
is still to be read.
2009-10-15 Ralf Corsépius <ralf.corsepius@rtems.org>
* make/custom/pc386.cfg: New (relocated from /make/custom).

View File

@@ -183,17 +183,17 @@ bool pc386_ide_probe
void pc386_ide_initialize
(
/*-------------------------------------------------------------------------*\
| Purpose: |
| initialize IDE access |
+---------------------------------------------------------------------------+
| Input Parameters: |
\*-------------------------------------------------------------------------*/
| Purpose: |
| initialize IDE access |
+---------------------------------------------------------------------------+
| Input Parameters: |
\*-------------------------------------------------------------------------*/
int minor /* controller minor number */
)
/*-------------------------------------------------------------------------*\
| Return Value: |
| <none> |
\*=========================================================================*/
| Return Value: |
| <none> |
\*=========================================================================*/
{
uint32_t port = IDE_Controller_Table[minor].port1;
uint8_t dev = 0;
@@ -213,6 +213,7 @@ void pc386_ide_initialize
for (dev = 0; dev < 2; dev++)
{
uint16_t capabilities = 0;
uint32_t byte;
uint8_t status;
uint8_t error;
@@ -224,8 +225,10 @@ void pc386_ide_initialize
uint32_t cylinders = 0;
uint32_t heads = 0;
uint32_t sectors = 0;
uint32_t lba_sectors = 0;
char model_number[41];
char* p = &model_number[0];
bool data_ready;
memset(model_number, 0, sizeof(model_number));
@@ -265,12 +268,6 @@ void pc386_ide_initialize
continue;
}
byte = 0;
while (byte < 512)
{
uint16_t word;
bool data_ready;
data_ready = pc386_ide_status_data_ready (port,
250,
&status,
@@ -283,17 +280,25 @@ void pc386_ide_initialize
{
if (pc386_ide_show)
printk("IDE%d:%s: error=%04x\n", minor, label, error);
break;
continue;
}
/*
* The device is an ATAPI device.
*/
outport_byte(port+IDE_REGISTER_COMMAND, 0xa1);
continue;
data_ready = pc386_ide_status_data_ready (port,
250,
&status,
pc386_ide_prestart_sleep);
}
if (!data_ready)
break;
continue;
byte = 0;
while (byte < 512)
{
uint16_t word;
if (pc386_ide_show && ((byte % 16) == 0))
printk("\n %04x : ", byte);
@@ -318,18 +323,23 @@ void pc386_ide_initialize
p++;
}
if (byte == 94)
max_multiple_sectors = word & 0xff;
if (byte == (47 * 2))
max_multiple_sectors = word & 0xff;
if (byte == (49 * 2))
capabilities = word;
if (byte == (59 * 2))
{
if (word & (1 << 8))
cur_multiple_sectors = word & 0xff;
}
if (byte == (60 * 2))
lba_sectors = word;
if (byte == (61 * 2))
lba_sectors |= word << 16;
byte += 2;
}
@@ -343,7 +353,12 @@ void pc386_ide_initialize
uint32_t right;
char units;
size = ((((uint64_t) cylinders) * heads) * sectors * 512) / 1024;
if (capabilities & (1 << 9))
size = lba_sectors;
else
size = cylinders * heads * sectors;
size /= 2;
if (size > (1024 * 1024))
{

View File

@@ -33,6 +33,7 @@
#include <wd80x3.h>
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <errno.h>
@@ -1189,16 +1190,32 @@ rtems_ne_driver_attach (struct rtems_bsdnet_ifconfig *config, int attach)
if (config->irno != 0)
sc->irno = config->irno;
else {
const char* opt;
opt = bsp_cmdline_arg ("--ne2k-irq=");
if (opt) {
opt += sizeof ("--ne2k-irq=") - 1;
sc->irno = strtoul (opt, 0, 0);
}
if (sc->irno == 0) {
/* We use 5 as the default IRQ. */
sc->irno = 5;
}
}
if (config->port != 0)
sc->port = config->port;
else {
const char* opt;
opt = bsp_cmdline_arg ("--ne2k-port=");
if (opt) {
opt += sizeof ("--ne2k-port=") - 1;
sc->port = strtoul (opt, 0, 0);
}
if (config->port != 0) {
/* We use 0x300 as the default IO port number. */
sc->port = 0x300;
}
}
sc->accept_broadcasts = ! config->ignore_broadcast;