Linux HPT366 mini-HOWTO
From: David Jericho <email@example.com>
an unabashed pinch from a site that may no longer be there
This page is devoted to the use of the HPT366 IDE controller under the Linux operating system. Made by HighPoint Tech, HPT366 is an IDE controller chip that supports the Ultra ATA/66 standard, thus boosting the maximum transfer rate of IDE devices from 33MB/s to 66MB/s. Currently HPT366 is found on a number of Abit products, including the BP6/BE6 motherboard and the HotRod 66 PCI IDE controller adapter. The HPT366 also appears on Soyo SY-6BA+ IV.
Status of HPT366 support under Linux
The answer to this important question is both yes and no. The latest stable Linux kernel 2.2.13 does not support HPT366 yet, however the driver had made its way into the development kernel since 2.3.13, therefore we can expect official support once the 2.4 series is out later this year.
Since there are many people out there who need HPT366 support but does not want to adopt the experimental kernels, the author of the driver, Andre Hedrick, has kindly provided a patch against the stable 2.2.13 kernel. Many people (including myself) have reported success with the driver, however there are still people who encountered problems, so please keep in mind that using experimental code is, as always, a risky business.
Why bother with HPT366 support
Although the topic whether UDMA/66 provides significant performance boost to UDMA/33 is still under intense debate, there are still quite a few reasons why you would like to get HPT366 working under Linux. First, HPT366 offers two more IDE channels in addition to the two provided by the Intel PIIX controller, thus enables your computer to host up to 8 IDE devices at once. Second, if you have more than 2 (but less than 5) IDE devices, you can arrange the hardware configuration so that no two devices share the same channel, and that helps performance. Finally, there are always people who like to watch the kernel boot messages...
Why not bother with HPT366 support (important)
Remember, the reason you bought your computer is to get things done easily and efficiently, so there is no need to worry about some hardware that you do not really need (in this case, the HPT366). As mentioned above, playing with experimental code is risky business, so those of you who are building mission-critical systems might decide to leave it alone for a while. The procedure of installation is definitely not complex, however a little bit of time, some understanding to general Linux operations, and a little bit of luck is needed, so newbies might not want to do this alone themselves.
Taking all these factors into consideration, leaving your blazing-fast UDMA/66 capable harddisk to the PIIX controller is not really a great loss (it is not likely that your disk can keep more than 33MB/s sustained transfer rate anyway). For those who unwilling to give up, seeking help from a local Linux guru would be a good idea --- you might even make some friends this way.
My hardware setup
Abit BP6, 128MB PC-100 SDRAM (1 DIMM), dual Celeron 300P @ 450MHz
Elsa Erazor III (32MB Riva TNT2) on AGP slot
Adaptec AHA-2940AU Ultra SCSI Adapter
HighPoint HPT366 IDE controller
Intel PIIX4 IDE controller
Enabling HPT366 with UDMA/66 support
Here we will briefly describe the procedure needed to enable HPT366 support through reconfiguring the Linux kernel. We assume that you already have your Linux system installed, and would like to go for the patched 2.2.13 kernel path. If you want to go to the development (2.3) kernel directly, you better have an idea about what you are doing, but the procedure will be largely the same.
Obtain the patch here and the 2.2.13 kernel from a local kernel mirror site.
Unpack the kernel source and apply the patch to the source tree.
% patch -p1 < ide.126.96.36.19991102.patch
Enable relevant kernel configuration options. In general you should enable the the "HPT366 chipset support", "Generic PCI bus-master DMA support", and "Use DMA by default when available" options in the "Block Devices" menu. You may want to take a look at my 2.2.10 kernel configuration, but I do not know if you can use them on 2.2.13 kernels or not. The kernel configuration utility can be called up through one of the following commands:
% make config
% make menuconfig
% make xconfig
Make, and then install the kernel with the following command (remember that you should also make and install the modules should you have ordered them in the previous step):
% make bzlilo
Make whatever preparations necessary for the possibility of boot failures (boot disks will be a good idea). Full backups may not be necessary, but do not quote me on that. When you feel that you are ready, keep your fingers crossed, and reboot.
If the new kernel boots and you see messages indicating that HPT366 and the disks attached to it, then you have successfully got it working. You may use hdparm to make sure that the drive is running as fast as it is supposed to be --- all modern 7200 RPM IDE disks should have transfer rates from 15MB/s to 20MB/s. For more information on handling the kernel, please refer to the Linux Kernel HOWTO
Enabling HPT366 without UDMA/66 support
The procedure above is all fine, but you do not always have the choice of compiling a new kernel for the system. This is especially true for those who are still in the process of installing Linux --- requiring a kernel compilation to obtain HPT366 support will undoubtedly create a deadlock. Fortunately there is a way out; however I would suggest that you reconsider (again!) putting the disk on the PIIX UDMA/33 channel before pursuing the following option.
Gert van der Knokke is the first to report that HPT366 can be activated by exploring the backward compatibility of the IDE controller. All you have to do is to issue the following command to the kernel through the LILO prompt (hold Shift before loading Linux) at bootup:
The arguments supplied represents the I/O addresses and the IRQ number used by HPT366 respectively. The third argument can be omitted; in that case, the driver will probe for the IRQ automagically. And this is the good news. The bad news is that the values vary from system to system, therefore you need to figure out the magic numbers in advance. Trial and error will definitely not work here.
Jonathan Smith sent in a link on how to do the number trick correctly by peeking into the /proc/pci file (the information you are looking for is in section "Installing Linux with the Ultra33"). It might also be possible to figure out the numbers through the control panel in Windows 95/98, but I have not personally tried that yet.
(I think maybe I should give a real example here because what you see in /proc/pci only remotely resembles the description on the Ultra-DMA mini-HOWTO. The following are taken from the /proc/pci file on my own machine:
Bus 0, device 19, function 0:
Unknown mass storage controller: Triones Technologies, Inc. HPT366 IDE UltraDMA/66 (rev 1).
Medium devsel. IRQ 11. Master Capable. Latency=120. Min Gnt=8.Max Lat=8.
I/O at 0xb000 [0xb001].
I/O at 0xb400 [0xb401].
I/O at 0xb800 [0xb801].
Bus 0, device 19, function 1:
Unknown mass storage controller: Triones Technologies, Inc. HPT366 IDE UltraDMA/66 (rev 1).
Medium devsel. IRQ 11. Master Capable. Latency=120. Min Gnt=8.Max Lat=8.
I/O at 0xbc00 [0xbc01].
I/O at 0xc000 [0xc001].
I/O at 0xc400 [0xc401].
The magic numbers for each channel are the first I/O address and two plus the second I/O address, so the boot time option to pass to the kernel in my case would be "ide2=0xb000,0xb402 ide3=0xbc00,0xc002".)
The procedure described above should work fine on most systems, but in some cases you might need to supply the IRQ numbers to the kernel as well. If that is the case, then change the kernel boot time option in the example above to "ide2=0xb000,0xb4022,11 ide3=0xbc00,0xc002,11" where the 3rd arguement is the IRQ number reported by /proc/pci. Acknowledgements to Shek Vincent who first reported this problem as well as the solution.
Note: Sotiris Karkalakos reported that the hack does not work properly on his Soyo SY-6BA+ IV motherboard and Quantum Fireball KA. Both are properly recognized by the kernel, but trying to use them resulted in a bunch of kernel error messages. You are advised to steer clear of the product before a solution comes up, and for those who know what the problem is, please contact Sotiris directly.
Installing Linux to an UDMA/66 drive
A couple of guys asked me this question within the first 24 hours of the publication of this page, therefore I might as well make this point clearer: you can install Linux on a disk attached to the HPT366 controller directly, and all the information you need is on this page. Below I will try to provide some more detailed instructions, and hopefully that will guide you through the process smoothly.
Before you start, please first read through the last section, "Enabling HPT366 without UDMA/66 support", as this is how we are going to get Linux working together with HPT366 without going through the kernerl building process in the first place (otherwise this would create a deadlock and nobody will be going anywhere). Next, if you feel like getting more information, hit this link for descriptions on installing Linux with other UDMA controllers. You can see that the instructions are quite similar, and you may refer to the article for a second opinion should any ambiguity occur in this document.
Boot with the installation floppy or CD-ROM supplied with your Linux distribution. After you have passed the boot process (there should be a menu or something coming up at this point), press Alt-F2 to switch to a different virtual console.
There should be a command prompt waiting there. Type in the following instruction:
# cat /proc/pci
You should see lots of information appeared on the screen. Find something that looks like the sample output shown at the end of the previous section. You may use Shift-PgUp and Shift-PgDn to scroll the display.
Compute the magic numbers as instructed in the previous section.
Reboot. This time when you see the boot prompt, type:
boot: linux ide2=0x????,0x???? ide3=0x????,0x???? What you see and the exact command to type varies from distribution to distribution. Check your installation manual or online help to make sure you are giving the right command.
This time the kernel should recognize the HPT366 channels and all the disks attached to them. Install as usual.
At the end of installation you should be offered the option of making Linux directly bootable from the disk or make boot floppies. I recommend you should have bootable floppies lying around in case something goes wrong, but whatever you do, you should modify lilo.conf and add the following line to it:
append="ide2=... ide3=..." Just like you typed in the boot command prompt. If you do not do it now, you will have to type it manually each and every time you boot, otherwise Linux will not load successfully. Thank George Gusciora for the reminder.
Booting from the HPT366 interface
There has been quite some confusion over how to boot from a disk connected to HPT366. Hedrick contributed greatly to the chaos since he is the one who said that "The HPT366 chipset in its current form is a non-bootable" in the kernel config help of HPT366 (but I still love the guy since he wrote the driver in the first place), and the fact that the few documents that actually exist contradict with each other does not help much either. After a bit of research, it turned out that my previous understanding to the affair is not entirely correct, and the transition process is actually quite trivial.
I said that because booting from the HPT366 channels is just the same as booting from the ordinary Intel PIIX channels (provided that your kernel have native support for HPT366): all the later LILO versions (at least after version 25) support up to 6 IDE devices (12 disks), and the Linux kernel itself can load the root filesystem from /dev/hda all the way to /dev/hdp, supporting theoretically up to 8 IDE devices. There is no need to enable "Boot off-board chipsets first support" in the kernel configuration or give "pci=reverse" arguments at boot time, because (based on user reports and a little bit of kernel reading) they do not seem of much use except further complicate the situation.
So suppose your Linux system is already installed on a disk connected to the HPT366 channel but is still unbootable, what should you do? Simple. All you have to do is to modify /etc/lilo.conf so that both the boot and root option points to the correct partition on the disk. (For example /dev/hde2 would be the 2nd partition on the disk connected as the primary master of the HPT366 controller, and both PIIX channels are not disabled. If one of the PIIX channel is disabled, then the disk would become /dev/hdc; if both PIIX channels are disabled, then the disk should be /dev/hda.) Type lilo to install LILO, reboot, adjust in your BIOS menu so that the disk becomes the boot disk, and reboot again. If this does not work, you can always boot the way you used to do --- using a boot disk or loadlin. For more information about LILO, please refer to the LILO mini-HOWTO or the LILO Manual accompanying the software.
If your Linux system disk is currently connected to the PIIX controller, the procedure will be slightly complicated, but the idea is still the same as described above:
Build yourself a new kernel with HPT366 and use it to make a boot floppy. In plain English, stick a floppy into the floppy drive and type "make bzdisk" in place of "make bzlilo" when building the kernel.
Change the default root device of the kernel with rdev to the root partition after the switch (see the discussions above to determine where your root filesystem will be after the switch). In the example above, type:
% rdev /dev/fd0 /dev/hde2
Try to boot with the floppy. It will definitely fail because you have not switched your disk to the proper location yet, but pay attention to see whether HPT366 is recognized by the kernel or not.
If the answer to the previous question is yes, then turn off your computer and switch the disk to the preplanned position under the HPT366 controller.
Boot with the floppy again. This time it should boot successfully, and you may use the knowledge provided in the previous paragraph to make Linux bootable again from the hard disk.
One thing worth mentioning is that although it took me quite some time to figure the whole thing out, the Ultra-DMA mini-HOWTO already gave accurate instructions similar to the ones here back in their January 1998 version. Hats off to the author of the document, Brion Vibber.
What to do when running into problems
The first thing to remember when you run into any kind of trouble is: don't panic! Suppose you have a working boot floppy ready, nearly all the mistakes you can make are completely recoverable. Even if you do not have boot floppies around, you can just download the rescue disk of your favorite distribution and and make the floppies on the other computers you have access to. All the problems can be solved, provided that you are calm and cool, and have some spare time in your hands.
Before doing anything else, read this document again and double-double check everything. People always seem to discover stupid mistakes minutes after sending out "help me" messages. However if you have checked everything again and again, and have read this page until you cannot see straight, then it would be time to take other actions. Turning to the newsgroups for help is a good option, but please do a Dejanews before posting anything on public forums.
The Abit mainboard newsgroup is appropriate for both general and Linux centric discussions on BE6, BP6, and the Hot Rod 66, though the last item is technically not a mainboard product. Aside from the HPT366 users all over the world, Abit also answers questions on the group from time to time. Monitor this group if you already have (or is planning to buy) one of these products. Since many Linux problems are not Linux specific, you can learn a lot here.
The other valuable resource you should definitely not miss is the Linux hardware newsgroup. General non-Linux problems (such as "why the HPT366 bios does not detect my HD at bootup" and the like) should not be raised here, but there are more Linux gurus here to help you with your Linux specific questions. Currently I monitor both groups on a regular basis.
If something goes wrong, it could be that you, me, Hedrick, or somebody else that have made the silly mistake. If you suspect the first two cases, you can send me messages directly besides going to the newsgroups. If you suspect the latter two cases, please send a message to Hedrick directly. The possibility of driver bugs are real, and it is the driver guy's responsibility to cover the hardware people's asses, so please do not be shy in reporting possible bugs.
Remember: do provide adequate information when turning to others for help, so that other people have a chance to figure out what indeed went wrong. It is a crowded net out there, therefore if you need to ask a question, you have better make it a good one!
Abit Computer Corp.
Linux IDE and UDMA patches from Hedrick
Linux kernel HOWTO
IDE Patch against kernel 2.2.12
Please send questions, comments, suggestions, or further information to me. They will be added to later revisions of this page for the benefit of others.
Last modified: Tue Dec 7 08:42:41 CST 1999