PERFORCE change 127324 for review
John Birrell
jb at FreeBSD.org
Mon Oct 8 16:02:27 PDT 2007
http://perforce.freebsd.org/chv.cgi?CH=127324
Change 127324 by jb at jb_freebsd1 on 2007/10/08 23:01:38
IF6
Affected files ...
.. //depot/projects/dtrace6/src/lib/libc/gen/Makefile.inc#2 integrate
.. //depot/projects/dtrace6/src/sys/amd64/acpica/madt.c#2 integrate
.. //depot/projects/dtrace6/src/sys/amd64/amd64/local_apic.c#2 integrate
.. //depot/projects/dtrace6/src/sys/amd64/amd64/mp_machdep.c#2 integrate
.. //depot/projects/dtrace6/src/sys/amd64/amd64/mptable.c#2 integrate
.. //depot/projects/dtrace6/src/sys/amd64/include/apicvar.h#2 integrate
.. //depot/projects/dtrace6/src/sys/conf/files#2 integrate
.. //depot/projects/dtrace6/src/sys/conf/kern.pre.mk#2 integrate
.. //depot/projects/dtrace6/src/sys/dev/em/LICENSE#2 integrate
.. //depot/projects/dtrace6/src/sys/dev/em/e1000_80003es2lan.c#1 branch
.. //depot/projects/dtrace6/src/sys/dev/em/e1000_80003es2lan.h#1 branch
.. //depot/projects/dtrace6/src/sys/dev/em/e1000_82540.c#1 branch
.. //depot/projects/dtrace6/src/sys/dev/em/e1000_82541.c#1 branch
.. //depot/projects/dtrace6/src/sys/dev/em/e1000_82541.h#1 branch
.. //depot/projects/dtrace6/src/sys/dev/em/e1000_82542.c#1 branch
.. //depot/projects/dtrace6/src/sys/dev/em/e1000_82543.c#1 branch
.. //depot/projects/dtrace6/src/sys/dev/em/e1000_82543.h#1 branch
.. //depot/projects/dtrace6/src/sys/dev/em/e1000_82571.c#1 branch
.. //depot/projects/dtrace6/src/sys/dev/em/e1000_82571.h#1 branch
.. //depot/projects/dtrace6/src/sys/dev/em/e1000_82575.c#1 branch
.. //depot/projects/dtrace6/src/sys/dev/em/e1000_82575.h#1 branch
.. //depot/projects/dtrace6/src/sys/dev/em/e1000_api.c#1 branch
.. //depot/projects/dtrace6/src/sys/dev/em/e1000_api.h#1 branch
.. //depot/projects/dtrace6/src/sys/dev/em/e1000_defines.h#1 branch
.. //depot/projects/dtrace6/src/sys/dev/em/e1000_hw.h#1 branch
.. //depot/projects/dtrace6/src/sys/dev/em/e1000_ich8lan.c#1 branch
.. //depot/projects/dtrace6/src/sys/dev/em/e1000_ich8lan.h#1 branch
.. //depot/projects/dtrace6/src/sys/dev/em/e1000_mac.c#1 branch
.. //depot/projects/dtrace6/src/sys/dev/em/e1000_mac.h#1 branch
.. //depot/projects/dtrace6/src/sys/dev/em/e1000_manage.c#1 branch
.. //depot/projects/dtrace6/src/sys/dev/em/e1000_manage.h#1 branch
.. //depot/projects/dtrace6/src/sys/dev/em/e1000_nvm.c#1 branch
.. //depot/projects/dtrace6/src/sys/dev/em/e1000_nvm.h#1 branch
.. //depot/projects/dtrace6/src/sys/dev/em/e1000_osdep.h#1 branch
.. //depot/projects/dtrace6/src/sys/dev/em/e1000_phy.c#1 branch
.. //depot/projects/dtrace6/src/sys/dev/em/e1000_phy.h#1 branch
.. //depot/projects/dtrace6/src/sys/dev/em/e1000_regs.h#1 branch
.. //depot/projects/dtrace6/src/sys/dev/em/if_em.c#2 integrate
.. //depot/projects/dtrace6/src/sys/dev/em/if_em.h#2 integrate
.. //depot/projects/dtrace6/src/sys/dev/em/if_em_hw.c#2 delete
.. //depot/projects/dtrace6/src/sys/dev/em/if_em_hw.h#2 delete
.. //depot/projects/dtrace6/src/sys/dev/em/if_em_osdep.h#2 delete
.. //depot/projects/dtrace6/src/sys/i386/acpica/madt.c#2 integrate
.. //depot/projects/dtrace6/src/sys/i386/i386/local_apic.c#2 integrate
.. //depot/projects/dtrace6/src/sys/i386/i386/mp_machdep.c#2 integrate
.. //depot/projects/dtrace6/src/sys/i386/i386/mptable.c#2 integrate
.. //depot/projects/dtrace6/src/sys/i386/include/apicvar.h#2 integrate
.. //depot/projects/dtrace6/src/sys/modules/em/Makefile#2 integrate
.. //depot/projects/dtrace6/src/sys/sparc64/isa/ofw_isa.c#2 integrate
.. //depot/projects/dtrace6/src/sys/sparc64/pci/apb.c#2 integrate
.. //depot/projects/dtrace6/src/sys/sparc64/pci/ofw_pci.c#2 integrate
.. //depot/projects/dtrace6/src/sys/sparc64/pci/ofw_pcib_subr.c#2 integrate
.. //depot/projects/dtrace6/src/sys/sparc64/pci/ofw_pcibus.c#2 integrate
Differences ...
==== //depot/projects/dtrace6/src/lib/libc/gen/Makefile.inc#2 (text+ko) ====
@@ -1,5 +1,5 @@
# @(#)Makefile.inc 8.6 (Berkeley) 5/4/95
-# $FreeBSD: src/lib/libc/gen/Makefile.inc,v 1.121.2.1 2005/12/05 19:59:20 jhb Exp $
+# $FreeBSD: src/lib/libc/gen/Makefile.inc,v 1.121.2.2 2007/10/06 03:15:15 scf Exp $
# machine-independent gen sources
.PATH: ${.CURDIR}/${MACHINE_ARCH}/gen ${.CURDIR}/gen
@@ -81,7 +81,8 @@
fpclassify.3 isnormal.3
MLINKS+=frexp.3 frexpf.3 frexp.3 frexpl.3
MLINKS+=fts.3 fts_children.3 fts.3 fts_close.3 fts.3 fts_open.3 \
- fts.3 fts_read.3 fts.3 fts_set.3
+ fts.3 fts_read.3 fts.3 fts_set.3 fts.3 fts_set_clientptr.3 \
+ fts.3 fts_get_clientptr.3 fts.3 fts_get_stream.3
MLINKS+=ftw.3 nftw.3
MLINKS+=getcap.3 cgetcap.3 getcap.3 cgetclose.3 getcap.3 cgetent.3 \
getcap.3 cgetfirst.3 getcap.3 cgetmatch.3 getcap.3 cgetnext.3 \
==== //depot/projects/dtrace6/src/sys/amd64/acpica/madt.c#2 (text+ko) ====
@@ -28,7 +28,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/amd64/acpica/madt.c,v 1.16.2.3 2007/05/02 18:42:45 jhb Exp $");
+__FBSDID("$FreeBSD: src/sys/amd64/acpica/madt.c,v 1.16.2.4 2007/10/05 15:22:35 jhb Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -53,21 +53,18 @@
#include <dev/acpica/acpivar.h>
#include <dev/pci/pcivar.h>
-#define NIOAPICS 32 /* Max number of I/O APICs */
-#define NLAPICS 32 /* Max number of local APICs */
-
typedef void madt_entry_handler(APIC_HEADER *entry, void *arg);
/* These two arrays are indexed by APIC IDs. */
struct ioapic_info {
void *io_apic;
UINT32 io_vector;
-} ioapics[NIOAPICS];
+} ioapics[MAX_APIC_ID + 1];
struct lapic_info {
u_int la_enabled:1;
u_int la_acpi_id:8;
-} lapics[NLAPICS];
+} lapics[MAX_APIC_ID + 1];
static int madt_found_sci_override;
static MULTIPLE_APIC_TABLE *madt;
@@ -391,7 +388,7 @@
}
/* Third, we register all the I/O APIC's. */
- for (i = 0; i < NIOAPICS; i++)
+ for (i = 0; i <= MAX_APIC_ID; i++)
if (ioapics[i].io_apic != NULL)
ioapic_register(ioapics[i].io_apic);
@@ -447,7 +444,7 @@
proc->ProcessorEnabled ? "enabled" : "disabled");
if (!proc->ProcessorEnabled)
break;
- if (proc->LocalApicId >= NLAPICS)
+ if (proc->LocalApicId > MAX_APIC_ID)
panic("%s: CPU ID %d too high", __func__,
proc->LocalApicId);
la = &lapics[proc->LocalApicId];
@@ -476,7 +473,7 @@
printf("MADT: Found IO APIC ID %d, Interrupt %d at %p\n",
apic->IoApicId, apic->Interrupt,
(void *)(uintptr_t)apic->Address);
- if (apic->IoApicId >= NIOAPICS)
+ if (apic->IoApicId > MAX_APIC_ID)
panic("%s: I/O APIC ID %d too high", __func__,
apic->IoApicId);
if (ioapics[apic->IoApicId].io_apic != NULL)
@@ -544,7 +541,7 @@
{
int i;
- for (i = 0; i < NLAPICS; i++) {
+ for (i = 0; i <= MAX_APIC_ID; i++) {
if (!lapics[i].la_enabled)
continue;
if (lapics[i].la_acpi_id != acpi_id)
@@ -565,7 +562,7 @@
int i, best;
best = -1;
- for (i = 0; i < NIOAPICS; i++) {
+ for (i = 0; i <= MAX_APIC_ID; i++) {
if (ioapics[i].io_apic == NULL ||
ioapics[i].io_vector > intr)
continue;
==== //depot/projects/dtrace6/src/sys/amd64/amd64/local_apic.c#2 (text+ko) ====
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/amd64/amd64/local_apic.c,v 1.17.2.13 2007/04/28 09:04:09 ariff Exp $");
+__FBSDID("$FreeBSD: src/sys/amd64/amd64/local_apic.c,v 1.17.2.14 2007/10/05 15:22:35 jhb Exp $");
#include "opt_hwpmc_hooks.h"
@@ -65,13 +65,6 @@
#include <ddb/ddb.h>
#endif
-/*
- * We can handle up to 60 APICs via our logical cluster IDs, but currently
- * the physical IDs on Intel processors up to the Pentium 4 are limited to
- * 16.
- */
-#define MAX_APICID 16
-
/* Sanity checks on IDT vectors. */
CTASSERT(APIC_IO_INTS + APIC_NUM_IOINTS == APIC_TIMER_INT);
CTASSERT(APIC_TIMER_INT < APIC_LOCAL_INTS);
@@ -114,7 +107,7 @@
u_long la_hard_ticks;
u_long la_stat_ticks;
u_long la_prof_ticks;
-} static lapics[MAX_APICID];
+} static lapics[MAX_APIC_ID + 1];
/* XXX: should thermal be an NMI? */
@@ -237,7 +230,7 @@
{
int i;
- if (apic_id >= MAX_APICID) {
+ if (apic_id > MAX_APIC_ID) {
printf("APIC: Ignoring local APIC with ID %d\n", apic_id);
if (boot_cpu)
panic("Can't ignore BSP");
==== //depot/projects/dtrace6/src/sys/amd64/amd64/mp_machdep.c#2 (text+ko) ====
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/amd64/amd64/mp_machdep.c,v 1.260.2.12 2007/08/29 23:26:33 peter Exp $");
+__FBSDID("$FreeBSD: src/sys/amd64/amd64/mp_machdep.c,v 1.260.2.14 2007/10/08 21:51:01 jhb Exp $");
#include "opt_cpu.h"
#include "opt_kdb.h"
@@ -133,7 +133,7 @@
int cpu_present:1;
int cpu_bsp:1;
int cpu_disabled:1;
-} static cpu_info[MAXCPU];
+} static cpu_info[MAX_APIC_ID + 1];
static int cpu_apic_ids[MAXCPU];
/* Holds pending bitmap based IPIs per CPU */
@@ -141,6 +141,7 @@
static u_int boot_address;
+static void assign_cpu_ids(void);
static void set_interrupt_apic_ids(void);
static int start_all_aps(void);
static int start_ap(int apic_id);
@@ -178,7 +179,7 @@
return;
group = &mp_groups[0];
groups = 1;
- for (cpu = 0, apic_id = 0; apic_id < MAXCPU; apic_id++) {
+ for (cpu = 0, apic_id = 0; apic_id <= MAX_APIC_ID; apic_id++) {
if (!cpu_info[apic_id].cpu_present)
continue;
/*
@@ -225,9 +226,8 @@
cpu_add(u_int apic_id, char boot_cpu)
{
- if (apic_id >= MAXCPU) {
- printf("SMP: CPU %d exceeds maximum CPU %d, ignoring\n",
- apic_id, MAXCPU - 1);
+ if (apic_id > MAX_APIC_ID) {
+ panic("SMP: APIC ID %d too high", apic_id);
return;
}
KASSERT(cpu_info[apic_id].cpu_present == 0, ("CPU %d added twice",
@@ -240,13 +240,13 @@
boot_cpu_id = apic_id;
cpu_info[apic_id].cpu_bsp = 1;
}
- mp_ncpus++;
- if (apic_id > mp_maxid)
- mp_maxid = apic_id;
+ if (mp_ncpus < MAXCPU) {
+ mp_ncpus++;
+ mp_maxid = mp_ncpus -1;
+ }
if (bootverbose)
printf("SMP: Added CPU %d (%s)\n", apic_id, boot_cpu ? "BSP" :
"AP");
-
}
void
@@ -265,8 +265,7 @@
else
KASSERT(mp_maxid >= mp_ncpus - 1,
("%s: counters out of sync: max %d, count %d", __func__,
- mp_maxid, mp_ncpus));
-
+ mp_maxid, mp_ncpus));
}
int
@@ -344,6 +343,8 @@
("BSP's APIC ID doesn't match boot_cpu_id"));
cpu_apic_ids[0] = boot_cpu_id;
+ assign_cpu_ids();
+
/* Start each Application Processor */
start_all_aps();
@@ -408,7 +409,7 @@
/* List CPUs */
printf(" cpu0 (BSP): APIC ID: %2d\n", boot_cpu_id);
- for (i = 1, x = 0; x < MAXCPU; x++) {
+ for (i = 1, x = 0; x <= MAX_APIC_ID; x++) {
if (!cpu_info[x].cpu_present || cpu_info[x].cpu_bsp)
continue;
if (cpu_info[x].cpu_disabled)
@@ -624,6 +625,48 @@
}
/*
+ * Assign logical CPU IDs to local APICs.
+ */
+static void
+assign_cpu_ids(void)
+{
+ u_int i;
+
+ /* Check for explicitly disabled CPUs. */
+ for (i = 0; i <= MAX_APIC_ID; i++) {
+ if (!cpu_info[i].cpu_present || cpu_info[i].cpu_bsp)
+ continue;
+
+ /* Don't use this CPU if it has been disabled by a tunable. */
+ if (resource_disabled("lapic", i)) {
+ cpu_info[i].cpu_disabled = 1;
+ continue;
+ }
+ }
+
+ /*
+ * Assign CPU IDs to local APIC IDs and disable any CPUs
+ * beyond MAXCPU. CPU 0 has already been assigned to the BSP,
+ * so we only have to assign IDs for APs.
+ */
+ mp_ncpus = 1;
+ for (i = 0; i <= MAX_APIC_ID; i++) {
+ if (!cpu_info[i].cpu_present || cpu_info[i].cpu_bsp ||
+ cpu_info[i].cpu_disabled)
+ continue;
+
+ if (mp_ncpus < MAXCPU) {
+ cpu_apic_ids[mp_ncpus] = i;
+ mp_ncpus++;
+ } else
+ cpu_info[i].cpu_disabled = 1;
+ }
+ KASSERT(mp_maxid >= mp_ncpus - 1,
+ ("%s: counters out of sync: max %d, count %d", __func__, mp_maxid,
+ mp_ncpus));
+}
+
+/*
* start each AP in our list
*/
static int
@@ -674,25 +717,9 @@
outb(CMOS_DATA, BIOS_WARM); /* 'warm-start' */
/* start each AP */
- for (cpu = 0, apic_id = 0; apic_id < MAXCPU; apic_id++) {
-
- /* Ignore non-existent CPUs and the BSP. */
- if (!cpu_info[apic_id].cpu_present ||
- cpu_info[apic_id].cpu_bsp)
- continue;
+ for (cpu = 1; cpu < mp_ncpus; cpu++) {
+ apic_id = cpu_apic_ids[cpu];
- /* Don't use this CPU if it has been disabled by a tunable. */
- if (resource_disabled("lapic", apic_id)) {
- cpu_info[apic_id].cpu_disabled = 1;
- mp_ncpus--;
- continue;
- }
-
- cpu++;
-
- /* save APIC ID for this logical ID */
- cpu_apic_ids[cpu] = apic_id;
-
/* allocate and set up an idle stack data page */
bootstacks[cpu] = (void *)kmem_alloc(kernel_map, KSTACK_PAGES * PAGE_SIZE);
doublefault_stack = (char *)kmem_alloc(kernel_map, PAGE_SIZE);
@@ -937,10 +964,10 @@
ipi_bitmap = atomic_readandclear_int(&cpu_ipi_pending[cpu]);
#ifdef IPI_PREEMPTION
- if (ipi_bitmap & IPI_PREEMPT) {
+ if (ipi_bitmap & (1 << IPI_PREEMPT)) {
mtx_lock_spin(&sched_lock);
/* Don't preempt the idle thread */
- if (curthread->td_priority < PRI_MIN_IDLE) {
+ if (curthread != PCPU_GET(idlethread)) {
struct thread *running_thread = curthread;
if (running_thread->td_critnest > 1)
running_thread->td_owepreempt = 1;
==== //depot/projects/dtrace6/src/sys/amd64/amd64/mptable.c#2 (text+ko) ====
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/amd64/amd64/mptable.c,v 1.236 2005/04/15 18:44:53 peter Exp $");
+__FBSDID("$FreeBSD: src/sys/amd64/amd64/mptable.c,v 1.236.2.1 2007/10/05 15:22:35 jhb Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -50,7 +50,7 @@
/* string defined by the Intel MP Spec as identifying the MP table */
#define MP_SIG 0x5f504d5f /* _MP_ */
-#define NAPICID 32 /* Max number of APIC's */
+#define MAX_LAPIC_ID 63 /* Max local APIC ID for HTT fixup */
#define BIOS_BASE (0xf0000)
#define BIOS_SIZE (0x10000)
@@ -136,7 +136,7 @@
static mpfps_t mpfps;
static mpcth_t mpct;
-static void *ioapics[NAPICID];
+static void *ioapics[MAX_APIC_ID + 1];
static bus_datum *busses;
static int mptable_nioapics, mptable_nbusses, mptable_maxbusid;
static int pci0 = -1;
@@ -152,7 +152,7 @@
static void mptable_count_items(void);
static void mptable_count_items_handler(u_char *entry, void *arg);
#ifdef MPTABLE_FORCE_HTT
-static void mptable_hyperthread_fixup(u_int id_mask);
+static void mptable_hyperthread_fixup(u_long id_mask);
#endif
static void mptable_parse_apics_and_busses(void);
static void mptable_parse_apics_and_busses_handler(u_char *entry,
@@ -294,7 +294,7 @@
static int
mptable_probe_cpus(void)
{
- u_int cpu_mask;
+ u_long cpu_mask;
/* Is this a pre-defined config? */
if (mpfps->config_type != 0) {
@@ -354,7 +354,7 @@
mptable_parse_ints();
/* Fourth, we register all the I/O APIC's. */
- for (i = 0; i < NAPICID; i++)
+ for (i = 0; i <= MAX_APIC_ID; i++)
if (ioapics[i] != NULL)
ioapic_register(ioapics[i]);
@@ -412,7 +412,7 @@
mptable_probe_cpus_handler(u_char *entry, void *arg)
{
proc_entry_ptr proc;
- u_int *cpu_mask;
+ u_long *cpu_mask;
switch (*entry) {
case MPCT_ENTRY_PROCESSOR:
@@ -420,8 +420,10 @@
if (proc->cpu_flags & PROCENTRY_FLAG_EN) {
lapic_create(proc->apic_id, proc->cpu_flags &
PROCENTRY_FLAG_BP);
- cpu_mask = (u_int *)arg;
- *cpu_mask |= (1 << proc->apic_id);
+ if (proc->apic_id < MAX_LAPIC_ID) {
+ cpu_mask = (u_long *)arg;
+ *cpu_mask |= (1ul << proc->apic_id);
+ }
}
break;
}
@@ -508,7 +510,7 @@
apic = (io_apic_entry_ptr)entry;
if (!(apic->apic_flags & IOAPICENTRY_FLAG_EN))
break;
- if (apic->apic_id >= NAPICID)
+ if (apic->apic_id > MAX_APIC_ID)
panic("%s: I/O APIC ID %d too high", __func__,
apic->apic_id);
if (ioapics[apic->apic_id] != NULL)
@@ -653,7 +655,7 @@
return;
}
}
- if (apic_id >= NAPICID) {
+ if (apic_id > MAX_APIC_ID) {
printf("MPTable: Ignoring interrupt entry for ioapic%d\n",
intr->dst_apic_id);
return;
@@ -866,7 +868,7 @@
* with the number of logical CPU's in the processor.
*/
static void
-mptable_hyperthread_fixup(u_int id_mask)
+mptable_hyperthread_fixup(u_long id_mask)
{
u_int i, id, logical_cpus;
@@ -883,7 +885,7 @@
* physical processor. If any of those ID's are
* already in the table, then kill the fixup.
*/
- for (id = 0; id < NAPICID; id++) {
+ for (id = 0; id <= MAX_LAPIC_ID; id++) {
if ((id_mask & 1 << id) == 0)
continue;
/* First, make sure we are on a logical_cpus boundary. */
@@ -898,7 +900,7 @@
* Ok, the ID's checked out, so perform the fixup by
* adding the logical CPUs.
*/
- while ((id = ffs(id_mask)) != 0) {
+ while ((id = ffsl(id_mask)) != 0) {
id--;
for (i = id + 1; i < id + logical_cpus; i++) {
if (bootverbose)
==== //depot/projects/dtrace6/src/sys/amd64/include/apicvar.h#2 (text+ko) ====
@@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD: src/sys/amd64/include/apicvar.h,v 1.13.2.5 2007/05/02 15:40:14 jhb Exp $
+ * $FreeBSD: src/sys/amd64/include/apicvar.h,v 1.13.2.6 2007/10/05 15:22:36 jhb Exp $
*/
#ifndef _MACHINE_APICVAR_H_
@@ -79,6 +79,7 @@
* I/O device!
*/
+#define MAX_APIC_ID 0xfe
#define APIC_ID_ALL 0xff
/* I/O Interrupts are used for external devices such as ISA, PCI, etc. */
==== //depot/projects/dtrace6/src/sys/conf/files#2 (text+ko) ====
@@ -1,4 +1,4 @@
-# $FreeBSD: src/sys/conf/files,v 1.1031.2.68 2007/09/04 22:40:38 alfred Exp $
+# $FreeBSD: src/sys/conf/files,v 1.1031.2.69 2007/10/05 22:49:06 jfv Exp $
#
# The long compile-with and dependency lines are required because of
# limitations in config: backslash-newline doesn't work in strings, and
@@ -568,8 +568,34 @@
dev/ed/if_ed_rtl80x9.c optional ed
dev/eisa/eisa_if.m standard
dev/eisa/eisaconf.c optional eisa
-dev/em/if_em.c optional em
-dev/em/if_em_hw.c optional em
+dev/em/if_em.c optional em \
+ compile-with "${NORMAL_C} -I$S/dev/em"
+dev/em/e1000_80003es2lan.c optional em \
+ compile-with "${NORMAL_C} -I$S/dev/em"
+dev/em/e1000_82540.c optional em \
+ compile-with "${NORMAL_C} -I$S/dev/em"
+dev/em/e1000_82541.c optional em \
+ compile-with "${NORMAL_C} -I$S/dev/em"
+dev/em/e1000_82542.c optional em \
+ compile-with "${NORMAL_C} -I$S/dev/em"
+dev/em/e1000_82543.c optional em \
+ compile-with "${NORMAL_C} -I$S/dev/em"
+dev/em/e1000_82571.c optional em \
+ compile-with "${NORMAL_C} -I$S/dev/em"
+dev/em/e1000_82575.c optional em \
+ compile-with "${NORMAL_C} -I$S/dev/em"
+dev/em/e1000_api.c optional em \
+ compile-with "${NORMAL_C} -I$S/dev/em"
+dev/em/e1000_ich8lan.c optional em \
+ compile-with "${NORMAL_C} -I$S/dev/em"
+dev/em/e1000_mac.c optional em \
+ compile-with "${NORMAL_C} -I$S/dev/em"
+dev/em/e1000_manage.c optional em \
+ compile-with "${NORMAL_C} -I$S/dev/em"
+dev/em/e1000_nvm.c optional em \
+ compile-with "${NORMAL_C} -I$S/dev/em"
+dev/em/e1000_phy.c optional em \
+ compile-with "${NORMAL_C} -I$S/dev/em"
dev/en/if_en_pci.c optional en pci
dev/en/midway.c optional en
dev/ep/if_ep.c optional ep
==== //depot/projects/dtrace6/src/sys/conf/kern.pre.mk#2 (text+ko) ====
@@ -1,4 +1,4 @@
-# $FreeBSD: src/sys/conf/kern.pre.mk,v 1.65.2.4 2007/02/25 05:01:05 bde Exp $
+# $FreeBSD: src/sys/conf/kern.pre.mk,v 1.65.2.5 2007/10/05 22:49:06 jfv Exp $
# Part of a unified Makefile for building kernels. This part contains all
# of the definitions that need to be before %BEFORE_DEPEND.
@@ -67,6 +67,12 @@
# .. and the same for twa
INCLUDES+= -I$S/dev/twa
+# .. and the same for em
+INCLUDES+= -I$S/dev/em
+
+# .. and the same for em
+INCLUDES+= -I$S/dev/em
+
CFLAGS= ${COPTFLAGS} ${CWARNFLAGS} ${DEBUG}
CFLAGS+= ${INCLUDES} -D_KERNEL -DHAVE_KERNEL_OPTION_HEADERS -include opt_global.h
.if ${CC} != "icc"
==== //depot/projects/dtrace6/src/sys/dev/em/LICENSE#2 (text+ko) ====
@@ -1,6 +1,6 @@
-$FreeBSD: src/sys/dev/em/LICENSE,v 1.3.2.1 2006/08/08 09:20:26 glebius Exp $
+$FreeBSD: src/sys/dev/em/LICENSE,v 1.3.2.2 2007/10/05 22:49:06 jfv Exp $
/*-
-Copyright (c) 2001-2005, Intel Corporation
+Copyright (c) 2001-2007, Intel Corporation
All rights reserved.
Redistribution and use in source and binary forms, with or without
==== //depot/projects/dtrace6/src/sys/dev/em/if_em.c#2 (text+ko) ====
@@ -1,6 +1,6 @@
/**************************************************************************
-Copyright (c) 2001-2006, Intel Corporation
+Copyright (c) 2001-2007, Intel Corporation
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -31,7 +31,7 @@
***************************************************************************/
-/*$FreeBSD: src/sys/dev/em/if_em.c,v 1.65.2.23 2007/06/05 17:44:01 jfv Exp $*/
+/* $FreeBSD: src/sys/dev/em/if_em.c,v 1.65.2.26 2007/10/07 03:11:31 jfv Exp $*/
#ifdef HAVE_KERNEL_OPTION_HEADERS
#include "opt_device_polling.h"
@@ -69,15 +69,17 @@
#include <netinet/in.h>
#include <netinet/if_ether.h>
#include <netinet/ip.h>
+#include <netinet/ip6.h>
#include <netinet/tcp.h>
#include <netinet/udp.h>
#include <machine/in_cksum.h>
-
#include <dev/pci/pcivar.h>
#include <dev/pci/pcireg.h>
-#include <dev/em/if_em_hw.h>
-#include <dev/em/if_em.h>
+
+#include "e1000_api.h"
+#include "e1000_82575.h"
+#include "if_em.h"
/*********************************************************************
* Set this to one to display debug statistics
@@ -85,16 +87,16 @@
int em_display_debug_stats = 0;
/*********************************************************************
- * Driver version
+ * Base Driver version:
*********************************************************************/
-char em_driver_version[] = "Version - 6.2.9";
+char em_driver_version[] = "Version - 6.6.6";
/*********************************************************************
* PCI Device ID Table
*
* Used by probe to select devices to load on
- * Last field stores an index into em_strings
+ * Last field stores an index into e1000_strings
* Last entry must be all 0s
*
* { Vendor ID, Device ID, SubVendor ID, SubDevice ID, String Index }
@@ -153,9 +155,12 @@
{ 0x8086, E1000_DEV_ID_82571EB_SERDES, PCI_ANY_ID, PCI_ANY_ID, 0},
{ 0x8086, E1000_DEV_ID_82571EB_QUAD_COPPER,
PCI_ANY_ID, PCI_ANY_ID, 0},
- { 0x8086, E1000_DEV_ID_82571EB_QUAD_COPPER_LOWPROFILE,
+ { 0x8086, E1000_DEV_ID_82571EB_QUAD_COPPER_LP,
+ PCI_ANY_ID, PCI_ANY_ID, 0},
+ { 0x8086, E1000_DEV_ID_82571EB_QUAD_FIBER,
+ PCI_ANY_ID, PCI_ANY_ID, 0},
+ { 0x8086, E1000_DEV_ID_82571PT_QUAD_COPPER,
PCI_ANY_ID, PCI_ANY_ID, 0},
-
{ 0x8086, E1000_DEV_ID_82572EI_COPPER, PCI_ANY_ID, PCI_ANY_ID, 0},
{ 0x8086, E1000_DEV_ID_82572EI_FIBER, PCI_ANY_ID, PCI_ANY_ID, 0},
{ 0x8086, E1000_DEV_ID_82572EI_SERDES, PCI_ANY_ID, PCI_ANY_ID, 0},
@@ -180,6 +185,17 @@
{ 0x8086, E1000_DEV_ID_ICH8_IFE_G, PCI_ANY_ID, PCI_ANY_ID, 0},
{ 0x8086, E1000_DEV_ID_ICH8_IGP_M, PCI_ANY_ID, PCI_ANY_ID, 0},
+ { 0x8086, E1000_DEV_ID_ICH9_IGP_AMT, PCI_ANY_ID, PCI_ANY_ID, 0},
+ { 0x8086, E1000_DEV_ID_ICH9_IGP_C, PCI_ANY_ID, PCI_ANY_ID, 0},
+ { 0x8086, E1000_DEV_ID_ICH9_IFE, PCI_ANY_ID, PCI_ANY_ID, 0},
+ { 0x8086, E1000_DEV_ID_ICH9_IFE_GT, PCI_ANY_ID, PCI_ANY_ID, 0},
+ { 0x8086, E1000_DEV_ID_ICH9_IFE_G, PCI_ANY_ID, PCI_ANY_ID, 0},
+
+ { 0x8086, E1000_DEV_ID_82575EB_COPPER, PCI_ANY_ID, PCI_ANY_ID, 0},
+ { 0x8086, E1000_DEV_ID_82575EB_FIBER_SERDES,
+ PCI_ANY_ID, PCI_ANY_ID, 0},
+ { 0x8086, E1000_DEV_ID_82575GB_QUAD_COPPER,
+ PCI_ANY_ID, PCI_ANY_ID, 0},
/* required last entry */
{ 0, 0, 0, 0, 0}
};
@@ -228,35 +244,39 @@
static void em_free_receive_structures(struct adapter *);
static void em_update_stats_counters(struct adapter *);
static void em_txeof(struct adapter *);
+static void em_tx_purge(struct adapter *);
static int em_allocate_receive_structures(struct adapter *);
static int em_allocate_transmit_structures(struct adapter *);
static int em_rxeof(struct adapter *, int);
#ifndef __NO_STRICT_ALIGNMENT
static int em_fixup_rx(struct adapter *);
#endif
-static void em_receive_checksum(struct adapter *, struct em_rx_desc *,
+static void em_receive_checksum(struct adapter *, struct e1000_rx_desc *,
struct mbuf *);
static void em_transmit_checksum_setup(struct adapter *, struct mbuf *,
uint32_t *, uint32_t *);
+static boolean_t em_tx_adv_ctx_setup(struct adapter *, struct mbuf *);
#ifdef EM_TSO
-static boolean_t em_tso_setup(struct adapter *, struct mbuf *, u_int32_t *,
+static boolean_t em_tso_setup(struct adapter *, struct mbuf *, uint32_t *,
uint32_t *);
-#endif
+static boolean_t em_tso_adv_setup(struct adapter *, struct mbuf *, uint32_t *);
+#endif /* EM_TSO */
static void em_set_promisc(struct adapter *);
static void em_disable_promisc(struct adapter *);
static void em_set_multi(struct adapter *);
static void em_print_hw_stats(struct adapter *);
static void em_update_link_status(struct adapter *);
-static int em_get_buf(int i, struct adapter *, struct mbuf *);
+static int em_get_buf(struct adapter *, int);
static void em_enable_vlans(struct adapter *);
static int em_encap(struct adapter *, struct mbuf **);
+static int em_adv_encap(struct adapter *, struct mbuf **);
static void em_smartspeed(struct adapter *);
static int em_82547_fifo_workaround(struct adapter *, int);
static void em_82547_update_fifo_head(struct adapter *, int);
static int em_82547_tx_fifo_reset(struct adapter *);
static void em_82547_move_tail(void *);
static int em_dma_malloc(struct adapter *, bus_size_t,
- struct em_dma_alloc *, int);
+ struct em_dma_alloc *, int);
static void em_dma_free(struct adapter *, struct em_dma_alloc *);
static void em_print_debug_info(struct adapter *);
static int em_is_valid_ether_addr(uint8_t *);
@@ -266,19 +286,24 @@
PDESC_ARRAY desc_array);
static int em_sysctl_int_delay(SYSCTL_HANDLER_ARGS);
static void em_add_int_delay_sysctl(struct adapter *, const char *,
- const char *, struct em_int_delay_info *, int, int);
+ const char *, struct em_int_delay_info *, int, int);
+/* Management and WOL Support */
+static void em_init_manageability(struct adapter *);
+static void em_release_manageability(struct adapter *);
+static void em_get_hw_control(struct adapter *);
+static void em_release_hw_control(struct adapter *);
+static void em_enable_wakeup(device_t);
+
+#ifdef DEVICE_POLLING
+static poll_handler_t em_poll;
+static void em_intr(void *);
+#else
+static void em_intr_fast(void *);
static void em_add_rx_process_limit(struct adapter *, const char *,
- const char *, int *, int);
-#ifdef EM_FAST_INTR
-static void em_intr_fast(void *);
+ const char *, int *, int);
static void em_handle_rxtx(void *context, int pending);
static void em_handle_link(void *context, int pending);
-#else /* Legacy Interrupt Handling */
-static void em_intr(void *);
-#ifdef DEVICE_POLLING
-static poll_handler_t em_poll;
-#endif /* DEVICE_POLLING */
-#endif /* EM_FAST_INTR */
+#endif
/*********************************************************************
* FreeBSD Device Interface Entry Points
@@ -308,14 +333,19 @@
* Tunable default values.
*********************************************************************/
-#define E1000_TICKS_TO_USECS(ticks) ((1024 * (ticks) + 500) / 1000)
-#define E1000_USECS_TO_TICKS(usecs) ((1000 * (usecs) + 512) / 1024)
-#define M_TSO_LEN 66 /* mbuf with just hdr and TSO pkthdr */
+#define EM_TICKS_TO_USECS(ticks) ((1024 * (ticks) + 500) / 1000)
+#define EM_USECS_TO_TICKS(usecs) ((1000 * (usecs) + 512) / 1024)
+#define M_TSO_LEN 66
+
+/* Allow common code without TSO */
+#ifndef CSUM_TSO
+#define CSUM_TSO 0
+#endif
-static int em_tx_int_delay_dflt = E1000_TICKS_TO_USECS(EM_TIDV);
-static int em_rx_int_delay_dflt = E1000_TICKS_TO_USECS(EM_RDTR);
-static int em_tx_abs_int_delay_dflt = E1000_TICKS_TO_USECS(EM_TADV);
-static int em_rx_abs_int_delay_dflt = E1000_TICKS_TO_USECS(EM_RADV);
+static int em_tx_int_delay_dflt = EM_TICKS_TO_USECS(EM_TIDV);
+static int em_rx_int_delay_dflt = EM_TICKS_TO_USECS(EM_RDTR);
+static int em_tx_abs_int_delay_dflt = EM_TICKS_TO_USECS(EM_TADV);
+static int em_rx_abs_int_delay_dflt = EM_TICKS_TO_USECS(EM_RADV);
static int em_rxd = EM_DEFAULT_RXD;
static int em_txd = EM_DEFAULT_TXD;
static int em_smart_pwr_down = FALSE;
@@ -327,10 +357,13 @@
TUNABLE_INT("hw.em.rxd", &em_rxd);
TUNABLE_INT("hw.em.txd", &em_txd);
TUNABLE_INT("hw.em.smart_pwr_down", &em_smart_pwr_down);
-
+#ifndef DEVICE_POLLING
/* How many packets rxeof tries to clean at a time */
static int em_rx_process_limit = 100;
TUNABLE_INT("hw.em.rx_process_limit", &em_rx_process_limit);
+#endif
+/* Global used in WOL setup with multiport cards */
+static int global_quad_port_a = 0;
/*********************************************************************
* Device identification routine
@@ -399,6 +432,7 @@
struct adapter *adapter;
int tsize, rsize;
int error = 0;
+ u16 eeprom_data, device_id;
INIT_DEBUGOUT("em_attach: begin");
@@ -420,51 +454,88 @@
callout_init_mtx(&adapter->timer, &adapter->mtx, 0);
callout_init_mtx(&adapter->tx_fifo_timer, &adapter->mtx, 0);
- /* Determine hardware revision */
+ /* Determine hardware and mac info */
em_identify_hardware(adapter);
+ /* Setup PCI resources */
+ if (em_allocate_pci_resources(adapter)) {
+ device_printf(dev, "Allocation of PCI resources failed\n");
+ error = ENXIO;
+ goto err_pci;
+ }
+
+ /*
+ ** For ICH8 and family we need to
+ ** map the flash memory, and this
+ ** must happen after the MAC is
+ ** identified
+ */
+ if ((adapter->hw.mac.type == e1000_ich8lan) ||
+ (adapter->hw.mac.type == e1000_ich9lan)) {
+ int rid = EM_BAR_TYPE_FLASH;
+ adapter->flash_mem = bus_alloc_resource_any(dev,
+ SYS_RES_MEMORY, &rid, RF_ACTIVE);
+ /* This is used in the shared code */
+ adapter->hw.flash_address = (u8 *)adapter->flash_mem;
+ adapter->osdep.flash_bus_space_tag =
+ rman_get_bustag(adapter->flash_mem);
+ adapter->osdep.flash_bus_space_handle =
+ rman_get_bushandle(adapter->flash_mem);
+ }
+
+ /* Do Shared Code initialization */
+ if (e1000_setup_init_funcs(&adapter->hw, TRUE)) {
+ device_printf(dev, "Setup of Shared code failed\n");
+ error = ENXIO;
+ goto err_pci;
+ }
+
+ e1000_get_bus_info(&adapter->hw);
+
/* Set up some sysctls for the tunable interrupt delays */
em_add_int_delay_sysctl(adapter, "rx_int_delay",
"receive interrupt delay in usecs", &adapter->rx_int_delay,
- E1000_REG_OFFSET(&adapter->hw, RDTR), em_rx_int_delay_dflt);
+ E1000_REGISTER(&adapter->hw, E1000_RDTR), em_rx_int_delay_dflt);
em_add_int_delay_sysctl(adapter, "tx_int_delay",
"transmit interrupt delay in usecs", &adapter->tx_int_delay,
- E1000_REG_OFFSET(&adapter->hw, TIDV), em_tx_int_delay_dflt);
- if (adapter->hw.mac_type >= em_82540) {
+ E1000_REGISTER(&adapter->hw, E1000_TIDV), em_tx_int_delay_dflt);
+ if (adapter->hw.mac.type >= e1000_82540) {
em_add_int_delay_sysctl(adapter, "rx_abs_int_delay",
"receive interrupt delay limit in usecs",
&adapter->rx_abs_int_delay,
- E1000_REG_OFFSET(&adapter->hw, RADV),
+ E1000_REGISTER(&adapter->hw, E1000_RADV),
em_rx_abs_int_delay_dflt);
em_add_int_delay_sysctl(adapter, "tx_abs_int_delay",
"transmit interrupt delay limit in usecs",
&adapter->tx_abs_int_delay,
- E1000_REG_OFFSET(&adapter->hw, TADV),
+ E1000_REGISTER(&adapter->hw, E1000_TADV),
em_tx_abs_int_delay_dflt);
}
+#ifndef DEVICE_POLLING
/* Sysctls for limiting the amount of work done in the taskqueue */
em_add_rx_process_limit(adapter, "rx_processing_limit",
"max number of rx packets to process", &adapter->rx_process_limit,
em_rx_process_limit);
+#endif
/*
* Validate number of transmit and receive descriptors. It
* must not exceed hardware maximum, and must be multiple
- * of EM_DBA_ALIGN.
+ * of E1000_DBA_ALIGN.
*/
- if (((em_txd * sizeof(struct em_tx_desc)) % EM_DBA_ALIGN) != 0 ||
- (adapter->hw.mac_type >= em_82544 && em_txd > EM_MAX_TXD) ||
- (adapter->hw.mac_type < em_82544 && em_txd > EM_MAX_TXD_82543) ||
+ if (((em_txd * sizeof(struct e1000_tx_desc)) % EM_DBA_ALIGN) != 0 ||
+ (adapter->hw.mac.type >= e1000_82544 && em_txd > EM_MAX_TXD) ||
+ (adapter->hw.mac.type < e1000_82544 && em_txd > EM_MAX_TXD_82543) ||
(em_txd < EM_MIN_TXD)) {
device_printf(dev, "Using %d TX descriptors instead of %d!\n",
EM_DEFAULT_TXD, em_txd);
adapter->num_tx_desc = EM_DEFAULT_TXD;
} else
adapter->num_tx_desc = em_txd;
- if (((em_rxd * sizeof(struct em_rx_desc)) % EM_DBA_ALIGN) != 0 ||
- (adapter->hw.mac_type >= em_82544 && em_rxd > EM_MAX_RXD) ||
- (adapter->hw.mac_type < em_82544 && em_rxd > EM_MAX_RXD_82543) ||
+ if (((em_rxd * sizeof(struct e1000_rx_desc)) % EM_DBA_ALIGN) != 0 ||
+ (adapter->hw.mac.type >= e1000_82544 && em_rxd > EM_MAX_RXD) ||
+ (adapter->hw.mac.type < e1000_82544 && em_rxd > EM_MAX_RXD_82543) ||
(em_rxd < EM_MIN_RXD)) {
device_printf(dev, "Using %d RX descriptors instead of %d!\n",
EM_DEFAULT_RXD, em_rxd);
@@ -472,45 +543,35 @@
} else
adapter->num_rx_desc = em_rxd;
- adapter->hw.autoneg = DO_AUTO_NEG;
- adapter->hw.wait_autoneg_complete = WAIT_FOR_AUTO_NEG_DEFAULT;
- adapter->hw.autoneg_advertised = AUTONEG_ADV_DEFAULT;
- adapter->hw.tbi_compatibility_en = TRUE;
- adapter->rx_buffer_len = EM_RXBUFFER_2048;
+ adapter->hw.mac.autoneg = DO_AUTO_NEG;
+ adapter->hw.phy.autoneg_wait_to_complete = FALSE;
+ adapter->hw.phy.autoneg_advertised = AUTONEG_ADV_DEFAULT;
+ adapter->rx_buffer_len = 2048;
+
+ e1000_init_script_state_82541(&adapter->hw, TRUE);
+ e1000_set_tbi_compatibility_82543(&adapter->hw, TRUE);
- adapter->hw.phy_init_script = 1;
- adapter->hw.phy_reset_disable = FALSE;
+ /* Copper options */
+ if (adapter->hw.phy.media_type == e1000_media_type_copper) {
+ adapter->hw.phy.mdix = AUTO_ALL_MODES;
+ adapter->hw.phy.disable_polarity_correction = FALSE;
+ adapter->hw.phy.ms_type = EM_MASTER_SLAVE;
+ }
-#ifndef EM_MASTER_SLAVE
- adapter->hw.master_slave = em_ms_hw_default;
-#else
- adapter->hw.master_slave = EM_MASTER_SLAVE;
-#endif
/*
- * Set the max frame size assuming standard ethernet
- * sized frames.
+ * Set the frame limits assuming
+ * standard ethernet sized frames.
*/
- adapter->hw.max_frame_size =
- ETHERMTU + ETHER_HDR_LEN + ETHER_CRC_LEN;
+ adapter->max_frame_size = ETHERMTU + ETHER_HDR_LEN + ETHERNET_FCS_SIZE;
+ adapter->min_frame_size = ETH_ZLEN + ETHERNET_FCS_SIZE;
- adapter->hw.min_frame_size =
- MINIMUM_ETHERNET_PACKET_SIZE + ETHER_CRC_LEN;
-
/*
* This controls when hardware reports transmit completion
* status.
*/
- adapter->hw.report_tx_early = 1;
- if (em_allocate_pci_resources(adapter)) {
- device_printf(dev, "Allocation of PCI resources failed\n");
- error = ENXIO;
- goto err_pci;
- }
-
- /* Initialize eeprom parameters */
- em_init_eeprom_params(&adapter->hw);
>>> TRUNCATED FOR MAIL (1000 lines) <<<
More information about the p4-projects
mailing list