From owner-freebsd-drivers@FreeBSD.ORG  Mon Sep 18 08:20:57 2006
Return-Path: <owner-freebsd-drivers@FreeBSD.ORG>
X-Original-To: freebsd-drivers@freebsd.org
Delivered-To: freebsd-drivers@freebsd.org
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 1921816A415
	for <freebsd-drivers@freebsd.org>; Mon, 18 Sep 2006 08:20:57 +0000 (UTC)
	(envelope-from mail@sashi.de)
Received: from server56.greatnet.de (server56.greatnet.de [83.133.97.162])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 8E84743D76
	for <freebsd-drivers@freebsd.org>; Mon, 18 Sep 2006 08:20:55 +0000 (GMT)
	(envelope-from mail@sashi.de)
Received: from [192.168.1.70] (unknown [87.193.41.167])
	by server56.greatnet.de (Postfix) with ESMTP id 1216D60A6F
	for <freebsd-drivers@freebsd.org>;
	Mon, 18 Sep 2006 10:20:49 +0200 (CEST)
Message-ID: <450E571A.8030200@sashi.de>
Date: Mon, 18 Sep 2006 10:21:46 +0200
From: Marian Asokarajan <mail@sashi.de>
User-Agent: Mozilla Thunderbird 1.0.6 (X11/20051013)
X-Accept-Language: en-us, en
MIME-Version: 1.0
To: freebsd-drivers@freebsd.org
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Subject: SDHCI Device Driver (first steps)
X-BeenThere: freebsd-drivers@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: mail@sashi.de
List-Id: Writing device drivers for FreeBSD <freebsd-drivers.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-drivers>, 
	<mailto:freebsd-drivers-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/freebsd-drivers>
List-Post: <mailto:freebsd-drivers@freebsd.org>
List-Help: <mailto:freebsd-drivers-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-drivers>,
	<mailto:freebsd-drivers-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 18 Sep 2006 08:20:57 -0000

Hello,

I'm trying to write an universal SD Host-Controller Device Driver,
which I'd like to contribute to the FreeBSD community.
So far the driver is able to recognize SD card insertion and removal.
Via a device node (/dev/sdhci0), it's also possible to dump
the SDHC's register set.

Could someone please help testing the code ?
The kernel module and sources can be download here:
http://www.sashi.de/downloads/freebsd/sdhci/sdhcidd-0.0.1.tbz
* NOTE: The driver is experimental and might crash your system!

I'm developing it on an ASUS laptop with a RICOH chipset and
it's the only chipset (beside Texas Instruments) supported.
Therefore, it would be great to receive a "pciconf -lv" block
of other SD host controllers.

Thanks for your help.

Regards,
Sashi

From owner-freebsd-drivers@FreeBSD.ORG  Mon Sep 18 11:27:10 2006
Return-Path: <owner-freebsd-drivers@FreeBSD.ORG>
X-Original-To: freebsd-drivers@FreeBSD.ORG
Delivered-To: freebsd-drivers@FreeBSD.ORG
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 44E6916A403
	for <freebsd-drivers@FreeBSD.ORG>; Mon, 18 Sep 2006 11:27:10 +0000 (UTC)
	(envelope-from olli@lurza.secnetix.de)
Received: from lurza.secnetix.de (lurza.secnetix.de [83.120.8.8])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 7B15843D49
	for <freebsd-drivers@FreeBSD.ORG>; Mon, 18 Sep 2006 11:27:09 +0000 (GMT)
	(envelope-from olli@lurza.secnetix.de)
Received: from lurza.secnetix.de (jylqnu@localhost [127.0.0.1])
	by lurza.secnetix.de (8.13.4/8.13.4) with ESMTP id k8IBR3PF093001;
	Mon, 18 Sep 2006 13:27:08 +0200 (CEST)
	(envelope-from oliver.fromme@secnetix.de)
Received: (from olli@localhost)
	by lurza.secnetix.de (8.13.4/8.13.1/Submit) id k8IBR3uZ093000;
	Mon, 18 Sep 2006 13:27:03 +0200 (CEST) (envelope-from olli)
Date: Mon, 18 Sep 2006 13:27:03 +0200 (CEST)
Message-Id: <200609181127.k8IBR3uZ093000@lurza.secnetix.de>
From: Oliver Fromme <olli@lurza.secnetix.de>
To: freebsd-drivers@FreeBSD.ORG, mail@sashi.de
In-Reply-To: <450E571A.8030200@sashi.de>
X-Newsgroups: list.freebsd-drivers
User-Agent: tin/1.8.0-20051224 ("Ronay") (UNIX) (FreeBSD/4.11-STABLE (i386))
X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.1.2
	(lurza.secnetix.de [127.0.0.1]);
	Mon, 18 Sep 2006 13:27:08 +0200 (CEST)
Cc: 
Subject: Re: SDHCI Device Driver (first steps)
X-BeenThere: freebsd-drivers@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: Writing device drivers for FreeBSD <freebsd-drivers.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-drivers>, 
	<mailto:freebsd-drivers-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/freebsd-drivers>
List-Post: <mailto:freebsd-drivers@freebsd.org>
List-Help: <mailto:freebsd-drivers-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-drivers>,
	<mailto:freebsd-drivers-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 18 Sep 2006 11:27:10 -0000

Marian Asokarajan wrote:
 > I'm trying to write an universal SD Host-Controller Device Driver,
 > which I'd like to contribute to the FreeBSD community.

That's very cool!

 > So far the driver is able to recognize SD card insertion and removal.
 > Via a device node (/dev/sdhci0), it's also possible to dump
 > the SDHC's register set.
 > 
 > Could someone please help testing the code ?
 > The kernel module and sources can be download here:
 > http://www.sashi.de/downloads/freebsd/sdhci/sdhcidd-0.0.1.tbz
 > * NOTE: The driver is experimental and might crash your system!

For which version of FreeBSD is it?  I'm running RELENG_6 on
my notebook, which has two such slots (one for SD cards and
one Sony memory sticks).  If your driver works on RELENG_6,
I can try it when I have some free time.

none3@pci6:9:2: class=0x080500 card=0xc01a144d chip=0x08221180 rev=0x17 hdr=0x00
    vendor   = 'Ricoh Co Ltd'
    device   = 'SD Bus Host Adapter'
    class    = base peripheral
none4@pci6:9:3: class=0x088000 card=0xc01a144d chip=0x05921180 rev=0x08 hdr=0x00
    vendor   = 'Ricoh Co Ltd'
    device   = 'Memory Stick Bus Host Adapter'
    class    = base peripheral

It's a Samsung X20-XVM 1600-V notebook (Pentium-M / Centrino
with i915 chipset).  I like it very much, because all of the
components are supported by FreeBSD, except for the SD and
memory stick slots.  I don't have any memory sticks, so I
don't care, but I do have an SD card which I use with my
Zaurus PDA (running Linux), and it would be very nice to
access it directly with the notebook, without having to use
a USB cardreader.

Best regards
   Oliver

-- 
Oliver Fromme,  secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing
Dienstleistungen mit Schwerpunkt FreeBSD: http://www.secnetix.de/bsd
Any opinions expressed in this message may be personal to the author
and may not necessarily reflect the opinions of secnetix in any way.

"C++ is over-complicated nonsense. And Bjorn Shoestrap's book
a danger to public health. I tried reading it once, I was in
recovery for months."
        -- Cliff Sarginson

From owner-freebsd-drivers@FreeBSD.ORG  Mon Sep 18 11:57:18 2006
Return-Path: <owner-freebsd-drivers@FreeBSD.ORG>
X-Original-To: freebsd-drivers@FreeBSD.ORG
Delivered-To: freebsd-drivers@FreeBSD.ORG
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 4515216A4D2
	for <freebsd-drivers@FreeBSD.ORG>; Mon, 18 Sep 2006 11:57:18 +0000 (UTC)
	(envelope-from mail@sashi.de)
Received: from server56.greatnet.de (server56.greatnet.de [83.133.97.162])
	by mx1.FreeBSD.org (Postfix) with ESMTP id B26D443E94
	for <freebsd-drivers@FreeBSD.ORG>; Mon, 18 Sep 2006 11:54:42 +0000 (GMT)
	(envelope-from mail@sashi.de)
Received: from [192.168.1.70] (unknown [87.193.41.167])
	by server56.greatnet.de (Postfix) with ESMTP id BA48060DE1;
	Mon, 18 Sep 2006 13:54:40 +0200 (CEST)
Message-ID: <450E8941.2060301@sashi.de>
Date: Mon, 18 Sep 2006 13:55:45 +0200
From: Marian Asokarajan <mail@sashi.de>
User-Agent: Mozilla Thunderbird 1.0.6 (X11/20051013)
X-Accept-Language: en-us, en
MIME-Version: 1.0
To: Oliver Fromme <olli@lurza.secnetix.de>
References: <200609181127.k8IBR3uZ093000@lurza.secnetix.de>
In-Reply-To: <200609181127.k8IBR3uZ093000@lurza.secnetix.de>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Cc: freebsd-drivers@FreeBSD.ORG
Subject: Re: SDHCI Device Driver (first steps)
X-BeenThere: freebsd-drivers@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: mail@sashi.de
List-Id: Writing device drivers for FreeBSD <freebsd-drivers.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-drivers>, 
	<mailto:freebsd-drivers-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/freebsd-drivers>
List-Post: <mailto:freebsd-drivers@freebsd.org>
List-Help: <mailto:freebsd-drivers-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-drivers>,
	<mailto:freebsd-drivers-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 18 Sep 2006 11:57:18 -0000

Oliver Fromme wrote:
> For which version of FreeBSD is it?  I'm running RELENG_6 on
Sorry, I forgot to mention it. I'm working with 6.0-RELEASE.

> none3@pci6:9:2: class=0x080500 card=0xc01a144d chip=0x08221180 rev=0x17 hdr=0x00
That's the same config (ricoh chip) as it is in my Asus (A6vm) Laptop,
so it should work perfectly (i hope :) ) with yours!
The driver is only for the SD Bus Host Adapter.

> Zaurus PDA (running Linux), and it would be very nice to
> access it directly with the notebook, without having to use
> a USB cardreader.
That's the same reason why I started working on the driver ;-)
It's a bit challenging to write a device driver on your spare time
with rare documentation, so I cannot promise you anything.

Thanks for your help.

Best Regards,
Sashi

From owner-freebsd-drivers@FreeBSD.ORG  Mon Sep 18 14:40:24 2006
Return-Path: <owner-freebsd-drivers@FreeBSD.ORG>
X-Original-To: freebsd-drivers@freebsd.org
Delivered-To: freebsd-drivers@freebsd.org
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 5DFC316A49E
	for <freebsd-drivers@freebsd.org>; Mon, 18 Sep 2006 14:40:24 +0000 (UTC)
	(envelope-from imp@bsdimp.com)
Received: from harmony.bsdimp.com (vc4-2-0-87.dsl.netrack.net [199.45.160.85])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 39E6743D6A
	for <freebsd-drivers@freebsd.org>; Mon, 18 Sep 2006 14:39:07 +0000 (GMT)
	(envelope-from imp@bsdimp.com)
Received: from localhost (localhost [127.0.0.1])
	by harmony.bsdimp.com (8.13.4/8.13.4) with ESMTP id k8IEcgIY018902;
	Mon, 18 Sep 2006 08:38:43 -0600 (MDT) (envelope-from imp@bsdimp.com)
Date: Mon, 18 Sep 2006 08:37:58 -0600 (MDT)
Message-Id: <20060918.083758.63053354.imp@bsdimp.com>
To: mail@sashi.de
From: "M. Warner Losh" <imp@bsdimp.com>
In-Reply-To: <450E571A.8030200@sashi.de>
References: <450E571A.8030200@sashi.de>
X-Mailer: Mew version 4.2 on Emacs 21.3 / Mule 5.0 (SAKAKI)
Mime-Version: 1.0
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.0
	(harmony.bsdimp.com [127.0.0.1]);
	Mon, 18 Sep 2006 08:38:43 -0600 (MDT)
Cc: freebsd-drivers@freebsd.org
Subject: Re: SDHCI Device Driver (first steps)
X-BeenThere: freebsd-drivers@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: Writing device drivers for FreeBSD <freebsd-drivers.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-drivers>, 
	<mailto:freebsd-drivers-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/freebsd-drivers>
List-Post: <mailto:freebsd-drivers@freebsd.org>
List-Help: <mailto:freebsd-drivers-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-drivers>,
	<mailto:freebsd-drivers-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 18 Sep 2006 14:40:24 -0000

In message: <450E571A.8030200@sashi.de>
            Marian Asokarajan <mail@sashi.de> writes:
: Hello,
: 
: I'm trying to write an universal SD Host-Controller Device Driver,
: which I'd like to contribute to the FreeBSD community.
: So far the driver is able to recognize SD card insertion and removal.
: Via a device node (/dev/sdhci0), it's also possible to dump
: the SDHC's register set.
: 
: Could someone please help testing the code ?
: The kernel module and sources can be download here:
: http://www.sashi.de/downloads/freebsd/sdhci/sdhcidd-0.0.1.tbz
: * NOTE: The driver is experimental and might crash your system!
: 
: I'm developing it on an ASUS laptop with a RICOH chipset and
: it's the only chipset (beside Texas Instruments) supported.
: Therefore, it would be great to receive a "pciconf -lv" block
: of other SD host controllers.
: 
: Thanks for your help.

I'll be happy to do so.

I too am working on the SD/MMC card stack.  I have one boot loader for
the AT91RM9200 working, and have been hacking on a quick and dirty
driver for that part, but it needs to have the transport layer
separated out from the MMC/SD protocol goo.  Maybe we can work
together to produce something that fits both our needs?

Warner

From owner-freebsd-drivers@FreeBSD.ORG  Mon Sep 18 16:40:11 2006
Return-Path: <owner-freebsd-drivers@FreeBSD.ORG>
X-Original-To: freebsd-drivers@freebsd.org
Delivered-To: freebsd-drivers@freebsd.org
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 5E1B016A403
	for <freebsd-drivers@freebsd.org>; Mon, 18 Sep 2006 16:40:11 +0000 (UTC)
	(envelope-from mail@sashi.de)
Received: from server56.greatnet.de (server56.greatnet.de [83.133.97.162])
	by mx1.FreeBSD.org (Postfix) with ESMTP id D6B7743D45
	for <freebsd-drivers@freebsd.org>; Mon, 18 Sep 2006 16:40:10 +0000 (GMT)
	(envelope-from mail@sashi.de)
Received: from [49.1.1.104] (p54B02598.dip0.t-ipconnect.de [84.176.37.152])
	by server56.greatnet.de (Postfix) with ESMTP id 2370F609B1;
	Mon, 18 Sep 2006 18:39:56 +0200 (CEST)
Message-ID: <450ECC1C.6070005@sashi.de>
Date: Mon, 18 Sep 2006 18:41:00 +0200
From: Marian Asokarajan <mail@sashi.de>
User-Agent: Mozilla Thunderbird 1.0.6 (X11/20051013)
X-Accept-Language: en-us, en
MIME-Version: 1.0
To: "M. Warner Losh" <imp@bsdimp.com>
References: <450E571A.8030200@sashi.de>
	<20060918.083758.63053354.imp@bsdimp.com>
In-Reply-To: <20060918.083758.63053354.imp@bsdimp.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Cc: freebsd-drivers@freebsd.org
Subject: Re: SDHCI Device Driver (first steps)
X-BeenThere: freebsd-drivers@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: mail@sashi.de
List-Id: Writing device drivers for FreeBSD <freebsd-drivers.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-drivers>, 
	<mailto:freebsd-drivers-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/freebsd-drivers>
List-Post: <mailto:freebsd-drivers@freebsd.org>
List-Help: <mailto:freebsd-drivers-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-drivers>,
	<mailto:freebsd-drivers-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 18 Sep 2006 16:40:11 -0000

M. Warner Losh wrote:
> In message: <450E571A.8030200@sashi.de>
> I too am working on the SD/MMC card stack.  I have one boot loader for
> the AT91RM9200 working, and have been hacking on a quick and dirty
> driver for that part, but it needs to have the transport layer
> separated out from the MMC/SD protocol goo.  Maybe we can work
> together to produce something that fits both our needs?
Ofcourse, I'd love to help you out!
My goal is to implement a SD-Bus on which the SD/SDIO drivers can
attach to. My knowledge of FreeBSD Kernel is poor and at the moment I'm
walking through driver sources of usb, trying to understand the
(New-)Bus architecture (hope it's the right place?!).

So if you still want to work with me ;-) , I could implement the bus
interface on which your MMC/SD stack can attach to.

Regards,
Sashi

From owner-freebsd-drivers@FreeBSD.ORG  Mon Sep 18 16:59:52 2006
Return-Path: <owner-freebsd-drivers@FreeBSD.ORG>
X-Original-To: freebsd-drivers@freebsd.org
Delivered-To: freebsd-drivers@freebsd.org
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 5CDC516A40F
	for <freebsd-drivers@freebsd.org>; Mon, 18 Sep 2006 16:59:52 +0000 (UTC)
	(envelope-from imp@bsdimp.com)
Received: from harmony.bsdimp.com (vc4-2-0-87.dsl.netrack.net [199.45.160.85])
	by mx1.FreeBSD.org (Postfix) with ESMTP id E814143D7C
	for <freebsd-drivers@freebsd.org>; Mon, 18 Sep 2006 16:59:45 +0000 (GMT)
	(envelope-from imp@bsdimp.com)
Received: from localhost (localhost [127.0.0.1])
	by harmony.bsdimp.com (8.13.4/8.13.4) with ESMTP id k8IGvtsv020792;
	Mon, 18 Sep 2006 10:57:55 -0600 (MDT) (envelope-from imp@bsdimp.com)
Date: Mon, 18 Sep 2006 10:57:09 -0600 (MDT)
Message-Id: <20060918.105709.179960957.imp@bsdimp.com>
To: mail@sashi.de
From: "M. Warner Losh" <imp@bsdimp.com>
In-Reply-To: <20060918.083758.63053354.imp@bsdimp.com>
References: <450E571A.8030200@sashi.de>
	<20060918.083758.63053354.imp@bsdimp.com>
X-Mailer: Mew version 4.2 on Emacs 21.3 / Mule 5.0 (SAKAKI)
Mime-Version: 1.0
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.0
	(harmony.bsdimp.com [127.0.0.1]);
	Mon, 18 Sep 2006 10:57:56 -0600 (MDT)
Cc: freebsd-drivers@freebsd.org
Subject: Re: SDHCI Device Driver (first steps)
X-BeenThere: freebsd-drivers@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: Writing device drivers for FreeBSD <freebsd-drivers.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-drivers>, 
	<mailto:freebsd-drivers-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/freebsd-drivers>
List-Post: <mailto:freebsd-drivers@freebsd.org>
List-Help: <mailto:freebsd-drivers-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-drivers>,
	<mailto:freebsd-drivers-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 18 Sep 2006 16:59:52 -0000

In message: <20060918.083758.63053354.imp@bsdimp.com>
            "M. Warner Losh" <imp@bsdimp.com> writes:
: In message: <450E571A.8030200@sashi.de>
:             Marian Asokarajan <mail@sashi.de> writes:
: : Hello,
: : 
: : I'm trying to write an universal SD Host-Controller Device Driver,
: : which I'd like to contribute to the FreeBSD community.
: : So far the driver is able to recognize SD card insertion and removal.
: : Via a device node (/dev/sdhci0), it's also possible to dump
: : the SDHC's register set.
: : 
: : Could someone please help testing the code ?
: : The kernel module and sources can be download here:
: : http://www.sashi.de/downloads/freebsd/sdhci/sdhcidd-0.0.1.tbz
: : * NOTE: The driver is experimental and might crash your system!

It crashes mine.  I did tweak it a little to make it reconize the host
controller generically (there's little chance we'd keep up with all
the bridges anyway).

What's the current level?  I didn't get it to see insert/remove from
my slot:

none6@pci6:4:3: class=0x018000 card=0x30a4103c chip=0x8033104c rev=0x00 hdr=0x00
    vendor   = 'Texas Instruments (TI)'
    device   = 'PCIxx21 Integrated FlashMedia Controller'
    class    = mass storage

There's tests for slots that aren't quite right.  It and's with 0x70,
but tests to see > 5, which it always will be if any of the bits are
set.

The code should use more of the higher level interfaces in
FreeBSD for accessing the pci bus.

The code should stive to be more style(9) compliant.  Its style is so
different from the usual as to be difficult to read.

Warner

: : I'm developing it on an ASUS laptop with a RICOH chipset and
: : it's the only chipset (beside Texas Instruments) supported.
: : Therefore, it would be great to receive a "pciconf -lv" block
: : of other SD host controllers.
: : 
: : Thanks for your help.
: 
: I'll be happy to do so.
: 
: I too am working on the SD/MMC card stack.  I have one boot loader for
: the AT91RM9200 working, and have been hacking on a quick and dirty
: driver for that part, but it needs to have the transport layer
: separated out from the MMC/SD protocol goo.  Maybe we can work
: together to produce something that fits both our needs?

From owner-freebsd-drivers@FreeBSD.ORG  Mon Sep 18 17:05:43 2006
Return-Path: <owner-freebsd-drivers@FreeBSD.ORG>
X-Original-To: freebsd-drivers@FreeBSD.ORG
Delivered-To: freebsd-drivers@FreeBSD.ORG
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id D12B616A407
	for <freebsd-drivers@FreeBSD.ORG>; Mon, 18 Sep 2006 17:05:43 +0000 (UTC)
	(envelope-from imp@bsdimp.com)
Received: from harmony.bsdimp.com (vc4-2-0-87.dsl.netrack.net [199.45.160.85])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 5EFFA43D53
	for <freebsd-drivers@FreeBSD.ORG>; Mon, 18 Sep 2006 17:05:43 +0000 (GMT)
	(envelope-from imp@bsdimp.com)
Received: from localhost (localhost [127.0.0.1])
	by harmony.bsdimp.com (8.13.4/8.13.4) with ESMTP id k8IH4Zu0020888;
	Mon, 18 Sep 2006 11:04:35 -0600 (MDT) (envelope-from imp@bsdimp.com)
Date: Mon, 18 Sep 2006 11:03:51 -0600 (MDT)
Message-Id: <20060918.110351.-233672614.imp@bsdimp.com>
To: mail@sashi.de
From: "M. Warner Losh" <imp@bsdimp.com>
In-Reply-To: <450ECC1C.6070005@sashi.de>
References: <450E571A.8030200@sashi.de>
	<20060918.083758.63053354.imp@bsdimp.com>
	<450ECC1C.6070005@sashi.de>
X-Mailer: Mew version 4.2 on Emacs 21.3 / Mule 5.0 (SAKAKI)
Mime-Version: 1.0
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.0
	(harmony.bsdimp.com [127.0.0.1]);
	Mon, 18 Sep 2006 11:04:36 -0600 (MDT)
Cc: freebsd-drivers@FreeBSD.ORG
Subject: Re: SDHCI Device Driver (first steps)
X-BeenThere: freebsd-drivers@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: Writing device drivers for FreeBSD <freebsd-drivers.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-drivers>, 
	<mailto:freebsd-drivers-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/freebsd-drivers>
List-Post: <mailto:freebsd-drivers@freebsd.org>
List-Help: <mailto:freebsd-drivers-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-drivers>,
	<mailto:freebsd-drivers-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 18 Sep 2006 17:05:43 -0000

In message: <450ECC1C.6070005@sashi.de>
            Marian Asokarajan <mail@sashi.de> writes:
: M. Warner Losh wrote:
: > In message: <450E571A.8030200@sashi.de>
: > I too am working on the SD/MMC card stack.  I have one boot loader for
: > the AT91RM9200 working, and have been hacking on a quick and dirty
: > driver for that part, but it needs to have the transport layer
: > separated out from the MMC/SD protocol goo.  Maybe we can work
: > together to produce something that fits both our needs?
: Ofcourse, I'd love to help you out!
: My goal is to implement a SD-Bus on which the SD/SDIO drivers can
: attach to. My knowledge of FreeBSD Kernel is poor and at the moment I'm
: walking through driver sources of usb, trying to understand the
: (New-)Bus architecture (hope it's the right place?!).

Don't use usb driver as a good example of how to write FreeBSD driver
code.  It was ported from NetBSD badly.

pccard might be a better place to look.

: So if you still want to work with me ;-) , I could implement the bus
: interface on which your MMC/SD stack can attach to.

Sounds cool.

Warner

From owner-freebsd-drivers@FreeBSD.ORG  Tue Sep 19 13:20:10 2006
Return-Path: <owner-freebsd-drivers@FreeBSD.ORG>
X-Original-To: freebsd-drivers@freebsd.org
Delivered-To: freebsd-drivers@freebsd.org
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 0DB9A16A412
	for <freebsd-drivers@freebsd.org>; Tue, 19 Sep 2006 13:20:09 +0000 (UTC)
	(envelope-from bounces@nabble.com)
Received: from talk.nabble.com (www.nabble.com [72.21.53.35])
	by mx1.FreeBSD.org (Postfix) with ESMTP id BD4F443D5A
	for <freebsd-drivers@freebsd.org>; Tue, 19 Sep 2006 13:20:09 +0000 (GMT)
	(envelope-from bounces@nabble.com)
Received: from [72.21.53.38] (helo=jubjub.nabble.com)
	by talk.nabble.com with esmtp (Exim 4.50) id 1GPfWC-0007AP-VN
	for freebsd-drivers@freebsd.org; Tue, 19 Sep 2006 06:20:08 -0700
Message-ID: <6387977.post@talk.nabble.com>
Date: Tue, 19 Sep 2006 06:20:08 -0700 (PDT)
From: Gireesh <gireesh.nagabhushana@neterion.com>
To: freebsd-drivers@freebsd.org
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Nabble-From: gireesh.nagabhushana@neterion.com
Subject: Reading configuration file from driver during load
X-BeenThere: freebsd-drivers@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: Writing device drivers for FreeBSD <freebsd-drivers.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-drivers>, 
	<mailto:freebsd-drivers-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/freebsd-drivers>
List-Post: <mailto:freebsd-drivers@freebsd.org>
List-Help: <mailto:freebsd-drivers-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-drivers>,
	<mailto:freebsd-drivers-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 19 Sep 2006 13:20:10 -0000


Hi All,

I have a driver which has some parameters hardcoded as of now. It requires
values of these parameters to be available during load (during attach
function). My requirement is to read these parameters from a configuration
file so that we can load driver with different values to parameters without
rebuilding driver. 
Is there any way of reading such configuration files from driver during
load?

Thanks,
Gireesh
-- 
View this message in context: http://www.nabble.com/Reading-configuration-file-from-driver-during-load-tf2298986.html#a6387977
Sent from the freebsd-drivers mailing list archive at Nabble.com.


From owner-freebsd-drivers@FreeBSD.ORG  Tue Sep 19 13:46:20 2006
Return-Path: <owner-freebsd-drivers@FreeBSD.ORG>
X-Original-To: freebsd-drivers@FreeBSD.ORG
Delivered-To: freebsd-drivers@FreeBSD.ORG
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 3852A16A412
	for <freebsd-drivers@FreeBSD.ORG>; Tue, 19 Sep 2006 13:46:20 +0000 (UTC)
	(envelope-from olli@lurza.secnetix.de)
Received: from lurza.secnetix.de (lurza.secnetix.de [83.120.8.8])
	by mx1.FreeBSD.org (Postfix) with ESMTP id B4FA843D5F
	for <freebsd-drivers@FreeBSD.ORG>; Tue, 19 Sep 2006 13:46:16 +0000 (GMT)
	(envelope-from olli@lurza.secnetix.de)
Received: from lurza.secnetix.de (bqjylq@localhost [127.0.0.1])
	by lurza.secnetix.de (8.13.4/8.13.4) with ESMTP id k8JDk9jl076220;
	Tue, 19 Sep 2006 15:46:14 +0200 (CEST)
	(envelope-from oliver.fromme@secnetix.de)
Received: (from olli@localhost)
	by lurza.secnetix.de (8.13.4/8.13.1/Submit) id k8JDk9b3076219;
	Tue, 19 Sep 2006 15:46:09 +0200 (CEST) (envelope-from olli)
Date: Tue, 19 Sep 2006 15:46:09 +0200 (CEST)
Message-Id: <200609191346.k8JDk9b3076219@lurza.secnetix.de>
From: Oliver Fromme <olli@lurza.secnetix.de>
To: freebsd-drivers@FreeBSD.ORG, gireesh.nagabhushana@neterion.com
In-Reply-To: <6387977.post@talk.nabble.com>
X-Newsgroups: list.freebsd-drivers
User-Agent: tin/1.8.0-20051224 ("Ronay") (UNIX) (FreeBSD/4.11-STABLE (i386))
X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.1.2
	(lurza.secnetix.de [127.0.0.1]);
	Tue, 19 Sep 2006 15:46:15 +0200 (CEST)
Cc: 
Subject: Re: Reading configuration file from driver during load
X-BeenThere: freebsd-drivers@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: freebsd-drivers@FreeBSD.ORG, gireesh.nagabhushana@neterion.com
List-Id: Writing device drivers for FreeBSD <freebsd-drivers.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-drivers>, 
	<mailto:freebsd-drivers-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/freebsd-drivers>
List-Post: <mailto:freebsd-drivers@freebsd.org>
List-Help: <mailto:freebsd-drivers-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-drivers>,
	<mailto:freebsd-drivers-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 19 Sep 2006 13:46:20 -0000

Gireesh wrote:
 > I have a driver which has some parameters hardcoded as of now. It requires
 > values of these parameters to be available during load (during attach
 > function). My requirement is to read these parameters from a configuration
 > file so that we can load driver with different values to parameters without
 > rebuilding driver. 

I think that sysctl or kenv variables are best suited for
that purpose.  There are a lot of examples for that in
existing drivers.

Best regards
   Oliver

-- 
Oliver Fromme,  secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing
Dienstleistungen mit Schwerpunkt FreeBSD: http://www.secnetix.de/bsd
Any opinions expressed in this message may be personal to the author
and may not necessarily reflect the opinions of secnetix in any way.

We're sysadmins.  To us, data is a protocol-overhead.

From owner-freebsd-drivers@FreeBSD.ORG  Tue Sep 19 13:54:02 2006
Return-Path: <owner-freebsd-drivers@FreeBSD.ORG>
X-Original-To: freebsd-drivers@freebsd.org
Delivered-To: freebsd-drivers@freebsd.org
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 9DD5A16A416
	for <freebsd-drivers@freebsd.org>; Tue, 19 Sep 2006 13:54:02 +0000 (UTC)
	(envelope-from mail@sashi.de)
Received: from server56.greatnet.de (server56.greatnet.de [83.133.97.162])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 9EF6A43D49
	for <freebsd-drivers@freebsd.org>; Tue, 19 Sep 2006 13:53:56 +0000 (GMT)
	(envelope-from mail@sashi.de)
Received: from [192.168.1.70] (unknown [84.245.168.227])
	by server56.greatnet.de (Postfix) with ESMTP id 0BEAC60A7E;
	Tue, 19 Sep 2006 15:53:51 +0200 (CEST)
Message-ID: <450FF6B2.2000908@sashi.de>
Date: Tue, 19 Sep 2006 15:54:58 +0200
From: Marian Asokarajan <mail@sashi.de>
User-Agent: Mozilla Thunderbird 1.0.6 (X11/20051013)
X-Accept-Language: en-us, en
MIME-Version: 1.0
To: "M. Warner Losh" <imp@bsdimp.com>
References: <450E571A.8030200@sashi.de>	<20060918.083758.63053354.imp@bsdimp.com>
	<20060918.105709.179960957.imp@bsdimp.com>
In-Reply-To: <20060918.105709.179960957.imp@bsdimp.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Cc: freebsd-drivers@freebsd.org
Subject: Re: SDHCI Device Driver (first steps)
X-BeenThere: freebsd-drivers@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: Writing device drivers for FreeBSD <freebsd-drivers.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-drivers>, 
	<mailto:freebsd-drivers-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/freebsd-drivers>
List-Post: <mailto:freebsd-drivers@freebsd.org>
List-Help: <mailto:freebsd-drivers-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-drivers>,
	<mailto:freebsd-drivers-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 19 Sep 2006 13:54:02 -0000

M. Warner Losh wrote:
> : : * NOTE: The driver is experimental and might crash your system!
> 
> It crashes mine.  I did tweak it a little to make it reconize the host
oops. Seems chip 0x8033 doesn't follow specs definied by sdcard.org ?!
I got the TI 0x803C by reading out driver details from a windows machine
(HP Laptop) in a shopping mall :)

> What's the current level?  I didn't get it to see insert/remove from
> my slot:
What do you mean by "current level" ?

> There's tests for slots that aren't quite right.  It and's with 0x70,
> but tests to see > 5, which it always will be if any of the bits are
> set.
Oops, huge bad mistake :( . Thanks for pointing that out.
I forgot the prefix "0x". the line now says:
if (sc->firstBARat>0x05 || sc->slots>0x50) ...

> The code should use more of the higher level interfaces in
> FreeBSD for accessing the pci bus.
Could you please give me hint on that ? I thought bus_space_* is already
an abstraction of the PCI bus (guess, I realy have to walk through the
pccard sources).

> The code should stive to be more style(9) compliant.  Its style is so
> different from the usual as to be difficult to read.
I printed out the man pages and had it as my bedtime lecture ;)
The code has been now "styled" a bit. I'll later setup a web page
with current codefile. for now the code is available at:
http://www.sashi.de/downloads/freebsd/sdhci/sdhcidd-current.tbz

Regards,
Sashi

From owner-freebsd-drivers@FreeBSD.ORG  Tue Sep 19 14:24:44 2006
Return-Path: <owner-freebsd-drivers@FreeBSD.ORG>
X-Original-To: freebsd-drivers@freebsd.org
Delivered-To: freebsd-drivers@freebsd.org
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 82D7416A40F
	for <freebsd-drivers@freebsd.org>; Tue, 19 Sep 2006 14:24:44 +0000 (UTC)
	(envelope-from bounces@nabble.com)
Received: from talk.nabble.com (www.nabble.com [72.21.53.35])
	by mx1.FreeBSD.org (Postfix) with ESMTP id E09A443D78
	for <freebsd-drivers@freebsd.org>; Tue, 19 Sep 2006 14:24:41 +0000 (GMT)
	(envelope-from bounces@nabble.com)
Received: from [72.21.53.38] (helo=jubjub.nabble.com)
	by talk.nabble.com with esmtp (Exim 4.50) id 1GPgWf-0001Mm-Dz
	for freebsd-drivers@freebsd.org; Tue, 19 Sep 2006 07:24:41 -0700
Message-ID: <6389336.post@talk.nabble.com>
Date: Tue, 19 Sep 2006 07:24:41 -0700 (PDT)
From: Gireesh <gireesh.nagabhushana@neterion.com>
To: freebsd-drivers@freebsd.org
In-Reply-To: <200609191346.k8JDk9b3076219@lurza.secnetix.de>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Nabble-From: gireesh.nagabhushana@neterion.com
References: <6387977.post@talk.nabble.com>
	<200609191346.k8JDk9b3076219@lurza.secnetix.de>
Subject: Re: Reading configuration file from driver during load
X-BeenThere: freebsd-drivers@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: Writing device drivers for FreeBSD <freebsd-drivers.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-drivers>, 
	<mailto:freebsd-drivers-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/freebsd-drivers>
List-Post: <mailto:freebsd-drivers@freebsd.org>
List-Help: <mailto:freebsd-drivers-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-drivers>,
	<mailto:freebsd-drivers-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 19 Sep 2006 14:24:44 -0000




Oliver Fromme wrote:
> 
> Gireesh wrote:
>  > I have a driver which has some parameters hardcoded as of now. It
> requires
>  > values of these parameters to be available during load (during attach
>  > function). My requirement is to read these parameters from a
> configuration
>  > file so that we can load driver with different values to parameters
> without
>  > rebuilding driver. 
> 
> I think that sysctl or kenv variables are best suited for
> that purpose.  There are a lot of examples for that in
> existing drivers.
> 
> Best regards
>    Oliver
> 
> -- 
> Oliver Fromme,  secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing
> Dienstleistungen mit Schwerpunkt FreeBSD: http://www.secnetix.de/bsd
> Any opinions expressed in this message may be personal to the author
> and may not necessarily reflect the opinions of secnetix in any way.
> 
> We're sysadmins.  To us, data is a protocol-overhead.
> _______________________________________________
> freebsd-drivers@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-drivers
> To unsubscribe, send any mail to "freebsd-drivers-unsubscribe@freebsd.org"
> 
> 

Thanks Oliver for your reply.
We can use sysctls. But we should have created those sysctl entries before
loading
driver. Otherwise, we have to use a kernel module to create those entries.
Do we have any way of avoiding this?

Thanks,
Gireesh
-- 
View this message in context: http://www.nabble.com/Reading-configuration-file-from-driver-during-load-tf2298986.html#a6389336
Sent from the freebsd-drivers mailing list archive at Nabble.com.


From owner-freebsd-drivers@FreeBSD.ORG  Tue Sep 19 14:46:05 2006
Return-Path: <owner-freebsd-drivers@FreeBSD.ORG>
X-Original-To: freebsd-drivers@freebsd.org
Delivered-To: freebsd-drivers@freebsd.org
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 2DE4A16A47B
	for <freebsd-drivers@freebsd.org>; Tue, 19 Sep 2006 14:46:05 +0000 (UTC)
	(envelope-from imp@bsdimp.com)
Received: from harmony.bsdimp.com (vc4-2-0-87.dsl.netrack.net [199.45.160.85])
	by mx1.FreeBSD.org (Postfix) with ESMTP id CFA8743D5C
	for <freebsd-drivers@freebsd.org>; Tue, 19 Sep 2006 14:45:17 +0000 (GMT)
	(envelope-from imp@bsdimp.com)
Received: from localhost (localhost [127.0.0.1])
	by harmony.bsdimp.com (8.13.4/8.13.4) with ESMTP id k8JEhr4Y037059;
	Tue, 19 Sep 2006 08:43:53 -0600 (MDT) (envelope-from imp@bsdimp.com)
Date: Tue, 19 Sep 2006 08:43:53 -0600 (MDT)
Message-Id: <20060919.084353.41650344.imp@bsdimp.com>
To: freebsd-drivers@freebsd.org, gireesh.nagabhushana@neterion.com,
	olli@lurza.secnetix.de
From: Warner Losh <imp@bsdimp.com>
In-Reply-To: <200609191346.k8JDk9b3076219@lurza.secnetix.de>
References: <6387977.post@talk.nabble.com>
	<200609191346.k8JDk9b3076219@lurza.secnetix.de>
X-Mailer: Mew version 3.3 on Emacs 21.3 / Mule 5.0 (SAKAKI)
Mime-Version: 1.0
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.0
	(harmony.bsdimp.com [127.0.0.1]);
	Tue, 19 Sep 2006 08:43:53 -0600 (MDT)
Cc: 
Subject: Re: Reading configuration file from driver during load
X-BeenThere: freebsd-drivers@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: Writing device drivers for FreeBSD <freebsd-drivers.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-drivers>, 
	<mailto:freebsd-drivers-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/freebsd-drivers>
List-Post: <mailto:freebsd-drivers@freebsd.org>
List-Help: <mailto:freebsd-drivers-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-drivers>,
	<mailto:freebsd-drivers-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 19 Sep 2006 14:46:05 -0000

From: Oliver Fromme <olli@lurza.secnetix.de>
Subject: Re: Reading configuration file from driver during load
Date: Tue, 19 Sep 2006 15:46:09 +0200 (CEST)

> Gireesh wrote:
>  > I have a driver which has some parameters hardcoded as of now. It requires
>  > values of these parameters to be available during load (during attach
>  > function). My requirement is to read these parameters from a configuration
>  > file so that we can load driver with different values to parameters without
>  > rebuilding driver. 
> 
> I think that sysctl or kenv variables are best suited for
> that purpose.  There are a lot of examples for that in
> existing drivers.

The 'kenv' variables are best wrapped in the tunable interfaces.  For
example: 

u_long cbb_start_16_io = CBB_START_16_IO;
TUNABLE_ULONG("hw.cbb.start_16_io", &cbb_start_16_io);
SYSCTL_ULONG(_hw_cbb, OID_AUTO, start_16_io, CTLFLAG_RW,
    &cbb_start_16_io, CBB_START_16_IO,
    "Starting ioport for 16-bit cards");

This is from the cbb driver.  It is a hint/tunable that can also set
the starting I/O port address range to use for 16-bit cards.  Users
can either place the following line in /boot/loader.conf or in
/etc/sysctl.conf.

	hw.cbb.start_16_io=0x300

The former sets it at attach time, while the latter sets it early in
the boot process, but after it has attached.  You can also set it at
run-time:

	sysctl hw.cbb.start_16_io=0x300

Warner

From owner-freebsd-drivers@FreeBSD.ORG  Tue Sep 19 14:51:32 2006
Return-Path: <owner-freebsd-drivers@FreeBSD.ORG>
X-Original-To: freebsd-drivers@freebsd.org
Delivered-To: freebsd-drivers@freebsd.org
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 8715516A548
	for <freebsd-drivers@freebsd.org>; Tue, 19 Sep 2006 14:51:32 +0000 (UTC)
	(envelope-from imp@bsdimp.com)
Received: from harmony.bsdimp.com (vc4-2-0-87.dsl.netrack.net [199.45.160.85])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 1990043E7F
	for <freebsd-drivers@freebsd.org>; Tue, 19 Sep 2006 14:48:15 +0000 (GMT)
	(envelope-from imp@bsdimp.com)
Received: from localhost (localhost [127.0.0.1])
	by harmony.bsdimp.com (8.13.4/8.13.4) with ESMTP id k8JElvq4037099;
	Tue, 19 Sep 2006 08:47:57 -0600 (MDT) (envelope-from imp@bsdimp.com)
Date: Tue, 19 Sep 2006 08:47:57 -0600 (MDT)
Message-Id: <20060919.084757.78728269.imp@bsdimp.com>
To: gireesh.nagabhushana@neterion.com
From: Warner Losh <imp@bsdimp.com>
In-Reply-To: <6389336.post@talk.nabble.com>
References: <6387977.post@talk.nabble.com>
	<200609191346.k8JDk9b3076219@lurza.secnetix.de>
	<6389336.post@talk.nabble.com>
X-Mailer: Mew version 3.3 on Emacs 21.3 / Mule 5.0 (SAKAKI)
Mime-Version: 1.0
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.0
	(harmony.bsdimp.com [127.0.0.1]);
	Tue, 19 Sep 2006 08:47:57 -0600 (MDT)
Cc: freebsd-drivers@freebsd.org
Subject: Re: Reading configuration file from driver during load
X-BeenThere: freebsd-drivers@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: Writing device drivers for FreeBSD <freebsd-drivers.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-drivers>, 
	<mailto:freebsd-drivers-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/freebsd-drivers>
List-Post: <mailto:freebsd-drivers@freebsd.org>
List-Help: <mailto:freebsd-drivers-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-drivers>,
	<mailto:freebsd-drivers-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 19 Sep 2006 14:51:32 -0000

> Do we have any way of avoiding this?

Yes.  You can use tunables from kenv.  I posted one example of how to
do this.  Please let me know if you need to do this on a per-device
basis, and I'll point you at a driver that does this.

Warner

From owner-freebsd-drivers@FreeBSD.ORG  Tue Sep 19 14:51:48 2006
Return-Path: <owner-freebsd-drivers@FreeBSD.ORG>
X-Original-To: freebsd-drivers@freebsd.org
Delivered-To: freebsd-drivers@freebsd.org
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 7BDB316A49E
	for <freebsd-drivers@freebsd.org>; Tue, 19 Sep 2006 14:51:48 +0000 (UTC)
	(envelope-from imp@bsdimp.com)
Received: from harmony.bsdimp.com (vc4-2-0-87.dsl.netrack.net [199.45.160.85])
	by mx1.FreeBSD.org (Postfix) with ESMTP id D43A543E97
	for <freebsd-drivers@freebsd.org>; Tue, 19 Sep 2006 14:48:58 +0000 (GMT)
	(envelope-from imp@bsdimp.com)
Received: from localhost (localhost [127.0.0.1])
	by harmony.bsdimp.com (8.13.4/8.13.4) with ESMTP id k8JEk2YK037080;
	Tue, 19 Sep 2006 08:46:02 -0600 (MDT) (envelope-from imp@bsdimp.com)
Date: Tue, 19 Sep 2006 08:46:02 -0600 (MDT)
Message-Id: <20060919.084602.71108867.imp@bsdimp.com>
To: mail@sashi.de
From: Warner Losh <imp@bsdimp.com>
In-Reply-To: <450FF6B2.2000908@sashi.de>
References: <20060918.083758.63053354.imp@bsdimp.com>
	<20060918.105709.179960957.imp@bsdimp.com>
	<450FF6B2.2000908@sashi.de>
X-Mailer: Mew version 3.3 on Emacs 21.3 / Mule 5.0 (SAKAKI)
Mime-Version: 1.0
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.0
	(harmony.bsdimp.com [127.0.0.1]);
	Tue, 19 Sep 2006 08:46:03 -0600 (MDT)
Cc: freebsd-drivers@freebsd.org
Subject: Re: SDHCI Device Driver (first steps)
X-BeenThere: freebsd-drivers@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: Writing device drivers for FreeBSD <freebsd-drivers.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-drivers>, 
	<mailto:freebsd-drivers-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/freebsd-drivers>
List-Post: <mailto:freebsd-drivers@freebsd.org>
List-Help: <mailto:freebsd-drivers-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-drivers>,
	<mailto:freebsd-drivers-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 19 Sep 2006 14:51:48 -0000

From: Marian Asokarajan <mail@sashi.de>
Subject: Re: SDHCI Device Driver (first steps)
Date: Tue, 19 Sep 2006 15:54:58 +0200

> M. Warner Losh wrote:
> > : : * NOTE: The driver is experimental and might crash your system!
> > 
> > It crashes mine.  I did tweak it a little to make it reconize the host
> oops. Seems chip 0x8033 doesn't follow specs definied by sdcard.org ?!
> I got the TI 0x803C by reading out driver details from a windows machine
> (HP Laptop) in a shopping mall :)

It does follow the specs, as far as I can tell.  It crahsed when I
tried to fdisk the device that was created...

> > What's the current level?  I didn't get it to see insert/remove from
> > my slot:
> What do you mean by "current level" ?

What's expected to work?

> > There's tests for slots that aren't quite right.  It and's with 0x70,
> > but tests to see > 5, which it always will be if any of the bits are
> > set.
> Oops, huge bad mistake :( . Thanks for pointing that out.
> I forgot the prefix "0x". the line now says:
> if (sc->firstBARat>0x05 || sc->slots>0x50) ...

Shouldn't slots be shifted instead?

> > The code should use more of the higher level interfaces in
> > FreeBSD for accessing the pci bus.
> Could you please give me hint on that ? I thought bus_space_* is already
> an abstraction of the PCI bus (guess, I realy have to walk through the
> pccard sources).

pci_get_vendorid() is what I had in mind.

> > The code should stive to be more style(9) compliant.  Its style is so
> > different from the usual as to be difficult to read.
> I printed out the man pages and had it as my bedtime lecture ;)
> The code has been now "styled" a bit. I'll later setup a web page
> with current codefile. for now the code is available at:
> http://www.sashi.de/downloads/freebsd/sdhci/sdhcidd-current.tbz

I'll take another look.  Thanks!

Warner

From owner-freebsd-drivers@FreeBSD.ORG  Tue Sep 19 16:51:40 2006
Return-Path: <owner-freebsd-drivers@FreeBSD.ORG>
X-Original-To: freebsd-drivers@freebsd.org
Delivered-To: freebsd-drivers@freebsd.org
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id F012316A4F3
	for <freebsd-drivers@freebsd.org>; Tue, 19 Sep 2006 16:51:40 +0000 (UTC)
	(envelope-from mail@sashi.de)
Received: from server56.greatnet.de (server56.greatnet.de [83.133.97.162])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 2828943D66
	for <freebsd-drivers@freebsd.org>; Tue, 19 Sep 2006 16:51:38 +0000 (GMT)
	(envelope-from mail@sashi.de)
Received: from [49.1.1.104] (p54B02374.dip0.t-ipconnect.de [84.176.35.116])
	by server56.greatnet.de (Postfix) with ESMTP id 91CDB60A61;
	Tue, 19 Sep 2006 18:51:36 +0200 (CEST)
Message-ID: <4510205E.6010606@sashi.de>
Date: Tue, 19 Sep 2006 18:52:46 +0200
From: Marian Asokarajan <mail@sashi.de>
User-Agent: Mozilla Thunderbird 1.0.6 (X11/20051013)
X-Accept-Language: en-us, en
MIME-Version: 1.0
To: Warner Losh <imp@bsdimp.com>, freebsd-drivers@freebsd.org
References: <20060918.083758.63053354.imp@bsdimp.com>	<20060918.105709.179960957.imp@bsdimp.com>	<450FF6B2.2000908@sashi.de>
	<20060919.084602.71108867.imp@bsdimp.com>
In-Reply-To: <20060919.084602.71108867.imp@bsdimp.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Cc: 
Subject: Re: SDHCI Device Driver (first steps)
X-BeenThere: freebsd-drivers@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: Writing device drivers for FreeBSD <freebsd-drivers.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-drivers>, 
	<mailto:freebsd-drivers-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/freebsd-drivers>
List-Post: <mailto:freebsd-drivers@freebsd.org>
List-Help: <mailto:freebsd-drivers-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-drivers>,
	<mailto:freebsd-drivers-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 19 Sep 2006 16:51:41 -0000

Warner Losh wrote:
> It does follow the specs, as far as I can tell.  It crahsed when I
> tried to fdisk the device that was created...
Cool, I'm gonna boot into single user to check if that happens
to the Ricoh chip too.

 > What's expected to work?
- the driver should recognize card insertion and removal
- dump sdhc's register set via /dev/sdhci0
next ToDo:
- read bus architecture docs
- implment bus read/write routines

>>if (sc->firstBARat>0x05 || sc->slots>0x50) ...
> Shouldn't slots be shifted instead?
Yes, first it had ((slots>>4) > 5) but then I thought,
masking slots with 0x70 leaves valid lower values and
an invalid higher value. So I dropped shifting to save CPU time.

> pci_get_vendorid() is what I had in mind.
Ok, I'll go through the code again and do some optimization.

Thanks.

Best Regards,
Sashi

From owner-freebsd-drivers@FreeBSD.ORG  Tue Sep 19 17:09:22 2006
Return-Path: <owner-freebsd-drivers@FreeBSD.ORG>
X-Original-To: freebsd-drivers@freebsd.org
Delivered-To: freebsd-drivers@freebsd.org
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 484F416A40F
	for <freebsd-drivers@freebsd.org>; Tue, 19 Sep 2006 17:09:22 +0000 (UTC)
	(envelope-from bounces@nabble.com)
Received: from talk.nabble.com (www.nabble.com [72.21.53.35])
	by mx1.FreeBSD.org (Postfix) with ESMTP id BDEE943D5E
	for <freebsd-drivers@freebsd.org>; Tue, 19 Sep 2006 17:09:16 +0000 (GMT)
	(envelope-from bounces@nabble.com)
Received: from [72.21.53.38] (helo=jubjub.nabble.com)
	by talk.nabble.com with esmtp (Exim 4.50) id 1GPj5w-0007y5-7F
	for freebsd-drivers@freebsd.org; Tue, 19 Sep 2006 10:09:16 -0700
Message-ID: <6392703.post@talk.nabble.com>
Date: Tue, 19 Sep 2006 10:09:16 -0700 (PDT)
From: Gireesh <gireesh.nagabhushana@neterion.com>
To: freebsd-drivers@freebsd.org
In-Reply-To: <20060919.084757.78728269.imp@bsdimp.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Nabble-From: gireesh.nagabhushana@neterion.com
References: <6387977.post@talk.nabble.com>
	<200609191346.k8JDk9b3076219@lurza.secnetix.de>
	<6389336.post@talk.nabble.com>
	<20060919.084757.78728269.imp@bsdimp.com>
Subject: Re: Reading configuration file from driver during load
X-BeenThere: freebsd-drivers@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: Writing device drivers for FreeBSD <freebsd-drivers.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-drivers>, 
	<mailto:freebsd-drivers-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/freebsd-drivers>
List-Post: <mailto:freebsd-drivers@freebsd.org>
List-Help: <mailto:freebsd-drivers-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-drivers>,
	<mailto:freebsd-drivers-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 19 Sep 2006 17:09:22 -0000



M. Warner Losh wrote:
> 
>> Do we have any way of avoiding this?
> 
> Yes.  You can use tunables from kenv.  I posted one example of how to
> do this.  Please let me know if you need to do this on a per-device
> basis, and I'll point you at a driver that does this.
> 
> Warner
> _______________________________________________
> freebsd-drivers@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-drivers
> To unsubscribe, send any mail to "freebsd-drivers-unsubscribe@freebsd.org"
> 
> 


Thanks Warner for the example code.

That suffices my requirement. Even though, it is not required at this time,
I like to know how to do that on a per-device basis.

Thanks,
Gireesh
-- 
View this message in context: http://www.nabble.com/Reading-configuration-file-from-driver-during-load-tf2298986.html#a6392703
Sent from the freebsd-drivers mailing list archive at Nabble.com.