FreeBSD/xbox: updated 7.0 patchset

classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

FreeBSD/xbox: updated 7.0 patchset

Rink Springer
Hello everyone,

I'd like to present my 7.0-CURRENT XBOX patches. If you put 'options
XBOX' in your kernel after applying this patch, you will get a kernel
that is bootable on both ordinary i386 PC's as well as XBOX'es. 'device
xboxfb' is an XBOX-capable frame buffer.

You can download the patches from
http://rink.nu/downloads/xbox-patches/xbox-7-current.diff. I hope this
patch will be committed to the FreeBSD source tree. Let me know any
suggestions for improvements.

The XBOX option depends on I686_CPU and will error out if it is not
supplied. The overall patch is just over 1000 lines, mainly due to the
framebuffer driver. You will need the most recent CVS version of
Cromwell [1], as it now fakes FreeBSD boot info so the initial entry
won't halt the CPU. This removes the patches in the locore.s file.

For some reason, the kernel will not work fine if you have syscons in your
kernel. This only affects the XBOX, so either syscons crashes it somehow
or it gets a higher priority. However, as the current framedriver driver
needs to be syscon(4)-ized, I intend to port the framebuffer to the VESA
framework. Assistance on this is very welcome.

Finally, I am willing to maintain this so future FreeBSD's will run on
the XBOX without any issues. Work is underway for the nForce ethernet as
well as an improved syscons(4)-able console driver.

[1] This is the Linux BIOS for the XBOX; it was patched in order to boot
    FreeBSD correctly.

--
Rink P.W. Springer                                - http://rink.nu
"God, root, what is difference?"                  - Pitr, Userfriendly

attachment0 (194 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: FreeBSD/xbox: updated 7.0 patchset

Warner Losh
In message: <[hidden email]>
            Rink Springer <[hidden email]> writes:
: You can download the patches from
: http://rink.nu/downloads/xbox-patches/xbox-7-current.diff. I hope this
: patch will be committed to the FreeBSD source tree. Let me know any
: suggestions for improvements.

OK.  I mostly like this patch.  It is fairly clean and I'll be working
on integrating it into the FreeBSD repo, with your help.

I have just a few questions/comments on your patch.

First, options XBOX shouldn't be in opt_global.h, but rather in
opt_xbox.h that dev/fb/boot_font.c, i386/i386/machdep.c,
i386/i386/pmap.c, i386/i386/vm_machdep, i386/isa/clock.c, and
i386/pci/pci_cfgreg.c should be including.  In general, we try to
reserve opt_global.h for really global stuff.

I don't understand the change to dev/fb/boot_font.c at all.  Can you
explain it in more detail?

There's some style(9) issues with xboxfb.c.  Specifically, there are a
few cases in some switches that are inconsistantly formatted wrt other
case statements.

There are a few really gross hacks that are marked with XXX better
fixes welcome.  I'm a little torn about committing those, but at least
they are all #ifdef XBOX.  My question is how long do you think until
there's a better solution for them?

This is absolutely great work!  Don't let my few quibbles and such get
you down.  I very much want to see xbox support committed to the tree.

Warner


_______________________________________________
[hidden email] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-arch
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: FreeBSD/xbox: updated 7.0 patchset

Ed Schouten
Hello,

* M. Warner Losh <[hidden email]> wrote:
> I don't understand the change to dev/fb/boot_font.c at all.  Can you
> explain it in more detail?

It seems that boot_font.c includes the file 'machine/rpb.h' which is
located at 'sys/alpha/include'. I'm not sure whether it is needed on
Alpha anyway.

Yours,
--
 Ed Schouten <[hidden email]>
 WWW: http://g-rave.nl/

attachment0 (194 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: FreeBSD/xbox: updated 7.0 patchset

Warner Losh
In message: <[hidden email]>
            Ed Schouten <[hidden email]> writes:
: Hello,
:
: * M. Warner Losh <[hidden email]> wrote:
: > I don't understand the change to dev/fb/boot_font.c at all.  Can you
: > explain it in more detail?
:
: It seems that boot_font.c includes the file 'machine/rpb.h' which is
: located at 'sys/alpha/include'. I'm not sure whether it is needed on
: Alpha anyway.

OK.  It isn't needed on the alpha.  I just confirmed by building lint
w/o the line.  I've committed it.  One fewer files to patch :-)

Warner
_______________________________________________
[hidden email] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-arch
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: FreeBSD/xbox: updated 7.0 patchset

Rink Springer
In reply to this post by Warner Losh
Hi Warner,

> I have just a few questions/comments on your patch.
>
> First, options XBOX shouldn't be in opt_global.h, but rather in
> opt_xbox.h that dev/fb/boot_font.c, i386/i386/machdep.c,
> i386/i386/pmap.c, i386/i386/vm_machdep, i386/isa/clock.c, and
> i386/pci/pci_cfgreg.c should be including.  In general, we try to
> reserve opt_global.h for really global stuff.

Ah, ok. I'll update this; just curious: are guidelines like this
outlined anywhere?

> I don't understand the change to dev/fb/boot_font.c at all.  Can you
> explain it in more detail?

You seem to have removed it alltogether already, just saw the commit :)

> There's some style(9) issues with xboxfb.c.  Specifically, there are a
> few cases in some switches that are inconsistantly formatted wrt other
> case statements.

Ah ok, I'll see if I can fix these.

> There are a few really gross hacks that are marked with XXX better
> fixes welcome.  I'm a little torn about committing those, but at least
> they are all #ifdef XBOX.  My question is how long do you think until
> there's a better solution for them?

Well, let's put them in an overview:

1) i386/i386/machdep.c: 64MB memory hardcoding on XBOX'es
   A normal XBOX as they are sold in most stores have 64MB RAM. However, some
   people have soldered 128MB memory on their XBOX, which also works but
   is non-standard.
 
   Since BIOS interrupts are nonexistant in an XBOX, the only way is to
   hardcode or probe. I could a minor check which tries the 120th
   Megabyte of memory or so and adjust memory accordingly, would this be
   acceptable?

   The reason why I left it like this is because I have no way to test
   128MB XBOX'es, they are quite rare.

2) i386/i386/pmap.c: Not clearing the pagetable
   This is indeed very gross. The framebuffer driver bluntly remaps the
   video memory to logical address 4KB and up; normally this space is
   unused and I use it for temporary video memory.

   Since we really want a console driver this early, but cannot yet do
   a sensible mapping, I used this hack. When the final console driver is
   used, it will make a good mapping using pmap_mapdev().

   I am unsure how to fix this; I tried using pmap_mapdev() but this
   didn't work; perhaps due to the kmem_alloc_nofault() ? (malloc() isn't
   yet active there) People who have more experience with the VM are very
   welcome to assist here ...

These are the main FIXME/XXX-es I can find. The xboxfb.c console driver
stresses out the #2 and claims it should be fixed in a more neat way ;-)

> This is absolutely great work!  Don't let my few quibbles and such get
> you down.  I very much want to see xbox support committed to the tree.

I'm very glad you are taking the time to help me out with this! I'll try
to get an updated patch released tonight.

Thanks!

--
Rink P.W. Springer                                - http://rink.nu
"God, root, what is difference?"                  - Pitr, Userfriendly

attachment0 (194 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: FreeBSD/xbox: updated 7.0 patchset

John Baldwin
In reply to this post by Rink Springer
On Sunday 06 November 2005 05:23 pm, Rink Springer wrote:

> Hello everyone,
>
> I'd like to present my 7.0-CURRENT XBOX patches. If you put 'options
> XBOX' in your kernel after applying this patch, you will get a kernel
> that is bootable on both ordinary i386 PC's as well as XBOX'es. 'device
> xboxfb' is an XBOX-capable frame buffer.
>
> You can download the patches from
> http://rink.nu/downloads/xbox-patches/xbox-7-current.diff. I hope this
> patch will be committed to the FreeBSD source tree. Let me know any
> suggestions for improvements.
>
> The XBOX option depends on I686_CPU and will error out if it is not
> supplied. The overall patch is just over 1000 lines, mainly due to the
> framebuffer driver. You will need the most recent CVS version of
> Cromwell [1], as it now fakes FreeBSD boot info so the initial entry
> won't halt the CPU. This removes the patches in the locore.s file.
>
> For some reason, the kernel will not work fine if you have syscons in your
> kernel. This only affects the XBOX, so either syscons crashes it somehow
> or it gets a higher priority. However, as the current framedriver driver
> needs to be syscon(4)-ized, I intend to port the framebuffer to the VESA
> framework. Assistance on this is very welcome.
>
> Finally, I am willing to maintain this so future FreeBSD's will run on
> the XBOX without any issues. Work is underway for the nForce ethernet as
> well as an improved syscons(4)-able console driver.
>
> [1] This is the Linux BIOS for the XBOX; it was patched in order to boot
>     FreeBSD correctly.

It might be nice to have as much of pci16l.s in C as possible for ease of
maintenance.  For example, at least two of the functions I looked at in there
just call a p16l_setbits() and that could be done via an inline function in a
header file.

--
John Baldwin <[hidden email]>  <><  http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve"  =  http://www.FreeBSD.org
_______________________________________________
[hidden email] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-arch
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: FreeBSD/xbox: updated 7.0 patchset

Rink Springer
Hi,

OK, I've updated the patchset. Changes:

- opt_xbox.h is now used instead of opt_global.h
- xboxfb.c should follow style(9) better
- boot_font.c is no longer patched
- 128MB XBOX-es should work too [1]

It is fetchable from
http://rink.nu/downloads/xbox-patches/xbox-7-current.v2.diff

Oh, and for John's comment: The reason pic16l.s is coded in assembly, was
that it was used extensively while debugging (it even resided in
locore.s for a while :-), as being able to change the LED's color is
immensely useful if you don't have a framebuffer working already :) This
is why I'd prefer to keep this file as-is.

[1] I have no way of testing this; volunteers are very welcome!

--
Rink P.W. Springer                                - http://rink.nu
"God, root, what is difference?"                  - Pitr, Userfriendly

* John Baldwin ([hidden email]) wrote:

> On Sunday 06 November 2005 05:23 pm, Rink Springer wrote:
> > Hello everyone,
> >
> > I'd like to present my 7.0-CURRENT XBOX patches. If you put 'options
> > XBOX' in your kernel after applying this patch, you will get a kernel
> > that is bootable on both ordinary i386 PC's as well as XBOX'es. 'device
> > xboxfb' is an XBOX-capable frame buffer.
> >
> > You can download the patches from
> > http://rink.nu/downloads/xbox-patches/xbox-7-current.diff. I hope this
> > patch will be committed to the FreeBSD source tree. Let me know any
> > suggestions for improvements.
> >
> > The XBOX option depends on I686_CPU and will error out if it is not
> > supplied. The overall patch is just over 1000 lines, mainly due to the
> > framebuffer driver. You will need the most recent CVS version of
> > Cromwell [1], as it now fakes FreeBSD boot info so the initial entry
> > won't halt the CPU. This removes the patches in the locore.s file.
> >
> > For some reason, the kernel will not work fine if you have syscons in your
> > kernel. This only affects the XBOX, so either syscons crashes it somehow
> > or it gets a higher priority. However, as the current framedriver driver
> > needs to be syscon(4)-ized, I intend to port the framebuffer to the VESA
> > framework. Assistance on this is very welcome.
> >
> > Finally, I am willing to maintain this so future FreeBSD's will run on
> > the XBOX without any issues. Work is underway for the nForce ethernet as
> > well as an improved syscons(4)-able console driver.
> >
> > [1] This is the Linux BIOS for the XBOX; it was patched in order to boot
> >     FreeBSD correctly.
>
> It might be nice to have as much of pci16l.s in C as possible for ease of
> maintenance.  For example, at least two of the functions I looked at in there
> just call a p16l_setbits() and that could be done via an inline function in a
> header file.
>
> --
> John Baldwin <[hidden email]>  <><  http://www.FreeBSD.org/~jhb/
> "Power Users Use the Power to Serve"  =  http://www.FreeBSD.org
>

attachment0 (194 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: FreeBSD/xbox: updated 7.0 patchset

John Baldwin
On Monday 07 November 2005 02:44 pm, Rink Springer wrote:

> Hi,
>
> OK, I've updated the patchset. Changes:
>
> - opt_xbox.h is now used instead of opt_global.h
> - xboxfb.c should follow style(9) better
> - boot_font.c is no longer patched
> - 128MB XBOX-es should work too [1]
>
> It is fetchable from
> http://rink.nu/downloads/xbox-patches/xbox-7-current.v2.diff
>
> Oh, and for John's comment: The reason pic16l.s is coded in assembly, was
> that it was used extensively while debugging (it even resided in
> locore.s for a while :-), as being able to change the LED's color is
> immensely useful if you don't have a framebuffer working already :) This
> is why I'd prefer to keep this file as-is.

You do realize that you can call C functions from assembly, right? :)

> [1] I have no way of testing this; volunteers are very welcome!

--
John Baldwin <[hidden email]>  <><  http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve"  =  http://www.FreeBSD.org
_______________________________________________
[hidden email] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-arch
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: FreeBSD/xbox: updated 7.0 patchset

Scott Long-2
John Baldwin wrote:

> On Monday 07 November 2005 02:44 pm, Rink Springer wrote:
>
>>Hi,
>>
>>OK, I've updated the patchset. Changes:
>>
>>- opt_xbox.h is now used instead of opt_global.h
>>- xboxfb.c should follow style(9) better
>>- boot_font.c is no longer patched
>>- 128MB XBOX-es should work too [1]
>>
>>It is fetchable from
>>http://rink.nu/downloads/xbox-patches/xbox-7-current.v2.diff
>>
>>Oh, and for John's comment: The reason pic16l.s is coded in assembly, was
>>that it was used extensively while debugging (it even resided in
>>locore.s for a while :-), as being able to change the LED's color is
>>immensely useful if you don't have a framebuffer working already :) This
>>is why I'd prefer to keep this file as-is.
>
>
> You do realize that you can call C functions from assembly, right? :)
>

If this is the only remaining technical objection, then can it be
something that gets resolved after it goes into the tree?  It's code
that is segregated and private to the XBOX port, so it would be a shame
to make it stall this great work.

Scott
_______________________________________________
[hidden email] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-arch
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: FreeBSD/xbox: updated 7.0 patchset

John Baldwin
On Monday 07 November 2005 05:26 pm, Scott Long wrote:

> John Baldwin wrote:
> > On Monday 07 November 2005 02:44 pm, Rink Springer wrote:
> >>Hi,
> >>
> >>OK, I've updated the patchset. Changes:
> >>
> >>- opt_xbox.h is now used instead of opt_global.h
> >>- xboxfb.c should follow style(9) better
> >>- boot_font.c is no longer patched
> >>- 128MB XBOX-es should work too [1]
> >>
> >>It is fetchable from
> >>http://rink.nu/downloads/xbox-patches/xbox-7-current.v2.diff
> >>
> >>Oh, and for John's comment: The reason pic16l.s is coded in assembly, was
> >>that it was used extensively while debugging (it even resided in
> >>locore.s for a while :-), as being able to change the LED's color is
> >>immensely useful if you don't have a framebuffer working already :) This
> >>is why I'd prefer to keep this file as-is.
> >
> > You do realize that you can call C functions from assembly, right? :)
>
> If this is the only remaining technical objection, then can it be
> something that gets resolved after it goes into the tree?  It's code
> that is segregated and private to the XBOX port, so it would be a shame
> to make it stall this great work.

Yes, certainly, that is only a minor nit!  I just tend to prefer that we keep
as much code in C as possible rather than asm as C has a lower learning
curve.

--
John Baldwin <[hidden email]>  <><  http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve"  =  http://www.FreeBSD.org
_______________________________________________
[hidden email] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-arch
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: FreeBSD/xbox: updated 7.0 patchset

Warner Losh
In reply to this post by Scott Long-2
In message: <[hidden email]>
            Scott Long <[hidden email]> writes:
: John Baldwin wrote:
:
: > On Monday 07 November 2005 02:44 pm, Rink Springer wrote:
: >
: >>Hi,
: >>
: >>OK, I've updated the patchset. Changes:
: >>
: >>- opt_xbox.h is now used instead of opt_global.h
: >>- xboxfb.c should follow style(9) better
: >>- boot_font.c is no longer patched
: >>- 128MB XBOX-es should work too [1]
: >>
: >>It is fetchable from
: >>http://rink.nu/downloads/xbox-patches/xbox-7-current.v2.diff
: >>
: >>Oh, and for John's comment: The reason pic16l.s is coded in assembly, was
: >>that it was used extensively while debugging (it even resided in
: >>locore.s for a while :-), as being able to change the LED's color is
: >>immensely useful if you don't have a framebuffer working already :) This
: >>is why I'd prefer to keep this file as-is.
: >
: >
: > You do realize that you can call C functions from assembly, right? :)
: >
:
: If this is the only remaining technical objection, then can it be
: something that gets resolved after it goes into the tree?  It's code
: that is segregated and private to the XBOX port, so it would be a shame
: to make it stall this great work.

Don't worry.  I have v1 of the patches sitting in a tree waiting for
me to find some time to commit them.  I was going to update to v2
tonight and see what had been fixed and integrate more into it either
tonight or tomorrow night.

Warner
_______________________________________________
[hidden email] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-arch
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: FreeBSD/xbox: updated 7.0 patchset

Rink Springer
In reply to this post by Rink Springer
Hello everyone,

> [xbox patches]

For your information: Warner (imp@) commited this some time ago now,
thanks! It's in HEAD now :-) The actual commit can be found at
http://www.freebsd.org/cgi/cvsweb.cgi/src/sys/i386/conf/XBOX.

I've got a patch set up for NOTES to inform people about the XBOX
options, per Warner's request. It can be found at
http://rink.nu/downloads/xbox-patches/NOTES.diff. For some reason,
Warner doesn't seem to receive some of my mails (over-enthoisiastic spam
filtering perhaps?), which is why I'll post this mini-patch here.

As a status update, I've got a syscons(4)-ized version of the
framebuffer working. It's very kludgy and not yet ready; for some reason,
it doesn't yet work as a kernel console (when I enable this, by forcing
isa/syscons_isa.c to return my xboxfb driver for syscons, it initializes
fine but freezes afterwards)...

Who is the syscons(4) guru around here who can give me some pointers on
syscon's bootup behaviour? :-)

--
Rink P.W. Springer                                - http://rink.nu
"God, root, what is difference?"                  - Pitr, Userfriendly

attachment0 (194 bytes) Download Attachment