delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/03/06/04:30:27

From: Ned Ulbricht <nedu AT ee DOT washington DOT edu>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: hdparm lets your IDE disk spin down
Date: Thu, 05 Mar 1998 17:56:18 -0800
Organization: University of Washington
Lines: 41
Message-ID: <34FF57C2.1B42@ee.washington.edu>
References: <6dlgva$o34$1 AT antares DOT lu DOT erisoft DOT se>
NNTP-Posting-Host: cs209-1.student.washington.edu
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Martin Stromberg wrote:
> 
> hdparm is a program that interfaces directly with the hard disk under
> Linux. One of the things it can do is set that an IDE disk should
> spin down after a certain idle time.
> 
> This is something that I've been missing in DOS. So wildly extracting
> from the Linux kernel and the hdparm program sources, I've managed to
> get it working. However what I've done is to take only the things
> needed to make it work for me; basically five calls to outportb.
> 
> Now I'd like to generalise it back to its glorious shape it came
> from. But how do I get which physical IDE disk and partition 'c:' or
> 'g:' is? For those who knows about Linux, I need a mapping from
> DOSish letters to /dev/hd{a,b,c,d}.

IMHO, this problem breaks into two parts: a) what to do, & b) how to do
it from a protected-mode environment using using djgpp (since I presume
that's the reason you posted to this n.g.). 

For part a) only, I have a three suggestions: 

Get a copy of Ralf Brown's interrupt list
http://www.cs.cmu.edu/afs/cs/user/ralf/pub/WWW/files.html 

Look at int 21h, ah=32 which gets the drive parameter block for a
specific drive. The DPB associates drive letters with assigned device
drivers. Note that this call will hit the disk. If you don't want to do
that then you'll to start with int 21h, ax=52 and go from there--see the
interrupt list for more details. 

And try asking on news:comp.os.msdos.programmer 

For part b), you'll have to get some from someone more knowledgable than
I about messing around in DOS's guts while in protected mode. If it were
me, I'd certainly try making this work in real mode first, probably
using straight assembly.  YMMV.

-- 
Ned Ulbricht
mailto:nedu AT ee DOT washington DOT edu

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019