Index: head/share/man/man4/Makefile =================================================================== --- head/share/man/man4/Makefile (revision 159966) +++ head/share/man/man4/Makefile (revision 159967) @@ -1,525 +1,529 @@ # @(#)Makefile 8.1 (Berkeley) 6/18/93 # $FreeBSD$ MAN= aac.4 \ acpi.4 \ ${_acpi_dock.4} \ acpi_thermal.4 \ acpi_video.4 \ adv.4 \ adw.4 \ agp.4 \ aha.4 \ ahb.4 \ ahc.4 \ ahd.4 \ aio.4 \ altq.4 \ amd.4 \ ${_amdsmb.4} \ amr.4 \ an.4 \ arcmsr.4 \ asr.4 \ ata.4 \ atapicam.4 \ ataraid.4 \ ath.4 \ ath_hal.4 \ atkbd.4 \ atkbdc.4 \ audit.4 \ auditpipe.4 \ aue.4 \ awi.4 \ axe.4 \ bce.4 \ bfe.4 \ bge.4 \ bktr.4 \ blackhole.4 \ bpf.4 \ bt.4 \ cardbus.4 \ carp.4 \ ccd.4 \ cd.4 \ cdce.4 \ ch.4 \ ciss.4 \ cm.4 \ cnw.4 \ cpufreq.4 \ crypto.4 \ cue.4 \ cy.4 \ da.4 \ dc.4 \ dcons.4 \ dcons_crom.4 \ ddb.4 \ de.4 \ devctl.4 \ digi.4 \ disc.4 \ divert.4 \ dpt.4 \ dummynet.4 \ ed.4 \ ef.4 \ ehci.4 \ em.4 \ en.4 \ enc.4 \ esp.4 \ exca.4 \ faith.4 \ fast_ipsec.4 \ fatm.4 \ fd.4 \ fdc.4 \ firewire.4 \ fla.4 \ fpa.4 \ fwe.4 \ fwip.4 \ fwohci.4 \ fxp.4 \ gbde.4 \ gdb.4 \ gem.4 \ geom.4 \ geom_fox.4 \ gif.4 \ gre.4 \ harp.4 \ hatm.4 \ hfa.4 \ hifn.4 \ hme.4 \ hptmv.4 \ hwpmc.4 \ ichsmb.4 \ icmp.4 \ icmp6.4 \ ida.4 \ idt.4 \ ieee80211.4 \ if_bridge.4 \ ifmib.4 \ iic.4 \ iicbb.4 \ iicbus.4 \ iicsmb.4 \ iir.4 \ inet.4 \ inet6.4 \ intpm.4 \ intro.4 \ ip.4 \ ip6.4 \ ipfirewall.4 \ ${_ipmi.4} \ ips.4 \ ipsec.4 \ ipw.4 \ isp.4 \ ispfw.4 \ iwi.4 \ ixgb.4 \ joy.4 \ kame.4 \ kbdmux.4 \ keyboard.4 \ kld.4 \ ktr.4 \ kue.4 \ le.4 \ led.4 \ lge.4 \ lmc.4 \ lo.4 \ lp.4 \ lpbb.4 \ lpt.4 \ mac.4 \ mac_biba.4 \ mac_bsdextended.4 \ mac_ifoff.4 \ mac_lomac.4 \ mac_mls.4 \ mac_none.4 \ mac_partition.4 \ mac_portacl.4 \ mac_seeotheruids.4 \ mac_stub.4 \ mac_test.4 \ md.4 \ mem.4 \ meteor.4 \ mfi.4 \ miibus.4 \ mlx.4 \ mly.4 \ mn.4 \ mouse.4 \ mpt.4 \ mtio.4 \ multicast.4 \ mxge.4 \ my.4 \ natm.4 \ natmip.4 \ ncr.4 \ ncv.4 \ netgraph.4 \ netintro.4 \ + ${_nfe.4} \ ${_nfsmb.4} \ ng_async.4 \ ng_atm.4 \ ngatmbase.4 \ ng_atmllc.4 \ ng_atmpif.4 \ ng_bluetooth.4 \ ng_bpf.4 \ ng_bridge.4 \ ng_bt3c.4 \ ng_btsocket.4 \ ng_ccatm.4 \ ng_cisco.4 \ ng_device.4 \ nge.4 \ ng_echo.4 \ ng_eiface.4 \ ng_etf.4 \ ng_ether.4 \ ng_fec.4 \ ng_frame_relay.4 \ ng_gif.4 \ ng_gif_demux.4 \ ng_h4.4 \ ng_hci.4 \ ng_hole.4 \ ng_hub.4 \ ng_iface.4 \ ng_ipfw.4 \ ng_ip_input.4 \ ng_ksocket.4 \ ng_l2cap.4 \ ng_l2tp.4 \ ng_lmi.4 \ ng_mppc.4 \ ng_nat.4 \ ng_netflow.4 \ ng_one2many.4 \ ng_ppp.4 \ ng_pppoe.4 \ ng_pptpgre.4 \ ng_rfc1490.4 \ ng_socket.4 \ ng_source.4 \ ng_split.4 \ ng_sppp.4 \ ng_sscfu.4 \ ng_sscop.4 \ ng_tcpmss.4 \ ng_tee.4 \ ng_tty.4 \ ng_ubt.4 \ ng_UI.4 \ ng_uni.4 \ ng_vjc.4 \ ng_vlan.4 \ nmdm.4 \ nsp.4 \ null.4 \ ${_nve.4} \ ohci.4 \ oldcard.4 \ orm.4 \ pass.4 \ patm.4 \ pccard.4 \ pccbb.4 \ pci.4 \ pcic.4 \ pcm.4 \ pcn.4 \ pim.4 \ polling.4 \ ppbus.4 \ ppc.4 \ ppi.4 \ ppp.4 \ psm.4 \ pst.4 \ pt.4 \ pty.4 \ puc.4 \ ral.4 \ random.4 \ rc.4 \ re.4 \ rl.4 \ rndtest.4 \ route.4 \ rp.4 \ ${_rr232x.4} \ rue.4 \ sa.4 \ safe.4 \ sbp.4 \ sbp_targ.4 \ sbsh.4 \ scc.4 \ sched_4bsd.4 \ sched_core.4 \ sched_ule.4 \ screen.4 \ scsi.4 \ sem.4 \ ses.4 \ sf.4 \ si.4 \ sio.4 \ sis.4 \ sk.4 \ sl.4 \ smb.4 \ smbus.4 \ smp.4 \ sn.4 \ snd_ad1816.4 \ snd_als4000.4 \ snd_atiixp.4 \ snd_cmi.4 \ snd_cs4281.4 \ snd_csa.4 \ snd_ds1.4 \ snd_emu10k1.4 \ snd_envy24.4 \ snd_es137x.4 \ snd_ess.4 \ snd_fm801.4 \ snd_gusc.4 \ snd_ich.4 \ snd_maestro.4 \ snd_maestro3.4 \ snd_mss.4 \ snd_neomagic.4 \ snd_sbc.4 \ snd_solo.4 \ snd_t4dwave.4 \ snd_uaudio.4 \ snd_via8233.4 \ snd_via82c686.4 \ snd_vibes.4 \ snp.4 \ spic.4 \ ${_spkr.4} \ splash.4 \ sppp.4 \ ste.4 \ stf.4 \ stg.4 \ sym.4 \ syncache.4 \ syncer.4 \ syscons.4 \ sysmouse.4 \ tap.4 \ targ.4 \ tcp.4 \ tdfx.4 \ termios.4 \ ti.4 \ tl.4 \ trm.4 \ tty.4 \ tun.4 \ twa.4 \ twe.4 \ tx.4 \ txp.4 \ uart.4 \ ubsa.4 \ ubsec.4 \ ubser.4 \ ubtbcmfw.4 \ ucom.4 \ ucycom.4 \ udav.4 \ udbp.4 \ udp.4 \ ufm.4 \ ufoma.4 \ uftdi.4 \ ugen.4 \ uhci.4 \ uhid.4 \ uhidev.4 \ ukbd.4 \ ulpt.4 \ umass.4 \ umct.4 \ umodem.4 \ ums.4 \ unix.4 \ uplcom.4 \ ural.4 \ urio.4 \ usb.4 \ uscanner.4 \ utopia.4 \ uvisor.4 \ uvscom.4 \ vga.4 \ vge.4 \ vinum.4 \ vkbd.4 \ vlan.4 \ vpo.4 \ vr.4 \ watchdog.4 \ wb.4 \ wi.4 \ witness.4 \ wlan.4 \ wlan_acl.4 \ wlan_ccmp.4 \ wlan_tkip.4 \ wlan_wep.4 \ wlan_xauth.4 \ worm.4 \ xe.4 \ xl.4 \ xpt.4 \ zero.4 MLINKS= agp.4 agpgart.4 MLINKS+=altq.4 ALTQ.4 MLINKS+=an.4 if_an.4 MLINKS+=ata.4 acd.4 \ ata.4 ad.4 \ ata.4 afd.4 \ ata.4 ast.4 MLINKS+=aue.4 if_aue.4 MLINKS+=awi.4 if_awi.4 MLINKS+=axe.4 if_axe.4 MLINKS+=bce.4 if_bce.4 MLINKS+=bfe.4 if_bfe.4 MLINKS+=bge.4 if_bge.4 MLINKS+=bktr.4 brooktree.4 MLINKS+=cnw.4 if_cnw.4 MLINKS+=crypto.4 cryptodev.4 MLINKS+=cue.4 if_cue.4 MLINKS+=dc.4 if_dc.4 MLINKS+=de.4 if_de.4 MLINKS+=disc.4 if_disc.4 MLINKS+=ed.4 if_ed.4 MLINKS+=ef.4 if_ef.4 MLINKS+=em.4 if_em.4 MLINKS+=en.4 if_en.4 MLINKS+=faith.4 if_faith.4 MLINKS+=fatm.4 if_fatm.4 MLINKS+=fd.4 stderr.4 \ fd.4 stdin.4 \ fd.4 stdout.4 MLINKS+=firewire.4 ieee1394.4 MLINKS+=fpa.4 fea.4 MLINKS+=fwe.4 if_fwe.4 MLINKS+=fwip.4 if_fwip.4 MLINKS+=fxp.4 if_fxp.4 MLINKS+=gem.4 if_gem.4 MLINKS+=geom.4 GEOM.4 MLINKS+=gif.4 if_gif.4 MLINKS+=gre.4 if_gre.4 MLINKS+=hatm.4 if_hatm.4 MLINKS+=hme.4 if_hme.4 MLINKS+=idt.4 if_idt.4 MLINKS+=if_bridge.4 bridge.4 MLINKS+=ip.4 rawip.4 MLINKS+=ipfirewall.4 ipaccounting.4 \ ipfirewall.4 ipacct.4 \ ipfirewall.4 ipfw.4 MLINKS+=ipw.4 if_ipw.4 MLINKS+=iwi.4 if_iwi.4 MLINKS+=ixgb.4 if_ixgb.4 MLINKS+=kue.4 if_kue.4 MLINKS+=le.4 if_le.4 MLINKS+=lge.4 if_lge.4 MLINKS+=lo.4 loop.4 MLINKS+=lp.4 plip.4 MLINKS+=md.4 vn.4 MLINKS+=mem.4 kmem.4 MLINKS+=mn.4 if_mn.4 MLINKS+=mxge.4 if_mxge.4 MLINKS+=my.4 if_my.4 MLINKS+=netintro.4 net.4 \ netintro.4 networking.4 +MLINKS+=${_nfe.4} ${_if_nfe.4} MLINKS+=nge.4 if_nge.4 MLINKS+=${_nve.4} ${_if_nve.4} MLINKS+=oldcard.4 card.4 MLINKS+=patm.4 if_patm.4 MLINKS+=pccbb.4 cbb.4 MLINKS+=pcm.4 snd.4 \ pcm.4 sound.4 MLINKS+=pcn.4 if_pcn.4 MLINKS+=ppp.4 if_ppp.4 MLINKS+=ral.4 if_ral.4 MLINKS+=re.4 if_re.4 MLINKS+=rl.4 if_rl.4 MLINKS+=rue.4 if_rue.4 MLINKS+=sbsh.4 if_sbsh.4 MLINKS+=scsi.4 CAM.4 \ scsi.4 cam.4 \ scsi.4 scbus.4 \ scsi.4 SCSI.4 MLINKS+=sf.4 if_sf.4 MLINKS+=sis.4 if_sis.4 MLINKS+=sk.4 if_sk.4 MLINKS+=sl.4 if_sl.4 MLINKS+=smp.4 SMP.4 MLINKS+=sn.4 if_sn.4 MLINKS+=snd_envy24.4 snd_ak452x.4 MLINKS+=${_spkr.4} ${_speaker.4} MLINKS+=splash.4 screensaver.4 MLINKS+=ste.4 if_ste.4 MLINKS+=stf.4 if_stf.4 MLINKS+=syncache.4 syncookies.4 MLINKS+=syscons.4 sc.4 MLINKS+=tap.4 if_tap.4 MLINKS+=tdfx.4 tdfx_linux.4 MLINKS+=ti.4 if_ti.4 MLINKS+=tl.4 if_tl.4 MLINKS+=tun.4 if_tun.4 MLINKS+=tx.4 if_tx.4 MLINKS+=txp.4 if_txp.4 MLINKS+=udav.4 if_udav.4 MLINKS+=ural.4 if_ural.4 MLINKS+=vge.4 if_vge.4 MLINKS+=vlan.4 if_vlan.4 MLINKS+=vpo.4 imm.4 MLINKS+=vr.4 if_vr.4 MLINKS+=wb.4 if_wb.4 MLINKS+=wi.4 if_wi.4 MLINKS+=xe.4 if_xe.4 MLINKS+=xl.4 if_xl.4 .if ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "i386" _acpi_dock.4= acpi_dock.4 _amdsmb.4= amdsmb.4 +_if_nfe.4= if_nfe.4 _if_nve.4= if_nve.4 _ipmi.4= ipmi.4 _nfsmb.4= nfsmb.4 +_nfe.4= nfe.4 _nve.4= nve.4 _rr232x.4= rr232x.4 _spkr.4= spkr.4 _speaker.4= speaker.4 .endif .if exists(${.CURDIR}/man4.${MACHINE_ARCH}) SUBDIR= man4.${MACHINE_ARCH} .endif .include Index: head/share/man/man4/nfe.4 =================================================================== --- head/share/man/man4/nfe.4 (nonexistent) +++ head/share/man/man4/nfe.4 (revision 159967) @@ -0,0 +1,96 @@ +.\" $OpenBSD: nfe.4,v 1.7 2006/02/28 08:13:47 jsg Exp $ +.\" +.\" Copyright (c) 2006 Jonathan Gray +.\" +.\" Permission to use, copy, modify, and distribute this software for any +.\" purpose with or without fee is hereby granted, provided that the above +.\" copyright notice and this permission notice appear in all copies. +.\" +.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +.\" +.\" $FreeBSD$ +.\" +.Dd February 6, 2006 +.Dt NFE 4 +.Os +.Sh NAME +.Nm nfe +.Nd "NVIDIA nForce MCP Ethernet driver" +.Sh SYNOPSIS +To compile this driver into the kernel, +place the following lines in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device miibus" +.Cd "device nve" +.Ed +.Pp +Alternatively, to load the driver as a +module at boot time, place the following line in +.Xr loader.conf 5 : +.Bd -literal -offset indent +if_nfe_load="YES" +.Ed +.Sh DESCRIPTION +The +.Nm +driver supports PCI Ethernet adapters based on the NVIDIA +nForce Media and Communications Processors (MCP), such as +the nForce, nForce 2, nForce 3, CK804, MCP04, MCP51 and MCP55 +Ethernet controller chips. +.Pp +The +.Nm +driver supports the following +.Ar media +types: +.Pp +.Bl -tag -width autoselect -compact +.It Cm autoselect +Enable autoselection of the media type and options. +.It Cm 10baseT +Set 10Mbps operation. +.It Cm 100baseTX +Set 100Mbps (Fast Ethernet) operation. +.It Cm 1000baseT +Set 1000Mbps (Gigabit Ethernet) operation (recent models only). +.El +.Sh SEE ALSO +.Xr arp 4 , +.Xr intro 4 , +.Xr miibus 4 , +.Xr netintro 4 , +.Xr pci 4 , +.Xr ifconfig 8 +.Sh HISTORY +The +.Nm +device driver first appeared in +.Ox 3.9 , +and then in +.Fx 6.0 . +.Sh AUTHORS +.An -nosplit +The +.Nm +driver was written by +.An Jonathan Gray +.Aq jsg@openbsd.org +and +.An Damien Bergamini +.Aq damien@openbsd.org . +The +.Nm +driver was ported to +.Fx +by +.An Shigeaki Tagashira +.Aq shigeaki@se.hiroshima-u.ac.jp . +.Sh CAVEATS +NVIDIA refuse to release any documentation on their products. Property changes on: head/share/man/man4/nfe.4 ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property Index: head/sys/amd64/conf/NOTES =================================================================== --- head/sys/amd64/conf/NOTES (revision 159966) +++ head/sys/amd64/conf/NOTES (revision 159967) @@ -1,573 +1,575 @@ # # NOTES -- Lines that can be cut/pasted into kernel and hints configs. # # This file contains machine dependent kernel configuration notes. For # machine independent notes, look in /sys/conf/NOTES. # # $FreeBSD$ # # # We want LINT to cover profiling as well. profile 2 ##################################################################### # SMP OPTIONS: # # Notes: # # IPI_PREEMPTION instructs the kernel to preempt threads running on other # CPUS if needed. Relies on the PREEMPTION option # Optional: options IPI_PREEMPTION device atpic # Optional legacy pic support device mptable # Optional MPSPEC mptable support # # Watchdog routines. # options MP_WATCHDOG # # Debugging options. # options STOP_NMI # Stop CPUS using NMI instead of IPI ##################################################################### # CPU OPTIONS # # You must specify at least one CPU (the one you intend to run on); # deleting the specification for CPUs you don't need to use may make # parts of the system run faster. # cpu HAMMER # aka K8, aka Opteron & Athlon64 # # Options for CPU features. # # # PERFMON causes the driver for Pentium/Pentium Pro performance counters # to be compiled. See perfmon(4) for more information. # #XXX#options PERFMON ##################################################################### # NETWORKING OPTIONS # # DEVICE_POLLING adds support for mixed interrupt-polling handling # of network device drivers, which has significant benefits in terms # of robustness to overloads and responsivity, as well as permitting # accurate scheduling of the CPU time between kernel network processing # and other activities. The drawback is a moderate (up to 1/HZ seconds) # potential increase in response times. # It is strongly recommended to use HZ=1000 or 2000 with DEVICE_POLLING # to achieve smoother behaviour. # Additionally, you can enable/disable polling at runtime with help of # the ifconfig(8) utility, and select the CPU fraction reserved to # userland with the sysctl variable kern.polling.user_frac # (default 50, range 0..100). # # Not all device drivers support this mode of operation at the time of # this writing. See polling(4) for more details. options DEVICE_POLLING ##################################################################### # CLOCK OPTIONS # The following options are used for debugging clock behavior only, and # should not be used for production systems. # CLK_CALIBRATION_LOOP causes clock calibration to be run in a loop at # startup until the user presses a key. (The i8254 clock is always # calibrated relative to the RTC (mc146818a) and this option causes the # calibration to be repeated.) options CLK_CALIBRATION_LOOP # CLK_USE_I8254_CALIBRATION causes the calibrated frequency of the i8254 # clock to actually be used. options CLK_USE_I8254_CALIBRATION ##################################################################### # MISCELLANEOUS DEVICES AND OPTIONS device speaker #Play IBM BASIC-style noises out your speaker hint.speaker.0.at="isa" hint.speaker.0.port="0x61" device gzip #Exec gzipped a.out's. REQUIRES COMPAT_AOUT! ##################################################################### # HARDWARE BUS CONFIGURATION # # ISA bus # device isa # # Options for `isa': # # AUTO_EOI_1 enables the `automatic EOI' feature for the master 8259A # interrupt controller. This saves about 0.7-1.25 usec for each interrupt. # This option breaks suspend/resume on some portables. # # AUTO_EOI_2 enables the `automatic EOI' feature for the slave 8259A # interrupt controller. This saves about 0.7-1.25 usec for each interrupt. # Automatic EOI is documented not to work for for the slave with the # original i8259A, but it works for some clones and some integrated # versions. # # MAXMEM specifies the amount of RAM on the machine; if this is not # specified, FreeBSD will first read the amount of memory from the CMOS # RAM, so the amount of memory will initially be limited to 64MB or 16MB # depending on the BIOS. If the BIOS reports 64MB, a memory probe will # then attempt to detect the installed amount of RAM. If this probe # fails to detect >64MB RAM you will have to use the MAXMEM option. # The amount is in kilobytes, so for a machine with 128MB of RAM, it would # be 131072 (128 * 1024). # # BROKEN_KEYBOARD_RESET disables the use of the keyboard controller to # reset the CPU for reboot. This is needed on some systems with broken # keyboard controllers. options AUTO_EOI_1 #options AUTO_EOI_2 options MAXMEM=(128*1024) #options BROKEN_KEYBOARD_RESET # # PCI bus & PCI options: # device pci # # AGP GART support device agp ##################################################################### # HARDWARE DEVICE CONFIGURATION # # Optional devices: # # 3Dfx Voodoo Graphics, Voodoo II /dev/3dfx CDEV support. This will create # the /dev/3dfx0 device to work with glide implementations. This should get # linked to /dev/3dfx and /dev/voodoo. Note that this is not the same as # the tdfx DRI module from XFree86 and is completely unrelated. # # To enable Linuxulator support, one must also include COMPAT_LINUX in the # config as well. The other option is to load both as modules. device tdfx # Enable 3Dfx Voodoo support #XXX#device tdfx_linux # Enable Linuxulator support # # ACPI support using the Intel ACPI Component Architecture reference # implementation. # # ACPI_DEBUG enables the use of the debug.acpi.level and debug.acpi.layer # kernel environment variables to select initial debugging levels for the # Intel ACPICA code. (Note that the Intel code must also have USE_DEBUGGER # defined when it is built). # # ACPI_NO_SEMAPHORES makes the AcpiOs*Semaphore routines a no-op. # # ACPICA_PEDANTIC enables strict checking of AML. Our default is to # relax these checks to allow code generated by the Microsoft compiler # to still execute. # # Note that building ACPI into the kernel is deprecated; the module is # normally loaded automatically by the loader. device acpi options ACPI_DEBUG #!options ACPI_NO_SEMAPHORES #!options ACPICA_PEDANTIC # The cpufreq(4) driver provides support for non-ACPI CPU frequency control device cpufreq # Direct Rendering modules for 3D acceleration. device drm # DRM core module required by DRM drivers device i915drm # Intel i830 through i915 device mach64drm # ATI Rage Pro, Rage Mobility P/M, Rage XL device mgadrm # AGP Matrox G200, G400, G450, G550 device r128drm # ATI Rage 128 device radeondrm # ATI Radeon device savagedrm # S3 Savage3D, Savage4 device sisdrm # SiS 300/305, 540, 630 device tdfxdrm # 3dfx Voodoo 3/4/5 and Banshee options DRM_DEBUG # Include debug printfs (slow) # # Network interfaces: # # ath: Atheros a/b/g WiFi adapters (requires ath_hal and wlan) # ed: Western Digital and SMC 80xx; Novell NE1000 and NE2000; 3Com 3C503 # HP PC Lan+, various PC Card devices (refer to etc/defaults/pccard.conf) # (requires miibus) # ipw: Intel PRO/Wireless 2100 IEEE 802.11 adapter # iwi: Intel PRO/Wireless 2200BG/2225BG/2915ABG IEEE 802.11 adapters +# nfe: nVidia nForce MCP on-board Ethernet Networking (BSD open source) # nve: nVidia nForce MCP on-board Ethernet Networking # ral: Ralink Technology IEEE 802.11 wireless adapter # ural: Ralink Technology RT2500USB IEEE 802.11 wireless adapter device ed options ED_3C503 options ED_HPP options ED_SIC device iwi device ipw +device nfe # nVidia nForce MCP on-board Ethernet Networking device nve # nVidia nForce MCP on-board Ethernet Networking device ral device ural device ath device ath_hal # Atheros HAL (includes binary component) #device ath_rate_amrr # AMRR rate control for ath driver #device ath_rate_onoe # Onoe rate control for ath driver device ath_rate_sample # SampleRate rate control for the ath driver #device wlan # 802.11 layer # #XXX this stores pointers in a 32bit field that is defined by the hardware #device pst # # Areca 11xx and 12xx series of SATA II RAID controllers. # CAM is required. # device arcmsr # Areca SATA II RAID # # 3ware 9000 series PATA/SATA RAID controller driver and options. # The driver is implemented as a SIM, and so, needs the CAM infrastructure. # options TWA_DEBUG # 0-10; 10 prints the most messages. options TWA_FLASH_FIRMWARE # firmware image bundled when defined. device twa # 3ware 9000 series PATA/SATA RAID # # SCSI host adapters: # # ncv: NCR 53C500 based SCSI host adapters. # nsp: Workbit Ninja SCSI-3 based PC Card SCSI host adapters. # stg: TMC 18C30, 18C50 based SCSI host adapters. device ncv device nsp device stg # # Adaptec FSA RAID controllers, including integrated DELL controllers, # the Dell PERC 2/QC and the HP NetRAID-4M device aac device aacp # SCSI Passthrough interface (optional, CAM required) # # Highpoint RocketRAID 182x. This is really just software RAID on a # Marvell SATA chip. device hptmv # # Highpoint RocketRAID 232x. This is software RAID but with hardware # acceleration assistance for RAID_5. device rr232x # # IBM (now Adaptec) ServeRAID controllers device ips # # SafeNet crypto driver: can be moved to the MI NOTES as soon as # it's tested on a big-endian machine # device safe # SafeNet 1141 options SAFE_DEBUG # enable debugging support: hw.safe.debug options SAFE_RNDTEST # enable rndtest support ##################################################################### # # Miscellaneous hardware: # # smbios: DMI/SMBIOS entry point # vpd: Vital Product Data kernel interface # cy: Cyclades serial driver # digi: Digiboard driver # Notes on the Specialix SI/XIO driver: # The host card is memory, not IO mapped. # The Rev 1 host cards use a 64K chunk, on a 32K boundary. # The Rev 2 host cards use a 32K chunk, on a 32K boundary. # The cards can use an IRQ of 11, 12 or 15. device cy options CY_PCI_FASTINTR # Use with cy_pci unless irq is shared device digi # BIOS & FEP/OS components of device digi. device digi_CX device digi_CX_PCI device digi_EPCX device digi_EPCX_PCI device digi_Xe device digi_Xem device digi_Xr # Parallel (8255 PPI) basic I/O (mode 0) port (e.g. Advantech PCL-724) device pbio hint.pbio.0.at="isa" hint.pbio.0.port="0x360" device smbios device vpd # HOT1 Xilinx 6200 card (http://www.vcc.com/) device xrpu # # Laptop/Notebook options: # # # I2C Bus # # # Hardware watchdog timers: # # ichwd: Intel ICH watchdog timer # device ichwd #--------------------------------------------------------------------------- # ISDN4BSD # # See /usr/share/examples/isdn/ROADMAP for an introduction to isdn4bsd. # # i4b passive ISDN cards support contains the following hardware drivers: # # isic - Siemens/Infineon ISDN ISAC/HSCX/IPAC chipset driver # iwic - Winbond W6692 PCI bus ISDN S/T interface controller # ifpi - AVM Fritz!Card PCI driver # ifpi2 - AVM Fritz!Card PCI version 2 driver # itjc - Siemens ISAC / TJNet Tiger300/320 chipset # # i4b active ISDN cards support contains the following hardware drivers: # # iavc - AVM B1 PCI, AVM B1 ISA, AVM T1 # # Note that the ``options'' (if given) and ``device'' lines must BOTH # be uncommented to enable support for a given card ! # # In addition to a hardware driver (and probably an option) the mandatory # ISDN protocol stack devices and the mandatory support device must be # enabled as well as one or more devices from the optional devices section. # #--------------------------------------------------------------------------- # isic driver (Siemens/Infineon chipsets) # #XXX#device isic # # PCI bus Cards: # -------------- # # ELSA MicroLink ISDN/PCI (same as ELSA QuickStep 1000pro PCI) options ELSA_QS1PCI # #--------------------------------------------------------------------------- # ifpi2 driver for AVM Fritz!Card PCI version 2 # # AVM Fritz!Card PCI version 2 #XXX#device ifpi2 # #--------------------------------------------------------------------------- # iwic driver for Winbond W6692 chipset # # ASUSCOM P-IN100-ST-D (and other Winbond W6692 based cards) #XXX#device iwic # #--------------------------------------------------------------------------- # itjc driver for Siemens ISAC / TJNet Tiger300/320 chipset # # Traverse Technologies NETjet-S # Teles PCI-TJ #XXX#device itjc # #--------------------------------------------------------------------------- # iavc driver (AVM active cards, needs i4bcapi driver!) # #XXX#device iavc # #--------------------------------------------------------------------------- # ISDN Protocol Stack - mandatory for all hardware drivers # # Q.921 / layer 2 - i4b passive cards D channel handling #XXX#device i4bq921 # # Q.931 / layer 3 - i4b passive cards D channel handling #XXX#device i4bq931 # # layer 4 - i4b common passive and active card handling #XXX#device i4b # #--------------------------------------------------------------------------- # ISDN devices - mandatory for all hardware drivers # # userland driver to do ISDN tracing (for passive cards only) #XXX#device i4btrc #XXX#options NI4BTRC=4 # # userland driver to control the whole thing #XXX#device i4bctl # #--------------------------------------------------------------------------- # ISDN devices - optional # # userland driver for access to raw B channel #XXX#device i4brbch #XXX#options NI4BRBCH=4 # # userland driver for telephony #XXX#device i4btel #XXX#options NI4BTEL=2 # # network driver for IP over raw HDLC ISDN #XXX#device i4bipr #XXX#options NI4BIPR=4 # enable VJ header compression detection for ipr i/f options IPR_VJ # enable logging of the first n IP packets to isdnd (n=32 here) options IPR_LOG=32 # # network driver for sync PPP over ISDN; requires an equivalent # number of sppp device to be configured #XXX#device i4bisppp #XXX#options NI4BISPPP=4 # # B-channel interface to the netgraph subsystem #XXX#device i4bing #XXX#options NI4BING=2 # # CAPI driver needed for active ISDN cards (see iavc driver above) #XXX#device i4bcapi # #--------------------------------------------------------------------------- # # System Management Bus (SMB) # options ENABLE_ALART # Control alarm on Intel intpm driver # # Set the number of PV entries per process. Increasing this can # stop panics related to heavy use of shared memory. However, that can # (combined with large amounts of physical memory) cause panics at # boot time due the kernel running out of VM space. # # If you're tweaking this, you might also want to increase the sysctls # "vm.v_free_min", "vm.v_free_reserved", and "vm.v_free_target". # # The value below is the one more than the default. # options PMAP_SHPGPERPROC=201 ##################################################################### # ABI Emulation #XXX keep these here for now and reactivate when support for emulating #XXX these 32 bit binaries is added. # Enable 32-bit runtime support for FreeBSD/i386 binaries. options COMPAT_IA32 # Enable iBCS2 runtime support for SCO and ISC binaries #XXX#options IBCS2 # Emulate spx device for client side of SVR3 local X interface #XXX#options SPX_HACK # Enable Linux ABI emulation #XXX#options COMPAT_LINUX # Enable 32-bit Linux ABI emulation (requires COMPAT_43 and COMPAT_IA32) options COMPAT_LINUX32 # Enable the linux-like proc filesystem support (requires COMPAT_LINUX32 # and PSEUDOFS) options LINPROCFS #Enable the linux-like sys filesystem support (requires COMPAT_LINUX32 # and PSEUDOFS) options LINSYSFS # # SysVR4 ABI emulation # # The svr4 ABI emulator can be statically compiled into the kernel or loaded as # a KLD module. # The STREAMS network emulation code can also be compiled statically or as a # module. If loaded as a module, it must be loaded before the svr4 module # (the /usr/sbin/svr4 script does this for you). If compiling statically, # the `streams' device must be configured into any kernel which also # specifies COMPAT_SVR4. It is possible to have a statically-configured # STREAMS device and a dynamically loadable svr4 emulator; the /usr/sbin/svr4 # script understands that it doesn't need to load the `streams' module under # those circumstances. # Caveat: At this time, `options KTRACE' is required for the svr4 emulator # (whether static or dynamic). # #XXX#options COMPAT_SVR4 # build emulator statically #XXX#options DEBUG_SVR4 # enable verbose debugging #XXX#device streams # STREAMS network driver (required for svr4). ##################################################################### # VM OPTIONS # KSTACK_PAGES is the number of memory pages to assign to the kernel # stack of each thread. options KSTACK_PAGES=3 ##################################################################### # More undocumented options for linting. # Note that documenting these are not considered an affront. options FB_INSTALL_CDEV # install a CDEV entry in /dev options KBDIO_DEBUG=2 options KBD_MAXRETRY=4 options KBD_MAXWAIT=6 options KBD_RESETDELAY=201 options PSM_DEBUG=1 options TIMER_FREQ=((14318182+6)/12) options VM_KMEM_SIZE options VM_KMEM_SIZE_MAX options VM_KMEM_SIZE_SCALE # Enable NDIS binary driver support options NDISAPI device ndis # The I/O device device io Index: head/sys/conf/files.amd64 =================================================================== --- head/sys/conf/files.amd64 (revision 159966) +++ head/sys/conf/files.amd64 (revision 159967) @@ -1,261 +1,262 @@ # This file tells config what files go into building a kernel, # files marked standard are always included. # # $FreeBSD$ # # The long compile-with and dependency lines are required because of # limitations in config: backslash-newline doesn't work in strings, and # dependency lines other than the first are silently ignored. # # linux32_genassym.o optional compat_linux32 \ dependency "$S/amd64/linux32/linux32_genassym.c" \ compile-with "${CC} ${CFLAGS:N-fno-common} -c ${.IMPSRC}" \ no-obj no-implicit-rule \ clean "linux32_genassym.o" # linux32_assym.h optional compat_linux32 \ dependency "$S/kern/genassym.sh linux32_genassym.o" \ compile-with "sh $S/kern/genassym.sh linux32_genassym.o > ${.TARGET}" \ no-obj no-implicit-rule before-depend \ clean "linux32_assym.h" # ia32_genassym.o standard \ dependency "$S/compat/ia32/ia32_genassym.c" \ compile-with "${CC} ${CFLAGS:N-fno-common} -c ${.IMPSRC}" \ no-obj no-implicit-rule \ clean "ia32_genassym.o" # ia32_assym.h standard \ dependency "$S/kern/genassym.sh ia32_genassym.o" \ compile-with "env NM='${NM}' sh $S/kern/genassym.sh ia32_genassym.o > ${.TARGET}" \ no-obj no-implicit-rule before-depend \ clean "ia32_assym.h" # font.h optional sc_dflt_font \ compile-with "uudecode < /usr/share/syscons/fonts/${SC_DFLT_FONT}-8x16.fnt && file2c 'static u_char dflt_font_16[16*256] = {' '};' < ${SC_DFLT_FONT}-8x16 > font.h && uudecode < /usr/share/syscons/fonts/${SC_DFLT_FONT}-8x14.fnt && file2c 'static u_char dflt_font_14[14*256] = {' '};' < ${SC_DFLT_FONT}-8x14 >> font.h && uudecode < /usr/share/syscons/fonts/${SC_DFLT_FONT}-8x8.fnt && file2c 'static u_char dflt_font_8[8*256] = {' '};' < ${SC_DFLT_FONT}-8x8 >> font.h" \ no-obj no-implicit-rule before-depend \ clean "font.h ${SC_DFLT_FONT}-8x14 ${SC_DFLT_FONT}-8x16 ${SC_DFLT_FONT}-8x8" # atkbdmap.h optional atkbd_dflt_keymap \ compile-with "/usr/sbin/kbdcontrol -L ${ATKBD_DFLT_KEYMAP} | sed -e 's/^static keymap_t.* = /static keymap_t key_map = /' -e 's/^static accentmap_t.* = /static accentmap_t accent_map = /' > atkbdmap.h" \ no-obj no-implicit-rule before-depend \ clean "atkbdmap.h" # ukbdmap.h optional ukbd_dflt_keymap \ compile-with "/usr/sbin/kbdcontrol -L ${UKBD_DFLT_KEYMAP} | sed -e 's/^static keymap_t.* = /static keymap_t key_map = /' -e 's/^static accentmap_t.* = /static accentmap_t accent_map = /' > ukbdmap.h" \ no-obj no-implicit-rule before-depend \ clean "ukbdmap.h" # hal.o optional ath_hal \ dependency "$S/contrib/dev/ath/public/x86_64-elf.hal.o.uu" \ compile-with "uudecode < $S/contrib/dev/ath/public/x86_64-elf.hal.o.uu" \ no-implicit-rule opt_ah.h optional ath_hal \ dependency "$S/contrib/dev/ath/public/x86_64-elf.opt_ah.h" \ compile-with "cp $S/contrib/dev/ath/public/x86_64-elf.opt_ah.h opt_ah.h" \ no-obj no-implicit-rule before-depend \ clean "opt_ah.h" # nvenetlib.o optional nve pci \ dependency "$S/contrib/dev/nve/amd64/nvenetlib.o.bz2.uu" \ compile-with "uudecode $S/contrib/dev/nve/amd64/nvenetlib.o.bz2.uu ; bzip2 -df nvenetlib.o.bz2" \ no-implicit-rule # os+%DIKED-nve.h optional nve pci \ dependency "$S/contrib/dev/nve/os.h" \ compile-with "sed -e 's/^.*#include.*phy\.h.*$$//' $S/contrib/dev/nve/os.h > os+%DIKED-nve.h" \ no-implicit-rule no-obj before-depend \ clean "os+%DIKED-nve.h" # hptmvraid.o optional hptmv \ dependency "$S/dev/hptmv/amd64-elf.raid.o.uu" \ compile-with "uudecode < $S/dev/hptmv/amd64-elf.raid.o.uu" \ no-implicit-rule rr232x_lib.o optional rr232x \ dependency "$S/dev/rr232x/amd64-elf.rr232x_lib.o.uu" \ compile-with "uudecode < $S/dev/rr232x/amd64-elf.rr232x_lib.o.uu" \ no-implicit-rule # amd64/acpica/OsdEnvironment.c optional acpi amd64/acpica/acpi_machdep.c optional acpi amd64/acpica/acpi_wakeup.c optional acpi amd64/acpica/madt.c optional acpi amd64/amd64/amd64_mem.c optional mem #amd64/amd64/apic_vector.S standard amd64/amd64/atomic.c standard amd64/amd64/autoconf.c standard amd64/amd64/bios.c standard amd64/amd64/bpf_jit_machdep.c optional bpf_jitter amd64/amd64/busdma_machdep.c standard amd64/amd64/cpu_switch.S standard amd64/amd64/db_disasm.c optional ddb amd64/amd64/db_interface.c optional ddb amd64/amd64/db_trace.c optional ddb amd64/amd64/dump_machdep.c standard amd64/amd64/elf_machdep.c standard amd64/amd64/exception.S standard amd64/amd64/fpu.c standard amd64/amd64/gdb_machdep.c optional gdb amd64/amd64/identcpu.c standard amd64/amd64/in_cksum.c optional inet amd64/amd64/initcpu.c standard amd64/amd64/intr_machdep.c standard amd64/amd64/io.c optional io amd64/amd64/io_apic.c standard amd64/amd64/legacy.c standard amd64/amd64/local_apic.c standard amd64/amd64/locore.S standard no-obj amd64/amd64/machdep.c standard amd64/amd64/mem.c optional mem amd64/amd64/minidump_machdep.c standard amd64/amd64/mp_machdep.c optional smp amd64/amd64/mp_watchdog.c optional mp_watchdog smp amd64/amd64/mpboot.S optional smp amd64/amd64/mptable.c optional mptable amd64/amd64/mptable_pci.c optional mptable pci amd64/amd64/nexus.c standard amd64/amd64/pmap.c standard amd64/amd64/prof_machdep.c optional profiling-routine amd64/amd64/sigtramp.S standard amd64/amd64/support.S standard amd64/amd64/sys_machdep.c standard amd64/amd64/trap.c standard amd64/amd64/tsc.c standard amd64/amd64/uio_machdep.c standard amd64/amd64/uma_machdep.c standard amd64/amd64/vm_machdep.c standard amd64/isa/atpic.c optional atpic isa #amd64/isa/atpic_vector.S optional atpic isa amd64/isa/clock.c standard amd64/isa/elcr.c standard amd64/isa/isa.c standard amd64/isa/isa_dma.c standard amd64/isa/nmi.c standard amd64/pci/pci_bus.c optional pci amd64/pci/pci_cfgreg.c optional pci crypto/blowfish/bf_enc.c optional crypto | ipsec ipsec_esp crypto/des/des_enc.c optional crypto | ipsec ipsec_esp | \ netsmb dev/acpica/acpi_if.m standard dev/arcmsr/arcmsr.c optional arcmsr pci dev/atkbdc/atkbd.c optional atkbd atkbdc dev/atkbdc/atkbd_atkbdc.c optional atkbd atkbdc dev/atkbdc/atkbdc.c optional atkbdc dev/atkbdc/atkbdc_isa.c optional atkbdc isa dev/atkbdc/atkbdc_subr.c optional atkbdc dev/atkbdc/psm.c optional psm atkbdc # There are no systems with isa slots, so all ed isa entries should go.. dev/ed/if_ed_3c503.c optional ed isa ed_3c503 dev/ed/if_ed_isa.c optional ed isa dev/ed/if_ed_wd80x3.c optional ed isa dev/ed/if_ed_hpp.c optional ed isa ed_hpp dev/ed/if_ed_sic.c optional ed isa ed_sic dev/fb/fb.c optional fb | vga dev/fb/splash.c optional splash dev/fb/vga.c optional vga dev/ichwd/ichwd.c optional ichwd dev/if_ndis/if_ndis.c optional ndis dev/if_ndis/if_ndis_pccard.c optional ndis pccard dev/if_ndis/if_ndis_pci.c optional ndis cardbus | ndis pci dev/if_ndis/if_ndis_usb.c optional ndis usb dev/io/iodev.c optional io dev/ipmi/ipmi.c optional ipmi dev/ipmi/ipmi_smbios.c optional ipmi isa dev/ipmi/ipmi_pci.c optional ipmi pci dev/fdc/fdc.c optional fdc dev/fdc/fdc_acpi.c optional fdc dev/fdc/fdc_isa.c optional fdc isa dev/fdc/fdc_pccard.c optional fdc pccard dev/hptmv/entry.c optional hptmv dev/hptmv/mv.c optional hptmv dev/hptmv/gui_lib.c optional hptmv dev/hptmv/hptproc.c optional hptmv dev/hptmv/ioctl.c optional hptmv dev/hwpmc/hwpmc_amd.c optional hwpmc dev/hwpmc/hwpmc_piv.c optional hwpmc dev/hwpmc/hwpmc_x86.c optional hwpmc dev/kbd/kbd.c optional atkbd | sc | ukbd dev/mem/memutil.c optional mem +dev/nfe/if_nfe.c optional nfe pci dev/nve/if_nve.c optional nve pci dev/rr232x/os_bsd.c optional rr232x dev/rr232x/osm_bsd.c optional rr232x dev/rr232x/rr232x_config.c optional rr232x dev/sio/sio.c optional sio dev/sio/sio_isa.c optional sio isa dev/speaker/spkr.c optional speaker dev/syscons/apm/apm_saver.c optional apm_saver apm dev/syscons/schistory.c optional sc dev/syscons/scmouse.c optional sc dev/syscons/scterm-dumb.c optional sc dev/syscons/scterm-sc.c optional sc dev/syscons/scterm.c optional sc dev/syscons/scvgarndr.c optional sc vga dev/syscons/scvidctl.c optional sc dev/syscons/scvtb.c optional sc dev/syscons/syscons.c optional sc dev/syscons/sysmouse.c optional sc dev/uart/uart_cpu_amd64.c optional uart geom/geom_bsd.c standard geom/geom_bsd_enc.c standard geom/geom_mbr.c standard geom/geom_mbr_enc.c standard isa/syscons_isa.c optional sc isa/vga_isa.c optional vga kern/link_elf_obj.c standard pci/agp_amd64.c optional agp pci/agp_intel.c optional agp # # IA32 binary support # #amd64/ia32/ia32_exception.S optional compat_ia32 amd64/ia32/ia32_reg.c optional compat_ia32 amd64/ia32/ia32_signal.c optional compat_ia32 amd64/ia32/ia32_sigtramp.S optional compat_ia32 amd64/ia32/ia32_syscall.c optional compat_ia32 compat/freebsd32/freebsd32_misc.c optional compat_ia32 compat/freebsd32/freebsd32_syscalls.c optional compat_ia32 compat/freebsd32/freebsd32_sysent.c optional compat_ia32 compat/ia32/ia32_sysvec.c optional compat_ia32 compat/linprocfs/linprocfs.c optional linprocfs compat/linsysfs/linsysfs.c optional linsysfs kern/imgact_elf32.c optional compat_ia32 # # Linux/i386 binary support # amd64/linux32/linux32_dummy.c optional compat_linux32 amd64/linux32/linux32_locore.s optional compat_linux32 \ dependency "linux32_assym.h" amd64/linux32/linux32_machdep.c optional compat_linux32 amd64/linux32/linux32_sysent.c optional compat_linux32 amd64/linux32/linux32_sysvec.c optional compat_linux32 compat/linux/linux_file.c optional compat_linux32 compat/linux/linux_getcwd.c optional compat_linux32 compat/linux/linux_ioctl.c optional compat_linux32 compat/linux/linux_ipc.c optional compat_linux32 compat/linux/linux_mib.c optional compat_linux32 compat/linux/linux_misc.c optional compat_linux32 compat/linux/linux_signal.c optional compat_linux32 compat/linux/linux_socket.c optional compat_linux32 compat/linux/linux_stats.c optional compat_linux32 compat/linux/linux_sysctl.c optional compat_linux32 compat/linux/linux_uid16.c optional compat_linux32 compat/linux/linux_util.c optional compat_linux32 dev/amr/amr_linux.c optional compat_linux32 amr dev/mfi/mfi_linux.c optional compat_linux32 mfi # # Windows NDIS driver support # compat/ndis/kern_ndis.c optional ndisapi pci compat/ndis/kern_windrv.c optional ndisapi pci compat/ndis/subr_hal.c optional ndisapi pci compat/ndis/subr_ndis.c optional ndisapi pci compat/ndis/subr_ntoskrnl.c optional ndisapi pci compat/ndis/subr_pe.c optional ndisapi pci compat/ndis/subr_usbd.c optional ndisapi pci compat/ndis/winx64_wrap.S optional ndisapi pci i386/bios/smbios.c optional smbios i386/bios/vpd.c optional vpd i386/cpufreq/powernow.c optional cpufreq i386/cpufreq/est.c optional cpufreq i386/cpufreq/p4tcc.c optional cpufreq Index: head/sys/conf/files.i386 =================================================================== --- head/sys/conf/files.i386 (revision 159966) +++ head/sys/conf/files.i386 (revision 159967) @@ -1,451 +1,452 @@ # This file tells config what files go into building a kernel, # files marked standard are always included. # # $FreeBSD$ # # The long compile-with and dependency lines are required because of # limitations in config: backslash-newline doesn't work in strings, and # dependency lines other than the first are silently ignored. # linux_genassym.o optional compat_linux \ dependency "$S/i386/linux/linux_genassym.c" \ compile-with "${CC} ${CFLAGS:N-fno-common} -c ${.IMPSRC}" \ no-obj no-implicit-rule \ clean "linux_genassym.o" # linux_assym.h optional compat_linux \ dependency "$S/kern/genassym.sh linux_genassym.o" \ compile-with "sh $S/kern/genassym.sh linux_genassym.o > ${.TARGET}" \ no-obj no-implicit-rule before-depend \ clean "linux_assym.h" # svr4_genassym.o optional compat_svr4 \ dependency "$S/i386/svr4/svr4_genassym.c" \ compile-with "${CC} ${CFLAGS:N-fno-common} -c ${.IMPSRC}" \ no-obj no-implicit-rule \ clean "svr4_genassym.o" # svr4_assym.h optional compat_svr4 \ dependency "$S/kern/genassym.sh svr4_genassym.o" \ compile-with "sh $S/kern/genassym.sh svr4_genassym.o > ${.TARGET}" \ no-obj no-implicit-rule before-depend \ clean "svr4_assym.h" # font.h optional sc_dflt_font \ compile-with "uudecode < /usr/share/syscons/fonts/${SC_DFLT_FONT}-8x16.fnt && file2c 'static u_char dflt_font_16[16*256] = {' '};' < ${SC_DFLT_FONT}-8x16 > font.h && uudecode < /usr/share/syscons/fonts/${SC_DFLT_FONT}-8x14.fnt && file2c 'static u_char dflt_font_14[14*256] = {' '};' < ${SC_DFLT_FONT}-8x14 >> font.h && uudecode < /usr/share/syscons/fonts/${SC_DFLT_FONT}-8x8.fnt && file2c 'static u_char dflt_font_8[8*256] = {' '};' < ${SC_DFLT_FONT}-8x8 >> font.h" \ no-obj no-implicit-rule before-depend \ clean "font.h ${SC_DFLT_FONT}-8x14 ${SC_DFLT_FONT}-8x16 ${SC_DFLT_FONT}-8x8" # atkbdmap.h optional atkbd_dflt_keymap \ compile-with "/usr/sbin/kbdcontrol -L ${ATKBD_DFLT_KEYMAP} | sed -e 's/^static keymap_t.* = /static keymap_t key_map = /' -e 's/^static accentmap_t.* = /static accentmap_t accent_map = /' > atkbdmap.h" \ no-obj no-implicit-rule before-depend \ clean "atkbdmap.h" # ukbdmap.h optional ukbd_dflt_keymap \ compile-with "/usr/sbin/kbdcontrol -L ${UKBD_DFLT_KEYMAP} | sed -e 's/^static keymap_t.* = /static keymap_t key_map = /' -e 's/^static accentmap_t.* = /static accentmap_t accent_map = /' > ukbdmap.h" \ no-obj no-implicit-rule before-depend \ clean "ukbdmap.h" # trlld.o optional oltr \ dependency "$S/contrib/dev/oltr/i386-elf.trlld.o.uu" \ compile-with "uudecode < $S/contrib/dev/oltr/i386-elf.trlld.o.uu" \ no-implicit-rule # hal.o optional ath_hal \ dependency "$S/contrib/dev/ath/public/i386-elf.hal.o.uu" \ compile-with "uudecode < $S/contrib/dev/ath/public/i386-elf.hal.o.uu" \ no-implicit-rule opt_ah.h optional ath_hal \ dependency "$S/contrib/dev/ath/public/i386-elf.opt_ah.h" \ compile-with "cp $S/contrib/dev/ath/public/i386-elf.opt_ah.h opt_ah.h" \ no-obj no-implicit-rule before-depend \ clean "opt_ah.h" # nvenetlib.o optional nve pci \ dependency "$S/contrib/dev/nve/i386/nvenetlib.o.bz2.uu" \ compile-with "uudecode $S/contrib/dev/nve/i386/nvenetlib.o.bz2.uu ; bzip2 -df nvenetlib.o.bz2" \ no-implicit-rule # os+%DIKED-nve.h optional nve pci \ dependency "$S/contrib/dev/nve/os.h" \ compile-with "sed -e 's/^.*#include.*phy\.h.*$$//' $S/contrib/dev/nve/os.h > os+%DIKED-nve.h" \ no-implicit-rule no-obj before-depend \ clean "os+%DIKED-nve.h" # hptmvraid.o optional hptmv \ dependency "$S/dev/hptmv/i386-elf.raid.o.uu" \ compile-with "uudecode < $S/dev/hptmv/i386-elf.raid.o.uu" \ no-implicit-rule # rr232x_lib.o optional rr232x \ dependency "$S/dev/rr232x/i386-elf.rr232x_lib.o.uu" \ compile-with "uudecode < $S/dev/rr232x/i386-elf.rr232x_lib.o.uu" \ no-implicit-rule # # compat/linprocfs/linprocfs.c optional linprocfs compat/linsysfs/linsysfs.c optional linsysfs compat/linux/linux_file.c optional compat_linux compat/linux/linux_getcwd.c optional compat_linux compat/linux/linux_ioctl.c optional compat_linux compat/linux/linux_ipc.c optional compat_linux compat/linux/linux_mib.c optional compat_linux compat/linux/linux_misc.c optional compat_linux compat/linux/linux_signal.c optional compat_linux compat/linux/linux_socket.c optional compat_linux compat/linux/linux_stats.c optional compat_linux compat/linux/linux_sysctl.c optional compat_linux compat/linux/linux_uid16.c optional compat_linux compat/linux/linux_util.c optional compat_linux compat/ndis/kern_ndis.c optional ndisapi pci compat/ndis/kern_windrv.c optional ndisapi pci compat/ndis/subr_hal.c optional ndisapi pci compat/ndis/subr_ndis.c optional ndisapi pci compat/ndis/subr_ntoskrnl.c optional ndisapi pci compat/ndis/subr_pe.c optional ndisapi pci compat/ndis/subr_usbd.c optional ndisapi pci compat/ndis/winx32_wrap.S optional ndisapi pci compat/pecoff/imgact_pecoff.c optional pecoff_support compat/svr4/imgact_svr4.c optional compat_svr4 compat/svr4/svr4_fcntl.c optional compat_svr4 compat/svr4/svr4_filio.c optional compat_svr4 compat/svr4/svr4_ioctl.c optional compat_svr4 compat/svr4/svr4_ipc.c optional compat_svr4 compat/svr4/svr4_misc.c optional compat_svr4 compat/svr4/svr4_resource.c optional compat_svr4 compat/svr4/svr4_signal.c optional compat_svr4 compat/svr4/svr4_socket.c optional compat_svr4 compat/svr4/svr4_sockio.c optional compat_svr4 compat/svr4/svr4_stat.c optional compat_svr4 compat/svr4/svr4_stream.c optional compat_svr4 compat/svr4/svr4_syscallnames.c optional compat_svr4 compat/svr4/svr4_sysent.c optional compat_svr4 compat/svr4/svr4_sysvec.c optional compat_svr4 compat/svr4/svr4_termios.c optional compat_svr4 compat/svr4/svr4_ttold.c optional compat_svr4 contrib/dev/oltr/if_oltr.c optional oltr contrib/dev/oltr/if_oltr_isa.c optional oltr isa contrib/dev/oltr/if_oltr_pci.c optional oltr pci contrib/dev/oltr/trlldbm.c optional oltr contrib/dev/oltr/trlldhm.c optional oltr contrib/dev/oltr/trlldmac.c optional oltr bf_enc.o optional crypto | ipsec ipsec_esp \ dependency "$S/crypto/blowfish/arch/i386/bf_enc.S $S/crypto/blowfish/arch/i386/bf_enc_586.S $S/crypto/blowfish/arch/i386/bf_enc_686.S" \ compile-with "${CC} -c -I$S/crypto/blowfish/arch/i386 ${ASM_CFLAGS} ${WERROR} ${.IMPSRC}" \ no-implicit-rule crypto/des/arch/i386/des_enc.S optional crypto | ipsec ipsec_esp | netsmb crypto/via/padlock.c optional padlock dev/advansys/adv_isa.c optional adv isa dev/aic/aic_isa.c optional aic isa dev/arcmsr/arcmsr.c optional arcmsr pci dev/ar/if_ar.c optional ar dev/ar/if_ar_isa.c optional ar isa dev/ar/if_ar_pci.c optional ar pci dev/arl/if_arl.c optional arl dev/arl/if_arl_isa.c optional arl isa dev/atkbdc/atkbd.c optional atkbd atkbdc dev/atkbdc/atkbd_atkbdc.c optional atkbd atkbdc dev/atkbdc/atkbdc.c optional atkbdc dev/atkbdc/atkbdc_isa.c optional atkbdc isa dev/atkbdc/atkbdc_subr.c optional atkbdc dev/atkbdc/psm.c optional psm atkbdc dev/ce/ceddk.c optional ce dev/ce/if_ce.c optional ce dev/ce/tau32-ddk.c optional ce dev/cm/if_cm_isa.c optional cm isa dev/cp/cpddk.c optional cp dev/cp/if_cp.c optional cp dev/ctau/ctau.c optional ctau dev/ctau/ctddk.c optional ctau dev/ctau/if_ct.c optional ctau dev/cx/csigma.c optional cx dev/cx/cxddk.c optional cx dev/cx/if_cx.c optional cx dev/ed/if_ed_3c503.c optional ed isa ed_3c503 dev/ed/if_ed_isa.c optional ed isa dev/ed/if_ed_wd80x3.c optional ed isa dev/ed/if_ed_hpp.c optional ed isa ed_hpp dev/ed/if_ed_sic.c optional ed isa ed_sic dev/fb/fb.c optional fb | vga dev/fb/splash.c optional splash dev/fb/vga.c optional vga dev/fdc/fdc.c optional fdc dev/fdc/fdc_acpi.c optional fdc dev/fdc/fdc_isa.c optional fdc isa dev/fdc/fdc_pccard.c optional fdc pccard dev/fe/if_fe_isa.c optional fe isa dev/hptmv/entry.c optional hptmv dev/hptmv/mv.c optional hptmv dev/hptmv/gui_lib.c optional hptmv dev/hptmv/hptproc.c optional hptmv dev/hptmv/ioctl.c optional hptmv dev/hwpmc/hwpmc_amd.c optional hwpmc dev/hwpmc/hwpmc_pentium.c optional hwpmc dev/hwpmc/hwpmc_piv.c optional hwpmc dev/hwpmc/hwpmc_ppro.c optional hwpmc dev/hwpmc/hwpmc_x86.c optional hwpmc dev/ichwd/ichwd.c optional ichwd dev/if_ndis/if_ndis.c optional ndis dev/if_ndis/if_ndis_pccard.c optional ndis pccard dev/if_ndis/if_ndis_pci.c optional ndis cardbus | ndis pci dev/if_ndis/if_ndis_usb.c optional ndis usb dev/io/iodev.c optional io dev/ipmi/ipmi.c optional ipmi dev/ipmi/ipmi_smbios.c optional ipmi isa dev/ipmi/ipmi_pci.c optional ipmi pci dev/kbd/kbd.c optional atkbd | sc | ukbd | vt dev/le/if_le_isa.c optional le isa dev/mem/memutil.c optional mem dev/mse/mse.c optional mse dev/mse/mse_isa.c optional mse isa +dev/nfe/if_nfe.c optional nfe pci dev/nve/if_nve.c optional nve pci dev/pcf/pcf_isa.c optional pcf dev/random/nehemiah.c optional random dev/rr232x/os_bsd.c optional rr232x dev/rr232x/osm_bsd.c optional rr232x dev/rr232x/rr232x_config.c optional rr232x dev/sbni/if_sbni.c optional sbni dev/sbni/if_sbni_isa.c optional sbni isa dev/sbni/if_sbni_pci.c optional sbni pci dev/sio/sio.c optional sio dev/sio/sio_isa.c optional sio isa dev/speaker/spkr.c optional speaker dev/sr/if_sr_isa.c optional sr isa dev/syscons/apm/apm_saver.c optional apm_saver apm dev/syscons/schistory.c optional sc dev/syscons/scmouse.c optional sc dev/syscons/scterm.c optional sc dev/syscons/scterm-dumb.c optional sc dev/syscons/scterm-sc.c optional sc dev/syscons/scvesactl.c optional sc vga vesa dev/syscons/scvgarndr.c optional sc vga dev/syscons/scvidctl.c optional sc dev/syscons/scvtb.c optional sc dev/syscons/syscons.c optional sc dev/syscons/sysmouse.c optional sc dev/uart/uart_cpu_i386.c optional uart geom/geom_bsd.c standard geom/geom_bsd_enc.c standard geom/geom_mbr.c standard geom/geom_mbr_enc.c standard dev/acpica/acpi_if.m standard i386/acpica/OsdEnvironment.c optional acpi i386/acpica/acpi_machdep.c optional acpi i386/acpica/acpi_wakeup.c optional acpi acpi_wakecode.h optional acpi \ dependency "$S/i386/acpica/acpi_wakecode.S assym.s" \ compile-with "${MAKE} -f $S/i386/acpica/Makefile MAKESRCPATH=$S/i386/acpica" \ no-obj no-implicit-rule before-depend \ clean "acpi_wakecode.h acpi_wakecode.o acpi_wakecode.bin" # i386/acpica/madt.c optional acpi apic i386/bios/apm.c optional apm i386/bios/mca_machdep.c optional mca i386/bios/smapi.c optional smapi i386/bios/smapi_bios.S optional smapi i386/bios/smbios.c optional smbios i386/bios/vpd.c optional vpd i386/cpufreq/est.c optional cpufreq i386/cpufreq/p4tcc.c optional cpufreq i386/cpufreq/powernow.c optional cpufreq i386/cpufreq/smist.c optional cpufreq #i386/i386/apic_vector.s optional apic i386/i386/atomic.c standard \ compile-with "${CC} -c ${CFLAGS} ${DEFINED_PROF:S/^$/-fomit-frame-pointer/} ${.IMPSRC}" i386/i386/autoconf.c standard i386/i386/bios.c standard i386/i386/bioscall.s standard i386/i386/bpf_jit_machdep.c optional bpf_jitter i386/i386/busdma_machdep.c standard i386/i386/db_disasm.c optional ddb i386/i386/db_interface.c optional ddb i386/i386/db_trace.c optional ddb i386/i386/dump_machdep.c standard i386/i386/elan-mmcr.c optional cpu_elan | cpu_soekris i386/i386/elf_machdep.c standard i386/i386/exception.s standard i386/i386/gdb_machdep.c optional gdb i386/i386/geode.c optional cpu_geode i386/i386/i686_mem.c optional mem i386/i386/identcpu.c standard i386/i386/in_cksum.c optional inet i386/i386/initcpu.c standard i386/i386/intr_machdep.c standard i386/i386/io.c optional io i386/i386/io_apic.c optional apic i386/i386/k6_mem.c optional mem i386/i386/legacy.c standard i386/i386/local_apic.c optional apic i386/i386/locore.s standard no-obj i386/i386/longrun.c optional cpu_enable_longrun i386/i386/machdep.c standard i386/i386/mem.c optional mem i386/i386/minidump_machdep.c standard i386/i386/mp_clock.c optional smp i386/i386/mp_machdep.c optional smp i386/i386/mp_watchdog.c optional mp_watchdog smp i386/i386/mpboot.s optional smp i386/i386/mptable.c optional apic i386/i386/mptable_pci.c optional apic pci i386/i386/nexus.c standard i386/i386/perfmon.c optional perfmon i386/i386/pmap.c standard i386/i386/ptrace_machdep.c standard i386/i386/support.s standard i386/i386/swtch.s standard i386/i386/sys_machdep.c standard i386/i386/trap.c standard i386/i386/tsc.c standard i386/i386/uio_machdep.c standard i386/i386/vm86.c standard i386/i386/vm_machdep.c standard i386/ibcs2/ibcs2_errno.c optional ibcs2 i386/ibcs2/ibcs2_fcntl.c optional ibcs2 i386/ibcs2/ibcs2_ioctl.c optional ibcs2 i386/ibcs2/ibcs2_ipc.c optional ibcs2 i386/ibcs2/ibcs2_isc.c optional ibcs2 i386/ibcs2/ibcs2_isc_sysent.c optional ibcs2 i386/ibcs2/ibcs2_misc.c optional ibcs2 i386/ibcs2/ibcs2_msg.c optional ibcs2 i386/ibcs2/ibcs2_other.c optional ibcs2 i386/ibcs2/ibcs2_signal.c optional ibcs2 i386/ibcs2/ibcs2_socksys.c optional ibcs2 i386/ibcs2/ibcs2_stat.c optional ibcs2 i386/ibcs2/ibcs2_sysent.c optional ibcs2 i386/ibcs2/ibcs2_sysi86.c optional ibcs2 i386/ibcs2/ibcs2_sysvec.c optional ibcs2 i386/ibcs2/ibcs2_util.c optional ibcs2 i386/ibcs2/ibcs2_xenix.c optional ibcs2 i386/ibcs2/ibcs2_xenix_sysent.c optional ibcs2 i386/ibcs2/imgact_coff.c optional ibcs2 i386/isa/atpic.c standard #i386/isa/atpic_vector.s standard i386/isa/clock.c standard i386/isa/elcr.c standard i386/isa/elink.c optional ep | ie i386/isa/isa.c optional isa i386/isa/isa_dma.c optional isa i386/isa/nmi.c standard i386/isa/npx.c optional npx i386/isa/pmtimer.c optional pmtimer i386/isa/prof_machdep.c optional profiling-routine i386/isa/spic.c optional spic i386/isa/vesa.c optional vga vesa i386/linux/imgact_linux.c optional compat_linux i386/linux/linux_dummy.c optional compat_linux i386/linux/linux_locore.s optional compat_linux \ dependency "linux_assym.h" i386/linux/linux_machdep.c optional compat_linux i386/linux/linux_ptrace.c optional compat_linux i386/linux/linux_sysent.c optional compat_linux i386/linux/linux_sysvec.c optional compat_linux i386/pci/pci_bus.c optional pci i386/pci/pci_cfgreg.c optional pci i386/pci/pci_pir.c optional pci i386/svr4/svr4_locore.s optional compat_svr4 \ dependency "svr4_assym.h" \ warning "COMPAT_SVR4 is broken and should be avoided" i386/svr4/svr4_machdep.c optional compat_svr4 # # isdn4bsd, needed for isic | iwic | ifpi | ifpi2 | ihfc | ifpnp | itjc # i4b/layer1/i4b_hdlc.c optional ihfc | itjc i4b/layer1/i4b_l1dmux.c optional ifpi | ifpi2 | ifpnp | \ ihfc | isic | itjc | iwic i4b/layer1/i4b_l1lib.c optional ifpi | ifpi2 | ifpnp | \ ihfc | isic | itjc | iwic # # isdn4bsd, isic # i4b/layer1/isic/i4b_asuscom_ipac.c optional isic i4b/layer1/isic/i4b_avm_a1.c optional isic i4b/layer1/isic/i4b_bchan.c optional isic i4b/layer1/isic/i4b_ctx_s0P.c optional isic i4b/layer1/isic/i4b_drn_ngo.c optional isic i4b/layer1/isic/i4b_dynalink.c optional isic i4b/layer1/isic/i4b_elsa_qs1i.c optional isic i4b/layer1/isic/i4b_elsa_qs1p.c optional isic pci i4b/layer1/isic/i4b_elsa_pcc16.c optional isic i4b/layer1/isic/i4b_hscx.c optional isic i4b/layer1/isic/i4b_isac.c optional isic i4b/layer1/isic/i4b_isic.c optional isic i4b/layer1/isic/i4b_isic_isa.c optional isic i4b/layer1/isic/i4b_isic_pnp.c optional isic i4b/layer1/isic/i4b_itk_ix1.c optional isic i4b/layer1/isic/i4b_l1.c optional isic i4b/layer1/isic/i4b_l1fsm.c optional isic i4b/layer1/isic/i4b_siemens_isurf.c optional isic i4b/layer1/isic/i4b_sws.c optional isic i4b/layer1/isic/i4b_tel_s016.c optional isic i4b/layer1/isic/i4b_tel_s0163.c optional isic i4b/layer1/isic/i4b_tel_s08.c optional isic i4b/layer1/isic/i4b_usr_sti.c optional isic i4b/layer1/isic/i4b_diva.c optional isic # # isdn4bsd, iwic # i4b/layer1/iwic/i4b_iwic_pci.c optional iwic pci i4b/layer1/iwic/i4b_iwic_dchan.c optional iwic pci i4b/layer1/iwic/i4b_iwic_bchan.c optional iwic pci i4b/layer1/iwic/i4b_iwic_fsm.c optional iwic pci i4b/layer1/iwic/i4b_iwic_l1if.c optional iwic pci # # isdn4bsd, ifpi # i4b/layer1/ifpi/i4b_ifpi_pci.c optional ifpi pci i4b/layer1/ifpi/i4b_ifpi_isac.c optional ifpi pci i4b/layer1/ifpi/i4b_ifpi_l1.c optional ifpi pci i4b/layer1/ifpi/i4b_ifpi_l1fsm.c optional ifpi pci # # isdn4bsd, ifpi2 # i4b/layer1/ifpi2/i4b_ifpi2_pci.c optional ifpi2 pci i4b/layer1/ifpi2/i4b_ifpi2_isacsx.c optional ifpi2 pci i4b/layer1/ifpi2/i4b_ifpi2_l1.c optional ifpi2 pci i4b/layer1/ifpi2/i4b_ifpi2_l1fsm.c optional ifpi2 pci # # isdn4bsd, ifpnp # i4b/layer1/ifpnp/i4b_ifpnp_avm.c optional ifpnp i4b/layer1/ifpnp/i4b_ifpnp_isac.c optional ifpnp i4b/layer1/ifpnp/i4b_ifpnp_l1.c optional ifpnp i4b/layer1/ifpnp/i4b_ifpnp_l1fsm.c optional ifpnp # # isdn4bsd, ihfc # i4b/layer1/ihfc/i4b_ihfc_l1if.c optional ihfc i4b/layer1/ihfc/i4b_ihfc_pnp.c optional ihfc i4b/layer1/ihfc/i4b_ihfc_drv.c optional ihfc # # isdn4bsd, itjc # i4b/layer1/itjc/i4b_itjc_pci.c optional itjc i4b/layer1/itjc/i4b_itjc_isac.c optional itjc i4b/layer1/itjc/i4b_itjc_l1.c optional itjc i4b/layer1/itjc/i4b_itjc_l1fsm.c optional itjc # isa/syscons_isa.c optional sc isa/vga_isa.c optional vga kern/imgact_aout.c optional compat_aout kern/imgact_gzip.c optional gzip libkern/divdi3.c standard libkern/ffsl.c standard libkern/flsl.c standard libkern/moddi3.c standard libkern/qdivrem.c standard libkern/ucmpdi2.c standard libkern/udivdi3.c standard libkern/umoddi3.c standard pci/agp_ali.c optional agp pci/agp_amd.c optional agp pci/agp_amd64.c optional agp pci/agp_ati.c optional agp pci/agp_i810.c optional agp pci/agp_intel.c optional agp pci/agp_nvidia.c optional agp pci/agp_sis.c optional agp pci/agp_via.c optional agp i386/xbox/xbox.c optional xbox i386/xbox/xboxfb.c optional xboxfb dev/fb/boot_font.c optional xboxfb i386/xbox/pic16l.s optional xbox Index: head/sys/dev/nfe/if_nfe.c =================================================================== --- head/sys/dev/nfe/if_nfe.c (revision 159966) +++ head/sys/dev/nfe/if_nfe.c (revision 159967) @@ -1,1731 +1,2127 @@ -/* $OpenBSD: if_nfe.c,v 1.57 2006/04/26 02:07:29 jsg Exp $ */ +/* $OpenBSD: if_nfe.c,v 1.54 2006/04/07 12:38:12 jsg Exp $ */ /*- + * Copyright (c) 2006 Shigeaki Tagashira * Copyright (c) 2006 Damien Bergamini * Copyright (c) 2005, 2006 Jonathan Gray * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* Driver for NVIDIA nForce MCP Fast Ethernet and Gigabit Ethernet */ -#include "bpfilter.h" -#include "vlan.h" +#include +__FBSDID("$FreeBSD$"); +/* Uncomment the following line to enable polling. */ +/* #define DEVICE_POLLING */ + +#define NFE_NO_JUMBO +#define NFE_CSUM +#define NFE_CSUM_FEATURES (CSUM_IP | CSUM_TCP | CSUM_UDP) +#define NVLAN 0 + +#ifdef HAVE_KERNEL_OPTION_HEADERS +#include "opt_device_polling.h" +#endif + #include #include #include -#include #include #include -#include #include +#include #include -#include #include +#include -#include - #include +#include +#include #include #include - -#ifdef INET -#include -#include -#include -#include -#include -#endif - -#if NVLAN > 0 #include #include -#endif -#if NBPFILTER > 0 #include -#endif +#include +#include +#include +#include + #include #include #include #include -#include -#include -#include +#include +#include -int nfe_match(struct device *, void *, void *); -void nfe_attach(struct device *, struct device *, void *); -void nfe_power(int, void *); -void nfe_miibus_statchg(struct device *); -int nfe_miibus_readreg(struct device *, int, int); -void nfe_miibus_writereg(struct device *, int, int, int); -int nfe_intr(void *); -int nfe_ioctl(struct ifnet *, u_long, caddr_t); -void nfe_txdesc32_sync(struct nfe_softc *, struct nfe_desc32 *, int); -void nfe_txdesc64_sync(struct nfe_softc *, struct nfe_desc64 *, int); -void nfe_txdesc32_rsync(struct nfe_softc *, int, int, int); -void nfe_txdesc64_rsync(struct nfe_softc *, int, int, int); -void nfe_rxdesc32_sync(struct nfe_softc *, struct nfe_desc32 *, int); -void nfe_rxdesc64_sync(struct nfe_softc *, struct nfe_desc64 *, int); -void nfe_rxeof(struct nfe_softc *); -void nfe_txeof(struct nfe_softc *); -int nfe_encap(struct nfe_softc *, struct mbuf *); -void nfe_start(struct ifnet *); -void nfe_watchdog(struct ifnet *); -int nfe_init(struct ifnet *); -void nfe_stop(struct ifnet *, int); -struct nfe_jbuf *nfe_jalloc(struct nfe_softc *); -void nfe_jfree(caddr_t, u_int, void *); -int nfe_jpool_alloc(struct nfe_softc *); -void nfe_jpool_free(struct nfe_softc *); -int nfe_alloc_rx_ring(struct nfe_softc *, struct nfe_rx_ring *); -void nfe_reset_rx_ring(struct nfe_softc *, struct nfe_rx_ring *); -void nfe_free_rx_ring(struct nfe_softc *, struct nfe_rx_ring *); -int nfe_alloc_tx_ring(struct nfe_softc *, struct nfe_tx_ring *); -void nfe_reset_tx_ring(struct nfe_softc *, struct nfe_tx_ring *); -void nfe_free_tx_ring(struct nfe_softc *, struct nfe_tx_ring *); -int nfe_ifmedia_upd(struct ifnet *); -void nfe_ifmedia_sts(struct ifnet *, struct ifmediareq *); -void nfe_setmulti(struct nfe_softc *); -void nfe_get_macaddr(struct nfe_softc *, uint8_t *); -void nfe_set_macaddr(struct nfe_softc *, const uint8_t *); -void nfe_tick(void *); +MODULE_DEPEND(nfe, pci, 1, 1, 1); +MODULE_DEPEND(nfe, ether, 1, 1, 1); +MODULE_DEPEND(nfe, miibus, 1, 1, 1); +#include "miibus_if.h" -struct cfattach nfe_ca = { - sizeof (struct nfe_softc), nfe_match, nfe_attach -}; +static int nfe_probe (device_t); +static int nfe_attach (device_t); +static int nfe_detach (device_t); +static void nfe_shutdown(device_t); +static int nfe_miibus_readreg (device_t, int, int); +static int nfe_miibus_writereg (device_t, int, int, int); +static void nfe_miibus_statchg (device_t); +static int nfe_ioctl(struct ifnet *, u_long, caddr_t); +static void nfe_intr(void *); +static void nfe_txdesc32_sync(struct nfe_softc *, struct nfe_desc32 *, int); +static void nfe_txdesc64_sync(struct nfe_softc *, struct nfe_desc64 *, int); +static void nfe_txdesc32_rsync(struct nfe_softc *, int, int, int); +static void nfe_txdesc64_rsync(struct nfe_softc *, int, int, int); +static void nfe_rxdesc32_sync(struct nfe_softc *, struct nfe_desc32 *, int); +static void nfe_rxdesc64_sync(struct nfe_softc *, struct nfe_desc64 *, int); +static void nfe_rxeof(struct nfe_softc *); +static void nfe_txeof(struct nfe_softc *); +static int nfe_encap(struct nfe_softc *, struct mbuf *); +static struct nfe_jbuf *nfe_jalloc(struct nfe_softc *); +static void nfe_jfree(void *, void *); +static int nfe_jpool_alloc(struct nfe_softc *); +static void nfe_jpool_free(struct nfe_softc *); +static void nfe_setmulti(struct nfe_softc *); +static void nfe_start(struct ifnet *); +static void nfe_start_locked(struct ifnet *); +static void nfe_watchdog(struct ifnet *); +static void nfe_init(void *); +static void nfe_init_locked(void *); +static void nfe_stop(struct ifnet *, int); +static int nfe_alloc_rx_ring(struct nfe_softc *, struct nfe_rx_ring *); +static void nfe_reset_rx_ring(struct nfe_softc *, struct nfe_rx_ring *); +static void nfe_free_rx_ring(struct nfe_softc *, struct nfe_rx_ring *); +static int nfe_alloc_tx_ring(struct nfe_softc *, struct nfe_tx_ring *); +static void nfe_reset_tx_ring(struct nfe_softc *, struct nfe_tx_ring *); +static void nfe_free_tx_ring(struct nfe_softc *, struct nfe_tx_ring *); +static int nfe_ifmedia_upd(struct ifnet *); +static int nfe_ifmedia_upd_locked(struct ifnet *); +static void nfe_ifmedia_sts(struct ifnet *, struct ifmediareq *); +static void nfe_tick(void *); +static void nfe_tick_locked(struct nfe_softc *); +static void nfe_get_macaddr(struct nfe_softc *, u_char *); +static void nfe_set_macaddr(struct nfe_softc *, u_char *); +static void nfe_dma_map_segs (void *, bus_dma_segment_t *, int, int); +#ifdef DEVICE_POLLING +static void nfe_poll_locked(struct ifnet *, enum poll_cmd, int); +#endif -struct cfdriver nfe_cd = { - NULL, "nfe", DV_IFNET -}; - -/*#define NFE_NO_JUMBO*/ - #ifdef NFE_DEBUG int nfedebug = 0; #define DPRINTF(x) do { if (nfedebug) printf x; } while (0) #define DPRINTFN(n,x) do { if (nfedebug >= (n)) printf x; } while (0) #else #define DPRINTF(x) #define DPRINTFN(n,x) #endif -const struct pci_matchid nfe_devices[] = { - { PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE_LAN }, - { PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE2_LAN }, - { PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE3_LAN1 }, - { PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE3_LAN2 }, - { PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE3_LAN3 }, - { PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE3_LAN4 }, - { PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE3_LAN5 }, - { PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_CK804_LAN1 }, - { PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_CK804_LAN2 }, - { PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP04_LAN1 }, - { PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP04_LAN2 }, - { PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP51_LAN1 }, - { PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP51_LAN2 }, - { PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP55_LAN1 }, - { PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP55_LAN2 } +#define NFE_LOCK(_sc) mtx_lock(&(_sc)->nfe_mtx) +#define NFE_UNLOCK(_sc) mtx_unlock(&(_sc)->nfe_mtx) +#define NFE_LOCK_ASSERT(_sc) mtx_assert(&(_sc)->nfe_mtx, MA_OWNED) + +#define letoh16(x) le16toh(x) + +#define NV_RID 0x10 + +static device_method_t nfe_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, nfe_probe), + DEVMETHOD(device_attach, nfe_attach), + DEVMETHOD(device_detach, nfe_detach), + DEVMETHOD(device_shutdown, nfe_shutdown), + + /* bus interface */ + DEVMETHOD(bus_print_child, bus_generic_print_child), + DEVMETHOD(bus_driver_added, bus_generic_driver_added), + + /* MII interface */ + DEVMETHOD(miibus_readreg, nfe_miibus_readreg), + DEVMETHOD(miibus_writereg, nfe_miibus_writereg), + DEVMETHOD(miibus_statchg, nfe_miibus_statchg), + + { 0, 0 } }; -int -nfe_match(struct device *dev, void *match, void *aux) +static driver_t nfe_driver = { + "nfe", + nfe_methods, + sizeof(struct nfe_softc) +}; + +static devclass_t nfe_devclass; + +DRIVER_MODULE(nfe, pci, nfe_driver, nfe_devclass, 0, 0); +DRIVER_MODULE(miibus, nfe, miibus_driver, miibus_devclass, 0, 0); + +static struct nfe_type nfe_devs[] = { + {PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE_LAN, + "NVIDIA nForce Networking Adapter"}, + {PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE2_LAN, + "NVIDIA nForce2 Networking Adapter"}, + {PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE3_LAN1, + "NVIDIA nForce3 Networking Adapter"}, + {PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE2_400_LAN1, + "NVIDIA nForce2 400 Networking Adapter"}, + {PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE2_400_LAN2, + "NVIDIA nForce2 400 Networking Adapter"}, + {PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE3_250_LAN, + "NVIDIA nForce3 250 Networking Adapter"}, + {PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE3_LAN4, + "NVIDIA nForce3 Networking Adapter"}, + {PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE4_LAN1, + "NVIDIA nForce4 Networking Adapter"}, + {PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE4_LAN2, + "NVIDIA nForce4 Networking Adapter"}, + {PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP04_LAN1, + "NVIDIA nForce MCP04 Networking Adapter"}, + {PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP04_LAN2, + "NVIDIA nForce MCP04 Networking Adapter"}, + {PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE430_LAN1, + "NVIDIA nForce 430 Networking Adapter"}, + {PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE430_LAN2, + "NVIDIA nForce 430 Networking Adapter"}, + {PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP55_LAN1, + "NVIDIA nForce MCP55 Networking Adapter"}, + {PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP55_LAN2, + "NVIDIA nForce MCP55 Networking Adapter"}, + {0, 0, NULL} +}; + + +/* Probe for supported hardware ID's */ +static int +nfe_probe(device_t dev) { - return pci_matchbyid((struct pci_attach_args *)aux, nfe_devices, - sizeof (nfe_devices) / sizeof (nfe_devices[0])); + struct nfe_type *t; + + t = nfe_devs; + /* Check for matching PCI DEVICE ID's */ + while (t->name != NULL) { + if ((pci_get_vendor(dev) == t->vid_id) && + (pci_get_device(dev) == t->dev_id)) { + device_set_desc(dev, t->name); + return (0); + } + t++; + } + + return (ENXIO); } -void -nfe_attach(struct device *parent, struct device *self, void *aux) +static int +nfe_attach(device_t dev) { - struct nfe_softc *sc = (struct nfe_softc *)self; - struct pci_attach_args *pa = aux; - pci_chipset_tag_t pc = pa->pa_pc; - pci_intr_handle_t ih; - const char *intrstr; + struct nfe_softc *sc; struct ifnet *ifp; - bus_size_t memsize; - pcireg_t memtype; + int unit, error = 0, rid; - memtype = pci_mapreg_type(pa->pa_pc, pa->pa_tag, NFE_PCI_BA); - switch (memtype) { - case PCI_MAPREG_TYPE_MEM | PCI_MAPREG_MEM_TYPE_32BIT: - case PCI_MAPREG_TYPE_MEM | PCI_MAPREG_MEM_TYPE_64BIT: - if (pci_mapreg_map(pa, NFE_PCI_BA, memtype, 0, &sc->sc_memt, - &sc->sc_memh, NULL, &memsize, 0) == 0) - break; - /* FALLTHROUGH */ - default: - printf(": could not map mem space\n"); - return; - } + sc = device_get_softc(dev); + unit = device_get_unit(dev); + sc->nfe_dev = dev; + sc->nfe_unit = unit; - if (pci_intr_map(pa, &ih) != 0) { - printf(": could not map interrupt\n"); - return; - } + mtx_init(&sc->nfe_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK, + MTX_DEF | MTX_RECURSE); + callout_init_mtx(&sc->nfe_stat_ch, &sc->nfe_mtx, 0); - intrstr = pci_intr_string(pc, ih); - sc->sc_ih = pci_intr_establish(pc, ih, IPL_NET, nfe_intr, sc, - sc->sc_dev.dv_xname); - if (sc->sc_ih == NULL) { - printf(": could not establish interrupt"); - if (intrstr != NULL) - printf(" at %s", intrstr); - printf("\n"); - return; + + pci_enable_busmaster(dev); + + rid = NV_RID; + sc->nfe_res = bus_alloc_resource(dev, SYS_RES_MEMORY, &rid, + 0, ~0, 1, RF_ACTIVE); + + if (sc->nfe_res == NULL) { + printf ("nfe%d: couldn't map ports/memory\n", unit); + error = ENXIO; + goto fail; } - printf(": %s", intrstr); - sc->sc_dmat = pa->pa_dmat; + sc->nfe_memt = rman_get_bustag(sc->nfe_res); + sc->nfe_memh = rman_get_bushandle(sc->nfe_res); - nfe_get_macaddr(sc, sc->sc_arpcom.ac_enaddr); - printf(", address %s\n", ether_sprintf(sc->sc_arpcom.ac_enaddr)); + /* Allocate interrupt */ + rid = 0; + sc->nfe_irq = bus_alloc_resource(dev, SYS_RES_IRQ, &rid, + 0, ~0, 1, RF_SHAREABLE | RF_ACTIVE); - sc->sc_flags = 0; + if (sc->nfe_irq == NULL) { + printf("nfe%d: couldn't map interrupt\n", unit); + error = ENXIO; + goto fail; + } - switch (PCI_PRODUCT(pa->pa_id)) { + nfe_get_macaddr(sc, sc->eaddr); + + sc->nfe_flags = 0; + + switch (pci_get_device(dev)) { case PCI_PRODUCT_NVIDIA_NFORCE3_LAN2: case PCI_PRODUCT_NVIDIA_NFORCE3_LAN3: case PCI_PRODUCT_NVIDIA_NFORCE3_LAN4: case PCI_PRODUCT_NVIDIA_NFORCE3_LAN5: - sc->sc_flags |= NFE_JUMBO_SUP | NFE_HW_CSUM; + sc->nfe_flags |= NFE_JUMBO_SUP | NFE_HW_CSUM; break; case PCI_PRODUCT_NVIDIA_MCP51_LAN1: case PCI_PRODUCT_NVIDIA_MCP51_LAN2: - sc->sc_flags |= NFE_40BIT_ADDR; + sc->nfe_flags |= NFE_40BIT_ADDR; break; case PCI_PRODUCT_NVIDIA_CK804_LAN1: case PCI_PRODUCT_NVIDIA_CK804_LAN2: case PCI_PRODUCT_NVIDIA_MCP04_LAN1: case PCI_PRODUCT_NVIDIA_MCP04_LAN2: - sc->sc_flags |= NFE_JUMBO_SUP | NFE_40BIT_ADDR | NFE_HW_CSUM; + sc->nfe_flags |= NFE_JUMBO_SUP | NFE_40BIT_ADDR | NFE_HW_CSUM; break; case PCI_PRODUCT_NVIDIA_MCP55_LAN1: case PCI_PRODUCT_NVIDIA_MCP55_LAN2: - sc->sc_flags |= NFE_JUMBO_SUP | NFE_40BIT_ADDR | NFE_HW_CSUM | - NFE_HW_VLAN; + sc->nfe_flags |= NFE_JUMBO_SUP | NFE_40BIT_ADDR | NFE_HW_CSUM | NFE_HW_VLAN; break; } #ifndef NFE_NO_JUMBO /* enable jumbo frames for adapters that support it */ - if (sc->sc_flags & NFE_JUMBO_SUP) - sc->sc_flags |= NFE_USE_JUMBO; + if (sc->nfe_flags & NFE_JUMBO_SUP) + sc->nfe_flags |= NFE_USE_JUMBO; #endif /* + * Allocate the parent bus DMA tag appropriate for PCI. + */ +#define NFE_NSEG_NEW 32 + error = bus_dma_tag_create(NULL, /* parent */ + 1, 0, /* alignment, boundary */ + BUS_SPACE_MAXADDR_32BIT,/* lowaddr */ + BUS_SPACE_MAXADDR, /* highaddr */ + NULL, NULL, /* filter, filterarg */ + MAXBSIZE, NFE_NSEG_NEW, /* maxsize, nsegments */ + BUS_SPACE_MAXSIZE_32BIT,/* maxsegsize */ + BUS_DMA_ALLOCNOW, /* flags */ + NULL, NULL, /* lockfunc, lockarg */ + &sc->nfe_parent_tag); + if (error) + goto fail; + + /* * Allocate Tx and Rx rings. */ if (nfe_alloc_tx_ring(sc, &sc->txq) != 0) { - printf("%s: could not allocate Tx ring\n", - sc->sc_dev.dv_xname); - return; + printf("nfe%d: could not allocate Tx ring\n", unit); + error = ENXIO; + goto fail; } if (nfe_alloc_rx_ring(sc, &sc->rxq) != 0) { - printf("%s: could not allocate Rx ring\n", - sc->sc_dev.dv_xname); + printf("nfe%d: could not allocate Rx ring\n", unit); nfe_free_tx_ring(sc, &sc->txq); - return; + error = ENXIO; + goto fail; } - ifp = &sc->sc_arpcom.ac_if; + ifp = sc->nfe_ifp = if_alloc(IFT_ETHER); + if (ifp == NULL) { + printf("nfe%d: can not if_alloc()\n", unit); + error = ENOSPC; + goto fail; + } + ifp->if_softc = sc; + if_initname(ifp, device_get_name(dev), device_get_unit(dev)); + ifp->if_mtu = ETHERMTU; ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; ifp->if_ioctl = nfe_ioctl; ifp->if_start = nfe_start; + /* ifp->if_hwassist = NFE_CSUM_FEATURES; */ ifp->if_watchdog = nfe_watchdog; ifp->if_init = nfe_init; ifp->if_baudrate = IF_Gbps(1); - IFQ_SET_MAXLEN(&ifp->if_snd, NFE_IFQ_MAXLEN); - IFQ_SET_READY(&ifp->if_snd); - strlcpy(ifp->if_xname, sc->sc_dev.dv_xname, IFNAMSIZ); + ifp->if_snd.ifq_maxlen = NFE_IFQ_MAXLEN; ifp->if_capabilities = IFCAP_VLAN_MTU; #if NVLAN > 0 - if (sc->sc_flags & NFE_HW_VLAN) + if (sc->nfe_flags & NFE_HW_VLAN) ifp->if_capabilities |= IFCAP_VLAN_HWTAGGING; #endif #ifdef NFE_CSUM - if (sc->sc_flags & NFE_HW_CSUM) { - ifp->if_capabilities |= IFCAP_CSUM_IPv4 | IFCAP_CSUM_TCPv4 | - IFCAP_CSUM_UDPv4; + if (sc->nfe_flags & NFE_HW_CSUM) { + ifp->if_capabilities |= IFCAP_HWCSUM; } #endif + ifp->if_capenable = ifp->if_capabilities; - sc->sc_mii.mii_ifp = ifp; - sc->sc_mii.mii_readreg = nfe_miibus_readreg; - sc->sc_mii.mii_writereg = nfe_miibus_writereg; - sc->sc_mii.mii_statchg = nfe_miibus_statchg; +#ifdef DEVICE_POLLING + ifp->if_capabilities |= IFCAP_POLLING; +#endif - ifmedia_init(&sc->sc_mii.mii_media, 0, nfe_ifmedia_upd, - nfe_ifmedia_sts); - mii_attach(self, &sc->sc_mii, 0xffffffff, MII_PHY_ANY, - MII_OFFSET_ANY, 0); - if (LIST_FIRST(&sc->sc_mii.mii_phys) == NULL) { - printf("%s: no PHY found!\n", sc->sc_dev.dv_xname); - ifmedia_add(&sc->sc_mii.mii_media, IFM_ETHER | IFM_MANUAL, - 0, NULL); - ifmedia_set(&sc->sc_mii.mii_media, IFM_ETHER | IFM_MANUAL); - } else - ifmedia_set(&sc->sc_mii.mii_media, IFM_ETHER | IFM_AUTO); + /* Do MII setup */ + if (mii_phy_probe(dev, &sc->nfe_miibus, nfe_ifmedia_upd, nfe_ifmedia_sts)) { + printf("nfe%d: MII without any phy!\n", unit); + error = ENXIO; + goto fail; + } - if_attach(ifp); - ether_ifattach(ifp); + ether_ifattach(ifp, sc->eaddr); - timeout_set(&sc->sc_tick_ch, nfe_tick, sc); + error = bus_setup_intr(dev, sc->nfe_irq, INTR_TYPE_NET|INTR_MPSAFE, + nfe_intr, sc, &sc->nfe_intrhand); - sc->sc_powerhook = powerhook_establish(nfe_power, sc); + if (error) { + printf("nfe%d: couldn't set up irq\n", unit); + ether_ifdetach(ifp); + goto fail; + } + +fail: + if (error) + nfe_detach(dev); + + return (error); } -void -nfe_power(int why, void *arg) + +static int +nfe_detach(device_t dev) { - struct nfe_softc *sc = arg; - struct ifnet *ifp; + struct nfe_softc *sc; + struct ifnet *ifp; + u_char eaddr[ETHER_ADDR_LEN]; + int i; - if (why == PWR_RESUME) { - ifp = &sc->sc_arpcom.ac_if; - if (ifp->if_flags & IFF_UP) { - nfe_init(ifp); - if (ifp->if_flags & IFF_RUNNING) - nfe_start(ifp); - } + sc = device_get_softc(dev); + KASSERT(mtx_initialized(&sc->nfe_mtx), ("nfe mutex not initialized")); + ifp = sc->nfe_ifp; + +#ifdef DEVICE_POLLING + if (ifp->if_capenable & IFCAP_POLLING) + ether_poll_deregister(ifp); +#endif + + for (i = 0; i < ETHER_ADDR_LEN; i++) { + eaddr[i] = sc->eaddr[5 - i]; } + nfe_set_macaddr(sc, eaddr); + + if (device_is_attached(dev)) { + nfe_stop(ifp, 1); + ifp->if_flags &= ~IFF_UP; + callout_drain(&sc->nfe_stat_ch); + ether_ifdetach(ifp); + } + + if (ifp) + if_free(ifp); + if (sc->nfe_miibus) + device_delete_child(dev, sc->nfe_miibus); + bus_generic_detach(dev); + + if (sc->nfe_intrhand) + bus_teardown_intr(dev, sc->nfe_irq, sc->nfe_intrhand); + if (sc->nfe_irq) + bus_release_resource(dev, SYS_RES_IRQ, 0, sc->nfe_irq); + if (sc->nfe_res) + bus_release_resource(dev, SYS_RES_MEMORY, NV_RID, sc->nfe_res); + + nfe_free_tx_ring(sc, &sc->txq); + nfe_free_rx_ring(sc, &sc->rxq); + + if (sc->nfe_parent_tag) + bus_dma_tag_destroy(sc->nfe_parent_tag); + + mtx_destroy(&sc->nfe_mtx); + + return (0); } -void -nfe_miibus_statchg(struct device *dev) + +static void +nfe_miibus_statchg(device_t dev) { - struct nfe_softc *sc = (struct nfe_softc *)dev; - struct mii_data *mii = &sc->sc_mii; - uint32_t phy, seed, misc = NFE_MISC1_MAGIC, link = NFE_MEDIA_SET; + struct nfe_softc *sc; + struct mii_data *mii; + u_int32_t phy, seed, misc = NFE_MISC1_MAGIC, link = NFE_MEDIA_SET; + sc = device_get_softc(dev); + mii = device_get_softc(sc->nfe_miibus); + phy = NFE_READ(sc, NFE_PHY_IFACE); phy &= ~(NFE_PHY_HDX | NFE_PHY_100TX | NFE_PHY_1000T); seed = NFE_READ(sc, NFE_RNDSEED); seed &= ~NFE_SEED_MASK; if ((mii->mii_media_active & IFM_GMASK) == IFM_HDX) { phy |= NFE_PHY_HDX; /* half-duplex */ misc |= NFE_MISC1_HDX; } switch (IFM_SUBTYPE(mii->mii_media_active)) { case IFM_1000_T: /* full-duplex only */ link |= NFE_MEDIA_1000T; seed |= NFE_SEED_1000T; phy |= NFE_PHY_1000T; break; case IFM_100_TX: link |= NFE_MEDIA_100TX; seed |= NFE_SEED_100TX; phy |= NFE_PHY_100TX; break; case IFM_10_T: link |= NFE_MEDIA_10T; seed |= NFE_SEED_10T; break; } NFE_WRITE(sc, NFE_RNDSEED, seed); /* XXX: gigabit NICs only? */ NFE_WRITE(sc, NFE_PHY_IFACE, phy); NFE_WRITE(sc, NFE_MISC1, misc); NFE_WRITE(sc, NFE_LINKSPEED, link); } -int -nfe_miibus_readreg(struct device *dev, int phy, int reg) +static int +nfe_miibus_readreg(device_t dev, int phy, int reg) { - struct nfe_softc *sc = (struct nfe_softc *)dev; - uint32_t val; + struct nfe_softc *sc = device_get_softc(dev); + u_int32_t val; int ntries; NFE_WRITE(sc, NFE_PHY_STATUS, 0xf); if (NFE_READ(sc, NFE_PHY_CTL) & NFE_PHY_BUSY) { NFE_WRITE(sc, NFE_PHY_CTL, NFE_PHY_BUSY); DELAY(100); } NFE_WRITE(sc, NFE_PHY_CTL, (phy << NFE_PHYADD_SHIFT) | reg); for (ntries = 0; ntries < 1000; ntries++) { DELAY(100); if (!(NFE_READ(sc, NFE_PHY_CTL) & NFE_PHY_BUSY)) break; } if (ntries == 1000) { - DPRINTFN(2, ("%s: timeout waiting for PHY\n", - sc->sc_dev.dv_xname)); + DPRINTFN(2, ("nfe%d: timeout waiting for PHY\n", sc->nfe_unit)); return 0; } if (NFE_READ(sc, NFE_PHY_STATUS) & NFE_PHY_ERROR) { - DPRINTFN(2, ("%s: could not read PHY\n", - sc->sc_dev.dv_xname)); + DPRINTFN(2, ("nfe%d: could not read PHY\n", sc->nfe_unit)); return 0; } val = NFE_READ(sc, NFE_PHY_DATA); if (val != 0xffffffff && val != 0) sc->mii_phyaddr = phy; - DPRINTFN(2, ("%s: mii read phy %d reg 0x%x ret 0x%x\n", - sc->sc_dev.dv_xname, phy, reg, val)); + DPRINTFN(2, ("nfe%d: mii read phy %d reg 0x%x ret 0x%x\n", sc->nfe_unit, phy, reg, val)); return val; } -void -nfe_miibus_writereg(struct device *dev, int phy, int reg, int val) +static int +nfe_miibus_writereg(device_t dev, int phy, int reg, int val) { - struct nfe_softc *sc = (struct nfe_softc *)dev; - uint32_t ctl; - int ntries; + struct nfe_softc *sc = device_get_softc(dev); + u_int32_t ctl; + int ntries; NFE_WRITE(sc, NFE_PHY_STATUS, 0xf); if (NFE_READ(sc, NFE_PHY_CTL) & NFE_PHY_BUSY) { NFE_WRITE(sc, NFE_PHY_CTL, NFE_PHY_BUSY); DELAY(100); } NFE_WRITE(sc, NFE_PHY_DATA, val); ctl = NFE_PHY_WRITE | (phy << NFE_PHYADD_SHIFT) | reg; NFE_WRITE(sc, NFE_PHY_CTL, ctl); for (ntries = 0; ntries < 1000; ntries++) { DELAY(100); if (!(NFE_READ(sc, NFE_PHY_CTL) & NFE_PHY_BUSY)) break; } #ifdef NFE_DEBUG if (nfedebug >= 2 && ntries == 1000) printf("could not write to PHY\n"); #endif + return 0; } -int -nfe_intr(void *arg) +static int +nfe_alloc_rx_ring(struct nfe_softc *sc, struct nfe_rx_ring *ring) { + struct nfe_desc32 *desc32; + struct nfe_desc64 *desc64; + struct nfe_rx_data *data; + struct nfe_jbuf *jbuf; + void **desc; + bus_addr_t physaddr; + int i, error, descsize; + + if (sc->nfe_flags & NFE_40BIT_ADDR) { + desc = (void **)&ring->desc64; + descsize = sizeof (struct nfe_desc64); + } else { + desc = (void **)&ring->desc32; + descsize = sizeof (struct nfe_desc32); + } + + ring->cur = ring->next = 0; + ring->bufsz = MCLBYTES; + + error = bus_dma_tag_create(sc->nfe_parent_tag, + PAGE_SIZE, 0, /* alignment, boundary */ + BUS_SPACE_MAXADDR_32BIT,/* lowaddr */ + BUS_SPACE_MAXADDR, /* highaddr */ + NULL, NULL, /* filter, filterarg */ + NFE_RX_RING_COUNT * descsize, 1, /* maxsize, nsegments */ + NFE_RX_RING_COUNT * descsize, /* maxsegsize */ + BUS_DMA_ALLOCNOW, /* flags */ + NULL, NULL, /* lockfunc, lockarg */ + &ring->rx_desc_tag); + if (error != 0) { + printf("nfe%d: could not create desc DMA tag\n", sc->nfe_unit); + goto fail; + } + + /* allocate memory to desc */ + error = bus_dmamem_alloc(ring->rx_desc_tag, (void **)desc, BUS_DMA_NOWAIT, &ring->rx_desc_map); + if (error != 0) { + printf("nfe%d: could not create desc DMA map\n", sc->nfe_unit); + goto fail; + } + + /* map desc to device visible address space */ + error = bus_dmamap_load(ring->rx_desc_tag, ring->rx_desc_map, *desc, + NFE_RX_RING_COUNT * descsize, nfe_dma_map_segs, &ring->rx_desc_segs, BUS_DMA_NOWAIT); + if (error != 0) { + printf("nfe%d: could not load desc DMA map\n", sc->nfe_unit); + goto fail; + } + + bzero(*desc, NFE_RX_RING_COUNT * descsize); + ring->rx_desc_addr = ring->rx_desc_segs.ds_addr; + ring->physaddr = ring->rx_desc_addr; + + if (sc->nfe_flags & NFE_USE_JUMBO) { + ring->bufsz = NFE_JBYTES; + if ((error = nfe_jpool_alloc(sc)) != 0) { + printf("nfe%d: could not allocate jumbo frames\n", sc->nfe_unit); + goto fail; + } + } + + /* + * Pre-allocate Rx buffers and populate Rx ring. + */ + for (i = 0; i < NFE_RX_RING_COUNT; i++) { + data = &sc->rxq.data[i]; + + MGETHDR(data->m, M_DONTWAIT, MT_DATA); + if (data->m == NULL) { + printf("nfe%d: could not allocate rx mbuf\n", sc->nfe_unit); + error = ENOMEM; + goto fail; + } + + if (sc->nfe_flags & NFE_USE_JUMBO) { + if ((jbuf = nfe_jalloc(sc)) == NULL) { + printf("nfe%d: could not allocate jumbo buffer\n", sc->nfe_unit); + goto fail; + } + data->m->m_data = (void *)jbuf->buf; + data->m->m_len = data->m->m_pkthdr.len = NFE_JBYTES; + MEXTADD(data->m, jbuf->buf, NFE_JBYTES, nfe_jfree, (struct nfe_softc *)sc, 0, EXT_NET_DRV); + /* m_adj(data->m, ETHER_ALIGN); */ + physaddr = jbuf->physaddr; + } else { + error = bus_dma_tag_create(sc->nfe_parent_tag, + PAGE_SIZE, 0, /* alignment, boundary */ + BUS_SPACE_MAXADDR_32BIT,/* lowaddr */ + BUS_SPACE_MAXADDR, /* highaddr */ + NULL, NULL, /* filter, filterarg */ + MCLBYTES, 1, /* maxsize, nsegments */ + MCLBYTES, /* maxsegsize */ + BUS_DMA_ALLOCNOW, /* flags */ + NULL, NULL, /* lockfunc, lockarg */ + &data->rx_data_tag); + if (error != 0) { + printf("nfe%d: could not create DMA map\n", sc->nfe_unit); + goto fail; + } + + error = bus_dmamap_create(data->rx_data_tag, 0, &data->rx_data_map); + if (error != 0) { + printf("nfe%d: could not allocate mbuf cluster\n", sc->nfe_unit); + goto fail; + } + + MCLGET(data->m, M_DONTWAIT); + if (!(data->m->m_flags & M_EXT)) { + error = ENOMEM; + goto fail; + } + + error = bus_dmamap_load(data->rx_data_tag, data->rx_data_map, mtod(data->m, void *), + MCLBYTES, nfe_dma_map_segs, &data->rx_data_segs, BUS_DMA_NOWAIT); + if (error != 0) { + printf("nfe%d: could not load rx buf DMA map", sc->nfe_unit); + goto fail; + } + + data->rx_data_addr = data->rx_data_segs.ds_addr; + physaddr = data->rx_data_addr; + + } + + if (sc->nfe_flags & NFE_40BIT_ADDR) { + desc64 = &sc->rxq.desc64[i]; +#if defined(__LP64__) + desc64->physaddr[0] = htole32(physaddr >> 32); +#endif + desc64->physaddr[1] = htole32(physaddr & 0xffffffff); + desc64->length = htole16(sc->rxq.bufsz); + desc64->flags = htole16(NFE_RX_READY); + } else { + desc32 = &sc->rxq.desc32[i]; + desc32->physaddr = htole32(physaddr); + desc32->length = htole16(sc->rxq.bufsz); + desc32->flags = htole16(NFE_RX_READY); + } + + } + + bus_dmamap_sync(ring->rx_desc_tag, ring->rx_desc_map, BUS_DMASYNC_PREWRITE); + + return 0; + +fail: nfe_free_rx_ring(sc, ring); + + return error; +} + +static int +nfe_jpool_alloc(struct nfe_softc *sc) +{ + struct nfe_rx_ring *ring = &sc->rxq; + struct nfe_jbuf *jbuf; + bus_addr_t physaddr; + caddr_t buf; + int i, error; + + /* + * Allocate a big chunk of DMA'able memory. + */ + error = bus_dma_tag_create(sc->nfe_parent_tag, + PAGE_SIZE, 0, /* alignment, boundary */ + BUS_SPACE_MAXADDR_32BIT,/* lowaddr */ + BUS_SPACE_MAXADDR, /* highaddr */ + NULL, NULL, /* filter, filterarg */ + NFE_JPOOL_SIZE, 1, /* maxsize, nsegments */ + NFE_JPOOL_SIZE, /* maxsegsize */ + BUS_DMA_ALLOCNOW, /* flags */ + NULL, NULL, /* lockfunc, lockarg */ + &ring->rx_jumbo_tag); + if (error != 0) { + printf("nfe%d: could not create jumbo DMA tag\n", sc->nfe_unit); + goto fail; + } + error = bus_dmamem_alloc(ring->rx_jumbo_tag, (void **)&ring->jpool, BUS_DMA_NOWAIT, &ring->rx_jumbo_map); + if (error != 0) { + printf("nfe%d: could not create jumbo DMA memory\n", sc->nfe_unit); + goto fail; + } + + error = bus_dmamap_load(ring->rx_jumbo_tag, ring->rx_jumbo_map, ring->jpool, + NFE_JPOOL_SIZE, nfe_dma_map_segs, &ring->rx_jumbo_segs, BUS_DMA_NOWAIT); + if (error != 0) { + printf("nfe%d: could not load jumbo DMA map\n", sc->nfe_unit); + goto fail; + } + + /* ..and split it into 9KB chunks */ + SLIST_INIT(&ring->jfreelist); + + buf = ring->jpool; + ring->rx_jumbo_addr = ring->rx_jumbo_segs.ds_addr; + physaddr = ring->rx_jumbo_addr; + + for (i = 0; i < NFE_JPOOL_COUNT; i++) { + jbuf = &ring->jbuf[i]; + + jbuf->buf = buf; + jbuf->physaddr = physaddr; + + SLIST_INSERT_HEAD(&ring->jfreelist, jbuf, jnext); + + buf += NFE_JBYTES; + physaddr += NFE_JBYTES; + } + + return 0; + +fail: nfe_jpool_free(sc); + return error; +} + + +static void +nfe_jpool_free(struct nfe_softc *sc) +{ + struct nfe_rx_ring *ring = &sc->rxq; + + if (ring->jpool != NULL) { +#if 0 + bus_dmamem_unmap(ring->rx_jumbo_tag, ring->jpool, NFE_JPOOL_SIZE); +#endif + bus_dmamem_free(ring->rx_jumbo_tag, &ring->rx_jumbo_segs, ring->rx_jumbo_map); + } + if (ring->rx_jumbo_map != NULL) { + bus_dmamap_sync(ring->rx_jumbo_tag, ring->rx_jumbo_map, BUS_DMASYNC_POSTWRITE); + bus_dmamap_unload(ring->rx_jumbo_tag, ring->rx_jumbo_map); + bus_dmamap_destroy(ring->rx_jumbo_tag, ring->rx_jumbo_map); + } +} + +static struct nfe_jbuf * +nfe_jalloc(struct nfe_softc *sc) +{ + struct nfe_jbuf *jbuf; + + jbuf = SLIST_FIRST(&sc->rxq.jfreelist); + if (jbuf == NULL) + return NULL; + SLIST_REMOVE_HEAD(&sc->rxq.jfreelist, jnext); + return jbuf; +} + +/* + * This is called automatically by the network stack when the mbuf is freed. + * Caution must be taken that the NIC might be reset by the time the mbuf is + * freed. + */ +static void +nfe_jfree(void *buf, void *arg) +{ struct nfe_softc *sc = arg; - struct ifnet *ifp = &sc->sc_arpcom.ac_if; - uint32_t r; + struct nfe_jbuf *jbuf; + int i; - if ((r = NFE_READ(sc, NFE_IRQ_STATUS)) == 0) - return 0; /* not for us */ - NFE_WRITE(sc, NFE_IRQ_STATUS, r); + /* find the jbuf from the base pointer */ + i = ((vm_offset_t)buf - (vm_offset_t)sc->rxq.jpool) / NFE_JBYTES; + if (i < 0 || i >= NFE_JPOOL_COUNT) { + printf("nfe%d: request to free a buffer (%p) not managed by us\n", sc->nfe_unit, buf); + return; + } + jbuf = &sc->rxq.jbuf[i]; - DPRINTFN(5, ("nfe_intr: interrupt register %x\n", r)); + /* ..and put it back in the free list */ + SLIST_INSERT_HEAD(&sc->rxq.jfreelist, jbuf, jnext); +} - if (r & NFE_IRQ_LINK) { - NFE_READ(sc, NFE_PHY_STATUS); - NFE_WRITE(sc, NFE_PHY_STATUS, 0xf); - DPRINTF(("%s: link state changed\n", sc->sc_dev.dv_xname)); + +static void +nfe_reset_rx_ring(struct nfe_softc *sc, struct nfe_rx_ring *ring) +{ + int i; + + for (i = 0; i < NFE_RX_RING_COUNT; i++) { + if (sc->nfe_flags & NFE_40BIT_ADDR) { + ring->desc64[i].length = htole16(ring->bufsz); + ring->desc64[i].flags = htole16(NFE_RX_READY); + } else { + ring->desc32[i].length = htole16(ring->bufsz); + ring->desc32[i].flags = htole16(NFE_RX_READY); + } } - if (ifp->if_flags & IFF_RUNNING) { - /* check Rx ring */ - nfe_rxeof(sc); + bus_dmamap_sync(ring->rx_desc_tag, ring->rx_desc_map, BUS_DMASYNC_PREWRITE); - /* check Tx ring */ - nfe_txeof(sc); + ring->cur = ring->next = 0; +} + + +static void +nfe_free_rx_ring(struct nfe_softc *sc, struct nfe_rx_ring *ring) +{ + struct nfe_rx_data *data; + void *desc; + int i, descsize; + + if (sc->nfe_flags & NFE_40BIT_ADDR) { + desc = ring->desc64; + descsize = sizeof (struct nfe_desc64); + } else { + desc = ring->desc32; + descsize = sizeof (struct nfe_desc32); } - return 1; + if (desc != NULL) { + bus_dmamap_sync(ring->rx_desc_tag, ring->rx_desc_map, BUS_DMASYNC_POSTWRITE); + bus_dmamap_unload(ring->rx_desc_tag, ring->rx_desc_map); + bus_dmamem_free(ring->rx_desc_tag, desc, ring->rx_desc_map); + bus_dma_tag_destroy(ring->rx_desc_tag); + } + + + if (sc->nfe_flags & NFE_USE_JUMBO) { + nfe_jpool_free(sc); + } else { + for (i = 0; i < NFE_RX_RING_COUNT; i++) { + data = &ring->data[i]; + + if (data->rx_data_map != NULL) { + bus_dmamap_sync(data->rx_data_tag, data->rx_data_map, BUS_DMASYNC_POSTREAD); + bus_dmamap_unload(data->rx_data_tag, data->rx_data_map); + bus_dmamap_destroy(data->rx_data_tag, data->rx_data_map); + bus_dma_tag_destroy(data->rx_data_tag); + } + if (data->m != NULL) + m_freem(data->m); + } + } } -int -nfe_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) +static int +nfe_alloc_tx_ring(struct nfe_softc *sc, struct nfe_tx_ring *ring) { - struct nfe_softc *sc = ifp->if_softc; - struct ifreq *ifr = (struct ifreq *)data; - struct ifaddr *ifa = (struct ifaddr *)data; - int s, error = 0; + int i, error; + void **desc; + int descsize; - s = splnet(); + if (sc->nfe_flags & NFE_40BIT_ADDR) { + desc = (void **)&ring->desc64; + descsize = sizeof (struct nfe_desc64); + } else { + desc = (void **)&ring->desc32; + descsize = sizeof (struct nfe_desc32); + } - if ((error = ether_ioctl(ifp, &sc->sc_arpcom, cmd, data)) > 0) { - splx(s); - return error; + ring->queued = 0; + ring->cur = ring->next = 0; + + error = bus_dma_tag_create(sc->nfe_parent_tag, + PAGE_SIZE, 0, /* alignment, boundary */ + BUS_SPACE_MAXADDR_32BIT,/* lowaddr */ + BUS_SPACE_MAXADDR, /* highaddr */ + NULL, NULL, /* filter, filterarg */ + NFE_TX_RING_COUNT * descsize, 1, /* maxsize, nsegments */ + NFE_TX_RING_COUNT * descsize, /* maxsegsize */ + BUS_DMA_ALLOCNOW, /* flags */ + NULL, NULL, /* lockfunc, lockarg */ + &ring->tx_desc_tag); + if (error != 0) { + printf("nfe%d: could not create desc DMA tag\n", sc->nfe_unit); + goto fail; } + error = bus_dmamem_alloc(ring->tx_desc_tag, (void **)desc, BUS_DMA_NOWAIT, &ring->tx_desc_map); + if (error != 0) { + printf("nfe%d: could not create desc DMA map\n", sc->nfe_unit); + goto fail; + } + + error = bus_dmamap_load(ring->tx_desc_tag, ring->tx_desc_map, *desc, + NFE_TX_RING_COUNT * descsize, nfe_dma_map_segs, &ring->tx_desc_segs, BUS_DMA_NOWAIT); + if (error != 0) { + printf("nfe%d: could not load desc DMA map\n", sc->nfe_unit); + goto fail; + } + + bzero(*desc, NFE_TX_RING_COUNT * descsize); + + ring->tx_desc_addr = ring->tx_desc_segs.ds_addr; + ring->physaddr = ring->tx_desc_addr; + + error = bus_dma_tag_create(sc->nfe_parent_tag, + ETHER_ALIGN, 0, + BUS_SPACE_MAXADDR_32BIT, + BUS_SPACE_MAXADDR, + NULL, NULL, + NFE_JBYTES, NFE_MAX_SCATTER, + NFE_JBYTES, + BUS_DMA_ALLOCNOW, + NULL, NULL, + &ring->tx_data_tag); + if (error != 0) { + printf("nfe%d: could not create DMA tag\n", sc->nfe_unit); + goto fail; + } + + for (i = 0; i < NFE_TX_RING_COUNT; i++) { + error = bus_dmamap_create(ring->tx_data_tag, 0, &ring->data[i].tx_data_map); + if (error != 0) { + printf("nfe%d: could not create DMA map\n", sc->nfe_unit); + goto fail; + } + } + + return 0; + +fail: nfe_free_tx_ring(sc, ring); + return error; +} + + +static void +nfe_reset_tx_ring(struct nfe_softc *sc, struct nfe_tx_ring *ring) +{ + struct nfe_tx_data *data; + int i; + + for (i = 0; i < NFE_TX_RING_COUNT; i++) { + if (sc->nfe_flags & NFE_40BIT_ADDR) + ring->desc64[i].flags = 0; + else + ring->desc32[i].flags = 0; + + data = &ring->data[i]; + + if (data->m != NULL) { + bus_dmamap_sync(ring->tx_data_tag, data->active, BUS_DMASYNC_POSTWRITE); + bus_dmamap_unload(ring->tx_data_tag, data->active); + m_freem(data->m); + data->m = NULL; + } + } + + bus_dmamap_sync(ring->tx_desc_tag, ring->tx_desc_map, BUS_DMASYNC_PREWRITE); + + ring->queued = 0; + ring->cur = ring->next = 0; +} + +static void +nfe_free_tx_ring(struct nfe_softc *sc, struct nfe_tx_ring *ring) +{ + struct nfe_tx_data *data; + void *desc; + int i, descsize; + + if (sc->nfe_flags & NFE_40BIT_ADDR) { + desc = ring->desc64; + descsize = sizeof (struct nfe_desc64); + } else { + desc = ring->desc32; + descsize = sizeof (struct nfe_desc32); + } + + if (desc != NULL) { + bus_dmamap_sync(ring->tx_desc_tag, ring->tx_desc_map, BUS_DMASYNC_POSTWRITE); + bus_dmamap_unload(ring->tx_desc_tag, ring->tx_desc_map); + bus_dmamem_free(ring->tx_desc_tag, desc, ring->tx_desc_map); + bus_dma_tag_destroy(ring->tx_desc_tag); + } + + for (i = 0; i < NFE_TX_RING_COUNT; i++) { + data = &ring->data[i]; + + if (data->m != NULL) { + bus_dmamap_sync(ring->tx_data_tag, data->active, BUS_DMASYNC_POSTWRITE); + bus_dmamap_unload(ring->tx_data_tag, data->active); + m_freem(data->m); + } + } + + /* ..and now actually destroy the DMA mappings */ + for (i = 0; i < NFE_TX_RING_COUNT; i++) { + data = &ring->data[i]; + if (data->tx_data_map == NULL) + continue; + bus_dmamap_destroy(ring->tx_data_tag, data->tx_data_map); + } + + bus_dma_tag_destroy(ring->tx_data_tag); +} + +#ifdef DEVICE_POLLING +static poll_handler_t nfe_poll; + +static void +nfe_poll(struct ifnet *ifp, enum poll_cmd cmd, int count) +{ + struct nfe_softc *sc = ifp->if_softc; + + NFE_LOCK(sc); + if (ifp->if_drv_flags & IFF_DRV_RUNNING) + nfe_poll_locked(ifp, cmd, count); + NFE_UNLOCK(sc); +} + + +static void +nfe_poll_locked(struct ifnet *ifp, enum poll_cmd cmd, int count) +{ + struct nfe_softc *sc = ifp->if_softc; + u_int32_t r; + + NFE_LOCK_ASSERT(sc); + + if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) { + return; + } + + sc->rxcycles = count; + nfe_rxeof(sc); + nfe_txeof(sc); + if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) + nfe_start_locked(ifp); + + if (cmd == POLL_AND_CHECK_STATUS) { + if ((r = NFE_READ(sc, NFE_IRQ_STATUS)) == 0) { + return; + } + NFE_WRITE(sc, NFE_IRQ_STATUS, r); + + if (r & NFE_IRQ_LINK) { + NFE_READ(sc, NFE_PHY_STATUS); + NFE_WRITE(sc, NFE_PHY_STATUS, 0xf); + DPRINTF(("nfe%d: link state changed\n", sc->nfe_unit)); + } + } +} +#endif /* DEVICE_POLLING */ + + +static int +nfe_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) +{ + int error = 0; + struct nfe_softc *sc = ifp->if_softc; + struct ifreq *ifr = (struct ifreq *) data; + struct mii_data *mii; + switch (cmd) { - case SIOCSIFADDR: - ifp->if_flags |= IFF_UP; - if (!(ifp->if_flags & IFF_RUNNING)) - nfe_init(ifp); -#ifdef INET - if (ifa->ifa_addr->sa_family == AF_INET) - arp_ifinit(&sc->sc_arpcom, ifa); -#endif - break; case SIOCSIFMTU: if (ifr->ifr_mtu < ETHERMIN || - ((sc->sc_flags & NFE_USE_JUMBO) && + ((sc->nfe_flags & NFE_USE_JUMBO) && ifr->ifr_mtu > ETHERMTU_JUMBO) || - (!(sc->sc_flags & NFE_USE_JUMBO) && + (!(sc->nfe_flags & NFE_USE_JUMBO) && ifr->ifr_mtu > ETHERMTU)) error = EINVAL; - else if (ifp->if_mtu != ifr->ifr_mtu) + else if (ifp->if_mtu != ifr->ifr_mtu) { ifp->if_mtu = ifr->ifr_mtu; + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; + nfe_init(sc); + } break; case SIOCSIFFLAGS: + NFE_LOCK(sc); if (ifp->if_flags & IFF_UP) { /* * If only the PROMISC or ALLMULTI flag changes, then * don't do a full re-init of the chip, just update * the Rx filter. */ - if ((ifp->if_flags & IFF_RUNNING) && - ((ifp->if_flags ^ sc->sc_if_flags) & - (IFF_ALLMULTI | IFF_PROMISC)) != 0) { + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) && + ((ifp->if_flags ^ sc->nfe_if_flags) & + (IFF_ALLMULTI | IFF_PROMISC)) != 0) nfe_setmulti(sc); - } else { - if (!(ifp->if_flags & IFF_RUNNING)) - nfe_init(ifp); - } + else + nfe_init_locked(sc); } else { - if (ifp->if_flags & IFF_RUNNING) + if (ifp->if_drv_flags & IFF_DRV_RUNNING) nfe_stop(ifp, 1); } - sc->sc_if_flags = ifp->if_flags; + sc->nfe_if_flags = ifp->if_flags; + NFE_UNLOCK(sc); + error = 0; break; case SIOCADDMULTI: case SIOCDELMULTI: - error = (cmd == SIOCADDMULTI) ? - ether_addmulti(ifr, &sc->sc_arpcom) : - ether_delmulti(ifr, &sc->sc_arpcom); - - if (error == ENETRESET) { - if (ifp->if_flags & IFF_RUNNING) - nfe_setmulti(sc); + if (ifp->if_drv_flags & IFF_DRV_RUNNING) { + NFE_LOCK(sc); + nfe_setmulti(sc); + NFE_UNLOCK(sc); error = 0; } break; case SIOCSIFMEDIA: case SIOCGIFMEDIA: - error = ifmedia_ioctl(ifp, ifr, &sc->sc_mii.mii_media, cmd); + mii = device_get_softc(sc->nfe_miibus); + error = ifmedia_ioctl(ifp, ifr, &mii->mii_media, cmd); break; + case SIOCSIFCAP: + { + int mask = ifr->ifr_reqcap ^ ifp->if_capenable; +#ifdef DEVICE_POLLING + if (mask & IFCAP_POLLING) { + if (ifr->ifr_reqcap & IFCAP_POLLING) { + error = ether_poll_register(nfe_poll, ifp); + if (error) + return(error); + NFE_LOCK(sc); + NFE_WRITE(sc, NFE_IRQ_MASK, 0); + ifp->if_capenable |= IFCAP_POLLING; + NFE_UNLOCK(sc); + } else { + error = ether_poll_deregister(ifp); + /* Enable interrupt even in error case */ + NFE_LOCK(sc); + NFE_WRITE(sc, NFE_IRQ_MASK, NFE_IRQ_WANTED); + ifp->if_capenable &= ~IFCAP_POLLING; + NFE_UNLOCK(sc); + } + } +#endif + if (mask & IFCAP_HWCSUM) { + ifp->if_capenable ^= IFCAP_HWCSUM; + if (IFCAP_HWCSUM & ifp->if_capenable && + IFCAP_HWCSUM & ifp->if_capabilities) + ifp->if_hwassist = NFE_CSUM_FEATURES; + else + ifp->if_hwassist = 0; + } + } + break; + default: - error = EINVAL; + error = ether_ioctl(ifp, cmd, data); + break; } - splx(s); - return error; } -void + +static void nfe_intr(void *arg) +{ + struct nfe_softc *sc = arg; + struct ifnet *ifp = sc->nfe_ifp; + u_int32_t r; + + NFE_LOCK(sc); + +#ifdef DEVICE_POLLING + if (ifp->if_capenable & IFCAP_POLLING) { + NFE_UNLOCK(sc); + return; + } +#endif + + if ((r = NFE_READ(sc, NFE_IRQ_STATUS)) == 0) { + NFE_UNLOCK(sc); + return; /* not for us */ + } + NFE_WRITE(sc, NFE_IRQ_STATUS, r); + + DPRINTFN(5, ("nfe_intr: interrupt register %x\n", r)); + + NFE_WRITE(sc, NFE_IRQ_MASK, 0); + + if (r & NFE_IRQ_LINK) { + NFE_READ(sc, NFE_PHY_STATUS); + NFE_WRITE(sc, NFE_PHY_STATUS, 0xf); + DPRINTF(("nfe%d: link state changed\n", sc->nfe_unit)); + } + + if (ifp->if_drv_flags & IFF_DRV_RUNNING) { + /* check Rx ring */ + nfe_rxeof(sc); + /* check Tx ring */ + nfe_txeof(sc); + } + + NFE_WRITE(sc, NFE_IRQ_MASK, NFE_IRQ_WANTED); + + if (ifp->if_drv_flags & IFF_DRV_RUNNING && + !IFQ_DRV_IS_EMPTY(&ifp->if_snd)) + nfe_start_locked(ifp); + + NFE_UNLOCK(sc); + + return; +} + +static void nfe_txdesc32_sync(struct nfe_softc *sc, struct nfe_desc32 *desc32, int ops) { - bus_dmamap_sync(sc->sc_dmat, sc->txq.map, - (caddr_t)desc32 - (caddr_t)sc->txq.desc32, - sizeof (struct nfe_desc32), ops); + bus_dmamap_sync(sc->txq.tx_desc_tag, sc->txq.tx_desc_map, ops); } -void +static void nfe_txdesc64_sync(struct nfe_softc *sc, struct nfe_desc64 *desc64, int ops) { - bus_dmamap_sync(sc->sc_dmat, sc->txq.map, - (caddr_t)desc64 - (caddr_t)sc->txq.desc64, - sizeof (struct nfe_desc64), ops); + bus_dmamap_sync(sc->txq.tx_desc_tag, sc->txq.tx_desc_map, ops); } -void +static void nfe_txdesc32_rsync(struct nfe_softc *sc, int start, int end, int ops) { - if (end > start) { - bus_dmamap_sync(sc->sc_dmat, sc->txq.map, - (caddr_t)&sc->txq.desc32[start] - (caddr_t)sc->txq.desc32, - (caddr_t)&sc->txq.desc32[end] - - (caddr_t)&sc->txq.desc32[start], ops); - return; - } - /* sync from 'start' to end of ring */ - bus_dmamap_sync(sc->sc_dmat, sc->txq.map, - (caddr_t)&sc->txq.desc32[start] - (caddr_t)sc->txq.desc32, - (caddr_t)&sc->txq.desc32[NFE_TX_RING_COUNT] - - (caddr_t)&sc->txq.desc32[start], ops); - - /* sync from start of ring to 'end' */ - bus_dmamap_sync(sc->sc_dmat, sc->txq.map, 0, - (caddr_t)&sc->txq.desc32[end] - (caddr_t)sc->txq.desc32, ops); + bus_dmamap_sync(sc->txq.tx_desc_tag, sc->txq.tx_desc_map, ops); } -void +static void nfe_txdesc64_rsync(struct nfe_softc *sc, int start, int end, int ops) { - if (end > start) { - bus_dmamap_sync(sc->sc_dmat, sc->txq.map, - (caddr_t)&sc->txq.desc64[start] - (caddr_t)sc->txq.desc64, - (caddr_t)&sc->txq.desc64[end] - - (caddr_t)&sc->txq.desc64[start], ops); - return; - } - /* sync from 'start' to end of ring */ - bus_dmamap_sync(sc->sc_dmat, sc->txq.map, - (caddr_t)&sc->txq.desc64[start] - (caddr_t)sc->txq.desc64, - (caddr_t)&sc->txq.desc64[NFE_TX_RING_COUNT] - - (caddr_t)&sc->txq.desc64[start], ops); - - /* sync from start of ring to 'end' */ - bus_dmamap_sync(sc->sc_dmat, sc->txq.map, 0, - (caddr_t)&sc->txq.desc64[end] - (caddr_t)sc->txq.desc64, ops); + bus_dmamap_sync(sc->txq.tx_desc_tag, sc->txq.tx_desc_map, ops); } -void +static void nfe_rxdesc32_sync(struct nfe_softc *sc, struct nfe_desc32 *desc32, int ops) { - bus_dmamap_sync(sc->sc_dmat, sc->rxq.map, - (caddr_t)desc32 - (caddr_t)sc->rxq.desc32, - sizeof (struct nfe_desc32), ops); + bus_dmamap_sync(sc->rxq.rx_desc_tag, sc->rxq.rx_desc_map, ops); } -void +static void nfe_rxdesc64_sync(struct nfe_softc *sc, struct nfe_desc64 *desc64, int ops) { - bus_dmamap_sync(sc->sc_dmat, sc->rxq.map, - (caddr_t)desc64 - (caddr_t)sc->rxq.desc64, - sizeof (struct nfe_desc64), ops); + + bus_dmamap_sync(sc->rxq.rx_desc_tag, sc->rxq.rx_desc_map, ops); } -void -nfe_rxeof(struct nfe_softc *sc) +static void nfe_rxeof(struct nfe_softc *sc) { - struct ifnet *ifp = &sc->sc_arpcom.ac_if; - struct nfe_desc32 *desc32; - struct nfe_desc64 *desc64; + struct ifnet *ifp = sc->nfe_ifp; + struct nfe_desc32 *desc32=NULL; + struct nfe_desc64 *desc64=NULL; struct nfe_rx_data *data; struct nfe_jbuf *jbuf; struct mbuf *m, *mnew; bus_addr_t physaddr; - uint16_t flags; + u_int16_t flags; int error, len; +#if NVLAN > 1 + u_int16_t vlan_tag = 0; + int have_tag = 0; +#endif + NFE_LOCK_ASSERT(sc); + for (;;) { + +#ifdef DEVICE_POLLING + if (ifp->if_capenable & IFCAP_POLLING) { + if (sc->rxcycles <= 0) + break; + sc->rxcycles--; + } +#endif + data = &sc->rxq.data[sc->rxq.cur]; - if (sc->sc_flags & NFE_40BIT_ADDR) { + if (sc->nfe_flags & NFE_40BIT_ADDR) { desc64 = &sc->rxq.desc64[sc->rxq.cur]; nfe_rxdesc64_sync(sc, desc64, BUS_DMASYNC_POSTREAD); flags = letoh16(desc64->flags); len = letoh16(desc64->length) & 0x3fff; + +#if NVLAN > 1 + if (flags & NFE_TX_VLAN_TAG) { + have_tag = 1; + vlan_tag = desc64->vtag; + } +#endif + } else { desc32 = &sc->rxq.desc32[sc->rxq.cur]; nfe_rxdesc32_sync(sc, desc32, BUS_DMASYNC_POSTREAD); flags = letoh16(desc32->flags); len = letoh16(desc32->length) & 0x3fff; } if (flags & NFE_RX_READY) break; - if ((sc->sc_flags & (NFE_JUMBO_SUP | NFE_40BIT_ADDR)) == 0) { + if ((sc->nfe_flags & (NFE_JUMBO_SUP | NFE_40BIT_ADDR)) == 0) { if (!(flags & NFE_RX_VALID_V1)) goto skip; - if ((flags & NFE_RX_FIXME_V1) == NFE_RX_FIXME_V1) { flags &= ~NFE_RX_ERROR; len--; /* fix buffer length */ } } else { if (!(flags & NFE_RX_VALID_V2)) goto skip; if ((flags & NFE_RX_FIXME_V2) == NFE_RX_FIXME_V2) { flags &= ~NFE_RX_ERROR; len--; /* fix buffer length */ } } if (flags & NFE_RX_ERROR) { ifp->if_ierrors++; goto skip; } /* * Try to allocate a new mbuf for this ring element and load * it before processing the current mbuf. If the ring element * cannot be loaded, drop the received packet and reuse the * old mbuf. In the unlikely case that the old mbuf can't be * reloaded either, explicitly panic. */ MGETHDR(mnew, M_DONTWAIT, MT_DATA); if (mnew == NULL) { ifp->if_ierrors++; goto skip; } - if (sc->sc_flags & NFE_USE_JUMBO) { + if (sc->nfe_flags & NFE_USE_JUMBO) { if ((jbuf = nfe_jalloc(sc)) == NULL) { m_freem(mnew); ifp->if_ierrors++; goto skip; } - MEXTADD(mnew, jbuf->buf, NFE_JBYTES, 0, nfe_jfree, sc); + mnew->m_data = (void *)jbuf->buf; + mnew->m_len = mnew->m_pkthdr.len = NFE_JBYTES; + MEXTADD(mnew, jbuf->buf, NFE_JBYTES, nfe_jfree, + (struct nfe_softc *)sc, 0 , EXT_NET_DRV); - bus_dmamap_sync(sc->sc_dmat, sc->rxq.jmap, - mtod(data->m, caddr_t) - sc->rxq.jpool, NFE_JBYTES, - BUS_DMASYNC_POSTREAD); - + bus_dmamap_sync(sc->rxq.rx_jumbo_tag, + sc->rxq.rx_jumbo_map, BUS_DMASYNC_POSTREAD); physaddr = jbuf->physaddr; } else { MCLGET(mnew, M_DONTWAIT); if (!(mnew->m_flags & M_EXT)) { m_freem(mnew); ifp->if_ierrors++; goto skip; } - bus_dmamap_sync(sc->sc_dmat, data->map, 0, - data->map->dm_mapsize, BUS_DMASYNC_POSTREAD); - bus_dmamap_unload(sc->sc_dmat, data->map); - - error = bus_dmamap_load(sc->sc_dmat, data->map, - mtod(mnew, void *), MCLBYTES, NULL, - BUS_DMA_READ | BUS_DMA_NOWAIT); + bus_dmamap_sync(data->rx_data_tag, data->rx_data_map, + BUS_DMASYNC_POSTREAD); + bus_dmamap_unload(data->rx_data_tag, data->rx_data_map); + error = bus_dmamap_load(data->rx_data_tag, + data->rx_data_map, mtod(mnew, void *), MCLBYTES, + nfe_dma_map_segs, &data->rx_data_segs, + BUS_DMA_NOWAIT); if (error != 0) { m_freem(mnew); /* try to reload the old mbuf */ - error = bus_dmamap_load(sc->sc_dmat, data->map, - mtod(data->m, void *), MCLBYTES, NULL, - BUS_DMA_READ | BUS_DMA_NOWAIT); + error = bus_dmamap_load(data->rx_data_tag, + data->rx_data_map, mtod(data->m, void *), + MCLBYTES, nfe_dma_map_segs, + &data->rx_data_segs, BUS_DMA_NOWAIT); if (error != 0) { /* very unlikely that it will fail.. */ - panic("%s: could not load old rx mbuf", - sc->sc_dev.dv_xname); + panic("nfe%d: could not load old rx mbuf", + sc->nfe_unit); } ifp->if_ierrors++; goto skip; } - physaddr = data->map->dm_segs[0].ds_addr; + data->rx_data_addr = data->rx_data_segs.ds_addr; + physaddr = data->rx_data_addr; } /* * New mbuf successfully loaded, update Rx ring and continue * processing. */ m = data->m; data->m = mnew; /* finalize mbuf */ m->m_pkthdr.len = m->m_len = len; m->m_pkthdr.rcvif = ifp; -#ifdef notyet - if (sc->sc_flags & NFE_HW_CSUM) { - if (flags & NFE_RX_IP_CSUMOK) - m->m_pkthdr.csum_flags |= M_IPV4_CSUM_IN_OK; - if (flags & NFE_RX_UDP_CSUMOK) - m->m_pkthdr.csum_flags |= M_UDP_CSUM_IN_OK; - if (flags & NFE_RX_TCP_CSUMOK) - m->m_pkthdr.csum_flags |= M_TCP_CSUM_IN_OK; + +#if defined(NFE_CSUM) + if ((sc->nfe_flags & NFE_HW_CSUM) && (flags & NFE_RX_CSUMOK)) { + m->m_pkthdr.csum_flags |= CSUM_IP_CHECKED; + if (flags & NFE_RX_IP_CSUMOK_V2) { + m->m_pkthdr.csum_flags |= CSUM_IP_VALID; + } + if (flags & NFE_RX_UDP_CSUMOK_V2 || + flags & NFE_RX_TCP_CSUMOK_V2) { + m->m_pkthdr.csum_flags |= + CSUM_DATA_VALID|CSUM_PSEUDO_HDR; + m->m_pkthdr.csum_data = 0xffff; + } } -#elif defined(NFE_CSUM) - if ((sc->sc_flags & NFE_HW_CSUM) && (flags & NFE_RX_CSUMOK)) - m->m_pkthdr.csum_flags = M_IPV4_CSUM_IN_OK; #endif -#if NBPFILTER > 0 - if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN); +#if NVLAN > 1 + if (have_tag) { + VLAN_INPUT_TAG_NEW(ifp, m, vlan_tag); + if (m == NULL) + continue; + } #endif + ifp->if_ipackets++; - ether_input_mbuf(ifp, m); + NFE_UNLOCK(sc); + (*ifp->if_input)(ifp, m); + NFE_LOCK(sc); + /* update mapping address in h/w descriptor */ - if (sc->sc_flags & NFE_40BIT_ADDR) { + if (sc->nfe_flags & NFE_40BIT_ADDR) { #if defined(__LP64__) desc64->physaddr[0] = htole32(physaddr >> 32); #endif desc64->physaddr[1] = htole32(physaddr & 0xffffffff); } else { desc32->physaddr = htole32(physaddr); } -skip: if (sc->sc_flags & NFE_40BIT_ADDR) { +skip: if (sc->nfe_flags & NFE_40BIT_ADDR) { desc64->length = htole16(sc->rxq.bufsz); desc64->flags = htole16(NFE_RX_READY); nfe_rxdesc64_sync(sc, desc64, BUS_DMASYNC_PREWRITE); } else { desc32->length = htole16(sc->rxq.bufsz); desc32->flags = htole16(NFE_RX_READY); nfe_rxdesc32_sync(sc, desc32, BUS_DMASYNC_PREWRITE); } sc->rxq.cur = (sc->rxq.cur + 1) % NFE_RX_RING_COUNT; } } -void -nfe_txeof(struct nfe_softc *sc) +static void nfe_txeof(struct nfe_softc *sc) { - struct ifnet *ifp = &sc->sc_arpcom.ac_if; + struct ifnet *ifp = sc->nfe_ifp; struct nfe_desc32 *desc32; struct nfe_desc64 *desc64; struct nfe_tx_data *data = NULL; - uint16_t flags; + u_int16_t flags; + NFE_LOCK_ASSERT(sc); + while (sc->txq.next != sc->txq.cur) { - if (sc->sc_flags & NFE_40BIT_ADDR) { + if (sc->nfe_flags & NFE_40BIT_ADDR) { desc64 = &sc->txq.desc64[sc->txq.next]; nfe_txdesc64_sync(sc, desc64, BUS_DMASYNC_POSTREAD); flags = letoh16(desc64->flags); } else { desc32 = &sc->txq.desc32[sc->txq.next]; nfe_txdesc32_sync(sc, desc32, BUS_DMASYNC_POSTREAD); flags = letoh16(desc32->flags); } if (flags & NFE_TX_VALID) break; data = &sc->txq.data[sc->txq.next]; - if ((sc->sc_flags & (NFE_JUMBO_SUP | NFE_40BIT_ADDR)) == 0) { + if ((sc->nfe_flags & (NFE_JUMBO_SUP | NFE_40BIT_ADDR)) == 0) { if (!(flags & NFE_TX_LASTFRAG_V1) && data->m == NULL) goto skip; if ((flags & NFE_TX_ERROR_V1) != 0) { - printf("%s: tx v1 error 0x%04b\n", - sc->sc_dev.dv_xname, flags, NFE_V1_TXERR); + printf("nfe%d: tx v1 error 0x%4b\n", + sc->nfe_unit, flags, NFE_V1_TXERR); + ifp->if_oerrors++; } else ifp->if_opackets++; } else { if (!(flags & NFE_TX_LASTFRAG_V2) && data->m == NULL) goto skip; if ((flags & NFE_TX_ERROR_V2) != 0) { - printf("%s: tx v2 error 0x%04b\n", - sc->sc_dev.dv_xname, flags, NFE_V2_TXERR); + printf("nfe%d: tx v1 error 0x%4b\n", + sc->nfe_unit, flags, NFE_V2_TXERR); + ifp->if_oerrors++; } else ifp->if_opackets++; } if (data->m == NULL) { /* should not get there */ - printf("%s: last fragment bit w/o associated mbuf!\n", - sc->sc_dev.dv_xname); + printf("nfe%d: last fragment bit w/o associated mbuf!\n", + sc->nfe_unit); goto skip; } /* last fragment of the mbuf chain transmitted */ - bus_dmamap_sync(sc->sc_dmat, data->active, 0, - data->active->dm_mapsize, BUS_DMASYNC_POSTWRITE); - bus_dmamap_unload(sc->sc_dmat, data->active); + bus_dmamap_sync(sc->txq.tx_data_tag, data->active, + BUS_DMASYNC_POSTWRITE); + bus_dmamap_unload(sc->txq.tx_data_tag, data->active); m_freem(data->m); data->m = NULL; ifp->if_timer = 0; skip: sc->txq.queued--; sc->txq.next = (sc->txq.next + 1) % NFE_TX_RING_COUNT; } if (data != NULL) { /* at least one slot freed */ - ifp->if_flags &= ~IFF_OACTIVE; - nfe_start(ifp); + ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; + nfe_start_locked(ifp); } } -int -nfe_encap(struct nfe_softc *sc, struct mbuf *m0) +static int nfe_encap(struct nfe_softc *sc, struct mbuf *m0) { - struct nfe_desc32 *desc32; - struct nfe_desc64 *desc64; - struct nfe_tx_data *data; + struct nfe_desc32 *desc32=NULL; + struct nfe_desc64 *desc64=NULL; + struct nfe_tx_data *data=NULL; bus_dmamap_t map; - uint16_t flags = NFE_TX_VALID; + u_int16_t flags = NFE_TX_VALID; #if NVLAN > 0 - uint32_t vtag = 0; + struct m_tag *vtag; #endif + bus_dma_segment_t segs[NFE_MAX_SCATTER]; + int nsegs; int error, i; - map = sc->txq.data[sc->txq.cur].map; + map = sc->txq.data[sc->txq.cur].tx_data_map; - error = bus_dmamap_load_mbuf(sc->sc_dmat, map, m0, BUS_DMA_NOWAIT); + error = bus_dmamap_load_mbuf_sg(sc->txq.tx_data_tag, map, m0, segs, + &nsegs, BUS_DMA_NOWAIT); + if (error != 0) { - printf("%s: could not map mbuf (error %d)\n", - sc->sc_dev.dv_xname, error); + printf("nfe%d: could not map mbuf (error %d)\n", sc->nfe_unit, + error); return error; } - if (sc->txq.queued + map->dm_nsegs >= NFE_TX_RING_COUNT - 1) { - bus_dmamap_unload(sc->sc_dmat, map); + if (sc->txq.queued + nsegs >= NFE_TX_RING_COUNT - 1) { + bus_dmamap_unload(sc->txq.tx_data_tag, map); return ENOBUFS; } + #if NVLAN > 0 /* setup h/w VLAN tagging */ - if ((m0->m_flags & (M_PROTO1 | M_PKTHDR)) == (M_PROTO1 | M_PKTHDR) && - m0->m_pkthdr.rcvif != NULL) { - struct ifvlan *ifv = m0->m_pkthdr.rcvif->if_softc; - vtag = NFE_TX_VTAG | htons(ifv->ifv_tag); - } + vtag = VLAN_OUTPUT_TAG(sc->nfe_ifp, m0); #endif + #ifdef NFE_CSUM - if (m0->m_pkthdr.csum_flags & M_IPV4_CSUM_OUT) + if (m0->m_pkthdr.csum_flags & CSUM_IP) flags |= NFE_TX_IP_CSUM; - if (m0->m_pkthdr.csum_flags & (M_TCPV4_CSUM_OUT | M_UDPV4_CSUM_OUT)) + if (m0->m_pkthdr.csum_flags & CSUM_TCP) flags |= NFE_TX_TCP_CSUM; + if (m0->m_pkthdr.csum_flags & CSUM_UDP) + flags |= NFE_TX_TCP_CSUM; #endif - for (i = 0; i < map->dm_nsegs; i++) { + for (i = 0; i < nsegs; i++) { data = &sc->txq.data[sc->txq.cur]; - if (sc->sc_flags & NFE_40BIT_ADDR) { + if (sc->nfe_flags & NFE_40BIT_ADDR) { desc64 = &sc->txq.desc64[sc->txq.cur]; #if defined(__LP64__) - desc64->physaddr[0] = - htole32(map->dm_segs[i].ds_addr >> 32); + desc64->physaddr[0] = htole32(segs[i].ds_addr >> 32); #endif - desc64->physaddr[1] = - htole32(map->dm_segs[i].ds_addr & 0xffffffff); - desc64->length = htole16(map->dm_segs[i].ds_len - 1); + desc64->physaddr[1] = htole32(segs[i].ds_addr & + 0xffffffff); + desc64->length = htole16(segs[i].ds_len - 1); desc64->flags = htole16(flags); #if NVLAN > 0 - desc64->vtag = htole32(vtag); + desc64->vtag = htole32(NFE_TX_VTAG | + VLAN_TAG_VALUE(vtag)); #endif } else { desc32 = &sc->txq.desc32[sc->txq.cur]; - desc32->physaddr = htole32(map->dm_segs[i].ds_addr); - desc32->length = htole16(map->dm_segs[i].ds_len - 1); + desc32->physaddr = htole32(segs[i].ds_addr); + desc32->length = htole16(segs[i].ds_len - 1); desc32->flags = htole16(flags); } /* csum flags and vtag belong to the first fragment only */ - if (map->dm_nsegs > 1) { + if (nsegs > 1) { flags &= ~(NFE_TX_IP_CSUM | NFE_TX_TCP_CSUM); #if NVLAN > 0 vtag = 0; #endif } - + sc->txq.queued++; sc->txq.cur = (sc->txq.cur + 1) % NFE_TX_RING_COUNT; } /* the whole mbuf chain has been DMA mapped, fix last descriptor */ - if (sc->sc_flags & NFE_40BIT_ADDR) { + if (sc->nfe_flags & NFE_40BIT_ADDR) { flags |= NFE_TX_LASTFRAG_V2; desc64->flags = htole16(flags); } else { - if (sc->sc_flags & NFE_JUMBO_SUP) + if (sc->nfe_flags & NFE_JUMBO_SUP) flags |= NFE_TX_LASTFRAG_V2; else flags |= NFE_TX_LASTFRAG_V1; desc32->flags = htole16(flags); } data->m = m0; data->active = map; + data->nsegs = nsegs; - bus_dmamap_sync(sc->sc_dmat, map, 0, map->dm_mapsize, - BUS_DMASYNC_PREWRITE); + bus_dmamap_sync(sc->txq.tx_data_tag, map, BUS_DMASYNC_PREWRITE); return 0; } -void -nfe_start(struct ifnet *ifp) + +static void nfe_setmulti(struct nfe_softc *sc) { + struct ifnet *ifp = sc->nfe_ifp; + struct ifmultiaddr *ifma; + u_int8_t addr[ETHER_ADDR_LEN], mask[ETHER_ADDR_LEN]; + u_int32_t filter = NFE_RXFILTER_MAGIC; + u_int8_t etherbroadcastaddr[ETHER_ADDR_LEN] = + { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; + int i; + + NFE_LOCK_ASSERT(sc); + + if ((ifp->if_flags & (IFF_ALLMULTI | IFF_PROMISC)) != 0) { + bzero(addr, ETHER_ADDR_LEN); + bzero(mask, ETHER_ADDR_LEN); + goto done; + } + + bcopy(etherbroadcastaddr, addr, ETHER_ADDR_LEN); + bcopy(etherbroadcastaddr, mask, ETHER_ADDR_LEN); + + IF_ADDR_LOCK(ifp); + TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + u_char *addrp; + + if (ifma->ifma_addr->sa_family != AF_LINK) + continue; + + addrp = LLADDR((struct sockaddr_dl *) ifma->ifma_addr); + for (i = 0; i < ETHER_ADDR_LEN; i++) { + u_int8_t mcaddr = addrp[i]; + addr[i] &= mcaddr; + mask[i] &= ~mcaddr; + } + } + IF_ADDR_UNLOCK(ifp); + + for (i = 0; i < ETHER_ADDR_LEN; i++) { + mask[i] |= addr[i]; + } + +done: + addr[0] |= 0x01; /* make sure multicast bit is set */ + + NFE_WRITE(sc, NFE_MULTIADDR_HI, + addr[3] << 24 | addr[2] << 16 | addr[1] << 8 | addr[0]); + NFE_WRITE(sc, NFE_MULTIADDR_LO, + addr[5] << 8 | addr[4]); + NFE_WRITE(sc, NFE_MULTIMASK_HI, + mask[3] << 24 | mask[2] << 16 | mask[1] << 8 | mask[0]); + NFE_WRITE(sc, NFE_MULTIMASK_LO, + mask[5] << 8 | mask[4]); + + filter |= (ifp->if_flags & IFF_PROMISC) ? NFE_PROMISC : NFE_U2M; + NFE_WRITE(sc, NFE_RXFILTER, filter); +} + +static void nfe_start(struct ifnet *ifp) +{ + struct nfe_softc *sc; + + sc = ifp->if_softc; + NFE_LOCK(sc); + nfe_start_locked(ifp); + NFE_UNLOCK(sc); +} + +static void nfe_start_locked(struct ifnet *ifp) +{ struct nfe_softc *sc = ifp->if_softc; int old = sc->txq.cur; struct mbuf *m0; + if (!sc->nfe_link || ifp->if_drv_flags & IFF_DRV_OACTIVE) { + return; + } + for (;;) { IFQ_POLL(&ifp->if_snd, m0); if (m0 == NULL) break; if (nfe_encap(sc, m0) != 0) { - ifp->if_flags |= IFF_OACTIVE; + ifp->if_drv_flags |= IFF_DRV_OACTIVE; break; } /* packet put in h/w queue, remove from s/w queue */ IFQ_DEQUEUE(&ifp->if_snd, m0); -#if NBPFILTER > 0 - if (ifp->if_bpf != NULL) - bpf_mtap(ifp->if_bpf, m0, BPF_DIRECTION_OUT); -#endif + BPF_MTAP(ifp, m0); } - if (sc->txq.cur == old) /* nothing sent */ + if (sc->txq.cur == old) { /* nothing sent */ return; + } - if (sc->sc_flags & NFE_40BIT_ADDR) + if (sc->nfe_flags & NFE_40BIT_ADDR) nfe_txdesc64_rsync(sc, old, sc->txq.cur, BUS_DMASYNC_PREWRITE); else nfe_txdesc32_rsync(sc, old, sc->txq.cur, BUS_DMASYNC_PREWRITE); /* kick Tx */ NFE_WRITE(sc, NFE_RXTX_CTL, NFE_RXTX_KICKTX | sc->rxtxctl); /* * Set a timeout in case the chip goes out to lunch. */ ifp->if_timer = 5; + + return; } -void -nfe_watchdog(struct ifnet *ifp) +static void nfe_watchdog(struct ifnet *ifp) { struct nfe_softc *sc = ifp->if_softc; - printf("%s: watchdog timeout\n", sc->sc_dev.dv_xname); + printf("nfe%d: watchdog timeout\n", sc->nfe_unit); - nfe_init(ifp); + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; + nfe_init(sc); ifp->if_oerrors++; + + return; } -int -nfe_init(struct ifnet *ifp) +static void nfe_init(void *xsc) { - struct nfe_softc *sc = ifp->if_softc; - uint32_t tmp; + struct nfe_softc *sc = xsc; + NFE_LOCK(sc); + nfe_init_locked(sc); + NFE_UNLOCK(sc); + + return; +} + +static void nfe_init_locked(void *xsc) +{ + struct nfe_softc *sc = xsc; + struct ifnet *ifp = sc->nfe_ifp; + struct mii_data *mii; + u_int32_t tmp; + + NFE_LOCK_ASSERT(sc); + + mii = device_get_softc(sc->nfe_miibus); + + if (ifp->if_drv_flags & IFF_DRV_RUNNING) { + return; + } + nfe_stop(ifp, 0); NFE_WRITE(sc, NFE_TX_UNK, 0); NFE_WRITE(sc, NFE_STATUS, 0); sc->rxtxctl = NFE_RXTX_BIT2; - if (sc->sc_flags & NFE_40BIT_ADDR) + if (sc->nfe_flags & NFE_40BIT_ADDR) sc->rxtxctl |= NFE_RXTX_V3MAGIC; - else if (sc->sc_flags & NFE_JUMBO_SUP) + else if (sc->nfe_flags & NFE_JUMBO_SUP) sc->rxtxctl |= NFE_RXTX_V2MAGIC; #ifdef NFE_CSUM - if (sc->sc_flags & NFE_HW_CSUM) + if (sc->nfe_flags & NFE_HW_CSUM) sc->rxtxctl |= NFE_RXTX_RXCSUM; #endif + #if NVLAN > 0 /* * Although the adapter is capable of stripping VLAN tags from received * frames (NFE_RXTX_VTAG_STRIP), we do not enable this functionality on * purpose. This will be done in software by our network stack. */ - if (sc->sc_flags & NFE_HW_VLAN) + if (sc->nfe_flags & NFE_HW_VLAN) sc->rxtxctl |= NFE_RXTX_VTAG_INSERT; #endif + NFE_WRITE(sc, NFE_RXTX_CTL, NFE_RXTX_RESET | sc->rxtxctl); DELAY(10); NFE_WRITE(sc, NFE_RXTX_CTL, sc->rxtxctl); #if NVLAN - if (sc->sc_flags & NFE_HW_VLAN) + if (sc->nfe_flags & NFE_HW_VLAN) NFE_WRITE(sc, NFE_VTAG_CTL, NFE_VTAG_ENABLE); #endif NFE_WRITE(sc, NFE_SETUP_R6, 0); /* set MAC address */ - nfe_set_macaddr(sc, sc->sc_arpcom.ac_enaddr); + nfe_set_macaddr(sc, sc->eaddr); /* tell MAC where rings are in memory */ #ifdef __LP64__ NFE_WRITE(sc, NFE_RX_RING_ADDR_HI, sc->rxq.physaddr >> 32); #endif NFE_WRITE(sc, NFE_RX_RING_ADDR_LO, sc->rxq.physaddr & 0xffffffff); #ifdef __LP64__ NFE_WRITE(sc, NFE_TX_RING_ADDR_HI, sc->txq.physaddr >> 32); #endif NFE_WRITE(sc, NFE_TX_RING_ADDR_LO, sc->txq.physaddr & 0xffffffff); NFE_WRITE(sc, NFE_RING_SIZE, (NFE_RX_RING_COUNT - 1) << 16 | (NFE_TX_RING_COUNT - 1)); NFE_WRITE(sc, NFE_RXBUFSZ, sc->rxq.bufsz); /* force MAC to wakeup */ tmp = NFE_READ(sc, NFE_PWR_STATE); NFE_WRITE(sc, NFE_PWR_STATE, tmp | NFE_PWR_WAKEUP); DELAY(10); tmp = NFE_READ(sc, NFE_PWR_STATE); NFE_WRITE(sc, NFE_PWR_STATE, tmp | NFE_PWR_VALID); #if 1 /* configure interrupts coalescing/mitigation */ NFE_WRITE(sc, NFE_IMTIMER, NFE_IM_DEFAULT); #else /* no interrupt mitigation: one interrupt per packet */ NFE_WRITE(sc, NFE_IMTIMER, 970); #endif NFE_WRITE(sc, NFE_SETUP_R1, NFE_R1_MAGIC); NFE_WRITE(sc, NFE_SETUP_R2, NFE_R2_MAGIC); NFE_WRITE(sc, NFE_SETUP_R6, NFE_R6_MAGIC); /* update MAC knowledge of PHY; generates a NFE_IRQ_LINK interrupt */ NFE_WRITE(sc, NFE_STATUS, sc->mii_phyaddr << 24 | NFE_STATUS_MAGIC); NFE_WRITE(sc, NFE_SETUP_R4, NFE_R4_MAGIC); NFE_WRITE(sc, NFE_WOL_CTL, NFE_WOL_MAGIC); sc->rxtxctl &= ~NFE_RXTX_BIT2; NFE_WRITE(sc, NFE_RXTX_CTL, sc->rxtxctl); DELAY(10); NFE_WRITE(sc, NFE_RXTX_CTL, NFE_RXTX_BIT1 | sc->rxtxctl); /* set Rx filter */ nfe_setmulti(sc); nfe_ifmedia_upd(ifp); + nfe_tick_locked(sc); + /* enable Rx */ NFE_WRITE(sc, NFE_RX_CTL, NFE_RX_START); /* enable Tx */ NFE_WRITE(sc, NFE_TX_CTL, NFE_TX_START); NFE_WRITE(sc, NFE_PHY_STATUS, 0xf); - /* enable interrupts */ - NFE_WRITE(sc, NFE_IRQ_MASK, NFE_IRQ_WANTED); +#ifdef DEVICE_POLLING + if (ifp->if_capenable & IFCAP_POLLING) + NFE_WRITE(sc, NFE_IRQ_MASK, 0); + else +#endif + NFE_WRITE(sc, NFE_IRQ_MASK, NFE_IRQ_WANTED); /* enable interrupts */ - timeout_add(&sc->sc_tick_ch, hz); + ifp->if_drv_flags |= IFF_DRV_RUNNING; + ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; - ifp->if_flags |= IFF_RUNNING; - ifp->if_flags &= ~IFF_OACTIVE; + sc->nfe_link = 0; - return 0; + return; } -void -nfe_stop(struct ifnet *ifp, int disable) +static void nfe_stop(struct ifnet *ifp, int disable) { struct nfe_softc *sc = ifp->if_softc; + struct mii_data *mii; - timeout_del(&sc->sc_tick_ch); + NFE_LOCK_ASSERT(sc); ifp->if_timer = 0; - ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); + ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE); - mii_down(&sc->sc_mii); + mii = device_get_softc(sc->nfe_miibus); + callout_stop(&sc->nfe_stat_ch); + /* abort Tx */ NFE_WRITE(sc, NFE_TX_CTL, 0); /* disable Rx */ NFE_WRITE(sc, NFE_RX_CTL, 0); /* disable interrupts */ NFE_WRITE(sc, NFE_IRQ_MASK, 0); + sc->nfe_link = 0; + /* reset Tx and Rx rings */ nfe_reset_tx_ring(sc, &sc->txq); nfe_reset_rx_ring(sc, &sc->rxq); -} -int -nfe_alloc_rx_ring(struct nfe_softc *sc, struct nfe_rx_ring *ring) -{ - struct nfe_desc32 *desc32; - struct nfe_desc64 *desc64; - struct nfe_rx_data *data; - struct nfe_jbuf *jbuf; - void **desc; - bus_addr_t physaddr; - int i, nsegs, error, descsize; - - if (sc->sc_flags & NFE_40BIT_ADDR) { - desc = (void **)&ring->desc64; - descsize = sizeof (struct nfe_desc64); - } else { - desc = (void **)&ring->desc32; - descsize = sizeof (struct nfe_desc32); - } - - ring->cur = ring->next = 0; - ring->bufsz = MCLBYTES; - - error = bus_dmamap_create(sc->sc_dmat, NFE_RX_RING_COUNT * descsize, 1, - NFE_RX_RING_COUNT * descsize, 0, BUS_DMA_NOWAIT, &ring->map); - if (error != 0) { - printf("%s: could not create desc DMA map\n", - sc->sc_dev.dv_xname); - goto fail; - } - - error = bus_dmamem_alloc(sc->sc_dmat, NFE_RX_RING_COUNT * descsize, - PAGE_SIZE, 0, &ring->seg, 1, &nsegs, BUS_DMA_NOWAIT); - if (error != 0) { - printf("%s: could not allocate DMA memory\n", - sc->sc_dev.dv_xname); - goto fail; - } - - error = bus_dmamem_map(sc->sc_dmat, &ring->seg, nsegs, - NFE_RX_RING_COUNT * descsize, (caddr_t *)desc, BUS_DMA_NOWAIT); - if (error != 0) { - printf("%s: could not map desc DMA memory\n", - sc->sc_dev.dv_xname); - goto fail; - } - - error = bus_dmamap_load(sc->sc_dmat, ring->map, *desc, - NFE_RX_RING_COUNT * descsize, NULL, BUS_DMA_NOWAIT); - if (error != 0) { - printf("%s: could not load desc DMA map\n", - sc->sc_dev.dv_xname); - goto fail; - } - - bzero(*desc, NFE_RX_RING_COUNT * descsize); - ring->physaddr = ring->map->dm_segs[0].ds_addr; - - if (sc->sc_flags & NFE_USE_JUMBO) { - ring->bufsz = NFE_JBYTES; - if ((error = nfe_jpool_alloc(sc)) != 0) { - printf("%s: could not allocate jumbo frames\n", - sc->sc_dev.dv_xname); - goto fail; - } - } - - /* - * Pre-allocate Rx buffers and populate Rx ring. - */ - for (i = 0; i < NFE_RX_RING_COUNT; i++) { - data = &sc->rxq.data[i]; - - MGETHDR(data->m, M_DONTWAIT, MT_DATA); - if (data->m == NULL) { - printf("%s: could not allocate rx mbuf\n", - sc->sc_dev.dv_xname); - error = ENOMEM; - goto fail; - } - - if (sc->sc_flags & NFE_USE_JUMBO) { - if ((jbuf = nfe_jalloc(sc)) == NULL) { - printf("%s: could not allocate jumbo buffer\n", - sc->sc_dev.dv_xname); - goto fail; - } - MEXTADD(data->m, jbuf->buf, NFE_JBYTES, 0, nfe_jfree, - sc); - - physaddr = jbuf->physaddr; - } else { - error = bus_dmamap_create(sc->sc_dmat, MCLBYTES, 1, - MCLBYTES, 0, BUS_DMA_NOWAIT, &data->map); - if (error != 0) { - printf("%s: could not create DMA map\n", - sc->sc_dev.dv_xname); - goto fail; - } - MCLGET(data->m, M_DONTWAIT); - if (!(data->m->m_flags & M_EXT)) { - printf("%s: could not allocate mbuf cluster\n", - sc->sc_dev.dv_xname); - error = ENOMEM; - goto fail; - } - - error = bus_dmamap_load(sc->sc_dmat, data->map, - mtod(data->m, void *), MCLBYTES, NULL, - BUS_DMA_READ | BUS_DMA_NOWAIT); - if (error != 0) { - printf("%s: could not load rx buf DMA map", - sc->sc_dev.dv_xname); - goto fail; - } - physaddr = data->map->dm_segs[0].ds_addr; - } - - if (sc->sc_flags & NFE_40BIT_ADDR) { - desc64 = &sc->rxq.desc64[i]; -#if defined(__LP64__) - desc64->physaddr[0] = htole32(physaddr >> 32); -#endif - desc64->physaddr[1] = htole32(physaddr & 0xffffffff); - desc64->length = htole16(sc->rxq.bufsz); - desc64->flags = htole16(NFE_RX_READY); - } else { - desc32 = &sc->rxq.desc32[i]; - desc32->physaddr = htole32(physaddr); - desc32->length = htole16(sc->rxq.bufsz); - desc32->flags = htole16(NFE_RX_READY); - } - } - - bus_dmamap_sync(sc->sc_dmat, ring->map, 0, ring->map->dm_mapsize, - BUS_DMASYNC_PREWRITE); - - return 0; - -fail: nfe_free_rx_ring(sc, ring); - return error; + return; } -void -nfe_reset_rx_ring(struct nfe_softc *sc, struct nfe_rx_ring *ring) +static int nfe_ifmedia_upd(struct ifnet *ifp) { - int i; + struct nfe_softc *sc = ifp->if_softc; - for (i = 0; i < NFE_RX_RING_COUNT; i++) { - if (sc->sc_flags & NFE_40BIT_ADDR) { - ring->desc64[i].length = htole16(ring->bufsz); - ring->desc64[i].flags = htole16(NFE_RX_READY); - } else { - ring->desc32[i].length = htole16(ring->bufsz); - ring->desc32[i].flags = htole16(NFE_RX_READY); - } - } - - bus_dmamap_sync(sc->sc_dmat, ring->map, 0, ring->map->dm_mapsize, - BUS_DMASYNC_PREWRITE); - - ring->cur = ring->next = 0; + NFE_LOCK(sc); + nfe_ifmedia_upd_locked(ifp); + NFE_UNLOCK(sc); + return (0); } -void -nfe_free_rx_ring(struct nfe_softc *sc, struct nfe_rx_ring *ring) +static int nfe_ifmedia_upd_locked(struct ifnet *ifp) { - struct nfe_rx_data *data; - void *desc; - int i, descsize; + struct nfe_softc *sc = ifp->if_softc; + struct mii_data *mii; - if (sc->sc_flags & NFE_40BIT_ADDR) { - desc = ring->desc64; - descsize = sizeof (struct nfe_desc64); - } else { - desc = ring->desc32; - descsize = sizeof (struct nfe_desc32); - } + NFE_LOCK_ASSERT(sc); - if (desc != NULL) { - bus_dmamap_sync(sc->sc_dmat, ring->map, 0, - ring->map->dm_mapsize, BUS_DMASYNC_POSTWRITE); - bus_dmamap_unload(sc->sc_dmat, ring->map); - bus_dmamem_unmap(sc->sc_dmat, (caddr_t)desc, - NFE_RX_RING_COUNT * descsize); - bus_dmamem_free(sc->sc_dmat, &ring->seg, 1); - } + mii = device_get_softc(sc->nfe_miibus); - for (i = 0; i < NFE_RX_RING_COUNT; i++) { - data = &ring->data[i]; - - if (data->map != NULL) { - bus_dmamap_sync(sc->sc_dmat, data->map, 0, - data->map->dm_mapsize, BUS_DMASYNC_POSTREAD); - bus_dmamap_unload(sc->sc_dmat, data->map); - bus_dmamap_destroy(sc->sc_dmat, data->map); + if (mii->mii_instance) { + struct mii_softc *miisc; + for (miisc = LIST_FIRST(&mii->mii_phys); miisc != NULL; + miisc = LIST_NEXT(miisc, mii_list)) { + mii_phy_reset(miisc); } - if (data->m != NULL) - m_freem(data->m); } + mii_mediachg(mii); + + return (0); } -struct nfe_jbuf * -nfe_jalloc(struct nfe_softc *sc) +static void nfe_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr) { - struct nfe_jbuf *jbuf; + struct nfe_softc *sc; + struct mii_data *mii; - jbuf = SLIST_FIRST(&sc->rxq.jfreelist); - if (jbuf == NULL) - return NULL; - SLIST_REMOVE_HEAD(&sc->rxq.jfreelist, jnext); - return jbuf; -} + sc = ifp->if_softc; -/* - * This is called automatically by the network stack when the mbuf is freed. - * Caution must be taken that the NIC might be reset by the time the mbuf is - * freed. - */ -void -nfe_jfree(caddr_t buf, u_int size, void *arg) -{ - struct nfe_softc *sc = arg; - struct nfe_jbuf *jbuf; - int i; + NFE_LOCK(sc); + mii = device_get_softc(sc->nfe_miibus); + mii_pollstat(mii); + NFE_UNLOCK(sc); - /* find the jbuf from the base pointer */ - i = (buf - sc->rxq.jpool) / NFE_JBYTES; - if (i < 0 || i >= NFE_JPOOL_COUNT) { - printf("%s: request to free a buffer (%p) not managed by us\n", - sc->sc_dev.dv_xname, buf); - return; - } - jbuf = &sc->rxq.jbuf[i]; + ifmr->ifm_active = mii->mii_media_active; + ifmr->ifm_status = mii->mii_media_status; - /* ..and put it back in the free list */ - SLIST_INSERT_HEAD(&sc->rxq.jfreelist, jbuf, jnext); + return; } -int -nfe_jpool_alloc(struct nfe_softc *sc) +static void +nfe_tick(void *xsc) { - struct nfe_rx_ring *ring = &sc->rxq; - struct nfe_jbuf *jbuf; - bus_addr_t physaddr; - caddr_t buf; - int i, nsegs, error; + struct nfe_softc *sc; - /* - * Allocate a big chunk of DMA'able memory. - */ - error = bus_dmamap_create(sc->sc_dmat, NFE_JPOOL_SIZE, 1, - NFE_JPOOL_SIZE, 0, BUS_DMA_NOWAIT, &ring->jmap); - if (error != 0) { - printf("%s: could not create jumbo DMA map\n", - sc->sc_dev.dv_xname); - goto fail; - } + sc = xsc; - error = bus_dmamem_alloc(sc->sc_dmat, NFE_JPOOL_SIZE, PAGE_SIZE, 0, - &ring->jseg, 1, &nsegs, BUS_DMA_NOWAIT); - if (error != 0) { - printf("%s could not allocate jumbo DMA memory\n", - sc->sc_dev.dv_xname); - goto fail; - } - - error = bus_dmamem_map(sc->sc_dmat, &ring->jseg, nsegs, NFE_JPOOL_SIZE, - &ring->jpool, BUS_DMA_NOWAIT); - if (error != 0) { - printf("%s: could not map jumbo DMA memory\n", - sc->sc_dev.dv_xname); - goto fail; - } - - error = bus_dmamap_load(sc->sc_dmat, ring->jmap, ring->jpool, - NFE_JPOOL_SIZE, NULL, BUS_DMA_READ | BUS_DMA_NOWAIT); - if (error != 0) { - printf("%s: could not load jumbo DMA map\n", - sc->sc_dev.dv_xname); - goto fail; - } - - /* ..and split it into 9KB chunks */ - SLIST_INIT(&ring->jfreelist); - - buf = ring->jpool; - physaddr = ring->jmap->dm_segs[0].ds_addr; - for (i = 0; i < NFE_JPOOL_COUNT; i++) { - jbuf = &ring->jbuf[i]; - - jbuf->buf = buf; - jbuf->physaddr = physaddr; - - SLIST_INSERT_HEAD(&ring->jfreelist, jbuf, jnext); - - buf += NFE_JBYTES; - physaddr += NFE_JBYTES; - } - - return 0; - -fail: nfe_jpool_free(sc); - return error; + NFE_LOCK(sc); + nfe_tick_locked(sc); + NFE_UNLOCK(sc); } -void -nfe_jpool_free(struct nfe_softc *sc) -{ - struct nfe_rx_ring *ring = &sc->rxq; - if (ring->jmap != NULL) { - bus_dmamap_sync(sc->sc_dmat, ring->jmap, 0, - ring->jmap->dm_mapsize, BUS_DMASYNC_POSTWRITE); - bus_dmamap_unload(sc->sc_dmat, ring->jmap); - bus_dmamap_destroy(sc->sc_dmat, ring->jmap); - } - if (ring->jpool != NULL) { - bus_dmamem_unmap(sc->sc_dmat, ring->jpool, NFE_JPOOL_SIZE); - bus_dmamem_free(sc->sc_dmat, &ring->jseg, 1); - } -} - -int -nfe_alloc_tx_ring(struct nfe_softc *sc, struct nfe_tx_ring *ring) +void nfe_tick_locked(struct nfe_softc *arg) { - int i, nsegs, error; - void **desc; - int descsize; + struct nfe_softc *sc; + struct mii_data *mii; + struct ifnet *ifp; - if (sc->sc_flags & NFE_40BIT_ADDR) { - desc = (void **)&ring->desc64; - descsize = sizeof (struct nfe_desc64); - } else { - desc = (void **)&ring->desc32; - descsize = sizeof (struct nfe_desc32); - } + sc = arg; - ring->queued = 0; - ring->cur = ring->next = 0; + NFE_LOCK_ASSERT(sc); - error = bus_dmamap_create(sc->sc_dmat, NFE_TX_RING_COUNT * descsize, 1, - NFE_TX_RING_COUNT * descsize, 0, BUS_DMA_NOWAIT, &ring->map); + ifp = sc->nfe_ifp; - if (error != 0) { - printf("%s: could not create desc DMA map\n", - sc->sc_dev.dv_xname); - goto fail; - } + mii = device_get_softc(sc->nfe_miibus); + mii_tick(mii); - error = bus_dmamem_alloc(sc->sc_dmat, NFE_TX_RING_COUNT * descsize, - PAGE_SIZE, 0, &ring->seg, 1, &nsegs, BUS_DMA_NOWAIT); - if (error != 0) { - printf("%s: could not allocate DMA memory\n", - sc->sc_dev.dv_xname); - goto fail; - } - - error = bus_dmamem_map(sc->sc_dmat, &ring->seg, nsegs, - NFE_TX_RING_COUNT * descsize, (caddr_t *)desc, BUS_DMA_NOWAIT); - if (error != 0) { - printf("%s: could not map desc DMA memory\n", - sc->sc_dev.dv_xname); - goto fail; - } - - error = bus_dmamap_load(sc->sc_dmat, ring->map, *desc, - NFE_TX_RING_COUNT * descsize, NULL, BUS_DMA_NOWAIT); - if (error != 0) { - printf("%s: could not load desc DMA map\n", - sc->sc_dev.dv_xname); - goto fail; - } - - bzero(*desc, NFE_TX_RING_COUNT * descsize); - ring->physaddr = ring->map->dm_segs[0].ds_addr; - - for (i = 0; i < NFE_TX_RING_COUNT; i++) { - error = bus_dmamap_create(sc->sc_dmat, NFE_JBYTES, - NFE_MAX_SCATTER, NFE_JBYTES, 0, BUS_DMA_NOWAIT, - &ring->data[i].map); - if (error != 0) { - printf("%s: could not create DMA map\n", - sc->sc_dev.dv_xname); - goto fail; + if (!sc->nfe_link) { + if (mii->mii_media_status & IFM_ACTIVE && + IFM_SUBTYPE(mii->mii_media_active) != IFM_NONE) { + sc->nfe_link++; + if (IFM_SUBTYPE(mii->mii_media_active) == IFM_1000_T + && bootverbose) + if_printf(sc->nfe_ifp, "gigabit link up\n"); + if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) + nfe_start_locked(ifp); } } + callout_reset(&sc->nfe_stat_ch, hz, nfe_tick, sc); - return 0; - -fail: nfe_free_tx_ring(sc, ring); - return error; + return; } -void -nfe_reset_tx_ring(struct nfe_softc *sc, struct nfe_tx_ring *ring) -{ - struct nfe_tx_data *data; - int i; - for (i = 0; i < NFE_TX_RING_COUNT; i++) { - if (sc->sc_flags & NFE_40BIT_ADDR) - ring->desc64[i].flags = 0; - else - ring->desc32[i].flags = 0; - - data = &ring->data[i]; - - if (data->m != NULL) { - bus_dmamap_sync(sc->sc_dmat, data->active, 0, - data->active->dm_mapsize, BUS_DMASYNC_POSTWRITE); - bus_dmamap_unload(sc->sc_dmat, data->active); - m_freem(data->m); - data->m = NULL; - } - } - - bus_dmamap_sync(sc->sc_dmat, ring->map, 0, ring->map->dm_mapsize, - BUS_DMASYNC_PREWRITE); - - ring->queued = 0; - ring->cur = ring->next = 0; -} - -void -nfe_free_tx_ring(struct nfe_softc *sc, struct nfe_tx_ring *ring) +static void nfe_shutdown(device_t dev) { - struct nfe_tx_data *data; - void *desc; - int i, descsize; + struct nfe_softc *sc; + struct ifnet *ifp; - if (sc->sc_flags & NFE_40BIT_ADDR) { - desc = ring->desc64; - descsize = sizeof (struct nfe_desc64); - } else { - desc = ring->desc32; - descsize = sizeof (struct nfe_desc32); - } + sc = device_get_softc(dev); - if (desc != NULL) { - bus_dmamap_sync(sc->sc_dmat, ring->map, 0, - ring->map->dm_mapsize, BUS_DMASYNC_POSTWRITE); - bus_dmamap_unload(sc->sc_dmat, ring->map); - bus_dmamem_unmap(sc->sc_dmat, (caddr_t)desc, - NFE_TX_RING_COUNT * descsize); - bus_dmamem_free(sc->sc_dmat, &ring->seg, 1); - } + NFE_LOCK(sc); + ifp = sc->nfe_ifp; + nfe_stop(ifp,0); + /* nfe_reset(sc); */ + NFE_UNLOCK(sc); - for (i = 0; i < NFE_TX_RING_COUNT; i++) { - data = &ring->data[i]; - - if (data->m != NULL) { - bus_dmamap_sync(sc->sc_dmat, data->active, 0, - data->active->dm_mapsize, BUS_DMASYNC_POSTWRITE); - bus_dmamap_unload(sc->sc_dmat, data->active); - m_freem(data->m); - } - } - - /* ..and now actually destroy the DMA mappings */ - for (i = 0; i < NFE_TX_RING_COUNT; i++) { - data = &ring->data[i]; - if (data->map == NULL) - continue; - bus_dmamap_destroy(sc->sc_dmat, data->map); - } + return; } -int -nfe_ifmedia_upd(struct ifnet *ifp) -{ - struct nfe_softc *sc = ifp->if_softc; - struct mii_data *mii = &sc->sc_mii; - struct mii_softc *miisc; - if (mii->mii_instance != 0) { - LIST_FOREACH(miisc, &mii->mii_phys, mii_list) - mii_phy_reset(miisc); - } - return mii_mediachg(mii); -} - -void -nfe_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr) +static void nfe_get_macaddr(struct nfe_softc *sc, u_char *addr) { - struct nfe_softc *sc = ifp->if_softc; - struct mii_data *mii = &sc->sc_mii; - - mii_pollstat(mii); - ifmr->ifm_status = mii->mii_media_status; - ifmr->ifm_active = mii->mii_media_active; -} - -void -nfe_setmulti(struct nfe_softc *sc) -{ - struct arpcom *ac = &sc->sc_arpcom; - struct ifnet *ifp = &ac->ac_if; - struct ether_multi *enm; - struct ether_multistep step; - uint8_t addr[ETHER_ADDR_LEN], mask[ETHER_ADDR_LEN]; - uint32_t filter = NFE_RXFILTER_MAGIC; - int i; - - if ((ifp->if_flags & (IFF_ALLMULTI | IFF_PROMISC)) != 0) { - bzero(addr, ETHER_ADDR_LEN); - bzero(mask, ETHER_ADDR_LEN); - goto done; - } - - bcopy(etherbroadcastaddr, addr, ETHER_ADDR_LEN); - bcopy(etherbroadcastaddr, mask, ETHER_ADDR_LEN); - - ETHER_FIRST_MULTI(step, ac, enm); - while (enm != NULL) { - if (bcmp(enm->enm_addrlo, enm->enm_addrhi, ETHER_ADDR_LEN)) { - ifp->if_flags |= IFF_ALLMULTI; - bzero(addr, ETHER_ADDR_LEN); - bzero(mask, ETHER_ADDR_LEN); - goto done; - } - for (i = 0; i < ETHER_ADDR_LEN; i++) { - addr[i] &= enm->enm_addrlo[i]; - mask[i] &= ~enm->enm_addrlo[i]; - } - ETHER_NEXT_MULTI(step, enm); - } - for (i = 0; i < ETHER_ADDR_LEN; i++) - mask[i] |= addr[i]; - -done: - addr[0] |= 0x01; /* make sure multicast bit is set */ - - NFE_WRITE(sc, NFE_MULTIADDR_HI, - addr[3] << 24 | addr[2] << 16 | addr[1] << 8 | addr[0]); - NFE_WRITE(sc, NFE_MULTIADDR_LO, - addr[5] << 8 | addr[4]); - NFE_WRITE(sc, NFE_MULTIMASK_HI, - mask[3] << 24 | mask[2] << 16 | mask[1] << 8 | mask[0]); - NFE_WRITE(sc, NFE_MULTIMASK_LO, - mask[5] << 8 | mask[4]); - - filter |= (ifp->if_flags & IFF_PROMISC) ? NFE_PROMISC : NFE_U2M; - NFE_WRITE(sc, NFE_RXFILTER, filter); -} - -void -nfe_get_macaddr(struct nfe_softc *sc, uint8_t *addr) -{ uint32_t tmp; tmp = NFE_READ(sc, NFE_MACADDR_LO); addr[0] = (tmp >> 8) & 0xff; addr[1] = (tmp & 0xff); tmp = NFE_READ(sc, NFE_MACADDR_HI); addr[2] = (tmp >> 24) & 0xff; addr[3] = (tmp >> 16) & 0xff; addr[4] = (tmp >> 8) & 0xff; addr[5] = (tmp & 0xff); } -void -nfe_set_macaddr(struct nfe_softc *sc, const uint8_t *addr) +static void nfe_set_macaddr(struct nfe_softc *sc, u_char *addr) { - NFE_WRITE(sc, NFE_MACADDR_LO, - addr[5] << 8 | addr[4]); - NFE_WRITE(sc, NFE_MACADDR_HI, - addr[3] << 24 | addr[2] << 16 | addr[1] << 8 | addr[0]); + + NFE_WRITE(sc, NFE_MACADDR_LO, addr[5] << 8 | addr[4]); + NFE_WRITE(sc, NFE_MACADDR_HI, addr[3] << 24 | addr[2] << 16 | + addr[1] << 8 | addr[0]); } -void -nfe_tick(void *arg) +/* + * Map a single buffer address. + */ + +static void +nfe_dma_map_segs(arg, segs, nseg, error) + void *arg; + bus_dma_segment_t *segs; + int error, nseg; { - struct nfe_softc *sc = arg; - int s; - s = splnet(); - mii_tick(&sc->sc_mii); - splx(s); + if (error) + return; - timeout_add(&sc->sc_tick_ch, hz); + KASSERT(nseg == 1, ("too many DMA segments, %d should be 1", nseg)); + + *(bus_dma_segment_t *)arg = *segs; + + return; } Index: head/sys/dev/nfe/if_nfereg.h =================================================================== --- head/sys/dev/nfe/if_nfereg.h (revision 159966) +++ head/sys/dev/nfe/if_nfereg.h (revision 159967) @@ -1,187 +1,240 @@ -/* $OpenBSD: if_nfereg.h,v 1.18 2006/05/01 15:59:31 brad Exp $ */ +/* $OpenBSD: if_nfereg.h,v 1.16 2006/02/22 19:23:44 damien Exp $ */ /*- * Copyright (c) 2005 Jonathan Gray * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * $FreeBSD$ */ #define NFE_PCI_BA 0x10 #define NFE_RX_RING_COUNT 128 #define NFE_TX_RING_COUNT 256 #define NFE_JBYTES (ETHER_MAX_LEN_JUMBO + ETHER_ALIGN) #define NFE_JPOOL_COUNT (NFE_RX_RING_COUNT + 64) #define NFE_JPOOL_SIZE (NFE_JPOOL_COUNT * NFE_JBYTES) #define NFE_MAX_SCATTER (NFE_TX_RING_COUNT - 2) #define NFE_IRQ_STATUS 0x000 #define NFE_IRQ_MASK 0x004 #define NFE_SETUP_R6 0x008 #define NFE_IMTIMER 0x00c #define NFE_MISC1 0x080 #define NFE_TX_CTL 0x084 #define NFE_TX_STATUS 0x088 #define NFE_RXFILTER 0x08c #define NFE_RXBUFSZ 0x090 #define NFE_RX_CTL 0x094 #define NFE_RX_STATUS 0x098 #define NFE_RNDSEED 0x09c #define NFE_SETUP_R1 0x0a0 #define NFE_SETUP_R2 0x0a4 #define NFE_MACADDR_HI 0x0a8 #define NFE_MACADDR_LO 0x0ac #define NFE_MULTIADDR_HI 0x0b0 #define NFE_MULTIADDR_LO 0x0b4 #define NFE_MULTIMASK_HI 0x0b8 #define NFE_MULTIMASK_LO 0x0bc #define NFE_PHY_IFACE 0x0c0 #define NFE_TX_RING_ADDR_LO 0x100 #define NFE_RX_RING_ADDR_LO 0x104 #define NFE_RING_SIZE 0x108 #define NFE_TX_UNK 0x10c #define NFE_LINKSPEED 0x110 #define NFE_SETUP_R5 0x130 #define NFE_SETUP_R3 0x13C #define NFE_SETUP_R7 0x140 #define NFE_RXTX_CTL 0x144 #define NFE_TX_RING_ADDR_HI 0x148 #define NFE_RX_RING_ADDR_HI 0x14c #define NFE_PHY_STATUS 0x180 #define NFE_SETUP_R4 0x184 #define NFE_STATUS 0x188 #define NFE_PHY_SPEED 0x18c #define NFE_PHY_CTL 0x190 #define NFE_PHY_DATA 0x194 #define NFE_WOL_CTL 0x200 #define NFE_PATTERN_CRC 0x204 #define NFE_PATTERN_MASK 0x208 #define NFE_PWR_CAP 0x268 #define NFE_PWR_STATE 0x26c #define NFE_VTAG_CTL 0x300 #define NFE_PHY_ERROR 0x00001 #define NFE_PHY_WRITE 0x00400 #define NFE_PHY_BUSY 0x08000 #define NFE_PHYADD_SHIFT 5 #define NFE_STATUS_MAGIC 0x140000 #define NFE_R1_MAGIC 0x16070f #define NFE_R2_MAGIC 0x16 #define NFE_R4_MAGIC 0x08 #define NFE_R6_MAGIC 0x03 #define NFE_WOL_MAGIC 0x7770 #define NFE_RX_START 0x01 #define NFE_TX_START 0x01 #define NFE_IRQ_RXERR 0x0001 #define NFE_IRQ_RX 0x0002 #define NFE_IRQ_RX_NOBUF 0x0004 #define NFE_IRQ_TXERR 0x0008 #define NFE_IRQ_TX_DONE 0x0010 #define NFE_IRQ_TIMER 0x0020 #define NFE_IRQ_LINK 0x0040 #define NFE_IRQ_TXERR2 0x0080 #define NFE_IRQ_TX1 0x0100 #define NFE_IRQ_WANTED \ (NFE_IRQ_RXERR | NFE_IRQ_RX_NOBUF | NFE_IRQ_RX | \ NFE_IRQ_TXERR | NFE_IRQ_TXERR2 | NFE_IRQ_TX_DONE | \ NFE_IRQ_LINK) #define NFE_RXTX_KICKTX 0x0001 #define NFE_RXTX_BIT1 0x0002 #define NFE_RXTX_BIT2 0x0004 #define NFE_RXTX_RESET 0x0010 #define NFE_RXTX_VTAG_STRIP 0x0040 #define NFE_RXTX_VTAG_INSERT 0x0080 #define NFE_RXTX_RXCSUM 0x0400 #define NFE_RXTX_V2MAGIC 0x2100 #define NFE_RXTX_V3MAGIC 0x2200 #define NFE_RXFILTER_MAGIC 0x007f0008 #define NFE_U2M (1 << 5) #define NFE_PROMISC (1 << 7) /* default interrupt moderation timer of 128us */ #define NFE_IM_DEFAULT ((128 * 100) / 1024) #define NFE_VTAG_ENABLE (1 << 13) #define NFE_PWR_VALID (1 << 8) #define NFE_PWR_WAKEUP (1 << 15) #define NFE_MEDIA_SET 0x10000 #define NFE_MEDIA_1000T 0x00032 #define NFE_MEDIA_100TX 0x00064 #define NFE_MEDIA_10T 0x003e8 #define NFE_PHY_100TX (1 << 0) #define NFE_PHY_1000T (1 << 1) #define NFE_PHY_HDX (1 << 8) #define NFE_MISC1_MAGIC 0x003b0f3c #define NFE_MISC1_HDX (1 << 1) #define NFE_SEED_MASK 0x0003ff00 #define NFE_SEED_10T 0x00007f00 #define NFE_SEED_100TX 0x00002d00 #define NFE_SEED_1000T 0x00007400 /* Rx/Tx descriptor */ struct nfe_desc32 { uint32_t physaddr; uint16_t length; uint16_t flags; #define NFE_RX_FIXME_V1 0x6004 #define NFE_RX_VALID_V1 (1 << 0) #define NFE_TX_ERROR_V1 0x7808 #define NFE_TX_LASTFRAG_V1 (1 << 0) +#define NFE_RX_ERROR1_V1 (1<<7) +#define NFE_RX_ERROR2_V1 (1<<8) +#define NFE_RX_ERROR3_V1 (1<<9) +#define NFE_RX_ERROR4_V1 (1<<10) } __packed; #define NFE_V1_TXERR "\020" \ "\14TXERROR\13UNDERFLOW\12LATECOLLISION\11LOSTCARRIER\10DEFERRED" \ "\08FORCEDINT\03RETRY\00LASTPACKET" /* V2 Rx/Tx descriptor */ struct nfe_desc64 { uint32_t physaddr[2]; uint32_t vtag; #define NFE_RX_VTAG (1 << 16) #define NFE_TX_VTAG (1 << 18) uint16_t length; uint16_t flags; #define NFE_RX_FIXME_V2 0x4300 #define NFE_RX_VALID_V2 (1 << 13) #define NFE_TX_ERROR_V2 0x5c04 #define NFE_TX_LASTFRAG_V2 (1 << 13) +#define NFE_RX_IP_CSUMOK_V2 0x1000 +#define NFE_RX_UDP_CSUMOK_V2 0x1400 +#define NFE_RX_TCP_CSUMOK_V2 0x1800 +#define NFE_RX_ERROR1_V2 (1<<2) +#define NFE_RX_ERROR2_V2 (1<<3) +#define NFE_RX_ERROR3_V2 (1<<4) +#define NFE_RX_ERROR4_V2 (1<<5) } __packed; #define NFE_V2_TXERR "\020" \ "\14FORCEDINT\13LASTPACKET\12UNDERFLOW\10LOSTCARRIER\09DEFERRED\02RETRY" /* flags common to V1/V2 descriptors */ #define NFE_RX_CSUMOK 0x1c00 #define NFE_RX_ERROR (1 << 14) #define NFE_RX_READY (1 << 15) #define NFE_TX_TCP_CSUM (1 << 10) #define NFE_TX_IP_CSUM (1 << 11) #define NFE_TX_VALID (1 << 15) #define NFE_READ(sc, reg) \ - bus_space_read_4((sc)->sc_memt, (sc)->sc_memh, (reg)) + bus_space_read_4((sc)->nfe_memt, (sc)->nfe_memh, (reg)) #define NFE_WRITE(sc, reg, val) \ - bus_space_write_4((sc)->sc_memt, (sc)->sc_memh, (reg), (val)) + bus_space_write_4((sc)->nfe_memt, (sc)->nfe_memh, (reg), (val)) + +#ifndef PCI_VENDOR_NVIDIA +#define PCI_VENDOR_NVIDIA 0x10DE +#endif + +#define PCI_PRODUCT_NVIDIA_NFORCE_LAN 0x01C3 +#define PCI_PRODUCT_NVIDIA_NFORCE2_LAN 0x0066 +#define PCI_PRODUCT_NVIDIA_NFORCE3_LAN1 0x00D6 +#define PCI_PRODUCT_NVIDIA_NFORCE2_400_LAN1 0x0086 +#define PCI_PRODUCT_NVIDIA_NFORCE2_400_LAN2 0x008C +#define PCI_PRODUCT_NVIDIA_NFORCE3_250_LAN 0x00E6 +#define PCI_PRODUCT_NVIDIA_NFORCE3_LAN4 0x00DF +#define PCI_PRODUCT_NVIDIA_NFORCE4_LAN1 0x0056 +#define PCI_PRODUCT_NVIDIA_NFORCE4_LAN2 0x0057 +#define PCI_PRODUCT_NVIDIA_MCP04_LAN1 0x0037 +#define PCI_PRODUCT_NVIDIA_MCP04_LAN2 0x0038 +#define PCI_PRODUCT_NVIDIA_NFORCE430_LAN1 0x0268 +#define PCI_PRODUCT_NVIDIA_NFORCE430_LAN2 0x0269 +#define PCI_PRODUCT_NVIDIA_MCP55_LAN1 0x0372 +#define PCI_PRODUCT_NVIDIA_MCP55_LAN2 0x0373 + +#define PCI_PRODUCT_NVIDIA_NFORCE3_LAN2 PCI_PRODUCT_NVIDIA_NFORCE2_400_LAN1 +#define PCI_PRODUCT_NVIDIA_NFORCE3_LAN3 PCI_PRODUCT_NVIDIA_NFORCE2_400_LAN2 +#define PCI_PRODUCT_NVIDIA_NFORCE3_LAN5 PCI_PRODUCT_NVIDIA_NFORCE3_250_LAN +#define PCI_PRODUCT_NVIDIA_CK804_LAN1 PCI_PRODUCT_NVIDIA_NFORCE4_LAN1 +#define PCI_PRODUCT_NVIDIA_CK804_LAN2 PCI_PRODUCT_NVIDIA_NFORCE4_LAN2 +#define PCI_PRODUCT_NVIDIA_MCP51_LAN1 PCI_PRODUCT_NVIDIA_NFORCE430_LAN1 +#define PCI_PRODUCT_NVIDIA_MCP51_LAN2 PCI_PRODUCT_NVIDIA_NFORCE430_LAN2 + +#define NFE_DEBUG 0x0000 +#define NFE_DEBUG_INIT 0x0001 +#define NFE_DEBUG_RUNNING 0x0002 +#define NFE_DEBUG_DEINIT 0x0004 +#define NFE_DEBUG_IOCTL 0x0008 +#define NFE_DEBUG_INTERRUPT 0x0010 +#define NFE_DEBUG_API 0x0020 +#define NFE_DEBUG_LOCK 0x0040 +#define NFE_DEBUG_BROKEN 0x0080 +#define NFE_DEBUG_MII 0x0100 +#define NFE_DEBUG_ALL 0xFFFF Index: head/sys/dev/nfe/if_nfevar.h =================================================================== --- head/sys/dev/nfe/if_nfevar.h (revision 159966) +++ head/sys/dev/nfe/if_nfevar.h (revision 159967) @@ -1,91 +1,127 @@ /* $OpenBSD: if_nfevar.h,v 1.11 2006/02/19 13:57:02 damien Exp $ */ /*- * Copyright (c) 2005 Jonathan Gray * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * $FreeBSD$ */ -#define NFE_IFQ_MAXLEN 64 +#define NFE_IFQ_MAXLEN 64 struct nfe_tx_data { - bus_dmamap_t map; + bus_dmamap_t tx_data_map; bus_dmamap_t active; + int nsegs; struct mbuf *m; }; struct nfe_tx_ring { - bus_dmamap_t map; - bus_dma_segment_t seg; + bus_dmamap_t tx_desc_map; + bus_dma_segment_t tx_desc_segs; bus_addr_t physaddr; struct nfe_desc32 *desc32; struct nfe_desc64 *desc64; struct nfe_tx_data data[NFE_TX_RING_COUNT]; int queued; int cur; int next; + bus_addr_t tx_desc_addr; + bus_addr_t tx_data_addr; + bus_dma_tag_t tx_desc_tag; + bus_dma_tag_t tx_data_tag; }; struct nfe_jbuf { caddr_t buf; bus_addr_t physaddr; SLIST_ENTRY(nfe_jbuf) jnext; }; struct nfe_rx_data { - bus_dmamap_t map; + bus_dmamap_t rx_data_map; + bus_dma_tag_t rx_data_tag; + bus_addr_t rx_data_addr; + bus_dma_segment_t rx_data_segs; struct mbuf *m; }; struct nfe_rx_ring { - bus_dmamap_t map; - bus_dma_segment_t seg; - bus_dmamap_t jmap; - bus_dma_segment_t jseg; + bus_dmamap_t rx_desc_map; + bus_dma_segment_t rx_desc_segs; + bus_dma_tag_t rx_desc_tag; + bus_addr_t rx_desc_addr; +#ifndef JMBUF + bus_dmamap_t rx_jumbo_map; + bus_dma_segment_t rx_jumbo_segs; + bus_dma_tag_t rx_jumbo_tag; + bus_addr_t rx_jumbo_addr; + caddr_t jpool; + struct nfe_jbuf jbuf[NFE_JPOOL_COUNT]; + SLIST_HEAD(, nfe_jbuf) jfreelist; +#endif bus_addr_t physaddr; struct nfe_desc32 *desc32; struct nfe_desc64 *desc64; - caddr_t jpool; struct nfe_rx_data data[NFE_RX_RING_COUNT]; - struct nfe_jbuf jbuf[NFE_JPOOL_COUNT]; - SLIST_HEAD(, nfe_jbuf) jfreelist; int bufsz; int cur; int next; }; struct nfe_softc { - struct device sc_dev; - struct arpcom sc_arpcom; - bus_space_handle_t sc_memh; - bus_space_tag_t sc_memt; - void *sc_ih; - bus_dma_tag_t sc_dmat; - struct mii_data sc_mii; - struct timeout sc_tick_ch; - void *sc_powerhook; + struct ifnet *nfe_ifp; + device_t nfe_dev; + device_t nfe_miibus; + struct mtx nfe_mtx; + bus_space_handle_t nfe_memh; + bus_space_tag_t nfe_memt; + struct resource *nfe_res; + struct resource *nfe_irq; + void *nfe_intrhand; + struct mii_data nfe_mii; + u_int8_t nfe_unit; + struct callout nfe_stat_ch; - int sc_if_flags; - u_int sc_flags; -#define NFE_JUMBO_SUP 0x01 -#define NFE_40BIT_ADDR 0x02 -#define NFE_HW_CSUM 0x04 -#define NFE_HW_VLAN 0x08 -#define NFE_USE_JUMBO 0x10 + struct arpcom nfe_arpcom; + bus_dma_tag_t nfe_parent_tag; + /* struct timeout nfe_tick_ch; */ + void *nfe_powerhook; - uint32_t rxtxctl; - uint8_t mii_phyaddr; + int nfe_if_flags; + u_int nfe_flags; +#define NFE_JUMBO_SUP 0x01 +#define NFE_40BIT_ADDR 0x02 +#define NFE_HW_CSUM 0x04 +#define NFE_HW_VLAN 0x08 +#define NFE_USE_JUMBO 0x10 + u_int32_t rxtxctl; + u_int8_t mii_phyaddr; + u_char eaddr[ETHER_ADDR_LEN]; + struct task nfe_txtask; + int nfe_link; struct nfe_tx_ring txq; struct nfe_rx_ring rxq; + +#ifdef DEVICE_POLLING + int rxcycles; +#endif +}; + +struct nfe_type { + u_int16_t vid_id; + u_int16_t dev_id; + char *name; }; Index: head/sys/i386/conf/NOTES =================================================================== --- head/sys/i386/conf/NOTES (revision 159966) +++ head/sys/i386/conf/NOTES (revision 159967) @@ -1,1117 +1,1119 @@ # # NOTES -- Lines that can be cut/pasted into kernel and hints configs. # # This file contains machine dependent kernel configuration notes. For # machine independent notes, look in /sys/conf/NOTES. # # $FreeBSD$ # # # We want LINT to cover profiling as well. profile 2 ##################################################################### # SMP OPTIONS: # # The apic device enables the use of the I/O APIC for interrupt delivery. # The apic device can be used in both UP and SMP kernels, but is required # for SMP kernels. Thus, the apic device is not strictly an SMP option, # but it is a prerequisite for SMP. # # Notes: # # HTT CPUs should only be used if they are enabled in the BIOS. For # the ACPI case, ACPI only correctly tells us about any HTT CPUs if # they are enabled. However, most HTT systems do not list HTT CPUs # in the MP Table if they are enabled, thus we guess at the HTT CPUs # for the MP Table case. However, we shouldn't try to guess and use # these CPUs if HTT is disabled. Thus, HTT guessing is only enabled # for the MP Table if the user explicitly asks for it via the # MPTABLE_FORCE_HTT option. Do NOT use this option if you have HTT # disabled in your BIOS. # # IPI_PREEMPTION instructs the kernel to preempt threads running on other # CPUS if needed. Relies on the PREEMPTION option # Mandatory: device apic # I/O apic # Optional: options MPTABLE_FORCE_HTT # Enable HTT CPUs with the MP Table options IPI_PREEMPTION # # Watchdog routines. # options MP_WATCHDOG # Debugging options. # options STOP_NMI # Stop CPUS using NMI instead of IPI options COUNT_XINVLTLB_HITS # Counters for TLB events options COUNT_IPIS # Per-CPU IPI interrupt counters ##################################################################### # CPU OPTIONS # # You must specify at least one CPU (the one you intend to run on); # deleting the specification for CPUs you don't need to use may make # parts of the system run faster. # cpu I486_CPU cpu I586_CPU # aka Pentium(tm) cpu I686_CPU # aka Pentium Pro(tm) # # Options for CPU features. # # CPU_ATHLON_SSE_HACK tries to enable SSE instructions when the BIOS has # forgotten to enable them. # # CPU_BLUELIGHTNING_3X enables triple-clock mode on IBM Blue Lightning # CPU if CPU supports it. The default is double-clock mode on # BlueLightning CPU box. # # CPU_BLUELIGHTNING_FPU_OP_CACHE enables FPU operand cache on IBM # BlueLightning CPU. It works only with Cyrix FPU, and this option # should not be used with Intel FPU. # # CPU_BTB_EN enables branch target buffer on Cyrix 5x86 (NOTE 1). # # CPU_CYRIX_NO_LOCK enables weak locking for the entire address space # of Cyrix 6x86 and 6x86MX CPUs by setting the NO_LOCK bit of CCR1. # Otherwise, the NO_LOCK bit of CCR1 is cleared. (NOTE 3) # # CPU_DIRECT_MAPPED_CACHE sets L1 cache of Cyrix 486DLC CPU in direct # mapped mode. Default is 2-way set associative mode. # # CPU_DISABLE_5X86_LSSER disables load store serialize (i.e., enables # reorder). This option should not be used if you use memory mapped # I/O device(s). # # CPU_DISABLE_CMPXCHG disables the CMPXCHG instruction on > i386 IA32 # machines. VmWare 3.x seems to emulate this instruction poorly, causing # the guest OS to run very slowly. This problem appears to be fixed in # VmWare 4.x, at least in version 4.5.2, so that enabling this option with # VmWare 4.x will result in locking operations to be 20-30 times slower. # Enabling this with an SMP kernel will cause the kernel to be unusable. # # CPU_DISABLE_SSE explicitly prevents I686_CPU from turning on SSE. # # CPU_ELAN enables support for AMDs ElanSC520 CPU. # CPU_ELAN_PPS enables precision timestamp code. # CPU_ELAN_XTAL sets the clock crystal frequency in Hz. # # CPU_ENABLE_LONGRUN enables support for Transmeta Crusoe LongRun # technology which allows to restrict power consumption of the CPU by # using group of hw.crusoe.* sysctls. # # CPU_FASTER_5X86_FPU enables faster FPU exception handler. # # CPU_GEODE is for the SC1100 Geode embedded processor. This option # is necessary because the i8254 timecounter is toast. # # CPU_I486_ON_386 enables CPU cache on i486 based CPU upgrade products # for i386 machines. # # CPU_IORT defines I/O clock delay time (NOTE 1). Default values of # I/O clock delay time on Cyrix 5x86 and 6x86 are 0 and 7,respectively # (no clock delay). # # CPU_L2_LATENCY specifies the L2 cache latency value. This option is used # only when CPU_PPRO2CELERON is defined and Mendocino Celeron is detected. # The default value is 5. # # CPU_LOOP_EN prevents flushing the prefetch buffer if the destination # of a jump is already present in the prefetch buffer on Cyrix 5x86(NOTE # 1). # # CPU_PPRO2CELERON enables L2 cache of Mendocino Celeron CPUs. This option # is useful when you use Socket 8 to Socket 370 converter, because most Pentium # Pro BIOSs do not enable L2 cache of Mendocino Celeron CPUs. # # CPU_RSTK_EN enables return stack on Cyrix 5x86 (NOTE 1). # # CPU_SOEKRIS enables support www.soekris.com hardware. # # CPU_SUSP_HLT enables suspend on HALT. If this option is set, CPU # enters suspend mode following execution of HALT instruction. # # CPU_UPGRADE_HW_CACHE eliminates unneeded cache flush instruction(s). # # CPU_WT_ALLOC enables write allocation on Cyrix 6x86/6x86MX and AMD # K5/K6/K6-2 CPUs. # # CYRIX_CACHE_WORKS enables CPU cache on Cyrix 486 CPUs with cache # flush at hold state. # # CYRIX_CACHE_REALLY_WORKS enables (1) CPU cache on Cyrix 486 CPUs # without cache flush at hold state, and (2) write-back CPU cache on # Cyrix 6x86 whose revision < 2.7 (NOTE 2). # # NO_F00F_HACK disables the hack that prevents Pentiums (and ONLY # Pentiums) from locking up when a LOCK CMPXCHG8B instruction is # executed. This option is only needed if I586_CPU is also defined, # and should be included for any non-Pentium CPU that defines it. # # NO_MEMORY_HOLE is an optimisation for systems with AMD K6 processors # which indicates that the 15-16MB range is *definitely* not being # occupied by an ISA memory hole. # # NOTE 1: The options, CPU_BTB_EN, CPU_LOOP_EN, CPU_IORT, # CPU_LOOP_EN and CPU_RSTK_EN should not be used because of CPU bugs. # These options may crash your system. # # NOTE 2: If CYRIX_CACHE_REALLY_WORKS is not set, CPU cache is enabled # in write-through mode when revision < 2.7. If revision of Cyrix # 6x86 >= 2.7, CPU cache is always enabled in write-back mode. # # NOTE 3: This option may cause failures for software that requires # locked cycles in order to operate correctly. # options CPU_ATHLON_SSE_HACK options CPU_BLUELIGHTNING_3X options CPU_BLUELIGHTNING_FPU_OP_CACHE options CPU_BTB_EN options CPU_DIRECT_MAPPED_CACHE options CPU_DISABLE_5X86_LSSER options CPU_DISABLE_CMPXCHG #options CPU_DISABLE_SSE options CPU_ELAN options CPU_ELAN_PPS options CPU_ELAN_XTAL=32768000 options CPU_ENABLE_LONGRUN options CPU_FASTER_5X86_FPU options CPU_GEODE options CPU_I486_ON_386 options CPU_IORT options CPU_L2_LATENCY=5 options CPU_LOOP_EN options CPU_PPRO2CELERON options CPU_RSTK_EN options CPU_SOEKRIS options CPU_SUSP_HLT options CPU_UPGRADE_HW_CACHE options CPU_WT_ALLOC options CYRIX_CACHE_WORKS options CYRIX_CACHE_REALLY_WORKS #options NO_F00F_HACK # Debug options options NPX_DEBUG # enable npx debugging # # PERFMON causes the driver for Pentium/Pentium Pro performance counters # to be compiled. See perfmon(4) for more information. # options PERFMON # # XBOX causes the kernel to be bootable on the Microsoft XBox console system. # The resulting kernel will auto-detect whether it is being booted on a XBox, # so kernels compiled with this option will also work on an ordinary PC. # This option require I686_CPU. # # xboxfb includes support for the XBox frame buffer device. It is fully USB- # keyboard aware, and will only be used if an xbox is detected. This option # (obviously) requires XBOX support in your kernel. # # NOTE: xboxfb currently conflicts with syscons(4); if you have an XBOX and # include both in your kernel; you will not get any video output. Ordinary # PC's do not suffer from this. # options XBOX device xboxfb ##################################################################### # NETWORKING OPTIONS # # DEVICE_POLLING adds support for mixed interrupt-polling handling # of network device drivers, which has significant benefits in terms # of robustness to overloads and responsivity, as well as permitting # accurate scheduling of the CPU time between kernel network processing # and other activities. The drawback is a moderate (up to 1/HZ seconds) # potential increase in response times. # It is strongly recommended to use HZ=1000 or 2000 with DEVICE_POLLING # to achieve smoother behaviour. # Additionally, you can enable/disable polling at runtime with help of # the ifconfig(8) utility, and select the CPU fraction reserved to # userland with the sysctl variable kern.polling.user_frac # (default 50, range 0..100). # # Not all device drivers support this mode of operation at the time of # this writing. See polling(4) for more details. options DEVICE_POLLING ##################################################################### # CLOCK OPTIONS # The following options are used for debugging clock behavior only, and # should not be used for production systems. # CLK_CALIBRATION_LOOP causes clock calibration to be run in a loop at # startup until the user presses a key. (The i8254 clock is always # calibrated relative to the RTC (mc146818a) and this option causes the # calibration to be repeated.) options CLK_CALIBRATION_LOOP # CLK_USE_I8254_CALIBRATION causes the calibrated frequency of the i8254 # clock to actually be used. options CLK_USE_I8254_CALIBRATION ##################################################################### # MISCELLANEOUS DEVICES AND OPTIONS device speaker #Play IBM BASIC-style noises out your speaker hint.speaker.0.at="isa" hint.speaker.0.port="0x61" device gzip #Exec gzipped a.out's. REQUIRES COMPAT_AOUT! device apm_saver # Requires APM ##################################################################### # HARDWARE BUS CONFIGURATION # # ISA bus # device isa # Required by npx(4) # # Options for `isa': # # AUTO_EOI_1 enables the `automatic EOI' feature for the master 8259A # interrupt controller. This saves about 0.7-1.25 usec for each interrupt. # This option breaks suspend/resume on some portables. # # AUTO_EOI_2 enables the `automatic EOI' feature for the slave 8259A # interrupt controller. This saves about 0.7-1.25 usec for each interrupt. # Automatic EOI is documented not to work for for the slave with the # original i8259A, but it works for some clones and some integrated # versions. # # MAXMEM specifies the amount of RAM on the machine; if this is not # specified, FreeBSD will first read the amount of memory from the CMOS # RAM, so the amount of memory will initially be limited to 64MB or 16MB # depending on the BIOS. If the BIOS reports 64MB, a memory probe will # then attempt to detect the installed amount of RAM. If this probe # fails to detect >64MB RAM you will have to use the MAXMEM option. # The amount is in kilobytes, so for a machine with 128MB of RAM, it would # be 131072 (128 * 1024). # # BROKEN_KEYBOARD_RESET disables the use of the keyboard controller to # reset the CPU for reboot. This is needed on some systems with broken # keyboard controllers. options AUTO_EOI_1 #options AUTO_EOI_2 options MAXMEM=(128*1024) #options BROKEN_KEYBOARD_RESET # # EISA bus # # The EISA bus device is `eisa'. It provides auto-detection and # configuration support for all devices on the EISA bus. device eisa # By default, only 10 EISA slots are probed, since the slot numbers # above clash with the configuration address space of the PCI subsystem, # and the EISA probe is not very smart about this. This is sufficient # for most machines, but in particular the HP NetServer LC series comes # with an onboard AIC7770 dual-channel SCSI controller on EISA slot #11, # thus you need to bump this figure to 12 for them. options EISA_SLOTS=12 # # MCA bus: # # The MCA bus device is `mca'. It provides auto-detection and # configuration support for all devices on the MCA bus. # No hints are required for MCA. device mca # # PCI bus & PCI options: # device pci # # AGP GART support device agp ##################################################################### # HARDWARE DEVICE CONFIGURATION # To include support for VGA VESA video modes options VESA # Turn on extra debugging checks and output for VESA support. options VESA_DEBUG # # The Numeric Processing eXtension driver. This is non-optional. device npx hint.npx.0.flags="0x0" hint.npx.0.irq="13" # # `flags' for npx0: # 0x01 don't use the npx registers to optimize bcopy. # 0x02 don't use the npx registers to optimize bzero. # 0x04 don't use the npx registers to optimize copyin or copyout. # The npx registers are normally used to optimize copying and zeroing when # all of the following conditions are satisfied: # I586_CPU is an option # the cpu is an i586 (perhaps not a Pentium) # the probe for npx0 succeeds # INT 16 exception handling works. # Then copying and zeroing using the npx registers is normally 30-100% faster. # The flags can be used to control cases where it doesn't work or is slower. # Setting them at boot time using hints works right (the optimizations # are not used until later in the bootstrap when npx0 is attached). # Flag 0x08 automatically disables the i586 optimized routines. # # # Optional devices: # # 3Dfx Voodoo Graphics, Voodoo II /dev/3dfx CDEV support. This will create # the /dev/3dfx0 device to work with glide implementations. This should get # linked to /dev/3dfx and /dev/voodoo. Note that this is not the same as # the tdfx DRI module from XFree86 and is completely unrelated. # # To enable Linuxulator support, one must also include COMPAT_LINUX in the # config as well. The other option is to load both as modules. device tdfx # Enable 3Dfx Voodoo support device tdfx_linux # Enable Linuxulator support # # ACPI support using the Intel ACPI Component Architecture reference # implementation. # # ACPI_DEBUG enables the use of the debug.acpi.level and debug.acpi.layer # kernel environment variables to select initial debugging levels for the # Intel ACPICA code. (Note that the Intel code must also have USE_DEBUGGER # defined when it is built). # # ACPI_NO_SEMAPHORES makes the AcpiOs*Semaphore routines a no-op. # # ACPICA_PEDANTIC enables strict checking of AML. Our default is to # relax these checks to allow code generated by the Microsoft compiler # to still execute. # # Note that building ACPI into the kernel is deprecated; the module is # normally loaded automatically by the loader. device acpi options ACPI_DEBUG #!options ACPI_NO_SEMAPHORES #!options ACPICA_PEDANTIC # ACPI Asus Extras (LCD backlight/brightness, video output, etc.) device acpi_asus # ACPI Fujitsu Extras (Buttons) device acpi_fujitsu # ACPI extras driver for IBM laptops device acpi_ibm # ACPI Panasonic Extras (LCD backlight/brightness, video output, etc.) device acpi_panasonic # ACPI Sony extra (LCD brightness) device acpi_sony # ACPI Toshiba Extras (LCD backlight/brightness, video output, etc.) device acpi_toshiba # ACPI Video Extensions (LCD backlight/brightness, video output, etc.) device acpi_video # ACPI Docking Station device acpi_dock # The cpufreq(4) driver provides support for non-ACPI CPU frequency control device cpufreq # Direct Rendering modules for 3D acceleration. device drm # DRM core module required by DRM drivers device i915drm # Intel i830 through i915 device mach64drm # ATI Rage Pro, Rage Mobility P/M, Rage XL device mgadrm # AGP Matrox G200, G400, G450, G550 device r128drm # ATI Rage 128 device radeondrm # ATI Radeon device savagedrm # S3 Savage3D, Savage4 device sisdrm # SiS 300/305, 540, 630 device tdfxdrm # 3dfx Voodoo 3/4/5 and Banshee options DRM_DEBUG # Include debug printfs (slow) # # mse: Logitech and ATI InPort bus mouse ports device mse hint.mse.0.at="isa" hint.mse.0.port="0x23c" hint.mse.0.irq="5" # # Network interfaces: # # ar: Arnet SYNC/570i hdlc sync 2/4 port V.35/X.21 serial driver # (requires sppp) # arl: Aironet Arlan 655 wireless adapters. # ath: Atheros a/b/g WiFi adapters (requires ath_hal and wlan) # ce: Cronyx Tau-PCI/32 sync single/dual port G.703/E1 serial adaptor # with 32 HDLC subchannels (requires sppp (default), or NETGRAPH if # NETGRAPH_CRONYX is configured) # cp: Cronyx Tau-PCI sync single/dual/four port # V.35/RS-232/RS-530/RS-449/X.21/G.703/E1/E3/T3/STS-1 # serial adaptor (requires sppp (default), or NETGRAPH if # NETGRAPH_CRONYX is configured) # cs: IBM Etherjet and other Crystal Semi CS89x0-based adapters # ctau: Cronyx Tau sync dual port V.35/RS-232/RS-530/RS-449/X.21/G.703/E1 # serial adaptor (requires sppp (default), or NETGRAPH if # NETGRAPH_CRONYX is configured) # cx: Cronyx Sigma multiport sync/async adapter (requires sppp (default), # or NETGRAPH if NETGRAPH_CRONYX is configured) # ed: Western Digital and SMC 80xx; Novell NE1000 and NE2000; 3Com 3C503 # HP PC Lan+, various PC Card devices (refer to etc/defaults/pccard.conf) # (requires miibus) # ie: AT&T StarLAN 10 and EN100; 3Com 3C507; unknown NI5210; # Intel EtherExpress # ipw: Intel PRO/Wireless 2100 IEEE 802.11 adapter # iwi: Intel PRO/Wireless 2200BG/2225BG/2915ABG IEEE 802.11 adapters +# nfe: nVidia nForce MCP on-board Ethernet Networking (BSD open source) # nve: nVidia nForce MCP on-board Ethernet Networking # oltr: Olicom ISA token-ring adapters OC-3115, OC-3117, OC-3118 and OC-3133. # Olicom PCI token-ring adapters OC-3136, OC-3137, OC-3139, OC-3140, # OC-3141, OC-3540 and OC-3250. # ral: Ralink Technology IEEE 802.11 wireless adapter # sbni: Granch SBNI12-xx ISA and PCI adapters # sr: RISCom/N2 hdlc sync 1/2 port V.35/X.21 serial driver (requires sppp) # ural: Ralink Technology RT2500USB IEEE 802.11 wireless adapter # wl: Lucent Wavelan (ISA card only). # Order for ISA/EISA devices is important here device ar hint.ar.0.at="isa" hint.ar.0.port="0x300" hint.ar.0.irq="10" hint.ar.0.maddr="0xd0000" device arl hint.arl.0.at="isa" hint.arl.0.irq="9" hint.arl.0.maddr="0xd0000" device ce device cp device cs hint.cs.0.at="isa" hint.cs.0.port="0x300" device ctau hint.ctau.0.at="isa" hint.ctau.0.port="0x240" hint.ctau.0.irq="15" hint.ctau.0.drq="7" device cx hint.cx.0.at="isa" hint.cx.0.port="0x240" hint.cx.0.irq="15" hint.cx.0.drq="7" #options NETGRAPH_CRONYX # Enable NETGRAPH support for Cronyx adapter(s) device ed options ED_3C503 options ED_HPP options ED_SIC hint.ed.0.at="isa" hint.ed.0.port="0x280" hint.ed.0.irq="5" hint.ed.0.maddr="0xd8000" device ie # Hints only required for Starlan hint.ie.2.at="isa" hint.ie.2.port="0x300" hint.ie.2.irq="5" hint.ie.2.maddr="0xd0000" device iwi device ipw # Hint for the i386-only ISA front-end of le(4). hint.le.0.at="isa" hint.le.0.port="0x280" hint.le.0.irq="10" hint.le.0.drq="0" +device nfe # nVidia nForce MCP on-board Ethernet Networking device nve # nVidia nForce MCP on-board Ethernet Networking device oltr hint.oltr.0.at="isa" device ral device sbni hint.sbni.0.at="isa" hint.sbni.0.port="0x210" hint.sbni.0.irq="0xefdead" hint.sbni.0.flags="0" device sr hint.sr.0.at="isa" hint.sr.0.port="0x300" hint.sr.0.irq="5" hint.sr.0.maddr="0xd0000" device ural device wl hint.wl.0.at="isa" hint.wl.0.port="0x300" options WLCACHE # enables the signal-strength cache options WLDEBUG # enables verbose debugging output device ath device ath_hal # Atheros HAL (includes binary component) #device ath_rate_amrr # AMRR rate control for ath driver #device ath_rate_onoe # Onoe rate control for ath driver device ath_rate_sample # SampleRate rate control for the ath driver #device wlan # 802.11 layer # # ATA raid adapters # device pst # # Areca 11xx and 12xx series of SATA II RAID controllers. # CAM is required. # device arcmsr # Areca SATA II RAID # # 3ware 9000 series PATA/SATA RAID controller driver and options. # The driver is implemented as a SIM, and so, needs the CAM infrastructure. # options TWA_DEBUG # 0-10; 10 prints the most messages. options TWA_FLASH_FIRMWARE # firmware image bundled when defined. device twa # 3ware 9000 series PATA/SATA RAID # # SCSI host adapters: # # ncv: NCR 53C500 based SCSI host adapters. # nsp: Workbit Ninja SCSI-3 based PC Card SCSI host adapters. # stg: TMC 18C30, 18C50 based SCSI host adapters. device ncv device nsp device stg hint.stg.0.at="isa" hint.stg.0.port="0x140" hint.stg.0.port="11" # # Adaptec FSA RAID controllers, including integrated DELL controllers, # the Dell PERC 2/QC and the HP NetRAID-4M device aac device aacp # SCSI Passthrough interface (optional, CAM required) # The 'asr' driver provides support for current DPT/Adaptec SCSI RAID # controllers (SmartRAID V and VI and later). # These controllers require the CAM infrastructure. # device asr # # Highpoint RocketRAID 182x. This is really just software RAID on a # Marvell SATA chip. device hptmv # # Highpoint RocketRAID 232x. This is software RAID but with hardware # acceleration assistance for RAID_5. device rr232x # # IBM (now Adaptec) ServeRAID controllers device ips # # SafeNet crypto driver: can be moved to the MI NOTES as soon as # it's tested on a big-endian machine # device safe # SafeNet 1141 options SAFE_DEBUG # enable debugging support: hw.safe.debug options SAFE_RNDTEST # enable rndtest support ##################################################################### # # Miscellaneous hardware: # # apm: Laptop Advanced Power Management (experimental) # pmtimer: Timer device driver for power management events (APM or ACPI) # smapi: System Management Application Program Interface driver # smbios: DMI/SMBIOS entry point # vpd: Vital Product Data kernel interface # cy: Cyclades serial driver # digi: Digiboard driver # spic: Sony Programmable I/O controller (VAIO notebooks) # Notes on APM # The flags takes the following meaning for apm0: # 0x0020 Statclock is broken. # Notes on the Specialix SI/XIO driver: # The host card is memory, not IO mapped. # The Rev 1 host cards use a 64K chunk, on a 32K boundary. # The Rev 2 host cards use a 32K chunk, on a 32K boundary. # The cards can use an IRQ of 11, 12 or 15. # Notes on the Sony Programmable I/O controller # This is a temporary driver that should someday be replaced by something # that hooks into the ACPI layer. The device is hooked to the PIIX4's # General Device 10 decoder, which means you have to fiddle with PCI # registers to map it in, even though it is otherwise treated here as # an ISA device. At the moment, the driver polls, although the device # is capable of generating interrupts. It largely undocumented. # The port location in the hint is where you WANT the device to be # mapped. 0x10a0 seems to be traditional. At the moment the jogdial # is the only thing truly supported, but apparently a fair percentage # of the Vaio extra features are controlled by this device. device apm hint.apm.0.flags="0x20" device smapi device smbios device vpd device pmtimer # Adjust system timer at wakeup time device cy options CY_PCI_FASTINTR # Use with cy_pci unless irq is shared hint.cy.0.at="isa" hint.cy.0.irq="10" hint.cy.0.maddr="0xd4000" hint.cy.0.msize="0x2000" device digi hint.digi.0.at="isa" hint.digi.0.port="0x104" hint.digi.0.maddr="0xd0000" # BIOS & FEP/OS components of device digi. device digi_CX device digi_CX_PCI device digi_EPCX device digi_EPCX_PCI device digi_Xe device digi_Xem device digi_Xr # Parallel (8255 PPI) basic I/O (mode 0) port (e.g. Advantech PCL-724) device pbio hint.pbio.0.at="isa" hint.pbio.0.port="0x360" device spic hint.spic.0.at="isa" hint.spic.0.port="0x10a0" # HOT1 Xilinx 6200 card (http://www.vcc.com/) device xrpu # # Laptop/Notebook options: # # See also: # apm under `Miscellaneous hardware' # above. # For older notebooks that signal a powerfail condition (external # power supply dropped, or battery state low) by issuing an NMI: options POWERFAIL_NMI # make it beep instead of panicing # # I2C Bus # # Philips i2c bus support is provided by the `iicbus' device. # # Supported interfaces: # pcf Philips PCF8584 ISA-bus controller # device pcf hint.pcf.0.at="isa" hint.pcf.0.port="0x320" hint.pcf.0.irq="5" # # Hardware watchdog timers: # # ichwd: Intel ICH watchdog timer # device ichwd #--------------------------------------------------------------------------- # ISDN4BSD # # See /usr/share/examples/isdn/ROADMAP for an introduction to isdn4bsd. # # i4b passive ISDN cards support contains the following hardware drivers: # # isic - Siemens/Infineon ISDN ISAC/HSCX/IPAC chipset driver # iwic - Winbond W6692 PCI bus ISDN S/T interface controller # ifpi - AVM Fritz!Card PCI driver # ifpi2 - AVM Fritz!Card PCI version 2 driver # ihfc - Cologne Chip HFC ISA/ISA-PnP chipset driver # ifpnp - AVM Fritz!Card PnP driver # itjc - Siemens ISAC / TJNet Tiger300/320 chipset # # i4b active ISDN cards support contains the following hardware drivers: # # iavc - AVM B1 PCI, AVM B1 ISA, AVM T1 # # Note that the ``options'' (if given) and ``device'' lines must BOTH # be uncommented to enable support for a given card ! # # In addition to a hardware driver (and probably an option) the mandatory # ISDN protocol stack devices and the mandatory support device must be # enabled as well as one or more devices from the optional devices section. # #--------------------------------------------------------------------------- # isic driver (Siemens/Infineon chipsets) # device isic # # ISA bus non-PnP Cards: # ---------------------- # # Teles S0/8 or Niccy 1008 options TEL_S0_8 hint.isic.0.at="isa" hint.isic.0.maddr="0xd0000" hint.isic.0.irq="5" hint.isic.0.flags="1" # # Teles S0/16 or Creatix ISDN-S0 or Niccy 1016 options TEL_S0_16 hint.isic.0.at="isa" hint.isic.0.port="0xd80" hint.isic.0.maddr="0xd0000" hint.isic.0.irq="5" hint.isic.0.flags="2" # # Teles S0/16.3 options TEL_S0_16_3 hint.isic.0.at="isa" hint.isic.0.port="0xd80" hint.isic.0.irq="5" hint.isic.0.flags="3" # # AVM A1 or AVM Fritz!Card options AVM_A1 hint.isic.0.at="isa" hint.isic.0.port="0x340" hint.isic.0.irq="5" hint.isic.0.flags="4" # # USRobotics Sportster ISDN TA intern options USR_STI hint.isic.0.at="isa" hint.isic.0.port="0x268" hint.isic.0.irq="5" hint.isic.0.flags="7" # # ITK ix1 Micro ( < V.3, non-PnP version ) options ITKIX1 hint.isic.0.at="isa" hint.isic.0.port="0x398" hint.isic.0.irq="10" hint.isic.0.flags="18" # # ELSA PCC-16 options ELSA_PCC16 hint.isic.0.at="isa" hint.isic.0.port="0x360" hint.isic.0.irq="10" hint.isic.0.flags="20" # # ISA bus PnP Cards: # ------------------ # # Teles S0/16.3 PnP options TEL_S0_16_3_P # # Creatix ISDN-S0 P&P options CRTX_S0_P # # Dr. Neuhaus Niccy Go@ options DRN_NGO # # Sedlbauer Win Speed options SEDLBAUER # # Dynalink IS64PH options DYNALINK # # ELSA QuickStep 1000pro ISA options ELSA_QS1ISA # # Siemens I-Surf 2.0 options SIEMENS_ISURF2 # # Asuscom ISDNlink 128K ISA options ASUSCOM_IPAC # # Eicon Diehl DIVA 2.0 and 2.02 options EICON_DIVA # # Compaq Microcom 610 ISDN card (Compaq series PSB2222I) options COMPAQ_M610 # # PCI bus Cards: # -------------- # # ELSA MicroLink ISDN/PCI (same as ELSA QuickStep 1000pro PCI) options ELSA_QS1PCI # #--------------------------------------------------------------------------- # ifpnp driver for AVM Fritz!Card PnP # # AVM Fritz!Card PnP device ifpnp # #--------------------------------------------------------------------------- # ihfc driver for Cologne Chip ISA chipsets (experimental!) # # Teles 16.3c ISA PnP # AcerISDN P10 ISA PnP # TELEINT ISDN SPEED No.1 device ihfc # #--------------------------------------------------------------------------- # ifpi driver for AVM Fritz!Card PCI # # AVM Fritz!Card PCI device ifpi # #--------------------------------------------------------------------------- # ifpi2 driver for AVM Fritz!Card PCI version 2 # # AVM Fritz!Card PCI version 2 device ifpi2 # #--------------------------------------------------------------------------- # iwic driver for Winbond W6692 chipset # # ASUSCOM P-IN100-ST-D (and other Winbond W6692 based cards) device iwic # #--------------------------------------------------------------------------- # itjc driver for Siemens ISAC / TJNet Tiger300/320 chipset # # Traverse Technologies NETjet-S # Teles PCI-TJ device itjc # #--------------------------------------------------------------------------- # iavc driver (AVM active cards, needs i4bcapi driver!) # device iavc # # AVM B1 ISA bus (PnP mode not supported!) # ---------------------------------------- hint.iavc.0.at="isa" hint.iavc.0.port="0x150" hint.iavc.0.irq="5" # #--------------------------------------------------------------------------- # ISDN Protocol Stack - mandatory for all hardware drivers # # Q.921 / layer 2 - i4b passive cards D channel handling device i4bq921 # # Q.931 / layer 3 - i4b passive cards D channel handling device i4bq931 # # layer 4 - i4b common passive and active card handling device i4b # #--------------------------------------------------------------------------- # ISDN devices - mandatory for all hardware drivers # # userland driver to do ISDN tracing (for passive cards only) device i4btrc options NI4BTRC=4 # # userland driver to control the whole thing device i4bctl # #--------------------------------------------------------------------------- # ISDN devices - optional # # userland driver for access to raw B channel device i4brbch options NI4BRBCH=4 # # userland driver for telephony device i4btel options NI4BTEL=2 # # network driver for IP over raw HDLC ISDN device i4bipr options NI4BIPR=4 # enable VJ header compression detection for ipr i/f options IPR_VJ # enable logging of the first n IP packets to isdnd (n=32 here) options IPR_LOG=32 # # network driver for sync PPP over ISDN; requires an equivalent # number of sppp device to be configured device i4bisppp options NI4BISPPP=4 # # B-channel interface to the netgraph subsystem device i4bing options NI4BING=2 # # CAPI driver needed for active ISDN cards (see iavc driver above) device i4bcapi # #--------------------------------------------------------------------------- # # System Management Bus (SMB) # options ENABLE_ALART # Control alarm on Intel intpm driver # # Set the number of PV entries per process. Increasing this can # stop panics related to heavy use of shared memory. However, that can # (combined with large amounts of physical memory) cause panics at # boot time due the kernel running out of VM space. # # If you're tweaking this, you might also want to increase the sysctls # "vm.v_free_min", "vm.v_free_reserved", and "vm.v_free_target". # # The value below is the one more than the default. # options PMAP_SHPGPERPROC=201 # # Change the size of the kernel virtual address space. Due to # constraints in loader(8) on i386, this must be a multiple of 4. # 256 = 1 GB of kernel address space. Increasing this also causes # a reduction of the address space in user processes. 512 splits # the 4GB cpu address space in half (2GB user, 2GB kernel). # options KVA_PAGES=260 ##################################################################### # ABI Emulation # Enable iBCS2 runtime support for SCO and ISC binaries options IBCS2 # Emulate spx device for client side of SVR3 local X interface options SPX_HACK # Enable Linux ABI emulation options COMPAT_LINUX # Enable i386 a.out binary support options COMPAT_AOUT # Enable the linux-like proc filesystem support (requires COMPAT_LINUX # and PSEUDOFS) options LINPROCFS #Enable the linux-like sys filesystem support (requires COMPAT_LINUX # and PSEUDOFS) options LINSYSFS # # SysVR4 ABI emulation # # The svr4 ABI emulator can be statically compiled into the kernel or loaded as # a KLD module. # The STREAMS network emulation code can also be compiled statically or as a # module. If loaded as a module, it must be loaded before the svr4 module # (the /usr/sbin/svr4 script does this for you). If compiling statically, # the `streams' device must be configured into any kernel which also # specifies COMPAT_SVR4. It is possible to have a statically-configured # STREAMS device and a dynamically loadable svr4 emulator; the /usr/sbin/svr4 # script understands that it doesn't need to load the `streams' module under # those circumstances. # Caveat: At this time, `options KTRACE' is required for the svr4 emulator # (whether static or dynamic). # options COMPAT_SVR4 # build emulator statically options DEBUG_SVR4 # enable verbose debugging device streams # STREAMS network driver (required for svr4). # Enable NDIS binary driver support options NDISAPI device ndis ##################################################################### # VM OPTIONS # Disable the 4 MByte page PSE CPU feature. The PSE feature allows the # kernel to use 4 MByte pages to map the kernel instead of 4k pages. # This saves on the amount of memory needed for page tables needed to # map the kernel. You should only disable this feature as a temporary # workaround if you are having problems with it enabled. # #options DISABLE_PSE # Disable the global pages PGE CPU feature. The PGE feature allows pages # to be marked with the PG_G bit. TLB entries for these pages are not # flushed from the cache when %cr3 is reloaded. This can make context # switches less expensive. You should only disable this feature as a # temporary workaround if you are having problems with it enabled. # #options DISABLE_PG_G # KSTACK_PAGES is the number of memory pages to assign to the kernel # stack of each thread. options KSTACK_PAGES=3 ##################################################################### # More undocumented options for linting. # Note that documenting these are not considered an affront. options FB_INSTALL_CDEV # install a CDEV entry in /dev # PECOFF module (Win32 Execution Format) options PECOFF_SUPPORT options PECOFF_DEBUG options I4B_SMP_WORKAROUND options I586_PMC_GUPROF=0x70000 options KBDIO_DEBUG=2 options KBD_MAXRETRY=4 options KBD_MAXWAIT=6 options KBD_RESETDELAY=201 options PSM_DEBUG=1 options TIMER_FREQ=((14318182+6)/12) options VM_KMEM_SIZE options VM_KMEM_SIZE_MAX options VM_KMEM_SIZE_SCALE # The I/O device device io # asr old ioctls support, needed by raidutils options ASR_COMPAT Index: head/sys/modules/Makefile =================================================================== --- head/sys/modules/Makefile (revision 159966) +++ head/sys/modules/Makefile (revision 159967) @@ -1,559 +1,562 @@ # $FreeBSD$ .include SUBDIR= ${_3dfx} \ ${_3dfx_linux} \ ${_aac} \ accf_data \ accf_http \ ${_acpi} \ ${_agp} \ aha \ ${_ahb} \ ${_aic} \ aic7xxx \ aio \ ${_amd} \ amr \ ${_an} \ ${_aout} \ ${_apm} \ ${_ar} \ ${_arcmsr} \ ${_arcnet} \ ${_arl} \ ${_asr} \ ata \ ath \ ${_ath_hal} \ ath_rate_amrr \ ath_rate_onoe \ ath_rate_sample \ aue \ ${_auxio} \ ${_awi} \ axe \ bfe \ bge \ ${_bios} \ ${_bktr} \ cam \ ${_canbepm} \ ${_canbus} \ ${_cardbus} \ ${_cbb} \ cd9660 \ cd9660_iconv \ cdce \ ${_ce} \ ${_ciss} \ ${_cm} \ coda \ coda5 \ ${_coff} \ ${_cp} \ ${_cpufreq} \ ${_crypto} \ ${_cryptodev} \ ${_cs} \ ${_ctau} \ cue \ ${_cx} \ dc \ dcons \ dcons_crom \ de \ ${_digi} \ ${_dpt} \ ${_drm} \ dummynet \ ${_ed} \ ${_elink} \ ${_em} \ en \ ${_ep} \ ${_ex} \ ${_exca} \ ${_ext2fs} \ fatm \ fdc \ fdescfs \ ${_fe} \ firewire \ firmware \ fxp \ ${_gem} \ geom \ harp \ hatm \ ${_hfa} \ hifn \ hme \ ${_hptmv} \ hwpmc \ ${_i2c} \ ${_ibcs2} \ ${_ichwd} \ ${_ida} \ ${_idt} \ ${_ie} \ if_bridge \ if_disc \ if_ef \ if_faith \ if_gif \ if_gre \ ${_if_ndis} \ if_ppp \ if_sl \ if_stf \ if_tap \ if_tun \ if_vlan \ ${_iir} \ ${_io} \ ipdivert \ ${_ipfilter} \ ipfw \ ip_mroute_mod \ ${_ipmi} \ ${_ips} \ ${_ipw} \ isp \ ispfw \ ${_iwi} \ joy \ kbdmux \ kue \ le \ lge \ libalias \ libiconv \ libmbpool \ libmchain \ ${_linprocfs} \ ${_linsysfs} \ ${_linux} \ lmc \ lpt \ mac_biba \ mac_bsdextended \ mac_ifoff \ mac_lomac \ mac_mls \ mac_none \ mac_partition \ mac_portacl \ mac_seeotheruids \ mac_stub \ mac_test \ mcd \ md \ mem \ mfi \ mii \ mlx \ ${_mly} \ mpt \ mqueue \ msdosfs \ msdosfs_iconv \ ${_mse} \ ${_mxge} \ my \ ${_ncp} \ ${_ncv} \ ${_ndis} \ netgraph \ + ${_nfe} \ nfsclient \ nfsserver \ nge \ nmdm \ ${_nsp} \ ntfs \ ntfs_iconv \ nullfs \ ${_nve} \ ${_nwfs} \ ${_oltr} \ ${_osf1} \ ${_padlock} \ patm \ ${_pccard} \ ${_pcfclock} \ pcn \ ${_pecoff} \ ${_pf} \ ${_pflog} \ plip \ ${_pmc} \ portalfs \ ppbus \ ppc \ ppi \ pps \ procfs \ pseudofs \ ${_pst} \ puc \ ral \ ${_random} \ ${_ray} \ rc \ rc4 \ re \ reiserfs \ rl \ rp \ ${_rr232x} \ rue \ ${_s3} \ ${_safe} \ ${_sbni} \ sbsh \ scc \ scd \ ${_scsi_low} \ sf \ ${_sio} \ sis \ sk \ ${_smbfs} \ sn \ ${_snc} \ snp \ ${_sound} \ ${_speaker} \ ${_splash} \ ${_sppp} \ ${_sr} \ ste \ ${_stg} \ ${_streams} \ sym \ ${_syscons} \ sysvipc \ ti \ tl \ trm \ ${_twa} \ twe \ tx \ txp \ uart \ ubsa \ ubsec \ ubser \ ucom \ ucycom \ udav \ udbp \ udf \ udf_iconv \ ufm \ ${_ufs} \ ufoma \ uftdi \ ugen \ uhid \ ukbd \ ulpt \ umass \ umct \ umodem \ ums \ unionfs \ uplcom \ ural \ urio \ usb \ uscanner \ utopia \ uvisor \ uvscom \ ${_vesa} \ vge \ vkbd \ ${_vpo} \ vr \ vx \ wb \ ${_wi} \ wlan \ wlan_acl \ wlan_ccmp \ wlan_tkip \ wlan_wep \ wlan_xauth \ ${_xe} \ xfs \ xl \ zlib .if ${MACHINE_ARCH} != "powerpc" _syscons= syscons _vpo= vpo .endif .if defined(ALL_MODULES) _ufs= ufs .endif .if ${MK_CRYPT} != "no" || defined(ALL_MODULES) .if exists(${.CURDIR}/../opencrypto) _crypto= crypto _cryptodev= cryptodev .endif .if exists(${.CURDIR}/../crypto) _random= random .endif .endif .if ${MK_IPFILTER} != "no" || defined(ALL_MODULES) _ipfilter= ipfilter .endif .if ${MK_PF} != "no" || defined(ALL_MODULES) _pf= pf _pflog= pflog .endif .if ${MACHINE_ARCH} == "i386" # XXX some of these can move to the general case when de-i386'ed # XXX some of these can move now, but are untested on other architectures. _3dfx= 3dfx _3dfx_linux= 3dfx_linux _agp= agp _aic= aic _amd= amd _an= an _aout= aout _apm= apm _ar= ar _arcnet= arcnet _ath_hal= ath_hal _awi= awi _bktr= bktr _cardbus= cardbus _cbb= cbb _ce= ce _coff= coff _cp= cp _cpufreq= cpufreq _cs= cs _digi= digi _drm= drm _ed= ed _elink= elink _em= em _ep= ep _exca= exca _ext2fs= ext2fs _fe= fe _hfa= hfa _i2c= i2c _ibcs2= ibcs2 _ie= ie _if_ndis= if_ndis _io= io _linprocfs= linprocfs _linsysfs= linsysfs _linux= linux _mse= mse .if ${MK_NCP} != "no" _ncp= ncp .endif _ncv= ncv _ndis= ndis _nsp= nsp .if ${MK_NCP} != "no" _nwfs= nwfs .endif _oltr= oltr _pccard= pccard _pcfclock= pcfclock _pecoff= pecoff _pst= pst _ray= ray _safe= safe _sbni= sbni _scsi_low= scsi_low _sio= sio _smbfs= smbfs _sound= sound _speaker= speaker _splash= splash _sppp= sppp _sr= sr _stg= stg _streams= streams _wi= wi _xe= xe .if ${MACHINE} == "i386" _aac= aac _acpi= acpi _ahb= ahb _arcmsr= arcmsr _arl= arl _asr= asr _bios= bios _ciss= ciss _cm= cm _ctau= ctau _cx= cx _dpt= dpt _ex= ex _hptmv= hptmv _ichwd= ichwd _ida= ida _idt= idt _iir= iir _ipmi= ipmi _ips= ips _ipw= ipw _iwi= iwi _mly= mly _mxge= mxge +_nfe= nfe _nve= nve .if ${MK_CRYPT} != "no" || defined(ALL_MODULES) .if exists(${.CURDIR}/../crypto/via) _padlock= padlock .endif .endif _rr232x= rr232x _s3= s3 _twa= twa _vesa= vesa .elif ${MACHINE} == "pc98" _canbepm= canbepm _canbus= canbus _pmc= pmc _snc= snc .endif .endif .if ${MACHINE_ARCH} == "alpha" _agp= agp _ahb= ahb _ext2fs= ext2fs _osf1= osf1 _sound= sound _sppp= sppp .endif .if ${MACHINE_ARCH} == "amd64" _aac= aac #_acpi= acpi # doesn't work on amd64 yet as module _agp= agp _an= an _arcmsr= arcmsr _ath_hal= ath_hal _cardbus= cardbus _cbb= cbb _ciss= ciss _cpufreq= cpufreq _digi= digi _drm= drm _ed= ed _em= em _exca= exca _ext2fs= ext2fs _hptmv= hptmv _i2c= i2c _ichwd= ichwd _ida= ida _if_ndis= if_ndis _iir= iir _io= io _ipmi= ipmi _ips= ips _ipw= ipw _iwi= iwi _mly= mly _mxge= mxge _ndis= ndis +_nfe= nfe _nve= nve _pccard= pccard _rr232x= rr232x _safe= safe _scsi_low= scsi_low _smbfs= smbfs _sound= sound _speaker= speaker _sppp= sppp _twa= twa _wi= wi .endif .if ${MACHINE_ARCH} == "ia64" # Modules not enabled on ia64 (as compared to i386) include: # aac acpi aout apm atspeaker drm ibcs2 linprocfs linux ncv # nsp oltr pecoff s3 sbni stg vesa # acpi is not enabled because it is broken as a module on ia64 _aic= aic #_ar= ar not 64-bit clean _arcnet= arcnet _asr= asr _an= an _bktr= bktr _cardbus= cardbus _cbb= cbb _ciss= ciss _cm= cm _coff= coff _cpufreq= cpufreq _em= em _ep= ep _exca= exca _fe= fe _hfa= hfa _iir= iir _mly= mly _pccard= pccard _scsi_low= scsi_low _smbfs= smbfs _sound= sound _splash= splash _sppp= sppp #_sr= sr not 64bit clean _streams= streams _wi= wi _xe= xe .endif .if ${MACHINE_ARCH} == "powerpc" _an= an _ath_hal= ath_hal _gem= gem _smbfs= smbfs .endif .if ${MACHINE_ARCH} == "sparc64" _ath_hal= ath_hal _auxio= auxio _em= em _gem= gem _i2c= i2c _sound= sound .endif .if defined(MODULES_OVERRIDE) && !defined(ALL_MODULES) SUBDIR=${MODULES_OVERRIDE} .endif .for reject in ${WITHOUT_MODULES} SUBDIR:= ${SUBDIR:N${reject}} .endfor # Calling kldxref(8) for each module is expensive. .if !defined(NO_XREF) .MAKEFLAGS+= -DNO_XREF afterinstall: @if type kldxref >/dev/null 2>&1; then \ ${ECHO} kldxref ${DESTDIR}${KMODDIR}; \ kldxref ${DESTDIR}${KMODDIR}; \ fi .endif .include Index: head/sys/modules/nfe/Makefile =================================================================== --- head/sys/modules/nfe/Makefile (nonexistent) +++ head/sys/modules/nfe/Makefile (revision 159967) @@ -0,0 +1,8 @@ +# $FreeBSD$ + +.PATH: ${.CURDIR}/../../dev/nfe + +KMOD= if_nfe +SRCS= if_nfe.c opt_bdg.h device_if.h bus_if.h pci_if.h miibus_if.h + +.include Property changes on: head/sys/modules/nfe/Makefile ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property