mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2025-12-05 15:15:44 +00:00
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:
@@ -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>
|
2009-10-15 Ralf Corsépius <ralf.corsepius@rtems.org>
|
||||||
|
|
||||||
* make/custom/pc386.cfg: New (relocated from /make/custom).
|
* make/custom/pc386.cfg: New (relocated from /make/custom).
|
||||||
|
|||||||
@@ -183,17 +183,17 @@ bool pc386_ide_probe
|
|||||||
void pc386_ide_initialize
|
void pc386_ide_initialize
|
||||||
(
|
(
|
||||||
/*-------------------------------------------------------------------------*\
|
/*-------------------------------------------------------------------------*\
|
||||||
| Purpose: |
|
| Purpose: |
|
||||||
| initialize IDE access |
|
| initialize IDE access |
|
||||||
+---------------------------------------------------------------------------+
|
+---------------------------------------------------------------------------+
|
||||||
| Input Parameters: |
|
| Input Parameters: |
|
||||||
\*-------------------------------------------------------------------------*/
|
\*-------------------------------------------------------------------------*/
|
||||||
int minor /* controller minor number */
|
int minor /* controller minor number */
|
||||||
)
|
)
|
||||||
/*-------------------------------------------------------------------------*\
|
/*-------------------------------------------------------------------------*\
|
||||||
| Return Value: |
|
| Return Value: |
|
||||||
| <none> |
|
| <none> |
|
||||||
\*=========================================================================*/
|
\*=========================================================================*/
|
||||||
{
|
{
|
||||||
uint32_t port = IDE_Controller_Table[minor].port1;
|
uint32_t port = IDE_Controller_Table[minor].port1;
|
||||||
uint8_t dev = 0;
|
uint8_t dev = 0;
|
||||||
@@ -213,6 +213,7 @@ void pc386_ide_initialize
|
|||||||
|
|
||||||
for (dev = 0; dev < 2; dev++)
|
for (dev = 0; dev < 2; dev++)
|
||||||
{
|
{
|
||||||
|
uint16_t capabilities = 0;
|
||||||
uint32_t byte;
|
uint32_t byte;
|
||||||
uint8_t status;
|
uint8_t status;
|
||||||
uint8_t error;
|
uint8_t error;
|
||||||
@@ -224,8 +225,10 @@ void pc386_ide_initialize
|
|||||||
uint32_t cylinders = 0;
|
uint32_t cylinders = 0;
|
||||||
uint32_t heads = 0;
|
uint32_t heads = 0;
|
||||||
uint32_t sectors = 0;
|
uint32_t sectors = 0;
|
||||||
|
uint32_t lba_sectors = 0;
|
||||||
char model_number[41];
|
char model_number[41];
|
||||||
char* p = &model_number[0];
|
char* p = &model_number[0];
|
||||||
|
bool data_ready;
|
||||||
|
|
||||||
memset(model_number, 0, sizeof(model_number));
|
memset(model_number, 0, sizeof(model_number));
|
||||||
|
|
||||||
@@ -265,12 +268,6 @@ void pc386_ide_initialize
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
byte = 0;
|
|
||||||
while (byte < 512)
|
|
||||||
{
|
|
||||||
uint16_t word;
|
|
||||||
bool data_ready;
|
|
||||||
|
|
||||||
data_ready = pc386_ide_status_data_ready (port,
|
data_ready = pc386_ide_status_data_ready (port,
|
||||||
250,
|
250,
|
||||||
&status,
|
&status,
|
||||||
@@ -283,17 +280,25 @@ void pc386_ide_initialize
|
|||||||
{
|
{
|
||||||
if (pc386_ide_show)
|
if (pc386_ide_show)
|
||||||
printk("IDE%d:%s: error=%04x\n", minor, label, error);
|
printk("IDE%d:%s: error=%04x\n", minor, label, error);
|
||||||
break;
|
continue;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* The device is an ATAPI device.
|
* The device is an ATAPI device.
|
||||||
*/
|
*/
|
||||||
outport_byte(port+IDE_REGISTER_COMMAND, 0xa1);
|
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)
|
if (!data_ready)
|
||||||
break;
|
continue;
|
||||||
|
|
||||||
|
byte = 0;
|
||||||
|
while (byte < 512)
|
||||||
|
{
|
||||||
|
uint16_t word;
|
||||||
|
|
||||||
if (pc386_ide_show && ((byte % 16) == 0))
|
if (pc386_ide_show && ((byte % 16) == 0))
|
||||||
printk("\n %04x : ", byte);
|
printk("\n %04x : ", byte);
|
||||||
@@ -318,18 +323,23 @@ void pc386_ide_initialize
|
|||||||
p++;
|
p++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (byte == 94)
|
|
||||||
max_multiple_sectors = word & 0xff;
|
|
||||||
|
|
||||||
if (byte == (47 * 2))
|
if (byte == (47 * 2))
|
||||||
max_multiple_sectors = word & 0xff;
|
max_multiple_sectors = word & 0xff;
|
||||||
|
|
||||||
|
if (byte == (49 * 2))
|
||||||
|
capabilities = word;
|
||||||
|
|
||||||
if (byte == (59 * 2))
|
if (byte == (59 * 2))
|
||||||
{
|
{
|
||||||
if (word & (1 << 8))
|
if (word & (1 << 8))
|
||||||
cur_multiple_sectors = word & 0xff;
|
cur_multiple_sectors = word & 0xff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (byte == (60 * 2))
|
||||||
|
lba_sectors = word;
|
||||||
|
if (byte == (61 * 2))
|
||||||
|
lba_sectors |= word << 16;
|
||||||
|
|
||||||
byte += 2;
|
byte += 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -343,7 +353,12 @@ void pc386_ide_initialize
|
|||||||
uint32_t right;
|
uint32_t right;
|
||||||
char units;
|
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))
|
if (size > (1024 * 1024))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -33,6 +33,7 @@
|
|||||||
#include <wd80x3.h>
|
#include <wd80x3.h>
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
@@ -1189,16 +1190,32 @@ rtems_ne_driver_attach (struct rtems_bsdnet_ifconfig *config, int attach)
|
|||||||
if (config->irno != 0)
|
if (config->irno != 0)
|
||||||
sc->irno = config->irno;
|
sc->irno = config->irno;
|
||||||
else {
|
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. */
|
/* We use 5 as the default IRQ. */
|
||||||
sc->irno = 5;
|
sc->irno = 5;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (config->port != 0)
|
if (config->port != 0)
|
||||||
sc->port = config->port;
|
sc->port = config->port;
|
||||||
else {
|
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. */
|
/* We use 0x300 as the default IO port number. */
|
||||||
sc->port = 0x300;
|
sc->port = 0x300;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
sc->accept_broadcasts = ! config->ignore_broadcast;
|
sc->accept_broadcasts = ! config->ignore_broadcast;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user