From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <linux-kernel-owner+willy=40w.ods.org-S262401AbVA0QTX@vger.kernel.org>
Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand
	id S262401AbVA0QTX (ORCPT <rfc822;willy@w.ods.org>);
	Thu, 27 Jan 2005 11:19:23 -0500
Received: (majordomo@vger.kernel.org) by vger.kernel.org id S262646AbVA0QTX
	(ORCPT <rfc822;linux-kernel-outgoing>);
	Thu, 27 Jan 2005 11:19:23 -0500
Received: from rproxy.gmail.com ([64.233.170.203]:22416 "EHLO rproxy.gmail.com")
	by vger.kernel.org with ESMTP id S262401AbVA0QTV (ORCPT
	<rfc822;linux-kernel@vger.kernel.org>);
	Thu, 27 Jan 2005 11:19:21 -0500
DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws;
        s=beta; d=gmail.com;
        h=received:message-id:date:from:reply-to:to:subject:mime-version:content-type:content-transfer-encoding;
        b=WkE08RtKWZ9EUKdgCOQ2zI1tiu4ZO9lWY16fT2r76fiANLY4NUJD53cbHmRR92iITdL7k1ATJRvX8RlMikBS6RQbFbD76qEQrh27OWwHc97Ade1B8CZAY0Gbn9j9Uk5OuvdmgZ7cpcJ+ceAEaBSV9sCC6kwAB8hwRgwC0AZPukA=
Message-ID: <5b64f7f050127081948af7a31@mail.gmail.com>
Date: Thu, 27 Jan 2005 11:19:20 -0500
From: Rahul Karnik <deathdruid@gmail.com>
Reply-To: Rahul Karnik <deathdruid@gmail.com>
To: lkml <linux-kernel@vger.kernel.org>
Subject: Flashing BIOS of a PCI IDE card (IT8212F)
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Sender: linux-kernel-owner@vger.kernel.org
X-Mailing-List: linux-kernel@vger.kernel.org

Hello,

I was just wondering if it is possible to flash the BIOS of a PCI IDE
card from within Linux. I have an OEM IT8212 card with a really old
BIOS which the vendor does not support with a BIOS flashing tool. ITE
Tech's flashing tool appears to work, but it fails to verify that the
flash was successful and indeed the ROM is unchanged.

How is the BIOS on such cards different from the firmware on other
cards? Is it possible to use the kernel firmware loader to load a
different image at runtime?

Thanks for the help,
Rahul

From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <linux-kernel-owner+willy=40w.ods.org-S262659AbVA0QsA@vger.kernel.org>
Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand
	id S262659AbVA0QsA (ORCPT <rfc822;willy@w.ods.org>);
	Thu, 27 Jan 2005 11:48:00 -0500
Received: (majordomo@vger.kernel.org) by vger.kernel.org id S262660AbVA0QsA
	(ORCPT <rfc822;linux-kernel-outgoing>);
	Thu, 27 Jan 2005 11:48:00 -0500
Received: from alog0435.analogic.com ([208.224.222.211]:45440 "EHLO
	chaos.analogic.com") by vger.kernel.org with ESMTP id S262659AbVA0Qrx
	(ORCPT <rfc822;linux-kernel@vger.kernel.org>);
	Thu, 27 Jan 2005 11:47:53 -0500
Date: Thu, 27 Jan 2005 11:47:08 -0500 (EST)
From: linux-os <linux-os@analogic.com>
Reply-To: linux-os@analogic.com
To: Rahul Karnik <deathdruid@gmail.com>
cc: lkml <linux-kernel@vger.kernel.org>
Subject: Re: Flashing BIOS of a PCI IDE card (IT8212F)
In-Reply-To: <5b64f7f050127081948af7a31@mail.gmail.com>
Message-ID: <Pine.LNX.4.61.0501271145340.22577@chaos.analogic.com>
References: <5b64f7f050127081948af7a31@mail.gmail.com>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed
Sender: linux-kernel-owner@vger.kernel.org
X-Mailing-List: linux-kernel@vger.kernel.org

On Thu, 27 Jan 2005, Rahul Karnik wrote:

> Hello,
>
> I was just wondering if it is possible to flash the BIOS of a PCI IDE
> card from within Linux. I have an OEM IT8212 card with a really old
> BIOS which the vendor does not support with a BIOS flashing tool. ITE
> Tech's flashing tool appears to work, but it fails to verify that the
> flash was successful and indeed the ROM is unchanged.
>
> How is the BIOS on such cards different from the firmware on other
> cards? Is it possible to use the kernel firmware loader to load a
> different image at runtime?
>
> Thanks for the help,
> Rahul
> -

Simple answer: forget it.

But... If you know the part number of the flash-RAM,
it is possible to use one of the flash-RAM writers
that may exist in your version of the kernel or to
write your own. Basically you write some unlock codes
at specified offsets (0x55, 0xaa, etc.), then you
write a command-code, then some data at its offset.

Writing to flash requires erasing it first. Therefore
if the write fails, you are in deep dodo. Typically
flash RAM exists in 64k pages. Something as small as
a BIOS probably uses only one 64k page, but you
need to know what one inside the chip is actually
used.

There are other types of flash (micro-wire) that
are accessed only one bit at a time. There is such
code in several of the Ethernet Controllers. Although
writing code to read/erase/write any of these devices
is not difficult, you need to be able to experiment
to get it right. Because of different implementation
details, some flash can only be accessed in 32-bit
longs, some in 16-bit shorts, etc. Some single-bit
flash requires you to write an unused bit, with
some, the extra bit goes on the end, some it
goes first. Some require 16 bits written backwards,
etc. Without a spare device to experiment with, you
are in a world of hurt if your initial guess of
the implementation details is wrong.

Cheers,
Dick Johnson
Penguin : Linux version 2.6.10 on an i686 machine (5537.79 BogoMips).
  Notice : All mail here is now cached for review by Dictator Bush.
                  98.36% of all statistics are fiction.

From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <linux-kernel-owner+willy=40w.ods.org-S261723AbVA3Qoa@vger.kernel.org>
Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand
	id S261723AbVA3Qoa (ORCPT <rfc822;willy@w.ods.org>);
	Sun, 30 Jan 2005 11:44:30 -0500
Received: (majordomo@vger.kernel.org) by vger.kernel.org id S261724AbVA3Qoa
	(ORCPT <rfc822;linux-kernel-outgoing>);
	Sun, 30 Jan 2005 11:44:30 -0500
Received: from clock-tower.bc.nu ([81.2.110.250]:42447 "EHLO
	lxorguk.ukuu.org.uk") by vger.kernel.org with ESMTP id S261723AbVA3Qo1
	(ORCPT <rfc822;linux-kernel@vger.kernel.org>);
	Sun, 30 Jan 2005 11:44:27 -0500
Subject: Re: Flashing BIOS of a PCI IDE card (IT8212F)
From: Alan Cox <alan@lxorguk.ukuu.org.uk>
To: Rahul Karnik <deathdruid@gmail.com>
Cc: lkml <linux-kernel@vger.kernel.org>
In-Reply-To: <5b64f7f050127081948af7a31@mail.gmail.com>
References: <5b64f7f050127081948af7a31@mail.gmail.com>
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
Message-Id: <1106844207.14787.48.camel@localhost.localdomain>
Mime-Version: 1.0
X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) 
Date: Sun, 30 Jan 2005 15:39:41 +0000
Sender: linux-kernel-owner@vger.kernel.org
X-Mailing-List: linux-kernel@vger.kernel.org

On Iau, 2005-01-27 at 16:19, Rahul Karnik wrote:
> card from within Linux. I have an OEM IT8212 card with a really old
> BIOS which the vendor does not support with a BIOS flashing tool. ITE
> Tech's flashing tool appears to work, but it fails to verify that the
> flash was successful and indeed the ROM is unchanged.

Not every vendor bothers to make the flash writable from the PCI card,
and if the ROM is unchanged that seems likely.

Note that with the 2.6.10-ac kernels if you have a BIOS in raid mode you
can force it out of raid mode with a boot option. You cannot however do
the same in the other direction.


