Re: More than 10 IDE interfaces

Stephen Samuel (samuel@bcgreen.com)
Tue, 16 Apr 2002 04:48:49 -0700


It might be trowing bad money after good to do it, but why
not just put together a simple translation table.

rather than
drivenum=(driveletter - 'a')
and
driveletter=(drivenum+'a')

have translation tables, so that
drivenum= chartodrivenum[driveletter]
and
driveletter= drivenumtoletter[drivenum]
If you're willing to map (almost) all of the printable
characters, you could get 46 controllers and 92 drives
(I'd refuse to map ', ", \ or space)

You'd still be limited to one character, but it would, at least
make it easy to have 26 controllers and 52 drives (and that's
just using upper and lower case characters!)

Martin Dalecki wrote:
> Baldur Norddahl wrote:
>> With there changes the kernel detects the extra interfaces and the
>> disks on
>> them. They get some strange names like IDE< and the last disk is named
>> hd{,
>> but I guess I can live with that :-)
>
>
> The cause of those funny names is well known in the 2.5.xx series.
> The solution to it will first involve a complete rewrite of the kernel
> parameter parsing in ide.

Geh... Here's even a perl script to generate the mapping..
Change the characters if you wish.

#!/bin/perl -w
# Copyright (c) 2002 Stephen Samuel
# Can be re-licensed under either GPL or LGPL
#
my (%drivenum, %idenum);
my (@drivenames, @idenames);

@drivenames= qw' a b c d e f g h i j k l m n o p q r s t u v w x y z A B C D E F
G H I J K L M N O P Q R S T U V W X Y Z 0 1 2 3 4 5 6 7 8 9 ';

@idenames= qw' 0 1 2 3 4 5 6 7 8 9 A B C D E F G H I J K L M N O P Q R S T U ' ;
$drivenames=scalar(@drivenames);
$idenames=scalar(@idenames);

print <<EOF1

/*
defines the ide drive and controller mappings

*/

#define MAX_IDE_DEFINABLE $idenames
#define MAX_IDE_DRIVES_DEFINABLE $drivenames

EOF1
;
print "\n signed char drivenumtochar[$drivenames] ={";
$drivecount=0;
foreach $drive ( @drivenames ){
printf "%s%s\t'%s'",
$drivecount?",":"",
($drivecount & 7) ?"":"\n/*$drivecount*/" ,
$drive;
$drivenum{$drive} = $drivecount++;
};
print "};\n\n";

print "signed char idenumtochar[$idenames] ={";
$idecount=0;
foreach $ide ( @idenames ){
printf "%s%s\t'%s'",
$idecount?",":"",
($idecount & 7) ?"":"\n/*$idecount*/" ,
$ide;
$idenum{$ide} = $idecount++;
};
print "};\n\n";

$idecount=0;
foreach $ide ( @idenames ){
$idenum{$ide} = $idecount++;
};

print "\n/* can't be 128 because of EBCDIC */\nsigned char chartodrivenum[256] ={";
for ($char=0; $char<256; $char++){
printf "%s%s\t%s",
$char?",":"",
($char & 7) ?"":"\n/*$char*/" ,
defined($drivenum{chr($char)})?$drivenum{chr($char)}:-1;
};
print "}; \n\n";

print " signed char chartoidenum[256] ={";
for ($char=0; $char<256; $char++){
printf "%s%s\t%s",
$char?",":"",
($char & 7) ?"":"\n/*$char*/" ,
defined($idenum{chr($char)})?$idenum{chr($char)}:-1;
}
print "}; \n\n"

-- 
Stephen Samuel +1(604)876-0426                samuel@bcgreen.com
		   http://www.bcgreen.com/~samuel/
Powerful committed communication, reaching through fear, uncertainty and
doubt to touch the jewel within each person and bring it to life.

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/