Linux-Development-Sys Digest #573, Volume #8     Sat, 17 Mar 01 00:13:12 EST

Contents:
  Re: Processor ID (bill davidsen)
  Using the old AIX7XXX driver in 2.4.2 (bill davidsen)
  Re: adding a lot of syscalls (bill davidsen)
  Re: Processor ID ("John Pfaff")
  Re: comps and hdlist in RH Linux CD. (Brian Lee)
  Re: PORTIMG PRBLEMS FOR A DEVICE DRIVER (Josef Allen)

----------------------------------------------------------------------------

From: [EMAIL PROTECTED] (bill davidsen)
Crossposted-To: comp.os.linux.development.apps,comp.os.linux.hardware
Subject: Re: Processor ID
Date: 16 Mar 2001 20:07:54 GMT

In article <[EMAIL PROTECTED]>,  <[EMAIL PROTECTED]> wrote:
| In article <987gkm$e3b$[EMAIL PROTECTED]>,
| Victor Wagner <[EMAIL PROTECTED]> wrote:
| 
| >: IIRC, the x86 Linux kernel explicitly disables the processor ID
| >: facility.
| 
| >If so, why the following in the help file for Configure of kernel 2.2.18?
| >
| >CONFIG_X86_CPUID
| >  This device gives processes access to the x86 CPUID instruction to
| >  be executed on a specific processor.  It is a character device
| >  with major 203 and minors 0 to 31 for /dev/cpu/0/cpuid to
| >  /dev/cpu/31/cpuid.
| 
| So you can have a choice of course.

  I thought I posted sample output on this, the info does not appear to
have the serial number in the available information. If I have a system
up...

The output of the devices:
/dev/cpu/0/cpuid
0000000 0002 0000 6547 756e 746e 6c65 6e69 4965
        002  \0  \0  \0   G   e   n   u   n   t   e   l   i   n   e   I
0000020 0665 0000 0000 0000 0000 0000 fbff 0183
          e 006  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0 377 373 203 001
0000040 0101 0302 0000 0000 0000 0000 0841 0c04
        001 001 002 003  \0  \0  \0  \0  \0  \0  \0  \0   A  \b 004  \f
*
0002000
/dev/cpu/1/cpuid
0000000 0002 0000 6547 756e 746e 6c65 6e69 4965
        002  \0  \0  \0   G   e   n   u   n   t   e   l   i   n   e   I
0000020 0665 0000 0000 0000 0000 0000 fbff 0183
          e 006  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0 377 373 203 001
0000040 0101 0302 0000 0000 0000 0000 0841 0c04
        001 001 002 003  \0  \0  \0  \0  \0  \0  \0  \0   A  \b 004  \f
*
0002000

And the md5sum, showing they are the same:

/dev/cpu/0/cpuid
1d6470ad8a3c7201ad150abbd1f31da8  -
/dev/cpu/1/cpuid
1d6470ad8a3c7201ad150abbd1f31da8  -

So as far as I can see you don't have a choice, the CPUID does not
include the S/N. I don't think I have CPUs which are specially modifiled
not to have S/N, so I assume it's not there, and this is the same stuff
as /proc/cpuinfo.

System is dual P-II/500, 256MB, "2.4.2-ac17 #14 SMP" setup.

-- 
  bill davidsen <[EMAIL PROTECTED]>  CTO, TMR Associates, Inc
At LinuxExpo Sun was showing Linux applications running on Solaris.
They don't get it, the arrow points the other way. There's a reason why
there's no SolarisExpo, Solaris is a tool; Linux is a philosophy, a
religion, a way of life, and only incidentally an operating system.

------------------------------

From: [EMAIL PROTECTED] (bill davidsen)
Subject: Using the old AIX7XXX driver in 2.4.2
Date: 16 Mar 2001 20:16:28 GMT

I don't seem to see a config option to use the old aic7xxx driver,
although the source is there and there's sort-of support in the Makefile
for drivers/scsi. Before I hack it by hand, is this an opps that the old
drive isn't available?

The new driver has several defects, PCMCIA doesn't like it and it is
trying to use some database stuff which conflicts with the database I
chose to install. The idea of going to a database in a driver strikes me
as rather an odd implementation choice.

-- 
  bill davidsen <[EMAIL PROTECTED]>  CTO, TMR Associates, Inc
At LinuxExpo Sun was showing Linux applications running on Solaris.
They don't get it, the arrow points the other way. There's a reason why
there's no SolarisExpo, Solaris is a tool; Linux is a philosophy, a
religion, a way of life, and only incidentally an operating system.

------------------------------

From: [EMAIL PROTECTED] (bill davidsen)
Subject: Re: adding a lot of syscalls
Date: 16 Mar 2001 20:37:18 GMT

In article <[EMAIL PROTECTED]>,
Julien Cavoizy  <[EMAIL PROTECTED]> wrote:

| I am under a Mandrake 7.2 distribution and i want to add some syscalls
| in the kernel. My problem is that in the asm/unistd.h there are about 5
| syscalls which are not written in the entry.S file. So the number of
| these syscalls go to 197 but in the entry.S the number of the syscall
| table stop to 191.
| 
| So i tried to add one syscall with a number 198 in unistd.h and write
| 198 to the limit in entry.S but it doesn't work.
| What should i do ?
| 
| the strange syscalls in unistd.h are the followings ...
| ...
| #define __NR_mmap2            192
| #define __NR_truncate64               193
| #define __NR_ftruncate64      194
| #define __NR_stat64           195
| #define __NR_lstat64          196
| #define __NR_fstat64          197
| 
| thank for your answer

  I believe these are related to large file support, by their names. Can
you tell if these are compiled in or being ignored?

  If you want to test, try reusing the lowest number. Or drop in
definitions to match and then add your call at the end.
-- 
  bill davidsen <[EMAIL PROTECTED]>  CTO, TMR Associates, Inc
At LinuxExpo Sun was showing Linux applications running on Solaris.
They don't get it, the arrow points the other way. There's a reason why
there's no SolarisExpo, Solaris is a tool; Linux is a philosophy, a
religion, a way of life, and only incidentally an operating system.

------------------------------

From: "John Pfaff" <[EMAIL PROTECTED]>
Crossposted-To: comp.os.linux.development.apps,comp.os.linux.hardware
Subject: Re: Processor ID
Date: Fri, 16 Mar 2001 15:48:26 -0500

It's possible that in this context, cpuid means nothing other than
make/model, to differentiate between different flavours of Intel, AMD,
Cyrix, et. al.

"bill davidsen" <[EMAIL PROTECTED]> wrote in message
news:98trqp$8m8e$[EMAIL PROTECTED]...
> In article <[EMAIL PROTECTED]>,  <[EMAIL PROTECTED]> wrote:
> | In article <987gkm$e3b$[EMAIL PROTECTED]>,
> | Victor Wagner <[EMAIL PROTECTED]> wrote:
> |
> | >: IIRC, the x86 Linux kernel explicitly disables the processor ID
> | >: facility.
> |
> | >If so, why the following in the help file for Configure of kernel
2.2.18?
> | >
> | >CONFIG_X86_CPUID
> | >  This device gives processes access to the x86 CPUID instruction to
> | >  be executed on a specific processor.  It is a character device
> | >  with major 203 and minors 0 to 31 for /dev/cpu/0/cpuid to
> | >  /dev/cpu/31/cpuid.
> |
> | So you can have a choice of course.
>
>   I thought I posted sample output on this, the info does not appear to
> have the serial number in the available information. If I have a system
> up...
>
> The output of the devices:
> /dev/cpu/0/cpuid
> 0000000 0002 0000 6547 756e 746e 6c65 6e69 4965
>         002  \0  \0  \0   G   e   n   u   n   t   e   l   i   n   e   I
> 0000020 0665 0000 0000 0000 0000 0000 fbff 0183
>           e 006  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0 377 373 203 001
> 0000040 0101 0302 0000 0000 0000 0000 0841 0c04
>         001 001 002 003  \0  \0  \0  \0  \0  \0  \0  \0   A  \b 004  \f
> *
> 0002000
> /dev/cpu/1/cpuid
> 0000000 0002 0000 6547 756e 746e 6c65 6e69 4965
>         002  \0  \0  \0   G   e   n   u   n   t   e   l   i   n   e   I
> 0000020 0665 0000 0000 0000 0000 0000 fbff 0183
>           e 006  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0 377 373 203 001
> 0000040 0101 0302 0000 0000 0000 0000 0841 0c04
>         001 001 002 003  \0  \0  \0  \0  \0  \0  \0  \0   A  \b 004  \f
> *
> 0002000
>
> And the md5sum, showing they are the same:
>
> /dev/cpu/0/cpuid
> 1d6470ad8a3c7201ad150abbd1f31da8  -
> /dev/cpu/1/cpuid
> 1d6470ad8a3c7201ad150abbd1f31da8  -
>
> So as far as I can see you don't have a choice, the CPUID does not
> include the S/N. I don't think I have CPUs which are specially modifiled
> not to have S/N, so I assume it's not there, and this is the same stuff
> as /proc/cpuinfo.
>
> System is dual P-II/500, 256MB, "2.4.2-ac17 #14 SMP" setup.
>
> --
>   bill davidsen <[EMAIL PROTECTED]>  CTO, TMR Associates, Inc
> At LinuxExpo Sun was showing Linux applications running on Solaris.
> They don't get it, the arrow points the other way. There's a reason why
> there's no SolarisExpo, Solaris is a tool; Linux is a philosophy, a
> religion, a way of life, and only incidentally an operating system.



------------------------------

From: Brian Lee <[EMAIL PROTECTED]>
Subject: Re: comps and hdlist in RH Linux CD.
Date: Sat, 17 Mar 2001 02:33:04 GMT

Follow it gedhdlist prints in RH Linux 7.0 or higher. Anybody knows
what the options exactly mean? I updated RPM files in RH CD and 
ran genhdlist with 2 <path>s. Two hdlist file(hdlist, hdlist2) has
been generated but I got this error

genhdlist [--withnumbers] [--fileorder <path>] [--hdlist <path>]
<paths>+

error message : ``compat-libs-6.2-2.i386 cannot be opened. this
is due to a missing file, a bad package, or bad media ''

How can I set the location data of each RPM packages?

Kasper Dupont wrote:
> 
> Brian Lere wrote:
> >
> > Hi,
> >
> > I updated RPMs and added more RPMs in RH Linux 7.0. I got a program
> > which update the RPM database file in CD.
> > (They're in $(CD_ROOT)/RedHat/base/{comps,hdlist})
> >
> > But, you know there are two CDs in RH 7.0 or higher. I don't know
> > how to handle them when two CDs. How can I put some options on
> > ``genhdlist'' program for two CDs? Or where can I get a program which
> > can control RPM files which is in 2 CDs?
> >
> > Thanks for your reading/posting and sorry for bas English.
> >
> >  - Brian,.
> 
> You can give multiple paths as argument to genhdlist.
> If you run genhdlist without arguments it prints this
> information:
> genhdlist [--withnumbers] [--hdlist <path>] <paths>+
> 
> --
> Kasper Dupont

-- 
Brian Lee <[EMAIL PROTECTED]>
* To reply via email, remove .nospam from the reply address.

------------------------------

From: Josef Allen <[EMAIL PROTECTED]>
Subject: Re: PORTIMG PRBLEMS FOR A DEVICE DRIVER
Date: Fri, 16 Mar 2001 23:14:59 -0500

I am sorry that was the code before I made some changes to it
Here is the actual code that is on the linux box at this time



#include "cti.h"

#define CTI_MCR 4
#define CTI_LSR 5
#define CTI_LCR 3
#define CTI_DAV 0x01
#define CTI_ODR 0x20
#define CTI_COMPORT_TIMEOUT 100000L




int CtiCommunication(CtiData *Cti){

  long unsigned fromportnum, toportnumber, turn_on;

  short unsigned ComportAddress;

  int ControlIndex, SensorIndex, ThrottleIndex;

  int ByteOfData;
  
  int ii, TxCnt, RxCnt,StatCnt;
  
  int A = 65;

  int NextDoublet;

  int Doublet[2 * CTI_MAXMODULES];

  char TxBuffer[2 + (5 * CTI_MAXMODULES)];

  static int EvenOdd = 0;
 
  int Status = 0;  

  int y = ioperm(0x03f8, 7, 1);//gives permission to open up 0348 - 03ff
  cout << y << endl;

 
  //mapping logical comport to bas addresses

  switch(Cti->ComPort){

  case 1:ComportAddress = 0x3f8 ; break;  
  case 2:ComportAddress = 0x2f8 ; break;  
  case 3:ComportAddress = 0x3e8 ; break;  
  case 4:ComportAddress = 0x2e8; break;  
  default:ComportAddress = Cti->ComPort ; break;  

  }//end mapping logical comport to bas addresses


  if( ComportAddress == 0 ){

    return(CTI_PORT_NOT_FOUND);

  }//end if comport not found


  //INITIALIZE COMPORT HARDWARE (9600, N, 8, 1, no IRQ's)
  if(Cti->ServiceRequested & CTI_INIT ){

    outb( 0x00, ComportAddress + 1 ); //set baud rate 
    outb( 0x00, ComportAddress + 2 );
    outb( 0x83, ComportAddress + 3 );
    outb( 0x0c, ComportAddress + 0 );
    outb( 0x00, ComportAddress + 1 );
    outb( 0x00, ComportAddress + 3 );



    outb( 0x01, ComportAddress + CTI_MCR );// generate hardware reset pulse
    CtiSleep(100);
    outb( 0x00, ComportAddress + CTI_MCR );// generate hardware reset pulse
    CtiSleep(500);



    inb(ComportAddress);//flush comport data_in register    
    inb(ComportAddress);


    

    Status = Status | CtiSend( 65, ComportAddress );
    Status = Status | CtiRcv( &ByteOfData, ComportAddress);



    //loop till header moves aound the network
 for(ii = 0; ((ii < CTI_MAXMODULES) && (ByteOfData != 65) && !Status); ii++){

   Status = Status | CtiSend(0x00, ComportAddress);
   Status = Status | CtiRcv(&ByteOfData, ComportAddress);

 }//end for for loop till header moves aound the network


      if( ii != CTI_MAXMODULES){

       return (CTI_IO_TIMEOUT); // message header was never found
      
        }//end if for message header was never found
        
    Status = Status | CtiSend( 0x00, ComportAddress );
    Status = Status | CtiRcv( &ByteOfData, ComportAddress );

    if(Status){
cout<<" NumModules == 0 "<<endl;
      Cti->NumModules = 0;

    }//end if for if(status)

    else{
      Cti->NumModules = ii;

      for(ii = 0; ii < Cti->NumModules; ii++){

        //read in modules id
    Status = Status | CtiSend( 0x00, ComportAddress );
    Status = Status | CtiRcv( &ByteOfData, ComportAddress );

    if (ByteOfData == 0x88)
      Cti->ModuleType[ii] = CTI_8C;
    else if(ByteOfData == 0xaa)
      Cti->ModuleType[ii] = CTI_8S;
    else if(ByteOfData == 0x56)
      Cti->ModuleType[ii] = CTI_THROTTLES;              
    else
      Cti->ModuleType[ii] = CTI_4C4S;           

    cout<<hex<<Cti->ModuleType[ii]<<"Is the module type"<<endl;
      }//end for for inside else

    }//end else for if(status)

    outb( 0x01, ComportAddress + CTI_MCR );//  reset network after poll
    CtiSleep(100);
    outb( 0x00, ComportAddress + CTI_MCR );//  reset  network after poll
    CtiSleep(500);
    inb(ComportAddress);//flush comport data_in register    
    inb(ComportAddress);
cout<<" Coming out of the initialize "<<endl;
  }//end if for INITIALIZE COMPORT HARDWARE (9600, N, 8, 1, no IRQ's)
 





  if(Cti->ServiceRequested == CTI_DATA_EXCHANGE){
      ControlIndex = 0;
      SensorIndex = 0;
      ThrottleIndex = 0;
      TxCnt = 0;
      NextDoublet = 0;
      Doublet[0] = (int) -1;
      
      ByteOfData = inb(ComportAddress);//flush input port      
      ByteOfData = inb(ComportAddress);
      
      Status = CtiSend(65, ComportAddress);

cout<<"In Service Requested"<<endl;      

      if( Cti->NumModules == 0 ){
        
        Status = Status | CtiRcv( &ByteOfData, ComportAddress );
cout<<"In Cti->NumModules == 0"<<endl;          
        if( ByteOfData != 65 )
          return ( CTI_UNEXPECTED_DATA );
        
      }//end if for Cti->NumModules == 0 

      //save time by building tx buffer while header is being sent
      for( ii = 0; ii < Cti->NumModules; ii++){
        
        if( Cti->ModuleType[ii] == CTI_4C4S ){
cout<< Cti->ModuleType[ii] <<"We are in 4C4S"<<endl;
          ByteOfData = (Cti->Control[ControlIndex++] != 0) * 1;
          ByteOfData = ByteOfData + (Cti->Control[ControlIndex++] != 0) * 2;
          ByteOfData = ByteOfData + (Cti->Control[ControlIndex++] != 0) * 4;
          ByteOfData = ByteOfData + (Cti->Control[ControlIndex++] != 0) * 8;
          TxBuffer[TxCnt++] = (char) ByteOfData;
          
        }//end if for Cti->ModuleType[ii] == CTI_4C4S 
        
        else if( Cti->ModuleType[ii] == CTI_8C ){
cout<< Cti->ModuleType[ii] <<"We are in 8C"<<endl;
          ByteOfData =  (Cti->Control[ControlIndex++] != 0) * 1; 
          ByteOfData = ByteOfData + (Cti->Control[ControlIndex++] != 0) * 2;
          ByteOfData = ByteOfData + (Cti->Control[ControlIndex++] != 0) * 4;
          ByteOfData = ByteOfData + (Cti->Control[ControlIndex++] != 0) * 8;
          ByteOfData = ByteOfData + (Cti->Control[ControlIndex++] != 0) * 16;
          ByteOfData = ByteOfData + (Cti->Control[ControlIndex++] != 0) * 32;
          ByteOfData = ByteOfData + (Cti->Control[ControlIndex++] != 0) * 64;
          ByteOfData = ByteOfData + (Cti->Control[ControlIndex++] != 0) * 128;
          
          if(( ByteOfData == 65 ) ||( ByteOfData == 0x1b ) ){
cout<< Cti->ModuleType[ii] <<"We are in 0x1b"<<endl;
            TxBuffer[TxCnt++] = 0x1b;
            Doublet[NextDoublet++] = TxCnt + ii;
            Doublet[NextDoublet++] = (int) -1;
            TxBuffer[TxCnt++] = ~ByteOfData;
          }//end if for ByteOfData ==  65 ) ||( ByteOfData == 0x1b ) )
          
          else
            TxBuffer[TxCnt++] = (char) ByteOfData; 
          
        }//end else if for Cti->ModuleType[ii] == CTI_8C
        
        else if( Cti->ModuleType[ii] == CTI_8S ){
cout<< Cti->ModuleType[ii] <<"We are in 0x1b"<<endl;    
          TxBuffer[TxCnt++] = 0x01; 
        }
        
        
        else if (Cti->ModuleType[ii] == CTI_THROTTLES){
cout<< Cti->ModuleType[ii] <<"We are in 0x1b"<<endl;    
        if(EvenOdd){
          ByteOfData = (Cti->Throttle[ThrottleIndex++] & 0x7f );
          
          if( ByteOfData )
            ByteOfData = 100;
          
          ByteOfData = ByteOfData | 0x80;
          
        }//end if for EvenOdd
        
        else
          ByteOfData = ( Cti->Throttle[ThrottleIndex++] >> 8 ) & 0x7f;
        
        TxBuffer[TxCnt++] = (char) ByteOfData;  
        
        }//end else if for Cti->ModuleType[ii] == Throttle
        
      }//end if for Cti->ServiceRequested == CTI_DATA_EXCHANGE
   




      for( ii = 0; ii < Cti->NumModules; ii++ )
        TxBuffer[TxCnt++] = (char) 0xff;

      // receive response from header 
      Status = Status | CtiRcv( &ByteOfData, ComportAddress);

      //send module counter
      Status = Status | CtiSend( 0x00, ComportAddress);

      //sendreceive response to module counter
      Status = Status | CtiRcv( &ByteOfData, ComportAddress);

      NextDoublet = 0;
      RxCnt = 0;
      StatCnt = 0;

      for(ii = 0; ii < TxCnt; ii++){

        Status = Status | CtiSend( TxBuffer[ii], ComportAddress);

        if( ii == Doublet[NextDoublet]){
          NextDoublet++;
          CtiSleep(1);
        }//end if for ii == Doublet[NextDoublet]
      
        else{

          Status = Status | CtiRcv(&ByteOfData, ComportAddress);

          RxCnt++;

          if( RxCnt > Cti->NumModules ){
          //Status has begun coming back

            if( Cti->ModuleType[StatCnt] == CTI_4C4S ){
            
              ByteOfData = ByteOfData >> 4;

              Cti->Sensors[SensorIndex++] = ((ByteOfData & 0x01) != 0 );
              Cti->Sensors[SensorIndex++] = ((ByteOfData & 0x02) != 0 );
              Cti->Sensors[SensorIndex++] = ((ByteOfData & 0x04) != 0 );
              Cti->Sensors[SensorIndex++] = ((ByteOfData & 0x08) != 0 );


            }//end if for Cti->ModuleType[StatCnt] == CTI_4C4S 

            else if(Cti->ModuleType[StatCnt] == CTI_8S ){

              Cti->Sensors[SensorIndex++] = ((ByteOfData & 0x01) != 0 );
              Cti->Sensors[SensorIndex++] = ((ByteOfData & 0x02) != 0 );
              Cti->Sensors[SensorIndex++] = ((ByteOfData & 0x04) != 0 );
              Cti->Sensors[SensorIndex++] = ((ByteOfData & 0x08) != 0 );
              Cti->Sensors[SensorIndex++] = ((ByteOfData & 0x10) != 0 );
              Cti->Sensors[SensorIndex++] = ((ByteOfData & 0x20) != 0 );
              Cti->Sensors[SensorIndex++] = ((ByteOfData & 0x40) != 0 );
              Cti->Sensors[SensorIndex++] = ((ByteOfData & 0x80) != 0 );
            }//end else if for Cti->ModuleType[StatCnt] == CTI_8S 

          StatCnt++;

          }//end if for RxCnt > Cti->NumModules 
        }//end else
      }//end for with ii <  TxCnt
  }//Cti->ServiceRequested == CTI_DATA_EXCHANGE

      EvenOdd = EvenOdd ? 0 : 1;
      
      return(Status);
}//end cticommunication
     


int CtiSend(int data, short int address){
  
  clock_t TimeToGiveUp;

  TimeToGiveUp = clock() + CLOCKS_PER_SEC/10;
  while(!(inb(address + CTI_LSR ) & CTI_ODR ))
    if(clock() > TimeToGiveUp)
  return(CTI_IO_TIMEOUT);

  outb( data, address );
  return(CTI_SUCCESS);

}//end  CtiSend(int data, short int address)



int CtiRcv( int* Data , short int address){

  clock_t TimeToGiveUp;
  
  TimeToGiveUp = clock() + CLOCKS_PER_SEC/10;
  while(!(inb(address + CTI_LSR ) & CTI_DAV ))
    if(clock() > TimeToGiveUp){
      *Data = 0X00;
      return(CTI_IO_TIMEOUT);
    }

  *Data = inb(address);
  cout<<"In CtiRcv"<<"CtiMaxmodules==\t"<<CTI_MAXMODULES <<endl;
  return(CTI_SUCCESS);

}//end  CtiRcv( int* Data , short int address)


void CtiSleep( clock_t MsecsToSleep){

  clock_t Goal;
  Goal = clock() + (MsecsToSleep * CLOCKS_PER_SEC)/1000;

  while( Goal > clock() )
    ;

}//end 





















Josef D. Allen



------------------------------


** FOR YOUR REFERENCE **

The service address, to which questions about the list itself and requests
to be added to or deleted from it should be directed, is:

    Internet: [EMAIL PROTECTED]

You can send mail to the entire list by posting to the
comp.os.linux.development.system newsgroup.

Linux may be obtained via one of these FTP sites:
    ftp.funet.fi                                pub/Linux
    tsx-11.mit.edu                              pub/linux
    sunsite.unc.edu                             pub/Linux

End of Linux-Development-System Digest
******************************

Reply via email to