From owner-freebsd-arch@FreeBSD.ORG Thu Feb 1 18:25:05 2007 Return-Path: X-Original-To: freebsd-arch@freebsd.org Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1F47516A405 for ; Thu, 1 Feb 2007 18:25:05 +0000 (UTC) (envelope-from julian@elischer.org) Received: from outV.internet-mail-service.net (outV.internet-mail-service.net [216.240.47.245]) by mx1.freebsd.org (Postfix) with ESMTP id D6AA413C467 for ; Thu, 1 Feb 2007 18:25:04 +0000 (UTC) (envelope-from julian@elischer.org) Received: from shell.idiom.com (HELO idiom.com) (216.240.47.20) by out.internet-mail-service.net (qpsmtpd/0.32) with ESMTP; Thu, 01 Feb 2007 10:03:24 -0800 Received: from [192.168.2.5] (home.elischer.org [216.240.48.38]) by idiom.com (Postfix) with ESMTP id D7840125B31; Thu, 1 Feb 2007 10:24:58 -0800 (PST) Message-ID: <45C2307A.8000206@elischer.org> Date: Thu, 01 Feb 2007 10:24:58 -0800 From: Julian Elischer User-Agent: Thunderbird 1.5.0.9 (Macintosh/20061207) MIME-Version: 1.0 To: Luigi Rizzo References: <20070131115148.A60420@xorpc.icir.org> <200702011109.12821.jhb@freebsd.org> <20070201091605.A82313@xorpc.icir.org> In-Reply-To: <20070201091605.A82313@xorpc.icir.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-arch@freebsd.org Subject: Re: configurable device (and other) tables in the kernel ? X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2007 18:25:05 -0000 Luigi Rizzo wrote: > On Thu, Feb 01, 2007 at 11:09:12AM -0500, John Baldwin wrote: >> On Wednesday 31 January 2007 14:51, Luigi Rizzo wrote: > ... >>> We have several tables in our kernel and modules, >>> containing at least device-id tables (pci, usb), >>> quirks for certain devices, and maybe more (i am excluding > ... >> Windows and MAC OS X both use plain text files to hold things like PCI device >> IDs to match drivers to devices. OS X uses an XML file format that lets you > > plain text files! > > too obvious to think of it :) > > but, where can i find an example of a piece of kernel code that can > read from a file "safely" (i.e. say in the modevent handler or maybe > at device probe time) ? > Something like > > char *load_file_into_kernel_memody(filename, max_size, &error); > > I have looked at the kernel side of execve and kldload, they are not > exactly straightforward (at least there are seveal indirections). > Maybe there are other simpler ones ? > >> list the PCI ID's a driver supports and the kernel auto-loads driver modules >> by matching on PCI IDs. Many drivers can't be helped by this though, as they >> use the device ID for for device-specific behavior (such as em(4) or >> brgpy(4)). I like the idea of specifying aliases.. "if you see XXXX then pretend you saw YYYY and treat it the same." > > well, that's a two-phase process, if you have the above table-based > mechanism, the kernel (actually the bus driver i would say) can > load the [device_id -> driver] table (or tables, assuming > each driver has its own file) to select and load the > correct driver, and then the driver itself could use the same > mechanism to load a [device_id -> quirks] table for internal use ? > > cheers > luigi > _______________________________________________ > freebsd-arch@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-arch > To unsubscribe, send any mail to "freebsd-arch-unsubscribe@freebsd.org"