grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] cdrom access patch


From: Bean
Subject: Re: [PATCH] cdrom access patch
Date: Sun, 9 Mar 2008 23:33:27 +0800

On Fri, Mar 7, 2008 at 11:37 PM, Vesa Jääskeläinen <address@hidden> wrote:
>
> Bean wrote:
>  > Hi,
>  >
>  > This patch use int 13 func 4B01 to detect cdrom. It also change the
>  > name of the cd device to (hdN), where N is the bios drive number.
>
>  Hi Bean,
>
>  Have you tried to use EDD's functions to query for type of device?
>  (references are to EDD3 spec)
>
>  8.24 Get Device Parameters (FN 48h)
>  26 DWord Pointer to the Device Parameter Table Extension (DPTE)
>
>  8.24.3 Device Parameter Table Extension (DPTE)
>  10-11 Word BIOS selected hardware specific option flags
>
>  Bits 5 and 6; Removable device, ATAPI device.
>
>  This FN 48h can also be used to filter out PCI cards from ATA driver in
>  case there is BIOS support for the device already. So use BIOS if there
>  is BIOS handler for it, otherwise fall back to ATA driver.
>
>  I would prefer that CD's would be counted like (cd0) for first CD-ROM
>  device, (cd1) for second CD-ROM device, ... and so on. I think it is OK
>  to first allocate BIOS devices for CD's and after that use ATA driver
>  for rest of them. Ata driver can of course be accessed with ata name too.

Hi,

after some consideration, i think the best way to detect cdrom is to
check the number of bytes per sector. The handling of cdrom assume
sector size of 4096, cdrom that has other block size would not work.
On the other hand, the device don't even needs to be cdrom, as long as
it has 2048 sector size, the current handling works. Therefore,
checking sector size should be sufficient.

As for the device name, there are some drawbacks by using (cdN), in
init.c, we need to get the root device from bios drive number.
However, as Christian Franke discovers, the drive number can be:

0x82 (old Toshiba Laptop with unknown BIOS)
0x9f (PC with Phoenix-Award BIOS, VMware)
0xe0 (VirtualBox)
0xef (PC with AMI BIOS, VirtualPC)

It' quite tricky to determine whether a drive is cdrom or harddisk.

And in the multiboot loader, we need to do the oppisite, map the root
device to bios drive number. As names like (cd0) doesn't suggests the
number at all, we need to ask biosdisk for the number. Therefore,
multiboot loader will be depended on biosdisk, which is not a good
idea.

-- 
Bean

Attachment: cd2.diff
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]