Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 2 Aug 2005 14:53:22 +0800
From:      "Mars G. Miro" <marsgmiro@gmail.com>
To:        Juergen Lock <qemu-l@jelal.kn-bremen.de>, Jung-uk Kim <jkim@freebsd.org>,  freebsd-emulation@freebsd.org, qemu-devel@nongnu.org
Subject:   Re: ata devices on emulated amd64 on qemu
Message-ID:  <28edec3c0508012353757c7671@mail.gmail.com>
In-Reply-To: <20050801215410.GA10633@saturn.kn-bremen.de>
References:  <28edec3c0507290000415a350d@mail.gmail.com> <200507291540.52889.jkim@niksun.com> <200507291647.49230.jkim@niksun.com> <200507292022.38135.jkim@FreeBSD.org> <28edec3c050730045765b5262b@mail.gmail.com> <28edec3c05073119576445ec92@mail.gmail.com> <28edec3c050731203069f7c4a8@mail.gmail.com> <28edec3c0508010230226b4ae@mail.gmail.com> <20050801215410.GA10633@saturn.kn-bremen.de>

next in thread | previous in thread | raw e-mail | index | archive | help
On 8/2/05, Juergen Lock <qemu-l@jelal.kn-bremen.de> wrote:
> On Mon, Aug 01, 2005 at 05:30:47PM +0800, Mars G. Miro wrote:
> > On 8/1/05, Mars G. Miro <marsgmiro@gmail.com> wrote:
> > > On 8/1/05, Mars G. Miro <marsgmiro@gmail.com> wrote:
> > > > On 7/30/05, Mars G. Miro <marsgmiro@gmail.com> wrote:
> > > > > On 7/30/05, Jung-uk Kim <jkim@freebsd.org> wrote:
> > > > > > Okay.  I finally found a fix.  It was actually quite simple.=20
> Newer=20
> > > > > > FreeBSD and Linux ATA drivers check whether the PCI ATA control=
ler
> is
> > >=20
> > > > > > in legacy ATA mode (aka PATA mode).  The test failed and it was=
=20
> > > > > > treated like a SATA controller.  Of course, IRQ failed to map. =
;-)
> =20
> > > > > > Try the attached patch.  Tested with FreeBSD/amd64 6.0-BETA1 gu=
est
> on
> > >=20
> > > > > > FreeBSD/amd64 host.
> > > > > >=20
> > > > >=20
> > > > >=20
> > > > > You rock dude! This  patch fixes it. FreeBSD54/amd64 Guest on
> > > > > FreeBSD54/amd64 Host.
> > > > >=20
> > > > > Any thoughts of including this patch in the ports?
> > > > >=20
> > > > >=20
> > > >=20
> > > >=20
> > > > Oops. I noticed only now that this time, it's the emulated NE2000 N=
IC
> > > > that's not detected. This is for a FreeBSD/amd64 guest on
> > > > FreeBSD/amd64 Host.
> > > >=20
> > >=20
> > >=20
> > > Scratch that.=20
> > >=20
> > > This is only because there's no ed in the GENERIC kernel for AMD64.
> > >=20
> >=20
> > because we dropped support for it?
> >=20
> > cc -c -O2 -frename-registers -pipe -fno-strict-aliasing  -Wall
> > -Wredundant-decls -Wnested-externs -Wstrict-prototypes=20
> > -Wmissing-prototypes -Wpointer-
> > arith -Winline -Wcast-qual  -fformat-extensions -std=3Dc99  -nostdinc
> > -I-  -I. -I/usr/src/sys -I/usr/src/sys/contrib/dev/acpica
> > -I/usr/src/sys/contrib/a
> > ltq -I/usr/src/sys/contrib/ipfilter -I/usr/src/sys/contrib/pf
> > -I/usr/src/sys/contrib/dev/ath -I/usr/src/sys/contrib/dev/ath/freebsd
> > -I/usr/src/sys/con
> > trib/ngatm -D_KERNEL -include opt_global.h -fno-common
> > -finline-limit=3D8000 --param inline-unit-growth=3D100 --param
> > large-function-growth=3D1000  -mcmodel
> > =3Dkernel -mno-red-zone  -mfpmath=3D387 -mno-sse -mno-sse2 -mno-mmx
> > -mno-3dnow  -msoft-float -fno-asynchronous-unwind-tables
> > -ffreestanding -Werror  /usr/
> > src/sys/dev/ed/if_ed.c
> > /usr/src/sys/dev/ed/if_ed.c: In function `ed_probe_WD80x3_generic':
> > /usr/src/sys/dev/ed/if_ed.c:508: warning: implicit declaration of
> > function `kvtop'
> > /usr/src/sys/dev/ed/if_ed.c:508: warning: nested extern declaration of
> `kvtop'
> > /usr/src/sys/dev/ed/if_ed.c:521: warning: nested extern declaration of
> `kvtop'
> > /usr/src/sys/dev/ed/if_ed.c:508: warning: redundant redeclaration of
> 'kvtop'
> > /usr/src/sys/dev/ed/if_ed.c:508: warning: previous implicit
> > declaration of 'kvtop' was here
> > /usr/src/sys/dev/ed/if_ed.c:532: warning: nested extern declaration of
> `kvtop'
> > /usr/src/sys/dev/ed/if_ed.c:508: warning: redundant redeclaration of
> 'kvtop'
> > /usr/src/sys/dev/ed/if_ed.c:508: warning: previous implicit
> > declaration of 'kvtop' was here
> > /usr/src/sys/dev/ed/if_ed.c:539: warning: nested extern declaration of
> `kvtop'
> > /usr/src/sys/dev/ed/if_ed.c:508: warning: redundant redeclaration of
> 'kvtop'
> > /usr/src/sys/dev/ed/if_ed.c:508: warning: previous implicit
> > declaration of 'kvtop' was here
> > /usr/src/sys/dev/ed/if_ed.c:547: warning: nested extern declaration of
> `kvtop'
> > /usr/src/sys/dev/ed/if_ed.c:508: warning: redundant redeclaration of
> 'kvtop'
> > /usr/src/sys/dev/ed/if_ed.c:508: warning: previous implicit
> > declaration of 'kvtop' was here
> > /usr/src/sys/dev/ed/if_ed.c:570: warning: nested extern declaration of
> `kvtop'
> > /usr/src/sys/dev/ed/if_ed.c:508: warning: redundant redeclaration of
> 'kvtop'
> > /usr/src/sys/dev/ed/if_ed.c:508: warning: previous implicit
> > declaration of 'kvtop' was here
> > /usr/src/sys/dev/ed/if_ed.c: In function `ed_probe_3Com':
> > /usr/src/sys/dev/ed/if_ed.c:905: warning: nested extern declaration of
> `kvtop'
> > /usr/src/sys/dev/ed/if_ed.c:508: warning: redundant redeclaration of
> 'kvtop'
> > /usr/src/sys/dev/ed/if_ed.c:508: warning: previous implicit
> > declaration of 'kvtop' was here
> > /usr/src/sys/dev/ed/if_ed.c: In function `ed_probe_SIC':
> > /usr/src/sys/dev/ed/if_ed.c:998: warning: nested extern declaration of
> `kvtop'
> > /usr/src/sys/dev/ed/if_ed.c:508: warning: redundant redeclaration of
> 'kvtop'
> > /usr/src/sys/dev/ed/if_ed.c:508: warning: previous implicit
> > declaration of 'kvtop' was here
> > *** Error code 1
> >=20
> > ugh :-(
>=20
> Aha, amd64 doesnt have kvtop anymore.  Try the following patch:
> (compiles on i386, it should fix amd64 if you are lucky - as long as
> kvtop is the only problem...)
>

Tried this patch. It does seem to work.

But there are other problems in emulated amd64 --- such as segfaults
here and there --- they seem to occur at random. This is for
{5.4/6.01-Beta} AMD64.

Thanks.


> Index: if_ed.c
> @@ -205,7 +205,7 @@
>  =09int     i;
>  =09u_int   memsize, maddr;
>  =09u_char  iptr, isa16bit, sum, totalsum;
> -=09u_long=09conf_maddr, conf_msize, irq, junk;
> +=09u_long=09conf_maddr, conf_msize, irq, junk, mphys;
> =20
>  =09sc->chip_type =3D ED_CHIP_TYPE_DP8390;
> =20
> @@ -474,6 +474,7 @@
>  =09=09return (error);
>  =09}
>  =09sc->mem_start =3D (caddr_t) rman_get_virtual(sc->mem_res);
> +=09mphys =3D rman_get_start(sc->mem_res);
> =20
>  =09/*
>  =09 * allocate one xmit buffer if < 16k, two buffers otherwise
> @@ -505,7 +506,7 @@
>  =09=09=09sc->wd_laar_proto =3D ed_asic_inb(sc, ED_WD_LAAR);
>  =09=09} else {
>  =09=09=09sc->wd_laar_proto =3D ED_WD_LAAR_L16EN |
> -=09=09=09    ((kvtop(sc->mem_start) >> 19) & ED_WD_LAAR_ADDRHI);
> +=09=09=09    ((mphys >> 19) & ED_WD_LAAR_ADDRHI);
>  =09=09}
>  =09=09/*
>  =09=09 * Enable 16bit access
> @@ -518,7 +519,7 @@
>  =09=09     (sc->type =3D=3D ED_TYPE_TOSHIBA4) ||
>  =09=09     (sc->type =3D=3D ED_TYPE_WD8013EBT)) &&
>  =09=09    (sc->chip_type !=3D ED_CHIP_TYPE_WD790)) {
> -=09=09=09sc->wd_laar_proto =3D (kvtop(sc->mem_start) >> 19) &
> +=09=09=09sc->wd_laar_proto =3D (mphys >> 19) &
>  =09=09=09    ED_WD_LAAR_ADDRHI;
>  =09=09=09ed_asic_outb(sc, ED_WD_LAAR, sc->wd_laar_proto);
>  =09=09}
> @@ -530,22 +531,22 @@
>  =09if (sc->chip_type !=3D ED_CHIP_TYPE_WD790) {
>  =09=09if (ED_FLAGS_GETTYPE(flags) =3D=3D ED_FLAGS_TOSH_ETHER) {
>  =09=09=09ed_asic_outb(sc, ED_WD_MSR + 1,
> -=09=09=09=09     ((kvtop(sc->mem_start) >> 8) & 0xe0) | 4);
> +=09=09=09=09     ((mphys >> 8) & 0xe0) | 4);
>  =09=09=09ed_asic_outb(sc, ED_WD_MSR + 2,
> -=09=09=09=09     ((kvtop(sc->mem_start) >> 16) & 0x0f));
> +=09=09=09=09     ((mphys >> 16) & 0x0f));
>  =09=09=09ed_asic_outb(sc, ED_WD_MSR,
>  =09=09=09=09     ED_WD_MSR_MENB | ED_WD_MSR_POW);
>  =09=09} else {
>  =09=09=09ed_asic_outb(sc, ED_WD_MSR,
> -=09=09=09=09     ((kvtop(sc->mem_start) >> 13) &
> +=09=09=09=09     ((mphys >> 13) &
>  =09=09=09=09      ED_WD_MSR_ADDR) | ED_WD_MSR_MENB);
>  =09=09}
>  =09=09sc->cr_proto =3D ED_CR_RD2;
>  =09} else {
>  =09=09ed_asic_outb(sc, ED_WD_MSR, ED_WD_MSR_MENB);
>  =09=09ed_asic_outb(sc, ED_WD790_HWR, (ed_asic_inb(sc, ED_WD790_HWR) |
> ED_WD790_HWR_SWH));
> -=09=09ed_asic_outb(sc, ED_WD790_RAR, ((kvtop(sc->mem_start) >> 13) & 0x0=
f) |
> -=09=09     ((kvtop(sc->mem_start) >> 11) & 0x40) |
> +=09=09ed_asic_outb(sc, ED_WD790_RAR, ((mphys >> 13) & 0x0f) |
> +=09=09     ((mphys >> 11) & 0x40) |
>  =09=09     (ed_asic_inb(sc, ED_WD790_RAR) & 0xb0));
>  =09=09ed_asic_outb(sc, ED_WD790_HWR, (ed_asic_inb(sc, ED_WD790_HWR) &
> ~ED_WD790_HWR_SWH));
>  =09=09sc->cr_proto =3D 0;
> @@ -567,7 +568,7 @@
>  =09for (i =3D 0; i < memsize; ++i) {
>  =09=09if (sc->mem_start[i]) {
>  =09=09=09device_printf(dev, "failed to clear shared memory at %jx - chec=
k
> configuration\n",
> -=09=09=09=09      (uintmax_t)kvtop(sc->mem_start + i));
> +=09=09=09=09      (uintmax_t)mphys + i);
> =20
>  =09=09=09/*
>  =09=09=09 * Disable 16 bit access to shared memory
> @@ -902,7 +903,7 @@
>  =09for (i =3D 0; i < memsize; ++i)
>  =09=09if (sc->mem_start[i]) {
>  =09=09=09device_printf(dev, "failed to clear shared memory at %jx - chec=
k
> configuration\n",
> -=09=09=09=09      (uintmax_t)kvtop(sc->mem_start + i));
> +=09=09=09=09      (uintmax_t)rman_get_start(sc->mem_res) + i);
>  =09=09=09return (ENXIO);
>  =09=09}
>  =09return (0);
> @@ -995,7 +996,7 @@
>  =09=09if (sc->mem_start[i]) {
>  =09=09=09device_printf(dev, "failed to clear shared memory "
>  =09=09=09=09"at %jx - check configuration\n",
> -=09=09=09=09(uintmax_t)kvtop(sc->mem_start + i));
> +=09=09=09=09(uintmax_t)rman_get_start(sc->mem_res) + i);
> =20
>  =09=09=09return (ENXIO);
>  =09=09}
>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?28edec3c0508012353757c7671>