Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Accessing the AT controller

Posted on 1997-07-29
6
Medium Priority
?
181 Views
Last Modified: 2010-04-03
Is there anyone who knows how to access the AT controller to recieve such fancy stuff like disk serialnumber, firmware info and disktype etc?
I'm talking direct port access according to ATA-X standard.
/thanx
0
Comment
Question by:leja
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 1

Accepted Solution

by:
FuzzyLogic earned 400 total points
ID: 1340153
Well, here it is.

I think that the problem you encountered with is that you didn't wait until the HDC finished executing your request ($EC), and therefore could not give you the desired information.

Anyway, followed by this message a WORKING program that get the information of the HDs. (The only part I'm not sure of is identifing Master/Slave HDs since I could not check that in my system - so let me know...).
However, if you give incorrect parameters, the program will _Wait_ forever in an infinit-loop (drive never ready).

The program is writen in pascal, because I started working on it when your question was in the Pascal-topic. I used some assembler in it, but I'm sure you can handle it (...).


PS.  If you want all the ports usage, check "Ralf Brown Interrup List".


       FuzzyLogic
0
 
LVL 1

Expert Comment

by:FuzzyLogic
ID: 1340154
program Idetify;

type
  BufT=array[0..$200] of byte;

var
  Buffer:BufT;
  Base:word;
  a:byte;


function PrintStr(Buffer:BufT; start,len:word):string;
  var
    a:word;
    S:string;
  begin;
    S:='';
    for a:=start to (start+len-1) do S:=S+char(Buffer[a]);
    PrintStr:=S;
  end;


procedure Wait; assembler;
  asm
    mov  dx,Base
    add  dx,7    { 01x7 - HDC status register }
@loop:
    in   al,dx
    and  al,80h
    jnz  @loop   { Loop until ready... }
  end;


begin;
  writeln;
  write('Choose HDC [1-4]: '); readln(a);
  case a of
    1: Base:=$01F0;
    2: Base:=$0170;
    3: Base:=$01E8; { I'm not sure if it works with }
    4: Base:=$0168; { the 3rd and the 4th EIDE HDC  }
    else Halt(2);
  end;

  write('Choose Drive [0-1]: '); readln(a);
  if a>1 then Halt(2);

  asm
    lea  di,Buffer
    mov  ax,ds
    mov  es,ax

    mov  dx,Base
    add  dx,1      { 01x1 - Error register        }
    in   al,dx
    and  al,7
    cmp  al,1
    jg   @Error

    call Wait

    mov  dx,Base
    add  dx,6      { 01x6 - Drive/Head            }
    in   al,dx
    cmp  a,0
    je   @Drive0
    { Drive 1 }
    or   al,00001000b
    jmp  @DriveDone
@Drive0:
    and  al,11110111b
@DriveDone:
    out  dx,al
    call Wait

    mov  dx,Base
    add  dx,7      { 01x7 - Command register      }
    mov  al,0ECh   {        EC - Identify drive   }
    out  dx,al
    call Wait

    mov  cx,0100h  { read 100h WORDs = 200h BYTEs }
    mov  dx,Base   { 01x0 - Data register         }
    cld
@ReadLoop:
    in   ax,dx
    xchg ah,al
    stosw
    loop @ReadLoop

@Error:
  end;

  writeln;
  writeln('Serial Number     : ',PrintStr(Buffer,$14,20));
  writeln('Firmware Revision : ',PrintStr(Buffer,$2E,8));
  writeln('Model Number      : ',PrintStr(Buffer,$36,40));

end.
0
 

Author Comment

by:leja
ID: 1340155
Thanx!!!

Accepting the answer as extremely excellent. You couldn't be more preemptive.
All I can say is that I was almost there but you saved me a couple of hours work:-)
Stupid of me not to think of RB's listing, have it available in my computer but doesn't use it to often I guess...

/LeJa
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 1

Expert Comment

by:FuzzyLogic
ID: 1340156
Glad I could help.
0
 

Author Comment

by:leja
ID: 1340157
Have tried it on my desknote with docking station and it reported the same disk serial number and model on both drive 0 and 1 on the primary controller but it's a weird environment to work in so my guess is that it works well on any system. My second controller located in the docking station did report right values, one drive on number 0 and nothing on number 1.
Did try it under Windows 95 however and it didn't work at all but that was expected, guess I'll have to write a little miniport-driver or something for that since direct portaccess is a little bit forbidden under this OS...

Great work!
0
 

Author Comment

by:leja
ID: 1340158
Have tried it on my desknote with docking station and it reported the same disk serial number and model on both drive 0 and 1 on the primary controller but it's a weird environment to work in so my guess is that it works well on any system. My second controller located in the docking station did report right values, one drive on number 0 and nothing on number 1.
Did try it under Windows 95 however and it didn't work at all but that was expected, guess I'll have to write a little miniport-driver or something for that since direct portaccess is a little bit forbidden under this OS...

Great work!
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question