Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 28 Jan 2002 09:09:19 +0530
From:      Bruce Montague <brucem@cse.iitkgp.ernet.in>
To:        freebsd-small@freebsd.org
Cc:        benst@altus-escon.com
Subject:   FreeBSD on Nat Semi Geode (GX1) SBC.
Message-ID:  <200201280339.g0S3dJP01699@cse.iitkgp.ernet.in>

next in thread | raw e-mail | index | archive | help

 re:

>This is a tiny  sbc based on National's Geode GX
> cpu with on-board ... what is going wrong,...

I have successfully used FreeBSD/picoBSD on a
number of Geode-based SBC boards (nat semi reference
systems) with 64M RAM and smaller. I'm not sure
if it's necessary under the latest stable, but I
always apply the following two patches, which were
essential under 4.1(?) stable. I've been running
4.4-stable kernels built with these patches on
geode boards with "no" problems (that's not to
say that "everything", including sound, for
instance, will work)...

The problem you describe sounds like it _might_
be the problem solved by the VGA patch below, that
is, the driver does longword fetches that are not
longword aligned; the geode VGA croaks...

Incidently, the geode CPUs are descended from the
old cyrix low-end CPUs...


* Patch 1 makes the 8254 be used as the clock instead
of the TSC (timer register), this might not be needed
under 4.5-stable...

* Patch 2 supports byte-aligned blits to ``VGA''
video memory.


(1) Force Use of the 8254 instead of TSC.
==========================================

In file:

 /usr/src/sys/i386/isa/clock.c

At the end of routine ``startrtclock()'', replace
this code:

------------------
        if (tsc_present && tsc_freq != 0 && !tsc_is_broken) {
                tsc_timecounter.tc_frequency = tsc_freq;
                init_timecounter(&tsc_timecounter);
        }
------------------


 with this new code:

------------------

/*--- Dont use TSC. ----*/
#if 0
        if (tsc_present && tsc_freq != 0 && !tsc_is_broken) {
                tsc_timecounter.tc_frequency = tsc_freq;
                init_timecounter(&tsc_timecounter);
        }
#endif
------------------


What this does is keep the virtual real-time clock
that corresponds to the TSC from running. FreeBSD
can use multiple real-time clock devices. Each device
corresponds to a virtualized ``timecounter''. The
last ``timercounter'' initialized is used by the
system to perform delta-time delays such as those
required by the all-important ``tsleep()'' function.
Simply commenting out the TSC ``init_timecounter()''
call has the effect of causing the previously
initialized 8254 timer chip to be used for system
delta-time operations.




(2) Writing to Video Memory
===========================



In file:


  /usr/src/sys/i386/i386/support.s


 Replace the ``generic_bcopy()'' code shown here:
------------------
ENTRY(generic_bcopy)
        pushl   %esi
        pushl   %edi
        movl    12(%esp),%esi
        movl    16(%esp),%edi
        movl    20(%esp),%ecx

        movl    %edi,%eax
        subl    %esi,%eax
        cmpl    %ecx,%eax        /* overlapping && src < dst? */
        jb      1f

        shrl    $2,%ecx          /* copy by 32-bit words */
        cld                      /* nope, copy forwards */
        rep
        movsl

        movl    20(%esp),%ecx
        andl    $3,%ecx          /* any bytes left? */

        rep
        movsb

        popl    %edi
        popl    %esi
        ret
------------------

 with the following code:

------------------
ENTRY(generic_bcopy)
        pushl   %esi
        pushl   %edi
        movl    12(%esp),%esi
        movl    16(%esp),%edi
        movl    20(%esp),%ecx

        movl    %edi,%eax
        subl    %esi,%eax
        cmpl    %ecx,%eax        /* overlapping && src < dst? */
        jb      1f



#if 0
        shrl    $2,%ecx          /* copy by 32-bit words */
        cld                      /* nope, copy forwards */
        rep
        movsl

        movl    20(%esp),%ecx
        andl    $3,%ecx          /* any bytes left? */
#else
        cld                /* NEW CODE! */
#endif
        rep
        movsb

        popl    %edi
        popl    %esi
        ret
------------------


What this does is eliminate an attempt to use a
repeated move-word instruction loop as an optimization.
Instead the entire string of bytes to be copied is
simply copied using the repeated move-byte instruction
that normally just handles the bytes in the last
word.

This fix is required because of a call in file:


 /usr/src/sys/dev/syscons/scvtb.c


Routine ``sc_vtb_copy()'' calls ``bcopy_toio()'' on
an odd-address when the bytes that comprise the
video memory are blitted after a backspace. This
mis-aligned move-word should exact a performace
penalty, but should not hang the system (an older
version of the reference motherboard I have
generates a bad SMI (sys mgmt interrupt).





To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-small" in the body of the message




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