From owner-freebsd-drivers@FreeBSD.ORG Mon May 21 14:44:52 2007 Return-Path: X-Original-To: freebsd-drivers@freebsd.org Delivered-To: freebsd-drivers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 40EC216A421 for ; Mon, 21 May 2007 14:44:52 +0000 (UTC) (envelope-from die.gestalt@gmail.com) Received: from py-out-1112.google.com (py-out-1112.google.com [64.233.166.181]) by mx1.freebsd.org (Postfix) with ESMTP id F3CDA13C44B for ; Mon, 21 May 2007 14:44:51 +0000 (UTC) (envelope-from die.gestalt@gmail.com) Received: by py-out-1112.google.com with SMTP id f31so1867830pyh for ; Mon, 21 May 2007 07:44:51 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; b=NCawGwIA1t7R35plf0s7MhQNC/TBZdOzaYwJsFx9y2HkS8OF1sXboyR014dwLD0c/FCfE2X9CRKiikJ9B6Qho2QM8ZIaZunqw61Omj6QNdozXv2cJbSQIcSmaBX3n0Telk1I7GaSUdA7Bcqbta5HxG+qntcUCuJf7zKdpeWtkhs= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; b=Yi4ASEpd6+b2RiCo5OQHmAsCw6WPDO3trZ+WNwdn6pOiJwvDM1qxBO8VXYGeYGBL0iGC88yeH5lyh2BbUb9xqaf1hyl7QPyooyK8nRspsGde8BWEb2K+Si/qX+gCXtLOs5dhWO5nW6cXJquBjLvLQL21eUH00ShHeO5MZzQWkCQ= Received: by 10.65.81.10 with SMTP id i10mr10954847qbl.1179758690354; Mon, 21 May 2007 07:44:50 -0700 (PDT) Received: by 10.64.184.8 with HTTP; Mon, 21 May 2007 07:44:50 -0700 (PDT) Message-ID: <5bf3e10d0705210744s119d1c5cpc20ab1036e9f98ff@mail.gmail.com> Date: Mon, 21 May 2007 16:44:50 +0200 From: "Die Gestalt" To: "=?ISO-8859-1?Q?Dag-Erling_Sm=F8rgrav?=" In-Reply-To: <86veetgnk4.fsf@dwp.des.no> MIME-Version: 1.0 References: <5bf3e10d0705150724q3f0fd25fq89094bd02d8f9d29@mail.gmail.com> <86veetgnk4.fsf@dwp.des.no> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Content-Disposition: inline X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: freebsd-drivers@freebsd.org Subject: Re: Generic int 13h driver X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 May 2007 14:44:52 -0000 On 5/16/07, Dag-Erling Sm=F8rgrav wrote: > > "Die Gestalt" writes: > > As the subject implies I'm currently doing the most unholy thing ever. > I'm > > writing a driver that accesses hard disks through BIOS int13h. The > reasons > > why I'm doing this are many, but mainly I will be in a situation where = I > > > will not be able to update my kernel and where I want to support as muc= h > > devices as possible. I know this will be slow and I know this will only > work > > on the i386 platform, I accept that. > > It won't work nearly as universally as you intend; for some devices > (particularly USB devices), the BIOS tries to enter protected mode when > servicing requests. I know there will be some limitations unfortunately. > So far so good, I have a skeleton which is able to query the drive > > parameters and some basic stuff. But when I want to read, this doesn't > work, > > except in QEmu (http://www.qemu.org). I've tried on a VMWare and a real > > machine, what I get is a stall for maybe 10 s (sometimes not) and the > > operations returns saying it's successful but my buffer is actually lef= t > > > untouched. I get no kernel message. > > Have you verified that the buffer you write from or read into is mapped > correctly in virtual 8086 mode, and that you pass the correct address to > the BIOS? I think so. It works when I request a buffer to be filled with information. For instance function 48h of the int 13h correctly fills my buffer. To pass the address I use vm86_addpage to update a vm86context and then I pass this context to vm86_datacall. I think this might be a DMA problem. When the BIOS writes to the buffer, it does it via DMA, and I get typical DMA problems. However I've tried to use = a buffer allocated via buf_dmamem_alloc() to no success. Thanks for your answer.