Index: head/sys/conf/files =================================================================== --- head/sys/conf/files (revision 68516) +++ head/sys/conf/files (revision 68517) @@ -1,1172 +1,1159 @@ # $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. # aicasm optional ahc \ dependency "$S/dev/aic7xxx/aicasm/*.[chyl]" \ compile-with "${MAKE} -f $S/dev/aic7xxx/aicasm/Makefile MAKESRCPATH=$S/dev/aic7xxx/aicasm" \ no-obj no-implicit-rule \ clean "aicasm aicasm_gram.c aicasm_scan.c y.tab.h" aic7xxx_{seq,reg}.h optional ahc \ compile-with "./aicasm ${INCLUDES} -I$S/cam/scsi -I$S/dev/aic7xxx -o aic7xxx_seq.h -r aic7xxx_reg.h $S/dev/aic7xxx/aic7xxx.seq" \ no-obj no-implicit-rule before-depend \ clean "aic7xxx_seq.h aic7xxx_reg.h" \ dependency "$S/dev/aic7xxx/aic7xxx.{reg,seq} $S/cam/scsi/scsi_message.h aicasm" kern/device_if.m standard kern/bus_if.m standard kern/linker_if.m standard cam/cam.c optional scbus cam/cam_extend.c optional scbus cam/cam_periph.c optional scbus cam/cam_queue.c optional scbus cam/cam_sim.c optional scbus cam/cam_xpt.c optional scbus cam/scsi/scsi_all.c optional scbus cam/scsi/scsi_cd.c optional cd cam/scsi/scsi_ch.c optional ch cam/scsi/scsi_da.c optional da cam/scsi/scsi_low.c optional ncv cam/scsi/scsi_low.c optional nsp cam/scsi/scsi_low.c optional stg cam/scsi/scsi_low_pisa.c optional ncv cam/scsi/scsi_low_pisa.c optional nsp cam/scsi/scsi_low_pisa.c optional stg cam/scsi/scsi_pass.c optional pass cam/scsi/scsi_pt.c optional pt cam/scsi/scsi_sa.c optional sa cam/scsi/scsi_ses.c optional ses cam/scsi/scsi_targ_bh.c optional targbh cam/scsi/scsi_target.c optional targ coda/coda_fbsd.c count vcoda coda/coda_namecache.c optional vcoda coda/coda_psdev.c optional vcoda coda/coda_subr.c optional vcoda coda/coda_venus.c optional vcoda coda/coda_vfsops.c optional vcoda coda/coda_vnops.c optional vcoda contrib/dev/acpica/Subsystem/Common/cmalloc.c optional acpica contrib/dev/acpica/Subsystem/Common/cmclib.c optional acpica contrib/dev/acpica/Subsystem/Common/cmcopy.c optional acpica contrib/dev/acpica/Subsystem/Common/cmdebug.c optional acpica contrib/dev/acpica/Subsystem/Common/cmdelete.c optional acpica contrib/dev/acpica/Subsystem/Common/cmeval.c optional acpica contrib/dev/acpica/Subsystem/Common/cmglobal.c optional acpica contrib/dev/acpica/Subsystem/Common/cminit.c optional acpica contrib/dev/acpica/Subsystem/Common/cmobject.c optional acpica contrib/dev/acpica/Subsystem/Common/cmutils.c optional acpica contrib/dev/acpica/Subsystem/Common/cmxface.c optional acpica contrib/dev/acpica/Subsystem/Debugger/dbcmds.c optional acpica acpi_debug contrib/dev/acpica/Subsystem/Debugger/dbdisasm.c optional acpica acpi_debug contrib/dev/acpica/Subsystem/Debugger/dbdisply.c optional acpica acpi_debug contrib/dev/acpica/Subsystem/Debugger/dbexec.c optional acpica acpi_debug contrib/dev/acpica/Subsystem/Debugger/dbfileio.c optional acpica acpi_debug contrib/dev/acpica/Subsystem/Debugger/dbhistry.c optional acpica acpi_debug contrib/dev/acpica/Subsystem/Debugger/dbinput.c optional acpica acpi_debug contrib/dev/acpica/Subsystem/Debugger/dbstats.c optional acpica acpi_debug contrib/dev/acpica/Subsystem/Debugger/dbutils.c optional acpica acpi_debug contrib/dev/acpica/Subsystem/Debugger/dbxface.c optional acpica acpi_debug contrib/dev/acpica/Subsystem/Dispatcher/dsfield.c optional acpica contrib/dev/acpica/Subsystem/Dispatcher/dsmethod.c optional acpica contrib/dev/acpica/Subsystem/Dispatcher/dsmthdat.c optional acpica contrib/dev/acpica/Subsystem/Dispatcher/dsobject.c optional acpica contrib/dev/acpica/Subsystem/Dispatcher/dsopcode.c optional acpica contrib/dev/acpica/Subsystem/Dispatcher/dsutils.c optional acpica contrib/dev/acpica/Subsystem/Dispatcher/dswexec.c optional acpica contrib/dev/acpica/Subsystem/Dispatcher/dswload.c optional acpica contrib/dev/acpica/Subsystem/Dispatcher/dswscope.c optional acpica contrib/dev/acpica/Subsystem/Dispatcher/dswstate.c optional acpica contrib/dev/acpica/Subsystem/Events/evevent.c optional acpica contrib/dev/acpica/Subsystem/Events/evmisc.c optional acpica contrib/dev/acpica/Subsystem/Events/evregion.c optional acpica contrib/dev/acpica/Subsystem/Events/evrgnini.c optional acpica contrib/dev/acpica/Subsystem/Events/evsci.c optional acpica contrib/dev/acpica/Subsystem/Events/evxface.c optional acpica contrib/dev/acpica/Subsystem/Events/evxfevnt.c optional acpica contrib/dev/acpica/Subsystem/Events/evxfregn.c optional acpica contrib/dev/acpica/Subsystem/Hardware/hwacpi.c optional acpica contrib/dev/acpica/Subsystem/Hardware/hwgpe.c optional acpica contrib/dev/acpica/Subsystem/Hardware/hwregs.c optional acpica contrib/dev/acpica/Subsystem/Hardware/hwxface.c optional acpica contrib/dev/acpica/Subsystem/Interpreter/amconfig.c optional acpica contrib/dev/acpica/Subsystem/Interpreter/amcreate.c optional acpica contrib/dev/acpica/Subsystem/Interpreter/amdump.c optional acpica contrib/dev/acpica/Subsystem/Interpreter/amdyadic.c optional acpica contrib/dev/acpica/Subsystem/Interpreter/amfield.c optional acpica contrib/dev/acpica/Subsystem/Interpreter/amfldio.c optional acpica contrib/dev/acpica/Subsystem/Interpreter/ammisc.c optional acpica contrib/dev/acpica/Subsystem/Interpreter/ammonad.c optional acpica contrib/dev/acpica/Subsystem/Interpreter/amnames.c optional acpica contrib/dev/acpica/Subsystem/Interpreter/amprep.c optional acpica contrib/dev/acpica/Subsystem/Interpreter/amregion.c optional acpica contrib/dev/acpica/Subsystem/Interpreter/amresnte.c optional acpica contrib/dev/acpica/Subsystem/Interpreter/amresolv.c optional acpica contrib/dev/acpica/Subsystem/Interpreter/amresop.c optional acpica contrib/dev/acpica/Subsystem/Interpreter/amstore.c optional acpica contrib/dev/acpica/Subsystem/Interpreter/amstoren.c optional acpica contrib/dev/acpica/Subsystem/Interpreter/amstorob.c optional acpica contrib/dev/acpica/Subsystem/Interpreter/amsystem.c optional acpica contrib/dev/acpica/Subsystem/Interpreter/amutils.c optional acpica contrib/dev/acpica/Subsystem/Interpreter/amxface.c optional acpica contrib/dev/acpica/Subsystem/Namespace/nsaccess.c optional acpica contrib/dev/acpica/Subsystem/Namespace/nsalloc.c optional acpica contrib/dev/acpica/Subsystem/Namespace/nsdump.c optional acpica contrib/dev/acpica/Subsystem/Namespace/nseval.c optional acpica contrib/dev/acpica/Subsystem/Namespace/nsinit.c optional acpica contrib/dev/acpica/Subsystem/Namespace/nsload.c optional acpica contrib/dev/acpica/Subsystem/Namespace/nsnames.c optional acpica contrib/dev/acpica/Subsystem/Namespace/nsobject.c optional acpica contrib/dev/acpica/Subsystem/Namespace/nssearch.c optional acpica contrib/dev/acpica/Subsystem/Namespace/nsutils.c optional acpica contrib/dev/acpica/Subsystem/Namespace/nswalk.c optional acpica contrib/dev/acpica/Subsystem/Namespace/nsxfname.c optional acpica contrib/dev/acpica/Subsystem/Namespace/nsxfobj.c optional acpica contrib/dev/acpica/Subsystem/Parser/psargs.c optional acpica contrib/dev/acpica/Subsystem/Parser/psfind.c optional acpica contrib/dev/acpica/Subsystem/Parser/psopcode.c optional acpica contrib/dev/acpica/Subsystem/Parser/psparse.c optional acpica contrib/dev/acpica/Subsystem/Parser/psscope.c optional acpica contrib/dev/acpica/Subsystem/Parser/pstree.c optional acpica contrib/dev/acpica/Subsystem/Parser/psutils.c optional acpica contrib/dev/acpica/Subsystem/Parser/pswalk.c optional acpica contrib/dev/acpica/Subsystem/Parser/psxface.c optional acpica contrib/dev/acpica/Subsystem/Resources/rsaddr.c optional acpica contrib/dev/acpica/Subsystem/Resources/rscalc.c optional acpica contrib/dev/acpica/Subsystem/Resources/rscreate.c optional acpica contrib/dev/acpica/Subsystem/Resources/rsdump.c optional acpica contrib/dev/acpica/Subsystem/Resources/rsio.c optional acpica contrib/dev/acpica/Subsystem/Resources/rsirq.c optional acpica contrib/dev/acpica/Subsystem/Resources/rslist.c optional acpica contrib/dev/acpica/Subsystem/Resources/rsmemory.c optional acpica contrib/dev/acpica/Subsystem/Resources/rsmisc.c optional acpica contrib/dev/acpica/Subsystem/Resources/rsutils.c optional acpica contrib/dev/acpica/Subsystem/Resources/rsxface.c optional acpica contrib/dev/acpica/Subsystem/Tables/tbget.c optional acpica contrib/dev/acpica/Subsystem/Tables/tbinstal.c optional acpica contrib/dev/acpica/Subsystem/Tables/tbutils.c optional acpica contrib/dev/acpica/Subsystem/Tables/tbxface.c optional acpica contrib/dev/acpica/Subsystem/Tables/tbxfroot.c optional acpica crypto/blowfish/bf_cbc.c optional ipsec ipsec_esp crypto/blowfish/bf_cbc_m.c optional ipsec ipsec_esp crypto/blowfish/bf_enc.c optional ipsec ipsec_esp crypto/blowfish/bf_skey.c optional ipsec ipsec_esp crypto/cast128/cast128.c optional ipsec ipsec_esp crypto/cast128/cast128_cbc.c optional ipsec ipsec_esp crypto/des/des_3cbc.c optional ipsec ipsec_esp crypto/des/des_cbc.c optional ipsec ipsec_esp crypto/des/des_ecb.c optional ipsec ipsec_esp crypto/des/des_setkey.c optional ipsec ipsec_esp crypto/rc5/rc5.c optional ipsec ipsec_esp crypto/rc5/rc5_cbc.c optional ipsec ipsec_esp crypto/sha1.c optional ipsec ddb/db_access.c optional ddb ddb/db_break.c optional ddb ddb/db_command.c optional ddb ddb/db_examine.c optional ddb ddb/db_expr.c optional ddb ddb/db_input.c optional ddb ddb/db_kld.c optional ddb ddb/db_lex.c optional ddb ddb/db_output.c optional ddb ddb/db_print.c optional ddb ddb/db_ps.c optional ddb ddb/db_run.c optional ddb ddb/db_sym.c optional ddb ddb/db_sysctl.c optional ddb ddb/db_trap.c optional ddb ddb/db_variables.c optional ddb ddb/db_watch.c optional ddb ddb/db_write_cmd.c optional ddb dev/aac/aac.c optional aac #dev/aac/aac_debug.c optional aac dev/aac/aac_disk.c optional aac dev/aac/aac_pci.c optional aac pci -dev/acpi/acpi.c optional acpi -dev/acpi/acpi_io.c optional acpi -dev/acpi/acpi_event.c optional acpi -dev/acpi/acpi_powerres.c optional acpi -dev/acpi/aml/aml_amlmem.c optional acpi -dev/acpi/aml/aml_common.c optional acpi -dev/acpi/aml/aml_evalobj.c optional acpi -dev/acpi/aml/aml_memman.c optional acpi -dev/acpi/aml/aml_name.c optional acpi -dev/acpi/aml/aml_obj.c optional acpi -dev/acpi/aml/aml_parse.c optional acpi -dev/acpi/aml/aml_store.c optional acpi -dev/acpi/aml/aml_region.c optional acpi dev/acpica/acpi.c optional acpica dev/acpica/acpi_apic.c optional acpica dev/acpica/acpi_button.c optional acpica dev/acpica/acpi_ec.c optional acpica dev/acpica/acpi_isa.c optional acpica isa dev/acpica/acpi_lid.c optional acpica dev/acpica/acpi_pcib.c optional acpica pci dev/acpica/acpi_processor.c optional acpica dev/acpica/acpi_resource.c optional acpica dev/acpica/acpi_thermal.c optional acpica dev/acpica/acpi_timer.c optional acpica dev/acpica/Osd/OsdDebug.c optional acpica dev/acpica/Osd/OsdEnvironment.c optional acpica dev/acpica/Osd/OsdHardware.c optional acpica dev/acpica/Osd/OsdInterrupt.c optional acpica dev/acpica/Osd/OsdMemory.c optional acpica dev/acpica/Osd/OsdSchedule.c optional acpica dev/acpica/Osd/OsdStream.c optional acpica dev/acpica/Osd/OsdSynch.c optional acpica dev/advansys/adv_eisa.c optional adv eisa dev/advansys/adv_pci.c optional adv pci dev/advansys/advansys.c optional adv dev/advansys/advlib.c optional adv dev/advansys/advmcode.c optional adv dev/advansys/adw_pci.c optional adw pci dev/advansys/adwcam.c optional adw dev/advansys/adwlib.c optional adw dev/advansys/adwmcode.c optional adw dev/aha/aha.c count aha dev/aha/aha_isa.c optional aha isa dev/aha/aha_mca.c optional aha mca dev/ahb/ahb.c optional ahb eisa dev/aic/aic.c optional aic dev/aic/aic_pccard.c optional aic card dev/aic7xxx/aic7770.c optional ahc eisa dev/aic7xxx/ahc_eisa.c optional ahc eisa #dev/aic7xxx/ahc_isa.c optional ahc isa dev/aic7xxx/ahc_pci.c optional ahc pci dev/aic7xxx/aic7xxx.c optional ahc dev/aic7xxx/aic7xxx_93cx6.c optional ahc dev/aic7xxx/aic7xxx_freebsd.c optional ahc dev/aic7xxx/aic7xxx_pci.c optional ahc pci dev/amr/amr.c optional amr dev/amr/amr_disk.c optional amr dev/amr/amr_pci.c optional amr dev/an/if_an.c optional an dev/an/if_an_isa.c optional an isa dev/an/if_an_pccard.c optional an card dev/an/if_an_pci.c optional an pci dev/asr/asr.c optional asr pci dev/ata/ata-all.c count ata dev/ata/ata-disk.c count atadisk dev/ata/ata-raid.c count atadisk dev/ata/ata-dma.c optional ata dev/ata/atapi-all.c optional atapicd dev/ata/atapi-all.c optional atapifd dev/ata/atapi-all.c optional atapist dev/ata/atapi-cd.c count atapicd dev/ata/atapi-fd.c count atapifd dev/ata/atapi-tape.c count atapist dev/awi/am79c930.c optional awi dev/awi/awi.c optional awi dev/awi/awi_wep.c optional awi dev/awi/awi_wicfg.c optional awi dev/awi/if_awi_pccard.c optional awi card dev/bktr/bktr_audio.c optional bktr pci dev/bktr/bktr_card.c optional bktr pci dev/bktr/bktr_core.c count bktr pci dev/bktr/bktr_i2c.c optional bktr pci smbus dev/bktr/bktr_os.c optional bktr pci dev/bktr/bktr_tuner.c optional bktr pci dev/buslogic/bt.c optional bt dev/buslogic/bt_eisa.c optional bt eisa dev/buslogic/bt_isa.c optional bt isa dev/buslogic/bt_mca.c optional bt mca dev/buslogic/bt_pci.c optional bt pci dev/cardbus/cardbus.c optional cardbus dev/cardbus/cardbus_cis.c optional cardbus dev/pccbb/pccbb_if.m optional cardbus dev/pccbb/pccbb_if.m optional pccbb dev/ccd/ccd.c count ccd dev/cs/if_cs.c optional cs #dev/dpt/dpt_control.c optional dpt dev/dpt/dpt_eisa.c optional dpt eisa dev/dpt/dpt_pci.c optional dpt pci dev/dpt/dpt_scsi.c optional dpt dev/ed/if_ed.c optional ed dev/ed/if_ed_pccard.c optional ed card dev/ed/if_ed_pci.c optional ed pci dev/en/midway.c count en dev/ep/if_ep.c optional ep dev/ep/if_ep_eisa.c optional ep eisa dev/ep/if_ep_isa.c optional ep isa dev/ep/if_ep_mca.c optional ep mca dev/ep/if_ep_pccard.c optional ep card dev/ex/if_ex.c optional ex dev/ex/if_ex_isa.c optional ex isa dev/ex/if_ex_pccard.c optional ex card dev/fe/if_fe.c optional fe dev/fe/if_fe_pccard.c optional fe card dev/hea/eni.c optional hea dev/hea/eni_buffer.c optional hea dev/hea/eni_globals.c optional hea dev/hea/eni_if.c optional hea dev/hea/eni_init.c optional hea dev/hea/eni_intr.c optional hea dev/hea/eni_receive.c optional hea dev/hea/eni_transmit.c optional hea dev/hea/eni_vcm.c optional hea dev/hfa/fore_buffer.c optional hfa dev/hfa/fore_command.c optional hfa dev/hfa/fore_globals.c optional hfa dev/hfa/fore_if.c optional hfa dev/hfa/fore_init.c optional hfa dev/hfa/fore_intr.c optional hfa dev/hfa/fore_load.c optional hfa dev/hfa/fore_output.c optional hfa dev/hfa/fore_receive.c optional hfa dev/hfa/fore_stats.c optional hfa dev/hfa/fore_timer.c optional hfa dev/hfa/fore_transmit.c optional hfa dev/hfa/fore_vcm.c optional hfa dev/ichsmb/ichsmb.c optional ichsmb dev/ichsmb/ichsmb_pci.c optional ichsmb pci dev/ida/ida.c optional ida dev/ida/ida_disk.c optional ida dev/ida/ida_eisa.c optional ida eisa dev/ida/ida_pci.c optional ida pci dev/ie/if_ie.c count ie isa dev/iicbus/iicbb_if.m optional iicbb dev/iicbus/iicbus_if.m optional iicbus dev/iicbus/if_ic.c optional ic dev/iicbus/iic.c optional iic dev/iicbus/iicbb.c optional iicbb dev/iicbus/iicbus.c optional iicbus dev/iicbus/iiconf.c optional iicbus dev/iicbus/iicsmb.c optional iicsmb \ dependency "iicbus_if.h" dev/isp/isp.c optional isp dev/isp/isp_freebsd.c optional isp dev/isp/isp_target.c optional isp dev/ispfw/ispfw.c optional ispfw dev/lmc/if_lmc.c optional lmc dev/lnc/if_lnc.c count lnc dev/lnc/if_lnc_isa.c optional lnc isa dev/lnc/if_lnc_pc98.c optional lnc isa dev/lnc/if_lnc_pci.c optional lnc pci dev/ncv/ncr53c500.c optional ncv dev/ncv/ncr53c500_pccard.c optional ncv card dev/nsp/nsp.c optional nsp dev/nsp/nsp_pccard.c optional nsp card dev/mca/mca_bus.c optional mca dev/md/md.c optional md dev/mii/amphy.c optional miibus dev/mii/brgphy.c optional miibus dev/mii/dcphy.c optional miibus dev/mii/exphy.c optional miibus dev/mii/mii.c optional miibus dev/mii/mii_physubr.c optional miibus dev/mii/mlphy.c optional miibus dev/mii/nsphy.c optional miibus dev/mii/pnphy.c optional miibus dev/mii/pnaphy.c optional miibus dev/mii/rlphy.c optional miibus dev/mii/tdkphy.c optional miibus dev/mii/tlphy.c optional miibus dev/mii/ukphy.c optional miibus dev/mii/ukphy_subr.c optional miibus dev/mii/xmphy.c optional miibus dev/mii/miibus_if.m optional miibus dev/mlx/mlx.c optional mlx dev/mlx/mlx_disk.c optional mlx dev/mlx/mlx_pci.c optional mlx dev/mly/mly.c optional mly dev/mly/mly_cam.c optional mly dev/mly/mly_pci.c optional mly dev/musycc/musycc.c optional musycc dev/null/null.c standard dev/pccard/card_if.m optional card dev/pccard/card_if.m optional cardbus dev/pccard/card_if.m optional pccard dev/pccard/pccard.c optional pccard dev/pccard/pccard_cis.c optional pccard dev/pccard/pccard_cis_quirks.c optional pccard dev/pccard/power_if.m optional pccbb dev/pccard/power_if.m optional pccard dev/pcic/i82365.c optional pcic pccard dev/pcic/i82365_isa.c optional pcic pccard dev/pdq/if_fea.c optional fea eisa dev/pdq/if_fpa.c count fpa pci dev/pdq/pdq.c optional fea eisa dev/pdq/pdq.c optional fpa pci dev/pdq/pdq_ifsubr.c optional fea eisa dev/pdq/pdq_ifsubr.c optional fpa pci dev/ppbus/ppbus_if.m optional ppbus dev/ppbus/if_plip.c optional plip dev/ppbus/immio.c optional vpo dev/ppbus/lpbb.c optional lpbb dev/ppbus/lpt.c optional lpt dev/ppbus/pcfclock.c optional pcfclock dev/ppbus/ppb_1284.c optional ppbus dev/ppbus/ppb_base.c optional ppbus dev/ppbus/ppb_msq.c optional ppbus dev/ppbus/ppbconf.c optional ppbus dev/ppbus/ppi.c optional ppi dev/ppbus/pps.c optional pps dev/ppbus/vpo.c optional vpo dev/ppbus/vpoio.c optional vpo dev/random/harvest.c standard dev/random/randomdev.c optional random dev/random/yarrow.c optional random dev/random/hash.c optional random crypto/blowfish/bf_cbc.c optional random crypto/blowfish/bf_enc.c optional random crypto/blowfish/bf_skey.c optional random dev/rp/rp.c optional rp dev/rp/rp_isa.c optional rp isa dev/rp/rp_pci.c optional rp pci dev/si/si.c optional si dev/si/si2_z280.c optional si dev/si/si3_t225.c optional si dev/si/si_eisa.c optional si eisa dev/si/si_isa.c optional si isa dev/si/si_pci.c optional si pci dev/smbus/smbus_if.m optional smbus dev/smbus/smb.c optional smb dev/smbus/smbconf.c optional smbus dev/smbus/smbus.c count smbus dev/sn/if_sn.c optional sn dev/sn/if_sn_isa.c optional sn isa dev/sn/if_sn_pccard.c optional sn card dev/sound/isa/ad1816.c optional pcm isa dev/sound/isa/emu8000.c optional midi isa dev/sound/isa/es1888.c optional pcm isa dev/sound/isa/ess.c optional pcm isa dev/sound/isa/gusc.c optional gusc isa dev/sound/isa/gusc.c optional pcm isa dev/sound/isa/gusmidi.c optional midi isa dev/sound/isa/mpu.c optional midi isa dev/sound/isa/mss.c optional pcm isa dev/sound/isa/opl.c optional midi isa dev/sound/isa/sb16.c optional pcm isa dev/sound/isa/sb8.c optional pcm isa dev/sound/isa/sbc.c optional pcm isa dev/sound/isa/sbc.c optional sbc isa dev/sound/isa/uartsio.c optional midi isa dev/sound/midi/midi.c optional midi dev/sound/midi/midibuf.c optional midi dev/sound/midi/midisynth.c optional midi dev/sound/midi/sequencer.c optional seq midi #dev/sound/pci/aureal.c optional pcm pci dev/sound/pci/csa.c optional csa pci dev/sound/pci/csa.c optional pcm pci dev/sound/pci/csamidi.c optional midi csa dev/sound/pci/csapcm.c optional pcm pci dev/sound/pci/ds1.c optional pcm pci dev/sound/pci/emu10k1.c optional pcm pci dev/sound/pci/es137x.c optional pcm pci dev/sound/pci/fm801.c optional pcm pci dev/sound/pci/maestro.c optional pcm pci dev/sound/pci/neomagic.c optional pcm pci dev/sound/pci/solo.c optional pcm pci dev/sound/pci/t4dwave.c optional pcm pci dev/sound/pci/via82c686.c optional pcm pci dev/sound/pcm/ac97.c optional pcm dev/sound/pcm/channel.c optional pcm dev/sound/pcm/dsp.c optional pcm dev/sound/pcm/fake.c optional pcm dev/sound/pcm/feeder.c optional pcm dev/sound/pcm/feeder_fmt.c optional pcm #dev/sound/pcm/feeder_rate.c optional pcm dev/sound/pcm/mixer.c optional pcm dev/sound/pcm/sound.c optional pcm #dev/sound/usb/upcm.c optional pcm usb dev/streams/streams.c optional streams dev/stg/tmc18c30.c optional stg dev/stg/tmc18c30_pccard.c optional stg card dev/stg/tmc18c30_isa.c optional stg isa dev/sym/sym_hipd.c optional sym \ dependency "$S/dev/sym/sym_{conf,defs}.h" dev/tdfx/tdfx_pci.c optional tdfx dev/twe/twe.c optional twe dev/twe/twe_freebsd.c optional twe # # USB support dev/usb/usb_if.m optional usb dev/usb/hid.c optional usb dev/usb/if_aue.c optional aue dev/usb/if_cue.c optional cue dev/usb/if_kue.c optional kue dev/usb/ohci.c optional ohci dev/usb/udbp.c optional udbp dev/usb/ugen.c optional ugen dev/usb/uhci.c optional uhci dev/usb/uhid.c optional uhid dev/usb/uhub.c optional usb dev/usb/ukbd.c optional ukbd dev/usb/ulpt.c optional ulpt dev/usb/umass.c optional umass dev/usb/umodem.c optional umodem dev/usb/ums.c optional ums dev/usb/urio.c optional urio dev/usb/uscanner.c optional uscanner dev/usb/usb.c optional usb dev/usb/usb_ethersubr.c optional usb #dev/usb/usb_mem.c optional usb dev/usb/usb_quirks.c optional usb dev/usb/usb_subr.c optional usb dev/usb/usbdi.c optional usb dev/usb/usbdi_util.c optional usb dev/vinum/vinum.c optional vinum dev/vinum/vinumconfig.c optional vinum dev/vinum/vinumdaemon.c optional vinum dev/vinum/vinuminterrupt.c optional vinum dev/vinum/vinumio.c optional vinum dev/vinum/vinumioctl.c optional vinum dev/vinum/vinumlock.c optional vinum dev/vinum/vinummemory.c optional vinum dev/vinum/vinumparser.c optional vinum dev/vinum/vinumraid5.c optional vinum dev/vinum/vinumrequest.c optional vinum dev/vinum/vinumrevive.c optional vinum dev/vinum/vinumstate.c optional vinum dev/vinum/vinumutil.c optional vinum dev/vn/vn.c optional vn dev/vx/if_vx.c count vx dev/vx/if_vx_eisa.c optional vx eisa dev/vx/if_vx_pci.c optional vx pci dev/xe/if_xe.c optional xe card dev/wds/wd7000.c optional wds isa fs/devfs/devfs_vnops.c optional devfs fs/devfs/devfs_vfsops.c optional devfs fs/devfs/devfs_devs.c optional devfs gnu/ext2fs/ext2_alloc.c optional ext2fs gnu/ext2fs/ext2_balloc.c optional ext2fs gnu/ext2fs/ext2_inode.c optional ext2fs gnu/ext2fs/ext2_inode_cnv.c optional ext2fs gnu/ext2fs/ext2_linux_balloc.c optional ext2fs gnu/ext2fs/ext2_linux_ialloc.c optional ext2fs gnu/ext2fs/ext2_lookup.c optional ext2fs gnu/ext2fs/ext2_subr.c optional ext2fs gnu/ext2fs/ext2_vfsops.c optional ext2fs gnu/ext2fs/ext2_vnops.c optional ext2fs # # isdn4bsd device drivers # i4b/driver/i4b_trace.c count i4btrc i4b/driver/i4b_rbch.c count i4brbch i4b/driver/i4b_tel.c count i4btel i4b/driver/i4b_ipr.c count i4bipr net/slcompress.c optional i4bipr i4b/driver/i4b_ctl.c count i4bctl i4b/driver/i4b_ing.c count i4bing i4b/driver/i4b_isppp.c count i4bisppp i4b/driver/i4b_ispppsubr.c optional i4bisppp net/slcompress.c optional i4bisppp # # isdn4bsd support # i4b/layer2/i4b_mbuf.c optional i4btrc # # isdn4bsd Q.921 handler # i4b/layer2/i4b_l2.c count i4bq921 i4b/layer2/i4b_l2fsm.c optional i4bq921 i4b/layer2/i4b_uframe.c optional i4bq921 i4b/layer2/i4b_tei.c optional i4bq921 i4b/layer2/i4b_sframe.c optional i4bq921 i4b/layer2/i4b_iframe.c optional i4bq921 i4b/layer2/i4b_l2timer.c optional i4bq921 i4b/layer2/i4b_util.c optional i4bq921 i4b/layer2/i4b_lme.c optional i4bq921 # # isdn4bsd Q.931 handler # i4b/layer3/i4b_q931.c count i4bq931 i4b/layer3/i4b_l3fsm.c optional i4bq931 i4b/layer3/i4b_l3timer.c optional i4bq931 i4b/layer3/i4b_l2if.c optional i4bq931 i4b/layer3/i4b_l4if.c optional i4bq931 i4b/layer3/i4b_q932fac.c optional i4bq931 # # isdn4bsd control device driver, interface to isdnd # i4b/layer4/i4b_i4bdrv.c count i4b i4b/layer4/i4b_l4.c optional i4b i4b/layer4/i4b_l4mgmt.c optional i4b i4b/layer4/i4b_l4timer.c optional i4b # isa/isa_if.m optional isa isa/isa_common.c count isa isa/isahint.c optional isa isa/joy.c optional joy isa/pnp.c optional isa isa/pnpparse.c optional isa isofs/cd9660/cd9660_bmap.c optional cd9660 isofs/cd9660/cd9660_lookup.c optional cd9660 isofs/cd9660/cd9660_node.c optional cd9660 isofs/cd9660/cd9660_rrip.c optional cd9660 isofs/cd9660/cd9660_util.c optional cd9660 isofs/cd9660/cd9660_vfsops.c optional cd9660 isofs/cd9660/cd9660_vnops.c optional cd9660 kern/imgact_elf.c standard kern/imgact_shell.c standard kern/inflate.c optional gzip kern/init_main.c standard kern/init_sysent.c standard kern/kern_acct.c standard kern/kern_acl.c standard kern/kern_cap.c standard kern/kern_clock.c standard kern/kern_conf.c standard kern/kern_descrip.c standard kern/kern_environment.c standard kern/kern_event.c standard kern/kern_exec.c standard kern/kern_exit.c standard kern/kern_fork.c standard kern/kern_idle.c standard kern/kern_intr.c standard kern/kern_jail.c standard kern/kern_kthread.c standard kern/kern_ktr.c optional ktr kern/kern_ktrace.c standard kern/kern_linker.c standard kern/kern_lock.c standard kern/kern_lockf.c standard kern/kern_malloc.c standard kern/kern_mib.c standard kern/kern_module.c standard kern/kern_mutex.c standard kern/kern_ntptime.c standard kern/kern_physio.c standard kern/kern_proc.c standard kern/kern_prot.c standard kern/kern_resource.c standard kern/kern_shutdown.c standard kern/kern_sig.c standard kern/kern_subr.c standard kern/kern_switch.c standard kern/kern_synch.c standard kern/kern_syscalls.c standard kern/kern_sysctl.c standard kern/kern_tc.c standard kern/kern_threads.c standard kern/kern_time.c standard kern/kern_timeout.c standard kern/kern_xxx.c standard kern/link_elf.c standard kern/md5c.c standard kern/subr_autoconf.c standard kern/subr_blist.c standard kern/subr_bus.c standard kern/subr_devstat.c standard kern/subr_disk.c standard kern/subr_disklabel.c standard kern/subr_diskslice.c standard kern/subr_eventhandler.c standard kern/subr_kobj.c standard kern/subr_log.c standard kern/subr_module.c standard kern/subr_prf.c standard kern/subr_prof.c standard kern/subr_rman.c standard kern/subr_scanf.c standard kern/subr_taskqueue.c standard kern/subr_xxx.c standard kern/sys_generic.c standard kern/sys_pipe.c standard kern/sys_process.c standard kern/sys_socket.c standard kern/sysv_ipc.c standard kern/sysv_msg.c optional sysvmsg kern/sysv_sem.c optional sysvsem kern/sysv_shm.c optional sysvshm kern/tty.c standard kern/tty_compat.c standard kern/tty_conf.c standard kern/tty_cons.c standard kern/tty_pty.c optional pty kern/tty_snoop.c count snp kern/tty_subr.c standard kern/tty_tty.c standard kern/uipc_accf.c standard kern/uipc_domain.c standard kern/uipc_mbuf.c standard kern/uipc_mbuf2.c standard kern/uipc_proto.c standard kern/uipc_socket.c standard kern/uipc_socket2.c standard kern/uipc_syscalls.c standard kern/uipc_usrreq.c standard kern/vfs_aio.c standard kern/vfs_bio.c standard kern/vfs_cache.c standard kern/vfs_cluster.c standard kern/vfs_conf.c standard kern/vfs_default.c standard kern/vfs_init.c standard kern/vfs_lookup.c standard kern/vfs_subr.c standard kern/vfs_syscalls.c standard kern/vfs_vnops.c standard # # These files in libkern/ are those needed by all architectures. Some # of the files in libkern/ are only needed on some architectures, e.g., # libkern/divdi3.c is needed by i386 but not alpha. Also, some of these # routines may be optimized for a particular platform. In either case, # the file should be moved to /conf/files. from here. # libkern/arc4random.c standard libkern/bcd.c standard libkern/index.c standard libkern/inet_ntoa.c standard libkern/mcount.c optional profiling-routine libkern/qsort.c standard libkern/random.c standard libkern/rindex.c standard libkern/scanc.c standard libkern/skpc.c standard libkern/strcat.c standard libkern/strcmp.c standard libkern/strcpy.c standard libkern/strlen.c standard libkern/strncmp.c standard libkern/strncpy.c standard libkern/strtol.c standard libkern/strtoq.c standard libkern/strtoul.c standard libkern/strtouq.c standard miscfs/deadfs/dead_vnops.c standard miscfs/fdesc/fdesc_vfsops.c optional fdesc miscfs/fdesc/fdesc_vnops.c optional fdesc miscfs/fifofs/fifo_vnops.c standard miscfs/kernfs/kernfs_vfsops.c optional kernfs miscfs/kernfs/kernfs_vnops.c optional kernfs miscfs/nullfs/null_subr.c optional nullfs miscfs/nullfs/null_vfsops.c optional nullfs miscfs/nullfs/null_vnops.c optional nullfs miscfs/portal/portal_vfsops.c optional portal miscfs/portal/portal_vnops.c optional portal miscfs/procfs/procfs_ctl.c optional procfs miscfs/procfs/procfs_dbregs.c standard miscfs/procfs/procfs_fpregs.c standard miscfs/procfs/procfs_map.c optional procfs miscfs/procfs/procfs_mem.c standard miscfs/procfs/procfs_note.c optional procfs miscfs/procfs/procfs_regs.c standard miscfs/procfs/procfs_rlimit.c optional procfs miscfs/procfs/procfs_status.c optional procfs miscfs/procfs/procfs_subr.c optional procfs miscfs/procfs/procfs_type.c optional procfs miscfs/procfs/procfs_vfsops.c optional procfs miscfs/procfs/procfs_vnops.c optional procfs miscfs/specfs/spec_vnops.c standard miscfs/umapfs/umap_subr.c optional umapfs miscfs/umapfs/umap_vfsops.c optional umapfs miscfs/umapfs/umap_vnops.c optional umapfs miscfs/union/union_subr.c optional union miscfs/union/union_vfsops.c optional union miscfs/union/union_vnops.c optional union msdosfs/msdosfs_conv.c optional msdosfs msdosfs/msdosfs_denode.c optional msdosfs msdosfs/msdosfs_fat.c optional msdosfs msdosfs/msdosfs_lookup.c optional msdosfs msdosfs/msdosfs_vfsops.c optional msdosfs msdosfs/msdosfs_vnops.c optional msdosfs net/bpf.c standard net/bpf_filter.c count bpf net/bridge.c optional bridge net/bsd_comp.c optional ppp_bsdcomp #net/hostcache.c standard net/if.c standard net/if_atmsubr.c optional atm net/if_disc.c optional disc net/if_ef.c optional ef net/if_ethersubr.c optional ether net/if_faith.c count faith net/if_fddisubr.c optional fddi net/if_gif.c count gif net/if_iso88025subr.c optional token net/if_loop.c count loop net/if_media.c standard net/if_mib.c standard net/if_ppp.c count ppp net/if_sl.c optional sl net/if_spppsubr.c optional sppp net/if_stf.c count stf net/if_tun.c optional tun net/if_tap.c optional tap net/if_vlan.c count vlan net/intrq.c standard net/net_osdep.c standard net/ppp_deflate.c optional ppp_deflate net/ppp_tty.c optional ppp net/pfil.c optional pfil_hooks net/pfil.c optional ipfilter net/radix.c standard net/raw_cb.c standard net/raw_usrreq.c standard net/route.c standard net/rtsock.c standard net/slcompress.c optional ppp net/slcompress.c optional sl net/zlib.c optional ppp_deflate net/zlib.c optional ipsec netatalk/aarp.c optional netatalk netatalk/at_control.c optional netatalk netatalk/at_proto.c optional netatalk netatalk/at_rmx.c optional netatalkdebug netatalk/ddp_input.c optional netatalk netatalk/ddp_output.c optional netatalk netatalk/ddp_usrreq.c optional netatalk netatm/atm_aal5.c optional atm_core netatm/atm_cm.c optional atm_core netatm/atm_device.c optional atm_core netatm/atm_if.c optional atm_core netatm/atm_proto.c optional atm_core netatm/atm_signal.c optional atm_core netatm/atm_socket.c optional atm_core netatm/atm_subr.c optional atm_core netatm/atm_usrreq.c optional atm_core netatm/ipatm/ipatm_event.c optional atm_ip atm_core netatm/ipatm/ipatm_if.c optional atm_ip atm_core netatm/ipatm/ipatm_input.c optional atm_ip atm_core netatm/ipatm/ipatm_load.c optional atm_ip atm_core netatm/ipatm/ipatm_output.c optional atm_ip atm_core netatm/ipatm/ipatm_usrreq.c optional atm_ip atm_core netatm/ipatm/ipatm_vcm.c optional atm_ip atm_core netatm/sigpvc/sigpvc_if.c optional atm_sigpvc atm_core netatm/sigpvc/sigpvc_subr.c optional atm_sigpvc atm_core netatm/spans/spans_arp.c optional atm_spans atm_core \ dependency "spans_xdr.h" netatm/spans/spans_cls.c optional atm_spans atm_core netatm/spans/spans_if.c optional atm_spans atm_core netatm/spans/spans_kxdr.c optional atm_spans atm_core netatm/spans/spans_msg.c optional atm_spans atm_core netatm/spans/spans_print.c optional atm_spans atm_core netatm/spans/spans_proto.c optional atm_spans atm_core netatm/spans/spans_subr.c optional atm_spans atm_core netatm/spans/spans_util.c optional atm_spans atm_core spans_xdr.h optional atm_spans atm_core \ before-depend \ dependency "$S/netatm/spans/spans_xdr.x" \ compile-with "rpcgen -h -C $S/netatm/spans/spans_xdr.x > spans_xdr.h" \ clean "spans_xdr.h" \ no-obj no-implicit-rule spans_xdr.c optional atm_spans atm_core \ before-depend \ dependency "$S/netatm/spans/spans_xdr.x" \ compile-with "rpcgen -c -C $S/netatm/spans/spans_xdr.x > spans_xdr.c" \ clean "spans_xdr.c" \ no-obj no-implicit-rule local spans_xdr.o optional atm_spans atm_core \ dependency "$S/netatm/spans/spans_xdr.x" \ compile-with "${NORMAL_C}" \ no-implicit-rule local netatm/uni/q2110_sigaa.c optional atm_uni atm_core netatm/uni/q2110_sigcpcs.c optional atm_uni atm_core netatm/uni/q2110_subr.c optional atm_uni atm_core netatm/uni/qsaal1_sigaa.c optional atm_uni atm_core netatm/uni/qsaal1_sigcpcs.c optional atm_uni atm_core netatm/uni/qsaal1_subr.c optional atm_uni atm_core netatm/uni/sscf_uni.c optional atm_uni atm_core netatm/uni/sscf_uni_lower.c optional atm_uni atm_core netatm/uni/sscf_uni_upper.c optional atm_uni atm_core netatm/uni/sscop.c optional atm_uni atm_core netatm/uni/sscop_lower.c optional atm_uni atm_core netatm/uni/sscop_pdu.c optional atm_uni atm_core netatm/uni/sscop_sigaa.c optional atm_uni atm_core netatm/uni/sscop_sigcpcs.c optional atm_uni atm_core netatm/uni/sscop_subr.c optional atm_uni atm_core netatm/uni/sscop_timer.c optional atm_uni atm_core netatm/uni/sscop_upper.c optional atm_uni atm_core netatm/uni/uni_load.c optional atm_uni atm_core netatm/uni/uniarp.c optional atm_uni atm_core netatm/uni/uniarp_cache.c optional atm_uni atm_core netatm/uni/uniarp_input.c optional atm_uni atm_core netatm/uni/uniarp_output.c optional atm_uni atm_core netatm/uni/uniarp_timer.c optional atm_uni atm_core netatm/uni/uniarp_vcm.c optional atm_uni atm_core netatm/uni/uniip.c optional atm_uni atm_core netatm/uni/unisig_decode.c optional atm_uni atm_core netatm/uni/unisig_encode.c optional atm_uni atm_core netatm/uni/unisig_if.c optional atm_uni atm_core netatm/uni/unisig_mbuf.c optional atm_uni atm_core netatm/uni/unisig_msg.c optional atm_uni atm_core netatm/uni/unisig_print.c optional atm_uni atm_core netatm/uni/unisig_proto.c optional atm_uni atm_core netatm/uni/unisig_sigmgr_state.c optional atm_uni atm_core netatm/uni/unisig_subr.c optional atm_uni atm_core netatm/uni/unisig_util.c optional atm_uni atm_core netatm/uni/unisig_vc_state.c optional atm_uni atm_core netgraph/ng_UI.c optional netgraph_UI netgraph/ng_async.c optional netgraph_async netgraph/ng_base.c optional netgraph netgraph/ng_bpf.c optional netgraph_bpf net/bpf_filter.c optional netgraph_bpf netgraph/ng_bridge.c optional netgraph_bridge netgraph/ng_cisco.c optional netgraph_cisco netgraph/ng_echo.c optional netgraph_echo netgraph/ng_ether.c optional netgraph_ether netgraph/ng_frame_relay.c optional netgraph_frame_relay netgraph/ng_hole.c optional netgraph_hole netgraph/ng_iface.c optional netgraph_iface netgraph/ng_ksocket.c optional netgraph_ksocket netgraph/ng_lmi.c optional netgraph_lmi netgraph/ng_mppc.c optional netgraph_mppc_compression # The next two files (plus the header file net/mppc.h) are proprietary and # must be obtained elsewhere in order to enable NETGRAPH_MPPC_COMPRESSION net/mppcc.c optional netgraph_mppc_compression net/mppcd.c optional netgraph_mppc_compression netgraph/ng_mppc.c optional netgraph_mppc_encryption crypto/rc4/rc4.c optional awi crypto/rc4/rc4.c optional netgraph_mppc_encryption crypto/sha1.c optional netgraph_mppc_encryption netgraph/ng_parse.c optional netgraph netgraph/ng_ppp.c optional netgraph_ppp netgraph/ng_pppoe.c optional netgraph_pppoe netgraph/ng_pptpgre.c optional netgraph_pptpgre netgraph/ng_rfc1490.c optional netgraph_rfc1490 netgraph/ng_socket.c optional netgraph_socket netgraph/ng_tee.c optional netgraph_tee netgraph/ng_tty.c optional netgraph_tty netgraph/ng_vjc.c optional netgraph_vjc net/slcompress.c optional netgraph_vjc netinet/accf_data.c optional accept_filter_data netinet/accf_http.c optional accept_filter_http netinet/fil.c optional ipfilter inet netinet/if_atm.c optional atm netinet/if_ether.c optional ether netinet/igmp.c optional inet netinet/in.c optional inet netinet/in_gif.c optional gif inet #netinet/in_hostcache.c optional inet netinet/in_pcb.c optional inet netinet/in_proto.c optional inet netinet/in_rmx.c optional inet netinet/ip_auth.c optional ipfilter inet netinet/ip_divert.c optional ipdivert netinet/ip_dummynet.c optional dummynet netinet/ip_ecn.c optional inet netinet/ip_ecn.c optional inet6 netinet/ip_encap.c optional inet netinet/ip_encap.c optional inet6 netinet/ip_fil.c optional ipfilter inet netinet/ip_flow.c optional inet netinet/ip_frag.c optional ipfilter inet netinet/ip_fw.c optional ipfirewall netinet/ip_icmp.c optional inet netinet/ip_input.c optional inet netinet/ip_log.c optional ipfilter inet netinet/ip_mroute.c optional inet netinet/ip_nat.c optional ipfilter inet netinet/ip_output.c optional inet netinet/ip_proxy.c optional ipfilter inet netinet/ip_state.c optional ipfilter inet netinet/mlfk_ipl.c optional ipfilter inet netinet/raw_ip.c optional inet netinet/tcp_debug.c optional tcpdebug netinet/tcp_input.c optional inet netinet/tcp_output.c optional inet netinet/tcp_subr.c optional inet netinet/tcp_timer.c optional inet netinet/tcp_usrreq.c optional inet netinet/udp_usrreq.c optional inet netinet6/ah_core.c optional ipsec netinet6/ah_input.c optional ipsec netinet6/ah_output.c optional ipsec netinet6/dest6.c optional inet6 netinet6/esp_core.c optional ipsec ipsec_esp netinet6/esp_input.c optional ipsec ipsec_esp netinet6/esp_output.c optional ipsec ipsec_esp netinet6/frag6.c optional inet6 netinet6/icmp6.c optional inet6 netinet6/in6.c optional inet6 netinet6/in6_cksum.c optional inet6 netinet6/in6_gif.c optional gif inet6 netinet6/in6_ifattach.c optional inet6 netinet6/in6_pcb.c optional inet6 netinet6/in6_prefix.c optional inet6 netinet6/in6_proto.c optional inet6 netinet6/in6_rmx.c optional inet6 netinet6/in6_src.c optional inet6 netinet6/ip6_forward.c optional inet6 netinet6/ip6_fw.c optional inet6 ipv6firewall netinet6/ip6_input.c optional inet6 netinet6/ip6_mroute.c optional inet6 netinet6/ip6_output.c optional inet6 netinet6/ipcomp_core.c optional ipsec netinet6/ipcomp_input.c optional ipsec netinet6/ipcomp_output.c optional ipsec netinet6/ipsec.c optional ipsec netinet6/mld6.c optional inet6 netinet6/nd6.c optional inet6 netinet6/nd6_nbr.c optional inet6 netinet6/nd6_rtr.c optional inet6 netinet6/raw_ip6.c optional inet6 netinet6/route6.c optional inet6 netinet6/scope6.c optional inet6 netinet6/udp6_output.c optional inet6 netinet6/udp6_usrreq.c optional inet6 netipx/ipx.c optional ipx netipx/ipx_cksum.c optional ipx netipx/ipx_input.c optional ipx netipx/ipx_ip.c optional ipx netipx/ipx_outputfl.c optional ipx netipx/ipx_pcb.c optional ipx netipx/ipx_proto.c optional ipx netipx/ipx_tun.c optional ipx netipx/ipx_usrreq.c optional ipx netipx/spx_debug.c optional ipx netipx/spx_usrreq.c optional ipx netkey/key.c optional ipsec netkey/keydb.c optional ipsec netkey/key_debug.c optional ipsec netkey/keysock.c optional ipsec netnatm/natm.c optional natm netnatm/natm_pcb.c optional natm netnatm/natm_proto.c optional natm netncp/ncp_conn.c optional ncp netncp/ncp_crypt.c optional ncp netncp/ncp_login.c optional ncp netncp/ncp_mod.c optional ncp netncp/ncp_ncp.c optional ncp netncp/ncp_nls.c optional ncp netncp/ncp_rq.c optional ncp netncp/ncp_sock.c optional ncp netncp/ncp_subr.c optional ncp netns/idp_usrreq.c optional ns netns/ns.c optional ns netns/ns_error.c optional ns netns/ns_input.c optional ns netns/ns_ip.c optional ns netns/ns_output.c optional ns netns/ns_pcb.c optional ns netns/ns_proto.c optional ns netns/spp_debug.c optional ns netns/spp_usrreq.c optional ns nfs/bootp_subr.c optional bootp nfs/krpc_subr.c optional bootp nfs/nfs_bio.c optional nfs nfs/nfs_node.c optional nfs nfs/nfs_nqlease.c optional nfs nfs/nfs_serv.c optional nfs nfs/nfs_socket.c optional nfs nfs/nfs_srvcache.c optional nfs nfs/nfs_subs.c optional nfs nfs/nfs_syscalls.c optional nfs nfs/nfs_vfsops.c optional nfs nfs/nfs_vnops.c optional nfs ntfs/ntfs_compr.c optional ntfs ntfs/ntfs_ihash.c optional ntfs ntfs/ntfs_subr.c optional ntfs ntfs/ntfs_vfsops.c optional ntfs ntfs/ntfs_vnops.c optional ntfs nwfs/nwfs_io.c optional nwfs nwfs/nwfs_ioctl.c optional nwfs nwfs/nwfs_node.c optional nwfs nwfs/nwfs_subr.c optional nwfs nwfs/nwfs_vfsops.c optional nwfs nwfs/nwfs_vnops.c optional nwfs pccard/pccard.c count card pccard/pccard_beep.c optional card pccard/pccard_nbk.c optional card pccard/pcic.c optional pcic card pci/agp.c optional agp pci/agp_if.m optional agp pci/agp_intel.c optional agp pci/agp_via.c optional agp pci/agp_sis.c optional agp pci/agp_ali.c optional agp pci/agp_amd.c optional agp pci/agp_i810.c optional agp pci/alpm.c count alpm pci/amd.c optional amd pci/cy_pci.c optional cy pci pci/if_ar_p.c count ar pci pci/if_dc.c optional dc pci/if_de.c optional de pci/if_en_pci.c optional en pci pci/if_fxp.c optional fxp pci/if_mn.c optional mn pci/if_pcn.c optional pcn pci/if_rl.c optional rl pci/if_sf.c optional sf pci/if_sis.c optional sis pci/if_sk.c optional sk pci/if_sr_p.c optional sr pci pci/if_ste.c optional ste pci/if_ti.c optional ti pci/if_tl.c optional tl pci/if_tx.c optional tx pci/if_vr.c optional vr pci/if_wb.c optional wb pci/if_wx.c optional wx pci/if_xl.c optional xl pci/intpm.c optional intpm pci/isp_pci.c optional isp pci/meteor.c count meteor pci pci/ncr.c optional ncr pci/ohci_pci.c optional ohci dev/pccbb/pccbb.c optional pccbb pci/pci.c count pci pci/pci_compat.c optional pci compat_oldpci \ warning "Old PCI driver compatability shims present." pci/pcic_p.c optional pcic pci pci/pcisupport.c optional pci pci/pci_if.m optional pci pci/pcib_if.m optional pci pci/simos.c optional simos pci/uhci_pci.c optional uhci pci/xrpu.c optional xrpu posix4/ksched.c optional _kposix_priority_scheduling posix4/p1003_1b.c standard posix4/posix4_mib.c standard ufs/ffs/ffs_alloc.c optional ffs ufs/ffs/ffs_alloc.c optional ifs ufs/ffs/ffs_alloc.c optional mfs ufs/ffs/ffs_balloc.c optional ffs ufs/ffs/ffs_balloc.c optional ifs ufs/ffs/ffs_balloc.c optional mfs ufs/ffs/ffs_inode.c optional ffs ufs/ffs/ffs_inode.c optional ifs ufs/ffs/ffs_inode.c optional mfs ufs/ffs/ffs_snapshot.c optional ffs ufs/ffs/ffs_snapshot.c optional ifs ufs/ffs/ffs_snapshot.c optional mfs ufs/ffs/ffs_softdep.c optional softupdates ufs/ffs/ffs_softdep_stub.c standard ufs/ffs/ffs_subr.c optional ffs ufs/ffs/ffs_subr.c optional ifs ufs/ffs/ffs_subr.c optional mfs ufs/ffs/ffs_tables.c optional ffs ufs/ffs/ffs_tables.c optional ifs ufs/ffs/ffs_tables.c optional mfs ufs/ffs/ffs_vfsops.c optional ffs ufs/ffs/ffs_vfsops.c optional ifs ufs/ffs/ffs_vfsops.c optional mfs ufs/ffs/ffs_vnops.c optional ffs ufs/ffs/ffs_vnops.c optional ifs ufs/ffs/ffs_vnops.c optional mfs ufs/mfs/mfs_vfsops.c optional mfs ufs/mfs/mfs_vnops.c optional mfs ufs/ufs/ufs_bmap.c standard ufs/ufs/ufs_extattr.c standard ufs/ufs/ufs_ihash.c standard ufs/ufs/ufs_inode.c standard ufs/ufs/ufs_lookup.c standard ufs/ifs/ifs_lookup.c optional ifs ufs/ifs/ifs_vfsops.c optional ifs ufs/ifs/ifs_vnops.c optional ifs ufs/ifs/ifs_subr.c optional ifs ufs/ufs/ufs_quota.c standard ufs/ufs/ufs_vfsops.c standard ufs/ufs/ufs_vnops.c standard vm/default_pager.c standard vm/device_pager.c standard vm/phys_pager.c standard vm/swap_pager.c standard vm/vm_fault.c standard vm/vm_glue.c standard vm/vm_init.c standard vm/vm_kern.c standard vm/vm_map.c standard vm/vm_meter.c standard vm/vm_mmap.c standard vm/vm_object.c standard vm/vm_page.c standard vm/vm_pageout.c standard vm/vm_pager.c standard vm/vm_swap.c standard vm/vm_unix.c standard vm/vm_zone.c standard vm/vnode_pager.c standard Index: head/sys/conf/files.i386 =================================================================== --- head/sys/conf/files.i386 (revision 68516) +++ head/sys/conf/files.i386 (revision 68517) @@ -1,363 +1,362 @@ # 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} -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} -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" # msysosak.o optional fla \ dependency "$S/contrib/dev/fla/i386/msysosak.o.uu" \ compile-with "uudecode < $S/contrib/dev/fla/i386/msysosak.o.uu" \ no-implicit-rule # trlld.o optional oltr \ dependency "$S/contrib/dev/oltr/i386${FMT}.trlld.o.uu" \ compile-with "uudecode < $S/contrib/dev/oltr/i386${FMT}.trlld.o.uu" \ no-implicit-rule # compat/linux/linux_file.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_util.c optional compat_linux 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/acpica/Subsystem/Hardware/hwcpu32.c optional acpica contrib/dev/fla/fla.c optional fla contrib/dev/oltr/if_oltr.c optional oltr contrib/dev/oltr/trlldbm.c optional oltr contrib/dev/oltr/trlldhm.c optional oltr contrib/dev/oltr/trlldmac.c optional oltr dev/advansys/adv_isa.c optional adv isa dev/aic/aic_isa.c optional aic isa dev/ed/if_ed_isa.c optional ed isa dev/eisa/eisaconf.c count eisa dev/fb/fb.c optional fb dev/fb/fb.c optional vga dev/fb/splash.c count splash dev/fb/vga.c optional vga dev/fe/if_fe_isa.c optional fe isa dev/kbd/atkbd.c optional atkbd dev/kbd/atkbdc.c count atkbdc dev/kbd/kbd.c optional atkbd dev/kbd/kbd.c optional kbd dev/kbd/kbd.c optional sc dev/kbd/kbd.c optional ukbd dev/kbd/kbd.c optional vt dev/syscons/schistory.c count 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 gnu/i386/fpemul/div_small.s optional gpl_math_emulate gnu/i386/fpemul/errors.c optional gpl_math_emulate gnu/i386/fpemul/fpu_arith.c optional gpl_math_emulate gnu/i386/fpemul/fpu_aux.c optional gpl_math_emulate gnu/i386/fpemul/fpu_entry.c optional gpl_math_emulate gnu/i386/fpemul/fpu_etc.c optional gpl_math_emulate gnu/i386/fpemul/fpu_trig.c optional gpl_math_emulate gnu/i386/fpemul/get_address.c optional gpl_math_emulate gnu/i386/fpemul/load_store.c optional gpl_math_emulate gnu/i386/fpemul/poly_2xm1.c optional gpl_math_emulate gnu/i386/fpemul/poly_atan.c optional gpl_math_emulate gnu/i386/fpemul/poly_div.s optional gpl_math_emulate gnu/i386/fpemul/poly_l2.c optional gpl_math_emulate gnu/i386/fpemul/poly_mul64.s optional gpl_math_emulate gnu/i386/fpemul/poly_sin.c optional gpl_math_emulate gnu/i386/fpemul/poly_tan.c optional gpl_math_emulate gnu/i386/fpemul/polynomial.s optional gpl_math_emulate gnu/i386/fpemul/reg_add_sub.c optional gpl_math_emulate gnu/i386/fpemul/reg_compare.c optional gpl_math_emulate gnu/i386/fpemul/reg_constant.c optional gpl_math_emulate gnu/i386/fpemul/reg_div.s optional gpl_math_emulate gnu/i386/fpemul/reg_ld_str.c optional gpl_math_emulate gnu/i386/fpemul/reg_mul.c optional gpl_math_emulate gnu/i386/fpemul/reg_norm.s optional gpl_math_emulate gnu/i386/fpemul/reg_round.s optional gpl_math_emulate gnu/i386/fpemul/reg_u_add.s optional gpl_math_emulate gnu/i386/fpemul/reg_u_div.s optional gpl_math_emulate gnu/i386/fpemul/reg_u_mul.s optional gpl_math_emulate gnu/i386/fpemul/reg_u_sub.s optional gpl_math_emulate gnu/i386/fpemul/wm_shrx.s optional gpl_math_emulate gnu/i386/fpemul/wm_sqrt.s optional gpl_math_emulate gnu/i386/isa/dgb.c count dgb gnu/i386/isa/dgm.c count dgm i386/apm/apm.c count apm i386/i386/atomic.c standard \ compile-with "${CC} -c ${CFLAGS} ${DEFINED_PROF:S/^$/-fomit-frame-pointer/} ${.IMPSRC}" -i386/i386/acpi_machdep.c optional acpi i386/i386/autoconf.c standard i386/i386/bios.c standard i386/i386/bioscall.s standard 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/elf_machdep.c standard i386/i386/exception.s standard i386/i386/globals.s standard i386/i386/i386-gdbstub.c optional ddb i386/i386/i686_mem.c standard i386/i386/identcpu.c standard i386/i386/in_cksum.c optional inet i386/i386/initcpu.c standard i386/i386/k6_mem.c standard # locore.s needs to be handled in Makefile to put it first. Otherwise it's # now normal. # i386/i386/locore.s standard i386/i386/machdep.c standard i386/i386/math_emulate.c optional math_emulate i386/i386/mem.c standard i386/i386/mp_clock.c optional smp i386/i386/mp_machdep.c optional smp i386/i386/mpapic.c optional smp i386/i386/mpboot.s optional smp i386/i386/nexus.c standard i386/i386/perfmon.c optional perfmon i386/i386/perfmon.c optional perfmon profiling-routine i386/i386/pmap.c standard i386/i386/procfs_machdep.c standard i386/i386/simplelock.s optional smp i386/i386/support.s standard i386/i386/swtch.s standard i386/i386/sys_machdep.c standard i386/i386/trap.c standard i386/i386/userconfig.c optional userconfig 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/asc.c count asc i386/isa/clock.c standard i386/isa/cronyx.c optional cx i386/isa/ctx.c count ctx i386/isa/cx.c count cx i386/isa/cy.c count cy i386/isa/elink.c optional ep i386/isa/elink.c optional ie i386/isa/gpib.c optional gp i386/isa/gsc.c count gsc i386/isa/if_ar.c optional ar i386/isa/if_cx.c optional cx i386/isa/if_el.c count el i386/isa/if_le.c count le i386/isa/if_rdp.c count rdp i386/isa/if_sr.c count sr i386/isa/if_wi.c optional wi card i386/isa/if_wl.c count wl i386/isa/if_wlp.c optional wlp i386/isa/intr_machdep.c standard i386/isa/ithread.c standard i386/isa/ipl_funcs.c standard \ compile-with "${CC} -c ${CFLAGS} ${DEFINED_PROF:S/^$/-fomit-frame-pointer/} ${.IMPSRC}" i386/isa/isa.c optional isa i386/isa/isa_compat.c optional isa compat_oldisa \ warning "Old ISA driver compatability shims present." i386/isa/isa_dma.c optional isa i386/isa/istallion.c optional stli i386/isa/labpc.c count labpc i386/isa/loran.c optional loran i386/isa/matcd/matcd.c count matcd i386/isa/mca_machdep.c count mca i386/isa/mcd.c count mcd i386/isa/mse.c optional mse i386/isa/npx.c mandatory npx i386/isa/pcaudio.c optional pca i386/isa/pcf.c optional pcf i386/isa/pcvt/pcvt_drv.c optional vt i386/isa/pcvt/pcvt_ext.c optional vt i386/isa/pcvt/pcvt_kbd.c optional vt i386/isa/pcvt/pcvt_out.c optional vt i386/isa/pcvt/pcvt_sup.c optional vt i386/isa/pcvt/pcvt_vtf.c optional vt i386/isa/pmtimer.c optional pmtimer i386/isa/prof_machdep.c optional profiling-routine i386/isa/rc.c count rc #i386/isa/rp.c optional rp i386/isa/scd.c count scd i386/isa/spigot.c count spigot i386/isa/spkr.c optional speaker i386/isa/stallion.c optional stl i386/isa/tw.c count tw i386/isa/vesa.c optional vga vesa i386/isa/wt.c count wt 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_sysent.c optional compat_linux i386/linux/linux_sysvec.c optional compat_linux i386/pci/pci_cfgreg.c optional pci i386/pci/pci_bus.c optional pci i386/svr4/svr4_locore.s optional compat_svr4 \ dependency "svr4_assym.h" i386/svr4/svr4_machdep.c optional compat_svr4 # # isdn4bsd, needed for isic | iwic | ifpi | ihfc | ifpnp # i4b/layer1/i4b_l1dmux.c optional isic i4b/layer1/i4b_l1lib.c optional isic i4b/layer1/i4b_l1dmux.c optional iwic i4b/layer1/i4b_l1lib.c optional iwic i4b/layer1/i4b_l1dmux.c optional ifpi i4b/layer1/i4b_l1lib.c optional ifpi i4b/layer1/i4b_l1dmux.c optional ihfc i4b/layer1/i4b_l1lib.c optional ihfc i4b/layer1/i4b_l1dmux.c optional ifpnp i4b/layer1/i4b_l1lib.c optional ifpnp # # 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 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 count 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 # # isdn4bsd, iwic # i4b/layer1/iwic/i4b_iwic_pci.c count iwic i4b/layer1/iwic/i4b_iwic_dchan.c optional iwic i4b/layer1/iwic/i4b_iwic_bchan.c optional iwic i4b/layer1/iwic/i4b_iwic_fsm.c optional iwic i4b/layer1/iwic/i4b_iwic_l1if.c optional iwic # # isdn4bsd, ifpi # i4b/layer1/ifpi/i4b_ifpi_pci.c count ifpi i4b/layer1/ifpi/i4b_ifpi_isac.c optional ifpi i4b/layer1/ifpi/i4b_ifpi_l1.c optional ifpi i4b/layer1/ifpi/i4b_ifpi_l1fsm.c optional ifpi # # isdn4bsd, ifpnp # i4b/layer1/ifpnp/i4b_ifpnp_avm.c count 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 count ihfc i4b/layer1/ihfc/i4b_ihfc_pnp.c optional ihfc i4b/layer1/ihfc/i4b_ihfc_drv.c optional ihfc # isa/atkbd_isa.c optional atkbd isa/atkbdc_isa.c optional atkbdc isa/fd.c optional fdc isa/ppc.c optional ppc isa/psm.c optional psm isa/sio.c count sio isa/syscons_isa.c optional sc isa/vga_isa.c optional vga kern/imgact_aout.c standard kern/imgact_gzip.c optional gzip kern/link_aout.c standard kern/subr_diskmbr.c standard libkern/divdi3.c standard libkern/moddi3.c standard libkern/qdivrem.c standard libkern/udivdi3.c standard libkern/umoddi3.c standard Index: head/sys/dev/acpi/acpivar.h =================================================================== --- head/sys/dev/acpi/acpivar.h (revision 68516) +++ head/sys/dev/acpi/acpivar.h (nonexistent) @@ -1,253 +0,0 @@ -/*- - * Copyright (c) 1999 Takanori Watanabe - * Copyright (c) 1999, 2000 Mitsuru IWASAKI - * Copyright (c) 2000 Michael Smith - * Copyright (c) 2000 BSDi - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -/* - * PowerResource control - */ -struct acpi_powerres_device { - LIST_ENTRY(acpi_powerres_device) links; - struct aml_name *name; - - /* _PR[0-2] */ - u_int8_t state; /* D0 to D3 */ - u_int8_t next_state; /* initialized with D0 */ -#define ACPI_D_STATE_D0 0 -#define ACPI_D_STATE_D1 1 -#define ACPI_D_STATE_D2 2 -#define ACPI_D_STATE_D3 3 -#define ACPI_D_STATE_UNKNOWN 255 - - /* _PRW */ - u_int8_t wake_cap; /* wake capability */ -#define ACPI_D_WAKECAP_DISABLE 0 -#define ACPI_D_WAKECAP_ENABLE 1 -#define ACPI_D_WAKECAP_UNKNOWN 255 -#define ACPI_D_WAKECAP_DEFAULT 1 /* XXX default enable for testing */ - - boolean_t gpe_enabled; /* GEPx_EN enabled/disabled */ - union aml_object *prw_val[2]; /* elements of _PRW package */ -}; - -/* Device Power Management Chained Object Type */ -#define ACPI_D_PM_TYPE_IRC 0 /* _IRC */ -#define ACPI_D_PM_TYPE_PRW 1 /* _PRW */ -#define ACPI_D_PM_TYPE_PRX 2 /* _PR0 - _PR2 */ -/* and more... */ - -struct acpi_powerres_device_ref { - LIST_ENTRY(acpi_powerres_device_ref) links; - struct acpi_powerres_device *device; -}; - -struct acpi_powerres_info { - LIST_ENTRY(acpi_powerres_info) links; - struct aml_name *name; - u_int8_t state; /* OFF or ON */ -#define ACPI_POWER_RESOURCE_ON 1 -#define ACPI_POWER_RESOURCE_OFF 0 - -#define ACPI_PR_MAX 3 /* _PR[0-2] */ - LIST_HEAD(, acpi_powerres_device_ref) reflist[ACPI_PR_MAX]; - LIST_HEAD(, acpi_powerres_device_ref) prwlist; -}; - -/* - * Event Structure - */ -struct acpi_event { - STAILQ_ENTRY (acpi_event) ae_q; - int ae_type; -#define ACPI_EVENT_TYPE_FIXEDREG 0 -#define ACPI_EVENT_TYPE_GPEREG 1 -#define ACPI_EVENT_TYPE_EC 2 - int ae_arg; -}; - -/* - * I/O resource structure - */ - -#define ACPI_RES_SMI_CMD 0 -#define ACPI_RES_PM1A_EVT 1 -#define ACPI_RES_PM1B_EVT 2 -#define ACPI_RES_PM1A_CNT 3 -#define ACPI_RES_PM1B_CNT 4 -#define ACPI_RES_PM2_CNT 5 -#define ACPI_RES_PM_TMR 6 -#define ACPI_RES_GPE0 7 -#define ACPI_RES_GPE1 8 -#define ACPI_RES_FIRSTFREE 9 -#define ACPI_RES_AUTO -1 -#define ACPI_RES_MAX 64 - -struct acpi_io_resource { - struct resource *rsc; - int rid; - int size; - bus_space_handle_t bhandle; - bus_space_tag_t btag; -}; - -/* - * Softc - */ -typedef struct acpi_softc { - device_t dev; - dev_t dev_t; - - struct acpi_io_resource iores[ACPI_RES_MAX]; - - struct resource *irq; - int irq_rid; - void *irq_handle; - - struct ACPIsdt *rsdt; - struct ACPIsdt *facp; - struct FACPbody *facp_body; - struct ACPIsdt *dsdt; - struct FACS *facs; - int system_state; - int system_state_initialized; - int broken_wakeuplogic; - u_int32_t gpe0_mask; - u_int32_t gpe1_mask; - int enabled; - u_int32_t ignore_events; - struct acpi_system_state_package system_state_package; - struct proc *acpi_thread; - - LIST_HEAD(, acpi_powerres_info) acpi_powerres_inflist; - LIST_HEAD(, acpi_powerres_device) acpi_powerres_devlist; - STAILQ_HEAD(, acpi_event) event; -} acpi_softc_t; - -/* - * ACPI register I/O - */ -#define ACPI_REGISTER_INPUT 0 -#define ACPI_REGISTER_OUTPUT 1 -extern void acpi_enable_disable(acpi_softc_t *sc, boolean_t enable); -extern void acpi_io_pm1_status(acpi_softc_t *sc, boolean_t io, u_int32_t *status); -extern void acpi_io_pm1_enable(acpi_softc_t *sc, boolean_t io, u_int32_t *enable); -extern void acpi_io_pm1_control(acpi_softc_t *sc, boolean_t io, u_int32_t *val_a, u_int32_t *val_b); -extern void acpi_io_pm2_control(acpi_softc_t *sc, boolean_t io, u_int32_t *val); -extern void acpi_io_pm_timer(acpi_softc_t *sc, boolean_t io, u_int32_t *val); -extern void acpi_io_gpe0_status(acpi_softc_t *sc, boolean_t io, u_int32_t *val); -extern void acpi_io_gpe0_enable(acpi_softc_t *sc, boolean_t io, u_int32_t *val); -extern void acpi_io_gpe1_status(acpi_softc_t *sc, boolean_t io, u_int32_t *val); -extern void acpi_io_gpe1_enable(acpi_softc_t *sc, boolean_t io, u_int32_t *val); - - -/* - * Device State - */ -extern u_int8_t acpi_get_current_device_state(struct aml_name *name); -extern void acpi_set_device_state(acpi_softc_t *sc, struct aml_name *name, - u_int8_t state); -extern void acpi_set_device_wakecap(acpi_softc_t *sc, struct aml_name *name, - u_int8_t cap); - -/* - * System state - */ -extern void acpi_set_sleeping_state(acpi_softc_t *sc, u_int8_t state); - -/* - * PowerResource State - */ -extern void acpi_powerres_init(acpi_softc_t *sc); -extern void acpi_powerres_debug(acpi_softc_t *sc); -extern u_int8_t acpi_get_current_powerres_state(struct aml_name *name); -extern void acpi_set_powerres_state(acpi_softc_t *sc, struct aml_name *name, - u_int8_t state); -extern void acpi_powerres_set_sleeping_state(acpi_softc_t *sc, u_int8_t state); - -/* - * GPE enable bit manipulation - */ -extern void acpi_gpe_enable_bit(acpi_softc_t *sc, u_int32_t bit, boolean_t on_off); - -/* - * Event management - */ -extern void acpi_intr(void *data); -extern void acpi_queue_event(acpi_softc_t *sc, int type, int arg); -extern int acpi_send_pm_event(acpi_softc_t *sc, u_int8_t state); -extern void acpi_enable_events(acpi_softc_t *sc); -extern void acpi_disable_events(acpi_softc_t *sc); -extern void acpi_clear_ignore_events(void *arg); -extern void acpi_event_thread(void *arg); - -/* - * ACPI pmap subsystem - */ -#define ACPI_SMAP_MAX_SIZE 16 - -struct ACPIaddr { - int entries; - struct { - vm_offset_t pa_base; - vm_offset_t va_base; - vm_size_t size; - u_int32_t type; - } t [ACPI_SMAP_MAX_SIZE]; -}; - -extern struct ACPIaddr acpi_addr; -extern struct ACPIrsdp *acpi_rsdp; /* ACPI Root System Description Table */ -extern void acpi_init_addr_range(void); -extern void acpi_register_addr_range(u_int64_t base, u_int64_t size, u_int32_t type); -extern int acpi_sdt_checksum(struct ACPIsdt * sdt); -extern vm_offset_t acpi_pmap_ptv(vm_offset_t pa); -extern vm_offset_t acpi_pmap_vtp(vm_offset_t va); - -/* - * Bus interface. - */ -extern int acpi_attach_resource(acpi_softc_t *sc, int type, int *wantidx, - u_long start, u_long size); -extern struct ACPIrsdp *acpi_find_rsdp(void); -extern void acpi_mapmem(void); - -/* - * Debugging, console output - * - * XXX this should really be using device_printf or similar. - */ -extern int acpi_debug; -#define ACPI_DEVPRINTF(args...) printf("acpi0: " args) -#define ACPI_DEBUGPRINT(args...) do { if (acpi_debug) ACPI_DEVPRINTF(args);} while(0) - -/* - * System service interface - */ -extern int acpi_sleep(u_int32_t milli); - Property changes on: head/sys/dev/acpi/acpivar.h ___________________________________________________________________ Deleted: svn:keywords ## -1 +0,0 ## -FreeBSD=%H \ No newline at end of property Index: head/sys/dev/acpi/acpi_powerres.c =================================================================== --- head/sys/dev/acpi/acpi_powerres.c (revision 68516) +++ head/sys/dev/acpi/acpi_powerres.c (nonexistent) @@ -1,754 +0,0 @@ -/*- - * Copyright (c) 2000 Mitsuru IWASAKI - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#include "opt_acpi.h" -#include -#include -#include -#include -#include - -#include -#include -#include - -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -static int acpi_powerres_register(struct aml_name *name, va_list ap); -static int acpi_powerres_add_device(struct aml_name *name, va_list ap); - -static void acpi_set_device_next_state(acpi_softc_t *sc, - struct acpi_powerres_device *device, - u_int8_t sleeping_state, - u_int8_t def_dstate); - -static char *powerres_statestr[2] = {"_OFF", "_ON"}; - -/* - * 7.3.3 Evaluates to the current device state. - */ -u_int8_t -acpi_get_current_device_state(struct aml_name *name) -{ - u_int8_t dstate; - struct aml_name *method; - union aml_object *ret; - struct aml_environ env; - - dstate = ACPI_D_STATE_D0; - method = aml_find_from_namespace(name, "_PSC"); - if (method == NULL) { - return (dstate); - } - - bzero(&env, sizeof(env)); - aml_local_stack_push(aml_local_stack_create()); - ret = aml_eval_name(&env, method); - dstate = ret->num.number; - aml_local_stack_delete(aml_local_stack_pop()); - return (dstate); -} - -static __inline struct acpi_powerres_device * -acpi_powerres_get_powerres_device(acpi_softc_t *sc, struct aml_name *name) -{ - struct acpi_powerres_device *device; - - LIST_FOREACH(device, &sc->acpi_powerres_devlist, links) { - if (device->name == name) { - return (device); - } - } - - return (NULL); -} - -/* - * 7.2.2-4: For the OS to put the device in the Dx device state. - */ -void -acpi_set_device_state(acpi_softc_t *sc, struct aml_name *name, u_int8_t dstate) -{ - char psx[5]; /* "_PSx" */ - struct acpi_powerres_info *powerres; - struct acpi_powerres_device_ref *device_ref; - struct acpi_powerres_device *device; - struct aml_name *method; - struct aml_environ env; - - if (dstate > ACPI_D_STATE_D3) { - return; - } - - device = acpi_powerres_get_powerres_device(sc, name); - if (device == NULL) { - return; - } - device->state = dstate; - - /* - * D3 state transition. We don't need to check PowerResource, - * just execute _PS3 control method of the device. - */ - if (dstate == ACPI_D_STATE_D3) { - goto method_execution; - } - - /* - * D0 - D2 state transition. - * All Power Resources referenced by elements 1 through N - * in _PRx of the device must be in the ON state. - * - */ - LIST_FOREACH(powerres, &sc->acpi_powerres_inflist, links) { - LIST_FOREACH(device_ref, &powerres->reflist[dstate], links) { - if (device_ref->device->name != name) { - continue; - } - if (powerres->state != ACPI_POWER_RESOURCE_ON) { - acpi_set_powerres_state(sc, powerres->name, - ACPI_POWER_RESOURCE_ON); - } - break; /* already found, goto next PowerResource */ - } - } - -method_execution: - /* - * If present, the _PSx control method is executed to set the - * device into the Dx device state. - */ - snprintf(psx, sizeof(psx), "_PS%d", dstate); - method = aml_find_from_namespace(name, psx); - if (method == NULL) { - return; - } - - bzero(&env, sizeof(env)); - aml_local_stack_push(aml_local_stack_create()); - aml_eval_name(&env, method); - aml_local_stack_delete(aml_local_stack_pop()); -} - -/* - * 7.2.1: For the OS to have the defined wake capability properly enabled - * for the device. - */ -void -acpi_set_device_wakecap(acpi_softc_t *sc, struct aml_name *name, u_int8_t cap) -{ - struct acpi_powerres_info *powerres; - struct acpi_powerres_device_ref *device_ref; - struct acpi_powerres_device *device; - struct aml_name *method; - union aml_object argv[1]; - - if (cap != ACPI_D_WAKECAP_ENABLE && cap != ACPI_D_WAKECAP_DISABLE ) { - return; - } - - device = acpi_powerres_get_powerres_device(sc, name); - if (device == NULL) { - return; - } - device->wake_cap = cap; - - /* - * Disable wake capability. We don't need to check PowerResource, - * just execute _PSW control method of the device. - */ - if (cap == ACPI_D_WAKECAP_DISABLE ) { - goto method_execution; - } - - /* - * Enable wake capability. - * All Power Resources referenced by elements 2 through N - * are put into the ON state. - * - */ - LIST_FOREACH(powerres, &sc->acpi_powerres_inflist, links) { - LIST_FOREACH(device_ref, &powerres->prwlist, links) { - if (device_ref->device->name != name) { - continue; - } - if (powerres->state != ACPI_POWER_RESOURCE_ON) { - acpi_set_powerres_state(sc, powerres->name, - ACPI_POWER_RESOURCE_ON); - } - break; /* already found, goto next PowerResource */ - } - } - -method_execution: - /* - * If present, the _PSW control method is executed to set the - * device-specific registers to enable the wake functionality - * of the device. - */ - method = aml_find_from_namespace(name, "_PSW"); - if (method == NULL) { - return; - } - - argv[0].type = aml_t_num; - argv[0].num.number = cap; - aml_invoke_method(method, 1, argv); /* no result code */ -} - -/* - * 7.4.1 Returns the current ON or OFF status for the power resource. - */ -u_int8_t -acpi_get_current_powerres_state(struct aml_name *name) -{ - u_int8_t pstate; - struct aml_name *method; - union aml_object *ret; - struct aml_environ env; - - pstate = ACPI_POWER_RESOURCE_ON; - method = aml_find_from_namespace(name, "_STA"); - if (method == NULL) { - return (pstate); /* just in case */ - } - - bzero(&env, sizeof(env)); - aml_local_stack_push(aml_local_stack_create()); - ret = aml_eval_name(&env, method); - pstate = ret->num.number; /* OFF or ON */ - aml_local_stack_delete(aml_local_stack_pop()); - return (pstate); -} - -static __inline struct acpi_powerres_info * -acpi_powerres_get_powerres(acpi_softc_t *sc, struct aml_name *name) -{ - struct acpi_powerres_info *powerres; - - LIST_FOREACH(powerres, &sc->acpi_powerres_inflist, links) { - if (powerres->name == name) { - return (powerres); - } - } - - return (NULL); -} - -/* - * 7.4.2,3 Puts the power resource into the ON/OFF state. - */ -void -acpi_set_powerres_state(acpi_softc_t *sc, struct aml_name *name, - u_int8_t pstate) -{ - struct acpi_powerres_info *powerres; - struct aml_name *method; - struct aml_environ env; - - if (pstate != ACPI_POWER_RESOURCE_ON && - pstate != ACPI_POWER_RESOURCE_OFF) { - return; - } - - powerres = acpi_powerres_get_powerres(sc, name); - if (powerres == NULL) { - return; - } - powerres->state = pstate; - - method = aml_find_from_namespace(name, powerres_statestr[pstate]); - if (method == NULL) { - return; /* just in case */ - } - - bzero(&env, sizeof(env)); - aml_local_stack_push(aml_local_stack_create()); - aml_eval_name(&env, method); - aml_local_stack_delete(aml_local_stack_pop()); -} - -/* - * 7.1,2 Initialize the relationship of PowerResources and devices. - */ -void -acpi_powerres_init(acpi_softc_t *sc) -{ - struct acpi_powerres_info *powerres; - struct acpi_powerres_device_ref *device_ref; - struct acpi_powerres_device *device; - int i; - - while ((powerres = LIST_FIRST(&sc->acpi_powerres_inflist))) { - for (i = 0; i < ACPI_PR_MAX; i++) { - while ((device_ref = LIST_FIRST(&powerres->reflist[i]))) { - LIST_REMOVE(device_ref, links); - FREE(device_ref, M_TEMP); - } - LIST_INIT(&powerres->reflist[i]); - } - LIST_INIT(&powerres->prwlist); - LIST_REMOVE(powerres, links); - FREE(powerres, M_TEMP); - } - LIST_INIT(&sc->acpi_powerres_inflist); - - while ((device = LIST_FIRST(&sc->acpi_powerres_devlist))) { - LIST_REMOVE(device, links); - FREE(device, M_TEMP); - } - LIST_INIT(&sc->acpi_powerres_devlist); - - aml_apply_foreach_found_objects(NULL, ".", - acpi_powerres_register, sc); - aml_apply_foreach_found_objects(NULL, "_PR", - acpi_powerres_add_device, sc); -} - -static __inline void -acpi_powerres_device_prw_print(struct acpi_powerres_device *device) -{ - - printf("[PRW:%d:", device->wake_cap); - switch (device->prw_val[0]->type) { - case aml_t_num: - /* bit index in GPEx_EN of the enable bit */ - printf("0x%x", device->prw_val[0]->num.number); - break; - default: - /* XXX in ACPI 2.0, we can have additional GPE blocks */ - printf("GPE block"); - break; - } - /* the lowest sleeping state */ - printf(":%d] ", device->prw_val[1]->num.number); -} - -void -acpi_powerres_debug(acpi_softc_t *sc) -{ - struct acpi_powerres_info *powerres; - struct acpi_powerres_device_ref *device_ref; - struct acpi_powerres_device *device; - int i; - - LIST_FOREACH(powerres, &sc->acpi_powerres_inflist, links) { - printf("acpi_powerres_debug[powerres]:"); - aml_print_curname(powerres->name); - printf("[%d:%d:%s]\n", powerres->name->property->pres.level, - powerres->name->property->pres.order, - powerres_statestr[powerres->state]); - - /* for _PR[0-2] */ - for (i = 0; i < ACPI_PR_MAX; i++) { - if (LIST_EMPTY(&powerres->reflist[i])) { - continue; - } - printf("\t_PR%d:", i); - LIST_FOREACH(device_ref, &powerres->reflist[i], links) { - device = device_ref->device; - aml_print_curname(device->name); - printf("[D%d] ", device->state); - } - printf("\n"); - } - - /* for _PRW */ - if (LIST_EMPTY(&powerres->prwlist)) { - continue; - } - printf("\t_PRW:"); - LIST_FOREACH(device_ref, &powerres->prwlist, links) { - device = device_ref->device; - aml_print_curname(device->name); - acpi_powerres_device_prw_print(device); - } - printf("\n"); - } - - LIST_FOREACH(device, &sc->acpi_powerres_devlist, links) { - printf("acpi_powerres_debug[device]:"); - aml_print_curname(device->name); - if (device->state != ACPI_D_STATE_UNKNOWN) { - printf("[D%d] ", device->state); - } - if (device->wake_cap != ACPI_D_WAKECAP_UNKNOWN) { - acpi_powerres_device_prw_print(device); - } - printf("\n"); - } -} - -static int -acpi_powerres_register(struct aml_name *name, va_list ap) -{ - int i, order; - acpi_softc_t *sc; - struct acpi_powerres_info *powerres, *other_pr, *last_pr; - - sc = va_arg(ap, acpi_softc_t *); - - if (name->property == NULL || - name->property->type != aml_t_powerres) { - return (0); - } - - MALLOC(powerres, struct acpi_powerres_info *, - sizeof(*powerres), M_TEMP, M_NOWAIT); - if (powerres == NULL) { - return (1); - } - - powerres->name = name; - - /* get the current ON or OFF status for the power resource */ - powerres->state = acpi_get_current_powerres_state(name); - - /* must be sorted by resource order of PowerResource */ - order = powerres->name->property->pres.order; - other_pr = last_pr = NULL; - if (LIST_EMPTY(&sc->acpi_powerres_inflist)) { - LIST_INSERT_HEAD(&sc->acpi_powerres_inflist, powerres, links); - } else { - LIST_FOREACH(other_pr, &sc->acpi_powerres_inflist, links) { - if (other_pr->name->property->pres.order >= order) { - break; /* found */ - } - last_pr = other_pr; - } - if (other_pr != NULL) { - LIST_INSERT_BEFORE(other_pr, powerres, links); - } else { - LIST_INSERT_AFTER(last_pr, powerres, links); - } - } - - for (i = 0; i < ACPI_PR_MAX; i++) { - LIST_INIT(&powerres->reflist[i]); - } - LIST_INIT(&powerres->prwlist); - - return (0); -} - -static int -acpi_powerres_add_device(struct aml_name *name, va_list ap) -{ - int i, offset, objtype; - int prnum; - int dev_found; - acpi_softc_t *sc; - struct acpi_powerres_device *device; - struct acpi_powerres_device_ref *device_ref; - struct acpi_powerres_info *powerres; - struct aml_name *powerres_name; - struct aml_environ env; - union aml_object **objects; - - sc = va_arg(ap, acpi_softc_t *); - objtype = prnum = 0; - - /* should be _PR[0-2] or _PRW */ - switch (name->name[3]) { - case '0' ... '2': - objtype = ACPI_D_PM_TYPE_PRX; - prnum = name->name[3] - '0'; - offset = 0; - break; - case 'W': - objtype = ACPI_D_PM_TYPE_PRW; - /* for _PRW, PowerResource reference starts from elements 2 */ - offset = 2; - break; - default: - return (0); - } - - if (name->property == NULL || - name->property->type != aml_t_package) { - return (0); - } - - if (name->property->package.elements == 0) { - return (0); - } - - /* make the list of devices */ - dev_found = 0; - LIST_FOREACH(device, &sc->acpi_powerres_devlist, links) { - if (device->name == name->parent) { - dev_found = 1; - break; - } - } - if (!dev_found) { - MALLOC(device, struct acpi_powerres_device *, - sizeof(*device), M_TEMP, M_NOWAIT); - if (device == NULL) { - return (1); - } - - /* set default values */ - device->state = ACPI_D_STATE_UNKNOWN; - device->wake_cap = ACPI_D_WAKECAP_UNKNOWN; - - /* this is a _PR[0-2|W] object, we need the parent of this. */ - device->name = name->parent; - - - LIST_INSERT_HEAD(&sc->acpi_powerres_devlist, device, links); - } - - objects = name->property->package.objects; - - switch (objtype) { - case ACPI_D_PM_TYPE_PRX: - /* get the current device state. */ - if (device->state == ACPI_D_STATE_UNKNOWN) { - device->state = acpi_get_current_device_state(device->name); - } - break; - case ACPI_D_PM_TYPE_PRW: - device->wake_cap = ACPI_D_WAKECAP_DEFAULT; - for (i = 0; i < 2; i++) { - device->prw_val[i] = objects[i]; - } - break; - default: - break; - } - - /* find PowerResource which the device reference to */ - MALLOC(device_ref, struct acpi_powerres_device_ref *, - sizeof(*device_ref), M_TEMP, M_NOWAIT); - if (device_ref == NULL) { - return (1); - } - - device_ref->device = device; - env.curname = device->name; - for (i = offset; i < name->property->package.elements; i++) { - if (objects[i]->type != aml_t_namestr) { - printf("acpi_powerres_add_device: not name string\n"); - continue; - } - powerres_name = aml_search_name(&env, objects[i]->nstr.dp); - if (powerres_name == NULL) { - printf("acpi_powerres_add_device: not found\n"); - continue; - } - - LIST_FOREACH(powerres, &sc->acpi_powerres_inflist, links) { - if (powerres->name != powerres_name) { - continue; - } - - switch (objtype) { - case ACPI_D_PM_TYPE_PRX: - LIST_INSERT_HEAD(&powerres->reflist[prnum], - device_ref, links); - break; - case ACPI_D_PM_TYPE_PRW: - LIST_INSERT_HEAD(&powerres->prwlist, - device_ref, links); - break; - default: - break; - } - /* already found, go to next element... */ - break; - } - } - - switch (objtype) { - case ACPI_D_PM_TYPE_PRX: - /* XXX - * force to set the current device state to make - * PowerResource compatible with the device state. - */ - acpi_set_device_state(sc, device->name, device->state); - break; - case ACPI_D_PM_TYPE_PRW: - acpi_set_device_wakecap(sc, device->name, device->wake_cap); - break; - default: - break; - } - - return (0); -} - -static __inline void -acpi_set_device_prw_gpe(acpi_softc_t *sc, struct acpi_powerres_device *device, - boolean_t on_off) -{ - u_long ef; - - device->gpe_enabled = on_off; - - /* The proper general-purpose register bits are enabled. */ - switch (device->prw_val[0]->type) { - case aml_t_num: - /* bit index in GPEx_EN of the enable bit */ - ef = read_eflags(); /* XXX should MI */ - acpi_gpe_enable_bit(sc, device->prw_val[0]->num.number, on_off); - write_eflags(ef); - break; - default: - /* XXX in ACPI 2.0, we can have additional GPE blocks */ - printf("ACPI 2.0 style _PRW/GPE handling is not supported\n"); - break; - } -} - -static void -acpi_set_device_next_state(acpi_softc_t *sc, struct acpi_powerres_device *device, - u_int8_t sleeping_state, u_int8_t def_dstate) -{ - - /* set given default device state */ - device->next_state = def_dstate; - - if (device->wake_cap != ACPI_D_WAKECAP_ENABLE) { - goto out; - } - - /* - * 7.2.1 _PRW - * The sleeping state being enterted must be greater or equal to the - * power state declared in element 1 of the _PRW object. - */ - if (sleeping_state < device->prw_val[1]->num.number) { - goto out; - } - - device->next_state = ACPI_D_STATE_D0; /* XXX need to refer _SxD ? */ - - if (sleeping_state > ACPI_S_STATE_S0 && device->gpe_enabled == 0) { - acpi_set_device_prw_gpe(sc, device, 1); - } - -out: - return; -} - -/* - * 7.1-5 PowerResource manipulation on the sleeping state transision. - */ -void -acpi_powerres_set_sleeping_state(acpi_softc_t *sc, u_int8_t state) -{ - int i; - struct acpi_powerres_info *powerres; - struct acpi_powerres_device *device; - struct acpi_powerres_device_ref *device_ref; - - if (state > ACPI_S_STATE_S4) { - return; - } - - /* - * initialize the next device state to D0, then change to D3 later - * based on PowerResource state change. - */ - LIST_FOREACH(device, &sc->acpi_powerres_devlist, links) { - acpi_set_device_next_state(sc, device, state, ACPI_D_STATE_D0); - } - - /* - * 7.5.2 System \_Sx state - * Power Resources are in a state compatible with the system Sx - * state. All power Resources that supply a System Level reference - * of Sn (where n < x) are in the OFF state. - */ - LIST_FOREACH(powerres, &sc->acpi_powerres_inflist, links) { - if (powerres->name->property->pres.level < state) { - /* if ON state then put it in the OFF state */ - if (powerres->state == ACPI_POWER_RESOURCE_ON) { - acpi_set_powerres_state(sc, powerres->name, - ACPI_POWER_RESOURCE_OFF); - } - /* - * Device states are compatible with the current - * Power Resource states. - */ - for (i = 0; i < ACPI_PR_MAX; i++) { - LIST_FOREACH(device_ref, &powerres->reflist[i], links) { - device = device_ref->device; - acpi_set_device_next_state(sc, device, - state, ACPI_D_STATE_D3); - } - } - } else { - /* if OFF state then put it in the ON state */ - if (powerres->state == ACPI_POWER_RESOURCE_OFF) { - acpi_set_powerres_state(sc, powerres->name, - ACPI_POWER_RESOURCE_ON); - } - } - } - - /* - * Devices states are compatible with the current Power Resource - * states. only devices which solely reference Power Resources which - * are in the ON state for a given device state can be in that device - * state. In all other cases, the device is in the D3 (off) state. - * Note: - * Or is at least assumed to be in the D3 state by its device driver. - * For example, if the device doesn't explicitly describe how it can - * stay in some state non-off state while the system is in a sleeping - * state, the operating software must assume that the device can lose - * its power and state. - */ - - LIST_FOREACH(device, &sc->acpi_powerres_devlist, links) { - if (device->next_state == ACPI_D_STATE_D3 && - device->state != ACPI_D_STATE_D3) { - acpi_set_device_state(sc, device->name, ACPI_D_STATE_D3); - } - if (device->next_state == ACPI_D_STATE_D0 && - device->state != ACPI_D_STATE_D0) { - acpi_set_device_state(sc, device->name, ACPI_D_STATE_D0); - } - - /* XXX reset GEPx_EN enabled bit on S0 state */ - if (state == ACPI_S_STATE_S0 && device->gpe_enabled && - device->wake_cap == ACPI_D_WAKECAP_ENABLE) { - acpi_set_device_prw_gpe(sc, device, 0); - } - } -} Property changes on: head/sys/dev/acpi/acpi_powerres.c ___________________________________________________________________ Deleted: svn:keywords ## -1 +0,0 ## -FreeBSD=%H \ No newline at end of property Index: head/sys/dev/acpi/acpi_io.c =================================================================== --- head/sys/dev/acpi/acpi_io.c (revision 68516) +++ head/sys/dev/acpi/acpi_io.c (nonexistent) @@ -1,356 +0,0 @@ -/*- - * Copyright (c) 1999 Takanori Watanabe - * Copyright (c) 1999, 2000 Mitsuru IWASAKI - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#include "opt_acpi.h" -#include -#include -#include - -#include - -#include -#include - -/* - * ACPI Register I/O - */ -static __inline void -acpi_register_input(acpi_softc_t *sc, int res, int offset, u_int32_t *value, u_int32_t size) -{ - bus_space_tag_t bst; - bus_space_handle_t bsh; - u_int32_t val; - - if (sc->iores[res].rsc == NULL) - return; - - bst = sc->iores[res].btag; - bsh = sc->iores[res].bhandle; - - switch (size) { - case 1: - val = bus_space_read_1(bst, bsh, offset); - break; - case 2: - val = bus_space_read_2(bst, bsh, offset); - break; - case 3: - val = bus_space_read_4(bst, bsh, offset); - val &= 0x00ffffff; - break; - case 4: - val = bus_space_read_4(bst, bsh, offset); - break; - default: - ACPI_DEVPRINTF("acpi_register_input(): invalid size (%d)\n", size); - val = 0; - break; - } - - *value = val; -} - -static __inline void -acpi_register_output(acpi_softc_t *sc, int res, int offset, u_int32_t *value, u_int32_t size) -{ - bus_space_tag_t bst; - bus_space_handle_t bsh; - u_int32_t val; - - if (sc->iores[res].rsc == NULL) - return; - - val = *value; - bst = sc->iores[res].btag; - bsh = sc->iores[res].bhandle; - - switch (size) { - case 1: - bus_space_write_1(bst, bsh, offset, val & 0xff); - break; - case 2: - bus_space_write_2(bst, bsh, offset, val & 0xffff); - break; - case 3: - bus_space_write_2(bst, bsh, offset, val & 0xffff); - bus_space_write_1(bst, bsh, offset + 2, (val >> 16) & 0xff); - break; - case 4: - bus_space_write_4(bst, bsh, offset, val); - break; - default: - ACPI_DEVPRINTF("acpi_register_output(): invalid size\n"); - break; - } -} - -static __inline void -acpi_io_mirreg(acpi_softc_t *sc, boolean_t io, u_int32_t *data, - int res, int altres, int offset, int size) -{ - u_int32_t result; - - if (io == ACPI_REGISTER_INPUT) { - acpi_register_input(sc, res, offset, &result, size); - *data = result; - acpi_register_input(sc, altres, offset, &result, size); - *data |= result; - } else { - acpi_register_output(sc, res, offset, data, size); - acpi_register_output(sc, altres, offset, data, size); - } - - return; -} - -void -acpi_enable_disable(acpi_softc_t *sc, boolean_t enable) -{ - u_int8_t val; - - val = enable ? sc->facp_body->acpi_enable : sc->facp_body->acpi_disable; - bus_space_write_1(sc->iores[ACPI_RES_SMI_CMD].btag, - sc->iores[ACPI_RES_SMI_CMD].bhandle, - 0, val); - sc->enabled = enable; - - ACPI_DEBUGPRINT("acpi_enable_disable(%d) = (%x)\n", enable, val); -} - -void -acpi_io_pm1_status(acpi_softc_t *sc, boolean_t io, u_int32_t *status) -{ - int size; - struct FACPbody *facp; - - facp = sc->facp_body; - size = facp->pm1_evt_len / 2; - acpi_io_mirreg(sc, io, status, ACPI_RES_PM1A_EVT, ACPI_RES_PM1B_EVT, 0, size); - - ACPI_DEBUGPRINT("acpi_io_pm1_status(%d) = (%x)\n", io, *status); -} - -void -acpi_io_pm1_enable(acpi_softc_t *sc, boolean_t io, u_int32_t *enable) -{ - int size; - struct FACPbody *facp; - - facp = sc->facp_body; - size = facp->pm1_evt_len / 2; - acpi_io_mirreg(sc, io, enable, ACPI_RES_PM1A_EVT, ACPI_RES_PM1B_EVT, size, size); - - ACPI_DEBUGPRINT("acpi_io_pm1_enable(%d) = (%x)\n", io, *enable); -} - -/* - * PM1 is awkward because the SLP_TYP bits are not common between the two registers. - * A better interface than this might pass the SLP_TYP bits separately. - */ -void -acpi_io_pm1_control(acpi_softc_t *sc, boolean_t io, u_int32_t *value_a, u_int32_t *value_b) -{ - struct FACPbody *facp; - u_int32_t result; - - facp = sc->facp_body; - - if (io == ACPI_REGISTER_INPUT) { - acpi_register_input(sc, ACPI_RES_PM1A_CNT, 0, &result, facp->pm1_cnt_len); - *value_a = result; - acpi_register_input(sc, ACPI_RES_PM1B_CNT, 0, &result, facp->pm1_cnt_len); - *value_a |= result; - *value_a &= ~ACPI_CNT_SLP_TYPX; /* mask the SLP_TYP bits */ - } else { - acpi_register_output(sc, ACPI_RES_PM1A_CNT, 0, value_a, facp->pm1_cnt_len); - acpi_register_output(sc, ACPI_RES_PM1B_CNT, 0, value_b, facp->pm1_cnt_len); - } - - ACPI_DEBUGPRINT("acpi_io_pm1_control(%d) = (%x, %x)\n", io, *value_a, *value_b); -} - -void -acpi_io_pm2_control(acpi_softc_t *sc, boolean_t io, u_int32_t *val) -{ - int size; - struct FACPbody *facp; - - facp = sc->facp_body; - size = facp->pm2_cnt_len; - - if (size == 0) /* port is optional */ - return; - - if (io == ACPI_REGISTER_INPUT) { - acpi_register_input(sc, ACPI_RES_PM2_CNT, 0, val, size); - } else { - acpi_register_output(sc, ACPI_RES_PM2_CNT, 0, val, size); - } - - ACPI_DEBUGPRINT("acpi_io_pm2_control(%d) = (%x)\n", io, *val); - - return; -} - -void -acpi_io_pm_timer(acpi_softc_t *sc, boolean_t io, u_int32_t *val) -{ - if (io == ACPI_REGISTER_INPUT) { - acpi_register_input(sc, ACPI_RES_PM_TMR, 0, val, sizeof(u_int32_t)); - - ACPI_DEBUGPRINT("acpi_io_pm_timer(%d) = (%x)\n", io, *val); - } -} - -void -acpi_io_gpe0_status(acpi_softc_t *sc, boolean_t io, u_int32_t *val) -{ - int size; - struct FACPbody *facp; - - facp = sc->facp_body; - size = facp->gpe0_len / 2; - - if (size == 0) /* port is optional */ - return; - - if (io == ACPI_REGISTER_INPUT) { - acpi_register_input(sc, ACPI_RES_GPE0, 0, val, size); - } else { - acpi_register_output(sc, ACPI_RES_GPE0, 0, val, size); - } - - ACPI_DEBUGPRINT("acpi_io_gpe0_status(%d) = (%x)\n", io, *val); -} - -void -acpi_io_gpe0_enable(acpi_softc_t *sc, boolean_t io, u_int32_t *val) -{ - int size; - struct FACPbody *facp; - - facp = sc->facp_body; - size = facp->gpe0_len / 2; - - if (size == 0) /* port is optional */ - return; - - if (io == ACPI_REGISTER_INPUT) { - acpi_register_input(sc, ACPI_RES_GPE0, size, val, size); - } else { - acpi_register_output(sc, ACPI_RES_GPE0, size, val, size); - } - - ACPI_DEBUGPRINT("acpi_io_gpe0_enable(%d) = (%x)\n", io, *val); -} - -void -acpi_io_gpe1_status(acpi_softc_t *sc, boolean_t io, u_int32_t *val) -{ - int size; - struct FACPbody *facp; - - facp = sc->facp_body; - size = facp->gpe1_len / 2; - - if (size == 0) /* port is optional */ - return; - - if (io == ACPI_REGISTER_INPUT) { - acpi_register_input(sc, ACPI_RES_GPE1, 0, val, size); - } else { - acpi_register_output(sc, ACPI_RES_GPE1, 0, val, size); - } - - ACPI_DEBUGPRINT("acpi_io_gpe1_status(%d) = (%x)\n", io, *val); -} - -void -acpi_io_gpe1_enable(acpi_softc_t *sc, boolean_t io, u_int32_t *val) -{ - int size; - struct FACPbody *facp; - - facp = sc->facp_body; - size = facp->gpe1_len / 2; - - if (size == 0) /* port is optional */ - return; - - if (io == ACPI_REGISTER_INPUT) { - acpi_register_input(sc, ACPI_RES_GPE1, size, val, size); - } else { - acpi_register_output(sc, ACPI_RES_GPE1, size, val, size); - } - - ACPI_DEBUGPRINT("acpi_io_gpe0_enable(%d) = (%x)\n", io, *val); -} - -void -acpi_gpe_enable_bit(acpi_softc_t *sc, u_int32_t bit, boolean_t on_off) -{ - u_int32_t value; - int res; - - /* - * Is the bit in the first GPE port? - */ - if (bit < ((sc->facp_body->gpe0_len / 2) * 8)) { - res = ACPI_RES_GPE0; - } else { - /* - * Is the bit in the second GPE port? - */ - bit -= sc->facp_body->gpe1_base; - if (bit < ((sc->facp_body->gpe1_len / 2) * 8)) { - res = ACPI_RES_GPE1; - } else { - return; /* do nothing */ - } - } - - switch (res) { - case ACPI_RES_GPE0: - acpi_io_gpe0_enable(sc, ACPI_REGISTER_INPUT, &value); - break; - case ACPI_RES_GPE1: - acpi_io_gpe1_enable(sc, ACPI_REGISTER_INPUT, &value); - break; - } - value = (value & ~(1 << bit)) | (on_off ? (1 << bit) : 0); - switch (res) { - case ACPI_RES_GPE0: - acpi_io_gpe0_enable(sc, ACPI_REGISTER_OUTPUT, &value); - break; - case ACPI_RES_GPE1: - acpi_io_gpe1_enable(sc, ACPI_REGISTER_OUTPUT, &value); - break; - } -} - Property changes on: head/sys/dev/acpi/acpi_io.c ___________________________________________________________________ Deleted: svn:keywords ## -1 +0,0 ## -FreeBSD=%H \ No newline at end of property Index: head/sys/dev/acpi/acpireg.h =================================================================== --- head/sys/dev/acpi/acpireg.h (revision 68516) +++ head/sys/dev/acpi/acpireg.h (nonexistent) @@ -1,352 +0,0 @@ -/*- - * Copyright (c) 1999 Takanori Watanabe - * Copyright (c) 1999 Mitsuru IWASAKI - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -/* Generic Address structure */ -struct ACPIgas { - u_int8_t address_space_id; -#define ACPI_GAS_MEMORY 0 -#define ACPI_GAS_IO 1 -#define ACPI_GAS_PCI 2 -#define ACPI_GAS_EMBEDDED 3 -#define ACPI_GAS_SMBUS 4 -#define ACPI_GAS_FIXED 0x7f - u_int8_t register_bit_width; - u_int8_t register_bit_offset; - u_int8_t res; - u_int64_t address; -} __attribute__((packed)); - -/* Root System Description Pointer */ -struct ACPIrsdp { - u_char signature[8]; - u_char sum; - u_char oem[6]; - u_char res; - u_int32_t addr; -} __attribute__((packed)); - -/* System Description Table */ -struct ACPIsdt { - u_char signature[4]; - u_int32_t len; - u_char rev; - u_char check; - u_char oemid[6]; - u_char oemtblid[8]; - u_int32_t oemrev; - u_char creator[4]; - u_int32_t crerev; -#define SIZEOF_SDT_HDR 36 /* struct size except body */ - u_int32_t body[1];/* This member should be casted */ -} __attribute__((packed)); - -/* Fixed ACPI Description Table (body) */ -struct FACPbody { - u_int32_t facs_ptr; - u_int32_t dsdt_ptr; - u_int8_t int_model; -#define ACPI_FACP_INTMODEL_PIC 0 /* Standard PC-AT PIC */ -#define ACPI_FACP_INTMODEL_APIC 1 /* Multiple APIC */ - u_char reserved1; - u_int16_t sci_int; - u_int32_t smi_cmd; - u_int8_t acpi_enable; - u_int8_t acpi_disable; - u_int8_t s4biosreq; - u_int8_t reserved2; - u_int32_t pm1a_evt_blk; - u_int32_t pm1b_evt_blk; - u_int32_t pm1a_cnt_blk; - u_int32_t pm1b_cnt_blk; - u_int32_t pm2_cnt_blk; - u_int32_t pm_tmr_blk; - u_int32_t gpe0_blk; - u_int32_t gpe1_blk; - u_int8_t pm1_evt_len; - u_int8_t pm1_cnt_len; - u_int8_t pm2_cnt_len; - u_int8_t pm_tmr_len; - u_int8_t gpe0_len; - u_int8_t gpe1_len; - u_int8_t gpe1_base; - u_int8_t reserved3; - u_int16_t p_lvl2_lat; - u_int16_t p_lvl3_lat; - u_int16_t flush_size; - u_int16_t flush_stride; - u_int8_t duty_off; - u_int8_t duty_width; - u_int8_t day_alrm; - u_int8_t mon_alrm; - u_int8_t century; - u_int16_t iapc_boot_arch; - u_char reserved4[1]; - u_int32_t flags; -#define ACPI_FACP_FLAG_WBINVD 1 /* WBINVD is correctly supported */ -#define ACPI_FACP_FLAG_WBINVD_FLUSH 2 /* WBINVD flushes caches */ -#define ACPI_FACP_FLAG_PROC_C1 4 /* C1 power state supported */ -#define ACPI_FACP_FLAG_P_LVL2_UP 8 /* C2 power state works on SMP */ -#define ACPI_FACP_FLAG_PWR_BUTTON 16 /* Power button uses control method */ -#define ACPI_FACP_FLAG_SLP_BUTTON 32 /* Sleep button uses control method */ -#define ACPI_FACP_FLAG_FIX_RTC 64 /* RTC wakeup not supported */ -#define ACPI_FACP_FLAG_RTC_S4 128 /* RTC can wakeup from S4 state */ -#define ACPI_FACP_FLAG_TMR_VAL_EXT 256 /* TMR_VAL is 32bit */ -#define ACPI_FACP_FLAG_DCK_CAP 512 /* Can support docking */ - struct ACPIgas reset_reg; - u_int8_t reset_value; - u_int8_t reserved5[3]; - u_int64_t x_firmware_ctrl; - u_int64_t x_dsdt; - struct ACPIgas x_pm1a_evt_blk; - struct ACPIgas x_pm1b_evt_blk; - struct ACPIgas x_pm1a_cnt_blk; - struct ACPIgas x_pm1b_cnt_blk; - struct ACPIgas x_pm2_cnt_blk; - struct ACPIgas x_pm_tmr_blk; - struct ACPIgas x_gpe0_blk; - struct ACPIgas x_gpe1_blk; -} __attribute__((packed)); - -/* Firmware ACPI Control Structure */ -struct FACS { - u_char signature[4]; - u_int32_t len; - u_char hard_sig[4]; - /* - * NOTE This should be filled with physical address below 1MB!! - * sigh.... - */ - u_int32_t firm_wake_vec; - u_int32_t g_lock; /* bit field */ - /* 5.2.6.1 Global Lock */ -#define ACPI_GLOBAL_LOCK_PENDING 1 -#define ACPI_GLOBAL_LOCK_OWNED 2 - u_int32_t flags; /* bit field */ -#define ACPI_FACS_FLAG_S4BIOS_F 1 /* Supports S4BIOS_SEQ */ - char reserved[40]; -} __attribute__((packed)); - -/* - * Bits for ACPI registers - */ - -/* Power Management 1 Event Regisers (4.7.3.1 Table 4-9, 4-10) */ -/* these bits are for status and enable regiser */ -#define ACPI_PM1_TMR_EN 0x0001 -#define ACPI_PM1_GBL_EN 0x0020 -#define ACPI_PM1_PWRBTN_EN 0x0100 -#define ACPI_PM1_SLPBTN_EN 0x0200 -#define ACPI_PM1_RTC_EN 0x0400 -#define ACPI_PM1_ALL_ENABLE_BITS 0x0721 -/* these bits are for status regiser only */ -#define ACPI_PM1_BM_STS 0x0010 -#define ACPI_PM1_WAK_STS 0x8000 - -/* Power Management 1 Control Regisers (4.7.3.2 Table 4-11) */ -#define ACPI_CNT_SCI_EN 0x0001 -#define ACPI_CNT_BM_RLD 0x0002 -#define ACPI_CNT_GBL_RLS 0x0004 -#define ACPI_CNT_SLP_TYPX 0x1c00 -#define ACPI_CNT_SLP_EN 0x2000 - -#define ACPI_CNT_SET_SLP_TYP(x) (x << 10) - -/* Power Management Timer (4.7.3.3 Table 4-12) */ -/* Not yet */ - -/* Power Management 2 Control (4.7.3.4 Table 4-13) */ -/* Not yet */ - -/* Processor Register Block (4.7.3.5 Table 4-14, 4-15, 4-16) */ -/* Not yet */ - -/* Sleep state constants */ -#define ACPI_S_STATE_S0 0 -#define ACPI_S_STATE_S1 1 -#define ACPI_S_STATE_S2 2 -#define ACPI_S_STATE_S3 3 -#define ACPI_S_STATE_S4 4 -#define ACPI_S_STATE_S5 5 - -#ifdef _KERNEL -/* - * Structure for System State Package (7.5.2). - */ -struct acpi_system_state_package { - struct { - u_int8_t slp_typ_a; /* 3-bit only. */ - u_int8_t slp_typ_b; /* (4.7.3.2.1) */ - } mode[6]; -}; -#define ACPI_UNSUPPORTSLPTYP 0xff /* unsupported sleeping type */ - -/* - * ACPICA compatibility - */ -#ifdef _IA64 -typedef signed char INT8; -typedef unsigned char UINT8; -typedef unsigned char UCHAR; -typedef short INT16; -typedef unsigned short UINT16; -typedef int INT32; -typedef unsigned int UINT32; -typedef long INT64; -typedef unsigned long UINT64; - -typedef UINT64 NATIVE_UINT; -typedef INT64 NATIVE_INT; - -typedef NATIVE_UINT ACPI_TBLPTR; -#else /* !_IA64 */ -typedef signed char INT8; -typedef unsigned char UINT8; -typedef unsigned char UCHAR; -typedef short INT16; -typedef unsigned short UINT16; -typedef int INT32; -typedef unsigned int UINT32; - -typedef UINT32 NATIVE_UINT; -typedef INT32 NATIVE_INT; - -typedef NATIVE_UINT ACPI_TBLPTR; -#endif /* _IA64 */ - -/* common types */ -typedef NATIVE_UINT ACPI_IO_ADDRESS; -typedef UINT32 ACPI_STATUS; - -/* - * Exceptions returned by external ACPI interfaces - */ - -#define ACPI_SUCCESS(a) (!(a)) -#define ACPI_FAILURE(a) (a) - -#define AE_OK (ACPI_STATUS) 0x0000 -#define AE_CTRL_RETURN_VALUE (ACPI_STATUS) 0x0001 -#define AE_CTRL_PENDING (ACPI_STATUS) 0x0002 -#define AE_CTRL_TERMINATE (ACPI_STATUS) 0x0003 -#define AE_CTRL_TRUE (ACPI_STATUS) 0x0004 -#define AE_CTRL_FALSE (ACPI_STATUS) 0x0005 -#define AE_CTRL_DEPTH (ACPI_STATUS) 0x0006 -#define AE_CTRL_RESERVED (ACPI_STATUS) 0x0007 -#define AE_AML_ERROR (ACPI_STATUS) 0x0008 -#define AE_AML_PARSE (ACPI_STATUS) 0x0009 -#define AE_AML_BAD_OPCODE (ACPI_STATUS) 0x000A -#define AE_AML_NO_OPERAND (ACPI_STATUS) 0x000B -#define AE_AML_OPERAND_TYPE (ACPI_STATUS) 0x000C -#define AE_AML_OPERAND_VALUE (ACPI_STATUS) 0x000D -#define AE_AML_UNINITIALIZED_LOCAL (ACPI_STATUS) 0x000E -#define AE_AML_UNINITIALIZED_ARG (ACPI_STATUS) 0x000F -#define AE_AML_UNINITIALIZED_ELEMENT (ACPI_STATUS) 0x0010 -#define AE_AML_NUMERIC_OVERFLOW (ACPI_STATUS) 0x0011 -#define AE_AML_REGION_LIMIT (ACPI_STATUS) 0x0012 -#define AE_AML_BUFFER_LIMIT (ACPI_STATUS) 0x0013 -#define AE_AML_PACKAGE_LIMIT (ACPI_STATUS) 0x0014 -#define AE_AML_DIVIDE_BY_ZERO (ACPI_STATUS) 0x0015 -#define AE_AML_BAD_NAME (ACPI_STATUS) 0x0016 -#define AE_AML_NAME_NOT_FOUND (ACPI_STATUS) 0x0017 -#define AE_AML_INTERNAL (ACPI_STATUS) 0x0018 -#define AE_AML_RESERVED (ACPI_STATUS) 0x0019 -#define AE_ERROR (ACPI_STATUS) 0x001A -#define AE_NO_ACPI_TABLES (ACPI_STATUS) 0x001B -#define AE_NO_NAMESPACE (ACPI_STATUS) 0x001C -#define AE_NO_MEMORY (ACPI_STATUS) 0x001D -#define AE_BAD_SIGNATURE (ACPI_STATUS) 0x001E -#define AE_BAD_HEADER (ACPI_STATUS) 0x001F -#define AE_BAD_CHECKSUM (ACPI_STATUS) 0x0020 -#define AE_BAD_PARAMETER (ACPI_STATUS) 0x0021 -#define AE_BAD_CHARACTER (ACPI_STATUS) 0x0022 -#define AE_BAD_PATHNAME (ACPI_STATUS) 0x0023 -#define AE_BAD_DATA (ACPI_STATUS) 0x0024 -#define AE_BAD_ADDRESS (ACPI_STATUS) 0x0025 -#define AE_NOT_FOUND (ACPI_STATUS) 0x0026 -#define AE_NOT_EXIST (ACPI_STATUS) 0x0027 -#define AE_EXIST (ACPI_STATUS) 0x0028 -#define AE_TYPE (ACPI_STATUS) 0x0029 -#define AE_NULL_OBJECT (ACPI_STATUS) 0x002A -#define AE_NULL_ENTRY (ACPI_STATUS) 0x002B -#define AE_BUFFER_OVERFLOW (ACPI_STATUS) 0x002C -#define AE_STACK_OVERFLOW (ACPI_STATUS) 0x002D -#define AE_STACK_UNDERFLOW (ACPI_STATUS) 0x002E -#define AE_NOT_IMPLEMENTED (ACPI_STATUS) 0x002F -#define AE_VERSION_MISMATCH (ACPI_STATUS) 0x0030 -#define AE_SUPPORT (ACPI_STATUS) 0x0031 -#define AE_SHARE (ACPI_STATUS) 0x0032 -#define AE_LIMIT (ACPI_STATUS) 0x0033 -#define AE_TIME (ACPI_STATUS) 0x0034 -#define AE_UNKNOWN_STATUS (ACPI_STATUS) 0x0035 -#define ACPI_MAX_STATUS (ACPI_STATUS) 0x0035 -#define ACPI_NUM_STATUS (ACPI_STATUS) 0x0036 - -/* - * ACPICA Osd family functions - */ -#if defined(DIAGNOSTIC) -#define ACPI_NO_OSDFUNC_INLINE -#endif - -#ifdef ACPI_NO_OSDFUNC_INLINE -ACPI_STATUS OsdMapMemory(void *, UINT32, void **); -void OsdUnMapMemory(void *, UINT32); - -UINT8 OsdIn8(ACPI_IO_ADDRESS); -UINT16 OsdIn16(ACPI_IO_ADDRESS); -UINT32 OsdIn32(ACPI_IO_ADDRESS); -void OsdOut8(ACPI_IO_ADDRESS, UINT8); -void OsdOut16(ACPI_IO_ADDRESS, UINT16); -void OsdOut32(ACPI_IO_ADDRESS, UINT32); - -ACPI_STATUS OsdReadPciCfgByte(UINT32, UINT32 , UINT32 , UINT8 *); -ACPI_STATUS OsdReadPciCfgWord(UINT32, UINT32 , UINT32 , UINT16 *); -ACPI_STATUS OsdReadPciCfgDword(UINT32, UINT32 , UINT32 , UINT32 *); -ACPI_STATUS OsdWritePciCfgByte(UINT32, UINT32 , UINT32 , UINT8); -ACPI_STATUS OsdWritePciCfgWord(UINT32, UINT32 , UINT32 , UINT16); -ACPI_STATUS OsdWritePciCfgDword(UINT32, UINT32 , UINT32 , UINT32); - -ACPI_STATUS OsdSleep(UINT32, UINT32); -ACPI_STATUS OsdSleepUsec(UINT32); -#endif /* ACPI_NO_OSDFUNC_INLINE */ - -#else /* !_KERNEL */ - -void *acpi_map_physical(vm_offset_t, size_t); -struct ACPIrsdp *acpi_find_rsd_ptr(void); -int acpi_checksum(void *, size_t); -struct ACPIsdt *acpi_map_sdt(vm_offset_t); -void acpi_print_rsd_ptr(struct ACPIrsdp *); -void acpi_print_sdt(struct ACPIsdt *); -void acpi_print_rsdt(struct ACPIsdt *); -void acpi_print_facp(struct FACPbody *); -void acpi_print_dsdt(struct ACPIsdt *); - -#endif /* _KERNEL */ - Property changes on: head/sys/dev/acpi/acpireg.h ___________________________________________________________________ Deleted: svn:keywords ## -1 +0,0 ## -FreeBSD=%H \ No newline at end of property Index: head/sys/dev/acpi/acpi_event.c =================================================================== --- head/sys/dev/acpi/acpi_event.c (revision 68516) +++ head/sys/dev/acpi/acpi_event.c (nonexistent) @@ -1,431 +0,0 @@ -/*- - * Copyright (c) 1999 Takanori Watanabe - * Copyright (c) 1999, 2000 Mitsuru IWASAKI - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#include "opt_acpi.h" - -#include -#include -#include -#include -#include - -#include - -#include -#include - -#include -#include - -/* - * ACPI events - */ -static void acpi_process_event(acpi_softc_t *sc, u_int32_t status_e, - u_int32_t status_0, u_int32_t status_1); - -/* - * ACPI events - */ - -static void -acpi_process_event(acpi_softc_t *sc, u_int32_t status_e, - u_int32_t status_0, u_int32_t status_1) -{ - int i; - - if (status_e & ACPI_PM1_PWRBTN_EN) { - if (sc->ignore_events & ACPI_PM1_PWRBTN_EN) { - ACPI_DEBUGPRINT("PWRBTN event ingnored\n"); - } else { -#if 1 - acpi_set_sleeping_state(sc, ACPI_S_STATE_S5); -#else - /* - * If there is ACPI userland daemon, - * this event should be passed to it - * so that the user can determine power policy. - */ - acpi_queue_event(sc, ACPI_EVENT_TYPE_FIXEDREG, 0); -#endif - } - } - - if (status_e & ACPI_PM1_SLPBTN_EN) { - if (sc->ignore_events & ACPI_PM1_SLPBTN_EN) { - ACPI_DEBUGPRINT("SLPBTN event ingnored\n"); - } else { -#if 1 - acpi_set_sleeping_state(sc, ACPI_S_STATE_S1); -#else - acpi_queue_event(sc, ACPI_EVENT_TYPE_FIXEDREG, 1); -#endif - } - } - for(i = 0; i < sc->facp_body->gpe0_len * 4; i++) - if((status_0 & (1 << i)) && (sc->gpe0_mask & (1 << i))) - acpi_queue_event(sc, ACPI_EVENT_TYPE_GPEREG, i); - for(i = 0; i < sc->facp_body->gpe1_len * 4 ; i++) - if((status_1 & (1 << i)) && (sc->gpe1_mask & (1 << i))) - acpi_queue_event(sc, ACPI_EVENT_TYPE_GPEREG, - i + sc->facp_body->gpe1_base); -} - -void -acpi_intr(void *data) -{ - u_int32_t enable; - u_int32_t status_e, status_0, status_1; - u_int32_t val; - int debug; - acpi_softc_t *sc; - - sc = (acpi_softc_t *)data; - debug = acpi_debug; /* Save debug level */ - acpi_debug = 0; /* Shut up */ - - /* - * Power Management 1 Status Registers - */ - status_e = enable = 0; - acpi_io_pm1_status(sc, ACPI_REGISTER_INPUT, &status_e); - - /* - * Get current interrupt mask - */ - acpi_io_pm1_enable(sc, ACPI_REGISTER_INPUT, &enable); - - /* - * Disable events and re-enable again - */ - if ((status_e & enable) != 0) { - acpi_debug = debug; /* OK, you can speak */ - - ACPI_DEBUGPRINT("pm1_status intr CALLED\n"); - - /* Disable all interrupt generation */ - val = enable & (~ACPI_PM1_ALL_ENABLE_BITS); - acpi_io_pm1_enable(sc, ACPI_REGISTER_OUTPUT, &val); - - /* Clear interrupt status */ - val = enable & ACPI_PM1_ALL_ENABLE_BITS; - acpi_io_pm1_status(sc, ACPI_REGISTER_OUTPUT, &val); - - /* Re-enable interrupt */ - acpi_io_pm1_enable(sc, ACPI_REGISTER_OUTPUT, &enable); - - acpi_debug = 0; /* Shut up again */ - } - - /* - * General-Purpose Events 0 Status Registers - */ - status_0 = enable = 0; - acpi_io_gpe0_status(sc, ACPI_REGISTER_INPUT, &status_0); - - /* - * Get current interrupt mask - */ - acpi_io_gpe0_enable(sc, ACPI_REGISTER_INPUT, &enable); - - /* - * Disable events and re-enable again - */ - if ((status_0 & enable) != 0) { - acpi_debug = debug; /* OK, you can speak */ - - ACPI_DEBUGPRINT("gpe0_status intr CALLED\n"); - - /* Disable all interrupt generation */ - val = enable & ~status_0; -#if 0 - /* or should we disable all? */ - val = 0x0; -#endif - acpi_io_gpe0_enable(sc, ACPI_REGISTER_OUTPUT, &val); -#if 0 - /* Clear interrupt status */ - val = enable; /* XXX */ - acpi_io_gpe0_status(sc, ACPI_REGISTER_OUTPUT, &val); - - /* Re-enable interrupt */ - acpi_io_gpe0_enable(sc, ACPI_REGISTER_OUTPUT, &enable); - - acpi_debug = 0; /* Shut up again */ -#endif - } - - /* - * General-Purpose Events 1 Status Registers - */ - status_1 = enable = 0; - acpi_io_gpe1_status(sc, ACPI_REGISTER_INPUT, &status_1); - - /* - Get current interrupt mask - */ - acpi_io_gpe1_enable(sc, ACPI_REGISTER_INPUT, &enable); - - /* - * Disable events and re-enable again - */ - if ((status_1 & enable) != 0) { - acpi_debug = debug; /* OK, you can speak */ - - ACPI_DEBUGPRINT("gpe1_status intr CALLED\n"); - - /* Disable all interrupt generation */ - val = enable & ~status_1; -#if 0 - /* or should we disable all? */ - val = 0x0; -#endif - acpi_io_gpe1_enable(sc, ACPI_REGISTER_OUTPUT, &val); - - /* Clear interrupt status */ - val = enable; /* XXX */ - acpi_io_gpe1_status(sc, ACPI_REGISTER_OUTPUT, &val); - - /* Re-enable interrupt */ - acpi_io_gpe1_enable(sc, ACPI_REGISTER_OUTPUT, &enable); - - acpi_debug = 0; /* Shut up again */ - } - - acpi_debug = debug; /* Restore debug level */ - - /* do something to handle the events... */ - acpi_process_event(sc, status_e, status_0, status_1); -} - -static int -acpi_set_gpe_bits(struct aml_name *name, va_list ap) -{ - struct acpi_softc *sc = va_arg(ap, struct acpi_softc *); - int *gpemask0 = va_arg(ap, int *); - int *gpemask1 = va_arg(ap, int *); - int gpenum; - -#define XDIGITTONUM(c) ((isdigit(c)) ? ((c) - '0') : ('A' <= (c)&& (c) <= 'F') ? ((c) - 'A' + 10) : 0) - - if (isxdigit(name->name[2]) && isxdigit(name->name[3])) { - gpenum = XDIGITTONUM(name->name[2]) * 16 + - XDIGITTONUM(name->name[3]); - ACPI_DEBUGPRINT("GPENUM %d %d \n", gpenum, sc->facp_body->gpe0_len * 4); - if (gpenum < (sc->facp_body->gpe0_len * 4)) { - *gpemask0 |= (1 << gpenum); - } else { - *gpemask1 |= (1 << (gpenum - sc->facp_body->gpe1_base)); - } - } - ACPI_DEBUGPRINT("GPEMASK %x %x\n", *gpemask0, *gpemask1); - return 0; -} - -void -acpi_enable_events(acpi_softc_t *sc) -{ - u_int32_t status; - u_int32_t mask0, mask1; - u_int32_t flags; - - /* - * Setup PM1 Enable Registers Fixed Feature Enable Bits (4.7.3.1.2) - * based on flags field of Fixed ACPI Description Table (5.2.5). - */ - acpi_io_pm1_enable(sc, ACPI_REGISTER_INPUT, &status); - flags = sc->facp_body->flags; - if ((flags & ACPI_FACP_FLAG_PWR_BUTTON) == 0) { - status |= ACPI_PM1_PWRBTN_EN; - } - if ((flags & ACPI_FACP_FLAG_SLP_BUTTON) == 0) { - status |= ACPI_PM1_SLPBTN_EN; - } - acpi_io_pm1_enable(sc, ACPI_REGISTER_OUTPUT, &status); - -#if 1 - /* - * XXX - * This should be done based on level event handlers in - * \_GPE scope (4.7.2.2.1.2). - */ - - mask0 = mask1 = 0; - aml_apply_foreach_found_objects(NULL, "\\_GPE._L", acpi_set_gpe_bits, - sc, &mask0, &mask1); /* XXX correct? */ - sc->gpe0_mask = mask0; - sc->gpe1_mask = mask1; - - acpi_io_gpe0_enable(sc, ACPI_REGISTER_OUTPUT, &mask0); - acpi_io_gpe1_enable(sc, ACPI_REGISTER_OUTPUT, &mask1); -#endif - - /* print all event status for debugging */ - acpi_io_pm1_status(sc, ACPI_REGISTER_INPUT, &status); - acpi_io_pm1_enable(sc, ACPI_REGISTER_INPUT, &status); - acpi_io_gpe0_status(sc, ACPI_REGISTER_INPUT, &status); - acpi_io_gpe0_enable(sc, ACPI_REGISTER_INPUT, &status); - acpi_io_gpe1_status(sc, ACPI_REGISTER_INPUT, &status); - acpi_io_gpe1_enable(sc, ACPI_REGISTER_INPUT, &status); - acpi_io_pm1_control(sc, ACPI_REGISTER_INPUT, &mask0, &mask1); - acpi_io_pm2_control(sc, ACPI_REGISTER_INPUT, &status); - acpi_io_pm_timer(sc, ACPI_REGISTER_INPUT, &status); -} - -void -acpi_disable_events(acpi_softc_t *sc) -{ - u_int32_t zero; - - if (sc->enabled) { - zero = 0; - acpi_io_pm1_enable(sc, ACPI_REGISTER_OUTPUT, &zero); - acpi_io_gpe0_enable(sc, ACPI_REGISTER_OUTPUT, &zero); - acpi_io_gpe1_enable(sc, ACPI_REGISTER_OUTPUT, &zero); - } -} - -void -acpi_clear_ignore_events(void *arg) -{ - ((acpi_softc_t *)arg)->ignore_events = 0; - ACPI_DEBUGPRINT("ignore events cleared\n"); -} - -/* - * Transition the rest of the system through state changes. - */ -int -acpi_send_pm_event(acpi_softc_t *sc, u_int8_t state) -{ - int error; - - error = 0; - switch (state) { - case ACPI_S_STATE_S0: - if (sc->system_state != ACPI_S_STATE_S0) { - DEVICE_RESUME(root_bus); - } - break; - case ACPI_S_STATE_S1: - case ACPI_S_STATE_S2: - case ACPI_S_STATE_S3: - case ACPI_S_STATE_S4: - error = DEVICE_SUSPEND(root_bus); - break; - default: - break; - } - - return (error); -} - -/* - * Event-handler thread. - */ -void -acpi_queue_event(acpi_softc_t *sc, int type, int arg) -{ - struct acpi_event *ae; - int s; - - ae = malloc(sizeof(*ae), M_TEMP, M_NOWAIT); - if(ae == NULL) - panic("acpi_queue_event: can't allocate event"); - - ae->ae_type = type; - ae->ae_arg = arg; - s = splhigh(); - STAILQ_INSERT_TAIL(&sc->event, ae, ae_q); - splx(s); - wakeup(&sc->event); -} - -void -acpi_event_thread(void *arg) -{ - acpi_softc_t *sc = arg; - int s , gpe1_base = sc->facp_body->gpe1_base; - u_int32_t status,bit; - struct acpi_event *ae; - const char numconv[] = {'0','1','2','3','4','5','6','7', - '8','9','A','B','C','D','E','F',-1}; - char gpemethod[] = "\\_GPE._LXX"; - union aml_object argv; /* Dummy*/ - - while(1) { - s = splhigh(); - if ((ae = STAILQ_FIRST(&sc->event)) == NULL) { - splx(s); - tsleep(&sc->event, PWAIT, "acpiev", 0); - continue; - } else { - splx(s); - } - s = splhigh(); - STAILQ_REMOVE_HEAD_UNTIL(&sc->event, ae, ae_q); - splx(s); - switch(ae->ae_type) { - case ACPI_EVENT_TYPE_GPEREG: - sprintf(gpemethod, "\\_GPE._L%c%c", - numconv[(ae->ae_arg / 0x10) & 0xf], - numconv[ae->ae_arg & 0xf]); - aml_invoke_method_by_name(gpemethod, 0, &argv); - sprintf(gpemethod, "\\_GPE._E%c%c", - numconv[(ae->ae_arg / 0x10) & 0xf], - numconv[ae->ae_arg & 0xf]); - aml_invoke_method_by_name(gpemethod, 0, &argv); - s=splhigh(); - if((ae->ae_arg < gpe1_base) || (gpe1_base == 0)){ - bit = 1 << ae->ae_arg; - ACPI_DEBUGPRINT("GPE0%x\n", bit); - acpi_io_gpe0_status(sc, ACPI_REGISTER_OUTPUT, - &bit); - acpi_io_gpe0_enable(sc, ACPI_REGISTER_INPUT, - &status); - ACPI_DEBUGPRINT("GPE0%x\n", status); - status |= bit; - acpi_io_gpe0_enable(sc, ACPI_REGISTER_OUTPUT, - &status); - } else { - bit = 1 << (ae->ae_arg - sc->facp_body->gpe1_base); - acpi_io_gpe1_status(sc, ACPI_REGISTER_OUTPUT, - &bit); - acpi_io_gpe1_enable(sc, ACPI_REGISTER_INPUT, - &status); - status |= bit; - acpi_io_gpe1_enable(sc, ACPI_REGISTER_OUTPUT, - &status); - } - splx(s); - break; - } - free(ae, M_TEMP); - } - ACPI_DEVPRINTF("????\n"); -} Property changes on: head/sys/dev/acpi/acpi_event.c ___________________________________________________________________ Deleted: svn:keywords ## -1 +0,0 ## -FreeBSD=%H \ No newline at end of property Index: head/sys/dev/acpi/acpiio.h =================================================================== --- head/sys/dev/acpi/acpiio.h (revision 68516) +++ head/sys/dev/acpi/acpiio.h (nonexistent) @@ -1,33 +0,0 @@ -/*- - * Copyright (c) 1999 Takanori Watanabe - * Copyright (c) 1999 Mitsuru IWASAKI - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#define ACPIIO_ENABLE _IO('P', 1) -#define ACPIIO_DISABLE _IO('P', 2) -#define ACPIIO_SETSLPSTATE _IOW('P', 3, int) - Property changes on: head/sys/dev/acpi/acpiio.h ___________________________________________________________________ Deleted: svn:keywords ## -1 +0,0 ## -FreeBSD=%H \ No newline at end of property Index: head/sys/dev/acpi/acpi.c =================================================================== --- head/sys/dev/acpi/acpi.c (revision 68516) +++ head/sys/dev/acpi/acpi.c (nonexistent) @@ -1,1002 +0,0 @@ -/*- - * Copyright (c) 1999 Takanori Watanabe - * Copyright (c) 1999, 2000 Mitsuru IWASAKI - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $Id: acpi.c,v 1.26 2000/08/15 14:43:43 iwasaki Exp $ - * $FreeBSD$ - */ - -#include "opt_acpi.h" -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include -#include -#include - -#include -#include -#include - -#include -#include -#include -#include - -/* - * These items cannot be in acpi_softc because they are initialized - * by MD code before the softc is allocated. - */ -struct ACPIaddr acpi_addr; -struct ACPIrsdp *acpi_rsdp; - -/* - * Character device - */ - -static d_open_t acpiopen; -static d_close_t acpiclose; -static d_ioctl_t acpiioctl; -static d_mmap_t acpimmap; - -#define CDEV_MAJOR 152 -static struct cdevsw acpi_cdevsw = { - acpiopen, - acpiclose, - noread, - nowrite, - acpiioctl, - nopoll, - acpimmap, - nostrategy, - "acpi", - CDEV_MAJOR, - nodump, - nopsize, - 0, - -1 -}; - -/* - * Miscellaneous utility functions - */ -static void acpi_handle_dsdt(acpi_softc_t *sc); -static void acpi_handle_facp(acpi_softc_t *sc, struct ACPIsdt *facp); -static int acpi_handle_rsdt(acpi_softc_t *sc); - -/* - * System sleeping state - */ -static void acpi_trans_sleeping_state(acpi_softc_t *sc, u_int8_t state); -static void acpi_soft_off(void *data, int howto); -static void acpi_execute_pts(acpi_softc_t *sc, u_int8_t state); -static void acpi_execute_wak(acpi_softc_t *sc, u_int8_t state); - -/* - * Bus interface - */ -static void acpi_identify(driver_t *driver, device_t parent); -static int acpi_probe(device_t dev); -static int acpi_attach(device_t dev); -static void acpi_free(struct acpi_softc *sc); - -/* for debugging */ -#ifdef ACPI_DEBUG -int acpi_debug = 1; -#else /* !ACPI_DEBUG */ -int acpi_debug = 0; -#endif /* ACPI_DEBUG */ - -SYSCTL_INT(_debug, OID_AUTO, acpi_debug, CTLFLAG_RW, &acpi_debug, 1, ""); - -/* - * ACPI pmap subsystem - */ -void -acpi_init_addr_range(void) -{ - acpi_addr.entries = 0; -} - -void -acpi_register_addr_range(u_int64_t base, u_int64_t size, u_int32_t type) -{ - int i; - u_int32_t ext_size; - vm_offset_t pa_base, pa_next_base; - - if (acpi_addr.entries == ACPI_SMAP_MAX_SIZE) { - return; /* no room */ - } - - for (i = 0; i < acpi_addr.entries; i++) { - if (type != acpi_addr.t[i].type) { - continue; - } - - pa_base = acpi_addr.t[i].pa_base; - pa_next_base = pa_base + acpi_addr.t[i].size; - - /* continuous or overlap? */ - if (base > pa_base && base <= pa_next_base) { - ext_size = size - (pa_next_base - base); - acpi_addr.t[i].size += ext_size; - return; - } - } - - i = acpi_addr.entries; - acpi_addr.t[i].pa_base = base; - acpi_addr.t[i].size = size; - acpi_addr.t[i].type = type; - acpi_addr.entries++; -} - -vm_offset_t -acpi_pmap_ptv(vm_offset_t pa) -{ - int i; - vm_offset_t va; - - va = 0; - for (i = 0; i < acpi_addr.entries; i++) { - if (pa >= acpi_addr.t[i].pa_base && - pa < acpi_addr.t[i].pa_base + acpi_addr.t[i].size) { - va = acpi_addr.t[i].va_base + pa - acpi_addr.t[i].pa_base; - return (va); - } - } - - return (va); -} - -vm_offset_t -acpi_pmap_vtp(vm_offset_t va) -{ - int i; - vm_offset_t pa; - - pa = 0; - for (i = 0; i < acpi_addr.entries; i++) { - if (va >= acpi_addr.t[i].va_base && - va < acpi_addr.t[i].va_base + acpi_addr.t[i].size) { - pa = acpi_addr.t[i].pa_base + va - acpi_addr.t[i].va_base; - return (pa); - } - } - - return (pa); -} - -/* - * Miscellaneous utility functions - */ -int -acpi_sdt_checksum(struct ACPIsdt *sdt) -{ - u_char cksm, *ckbf; - int i; - - cksm = 0; - ckbf = (u_char *) sdt; - - for (i = 0; i < sdt->len; i++) - cksm += ckbf[i]; - - return ((cksm == 0) ? 0 : EINVAL); -} - -/* - * Handle the DSDT - */ -static void -acpi_handle_dsdt(acpi_softc_t *sc) -{ - int i; - int debug; - struct aml_name *newname, *sname; - union aml_object *spkg; - struct aml_name_group *newgrp; - struct ACPIsdt *dsdp; - char namestr[5]; - struct aml_environ env; - struct acpi_system_state_package ssp; - - /* - * Some systems (eg. IBM laptops) expect "Microsoft Windows*" as - * \_OS_ string, so we create it anyway. - */ - aml_new_name_group(AML_NAME_GROUP_OS_DEFINED); - env.curname = aml_get_rootname(); - newname = aml_create_name(&env, "\\_OS_"); - newname->property = aml_alloc_object(aml_t_string, NULL); - newname->property->str.needfree = 0; - newname->property->str.string = "Microsoft Windows NG"; - - /* - * Create namespace. - */ - dsdp = sc->dsdt; - newgrp = aml_new_name_group((int)dsdp->body); - - bzero(&env, sizeof(env)); - env.dp = (u_int8_t *)dsdp->body; - env.end = (u_int8_t *)dsdp + dsdp->len; - env.curname = aml_get_rootname(); - - /* - * Suppress debugging during AML parsing. - */ - debug = aml_debug; - aml_debug = 0; - - aml_local_stack_push(aml_local_stack_create()); - aml_parse_objectlist(&env, 0); - aml_local_stack_delete(aml_local_stack_pop()); - - aml_debug = debug; - - if (aml_debug) { - aml_showtree(aml_get_rootname(), 0); - } - - /* - * Get sleeping type values from ACPI namespace. - */ - sc->system_state = ACPI_S_STATE_S0; - sc->system_state_initialized = 1; - for (i = ACPI_S_STATE_S0; i <= ACPI_S_STATE_S5; i++) { - ssp.mode[i].slp_typ_a = ACPI_UNSUPPORTSLPTYP; - ssp.mode[i].slp_typ_b = ACPI_UNSUPPORTSLPTYP; - sprintf(namestr, "_S%d_", i); - sname = aml_find_from_namespace(NULL, namestr); - if (sname == NULL) { - continue; - } - spkg = aml_eval_name(&env, sname); - if (spkg == NULL || spkg->type != aml_t_package) { - continue; - } - if (spkg->package.elements < 2) { - continue; - } - if (spkg->package.objects[0] == NULL || - spkg->package.objects[0]->type != aml_t_num) { - continue; - } - ssp.mode[i].slp_typ_a = spkg->package.objects[0]->num.number; - ssp.mode[i].slp_typ_b = spkg->package.objects[1]->num.number; - ACPI_DEBUGPRINT("%s : [%d, %d]\n", namestr, - ssp.mode[i].slp_typ_a, ssp.mode[i].slp_typ_b); - } - sc->system_state_package = ssp; - -#if 0 - while (name_group_list->id != AML_NAME_GROUP_ROOT) { - aml_delete_name_group(name_group_list); - } - memman_statistics(aml_memman); - memman_freeall(aml_memman); -#endif -} - -/* - * Handle the FACP. - */ -static void -acpi_handle_facp(acpi_softc_t *sc, struct ACPIsdt *facp) -{ - struct ACPIsdt *dsdt; - struct FACPbody *body; - struct FACS *facs; - - ACPI_DEBUGPRINT(" FACP found\n"); - body = (struct FACPbody *)facp->body; - sc->facp = facp; - sc->facp_body = body; - sc->dsdt = NULL; - sc->facs = NULL; - dsdt = (struct ACPIsdt *) acpi_pmap_ptv(body->dsdt_ptr); - if (dsdt == NULL) { - return; - } - - if (strncmp(dsdt->signature, "DSDT", 4) == 0 && - acpi_sdt_checksum(dsdt) == 0) { - ACPI_DEBUGPRINT(" DSDT found Size=%d bytes\n", dsdt->len); - sc->dsdt = dsdt; - acpi_handle_dsdt(sc); - } - - facs = (struct FACS *) acpi_pmap_ptv(body->facs_ptr); - if (facs == NULL) { - return; - } - - /* - * FACS has no checksum (modified by both OS and BIOS) and in many - * cases, it is in nonvolatile storage. - */ - if (strncmp(facs->signature, "FACS", 4) == 0) { - sc->facs = facs; - ACPI_DEBUGPRINT(" FACS found Size=%d bytes\n", facs->len); - } -} - -/* - * Handle the RSDT. - */ -static int -acpi_handle_rsdt(acpi_softc_t *sc) -{ - u_int32_t *ptrs; - int entries; - int i; - struct ACPIsdt *rsdt, *sdt; - char sigstring[5]; - - rsdt = (struct ACPIsdt *) acpi_pmap_ptv(acpi_rsdp->addr); - if (rsdt == 0) { - ACPI_DEVPRINTF("cannot map physical memory\n"); - return (-1); - } - if ((strncmp(rsdt->signature, "RSDT", 4) != 0) || - (acpi_sdt_checksum(rsdt) != 0)) { - ACPI_DEVPRINTF("RSDT is broken\n"); - return (-1); - } - sc->rsdt = rsdt; - entries = (rsdt->len - SIZEOF_SDT_HDR) / sizeof(u_int32_t); - ACPI_DEBUGPRINT("RSDT have %d entries\n", entries); - ptrs = (u_int32_t *) & rsdt->body; - - for (i = 0; i < entries; i++) { - sdt = (struct ACPIsdt *) acpi_pmap_ptv((vm_offset_t) ptrs[i]); - bzero(sigstring, sizeof(sigstring)); - strncpy(sigstring, sdt->signature, sizeof(sdt->signature)); - ACPI_DEBUGPRINT("RSDT entry%d %s\n", i, sigstring); - - if (strncmp(sdt->signature, "FACP", 4) == 0 && - acpi_sdt_checksum(sdt) == 0) { - acpi_handle_facp(sc, sdt); - } - } - return (0); -} - -/* - * System sleeping state. - */ -static void -acpi_trans_sleeping_state(acpi_softc_t *sc, u_int8_t state) -{ - u_int8_t slp_typx; - u_int32_t val_a, val_b; - int debug, count; - u_long ef; - - /* XXX should be MI */ - /* XXX should always be called with interrupts enabled! */ - ef = read_eflags(); - disable_intr(); - - if (state > ACPI_S_STATE_S0) { - /* clear WAK_STS bit by writing a one */ - acpi_io_pm1_status(sc, ACPI_REGISTER_INPUT, &val_a); - if (val_a & ACPI_PM1_WAK_STS) { - sc->broken_wakeuplogic = 0; - } else { - ACPI_DEVPRINTF("wake-up logic seems broken, " - "this may cause troubles on wakeup\n"); - sc->broken_wakeuplogic = 1; - } - val_a = ACPI_PM1_WAK_STS; - acpi_io_pm1_status(sc, ACPI_REGISTER_OUTPUT, &val_a); - - /* ignore power button and sleep button events for 5 sec. */ - sc->ignore_events = ACPI_PM1_PWRBTN_EN | ACPI_PM1_SLPBTN_EN; - timeout(acpi_clear_ignore_events, (caddr_t)sc, hz * 5); - } - - acpi_io_pm1_control(sc, ACPI_REGISTER_INPUT, &val_a, &val_b); - val_a &= ~(ACPI_CNT_SLP_TYPX); - val_b &= ~(ACPI_CNT_SLP_TYPX); - slp_typx = sc->system_state_package.mode[state].slp_typ_a; - val_a |= ACPI_CNT_SET_SLP_TYP(slp_typx) | ACPI_CNT_SLP_EN; - slp_typx = sc->system_state_package.mode[state].slp_typ_b; - val_b |= ACPI_CNT_SET_SLP_TYP(slp_typx) | ACPI_CNT_SLP_EN; - acpi_io_pm1_control(sc, ACPI_REGISTER_OUTPUT, &val_a, &val_b); - - if (state == ACPI_S_STATE_S0) { - goto sleep_done; - } - - /* - * wait for WAK_STS bit - */ - debug = acpi_debug; /* Save debug level */ - acpi_debug = 0; /* Shut up */ - - count = 0; - for (;;) { - acpi_io_pm1_status(sc, ACPI_REGISTER_INPUT, &val_a); - if (val_a & ACPI_PM1_WAK_STS) { - break; - } - /* XXX - * some BIOSes doesn't set WAK_STS at all, - * give up waiting for wakeup if timeout... - */ - if (sc->broken_wakeuplogic) { - if (count++ >= 100) { - break; /* giving up */ - } - } - DELAY(10*1000); /* 0.01 sec */ - } - acpi_debug = debug; /* Restore debug level */ - -sleep_done: - /* XXX should be MI */ - write_eflags(ef); -} - -static void -acpi_soft_off(void *data, int howto) -{ - acpi_softc_t *sc; - u_int32_t vala = 0; - - if (!(howto & RB_POWEROFF)) { - return; - } - sc = (acpi_softc_t *) data; - acpi_execute_pts(sc, ACPI_S_STATE_S5); - - /* XXX Disable GPE intrrupt,or power on again in some machine */ - acpi_io_gpe0_enable(sc, ACPI_REGISTER_OUTPUT, &vala); - acpi_io_gpe1_enable(sc, ACPI_REGISTER_OUTPUT, &vala); - - acpi_trans_sleeping_state(sc, ACPI_S_STATE_S5); -} - -void -acpi_set_sleeping_state(acpi_softc_t *sc, u_int8_t state) -{ - u_int8_t slp_typ_a, slp_typ_b; - - if (!sc->system_state_initialized) { - return; - } - - slp_typ_a = sc->system_state_package.mode[state].slp_typ_a; - slp_typ_b = sc->system_state_package.mode[state].slp_typ_b; - - if (slp_typ_a == ACPI_UNSUPPORTSLPTYP || - slp_typ_b == ACPI_UNSUPPORTSLPTYP) { - return; /* unsupported sleeping type */ - } - - if (state < ACPI_S_STATE_S5) { - /* inform all devices that we are going to sleep. */ - if (acpi_send_pm_event(sc, state) != 0) { - /* if failure, 'wakeup' the system again */ - acpi_send_pm_event(sc, ACPI_S_STATE_S0); - return; - } - - /* Prepare to sleep */ - acpi_execute_pts(sc, state); - - /* PowerResource manipulation */ - acpi_powerres_set_sleeping_state(sc, state); - if (acpi_debug) { - acpi_powerres_debug(sc); - } - - sc->system_state = state; - } - - /* - * XXX currently support S1 and S5 only. - */ - switch (state) { - case ACPI_S_STATE_S0: - case ACPI_S_STATE_S1: - acpi_trans_sleeping_state(sc, state); - break; - case ACPI_S_STATE_S5: - /* Power the system off using ACPI */ - shutdown_nice(RB_POWEROFF); - break; - default: - break; - } - - if (state < ACPI_S_STATE_S5) { - acpi_powerres_set_sleeping_state(sc, 0); - if (acpi_debug) { - acpi_powerres_debug(sc); - } - acpi_execute_wak(sc, state); - acpi_send_pm_event(sc, ACPI_S_STATE_S0); - - sc->system_state = ACPI_S_STATE_S0; - } -} - -static void -acpi_execute_pts(acpi_softc_t *sc, u_int8_t state) -{ - union aml_object argv[1], *retval; - - argv[0].type = aml_t_num; - argv[0].num.number = state; - aml_local_stack_push(aml_local_stack_create()); - retval = aml_invoke_method_by_name("_PTS", 1, argv); - aml_local_stack_delete(aml_local_stack_pop()); -} - -static void -acpi_execute_wak(acpi_softc_t *sc, u_int8_t state) -{ - union aml_object argv[1], *retval; - - argv[0].type = aml_t_num; - argv[0].num.number = state; - aml_local_stack_push(aml_local_stack_create()); - retval = aml_invoke_method_by_name("_WAK", 1, argv); - aml_local_stack_delete(aml_local_stack_pop()); - - /* - * XXX These shouldn't be here, but tentatively implemented. - * Sample application of aml_apply_foreach_found_objects(). - * We try to find and evaluate all of objects which have specified - * string. As the result, Battery Information, Battery Status and - * Power source will be reported. - */ - aml_apply_foreach_found_objects(NULL, "_BIF", aml_eval_name_simple); - aml_apply_foreach_found_objects(NULL, "_BST", aml_eval_name_simple); - aml_apply_foreach_found_objects(NULL, "_PSR", aml_eval_name_simple); -} - -/* - * Character device - */ - -static int -acpiopen(dev_t dev, int flag, int fmt, struct proc * p) -{ - return (0); -} - -static int -acpiclose(dev_t dev, int flag, int fmt, struct proc * p) -{ - return (0); -} - -static int -acpiioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc * p) -{ - int error, state; - acpi_softc_t *sc = (struct acpi_softc *)dev->si_drv1; - - error = 0; - - if (sc == NULL) { - return (EINVAL); - } - - switch (cmd) { - case ACPIIO_ENABLE: - acpi_enable_disable(sc, 1); - acpi_enable_events(sc); - break; - - case ACPIIO_DISABLE: - acpi_enable_disable(sc, 0); - break; - - case ACPIIO_SETSLPSTATE: - state = *(int *)addr; - if (state >= ACPI_S_STATE_S0 && state <= ACPI_S_STATE_S5) { - acpi_set_sleeping_state(sc, state); - } else { - error = EINVAL; - } - ACPI_DEBUGPRINT("ACPIIO_SETSLPSTATE = %d\n", state); - break; - - default: - error = EINVAL; - break; - } - - return (error); -} - -static int -acpimmap(dev_t dev, vm_offset_t offset, int nprot) -{ - acpi_softc_t *sc = (struct acpi_softc *)dev->si_drv1; - - if (sc == NULL) { - return (EINVAL); - } - /* XXX should be MI */ - return (i386_btop(acpi_pmap_vtp((vm_offset_t)(sc->dsdt + offset)))); -} - -/* - * Bus interface - */ -static devclass_t acpi_devclass; - -static void -acpi_identify(driver_t *driver, device_t parent) -{ - device_t child; - struct ACPIrsdp *rsdp; - - /* - * If we've already got ACPI attached somehow, don't try again. - */ - if (device_find_child(parent, "acpi", 0)) { - printf("ACPI: already attached\n"); - return; - } - - /* - * Ask the MD code to find the ACPI RSDP - */ - if ((rsdp = acpi_find_rsdp()) == NULL) - return; - acpi_rsdp = rsdp; - - /* - * Call the MD code to map memory claimed by ACPI - */ - acpi_mapmem(); - - /* - * Attach the actual ACPI device. - */ - if ((child = BUS_ADD_CHILD(parent, 101, "acpi", 0)) == NULL) { - device_printf(parent, "ACPI: could not attach\n"); - return; - } -} - -static int -acpi_probe(device_t dev) -{ - int debug; - char oemstring[7]; - - /* get debug variables specified in loader. */ - if (getenv_int("debug.acpi_debug", &debug)) { - acpi_debug = debug; - } - if (getenv_int("debug.aml_debug", &debug)) { - aml_debug = debug; - } - - bzero(oemstring, sizeof(oemstring)); - strncpy(oemstring, acpi_rsdp->oem, sizeof(acpi_rsdp->oem)); - - ACPI_DEBUGPRINT("Found ACPI BIOS data at %p (<%s>, RSDT@%x)\n", - acpi_rsdp, oemstring, acpi_rsdp->addr); - - device_set_desc_copy(dev, oemstring); - return (0); -} - -static int -acpi_attach(device_t dev) -{ - acpi_softc_t *sc; - int rid; - - /* - * Set up the softc and parse the ACPI data completely. - */ - sc = device_get_softc(dev); - sc->dev = dev; - if (acpi_handle_rsdt(sc) != 0) { - acpi_free(sc); - return (ENXIO); - } - - /* - * SMI command register - */ - rid = ACPI_RES_SMI_CMD; - acpi_attach_resource(sc, SYS_RES_IOPORT, &rid, - sc->facp_body->smi_cmd, 1); - - /* - * PM1 event registers - */ - rid = ACPI_RES_PM1A_EVT; - acpi_attach_resource(sc, SYS_RES_IOPORT, &rid, - sc->facp_body->pm1a_evt_blk, sc->facp_body->pm1_evt_len); - if (sc->facp_body->pm1b_evt_blk != 0) { - rid = ACPI_RES_PM1B_EVT; - acpi_attach_resource(sc, SYS_RES_IOPORT, &rid, - sc->facp_body->pm1b_evt_blk, sc->facp_body->pm1_evt_len); - } - - /* - * PM1 control registers - */ - rid = ACPI_RES_PM1A_CNT; - acpi_attach_resource(sc, SYS_RES_IOPORT, &rid, - sc->facp_body->pm1a_cnt_blk, sc->facp_body->pm1_cnt_len); - if (sc->facp_body->pm1b_cnt_blk != 0) { - rid = ACPI_RES_PM1B_CNT; - acpi_attach_resource(sc, SYS_RES_IOPORT, &rid, - sc->facp_body->pm1b_cnt_blk, sc->facp_body->pm1_cnt_len); - } - - /* - * PM2 control register - */ - rid = ACPI_RES_PM2_CNT; - acpi_attach_resource(sc, SYS_RES_IOPORT, &rid, - sc->facp_body->pm2_cnt_blk, sc->facp_body->pm2_cnt_len); - - /* - * PM timer register - */ - rid = ACPI_RES_PM_TMR; - acpi_attach_resource(sc, SYS_RES_IOPORT, &rid, - sc->facp_body->pm_tmr_blk, 4); - - /* - * General purpose event registers - */ - if (sc->facp_body->gpe0_blk != 0) { - rid = ACPI_RES_GPE0; - acpi_attach_resource(sc, SYS_RES_IOPORT, &rid, - sc->facp_body->gpe0_blk, sc->facp_body->gpe0_len); - } - if (sc->facp_body->gpe1_blk != 0) { - rid = ACPI_RES_GPE1; - acpi_attach_resource(sc, SYS_RES_IOPORT, &rid, - sc->facp_body->gpe1_blk, sc->facp_body->gpe1_len); - } - - /* - * Notification interrupt - */ - if (sc->facp_body->sci_int != 0) - bus_set_resource(sc->dev, SYS_RES_IRQ, 0, sc->facp_body->sci_int, 1); - sc->irq_rid = 0; - if ((sc->irq = bus_alloc_resource(sc->dev, SYS_RES_IRQ, &sc->irq_rid, - 0, ~0, 1, RF_SHAREABLE | RF_ACTIVE)) == NULL) { - ACPI_DEVPRINTF("could not allocate interrupt\n"); - acpi_free(sc); - return(ENOMEM); - } - if (bus_setup_intr(sc->dev, sc->irq, INTR_TYPE_MISC, acpi_intr, sc, &sc->irq_handle)) { - ACPI_DEVPRINTF("could not set up irq\n"); - acpi_free(sc); - return(ENXIO); - } - - /* initialise the event queue */ - STAILQ_INIT(&sc->event); - -#ifndef ACPI_NO_ENABLE_ON_BOOT - acpi_enable_disable(sc, 1); - acpi_enable_events(sc); - acpi_intr((void *)sc); -#endif - - - acpi_powerres_init(sc); - if (acpi_debug) { - acpi_powerres_debug(sc); - } - - EVENTHANDLER_REGISTER(shutdown_pre_sync, acpi_disable_events, - sc, SHUTDOWN_PRI_LAST); - EVENTHANDLER_REGISTER(shutdown_final, acpi_soft_off, - sc, SHUTDOWN_PRI_LAST); - - sc->dev_t = make_dev(&acpi_cdevsw, 0, 0, 5, 0660, "acpi"); - sc->dev_t->si_drv1 = sc; - - /* - * Probe/attach children now that the AML has been parsed. - */ - bus_generic_probe(dev); - bus_generic_attach(dev); - - /* - * Start the eventhandler thread - */ - if (kthread_create(acpi_event_thread, sc, &sc->acpi_thread, 0, "acpi")) { - ACPI_DEVPRINTF("CANNOT CREATE THREAD\n"); - } - return (0); -} - -static int -acpi_detach(device_t dev) -{ - acpi_softc_t *sc = device_get_softc(dev); - - /* acpi_disable_events(sc); */ - acpi_enable_disable(sc, 0); - acpi_free(sc); - - return(0); -} - -static void -acpi_free(struct acpi_softc *sc) -{ - int i; - - for (i = 0; i < ACPI_RES_MAX; i++) { - if (sc->iores[i].rsc != NULL) { - bus_release_resource(sc->dev, - SYS_RES_IOPORT, - sc->iores[i].rid, - sc->iores[1].rsc); - } - } - if (sc->irq_handle != NULL) - bus_teardown_intr(sc->dev, sc->irq, sc->irq_handle); - if (sc->irq != NULL) - bus_release_resource(sc->dev, SYS_RES_IRQ, sc->irq_rid, sc->irq); -} - -static int -acpi_resume(device_t dev) -{ - acpi_softc_t *sc; - - sc = device_get_softc(dev); - if (sc->enabled) { - /* re-enable on wakeup */ - acpi_enable_disable(sc, 1); - acpi_enable_events(sc); - } - return (0); -} - -static device_method_t acpi_methods[] = { - /* Device interface */ - DEVMETHOD(device_identify, acpi_identify), - DEVMETHOD(device_probe, acpi_probe), - DEVMETHOD(device_attach, acpi_attach), - DEVMETHOD(device_resume, acpi_resume), - DEVMETHOD(device_detach, acpi_detach), - - /* Bus interface */ - DEVMETHOD(bus_print_child, bus_generic_print_child), - DEVMETHOD(bus_driver_added, bus_generic_driver_added), - - {0, 0} -}; - -static driver_t acpi_driver = { - "acpi", - acpi_methods, - sizeof(acpi_softc_t), -}; - -DRIVER_MODULE(acpi, nexus, acpi_driver, acpi_devclass, 0, 0); - -int -acpi_attach_resource(acpi_softc_t *sc, int type, int *wantidx, u_long start, u_long size) -{ - int i, idx; - - /* - * The caller is unaware of the softc, so find it. - */ - if (sc == NULL) - sc = devclass_get_softc(acpi_devclass, 0); - if (sc == NULL) - return(ENXIO); - - /* - * The caller wants an automatic index - */ - idx = *wantidx; - if (idx == ACPI_RES_AUTO) { - for (i = ACPI_RES_FIRSTFREE; i < ACPI_RES_MAX; i++) { - if (sc->iores[i].rsc == NULL) - break; - } - if (i == ACPI_RES_MAX) - return(ENOMEM); - idx = i; - } - - /* - * Connect the resource to ourselves. - */ - bus_set_resource(sc->dev, type, idx, start, size); - sc->iores[idx].rid = idx; - sc->iores[idx].size = size; - sc->iores[idx].rsc = bus_alloc_resource(sc->dev, type, &sc->iores[idx].rid, 0, ~0, 1, RF_ACTIVE); - if (sc->iores[idx].rsc != NULL) { - sc->iores[idx].bhandle = rman_get_bushandle(sc->iores[idx].rsc); - sc->iores[idx].btag = rman_get_bustag(sc->iores[idx].rsc); - *wantidx = idx; - return(0); - } else { - return(ENXIO); - } -} - -/* - * System service interface - */ - -#include - -int -acpi_sleep(u_int32_t milli) -{ - static u_int8_t count = 0; - int x, error; - u_int32_t timo; - - x = error = 0; - - if (milli == 0) { - return (1); - } - - if (curproc == NULL) { - return (2); - } - - timo = ((hz * milli) / 1000) ? ((hz * milli) / 1000) : 1; - error = tsleep((caddr_t)acpi_sleep + count, PWAIT, "acpislp", timo); - if (error != 0 && error != EWOULDBLOCK) { - return (2); - } - x = splhigh(); - count++; - splx(x); - - return (0); -} - Property changes on: head/sys/dev/acpi/acpi.c ___________________________________________________________________ Deleted: svn:keywords ## -1 +0,0 ## -FreeBSD=%H \ No newline at end of property Index: head/sys/dev/acpi/aml/aml_region.h =================================================================== --- head/sys/dev/acpi/aml/aml_region.h (revision 68516) +++ head/sys/dev/acpi/aml/aml_region.h (nonexistent) @@ -1,92 +0,0 @@ -/*- - * Copyright (c) 2000 Mitsuru IWASAKI - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $Id: aml_region.h,v 1.5 2000/08/08 14:12:05 iwasaki Exp $ - * $FreeBSD$ - */ - -#ifndef _AML_REGION_H_ -#define _AML_REGION_H_ - -/* - * Note that common part of region I/O is implemented in aml_common.c. - */ - -/* - * Debug macros for region I/O - */ - -#define AML_REGION_READ_DEBUG(regtype, flags, addr, bitoffset, bitlen) \ - AML_DEBUGPRINT("\n[aml_region_read(%d, %d, 0x%x, 0x%x, 0x%x)]\n",\ - regtype, flags, addr, bitoffset, bitlen) - -#define AML_REGION_READ_INTO_BUFFER_DEBUG(regtype, flags, \ - addr, bitoffset, bitlen) \ - AML_DEBUGPRINT("\n[aml_region_read_into_buffer(%d, %d, 0x%x, 0x%x, 0x%x)]\n",\ - regtype, flags, addr, bitoffset, bitlen) - -#define AML_REGION_WRITE_DEBUG(regtype, flags, value, \ - addr, bitoffset, bitlen) \ - AML_DEBUGPRINT("\n[aml_region_write(%d, %d, 0x%x, 0x%x, 0x%x, 0x%x)]\n",\ - regtype, flags, value, addr, bitoffset, bitlen) - -#define AML_REGION_WRITE_FROM_BUFFER_DEBUG(regtype, flags, \ - addr, bitoffset, bitlen) \ - AML_DEBUGPRINT("\n[aml_region_write_from_buffer(%d, %d, 0x%x, 0x%x, 0x%x)]\n",\ - regtype, flags, addr, bitoffset, bitlen) - -#define AML_REGION_BCOPY_DEBUG(regtype, flags, addr, bitoffset, bitlen, \ - dflags, daddr, dbitoffset, dbitlen) \ - AML_DEBUGPRINT("\n[aml_region_bcopy(%d, %d, 0x%x, 0x%x, 0x%x, %d, 0x%x, 0x%x, 0x%x)]\n",\ - regtype, flags, addr, bitoffset, bitlen, \ - dflags, daddr, dbitoffset, dbitlen) - -/* - * Region I/O subroutine - */ - -struct aml_environ; - -u_int32_t aml_region_read(struct aml_environ *, int, u_int32_t, - u_int32_t, u_int32_t, u_int32_t); -int aml_region_write(struct aml_environ *, int, u_int32_t, - u_int32_t, u_int32_t, u_int32_t, u_int32_t); -int aml_region_read_into_buffer(struct aml_environ *, int, - u_int32_t, u_int32_t, u_int32_t, - u_int32_t, u_int8_t *); -int aml_region_write_from_buffer(struct aml_environ *, int, - u_int32_t, u_int8_t *, u_int32_t, - u_int32_t, u_int32_t); -int aml_region_bcopy(struct aml_environ *, int, - u_int32_t, u_int32_t, u_int32_t, u_int32_t, - u_int32_t, u_int32_t, u_int32_t, u_int32_t); - -#ifndef _KERNEL -void aml_simulation_regdump(const char *); -extern int aml_debug_prompt_regoutput; -extern int aml_debug_prompt_reginput; -#endif /* !_KERNEL */ - -#endif /* !_AML_REGION_H_ */ Property changes on: head/sys/dev/acpi/aml/aml_region.h ___________________________________________________________________ Deleted: svn:keywords ## -1 +0,0 ## -FreeBSD=%H \ No newline at end of property Index: head/sys/dev/acpi/aml/aml_region.c =================================================================== --- head/sys/dev/acpi/aml/aml_region.c (revision 68516) +++ head/sys/dev/acpi/aml/aml_region.c (nonexistent) @@ -1,349 +0,0 @@ -/*- - * Copyright (c) 2000 Mitsuru IWASAKI - * Copyright (c) 2000 Munehiro Matsuda - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $Id: aml_region.c,v 1.10 2000/08/09 14:47:44 iwasaki Exp $ - * $FreeBSD$ - */ - -/* - * Region I/O subroutine - */ - -#include "opt_acpi.h" -#include -#include -#include - -#include -#include -#include - -#include -#include -#include -#include -#include - -#ifndef ACPI_NO_OSDFUNC_INLINE -#include -#endif - -/* - * Dummy functions for aml_region_io_simple() - */ -u_int32_t -aml_region_prompt_read(struct aml_region_handle *h, u_int32_t value) -{ - - return (value); -} - -u_int32_t -aml_region_prompt_write(struct aml_region_handle *h, u_int32_t value) -{ - - return (value); -} - -int -aml_region_prompt_update_value(u_int32_t orgval, u_int32_t value, - struct aml_region_handle *h) -{ - return (0); -} - -/* - * Primitive functions for aml_region_io_simple() - */ -int -aml_region_read_simple(struct aml_region_handle *h, vm_offset_t offset, u_int32_t *valuep) -{ - u_int32_t value; - - switch (h->regtype) { - case AML_REGION_SYSMEM: - /* XXX should be MI */ - switch (h->unit) { - case 1: - value = *(volatile u_int8_t *)(h->vaddr + offset); - value &= 0xff; - break; - case 2: - value = *(volatile u_int16_t *)(h->vaddr + offset); - value &= 0xffff; - break; - case 4: - value = *(volatile u_int32_t *)(h->vaddr + offset); - break; - } - break; - case AML_REGION_SYSIO: - switch (h->unit) { - case 1: - value = OsdIn8(h->addr + offset); - value &= 0xff; - break; - case 2: - value = OsdIn16(h->addr + offset); - value &= 0xffff; - break; - case 4: - value = OsdIn32(h->addr + offset); - break; - } - break; - case AML_REGION_PCICFG: - switch (h->unit) { - case 1: - OsdReadPciCfgByte(h->pci_bus, h->pci_devfunc, - h->addr + offset, (UINT8 *)&value); - value &= 0xff; - break; - case 2: - OsdReadPciCfgWord(h->pci_bus, h->pci_devfunc, - h->addr + offset, (UINT16 *)&value); - value &= 0xffff; - break; - case 4: - OsdReadPciCfgDword(h->pci_bus, h->pci_devfunc, - h->addr + offset, &value); - break; - } - break; - default: - printf("aml_region_read_simple: not supported yet (%d)\n", - h->regtype); - value = 0; - break; - } - *valuep = value; - return (0); -} - -int -aml_region_write_simple(struct aml_region_handle *h, vm_offset_t offset, u_int32_t value) -{ - - switch (h->regtype) { - case AML_REGION_SYSMEM: - /* XXX should be MI */ - switch (h->unit) { - case 1: - value &= 0xff; - *(volatile u_int8_t *)(h->vaddr + offset) = value; - break; - case 2: - value &= 0xffff; - *(volatile u_int16_t *)(h->vaddr + offset) = value; - break; - case 4: - *(volatile u_int32_t *)(h->vaddr + offset) = value; - break; - } - break; - case AML_REGION_SYSIO: - switch (h->unit) { - case 1: - value &= 0xff; - OsdOut8(h->addr + offset, value); - break; - case 2: - value &= 0xffff; - OsdOut16(h->addr + offset, value); - break; - case 4: - OsdOut32(h->addr + offset, value); - break; - } - break; - case AML_REGION_PCICFG: - switch (h->unit) { - case 1: - OsdWritePciCfgByte(h->pci_bus, h->pci_devfunc, - h->addr + offset, value); - break; - case 2: - OsdWritePciCfgWord(h->pci_bus, h->pci_devfunc, - h->addr + offset, value); - break; - case 4: - OsdWritePciCfgDword(h->pci_bus, h->pci_devfunc, - h->addr + offset, value); - break; - } - break; - default: - printf("aml_region_write_simple: not supported yet (%d)\n", - h->regtype); - break; - } - - return (0); -} - -static int -aml_region_io_buffer(boolean_t io, int regtype, u_int32_t flags, - u_int8_t *buffer, u_int32_t baseaddr, u_int32_t bitoffset, u_int32_t bitlen) -{ - vm_offset_t addr, vaddr; - size_t len; - const char *funcname[] = { - "aml_region_read_into_buffer", - "aml_region_write_from_buffer" - }; - - if (regtype != AML_REGION_SYSMEM) { - printf("%s: region type isn't system memory!\n", funcname[io]); - return (-1); - } - - if (bitlen % 8) { - printf("%s: bit length isn't a multiple of 8!\n", funcname[io]); - } - if (bitoffset % 8) { - printf("%s: bit offset isn't a multiple of 8!\n", funcname[io]); - } - - addr = baseaddr + bitoffset / 8; - len = bitlen / 8 + ((bitlen % 8) ? 1 : 0); - - OsdMapMemory((void *)addr, len, (void **)&vaddr); - - switch (io) { - case AML_REGION_INPUT: - bcopy((void *)vaddr, (void *)buffer, len); - break; - case AML_REGION_OUTPUT: - bcopy((void *)buffer, (void *)vaddr, len); - break; - } - - OsdUnMapMemory((void *)vaddr, len); - - return (0); -} - -u_int32_t -aml_region_read(struct aml_environ *env, int regtype, u_int32_t flags, - u_int32_t addr, u_int32_t bitoffset, u_int32_t bitlen) -{ - int value; - int state; - - AML_REGION_READ_DEBUG(regtype, flags, addr, bitoffset, bitlen); - - state = aml_region_io(env, AML_REGION_INPUT, regtype, - flags, &value, addr, bitoffset, bitlen); - AML_SYSASSERT(state != -1); - - return (value); -} - -int -aml_region_read_into_buffer(struct aml_environ *env, int regtype, - u_int32_t flags, u_int32_t addr, u_int32_t bitoffset, u_int32_t bitlen, - u_int8_t *buffer) -{ - int state; - - AML_REGION_READ_INTO_BUFFER_DEBUG(regtype, flags, addr, bitoffset, bitlen); - state = aml_region_io_buffer(AML_REGION_INPUT, regtype, flags, - buffer, addr, bitoffset, bitlen); - - return (state); -} - -int -aml_region_write(struct aml_environ *env, int regtype, u_int32_t flags, - u_int32_t value, u_int32_t addr, u_int32_t bitoffset, u_int32_t bitlen) -{ - int state; - - AML_REGION_WRITE_DEBUG(regtype, flags, value, addr, bitoffset, bitlen); - - state = aml_region_io(env, AML_REGION_OUTPUT, regtype, - flags, &value, addr, bitoffset, bitlen); - AML_SYSASSERT(state != -1); - - return (state); -} - -int -aml_region_write_from_buffer(struct aml_environ *env, int regtype, - u_int32_t flags, u_int8_t *buffer, u_int32_t addr, u_int32_t bitoffset, - u_int32_t bitlen) -{ - int state; - - AML_REGION_WRITE_FROM_BUFFER_DEBUG(regtype, flags, - addr, bitoffset, bitlen); - - state = aml_region_io_buffer(AML_REGION_OUTPUT, regtype, flags, - buffer, addr, bitoffset, bitlen); - - return (state); -} - -int -aml_region_bcopy(struct aml_environ *env, int regtype, - u_int32_t flags, u_int32_t addr, u_int32_t bitoffset, u_int32_t bitlen, - u_int32_t dflags, u_int32_t daddr, u_int32_t dbitoffset, u_int32_t dbitlen) -{ - vm_offset_t from_addr, from_vaddr; - vm_offset_t to_addr, to_vaddr; - size_t len; - - AML_REGION_BCOPY_DEBUG(regtype, flags, addr, bitoffset, bitlen, - dflags, daddr, dbitoffset, dbitlen); - - if (regtype != AML_REGION_SYSMEM) { - printf("aml_region_bcopy: region type isn't system memory!\n"); - return (-1); - } - - if ((bitlen % 8) || (dbitlen % 8)) { - printf("aml_region_bcopy: bit length isn't a multiple of 8!\n"); - } - if ((bitoffset % 8) || (dbitoffset % 8)) { - printf("aml_region_bcopy: bit offset isn't a multiple of 8!\n"); - } - - from_addr = addr + bitoffset / 8; - to_addr = daddr + dbitoffset / 8; - - len = (bitlen > dbitlen) ? dbitlen : bitlen; - len = len / 8 + ((len % 8) ? 1 : 0); - - OsdMapMemory((void *)from_addr, len, (void **)&from_vaddr); - OsdMapMemory((void *)to_addr, len, (void **)&to_vaddr); - - bcopy((void *)from_vaddr, (void *)to_vaddr, len); - - OsdUnMapMemory((void *)from_vaddr, len); - OsdUnMapMemory((void *)to_vaddr, len); - - return (0); -} Property changes on: head/sys/dev/acpi/aml/aml_region.c ___________________________________________________________________ Deleted: svn:keywords ## -1 +0,0 ## -FreeBSD=%H \ No newline at end of property Index: head/sys/dev/acpi/aml/aml_obj.h =================================================================== --- head/sys/dev/acpi/aml/aml_obj.h (revision 68516) +++ head/sys/dev/acpi/aml/aml_obj.h (nonexistent) @@ -1,227 +0,0 @@ -/*- - * Copyright (c) 1999 Takanori Watanabe - * Copyright (c) 1999, 2000 Mitsuru IWASAKI - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $Id: aml_obj.h,v 1.15 2000/08/09 14:47:43 iwasaki Exp $ - * $FreeBSD$ - */ - -#ifndef _AML_OBJ_H_ -#define _AML_OBJ_H_ - -#include - -struct aml_environ; -enum aml_objtype { - aml_t_namestr = -3, - aml_t_regfield, - aml_t_objref, - aml_t_null = 0, - aml_t_num, - aml_t_string, - aml_t_buffer, - aml_t_package, - aml_t_device, - aml_t_field, - aml_t_event, - aml_t_method, - aml_t_mutex, - aml_t_opregion, - aml_t_powerres, - aml_t_processor, - aml_t_therm, - aml_t_bufferfield, - aml_t_ddbhandle, - aml_t_debug -}; - -struct aml_namestr { - enum aml_objtype type; /* =aml_t_namestr */ - u_int8_t *dp; -}; - -struct aml_opregion { - enum aml_objtype type; - int space; - int offset; - int length; -}; - -struct aml_num { - enum aml_objtype type; /* =aml_t_num */ - int number; - int constant; -}; - -struct aml_package { - enum aml_objtype type; - int elements; - union aml_object **objects; -}; - -struct aml_string { - enum aml_objtype type; /* =aml_t_string */ - int needfree; - u_int8_t *string; -}; - -struct aml_buffer { - enum aml_objtype type; /* =aml_t_buffer */ - int size; - u_int8_t *data; /* This should be free when - * this object is free. - */ -}; - -enum fieldtype { - f_t_field, - f_t_index, - f_t_bank -}; - -struct nfieldd { - enum fieldtype ftype; /* f_t_field */ - u_int8_t *regname; /* Namestring */ -}; - -struct ifieldd { - enum fieldtype ftype; /* f_t_index */ - u_int8_t *indexname; - u_int8_t *dataname; -}; - -struct bfieldd { - enum fieldtype ftype; /* f_t_bank */ - u_int8_t *regname; - u_int8_t *bankname; - u_int32_t bankvalue; -}; - -struct aml_field { - enum aml_objtype type; - u_int32_t flags; - int bitoffset; /* Not Byte offset but bitoffset */ - int bitlen; - union { - enum fieldtype ftype; - struct nfieldd fld; - struct ifieldd ifld; - struct bfieldd bfld; - } f; -}; - -struct aml_bufferfield { - enum aml_objtype type; /* aml_t_bufferfield */ - int bitoffset; - int bitlen; - u_int8_t *origin; /* This should not be free - * when this object is free - * (Within Buffer object) - */ -}; - -struct aml_method { - enum aml_objtype type; - int argnum; /* Not argnum but argnum|frag */ - u_int8_t *from; - u_int8_t *to; -}; - -struct aml_powerres { - enum aml_objtype type; - int level; - int order; -}; - -struct aml_processor { - enum aml_objtype type; - int id; - int addr; - int len; -}; - -struct aml_mutex_queue { - STAILQ_ENTRY(aml_mutex_queue) entry; -}; - -struct aml_mutex { - enum aml_objtype type; - int level; - volatile void *cookie; /* In kernel, struct proc? */ - STAILQ_HEAD(, aml_mutex_queue) queue; -}; - -struct aml_objref { - enum aml_objtype type; - struct aml_name *nameref; - union aml_object *ref; - int offset; /* of aml_buffer.data or aml_package.objects. */ - /* if negative value, not ready to dereference for element access. */ - unsigned deref; /* indicates whether dereffenced or not */ - unsigned alias; /* true if this is an alias object reference */ -}; - -struct aml_regfield { - enum aml_objtype type; - int space; - u_int32_t flags; - int offset; - int bitoffset; - int bitlen; -}; - -struct aml_event { - enum aml_objtype type; /* aml_t_event */ - int inuse; -}; - -union aml_object { - enum aml_objtype type; - struct aml_num num; - struct aml_processor proc; - struct aml_powerres pres; - struct aml_opregion opregion; - struct aml_method meth; - struct aml_field field; - struct aml_mutex mutex; - struct aml_namestr nstr; - struct aml_buffer buffer; - struct aml_bufferfield bfld; - struct aml_package package; - struct aml_string str; - struct aml_objref objref; - struct aml_event event; - struct aml_regfield regfield; -}; - -union aml_object *aml_copy_object(struct aml_environ *, - union aml_object *); -union aml_object *aml_alloc_object(enum aml_objtype, - union aml_object *); -void aml_free_objectcontent(union aml_object *); -void aml_free_object(union aml_object **); -void aml_realloc_object(union aml_object *, int); - -#endif /* !_AML_OBJ_H_ */ Property changes on: head/sys/dev/acpi/aml/aml_obj.h ___________________________________________________________________ Deleted: svn:keywords ## -1 +0,0 ## -FreeBSD=%H \ No newline at end of property Index: head/sys/dev/acpi/aml/aml_status.h =================================================================== --- head/sys/dev/acpi/aml/aml_status.h (revision 68516) +++ head/sys/dev/acpi/aml/aml_status.h (nonexistent) @@ -1,41 +0,0 @@ -/*- - * Copyright (c) 1999 Takanori Watanabe - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $Id: aml_status.h,v 1.6 2000/08/08 14:12:05 iwasaki Exp $ - * $FreeBSD$ - */ - -#ifndef _AML_STATUS_H_ -#define _AML_STATUS_H_ - -enum aml_status { - aml_stat_none = 0, - aml_stat_return, - aml_stat_break, - aml_stat_panic, - aml_stat_step -}; - -#endif /* !_AML_STATUS_H_ */ Property changes on: head/sys/dev/acpi/aml/aml_status.h ___________________________________________________________________ Deleted: svn:keywords ## -1 +0,0 ## -FreeBSD=%H \ No newline at end of property Index: head/sys/dev/acpi/aml/aml_amlmem.c =================================================================== --- head/sys/dev/acpi/aml/aml_amlmem.c (revision 68516) +++ head/sys/dev/acpi/aml/aml_amlmem.c (nonexistent) @@ -1,92 +0,0 @@ -/*- - * Copyright (c) 1999, 2000 Mitsuru IWASAKI - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $Id: aml_amlmem.c,v 1.15 2000/08/09 14:47:43 iwasaki Exp $ - * $FreeBSD$ - */ - -/* - * AML Namespace Memory Management - */ - -#include - -#include -#include -#include - -MEMMAN_INITIALSTORAGE_DESC(struct aml_namestr, _aml_namestr_storage); -MEMMAN_INITIALSTORAGE_DESC(struct aml_num, _aml_num_storage); -MEMMAN_INITIALSTORAGE_DESC(struct aml_string, _aml_string_storage); -MEMMAN_INITIALSTORAGE_DESC(struct aml_buffer, _aml_buffer_storage); -MEMMAN_INITIALSTORAGE_DESC(struct aml_package, _aml_package_storage); -MEMMAN_INITIALSTORAGE_DESC(struct aml_field, _aml_field_storage); -MEMMAN_INITIALSTORAGE_DESC(struct aml_method, _aml_method_storage); -MEMMAN_INITIALSTORAGE_DESC(struct aml_mutex, _aml_mutex_storage); -MEMMAN_INITIALSTORAGE_DESC(struct aml_opregion, _aml_opregion_storage); -MEMMAN_INITIALSTORAGE_DESC(struct aml_powerres, _aml_powerres_storage); -MEMMAN_INITIALSTORAGE_DESC(struct aml_processor, _aml_processor_storage); -MEMMAN_INITIALSTORAGE_DESC(struct aml_bufferfield, _aml_bufferfield_storage); -MEMMAN_INITIALSTORAGE_DESC(struct aml_event, _aml_event_storage); -MEMMAN_INITIALSTORAGE_DESC(enum aml_objtype, _aml_objtype_storage); -MEMMAN_INITIALSTORAGE_DESC(struct aml_name, _aml_name_storage); -MEMMAN_INITIALSTORAGE_DESC(struct aml_name_group, _aml_name_group_storage); -MEMMAN_INITIALSTORAGE_DESC(struct aml_objref, _aml_objref_storage); -MEMMAN_INITIALSTORAGE_DESC(struct aml_regfield, _aml_regfield_storage); -MEMMAN_INITIALSTORAGE_DESC(struct aml_environ, _aml_environ_storage); -MEMMAN_INITIALSTORAGE_DESC(struct aml_local_stack, _aml_local_stack_storage); -MEMMAN_INITIALSTORAGE_DESC(struct aml_mutex_queue, _aml_mutex_queue_storage); - -struct memman_blockman aml_blockman[] = { - MEMMAN_MEMBLOCK_DESC(sizeof(struct aml_namestr), _aml_namestr_storage), - MEMMAN_MEMBLOCK_DESC(sizeof(struct aml_num), _aml_num_storage), - MEMMAN_MEMBLOCK_DESC(sizeof(struct aml_string), _aml_string_storage), - MEMMAN_MEMBLOCK_DESC(sizeof(struct aml_buffer), _aml_buffer_storage), - MEMMAN_MEMBLOCK_DESC(sizeof(struct aml_package), _aml_package_storage), - MEMMAN_MEMBLOCK_DESC(sizeof(struct aml_field), _aml_field_storage), - MEMMAN_MEMBLOCK_DESC(sizeof(struct aml_method), _aml_method_storage), - MEMMAN_MEMBLOCK_DESC(sizeof(struct aml_mutex), _aml_mutex_storage), - MEMMAN_MEMBLOCK_DESC(sizeof(struct aml_opregion), _aml_opregion_storage), - MEMMAN_MEMBLOCK_DESC(sizeof(struct aml_powerres), _aml_powerres_storage), - MEMMAN_MEMBLOCK_DESC(sizeof(struct aml_processor), _aml_processor_storage), - MEMMAN_MEMBLOCK_DESC(sizeof(struct aml_bufferfield), _aml_bufferfield_storage), - MEMMAN_MEMBLOCK_DESC(sizeof(struct aml_event), _aml_event_storage), - MEMMAN_MEMBLOCK_DESC(sizeof(enum aml_objtype), _aml_objtype_storage), - MEMMAN_MEMBLOCK_DESC(sizeof(struct aml_name), _aml_name_storage), - MEMMAN_MEMBLOCK_DESC(sizeof(struct aml_name_group), _aml_name_group_storage), - MEMMAN_MEMBLOCK_DESC(sizeof(struct aml_objref), _aml_objref_storage), - MEMMAN_MEMBLOCK_DESC(sizeof(struct aml_regfield), _aml_regfield_storage), - MEMMAN_MEMBLOCK_DESC(sizeof(struct aml_environ), _aml_environ_storage), - MEMMAN_MEMBLOCK_DESC(sizeof(struct aml_local_stack), _aml_local_stack_storage), - MEMMAN_MEMBLOCK_DESC(sizeof(struct aml_mutex_queue), _aml_mutex_queue_storage), -}; - -struct memman_histogram aml_histogram[MEMMAN_HISTOGRAM_SIZE]; - -static struct memman _aml_memman = MEMMAN_MEMMANAGER_DESC(aml_blockman, 21, - aml_histogram, 1); - -struct memman *aml_memman = &_aml_memman; - Property changes on: head/sys/dev/acpi/aml/aml_amlmem.c ___________________________________________________________________ Deleted: svn:keywords ## -1 +0,0 ## -FreeBSD=%H \ No newline at end of property Index: head/sys/dev/acpi/aml/aml_amlmem.h =================================================================== --- head/sys/dev/acpi/aml/aml_amlmem.h (revision 68516) +++ head/sys/dev/acpi/aml/aml_amlmem.h (nonexistent) @@ -1,65 +0,0 @@ -/*- - * Copyright (c) 1999 Mitsuru IWASAKI - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $Id: aml_amlmem.h,v 1.12 2000/08/08 14:12:05 iwasaki Exp $ - * $FreeBSD$ - */ - -#ifndef _AML_AMLMEM_H_ -#define _AML_AMLMEM_H_ - -/* - * AML Namespace Memory Management - */ - -#include - -enum { - memid_aml_namestr = 0, - memid_aml_num, - memid_aml_string, - memid_aml_buffer, - memid_aml_package, - memid_aml_field, - memid_aml_method, - memid_aml_mutex, - memid_aml_opregion, - memid_aml_powerres, - memid_aml_processor, - memid_aml_bufferfield, - memid_aml_event, - memid_aml_objtype, - memid_aml_name, - memid_aml_name_group, - memid_aml_objref, - memid_aml_regfield, - memid_aml_environ, - memid_aml_local_stack, - memid_aml_mutex_queue, -}; - -extern struct memman *aml_memman; - -#endif /* !_AML_AMLMEM_H_ */ Property changes on: head/sys/dev/acpi/aml/aml_amlmem.h ___________________________________________________________________ Deleted: svn:keywords ## -1 +0,0 ## -FreeBSD=%H \ No newline at end of property Index: head/sys/dev/acpi/aml/aml_name.c =================================================================== --- head/sys/dev/acpi/aml/aml_name.c (revision 68516) +++ head/sys/dev/acpi/aml/aml_name.c (nonexistent) @@ -1,481 +0,0 @@ -/*- - * Copyright (c) 1999 Takanori Watanabe - * Copyright (c) 1999, 2000 Yasuo Yokoyama - * Copyright (c) 1999, 2000 Mitsuru IWASAKI - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $Id: aml_name.c,v 1.15 2000/08/16 18:14:53 iwasaki Exp $ - * $FreeBSD$ - */ - -#include - -#include -#include -#include -#include - -#ifndef _KERNEL -#include -#include -#include - -#include "debug.h" -#else /* _KERNEL */ -#include -#endif /* !_KERNEL */ - -static struct aml_name *aml_find_name(struct aml_name *, char *); -static struct aml_name *aml_new_name(struct aml_name *, char *); -static void aml_delete_name(struct aml_name *); - -static struct aml_name rootname = {"\\", NULL, NULL, NULL, NULL, NULL}; - -static struct aml_name_group root_group = { - AML_NAME_GROUP_ROOT, - &rootname, - NULL -}; - -struct aml_name_group *name_group_list = &root_group; -struct aml_local_stack *stack_top = NULL; - -struct aml_name * -aml_get_rootname() -{ - - return (&rootname); -} - -static struct aml_name * -aml_find_name(struct aml_name *parent, char *name) -{ - struct aml_name *result; - - if (!parent) - parent = &rootname; - for (result = parent->child; result; result = result->brother) - if (!strncmp(result->name, name, 4)) - break; - return (result); -} - -/* - * Parse given namesppace expression and find a first matched object - * under given level of the tree by depth first search. - */ - -struct aml_name * -aml_find_from_namespace(struct aml_name *parent, char *name) -{ - char *ptr; - int len; - struct aml_name *result; - - ptr = name; - if (!parent) - parent = &rootname; - - if (ptr[0] == '\\') { - ptr++; - parent = &rootname; - } - for (len = 0; ptr[len] != '.' && ptr[len] != '\0'; len++) - ; - - for (result = parent->child; result; result = result->brother) { - if (!strncmp(result->name, ptr, len)) { - if (ptr[len] == '\0' || ptr[len + 1] == '\0') { - return (result); - } - ptr += len; - if (ptr[0] != '.') { - return (NULL); - } - ptr++; - return (aml_find_from_namespace(result, ptr)); - } - } - - return (NULL); -} - -static void -_aml_apply_foreach_found_objects(struct aml_name *parent, char *name, - int len, int shallow, int (*func)(struct aml_name *, va_list), va_list ap) -{ - struct aml_name *child, *ptr; - - child = ptr = NULL; - - /* function to apply must be specified */ - if (func == NULL) { - return; - } - - for (child = parent->child; child; child = child->brother) { - if (!strncmp(child->name, name, len)) { - /* if function call was failed, stop searching */ - if (func(child, ap) != 0) { - return; - } - } - } - - if (shallow == 1) { - return; - } - - for (ptr = parent->child; ptr; ptr = ptr->brother) { - /* do more searching */ - _aml_apply_foreach_found_objects(ptr, name, len, 0, func, ap); - } -} - -/* - * Find named objects as many as possible under given level of - * namespace, and apply given callback function for each - * named objects found. If the callback function returns non-zero - * value, then the search terminates immediately. - * Note that object name expression is used as forward substring match, - * not exact match. The name expression "_L" will match for objects - * which have name starting with "_L" such as "\_SB_.LID_._LID" and - * "\_GPE._L00" and so on. The name expression can include parent object - * name in it like "\_GPE._L". In this case, GPE X level wake handlers - * will be found under "\_GPE" in shallow level. - */ - -void -aml_apply_foreach_found_objects(struct aml_name *start, char *name, - int (*func)(struct aml_name *, va_list), ...) -{ - int i, len, has_dot, last_is_dot, shallow; - struct aml_name *child, *parent; - va_list ap; - - shallow = 0; - if (start == NULL) { - parent = &rootname; - } else { - parent = start; - } - if (name[0] == '\\') { - name++; - parent = &rootname; - shallow = 1; - } - - len = strlen(name); - last_is_dot = 0; - /* the last dot should be ignored */ - if (len > 0 && name[len - 1] == '.') { - len--; - last_is_dot = 1; - } - - has_dot = 0; - for (i = 0; i < len - 1; i++) { - if (name[i] == '.') { - has_dot = 1; - break; - } - } - - /* try to parse expression and find any matched object. */ - if (has_dot == 1) { - child = aml_find_from_namespace(parent, name); - if (child == NULL) { - return; - } - - /* - * we have at least one object matched, search all objects - * under upper level of the found object. - */ - parent = child->parent; - - /* find the last `.' */ - for (name = name + len - 1; *name != '.'; name--) - ; - name++; - len = strlen(name) - last_is_dot; - shallow = 1; - } - - if (len > 4) { - return; - } - - va_start(ap, func); - _aml_apply_foreach_found_objects(parent, name, len, shallow, func, ap); - va_end(ap); -} - -struct aml_name_group * -aml_new_name_group(int id) -{ - struct aml_name_group *result; - - result = memman_alloc(aml_memman, memid_aml_name_group); - result->id = id; - result->head = NULL; - result->next = name_group_list; - name_group_list = result; - return (result); -} - -void -aml_delete_name_group(struct aml_name_group *target) -{ - struct aml_name_group *previous; - - previous = name_group_list; - if (previous == target) - name_group_list = target->next; - else { - while (previous && previous->next != target) - previous = previous->next; - if (previous) - previous->next = target->next; - } - target->next = NULL; - if (target->head) - aml_delete_name(target->head); - memman_free(aml_memman, memid_aml_name_group, target); -} - -static struct aml_name * -aml_new_name(struct aml_name *parent, char *name) -{ - struct aml_name *newname; - - if ((newname = aml_find_name(parent, name)) != NULL) - return (newname); - - newname = memman_alloc(aml_memman, memid_aml_name); - strncpy(newname->name, name, 4); - newname->parent = parent; - newname->child = NULL; - newname->property = NULL; - if (parent->child) - newname->brother = parent->child; - else - newname->brother = NULL; - parent->child = newname; - - newname->chain = name_group_list->head; - name_group_list->head = newname; - - return (newname); -} - -/* - * NOTE: - * aml_delete_name() doesn't maintain aml_name_group::{head,tail}. - */ -static void -aml_delete_name(struct aml_name *target) -{ - struct aml_name *next; - struct aml_name *ptr; - - for (; target; target = next) { - next = target->chain; - if (target->child) { - target->chain = NULL; - continue; - } - if (target->brother) { - if (target->parent) { - if (target->parent->child == target) { - target->parent->child = target->brother; - } else { - ptr = target->parent->child; - while (ptr && ptr->brother != target) - ptr = ptr->brother; - if (ptr) - ptr->brother = target->brother; - } - target->brother = NULL; - } - } else if (target->parent) { - target->parent->child = NULL; - } - aml_free_object(&target->property); - memman_free(aml_memman, memid_aml_name, target); - } -} - -#define AML_SEARCH_NAME 0 -#define AML_CREATE_NAME 1 -static struct aml_name *aml_nameman(struct aml_environ *, u_int8_t *, int); - -struct aml_name * -aml_search_name(struct aml_environ *env, u_int8_t *dp) -{ - - return (aml_nameman(env, dp, AML_SEARCH_NAME)); -} - -struct aml_name * -aml_create_name(struct aml_environ *env, u_int8_t *dp) -{ - - return (aml_nameman(env, dp, AML_CREATE_NAME)); -} - -static struct aml_name * -aml_nameman(struct aml_environ *env, u_int8_t *dp, int flag) -{ - int segcount; - int i; - struct aml_name *newname, *curname; - struct aml_name *(*searchfunc) (struct aml_name *, char *); - -#define CREATECHECK() do { \ - if (newname == NULL) { \ - AML_DEBUGPRINT("ERROR CANNOT FIND NAME\n"); \ - env->stat = aml_stat_panic; \ - return (NULL); \ - } \ -} while(0) - - searchfunc = (flag == AML_CREATE_NAME) ? aml_new_name : aml_find_name; - newname = env->curname; - if (dp[0] == '\\') { - newname = &rootname; - dp++; - } else if (dp[0] == '^') { - while (dp[0] == '^') { - newname = newname->parent; - CREATECHECK(); - dp++; - } - } - if (dp[0] == 0x00) { /* NullName */ - dp++; - } else if (dp[0] == 0x2e) { /* DualNamePrefix */ - newname = (*searchfunc) (newname, dp + 1); - CREATECHECK(); - newname = (*searchfunc) (newname, dp + 5); - CREATECHECK(); - } else if (dp[0] == 0x2f) { /* MultiNamePrefix */ - segcount = dp[1]; - for (i = 0, dp += 2; i < segcount; i++, dp += 4) { - newname = (*searchfunc) (newname, dp); - CREATECHECK(); - } - } else if (flag == AML_CREATE_NAME) { /* NameSeg */ - newname = aml_new_name(newname, dp); - CREATECHECK(); - } else { - curname = newname; - for (;;) { - newname = aml_find_name(curname, dp); - if (newname != NULL) - break; - if (curname == &rootname) - break; - curname = curname->parent; - } - } - return (newname); -} - -#undef CREATECHECK - -struct aml_local_stack * -aml_local_stack_create() -{ - struct aml_local_stack *result; - - result = memman_alloc(aml_memman, memid_aml_local_stack); - memset(result, 0, sizeof(struct aml_local_stack)); - return (result); -} - -void -aml_local_stack_push(struct aml_local_stack *stack) -{ - - stack->next = stack_top; - stack_top = stack; -} - -struct aml_local_stack * -aml_local_stack_pop() -{ - struct aml_local_stack *result; - - result = stack_top; - stack_top = result->next; - result->next = NULL; - return (result); -} - -void -aml_local_stack_delete(struct aml_local_stack *stack) -{ - int i; - - for (i = 0; i < 8; i++) - aml_free_object(&stack->localvalue[i].property); - for (i = 0; i < 7; i++) - aml_free_object(&stack->argumentvalue[i].property); - aml_delete_name(stack->temporary); - memman_free(aml_memman, memid_aml_local_stack, stack); -} - -struct aml_name * -aml_local_stack_getLocalX(int index) -{ - - if (stack_top == NULL) - return (NULL); - return (&stack_top->localvalue[index]); -} - -struct aml_name * -aml_local_stack_getArgX(struct aml_local_stack *stack, int index) -{ - - if (!stack) - stack = stack_top; - if (stack == NULL) - return (NULL); - return (&stack->argumentvalue[index]); -} - -struct aml_name * -aml_create_local_object() -{ - struct aml_name *result; - - result = memman_alloc(aml_memman, memid_aml_name); - result->child = result->brother = result->parent = NULL; - result->property = NULL; - result->chain = stack_top->temporary; - stack_top->temporary = result; - return (result); -} Property changes on: head/sys/dev/acpi/aml/aml_name.c ___________________________________________________________________ Deleted: svn:keywords ## -1 +0,0 ## -FreeBSD=%H \ No newline at end of property Index: head/sys/dev/acpi/aml/aml_name.h =================================================================== --- head/sys/dev/acpi/aml/aml_name.h (revision 68516) +++ head/sys/dev/acpi/aml/aml_name.h (nonexistent) @@ -1,88 +0,0 @@ -/*- - * Copyright (c) 1999 Takanori Watanabe - * Copyright (c) 1999, 2000 Yasuo Yokoyama - * Copyright (c) 1999, 2000 Mitsuru IWASAKI - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $Id: aml_name.h,v 1.17 2000/08/16 18:14:54 iwasaki Exp $ - * $FreeBSD$ - */ - -#ifndef _AML_NAME_H_ -#define _AML_NAME_H_ - -#include - -#include - -struct aml_name { - char name[4]; - union aml_object *property; - struct aml_name *parent; - struct aml_name *brother; - struct aml_name *child; - struct aml_name *chain; -}; - -#define AML_NAME_GROUP_ROOT 0 -#define AML_NAME_GROUP_OS_DEFINED 1 -#define AML_NAME_GROUP_IN_METHOD 2 - -struct aml_name_group { - int id; /* DSDT address or DBHANDLE */ - struct aml_name *head; - struct aml_name_group *next; -}; - -struct aml_local_stack { - struct aml_name localvalue[8]; - struct aml_name argumentvalue[7]; - struct aml_name *temporary; - struct aml_local_stack *next; -}; - -/* forward declarement */ -struct aml_envrion; - -struct aml_name *aml_get_rootname(void); -struct aml_name_group *aml_new_name_group(int); -void aml_delete_name_group(struct aml_name_group *); - -struct aml_name *aml_find_from_namespace(struct aml_name *, char *); -void aml_apply_foreach_found_objects(struct aml_name *, - char *, int (*)(struct aml_name *, va_list), ...); -struct aml_name *aml_search_name(struct aml_environ *, u_int8_t *); -struct aml_name *aml_create_name(struct aml_environ *, u_int8_t *); - -struct aml_local_stack *aml_local_stack_create(void); -void aml_local_stack_push(struct aml_local_stack *); -struct aml_local_stack *aml_local_stack_pop(void); -void aml_local_stack_delete(struct aml_local_stack *); -struct aml_name *aml_local_stack_getLocalX(int); -struct aml_name *aml_local_stack_getArgX(struct aml_local_stack *, int); -struct aml_name *aml_create_local_object(void); - -extern struct aml_name_group *name_group_list; - -#endif /* !_AML_NAME_H_ */ Property changes on: head/sys/dev/acpi/aml/aml_name.h ___________________________________________________________________ Deleted: svn:keywords ## -1 +0,0 ## -FreeBSD=%H \ No newline at end of property Index: head/sys/dev/acpi/aml/aml_memman.c =================================================================== --- head/sys/dev/acpi/aml/aml_memman.c (revision 68516) +++ head/sys/dev/acpi/aml/aml_memman.c (nonexistent) @@ -1,476 +0,0 @@ -/*- - * Copyright (c) 1999, 2000 Mitsuru IWASAKI - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $Id: aml_memman.c,v 1.10 2000/08/09 14:47:43 iwasaki Exp $ - * $FreeBSD$ - */ - -/* - * Generic Memory Management - */ - -#include - -#include - -#ifndef _KERNEL -#include -#include -#include -#else /* _KERNEL */ -#include -#include -#include -MALLOC_DEFINE(M_MEMMAN, "memman", "Generic and Simple Memory Management"); -#endif /* !_KERNEL */ - -unsigned int memid_unkown = 255; - -static int manage_block(struct memman *memman, unsigned int id, - void *block, unsigned static_mem, - unsigned entries); -static int blockman_init(struct memman *memman, unsigned int id); -static void memman_flexsize_add_histogram(struct memman *memman, - size_t size, - int tolerance); -static int memman_comp_histogram_size(const void *a, - const void *b); -static void memman_sort_histogram_by_size(struct memman *memman); -static unsigned int memman_guess_memid(struct memman *memman, void *chunk); -static void memman_statistics_fixedsize(struct memman *memman); -static void memman_statistics_flexsize(struct memman *memman); - -static int -manage_block(struct memman *memman, unsigned int id, void *block, - unsigned static_mem, unsigned entries) -{ - unsigned int i; - size_t alloc_size; - void *tmp, *realblock; - struct memman_blockman *bmp; - struct memman_block *memblock; - struct memman_node *memnodes; - - bmp = &memman->blockman[id]; - alloc_size = MEMMAN_BLOCKNODE_SIZE(entries); - - if (static_mem) { - tmp = (void *)block; - realblock = (char *)block + alloc_size; - } else { - tmp = MEMMAN_SYSMALLOC(alloc_size); - if (!tmp) { - return (-1); - } - realblock = block; - - memman->allocated_mem += alloc_size; - memman->salloc_called++; - } - - memblock = (struct memman_block *)tmp; - memnodes = (struct memman_node *)((char *)tmp + sizeof(struct memman_block)); - - memblock->block = realblock; - memblock->static_mem = static_mem; - memblock->allocated = entries; - memblock->available = entries; - if (!static_mem) { - alloc_size += roundup(bmp->size * entries, ROUNDUP_UNIT); - } - memblock->allocated_mem = alloc_size; - LIST_INSERT_HEAD(&bmp->block_list, memblock, links); - - for (i = 0; i < entries; ++i) { - memnodes[i].node = ((char *)realblock + (i * (bmp->size))); - memnodes[i].memblock = memblock; - LIST_INSERT_HEAD(&bmp->free_node_list, &memnodes[i], links); - } - bmp->available = entries; - - return (0); -} - -static int -blockman_init(struct memman *memman, unsigned int id) -{ - int status; - struct memman_blockman *bmp; - - bmp = &memman->blockman[id]; - bmp->initialized = 1; - LIST_INIT(&bmp->block_list); - LIST_INIT(&bmp->free_node_list); - LIST_INIT(&bmp->occupied_node_list); - status = manage_block(memman, id, bmp->initial_block, - 1, MEMMAN_INITIAL_SIZE); - return (status); -} - -void * -memman_alloc(struct memman *memman, unsigned int id) -{ - size_t alloc_size; - void *chunk, *block; - struct memman_blockman *bmp; - struct memman_node *memnode; - - if (memman->max_memid <= id) { - printf("memman_alloc: invalid memory type id\n"); - return (NULL); - } - bmp = &memman->blockman[id]; - if (!bmp->initialized) { - if (blockman_init(memman, id)) { - goto malloc_fail; - } - } - memman->alloc_called++; - - if (bmp->available == 0) { - alloc_size = roundup(bmp->size * MEMMAN_INCR_SIZE, - ROUNDUP_UNIT); - block = MEMMAN_SYSMALLOC(alloc_size); - if (!block) { - goto malloc_fail; - } - memman->required_mem += bmp->size * MEMMAN_INCR_SIZE; - memman->allocated_mem += alloc_size; - memman->salloc_called++; - - if (manage_block(memman, id, block, 0, MEMMAN_INCR_SIZE)) { - goto malloc_fail; - } - } - memnode = LIST_FIRST(&bmp->free_node_list); - LIST_REMOVE(memnode, links); - chunk = memnode->node; - LIST_INSERT_HEAD(&bmp->occupied_node_list, memnode, links); - memnode->memblock->available--; - bmp->available--; - - return (chunk); - -malloc_fail: - printf("memman_alloc: could not allocate memory\n"); - return (NULL); -} - -static void -memman_flexsize_add_histogram(struct memman *memman, size_t size, - int tolerance) -{ - int i; - int gap; - - if (size == 0) { - return; - } - for (i = 0; i < memman->flex_mem_histogram_ptr; i++) { - gap = memman->flex_mem_histogram[i].mem_size - size; - if (gap >= (tolerance * -1) && gap <= tolerance) { - memman->flex_mem_histogram[i].count++; - if (memman->flex_mem_histogram[i].mem_size < size) { - memman->flex_mem_histogram[i].mem_size = size; - } - return; - } - } - - if (memman->flex_mem_histogram_ptr == MEMMAN_HISTOGRAM_SIZE) { - memman_flexsize_add_histogram(memman, size, tolerance + 1); - return; - } - i = memman->flex_mem_histogram_ptr; - memman->flex_mem_histogram[i].mem_size = size; - memman->flex_mem_histogram[i].count = 1; - memman->flex_mem_histogram_ptr++; -} - -static int -memman_comp_histogram_size(const void *a, const void *b) -{ - int delta; - - delta = ((const struct memman_histogram *)a)->mem_size - - ((const struct memman_histogram *)b)->mem_size; - return (delta); -} - -static void -memman_sort_histogram_by_size(struct memman *memman) -{ - qsort(memman->flex_mem_histogram, memman->flex_mem_histogram_ptr, - sizeof(struct memman_histogram), memman_comp_histogram_size); -} - -void * -memman_alloc_flexsize(struct memman *memman, size_t size) -{ - void *mem; - struct memman_flexmem_info *info; - - if (size == 0) { - return (NULL); - } - if ((mem = MEMMAN_SYSMALLOC(size)) != NULL) { /* XXX */ - - info = MEMMAN_SYSMALLOC(sizeof(struct memman_flexmem_info)); - if (info) { - if (!memman->flex_mem_initialized) { - LIST_INIT(&memman->flexmem_info_list); - bzero(memman->flex_mem_histogram, - sizeof(struct memman_histogram)); - memman->flex_mem_initialized = 1; - } - info->addr = mem; - info->mem_size = size; - LIST_INSERT_HEAD(&memman->flexmem_info_list, info, links); - } - memman->flex_alloc_called++; - memman->flex_salloc_called++; - memman->flex_required_mem += size; - memman->flex_allocated_mem += size; - if (memman->flex_mem_size_min == 0 || - memman->flex_mem_size_min > size) { - memman->flex_mem_size_min = size; - } - if (memman->flex_mem_size_max < size) { - memman->flex_mem_size_max = size; - } - if (memman->flex_peak_mem_usage < - (memman->flex_allocated_mem - memman->flex_reclaimed_mem)) { - memman->flex_peak_mem_usage = - (memman->flex_allocated_mem - memman->flex_reclaimed_mem); - } - memman_flexsize_add_histogram(memman, size, - memman->flex_mem_histogram_initial_tolerance); - } - return (mem); -} - -static unsigned int -memman_guess_memid(struct memman *memman, void *chunk) -{ - unsigned int id; - struct memman_blockman *bmp; - struct memman_node *memnode; - - for (id = 0; id < memman->max_memid; id++) { - bmp = &memman->blockman[id]; - if (!bmp->initialized) { - if (blockman_init(memman, id)) { - printf("memman_free: could not initialized\n"); - } - } - LIST_FOREACH(memnode, &bmp->occupied_node_list, links) { - if (memnode->node == chunk) { - return (id); /* got it! */ - } - } - } - return (memid_unkown); /* gave up */ -} - -void -memman_free(struct memman *memman, unsigned int memid, void *chunk) -{ - unsigned int id; - unsigned found; - void *block; - struct memman_blockman *bmp; - struct memman_block *memblock; - struct memman_node *memnode; - - id = memid; - if (memid == memid_unkown) { - id = memman_guess_memid(memman, chunk); - } - if (memman->max_memid <= id) { - printf("memman_free: invalid memory type id\n"); - MEMMAN_SYSABORT(); - return; - } - bmp = &memman->blockman[id]; - if (!bmp->initialized) { - if (blockman_init(memman, id)) { - printf("memman_free: could not initialized\n"); - } - } - found = 0; - LIST_FOREACH(memnode, &bmp->occupied_node_list, links) { - if (memnode->node == chunk) { - found = 1; - break; - } - } - if (!found) { - printf("memman_free: invalid address\n"); - return; - } - memman->free_called++; - - LIST_REMOVE(memnode, links); - memblock = memnode->memblock; - memblock->available++; - LIST_INSERT_HEAD(&bmp->free_node_list, memnode, links); - bmp->available++; - - if (!memblock->static_mem && - memblock->available == memblock->allocated) { - LIST_FOREACH(memnode, &bmp->free_node_list, links) { - if (memnode->memblock != memblock) { - continue; - } - LIST_REMOVE(memnode, links); - bmp->available--; - } - block = memblock->block; - MEMMAN_SYSFREE(block); - memman->sfree_called++; - - LIST_REMOVE(memblock, links); - memman->sfree_called++; - memman->reclaimed_mem += memblock->allocated_mem; - MEMMAN_SYSFREE(memblock); - } -} - -void -memman_free_flexsize(struct memman *memman, void *chunk) -{ - struct memman_flexmem_info *info; - - LIST_FOREACH(info, &memman->flexmem_info_list, links) { - if (info->addr == chunk) { - memman->flex_reclaimed_mem += info->mem_size; - LIST_REMOVE(info, links); - MEMMAN_SYSFREE(info); - break; - } - } - /* XXX */ - memman->flex_free_called++; - memman->flex_sfree_called++; - MEMMAN_SYSFREE(chunk); -} - -void -memman_freeall(struct memman *memman) -{ - int id; - void *chunk; - struct memman_blockman *bmp; - struct memman_node *memnode; - struct memman_block *memblock; - struct memman_flexmem_info *info; - - for (id = 0; id < memman->max_memid; id++) { - bmp = &memman->blockman[id]; - - while ((memnode = LIST_FIRST(&bmp->occupied_node_list))) { - chunk = memnode->node; - printf("memman_freeall: fixed size (id = %d)\n", id); - memman_free(memman, id, chunk); - } - while ((memblock = LIST_FIRST(&bmp->block_list))) { - LIST_REMOVE(memblock, links); - if (!memblock->static_mem) { - memman->sfree_called++; - memman->reclaimed_mem += memblock->allocated_mem; - MEMMAN_SYSFREE(memblock); - } - } - bmp->initialized = 0; - } - - LIST_FOREACH(info, &memman->flexmem_info_list, links) { - printf("memman_freeall: flex size (size = %d, addr = %p)\n", - info->mem_size, info->addr); - memman_free_flexsize(memman, info->addr); - } -} - -static void -memman_statistics_fixedsize(struct memman *memman) -{ - printf(" fixed size memory blocks\n"); - printf(" alloc(): %d times\n", memman->alloc_called); - printf(" system malloc(): %d times\n", memman->salloc_called); - printf(" free(): %d times\n", memman->free_called); - printf(" system free(): %d times\n", memman->sfree_called); - printf(" required memory: %d bytes\n", memman->required_mem); - printf(" allocated memory: %d bytes\n", memman->allocated_mem); - printf(" reclaimed memory: %d bytes\n", memman->reclaimed_mem); -} - -static void -memman_statistics_flexsize(struct memman *memman) -{ - int i; - - printf(" flexible size memory blocks\n"); - printf(" alloc(): %d times\n", memman->flex_alloc_called); - printf(" system malloc(): %d times\n", memman->flex_salloc_called); - printf(" free(): %d times\n", memman->flex_free_called); - printf(" system free(): %d times\n", memman->flex_sfree_called); - printf(" required memory: %d bytes\n", memman->flex_required_mem); - printf(" allocated memory: %d bytes\n", memman->flex_allocated_mem); - printf(" reclaimed memory: %d bytes\n", memman->flex_reclaimed_mem); - printf(" peak memory usage: %d bytes\n", memman->flex_peak_mem_usage); - printf(" min memory size: %d bytes\n", memman->flex_mem_size_min); - printf(" max memory size: %d bytes\n", memman->flex_mem_size_max); - printf(" avg memory size: %d bytes\n", - (memman->flex_alloc_called) ? - memman->flex_allocated_mem / memman->flex_alloc_called : 0); - - printf(" memory size histogram (%d entries):\n", - memman->flex_mem_histogram_ptr); - printf(" size count\n"); - memman_sort_histogram_by_size(memman); - for (i = 0; i < memman->flex_mem_histogram_ptr; i++) { - printf(" %d %d\n", - memman->flex_mem_histogram[i].mem_size, - memman->flex_mem_histogram[i].count); - } -} - -void -memman_statistics(struct memman *memman) -{ - printf("memman: reporting statistics\n"); - memman_statistics_fixedsize(memman); - memman_statistics_flexsize(memman); -} - -size_t -memman_memid2size(struct memman *memman, unsigned int id) -{ - if (memman->max_memid <= id) { - printf("memman_alloc: invalid memory type id\n"); - return (0); - } - return (memman->blockman[id].size); -} Property changes on: head/sys/dev/acpi/aml/aml_memman.c ___________________________________________________________________ Deleted: svn:keywords ## -1 +0,0 ## -FreeBSD=%H \ No newline at end of property Index: head/sys/dev/acpi/aml/aml_memman.h =================================================================== --- head/sys/dev/acpi/aml/aml_memman.h (revision 68516) +++ head/sys/dev/acpi/aml/aml_memman.h (nonexistent) @@ -1,172 +0,0 @@ -/*- - * Copyright (c) 1999, 2000 Mitsuru IWASAKI - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $Id: aml_memman.h,v 1.9 2000/08/09 14:47:43 iwasaki Exp $ - * $FreeBSD$ - */ - -#ifndef _MEMMAN_H_ -#define _MEMMAN_H_ - -/* - * Generic Memory Management - */ - -#include -#include - -/* memory block */ -struct memman_block { - LIST_ENTRY(memman_block) links; - void *block; - unsigned static_mem; /* static memory or not */ - unsigned int allocated; /* number of allocated chunks */ - unsigned int available; /* number of available chunks */ - unsigned int allocated_mem; /* block + misc (in bytes) */ - -}__attribute__((packed)); - -LIST_HEAD(memman_block_list, memman_block); - -/* memory node in block */ -struct memman_node { - LIST_ENTRY(memman_node) links; - void *node; - struct memman_block *memblock; -}__attribute__((packed)); - -LIST_HEAD(memman_node_list, memman_node); - -/* memory type id */ -extern unsigned int memid_unkown; - -/* memory block manager */ -struct memman_blockman { - unsigned int size; /* size of chunk */ - unsigned int available; /* total # of available chunks */ - void *initial_block; /* initial memory storage */ - unsigned initialized; /* initialized or not */ - - struct memman_block_list block_list; - struct memman_node_list free_node_list; - struct memman_node_list occupied_node_list; -}; - -/* memory size histogram */ -#define MEMMAN_HISTOGRAM_SIZE 20 -struct memman_histogram { - int mem_size; - int count; -}; - -/* flex size memory allocation info */ -struct memman_flexmem_info { - LIST_ENTRY(memman_flexmem_info) links; - void *addr; - size_t mem_size; -}__attribute__((packed)); - -LIST_HEAD(memman_flexmem_info_list, memman_flexmem_info); - -/* memory manager */ -struct memman { - struct memman_blockman *blockman; - unsigned int max_memid; /* max number of valid memid */ - - /* fixed size memory blocks */ - unsigned int alloc_called; /* memman_alloc() calling */ - unsigned int free_called; /* memman_free() calling */ - unsigned int salloc_called; /* malloc() calling */ - unsigned int sfree_called; /* free() calling */ - size_t required_mem; /* total required memory (in bytes) */ - size_t allocated_mem; /* total malloc()ed memory */ - size_t reclaimed_mem; /* total free()ed memory */ - /* flex size memory blocks */ - unsigned int flex_alloc_called; /* memman_alloc_flexsize() calling */ - unsigned int flex_free_called; /* memman_free_flexsize() calling */ - unsigned int flex_salloc_called;/* malloc() calling */ - unsigned int flex_sfree_called; /* free() calling */ - size_t flex_required_mem; /* total required memory (in bytes) */ - size_t flex_allocated_mem;/* total malloc()ed memory */ - size_t flex_reclaimed_mem;/* total free()ed memory */ - size_t flex_mem_size_min; /* min size of allocated memory */ - size_t flex_mem_size_max; /* max size of allocated memory */ - size_t flex_peak_mem_usage;/* memory usage at a peak period */ - - /* stuff for more detailed statistical information */ - struct memman_histogram *flex_mem_histogram; - unsigned int flex_mem_histogram_ptr; - int flex_mem_histogram_initial_tolerance; - unsigned flex_mem_initialized; - struct memman_flexmem_info_list flexmem_info_list; -}; - -#define MEMMAN_BLOCKNODE_SIZE(entries) sizeof(struct memman_block) + \ - sizeof(struct memman_node) * entries - -#ifndef ROUNDUP_UNIT -#define ROUNDUP_UNIT 4 -#endif - -#if !defined(MEMMAN_INITIAL_SIZE) || MEMMAN_INITIAL_SIZE < 2048 -#define MEMMAN_INITIAL_SIZE 2048 -#endif - -#if !defined(MEMMAN_INCR_SIZE) || MEMMAN_INCR_SIZE < 512 -#define MEMMAN_INCR_SIZE 512 -#endif - -#define MEMMAN_INITIALSTORAGE_DESC(type, name) \ -static struct { \ - char blocknodes[MEMMAN_BLOCKNODE_SIZE(MEMMAN_INITIAL_SIZE)]; \ - type realblock[MEMMAN_INITIAL_SIZE]; \ -} name - -#define MEMMAN_MEMBLOCK_DESC(size, initial_storage) \ - { size, MEMMAN_INITIAL_SIZE, &initial_storage, 0 } - -#define MEMMAN_MEMMANAGER_DESC(blockman, max_memid, histogram, tolerance) \ - { blockman, max_memid, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ - 0, 0, 0, histogram, 0, tolerance, 0} - -void *memman_alloc(struct memman *, unsigned int); -void *memman_alloc_flexsize(struct memman *, size_t); -void memman_free(struct memman *, unsigned int, void *); -void memman_free_flexsize(struct memman *, void *); -void memman_freeall(struct memman *); -void memman_statistics(struct memman *); -size_t memman_memid2size(struct memman *, unsigned int); - -#ifdef _KERNEL -#define MEMMAN_SYSMALLOC(size) malloc(size, M_MEMMAN, M_WAITOK) -#define MEMMAN_SYSFREE(ptr) free(ptr, M_MEMMAN) -#define MEMMAN_SYSABORT() /* no abort in kernel */ -#else /* !_KERNEL */ -#define MEMMAN_SYSMALLOC(size) malloc(size) -#define MEMMAN_SYSFREE(ptr) free(ptr) -#define MEMMAN_SYSABORT() abort() -#endif /* _KERNEL */ - -#endif /* !_MEMMAN_H_ */ Property changes on: head/sys/dev/acpi/aml/aml_memman.h ___________________________________________________________________ Deleted: svn:keywords ## -1 +0,0 ## -FreeBSD=%H \ No newline at end of property Index: head/sys/dev/acpi/aml/aml_evalobj.c =================================================================== --- head/sys/dev/acpi/aml/aml_evalobj.c (revision 68516) +++ head/sys/dev/acpi/aml/aml_evalobj.c (nonexistent) @@ -1,436 +0,0 @@ -/*- - * Copyright (c) 1999 Takanori Watanabe - * Copyright (c) 1999, 2000 Mitsuru IWASAKI - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $Id: aml_evalobj.c,v 1.27 2000/08/16 18:14:53 iwasaki Exp $ - * $FreeBSD$ - */ - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifndef _KERNEL -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#include "debug.h" -#else /* _KERNEL */ -#include -#endif /* !_KERNEL */ - -static union aml_object *aml_eval_fieldobject(struct aml_environ *env, - struct aml_name *name); - -static union aml_object * -aml_eval_fieldobject(struct aml_environ *env, struct aml_name *name) -{ - int num; - struct aml_name *oname,*wname; - struct aml_field *field; - struct aml_opregion *or; - union aml_object tobj; - - num = 0; - /* CANNOT OCCUR! */ - if (name == NULL || name->property == NULL || - name->property->type != aml_t_field) { - printf("????\n"); - env->stat = aml_stat_panic; - return (NULL); - } - field = &name->property->field; - oname = env->curname; - if (field->bitlen > 32) { - env->tempobject.type = aml_t_regfield; - } else { - env->tempobject.type = aml_t_num; - } - env->curname = name; - if (field->f.ftype == f_t_field) { - wname = aml_search_name(env, field->f.fld.regname); - if (wname == NULL || wname->property == NULL || - wname->property->type != aml_t_opregion) { - AML_DEBUGPRINT("Inappropreate Type\n"); - env->stat = aml_stat_panic; - env->curname = oname; - return (NULL); - } - or = &wname->property->opregion; - if (env->tempobject.type == aml_t_regfield) { - env->tempobject.regfield.space = or->space; - env->tempobject.regfield.flags = field->flags; - env->tempobject.regfield.offset = or->offset; - env->tempobject.regfield.bitoffset = field->bitoffset; - env->tempobject.regfield.bitlen = field->bitlen; - } else { - env->tempobject.type = aml_t_num; - env->tempobject.num.number = aml_region_read(env, - or->space, field->flags, or->offset, - field->bitoffset, field->bitlen); - AML_DEBUGPRINT("[read(%d, 0x%x)->0x%x]", - or->space, or->offset + field->bitoffset / 8, - env->tempobject.num.number); - } - } else if (field->f.ftype == f_t_index) { - wname = aml_search_name(env, field->f.ifld.indexname); - tobj.type = aml_t_num; - tobj.num.number = field->bitoffset / 8;/* AccessType Boundary */ - aml_store_to_name(env, &tobj, wname); - wname = aml_search_name(env, field->f.ifld.dataname); - num = aml_objtonum(env, aml_eval_name(env, wname)); - env->tempobject.type = aml_t_num; - env->tempobject.num.number = (num >> (field->bitoffset & 7)) & - ((1 << field->bitlen) - 1); - } - env->curname = oname; - return (&env->tempobject); -} - -union aml_object * -aml_eval_objref(struct aml_environ *env, union aml_object *obj) -{ - int offset; - union aml_object num1; - union aml_object *ref, *ret; - - ret = obj; - if (obj->objref.deref == 1) { - num1.type = aml_t_num; - offset = obj->objref.offset; - ref = obj->objref.ref; - if (ref == NULL) { - goto out; - } - switch (ref->type) { - case aml_t_package: - if (ref->package.elements > offset) { - ret = ref->package.objects[offset]; - } else { - num1.num.number = 0; - env->tempobject = num1; - ret = &env->tempobject; - } - break; - case aml_t_buffer: - if (ref->buffer.size > offset) { - num1.num.number = ref->buffer.data[offset] & 0xff; - } else { - num1.num.number = 0; - } - env->tempobject = num1; - ret = &env->tempobject; - break; - default: - break; - } - } - if (obj->objref.alias == 1) { - ret = aml_eval_name(env, obj->objref.nameref); - goto out; - } -out: - return (ret); -} - -/* - * Eval named object. - */ -union aml_object * -aml_eval_name(struct aml_environ *env, struct aml_name *aname) -{ - int argnum, i; - int num; - struct aml_name *tmp; - struct aml_environ *copy; - struct aml_local_stack *stack; - union aml_object *obj, *ret; - union aml_object *src; - - ret = NULL; - if (aname == NULL || aname->property == NULL) { - return (NULL); - } - if (env->stat == aml_stat_panic) { - return (NULL); - } - copy = memman_alloc(aml_memman, memid_aml_environ); - if (copy == NULL) { - return (NULL); - } - ret = aname->property; - i = 0; -reevaluate: - if (i > 10) { - env->stat = aml_stat_panic; - printf("TOO MANY LOOP\n"); - ret = NULL; - goto out; - } - switch (aname->property->type) { - case aml_t_namestr: - tmp = aname; - aname = aml_search_name(env, aname->property->nstr.dp); - if (aname == NULL) { - aname = tmp; - } - i++; - goto reevaluate; - case aml_t_objref: - ret = aml_eval_objref(env, aname->property); - goto out; - case aml_t_num: - case aml_t_string: - case aml_t_buffer: - case aml_t_package: - case aml_t_debug: - ret = aname->property; - goto out; - case aml_t_field: - aml_free_objectcontent(&env->tempobject); - ret = aml_eval_fieldobject(env, aname); - goto out; - case aml_t_method: - aml_free_objectcontent(&env->tempobject); - argnum = aname->property->meth.argnum & 7; - *copy = *env; - copy->curname = aname; - copy->dp = aname->property->meth.from; - copy->end = aname->property->meth.to; - copy->stat = aml_stat_none; - stack = aml_local_stack_create(); - AML_DEBUGPRINT("("); - for (i = 0; i < argnum; i++) { - aml_local_stack_getArgX(stack, i)->property = - aml_copy_object(env, - aml_eval_name(env, - aml_parse_termobj(env, 0))); - if (i < argnum - 1) - AML_DEBUGPRINT(", "); - } - AML_DEBUGPRINT(")\n"); - aml_local_stack_push(stack); - if (env->stat == aml_stat_step) { - AML_DEBUGGER(env, copy); - } - tmp = aml_execute_method(copy); - obj = aml_eval_name(env, tmp); - if (copy->stat == aml_stat_panic) { - AML_DEBUGPRINT("PANIC OCCURED IN METHOD"); - env->stat = aml_stat_panic; - ret = NULL; - aml_local_stack_delete(aml_local_stack_pop()); - goto out; - } - if (aml_debug) { - aml_showobject(obj); - } - - if (tmp) - tmp->property = NULL; - aml_local_stack_delete(aml_local_stack_pop()); - if (obj) { - aml_create_local_object()->property = obj; - ret = obj; - } else { - env->tempobject.type = aml_t_num; - env->tempobject.num.number = 0; - } - - goto out; - case aml_t_bufferfield: - aml_free_objectcontent(&env->tempobject); - if (aname->property->bfld.bitlen > 32) { - ret = aname->property; - } else { - src = aname->property; - num = aml_bufferfield_read(src->bfld.origin, - src->bfld.bitoffset, src->bfld.bitlen); - env->tempobject.type = aml_t_num; - env->tempobject.num.number = num; - ret = &env->tempobject; - } - goto out; - default: - AML_DEBUGPRINT("I eval the object that I should not eval, %s%d", - aname->name, aname->property->type); - AML_SYSABORT(); - ret = NULL; - goto out; - } -out: - memman_free(aml_memman, memid_aml_environ, copy); - return (ret); -} - -/* - * Eval named object but env variable is not required and return - * status of evaluation (success is zero). This function is assumed - * to be called by aml_apply_foreach_found_objects(). - * Note that no arguments are passed if object is a method. - */ - -int -aml_eval_name_simple(struct aml_name *name, va_list ap) -{ - struct aml_environ *env; - union aml_object *ret; - - if (name == NULL || name->property == NULL) { - return (1); - } - - env = memman_alloc(aml_memman, memid_aml_environ); - if (env == NULL) { - return (1); - } - bzero(env, sizeof(struct aml_environ)); - - aml_local_stack_push(aml_local_stack_create()); - - AML_DEBUGPRINT("Evaluating "); - aml_print_curname(name); - ret = aml_eval_name(env, name); - if (name->property->type != aml_t_method) { - AML_DEBUGPRINT("\n"); - if (aml_debug) { - aml_showobject(ret); - } - } - - aml_local_stack_delete(aml_local_stack_pop()); - - memman_free(aml_memman, memid_aml_environ, env); - return (0); -} - -int -aml_objtonum(struct aml_environ *env, union aml_object *obj) -{ - - if (obj != NULL && obj->type == aml_t_num) { - return (obj->num.number); - } else { - env->stat = aml_stat_panic; - return (-1); - } -} - -struct aml_name * -aml_execute_method(struct aml_environ *env) -{ - struct aml_name *name; - struct aml_name_group *newgrp; - - newgrp = aml_new_name_group(AML_NAME_GROUP_IN_METHOD); - - AML_DEBUGPRINT("["); - aml_print_curname(env->curname); - AML_DEBUGPRINT(" START]\n"); - - name = aml_parse_objectlist(env, 0); - AML_DEBUGPRINT("["); - aml_print_curname(env->curname); - AML_DEBUGPRINT(" END]\n"); - - aml_delete_name_group(newgrp); - return (name); -} - -union aml_object * -aml_invoke_method(struct aml_name *name, int argc, union aml_object *argv) -{ - int i; - struct aml_name *tmp; - struct aml_environ *env; - struct aml_local_stack *stack; - union aml_object *retval; - union aml_object *obj; - - retval = NULL; - env = memman_alloc(aml_memman, memid_aml_environ); - if (env == NULL) { - return (NULL); - } - bzero(env, sizeof(struct aml_environ)); - - if (name != NULL && name->property != NULL && - name->property->type == aml_t_method) { - env->curname = name; - env->dp = name->property->meth.from; - env->end = name->property->meth.to; - AML_DEBUGGER(env, env); - stack = aml_local_stack_create(); - for (i = 0; i < argc; i++) { - aml_local_stack_getArgX(stack, i)->property = - aml_alloc_object(argv[i].type, &argv[i]); - } - aml_local_stack_push(stack); - obj = aml_eval_name(env, tmp = aml_execute_method(env)); - if (aml_debug) { - aml_showtree(name, 0); - } - - if (tmp) - tmp->property = NULL; - aml_local_stack_delete(aml_local_stack_pop()); - if (obj) { - aml_create_local_object()->property = obj; - retval = obj; - } - } - memman_free(aml_memman, memid_aml_environ, env); - return (retval); -} - -union aml_object * -aml_invoke_method_by_name(char *method, int argc, union aml_object *argv) -{ - struct aml_name *name; - - name = aml_find_from_namespace(aml_get_rootname(), method); - if (name == NULL) { - return (NULL); - } - - return (aml_invoke_method(name, argc, argv)); -} Property changes on: head/sys/dev/acpi/aml/aml_evalobj.c ___________________________________________________________________ Deleted: svn:keywords ## -1 +0,0 ## -FreeBSD=%H \ No newline at end of property Index: head/sys/dev/acpi/aml/aml_common.c =================================================================== --- head/sys/dev/acpi/aml/aml_common.c (revision 68516) +++ head/sys/dev/acpi/aml/aml_common.c (nonexistent) @@ -1,735 +0,0 @@ -/*- - * Copyright (c) 1999 Takanori Watanabe - * Copyright (c) 1999, 2000 Mitsuru IWASAKI - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $Id: aml_common.c,v 1.9 2000/08/09 14:47:43 iwasaki Exp $ - * $FreeBSD$ - */ - -#include - -#ifndef _KERNEL -#include -#include -#include -#include -#include -#include -#else /* _KERNEL */ -#include "opt_acpi.h" -#include -#include -#include -#include -#include -#include -#include -#ifndef ACPI_NO_OSDFUNC_INLINE -#include -#endif /* !ACPI_NO_OSDFUNC_INLINE */ -#endif /* !_KERNEL */ - -#include -#include -#include -#include -#include -#include -#include -#include - -/* for debugging */ -#ifdef AML_DEBUG -int aml_debug = 1; -#else /* !AML_DEBUG */ -int aml_debug = 0; -#endif /* AML_DEBUG */ -#ifdef _KERNEL -SYSCTL_INT(_debug, OID_AUTO, aml_debug, CTLFLAG_RW, &aml_debug, 1, ""); -#endif /* _KERNEL */ - -static void aml_print_nameseg(u_int8_t *dp); - -static void -aml_print_nameseg(u_int8_t *dp) -{ - - if (dp[3] != '_') { - AML_DEBUGPRINT("%c%c%c%c", dp[0], dp[1], dp[2], dp[3]); - } else if (dp[2] != '_') { - AML_DEBUGPRINT("%c%c%c_", dp[0], dp[1], dp[2]); - } else if (dp[1] != '_') { - AML_DEBUGPRINT("%c%c__", dp[0], dp[1]); - } else if (dp[0] != '_') { - AML_DEBUGPRINT("%c___", dp[0]); - } -} - -void -aml_print_namestring(u_int8_t *dp) -{ - int segcount; - int i; - - if (dp[0] == '\\') { - AML_DEBUGPRINT("%c", dp[0]); - dp++; - } else if (dp[0] == '^') { - while (dp[0] == '^') { - AML_DEBUGPRINT("%c", dp[0]); - dp++; - } - } - if (dp[0] == 0x00) { /* NullName */ - /* AML_DEBUGPRINT(""); */ - dp++; - } else if (dp[0] == 0x2e) { /* DualNamePrefix */ - aml_print_nameseg(dp + 1); - AML_DEBUGPRINT("%c", '.'); - aml_print_nameseg(dp + 5); - } else if (dp[0] == 0x2f) { /* MultiNamePrefix */ - segcount = dp[1]; - for (i = 0, dp += 2; i < segcount; i++, dp += 4) { - if (i > 0) { - AML_DEBUGPRINT("%c", '.'); - } - aml_print_nameseg(dp); - } - } else /* NameSeg */ - aml_print_nameseg(dp); -} - -int -aml_print_curname(struct aml_name *name) -{ - struct aml_name *root; - - root = aml_get_rootname(); - if (name == root) { - AML_DEBUGPRINT("\\"); - return (0); - } else { - aml_print_curname(name->parent); - } - aml_print_nameseg(name->name); - AML_DEBUGPRINT("."); - return (0); -} - -void -aml_print_indent(int indent) -{ - int i; - - for (i = 0; i < indent; i++) - AML_DEBUGPRINT(" "); -} - -void -aml_showobject(union aml_object * obj) -{ - int debug; - int i; - - if (obj == NULL) { - printf("NO object\n"); - return; - } - debug = aml_debug; - aml_debug = 1; - switch (obj->type) { - case aml_t_num: - printf("Num:0x%x\n", obj->num.number); - break; - case aml_t_processor: - printf("Processor:No %d,Port 0x%x length 0x%x\n", - obj->proc.id, obj->proc.addr, obj->proc.len); - break; - case aml_t_mutex: - printf("Mutex:Level %d\n", obj->mutex.level); - break; - case aml_t_powerres: - printf("PowerResource:Level %d Order %d\n", - obj->pres.level, obj->pres.order); - break; - case aml_t_opregion: - printf("OprationRegion:Busspace%d, Offset 0x%x Length 0x%x\n", - obj->opregion.space, obj->opregion.offset, - obj->opregion.length); - break; - case aml_t_field: - printf("Fieldelement:flag 0x%x offset 0x%x len 0x%x {", - obj->field.flags, obj->field.bitoffset, - obj->field.bitlen); - switch (obj->field.f.ftype) { - case f_t_field: - aml_print_namestring(obj->field.f.fld.regname); - break; - case f_t_index: - aml_print_namestring(obj->field.f.ifld.indexname); - printf(" "); - aml_print_namestring(obj->field.f.ifld.dataname); - break; - case f_t_bank: - aml_print_namestring(obj->field.f.bfld.regname); - printf(" "); - aml_print_namestring(obj->field.f.bfld.bankname); - printf("0x%x", obj->field.f.bfld.bankvalue); - break; - } - printf("}\n"); - break; - case aml_t_method: - printf("Method: Arg %d From %p To %p\n", obj->meth.argnum, - obj->meth.from, obj->meth.to); - break; - case aml_t_buffer: - printf("Buffer: size:0x%x Data %p\n", obj->buffer.size, - obj->buffer.data); - break; - case aml_t_device: - printf("Device\n"); - break; - case aml_t_bufferfield: - printf("Bufferfield:offset 0x%x len 0x%x Origin %p\n", - obj->bfld.bitoffset, obj->bfld.bitlen, obj->bfld.origin); - break; - case aml_t_string: - printf("String:%s\n", obj->str.string); - break; - case aml_t_package: - printf("Package:elements %d \n", obj->package.elements); - for (i = 0; i < obj->package.elements; i++) { - if (obj->package.objects[i] == NULL) { - break; - } - if (obj->package.objects[i]->type < 0) { - continue; - } - printf(" "); - aml_showobject(obj->package.objects[i]); - } - break; - case aml_t_therm: - printf("Thermalzone\n"); - break; - case aml_t_event: - printf("Event\n"); - break; - case aml_t_ddbhandle: - printf("DDBHANDLE\n"); - break; - case aml_t_objref: - if (obj->objref.alias == 1) { - printf("Alias"); - } else { - printf("Object reference"); - if (obj->objref.offset >= 0) { - printf(" (offset 0x%x)", obj->objref.offset); - } - } - printf(" of "); - aml_showobject(obj->objref.ref); - break; - default: - printf("UNK ID=%d\n", obj->type); - } - - aml_debug = debug; -} - -void -aml_showtree(struct aml_name * aname, int lev) -{ - int i; - struct aml_name *ptr; - char name[5]; - - for (i = 0; i < lev; i++) { - printf(" "); - } - strncpy(name, aname->name, 4); - name[4] = 0; - printf("%s ", name); - if (aname->property != NULL) { - aml_showobject(aname->property); - } else { - printf("\n"); - } - for (ptr = aname->child; ptr; ptr = ptr->brother) - aml_showtree(ptr, lev + 1); -} - -/* - * Common Region I/O Stuff - */ - -static __inline u_int64_t -aml_adjust_bitmask(u_int32_t flags, u_int32_t bitlen) -{ - u_int64_t bitmask; - - switch (AML_FIELDFLAGS_ACCESSTYPE(flags)) { - case AML_FIELDFLAGS_ACCESS_ANYACC: - if (bitlen <= 8) { - bitmask = 0x000000ff; - break; - } - if (bitlen <= 16) { - bitmask = 0x0000ffff; - break; - } - bitmask = 0xffffffff; - break; - case AML_FIELDFLAGS_ACCESS_BYTEACC: - bitmask = 0x000000ff; - break; - case AML_FIELDFLAGS_ACCESS_WORDACC: - bitmask = 0x0000ffff; - break; - case AML_FIELDFLAGS_ACCESS_DWORDACC: - default: - bitmask = 0xffffffff; - break; - } - - switch (bitlen) { - case 16: - bitmask |= 0x0000ffff; - break; - case 32: - bitmask |= 0xffffffff; - break; - } - - return (bitmask); -} - -u_int32_t -aml_adjust_readvalue(u_int32_t flags, u_int32_t bitoffset, u_int32_t bitlen, - u_int32_t orgval) -{ - u_int32_t offset, retval; - u_int64_t bitmask; - - offset = bitoffset; /* XXX bitoffset may change in this function! */ - bitmask = aml_adjust_bitmask(flags, bitlen); - retval = (orgval >> offset) & (~(bitmask << bitlen)) & bitmask; - - return (retval); -} - -u_int32_t -aml_adjust_updatevalue(u_int32_t flags, u_int32_t bitoffset, u_int32_t bitlen, - u_int32_t orgval, u_int32_t value) -{ - u_int32_t offset, retval; - u_int64_t bitmask; - - offset = bitoffset; /* XXX bitoffset may change in this function! */ - bitmask = aml_adjust_bitmask(flags, bitlen); - retval = orgval; - switch (AML_FIELDFLAGS_UPDATERULE(flags)) { - case AML_FIELDFLAGS_UPDATE_PRESERVE: - retval &= (~(((u_int64_t)1 << bitlen) - 1) << offset) | - (~(bitmask << offset)); - break; - case AML_FIELDFLAGS_UPDATE_WRITEASONES: - retval = (~(((u_int64_t)1 << bitlen) - 1) << offset) | - (~(bitmask << offset)); - retval &= bitmask; /* trim the upper bits */ - break; - case AML_FIELDFLAGS_UPDATE_WRITEASZEROS: - retval = 0; - break; - default: - printf("illegal update rule: %d\n", flags); - return (orgval); - } - - retval |= (value << (offset & bitmask)); - return (retval); -} - -/* - * BufferField I/O - */ - -#define AML_BUFFER_INPUT 0 -#define AML_BUFFER_OUTPUT 1 - -static int aml_bufferfield_io(int io, u_int32_t *valuep, - u_int8_t *origin, u_int32_t bitoffset, - u_int32_t bitlen); - -static int -aml_bufferfield_io(int io, u_int32_t *valuep, u_int8_t *origin, - u_int32_t bitoffset, u_int32_t bitlen) -{ - u_int8_t val, tmp, masklow, maskhigh; - u_int8_t offsetlow, offsethigh; - u_int8_t *addr; - int i; - u_int32_t value, readval; - u_int32_t byteoffset, bytelen; - - masklow = maskhigh = 0xff; - val = readval = 0; - value = *valuep; - - byteoffset = bitoffset / 8; - bytelen = bitlen / 8 + ((bitlen % 8) ? 1 : 0); - addr = origin + byteoffset; - - /* simple I/O ? */ - if (bitlen <= 8 || bitlen == 16 || bitlen == 32) { - bcopy(addr, &readval, bytelen); - AML_DEBUGPRINT("\n\t[bufferfield:0x%x@%p:%d,%d]", - readval, addr, bitoffset % 8, bitlen); - switch (io) { - case AML_BUFFER_INPUT: - value = aml_adjust_readvalue(AML_FIELDFLAGS_ACCESS_BYTEACC, - bitoffset % 8, bitlen, readval); - *valuep = value; - AML_DEBUGPRINT("\n[read(bufferfield, %p)&mask:0x%x]\n", - addr, value); - break; - case AML_BUFFER_OUTPUT: - value = aml_adjust_updatevalue(AML_FIELDFLAGS_ACCESS_BYTEACC, - bitoffset % 8, bitlen, readval, value); - bcopy(&value, addr, bytelen); - AML_DEBUGPRINT("->[bufferfield:0x%x@%p:%d,%d]", - value, addr, bitoffset % 8, bitlen); - break; - } - goto out; - } - - offsetlow = bitoffset % 8; - if (bytelen > 1) { - offsethigh = (bitlen - (8 - offsetlow)) % 8; - } else { - offsethigh = 0; - } - - if (offsetlow) { - masklow = (~((1 << bitlen) - 1) << offsetlow) | ~(0xff << offsetlow); - AML_DEBUGPRINT("\t[offsetlow = 0x%x, masklow = 0x%x, ~masklow = 0x%x]\n", - offsetlow, masklow, ~masklow & 0xff); - } - if (offsethigh) { - maskhigh = 0xff << offsethigh; - AML_DEBUGPRINT("\t[offsethigh = 0x%x, maskhigh = 0x%x, ~maskhigh = 0x%x]\n", - offsethigh, maskhigh, ~maskhigh & 0xff); - } - for (i = bytelen; i > 0; i--, addr++) { - val = *addr; - - AML_DEBUGPRINT("\t[bufferfield:0x%02x@%p]", val, addr); - - switch (io) { - case AML_BUFFER_INPUT: - tmp = val; - /* the lowest byte? */ - if (i == bytelen) { - if (offsetlow) { - readval = tmp & ~masklow; - } else { - readval = tmp; - } - } else { - if (i == 1 && offsethigh) { - tmp = tmp & ~maskhigh; - } - readval = (tmp << (8 * (bytelen - i))) | readval; - } - - AML_DEBUGPRINT("\n"); - /* goto to next byte... */ - if (i > 1) { - continue; - } - /* final adjustment before finishing region access */ - if (offsetlow) { - readval = readval >> offsetlow; - } - AML_DEBUGPRINT("[read(bufferfield, %p)&mask:0x%x]\n", - addr, readval); - *valuep = readval; - - break; - - case AML_BUFFER_OUTPUT: - tmp = value & 0xff; - /* the lowest byte? */ - if (i == bytelen) { - if (offsetlow) { - tmp = (val & masklow) | tmp << offsetlow; - } - value = value >> (8 - offsetlow); - } else { - if (i == 1 && offsethigh) { - tmp = (val & maskhigh) | tmp; - } - value = value >> 8; - } - - AML_DEBUGPRINT("->[bufferfield:0x%02x@%p]\n", - tmp, addr); - *addr = tmp; - } - } -out: - return (0); -} - -u_int32_t -aml_bufferfield_read(u_int8_t *origin, u_int32_t bitoffset, - u_int32_t bitlen) -{ - int value; - - value = 0; - aml_bufferfield_io(AML_BUFFER_INPUT, &value, origin, - bitoffset, bitlen); - return (value); -} - -int -aml_bufferfield_write(u_int32_t value, u_int8_t *origin, - u_int32_t bitoffset, u_int32_t bitlen) -{ - int status; - - status = aml_bufferfield_io(AML_BUFFER_OUTPUT, &value, - origin, bitoffset, bitlen); - return (status); -} - -int -aml_region_handle_alloc(struct aml_environ *env, int regtype, u_int32_t flags, - u_int32_t baseaddr, u_int32_t bitoffset, u_int32_t bitlen, - struct aml_region_handle *h) -{ - int state; - struct aml_name *pci_info; - - state = 0; - pci_info = NULL; - bzero(h, sizeof(struct aml_region_handle)); - - h->env = env; - h->regtype = regtype; - h->flags = flags; - h->baseaddr = baseaddr; - h->bitoffset = bitoffset; - h->bitlen = bitlen; - - switch (AML_FIELDFLAGS_ACCESSTYPE(flags)) { - case AML_FIELDFLAGS_ACCESS_ANYACC: - if (bitlen <= 8) { - h->unit = 1; - break; - } - if (bitlen <= 16) { - h->unit = 2; - break; - } - h->unit = 4; - break; - case AML_FIELDFLAGS_ACCESS_BYTEACC: - h->unit = 1; - break; - case AML_FIELDFLAGS_ACCESS_WORDACC: - h->unit = 2; - break; - case AML_FIELDFLAGS_ACCESS_DWORDACC: - h->unit = 4; - break; - default: - h->unit = 1; - break; - } - - h->addr = baseaddr + h->unit * ((bitoffset / 8) / h->unit); - h->bytelen = baseaddr + ((bitoffset + bitlen) / 8) - h->addr + - ((bitlen % 8) ? 1 : 0); - -#ifdef _KERNEL - switch (h->regtype) { - case AML_REGION_SYSMEM: - OsdMapMemory((void *)h->addr, h->bytelen, (void **)&h->vaddr); - break; - - case AML_REGION_PCICFG: - /* Obtain PCI bus number */ - pci_info = aml_search_name(env, "_BBN"); - if (pci_info == NULL || pci_info->property->type != aml_t_num) { - AML_DEBUGPRINT("Cannot locate _BBN. Using default 0\n"); - h->pci_bus = 0; - } else { - AML_DEBUGPRINT("found _BBN: %d\n", - pci_info->property->num.number); - h->pci_bus = pci_info->property->num.number & 0xff; - } - - /* Obtain device & function number */ - pci_info = aml_search_name(env, "_ADR"); - if (pci_info == NULL || pci_info->property->type != aml_t_num) { - printf("Cannot locate: _ADR\n"); - state = -1; - goto out; - } - h->pci_devfunc = pci_info->property->num.number; - - AML_DEBUGPRINT("[pci%d.%d]", h->pci_bus, h->pci_devfunc); - break; - - default: - break; - } - -out: -#endif /* _KERNEL */ - return (state); -} - -void -aml_region_handle_free(struct aml_region_handle *h) -{ -#ifdef _KERNEL - switch (h->regtype) { - case AML_REGION_SYSMEM: - OsdUnMapMemory((void *)h->vaddr, h->bytelen); - break; - - default: - break; - } -#endif /* _KERNEL */ -} - -static int -aml_region_io_simple(struct aml_environ *env, int io, int regtype, - u_int32_t flags, u_int32_t *valuep, u_int32_t baseaddr, - u_int32_t bitoffset, u_int32_t bitlen) -{ - int i, state; - u_int32_t readval, value, offset, bytelen; - struct aml_region_handle handle; - - state = aml_region_handle_alloc(env, regtype, flags, - baseaddr, bitoffset, bitlen, &handle); - if (state == -1) { - goto out; - } - - readval = 0; - offset = bitoffset % (handle.unit * 8); - /* limitation of 32 bits alignment */ - bytelen = (handle.bytelen > 4) ? 4 : handle.bytelen; - - if (io == AML_REGION_INPUT || - AML_FIELDFLAGS_UPDATERULE(flags) == AML_FIELDFLAGS_UPDATE_PRESERVE) { - for (i = 0; i < bytelen; i += handle.unit) { - state = aml_region_read_simple(&handle, i, &value); - if (state == -1) { - goto out; - } - readval |= (value << (i * 8)); - } - AML_DEBUGPRINT("\t[%d:0x%x@0x%x:%d,%d]", - regtype, readval, handle.addr, offset, bitlen); - } - - switch (io) { - case AML_REGION_INPUT: - AML_DEBUGPRINT("\n"); - readval = aml_adjust_readvalue(flags, offset, bitlen, readval); - value = readval; - value = aml_region_prompt_read(&handle, value); - state = aml_region_prompt_update_value(readval, value, &handle); - if (state == -1) { - goto out; - } - - *valuep = value; - break; - case AML_REGION_OUTPUT: - value = *valuep; - value = aml_adjust_updatevalue(flags, offset, - bitlen, readval, value); - value = aml_region_prompt_write(&handle, value); - AML_DEBUGPRINT("\t->[%d:0x%x@0x%x:%d,%d]\n", regtype, value, - handle.addr, offset, bitlen); - for (i = 0; i < bytelen; i += handle.unit) { - state = aml_region_write_simple(&handle, i, value); - if (state == -1) { - goto out; - } - value = value >> (handle.unit * 8); - } - break; - } - - aml_region_handle_free(&handle); -out: - return (state); -} - -int -aml_region_io(struct aml_environ *env, int io, int regtype, - u_int32_t flags, u_int32_t *valuep, u_int32_t baseaddr, - u_int32_t bitoffset, u_int32_t bitlen) -{ - u_int32_t unit, offset; - u_int32_t offadj, bitadj; - u_int32_t value, readval; - int state, i; - - readval = 0; - state = 0; - unit = 4; /* limitation of 32 bits alignment */ - offset = bitoffset % (unit * 8); - offadj = 0; - bitadj = 0; - if (offset + bitlen > unit * 8) { - bitadj = bitlen - (unit * 8 - offset); - } - for (i = 0; i < offset + bitlen; i += unit * 8) { - value = (*valuep) >> offadj; - state = aml_region_io_simple(env, io, regtype, flags, - &value, baseaddr, bitoffset + offadj, bitlen - bitadj); - if (state == -1) { - goto out; - } - readval |= value << offadj; - bitadj = offadj = bitlen - bitadj; - } - *valuep = readval; - -out: - return (state); -} Property changes on: head/sys/dev/acpi/aml/aml_common.c ___________________________________________________________________ Deleted: svn:keywords ## -1 +0,0 ## -FreeBSD=%H \ No newline at end of property Index: head/sys/dev/acpi/aml/aml_common.h =================================================================== --- head/sys/dev/acpi/aml/aml_common.h (revision 68516) +++ head/sys/dev/acpi/aml/aml_common.h (nonexistent) @@ -1,159 +0,0 @@ -/*- - * Copyright (c) 2000 Mitsuru IWASAKI - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $Id: aml_common.h,v 1.4 2000/08/08 14:12:05 iwasaki Exp $ - * $FreeBSD$ - */ - -#ifndef _AML_COMMON_H_ -#define _AML_COMMON_H_ - -/* - * General Stuff - */ -#ifdef _KERNEL -#define AML_SYSABORT() do { \ - printf("aml: fatal errer at %s:%d\n", __FILE__, __LINE__); \ - panic("panic in AML interpreter!"); \ -} while(0) -#define AML_SYSASSERT(x) do { \ - if (!(x)) { \ - AML_SYSABORT(); \ - } \ -} while(0) -#define AML_SYSERRX(eval, fmt, args...) do { \ - printf(fmt, args); \ -} while(0) -#define AML_DEBUGGER(x, y) /* no debugger in kernel */ -#define AML_STALL(micro) OsdSleepUsec(micro) -#define AML_SLEEP(sec, milli) OsdSleep(sec, milli) -#else /* !_KERNEL */ -#define AML_SYSASSERT(x) assert(x) -#define AML_SYSABORT() abort() -#define AML_SYSERRX(eval, fmt, args...) errx(eval, fmt, args) -#define AML_DEBUGGER(x, y) aml_dbgr(x, y) -#define AML_STALL(micro) /* not required in userland */ -#define AML_SLEEP(sec, milli) /* not required in userland */ -#endif /* _KERNEL */ - -union aml_object; -struct aml_name; - -extern int aml_debug; - -#define AML_DEBUGPRINT(args...) do { \ - if (aml_debug) { \ - printf(args); \ - } \ -} while(0) - -void aml_showobject(union aml_object *); -void aml_showtree(struct aml_name *, int); -int aml_print_curname(struct aml_name *); -void aml_print_namestring(u_int8_t *); -void aml_print_indent(int); - -/* - * Reigion I/O Stuff for both kernel/userland. - */ - -/* - * Field Flags - */ -/* bit 0 -3: AccessType */ -#define AML_FIELDFLAGS_ACCESS_ANYACC 0x00 -#define AML_FIELDFLAGS_ACCESS_BYTEACC 0x01 -#define AML_FIELDFLAGS_ACCESS_WORDACC 0x02 -#define AML_FIELDFLAGS_ACCESS_DWORDACC 0x03 -#define AML_FIELDFLAGS_ACCESS_BLOCKACC 0x04 -#define AML_FIELDFLAGS_ACCESS_SMBSENDRECVACC 0x05 -#define AML_FIELDFLAGS_ACCESS_SMBQUICKACC 0x06 -#define AML_FIELDFLAGS_ACCESSTYPE(flags) (flags & 0x0f) -/* bit 4: LockRule */ -#define AML_FIELDFLAGS_LOCK_NOLOCK 0x00 -#define AML_FIELDFLAGS_LOCK_LOCK 0x10 -#define AML_FIELDFLAGS_LOCKRULE(flags) (flags & 0x10) -/* bit 5 - 6: UpdateRule */ -#define AML_FIELDFLAGS_UPDATE_PRESERVE 0x00 -#define AML_FIELDFLAGS_UPDATE_WRITEASONES 0x20 -#define AML_FIELDFLAGS_UPDATE_WRITEASZEROS 0x40 -#define AML_FIELDFLAGS_UPDATERULE(flags) (flags & 0x60) -/* bit 7: reserved (must be 0) */ - -#define AML_REGION_INPUT 0 -#define AML_REGION_OUTPUT 1 - -#define AML_REGION_SYSMEM 0 -#define AML_REGION_SYSIO 1 -#define AML_REGION_PCICFG 2 -#define AML_REGION_EMBCTL 3 -#define AML_REGION_SMBUS 4 - -struct aml_region_handle { - /* These are copies of values used on initialization */ - struct aml_environ *env; - int regtype; - u_int32_t flags; - u_int32_t baseaddr; - u_int32_t bitoffset; - u_int32_t bitlen; - - /* following is determined on initialization */ - vm_offset_t addr, bytelen; - u_int32_t unit; /* access unit in bytes */ - - /* region type dependant */ - vm_offset_t vaddr; /* SystemMemory */ - u_int32_t pci_bus, pci_devfunc; /* PCI_Config */ -}; - -u_int32_t aml_adjust_readvalue(u_int32_t, u_int32_t, u_int32_t, - u_int32_t); -u_int32_t aml_adjust_updatevalue(u_int32_t, u_int32_t, u_int32_t, - u_int32_t, u_int32_t); - -u_int32_t aml_bufferfield_read(u_int8_t *, u_int32_t, u_int32_t); -int aml_bufferfield_write(u_int32_t, u_int8_t *, - u_int32_t, u_int32_t); - -int aml_region_handle_alloc(struct aml_environ *, int, u_int32_t, - u_int32_t, u_int32_t, u_int32_t, - struct aml_region_handle *); -void aml_region_handle_free(struct aml_region_handle *); - -int aml_region_io(struct aml_environ *, int, int, - u_int32_t, u_int32_t *, u_int32_t, - u_int32_t, u_int32_t); -extern int aml_region_read_simple(struct aml_region_handle *, vm_offset_t, - u_int32_t *); -extern int aml_region_write_simple(struct aml_region_handle *, vm_offset_t, - u_int32_t); -extern u_int32_t aml_region_prompt_read(struct aml_region_handle *, - u_int32_t); -extern u_int32_t aml_region_prompt_write(struct aml_region_handle *, - u_int32_t); -extern int aml_region_prompt_update_value(u_int32_t, u_int32_t, - struct aml_region_handle *); -#endif /* !_AML_COMMON_H_ */ Property changes on: head/sys/dev/acpi/aml/aml_common.h ___________________________________________________________________ Deleted: svn:keywords ## -1 +0,0 ## -FreeBSD=%H \ No newline at end of property Index: head/sys/dev/acpi/aml/aml_parse.c =================================================================== --- head/sys/dev/acpi/aml/aml_parse.c (revision 68516) +++ head/sys/dev/acpi/aml/aml_parse.c (nonexistent) @@ -1,2018 +0,0 @@ -/*- - * Copyright (c) 1999 Doug Rabson - * Copyright (c) 1999, 2000 Mitsuru IWASAKI - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $Id: aml_parse.c,v 1.32 2000/08/12 15:20:45 iwasaki Exp $ - * $FreeBSD$ - */ - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifndef _KERNEL -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include "debug.h" -#else /* _KERNEL */ -#include -#include -#include -#include -#include -#ifndef ACPI_NO_OSDFUNC_INLINE -#include -#endif -#endif /* !_KERNEL */ - -static int findsetleftbit(int num); -static int findsetrightbit(int num); -static int frombcd(int num); -static int tobcd(int num); - -static u_int32_t aml_parse_pkglength(struct aml_environ *env); -static u_int8_t aml_parse_bytedata(struct aml_environ *env); -static u_int16_t aml_parse_worddata(struct aml_environ *env); -static u_int32_t aml_parse_dworddata(struct aml_environ *env); -static u_int8_t *aml_parse_namestring(struct aml_environ *env); -static void aml_parse_defscope(struct aml_environ *env, - int indent); -static union aml_object *aml_parse_defbuffer(struct aml_environ *env, - int indent); -static struct aml_name *aml_parse_concat_number(struct aml_environ *env, - int num1, int indent); -static struct aml_name *aml_parse_concat_buffer(struct aml_environ *env, - union aml_object *obj, - int indent); -static struct aml_name *aml_parse_concat_string(struct aml_environ *env, - union aml_object *obj, - int indent); -static struct aml_name *aml_parse_concatop(struct aml_environ *env, - int indent); -static union aml_object *aml_parse_defpackage(struct aml_environ *env, - int indent); -static void aml_parse_defmethod(struct aml_environ *env, - int indent); -static void aml_parse_defopregion(struct aml_environ *env, - int indent); -static int aml_parse_field(struct aml_environ *env, - struct aml_field *template); -static void aml_parse_fieldlist(struct aml_environ *env, - struct aml_field *template, - int indent); -static void aml_parse_deffield(struct aml_environ *env, - int indent); -static void aml_parse_defindexfield(struct aml_environ *env, - int indent); -static void aml_parse_defbankfield(struct aml_environ *env, - int indent); -static void aml_parse_defdevice(struct aml_environ *env, - int indent); -static void aml_parse_defprocessor(struct aml_environ *env, - int indent); -static void aml_parse_defpowerres(struct aml_environ *env, - int indent); -static void aml_parse_defthermalzone(struct aml_environ *env, - int indent); -static struct aml_name *aml_parse_defelse(struct aml_environ *env, - int indent, int num); -static struct aml_name *aml_parse_defif(struct aml_environ *env, - int indent); -static struct aml_name *aml_parse_defwhile(struct aml_environ *env, - int indent); -static void aml_parse_defmutex(struct aml_environ *env, - int indent); -static void aml_createfield_generic(struct aml_environ *env, - union aml_object *srcbuf, - int index, int len, - char *newname); -static void aml_parse_defcreatefield(struct aml_environ *env, - int indent); - -static int -findsetleftbit(int num) -{ - int i, filter; - - filter = 0; - for (i = 0; i < 32; i++) { - filter = filter >> 1; - filter |= 1 << 31; - if (filter & num) { - break; - } - } - i = (i == 32) ? 0 : i + 1; - return (i); -} - -static int -findsetrightbit(int num) -{ - int i, filter; - - filter = 0; - for (i = 0; i < 32; i++) { - filter = filter << 1; - filter |= 1; - if (filter & num) { - break; - } - } - i = (i == 32) ? 0 : i + 1; - return (i); -} - -static int -frombcd(int num) -{ - int res, factor; - - res = 0; - factor = 1; - while (num != 0) { - res += ((num & 0xf) * factor); - num = num / 16; - factor *= 10; - } - return (res); -} - -static int -tobcd(int num) -{ - int res, factor; - - res = 0; - factor = 1; - while (num != 0) { - res += ((num % 10) * factor); - num = num / 10; - factor *= 16; - } - return (res); -} - -static u_int32_t -aml_parse_pkglength(struct aml_environ *env) -{ - u_int8_t *dp; - u_int32_t pkglength; - - dp = env->dp; - pkglength = *dp++; - switch (pkglength >> 6) { - case 0: - break; - case 1: - pkglength = (pkglength & 0xf) + (dp[0] << 4); - dp += 1; - break; - case 2: - pkglength = (pkglength & 0xf) + (dp[0] << 4) + (dp[1] << 12); - dp += 2; - break; - case 3: - pkglength = (pkglength & 0xf) - + (dp[0] << 4) + (dp[1] << 12) + (dp[2] << 20); - dp += 3; - break; - } - - env->dp = dp; - return (pkglength); -} - -static u_int8_t -aml_parse_bytedata(struct aml_environ *env) -{ - u_int8_t data; - - data = env->dp[0]; - env->dp++; - return (data); -} - -static u_int16_t -aml_parse_worddata(struct aml_environ *env) -{ - u_int16_t data; - - data = env->dp[0] + (env->dp[1] << 8); - env->dp += 2; - return (data); -} - -static u_int32_t -aml_parse_dworddata(struct aml_environ *env) -{ - u_int32_t data; - - data = env->dp[0] + (env->dp[1] << 8) + - (env->dp[2] << 16) + (env->dp[3] << 24); - env->dp += 4; - return (data); -} - -static u_int8_t * -aml_parse_namestring(struct aml_environ *env) -{ - u_int8_t *name; - int segcount; - - name = env->dp; - if (env->dp[0] == '\\') - env->dp++; - else if (env->dp[0] == '^') - while (env->dp[0] == '^') - env->dp++; - if (env->dp[0] == 0x00) /* NullName */ - env->dp++; - else if (env->dp[0] == 0x2e) /* DualNamePrefix */ - env->dp += 1 + 4 + 4; /* NameSeg, NameSeg */ - else if (env->dp[0] == 0x2f) { /* MultiNamePrefix */ - segcount = env->dp[1]; - env->dp += 1 + 1 + segcount * 4; /* segcount * NameSeg */ - } else - env->dp += 4; /* NameSeg */ - - return (name); -} - -struct aml_name * -aml_parse_objectlist(struct aml_environ *env, int indent) -{ - union aml_object *obj; - - obj = NULL; - while (env->dp < env->end) { - aml_print_indent(indent); - obj = aml_eval_name(env, aml_parse_termobj(env, indent)); - AML_DEBUGPRINT("\n"); - if (env->stat == aml_stat_step) { - AML_DEBUGGER(env, env); - continue; - } - if (env->stat != aml_stat_none) { - env->tempname.property = obj; - return (&env->tempname); - } - } - return (NULL); -} - -#define AML_CREATE_NAME(amlname, env, namestr, ret) do { \ - amlname = aml_create_name(env, namestr); \ - if (env->stat == aml_stat_panic) \ - return ret; \ -} while(0) - -#define AML_COPY_OBJECT(dest, env, src, ret) do { \ - dest = aml_copy_object(env, src); \ - if (dest == NULL) { \ - env->stat = aml_stat_panic; \ - return ret; \ - } \ -} while(0) - -#define AML_ALLOC_OBJECT(dest, env, type, ret) do { \ - dest = aml_alloc_object(type, NULL); \ - if (dest == NULL) { \ - env->stat= aml_stat_panic; \ - return ret; \ - } \ -} while(0) - -static void -aml_parse_defscope(struct aml_environ *env, int indent) -{ - u_int8_t *start, *end, *oend; - u_int8_t *name; - u_int32_t pkglength; - struct aml_name *oname; - - start = env->dp; - pkglength = aml_parse_pkglength(env); - - AML_DEBUGPRINT("Scope("); - name = aml_parse_namestring(env); - aml_print_namestring(name); - AML_DEBUGPRINT(") {\n"); - oname = env->curname; - AML_CREATE_NAME(env->curname, env, name,); - oend = env->end; - env->end = end = start + pkglength; - aml_parse_objectlist(env, indent + 1); - aml_print_indent(indent); - AML_DEBUGPRINT("}"); - AML_SYSASSERT(env->dp == env->end); - env->dp = end; - env->end = oend; - env->curname = oname; - env->stat = aml_stat_none; -} - -static union aml_object * -aml_parse_defbuffer(struct aml_environ *env, int indent) -{ - u_int8_t *start; - u_int8_t *end; - u_int8_t *buffer; - u_int32_t pkglength; - int size1, size2, size; - union aml_object *obj; - - start = env->dp; - pkglength = aml_parse_pkglength(env); - end = start + pkglength; - - AML_DEBUGPRINT("Buffer("); - obj = aml_eval_name(env, aml_parse_termobj(env, indent)); - size1 = aml_objtonum(env, obj); - size2 = end - env->dp; - size = (size1 < size2) ? size1 : size2; - if (size1 > 0) { - buffer = memman_alloc_flexsize(aml_memman, size1); - if (buffer == NULL) { - AML_DEBUGPRINT("NO MEMORY\n"); - env->stat = aml_stat_panic; - return (NULL); - } - bzero(buffer, size1); - bcopy(env->dp, buffer, size); - } else { - buffer = NULL; - } - - obj = &env->tempobject; - obj->type = aml_t_buffer; - obj->buffer.size = size1; - obj->buffer.data = buffer; - AML_DEBUGPRINT(") "); - env->dp = end; - - return (obj); -} - -static struct aml_name * -aml_parse_concat_number(struct aml_environ *env, int num1, int indent) -{ - int num2; - struct aml_name *destname; - union aml_object *obj; - - num2 = aml_objtonum(env, aml_eval_name(env, - aml_parse_termobj(env, indent))); - AML_DEBUGPRINT(", "); - destname = aml_parse_termobj(env, indent); - AML_DEBUGPRINT(")"); - obj = &env->tempobject; - obj->type = aml_t_buffer; - obj->buffer.size = 2; - obj->buffer.data = memman_alloc_flexsize(aml_memman, 2); - if (obj->buffer.data == NULL) { - env->stat = aml_stat_panic; - return (NULL); - } - obj->buffer.data[0] = num1 & 0xff; - obj->buffer.data[1] = num2 & 0xff; - aml_store_to_name(env, obj, destname); - return (&env->tempname); -} - -static struct aml_name * -aml_parse_concat_buffer(struct aml_environ *env, union aml_object *obj, - int indent) -{ - union aml_object *tmpobj, *tmpobj2, *resobj; - struct aml_name *destname; - - tmpobj = aml_eval_name(env, aml_parse_termobj(env, indent)); - AML_DEBUGPRINT(", "); - if (tmpobj->type != aml_t_buffer) { - env->stat = aml_stat_panic; - return (NULL); - } - AML_COPY_OBJECT(tmpobj2, env, tmpobj, NULL); - destname = aml_parse_termobj(env, indent); - AML_DEBUGPRINT(")"); - resobj = &env->tempobject; - env->tempname.property = resobj; - resobj->buffer.type = aml_t_buffer; - resobj->buffer.size = tmpobj2->buffer.size + obj->buffer.size; - if (resobj->buffer.size > 0) { - resobj->buffer.data = memman_alloc_flexsize(aml_memman, - resobj->buffer.size); - if (resobj->buffer.data == NULL) { - env->stat = aml_stat_panic; - return (NULL); - } - bcopy(obj->buffer.data, resobj->buffer.data, obj->buffer.size); - bcopy(tmpobj2->buffer.data, - resobj->buffer.data + obj->buffer.size, - tmpobj2->buffer.size); - } else { - resobj->buffer.data = NULL; - } - aml_free_object(&tmpobj2); - aml_store_to_name(env, resobj, destname); - return (&env->tempname); -} - -static struct aml_name * -aml_parse_concat_string(struct aml_environ *env, union aml_object *obj, - int indent) -{ - int len; - union aml_object *tmpobj, *tmpobj2, *resobj; - struct aml_name *destname; - - tmpobj = aml_eval_name(env, aml_parse_termobj(env, indent)); - AML_DEBUGPRINT(", "); - if (tmpobj->type != aml_t_string) { - env->stat = aml_stat_panic; - return (NULL); - } - AML_COPY_OBJECT(tmpobj2, env, tmpobj, NULL); - destname = aml_parse_termobj(env, indent); - AML_DEBUGPRINT(")"); - resobj = &env->tempobject; - env->tempname.property = resobj; - resobj->type = aml_t_buffer; - resobj->str.needfree = 1; - len = strlen(obj->str.string) + strlen(tmpobj2->str.string) + 1; - if (len > 0) { - resobj->str.string = memman_alloc_flexsize(aml_memman, len); - if (resobj->str.string == NULL) { - env->stat = aml_stat_panic; - return (NULL); - } - strncpy(resobj->str.string, obj->str.string, len); - strcat(resobj->str.string, tmpobj->str.string); - } else { - resobj->str.string = NULL; - } - aml_free_object(&tmpobj2); - aml_store_to_name(env, resobj, destname); - return (&env->tempname); -} - -static struct aml_name * -aml_parse_concatop(struct aml_environ *env, int indent) -{ - union aml_object *obj, *tmpobj; - struct aml_name *aname; - - AML_DEBUGPRINT("Concat("); - obj = aml_eval_name(env, aml_parse_termobj(env, indent)); - AML_DEBUGPRINT(", "); - switch (obj->type) { - case aml_t_num: - aname = aml_parse_concat_number(env, aml_objtonum(env, obj), indent); - break; - - case aml_t_buffer: - /* obj may be temporal object */ - AML_COPY_OBJECT(tmpobj, env, obj, NULL); - aname = aml_parse_concat_buffer(env, obj, indent); - aml_free_object(&tmpobj); - break; - - case aml_t_string: - /* obj may be temporal object */ - AML_COPY_OBJECT(tmpobj, env, obj, NULL); - aname = aml_parse_concat_string(env, obj, indent); - aml_free_object(&tmpobj); - break; - - default: - env->stat = aml_stat_panic; - aname = NULL; - break; - } - - AML_DEBUGPRINT("\n"); - return (aname); -} - -static union aml_object * -aml_parse_defpackage(struct aml_environ *env, int indent) -{ - u_int8_t numelements; - u_int8_t *start; - u_int32_t pkglength; - int i; - struct aml_environ *copy; - struct aml_name *tmpname; - union aml_object *obj, **objects; - - start = env->dp; - pkglength = aml_parse_pkglength(env); - numelements = aml_parse_bytedata(env); - copy = memman_alloc(aml_memman, memid_aml_environ); - if (copy == NULL) { - env->stat = aml_stat_panic; - return (NULL); - } - if (numelements > 0) { - objects = memman_alloc_flexsize(aml_memman, - numelements * sizeof(union aml_object *)); - if (objects == NULL) { - env->stat = aml_stat_panic; - return (NULL); - } else { - bzero(objects, numelements * sizeof(union aml_object *)); - } - } else { - objects = NULL; - } - - *copy = *env; - env->dp = copy->end = start + pkglength; - AML_DEBUGPRINT("Package() {\n"); - i = 0; - while ((copy->dp < copy->end) && (i < numelements)) { - aml_print_indent(indent + 1); - tmpname = aml_parse_termobj(copy, indent + 1); - - if (tmpname != NULL) { - objects[i] = aml_copy_object(copy, tmpname->property); - } - AML_DEBUGPRINT(",\n"); - i++; - } - aml_free_objectcontent(©->tempobject); - - aml_print_indent(indent); - AML_DEBUGPRINT("}"); - obj = &env->tempobject; - obj->type = aml_t_package; - obj->package.elements = numelements; - obj->package.objects = objects; - - memman_free(aml_memman, memid_aml_environ, copy); - return (obj); -} - -static void -aml_parse_defmethod(struct aml_environ *env, int indent) -{ - u_int8_t flags; - u_int8_t *start; - u_int32_t pkglength; - char *name; - struct aml_environ *copy; - struct aml_method *meth; - struct aml_name *aname; - union aml_object *aobj; - - start = env->dp; - pkglength = aml_parse_pkglength(env); - copy = memman_alloc(aml_memman, memid_aml_environ); - if (copy == NULL) { - env->stat = aml_stat_panic; - return; - } - AML_DEBUGPRINT("Method("); - name = aml_parse_namestring(env); - aml_print_namestring(name); - AML_CREATE_NAME(aname, env, name,); - if (aname->property != NULL) { - env->stat = aml_stat_panic; - AML_DEBUGPRINT("Already Defined \n"); - goto out; - } - AML_ALLOC_OBJECT(aobj, env, aml_t_method,); - meth = &aobj->meth; - aname->property = aobj; - flags = *env->dp++; - - if (flags) { - AML_DEBUGPRINT(", %d", flags); - } - AML_DEBUGPRINT(") {\n"); - *copy = *env; - meth->argnum = flags; - meth->from = env->dp; - meth->to = env->dp = copy->end = start + pkglength; - aml_print_indent(indent); - AML_DEBUGPRINT("}"); -out: - memman_free(aml_memman, memid_aml_environ, copy); -} - -static void -aml_parse_defopregion(struct aml_environ *env, int indent) -{ - u_int8_t *name; - struct aml_name *aname; - struct aml_opregion *opregion; - union aml_object *obj; - const char *regions[] = { - "SystemMemory", - "SystemIO", - "PCI_Config", - "EmbeddedControl", - "SMBus", - }; - - AML_DEBUGPRINT("OperationRegion("); - /* Name */ - name = aml_parse_namestring(env); - aml_print_namestring(name); - AML_CREATE_NAME(aname, env, name,); - if (aname->property != NULL) { - env->stat = aml_stat_panic; - AML_DEBUGPRINT("Already Defined \n"); - return; - } - AML_ALLOC_OBJECT(aname->property, env, aml_t_opregion,); - opregion = &aname->property->opregion; - opregion->space = *env->dp; - AML_DEBUGPRINT(", %s, ", regions[*env->dp]); /* Space */ - env->dp++; - obj = aml_eval_name(env, aml_parse_termobj(env, indent)); /* Offset */ - opregion->offset = aml_objtonum(env, obj); - AML_DEBUGPRINT(", "); - obj = aml_eval_name(env, aml_parse_termobj(env, indent)); /* Length */ - opregion->length = aml_objtonum(env, obj); - AML_DEBUGPRINT(")"); -} - -static const char *accessnames[] = { - "AnyAcc", - "ByteAcc", - "WordAcc", - "DWordAcc", - "BlockAcc", - "SMBSendRecvAcc", - "SMBQuickAcc" -}; - -static int -aml_parse_field(struct aml_environ *env, struct aml_field *template) -{ - u_int8_t *name; - u_int8_t access, attribute; - u_int32_t width; - struct aml_name *aname; - struct aml_field *prop; - - switch (*env->dp) { - case '\\': - case '^': - case 'A'...'Z': - case '_': - case '.': - name = aml_parse_namestring(env); - width = aml_parse_pkglength(env); - template->bitlen = width; - aml_print_namestring(name); - AML_CREATE_NAME(aname, env, name, NULL); - /* Allignment */ - if (width == 16) { - template->bitoffset += 15; - template->bitoffset &= (~15); - } - if (width == 32) { - template->bitoffset += 31; - template->bitoffset &= (~31); - } else if ((width & 7) == 0) { - template->bitoffset += 7; - template->bitoffset &= (~7); - } else if ((width > 32) && (width & 7) != 0) { - AML_DEBUGPRINT("??? Can I treat it?\n"); - } - if (aname->property != NULL) { - env->stat = aml_stat_panic; - AML_DEBUGPRINT("Already Defined \n"); - return (NULL); - } - AML_ALLOC_OBJECT(aname->property, env, aml_t_field, NULL); - prop = &aname->property->field; - *prop = *template; - template->bitoffset += width; - AML_DEBUGPRINT(",\t%d", width); - break; - case 0x00: - env->dp++; - width = aml_parse_pkglength(env); - template->bitoffset += width; - AML_DEBUGPRINT("Offset(0x%x)", template->bitoffset); - break; - case 0x01: - access = env->dp[1]; - attribute = env->dp[2]; - env->dp += 3; - AML_DEBUGPRINT("AccessAs(%s, %d)", accessnames[access], attribute); - template->bitoffset = attribute; - template->flags = (template->flags | 0xf0) | access; - break; - } - return (template->bitoffset); -} - -static void -aml_parse_fieldlist(struct aml_environ *env, struct aml_field *template, - int indent) -{ - u_int32_t offset; - - offset = 0; - while (env->dp < env->end) { - aml_print_indent(indent); - offset = aml_parse_field(env, template); - if (env->dp < env->end) { - AML_DEBUGPRINT(",\n"); - } else { - AML_DEBUGPRINT("\n"); - } - } -} - -static void -aml_parse_deffield(struct aml_environ *env, int indent) -{ - u_int8_t flags; - u_int8_t *start, *name; - u_int32_t pkglength; - struct aml_environ *copy; - struct aml_field fieldtemplate; - static const char *lockrules[] = {"NoLock", "Lock"}; - static const char *updaterules[] = {"Preserve", "WriteAsOnes", - "WriteAsZeros", "*Error*"}; - - start = env->dp; - pkglength = aml_parse_pkglength(env); - copy = memman_alloc(aml_memman, memid_aml_environ); - if (copy == NULL) { - env->stat = aml_stat_panic; - return; - } - AML_DEBUGPRINT("Field("); - aml_print_namestring(name = aml_parse_namestring(env)); - fieldtemplate.type = aml_t_field; - flags = aml_parse_bytedata(env); - fieldtemplate.flags = fieldtemplate.flags = flags; - - *copy = *env; - env->dp = copy->end = start + pkglength; - fieldtemplate.bitoffset = 0; - fieldtemplate.bitlen = 0; - fieldtemplate.f.ftype = f_t_field; - fieldtemplate.f.fld.regname = name; - AML_DEBUGPRINT(", %s, %s, %s) {\n", - accessnames[flags & 0xf], - lockrules[(flags >> 4) & 1], - updaterules[(flags >> 5) & 3]); - aml_parse_fieldlist(copy, &fieldtemplate, indent + 1); - aml_print_indent(indent); - AML_DEBUGPRINT("}"); - aml_free_objectcontent(©->tempobject); - - AML_SYSASSERT(copy->dp == copy->end); - memman_free(aml_memman, memid_aml_environ, copy); -} - -static void -aml_parse_defindexfield(struct aml_environ *env, int indent) -{ - u_int8_t flags; - u_int8_t *start, *iname, *dname; - u_int32_t pkglength; - struct aml_environ *copy; - struct aml_field template; - static const char *lockrules[] = {"NoLock", "Lock"}; - static const char *updaterules[] = {"Preserve", "WriteAsOnes", - "WriteAsZeros", "*Error*"}; - - start = env->dp; - pkglength = aml_parse_pkglength(env); - copy = memman_alloc(aml_memman, memid_aml_environ); - if (copy == NULL) { - env->stat = aml_stat_panic; - return; - } - AML_DEBUGPRINT("IndexField("); - aml_print_namestring(iname = aml_parse_namestring(env)); /* Name1 */ - AML_DEBUGPRINT(", "); - aml_print_namestring(dname = aml_parse_namestring(env)); /* Name2 */ - template.type = aml_t_field; - template.flags = flags = aml_parse_bytedata(env); - template.bitoffset = 0; - template.bitlen = 0; - template.f.ftype = f_t_index; - template.f.ifld.indexname = iname; - template.f.ifld.dataname = dname; - AML_DEBUGPRINT(", %s, %s, %s) {\n", - accessnames[flags & 0xf], - lockrules[(flags >> 4) & 1], - updaterules[(flags >> 5) & 3]); - *copy = *env; - env->dp = copy->end = start + pkglength; - aml_parse_fieldlist(copy, &template, indent + 1); - aml_print_indent(indent); - AML_DEBUGPRINT("}"); - aml_free_objectcontent(©->tempobject); - - AML_SYSASSERT(copy->dp == copy->end); - memman_free(aml_memman, memid_aml_environ, copy); -} - -static void -aml_parse_defbankfield(struct aml_environ *env, int indent) -{ - u_int8_t flags; - u_int8_t *start, *rname, *bname; - u_int32_t pkglength, bankvalue; - struct aml_environ *copy; - struct aml_field template; - union aml_object *obj; - static const char *lockrules[] = {"NoLock", "Lock"}; - static const char *updaterules[] = {"Preserve", "WriteAsOnes", - "WriteAsZeros", "*Error*"}; - - start = env->dp; - pkglength = aml_parse_pkglength(env); - copy = memman_alloc(aml_memman, memid_aml_environ); - if (copy == NULL) { - env->stat = aml_stat_panic; - return; - } - AML_DEBUGPRINT("BankField("); - aml_print_namestring(rname = aml_parse_namestring(env)); /* Name1 */ - AML_DEBUGPRINT(", "); - aml_print_namestring(bname = aml_parse_namestring(env)); /* Name2 */ - AML_DEBUGPRINT(", "); - obj = aml_eval_name(env, aml_parse_termobj(env, indent)); /* BankValue */ - bankvalue = aml_objtonum(env, obj); - template.type = aml_t_field; - template.flags = flags = aml_parse_bytedata(env); - template.bitoffset = 0; - template.bitlen = 0; - template.f.ftype = f_t_bank; - template.f.bfld.regname = rname; - template.f.bfld.bankname = bname; - template.f.bfld.bankvalue = bankvalue; - *copy = *env; - env->dp = copy->end = start + pkglength; - AML_DEBUGPRINT(", %s, %s, %s) {\n", - accessnames[flags & 0xf], - lockrules[(flags >> 4) & 1], - updaterules[(flags >> 5) & 3]); - aml_parse_fieldlist(copy, &template, indent + 1); - aml_print_indent(indent); - AML_DEBUGPRINT("}"); - - aml_free_objectcontent(©->tempobject); - AML_SYSASSERT(copy->dp == copy->end); - memman_free(aml_memman, memid_aml_environ, copy); -} - -static void -aml_parse_defdevice(struct aml_environ *env, int indent) -{ - u_int8_t *start; - u_int8_t *name; - u_int32_t pkglength; - struct aml_environ *copy; - - start = env->dp; - pkglength = aml_parse_pkglength(env); - copy = memman_alloc(aml_memman, memid_aml_environ); - if (copy == NULL) { - env->stat = aml_stat_panic; - return; - } - AML_DEBUGPRINT("Device("); - name = aml_parse_namestring(env); - aml_print_namestring(name); - AML_DEBUGPRINT(") {\n"); - *copy = *env; - AML_CREATE_NAME(copy->curname, env, name,); - if (copy->curname->property != NULL) { - env->stat = aml_stat_panic; - AML_DEBUGPRINT("Already Defined \n"); - goto out; - } - AML_ALLOC_OBJECT(copy->curname->property, env, aml_t_device,); - env->dp = copy->end = start + pkglength; - aml_parse_objectlist(copy, indent + 1); - aml_print_indent(indent); - AML_DEBUGPRINT("}"); - aml_free_objectcontent(©->tempobject); - - AML_SYSASSERT(copy->dp == copy->end); -out: - memman_free(aml_memman, memid_aml_environ, copy); -} - -static void -aml_parse_defprocessor(struct aml_environ *env, int indent) -{ - u_int8_t *start; - u_int8_t *name; - u_int32_t pkglength; - struct aml_environ *copy; - struct aml_processor *proc; - union aml_object *obj; - - start = env->dp; - pkglength = aml_parse_pkglength(env); - copy = memman_alloc(aml_memman, memid_aml_environ); - if (copy == NULL) { - env->stat = aml_stat_panic; - return; - } - AML_ALLOC_OBJECT(obj, env, aml_t_processor,); - proc = &obj->proc; - AML_DEBUGPRINT("Processor("); - name = aml_parse_namestring(env); - aml_print_namestring(name); - proc->id = aml_parse_bytedata(env); - proc->addr = aml_parse_dworddata(env); - proc->len = aml_parse_bytedata(env); - AML_DEBUGPRINT(", %d, 0x%x, 0x%x) {\n", proc->id, proc->addr, proc->len); - *copy = *env; - AML_CREATE_NAME(copy->curname, env, name,); - if (copy->curname->property != NULL) { - env->stat = aml_stat_panic; - AML_DEBUGPRINT("Already Defined \n"); - goto out; - } - copy->curname->property = obj; - env->dp = copy->end = start + pkglength; - aml_parse_objectlist(copy, indent + 1); - aml_print_indent(indent); - AML_DEBUGPRINT("}"); - aml_free_objectcontent(©->tempobject); - - AML_SYSASSERT(copy->dp == copy->end); -out: - memman_free(aml_memman, memid_aml_environ, copy); -} - -static void -aml_parse_defpowerres(struct aml_environ *env, int indent) -{ - u_int8_t *start; - u_int8_t *name; - u_int32_t pkglength; - struct aml_environ *copy; - struct aml_powerres *pres; - union aml_object *obj; - - start = env->dp; - pkglength = aml_parse_pkglength(env); - copy = memman_alloc(aml_memman, memid_aml_environ); - if (copy == NULL) { - env->stat = aml_stat_panic; - return; - } - AML_DEBUGPRINT("PowerResource("); - AML_ALLOC_OBJECT(obj, env, aml_t_powerres,); - name = aml_parse_namestring(env); - aml_print_namestring(name); - pres = &obj->pres; - pres->level = aml_parse_bytedata(env); - pres->order = aml_parse_worddata(env); - AML_DEBUGPRINT(", %d, %d) {\n", pres->level, pres->order); - *copy = *env; - AML_CREATE_NAME(copy->curname, env, name,); - if (copy->curname->property != NULL) { - env->stat = aml_stat_panic; - AML_DEBUGPRINT("Already Defined \n"); - goto out; - } - copy->curname->property = obj; - env->dp = copy->end = start + pkglength; - - aml_parse_objectlist(copy, indent + 1); - aml_print_indent(indent); - AML_DEBUGPRINT("}"); - aml_free_objectcontent(©->tempobject); - - AML_SYSASSERT(copy->dp == copy->end); -out: - memman_free(aml_memman, memid_aml_environ, copy); -} - -static void -aml_parse_defthermalzone(struct aml_environ *env, int indent) -{ - u_int8_t *start; - u_int8_t *name; - u_int32_t pkglength; - struct aml_environ *copy; - - start = env->dp; - pkglength = aml_parse_pkglength(env); - copy = memman_alloc(aml_memman, memid_aml_environ); - if (copy == NULL) { - env->stat = aml_stat_panic; - return; - } - AML_DEBUGPRINT("ThermalZone("); - name = aml_parse_namestring(env); - aml_print_namestring(name); - AML_DEBUGPRINT(") {\n"); - *copy = *env; - AML_CREATE_NAME(copy->curname, env, name,); - if (copy->curname->property != NULL) { - env->stat = aml_stat_panic; - AML_DEBUGPRINT("Already Defined \n"); - goto out; - } - AML_ALLOC_OBJECT(copy->curname->property, env, aml_t_therm,); - env->dp = copy->end = start + pkglength; - aml_parse_objectlist(copy, indent + 1); - aml_print_indent(indent); - AML_DEBUGPRINT("}"); - aml_free_objectcontent(©->tempobject); - AML_SYSASSERT(copy->dp == copy->end); -out: - memman_free(aml_memman, memid_aml_environ, copy); -} - -static struct aml_name * -aml_parse_defelse(struct aml_environ *env, int indent, int num) -{ - u_int8_t *start, *end, *oend; - u_int32_t pkglength; - struct aml_name *aname; - - start = env->dp; - pkglength = aml_parse_pkglength(env); - oend = env->end; - env->end = end = start + pkglength; - aname = NULL; - - AML_DEBUGPRINT("Else {\n"); - if (num == 0) { - aname = aml_parse_objectlist(env, indent + 1); - aml_print_indent(indent); - } - AML_DEBUGPRINT("}"); - - env->dp = end; - env->end = oend; - return (aname); -} - -static struct aml_name * -aml_parse_defif(struct aml_environ *env, int indent) -{ - u_int8_t *start, *end, *oend; - u_int32_t pkglength; - int num; - struct aml_name *aname, *aname1; - - start = env->dp; - pkglength = aml_parse_pkglength(env); - aname = NULL; - - AML_DEBUGPRINT("If("); - num = aml_objtonum(env, aml_eval_name - (env, aml_parse_termobj(env, indent))); - oend = env->end; - end = start + pkglength; - AML_DEBUGPRINT(")"); - if (num) { - AML_DEBUGPRINT("{\n"); - env->end = end; - aname = aml_parse_objectlist(env, indent + 1); - aml_print_indent(indent); - AML_DEBUGPRINT("}"); - } - env->dp = end; - env->end = oend; - if ((end < oend) && *(env->dp) == 0xa1) { - env->dp++; - aname1 = aml_parse_defelse(env, indent, num); - aname = (num == 0) ? aname1 : aname; - } - return (aname); -} - -static struct aml_name * -aml_parse_defwhile(struct aml_environ *env, int indent) -{ - u_int8_t *start, *end, *oend; - u_int32_t pkglength; - int num; - struct aml_name *aname; - - start = env->dp; - pkglength = aml_parse_pkglength(env); - oend = env->end; - end = start + pkglength; - aname = NULL; - for (;;) { - env->dp = start; - aml_parse_pkglength(env); - AML_DEBUGPRINT("While("); - num = aml_objtonum(env, aml_eval_name - (env, aml_parse_termobj(env, indent))); - AML_DEBUGPRINT(")"); - if (num == 0) { - break; - } - AML_DEBUGPRINT(" {\n"); - env->end = end; - aname = aml_parse_objectlist(env, indent + 1); - if (env->stat == aml_stat_step) { - AML_DEBUGGER(env, env); - continue; - } - if (env->stat != aml_stat_none) - break; - aml_print_indent(indent); - AML_DEBUGPRINT("}"); - } - AML_DEBUGPRINT("\n"); - env->dp = end; - env->end = oend; - if (env->stat == aml_stat_break) { - env->stat = aml_stat_none; - aname = NULL; - } - return (aname); -} - -static void -aml_parse_defmutex(struct aml_environ *env, int indent) -{ - char *name; - struct aml_name *aname; - struct aml_mutex *mut; - - /* MutexOp */ - AML_DEBUGPRINT("Mutex("); - name = aml_parse_namestring(env); - aml_print_namestring(name); - AML_CREATE_NAME(aname, env, name,); - if (aname->property != NULL) { - env->stat = aml_stat_panic; - AML_DEBUGPRINT("Already Defined \n"); - return; - } - AML_ALLOC_OBJECT(aname->property, env, aml_t_mutex,); - mut = &aname->property->mutex; - mut->level = *env->dp++; - STAILQ_INIT(&mut->queue); - AML_DEBUGPRINT(", %d)", mut->level); -} - -static void -aml_createfield_generic(struct aml_environ *env, - union aml_object *srcbuf, int index, - int len, char *newname) -{ - struct aml_bufferfield *field; - struct aml_name *aname; - - if (srcbuf == NULL || srcbuf->type != aml_t_buffer) { - AML_DEBUGPRINT("Not Buffer assigned,"); - env->stat = aml_stat_panic; - return; - } - AML_CREATE_NAME(aname, env, newname,); - if (aname->property != NULL) { - env->stat = aml_stat_panic; - AML_DEBUGPRINT("Already Defined \n"); - return; - } - AML_ALLOC_OBJECT(aname->property, env, aml_t_bufferfield,); - field = &aname->property->bfld; - field->bitoffset = index; - field->bitlen = len; - field->origin = srcbuf->buffer.data; -} - -static void -aml_parse_defcreatefield(struct aml_environ *env, int indent) -{ - int index, len; - char *newname; - union aml_object *obj, *srcbuf; - - /* CreateFieldOp */ - AML_DEBUGPRINT("CreateField("); - srcbuf = aml_eval_name(env, aml_parse_termobj(env, indent)); - if (srcbuf == &env->tempobject) { - AML_DEBUGPRINT("NONAMED BUFFER\n"); - env->stat = aml_stat_panic; - return; - } - AML_DEBUGPRINT(", "); - obj = aml_eval_name(env, aml_parse_termobj(env, indent)); - index = aml_objtonum(env, obj); - AML_DEBUGPRINT(", "); - obj = aml_eval_name(env, aml_parse_termobj(env, indent)); - len = aml_objtonum(env, obj); - AML_DEBUGPRINT(", "); - newname = aml_parse_namestring(env); - aml_print_namestring(newname); - aml_createfield_generic(env, srcbuf, index, len, newname); - AML_DEBUGPRINT(") "); -} - -/* - * Returns Named object or parser buffer. The object need not be free because - * it returns preallocated buffer in env or Contain of named object. If You - * need to preserve object, create a copy and then store. And The object - * returned from this function is not valid after another call is - * shared, tempolary buffer may be shared. - */ -struct aml_name * -aml_parse_termobj(struct aml_environ *env, int indent) -{ - u_int8_t opcode; - u_int8_t *name; - int value; - int num1, num2; - int len; - int match1, match2, i, pkgval, start; - int widthindex, index; - char *newname; - struct aml_name *aname; - struct aml_name *destname1, *destname2; - struct aml_name *tmpname, *srcname; - struct aml_name *src; - union aml_object *ret; - union aml_object *tmpobj; - union aml_object anum; - union aml_object *objref; - union aml_object *srcobj; - union aml_object *obj; - union aml_object *srcbuf; - static int widthtbl[4] = {32, 16, 8, 1}; - const char *opname[4] = {"CreateDWordField", "CreateWordField", - "CreateByteField", "CreateBitField"}; - - aname = &env->tempname; - ret = &env->tempobject; - anum.type = aml_t_num; - aname->property = ret; - aml_free_objectcontent(ret); - if (env->stat == aml_stat_panic) { - /* - * If previosuly parser panic , parsing next instruction is - * prohibited. - */ - return (NULL); - } - aname = NULL; - opcode = *env->dp++; - switch (opcode) { - case '\\': - case '^': - case 'A' ... 'Z': - case '_': - case '.': - env->dp--; - ret->type = aml_t_namestr; - ret->nstr.dp = aml_parse_namestring(env); - aml_print_namestring(ret->nstr.dp); - aname = &env->tempname; - break; - case 0x0a: /* BytePrefix */ - ret->type = aml_t_num; - value = aml_parse_bytedata(env); - ret->num.number = value; - AML_DEBUGPRINT("0x%x", value); - aname = &env->tempname; - break; - case 0x0b: /* WordPrefix */ - ret->type = aml_t_num; - value = aml_parse_worddata(env); - ret->num.number = value; - AML_DEBUGPRINT("0x%x", value); - aname = &env->tempname; - break; - case 0x0c: /* DWordPrefix */ - ret->type = aml_t_num; - value = aml_parse_dworddata(env); - ret->num.number = value; - AML_DEBUGPRINT("0x%x", value); - aname = &env->tempname; - break; - case 0x0d: /* StringPrefix */ - ret->type = aml_t_string; - ret->str.string = env->dp; - len = strlen(env->dp); - ret->str.needfree = 0; - AML_DEBUGPRINT("\"%s\"", (const char *)ret->str.string); - env->dp += (len + 1); - aname = &env->tempname; - break; - case 0x00: /* ZeroOp */ - ret->type = aml_t_num; - ret->num.number = 0; - ret->num.constant = 1; - AML_DEBUGPRINT("Zero"); - aname = &env->tempname; - break; - case 0x01: /* OneOp */ - ret->type = aml_t_num; - ret->num.number = 1; - ret->num.constant = 1; - AML_DEBUGPRINT("One"); - aname = &env->tempname; - break; - case 0xff: /* OnesOp */ - ret->type = aml_t_num; - ret->num.number = 0xffffffff; - ret->num.constant = 1; - AML_DEBUGPRINT("Ones"); - aname = &env->tempname; - break; - case 0x06: /* AliasOp */ - AML_DEBUGPRINT("Alias("); - tmpname = aml_parse_termobj(env, indent); - if (env->stat == aml_stat_panic) { - return (NULL); - } - if (tmpname->property == NULL || - tmpname->property->type != aml_t_namestr) { - env->stat = aml_stat_panic; - return (NULL); - } - /* - * XXX if srcname is deleted after this object, what - * shall I do? - */ - srcname = aml_search_name(env, tmpname->property->nstr.dp); - AML_DEBUGPRINT(", "); - name = aml_parse_namestring(env); - aml_print_namestring(name); - AML_CREATE_NAME(aname, env, name, NULL); - if (aname->property != NULL) { - env->stat = aml_stat_panic; - AML_DEBUGPRINT("Already Defined \n"); - aml_print_curname(aname); - return (NULL); - } - AML_ALLOC_OBJECT(aname->property, env, aml_t_objref, NULL); - objref = aname->property; - objref->objref.nameref = srcname; - objref->objref.ref = srcname->property; - objref->objref.offset = -1; - objref->objref.alias = 1; /* Yes, this is an alias */ - AML_DEBUGPRINT(")"); - /* shut the interpreter up during the namespace initializing */ - return (NULL); - case 0x08: /* NameOp */ - AML_DEBUGPRINT("Name("); - name = aml_parse_namestring(env); - aml_print_namestring(name); - AML_CREATE_NAME(aname, env, name, NULL); - if (env->stat == aml_stat_panic) { - AML_DEBUGPRINT("Already Defined \n"); - aml_print_curname(aname); - return (NULL); - } - AML_DEBUGPRINT(", "); - AML_COPY_OBJECT(aname->property, env, - aml_eval_name(env, - aml_parse_termobj(env, indent)), - NULL); - AML_DEBUGPRINT(")"); - break; - case 0x10: /* ScopeOp */ - aml_parse_defscope(env, indent); - break; - case 0x11: /* BufferOp */ - aname = &env->tempname; - aname->property = aml_parse_defbuffer(env, indent); - break; - case 0x12: /* PackageOp */ - aname = &env->tempname; - aname->property = aml_parse_defpackage(env, indent); - break; - case 0x14: /* MethodOp */ - aml_parse_defmethod(env, indent); - break; - case 0x5b: /* ExtOpPrefix */ - opcode = *env->dp++; - switch (opcode) { - case 0x01: - aml_parse_defmutex(env, indent); - break; - case 0x02: /* EventOp */ - AML_DEBUGPRINT("Event("); - name = aml_parse_namestring(env); - aml_print_namestring(name); - AML_CREATE_NAME(aname, env, name, NULL); - if (aname->property != NULL) { - env->stat = aml_stat_panic; - AML_DEBUGPRINT("Already Defined \n"); - return (NULL); - } - AML_ALLOC_OBJECT(aname->property, env, aml_t_event, NULL); - AML_DEBUGPRINT(")"); - return (NULL); - break; - case 0x12: /* CondRefOfOp */ - AML_DEBUGPRINT("CondRefOf("); - src = aml_parse_termobj(env, indent); - AML_DEBUGPRINT(", "); - if (src == &env->tempname || src == NULL) { - aml_parse_termobj(env, indent); - AML_DEBUGPRINT(")"); - anum.num.number = 0xffffffff; - env->tempobject.num = anum.num; - aname = &env->tempname; - break; - } - AML_ALLOC_OBJECT(objref, env, aml_t_objref, NULL); - if (src->property == NULL || - src->property->type != aml_t_namestr) { - objref->objref.nameref = src; - } else { - objref->objref.nameref = aml_create_local_object(); - } - objref->objref.ref = src->property; - objref->objref.offset = -1; /* different from IndexOp */ - - destname1 = aml_parse_termobj(env, indent); - aml_store_to_name(env, objref, destname1); - anum.num.number = 0; - env->tempobject.num = anum.num; - aname = &env->tempname; - AML_DEBUGPRINT(")"); - break; - case 0x13: - aml_parse_defcreatefield(env, indent); - break; - case 0x20: /* LoadOp *//* XXX Not Impremented */ - AML_DEBUGPRINT("Load("); - aml_parse_termobj(env, indent); - AML_DEBUGPRINT(", "); - aml_parse_termobj(env, indent); - AML_DEBUGPRINT(")"); - break; - case 0x21: /* StallOp */ - AML_DEBUGPRINT("Stall("); - num1 = aml_objtonum(env, aml_eval_name(env, - aml_parse_termobj(env, indent))); - AML_DEBUGPRINT(")"); - AML_STALL(num1); - break; - case 0x22: /* SleepOp */ - AML_DEBUGPRINT("Sleep("); - num1 = aml_objtonum(env, aml_eval_name(env, - aml_parse_termobj(env, indent))); - AML_SLEEP(0, num1); - AML_DEBUGPRINT(")"); - break; - case 0x23: /* AcquireOp *//* XXX Not yet */ - AML_DEBUGPRINT("Acquire("); - aml_parse_termobj(env, indent); - AML_DEBUGPRINT(", 0x%x)", aml_parse_worddata(env)); - break; - case 0x24: /* SignalOp *//* XXX Not yet */ - AML_DEBUGPRINT("Signal("); - aml_parse_termobj(env, indent); - AML_DEBUGPRINT(")"); - break; - case 0x25: /* WaitOp *//* XXX Not yet impremented */ - AML_DEBUGPRINT("Wait("); - aml_parse_termobj(env, indent); - AML_DEBUGPRINT(", "); - aml_parse_termobj(env, indent); - AML_DEBUGPRINT(")"); - break; - case 0x26: /* ResetOp *//* XXX Not yet impremented */ - AML_DEBUGPRINT("Reset("); - aml_parse_termobj(env, indent); - AML_DEBUGPRINT(")"); - break; - case 0x27: /* ReleaseOp *//* XXX Not yet impremented */ - AML_DEBUGPRINT("Release("); - aml_parse_termobj(env, indent); - AML_DEBUGPRINT(")"); - break; -#define NUMOP2(opname, operation) do { \ - AML_DEBUGPRINT(opname); \ - AML_DEBUGPRINT("("); \ - num1 = aml_objtonum(env, aml_eval_name(env, \ - aml_parse_termobj(env, indent))); \ - AML_DEBUGPRINT(", "); \ - anum.num.number = operation (num1); \ - destname1 = aml_parse_termobj(env, indent); \ - AML_DEBUGPRINT(")"); \ - aml_store_to_name(env, &anum, destname1); \ - env->tempobject.num = anum.num; \ - env->tempname.property = &env->tempobject; \ - aname = &env->tempname; \ -} while(0) - - case 0x28: /* FromBCDOp */ - NUMOP2("FromBCD", frombcd); - break; - case 0x29: /* ToBCDOp */ - NUMOP2("ToBCD", tobcd); - break; - case 0x2a: /* UnloadOp *//* XXX Not yet impremented */ - AML_DEBUGPRINT("Unload("); - aml_parse_termobj(env, indent); - AML_DEBUGPRINT(")"); - break; - case 0x30: - env->tempobject.type = aml_t_num; - env->tempobject.num.number = 0; - env->tempobject.num.constant = 1; - AML_DEBUGPRINT("Revision"); - break; - case 0x31: - env->tempobject.type = aml_t_debug; - aname = &env->tempname; - AML_DEBUGPRINT("Debug"); - break; - case 0x32: /* FatalOp */ - AML_DEBUGPRINT("Fatal("); - AML_DEBUGPRINT("0x%x, ", aml_parse_bytedata(env)); - AML_DEBUGPRINT("0x%x, ", aml_parse_dworddata(env)); - aml_parse_termobj(env, indent); - env->stat = aml_stat_panic; - AML_DEBUGPRINT(")"); - break; - case 0x80: /* OpRegionOp */ - aml_parse_defopregion(env, indent); - break; - case 0x81: /* FieldOp */ - aml_parse_deffield(env, indent); - break; - case 0x82: /* DeviceOp */ - aml_parse_defdevice(env, indent); - break; - case 0x83: /* ProcessorOp */ - aml_parse_defprocessor(env, indent); - break; - case 0x84: /* PowerResOp */ - aml_parse_defpowerres(env, indent); - break; - case 0x85: /* ThermalZoneOp */ - aml_parse_defthermalzone(env, indent); - break; - case 0x86: /* IndexFieldOp */ - aml_parse_defindexfield(env, indent); - break; - case 0x87: /* BankFieldOp */ - aml_parse_defbankfield(env, indent); - break; - default: - AML_SYSERRX(1, "strange opcode 0x5b, 0x%x\n", opcode); - AML_SYSABORT(); - } - break; - case 0x68 ... 0x6e: /* ArgN */ - AML_DEBUGPRINT("Arg%d", opcode - 0x68); - return (aml_local_stack_getArgX(NULL, opcode - 0x68)); - break; - case 0x60 ... 0x67: - AML_DEBUGPRINT("Local%d", opcode - 0x60); - return (aml_local_stack_getLocalX(opcode - 0x60)); - break; - case 0x70: /* StoreOp */ - AML_DEBUGPRINT("Store("); - aname = aml_create_local_object(); - AML_COPY_OBJECT(tmpobj, env, - aml_eval_name(env, aml_parse_termobj(env, indent)), NULL); - aname->property = tmpobj; - AML_DEBUGPRINT(", "); - destname1 = aml_parse_termobj(env, indent); - AML_DEBUGPRINT(")"); - /* XXX - * temporary object may change during aml_store_to_name() - * operation, so we make a copy of it on stack. - */ - if (destname1 == &env->tempname && - destname1->property == &env->tempobject) { - destname1 = aml_create_local_object(); - AML_COPY_OBJECT(destname1->property, env, - &env->tempobject, NULL); - } - aml_store_to_name(env, tmpobj, destname1); - if (env->stat == aml_stat_panic) { - AML_DEBUGPRINT("StoreOp failed"); - return (NULL); - } - aname = aml_create_local_object(); - AML_COPY_OBJECT(tmpobj, env, destname1->property, NULL); - aname->property = tmpobj; - if (tmpobj == NULL) { - printf("???"); - break; - } - break; - case 0x71: /* RefOfOp */ - AML_DEBUGPRINT("RefOf("); - src = aml_parse_termobj(env, indent); - AML_DEBUGPRINT(")"); - - aname = aml_create_local_object(); - AML_ALLOC_OBJECT(aname->property, env, aml_t_objref, NULL); - objref = aname->property; - if (src->property == NULL || - src->property->type != aml_t_namestr) { - objref->objref.nameref = src; - } else { - objref->objref.nameref = aml_create_local_object(); - } - objref->objref.ref = src->property; - objref->objref.offset = -1; /* different from IndexOp */ - break; - -#define NUMOP3_2(opname, oparation, ope2) do { \ - AML_DEBUGPRINT(opname); \ - AML_DEBUGPRINT("("); \ - num1 = aml_objtonum(env, aml_eval_name(env, \ - aml_parse_termobj(env, indent))); \ - AML_DEBUGPRINT(", "); \ - num2 = aml_objtonum(env, aml_eval_name(env, \ - aml_parse_termobj(env, indent))); \ - AML_DEBUGPRINT(", "); \ - anum.num.number = ope2(num1 oparation num2); \ - destname1 = aml_parse_termobj(env, indent); \ - AML_DEBUGPRINT(")"); \ - aml_store_to_name(env, &anum, destname1); \ - env->tempobject.num = anum.num; \ - env->tempname.property = &env->tempobject; \ - aname = &env->tempname; \ -} while(0) - -#define NUMOP3(opname, operation) NUMOP3_2(opname, operation, ) -#define NUMOPN3(opname, operation) NUMOP3_2(opname, operation, ~) - - case 0x72: /* AddOp */ - NUMOP3("Add", +); - break; - case 0x73: /* ConcatOp */ - aname = aml_parse_concatop(env, indent); - break; - case 0x74: /* SubtractOp */ - NUMOP3("Subtract", -); - break; - case 0x75: /* IncrementOp */ - AML_DEBUGPRINT("Increment("); - aname = aml_parse_termobj(env, indent); - num1 = aml_objtonum(env, aml_eval_name(env, aname)); - num1++; - anum.num.number = num1; - AML_DEBUGPRINT(")"); - aml_store_to_name(env, &anum, aname); - aname = &env->tempname; - env->tempobject.num = anum.num; - break; - case 0x76: /* DecrementOp */ - AML_DEBUGPRINT("Decrement("); - aname = aml_parse_termobj(env, indent); - num1 = aml_objtonum(env, aml_eval_name(env, aname)); - num1--; - anum.num.number = num1; - AML_DEBUGPRINT(")"); - aml_store_to_name(env, &anum, aname); - aname = &env->tempname; - env->tempobject.num = anum.num; - break; - case 0x77: /* MultiplyOp */ - NUMOP3("Multiply", *); - break; - case 0x78: /* DivideOp */ - AML_DEBUGPRINT("Divide("); - num1 = aml_objtonum(env, aml_eval_name(env, - aml_parse_termobj(env, indent))); - AML_DEBUGPRINT(", "); - num2 = aml_objtonum(env, aml_eval_name(env, - aml_parse_termobj(env, indent))); - AML_DEBUGPRINT(", "); - anum.num.number = num1 % num2; - destname1 = aml_parse_termobj(env, indent); - aml_store_to_name(env, &anum, destname1); - AML_DEBUGPRINT(", "); - anum.num.number = num1 / num2; - destname2 = aml_parse_termobj(env, indent); - AML_DEBUGPRINT(")"); - aml_store_to_name(env, &anum, destname2); - env->tempobject.num = anum.num; - aname = &env->tempname; - break; - case 0x79: /* ShiftLeftOp */ - NUMOP3("ShiftLeft", <<); - break; - case 0x7a: /* ShiftRightOp */ - NUMOP3("ShiftRight", >>); - break; - case 0x7b: /* AndOp */ - NUMOP3("And", &); - break; - case 0x7c: /* NAndOp */ - NUMOPN3("NAnd", &); - break; - case 0x7d: /* OrOp */ - NUMOP3("Or", |); - break; - case 0x7e: /* NOrOp */ - NUMOPN3("NOr", |); - break; - case 0x7f: /* XOrOp */ - NUMOP3("XOr", ^); - break; - case 0x80: /* NotOp */ - NUMOP2("Not", ~); - break; - case 0x81: /* FindSetLeftBitOp */ - NUMOP2("FindSetLeftBit", findsetleftbit); - break; - case 0x82: /* FindSetRightBitOp */ - NUMOP2("FindSetRightBit", findsetrightbit); - break; - case 0x83: /* DerefOp */ - AML_DEBUGPRINT("DerefOf("); - objref = aml_eval_name(env, aml_parse_termobj(env, indent)); - AML_DEBUGPRINT(")"); - - if (objref->objref.ref == NULL) { - env->tempname.property = objref->objref.ref; - aname = &env->tempname; - break; - } - switch (objref->objref.ref->type) { - case aml_t_package: - case aml_t_buffer: - if (objref->objref.offset < 0) { - env->tempname.property = objref->objref.ref; - } else { - objref->objref.deref = 1; - env->tempname.property = objref; - } - break; - default: - env->tempname.property = objref->objref.ref; - break; - } - - aname = &env->tempname; - break; - case 0x86: /* NotifyOp *//* XXX Not yet impremented */ - AML_DEBUGPRINT("Notify("); - aml_parse_termobj(env, indent); - AML_DEBUGPRINT(", "); - aml_parse_termobj(env, indent); - AML_DEBUGPRINT(")"); - break; - case 0x87: /* SizeOfOp */ - AML_DEBUGPRINT("SizeOf("); - aname = aml_parse_termobj(env, indent); - tmpobj = aml_eval_name(env, aname); - - AML_DEBUGPRINT(")"); - num1 = 0; - switch (tmpobj->type) { - case aml_t_buffer: - num1 = tmpobj->buffer.size; - break; - case aml_t_string: - num1 = strlen(tmpobj->str.string); - break; - case aml_t_package: - num1 = tmpobj->package.elements; - break; - default: - AML_DEBUGPRINT("Args of SizeOf should be " - "buffer/string/package only\n"); - break; - } - - anum.num.number = num1; - env->tempobject.num = anum.num; - aname = &env->tempname; - break; - case 0x88: /* IndexOp */ - AML_DEBUGPRINT("Index("); - srcobj = aml_eval_name(env, aml_parse_termobj(env, indent)); - AML_DEBUGPRINT(", "); - num1 = aml_objtonum(env, aml_eval_name(env, - aml_parse_termobj(env, indent))); - AML_DEBUGPRINT(", "); - destname1 = aml_parse_termobj(env, indent); - AML_DEBUGPRINT(")"); - aname = aml_create_local_object(); - switch (srcobj->type) { - case aml_t_package: - case aml_t_buffer: - AML_ALLOC_OBJECT(objref, env, aml_t_objref, NULL); - aname->property = objref; - objref->objref.ref = srcobj; - objref->objref.offset = num1; - objref->objref.deref = 0; - break; - default: - AML_DEBUGPRINT("Arg0 of Index should be either " - "buffer or package\n"); - return (aname); - } - - aml_store_to_name(env, objref, destname1); - break; - case 0x89: /* MatchOp *//* XXX Not yet Impremented */ - AML_DEBUGPRINT("Match("); - AML_COPY_OBJECT(obj, env, aml_eval_name(env, - aml_parse_termobj(env, indent)), NULL); - if (obj->type != aml_t_package) { - env->stat = aml_stat_panic; - return (NULL); - } - anum.num.number = 0xffffffff; - match1 = *env->dp; - AML_DEBUGPRINT(", %d", *env->dp); - env->dp++; - num1 = aml_objtonum(env, aml_eval_name(env, - aml_parse_termobj(env, indent))); - match2 = *env->dp; - AML_DEBUGPRINT(", %d", *env->dp); - env->dp++; - num2 = aml_objtonum(env, aml_eval_name(env, - aml_parse_termobj(env, indent))); - AML_DEBUGPRINT(", "); - start = aml_objtonum(env, aml_eval_name(env, - aml_parse_termobj(env, indent))); - -#define MATCHOP(opnum, arg1, arg2) ((opnum == 0) ? (1) : \ - (opnum == 1) ? ((arg1) == (arg2)) : \ - (opnum == 2) ? ((arg1) <= (arg2)) : \ - (opnum == 3) ? ((arg1) < (arg2)) : \ - (opnum == 4) ? ((arg1) >= (arg2)) : \ - (opnum == 5) ? ((arg1) > (arg2)) : 0 ) - - for (i = start; i < obj->package.elements; i++) { - pkgval = aml_objtonum(env, obj->package.objects[i]); - if (MATCHOP(match1, pkgval, num1) && - MATCHOP(match2, pkgval, num2)) { - anum.num.number = i; - break; - } - } - AML_DEBUGPRINT(")"); - aml_free_object(&obj); - aname = &env->tempname; - env->tempname.property = &env->tempobject; - env->tempobject.num = anum.num; - break; -#undef MATCHOP - case 0x8a ... 0x8d: /* CreateDWordFieldOp */ - widthindex = *(env->dp - 1) - 0x8a; - AML_DEBUGPRINT("%s(", opname[widthindex]); - srcbuf = aml_eval_name(env, aml_parse_termobj(env, indent)); - if (srcbuf == &env->tempobject) { - AML_DEBUGPRINT("NOT NAMEDBUF\n"); - env->stat = aml_stat_panic; - return (NULL); - } - AML_DEBUGPRINT(", "); - index = aml_objtonum(env, aml_eval_name(env, - aml_parse_termobj(env, indent))); - if (widthindex != 3) { - index *= 8; - } - AML_DEBUGPRINT(", "); - newname = aml_parse_namestring(env); - aml_print_namestring(newname); - aml_createfield_generic(env, srcbuf, index, - widthtbl[widthindex], newname); - AML_DEBUGPRINT(")"); - break; - case 0x8e: /* ObjectTypeOp */ - AML_DEBUGPRINT("ObjectType("); - aname = aml_parse_termobj(env, indent); - if (aname == NULL) { - env->tempobject.type = aml_t_num; - env->tempobject.num.number = aml_t_null; - } else { - env->tempobject.type = aml_t_num; - env->tempobject.num.number = aname->property->type; - } - aname = &env->tempname; - AML_DEBUGPRINT(")"); - break; - -#define CMPOP(opname,operation) do { \ - AML_DEBUGPRINT(opname); \ - AML_DEBUGPRINT("("); \ - num1 = aml_objtonum(env, aml_eval_name(env, \ - aml_parse_termobj(env, indent))); \ - AML_DEBUGPRINT(", "); \ - num2 = aml_objtonum(env, aml_eval_name(env, \ - aml_parse_termobj(env, indent))); \ - aname = &env->tempname; \ - env->tempobject.type = aml_t_num; \ - env->tempobject.num.number = (num1 operation num2) ? 0xffffffff : 0; \ - aname->property = &env->tempobject; \ - AML_DEBUGPRINT(")"); \ -} while(0) - - case 0x90: - CMPOP("LAnd", &&); - break; - case 0x91: - CMPOP("LOr", ||); - break; - case 0x92: - AML_DEBUGPRINT("LNot("); - num1 = aml_objtonum(env, aml_eval_name(env, - aml_parse_termobj(env, indent))); - aname = &env->tempname; - env->tempobject.type = aml_t_num; - env->tempobject.num.number = (!num1) ? 0xffffffff : 0; - aname->property = &env->tempobject; - AML_DEBUGPRINT(")"); - break; - case 0x93: - CMPOP("LEqual", ==); - break; - case 0x94: - CMPOP("LGreater", >); - break; - case 0x95: - CMPOP("LLess", <); - break; - case 0xa0: /* IfOp */ - aname = aml_parse_defif(env, indent); - break; -#if 0 - - case 0xa1: /* ElseOp should not be treated in Main parser - * But If Op */ - aml_parse_defelse(env, indent); - break; -#endif - case 0xa2: /* WhileOp */ - aname = aml_parse_defwhile(env, indent); - break; - case 0xa3: /* NoopOp */ - AML_DEBUGPRINT("Noop"); - break; - case 0xa5: /* BreakOp */ - AML_DEBUGPRINT("Break"); - env->stat = aml_stat_break; - break; - case 0xa4: /* ReturnOp */ - AML_DEBUGPRINT("Return("); - AML_COPY_OBJECT(env->tempname.property, env, aml_eval_name(env, - aml_parse_termobj(env, indent)), NULL); - aname = &env->tempname; - env->stat = aml_stat_return; - AML_DEBUGPRINT(")"); - break; - case 0xcc: /* BreakPointOp */ - /* XXX Not Yet Impremented (Not need?) */ - AML_DEBUGPRINT("BreakPoint"); - break; - default: - AML_SYSERRX(1, "strange opcode 0x%x\n", opcode); - AML_SYSABORT(); - } - - return (aname); -} Property changes on: head/sys/dev/acpi/aml/aml_parse.c ___________________________________________________________________ Deleted: svn:keywords ## -1 +0,0 ## -FreeBSD=%H \ No newline at end of property Index: head/sys/dev/acpi/aml/aml_store.c =================================================================== --- head/sys/dev/acpi/aml/aml_store.c (revision 68516) +++ head/sys/dev/acpi/aml/aml_store.c (nonexistent) @@ -1,349 +0,0 @@ -/*- - * Copyright (c) 1999 Takanori Watanabe - * Copyright (c) 1999, 2000 Mitsuru IWASAKI - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $Id: aml_store.c,v 1.22 2000/08/09 14:47:44 iwasaki Exp $ - * $FreeBSD$ - */ - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifndef _KERNEL -#include -#include -#include - -#include "debug.h" -#else /* _KERNEL */ -#include -#endif /* !_KERNEL */ - -static void -aml_store_to_fieldname(struct aml_environ *env, union aml_object *obj, - struct aml_name *name) -{ - char *buffer; - struct aml_name *wname, *oname, *iname; - struct aml_field *field; - struct aml_opregion *or; - union aml_object tobj, iobj, *tmpobj; - - field = &name->property->field; - oname = env->curname; - iname = NULL; - env->curname = name->parent; - if (field->f.ftype == f_t_field) { - wname = aml_search_name(env, field->f.fld.regname); - if (wname == NULL || - wname->property == NULL || - wname->property->type != aml_t_opregion) { - AML_DEBUGPRINT("Inappropreate Type\n"); - env->stat = aml_stat_panic; - env->curname = oname; - return; - } - or = &wname->property->opregion; - switch (obj->type) { - case aml_t_num: - aml_region_write(env, or->space, field->flags, - obj->num.number, or->offset, - field->bitoffset, field->bitlen); - AML_DEBUGPRINT("[write(%d, 0x%x, 0x%x)]", - or->space, obj->num.number, - or->offset + field->bitoffset / 8); - break; - case aml_t_buffer: - case aml_t_bufferfield: - if (obj->type == aml_t_buffer) { - buffer = obj->buffer.data; - } else { - buffer = obj->bfld.origin; - buffer += obj->bfld.bitoffset / 8; - } - aml_region_write_from_buffer(env, or->space, - field->flags, buffer, or->offset, field->bitoffset, - field->bitlen); - break; - case aml_t_regfield: - if (or->space != obj->regfield.space) { - AML_DEBUGPRINT("aml_store_to_fieldname: " - "Different type of space\n"); - break; - } - aml_region_bcopy(env, obj->regfield.space, - obj->regfield.flags, obj->regfield.offset, - obj->regfield.bitoffset, obj->regfield.bitlen, - field->flags, or->offset, field->bitoffset, - field->bitlen); - break; - default: - AML_DEBUGPRINT("aml_store_to_fieldname: " - "Inappropreate Type of src object\n"); - break; - } - } else if (field->f.ftype == f_t_index) { - iname = aml_search_name(env, field->f.ifld.indexname); - wname = aml_search_name(env, field->f.ifld.dataname); - iobj.type = aml_t_num; - iobj.num.number = field->bitoffset / 8; /* AccessType Boundary */ - - /* read whole values of IndexField */ - aml_store_to_name(env, &iobj, iname); - tmpobj = aml_eval_name(env, wname); - - /* make the values to be written */ - tobj.num = obj->num; - tobj.num.number = aml_adjust_updatevalue(field->flags, - field->bitoffset & 7, field->bitlen, - tmpobj->num.number, obj->num.number); - - /* write the values to IndexField */ - aml_store_to_name(env, &iobj, iname); - aml_store_to_name(env, &tobj, wname); - } - env->curname = oname; -} - -static void -aml_store_to_buffer(struct aml_environ *env, union aml_object *obj, - union aml_object *buf, int offset) -{ - int size; - int bitlen; - - switch (obj->type) { - case aml_t_num: - if (offset > buf->buffer.size) { - aml_realloc_object(buf, offset); - } - buf->buffer.data[offset] = obj->num.number & 0xff; - AML_DEBUGPRINT("[Store number 0x%x to buffer]", - obj->num.number & 0xff); - break; - case aml_t_string: - size = strlen(obj->str.string); - if (buf->buffer.size - offset < size) { - aml_realloc_object(buf, offset + size + 1); - } - strcpy(&buf->buffer.data[offset], obj->str.string); - AML_DEBUGPRINT("[Store string to buffer]"); - break; - case aml_t_buffer: - bzero(buf->buffer.data, buf->buffer.size); - if (obj->buffer.size > buf->buffer.size) { - size = buf->buffer.size; - } else { - size = obj->buffer.size; - } - bcopy(obj->buffer.data, buf->buffer.data, size); - break; - case aml_t_regfield: - bitlen = (buf->buffer.size - offset) * 8; - if (bitlen > obj->regfield.bitlen) { - bitlen = obj->regfield.bitlen; - } - aml_region_read_into_buffer(env, obj->regfield.space, - obj->regfield.flags, obj->regfield.offset, - obj->regfield.bitoffset, bitlen, - buf->buffer.data + offset); - break; - default: - goto not_yet; - } - return; -not_yet: - AML_DEBUGPRINT("[XXX not supported yet]"); -} - - -void -aml_store_to_object(struct aml_environ *env, union aml_object *src, - union aml_object * dest) -{ - char *buffer, *srcbuf; - int offset, bitlen; - - switch (dest->type) { - case aml_t_num: - if (src->type == aml_t_num) { - dest->num = src->num; - AML_DEBUGPRINT("[Store number 0x%x]", src->num.number); - } else { - env->stat = aml_stat_panic; - } - break; - case aml_t_string: - case aml_t_package: - break; - case aml_t_buffer: - aml_store_to_buffer(env, src, dest, 0); - break; - case aml_t_bufferfield: - buffer = dest->bfld.origin; - offset = dest->bfld.bitoffset; - bitlen = dest->bfld.bitlen; - - switch (src->type) { - case aml_t_num: - if (aml_bufferfield_write(src->num.number, buffer, offset, bitlen)) { - AML_DEBUGPRINT("aml_bufferfield_write() failed\n"); - } - break; - case aml_t_buffer: - case aml_t_bufferfield: - if (src->type == aml_t_buffer) { - srcbuf = src->buffer.data; - } else { - srcbuf = src->bfld.origin; - srcbuf += src->bfld.bitoffset / 8; - } - bcopy(srcbuf, buffer, bitlen / 8); - break; - case aml_t_regfield: - aml_region_read_into_buffer(env, src->regfield.space, - src->regfield.flags, src->regfield.offset, - src->regfield.bitoffset, src->regfield.bitlen, - buffer); - break; - default: - AML_DEBUGPRINT("not implemented yet"); - break; - } - break; - case aml_t_debug: - aml_showobject(src); - break; - default: - AML_DEBUGPRINT("[Unimplemented %d]", dest->type); - break; - } -} - -static void -aml_store_to_objref(struct aml_environ *env, union aml_object *obj, - union aml_object *r) -{ - int offset; - union aml_object *ref; - - if (r->objref.ref == NULL) { - r->objref.ref = aml_alloc_object(obj->type, NULL); /* XXX */ - r->objref.nameref->property = r->objref.ref; - } - ref = r->objref.ref; - - switch (ref->type) { - case aml_t_buffer: - offset = r->objref.offset; - aml_store_to_buffer(env, obj, ref, r->objref.offset); - break; - case aml_t_package: - offset = r->objref.offset; - if (r->objref.ref->package.elements < offset) { - aml_realloc_object(ref, offset); - } - if (ref->package.objects[offset] == NULL) { - ref->package.objects[offset] = aml_copy_object(env, obj); - } else { - aml_store_to_object(env, obj, ref->package.objects[offset]); - } - break; - default: - aml_store_to_object(env, obj, ref); - break; - } -} - -/* - * Store to Named object - */ -void -aml_store_to_name(struct aml_environ *env, union aml_object *obj, - struct aml_name *name) -{ - struct aml_name *wname; - - if (env->stat == aml_stat_panic) { - return; - } - if (name == NULL || obj == NULL) { - AML_DEBUGPRINT("[Try to store no existant name ]"); - return; - } - if (name->property == NULL) { - name->property = aml_copy_object(env, obj); - AML_DEBUGPRINT("[Copy number 0x%x]", obj->num.number); - return; - } - if (name->property->type == aml_t_namestr) { - wname = aml_search_name(env, name->property->nstr.dp); - name = wname; - } - if (name == NULL) { - env->stat = aml_stat_panic; - return; - } - if (name->property == NULL || name->property->type == aml_t_null) { - name->property = aml_copy_object(env, obj); - AML_DEBUGPRINT("[Copy number 0x%x]", obj->num.number); - return; - } - /* Writes to constant object are not allowed */ - if (name->property != NULL && name->property->type == aml_t_num && - name->property->num.constant == 1) { - return; - } - /* try to dereference */ - if (obj->type == aml_t_objref && obj->objref.deref == 0) { - AML_DEBUGPRINT("Source object isn't dereferenced yet, " - "try to dereference anyway\n"); - obj->objref.deref = 1; - obj = aml_eval_objref(env, obj); - } - switch (name->property->type) { - case aml_t_field: - aml_store_to_fieldname(env, obj, name); - break; - case aml_t_objref: - aml_store_to_objref(env, obj, name->property); - break; - case aml_t_num: - if (name == &env->tempname) - break; - default: - aml_store_to_object(env, obj, name->property); - break; - } -} Property changes on: head/sys/dev/acpi/aml/aml_store.c ___________________________________________________________________ Deleted: svn:keywords ## -1 +0,0 ## -FreeBSD=%H \ No newline at end of property Index: head/sys/dev/acpi/aml/aml_evalobj.h =================================================================== --- head/sys/dev/acpi/aml/aml_evalobj.h (revision 68516) +++ head/sys/dev/acpi/aml/aml_evalobj.h (nonexistent) @@ -1,48 +0,0 @@ -/*- - * Copyright (c) 1999 Takanori Watanabe - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $Id: aml_evalobj.h,v 1.11 2000/08/16 18:14:53 iwasaki Exp $ - * $FreeBSD$ - */ - -#ifndef _AML_EVALOBJ_H_ -#define _AML_EVALOBJ_H_ - -#include - -union aml_object *aml_eval_objref(struct aml_environ *, - union aml_object *); -union aml_object *aml_eval_name(struct aml_environ *, - struct aml_name *); -int aml_eval_name_simple(struct aml_name *, va_list); -int aml_objtonum(struct aml_environ *, - union aml_object *); -struct aml_name *aml_execute_method(struct aml_environ *); -union aml_object *aml_invoke_method(struct aml_name *, - int, union aml_object *); -union aml_object *aml_invoke_method_by_name(char *, - int, union aml_object *); - -#endif /* !_AML_EVALOBJ_H_ */ Property changes on: head/sys/dev/acpi/aml/aml_evalobj.h ___________________________________________________________________ Deleted: svn:keywords ## -1 +0,0 ## -FreeBSD=%H \ No newline at end of property Index: head/sys/dev/acpi/aml/aml_parse.h =================================================================== --- head/sys/dev/acpi/aml/aml_parse.h (revision 68516) +++ head/sys/dev/acpi/aml/aml_parse.h (nonexistent) @@ -1,36 +0,0 @@ -/*- - * Copyright (c) 1999 Doug Rabson - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $Id: aml_parse.h,v 1.9 2000/08/08 14:12:05 iwasaki Exp $ - * $FreeBSD$ - */ - -#ifndef _AML_PARSE_H_ -#define _AML_PARSE_H_ - -struct aml_name *aml_parse_objectlist(struct aml_environ *, int); -struct aml_name *aml_parse_termobj(struct aml_environ *, int); - -#endif /* !_AML_PARSE_H_ */ Property changes on: head/sys/dev/acpi/aml/aml_parse.h ___________________________________________________________________ Deleted: svn:keywords ## -1 +0,0 ## -FreeBSD=%H \ No newline at end of property Index: head/sys/dev/acpi/aml/aml_store.h =================================================================== --- head/sys/dev/acpi/aml/aml_store.h (revision 68516) +++ head/sys/dev/acpi/aml/aml_store.h (nonexistent) @@ -1,39 +0,0 @@ -/*- - * Copyright (c) 1999 Takanori Watanabe - * Copyright (c) 1999, 2000 Mitsuru IWASAKI - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $Id: aml_store.h,v 1.8 2000/08/09 14:47:44 iwasaki Exp $ - * $FreeBSD$ - */ - -#ifndef _AML_STORE_H_ -#define _AML_STORE_H_ - -void aml_store_to_name(struct aml_environ *, union aml_object *, - struct aml_name *); -void aml_store_to_object(struct aml_environ *, union aml_object *, - union aml_object *); - -#endif /* _AML_STORE_H_ */ Property changes on: head/sys/dev/acpi/aml/aml_store.h ___________________________________________________________________ Deleted: svn:keywords ## -1 +0,0 ## -FreeBSD=%H \ No newline at end of property Index: head/sys/dev/acpi/aml/aml_obj.c =================================================================== --- head/sys/dev/acpi/aml/aml_obj.c (revision 68516) +++ head/sys/dev/acpi/aml/aml_obj.c (nonexistent) @@ -1,264 +0,0 @@ -/*- - * Copyright (c) 1999 Takanori Watanabe - * Copyright (c) 1999, 2000 Mitsuru IWASAKI - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $Id: aml_obj.c,v 1.17 2000/08/12 15:20:45 iwasaki Exp $ - * $FreeBSD$ - */ - -#include - -#include -#include -#include -#include -#include -#include - -#ifndef _KERNEL -#include -#include - -#include -#include -#include -#include -#include -#include -#else /* _KERNEL */ -#include -#endif /* !_KERNEL */ - -union aml_object * -aml_copy_object(struct aml_environ *env, union aml_object *orig) -{ - int i; - union aml_object *ret; - - if (orig == NULL) - return (NULL); - switch (orig->type) { - case aml_t_regfield: - ret = aml_alloc_object(aml_t_buffer, 0); - ret->buffer.size = (orig->regfield.bitlen / 8) + - ((orig->regfield.bitlen % 8) ? 1 : 0); - if (ret->buffer.size == 0) { - goto out; - } - ret->buffer.data = memman_alloc_flexsize(aml_memman, ret->buffer.size); - aml_store_to_object(env, orig, ret); - break; - - default: - ret = aml_alloc_object(0, orig); - break; - } - - if (1 || orig != &env->tempobject) { /* XXX */ - if (orig->type == aml_t_buffer) { - if (orig->buffer.size == 0) { - goto out; - } - ret->buffer.data = memman_alloc_flexsize(aml_memman, - orig->buffer.size); - bcopy(orig->buffer.data, ret->buffer.data, orig->buffer.size); - } else if (orig->type == aml_t_package) { - if (ret->package.elements == 0) { - goto out; - } - ret->package.objects = memman_alloc_flexsize(aml_memman, - ret->package.elements * sizeof(union aml_object *)); - for (i = 0; i < ret->package.elements; i++) { - ret->package.objects[i] = aml_copy_object(env, orig->package.objects[i]); - } - } else if (orig->type == aml_t_string && orig->str.needfree != 0) { - ret->str.string = memman_alloc_flexsize(aml_memman, - strlen(orig->str.string) + 1); - strcpy(orig->str.string, ret->str.string); - } else if (orig->type == aml_t_num) { - ret->num.constant = 0; - } - } else { - printf("%s:%d\n", __FILE__, __LINE__); - env->tempobject.type = aml_t_null; - } -out: - return ret; -} - -/* - * This function have two function: copy or allocate. if orig != NULL, - * orig is duplicated. - */ - -union aml_object * -aml_alloc_object(enum aml_objtype type, union aml_object *orig) -{ - unsigned int memid; - union aml_object *ret; - - if (orig != NULL) { - type = orig->type; - } - switch (type) { - case aml_t_namestr: - memid = memid_aml_namestr; - break; - case aml_t_buffer: - memid = memid_aml_buffer; - break; - case aml_t_string: - memid = memid_aml_string; - break; - case aml_t_bufferfield: - memid = memid_aml_bufferfield; - break; - case aml_t_package: - memid = memid_aml_package; - break; - case aml_t_num: - memid = memid_aml_num; - break; - case aml_t_powerres: - memid = memid_aml_powerres; - break; - case aml_t_opregion: - memid = memid_aml_opregion; - break; - case aml_t_method: - memid = memid_aml_method; - break; - case aml_t_processor: - memid = memid_aml_processor; - break; - case aml_t_field: - memid = memid_aml_field; - break; - case aml_t_mutex: - memid = memid_aml_mutex; - break; - case aml_t_device: - memid = memid_aml_objtype; - break; - case aml_t_objref: - memid = memid_aml_objref; - break; - default: - memid = memid_aml_objtype; - break; - } - ret = memman_alloc(aml_memman, memid); - ret->type = type; - - if (orig != NULL) { - bcopy(orig, ret, memman_memid2size(aml_memman, memid)); - } - return (ret); -} - -void -aml_free_objectcontent(union aml_object *obj) -{ - int i; - - if (obj->type == aml_t_buffer && obj->buffer.data != NULL) { - memman_free_flexsize(aml_memman, obj->buffer.data); - obj->buffer.data = NULL; - } - if (obj->type == aml_t_string && obj->str.string != NULL) { - if (obj->str.needfree != 0) { - memman_free_flexsize(aml_memman, obj->str.string); - obj->str.string = NULL; - } - } - if (obj->type == aml_t_package && obj->package.objects != NULL) { - for (i = 0; i < obj->package.elements; i++) { - aml_free_object(&obj->package.objects[i]); - } - memman_free_flexsize(aml_memman, obj->package.objects); - obj->package.objects = NULL; - } -} - -void -aml_free_object(union aml_object **obj) -{ - union aml_object *body; - - body = *obj; - if (body == NULL) { - return; - } - aml_free_objectcontent(*obj); - memman_free(aml_memman, memid_unkown, *obj); - *obj = NULL; -} - -void -aml_realloc_object(union aml_object *obj, int size) -{ - int i; - enum aml_objtype type; - union aml_object tmp; - - type = obj->type; - switch (type) { - case aml_t_buffer: - if (obj->buffer.size >= size) { - return; - } - tmp.buffer.size = size; - tmp.buffer.data = memman_alloc_flexsize(aml_memman, size); - bzero(tmp.buffer.data, size); - bcopy(obj->buffer.data, tmp.buffer.data, obj->buffer.size); - aml_free_objectcontent(obj); - *obj = tmp; - break; - case aml_t_string: - if (strlen(obj->str.string) >= size) { - return; - } - tmp.str.string = memman_alloc_flexsize(aml_memman, size + 1); - strcpy(tmp.str.string, obj->str.string); - aml_free_objectcontent(obj); - *obj = tmp; - break; - case aml_t_package: - if (obj->package.elements >= size) { - return; - } - tmp.package.objects = memman_alloc_flexsize(aml_memman, - size * sizeof(union aml_object *)); - bzero(tmp.package.objects, size * sizeof(union aml_object *)); - for (i = 0; i < obj->package.elements; i++) { - tmp.package.objects[i] = obj->package.objects[i]; - } - memman_free_flexsize(aml_memman, obj->package.objects); - obj->package.objects = tmp.package.objects; - break; - default: - break; - } -} Property changes on: head/sys/dev/acpi/aml/aml_obj.c ___________________________________________________________________ Deleted: svn:keywords ## -1 +0,0 ## -FreeBSD=%H \ No newline at end of property Index: head/sys/dev/acpi/aml/aml_env.h =================================================================== --- head/sys/dev/acpi/aml/aml_env.h (revision 68516) +++ head/sys/dev/acpi/aml/aml_env.h (nonexistent) @@ -1,46 +0,0 @@ -/*- - * Copyright (c) 1999 Takanori Watanabe - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $Id: aml_env.h,v 1.11 2000/08/08 14:12:05 iwasaki Exp $ - * $FreeBSD$ - */ - -#ifndef _AML_ENV_H_ -#define _AML_ENV_H_ - -#include -#include -#include - -struct aml_environ { - u_int8_t *dp; - u_int8_t *end; - enum aml_status stat; - struct aml_name *curname; - struct aml_name tempname; - union aml_object tempobject; -}; - -#endif /* !_AML_ENV_H_ */ Property changes on: head/sys/dev/acpi/aml/aml_env.h ___________________________________________________________________ Deleted: svn:keywords ## -1 +0,0 ## -FreeBSD=%H \ No newline at end of property Index: head/sys/i386/i386/acpi_machdep.c =================================================================== --- head/sys/i386/i386/acpi_machdep.c (revision 68516) +++ head/sys/i386/i386/acpi_machdep.c (nonexistent) @@ -1,142 +0,0 @@ -/*- - * Copyright (c) 2000 Michael Smith - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#include "opt_acpi.h" -#include -#include -#include - -#include -#include - -#include -#include -#include -#include -#include - -#include -#include - -#ifdef ACPI_NO_OSDFUNC_INLINE -#include -#endif - -struct ACPIrsdp * -acpi_find_rsdp(void) -{ - u_long sigaddr; - struct ACPIrsdp *rsdp; - u_int8_t ck, *cv; - int i, year; - char *dp; - - /* - * Search for the RSD PTR signature. - */ - if ((sigaddr = bios_sigsearch(0, "RSD PTR ", 8, 16, 0)) == 0) - return(NULL); - - /* get a virtual pointer to the structure */ - rsdp = (struct ACPIrsdp *)(uintptr_t)BIOS_PADDRTOVADDR(sigaddr); - for (cv = (u_int8_t *)rsdp, ck = 0, i = 0; i < sizeof(struct ACPIrsdp); i++) { - ck += cv[i]; - } - - /* - * Fail if the checksum doesn't match. - */ - if (ck != 0) { - printf("ACPI: Bad ACPI BIOS data checksum\n"); - return(NULL); - } - - /* - * Fail if the BIOS is too old to be trustworthy. - * XXX we should check the ACPI BIOS blacklist/goodlist here. - */ - dp = (char *)(uintptr_t)BIOS_PADDRTOVADDR(0xffff5); - year = ((*(dp + 6) - '0') * 10) + (*(dp + 7) - '0'); - if (year < 70) - year += 100; - if (year < 99) { - printf("ACPI: BIOS too old (%.8s < 01/01/99)\n", dp); - return(NULL); - } - - return(rsdp); -} - -/* - * Find and map all memory regions that are regarded as belonging to ACPI - * and let the MI code know about them. Scan the ACPI memory map as managed - * by the MI code and map it into kernel space. - */ -void -acpi_mapmem(void) -{ - struct vm86frame vmf; - struct vm86context vmc; - struct bios_smap *smap; - vm_offset_t va; - int i; - - bzero(&vmf, sizeof(struct vm86frame)); - - acpi_init_addr_range(); - - /* - * Scan memory map with INT 15:E820 - */ - vmc.npages = 0; - smap = (void *)vm86_addpage(&vmc, 1, KERNBASE + (1 << PAGE_SHIFT)); - vm86_getptr(&vmc, (vm_offset_t)smap, &vmf.vmf_es, &vmf.vmf_di); - - vmf.vmf_ebx = 0; - do { - vmf.vmf_eax = 0xE820; - vmf.vmf_edx = SMAP_SIG; - vmf.vmf_ecx = sizeof(struct bios_smap); - i = vm86_datacall(0x15, &vmf, &vmc); - if (i || vmf.vmf_eax != SMAP_SIG) - break; - - /* ACPI-owned memory? */ - if (smap->type == 0x03 || smap->type == 0x04) { - acpi_register_addr_range(smap->base, smap->length, smap->type); - } - } while (vmf.vmf_ebx != 0); - - /* - * Map the physical ranges that have been registered into the kernel. - */ - for (i = 0; i < acpi_addr.entries; i++) { - va = (vm_offset_t)pmap_mapdev(acpi_addr.t[i].pa_base, acpi_addr.t[i].size); - acpi_addr.t[i].va_base = va; - } -} Property changes on: head/sys/i386/i386/acpi_machdep.c ___________________________________________________________________ Deleted: svn:keywords ## -1 +0,0 ## -FreeBSD=%H \ No newline at end of property Index: head/sys/i386/include/acpi_machdep.h =================================================================== --- head/sys/i386/include/acpi_machdep.h (revision 68516) +++ head/sys/i386/include/acpi_machdep.h (nonexistent) @@ -1,35 +0,0 @@ -/*- - * Copyright (c) 2000 Mitsuru IWASAKI - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_ACPI_MACHDEP_H_ -#define _MACHINE_ACPI_MACHDEP_H_ - -#define ACPI_BUS_SPACE_IO I386_BUS_SPACE_IO -#define ACPI_BUS_SPACE_MEM I386_BUS_SPACE_MEM - -#endif /* ! _MACHINE_ACPI_MACHDEP_H_ */ Property changes on: head/sys/i386/include/acpi_machdep.h ___________________________________________________________________ Deleted: svn:keywords ## -1 +0,0 ## -FreeBSD=%H \ No newline at end of property Index: head/sys/i386/include/acpica_osd.h =================================================================== --- head/sys/i386/include/acpica_osd.h (revision 68516) +++ head/sys/i386/include/acpica_osd.h (nonexistent) @@ -1,321 +0,0 @@ -/*- - * Copyright (c) 2000 Mitsuru IWASAKI - * Copyright (c) 2000 Munehiro Matsuda - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $Id: acpica_osd.h,v 1.3 2000/08/09 14:47:48 iwasaki Exp $ - * $FreeBSD$ - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "pcib_if.h" - -#ifdef ACPI_NO_OSDFUNC_INLINE -#define _ACPICA_INLINE_ -#else -#define _ACPICA_INLINE_ static __inline -#endif - -/* - * ACPICA compatibility - */ - -static UINT32 OsdInX(ACPI_IO_ADDRESS, int); -static void OsdOutX(ACPI_IO_ADDRESS, UINT32, int); - -/* - * New-bus dependent code - */ - -static device_t get_pcib_device(void); - -static __inline device_t -get_pcib_device() -{ - device_t nexus, pcib; - - if ((nexus = device_find_child(root_bus, "nexus", 0)) == NULL) { - return (NULL); - } - if ((pcib = device_find_child(nexus, "pcib", 0)) == NULL) { - return (NULL); - } - - return (pcib); -} - -/* - * Platform/Hardware independent I/O interfaces - */ - -static __inline UINT32 -OsdInX(ACPI_IO_ADDRESS InPort, int bytes) -{ - bus_space_tag_t bst; - bus_space_handle_t bsh; - UINT32 retval; - - bst = ACPI_BUS_SPACE_IO; - bsh = InPort; - switch (bytes) { - case 1: - retval = bus_space_read_1(bst, bsh, 0); - break; - case 2: - retval = bus_space_read_2(bst, bsh, 0); - break; - case 4: - retval = bus_space_read_4(bst, bsh, 0); - break; - default: - printf("OsdInX: wrong length to read\n"); - retval = 0; - } - return (retval); -} - -_ACPICA_INLINE_ UINT8 -OsdIn8(ACPI_IO_ADDRESS InPort) -{ - return (OsdInX(InPort, 1) & 0xff); -} - -_ACPICA_INLINE_ UINT16 -OsdIn16(ACPI_IO_ADDRESS InPort) -{ - return (OsdInX(InPort, 2) & 0xffff); -} - -_ACPICA_INLINE_ UINT32 -OsdIn32(ACPI_IO_ADDRESS InPort) -{ - return (OsdInX(InPort, 4)); -} - -static __inline void -OsdOutX(ACPI_IO_ADDRESS OutPort, UINT32 Value, int bytes) -{ - bus_space_tag_t bst; - bus_space_handle_t bsh; - - bst = ACPI_BUS_SPACE_IO; - bsh = OutPort; - switch (bytes) { - case 1: - bus_space_write_1(bst, bsh, 0, Value & 0xff); - break; - case 2: - bus_space_write_2(bst, bsh, 0, Value & 0xffff); - break; - case 4: - bus_space_write_4(bst, bsh, 0, Value); - break; - default: - printf("OsdOutX: wrong length to write\n"); - } -} - -_ACPICA_INLINE_ void -OsdOut8(ACPI_IO_ADDRESS OutPort, UINT8 Value) -{ - OsdOutX(OutPort, Value, 1); -} - -_ACPICA_INLINE_ void -OsdOut16(ACPI_IO_ADDRESS OutPort, UINT16 Value) -{ - OsdOutX(OutPort, Value, 2); -} - -_ACPICA_INLINE_ void -OsdOut32(ACPI_IO_ADDRESS OutPort, UINT32 Value) -{ - OsdOutX(OutPort, Value, 4); -} - -_ACPICA_INLINE_ ACPI_STATUS -OsdMapMemory(void *PhysicalAddress, UINT32 Length, void **LogicalAddress) -{ - vm_offset_t PhysicalEnd; - vm_offset_t PhysicalOffs; - - PhysicalEnd = (vm_offset_t)PhysicalAddress + Length; - if (PhysicalEnd < 1024 * 1024) { - /* - * The first 1Mb is mapped at KERNBASE. - */ - *LogicalAddress = (void *)(uintptr_t) - (KERNBASE + (vm_offset_t)PhysicalAddress); - } else { - PhysicalOffs = (vm_offset_t)PhysicalAddress - - trunc_page((vm_offset_t)PhysicalAddress); - *LogicalAddress = (caddr_t) - pmap_mapdev((vm_offset_t)PhysicalAddress - PhysicalOffs, - Length + PhysicalOffs) + - PhysicalOffs; - } - - return (AE_OK); -} - -_ACPICA_INLINE_ void -OsdUnMapMemory(void *LogicalAddress, UINT32 Length) -{ - - if ((vm_offset_t)LogicalAddress + Length - KERNBASE >= 1024 * 1024) { - pmap_unmapdev((vm_offset_t)LogicalAddress, Length); - } -} - -/* - * Standard access to PCI configuration space - */ - -static __inline ACPI_STATUS -OsdReadPciCfg(UINT32 Bus, UINT32 DeviceFunction, UINT32 Register, UINT32 *Value, int bytes) -{ - static device_t pcib = NULL; - - if (pcib == NULL && (pcib = get_pcib_device()) == NULL) { - return (AE_ERROR); - } - - *Value = PCIB_READ_CONFIG(pcib, Bus, (DeviceFunction >> 16) & 0xff, - DeviceFunction & 0xff, Register, bytes); - - return (AE_OK); -} - -_ACPICA_INLINE_ ACPI_STATUS -OsdReadPciCfgByte(UINT32 Bus, UINT32 DeviceFunction, UINT32 Register, UINT8 *Value) -{ - ACPI_STATUS status; - UINT32 tmp; - - status = OsdReadPciCfg(Bus, DeviceFunction, Register, &tmp, 1); - *Value = tmp & 0xff; - return (status); -} - -_ACPICA_INLINE_ ACPI_STATUS -OsdReadPciCfgWord(UINT32 Bus, UINT32 DeviceFunction, UINT32 Register, UINT16 *Value) -{ - ACPI_STATUS status; - UINT32 tmp; - - status = OsdReadPciCfg(Bus, DeviceFunction, Register, &tmp, 2); - *Value = tmp & 0xffff; - return (status); -} - -_ACPICA_INLINE_ ACPI_STATUS -OsdReadPciCfgDword(UINT32 Bus, UINT32 DeviceFunction, UINT32 Register, UINT32 *Value) -{ - ACPI_STATUS status; - UINT32 tmp; - - status = OsdReadPciCfg(Bus, DeviceFunction, Register, &tmp, 2); - *Value = tmp; - return (status); -} - -static __inline ACPI_STATUS -OsdWritePciCfg(UINT32 Bus, UINT32 DeviceFunction, UINT32 Register, UINT32 Value, int bytes) -{ - static device_t pcib = NULL; - - if (pcib == NULL && (pcib = get_pcib_device()) == NULL) { - return (AE_ERROR); - } - - PCIB_WRITE_CONFIG(pcib, Bus, (DeviceFunction >> 16) & 0xff, - DeviceFunction & 0xff, Register, Value, bytes); - - return (AE_OK); -} - -_ACPICA_INLINE_ ACPI_STATUS -OsdWritePciCfgByte(UINT32 Bus, UINT32 DeviceFunction, UINT32 Register, UINT8 Value) -{ - return (OsdWritePciCfg(Bus, DeviceFunction, Register, (UINT32) Value, 1)); -} - -_ACPICA_INLINE_ ACPI_STATUS -OsdWritePciCfgWord(UINT32 Bus, UINT32 DeviceFunction, UINT32 Register, UINT16 Value) -{ - return (OsdWritePciCfg(Bus, DeviceFunction, Register, (UINT32) Value, 2)); -} - -_ACPICA_INLINE_ ACPI_STATUS -OsdWritePciCfgDword(UINT32 Bus, UINT32 DeviceFunction, UINT32 Register, UINT32 Value) -{ - return (OsdWritePciCfg(Bus, DeviceFunction, Register, Value, 4)); -} - -_ACPICA_INLINE_ ACPI_STATUS -OsdSleep(UINT32 Seconds, UINT32 Milliseconds) -{ - int error; - ACPI_STATUS status; - - error = acpi_sleep(Seconds * 1000 + Milliseconds); - switch (error) { - case 0: - /* The running thread slept for the time specified */ - status = AE_OK; - break; - case 1: - /* TBD!!!! */ - status = AE_BAD_PARAMETER; - break; - case 2: - default: - /* The running thread did not slept because of a host OS error */ - status = AE_ERROR; - break; - } - - return (status); -} - -_ACPICA_INLINE_ ACPI_STATUS -OsdSleepUsec(UINT32 Microseconds) -{ - if (Microseconds == 0) { - return (AE_BAD_PARAMETER); - } - - DELAY(Microseconds); - return (AE_OK); -} - Property changes on: head/sys/i386/include/acpica_osd.h ___________________________________________________________________ Deleted: svn:keywords ## -1 +0,0 ## -FreeBSD=%H \ No newline at end of property