mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2025-11-16 12:34:45 +00:00
2003-03-25 Thomas Doerfler <Thomas.Doerfler@imd-systems.de>
PR 367/filesystem * Makefile.am, include/rtems/ide_part_table.h, src/ata.c, src/ide_part_table.c: Some bugs were still present in the DOSFS implementation: - FAT12 did not work properly on Big-Endian machines - Some synchronization and error handling problems were present - Some legal codings for EOC were not recognized
This commit is contained in:
@@ -18,14 +18,18 @@ $(PROJECT_INCLUDE)/rtems:
|
||||
|
||||
include_rtems_HEADERS = \
|
||||
include/rtems/bdbuf.h include/rtems/blkdev.h \
|
||||
include/rtems/diskdevs.h include/rtems/ramdisk.h
|
||||
include/rtems/diskdevs.h include/rtems/ramdisk.h \
|
||||
include/rtems/ata.h include/rtems/ata_internal.h \
|
||||
include/rtems/ide_part_table.h
|
||||
|
||||
PREINSTALL_FILES = $(PROJECT_INCLUDE)/rtems \
|
||||
$(include_rtems_HEADERS:include/%=$(PROJECT_INCLUDE)/%)
|
||||
|
||||
LIB = ${ARCH}/libblock.a
|
||||
|
||||
C_FILES = src/bdbuf.c src/blkdev.c src/diskdevs.c src/ramdisk.c
|
||||
C_FILES = src/bdbuf.c src/blkdev.c src/diskdevs.c src/ramdisk.c\
|
||||
src/ata.c src/ide_part_table.c
|
||||
|
||||
OBJS = $(C_FILES:src/%.c=${ARCH}/%.$(OBJEXT))
|
||||
|
||||
AM_CFLAGS += $(LIBC_DEFINES)
|
||||
|
||||
@@ -86,10 +86,17 @@ typedef struct sector_data_s
|
||||
|
||||
/*
|
||||
* Enum partition types
|
||||
* see list at http://ata-atapi.com/hiwtab.htm
|
||||
*/
|
||||
enum {
|
||||
EMPTY_PARTITION = 0,
|
||||
EXTENDED_PARTITION = 5,
|
||||
EMPTY_PARTITION = 0x00,
|
||||
DOS_FAT12_PARTITION = 0x01,
|
||||
DOS_FAT16_PARTITION = 0x04,
|
||||
EXTENDED_PARTITION = 0x05,
|
||||
DOS_P32MB_PARTITION = 0x06,
|
||||
FAT32_PARTITION = 0x0B,
|
||||
FAT32_LBA_PARTITION = 0x0C,
|
||||
FAT16_LBA_PARTITION = 0x0E,
|
||||
DM6_PARTITION = 0x54,
|
||||
EZD_PARTITION = 0x55,
|
||||
DM6_AUX1PARTITION = 0x51,
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include <errno.h>
|
||||
#include <chain.h>
|
||||
#include <assert.h>
|
||||
#include <string.h> /* for "memset" declaration */
|
||||
|
||||
#include <rtems/diskdevs.h>
|
||||
#include <rtems/blkdev.h>
|
||||
@@ -1152,36 +1153,32 @@ ata_initialize(rtems_device_major_number major,
|
||||
(unsigned8)(CF_LE_W(buffer[ATA_IDENT_WORD_MULT_SECS])) :
|
||||
0;
|
||||
|
||||
#ifndef ATA_DEV_IS_FLASH_DISK
|
||||
if ((CF_LE_W(buffer[ATA_IDENT_WORD_FIELD_VALIDITY]) &
|
||||
ATA_IDENT_BIT_VALID) == 0)
|
||||
ATA_IDENT_BIT_VALID) == 0) {
|
||||
/* no "supported modes" info -> use default */
|
||||
ATA_DEV_INFO(ctrl_minor, dev).mode_active = ATA_MODES_PIO3;
|
||||
}
|
||||
else {
|
||||
ATA_DEV_INFO(ctrl_minor, dev).modes_avaible =
|
||||
((CF_LE_W(buffer[64]) & 0x1) ? ATA_MODES_PIO3 : 0) |
|
||||
((CF_LE_W(buffer[64]) & 0x2) ? ATA_MODES_PIO4 : 0) |
|
||||
((CF_LE_W(buffer[63]) & 0x1) ? ATA_MODES_DMA0 : 0) |
|
||||
((CF_LE_W(buffer[63]) & 0x2) ?
|
||||
ATA_MODES_DMA0 | ATA_MODES_DMA1 : 0) |
|
||||
((CF_LE_W(buffer[63]) & 0x4) ?
|
||||
ATA_MODES_DMA0 | ATA_MODES_DMA1 | ATA_MODES_DMA2 : 0);
|
||||
if (ATA_DEV_INFO(ctrl_minor, dev).modes_avaible == 0)
|
||||
continue;
|
||||
#endif
|
||||
ATA_DEV_INFO(ctrl_minor, dev).modes_avaible =
|
||||
((CF_LE_W(buffer[64]) & 0x1) ? ATA_MODES_PIO3 : 0) |
|
||||
((CF_LE_W(buffer[64]) & 0x2) ? ATA_MODES_PIO4 : 0) |
|
||||
((CF_LE_W(buffer[63]) & 0x1) ? ATA_MODES_DMA0 : 0) |
|
||||
((CF_LE_W(buffer[63]) & 0x2) ?
|
||||
ATA_MODES_DMA0 | ATA_MODES_DMA1 : 0) |
|
||||
((CF_LE_W(buffer[63]) & 0x4) ?
|
||||
ATA_MODES_DMA0 | ATA_MODES_DMA1 | ATA_MODES_DMA2 : 0);
|
||||
|
||||
if (ATA_DEV_INFO(ctrl_minor, dev).modes_avaible == 0)
|
||||
continue;
|
||||
|
||||
/*
|
||||
* choose most appropriate ATA device data I/O speed supported by
|
||||
* the controller
|
||||
*/
|
||||
status = ide_controller_config_io_speed(
|
||||
/*
|
||||
* choose most appropriate ATA device data I/O speed supported
|
||||
* by the controller
|
||||
*/
|
||||
status = ide_controller_config_io_speed(
|
||||
ctrl_minor,
|
||||
ATA_DEV_INFO(ctrl_minor, dev).modes_avaible);
|
||||
if (status != RTEMS_SUCCESSFUL)
|
||||
if (status != RTEMS_SUCCESSFUL)
|
||||
continue;
|
||||
|
||||
#ifdef ATA_DEV_IS_FLASH_DISK
|
||||
ATA_DEV_INFO(ctrl_minor, dev).mode_active = ATA_MODES_PIO3;
|
||||
#endif
|
||||
}
|
||||
/*
|
||||
* Ok, let register new ATA device in the system
|
||||
*/
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
#include <rtems/ide_part_table.h>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
/*
|
||||
* get_sector --
|
||||
@@ -112,6 +112,29 @@ is_extended(unsigned8 type)
|
||||
return ((type == EXTENDED_PARTITION) || (type == LINUX_EXTENDED));
|
||||
}
|
||||
|
||||
/*
|
||||
* is_fat_partition --
|
||||
* checks if the partition type is defined for FAT
|
||||
*
|
||||
* PARAMETERS:
|
||||
* type - type of partition to check
|
||||
*
|
||||
* RETURNS:
|
||||
* TRUE if partition type is extended, FALSE otherwise
|
||||
*/
|
||||
static rtems_boolean
|
||||
is_fat_partition(unsigned8 type)
|
||||
{
|
||||
static const unsigned8 fat_part_types[] = {
|
||||
DOS_FAT12_PARTITION,DOS_FAT16_PARTITION,
|
||||
DOS_P32MB_PARTITION,
|
||||
FAT32_PARTITION ,FAT32_LBA_PARTITION,
|
||||
FAT16_LBA_PARTITION
|
||||
};
|
||||
|
||||
return (NULL != memchr(fat_part_types,type,sizeof(fat_part_types)));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* data_to_part_desc --
|
||||
@@ -157,16 +180,20 @@ data_to_part_desc(unsigned8 *data, part_desc_t **new_part_desc)
|
||||
memcpy(&temp, data + RTEMS_IDE_PARTITION_SIZE_OFFSET, sizeof(unsigned32));
|
||||
part_desc->size = LE_TO_CPU_U32(temp);
|
||||
|
||||
if ((part_desc->sys_type == EMPTY_PARTITION) ||
|
||||
((part_desc->size == 0) && (!is_extended(part_desc->sys_type))))
|
||||
{
|
||||
/* empty partition */
|
||||
free(part_desc);
|
||||
return RTEMS_SUCCESSFUL;
|
||||
/*
|
||||
* use partitions that are
|
||||
* - extended
|
||||
* or
|
||||
* - FAT type and non-zero
|
||||
*/
|
||||
if (is_extended(part_desc->sys_type) ||
|
||||
(is_fat_partition(part_desc->sys_type)) && (part_desc->size != 0)) {
|
||||
*new_part_desc = part_desc;
|
||||
}
|
||||
else {
|
||||
/* empty partition */
|
||||
free(part_desc);
|
||||
}
|
||||
|
||||
*new_part_desc = part_desc;
|
||||
|
||||
return RTEMS_SUCCESSFUL;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user