Changeset bf71e25e in rtems


Ignore:
Timestamp:
Mar 25, 2003, 5:02:01 PM (17 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Children:
086e708
Parents:
01c5b9d7
Message:

2003-03-25 Thomas Doerfler <Thomas.Doerfler@…>

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
Location:
cpukit/libblock
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • cpukit/libblock/Makefile.am

    r01c5b9d7 rbf71e25e  
    1919include_rtems_HEADERS = \
    2020    include/rtems/bdbuf.h include/rtems/blkdev.h \
    21     include/rtems/diskdevs.h include/rtems/ramdisk.h
     21    include/rtems/diskdevs.h include/rtems/ramdisk.h \
     22    include/rtems/ata.h include/rtems/ata_internal.h \
     23    include/rtems/ide_part_table.h
    2224
    2325PREINSTALL_FILES = $(PROJECT_INCLUDE)/rtems \
     
    2628LIB = ${ARCH}/libblock.a
    2729
    28 C_FILES = src/bdbuf.c src/blkdev.c src/diskdevs.c src/ramdisk.c
     30C_FILES = src/bdbuf.c src/blkdev.c src/diskdevs.c src/ramdisk.c\
     31          src/ata.c src/ide_part_table.c
     32
    2933OBJS = $(C_FILES:src/%.c=${ARCH}/%.$(OBJEXT))
    3034
  • cpukit/libblock/include/rtems/ide_part_table.h

    r01c5b9d7 rbf71e25e  
    8787/*
    8888 * Enum partition types
     89 * see list at http://ata-atapi.com/hiwtab.htm
    8990 */
    9091enum {
    91     EMPTY_PARTITION     = 0,
    92     EXTENDED_PARTITION  = 5,
     92    EMPTY_PARTITION     = 0x00,
     93    DOS_FAT12_PARTITION = 0x01,
     94    DOS_FAT16_PARTITION = 0x04,
     95    EXTENDED_PARTITION  = 0x05,
     96    DOS_P32MB_PARTITION = 0x06,
     97    FAT32_PARTITION     = 0x0B,
     98    FAT32_LBA_PARTITION = 0x0C,
     99    FAT16_LBA_PARTITION = 0x0E,
    93100    DM6_PARTITION       = 0x54,
    94101    EZD_PARTITION       = 0x55,
  • cpukit/libblock/src/ata.c

    r01c5b9d7 rbf71e25e  
    1919#include <chain.h>
    2020#include <assert.h>
     21#include <string.h> /* for "memset" declaration */
    2122
    2223#include <rtems/diskdevs.h>
     
    11531154                 0;
    11541155
    1155 #ifndef ATA_DEV_IS_FLASH_DISK
    11561156            if ((CF_LE_W(buffer[ATA_IDENT_WORD_FIELD_VALIDITY]) &
    1157                  ATA_IDENT_BIT_VALID) == 0)
     1157                 ATA_IDENT_BIT_VALID) == 0) {
     1158              /* no "supported modes" info -> use default */
     1159              ATA_DEV_INFO(ctrl_minor, dev).mode_active = ATA_MODES_PIO3;
     1160            }
     1161            else {
     1162              ATA_DEV_INFO(ctrl_minor, dev).modes_avaible =
     1163                ((CF_LE_W(buffer[64]) & 0x1) ? ATA_MODES_PIO3 : 0) |
     1164                ((CF_LE_W(buffer[64]) & 0x2) ? ATA_MODES_PIO4 : 0) |
     1165                ((CF_LE_W(buffer[63]) & 0x1) ? ATA_MODES_DMA0 : 0) |
     1166                ((CF_LE_W(buffer[63]) & 0x2) ?
     1167                 ATA_MODES_DMA0 | ATA_MODES_DMA1 : 0) |
     1168                ((CF_LE_W(buffer[63]) & 0x4) ?
     1169                 ATA_MODES_DMA0 | ATA_MODES_DMA1 | ATA_MODES_DMA2 : 0);
     1170              if (ATA_DEV_INFO(ctrl_minor, dev).modes_avaible == 0)
    11581171                continue;
    1159 #endif
    1160             ATA_DEV_INFO(ctrl_minor, dev).modes_avaible =
    1161             ((CF_LE_W(buffer[64]) & 0x1) ? ATA_MODES_PIO3 : 0) |
    1162             ((CF_LE_W(buffer[64]) & 0x2) ? ATA_MODES_PIO4 : 0) |
    1163             ((CF_LE_W(buffer[63]) & 0x1) ? ATA_MODES_DMA0 : 0) |
    1164             ((CF_LE_W(buffer[63]) & 0x2) ?
    1165             ATA_MODES_DMA0 | ATA_MODES_DMA1 : 0) |
    1166             ((CF_LE_W(buffer[63]) & 0x4) ?
    1167             ATA_MODES_DMA0 | ATA_MODES_DMA1 | ATA_MODES_DMA2 : 0);
    1168 
    1169             if (ATA_DEV_INFO(ctrl_minor, dev).modes_avaible == 0)
    1170                 continue;
    1171            
    1172             /*
    1173              * choose most appropriate ATA device data I/O speed supported by
    1174              * the controller
    1175              */
    1176             status = ide_controller_config_io_speed(
     1172              /*
     1173               * choose most appropriate ATA device data I/O speed supported
     1174               * by the controller
     1175               */
     1176              status = ide_controller_config_io_speed(
    11771177                ctrl_minor,
    11781178                ATA_DEV_INFO(ctrl_minor, dev).modes_avaible);
    1179             if (status != RTEMS_SUCCESSFUL)
     1179              if (status != RTEMS_SUCCESSFUL)
    11801180                continue;
    1181                    
    1182 #ifdef ATA_DEV_IS_FLASH_DISK
    1183             ATA_DEV_INFO(ctrl_minor, dev).mode_active = ATA_MODES_PIO3;
    1184 #endif       
     1181            }     
    11851182            /*
    11861183             * Ok, let register new ATA device in the system
  • cpukit/libblock/src/ide_part_table.c

    r01c5b9d7 rbf71e25e  
    2020
    2121#include <rtems/ide_part_table.h>
    22 
     22#include <string.h>
    2323
    2424/*
     
    113113}
    114114
     115/*
     116 * is_fat_partition --
     117 *      checks if the partition type is defined for FAT
     118 *
     119 * PARAMETERS:
     120 *      type - type of partition to check
     121 *
     122 * RETURNS:
     123 *      TRUE if partition type is extended, FALSE otherwise
     124 */
     125static rtems_boolean
     126is_fat_partition(unsigned8 type)
     127{
     128  static const unsigned8 fat_part_types[] = {
     129    DOS_FAT12_PARTITION,DOS_FAT16_PARTITION,
     130    DOS_P32MB_PARTITION,
     131    FAT32_PARTITION    ,FAT32_LBA_PARTITION,
     132    FAT16_LBA_PARTITION
     133  };
     134
     135  return (NULL != memchr(fat_part_types,type,sizeof(fat_part_types)));
     136}
     137
    115138
    116139/*
     
    158181    part_desc->size = LE_TO_CPU_U32(temp);
    159182
    160     if ((part_desc->sys_type == EMPTY_PARTITION) ||
    161         ((part_desc->size == 0) && (!is_extended(part_desc->sys_type))))
    162     {
    163         /* empty partition */
    164         free(part_desc);
    165         return RTEMS_SUCCESSFUL;
    166     }
    167    
    168     *new_part_desc = part_desc;
    169 
     183    /*
     184     * use partitions that are
     185     * - extended
     186     * or
     187     * - FAT type and non-zero
     188     */
     189    if (is_extended(part_desc->sys_type) ||
     190        (is_fat_partition(part_desc->sys_type)) && (part_desc->size != 0)) {
     191      *new_part_desc = part_desc;
     192    }
     193    else { 
     194      /* empty partition */
     195      free(part_desc);
     196    }
    170197    return RTEMS_SUCCESSFUL;
    171198}
Note: See TracChangeset for help on using the changeset viewer.