Commit Graph

61 Commits

Author SHA1 Message Date
Peter Grehan
2fcb4181ad Make code match comment: make the smallest unit of page allocation
from OpenFirmware be 16 pages to avoid fragmentation in the list
of mappings returned when the kernel requests it in pmap_bootstrap.

This allows a static buffer to be used when obtaining the existing
mappings - very useful on the G5 when random physical pages can't
be grabbed because they can't be BAT-mapped.

MFC after:	3 days
2005-07-22 23:22:29 +00:00
Peter Grehan
530d1c7646 Since the BAT mapping was removed a long time back, it can't
be assumed that modules are contiguous in memory (they're not)
so don't blindly __syncicache start/end. In fact, don't bother
syncing the icache for modules since the kernel will do it after
fixing up relocations.

This fixes the trap when loading modules at boot time.

Reported by:	orlando at break dot net
2005-05-24 21:43:49 +00:00
Peter Grehan
a9f9f6ce08 Change ofw_readin/ofw_copyin to map the entire region before
copying, rather than a page at a time. This was creating far
too many single-page mappings, and eventually OFW overflowed
some internal data structure and refused to map any more.
The new algorithm creates far less mappings and fixed a bug
where multiple mappings for the same page would be created.

'Twas known this was a problem, but only became urgent when the
install CD's mfs_root grew large enough to cause the overflow.
2005-05-19 07:21:46 +00:00
Marius Strobl
9e2b417bfd Remove unused variables. 2005-03-02 20:12:27 +00:00
Warner Losh
6a0fd84b50 Start each of the license/copyright comments with /*- 2005-01-05 22:16:58 +00:00
Ruslan Ermilov
a35d88931c For variables that are only checked with defined(), don't provide
any fake value.
2004-10-24 15:33:08 +00:00
Marius Strobl
39513fa664 Instead of "OpenFirmware", "openfirmware", etc. use the official spelling
"Open Firmware" from IEEE 1275 and OpenFirmware.org (no pun intended).

Ok'ed by:	tmm
2004-08-16 15:45:27 +00:00
Peter Grehan
d4a57a3131 G5 support: handle the case where the OpenFirmware memory array uses
64 bits for the phys address, but only 32 for the virtual address.
2004-08-02 03:05:09 +00:00
Peter Grehan
c727d17006 All hell breaks loose if the loader image is released before
jumping to the kernel. Another bug exposed by removing the
1:1 BAT mapping. Sparc64 doesn't do this either.

Compile tested on: panther (sparc64). Code built, but not used, on sparc64.
2004-07-08 06:09:22 +00:00
Peter Grehan
ff6e6584fc Correctly calculate size of memory to be mapped when copying. Removal
of the 256Mb 1:1 BAT mapping exposed this as copying into memory that
hadn't been claimed from OpenFirmware.

compiled-tested on: panther (sparc64). Code built, but not used, on sparc64
2004-07-08 06:06:56 +00:00
Peter Grehan
4bb04ec4eb Extract entry point from elf header before releasing the heap.
This caused a data-miss trap when the BAT init code was removed
on PPC.

Compile tested on: panther (sparc64). Code built, but not used, on sparc64.
2004-07-08 06:04:45 +00:00
David E. O'Brien
c990f469a7 Convert to __FBSDID. 2004-01-04 23:30:47 +00:00
Peter Grehan
e49e14200a - Add ':' as a separator between the OpenFirmware device space and
the file path. Commonly used on Macs e.g. "hd:9".
- Update the ofw_setcurrdev routine to match libstand setenv prototype

Not objected to by: sparc64
2003-12-21 12:38:25 +00:00
Peter Grehan
bca2f486f0 Make __elfN(ofw_loadfile) match parameter declaration for file_format
in boot/common/bootstrap.h. Having a 32-bit size when a 64-bit param
is declared wreaks havoc on PPC.

Not objected to by: sparc64
2003-12-21 12:27:01 +00:00
Peter Grehan
934eb1922a Only print out an error if returned data size is < 0. A value of 0
happens almost every time at the end of a file when using NFS.

No objection by: sparc64
2003-12-21 12:19:38 +00:00
Peter Grehan
e2776725d7 Use daddr_t instead of u_long for byte offset in strategy
routine to avoid >4G truncation on 32-bit systems.

no objection by: sparc64
2003-12-21 12:16:58 +00:00
Peter Grehan
69a8dff7af - use correct pointer arithmetic in heapsize calculation
- handle multiple Ofw memory regions when determining mem size
- allow currdev to be set as a loader command-line option.
  parse() is used to allow future options to be processed.
2003-12-21 12:11:31 +00:00
Peter Wemm
48a0b96a50 Enable the i386 loader to load and run an amd64 kernel. If this puts
things over floppy size limits, I can exclude it for release builds or
something like that.  Most of the changes are to get the load_elf.c file
into a seperate elf32_ or elf64_ namespace so that you can have two
ELF loaders present at once.  Note that for 64 bit kernels, it actually
starts up the kernel already in 64 bit mode with paging enabled.  This
is really easy because we have a known minimum feature set.

Of note is that for amd64, we have to pass in the bios int 15 0xe821
memory map because once in long mode, you absolutely cannot make VM86
calls.  amd64 does not use 'struct bootinfo' at all.  It is a pure loader
metadata startup, just like sparc64 and powerpc.  Much of the
infrastructure to support this was adapted from sparc64.
2003-05-01 03:56:30 +00:00
Poul-Henning Kamp
f770d2d3dd Cut&Paste considered far too easy:
Don't include <sys/disklabel.h>
2003-04-16 21:09:41 +00:00
Jake Burkholder
a0e1420b07 Fix a dumb bug that broke net booting on sparc64. The wrong length was
passed to strncmp.

Noticed by:	tmm
Approved by:	re
Pointy hat to:	jake
2002-12-02 01:46:22 +00:00
Jake Burkholder
de0acbf78f Change the device path representation in libofw to use the full firmware
path, instead of an internal i386 specific one.  Don't try to interpret
a disklabel in ofw_disk.c, open the partition's device node directly and
let the firmware do it.  This fixes booting from a partition other than 'a'
on sparc64, which is needed to support more installation methods.

No objection:	ppc
2002-11-10 19:17:36 +00:00
Benno Rice
8e465298e2 Major rework of how we copy data into kernel space.
We now talk to the memory and mmu instances directly rather than using the
OpenFirmware "claim" method.
2002-07-18 12:39:02 +00:00
Benno Rice
631c19755e Add support for passing metadata. 2002-07-10 12:13:16 +00:00
Benno Rice
0f9bb727a5 Fix up the DMA buffer allocation call. 2002-06-07 11:49:33 +00:00
Ruslan Ermilov
46f8fdc34e Removed now unused INTERNALSTATICLIB.
INTERNALLIB now implies NOPIC and NOPROFILE.
Removed gratuitous NOMAN.
2002-05-13 11:09:07 +00:00
David E. O'Brien
95cfc25d0d Back out last commit. I expect our bsd.*.mk gods to remove the need for
defining so many extra things in addition to INTERNALLIB.  We don't like
repetitive C code and we shouldn't for make code either.
2002-05-12 13:54:42 +00:00
Jake Burkholder
d07160f401 Change the disk probing so that it will actually find disks other
than the first one on a controller, and work for secondary
controllers.
Due to the prom not having nodes for each disk, but a catch-all one,
we have to iterate over each device, trying to open it to determine
whether it is actually present.
Since probing this way takese some time (and spews some spurious
warnings), it should maybe be short-circuited if we use the
device we were booted from.
Implement lazy device probing, and correct slice/partiniton
handling in the ofwd_open() code. With this, I can now actually boot
a kernel from disk, and the loader does not create unnecessary
delays.

Submitted by:	tmm
2002-05-11 21:30:46 +00:00
David E. O'Brien
3bf8b9cee3 NOPIC, NOPROFILE, NOMAN, and INTERNALSTATICLIB are redundant when using
INTERNALLIB now.
2002-05-11 18:02:33 +00:00
Jake Burkholder
90774cfa30 Add -ffreestanding to CFLAGS. 2002-02-23 04:36:15 +00:00
Jake Burkholder
23b93fc323 Fix test for != 0 that should be > 0. 2002-02-23 04:33:15 +00:00
Jake Burkholder
c2ef11f244 Check the return values of index() and don't dereference it if its null;
the path may not have a ':' in it.  The mac address property is called
mac-address for sparc64.  Don't allocate a dma buffer for sparc64 either.
2002-02-23 04:31:30 +00:00
Jake Burkholder
0c7065ad98 #if 0 more bootinfo stuff. 2002-02-23 04:13:02 +00:00
Jake Burkholder
acfdfd647b Add OF_claim_virt() and OF_release_phys().
Submitted by:	tmm
2002-02-23 03:36:04 +00:00
Robert Drehmel
2649cfd7fd - Remove unneeded variable.
- Remove change for my local configuration that slipped in with
   the last commit; I am having problems booting when multiple SCSI
   disks are attached, so I will change this part as soon as I find
   a solution, anyway.
2002-02-15 13:22:09 +00:00
Robert Drehmel
0259c50ec2 This file is now unneeded. 2002-02-15 13:11:00 +00:00
Robert Drehmel
6d41f1a9db - Do not include a NetBSD header as it is not needed anymore.
- Remove two constants that were needed in conjuction with the
   NetBSD disklabel header.  Use the FreeBSD equivalents.
   To boot from NetBSD/sparc64 partitions, define LABELOFFSET to
   be 128.
 - Do not use the complete open firmware path to filter out cdrom drives.
   No path containing "cdrom" is detected as a disk now.
 - Simplify some code.
2002-02-15 13:09:34 +00:00
Jake Burkholder
eea923d7f8 Make the openfirmware entry point function pointer non-static so that it
can be passed to the kernel.
2001-10-30 06:23:32 +00:00
Robert Drehmel
aa5bde88b1 Add a prototype for OF_alloc_phys. 2001-10-15 14:43:38 +00:00
Robert Drehmel
7081e52987 Make the ofw_reg structure and ofw_alloc_heap 64-bit save. 2001-10-15 12:16:20 +00:00
Robert Drehmel
d729d0aa31 Do not include openfirm.h; it is now included by libofw.h. 2001-10-15 09:52:38 +00:00
Robert Drehmel
66631c00de - Use the cell_t type definition for Open Firmware arguments in
combination with requisite casts as this avoids fatal side
   effects on 64-bit architectures.
 - Add the OF_alloc_phys function.
2001-10-15 09:51:09 +00:00
Robert Drehmel
1da9b140b7 - Fill dummy functions with code to read from disk using Open
Firmware.
 - Add a temporary disklabel header to boot off a NetBSD/sparc64
   partition.  This file can be deleted when we have got a FCode
   bootblock.

The disklabel header was obtained from NetBSD.
2001-10-15 09:35:40 +00:00
Robert Drehmel
7ff1bab73b - Include openfirm.h for phandle_t.
- Add some necessary members to the ofwdisk structure.
 - Add a prototype for ofw_parseofwdev.
2001-10-15 09:28:07 +00:00
Robert Drehmel
cdfc68815b Add a function for parsing an Open Firmware boot path into the
ofw_devdesc structure.
2001-10-15 09:25:30 +00:00
Robert Drehmel
8716f26121 - Add an ifdef guard.
- Use unsigned types for the (32-bit) Open Firmware device handles
   to avoid sign extension on 64-bit architectures.
 - Add a standard type definition for Open Firmware arguments.
2001-10-15 09:02:03 +00:00
Benno Rice
225845627b Whitespace fixes. 2001-10-07 13:27:27 +00:00
Benno Rice
a6bfff4582 Add new files needed by previous commit. 2001-10-07 13:24:56 +00:00
Benno Rice
cae2c81dc2 Mega-patch for OpenFirmware loader support.
- Flesh out ofw_readin routine.
- Add OpenFirmware load and exec routines.
- Make sure memory allocation for the kernel is done correctly.
- Change the way the heap is allocated so as to make it easier to deallocate
  when we hand over.
- Add a command to print memory maps similar to the one for ia64.

With this patch, I can now load and hand over to a kernel on my iMac.  There
are some problems with OpenFirmware routines failing after the hand over that
still need to be addressed.
2001-10-07 13:22:25 +00:00
Benno Rice
035dbc3cb5 Pass NULL instead of MAXPHYS to the DMA allocation method. Be a bit more
verbose if we fail to allocate the DMA buffer.
2001-08-26 07:07:47 +00:00
Benno Rice
4cc1860f9b OpenFirmware/PowerPC loader, part 2.
As of this patchset, the loader builds (under NetBSD/macppc), boots, interacts
and talks to BOOTP/NFS servers.

(main.c was moved from boot/ofw/libofw to boot/ofw/common but has no revision
 history)

Reviewed by:	obrien
2000-11-10 06:39:58 +00:00