> I'm currently porting OpenSolaris to the IBM zSeries. For both Sparc and x86
> targets there appears to be some smarts in the PROM to do a number of
> functions that are got at via bop_xxxx (or bsys_xxxx) APIs. The one I'm
> particularly interested in is bop_alloc() although I think I'll need to
> understand bop_alloc_virt() and bop_free() as well. 
>
> bop_alloc() appears to allocate pages from the top of memory. I just need to
> understand what it does, how it does it, and what it is returning (it appears
> you can pass it an address so what is it returning). zSeries of course has no
> such PROM support so I'm wondering the best way to emulate these routines.
> Some of the comments seem to indicate that the stuff it returns is a virtual
> address so I'm pretty confused at the moment. 

bop_alloc() is the implementation of the BOP_ALLOC() macro on the SPARC
target.  BOP_ALLOC() is one of a family of macros that are used by kernel
code early during boot to call through from the kernel to the boot code
to perform some operation -- in this case allocate memory -- that is
needed by the kernel very early during boot.  Once the kernel is fully
up and running the BOP_ entry points are no longer used.  One such place
we need BOP_ALLOC() is very early in krtld, before we begin the kernel.

On SPARC, BOP_ALLOC() is #defined to bop_alloc(), a C wrapper function which
traps into the OpenBoot PROM to perform the service.  On x86, BOP_ALLOC()
calls through a function pointer stored in the bootops by the boot program.
The parameters are a virtual hint about where to put the allocation (or 0 for
no hint), the size and alignment required for the allocation, and the
return value is expected to be a kernel virtual address.

If you look at usr/src/psm/stand/boot/i386/common/bootops.c, you can see
the source for bkern_alloc(), one of the foul implementations of this stuff.
For scratch allocations, you can just move a pointer around some presized
arena.  For permanent things we end up adjusting the actual memlists.
Fundamentally your implementation for zSeries will depend on how you
architect the boot loader and what sort of firmware IBM has underneath.

Hope this helps,

-Mike

PS-I'm not sure if you have a larger set of design decisions made around your
   boot architecture, but one thing I would definitely recommend is using the
   GRUB-style multiboot interface, as Solaris on x86 already does so and
   in the future we hope to move SPARC to the same.  There is a PSARC case
   pending on x86 direct boot (a modification of how we do GRUB), and I would
   also recommend taking a look at that and/or talking to its authors as this
   may also give you some good ideas as to how to tackle these issues.

-- 
Mike Shapiro, Solaris Kernel Development. blogs.sun.com/mws/
_______________________________________________
opensolaris-code mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code

Reply via email to