From owner-freebsd-arch@FreeBSD.ORG Tue Jan 31 19:39:14 2012 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CD27E1065670 for ; Tue, 31 Jan 2012 19:39:14 +0000 (UTC) (envelope-from ray@ddteam.net) Received: from mail-ey0-f182.google.com (mail-ey0-f182.google.com [209.85.215.182]) by mx1.freebsd.org (Postfix) with ESMTP id 65FF18FC19 for ; Tue, 31 Jan 2012 19:39:14 +0000 (UTC) Received: by eaan10 with SMTP id n10so134682eaa.13 for ; Tue, 31 Jan 2012 11:39:13 -0800 (PST) Received: by 10.213.8.199 with SMTP id i7mr602607ebi.129.1328038753210; Tue, 31 Jan 2012 11:39:13 -0800 (PST) Received: from rnote.ddteam.net (119-219-133-95.pool.ukrtel.net. [95.133.219.119]) by mx.google.com with ESMTPS id b3sm38528954een.2.2012.01.31.11.39.11 (version=SSLv3 cipher=OTHER); Tue, 31 Jan 2012 11:39:12 -0800 (PST) Date: Tue, 31 Jan 2012 21:38:57 +0200 From: Aleksandr Rybalko To: freebsd-arch@freebsd.org Message-Id: <20120131213857.86c81626.ray@ddteam.net> X-Mailer: Sylpheed 3.1.2 (GTK+ 2.24.5; amd64-portbld-freebsd9.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: dynamic attach of hinted devices 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: Tue, 31 Jan 2012 19:39:14 -0000 Hi FreeBSD hackers, at first I want to say this: :) WARNING: FOLLOWING DEVCTL PATCH MAY EASILY PANIC YOUR SYSTEM, PLEASE DO NOT TRY IT ON PRODUCTION SERVERS AND TRY IT WITH FILESYSTEMS MOUNTED AS READONLY :))))) So I introduce two patches first one [1] used to migrate from static_hints or hints in the static_kenv to dynamic hints. sysctl kern.hintmode=2 will copy hints from static hints or from static kenv and put it into dynamic kenv. Those will allow to manipulate hints values and attach hinted devices with devctl tool. Second [2] allow attach/detach devices with userland tool devctl. devctl tool allow add and initialize new devices which is not able to be autoenumerating, such a hinted devices. Both designed to have ability update EEPROM items in runtime, since some device can't work in mode when it accessible like a EEPROM chip. Example: # sysctl kern.hintmode=2 # kenv hint.mx25l.0.at="spibus0" # kenv hint.mx25l.0.cs=0 # kenv hint.mx25l.0.chipname="at25128" # devctl hinted spibus 0 mx25l 0 mx25l0: at cs 0 mode 0 on spibus0 mx25l0: at25128, sector 64 bytes, 256 sectors GEOM: new disk flash/spi0 Someone may found it also useful for testing device attach/detach code (memory leaks, resource allocation, etc). So, say me please your opinion. 1. http://my.ddteam.net/files/2012-01-31.to_dynamic_hints.patch 2. http://my.ddteam.net/files/2012-01-31.devctl2.patch WBW -- Aleksandr Rybalko