Commit Graph

1245 Commits

Author SHA1 Message Date
Maxim Sobolev
b5f9b5b875 Fix compilation in the case when kernel doesn't have KDB ebabled.
subr_kdb.c still references breakpoint() in this case.
2008-10-30 21:02:00 +00:00
Nathan Whitehorn
014186973a Fix some possible infinite loops in the ADB code, and remove some hacks
that were inserted in desperation during bring-up. In addition, move ADB bus
enumeration and child attachment to when interrupts are available.
2008-10-30 15:27:13 +00:00
Marcel Moolenaar
636f2ebf67 Add support for little-endian compilations to this file. 2008-10-30 03:31:33 +00:00
Nathan Whitehorn
360bf6787a DBDMA can transfer a maximum of 64K - 1 bytes per descriptor, as the byte
count field is 16 bits. Inform ATA of this fact.

Reported by:	Marco Trillo
2008-10-28 22:09:30 +00:00
Nathan Whitehorn
4a8c139140 Clean up some magic numbers in the DBDMA code by replacing them with
appropriately defined constants.

Suggested by:	gnn
2008-10-27 23:11:14 +00:00
Marcel Moolenaar
dc9d16844c Add support for kernel profiling for both AIM and BookE.
Obtained from:	Juniper Networks, Inc (BookE support).
2008-10-27 02:36:03 +00:00
Marcel Moolenaar
1463295f81 Remove unused declarations (interrupt_vector_{base|top}). 2008-10-27 01:51:30 +00:00
Marcel Moolenaar
11722a8c11 Declare btext and etext. Needed by sys/kern/subr_prof.c for
for kernel profiling.
2008-10-27 00:26:07 +00:00
Nathan Whitehorn
e865720075 Bring Kauai ATA driver in line with Macio ATA by reading the PIO config reg
to set the initial PIO mode instead of assuming PIO4. There are still a few
nagging issues:

- There are some problems with 64 K DMA transfers waiting on lower level
changes.

- ATAPI DMA is broken on Marcel's Mac Mini because we need an ATA SELECT hook
propagated up to individual drivers for hardware without timing registers for
each ATA channel.
2008-10-27 00:09:14 +00:00
Nathan Whitehorn
b4dbc59983 Add ADB support. This provides support for the external ADB bus on the PowerMac
G3 as well as the internal ADB keyboard and mice in PowerBooks and iBooks. This
also brings in Mac GPIO support, for which we should eventually have a better
interface.

Obtained from:  NetBSD (CUDA and PMU drivers)
2008-10-26 19:37:38 +00:00
Marcel Moolenaar
e5637f19bd Enable the cfi(4) driver. 2008-10-25 06:25:15 +00:00
Marcel Moolenaar
08077f589c Add a driver for the Local Bus Controller.
Obtained from:	Juniper Networks, Inc.
2008-10-25 06:03:40 +00:00
Marcel Moolenaar
bd616bc87e Assign 0xff800000-0xffffffff to the LBC controller. That's where
the NOR flash lives by default.
2008-10-25 05:57:36 +00:00
Marcel Moolenaar
9b85e175fd In mmu_booke_mapdev(), handle mappings that cannot be represented
by a single TLB entry. The boot ROM on the MPC85555CDS is 8MB, for
example, and in order to map that we need 2 4MB TLB entries.
2008-10-25 03:36:21 +00:00
Nathan Whitehorn
fc7a9640c7 Prevent the OF syscons module from trying to attach to real devices on the
nexus by only attaching to a device with no OF node.
2008-10-15 03:38:03 +00:00
Nathan Whitehorn
51d163d3e9 Convert PowerPC AIM PCI and nexus busses to standard OFW bus interface. This
simplifies certain device attachments (Kauai ATA, for instance), and makes
possible others on new hardware.

On G5 systems, there are several otherwise standard PCI devices
(Serverworks SATA) that will not allow their interrupt properties to be
written, so this information must be supplied directly from Open Firmware.

Obtained from:	sparc64
2008-10-14 14:54:14 +00:00
Marius Strobl
6f04e7b9aa Remove ipi_all() and ipi_self() as the former hasn't been used at
all to date and the latter also is only used in ia64 and powerpc
code which no longer serves a real purpose after bring-up and just
can be removed as well. Note that architectures like sun4u also
provide no means of implementing IPI'ing a CPU itself natively
in the first place.

Suggested by:	jhb
Reviewed by:	arch, grehan, jhb
2008-09-28 18:34:14 +00:00
Nathan Whitehorn
be05c004e0 Unbreak support for G4s without an L3 cache. L3 cache support was introduced
with, and limited to, the Motorola/Freescale 745x family.

Reported by:	Marco Trillo
2008-09-28 15:12:43 +00:00
Nathan Whitehorn
b798355b99 Expand the DBDMA API to allow setting device-dependent control bits. While
here, clean up and document this a little.

Submitted by:	Marco Trillo
MFC after:	1 week
2008-09-27 15:41:16 +00:00
Nathan Whitehorn
b7382e099d Add DMA support for Apple built-in ATA controllers.
Tested by:	grehan, marcotrillo@gmail.com
MFC after:	1 month
2008-09-27 15:13:44 +00:00
Ed Schouten
6bfa9a2d66 Replace all calls to minor() with dev2unit().
After I removed all the unit2minor()/minor2unit() calls from the kernel
yesterday, I realised calling minor() everywhere is quite confusing.
Character devices now only have the ability to store a unit number, not
a minor number. Remove the confusion by using dev2unit() everywhere.

This commit could also be considered as a bug fix. A lot of drivers call
minor(), while they should actually be calling dev2unit(). In -CURRENT
this isn't a problem, but it turns out we never had any problem reports
related to that issue in the past. I suspect not many people connect
more than 256 pieces of the same hardware.

Reviewed by:	kib
2008-09-27 08:51:18 +00:00
Konstantin Belousov
a8d403e102 Change the static struct sysentvec and struct Elf_Brandinfo initializers
to the C99 style. At least, it is easier to read sysent definitions
that way, and search for the actual instances of sigcode etc.

Explicitely initialize sysentvec.sv_maxssiz that was missed in most
sysvecs.

No objection from:	jhb
MFC after:	1 month
2008-09-24 10:14:37 +00:00
Nathan Whitehorn
4c01c0b965 Allow the cacheline size on PowerPC to be set at runtime. This is essential for
supporting 64-bit CPUs, which often have 128-byte cache lines instead of the
standard 32.
2008-09-24 00:28:46 +00:00
Maxim Sobolev
d3e5e8d1b6 Improve rev 183168, so that if /chosen/stdout is connected to the serial
port by OF the syscons won't take over console. Only attach syscons to "screen"
if /chosen/stdout is not connected, which could be the case when loader(8)
is booted directly from the OF. This fixes Marcel's Xserver.

Reported by:	marcel
2008-09-23 22:16:23 +00:00
Nathan Whitehorn
52a7870df1 In preparation for PowerPC G5 support, allow PVO objects to contain page
table entries for both the 32-bit and 64-bit AIM MMUs.
2008-09-23 03:02:57 +00:00
Nathan Whitehorn
f1dea04adb Change the DBDMA API to allow DBDMA registers in a subregion of a resource. This is necessary to allow future support of DMA for the various Apple on-board ATA controllers.
MFC after:	1 week
2008-09-23 02:12:47 +00:00
Nathan Whitehorn
a2fff700c9 Unbreak G3 support. G3 processors don't have an L3 cache, so we shouldn't try to program it.
Approved by:	marcel (mentor)
2008-09-22 03:21:02 +00:00
Maxim Sobolev
ccb33393cc When attaching framebuffer to "/chosen/stdout" node fails, try attaching
to "screen" node directly. The problem is that by default OF on some (all?)
Macs either doesn't provide "/chosen/stdout" or redirects it somewhere,
unless you boot in manual mode via CMD-ALT-O-F. It's nice to see normal
FreeBSD boot output instead of blank gray screen.
2008-09-19 03:22:47 +00:00
Marcel Moolenaar
e4f72b32cb o When not making a translation cache-inhibit and guarded (PTE_I|PTE_G)
make it memory-coherency enforced (PTE_M). This is required for SMP
   to work.
o  Serialize tlbie operations and implement the tlbie operation in a
   function called tlbie(). Hardware can end up in a live-lock if
   between the tlbsync and subsequent sync on one processor another
   processor executes a tlbie or tlbsync.
o  Eliminate the following defines:
	TLBIE, TLBSYNC, SYNC and EIEIO
   Use either inline assembly statements or inline functions defined
   in <machine/cpufunc.h>
2008-09-16 19:16:33 +00:00
Marcel Moolenaar
6e32690075 Rewrite cpudep_ap_bootstrap(). We now enable L3, L2, L1D and L1I
caches if not yet enabed. This is required for coherency and
atomic operations to work, not to mention performance. We use the
L2 and L3 cache settings of the BSP to configure the APs caches.
Can't be bad.

Program NAP and not DOZE. DOZE is present only on earlier CPUs
and the bit is reserved on the MPC7441 & MPC7451. NAP will do
bus snooping to keep caches coherent.

Program the PIR with the cpuid. This may not be necessary...
2008-09-16 17:22:16 +00:00
Marcel Moolenaar
d349b8aca9 o In decr_get_timecount() only read the low timebase register.
We're only returning a 32-bit counter.
o  In decr_intr(), manually perform LICM, so that we don't test
   a loop invariant condition inside a loop.
o  Include <machine/smp.h>
2008-09-16 17:11:33 +00:00
Marcel Moolenaar
5e3943bf93 Set pcpup->pc_curthread and pcpup->pc_curpcb before calling
pmap_activate. While pmap_activate doesn't need either, we
do need a valid curthread if we enable KTR_PMAP.
2008-09-16 17:03:52 +00:00
Marcel Moolenaar
bdd42e42d7 o Synchronize the APs timebase and decrementer values with the BSP.
o  Don't set/get the PIR register. It's CPU dependent.
o  Also initialize pcpup->pc_curpcb, in case it's dereferenced.
2008-09-16 16:33:36 +00:00
Marcel Moolenaar
5da7ea0a89 In powerpc_get_pcpup(), make the inline assembly statement
volatile so that the compiler won't perform CSE. For SMP,
this may result in us accessing the wrong PCPU and as such
results in a bogus curthread value.

Note that getting curthread is not quite MP-safe in the sense
that it requires two instructions that aren't performed
atomically. The first instruction gets the address of the PCPU
structure and the second instruction dereferences that pointer
to get curthread. If a thread is switched-out in between these
instructions and switched-in on a different CPU, we still get
the wrong curthread.
2008-09-16 16:28:51 +00:00
Marcel Moolenaar
c139f23d17 Remove the tracing from the AP startup. The AP is known
to start and the tracing can interfere with AP startup.
Instead, use the available space in the reset vector
for the initial stack.
2008-09-16 01:05:54 +00:00
Marcel Moolenaar
cf0c300484 o Remove SPR_TSR & SPR_TCR for AIM.
o  Remove SPR_HID2.
o  Add more SPR_L3CR bit definitions.
2008-09-15 02:51:07 +00:00
Marcel Moolenaar
cadd87749d Dont worry about PSL_RI (restartable interrupt indicator) in
common PowerPC code when all we want to achieve is to enable
external interrupts. We can set PSL_RI at any time before we
allow interrupts and/or exceptions, so move it to the AIM
specific initialization and do it when we also set PSL_ME
(machine check enable).
2008-09-15 01:03:16 +00:00
Marcel Moolenaar
12028e919b Rename cpu_config_l2cr() to cpu_print_cacheinfo(). We're not
configuring the L2 cache on the BSP. Nor the L3 cache. We
merely print the settings.

Save the L2 and L3 cache configuration in global values so
that we know how to configure the cache on APs.
2008-09-15 00:59:49 +00:00
Marcel Moolenaar
df1a6d5102 Remove debugging code. 2008-09-14 21:30:01 +00:00
Marcel Moolenaar
cbb6aaf62f Trace interrupts with KTR_INTR. 2008-08-31 23:54:22 +00:00
Marcel Moolenaar
8d8cca480c Remove redundant KTR statements. 2008-08-31 20:55:31 +00:00
Marcel Moolenaar
09a94c6407 Trace all PMAP calls using KTR_PMAP. 2008-08-31 20:08:13 +00:00
Marcel Moolenaar
24c8466e8f Remove restore_intr(). We have intr_restore()... 2008-08-31 02:25:20 +00:00
Marcel Moolenaar
896b354188 In db_show_mdpcpu(), print MD fields. 2008-08-30 18:50:11 +00:00
Marcel Moolenaar
958ed50695 Whitespace fixes. 2008-08-30 18:48:17 +00:00
Marcel Moolenaar
20c5910af7 Call powerpc_sync() instead of using an asm statement. 2008-08-30 18:39:29 +00:00
Marcel Moolenaar
d3f6fb3b91 Add powerpc_sync() as an inline function. 2008-08-30 18:38:37 +00:00
Marcel Moolenaar
7aff4169e3 Don't clear PSL_RI. Disabling external interrupts
doesn't make exceptions unrecoverable.
2008-08-30 18:37:55 +00:00
Rafal Jaworowski
c8e780791e Move initialization of tlb0, ptbl_bufs and kernel_pdir regions after we are
100% sure that TLB1 mapping covers for them; previously we could lock the CPU
with an untranslated references.

Obtained from:	Semihalf
2008-08-28 07:38:08 +00:00
Rafal Jaworowski
959aea56c1 Improve kernel stack handling on e500.
- Allocate thread0.td_kstack in pmap_bootstrap(), provide guard page
- Switch to thread0.td_kstack as soon as possible i.e. right after return
  from e500_init() and before mi_startup() happens
- Clean up temp stack area
- Other minor cosmetics in machdep.c

Obtained from:	Semihalf
2008-08-26 17:07:37 +00:00