svn commit: r239548 - head/sys/powerpc/powermac
Author: jhibbits Date: Tue Aug 21 23:55:29 2012 New Revision: 239548 URL: http://svn.freebsd.org/changeset/base/239548 Log: phandle_t is unsigned, and OF_finddevice() returns (phandle_t)(-1) on failure, so check for that instead of 0. While here, provide a better description for ATI backlight driver. Reported by: jchandra@ MFC after:3 days Modified: head/sys/powerpc/powermac/atibl.c head/sys/powerpc/powermac/nvbl.c Modified: head/sys/powerpc/powermac/atibl.c == --- head/sys/powerpc/powermac/atibl.c Tue Aug 21 23:44:47 2012 (r239547) +++ head/sys/powerpc/powermac/atibl.c Tue Aug 21 23:55:29 2012 (r239548) @@ -98,7 +98,7 @@ atibl_probe(device_t dev) handle = OF_finddevice(mac-io/backlight); - if (handle = 0) + if (handle == -1) return (ENXIO); if (OF_getprop(handle, backlight-control, control, sizeof(control)) 0) @@ -107,7 +107,7 @@ atibl_probe(device_t dev) if (strcmp(control, ati) != 0) return (ENXIO); - device_set_desc(dev, PowerBook backlight); + device_set_desc(dev, PowerBook backlight for ATI graphics); return (0); } Modified: head/sys/powerpc/powermac/nvbl.c == --- head/sys/powerpc/powermac/nvbl.cTue Aug 21 23:44:47 2012 (r239547) +++ head/sys/powerpc/powermac/nvbl.cTue Aug 21 23:55:29 2012 (r239548) @@ -94,7 +94,7 @@ nvbl_probe(device_t dev) handle = OF_finddevice(mac-io/backlight); - if (handle = 0) + if (handle == -1) return (ENXIO); if (OF_getprop(handle, backlight-control, control, sizeof(control)) 0) ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r237480 - head/sys/dev/adb
Author: jhibbits Date: Sat Jun 23 13:52:44 2012 New Revision: 237480 URL: http://svn.freebsd.org/changeset/base/237480 Log: Release the ADB keyboard mutex when handling the power button press/release. Found by WITNESS. Approved by: nwhitehorn (mentor) MFC after:3 days Modified: head/sys/dev/adb/adb_kbd.c Modified: head/sys/dev/adb/adb_kbd.c == --- head/sys/dev/adb/adb_kbd.c Sat Jun 23 12:40:24 2012(r237479) +++ head/sys/dev/adb/adb_kbd.c Sat Jun 23 13:52:44 2012(r237480) @@ -426,8 +426,10 @@ adb_kbd_receive_packet(device_t dev, u_c /* 0x7f is always the power button */ if (data[0] == 0x7f devctl_process_running()) { devctl_notify(PMU, Button, pressed, NULL); + mtx_unlock(sc-sc_mutex); return (0); } else if (data[0] == 0xff) { + mtx_unlock(sc-sc_mutex); return (0); /* Ignore power button release. */ } if ((data[0] 0x7f) == 57 sc-buffers 7) { ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r239027 - in head/sys: conf powerpc/conf powerpc/powermac
Author: jhibbits Date: Sat Aug 4 03:05:01 2012 New Revision: 239027 URL: http://svn.freebsd.org/changeset/base/239027 Log: Add backlight support for nVidia-based PowerBooks/iBooks/iMacs. Approved by: nwhitehorn (mentor) MFC after:9.1-RELEASE Added: head/sys/powerpc/powermac/nvbl.c (contents, props changed) Modified: head/sys/conf/files.powerpc head/sys/powerpc/conf/GENERIC head/sys/powerpc/conf/GENERIC64 Modified: head/sys/conf/files.powerpc == --- head/sys/conf/files.powerpc Sat Aug 4 02:38:05 2012(r239026) +++ head/sys/conf/files.powerpc Sat Aug 4 03:05:01 2012(r239027) @@ -160,6 +160,7 @@ powerpc/powermac/hrowpic.c optionalpowe powerpc/powermac/kiic.coptionalpowermac kiic powerpc/powermac/macgpio.c optionalpowermac pci powerpc/powermac/macio.c optionalpowermac pci +powerpc/powermac/nvbl.coptionalpowermac nvbl powerpc/powermac/openpic_macio.c optional powermac pci powerpc/powermac/platform_powermac.c optional powermac powerpc/powermac/powermac_thermal.c optional powermac Modified: head/sys/powerpc/conf/GENERIC == --- head/sys/powerpc/conf/GENERIC Sat Aug 4 02:38:05 2012 (r239026) +++ head/sys/powerpc/conf/GENERIC Sat Aug 4 03:05:01 2012 (r239027) @@ -197,6 +197,7 @@ device powermac_nvram # Open Firmware c device smu # Apple System Management Unit device windtunnel # Apple G4 MDD fan controller device atibl # ATI-based backlight driver for PowerBooks/iBooks +device nvbl# nVidia-based backlight driver for PowerBooks/iBooks # ADB support device adb Modified: head/sys/powerpc/conf/GENERIC64 == --- head/sys/powerpc/conf/GENERIC64 Sat Aug 4 02:38:05 2012 (r239026) +++ head/sys/powerpc/conf/GENERIC64 Sat Aug 4 03:05:01 2012 (r239027) @@ -194,6 +194,7 @@ device max6690 # PowerMac7,2 temperatu device powermac_nvram # Open Firmware configuration NVRAM device smu # Apple System Management Unit device atibl # ATI-based backlight driver for PowerBooks/iBooks +device nvbl# nVidia-based backlight driver for PowerBooks/iBooks # ADB support device adb Added: head/sys/powerpc/powermac/nvbl.c == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/powerpc/powermac/nvbl.cSat Aug 4 03:05:01 2012 (r239027) @@ -0,0 +1,197 @@ +/*- + * Copyright (c) 2012 Justin Hibbits + * 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 ``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 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. + */ + +#include sys/cdefs.h +__FBSDID($FreeBSD$); + +#include sys/param.h +#include sys/bus.h +#include sys/systm.h +#include sys/module.h +#include sys/kernel.h +#include sys/rman.h +#include sys/sysctl.h + +#include machine/bus.h + +#include dev/ofw/openfirm.h + +#define NVIDIA_BRIGHT_MIN (0x0ec) +#define NVIDIA_BRIGHT_MAX (0x538) +#define NVIDIA_BRIGHT_SCALE ((NVIDIA_BRIGHT_MAX - NVIDIA_BRIGHT_MIN)/100) +/* nVidia's MMIO registers are at PCI BAR[0] */ +#define NVIDIA_MMIO_PMC (0x0) +#define NVIDIA_PMC_OFF (NVIDIA_MMIO_PMC + 0x10f0) +#define NVIDIA_PMC_BL_SHIFT(16) +#define NVIDIA_PMC_BL_EN (1 31) + + +struct nvbl_softc { + device_t dev; + struct resource *sc_memr; +}; + +static void
svn commit: r228225 - head/share/misc
Author: jhibbits Date: Sat Dec 3 14:03:53 2011 New Revision: 228225 URL: http://svn.freebsd.org/changeset/base/228225 Log: Add myself to the relevant doc files. Approved by: nwhitehorn (mentor) Modified: head/share/misc/committers-src.dot Modified: head/share/misc/committers-src.dot == --- head/share/misc/committers-src.dot Sat Dec 3 14:02:25 2011 (r228224) +++ head/share/misc/committers-src.dot Sat Dec 3 14:03:53 2011 (r228225) @@ -159,6 +159,7 @@ jchandra [label=Jayachandran C.\njchand jeff [label=Jeff Roberson\nj...@freebsd.org\n2002/02/21] jh [label=Jaakko Heinonen\n...@freebsd.org\n2009/10/02] jhb [label=John Baldwin\n...@freebsd.org\n1999/08/23] +jhibbits [label=Justin Hibbits\njhibb...@freebsd.org\n2011/11/30] jilles [label=Jilles Tjoelker\njil...@freebsd.org\n2009/05/22] jinmei [label=JINMEI Tatuya\njin...@freebsd.org\n2007/03/17] jkim [label=Jung-uk Kim\nj...@freebsd.org\n2005/07/06] @@ -497,6 +498,7 @@ njl - rpaulo njl - sepotvin nwhitehorn - andreast +nwhitehorn - jhibbits obrien - benno obrien - groudier ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r228270 - in head: etc/devd sys/powerpc/powermac
Author: jhibbits Date: Mon Dec 5 00:12:10 2011 New Revision: 228270 URL: http://svn.freebsd.org/changeset/base/228270 Log: Add a devd notification for closing/opening the lid on PowerBooks and iBooks. Approved by: nwhitehorn (mentor) Modified: head/etc/devd/apple.conf head/sys/powerpc/powermac/pmu.c head/sys/powerpc/powermac/pmuvar.h Modified: head/etc/devd/apple.conf == --- head/etc/devd/apple.confMon Dec 5 00:00:47 2011(r228269) +++ head/etc/devd/apple.confMon Dec 5 00:12:10 2011(r228270) @@ -11,6 +11,16 @@ notify 0 { }; +# Keyboard power key +notify 0 { + match system PMU; + match subsystem lid; + match typeclose; + match notify 0x0; + action shutdown -p now; +}; + + # The next blocks enable volume hotkeys that can be found on Apple laptops notify 0 { match system PMU; Modified: head/sys/powerpc/powermac/pmu.c == --- head/sys/powerpc/powermac/pmu.c Mon Dec 5 00:00:47 2011 (r228269) +++ head/sys/powerpc/powermac/pmu.c Mon Dec 5 00:12:10 2011 (r228270) @@ -701,6 +701,20 @@ pmu_intr(void *arg) adb_receive_raw_packet(sc-adb_bus,resp[1],resp[2], len - 3,resp[3]); } + if (resp[1] PMU_INT_ENVIRONMENT) { + // if the lid was just closed, notify devd. + if ((resp[2] PMU_ENV_LID_CLOSED) (!sc-lid_closed)) { + sc-lid_closed = 1; + if (devctl_process_running()) + devctl_notify(PMU, lid, close, NULL); + } + else if (!(resp[2] PMU_ENV_LID_CLOSED) (sc-lid_closed)) { + // if the lid was just opened, notify devd. + if (devctl_process_running()) + devctl_notify(PMU, lid, open, NULL); + sc-lid_closed = 0; + } + } } static u_int Modified: head/sys/powerpc/powermac/pmuvar.h == --- head/sys/powerpc/powermac/pmuvar.h Mon Dec 5 00:00:47 2011 (r228269) +++ head/sys/powerpc/powermac/pmuvar.h Mon Dec 5 00:12:10 2011 (r228270) @@ -160,6 +160,7 @@ struct pmu_softc { volatile intsc_autopoll; int sc_batteries; struct cdev *sc_leddev; + int lid_closed; }; struct pmu_battstate { ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r228277 - in head: etc/devd sys/powerpc/powermac
Author: jhibbits Date: Mon Dec 5 14:13:21 2011 New Revision: 228277 URL: http://svn.freebsd.org/changeset/base/228277 Log: Fix style(9) issues from r228270. Approved by: nwhitehorn (mentor) Modified: head/etc/devd/apple.conf head/sys/powerpc/powermac/pmu.c Modified: head/etc/devd/apple.conf == --- head/etc/devd/apple.confMon Dec 5 12:06:53 2011(r228276) +++ head/etc/devd/apple.confMon Dec 5 14:13:21 2011(r228277) @@ -11,7 +11,7 @@ notify 0 { }; -# Keyboard power key +# PowerBook and iBook lid close. notify 0 { match system PMU; match subsystem lid; Modified: head/sys/powerpc/powermac/pmu.c == --- head/sys/powerpc/powermac/pmu.c Mon Dec 5 12:06:53 2011 (r228276) +++ head/sys/powerpc/powermac/pmu.c Mon Dec 5 14:13:21 2011 (r228277) @@ -702,14 +702,14 @@ pmu_intr(void *arg) len - 3,resp[3]); } if (resp[1] PMU_INT_ENVIRONMENT) { - // if the lid was just closed, notify devd. + /* if the lid was just closed, notify devd. */ if ((resp[2] PMU_ENV_LID_CLOSED) (!sc-lid_closed)) { sc-lid_closed = 1; if (devctl_process_running()) devctl_notify(PMU, lid, close, NULL); } else if (!(resp[2] PMU_ENV_LID_CLOSED) (sc-lid_closed)) { - // if the lid was just opened, notify devd. + /* if the lid was just opened, notify devd. */ if (devctl_process_running()) devctl_notify(PMU, lid, open, NULL); sc-lid_closed = 0; ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r228869 - in head: lib/libpmc sys/dev/hwpmc sys/powerpc/aim sys/powerpc/include sys/sys
: head/sys/dev/hwpmc/hwpmc_powerpc.c == --- head/sys/dev/hwpmc/hwpmc_powerpc.c Sat Dec 24 19:01:31 2011 (r228868) +++ head/sys/dev/hwpmc/hwpmc_powerpc.c Sat Dec 24 19:34:52 2011 (r228869) @@ -1,4 +1,5 @@ /*- + * Copyright (c) 2011 Justin Hibbits * Copyright (c) 2005, Joseph Koshy * All rights reserved. * @@ -30,20 +31,297 @@ __FBSDID($FreeBSD$); #include sys/param.h #include sys/pmc.h +#include sys/pmckern.h +#include sys/systm.h #include machine/pmc_mdep.h +#include machine/spr.h +#include machine/cpu.h -struct pmc_mdep * -pmc_md_initialize() -{ - return NULL; -} +#definePOWERPC_PMC_CAPS(PMC_CAP_INTERRUPT | PMC_CAP_USER | \ +PMC_CAP_SYSTEM | PMC_CAP_EDGE |\ +PMC_CAP_THRESHOLD | PMC_CAP_READ | \ +PMC_CAP_WRITE | PMC_CAP_INVERT | \ +PMC_CAP_QUALIFIER) -void -pmc_md_finalize(struct pmc_mdep *md) -{ - (void) md; -} +#define PPC_SET_PMC1SEL(r, x) ((r ~(SPR_MMCR0_PMC1SEL(0x3f))) | SPR_MMCR0_PMC1SEL(x)) +#define PPC_SET_PMC2SEL(r, x) ((r ~(SPR_MMCR0_PMC2SEL(0x3f))) | SPR_MMCR0_PMC2SEL(x)) +#define PPC_SET_PMC3SEL(r, x) ((r ~(SPR_MMCR1_PMC3SEL(0x1f))) | SPR_MMCR1_PMC3SEL(x)) +#define PPC_SET_PMC4SEL(r, x) ((r ~(SPR_MMCR1_PMC4SEL(0x1f))) | SPR_MMCR1_PMC4SEL(x)) +#define PPC_SET_PMC5SEL(r, x) ((r ~(SPR_MMCR1_PMC5SEL(0x1f))) | SPR_MMCR1_PMC5SEL(x)) +#define PPC_SET_PMC6SEL(r, x) ((r ~(SPR_MMCR1_PMC6SEL(0x3f))) | SPR_MMCR1_PMC6SEL(x)) + +/* Change this when we support more than just the 7450. */ +#define PPC_MAX_PMCS 6 + +#define POWERPC_PMC_KERNEL_ENABLE (0x1 30) +#define POWERPC_PMC_USER_ENABLE(0x1 31) + +#define POWERPC_PMC_ENABLE (POWERPC_PMC_KERNEL_ENABLE | POWERPC_PMC_USER_ENABLE) +#definePOWERPC_RELOAD_COUNT_TO_PERFCTR_VALUE(V)(0x8000-(V)) +#definePOWERPC_PERFCTR_VALUE_TO_RELOAD_COUNT(P)((P)-0x8000) +#define POWERPC_PMC_HAS_OVERFLOWED(x) (powerpc_pmcn_read(x) (0x1 31)) + + +/* + * This should work for every 32-bit PowerPC implementation I know of (G3 and G4 + * specifically). PoewrPC 970 will take more work. + */ + +/* + * Per-processor information. + */ +struct powerpc_cpu { + struct pmc_hw *pc_ppcpmcs; +}; + +static struct powerpc_cpu **powerpc_pcpu; + +struct powerpc_event_code_map { + enum pmc_event pe_ev; /* enum value */ + uint8_t pe_counter_mask; /* Which counter this can be counted in. */ + uint8_t pe_code; /* numeric code */ +}; + +#define PPC_PMC_MASK1 0 +#define PPC_PMC_MASK2 1 +#define PPC_PMC_MASK3 2 +#define PPC_PMC_MASK4 3 +#define PPC_PMC_MASK5 4 +#define PPC_PMC_MASK6 5 +#define PPC_PMC_MASK_ALL 0x3f + +#define PMC_POWERPC_EVENT(id, mask, number) \ + { .pe_ev = PMC_EV_PPC7450_##id, .pe_counter_mask = mask, .pe_code = number } + +static struct powerpc_event_code_map powerpc_event_codes[] = { + PMC_POWERPC_EVENT(CYCLE,PPC_PMC_MASK_ALL, 1), + PMC_POWERPC_EVENT(INSTR_COMPLETED, 0x0f, 2), + PMC_POWERPC_EVENT(TLB_BIT_TRANSITIONS, 0x0f, 3), + PMC_POWERPC_EVENT(INSTR_DISPATCHED, 0x0f, 4), + PMC_POWERPC_EVENT(PMON_EXCEPT, 0x0f, 5), + PMC_POWERPC_EVENT(PMON_SIG, 0x0f, 7), + PMC_POWERPC_EVENT(VPU_INSTR_COMPLETED, 0x03, 8), + PMC_POWERPC_EVENT(VFPU_INSTR_COMPLETED, 0x03, 9), + PMC_POWERPC_EVENT(VIU1_INSTR_COMPLETED, 0x03, 10), + PMC_POWERPC_EVENT(VIU2_INSTR_COMPLETED, 0x03, 11), + PMC_POWERPC_EVENT(MTVSCR_INSTR_COMPLETED, 0x03, 12), + PMC_POWERPC_EVENT(MTVRSAVE_INSTR_COMPLETED, 0x03, 13), + PMC_POWERPC_EVENT(VPU_INSTR_WAIT_CYCLES, 0x03, 14), + PMC_POWERPC_EVENT(VFPU_INSTR_WAIT_CYCLES, 0x03, 15), + PMC_POWERPC_EVENT(VIU1_INSTR_WAIT_CYCLES, 0x03, 16), + PMC_POWERPC_EVENT(VIU2_INSTR_WAIT_CYCLES, 0x03, 17), + PMC_POWERPC_EVENT(MFVSCR_SYNC_CYCLES, 0x03, 18), + PMC_POWERPC_EVENT(VSCR_SAT_SET, 0x03, 19), + PMC_POWERPC_EVENT(STORE_INSTR_COMPLETED, 0x03, 20), + PMC_POWERPC_EVENT(L1_INSTR_CACHE_MISSES, 0x03, 21), + PMC_POWERPC_EVENT(L1_DATA_SNOOPS, 0x03, 22), + PMC_POWERPC_EVENT(UNRESOLVED_BRANCHES, 0x01, 23), + PMC_POWERPC_EVENT(SPEC_BUFFER_CYCLES, 0x01, 24), + PMC_POWERPC_EVENT(BRANCH_UNIT_STALL_CYCLES, 0x01, 25), + PMC_POWERPC_EVENT(TRUE_BRANCH_TARGET_HITS, 0x01, 26), + PMC_POWERPC_EVENT(BRANCH_LINK_STAC_PREDICTED, 0x01, 27), + PMC_POWERPC_EVENT(GPR_ISSUE_QUEUE_DISPATCHES, 0x01, 28), + PMC_POWERPC_EVENT(CYCLES_THREE_INSTR_DISPATCHED, 0x01, 29), + PMC_POWERPC_EVENT(THRESHOLD_INSTR_QUEUE_ENTRIES_CYCLES, 0x01, 30), + PMC_POWERPC_EVENT(THRESHOLD_VEC_INSTR_QUEUE_ENTRIES_CYCLES, 0x01, 31), + PMC_POWERPC_EVENT(CYCLES_NO_COMPLETED_INSTRS, 0x01, 32), + PMC_POWERPC_EVENT
Re: svn commit: r228874 - head/sys/dev/hwpmc
On Dec 26, 2011, at 1:23 AM, Doug Barton wrote: On 12/25/2011 06:29, Bjoern A. Zeeb wrote: Author: bz Date: Sun Dec 25 14:29:36 2011 New Revision: 228874 URL: http://svn.freebsd.org/changeset/base/228874 Log: Quite the tinderbox for the holidays. Remove the assert[1]. Shouldn't Why it's Ok to remove the assert be part of this commit log? When I suggested the removal, I didn't see it as necessary, and was just looking to quiet the build for now while I look closer. Right now, that code is never called, as it's only used when configured for sampling, and that code was originally just a copy from the hwpmc_amd driver. I will be finishing the sampling code in the new year. - Justin ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r235678 - head/sys/dev/powermac_nvram
Author: jhibbits Date: Sun May 20 02:43:54 2012 New Revision: 235678 URL: http://svn.freebsd.org/changeset/base/235678 Log: nvram,flash may not be the first in the compatible list property of the nvram ofw node, so check all strings in the list. Approved by: nwhitehorn (mentor) MFC after:3 days Modified: head/sys/dev/powermac_nvram/powermac_nvram.c Modified: head/sys/dev/powermac_nvram/powermac_nvram.c == --- head/sys/dev/powermac_nvram/powermac_nvram.cSun May 20 02:05:25 2012(r235677) +++ head/sys/dev/powermac_nvram/powermac_nvram.cSun May 20 02:43:54 2012(r235678) @@ -36,6 +36,7 @@ #include dev/ofw/openfirm.h #include dev/ofw/ofw_bus.h +#include dev/ofw/ofw_bus_subr.h #include machine/bus.h #include machine/md_var.h @@ -118,7 +119,7 @@ powermac_nvram_probe(device_t dev) if (strcmp(type, nvram) != 0) return ENXIO; if (strcmp(compatible, amd-0137) != 0 - strcmp(compatible, nvram,flash) != 0) + !ofw_bus_is_compatible(dev, nvram,flash)) return ENXIO; device_set_desc(dev, Apple NVRAM); ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r230640 - head/etc/devd
Author: jhibbits Date: Sat Jan 28 02:52:22 2012 New Revision: 230640 URL: http://svn.freebsd.org/changeset/base/230640 Log: Remove the notify match from a couple devd apple events, the events don't include notify tags. Approved by: nwhitehorn (mentor) MFC after:3 days Modified: head/etc/devd/apple.conf Modified: head/etc/devd/apple.conf == --- head/etc/devd/apple.confSat Jan 28 02:48:48 2012(r230639) +++ head/etc/devd/apple.confSat Jan 28 02:52:22 2012(r230640) @@ -6,7 +6,6 @@ notify 0 { match system PMU; match subsystem Button; - match notify 0x0; action shutdown -p now; }; @@ -16,7 +15,6 @@ notify 0 { match system PMU; match subsystem lid; match typeclose; - match notify 0x0; action shutdown -p now; }; ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r230859 - head/sys/modules
Author: jhibbits Date: Wed Feb 1 03:42:14 2012 New Revision: 230859 URL: http://svn.freebsd.org/changeset/base/230859 Log: Enable the pccard/cardbus modules for powerpc. Approved by: nwhitehorn (mentor) Modified: head/sys/modules/Makefile Modified: head/sys/modules/Makefile == --- head/sys/modules/Makefile Wed Feb 1 03:28:19 2012(r230858) +++ head/sys/modules/Makefile Wed Feb 1 03:42:14 2012(r230859) @@ -707,9 +707,12 @@ _xe= xe _agp= agp _an= an _bm= bm +_cardbus= cardbus +_cbb= cbb _cfi= cfi _cpufreq= cpufreq _nvram=powermac_nvram +_pccard= pccard _smbfs=smbfs _sound=sound .endif ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r231014 - head/sys/modules
Author: jhibbits Date: Sun Feb 5 13:29:01 2012 New Revision: 231014 URL: http://svn.freebsd.org/changeset/base/231014 Log: Add exca to powerpc modules build as a dependency for cbb. Modified: head/sys/modules/Makefile Modified: head/sys/modules/Makefile == --- head/sys/modules/Makefile Sun Feb 5 12:52:28 2012(r231013) +++ head/sys/modules/Makefile Sun Feb 5 13:29:01 2012(r231014) @@ -764,6 +764,7 @@ _cardbus= cardbus _cbb= cbb _cfi= cfi _cpufreq= cpufreq +_exca= exca _nvram=powermac_nvram _pccard= pccard _smbfs=smbfs ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
Re: svn commit: r231014 - head/sys/modules
On Feb 5, 2012, at 8:29 AM, Justin Hibbits wrote: Author: jhibbits Date: Sun Feb 5 13:29:01 2012 New Revision: 231014 URL: http://svn.freebsd.org/changeset/base/231014 Log: Add exca to powerpc modules build as a dependency for cbb. Approved by: nwhitehorn (mentor) sigh. I really should stop committing first thing in the morning. ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r232176 - head/sys/modules/scc
Author: jhibbits Date: Sun Feb 26 13:27:22 2012 New Revision: 232176 URL: http://svn.freebsd.org/changeset/base/232176 Log: Fix the scc(4) module build. Without the file it's missing a required symbol. Approved by: nwhitehorn (mentor) MFC after:3 days Modified: head/sys/modules/scc/Makefile Modified: head/sys/modules/scc/Makefile == --- head/sys/modules/scc/Makefile Sun Feb 26 12:56:12 2012 (r232175) +++ head/sys/modules/scc/Makefile Sun Feb 26 13:27:22 2012 (r232176) @@ -6,7 +6,7 @@ scc_bfe= scc_bfe_ebus.c scc_bfe_sbus.c .endif .if ${MACHINE_CPUARCH} == powerpc -scc_bfe= scc_bfe_macio.c scc_bfe_quicc.c +scc_bfe= scc_bfe_macio.c scc_bfe_quicc.c scc_dev_quicc.c .endif KMOD= scc ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r232177 - in head: etc/devd sys/conf sys/powerpc/conf sys/powerpc/powermac
Author: jhibbits Date: Sun Feb 26 13:45:25 2012 New Revision: 232177 URL: http://svn.freebsd.org/changeset/base/232177 Log: Add backlight control to ATI-graphics PowerBooks and iBooks. Approved by: nwhitehorn (mentor) MFC after:1 week Added: head/sys/powerpc/powermac/atibl.c (contents, props changed) Modified: head/etc/devd/apple.conf head/sys/conf/files.powerpc head/sys/powerpc/conf/GENERIC head/sys/powerpc/conf/GENERIC64 Modified: head/etc/devd/apple.conf == --- head/etc/devd/apple.confSun Feb 26 13:27:22 2012(r232176) +++ head/etc/devd/apple.confSun Feb 26 13:45:25 2012(r232177) @@ -19,6 +19,26 @@ notify 0 { }; +# The next blocks enable brightness hotkeys that can be found on Apple laptops +notify 0 { + match system PMU; + match subsystem keys; + match typebrightness; + match notify down; + action sysctl dev.backlight.0.level=\ + $(expr `sysctl -n dev.backlight.0.level` - 10); +}; + +notify 0 { + match system PMU; + match subsystem keys; + match typebrightness; + match notify up; + action sysctl dev.backlight.0.level=\ + $(expr `sysctl -n dev.backlight.0.level` + 10); +}; + + # The next blocks enable volume hotkeys that can be found on Apple laptops notify 0 { match system PMU; Modified: head/sys/conf/files.powerpc == --- head/sys/conf/files.powerpc Sun Feb 26 13:27:22 2012(r232176) +++ head/sys/conf/files.powerpc Sun Feb 26 13:45:25 2012(r232177) @@ -145,6 +145,7 @@ powerpc/ofw/rtas.c optionalaim powerpc/powermac/ata_kauai.c optionalpowermac ata | powermac atamacio powerpc/powermac/ata_macio.c optionalpowermac ata | powermac atamacio powerpc/powermac/ata_dbdma.c optionalpowermac ata | powermac atamacio +powerpc/powermac/atibl.c optionalpowermac atibl powerpc/powermac/cuda.coptionalpowermac cuda powerpc/powermac/cpcht.c optionalpowermac pci powerpc/powermac/dbdma.c optionalpowermac pci Modified: head/sys/powerpc/conf/GENERIC == --- head/sys/powerpc/conf/GENERIC Sun Feb 26 13:27:22 2012 (r232176) +++ head/sys/powerpc/conf/GENERIC Sun Feb 26 13:45:25 2012 (r232177) @@ -194,6 +194,7 @@ device max6690 # PowerMac7,2 temperatu device powermac_nvram # Open Firmware configuration NVRAM device smu # Apple System Management Unit device windtunnel # Apple G4 MDD fan controller +device atibl # ATI-based backlight driver for PowerBooks/iBooks # ADB support device adb Modified: head/sys/powerpc/conf/GENERIC64 == --- head/sys/powerpc/conf/GENERIC64 Sun Feb 26 13:27:22 2012 (r232176) +++ head/sys/powerpc/conf/GENERIC64 Sun Feb 26 13:45:25 2012 (r232177) @@ -188,6 +188,7 @@ device fcu # Apple Fan Control Unit device max6690 # PowerMac7,2 temperature sensor device powermac_nvram # Open Firmware configuration NVRAM device smu # Apple System Management Unit +device atibl # ATI-based backlight driver for PowerBooks/iBooks # ADB support device adb Added: head/sys/powerpc/powermac/atibl.c == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/powerpc/powermac/atibl.c Sun Feb 26 13:45:25 2012 (r232177) @@ -0,0 +1,196 @@ +/*- + * Copyright (c) 2012 Justin Hibbits + * 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 ``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 BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING
svn commit: r249636 - head/sys/modules/uart
Author: jhibbits Date: Fri Apr 19 05:46:16 2013 New Revision: 249636 URL: http://svnweb.freebsd.org/changeset/base/249636 Log: Fix the uart(4) module build. Without uart_dev_lpc the module cannot be loaded. Modified: head/sys/modules/uart/Makefile Modified: head/sys/modules/uart/Makefile == --- head/sys/modules/uart/Makefile Fri Apr 19 05:28:08 2013 (r249635) +++ head/sys/modules/uart/Makefile Fri Apr 19 05:46:16 2013 (r249636) @@ -23,7 +23,7 @@ KMOD= uart SRCS= uart_bus_acpi.c ${uart_bus_ebus} uart_bus_isa.c uart_bus_pccard.c \ uart_bus_pci.c uart_bus_puc.c uart_bus_scc.c \ uart_core.c ${uart_cpu_machine} uart_dbg.c \ - uart_dev_ns8250.c uart_dev_quicc.c uart_dev_sab82532.c \ + uart_dev_lpc.c uart_dev_ns8250.c uart_dev_quicc.c uart_dev_sab82532.c \ uart_dev_z8530.c \ uart_if.c uart_if.h uart_subr.c uart_tty.c ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r249864 - head/sys/powerpc/aim
Author: jhibbits Date: Thu Apr 25 00:39:43 2013 New Revision: 249864 URL: http://svnweb.freebsd.org/changeset/base/249864 Log: Introduce kernel coredumps to ppc32 AIM. Leeched from the booke code. MFC after:2 weeks Modified: head/sys/powerpc/aim/mmu_oea.c Modified: head/sys/powerpc/aim/mmu_oea.c == --- head/sys/powerpc/aim/mmu_oea.c Wed Apr 24 23:38:04 2013 (r249863) +++ head/sys/powerpc/aim/mmu_oea.c Thu Apr 25 00:39:43 2013 (r249864) @@ -167,6 +167,11 @@ struct ofw_map { u_int om_mode; }; +extern unsigned char _etext[]; +extern unsigned char _end[]; + +extern int dumpsys_minidump; + /* * Map of physical memory regions. */ @@ -316,6 +321,9 @@ void moea_kenter(mmu_t, vm_offset_t, vm_ void moea_page_set_memattr(mmu_t mmu, vm_page_t m, vm_memattr_t ma); boolean_t moea_dev_direct_mapped(mmu_t, vm_paddr_t, vm_size_t); static void moea_sync_icache(mmu_t, pmap_t, vm_offset_t, vm_size_t); +vm_offset_t moea_dumpsys_map(mmu_t mmu, struct pmap_md *md, vm_size_t ofs, +vm_size_t *sz); +struct pmap_md * moea_scan_md(mmu_t mmu, struct pmap_md *prev); static mmu_method_t moea_methods[] = { MMUMETHOD(mmu_change_wiring,moea_change_wiring), @@ -363,6 +371,8 @@ static mmu_method_t moea_methods[] = { MMUMETHOD(mmu_kenter, moea_kenter), MMUMETHOD(mmu_kenter_attr, moea_kenter_attr), MMUMETHOD(mmu_dev_direct_mapped,moea_dev_direct_mapped), + MMUMETHOD(mmu_scan_md, moea_scan_md), + MMUMETHOD(mmu_dumpsys_map, moea_dumpsys_map), { 0, 0 } }; @@ -2567,3 +2577,104 @@ moea_sync_icache(mmu_t mmu, pmap_t pm, v } PMAP_UNLOCK(pm); } + +vm_offset_t +moea_dumpsys_map(mmu_t mmu, struct pmap_md *md, vm_size_t ofs, +vm_size_t *sz) +{ + if (md-md_vaddr == ~0UL) + return (md-md_paddr + ofs); + else + return (md-md_vaddr + ofs); +} + +/* TODO: Run this on minbar, single calls, to check addresses, offsets, and + * sizes. It should be doing more than just single pages. + */ +struct pmap_md * +moea_scan_md(mmu_t mmu, struct pmap_md *prev) +{ + static struct pmap_md md; + struct pvo_entry *pvo; + vm_offset_t va; + + if (dumpsys_minidump) { + md.md_paddr = ~0UL; /* Minidumps use virtual addresses. */ + if (prev == NULL) { + /* 1st: kernel .data and .bss. */ + md.md_index = 1; + md.md_vaddr = trunc_page((uintptr_t)_etext); + md.md_size = round_page((uintptr_t)_end) - md.md_vaddr; + return (md); + } + switch (prev-md_index) { + case 1: + /* 2nd: msgbuf and tables (see pmap_bootstrap()). */ + md.md_index = 2; + md.md_vaddr = (vm_offset_t)msgbufp-msg_ptr; + md.md_size = round_page(msgbufp-msg_size); + break; + case 2: + /* 3rd: kernel VM. */ + va = prev-md_vaddr + prev-md_size; + /* Find start of next chunk (from va). */ + while (va virtual_end) { + /* Don't dump the buffer cache. */ + if (va = kmi.buffer_sva + va kmi.buffer_eva) { + va = kmi.buffer_eva; + continue; + } + pvo = moea_pvo_find_va(kernel_pmap, + va ~ADDR_POFF, NULL); + if (pvo != NULL + (pvo-pvo_pte.pte.pte_hi PTE_VALID)) + break; + va += PAGE_SIZE; + } + if (va virtual_end) { + md.md_vaddr = va; + va += PAGE_SIZE; + /* Find last page in chunk. */ + while (va virtual_end) { + /* Don't run into the buffer cache. */ + if (va == kmi.buffer_sva) + break; + pvo = moea_pvo_find_va(kernel_pmap, + va ~ADDR_POFF, NULL); + if (pvo == NULL || + !(pvo-pvo_pte.pte.pte_hi PTE_VALID)) + break; + va += PAGE_SIZE; + } +
svn commit: r249918 - head/sys/powerpc/aim
Author: jhibbits Date: Fri Apr 26 05:18:18 2013 New Revision: 249918 URL: http://svnweb.freebsd.org/changeset/base/249918 Log: Remove a comment that shouldn't have gone in. X-MFC-with: r249864 Modified: head/sys/powerpc/aim/mmu_oea.c Modified: head/sys/powerpc/aim/mmu_oea.c == --- head/sys/powerpc/aim/mmu_oea.c Fri Apr 26 05:13:48 2013 (r249917) +++ head/sys/powerpc/aim/mmu_oea.c Fri Apr 26 05:18:18 2013 (r249918) @@ -2588,9 +2588,6 @@ moea_dumpsys_map(mmu_t mmu, struct pmap_ return (md-md_vaddr + ofs); } -/* TODO: Run this on minbar, single calls, to check addresses, offsets, and - * sizes. It should be doing more than just single pages. - */ struct pmap_md * moea_scan_md(mmu_t mmu, struct pmap_md *prev) { ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r251356 - head/sys/powerpc/include
Author: jhibbits Date: Tue Jun 4 00:40:26 2013 New Revision: 251356 URL: http://svnweb.freebsd.org/changeset/base/251356 Log: Pad the PCPU MD struct, to satisfy an assert added with the projects/counters branch import. PR: ports/179173,ports/179164 Modified: head/sys/powerpc/include/pcpu.h Modified: head/sys/powerpc/include/pcpu.h == --- head/sys/powerpc/include/pcpu.h Tue Jun 4 00:38:19 2013 (r251355) +++ head/sys/powerpc/include/pcpu.h Tue Jun 4 00:40:26 2013 (r251356) @@ -128,7 +128,7 @@ struct pmap; */ #ifndef PCPU_MD_FIELDS #definePCPU_MD_FIELDS \ - int pc_md_placeholder + int pc_md_placeholder[32] #endif #ifdef _KERNEL ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r252115 - head/sys/powerpc/ofw
Author: jhibbits Date: Sun Jun 23 14:20:54 2013 New Revision: 252115 URL: http://svnweb.freebsd.org/changeset/base/252115 Log: Cache the Open Firmware CPU properties at attach time, so we don't always enter it at runtime to get static data. Modified: head/sys/powerpc/ofw/ofw_cpu.c Modified: head/sys/powerpc/ofw/ofw_cpu.c == --- head/sys/powerpc/ofw/ofw_cpu.c Sun Jun 23 13:27:37 2013 (r252114) +++ head/sys/powerpc/ofw/ofw_cpu.c Sun Jun 23 14:20:54 2013 (r252115) @@ -133,6 +133,11 @@ static int ofw_cpu_attach(device_t); static int ofw_cpu_read_ivar(device_t dev, device_t child, int index, uintptr_t *result); +struct ofw_cpu_softc { + struct pcpu *sc_cpu_pcpu; + uint32_t sc_nominal_mhz; +}; + static device_method_t ofw_cpu_methods[] = { /* Device interface */ DEVMETHOD(device_probe, ofw_cpu_probe), @@ -175,6 +180,15 @@ ofw_cpu_probe(device_t dev) static int ofw_cpu_attach(device_t dev) { + struct ofw_cpu_softc *sc; + uint32_t cell; + + sc = device_get_softc(dev); + OF_getprop(ofw_bus_get_node(dev), reg, cell, sizeof(cell)); + sc-sc_cpu_pcpu = pcpu_find(cell); + OF_getprop(ofw_bus_get_node(dev), clock-frequency, cell, sizeof(cell)); + sc-sc_nominal_mhz = cell / 100; /* convert to MHz */ + bus_generic_probe(dev); return (bus_generic_attach(dev)); } @@ -182,19 +196,16 @@ ofw_cpu_attach(device_t dev) static int ofw_cpu_read_ivar(device_t dev, device_t child, int index, uintptr_t *result) { - uint32_t cell; + struct ofw_cpu_softc *sc; + + sc = device_get_softc(dev); switch (index) { case CPU_IVAR_PCPU: - OF_getprop(ofw_bus_get_node(dev), reg, cell, sizeof(cell)); - *result = (uintptr_t)(pcpu_find(cell)); + *result = (uintptr_t)sc-sc_cpu_pcpu; return (0); case CPU_IVAR_NOMINAL_MHZ: - cell = 0; - OF_getprop(ofw_bus_get_node(dev), clock-frequency, - cell, sizeof(cell)); - cell /= 100; /* convert to MHz */ - *result = (uintptr_t)(cell); + *result = (uintptr_t)sc-sc_nominal_mhz; return (0); } ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r261420 - head/sys/modules/hwpmc
Author: jhibbits Date: Mon Feb 3 01:16:32 2014 New Revision: 261420 URL: http://svnweb.freebsd.org/changeset/base/261420 Log: Add missing file to Makefile. MFC after:1 month X-MFC-with: 261342 Modified: head/sys/modules/hwpmc/Makefile Modified: head/sys/modules/hwpmc/Makefile == --- head/sys/modules/hwpmc/Makefile Sun Feb 2 23:29:51 2014 (r261419) +++ head/sys/modules/hwpmc/Makefile Mon Feb 3 01:16:32 2014 (r261420) @@ -29,7 +29,7 @@ SRCS+=hwpmc_ia64.c .endif .if ${MACHINE_CPUARCH} == powerpc -SRCS+= hwpmc_powerpc.c hwpmc_mpc7xxx.c +SRCS+= hwpmc_powerpc.c hwpmc_mpc7xxx.c hwpmc_ppc970.c .endif .if ${MACHINE_CPUARCH} == sparc64 ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r261421 - in head/sys: conf dev/iicbus powerpc/conf
Author: jhibbits Date: Mon Feb 3 01:22:50 2014 New Revision: 261421 URL: http://svnweb.freebsd.org/changeset/base/261421 Log: Add driver for the ADT7460/ADT7467 fan controller found in later PowerBooks and iBooks. Original work by andreast. MFC after:1 month Added: head/sys/dev/iicbus/adt746x.c (contents, props changed) Modified: head/sys/conf/files.powerpc head/sys/powerpc/conf/GENERIC Modified: head/sys/conf/files.powerpc == --- head/sys/conf/files.powerpc Mon Feb 3 01:16:32 2014(r261420) +++ head/sys/conf/files.powerpc Mon Feb 3 01:22:50 2014(r261421) @@ -33,6 +33,7 @@ dev/hwpmc/hwpmc_powerpc.c optionalhwpmc dev/hwpmc/hwpmc_mpc7xxx.c optionalhwpmc dev/hwpmc/hwpmc_ppc970.c optionalhwpmc dev/iicbus/ad7417.coptionalad7417 powermac +dev/iicbus/adt746x.c optionaladt746x powermac dev/iicbus/ds1631.coptionalds1631 powermac dev/iicbus/ds1775.coptionalds1775 powermac dev/iicbus/max6690.c optionalmax6690 powermac Added: head/sys/dev/iicbus/adt746x.c == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/iicbus/adt746x.c Mon Feb 3 01:22:50 2014 (r261421) @@ -0,0 +1,664 @@ +/*- + * Copyright (c) 2012 Andreas Tobler + * Copyright (c) 2014 Justin Hibbits + * 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 ``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 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. + */ + +#include sys/cdefs.h +__FBSDID($FreeBSD$); + +#include sys/param.h +#include sys/bus.h +#include sys/systm.h +#include sys/module.h +#include sys/callout.h +#include sys/conf.h +#include sys/cpu.h +#include sys/ctype.h +#include sys/kernel.h +#include sys/reboot.h +#include sys/rman.h +#include sys/sysctl.h +#include sys/limits.h + +#include machine/bus.h +#include machine/md_var.h + +#include dev/iicbus/iicbus.h +#include dev/iicbus/iiconf.h + +#include dev/ofw/openfirm.h +#include dev/ofw/ofw_bus.h +#include powerpc/powermac/powermac_thermal.h + +/* ADT746X registers. */ +#define ADT746X_TACH1LOW 0x28 +#define ADT746X_TACH1HIGH 0x29 +#define ADT746X_TACH2LOW 0x2a +#define ADT746X_TACH2HIGH 0x2b +#define ADT746X_PWM1 0x30 +#define ADT746X_PWM2 0x31 +#define ADT746X_DEVICE_ID 0x3d +#define ADT746X_COMPANY_ID0x3e +#define ADT746X_REV_ID0x3f +#define ADT746X_CONFIG0x40 +#define ADT746X_PWM1_CONF 0x5c +#define ADT746X_PWM2_CONF 0x5d +#define ADT746X_MANUAL_MASK 0xe0 + +#define ADT7460_DEV_ID0x27 +#define ADT7467_DEV_ID0x68 + +struct adt746x_fan { + struct pmac_fan fan; + device_tdev; + int id; + int setpoint; + int pwm_reg; + int conf_reg; +}; + +struct adt746x_sensor { + struct pmac_therm therm; + device_t dev; + int id; + cell_treg; + enum { + ADT746X_SENSOR_TEMP, + ADT746X_SENSOR_VOLT, + ADT746X_SENSOR_SPEED + } type; +}; + +struct adt746x_softc { + device_tsc_dev; + struct intr_config_hook enum_hook; + uint32_tsc_addr; + /* The 7467 supports up to 4 fans, 2 voltage and 3 temperature sensors. */ + struct adt746x_fan sc_fans[4]; + int sc_nfans; + struct adt746x_sensor sc_sensors[9]; + int sc_nsensors; + int
svn commit: r261422 - head/contrib/binutils/gas/config
Author: jhibbits Date: Mon Feb 3 01:45:07 2014 New Revision: 261422 URL: http://svnweb.freebsd.org/changeset/base/261422 Log: Make gas accept any PowerPC instruction by default. This is a local change, and will not be submitted upstream. Discussed with: nwhitehorn,rdivacky MFC after:1 month Modified: head/contrib/binutils/gas/config/tc-ppc.c Modified: head/contrib/binutils/gas/config/tc-ppc.c == --- head/contrib/binutils/gas/config/tc-ppc.c Mon Feb 3 01:22:50 2014 (r261421) +++ head/contrib/binutils/gas/config/tc-ppc.c Mon Feb 3 01:45:07 2014 (r261422) @@ -681,7 +681,7 @@ ppc_parse_name (const char *name, expres /* The type of processor we are assembling for. This is one or more of the PPC_OPCODE flags defined in opcode/ppc.h. */ -static unsigned long ppc_cpu = 0; +static unsigned long ppc_cpu = PPC_OPCODE_ANY; /* Whether to target xcoff64/elf64. */ static unsigned int ppc_obj64 = BFD_DEFAULT_TARGET_SIZE == 64; ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
Re: svn commit: r262466 - head/sys/cddl/dev/systrace
On Tue, Feb 25, 2014 at 5:35 PM, Mark Johnston ma...@freebsd.org wrote: On Tue, Feb 25, 2014 at 03:17:56PM -0800, Justin Hibbits wrote: I think this broke powerpc building. I see the following build failure: cc1: warnings being treated as errors /home/chmeee/freebsd/head/sys/modules/dtrace/systrace/../../../cddl/dev/systrace/systrace.c: In function 'systrace_probe': /home/chmeee/freebsd/head/sys/modules/dtrace/systrace/../../../cddl/dev/systrace/systrace.c:218: warning: function called through a non-compatible type /home/chmeee/freebsd/head/sys/modules/dtrace/systrace/../../../cddl/dev/systrace/systrace.c:218: note: if this code is reached, the program will abort Hi Justin, Sorry about this. I've reverted the commit. I realize that the change introduced undefined behaviour, but a similar trick is used elsewhere in the DTrace code to pass extra arguments at a probe site. Calling dtrace_probe() through a function pointer (patch below) makes the warning go away, but I don't really understand why. clang doesn't emit warnings in either case. Thanks, -Mark diff --git a/sys/cddl/dev/systrace/systrace.c b/sys/cddl/dev/systrace/systrace.c index 83f0793..5f4b82f 100644 --- a/sys/cddl/dev/systrace/systrace.c +++ b/sys/cddl/dev/systrace/systrace.c @@ -168,8 +168,8 @@ static dtrace_pops_t systrace_pops = { static struct cdev *systrace_cdev; static dtrace_provider_id_tsystrace_id; -typedef void (*systrace_dtrace_probe)(dtrace_id_t, uintptr_t, uintptr_t, -uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t); +typedef void (*systrace_probe_t)(dtrace_id_t, uintptr_t, uintptr_t, uintptr_t, +uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t); #if !defined(LINUX_SYSTRACE) /* @@ -214,8 +214,9 @@ systrace_probe(u_int32_t id, int sysnum, struct sysent *sysent, void *params, } /* Process the probe using the converted argments. */ - ((systrace_dtrace_probe)(dtrace_probe))(id, uargs[0], uargs[1], - uargs[2], uargs[3], uargs[4], uargs[5], uargs[6], uargs[7]); + systrace_probe_t probe = (systrace_probe_t)dtrace_probe; + probe(id, uargs[0], uargs[1], uargs[2], uargs[3], uargs[4], + uargs[5], uargs[6], uargs[7]); } #endif Hi Mark, I think this patch works because it circumvents gcc's variable tracking. With the first patch, gcc knew the function that was being called, and knew it was undefined behavior. With the second patch, it only knows at that time that you're calling through a function pointer. It's completely forgotten that the function pointer is pointing to that function. Just a guess. I'll give it a go and let you know if it still complains. Thanks! - Justin ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
Re: svn commit: r262466 - head/sys/cddl/dev/systrace
On Wed, Feb 26, 2014 at 9:52 AM, Justin Hibbits jhibb...@freebsd.org wrote: On Tue, Feb 25, 2014 at 5:35 PM, Mark Johnston ma...@freebsd.org wrote: On Tue, Feb 25, 2014 at 03:17:56PM -0800, Justin Hibbits wrote: I think this broke powerpc building. I see the following build failure: cc1: warnings being treated as errors /home/chmeee/freebsd/head/sys/modules/dtrace/systrace/../../../cddl/dev/systrace/systrace.c: In function 'systrace_probe': /home/chmeee/freebsd/head/sys/modules/dtrace/systrace/../../../cddl/dev/systrace/systrace.c:218: warning: function called through a non-compatible type /home/chmeee/freebsd/head/sys/modules/dtrace/systrace/../../../cddl/dev/systrace/systrace.c:218: note: if this code is reached, the program will abort Hi Justin, Sorry about this. I've reverted the commit. I realize that the change introduced undefined behaviour, but a similar trick is used elsewhere in the DTrace code to pass extra arguments at a probe site. Calling dtrace_probe() through a function pointer (patch below) makes the warning go away, but I don't really understand why. clang doesn't emit warnings in either case. Thanks, -Mark diff --git a/sys/cddl/dev/systrace/systrace.c b/sys/cddl/dev/systrace/systrace.c index 83f0793..5f4b82f 100644 --- a/sys/cddl/dev/systrace/systrace.c +++ b/sys/cddl/dev/systrace/systrace.c @@ -168,8 +168,8 @@ static dtrace_pops_t systrace_pops = { static struct cdev *systrace_cdev; static dtrace_provider_id_tsystrace_id; -typedef void (*systrace_dtrace_probe)(dtrace_id_t, uintptr_t, uintptr_t, -uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t); +typedef void (*systrace_probe_t)(dtrace_id_t, uintptr_t, uintptr_t, uintptr_t, +uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t); #if !defined(LINUX_SYSTRACE) /* @@ -214,8 +214,9 @@ systrace_probe(u_int32_t id, int sysnum, struct sysent *sysent, void *params, } /* Process the probe using the converted argments. */ - ((systrace_dtrace_probe)(dtrace_probe))(id, uargs[0], uargs[1], - uargs[2], uargs[3], uargs[4], uargs[5], uargs[6], uargs[7]); + systrace_probe_t probe = (systrace_probe_t)dtrace_probe; + probe(id, uargs[0], uargs[1], uargs[2], uargs[3], uargs[4], + uargs[5], uargs[6], uargs[7]); } #endif Hi Mark, I think this patch works because it circumvents gcc's variable tracking. With the first patch, gcc knew the function that was being called, and knew it was undefined behavior. With the second patch, it only knows at that time that you're calling through a function pointer. It's completely forgotten that the function pointer is pointing to that function. Just a guess. I'll give it a go and let you know if it still complains. Thanks! - Justin Just tested and confirmed it builds successfully. - Justin ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r262547 - head/sys/dev/hwpmc
Author: jhibbits Date: Thu Feb 27 04:45:29 2014 New Revision: 262547 URL: http://svnweb.freebsd.org/changeset/base/262547 Log: Fix callchain capture for hwpmc(4). While here, some style(9) fixes, too. MFC after:2 weeks Modified: head/sys/dev/hwpmc/hwpmc_powerpc.c Modified: head/sys/dev/hwpmc/hwpmc_powerpc.c == --- head/sys/dev/hwpmc/hwpmc_powerpc.c Thu Feb 27 04:06:34 2014 (r262546) +++ head/sys/dev/hwpmc/hwpmc_powerpc.c Thu Feb 27 04:45:29 2014 (r262547) @@ -32,6 +32,7 @@ __FBSDID($FreeBSD$); #include sys/param.h #include sys/pmc.h #include sys/pmckern.h +#include sys/sysent.h #include sys/systm.h #include machine/pmc_mdep.h @@ -60,10 +61,14 @@ pmc_save_kernel_callchain(uintptr_t *cc, cc[frames++] = PMC_TRAPFRAME_TO_PC(tf); sp = (uintptr_t *)PMC_TRAPFRAME_TO_FP(tf); - for (frames = 1; frames maxsamples; frames++) { + for (; frames maxsamples; frames++) { if (!INKERNEL(sp)) break; +#ifdef __powerpc64__ + cc[frames++] = sp[2]; +#else cc[frames++] = sp[1]; +#endif sp = (uintptr_t *)*sp; } return (frames); @@ -72,12 +77,14 @@ pmc_save_kernel_callchain(uintptr_t *cc, static int powerpc_switch_in(struct pmc_cpu *pc, struct pmc_process *pp) { + return (0); } static int powerpc_switch_out(struct pmc_cpu *pc, struct pmc_process *pp) { + return (0); } @@ -111,6 +118,7 @@ powerpc_describe(int cpu, int ri, struct int powerpc_get_config(int cpu, int ri, struct pmc **ppm) { + *ppm = powerpc_pcpu[cpu]-pc_ppcpmcs[ri].phw_pmc; return (0); @@ -182,11 +190,23 @@ pmc_save_user_callchain(uintptr_t *cc, i cc[frames++] = PMC_TRAPFRAME_TO_PC(tf); sp = (uintptr_t *)PMC_TRAPFRAME_TO_FP(tf); - for (frames = 1; frames maxsamples; frames++) { + for (; frames maxsamples; frames++) { if (!INUSER(sp)) break; - cc[frames++] = fuword(sp + 1); - sp = (uintptr_t *)fuword(sp); +#ifdef __powerpc64__ + /* Check if 32-bit mode. */ + if (!(tf-srr1 PSL_SF)) { + cc[frames++] = fuword32((uint32_t *)sp + 1); + sp = (uintptr_t *)(uintptr_t)fuword32(sp); + } else { + cc[frames++] = fuword(sp + 2); + sp = (uintptr_t *)fuword(sp); + } +#else + cc[frames++] = fuword32((uint32_t *)sp + 1); + sp = (uintptr_t *)fuword32(sp); +#endif } + return (frames); } ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r263464 - head/sys/powerpc/include
Author: jhibbits Date: Fri Mar 21 04:45:57 2014 New Revision: 263464 URL: http://svnweb.freebsd.org/changeset/base/263464 Log: Mask out SRR1 bits that aren't exported to the MSR. This appears to fix a strange condition with X on 32-bit PowerBooks I observed, caused by one of these bits getting set in the mcontext, but not set in the thread, which may be a symptom of another problem, more difficult to diagnose. Since these bits aren't exported anyway, this change makes it more explicit that the bits aren't MSR-related in SRR1. MFC after:3 weeks Modified: head/sys/powerpc/include/psl.h Modified: head/sys/powerpc/include/psl.h == --- head/sys/powerpc/include/psl.h Fri Mar 21 04:33:38 2014 (r263463) +++ head/sys/powerpc/include/psl.h Fri Mar 21 04:45:57 2014 (r263464) @@ -88,15 +88,17 @@ #define PSL_KERNSET(PSL_CE | PSL_ME | PSL_EE) #elif defined(BOOKE_PPC4XX) #define PSL_KERNSET(PSL_CE | PSL_ME | PSL_EE | PSL_FP) +#define PSL_SRR1_MASK 0xUL/* No mask on Book-E */ #elif defined(AIM) #ifdef __powerpc64__ #definePSL_KERNSET (PSL_SF | PSL_EE | PSL_ME | PSL_IR | PSL_DR | PSL_RI) #else #definePSL_KERNSET (PSL_EE | PSL_ME | PSL_IR | PSL_DR | PSL_RI) #endif +#define PSL_SRR1_MASK 0x7830UL/* Bits 1-4, 10-15 (ppc32), 33-36, 42-47 (ppc64) */ #endif #definePSL_USERSET (PSL_KERNSET | PSL_PR) -#definePSL_USERSTATIC ~(PSL_VEC | PSL_FP | PSL_FE0 | PSL_FE1) +#definePSL_USERSTATIC (~(PSL_VEC | PSL_FP | PSL_FE0 | PSL_FE1) ~PSL_SRR1_MASK) #endif /* _MACHINE_PSL_H_ */ ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
Re: svn commit: r261342 - in head: lib/libpmc sys/conf sys/dev/hwpmc sys/powerpc/include sys/sys
On Mon, 24 Mar 2014 05:44:42 + Alexey Dokuchaev da...@freebsd.org wrote: On Sat, Feb 01, 2014 at 02:03:51AM +, Justin Hibbits wrote: New Revision: 261342 URL: http://svnweb.freebsd.org/changeset/base/261342 Log: Add hwpmc(4) support for the PowerPC 970 class processors, direct events. This also fixes asserts on removal of the module for the mpc74xx. Hmm, -CURRENT does not build for me after this commit apparently; take a look at the log excerpt. Could it be that r261342 relies on some earlier revision which I'm missing (that is, my r260369'ish -CURRENT is too old)? What's the best way to catch up? Thanks, ./danfe It looks to me like it's picking up your old PMC header files. Did you try doing a full buildworld (without a -DNO_CLEAN)? I've built world multiple times since and it works just fine for me. - Justin ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
Re: svn commit: r261342 - in head: lib/libpmc sys/conf sys/dev/hwpmc sys/powerpc/include sys/sys
On Tue, Mar 25, 2014 at 2:06 AM, Alexey Dokuchaev da...@freebsd.org wrote: On Sun, Mar 23, 2014 at 10:58:18PM -0700, Justin Hibbits wrote: On Mon, 24 Mar 2014 05:44:42 + Alexey Dokuchaev wrote: Hmm, -CURRENT does not build for me after this commit apparently; take a look at the log excerpt. Could it be that r261342 relies on some earlier revision which I'm missing (that is, my r260369'ish -CURRENT is too old)? What's the best way to catch up? Thanks, It looks to me like it's picking up your old PMC header files. Did you try doing a full buildworld (without a -DNO_CLEAN)? I've built world multiple times since and it works just fine for me. It turned out to be ccache's fault. Once I've resumed the build with -DNO_CLEAN -DNO_CCACHE, it finished just fine. ./danfe Good to hear. I've never used ccache myself. - Justin ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
Re: svn commit: r263752 - head/sys/powerpc/include
On Tue, Mar 25, 2014 at 3:49 PM, Warner Losh i...@freebsd.org wrote: Author: imp Date: Tue Mar 25 22:49:33 2014 New Revision: 263752 URL: http://svnweb.freebsd.org/changeset/base/263752 Log: Define PSL_SRR1_MASK for BOOK-E too so MPC85XX compiles again. Modified: head/sys/powerpc/include/psl.h Modified: head/sys/powerpc/include/psl.h == --- head/sys/powerpc/include/psl.h Tue Mar 25 22:43:34 2014 (r263751) +++ head/sys/powerpc/include/psl.h Tue Mar 25 22:49:33 2014 (r263752) @@ -86,6 +86,7 @@ /* Initial kernel MSR, use IS=1 ad DS=1. */ #define PSL_KERNSET_INIT (PSL_IS | PSL_DS) #define PSL_KERNSET(PSL_CE | PSL_ME | PSL_EE) +#define PSL_SRR1_MASK 0xUL/* No mask on Book-E */ #elif defined(BOOKE_PPC4XX) #define PSL_KERNSET(PSL_CE | PSL_ME | PSL_EE | PSL_FP) #define PSL_SRR1_MASK 0xUL/* No mask on Book-E */ D'oh, thanks! ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r264189 - head/sys/powerpc/include
Author: jhibbits Date: Sun Apr 6 06:18:43 2014 New Revision: 264189 URL: http://svnweb.freebsd.org/changeset/base/264189 Log: Correct the SRR1 mask, it's 10-15 not 10-11. X-MFC-with: r263464,r263752 Modified: head/sys/powerpc/include/psl.h Modified: head/sys/powerpc/include/psl.h == --- head/sys/powerpc/include/psl.h Sun Apr 6 05:45:43 2014 (r264188) +++ head/sys/powerpc/include/psl.h Sun Apr 6 06:18:43 2014 (r264189) @@ -96,7 +96,7 @@ #else #definePSL_KERNSET (PSL_EE | PSL_ME | PSL_IR | PSL_DR | PSL_RI) #endif -#define PSL_SRR1_MASK 0x7830UL/* Bits 1-4, 10-15 (ppc32), 33-36, 42-47 (ppc64) */ +#define PSL_SRR1_MASK 0x783fUL/* Bits 1-4, 10-15 (ppc32), 33-36, 42-47 (ppc64) */ #endif #definePSL_USERSET (PSL_KERNSET | PSL_PR) ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r264205 - head/sys/powerpc/powermac
Author: jhibbits Date: Sun Apr 6 21:48:45 2014 New Revision: 264205 URL: http://svnweb.freebsd.org/changeset/base/264205 Log: Fix the ATI backlight driver off/on handling. Now this driver works correctly with the ATI Radeon 9700 in the PowerBook G4 1.67GHz. Code shamelessly taken in spirit from the radeonkms driver, which I hope will make this driver redundant in the future. MFC after:2 weeks Modified: head/sys/powerpc/powermac/atibl.c Modified: head/sys/powerpc/powermac/atibl.c == --- head/sys/powerpc/powermac/atibl.c Sun Apr 6 21:45:38 2014 (r264204) +++ head/sys/powerpc/powermac/atibl.c Sun Apr 6 21:48:45 2014 (r264205) @@ -57,6 +57,12 @@ __FBSDID($FreeBSD$); #define RADEON_LVDS_PLL_RESET(117) #define RADEON_PIXCLKS_CNTL 0x002d #define RADEON_PIXCLK_LVDS_ALWAYS_ONb (114) +#define RADEON_DISP_PWR_MAN 0x0d08 +#define RADEON_AUTO_PWRUP_EN (1 26) +#define RADEON_CLOCK_CNTL_DATA 0x000c +#define RADEON_CLOCK_CNTL_INDEX 0x0008 +#define RADEON_PLL_WR_EN (1 7) +#define RADEON_CRTC_GEN_CNTL 0x0050 struct atibl_softc { struct resource *sc_memr; @@ -151,12 +157,56 @@ atibl_attach(device_t dev) return (0); } +static uint32_t __inline +atibl_pll_rreg(struct atibl_softc *sc, uint32_t reg) +{ + uint32_t data, save, tmp; + + bus_write_1(sc-sc_memr, RADEON_CLOCK_CNTL_INDEX, + ((reg 0x3f) | RADEON_PLL_WR_EN)); + (void)bus_read_4(sc-sc_memr, RADEON_CLOCK_CNTL_DATA); + (void)bus_read_4(sc-sc_memr, RADEON_CRTC_GEN_CNTL); + + data = bus_read_4(sc-sc_memr, RADEON_CLOCK_CNTL_DATA); + + /* Only necessary on R300, bt won't hurt others. */ + save = bus_read_4(sc-sc_memr, RADEON_CLOCK_CNTL_INDEX); + tmp = save (~0x3f | RADEON_PLL_WR_EN); + bus_write_4(sc-sc_memr, RADEON_CLOCK_CNTL_INDEX, tmp); + tmp = bus_read_4(sc-sc_memr, RADEON_CLOCK_CNTL_DATA); + bus_write_4(sc-sc_memr, RADEON_CLOCK_CNTL_INDEX, save); + + return data; +} + +static void __inline +atibl_pll_wreg(struct atibl_softc *sc, uint32_t reg, uint32_t val) +{ + uint32_t save, tmp; + + bus_write_1(sc-sc_memr, RADEON_CLOCK_CNTL_INDEX, + ((reg 0x3f) | RADEON_PLL_WR_EN)); + (void)bus_read_4(sc-sc_memr, RADEON_CLOCK_CNTL_DATA); + (void)bus_read_4(sc-sc_memr, RADEON_CRTC_GEN_CNTL); + + bus_write_4(sc-sc_memr, RADEON_CLOCK_CNTL_DATA, val); + DELAY(5000); + + /* Only necessary on R300, bt won't hurt others. */ + save = bus_read_4(sc-sc_memr, RADEON_CLOCK_CNTL_INDEX); + tmp = save (~0x3f | RADEON_PLL_WR_EN); + bus_write_4(sc-sc_memr, RADEON_CLOCK_CNTL_INDEX, tmp); + tmp = bus_read_4(sc-sc_memr, RADEON_CLOCK_CNTL_DATA); + bus_write_4(sc-sc_memr, RADEON_CLOCK_CNTL_INDEX, save); +} + static int atibl_setlevel(struct atibl_softc *sc, int newlevel) { uint32_t lvds_gen_cntl; uint32_t lvds_pll_cntl; uint32_t pixclks_cntl; + uint32_t disp_pwr_reg; if (newlevel 100) newlevel = 100; @@ -168,11 +218,15 @@ atibl_setlevel(struct atibl_softc *sc, i if (newlevel 0) { newlevel = (newlevel * 5) / 2 + 5; + disp_pwr_reg = bus_read_4(sc-sc_memr, RADEON_DISP_PWR_MAN); + disp_pwr_reg |= RADEON_AUTO_PWRUP_EN; + bus_write_4(sc-sc_memr, RADEON_DISP_PWR_MAN, disp_pwr_reg); lvds_pll_cntl = bus_read_4(sc-sc_memr, RADEON_LVDS_PLL_CNTL); lvds_pll_cntl |= RADEON_LVDS_PLL_EN; bus_write_4(sc-sc_memr, RADEON_LVDS_PLL_CNTL, lvds_pll_cntl); lvds_pll_cntl = ~RADEON_LVDS_PLL_RESET; bus_write_4(sc-sc_memr, RADEON_LVDS_PLL_CNTL, lvds_pll_cntl); + DELAY(1000); lvds_gen_cntl = ~(RADEON_LVDS_DISPLAY_DIS | RADEON_LVDS_BL_MOD_LEVEL_MASK); @@ -181,20 +235,21 @@ atibl_setlevel(struct atibl_softc *sc, i lvds_gen_cntl |= (newlevel RADEON_LVDS_BL_MOD_LEVEL_SHIFT) RADEON_LVDS_BL_MOD_LEVEL_MASK; lvds_gen_cntl |= RADEON_LVDS_BL_MOD_EN; - DELAY(2000); + DELAY(200); bus_write_4(sc-sc_memr, RADEON_LVDS_GEN_CNTL, lvds_gen_cntl); } else { - pixclks_cntl = bus_read_4(sc-sc_memr, RADEON_PIXCLKS_CNTL); - bus_write_4(sc-sc_memr, RADEON_PIXCLKS_CNTL, + pixclks_cntl = atibl_pll_rreg(sc, RADEON_PIXCLKS_CNTL); + atibl_pll_wreg(sc, RADEON_PIXCLKS_CNTL, pixclks_cntl ~RADEON_PIXCLK_LVDS_ALWAYS_ONb); lvds_gen_cntl |= RADEON_LVDS_DISPLAY_DIS; - lvds_gen_cntl = RADEON_LVDS_BL_MOD_EN; + lvds_gen_cntl = ~RADEON_LVDS_BL_MOD_EN; bus_write_4(sc-sc_memr,
svn commit: r264207 - head/sys/powerpc/powermac
Author: jhibbits Date: Sun Apr 6 23:57:19 2014 New Revision: 264207 URL: http://svnweb.freebsd.org/changeset/base/264207 Log: Clear the backlight level when it's turned off. Also, reduce the delay times to less conservative values, also found in the radeonkms driver. MFC after:2 weeks X-MFC-with: r264205 Modified: head/sys/powerpc/powermac/atibl.c Modified: head/sys/powerpc/powermac/atibl.c == --- head/sys/powerpc/powermac/atibl.c Sun Apr 6 23:22:42 2014 (r264206) +++ head/sys/powerpc/powermac/atibl.c Sun Apr 6 23:57:19 2014 (r264207) @@ -235,21 +235,21 @@ atibl_setlevel(struct atibl_softc *sc, i lvds_gen_cntl |= (newlevel RADEON_LVDS_BL_MOD_LEVEL_SHIFT) RADEON_LVDS_BL_MOD_LEVEL_MASK; lvds_gen_cntl |= RADEON_LVDS_BL_MOD_EN; - DELAY(200); + DELAY(20); bus_write_4(sc-sc_memr, RADEON_LVDS_GEN_CNTL, lvds_gen_cntl); } else { pixclks_cntl = atibl_pll_rreg(sc, RADEON_PIXCLKS_CNTL); atibl_pll_wreg(sc, RADEON_PIXCLKS_CNTL, pixclks_cntl ~RADEON_PIXCLK_LVDS_ALWAYS_ONb); lvds_gen_cntl |= RADEON_LVDS_DISPLAY_DIS; - lvds_gen_cntl = ~RADEON_LVDS_BL_MOD_EN; + lvds_gen_cntl = ~(RADEON_LVDS_BL_MOD_EN | RADEON_LVDS_BL_MOD_LEVEL_MASK); bus_write_4(sc-sc_memr, RADEON_LVDS_GEN_CNTL, lvds_gen_cntl); lvds_gen_cntl = ~(RADEON_LVDS_ON | RADEON_LVDS_EN); - DELAY(200); + DELAY(20); bus_write_4(sc-sc_memr, RADEON_LVDS_GEN_CNTL, lvds_gen_cntl); atibl_pll_wreg(sc, RADEON_PIXCLKS_CNTL, pixclks_cntl); - DELAY(200); + DELAY(20); } return (0); ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r264338 - in head/sys/powerpc: include powerpc
Author: jhibbits Date: Fri Apr 11 06:17:44 2014 New Revision: 264338 URL: http://svnweb.freebsd.org/changeset/base/264338 Log: Small performance optimization. Clobber only cr0, rather than the entire CR. Discussed with: rdivacky,nwhitehorn MFC after:3 weeks Modified: head/sys/powerpc/include/atomic.h head/sys/powerpc/include/counter.h head/sys/powerpc/powerpc/copyinout.c Modified: head/sys/powerpc/include/atomic.h == --- head/sys/powerpc/include/atomic.h Fri Apr 11 06:15:58 2014 (r264337) +++ head/sys/powerpc/include/atomic.h Fri Apr 11 06:17:44 2014 (r264338) @@ -74,7 +74,7 @@ bne-1b\n \ : =r (t), =m (*p) \ : r (p), r (v), m (*p)\ - : cc, memory) \ + : cr0, memory) \ /* __atomic_add_int */ #ifdef __powerpc64__ @@ -86,7 +86,7 @@ bne-1b\n \ : =r (t), =m (*p) \ : r (p), r (v), m (*p)\ - : cc, memory) \ + : cr0, memory) \ /* __atomic_add_long */ #else #define__atomic_add_long(p, v, t) \ @@ -97,7 +97,7 @@ bne-1b\n \ : =r (t), =m (*p) \ : r (p), r (v), m (*p)\ - : cc, memory) \ + : cr0, memory) \ /* __atomic_add_long */ #endif @@ -160,7 +160,7 @@ _ATOMIC_ADD(long) bne-1b\n \ : =r (t), =m (*p) \ : r (p), r (v), m (*p)\ - : cc, memory) \ + : cr0, memory) \ /* __atomic_clear_int */ #ifdef __powerpc64__ @@ -172,7 +172,7 @@ _ATOMIC_ADD(long) bne-1b\n \ : =r (t), =m (*p) \ : r (p), r (v), m (*p)\ - : cc, memory) \ + : cr0, memory) \ /* __atomic_clear_long */ #else #define__atomic_clear_long(p, v, t)\ @@ -183,7 +183,7 @@ _ATOMIC_ADD(long) bne-1b\n \ : =r (t), =m (*p) \ : r (p), r (v), m (*p)\ - : cc, memory) \ + : cr0, memory) \ /* __atomic_clear_long */ #endif @@ -262,7 +262,7 @@ _ATOMIC_CLEAR(long) bne-1b\n \ : =r (t), =m (*p) \ : r (p), r (v), m (*p)\ - : cc, memory) \ + : cr0, memory) \ /* __atomic_set_int */ #ifdef __powerpc64__ @@ -274,7 +274,7 @@ _ATOMIC_CLEAR(long) bne-1b\n \ : =r (t), =m (*p) \ : r (p), r (v), m (*p)\ - : cc, memory) \ + : cr0, memory) \ /* __atomic_set_long */ #else #define__atomic_set_long(p, v, t) \ @@ -285,7 +285,7 @@ _ATOMIC_CLEAR(long) bne-1b\n \ : =r (t), =m (*p) \ : r (p), r (v), m (*p)\ - : cc, memory) \ + : cr0, memory) \ /* __atomic_set_long */ #endif @@ -348,7 +348,7 @@ _ATOMIC_SET(long) bne-1b\n \ : =r (t), =m (*p) \ : r (p), r (v), m (*p)\ - : cc, memory) \ + : cr0, memory) \ /* __atomic_subtract_int */ #ifdef __powerpc64__ @@ -360,7 +360,7 @@ _ATOMIC_SET(long) bne-1b\n \ : =r (t), =m (*p) \ : r (p), r (v), m (*p)\ -
svn commit: r264635 - head/sys/dev/hwpmc
Author: jhibbits Date: Fri Apr 18 06:39:00 2014 New Revision: 264635 URL: http://svnweb.freebsd.org/changeset/base/264635 Log: Enable and disable the PMC unit at load/unload time, respectively. MFC after:3 weeks Modified: head/sys/dev/hwpmc/hwpmc_mpc7xxx.c head/sys/dev/hwpmc/hwpmc_ppc970.c Modified: head/sys/dev/hwpmc/hwpmc_mpc7xxx.c == --- head/sys/dev/hwpmc/hwpmc_mpc7xxx.c Fri Apr 18 01:15:45 2014 (r264634) +++ head/sys/dev/hwpmc/hwpmc_mpc7xxx.c Fri Apr 18 06:39:00 2014 (r264635) @@ -580,6 +580,7 @@ mpc7xxx_pcpu_init(struct pmc_mdep *md, i /* Clear the MMCRs, and set FC, to disable all PMCs. */ mtspr(SPR_MMCR0, SPR_MMCR0_FC | SPR_MMCR0_PMXE | SPR_MMCR0_PMC1CE | SPR_MMCR0_PMCNCE); mtspr(SPR_MMCR1, 0); + mtmsr(mfmsr() | PSL_PMM); return 0; } @@ -589,10 +590,13 @@ mpc7xxx_pcpu_fini(struct pmc_mdep *md, i { uint32_t mmcr0 = mfspr(SPR_MMCR0); + mtmsr(mfmsr() ~PSL_PMM); mmcr0 |= SPR_MMCR0_FC; mtspr(SPR_MMCR0, mmcr0); + free(powerpc_pcpu[cpu]-pc_ppcpmcs, M_PMC); free(powerpc_pcpu[cpu], M_PMC); + return 0; } Modified: head/sys/dev/hwpmc/hwpmc_ppc970.c == --- head/sys/dev/hwpmc/hwpmc_ppc970.c Fri Apr 18 01:15:45 2014 (r264634) +++ head/sys/dev/hwpmc/hwpmc_ppc970.c Fri Apr 18 06:39:00 2014 (r264635) @@ -575,6 +575,7 @@ ppc970_pcpu_init(struct pmc_mdep *md, in mtspr(SPR_970MMCR0, SPR_MMCR0_FC | SPR_MMCR0_PMXE | SPR_MMCR0_PMC1CE | SPR_MMCR0_PMCNCE | SPR_970MMCR0_PMC1SEL(0x8) | SPR_970MMCR0_PMC2SEL(0x8)); mtspr(SPR_970MMCR1, 0x4218420); + mtmsr(mfmsr() | PSL_PMM); return 0; } @@ -584,11 +585,14 @@ ppc970_pcpu_fini(struct pmc_mdep *md, in { register_t mmcr0 = mfspr(SPR_MMCR0); + mtmsr(mfmsr() ~PSL_PMM); mmcr0 |= SPR_MMCR0_FC; mmcr0 = ~SPR_MMCR0_PMXE; mtspr(SPR_MMCR0, mmcr0); + free(powerpc_pcpu[cpu]-pc_ppcpmcs, M_PMC); free(powerpc_pcpu[cpu], M_PMC); + return 0; } ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
Re: svn commit: r265171 - head/release/powerpc
On Apr 30, 2014, at 8:24 PM, Nathan Whitehorn wrote: Author: nwhitehorn Date: Thu May 1 03:24:41 2014 New Revision: 265171 URL: http://svnweb.freebsd.org/changeset/base/265171 Log: Use mkimg instead of md(4) and gpart. Modified: head/release/powerpc/make-memstick.sh Modified: head/release/powerpc/make-memstick.sh Does this mean we can 'make release' without root now? Cool! - Justin ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
Re: svn commit: r265250 - head/contrib/top
On Fri, May 2, 2014 at 4:32 PM, Bryan Drewery bdrew...@freebsd.org wrote: Author: bdrewery Date: Fri May 2 23:32:44 2014 New Revision: 265250 URL: http://svnweb.freebsd.org/changeset/base/265250 Log: - Add a hint for 'u' and 'J' command that '+' displays all. Thanks! I keep forgetting about '+'. - Justin ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r266116 - head/sys/powerpc/aim
Author: jhibbits Date: Thu May 15 04:18:06 2014 New Revision: 266116 URL: http://svnweb.freebsd.org/changeset/base/266116 Log: A page mask size is 12-bits, not 11. MFC after:1 week Modified: head/sys/powerpc/aim/trap_subr32.S Modified: head/sys/powerpc/aim/trap_subr32.S == --- head/sys/powerpc/aim/trap_subr32.S Thu May 15 03:47:52 2014 (r266115) +++ head/sys/powerpc/aim/trap_subr32.S Thu May 15 04:18:06 2014 (r266116) @@ -677,7 +677,7 @@ disitrap: mtcr%r31 bt 17,realtrap /* branch is user mode */ mfsprg1 %r31/* get old SP */ - clrrwi %r31,%r31,11/* Round SP down to nearest page */ + clrrwi %r31,%r31,12/* Round SP down to nearest page */ sub.%r30,%r31,%r30 /* SP - DAR */ bge 1f neg %r30,%r30 /* modulo value */ ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r266136 - head/sys/powerpc/aim
Author: jhibbits Date: Thu May 15 15:17:44 2014 New Revision: 266136 URL: http://svnweb.freebsd.org/changeset/base/266136 Log: oea64 uses 4k pages, too. MFC after:1 week X-MFC-with: r266116 Modified: head/sys/powerpc/aim/trap_subr64.S Modified: head/sys/powerpc/aim/trap_subr64.S == --- head/sys/powerpc/aim/trap_subr64.S Thu May 15 15:15:23 2014 (r266135) +++ head/sys/powerpc/aim/trap_subr64.S Thu May 15 15:17:44 2014 (r266136) @@ -585,7 +585,7 @@ disitrap: mtcr%r31 bt 17,realtrap /* branch is user mode */ mfsprg1 %r31/* get old SP */ - clrrdi %r31,%r31,11/* Round SP down to nearest page */ + clrrdi %r31,%r31,12/* Round SP down to nearest page */ sub.%r30,%r31,%r30 /* SP - DAR */ bge 1f neg %r30,%r30 /* modulo value */ ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r266531 - in head/sys: amd64/conf conf i386/conf modules
Author: jhibbits Date: Thu May 22 05:04:40 2014 New Revision: 266531 URL: http://svnweb.freebsd.org/changeset/base/266531 Log: imagact_binmisc builds for all supported architectures, so enable it for all. Any bugs in execution will be dealt with as they crop up. MFC after:3 weeks Relnotes: Yes Modified: head/sys/amd64/conf/NOTES head/sys/conf/NOTES head/sys/conf/files head/sys/conf/files.amd64 head/sys/conf/files.i386 head/sys/conf/options head/sys/conf/options.amd64 head/sys/conf/options.i386 head/sys/i386/conf/NOTES head/sys/modules/Makefile Modified: head/sys/amd64/conf/NOTES == --- head/sys/amd64/conf/NOTES Thu May 22 04:46:51 2014(r266530) +++ head/sys/amd64/conf/NOTES Thu May 22 05:04:40 2014(r266531) @@ -646,6 +646,3 @@ options VM_KMEM_SIZE_SCALE # Enable NDIS binary driver support optionsNDISAPI device ndis - -# Module to enable execution of application via emulators like QEMU -options IMAGACT_BINMISC Modified: head/sys/conf/NOTES == --- head/sys/conf/NOTES Thu May 22 04:46:51 2014(r266530) +++ head/sys/conf/NOTES Thu May 22 05:04:40 2014(r266531) @@ -2968,3 +2968,6 @@ options RANDOM_YARROW # Yarrow RNG ##options RANDOM_FORTUNA # Fortuna RNG - not yet implemented optionsRANDOM_DEBUG# Debugging messages optionsRANDOM_RWFILE # Read and write entropy cache + +# Module to enable execution of application via emulators like QEMU +options IMAGACT_BINMISC Modified: head/sys/conf/files == --- head/sys/conf/files Thu May 22 04:46:51 2014(r266530) +++ head/sys/conf/files Thu May 22 05:04:40 2014(r266531) @@ -2850,6 +2850,7 @@ kern/bus_if.m standard kern/clock_if.mstandard kern/cpufreq_if.m standard kern/device_if.m standard +kern/imgact_binmisc.c optionalimagact_binmisc kern/imgact_elf.c standard kern/imgact_elf32.coptional compat_freebsd32 kern/imgact_shell.cstandard Modified: head/sys/conf/files.amd64 == --- head/sys/conf/files.amd64 Thu May 22 04:46:51 2014(r266530) +++ head/sys/conf/files.amd64 Thu May 22 05:04:40 2014(r266531) @@ -438,7 +438,6 @@ dev/virtio/scsi/virtio_scsi.c optional dev/virtio/random/virtio_random.c optionalvirtio_random isa/syscons_isa.c optionalsc isa/vga_isa.c optionalvga -kern/imgact_binmisc.c optionalimagact_binmisc kern/kern_clocksource.cstandard kern/link_elf_obj.cstandard # Modified: head/sys/conf/files.i386 == --- head/sys/conf/files.i386Thu May 22 04:46:51 2014(r266530) +++ head/sys/conf/files.i386Thu May 22 05:04:40 2014(r266531) @@ -520,7 +520,6 @@ isa/syscons_isa.c optional sc isa/vga_isa.c optional vga kern/kern_clocksource.cstandard kern/imgact_aout.c optional compat_aout -kern/imgact_binmisc.c optional imagact_binmisc kern/imgact_gzip.c optional gzip libkern/divdi3.c standard libkern/flsll.cstandard Modified: head/sys/conf/options == --- head/sys/conf/options Thu May 22 04:46:51 2014(r266530) +++ head/sys/conf/options Thu May 22 05:04:40 2014(r266531) @@ -91,6 +91,7 @@ DIRECTIO FILEMONopt_dontuse.h FFCLOCK FULL_PREEMPTIONopt_sched.h +IMAGACT_BINMISCopt_dontuse.h IPI_PREEMPTION opt_sched.h GEOM_AES opt_geom.h GEOM_BDE opt_geom.h Modified: head/sys/conf/options.amd64 == --- head/sys/conf/options.amd64 Thu May 22 04:46:51 2014(r266530) +++ head/sys/conf/options.amd64 Thu May 22 05:04:40 2014(r266531) @@ -21,7 +21,6 @@ COMPAT_FREEBSD32 opt_compat.h COMPAT_LINUX32 opt_compat.h #COMPAT_SVR4 opt_dontuse.h #DEBUG_SVR4opt_svr4.h -IMAGACT_BINMISCopt_dontuse.h LINPROCFS opt_dontuse.h LINSYSFS opt_dontuse.h NDISAPIopt_dontuse.h Modified: head/sys/conf/options.i386 == --- head/sys/conf/options.i386 Thu May 22 04:46:51 2014(r266530) +++ head/sys/conf/options.i386 Thu May 22
Re: svn commit: r267660 - head/sys/dev/firewire
On Fri, 20 Jun 2014 01:45:03 + (UTC) Alexander Kabaev k...@freebsd.org wrote: Author: kan Date: Fri Jun 20 01:45:03 2014 New Revision: 267660 URL: http://svnweb.freebsd.org/changeset/base/267660 Log: Set target-sbp field to valid value when sbp device is created. The sbp_cam_detach_target can be called from sbp_post_explore function on the first target that is not really attached and it was written with the corresponding safety check in place to tolerate that. Unfortunately the recent locking cleanup did add a locking assertion that tries to dereference the target-sbp pointer unconditionally, which causes less than desirable outcome. Since the assertion is useful, just initialize the target sbp pointer once when sbp device is being initialized instead of when the target is being attached. This makes assertion work in all cases and fixes the crash on boot. Thanks for fixing this! I was hitting it on my latest kernel rebuilds, and kept rolling back until I could find the time to fix it. You beat me to it. - Justin ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r267697 - head/sys/dev/adb
Author: jhibbits Date: Sat Jun 21 00:53:56 2014 New Revision: 267697 URL: http://svnweb.freebsd.org/changeset/base/267697 Log: No need to check if devd is running before posting an event. Modified: head/sys/dev/adb/adb_buttons.c head/sys/dev/adb/adb_kbd.c Modified: head/sys/dev/adb/adb_buttons.c == --- head/sys/dev/adb/adb_buttons.c Sat Jun 21 00:45:44 2014 (r267696) +++ head/sys/dev/adb/adb_buttons.c Sat Jun 21 00:53:56 2014 (r267697) @@ -118,37 +118,32 @@ abtn_receive_packet(device_t dev, u_char switch (cmd) { case 0x0a: /* decrease brightness */ - if (devctl_process_running()) - devctl_notify(PMU, keys, brightness, - notify=down); + devctl_notify(PMU, keys, brightness, + notify=down); break; case 0x09: /* increase brightness */ - if (devctl_process_running()) - devctl_notify(PMU, keys, brightness, notify=up); + devctl_notify(PMU, keys, brightness, notify=up); break; case 0x08: /* mute */ case 0x01: /* mute, AV hardware */ - if (devctl_process_running()) - devctl_notify(PMU, keys, mute, NULL); + devctl_notify(PMU, keys, mute, NULL); break; case 0x07: /* decrease volume */ case 0x02: /* decrease volume, AV hardware */ - if (devctl_process_running()) - devctl_notify(PMU, keys, volume, notify=down); + devctl_notify(PMU, keys, volume, notify=down); break; case 0x06: /* increase volume */ case 0x03: /* increase volume, AV hardware */ - if (devctl_process_running()) - devctl_notify(PMU, keys, volume, notify=up); + devctl_notify(PMU, keys, volume, notify=up); break; case 0x0c: /* mirror display key */ /* Need callback to do something with this */ break; case 0x0b: /* eject tray */ - if (devctl_process_running()) - devctl_notify(PMU, keys, eject, NULL); + devctl_notify(PMU, keys, eject, NULL); + break; case 0x7f: /* numlock */ /* Need callback to do something with this */ break; Modified: head/sys/dev/adb/adb_kbd.c == --- head/sys/dev/adb/adb_kbd.c Sat Jun 21 00:45:44 2014(r267696) +++ head/sys/dev/adb/adb_kbd.c Sat Jun 21 00:53:56 2014(r267697) @@ -424,7 +424,7 @@ adb_kbd_receive_packet(device_t dev, u_c mtx_lock(sc-sc_mutex); /* 0x7f is always the power button */ - if (data[0] == 0x7f devctl_process_running()) { + if (data[0] == 0x7f) { devctl_notify(PMU, Button, pressed, NULL); mtx_unlock(sc-sc_mutex); return (0); ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r253315 - head/sys/modules
Author: jhibbits Date: Sat Jul 13 07:16:45 2013 New Revision: 253315 URL: http://svnweb.freebsd.org/changeset/base/253315 Log: Clean up the modules list for PowerPC. powerpc64 has MACHINE_CPUARCH of powerpc. While here, sort the list. Modified: head/sys/modules/Makefile Modified: head/sys/modules/Makefile == --- head/sys/modules/Makefile Sat Jul 13 04:25:03 2013(r253314) +++ head/sys/modules/Makefile Sat Jul 13 07:16:45 2013(r253315) @@ -808,23 +808,24 @@ _cardbus= cardbus _cbb= cbb _cfi= cfi _cpufreq= cpufreq +.if ${MK_CDDL} != no || defined(ALL_MODULES) +_cyclic= cyclic +.endif _drm= drm +.if ${MK_CDDL} != no || defined(ALL_MODULES) +_dtrace= dtrace +.endif _exca= exca _nvram=powermac_nvram _pccard= pccard _smbfs=smbfs _sound=sound -_cyclic= cyclic -_dtrace= dtrace +.if ${MK_CDDL} != no || defined(ALL_MODULES) _opensolaris= opensolaris .endif +.endif .if ${MACHINE_ARCH} == powerpc64 -.if ${MK_CDDL} != no || defined(ALL_MODULES) -_cyclic= cyclic -_dtrace= dtrace -_opensolaris= opensolaris -.endif .if ${MK_ZFS} != no || defined(ALL_MODULES) _zfs= zfs .endif ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r253756 - head/sys/dev/wi
Author: jhibbits Date: Mon Jul 29 05:39:20 2013 New Revision: 253756 URL: http://svnweb.freebsd.org/changeset/base/253756 Log: Use the streaming functions for reading/writing the BAP fields on wi(4). This fixes wi(4) device access on big endian architectures. PR: kern/164499 Reviewed by: adrian Obtained from:NetBSD Modified: head/sys/dev/wi/if_wi.c Modified: head/sys/dev/wi/if_wi.c == --- head/sys/dev/wi/if_wi.c Sun Jul 28 20:11:31 2013(r253755) +++ head/sys/dev/wi/if_wi.c Mon Jul 29 05:39:20 2013(r253756) @@ -1905,8 +1905,7 @@ wi_seek_bap(struct wi_softc *sc, int id, static int wi_read_bap(struct wi_softc *sc, int id, int off, void *buf, int buflen) { - u_int16_t *ptr; - int i, error, cnt; + int error, cnt; if (buflen == 0) return 0; @@ -1915,9 +1914,7 @@ wi_read_bap(struct wi_softc *sc, int id, return error; } cnt = (buflen + 1) / 2; - ptr = (u_int16_t *)buf; - for (i = 0; i cnt; i++) - *ptr++ = CSR_READ_2(sc, WI_DATA0); + CSR_READ_MULTI_STREAM_2(sc, WI_DATA0, (u_int16_t *)buf, cnt); sc-sc_bap_off += cnt * 2; return 0; } @@ -1925,8 +1922,7 @@ wi_read_bap(struct wi_softc *sc, int id, static int wi_write_bap(struct wi_softc *sc, int id, int off, void *buf, int buflen) { - u_int16_t *ptr; - int i, error, cnt; + int error, cnt; if (buflen == 0) return 0; @@ -1936,9 +1932,7 @@ wi_write_bap(struct wi_softc *sc, int id return error; } cnt = (buflen + 1) / 2; - ptr = (u_int16_t *)buf; - for (i = 0; i cnt; i++) - CSR_WRITE_2(sc, WI_DATA0, ptr[i]); + CSR_WRITE_MULTI_STREAM_2(sc, WI_DATA0, (u_int16_t *)buf, cnt); sc-sc_bap_off += cnt * 2; return 0; ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
Re: svn commit: r253756 - head/sys/dev/wi
On Jul 30, 2013 2:14 PM, Jeremie Le Hen j...@freebsd.org wrote: On Mon, Jul 29, 2013 at 05:39:20AM +, Justin Hibbits wrote: Author: jhibbits Date: Mon Jul 29 05:39:20 2013 New Revision: 253756 URL: http://svnweb.freebsd.org/changeset/base/253756 Log: Use the streaming functions for reading/writing the BAP fields on wi(4). This fixes wi(4) device access on big endian architectures. PR: kern/164499 Reviewed by:adrian Obtained from: NetBSD That's funny that this commit comes right after Adrian's proposal to remove wi(4) :). -- Jeremie Le Hen It's two years in the making. I have one more, too, coming in a few minutes, also strongly encouraged by Adrian :-) - Justin ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r253825 - in head/sys: dev/wi modules modules/wi powerpc/powermac
Author: jhibbits Date: Wed Jul 31 01:13:29 2013 New Revision: 253825 URL: http://svnweb.freebsd.org/changeset/base/253825 Log: Add the macio attachment for wi(4). Partially obtained from NetBSD. Reviewed by: adrian Obtained from:NetBSD (partially) Added: head/sys/dev/wi/if_wi_macio.c (contents, props changed) Modified: head/sys/modules/Makefile head/sys/modules/wi/Makefile head/sys/powerpc/powermac/macio.c head/sys/powerpc/powermac/maciovar.h Added: head/sys/dev/wi/if_wi_macio.c == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/wi/if_wi_macio.c Wed Jul 31 01:13:29 2013 (r253825) @@ -0,0 +1,141 @@ +/*- + * Copyright (c) 2013 Justin Hibbits + * All rights reserved. + * Copyright (c) 1997, 1998, 1999 + * Bill Paul wp...@ctr.columbia.edu. 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. + * 3. All advertising materials mentioning features or use of this software + *must display the following acknowledgement: + * This product includes software developed by Bill Paul. + * 4. Neither the name of the author nor the names of any co-contributors + *may be used to endorse or promote products derived from this software + *without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY Bill Paul 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 Bill Paul OR THE VOICES IN HIS HEAD + * 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. + */ + +/* + * Lucent WaveLAN/IEEE 802.11 MacIO attachment for FreeBSD. + * + * Based on the PCMCIA driver + * Written by Bill Paul wp...@ctr.columbia.edu + * Electrical Engineering Department + * Columbia University, New York City + */ + +#include sys/cdefs.h +__FBSDID($FreeBSD$); + +#include sys/param.h +#include sys/kernel.h +#include sys/socket.h +#include sys/systm.h +#include sys/module.h +#include sys/bus.h + +#include machine/bus.h +#include machine/resource.h +#include sys/rman.h + +#include dev/ofw/ofw_bus.h +#include dev/ofw/openfirm.h +#include machine/ofw_machdep.h + +#include net/if.h +#include net/if_arp.h +#include net/ethernet.h +#include net/if_dl.h +#include net/if_media.h +#include net/if_types.h + +#include net80211/ieee80211_var.h +#include net80211/ieee80211_radiotap.h + +#include dev/wi/if_wavelan_ieee.h +#include dev/wi/if_wireg.h +#include dev/wi/if_wivar.h + +static int wi_macio_probe(device_t); +static int wi_macio_attach(device_t); + +static device_method_t wi_macio_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, wi_macio_probe), + DEVMETHOD(device_attach,wi_macio_attach), + DEVMETHOD(device_detach,wi_detach), + DEVMETHOD(device_shutdown, wi_shutdown), + + { 0, 0 } +}; + +static driver_t wi_macio_driver = { + wi, + wi_macio_methods, + sizeof(struct wi_softc) +}; + +DRIVER_MODULE(wi, macio, wi_macio_driver, wi_devclass, 0, 0); +MODULE_DEPEND(wi, wlan, 1, 1, 1); + +static int +wi_macio_probe(device_t dev) +{ + const char *name, *compat; + + /* Make sure we're a network driver */ + name = ofw_bus_get_name(dev); + if (name == NULL) + return (ENXIO); + + if (strcmp(name, radio) != 0) { + return ENXIO; + } + compat = ofw_bus_get_compat(dev); + if (strcmp(compat, wireless) != 0) { + return ENXIO; + } + + device_set_desc(dev, Apple Airport); + return 0; +} + +static int +wi_macio_attach(device_t dev) +{ + struct wi_softc *sc; + int error; + + sc = device_get_softc(dev); + sc-wi_gone = 0; + sc-wi_bus_type = 0; + + error = wi_alloc(dev, 0); + if (error == 0) { + /* Make sure interrupts are disabled. */ + CSR_WRITE_2(sc
svn commit: r253918 - head/sys/powerpc/include
Author: jhibbits Date: Sat Aug 3 18:05:12 2013 New Revision: 253918 URL: http://svnweb.freebsd.org/changeset/base/253918 Log: Remove duplicate definition of SPR MMCR0. MFC after:3 days Modified: head/sys/powerpc/include/spr.h Modified: head/sys/powerpc/include/spr.h == --- head/sys/powerpc/include/spr.h Sat Aug 3 16:23:43 2013 (r253917) +++ head/sys/powerpc/include/spr.h Sat Aug 3 18:05:12 2013 (r253918) @@ -325,7 +325,6 @@ #defineSPR_970MMCR00x31b /* ... Monitor Mode Control Register 0 (PPC 970) */ #defineSPR_970MMCR10x31e /* ... Monitor Mode Control Register 1 (PPC 970) */ #defineSPR_970MMCRA0x312 /* ... Monitor Mode Control Register 2 (PPC 970) */ -#defineSPR_970MMCR00x31b /* ... Monitor Mode Control Register 0 (PPC 970) */ #defineSPR_970PMC1 0x313 /* ... PMC 1 */ #defineSPR_970PMC2 0x314 /* ... PMC 2 */ #defineSPR_970PMC3 0x315 /* ... PMC 3 */ ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r253976 - head/sys/powerpc/aim
Author: jhibbits Date: Tue Aug 6 01:01:15 2013 New Revision: 253976 URL: http://svnweb.freebsd.org/changeset/base/253976 Log: Evict pages from the PTEG when it's full and trying to insert a new PTE, rather than panicking. Reviewed by: nwhitehorn MFC after:3 weeks Modified: head/sys/powerpc/aim/mmu_oea.c Modified: head/sys/powerpc/aim/mmu_oea.c == --- head/sys/powerpc/aim/mmu_oea.c Mon Aug 5 23:34:35 2013 (r253975) +++ head/sys/powerpc/aim/mmu_oea.c Tue Aug 6 01:01:15 2013 (r253976) @@ -548,7 +548,7 @@ moea_pte_set(struct pte *pt, struct pte /* * Update the PTE as defined in section 7.6.3.1. -* Note that the REF/CHG bits are from pvo_pt and thus should havce +* Note that the REF/CHG bits are from pvo_pt and thus should have * been saved so this routine can restore them (if desired). */ pt-pte_lo = pvo_pt-pte_lo; @@ -2021,10 +2021,8 @@ moea_pvo_enter(pmap_t pm, uma_zone_t zon pm-pm_stats.wired_count++; pm-pm_stats.resident_count++; - /* -* We hope this succeeds but it isn't required. -*/ i = moea_pte_insert(ptegidx, pvo-pvo_pte.pte); + KASSERT(i 8, (Invalid PTE index)); if (i = 0) { PVO_PTEGIDX_SET(pvo, i); } else { @@ -2163,6 +2161,9 @@ moea_pvo_to_pte(const struct pvo_entry * pvo but no valid pte, pvo); } + if (pvo-pvo_pte.pte.pte_hi != pt-pte_hi) { + panic(moea_pvo_to_pte: pvo does not match pte: pvo hi: %8x, pte hi: %8x, pvo-pvo_pte.pte.pte_hi, pt-pte_hi); + } if ((pt-pte_hi ^ (pvo-pvo_pte.pte.pte_hi ~PTE_VALID)) == PTE_VALID) { if ((pvo-pvo_pte.pte.pte_hi PTE_VALID) == 0) { panic(moea_pvo_to_pte: pvo %p has valid pte in @@ -2181,7 +2182,7 @@ moea_pvo_to_pte(const struct pvo_entry * if (pvo-pvo_pte.pte.pte_hi PTE_VALID) { panic(moea_pvo_to_pte: pvo %p has invalid pte %p in - moea_pteg_table but valid in pvo, pvo, pt); + moea_pteg_table but valid in pvo: %8x, %8x, pvo, pt, pvo-pvo_pte.pte.pte_hi, pt-pte_hi); } mtx_unlock(moea_table_mutex); @@ -2305,11 +2306,42 @@ moea_pte_spill(vm_offset_t addr) return (1); } +static __inline struct pvo_entry * +moea_pte_spillable_ident(u_int ptegidx) +{ + struct pte *pt; + struct pvo_entry *pvo_walk, *pvo = NULL; + + LIST_FOREACH(pvo_walk, moea_pvo_table[ptegidx], pvo_olink) { + if (pvo_walk-pvo_vaddr PVO_WIRED) + continue; + + if (!(pvo_walk-pvo_pte.pte.pte_hi PTE_VALID)) + continue; + + pt = moea_pvo_to_pte(pvo_walk, -1); + + if (pt == NULL) + continue; + + pvo = pvo_walk; + + mtx_unlock(moea_table_mutex); + if (!(pt-pte_lo PTE_REF)) + return (pvo_walk); + } + + return (pvo); +} + static int moea_pte_insert(u_int ptegidx, struct pte *pvo_pt) { struct pte *pt; + struct pvo_entry *victim_pvo; int i; + int victim_idx; + u_int pteg_bkpidx = ptegidx; mtx_assert(moea_table_mutex, MA_OWNED); @@ -2337,8 +2369,46 @@ moea_pte_insert(u_int ptegidx, struct pt } } - panic(moea_pte_insert: overflow); - return (-1); + /* Try again, but this time try to force a PTE out. */ + ptegidx = pteg_bkpidx; + + victim_pvo = moea_pte_spillable_ident(ptegidx); + if (victim_pvo == NULL) { + ptegidx ^= moea_pteg_mask; + victim_pvo = moea_pte_spillable_ident(ptegidx); + } + + if (victim_pvo == NULL) { + panic(moea_pte_insert: overflow); + return (-1); + } + + victim_idx = moea_pvo_pte_index(victim_pvo, ptegidx); + + if (pteg_bkpidx == ptegidx) + pvo_pt-pte_hi = ~PTE_HID; + else + pvo_pt-pte_hi |= PTE_HID; + + /* +* Synchronize the sacrifice PTE with its PVO, then mark both +* invalid. The PVO will be reused when/if the VM system comes +* here after a fault. +*/ + pt = moea_pteg_table[victim_idx 3].pt[victim_idx 7]; + + if (pt-pte_hi != victim_pvo-pvo_pte.pte.pte_hi) + panic(Victim PVO doesn't match PTE! PVO: %8x, PTE: %8x, victim_pvo-pvo_pte.pte.pte_hi, pt-pte_hi); + + /* +* Set the new PTE. +*/ + moea_pte_unset(pt, victim_pvo-pvo_pte.pte, victim_pvo-pvo_vaddr); + PVO_PTEGIDX_CLR(victim_pvo); + moea_pte_overflow++; + moea_pte_set(pt, pvo_pt); + + return (victim_idx 7); } static boolean_t ___
svn commit: r253978 - head/sys/powerpc/aim
Author: jhibbits Date: Tue Aug 6 02:58:16 2013 New Revision: 253978 URL: http://svnweb.freebsd.org/changeset/base/253978 Log: Remove an unnecessary panic. The PVO's PTE entry and the PTEG's PTE entry may not match, if the PVO's PTE is invalid. Modified: head/sys/powerpc/aim/mmu_oea.c Modified: head/sys/powerpc/aim/mmu_oea.c == --- head/sys/powerpc/aim/mmu_oea.c Tue Aug 6 02:14:30 2013 (r253977) +++ head/sys/powerpc/aim/mmu_oea.c Tue Aug 6 02:58:16 2013 (r253978) @@ -2161,9 +2161,6 @@ moea_pvo_to_pte(const struct pvo_entry * pvo but no valid pte, pvo); } - if (pvo-pvo_pte.pte.pte_hi != pt-pte_hi) { - panic(moea_pvo_to_pte: pvo does not match pte: pvo hi: %8x, pte hi: %8x, pvo-pvo_pte.pte.pte_hi, pt-pte_hi); - } if ((pt-pte_hi ^ (pvo-pvo_pte.pte.pte_hi ~PTE_VALID)) == PTE_VALID) { if ((pvo-pvo_pte.pte.pte_hi PTE_VALID) == 0) { panic(moea_pvo_to_pte: pvo %p has valid pte in ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r253979 - head/sys/powerpc/ofw
Author: jhibbits Date: Tue Aug 6 03:09:44 2013 New Revision: 253979 URL: http://svnweb.freebsd.org/changeset/base/253979 Log: Micro-optimize OFW syscons 8-bit blank. MFC after:1 week Modified: head/sys/powerpc/ofw/ofw_syscons.c Modified: head/sys/powerpc/ofw/ofw_syscons.c == --- head/sys/powerpc/ofw/ofw_syscons.c Tue Aug 6 02:58:16 2013 (r253978) +++ head/sys/powerpc/ofw/ofw_syscons.c Tue Aug 6 03:09:44 2013 (r253979) @@ -586,14 +586,22 @@ ofwfb_blank_display8(video_adapter_t *ad { struct ofwfb_softc *sc; int i; - uint8_t *addr; + uint32_t *addr; + uint32_t color; + uint32_t end; sc = (struct ofwfb_softc *)adp; - addr = (uint8_t *) sc-sc_addr; + addr = (uint32_t *) sc-sc_addr; + end = (sc-sc_stride/4) * sc-sc_height; + + /* Splat 4 pixels at once. */ + color = (ofwfb_background(SC_NORM_ATTR) 24) | + (ofwfb_background(SC_NORM_ATTR) 16) | + (ofwfb_background(SC_NORM_ATTR) 8) | + (ofwfb_background(SC_NORM_ATTR)); - /* Could be done a lot faster e.g. 32-bits, or Altivec'd */ - for (i = 0; i sc-sc_stride*sc-sc_height; i++) - *(addr + i) = ofwfb_background(SC_NORM_ATTR); + for (i = 0; i end; i++) + *(addr + i) = color; return (0); } ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r254509 - in head/sys: cddl/dev/dtrace/powerpc modules/dtrace
Author: jhibbits Date: Mon Aug 19 05:10:46 2013 New Revision: 254509 URL: http://svnweb.freebsd.org/changeset/base/254509 Log: Fix some ppc64 dtrace bugs, and enable systrace_freebsd32 for ppc64. Modified: head/sys/cddl/dev/dtrace/powerpc/dtrace_asm.S head/sys/cddl/dev/dtrace/powerpc/dtrace_isa.c head/sys/modules/dtrace/Makefile Modified: head/sys/cddl/dev/dtrace/powerpc/dtrace_asm.S == --- head/sys/cddl/dev/dtrace/powerpc/dtrace_asm.S Mon Aug 19 04:56:03 2013(r254508) +++ head/sys/cddl/dev/dtrace/powerpc/dtrace_asm.S Mon Aug 19 05:10:46 2013(r254509) @@ -50,6 +50,7 @@ void dtrace_membar_producer(void) */ ASENTRY_NOPROF(dtrace_membar_producer) + sync blr END(dtrace_membar_producer) @@ -57,6 +58,7 @@ END(dtrace_membar_producer) void dtrace_membar_consumer(void) */ ASENTRY_NOPROF(dtrace_membar_consumer) + isync blr END(dtrace_membar_consumer) @@ -97,12 +99,21 @@ void * dtrace_casptr(void *target, void *cmp, void *new) */ ASENTRY_NOPROF(dtrace_casptr) +#ifdef __powerpc64__ +1: + ldarx %r0,0,%r3 + cmpd%r4,%r0 + bne 2f + stdcx. %r5,0,%r3 + bne 1b +#else 1: lwarx %r0,0,%r3 cmpw%r4,%r0 bne 2f stwcx. %r5,0,%r3 bne 1b +#endif 2: mr %r3,%r0 blr END(dtrace_casptr) Modified: head/sys/cddl/dev/dtrace/powerpc/dtrace_isa.c == --- head/sys/cddl/dev/dtrace/powerpc/dtrace_isa.c Mon Aug 19 04:56:03 2013(r254508) +++ head/sys/cddl/dev/dtrace/powerpc/dtrace_isa.c Mon Aug 19 05:10:46 2013(r254509) @@ -80,7 +80,11 @@ dtrace_getpcstack(pc_t *pcstack, int pcs if (!INKERNEL((long) sp)) break; +#ifdef __powerpc64__ + callpc = *(uintptr_t *)(sp + RETURN_OFFSET64); +#else callpc = *(uintptr_t *)(sp + RETURN_OFFSET); +#endif if (!INKERNEL(callpc)) break; Modified: head/sys/modules/dtrace/Makefile == --- head/sys/modules/dtrace/MakefileMon Aug 19 04:56:03 2013 (r254508) +++ head/sys/modules/dtrace/MakefileMon Aug 19 05:10:46 2013 (r254509) @@ -22,7 +22,7 @@ SUBDIR+= fasttrap fbt systrace_linux32 .if ${MACHINE_CPUARCH} == powerpc SUBDIR+= fbt .endif -.if ${MACHINE_CPUARCH} == amd64 +.if ${MACHINE_CPUARCH} == amd64 || ${MACHINE_ARCH} == powerpc64 SUBDIR+= systrace_freebsd32 .endif ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r254634 - head/sys/cddl/dev/dtrace/powerpc
Author: jhibbits Date: Thu Aug 22 02:54:20 2013 New Revision: 254634 URL: http://svnweb.freebsd.org/changeset/base/254634 Log: Make dtrace_copy() actually work on PowerPC. Although unused currently, it may be used in the future by dtrace. Modified: head/sys/cddl/dev/dtrace/powerpc/dtrace_asm.S Modified: head/sys/cddl/dev/dtrace/powerpc/dtrace_asm.S == --- head/sys/cddl/dev/dtrace/powerpc/dtrace_asm.S Thu Aug 22 01:54:52 2013(r254633) +++ head/sys/cddl/dev/dtrace/powerpc/dtrace_asm.S Thu Aug 22 02:54:20 2013(r254634) @@ -125,13 +125,13 @@ void dtrace_copy(uintptr_t src, uintptr_t dest, size_t size) */ ASENTRY_NOPROF(dtrace_copy) - addme %r7,%r3 - addme %r8,%r4 + subi%r7,%r3,1 + subi%r8,%r4,1 + mtctr %r5 1: lbzu%r3,1(%r7) stbu%r3,1(%r8) - addme %r5,%r5 - beq 2f + bdnz1b 2: blr END(dtrace_copy) ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r254639 - head/sys/powerpc/conf
Author: jhibbits Date: Thu Aug 22 05:07:50 2013 New Revision: 254639 URL: http://svnweb.freebsd.org/changeset/base/254639 Log: Enable DTrace hooks in ppc64. Modified: head/sys/powerpc/conf/GENERIC64 Modified: head/sys/powerpc/conf/GENERIC64 == --- head/sys/powerpc/conf/GENERIC64 Thu Aug 22 05:03:41 2013 (r254638) +++ head/sys/powerpc/conf/GENERIC64 Thu Aug 22 05:07:50 2013 (r254639) @@ -24,6 +24,7 @@ ident GENERIC machinepowerpc powerpc64 makeoptionsDEBUG=-g#Build kernel with gdb(1) debug symbols +makeoptionsWITH_CTF=1 # Platform support optionsPOWERMAC#NewWorld Apple PowerMacs @@ -67,6 +68,8 @@ options _KPOSIX_PRIORITY_SCHEDULING #Po optionsHWPMC_HOOKS # Necessary kernel hooks for hwpmc(4) optionsAUDIT # Security event auditing optionsMAC # TrustedBSD MAC Framework +optionsKDTRACE_HOOKS # Kernel DTrace hooks +optionsDDB_CTF # Kernel ELF linker loads CTF data optionsINCLUDE_CONFIG_FILE # Include this file in kernel # Debugging support. Always need this: ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r255099 - in head/sys/cddl/dev: dtrace/powerpc fbt
Author: jhibbits Date: Sat Aug 31 16:30:20 2013 New Revision: 255099 URL: http://svnweb.freebsd.org/changeset/base/255099 Log: Fixes for DTrace on PowerPC: - Implement dtrace_getarg() - Sync fbt with x86, and fix a typo. - Pull in the time synchronization code from amd64. Modified: head/sys/cddl/dev/dtrace/powerpc/dtrace_isa.c head/sys/cddl/dev/dtrace/powerpc/dtrace_subr.c head/sys/cddl/dev/fbt/fbt_powerpc.c Modified: head/sys/cddl/dev/dtrace/powerpc/dtrace_isa.c == --- head/sys/cddl/dev/dtrace/powerpc/dtrace_isa.c Sat Aug 31 16:21:13 2013(r255098) +++ head/sys/cddl/dev/dtrace/powerpc/dtrace_isa.c Sat Aug 31 16:30:20 2013(r255099) @@ -349,50 +349,84 @@ zero: uint64_t dtrace_getarg(int arg, int aframes) { - return (0); -} - -#ifdef notyet -{ - int depth = 0; - register_t sp; - vm_offset_t callpc; - pc_t caller = (pc_t) solaris_cpu[curcpu].cpu_dtrace_caller; - - if (intrpc != 0) - pcstack[depth++] = (pc_t) intrpc; - - aframes++; - - sp = dtrace_getfp(); - - while (depth pcstack_limit) { - if (!INKERNEL((long) frame)) - break; - - callpc = *(void **)(sp + RETURN_OFFSET); - - if (!INKERNEL(callpc)) - break; + uintptr_t val; + uintptr_t *fp = (uintptr_t *)dtrace_getfp(); + uintptr_t *stack; + int i; + + /* +* A total of 8 arguments are passed via registers; any argument with +* index of 7 or lower is therefore in a register. +*/ + int inreg = 7; + + for (i = 1; i = aframes; i++) { + fp = (uintptr_t *)*fp; + + /* +* On ppc32 AIM, and booke, trapexit() is the immediately following +* label. On ppc64 AIM trapexit() follows a nop. +*/ + if (((long)(fp[1]) == (long)trapexit) || + (((long)(fp[1]) + 4 == (long)trapexit))) { + /* +* In the case of powerpc, we will use the pointer to the regs +* structure that was pushed when we took the trap. To get this +* structure, we must increment beyond the frame structure. If the +* argument that we're seeking is passed on the stack, we'll pull +* the true stack pointer out of the saved registers and decrement +* our argument by the number of arguments passed in registers; if +* the argument we're seeking is passed in regsiters, we can just +* load it directly. +*/ +#ifdef __powerpc64__ + struct reg *rp = (struct reg *)((uintptr_t)fp[0] + 48); +#else + struct reg *rp = (struct reg *)((uintptr_t)fp[0] + 8); +#endif - if (aframes 0) { - aframes--; - if ((aframes == 0) (caller != 0)) { - pcstack[depth++] = caller; + if (arg = inreg) { + stack = rp-fixreg[3]; + } else { + stack = (uintptr_t *)(rp-fixreg[1]); + arg -= inreg; } - } - else { - pcstack[depth++] = callpc; + goto load; } - sp = *(void **)sp; } - for (; depth pcstack_limit; depth++) { - pcstack[depth] = 0; + /* +* We know that we did not come through a trap to get into +* dtrace_probe() -- the provider simply called dtrace_probe() +* directly. As this is the case, we need to shift the argument +* that we're looking for: the probe ID is the first argument to +* dtrace_probe(), so the argument n will actually be found where +* one would expect to find argument (n + 1). +*/ + arg++; + + if (arg = inreg) { + /* +* This shouldn't happen. If the argument is passed in a +* register then it should have been, well, passed in a +* register... +*/ + DTRACE_CPUFLAG_SET(CPU_DTRACE_ILLOP); + return (0); } + + arg -= (inreg + 1); + stack = fp + 2; + +load: + DTRACE_CPUFLAG_SET(CPU_DTRACE_NOFAULT); + val = stack[arg]; + DTRACE_CPUFLAG_CLEAR(CPU_DTRACE_NOFAULT); + + return (val); + return (0); } -#endif int dtrace_getstackdepth(int aframes) Modified: head/sys/cddl/dev/dtrace/powerpc/dtrace_subr.c == ---
svn commit: r255100 - head/sys/powerpc/powermac
Author: jhibbits Date: Sat Aug 31 16:31:48 2013 New Revision: 255100 URL: http://svnweb.freebsd.org/changeset/base/255100 Log: Only add the backlight device if it actually exists in OF. MFC after:1 week Modified: head/sys/powerpc/powermac/atibl.c head/sys/powerpc/powermac/nvbl.c Modified: head/sys/powerpc/powermac/atibl.c == --- head/sys/powerpc/powermac/atibl.c Sat Aug 31 16:30:20 2013 (r255099) +++ head/sys/powerpc/powermac/atibl.c Sat Aug 31 16:31:48 2013 (r255100) @@ -86,6 +86,8 @@ DRIVER_MODULE(atibl, vgapci, atibl_drive static void atibl_identify(driver_t *driver, device_t parent) { + if (OF_finddevice(mac-io/backlight) == -1) + return; if (device_find_child(parent, backlight, -1) == NULL) device_add_child(parent, backlight, -1); } Modified: head/sys/powerpc/powermac/nvbl.c == --- head/sys/powerpc/powermac/nvbl.cSat Aug 31 16:30:20 2013 (r255099) +++ head/sys/powerpc/powermac/nvbl.cSat Aug 31 16:31:48 2013 (r255100) @@ -82,6 +82,8 @@ DRIVER_MODULE(nvbl, vgapci, nvbl_driver, static void nvbl_identify(driver_t *driver, device_t parent) { + if (OF_finddevice(mac-io/backlight) == -1) + return; if (device_find_child(parent, backlight, -1) == NULL) device_add_child(parent, backlight, -1); } ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r255161 - head/sys/cddl/dev/dtrace/powerpc
Author: jhibbits Date: Mon Sep 2 23:22:05 2013 New Revision: 255161 URL: http://svnweb.freebsd.org/changeset/base/255161 Log: Whitespace cleanup. Modified: head/sys/cddl/dev/dtrace/powerpc/dtrace_subr.c Modified: head/sys/cddl/dev/dtrace/powerpc/dtrace_subr.c == --- head/sys/cddl/dev/dtrace/powerpc/dtrace_subr.c Mon Sep 2 22:48:41 2013(r255160) +++ head/sys/cddl/dev/dtrace/powerpc/dtrace_subr.c Mon Sep 2 23:22:05 2013(r255161) @@ -213,8 +213,8 @@ dtrace_gethrtime_init(void *arg) CPU_SET(pc-pc_cpuid, map); smp_rendezvous_cpus(map, NULL, - dtrace_gethrtime_init_cpu, - smp_no_rendevous_barrier, (void *)(uintptr_t) i); + dtrace_gethrtime_init_cpu, + smp_no_rendevous_barrier, (void *)(uintptr_t) i); timebase_skew[i] = tgt_cpu_tsc - hst_cpu_tsc; } @@ -247,7 +247,7 @@ dtrace_gethrtime() lo = timebase; hi = timebase 32; return (((lo * nsec_scale) SCALE_SHIFT) + - ((hi * nsec_scale) (32 - SCALE_SHIFT))); + ((hi * nsec_scale) (32 - SCALE_SHIFT))); } uint64_t @@ -280,34 +280,34 @@ dtrace_trap(struct trapframe *frame, u_i * All the rest will be handled in the usual way. */ switch (type) { - /* Page fault. */ - case EXC_DSI: - case EXC_DSE: - /* Flag a bad address. */ - cpu_core[curcpu].cpuc_dtrace_flags |= CPU_DTRACE_BADADDR; - cpu_core[curcpu].cpuc_dtrace_illval = frame-cpu.aim.dar; - - /* -* Offset the instruction pointer to the instruction -* following the one causing the fault. -*/ - frame-srr0 += sizeof(int); - return (1); - case EXC_ISI: - case EXC_ISE: - /* Flag a bad address. */ - cpu_core[curcpu].cpuc_dtrace_flags |= CPU_DTRACE_BADADDR; - cpu_core[curcpu].cpuc_dtrace_illval = frame-srr0; - - /* -* Offset the instruction pointer to the instruction -* following the one causing the fault. -*/ - frame-srr0 += sizeof(int); - return (1); - default: - /* Handle all other traps in the usual way. */ - break; + /* Page fault. */ + case EXC_DSI: + case EXC_DSE: + /* Flag a bad address. */ + cpu_core[curcpu].cpuc_dtrace_flags |= CPU_DTRACE_BADADDR; + cpu_core[curcpu].cpuc_dtrace_illval = frame-cpu.aim.dar; + + /* +* Offset the instruction pointer to the instruction +* following the one causing the fault. +*/ + frame-srr0 += sizeof(int); + return (1); + case EXC_ISI: + case EXC_ISE: + /* Flag a bad address. */ + cpu_core[curcpu].cpuc_dtrace_flags |= CPU_DTRACE_BADADDR; + cpu_core[curcpu].cpuc_dtrace_illval = frame-srr0; + + /* +* Offset the instruction pointer to the instruction +* following the one causing the fault. +*/ + frame-srr0 += sizeof(int); + return (1); + default: + /* Handle all other traps in the usual way. */ + break; } } @@ -321,29 +321,29 @@ dtrace_probe_error(dtrace_state_t *state { dtrace_probe(dtrace_probeid_error, (uint64_t)(uintptr_t)state, - (uintptr_t)epid, - (uintptr_t)which, (uintptr_t)fault, (uintptr_t)fltoffs); + (uintptr_t)epid, + (uintptr_t)which, (uintptr_t)fault, (uintptr_t)fltoffs); } static int dtrace_invop_start(struct trapframe *frame) { switch (dtrace_invop(frame-srr0, (uintptr_t *)frame, frame-fixreg[3])) { - case DTRACE_INVOP_JUMP: - break; - case DTRACE_INVOP_BCTR: - frame-srr0 = frame-ctr; - break; - case DTRACE_INVOP_BLR: -
svn commit: r255164 - in head/sys: dev/hwpmc modules/hwpmc powerpc/include
Author: jhibbits Date: Tue Sep 3 00:34:18 2013 New Revision: 255164 URL: http://svnweb.freebsd.org/changeset/base/255164 Log: Refactor PowerPC hwpmc(4) driver into generic and specific. More refactoring will likely be done as more drivers are added, since AIM-compatible processors have similar PMC configuration logic. Added: head/sys/dev/hwpmc/hwpmc_mpc7xxx.c (contents, props changed) head/sys/dev/hwpmc/hwpmc_powerpc.h (contents, props changed) Modified: head/sys/dev/hwpmc/hwpmc_powerpc.c head/sys/modules/hwpmc/Makefile head/sys/powerpc/include/pmc_mdep.h Added: head/sys/dev/hwpmc/hwpmc_mpc7xxx.c == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/hwpmc/hwpmc_mpc7xxx.c Tue Sep 3 00:34:18 2013 (r255164) @@ -0,0 +1,748 @@ +/*- + * Copyright (c) 2011 Justin Hibbits + * Copyright (c) 2005, Joseph Koshy + * 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. + * + */ + +#include sys/cdefs.h +__FBSDID($FreeBSD$); + +#include sys/param.h +#include sys/pmc.h +#include sys/pmckern.h +#include sys/systm.h + +#include machine/pmc_mdep.h +#include machine/spr.h +#include machine/cpu.h + +#include hwpmc_powerpc.h + +#definePOWERPC_PMC_CAPS(PMC_CAP_INTERRUPT | PMC_CAP_USER | \ +PMC_CAP_SYSTEM | PMC_CAP_EDGE |\ +PMC_CAP_THRESHOLD | PMC_CAP_READ | \ +PMC_CAP_WRITE | PMC_CAP_INVERT | \ +PMC_CAP_QUALIFIER) + +#define PPC_SET_PMC1SEL(r, x) ((r ~(SPR_MMCR0_PMC1SEL(0x3f))) | SPR_MMCR0_PMC1SEL(x)) +#define PPC_SET_PMC2SEL(r, x) ((r ~(SPR_MMCR0_PMC2SEL(0x3f))) | SPR_MMCR0_PMC2SEL(x)) +#define PPC_SET_PMC3SEL(r, x) ((r ~(SPR_MMCR1_PMC3SEL(0x1f))) | SPR_MMCR1_PMC3SEL(x)) +#define PPC_SET_PMC4SEL(r, x) ((r ~(SPR_MMCR1_PMC4SEL(0x1f))) | SPR_MMCR1_PMC4SEL(x)) +#define PPC_SET_PMC5SEL(r, x) ((r ~(SPR_MMCR1_PMC5SEL(0x1f))) | SPR_MMCR1_PMC5SEL(x)) +#define PPC_SET_PMC6SEL(r, x) ((r ~(SPR_MMCR1_PMC6SEL(0x3f))) | SPR_MMCR1_PMC6SEL(x)) + +/* Change this when we support more than just the 7450. */ +#define MPC7XXX_MAX_PMCS 6 + +#define MPC7XXX_PMC_HAS_OVERFLOWED(x) (mpc7xxx_pmcn_read(x) (0x1 31)) + +/* + * Things to improve on this: + * - It stops (clears to 0) the PMC and resets it at every context switch + * currently. + */ + +/* + * This should work for every 32-bit PowerPC implementation I know of (G3 and G4 + * specifically). + */ + +struct powerpc_event_code_map { + enum pmc_event pe_ev; /* enum value */ + uint8_t pe_counter_mask; /* Which counter this can be counted in. */ + uint8_t pe_code; /* numeric code */ +}; + +#define PPC_PMC_MASK1 0 +#define PPC_PMC_MASK2 1 +#define PPC_PMC_MASK3 2 +#define PPC_PMC_MASK4 3 +#define PPC_PMC_MASK5 4 +#define PPC_PMC_MASK6 5 +#define PPC_PMC_MASK_ALL 0x3f +#define PMC_POWERPC_EVENT(id, mask, number) \ + { .pe_ev = PMC_EV_PPC7450_##id, .pe_counter_mask = mask, .pe_code = number } + +static struct powerpc_event_code_map powerpc_event_codes[] = { + PMC_POWERPC_EVENT(CYCLE,PPC_PMC_MASK_ALL, 1), + PMC_POWERPC_EVENT(INSTR_COMPLETED, 0x0f, 2), + PMC_POWERPC_EVENT(TLB_BIT_TRANSITIONS, 0x0f, 3), + PMC_POWERPC_EVENT(INSTR_DISPATCHED, 0x0f, 4), + PMC_POWERPC_EVENT(PMON_EXCEPT, 0x0f, 5), + PMC_POWERPC_EVENT(PMON_SIG, 0x0f, 7), + PMC_POWERPC_EVENT(VPU_INSTR_COMPLETED, 0x03, 8), + PMC_POWERPC_EVENT(VFPU_INSTR_COMPLETED, 0x03, 9), + PMC_POWERPC_EVENT(VIU1_INSTR_COMPLETED, 0x03, 10
svn commit: r255165 - head/sys/powerpc/aim
Author: jhibbits Date: Tue Sep 3 00:42:15 2013 New Revision: 255165 URL: http://svnweb.freebsd.org/changeset/base/255165 Log: Enable PMC interrupt handling, and fix a DTrace trap handling bug. Modified: head/sys/powerpc/aim/trap.c Modified: head/sys/powerpc/aim/trap.c == --- head/sys/powerpc/aim/trap.c Tue Sep 3 00:34:18 2013(r255164) +++ head/sys/powerpc/aim/trap.c Tue Sep 3 00:42:15 2013(r255165) @@ -197,13 +197,11 @@ trap(struct trapframe *frame) #ifdef HWPMC_HOOKS if (type == EXC_PERF (pmc_intr != NULL)) { -#ifdef notyet - (*pmc_intr)(PCPU_GET(cpuid), frame); - if (!user) + (*pmc_intr)(PCPU_GET(cpuid), frame); + if (user) + userret(td, frame); return; -#endif } - else #endif #ifdef KDTRACE_HOOKS /* @@ -316,9 +314,11 @@ trap(struct trapframe *frame) if (*(uintptr_t *)frame-srr0 == 0x7c810808) { if (dtrace_invop_jump_addr != NULL) { dtrace_invop_jump_addr(frame); + return; } } } + break; #endif #ifdef __powerpc64__ case EXC_DSE: ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r255199 - head/sys/dev/hwpmc
Author: jhibbits Date: Wed Sep 4 04:11:38 2013 New Revision: 255199 URL: http://svnweb.freebsd.org/changeset/base/255199 Log: Fix hwpmc(4) for 32-bit PowerPC. Modified: head/sys/dev/hwpmc/hwpmc_powerpc.c head/sys/dev/hwpmc/hwpmc_powerpc.h Modified: head/sys/dev/hwpmc/hwpmc_powerpc.c == --- head/sys/dev/hwpmc/hwpmc_powerpc.c Tue Sep 3 23:34:04 2013 (r255198) +++ head/sys/dev/hwpmc/hwpmc_powerpc.c Wed Sep 4 04:11:38 2013 (r255199) @@ -36,6 +36,8 @@ __FBSDID($FreeBSD$); #include machine/pmc_mdep.h #include machine/spr.h +#include machine/pte.h +#include machine/sr.h #include machine/cpu.h #include machine/vmparam.h /* For VM_MIN_KERNEL_ADDRESS/VM_MAX_KERNEL_ADDRESS */ @@ -44,11 +46,6 @@ __FBSDID($FreeBSD$); #define INKERNEL(x)(((vm_offset_t)(x)) = VM_MAX_KERNEL_ADDRESS \ ((vm_offset_t)(x)) = VM_MIN_KERNEL_ADDRESS) -/* - * Per-processor information. - */ -static unsigned int ppc_npmcs; - int pmc_save_kernel_callchain(uintptr_t *cc, int maxsamples, struct trapframe *tf) @@ -89,8 +86,6 @@ powerpc_describe(int cpu, int ri, struct KASSERT(cpu = 0 cpu pmc_cpu_max(), ([powerpc,%d], illegal CPU %d, __LINE__, cpu)); - KASSERT(ri = 0 ri ppc_npmcs, - ([powerpc,%d] row-index %d out of range, __LINE__, ri)); phw = powerpc_pcpu[cpu]-pc_ppcpmcs[ri]; snprintf(powerpc_name, sizeof(powerpc_name), POWERPC-%d, ri); Modified: head/sys/dev/hwpmc/hwpmc_powerpc.h == --- head/sys/dev/hwpmc/hwpmc_powerpc.h Tue Sep 3 23:34:04 2013 (r255198) +++ head/sys/dev/hwpmc/hwpmc_powerpc.h Wed Sep 4 04:11:38 2013 (r255199) @@ -51,7 +51,6 @@ struct powerpc_cpu { extern struct powerpc_cpu **powerpc_pcpu; extern int pmc_mpc7xxx_initialize(struct pmc_mdep *pmc_mdep); -extern int pmc_ppc970_initialize(struct pmc_mdep *pmc_mdep); extern int powerpc_describe(int cpu, int ri, struct pmc_info *pi, struct pmc **ppmc); extern int powerpc_get_config(int cpu, int ri, struct pmc **ppm); ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r255228 - head/sys/dev/hwpmc
Author: jhibbits Date: Thu Sep 5 01:13:26 2013 New Revision: 255228 URL: http://svnweb.freebsd.org/changeset/base/255228 Log: Fix the build. Modified: head/sys/dev/hwpmc/hwpmc_powerpc.c Modified: head/sys/dev/hwpmc/hwpmc_powerpc.c == --- head/sys/dev/hwpmc/hwpmc_powerpc.c Thu Sep 5 01:05:48 2013 (r255227) +++ head/sys/dev/hwpmc/hwpmc_powerpc.c Thu Sep 5 01:13:26 2013 (r255228) @@ -46,6 +46,8 @@ __FBSDID($FreeBSD$); #define INKERNEL(x)(((vm_offset_t)(x)) = VM_MAX_KERNEL_ADDRESS \ ((vm_offset_t)(x)) = VM_MIN_KERNEL_ADDRESS) +struct powerpc_cpu **powerpc_pcpu; + int pmc_save_kernel_callchain(uintptr_t *cc, int maxsamples, struct trapframe *tf) ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
Re: svn commit: r255247 - head/sys/conf
Pointyhat to: jhibbits Sorry about that, for the third time in as many days for the same component. On Sep 5, 2013 6:53 AM, Gleb Smirnoff gleb...@freebsd.org wrote: Author: glebius Date: Thu Sep 5 13:53:25 2013 New Revision: 255247 URL: http://svnweb.freebsd.org/changeset/base/255247 Log: Fix build. Modified: head/sys/conf/files.powerpc Modified: head/sys/conf/files.powerpc == --- head/sys/conf/files.powerpc Thu Sep 5 13:46:30 2013(r255246) +++ head/sys/conf/files.powerpc Thu Sep 5 13:53:25 2013(r255247) @@ -30,6 +30,7 @@ dev/agp/agp_apple.c optionalagp powerm dev/fb/fb.coptionalsc dev/fdt/fdt_powerpc.c optionalfdt dev/hwpmc/hwpmc_powerpc.c optionalhwpmc +dev/hwpmc/hwpmc_mpc7xxx.c optionalhwpmc dev/iicbus/ad7417.coptionalad7417 powermac dev/iicbus/ds1631.coptionalds1631 powermac dev/iicbus/ds1775.coptionalds1775 powermac ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r255921 - head/sys/dev/adb
Author: jhibbits Date: Sat Sep 28 02:13:59 2013 New Revision: 255921 URL: http://svnweb.freebsd.org/changeset/base/255921 Log: Fix powerpc/161045. ams_poll() needs to return that any data is available, not just a new packet. PR: powerpc/161045 Approved by: re(marius) MFC after:1 week Modified: head/sys/dev/adb/adb_mouse.c Modified: head/sys/dev/adb/adb_mouse.c == --- head/sys/dev/adb/adb_mouse.cSat Sep 28 00:44:59 2013 (r255920) +++ head/sys/dev/adb/adb_mouse.cSat Sep 28 02:13:59 2013 (r255921) @@ -471,7 +471,8 @@ ams_poll(struct cdev *dev, int events, s mtx_lock(sc-sc_mtx); if (sc-xdelta == 0 sc-ydelta == 0 - sc-buttons == sc-last_buttons) { + sc-buttons == sc-last_buttons + sc-packet_read_len == 0) { selrecord(p, sc-rsel); events = 0; } else { ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r256542 - head/sys/powerpc/aim
Author: jhibbits Date: Tue Oct 15 14:52:44 2013 New Revision: 256542 URL: http://svnweb.freebsd.org/changeset/base/256542 Log: Move the PMC handling to the first level interrupt handler where it belongs. Also add the pmc_hook use, to handle callchain tracing. MFC after:1 week Modified: head/sys/powerpc/aim/interrupt.c head/sys/powerpc/aim/trap.c Modified: head/sys/powerpc/aim/interrupt.c == --- head/sys/powerpc/aim/interrupt.cTue Oct 15 14:46:37 2013 (r256541) +++ head/sys/powerpc/aim/interrupt.cTue Oct 15 14:52:44 2013 (r256542) @@ -31,6 +31,8 @@ * Interrupts are dispatched to here from locore asm */ +#include opt_hwpmc_hooks.h + #include sys/cdefs.h /* RCS ID Copyright macro defns */ #include sys/param.h @@ -43,6 +45,9 @@ #include sys/lock.h #include sys/malloc.h #include sys/mutex.h +#ifdef HWPMC_HOOKS +#include sys/pmckern.h +#endif #include sys/proc.h #include sys/smp.h #include sys/unistd.h @@ -96,6 +101,17 @@ powerpc_interrupt(struct trapframe *fram atomic_subtract_int(td-td_intr_nesting_level, 1); critical_exit(); break; + case EXC_PERF: + critical_enter(); + KASSERT(pmc_intr != NULL, (Performance exception, but no handler!)); + (*pmc_intr)(PCPU_GET(cpuid), framep); + critical_enter(); +#ifdef HWPMC_HOOKS + if (pmc_hook (PCPU_GET(curthread)-td_pflags TDP_CALLCHAIN)) + pmc_hook(PCPU_GET(curthread), PMC_FN_USER_CALLCHAIN, framep); +#endif + critical_exit(); + break; default: /* Re-enable interrupts if applicable. */ Modified: head/sys/powerpc/aim/trap.c == --- head/sys/powerpc/aim/trap.c Tue Oct 15 14:46:37 2013(r256541) +++ head/sys/powerpc/aim/trap.c Tue Oct 15 14:52:44 2013(r256542) @@ -34,7 +34,6 @@ #include sys/cdefs.h __FBSDID($FreeBSD$); -#include opt_hwpmc_hooks.h #include opt_kdtrace.h #include sys/param.h @@ -52,9 +51,6 @@ __FBSDID($FreeBSD$); #include sys/uio.h #include sys/signalvar.h #include sys/vmmeter.h -#ifdef HWPMC_HOOKS -#include sys/pmckern.h -#endif #include security/audit/audit.h @@ -195,14 +191,6 @@ trap(struct trapframe *frame) CTR3(KTR_TRAP, trap: %s type=%s (%s), td-td_name, trapname(type), user ? user : kernel); -#ifdef HWPMC_HOOKS - if (type == EXC_PERF (pmc_intr != NULL)) { - (*pmc_intr)(PCPU_GET(cpuid), frame); - if (user) - userret(td, frame); - return; - } -#endif #ifdef KDTRACE_HOOKS /* * A trap can occur while DTrace executes a probe. Before @@ -292,7 +280,7 @@ trap(struct trapframe *frame) case EXC_PGM: /* Identify the trap reason */ if (frame-srr1 EXC_PGM_TRAP) - sig = SIGTRAP; + sig = SIGTRAP; else if (ppc_instr_emulate(frame) == 0) frame-srr0 += 4; else ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r256543 - in head: cddl/contrib/opensolaris/lib/libdtrace/common cddl/contrib/opensolaris/lib/libdtrace/powerpc sys/cddl/contrib/opensolaris/uts/powerpc/dtrace sys/cddl/contrib/opensola...
-ftps_type = DTFTP_OFFSETS; + ftp-ftps_pc = (uintptr_t)symp-st_value; + ftp-ftps_size = (size_t)symp-st_size; + ftp-ftps_noffs = 0; + + /* +* If we're matching against everything, just iterate through each +* instruction in the function, otherwise look for matching offset +* names by constructing the string and comparing it against the +* pattern. +*/ + if (strcmp(*, pattern) == 0) { + for (i = 0; i symp-st_size; i += 4) { + ftp-ftps_offs[ftp-ftps_noffs++] = i; + } + } else { + char name[sizeof (i) * 2 + 1]; + + for (i = 0; i symp-st_size; i += 4) { + (void) sprintf(name, %lx, i); + if (gmatch(name, pattern)) + ftp-ftps_offs[ftp-ftps_noffs++] = i; + } + } + + if (ioctl(dtp-dt_ftfd, FASTTRAPIOC_MAKEPROBE, ftp) != 0) { + dt_dprintf(fasttrap probe creation ioctl failed: %s\n, + strerror(errno)); + return (dt_set_errno(dtp, errno)); + } - dt_dprintf(%s: unimplemented\n, __func__); - return (DT_PROC_ERR); + return (ftp-ftps_noffs); } Modified: head/sys/cddl/contrib/opensolaris/uts/powerpc/dtrace/fasttrap_isa.c == --- head/sys/cddl/contrib/opensolaris/uts/powerpc/dtrace/fasttrap_isa.c Tue Oct 15 14:52:44 2013(r256542) +++ head/sys/cddl/contrib/opensolaris/uts/powerpc/dtrace/fasttrap_isa.c Tue Oct 15 15:00:29 2013(r256543) @@ -18,13 +18,560 @@ * * CDDL HEADER END */ - +/* Portions Copyright 2013 Justin Hibbits */ /* * Copyright 2007 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ +#include sys/fasttrap_isa.h +#include sys/fasttrap_impl.h +#include sys/dtrace.h +#include sys/dtrace_impl.h +#include cddl/dev/dtrace/dtrace_cddl.h +#include sys/proc.h +#include sys/types.h +#include sys/uio.h +#include sys/ptrace.h +#include sys/sysent.h + +#define OP(x) ((x) 26) +#define OPX(x) (((x) 2) 0x3FF) +#define OP_BO(x) (((x) 0x03E0) 21) +#define OP_BI(x) (((x) 0x001F) 16) +#define OP_RS(x) (((x) 0x03E0) 21) +#define OP_RA(x) (((x) 0x001F) 16) +#define OP_RB(x) (((x) 0xF100) 11) + + +static int +proc_ops(int op, proc_t *p, void *kaddr, off_t uaddr, size_t len) +{ + struct iovec iov; + struct uio uio; + + iov.iov_base = kaddr; + iov.iov_len = len; + uio.uio_offset = uaddr; + uio.uio_iov = iov; + uio.uio_resid = len; + uio.uio_iovcnt = 1; + uio.uio_segflg = UIO_SYSSPACE; + uio.uio_td = curthread; + uio.uio_rw = op; + PHOLD(p); + if (proc_rwmem(p, uio) 0) { + PRELE(p); + return (-1); + } + PRELE(p); + + return (0); +} + +static int +uread(proc_t *p, void *kaddr, size_t len, uintptr_t uaddr) +{ + + return (proc_ops(UIO_READ, p, kaddr, uaddr, len)); +} + +static int +uwrite(proc_t *p, void *kaddr, size_t len, uintptr_t uaddr) +{ + + return (proc_ops(UIO_WRITE, p, kaddr, uaddr, len)); +} + +int +fasttrap_tracepoint_install(proc_t *p, fasttrap_tracepoint_t *tp) +{ + fasttrap_instr_t instr = FASTTRAP_INSTR; + + if (uwrite(p, instr, 4, tp-ftt_pc) != 0) + return (-1); + + return (0); +} + +int +fasttrap_tracepoint_remove(proc_t *p, fasttrap_tracepoint_t *tp) +{ + uint32_t instr; + + /* +* Distinguish between read or write failures and a changed +* instruction. +*/ + if (uread(p, instr, 4, tp-ftt_pc) != 0) + return (0); + if (instr != FASTTRAP_INSTR) + return (0); + if (uwrite(p, tp-ftt_instr, 4, tp-ftt_pc) != 0) + return (-1); + + return (0); +} + +int +fasttrap_tracepoint_init(proc_t *p, fasttrap_tracepoint_t *tp, uintptr_t pc, +fasttrap_probe_type_t type) +{ + uint32_t instr; + //int32_t disp; + + /* +* Read the instruction at the given address out of the process's +* address space. We don't have to worry about a debugger +* changing this instruction before we overwrite it with our trap +* instruction since P_PR_LOCK is set. +*/ + if (uread(p, instr, 4, pc) != 0) + return (-1); + + /* +* Decode the instruction to fill in the probe flags. We can have +* the process execute most instructions on its own using a pc/npc +* trick, but pc-relative control transfer present a problem since +* we're relocating the instruction. We emulate these instructions +* in the kernel. We assume a default type and over-write that as +* needed. +* +* pc-relative instructions must be emulated for correctness; +* other instructions (which
svn commit: r256581 - head/sys/powerpc/aim
Author: jhibbits Date: Wed Oct 16 04:11:42 2013 New Revision: 256581 URL: http://svnweb.freebsd.org/changeset/base/256581 Log: Fix the Wii build, and remove an extraneous critical_enter(). Modified: head/sys/powerpc/aim/interrupt.c Modified: head/sys/powerpc/aim/interrupt.c == --- head/sys/powerpc/aim/interrupt.cWed Oct 16 04:10:28 2013 (r256580) +++ head/sys/powerpc/aim/interrupt.cWed Oct 16 04:11:42 2013 (r256581) @@ -101,17 +101,16 @@ powerpc_interrupt(struct trapframe *fram atomic_subtract_int(td-td_intr_nesting_level, 1); critical_exit(); break; +#ifdef HWPMC_HOOKS case EXC_PERF: critical_enter(); KASSERT(pmc_intr != NULL, (Performance exception, but no handler!)); (*pmc_intr)(PCPU_GET(cpuid), framep); - critical_enter(); -#ifdef HWPMC_HOOKS if (pmc_hook (PCPU_GET(curthread)-td_pflags TDP_CALLCHAIN)) pmc_hook(PCPU_GET(curthread), PMC_FN_USER_CALLCHAIN, framep); -#endif critical_exit(); break; +#endif default: /* Re-enable interrupts if applicable. */ ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r257081 - head/sys/cddl/dev/dtrace/powerpc
Author: jhibbits Date: Fri Oct 25 00:17:12 2013 New Revision: 257081 URL: http://svnweb.freebsd.org/changeset/base/257081 Log: ELF PowerPC64 ABI puts the LR save word at 16 byte offset, not 8. Modified: head/sys/cddl/dev/dtrace/powerpc/dtrace_isa.c Modified: head/sys/cddl/dev/dtrace/powerpc/dtrace_isa.c == --- head/sys/cddl/dev/dtrace/powerpc/dtrace_isa.c Thu Oct 24 23:47:31 2013(r257080) +++ head/sys/cddl/dev/dtrace/powerpc/dtrace_isa.c Fri Oct 25 00:17:12 2013(r257081) @@ -49,7 +49,8 @@ /* Offset to the LR Save word (ppc32) */ #define RETURN_OFFSET 4 -#define RETURN_OFFSET648 +/* Offset to LR Save word (ppc64). CR Save area sits between back chain and LR */ +#define RETURN_OFFSET6416 #define INKERNEL(x)((x) = VM_MAX_KERNEL_ADDRESS \ (x) = VM_MIN_KERNEL_ADDRESS) ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r257750 - head/sys/powerpc/powerpc
Author: jhibbits Date: Wed Nov 6 15:56:03 2013 New Revision: 257750 URL: http://svnweb.freebsd.org/changeset/base/257750 Log: Make the powerpc dumpsys() more consistent with the other architectures. MFC after:10.0-RELEASE Modified: head/sys/powerpc/powerpc/dump_machdep.c Modified: head/sys/powerpc/powerpc/dump_machdep.c == --- head/sys/powerpc/powerpc/dump_machdep.c Wed Nov 6 15:49:31 2013 (r257749) +++ head/sys/powerpc/powerpc/dump_machdep.c Wed Nov 6 15:56:03 2013 (r257750) @@ -260,7 +260,7 @@ dumpsys(struct dumperinfo *di) ehdr.e_phnum); /* Dump leader */ - error = di-dumper(di-priv, kdh, 0, dumplo, sizeof(kdh)); + error = dump_write(di, kdh, 0, dumplo, sizeof(kdh)); if (error) goto fail; dumplo += sizeof(kdh); @@ -291,12 +291,12 @@ dumpsys(struct dumperinfo *di) goto fail; /* Dump trailer */ - error = di-dumper(di-priv, kdh, 0, dumplo, sizeof(kdh)); + error = dump_write(di, kdh, 0, dumplo, sizeof(kdh)); if (error) goto fail; /* Signal completion, signoff and exit stage left. */ - di-dumper(di-priv, NULL, 0, 0, 0); + dump_write(di, NULL, 0, 0, 0); printf(\nDump complete\n); return; @@ -306,6 +306,8 @@ dumpsys(struct dumperinfo *di) if (error == ECANCELED) printf(\nDump aborted\n); + else if (error == ENOSPC) + printf(\nDump failed. Partition too small.\n); else printf(\n** DUMP FAILED (ERROR %d) **\n, error); } ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r257813 - head/sys/powerpc/powerpc
Author: jhibbits Date: Thu Nov 7 21:02:57 2013 New Revision: 257813 URL: http://svnweb.freebsd.org/changeset/base/257813 Log: Clamp the dump block size to the dump device max I/O size. Modified: head/sys/powerpc/powerpc/dump_machdep.c Modified: head/sys/powerpc/powerpc/dump_machdep.c == --- head/sys/powerpc/powerpc/dump_machdep.c Thu Nov 7 20:54:52 2013 (r257812) +++ head/sys/powerpc/powerpc/dump_machdep.c Thu Nov 7 21:02:57 2013 (r257813) @@ -114,7 +114,7 @@ cb_dumpdata(struct pmap_md *md, int seqn { struct dumperinfo *di = (struct dumperinfo*)arg; vm_offset_t va; - size_t counter, ofs, resid, sz; + size_t counter, ofs, resid, sz, maxsz; int c, error, twiddle; error = 0; @@ -123,11 +123,12 @@ cb_dumpdata(struct pmap_md *md, int seqn ofs = 0;/* Logical offset within the chunk */ resid = md-md_size; + maxsz = min(DFLTPHYS, di-maxiosize); printf( chunk %d: %lu bytes , seqnr, (u_long)resid); while (resid) { - sz = (resid DFLTPHYS) ? DFLTPHYS : resid; + sz = min(resid, maxsz); va = pmap_dumpsys_map(md, ofs, sz); counter += sz; if (counter 24) { ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r257941 - head/sys/powerpc/aim
Author: jhibbits Date: Mon Nov 11 03:17:38 2013 New Revision: 257941 URL: http://svnweb.freebsd.org/changeset/base/257941 Log: Add the necessary bits for dumps on ppc64. MFC after:2 weeks Modified: head/sys/powerpc/aim/mmu_oea64.c Modified: head/sys/powerpc/aim/mmu_oea64.c == --- head/sys/powerpc/aim/mmu_oea64.cMon Nov 11 03:12:43 2013 (r257940) +++ head/sys/powerpc/aim/mmu_oea64.cMon Nov 11 03:17:38 2013 (r257941) @@ -192,6 +192,11 @@ struct ofw_map { cell_t om_mode; }; +extern unsigned char _etext[]; +extern unsigned char _end[]; + +extern int dumpsys_minidump; + /* * Map of physical memory regions. */ @@ -329,6 +334,9 @@ void moea64_kenter_attr(mmu_t, vm_offset void moea64_kenter(mmu_t, vm_offset_t, vm_paddr_t); boolean_t moea64_dev_direct_mapped(mmu_t, vm_paddr_t, vm_size_t); static void moea64_sync_icache(mmu_t, pmap_t, vm_offset_t, vm_size_t); +vm_offset_t moea64_dumpsys_map(mmu_t mmu, struct pmap_md *md, vm_size_t ofs, +vm_size_t *sz); +struct pmap_md * moea64_scan_md(mmu_t mmu, struct pmap_md *prev); static mmu_method_t moea64_methods[] = { MMUMETHOD(mmu_change_wiring,moea64_change_wiring), @@ -374,6 +382,8 @@ static mmu_method_t moea64_methods[] = { MMUMETHOD(mmu_kenter, moea64_kenter), MMUMETHOD(mmu_kenter_attr, moea64_kenter_attr), MMUMETHOD(mmu_dev_direct_mapped,moea64_dev_direct_mapped), + MMUMETHOD(mmu_scan_md, moea64_scan_md), + MMUMETHOD(mmu_dumpsys_map, moea64_dumpsys_map), { 0, 0 } }; @@ -2584,3 +2594,98 @@ moea64_sync_icache(mmu_t mmu, pmap_t pm, } PMAP_UNLOCK(pm); } + +vm_offset_t +moea64_dumpsys_map(mmu_t mmu, struct pmap_md *md, vm_size_t ofs, +vm_size_t *sz) +{ + if (md-md_vaddr == ~0UL) + return (md-md_paddr + ofs); + else + return (md-md_vaddr + ofs); +} + +struct pmap_md * +moea64_scan_md(mmu_t mmu, struct pmap_md *prev) +{ + static struct pmap_md md; + struct pvo_entry *pvo; + vm_offset_t va; + + if (dumpsys_minidump) { + md.md_paddr = ~0UL; /* Minidumps use virtual addresses. */ + if (prev == NULL) { + /* 1st: kernel .data and .bss. */ + md.md_index = 1; + md.md_vaddr = trunc_page((uintptr_t)_etext); + md.md_size = round_page((uintptr_t)_end) - md.md_vaddr; + return (md); + } + switch (prev-md_index) { + case 1: + /* 2nd: msgbuf and tables (see pmap_bootstrap()). */ + md.md_index = 2; + md.md_vaddr = (vm_offset_t)msgbufp-msg_ptr; + md.md_size = round_page(msgbufp-msg_size); + break; + case 2: + /* 3rd: kernel VM. */ + va = prev-md_vaddr + prev-md_size; + /* Find start of next chunk (from va). */ + while (va virtual_end) { + /* Don't dump the buffer cache. */ + if (va = kmi.buffer_sva + va kmi.buffer_eva) { + va = kmi.buffer_eva; + continue; + } + pvo = moea64_pvo_find_va(kernel_pmap, + va ~ADDR_POFF); + if (pvo != NULL + (pvo-pvo_pte.pte.pte_hi PTE_VALID)) + break; + va += PAGE_SIZE; + } + if (va virtual_end) { + md.md_vaddr = va; + va += PAGE_SIZE; + /* Find last page in chunk. */ + while (va virtual_end) { + /* Don't run into the buffer cache. */ + if (va == kmi.buffer_sva) + break; + pvo = moea64_pvo_find_va(kernel_pmap, + va ~ADDR_POFF); + if (pvo == NULL || + !(pvo-pvo_pte.pte.pte_hi PTE_VALID)) + break; + va += PAGE_SIZE; + } + md.md_size = va - md.md_vaddr; + break; + } + md.md_index = 3; + /* FALLTHROUGH */
svn commit: r268207 - head/sys/dev/hwpmc
Author: jhibbits Date: Thu Jul 3 06:52:26 2014 New Revision: 268207 URL: http://svnweb.freebsd.org/changeset/base/268207 Log: Fix a bug in hwpmc(4) callchain retrieval, for both user and kernel. The array index for the callchain is getting double-incremented -- both in the loop and the storing. It should only be incremented in one location. Also, constrain the stack pointer range check. MFC after:2 weeks Modified: head/sys/dev/hwpmc/hwpmc_powerpc.c Modified: head/sys/dev/hwpmc/hwpmc_powerpc.c == --- head/sys/dev/hwpmc/hwpmc_powerpc.c Thu Jul 3 06:44:55 2014 (r268206) +++ head/sys/dev/hwpmc/hwpmc_powerpc.c Thu Jul 3 06:52:26 2014 (r268207) @@ -55,20 +55,22 @@ int pmc_save_kernel_callchain(uintptr_t *cc, int maxsamples, struct trapframe *tf) { + uintptr_t *osp, *sp; int frames = 0; - uintptr_t *sp; cc[frames++] = PMC_TRAPFRAME_TO_PC(tf); sp = (uintptr_t *)PMC_TRAPFRAME_TO_FP(tf); + osp = NULL; for (; frames maxsamples; frames++) { - if (!INKERNEL(sp)) + if (!INKERNEL(sp) || sp = osp) break; #ifdef __powerpc64__ - cc[frames++] = sp[2]; + cc[frames] = sp[2]; #else - cc[frames++] = sp[1]; + cc[frames] = sp[1]; #endif + osp = sp; sp = (uintptr_t *)*sp; } return (frames); @@ -184,26 +186,28 @@ int pmc_save_user_callchain(uintptr_t *cc, int maxsamples, struct trapframe *tf) { - uintptr_t *sp; + uintptr_t *osp, *sp; int frames = 0; cc[frames++] = PMC_TRAPFRAME_TO_PC(tf); sp = (uintptr_t *)PMC_TRAPFRAME_TO_FP(tf); + osp = NULL; for (; frames maxsamples; frames++) { - if (!INUSER(sp)) + if (!INUSER(sp) || sp = osp) break; + osp = sp; #ifdef __powerpc64__ /* Check if 32-bit mode. */ if (!(tf-srr1 PSL_SF)) { - cc[frames++] = fuword32((uint32_t *)sp + 1); + cc[frames] = fuword32((uint32_t *)sp + 1); sp = (uintptr_t *)(uintptr_t)fuword32(sp); } else { - cc[frames++] = fuword(sp + 2); + cc[frames] = fuword(sp + 2); sp = (uintptr_t *)fuword(sp); } #else - cc[frames++] = fuword32((uint32_t *)sp + 1); + cc[frames] = fuword32((uint32_t *)sp + 1); sp = (uintptr_t *)fuword32(sp); #endif } ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r269701 - head/sys/powerpc/aim
Author: jhibbits Date: Fri Aug 8 06:22:32 2014 New Revision: 269701 URL: http://svnweb.freebsd.org/changeset/base/269701 Log: Set the si_code appropriately for exception-caused signals. LLDB checks the si_code, and aborts if a code isn't known. MFC after:2 weeks Relnotes: yes Modified: head/sys/powerpc/aim/trap.c Modified: head/sys/powerpc/aim/trap.c == --- head/sys/powerpc/aim/trap.c Fri Aug 8 03:49:01 2014(r269700) +++ head/sys/powerpc/aim/trap.c Fri Aug 8 06:22:32 2014(r269701) @@ -192,6 +192,7 @@ trap(struct trapframe *frame) case EXC_TRC: frame-srr1 = ~PSL_SE; sig = SIGTRAP; + ucode = TRAP_TRACE; break; #ifdef __powerpc64__ @@ -199,13 +200,17 @@ trap(struct trapframe *frame) case EXC_DSE: if (handle_user_slb_spill(p-p_vmspace-vm_pmap, (type == EXC_ISE) ? frame-srr0 : - frame-cpu.aim.dar) != 0) + frame-cpu.aim.dar) != 0) { sig = SIGSEGV; + ucode = SEGV_MAPERR; + } break; #endif case EXC_DSI: case EXC_ISI: sig = trap_pfault(frame, 1); + if (sig == SIGSEGV) + ucode = SEGV_MAPERR; break; case EXC_SC: @@ -240,8 +245,10 @@ trap(struct trapframe *frame) break; case EXC_ALI: - if (fix_unaligned(td, frame) != 0) + if (fix_unaligned(td, frame) != 0) { sig = SIGBUS; + ucode = BUS_ADRALN; + } else frame-srr0 += 4; break; @@ -259,8 +266,16 @@ trap(struct trapframe *frame) } #endif sig = SIGTRAP; + ucode = TRAP_BRKPT; } else { sig = ppc_instr_emulate(frame, td-td_pcb); + if (sig == SIGILL) { + if (frame-srr1 EXC_PGM_PRIV) + ucode = ILL_PRVOPC; + else if (frame-srr1 EXC_PGM_ILLEGAL) + ucode = ILL_ILLOPC; + } else if (sig == SIGFPE) + ucode = FPE_FLTINV; /* Punt for now, invalid operation. */ } break; @@ -271,6 +286,7 @@ trap(struct trapframe *frame) * but it at least prevents the kernel from dying. */ sig = SIGBUS; + ucode = BUS_OBJERR; break; default: ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r246275 - head/sys/cddl/dev/dtrace/powerpc
Author: jhibbits Date: Sun Feb 3 00:19:34 2013 New Revision: 246275 URL: http://svnweb.freebsd.org/changeset/base/246275 Log: Fix the PowerPC DTrace copy functions. The kernel doesn't hold the same view to the user map, so use the md copy in/out functions provided by the kernel. MFC with: r242723 Modified: head/sys/cddl/dev/dtrace/powerpc/dtrace_asm.S head/sys/cddl/dev/dtrace/powerpc/dtrace_isa.c Modified: head/sys/cddl/dev/dtrace/powerpc/dtrace_asm.S == --- head/sys/cddl/dev/dtrace/powerpc/dtrace_asm.S Sun Feb 3 00:02:59 2013(r246274) +++ head/sys/cddl/dev/dtrace/powerpc/dtrace_asm.S Sun Feb 3 00:19:34 2013(r246275) @@ -19,6 +19,8 @@ * * CDDL HEADER END * + * Portions Copyright 2012,2013 Justin Hibbits jhibb...@freebsd.org + * * $FreeBSD$ */ /* @@ -114,48 +116,6 @@ ASENTRY_NOPROF(dtrace_fulword) END(dtrace_fulword) /* -uint8_t -dtrace_fuword8_nocheck(void *addr) -*/ -ASENTRY_NOPROF(dtrace_fuword8_nocheck) - lbz %r3,0(%r3) - blr -END(dtrace_fuword8_nocheck) - -/* -uint16_t -dtrace_fuword16_nocheck(void *addr) -*/ -ASENTRY_NOPROF(dtrace_fuword16_nocheck) - lhz %r3,0(%r3) - blr -END(dtrace_fuword16_nocheck) - -/* -uint32_t -dtrace_fuword32_nocheck(void *addr) -*/ -ASENTRY_NOPROF(dtrace_fuword32_nocheck) - lwz %r3,0(%r3) - blr -END(dtrace_fuword32_nocheck) - -/* -uint64_t -dtrace_fuword64_nocheck(void *addr) -*/ -ASENTRY_NOPROF(dtrace_fuword64_nocheck) -#if defined(__powerpc64__) - ld %r3,0(%r3) -#else - lwz %r5,0(%r3) - lwz %r4,4(%r3) - mr %r3,%r5 -#endif - blr -END(dtrace_fuword64_nocheck) - -/* XXX: unoptimized void dtrace_copy(uintptr_t src, uintptr_t dest, size_t size) Modified: head/sys/cddl/dev/dtrace/powerpc/dtrace_isa.c == --- head/sys/cddl/dev/dtrace/powerpc/dtrace_isa.c Sun Feb 3 00:02:59 2013(r246274) +++ head/sys/cddl/dev/dtrace/powerpc/dtrace_isa.c Sun Feb 3 00:19:34 2013(r246275) @@ -19,6 +19,8 @@ * * CDDL HEADER END * + * Portions Copyright 2012,2013 Justin Hibbits jhibb...@freebsd.org + * * $FreeBSD$ */ /* @@ -45,11 +47,6 @@ #include regset.h -uint8_t dtrace_fuword8_nocheck(void *); -uint16_t dtrace_fuword16_nocheck(void *); -uint32_t dtrace_fuword32_nocheck(void *); -uint64_t dtrace_fuword64_nocheck(void *); - /* Offset to the LR Save word (ppc32) */ #define RETURN_OFFSET 4 #define RETURN_OFFSET648 @@ -462,31 +459,63 @@ dtrace_copyin(uintptr_t uaddr, uintptr_t volatile uint16_t *flags) { if (dtrace_copycheck(uaddr, kaddr, size)) - dtrace_copy(uaddr, kaddr, size); + if (copyin((const void *)uaddr, (void *)kaddr, size)) { + DTRACE_CPUFLAG_SET(CPU_DTRACE_BADADDR); + cpu_core[curcpu].cpuc_dtrace_illval = (uintptr_t)uaddr; + } } void dtrace_copyout(uintptr_t kaddr, uintptr_t uaddr, size_t size, volatile uint16_t *flags) { - if (dtrace_copycheck(uaddr, kaddr, size)) - dtrace_copy(kaddr, uaddr, size); + if (dtrace_copycheck(uaddr, kaddr, size)) { + if (copyout((const void *)kaddr, (void *)uaddr, size)) { + DTRACE_CPUFLAG_SET(CPU_DTRACE_BADADDR); + cpu_core[curcpu].cpuc_dtrace_illval = (uintptr_t)uaddr; + } + } } void dtrace_copyinstr(uintptr_t uaddr, uintptr_t kaddr, size_t size, volatile uint16_t *flags) { - if (dtrace_copycheck(uaddr, kaddr, size)) - dtrace_copystr(uaddr, kaddr, size, flags); + size_t actual; + interror; + + if (dtrace_copycheck(uaddr, kaddr, size)) { + error = copyinstr((const void *)uaddr, (void *)kaddr, + size, actual); + + /* ENAMETOOLONG is not a fault condition. */ + if (error error != ENAMETOOLONG) { + DTRACE_CPUFLAG_SET(CPU_DTRACE_BADADDR); + cpu_core[curcpu].cpuc_dtrace_illval = (uintptr_t)uaddr; + } + } } +/* + * The bulk of this function could be replaced to match dtrace_copyinstr() + * if we ever implement a copyoutstr(). + */ void dtrace_copyoutstr(uintptr_t kaddr, uintptr_t uaddr, size_t size, volatile uint16_t *flags) { - if (dtrace_copycheck(uaddr, kaddr, size)) - dtrace_copystr(kaddr, uaddr, size, flags); + size_t len; + + if (dtrace_copycheck(uaddr, kaddr, size)) { + len = strlen((const char *)kaddr); + if (len size) + len = size; + + if (copyout((const void *)kaddr, (void *)uaddr, len)) { + DTRACE_CPUFLAG_SET(CPU_DTRACE_BADADDR
svn commit: r248457 - in head/sys: cddl/contrib/opensolaris/uts/common/sys cddl/dev/dtrace/powerpc cddl/dev/fbt modules/dtrace modules/dtrace/dtraceall modules/dtrace/fbt powerpc/aim
[] [name of copyright owner] + * + * CDDL HEADER END + * + * Portions Copyright 2006-2008 John Birrell j...@freebsd.org + * Portions Copyright 2013 Justin Hibbits jhibb...@freebsd.org + * + * $FreeBSD$ + * + */ + +/* + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#include sys/cdefs.h +#include sys/param.h +#include sys/systm.h +#include sys/conf.h +#include sys/cpuvar.h +#include sys/fcntl.h +#include sys/filio.h +#include sys/kdb.h +#include sys/kernel.h +#include sys/kmem.h +#include sys/kthread.h +#include sys/limits.h +#include sys/linker.h +#include sys/lock.h +#include sys/malloc.h +#include sys/module.h +#include sys/mutex.h +#include sys/pcpu.h +#include sys/poll.h +#include sys/proc.h +#include sys/selinfo.h +#include sys/smp.h +#include sys/syscall.h +#include sys/sysent.h +#include sys/sysproto.h +#include sys/uio.h +#include sys/unistd.h +#include machine/stdarg.h + +#include sys/dtrace.h +#include sys/dtrace_bsd.h + +static MALLOC_DEFINE(M_FBT, fbt, Function Boundary Tracing); + +#define FBT_PATCHVAL 0x7c810808 +#define FBT_MFLR_R00x7c0802a6 +#define FBT_MTLR_R00x7c0803a6 +#define FBT_BLR0x4e800020 +#define FBT_BCTR 0x4e800030 +#define FBT_BRANCH 0x4800 +#define FBT_BR_MASK0x03fc +#define FBT_IS_JUMP(instr) ((instr ~FBT_BR_MASK) == FBT_BRANCH) + +static d_open_tfbt_open; +static int fbt_unload(void); +static voidfbt_getargdesc(void *, dtrace_id_t, void *, dtrace_argdesc_t *); +static voidfbt_provide_module(void *, modctl_t *); +static voidfbt_destroy(void *, dtrace_id_t, void *); +static voidfbt_enable(void *, dtrace_id_t, void *); +static voidfbt_disable(void *, dtrace_id_t, void *); +static voidfbt_load(void *); +static voidfbt_suspend(void *, dtrace_id_t, void *); +static voidfbt_resume(void *, dtrace_id_t, void *); + +#defineFBT_ENTRY entry +#defineFBT_RETURN return +#defineFBT_ADDR2NDX(addr) uintptr_t)(addr)) 4) fbt_probetab_mask) +#defineFBT_PROBETAB_SIZE 0x8000 /* 32k entries -- 128K total */ + +static struct cdevsw fbt_cdevsw = { + .d_version = D_VERSION, + .d_open = fbt_open, + .d_name = fbt, +}; + +static dtrace_pattr_t fbt_attr = { +{ DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_COMMON }, +{ DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN }, +{ DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_ISA }, +{ DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_COMMON }, +{ DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_ISA }, +}; + +static dtrace_pops_t fbt_pops = { + NULL, + fbt_provide_module, + fbt_enable, + fbt_disable, + fbt_suspend, + fbt_resume, + fbt_getargdesc, + NULL, + NULL, + fbt_destroy +}; + +typedef struct fbt_probe { + struct fbt_probe *fbtp_hashnext; + uint32_t*fbtp_patchpoint; + int8_t fbtp_rval; + uint32_tfbtp_patchval; + uint32_tfbtp_savedval; + uintptr_t fbtp_roffset; + dtrace_id_t fbtp_id; + const char *fbtp_name; + modctl_t*fbtp_ctl; + int fbtp_loadcnt; + int fbtp_primary; + int fbtp_invop_cnt; + int fbtp_symindx; + struct fbt_probe *fbtp_next; +} fbt_probe_t; + +static struct cdev *fbt_cdev; +static dtrace_provider_id_tfbt_id; +static fbt_probe_t **fbt_probetab; +static int fbt_probetab_size; +static int fbt_probetab_mask; +static int fbt_verbose = 0; + +static int +fbt_invop(uintptr_t addr, uintptr_t *stack, uintptr_t rval) +{ + struct trapframe *frame = (struct trapframe *)stack; + solaris_cpu_t *cpu = solaris_cpu[curcpu]; + fbt_probe_t *fbt = fbt_probetab[FBT_ADDR2NDX(addr)]; + uintptr_t tmp; + + for (; fbt != NULL; fbt = fbt-fbtp_hashnext) { + if ((uintptr_t)fbt-fbtp_patchpoint == addr) { + fbt-fbtp_invop_cnt++; + if (fbt-fbtp_roffset == 0) { + cpu-cpu_dtrace_caller = addr; + + dtrace_probe(fbt-fbtp_id, frame-fixreg[3], + frame-fixreg[4], frame-fixreg[5], + frame-fixreg[6], frame-fixreg[7]); + + cpu-cpu_dtrace_caller = 0; + } else { + + dtrace_probe(fbt-fbtp_id, fbt-fbtp_roffset, + rval, 0, 0, 0); + /* +* The caller doesn't have
svn commit: r248486 - head/sys/modules/dtrace/fbt
Author: jhibbits Date: Tue Mar 19 00:39:02 2013 New Revision: 248486 URL: http://svnweb.freebsd.org/changeset/base/248486 Log: Fix the powerpc64 build. MACHINE_CPUARCH is common for powerpc/powerpc64, not MACHINE_ARCH. Modified: head/sys/modules/dtrace/fbt/Makefile Modified: head/sys/modules/dtrace/fbt/Makefile == --- head/sys/modules/dtrace/fbt/MakefileMon Mar 18 23:51:39 2013 (r248485) +++ head/sys/modules/dtrace/fbt/MakefileTue Mar 19 00:39:02 2013 (r248486) @@ -3,7 +3,7 @@ .PATH: ${.CURDIR}/../../../cddl/dev/fbt KMOD= fbt -.if ${MACHINE_ARCH} == powerpc +.if ${MACHINE_CPUARCH} == powerpc SRCS= fbt_powerpc.c .else SRCS= fbt.c ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r249129 - head/sys/powerpc/aim
Author: jhibbits Date: Fri Apr 5 04:53:43 2013 New Revision: 249129 URL: http://svnweb.freebsd.org/changeset/base/249129 Log: Print out DSISR in a fatal DSI trap. Sponsored by: Modified: head/sys/powerpc/aim/trap.c Modified: head/sys/powerpc/aim/trap.c == --- head/sys/powerpc/aim/trap.c Fri Apr 5 04:08:03 2013(r249128) +++ head/sys/powerpc/aim/trap.c Fri Apr 5 04:53:43 2013(r249129) @@ -385,6 +385,8 @@ printtrap(u_int vector, struct trapframe case EXC_DSI: printf( virtual address = 0x% PRIxPTR \n, frame-cpu.aim.dar); + printf( dsisr = 0x% PRIxPTR \n, + frame-cpu.aim.dsisr); break; case EXC_ISE: case EXC_ISI: ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
Re: svn commit: r249129 - head/sys/powerpc/aim
Interesting, I never touched the Sponsored by: line. On Apr 4, 2013 9:53 PM, Justin Hibbits jhibb...@freebsd.org wrote: Author: jhibbits Date: Fri Apr 5 04:53:43 2013 New Revision: 249129 URL: http://svnweb.freebsd.org/changeset/base/249129 Log: Print out DSISR in a fatal DSI trap. Sponsored by: Modified: head/sys/powerpc/aim/trap.c Modified: head/sys/powerpc/aim/trap.c == --- head/sys/powerpc/aim/trap.c Fri Apr 5 04:08:03 2013(r249128) +++ head/sys/powerpc/aim/trap.c Fri Apr 5 04:53:43 2013(r249129) @@ -385,6 +385,8 @@ printtrap(u_int vector, struct trapframe case EXC_DSI: printf( virtual address = 0x% PRIxPTR \n, frame-cpu.aim.dar); + printf( dsisr = 0x% PRIxPTR \n, + frame-cpu.aim.dsisr); break; case EXC_ISE: case EXC_ISI: ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
Re: svn commit: r249129 - head/sys/powerpc/aim
On Apr 4, 2013 10:06 PM, Eitan Adler ead...@freebsd.org wrote: On 5 April 2013 01:01, Justin Hibbits jr...@alumni.cwru.edu wrote: Interesting, I never touched the Sponsored by: line. Did you recently rebuild Subversion (after r314983 in ports?) Rui added a patch that may have affected this, but I don't think it should magically add a sponsored by line. Do you have ORGANIZATION set in make.conf? -- Eitan Adler Source, Ports, Doc committer Bugmeister, Ports Security teams I rebuilt all ports just the other day, don't know what ports revision it corresponds to, but I did a portsnap on Monday. And I don't have ORGANIZATION set in make.conf. - Justin ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r242723 - in head: cddl/contrib/opensolaris/lib/libdtrace/powerpc cddl/lib cddl/lib/libdtrace cddl/usr.sbin lib lib/libproc sys/cddl/contrib/opensolaris/uts/common/dtrace sys/cddl/contr...
Author: jhibbits Date: Wed Nov 7 23:45:09 2012 New Revision: 242723 URL: http://svnweb.freebsd.org/changeset/base/242723 Log: Implement DTrace for PowerPC. This includes both 32-bit and 64-bit. There is one known issue: Some probes will display an error message along the lines of: Invalid address (0) I tested this with both a simple dtrace probe and dtruss on a few different binaries on 32-bit. I only compiled 64-bit, did not run it, but I don't expect problems without the modules loaded. Volunteers are welcome. MFC after:1 month Added: head/cddl/contrib/opensolaris/lib/libdtrace/powerpc/ head/cddl/contrib/opensolaris/lib/libdtrace/powerpc/dt_isadep.c (contents, props changed) head/sys/cddl/contrib/opensolaris/uts/powerpc/ head/sys/cddl/contrib/opensolaris/uts/powerpc/dtrace/ head/sys/cddl/contrib/opensolaris/uts/powerpc/dtrace/fasttrap_isa.c (contents, props changed) head/sys/cddl/contrib/opensolaris/uts/powerpc/sys/ head/sys/cddl/contrib/opensolaris/uts/powerpc/sys/fasttrap_isa.h (contents, props changed) head/sys/cddl/dev/dtrace/powerpc/ head/sys/cddl/dev/dtrace/powerpc/dtrace_asm.S (contents, props changed) head/sys/cddl/dev/dtrace/powerpc/dtrace_isa.c (contents, props changed) head/sys/cddl/dev/dtrace/powerpc/dtrace_subr.c (contents, props changed) head/sys/cddl/dev/dtrace/powerpc/regset.h (contents, props changed) Modified: head/cddl/lib/Makefile head/cddl/lib/libdtrace/Makefile head/cddl/usr.sbin/Makefile head/lib/Makefile head/lib/libproc/proc_bkpt.c head/lib/libproc/proc_regs.c head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c head/sys/cddl/dev/lockstat/lockstat.c head/sys/cddl/dev/profile/profile.c head/sys/modules/Makefile head/sys/modules/dtrace/Makefile head/sys/powerpc/aim/locore32.S head/sys/powerpc/aim/locore64.S head/sys/powerpc/aim/trap.c head/sys/powerpc/aim/trap_subr32.S head/sys/powerpc/aim/trap_subr64.S Added: head/cddl/contrib/opensolaris/lib/libdtrace/powerpc/dt_isadep.c == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/cddl/contrib/opensolaris/lib/libdtrace/powerpc/dt_isadep.c Wed Nov 7 23:45:09 2012(r242723) @@ -0,0 +1,75 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the License). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets [] replaced with your own identifying + * information: Portions Copyright [] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#pragma ident %Z%%M% %I% %E% SMI + +#include stdlib.h +#include assert.h +#include errno.h +#include string.h +#include libgen.h + +#include dt_impl.h +#include dt_pid.h + +/*ARGSUSED*/ +int +dt_pid_create_entry_probe(struct ps_prochandle *P, dtrace_hdl_t *dtp, +fasttrap_probe_spec_t *ftp, const GElf_Sym *symp) +{ + + dt_dprintf(%s: unimplemented\n, __func__); + return (DT_PROC_ERR); +} + +int +dt_pid_create_return_probe(struct ps_prochandle *P, dtrace_hdl_t *dtp, +fasttrap_probe_spec_t *ftp, const GElf_Sym *symp, uint64_t *stret) +{ + + dt_dprintf(%s: unimplemented\n, __func__); + return (DT_PROC_ERR); +} + +/*ARGSUSED*/ +int +dt_pid_create_offset_probe(struct ps_prochandle *P, dtrace_hdl_t *dtp, +fasttrap_probe_spec_t *ftp, const GElf_Sym *symp, ulong_t off) +{ + + dt_dprintf(%s: unimplemented\n, __func__); + return (DT_PROC_ERR); +} + +/*ARGSUSED*/ +int +dt_pid_create_glob_offset_probes(struct ps_prochandle *P, dtrace_hdl_t *dtp, +fasttrap_probe_spec_t *ftp, const GElf_Sym *symp, const char *pattern) +{ + + dt_dprintf(%s: unimplemented\n, __func__); + return (DT_PROC_ERR); +} Modified: head/cddl/lib/Makefile == --- head/cddl/lib/Makefile Wed Nov 7 23:37:24 2012(r242722) +++ head/cddl/lib/Makefile Wed Nov 7 23:45:09 2012(r242723) @@ -19,7 +19,8 @@ _libzpool=libzpool .endif .endif -.if ${MACHINE_ARCH} == amd64 || ${MACHINE_ARCH} == i386 || ${MACHINE_CPUARCH} == mips +.if ${MACHINE_ARCH} == amd64 || ${MACHINE_ARCH} == i386 || \ + ${MACHINE_CPUARCH} == mips || ${MACHINE_CPUARCH} ==
svn commit: r242737 - head/sys/powerpc/conf
Author: jhibbits Date: Thu Nov 8 01:51:23 2012 New Revision: 242737 URL: http://svnweb.freebsd.org/changeset/base/242737 Log: Add DTrace to 32-bit PowerPC GENERIC now. MFC after:1 month Modified: head/sys/powerpc/conf/GENERIC Modified: head/sys/powerpc/conf/GENERIC == --- head/sys/powerpc/conf/GENERIC Thu Nov 8 01:46:47 2012 (r242736) +++ head/sys/powerpc/conf/GENERIC Thu Nov 8 01:51:23 2012 (r242737) @@ -24,6 +24,7 @@ ident GENERIC machinepowerpc powerpc makeoptionsDEBUG=-g#Build kernel with gdb(1) debug symbols +makeoptionsWITH_CTF=1 # Platform support optionsPOWERMAC#NewWorld Apple PowerMacs @@ -68,6 +69,8 @@ options AUDIT # Security event auditi optionsCAPABILITY_MODE # Capsicum capability mode optionsCAPABILITIES# Capsicum capabilities optionsMAC # TrustedBSD MAC Framework +optionsKDTRACE_HOOKS # Kernel DTrace hooks +optionsDDB_CTF # Kernel ELF linker loads CTF data optionsINCLUDE_CONFIG_FILE # Include this file in kernel # Debugging support. Always need this: ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r258078 - head/sys/powerpc/include
Author: jhibbits Date: Wed Nov 13 01:37:52 2013 New Revision: 258078 URL: http://svnweb.freebsd.org/changeset/base/258078 Log: Increase the stack size for ppc64 from 4 pages to 8. I found a stack overflow when a coredump was taken onto a ZFS volume with heavy network activity. 2 DSI traps, plus one DECR trap, along with several function calls in the stack, overflowed the 4 pages. 8 page stack fixes this. Discussed with: nwhitehorn MFC after:1 week Modified: head/sys/powerpc/include/param.h Modified: head/sys/powerpc/include/param.h == --- head/sys/powerpc/include/param.hWed Nov 13 01:04:02 2013 (r258077) +++ head/sys/powerpc/include/param.hWed Nov 13 01:37:52 2013 (r258078) @@ -104,7 +104,11 @@ #defineMAXPAGESIZES1 /* maximum number of supported page sizes */ #ifndef KSTACK_PAGES -#defineKSTACK_PAGES4 /* includes pcb */ +#ifdef __powerpc64__ +#defineKSTACK_PAGES8 /* includes pcb */ +#else +#defineKSTACK_PAGES8 /* includes pcb */ +#endif #endif #defineKSTACK_GUARD_PAGES 1 /* pages of kstack guard; 0 disables */ #defineUSPACE (KSTACK_PAGES * PAGE_SIZE) /* total size of pcb */ ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r258079 - head/sys/powerpc/include
Author: jhibbits Date: Wed Nov 13 01:51:40 2013 New Revision: 258079 URL: http://svnweb.freebsd.org/changeset/base/258079 Log: Fix typo. Submitted by: loos Modified: head/sys/powerpc/include/param.h Modified: head/sys/powerpc/include/param.h == --- head/sys/powerpc/include/param.hWed Nov 13 01:37:52 2013 (r258078) +++ head/sys/powerpc/include/param.hWed Nov 13 01:51:40 2013 (r258079) @@ -107,7 +107,7 @@ #ifdef __powerpc64__ #defineKSTACK_PAGES8 /* includes pcb */ #else -#defineKSTACK_PAGES8 /* includes pcb */ +#defineKSTACK_PAGES4 /* includes pcb */ #endif #endif #defineKSTACK_GUARD_PAGES 1 /* pages of kstack guard; 0 disables */ ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r258119 - head/sys/powerpc/aim
Author: jhibbits Date: Thu Nov 14 07:41:52 2013 New Revision: 258119 URL: http://svnweb.freebsd.org/changeset/base/258119 Log: Fix copy+paste-o, OEA64 uses LPTE, not PTE. X-MFC with: r257941 Modified: head/sys/powerpc/aim/mmu_oea64.c Modified: head/sys/powerpc/aim/mmu_oea64.c == --- head/sys/powerpc/aim/mmu_oea64.cThu Nov 14 07:27:00 2013 (r258118) +++ head/sys/powerpc/aim/mmu_oea64.cThu Nov 14 07:41:52 2013 (r258119) @@ -2642,7 +2642,7 @@ moea64_scan_md(mmu_t mmu, struct pmap_md pvo = moea64_pvo_find_va(kernel_pmap, va ~ADDR_POFF); if (pvo != NULL - (pvo-pvo_pte.pte.pte_hi PTE_VALID)) + (pvo-pvo_pte.lpte.pte_hi LPTE_VALID)) break; va += PAGE_SIZE; } @@ -2657,7 +2657,7 @@ moea64_scan_md(mmu_t mmu, struct pmap_md pvo = moea64_pvo_find_va(kernel_pmap, va ~ADDR_POFF); if (pvo == NULL || - !(pvo-pvo_pte.pte.pte_hi PTE_VALID)) + !(pvo-pvo_pte.lpte.pte_hi LPTE_VALID)) break; va += PAGE_SIZE; } ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r258275 - head/sys/powerpc/ofw
Author: jhibbits Date: Sun Nov 17 20:29:33 2013 New Revision: 258275 URL: http://svnweb.freebsd.org/changeset/base/258275 Log: Add a sysctl to allow disabling resetting the OF syscons. On some machines (G5 with lots of RAM), entering OF sometimes causes the machine to hang. Once the machine is booted, currently the only entry point into OF is through resetting the framebuffer on mode switch on these machines. Disabling this allows the machine to stay up at the expense of less usable consoles after X is started. MFC after:Never, this is only a hack Modified: head/sys/powerpc/ofw/ofw_syscons.c Modified: head/sys/powerpc/ofw/ofw_syscons.c == --- head/sys/powerpc/ofw/ofw_syscons.c Sun Nov 17 19:50:50 2013 (r258274) +++ head/sys/powerpc/ofw/ofw_syscons.c Sun Nov 17 20:29:33 2013 (r258275) @@ -57,9 +57,12 @@ __FBSDID($FreeBSD$); #include powerpc/ofw/ofw_syscons.h static int ofwfb_ignore_mmap_checks = 1; +static int ofwfb_reset_on_switch = 1; static SYSCTL_NODE(_hw, OID_AUTO, ofwfb, CTLFLAG_RD, 0, ofwfb); SYSCTL_INT(_hw_ofwfb, OID_AUTO, relax_mmap, CTLFLAG_RW, ofwfb_ignore_mmap_checks, 0, relaxed mmap bounds checking); +SYSCTL_INT(_hw_ofwfb, OID_AUTO, reset_on_mode_switch, CTLFLAG_RW, +ofwfb_reset_on_switch, 0, reset the framebuffer driver on mode switch); extern u_char dflt_font_16[]; extern u_char dflt_font_14[]; @@ -447,26 +450,28 @@ ofwfb_set_mode(video_adapter_t *adp, int sc = (struct ofwfb_softc *)adp; - /* -* Open the display device, which will initialize it. -*/ - - memset(name, 0, sizeof(name)); - OF_package_to_path(sc-sc_node, name, sizeof(name)); - ih = OF_open(name); - - if (sc-sc_depth == 8) { + if (ofwfb_reset_on_switch) { /* -* Install the ISO6429 colormap - older OFW systems -* don't do this by default +* Open the display device, which will initialize it. */ - for (i = 0; i 16; i++) { - OF_call_method(color!, ih, 4, 1, - ofwfb_cmap[i].red, - ofwfb_cmap[i].green, - ofwfb_cmap[i].blue, - i, - retval); + + memset(name, 0, sizeof(name)); + OF_package_to_path(sc-sc_node, name, sizeof(name)); + ih = OF_open(name); + + if (sc-sc_depth == 8) { + /* +* Install the ISO6429 colormap - older OFW systems +* don't do this by default +*/ + for (i = 0; i 16; i++) { + OF_call_method(color!, ih, 4, 1, + ofwfb_cmap[i].red, + ofwfb_cmap[i].green, + ofwfb_cmap[i].blue, + i, + retval); + } } } ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r258361 - head/sys/cddl/dev/fbt
Author: jhibbits Date: Wed Nov 20 01:33:13 2013 New Revision: 258361 URL: http://svnweb.freebsd.org/changeset/base/258361 Log: Fix the function search space. Submitted by: Howard Su Modified: head/sys/cddl/dev/fbt/fbt_powerpc.c Modified: head/sys/cddl/dev/fbt/fbt_powerpc.c == --- head/sys/cddl/dev/fbt/fbt_powerpc.c Wed Nov 20 00:17:57 2013 (r258360) +++ head/sys/cddl/dev/fbt/fbt_powerpc.c Wed Nov 20 01:33:13 2013 (r258361) @@ -219,7 +219,7 @@ fbt_provide_module_function(linker_file_ return (0); instr = (u_int32_t *) symval-value; - limit = (u_int32_t *) symval-value + symval-size; + limit = (u_int32_t *) (symval-value + symval-size); for (; instr limit; instr++) if (*instr == FBT_MFLR_R0) ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r258362 - in head/cddl/contrib/opensolaris/cmd: plockstat zfs
Author: jhibbits Date: Wed Nov 20 01:42:29 2013 New Revision: 258362 URL: http://svnweb.freebsd.org/changeset/base/258362 Log: Use 'int' to store the return value of getopt(), rather than char. On some architectures (powerpc), char is unsigned by default, which means comparisons against -1 always fail, so the programs get stuck in an infinite loop. MFC after:1 week Modified: head/cddl/contrib/opensolaris/cmd/plockstat/plockstat.c head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Modified: head/cddl/contrib/opensolaris/cmd/plockstat/plockstat.c == --- head/cddl/contrib/opensolaris/cmd/plockstat/plockstat.c Wed Nov 20 01:33:13 2013(r258361) +++ head/cddl/contrib/opensolaris/cmd/plockstat/plockstat.c Wed Nov 20 01:42:29 2013(r258362) @@ -778,7 +778,8 @@ main(int argc, char **argv) #endif int err; int opt_C = 0, opt_H = 0, opt_p = 0, opt_v = 0; - char c, *p, *end; + int c; + char *p, *end; struct sigaction act; int done = 0; Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c == --- head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.cWed Nov 20 01:33:13 2013(r258361) +++ head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.cWed Nov 20 01:42:29 2013(r258362) @@ -2011,7 +2011,7 @@ zfs_do_upgrade(int argc, char **argv) boolean_t showversions = B_FALSE; int ret = 0; upgrade_cbdata_t cb = { 0 }; - char c; + int c; int flags = ZFS_ITER_ARGS_CAN_BE_PATHS; /* check options */ @@ -3561,7 +3561,7 @@ static int zfs_do_snapshot(int argc, char **argv) { int ret = 0; - char c; + int c; nvlist_t *props; snap_cbdata_t sd = { 0 }; boolean_t multiple_snaps = B_FALSE; ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r258424 - head/sys/powerpc/aim
Author: jhibbits Date: Thu Nov 21 06:54:28 2013 New Revision: 258424 URL: http://svnweb.freebsd.org/changeset/base/258424 Log: Remove stale comment. The PID provider is handled elsewhere already. Modified: head/sys/powerpc/aim/trap.c Modified: head/sys/powerpc/aim/trap.c == --- head/sys/powerpc/aim/trap.c Thu Nov 21 05:17:36 2013(r258423) +++ head/sys/powerpc/aim/trap.c Thu Nov 21 06:54:28 2013(r258424) @@ -205,9 +205,6 @@ trap(struct trapframe *frame) * handled the trap and modified the trap frame so that this * function can return normally. */ - /* -* XXXDTRACE: add pid probe handler here (if ever) -*/ if (dtrace_trap_func != NULL (*dtrace_trap_func)(frame, type)) return; #endif ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r259080 - in head/sys: dev/iicbus geom/cache geom/journal
Author: jhibbits Date: Sat Dec 7 19:55:34 2013 New Revision: 259080 URL: http://svnweb.freebsd.org/changeset/base/259080 Log: Fix some integer signs. These unsigned integers should all be signed. Found by: clang (powerpc64) Modified: head/sys/dev/iicbus/max6690.c head/sys/geom/cache/g_cache.c head/sys/geom/journal/g_journal.c Modified: head/sys/dev/iicbus/max6690.c == --- head/sys/dev/iicbus/max6690.c Sat Dec 7 19:39:38 2013 (r259079) +++ head/sys/dev/iicbus/max6690.c Sat Dec 7 19:55:34 2013 (r259080) @@ -362,7 +362,7 @@ max6690_sensor_sysctl(SYSCTL_HANDLER_ARG struct max6690_softc *sc; struct max6690_sensor *sens; int error; - unsigned int temp; + int temp; dev = arg1; sc = device_get_softc(dev); Modified: head/sys/geom/cache/g_cache.c == --- head/sys/geom/cache/g_cache.c Sat Dec 7 19:39:38 2013 (r259079) +++ head/sys/geom/cache/g_cache.c Sat Dec 7 19:55:34 2013 (r259080) @@ -67,7 +67,7 @@ static u_int g_cache_used_hi = 20; static int sysctl_handle_pct(SYSCTL_HANDLER_ARGS) { - u_int val = *(u_int *)arg1; + int val; int error; error = sysctl_handle_int(oidp, val, 0, req); Modified: head/sys/geom/journal/g_journal.c == --- head/sys/geom/journal/g_journal.c Sat Dec 7 19:39:38 2013 (r259079) +++ head/sys/geom/journal/g_journal.c Sat Dec 7 19:55:34 2013 (r259080) @@ -168,7 +168,7 @@ SYSCTL_UINT(_kern_geom_journal_cache, OI static int g_journal_cache_switch_sysctl(SYSCTL_HANDLER_ARGS) { - u_int cswitch; + int cswitch; int error; cswitch = g_journal_cache_switch; ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
Re: svn commit: r259080 - in head/sys: dev/iicbus geom/cache geom/journal
On Sat, 7 Dec 2013 19:55:34 + (UTC) Justin Hibbits jhibb...@freebsd.org wrote: Author: jhibbits Date: Sat Dec 7 19:55:34 2013 New Revision: 259080 URL: http://svnweb.freebsd.org/changeset/base/259080 Log: Fix some integer signs. These unsigned integers should all be signed. Found by: clang (powerpc64) MFC after: 1 week - Justin ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r259082 - in head/sys: dev/iicbus powerpc/powermac
Author: jhibbits Date: Sat Dec 7 22:25:07 2013 New Revision: 259082 URL: http://svnweb.freebsd.org/changeset/base/259082 Log: Make more unsigned ints signed. Found by: clang (powerpc64) MFC after:1 week Modified: head/sys/dev/iicbus/ds1631.c head/sys/dev/iicbus/ds1775.c head/sys/powerpc/powermac/platform_powermac.c Modified: head/sys/dev/iicbus/ds1631.c == --- head/sys/dev/iicbus/ds1631.cSat Dec 7 22:18:36 2013 (r259081) +++ head/sys/dev/iicbus/ds1631.cSat Dec 7 22:25:07 2013 (r259082) @@ -398,7 +398,7 @@ ds1631_sensor_sysctl(SYSCTL_HANDLER_ARGS device_t dev; struct ds1631_softc *sc; int error; - unsigned int temp; + int temp; dev = arg1; sc = device_get_softc(dev); Modified: head/sys/dev/iicbus/ds1775.c == --- head/sys/dev/iicbus/ds1775.cSat Dec 7 22:18:36 2013 (r259081) +++ head/sys/dev/iicbus/ds1775.cSat Dec 7 22:25:07 2013 (r259082) @@ -257,7 +257,7 @@ ds1775_sensor_sysctl(SYSCTL_HANDLER_ARGS device_t dev; struct ds1775_softc *sc; int error; - unsigned int temp; + int temp; dev = arg1; sc = device_get_softc(dev); Modified: head/sys/powerpc/powermac/platform_powermac.c == --- head/sys/powerpc/powermac/platform_powermac.c Sat Dec 7 22:18:36 2013(r259081) +++ head/sys/powerpc/powermac/platform_powermac.c Sat Dec 7 22:25:07 2013(r259082) @@ -219,7 +219,8 @@ powermac_timebase_freq(platform_t plat, static int powermac_smp_fill_cpuref(struct cpuref *cpuref, phandle_t cpu) { - cell_t cpuid, res; + cell_t cpuid; + int res; cpuref-cr_hwref = cpu; res = OF_getprop(cpu, reg, cpuid, sizeof(cpuid)); ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r259096 - in head/sys/geom: cache journal
Author: jhibbits Date: Sun Dec 8 09:34:56 2013 New Revision: 259096 URL: http://svnweb.freebsd.org/changeset/base/259096 Log: Partially revert r259080. bde@ pointed out that there are a lot more style bugs going on in here than can be fixed, and I introduced some of my own. Rather than fix the whole host of them, back out my bugs. Found by: bde X-MFC with: r259080 Modified: head/sys/geom/cache/g_cache.c head/sys/geom/journal/g_journal.c Modified: head/sys/geom/cache/g_cache.c == --- head/sys/geom/cache/g_cache.c Sun Dec 8 06:52:22 2013 (r259095) +++ head/sys/geom/cache/g_cache.c Sun Dec 8 09:34:56 2013 (r259096) @@ -67,7 +67,7 @@ static u_int g_cache_used_hi = 20; static int sysctl_handle_pct(SYSCTL_HANDLER_ARGS) { - int val; + u_int val = *(u_int *)arg1; int error; error = sysctl_handle_int(oidp, val, 0, req); Modified: head/sys/geom/journal/g_journal.c == --- head/sys/geom/journal/g_journal.c Sun Dec 8 06:52:22 2013 (r259095) +++ head/sys/geom/journal/g_journal.c Sun Dec 8 09:34:56 2013 (r259096) @@ -168,7 +168,7 @@ SYSCTL_UINT(_kern_geom_journal_cache, OI static int g_journal_cache_switch_sysctl(SYSCTL_HANDLER_ARGS) { - int cswitch; + u_int cswitch; int error; cswitch = g_journal_cache_switch; ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r259245 - head/sys/powerpc/aim
Author: jhibbits Date: Thu Dec 12 04:12:19 2013 New Revision: 259245 URL: http://svnweb.freebsd.org/changeset/base/259245 Log: FBT now does work fully on PowerPC. MFC after:2 weeks Modified: head/sys/powerpc/aim/trap.c head/sys/powerpc/aim/trap_subr32.S head/sys/powerpc/aim/trap_subr64.S Modified: head/sys/powerpc/aim/trap.c == --- head/sys/powerpc/aim/trap.c Thu Dec 12 03:04:00 2013(r259244) +++ head/sys/powerpc/aim/trap.c Thu Dec 12 04:12:19 2013(r259245) @@ -297,7 +297,7 @@ trap(struct trapframe *frame) #ifdef KDTRACE_HOOKS case EXC_PGM: if (frame-srr1 EXC_PGM_TRAP) { - if (*(uintptr_t *)frame-srr0 == 0x7c810808) { + if (*(uint32_t *)frame-srr0 == 0x7c810808) { if (dtrace_invop_jump_addr != NULL) { dtrace_invop_jump_addr(frame); return; Modified: head/sys/powerpc/aim/trap_subr32.S == --- head/sys/powerpc/aim/trap_subr32.S Thu Dec 12 03:04:00 2013 (r259244) +++ head/sys/powerpc/aim/trap_subr32.S Thu Dec 12 04:12:19 2013 (r259245) @@ -883,8 +883,8 @@ CNAME(dblow): mfcr%r29/* save CR in r29 */ mfsrr1 %r1 mtcr%r1 - bf 17,1f /* branch if privileged */ - + bf 17,2f /* branch if privileged */ +1: /* Unprivileged case */ mtcr%r29/* put the condition register back */ mfsprg2%r29/* ... and r29 */ @@ -893,7 +893,17 @@ CNAME(dblow): li %r1, 0 /* How to get the vector from LR */ bla generictrap/* and we look like a generic trap */ -1: +2: +#ifdef KDTRACE_HOOKS + /* Privileged, so drop to KDB */ + mfsrr0 %r1 + lwz %r4,0(%r1) + /* Check if it's a DTrace trap. */ + li %r3,0x0808 + addis %r3,%r3,0x7c81 + cmplw %cr0,%r3,%r4 + beq %cr0,1b +#endif /* Privileged, so drop to KDB */ GET_CPUINFO(%r1) stw %r28,(PC_DBSAVE+CPUSAVE_R28)(%r1) /* free r28 */ Modified: head/sys/powerpc/aim/trap_subr64.S == --- head/sys/powerpc/aim/trap_subr64.S Thu Dec 12 03:04:00 2013 (r259244) +++ head/sys/powerpc/aim/trap_subr64.S Thu Dec 12 04:12:19 2013 (r259245) @@ -789,8 +789,9 @@ CNAME(dblow): mfcr%r29/* save CR in r29 */ mfsrr1 %r1 mtcr%r1 - bf 17,1f /* branch if privileged */ + bf 17,2f /* branch if privileged */ +1: /* Unprivileged case */ mtcr%r29/* put the condition register back */ mfsprg2%r29/* ... and r29 */ @@ -799,8 +800,17 @@ CNAME(dblow): li %r1, 0 /* How to get the vector from LR */ bla generictrap/* and we look like a generic trap */ -1: +2: +#ifdef KDTRACE_HOOKS /* Privileged, so drop to KDB */ + mfsrr0 %r1 + lwz %r4,0(%r1) + /* Check if it's a DTrace trap. */ + li %r3,0x0808 + addis %r3,%r3,0x7c81 + cmplw %cr0,%r3,%r4 + beq %cr0,1b +#endif GET_CPUINFO(%r1) std %r27,(PC_DBSAVE+CPUSAVE_R27)(%r1) /* free r27 */ std %r28,(PC_DBSAVE+CPUSAVE_R28)(%r1) /* free r28 */ ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r259284 - in head/sys: conf powerpc/aim powerpc/cpufreq powerpc/include powerpc/powermac powerpc/powerpc
Author: jhibbits Date: Fri Dec 13 02:37:35 2013 New Revision: 259284 URL: http://svnweb.freebsd.org/changeset/base/259284 Log: Add PMU-based CPU frequency scaling. This method is used on most Titanium PowerBooks. MFC after:1 month Added: head/sys/powerpc/cpufreq/pmufreq.c (contents, props changed) Modified: head/sys/conf/files.powerpc head/sys/powerpc/aim/mp_cpudep.c head/sys/powerpc/include/cpu.h head/sys/powerpc/include/dbdma.h head/sys/powerpc/include/pcpu.h head/sys/powerpc/include/spr.h head/sys/powerpc/powermac/platform_powermac.c head/sys/powerpc/powermac/pmu.c head/sys/powerpc/powermac/pmuvar.h head/sys/powerpc/powermac/uninorth.c head/sys/powerpc/powermac/uninorthvar.h head/sys/powerpc/powermac/viareg.h head/sys/powerpc/powerpc/mp_machdep.c Modified: head/sys/conf/files.powerpc == --- head/sys/conf/files.powerpc Fri Dec 13 02:21:32 2013(r259283) +++ head/sys/conf/files.powerpc Fri Dec 13 02:37:35 2013(r259284) @@ -107,6 +107,7 @@ powerpc/booke/pmap.coptionalbooke powerpc/booke/trap.c optionalbooke powerpc/cpufreq/dfs.c optionalcpufreq powerpc/cpufreq/pcr.c optionalcpufreq aim +powerpc/cpufreq/pmufreq.c optionalcpufreq aim pmu powerpc/fpu/fpu_add.c optionalfpu_emu powerpc/fpu/fpu_compare.c optionalfpu_emu powerpc/fpu/fpu_div.c optionalfpu_emu Modified: head/sys/powerpc/aim/mp_cpudep.c == --- head/sys/powerpc/aim/mp_cpudep.cFri Dec 13 02:21:32 2013 (r259283) +++ head/sys/powerpc/aim/mp_cpudep.cFri Dec 13 02:37:35 2013 (r259284) @@ -322,17 +322,13 @@ cpudep_ap_setup() mtspr(SPR_CELL_TSRL, bsp_state[5]); break; - case MPC7450: - case MPC7455: - case MPC7457: - /* Only MPC745x CPUs have an L3 cache. */ - reg = mpc745x_l3_enable(bsp_state[3]); - - /* Fallthrough */ case MPC7400: case MPC7410: case MPC7447A: case MPC7448: + case MPC7450: + case MPC7455: + case MPC7457: /* XXX: Program the CPU ID into PIR */ __asm __volatile(mtspr 1023,%0 :: r(PCPU_GET(cpuid))); @@ -342,6 +338,17 @@ cpudep_ap_setup() mtspr(SPR_HID0, bsp_state[0]); isync(); mtspr(SPR_HID1, bsp_state[1]); isync(); + /* Now enable the L3 cache. */ + switch (vers) { + case MPC7450: + case MPC7455: + case MPC7457: + /* Only MPC745x CPUs have an L3 cache. */ + reg = mpc745x_l3_enable(bsp_state[3]); + default: + break; + } + reg = mpc74xx_l2_enable(bsp_state[2]); reg = mpc74xx_l1d_enable(); reg = mpc74xx_l1i_enable(); Added: head/sys/powerpc/cpufreq/pmufreq.c == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/powerpc/cpufreq/pmufreq.c Fri Dec 13 02:37:35 2013 (r259284) @@ -0,0 +1,222 @@ +/*- + * Copyright (c) 2011 Justin Hibbits + * Copyright (c) 2009 Nathan Whitehorn + * 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 ``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 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. + */ + +#include sys/cdefs.h +__FBSDID($FreeBSD$); + +#include sys/param.h +#include sys/systm.h +#include sys/bus.h +#include sys/cpu.h +#include sys/kernel.h
svn commit: r259287 - head/sys/powerpc/cpufreq
Author: jhibbits Date: Fri Dec 13 05:54:25 2013 New Revision: 259287 URL: http://svnweb.freebsd.org/changeset/base/259287 Log: Some style(9) fixes MFC after:1 month X-MFC with: r259284 Modified: head/sys/powerpc/cpufreq/pmufreq.c Modified: head/sys/powerpc/cpufreq/pmufreq.c == --- head/sys/powerpc/cpufreq/pmufreq.c Fri Dec 13 03:09:29 2013 (r259286) +++ head/sys/powerpc/cpufreq/pmufreq.c Fri Dec 13 05:54:25 2013 (r259287) @@ -106,9 +106,9 @@ pmufreq_identify(driver_t *driver, devic static int pmufreq_probe(device_t dev) { - uint32_t min_freq; struct pmufreq_softc *sc; phandle_t node; + uint32_t min_freq; if (resource_disabled(pmufreq, 0)) return (ENXIO); @@ -174,8 +174,7 @@ static int pmufreq_set(device_t dev, const struct cf_setting *set) { struct pmufreq_softc *sc; - int speed_sel; - int error; + int error, speed_sel; if (set == NULL) return (EINVAL); @@ -191,7 +190,7 @@ pmufreq_set(device_t dev, const struct c if (error == 0) sc-curfreq = set-freq; - return error; + return (error); } static int ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r259394 - head/sys/powerpc/include
Author: jhibbits Date: Sat Dec 14 19:01:24 2013 New Revision: 259394 URL: http://svnweb.freebsd.org/changeset/base/259394 Log: Rebase the PMC indices at 1, since PMC_SOFT is at 0. MFC after:1 week Modified: head/sys/powerpc/include/pmc_mdep.h Modified: head/sys/powerpc/include/pmc_mdep.h == --- head/sys/powerpc/include/pmc_mdep.h Sat Dec 14 18:49:59 2013 (r259393) +++ head/sys/powerpc/include/pmc_mdep.h Sat Dec 14 19:01:24 2013 (r259394) @@ -7,8 +7,8 @@ #ifndef _MACHINE_PMC_MDEP_H_ #define_MACHINE_PMC_MDEP_H_ -#define PMC_MDEP_CLASS_INDEX_PPC7450 0 -#define PMC_MDEP_CLASS_INDEX_PPC9700 +#define PMC_MDEP_CLASS_INDEX_PPC7450 1 +#define PMC_MDEP_CLASS_INDEX_PPC9701 union pmc_md_op_pmcallocate { uint64_t__pad[4]; ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r259395 - head/sys/dev/hwpmc
Author: jhibbits Date: Sat Dec 14 20:12:28 2013 New Revision: 259395 URL: http://svnweb.freebsd.org/changeset/base/259395 Log: Add userland PMC backtracing, and use the PMC trapframe macros for kernel backtraces. MFC after:1 week Modified: head/sys/dev/hwpmc/hwpmc_powerpc.c Modified: head/sys/dev/hwpmc/hwpmc_powerpc.c == --- head/sys/dev/hwpmc/hwpmc_powerpc.c Sat Dec 14 19:01:24 2013 (r259394) +++ head/sys/dev/hwpmc/hwpmc_powerpc.c Sat Dec 14 20:12:28 2013 (r259395) @@ -45,6 +45,8 @@ __FBSDID($FreeBSD$); #define INKERNEL(x)(((vm_offset_t)(x)) = VM_MAX_KERNEL_ADDRESS \ ((vm_offset_t)(x)) = VM_MIN_KERNEL_ADDRESS) +#define INUSER(x) (((vm_offset_t)(x)) = VM_MAXUSER_ADDRESS \ + ((vm_offset_t)(x)) = VM_MIN_ADDRESS) struct powerpc_cpu **powerpc_pcpu; @@ -55,13 +57,13 @@ pmc_save_kernel_callchain(uintptr_t *cc, int frames = 0; uintptr_t *sp; - cc[frames++] = tf-srr0; - sp = (uintptr_t *)tf-fixreg[1]; + cc[frames++] = PMC_TRAPFRAME_TO_PC(tf); + sp = (uintptr_t *)PMC_TRAPFRAME_TO_FP(tf); for (frames = 1; frames maxsamples; frames++) { if (!INKERNEL(sp)) break; - cc[frames++] = *(sp + 1); + cc[frames++] = sp[1]; sp = (uintptr_t *)*sp; } return (frames); @@ -172,8 +174,17 @@ int pmc_save_user_callchain(uintptr_t *cc, int maxsamples, struct trapframe *tf) { - (void) cc; - (void) maxsamples; - (void) tf; - return (0); + uintptr_t *sp; + int frames = 0; + + cc[frames++] = PMC_TRAPFRAME_TO_PC(tf); + sp = (uintptr_t *)PMC_TRAPFRAME_TO_FP(tf); + + for (frames = 1; frames maxsamples; frames++) { + if (!INUSER(sp)) + break; + cc[frames++] = fuword(sp + 1); + sp = (uintptr_t *)fuword(sp); + } + return (frames); } ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r259421 - head/sys/powerpc/aim
Author: jhibbits Date: Sun Dec 15 18:07:25 2013 New Revision: 259421 URL: http://svnweb.freebsd.org/changeset/base/259421 Log: Save r3 before using it for the trap check, else we end up saving the new r3, containing the trap instruction encoding (0x7c810808), and restoring it back with the frame on return. This caused it to panic on my ppc32 machine, but somehow my ppc64 machine overlooked it, because I was using such a simple dtrace probe. X-MFC-with: r259245 MFC after:2 weeks Modified: head/sys/powerpc/aim/trap_subr32.S head/sys/powerpc/aim/trap_subr64.S Modified: head/sys/powerpc/aim/trap_subr32.S == --- head/sys/powerpc/aim/trap_subr32.S Sun Dec 15 18:05:04 2013 (r259420) +++ head/sys/powerpc/aim/trap_subr32.S Sun Dec 15 18:07:25 2013 (r259421) @@ -897,11 +897,13 @@ CNAME(dblow): #ifdef KDTRACE_HOOKS /* Privileged, so drop to KDB */ mfsrr0 %r1 - lwz %r4,0(%r1) + mtsprg3 %r3 + lwz %r1,0(%r1) /* Check if it's a DTrace trap. */ li %r3,0x0808 addis %r3,%r3,0x7c81 - cmplw %cr0,%r3,%r4 + cmplw %cr0,%r3,%r1 + mfsprg3 %r3 beq %cr0,1b #endif /* Privileged, so drop to KDB */ Modified: head/sys/powerpc/aim/trap_subr64.S == --- head/sys/powerpc/aim/trap_subr64.S Sun Dec 15 18:05:04 2013 (r259420) +++ head/sys/powerpc/aim/trap_subr64.S Sun Dec 15 18:07:25 2013 (r259421) @@ -804,11 +804,13 @@ CNAME(dblow): #ifdef KDTRACE_HOOKS /* Privileged, so drop to KDB */ mfsrr0 %r1 - lwz %r4,0(%r1) + mtsprg3 %r3 + lwz %r1,0(%r1) /* Check if it's a DTrace trap. */ li %r3,0x0808 addis %r3,%r3,0x7c81 - cmplw %cr0,%r3,%r4 + cmplw %cr0,%r3,%r1 + mfsprg3 %r3 beq %cr0,1b #endif GET_CPUINFO(%r1) ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r259657 - head/sys/powerpc/powermac
Author: jhibbits Date: Fri Dec 20 16:37:03 2013 New Revision: 259657 URL: http://svnweb.freebsd.org/changeset/base/259657 Log: Add suspend/resume handlers for ATI backlight ppc driver. With this, also shut shut off the display (DPMS-style) and disable the clocking when the backlight level is set to 0. This is taken from the radeonkms driver (radeon_legacy_encoders.c) which doesn't yet support PowerPC, and won't for a while, as it's missing full AGP support. Modified: head/sys/powerpc/powermac/atibl.c Modified: head/sys/powerpc/powermac/atibl.c == --- head/sys/powerpc/powermac/atibl.c Fri Dec 20 16:15:25 2013 (r259656) +++ head/sys/powerpc/powermac/atibl.c Fri Dec 20 16:37:03 2013 (r259657) @@ -52,10 +52,15 @@ __FBSDID($FreeBSD$); #define RADEON_LVDS_BL_MOD_EN(116) #define RADEON_LVDS_DIGON(118) #define RADEON_LVDS_BLON (119) +#define RADEON_LVDS_PLL_CNTL 0x02d4 +#define RADEON_LVDS_PLL_EN (116) +#define RADEON_LVDS_PLL_RESET(117) +#define RADEON_PIXCLKS_CNTL 0x002d +#define RADEON_PIXCLK_LVDS_ALWAYS_ONb (114) struct atibl_softc { - device_t dev; struct resource *sc_memr; + int sc_level; }; static void atibl_identify(driver_t *driver, device_t parent); @@ -63,13 +68,17 @@ static int atibl_probe(device_t dev); static int atibl_attach(device_t dev); static int atibl_setlevel(struct atibl_softc *sc, int newlevel); static int atibl_getlevel(struct atibl_softc *sc); +static int atibl_resume(device_t dev); +static int atibl_suspend(device_t dev); static int atibl_sysctl(SYSCTL_HANDLER_ARGS); static device_method_t atibl_methods[] = { /* Device interface */ - DEVMETHOD(device_identify, atibl_identify), - DEVMETHOD(device_probe, atibl_probe), - DEVMETHOD(device_attach, atibl_attach), + DEVMETHOD(device_identify, atibl_identify), + DEVMETHOD(device_probe, atibl_probe), + DEVMETHOD(device_attach,atibl_attach), + DEVMETHOD(device_suspend, atibl_suspend), + DEVMETHOD(device_resume,atibl_resume), {0, 0}, }; @@ -136,8 +145,8 @@ atibl_attach(device_t dev) tree = device_get_sysctl_tree(dev); SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, - level, CTLTYPE_INT | CTLFLAG_RW, sc, 0, - atibl_sysctl, I, Backlight level (0-100)); + level, CTLTYPE_INT | CTLFLAG_RW, sc, 0, + atibl_sysctl, I, Backlight level (0-100)); return (0); } @@ -146,6 +155,8 @@ static int atibl_setlevel(struct atibl_softc *sc, int newlevel) { uint32_t lvds_gen_cntl; + uint32_t lvds_pll_cntl; + uint32_t pixclks_cntl; if (newlevel 100) newlevel = 100; @@ -153,13 +164,38 @@ atibl_setlevel(struct atibl_softc *sc, i if (newlevel 0) newlevel = 0; - newlevel = (newlevel * 5) / 2 + 5; lvds_gen_cntl = bus_read_4(sc-sc_memr, RADEON_LVDS_GEN_CNTL); - lvds_gen_cntl |= RADEON_LVDS_BL_MOD_EN; - lvds_gen_cntl = ~RADEON_LVDS_BL_MOD_LEVEL_MASK; - lvds_gen_cntl |= (newlevel RADEON_LVDS_BL_MOD_LEVEL_SHIFT) - RADEON_LVDS_BL_MOD_LEVEL_MASK; - bus_write_4(sc-sc_memr, RADEON_LVDS_GEN_CNTL, lvds_gen_cntl); + + if (newlevel 0) { + newlevel = (newlevel * 5) / 2 + 5; + lvds_pll_cntl = bus_read_4(sc-sc_memr, RADEON_LVDS_PLL_CNTL); + lvds_pll_cntl |= RADEON_LVDS_PLL_EN; + bus_write_4(sc-sc_memr, RADEON_LVDS_PLL_CNTL, lvds_pll_cntl); + lvds_pll_cntl = ~RADEON_LVDS_PLL_RESET; + bus_write_4(sc-sc_memr, RADEON_LVDS_PLL_CNTL, lvds_pll_cntl); + + lvds_gen_cntl = ~(RADEON_LVDS_DISPLAY_DIS | + RADEON_LVDS_BL_MOD_LEVEL_MASK); + lvds_gen_cntl |= RADEON_LVDS_ON | RADEON_LVDS_EN | + RADEON_LVDS_DIGON | RADEON_LVDS_BLON; + lvds_gen_cntl |= (newlevel RADEON_LVDS_BL_MOD_LEVEL_SHIFT) + RADEON_LVDS_BL_MOD_LEVEL_MASK; + lvds_gen_cntl |= RADEON_LVDS_BL_MOD_EN; + DELAY(2000); + bus_write_4(sc-sc_memr, RADEON_LVDS_GEN_CNTL, lvds_gen_cntl); + } else { + pixclks_cntl = bus_read_4(sc-sc_memr, RADEON_PIXCLKS_CNTL); + bus_write_4(sc-sc_memr, RADEON_PIXCLKS_CNTL, + pixclks_cntl ~RADEON_PIXCLK_LVDS_ALWAYS_ONb); + lvds_gen_cntl |= RADEON_LVDS_DISPLAY_DIS; + lvds_gen_cntl = RADEON_LVDS_BL_MOD_EN; + bus_write_4(sc-sc_memr, RADEON_LVDS_GEN_CNTL, lvds_gen_cntl); + lvds_gen_cntl = ~(RADEON_LVDS_ON | RADEON_LVDS_EN); + DELAY(2000); + bus_write_4(sc-sc_memr,
svn commit: r259668 - head/sys/cddl/dev/fbt
Author: jhibbits Date: Fri Dec 20 23:18:14 2013 New Revision: 259668 URL: http://svnweb.freebsd.org/changeset/base/259668 Log: Fix a couple bugs in FBT PowerPC. Clamp the size to a 'instruction size' not 'byte size', and fix a typo. MFC after:2 weeks Modified: head/sys/cddl/dev/fbt/fbt_powerpc.c Modified: head/sys/cddl/dev/fbt/fbt_powerpc.c == --- head/sys/cddl/dev/fbt/fbt_powerpc.c Fri Dec 20 21:31:50 2013 (r259667) +++ head/sys/cddl/dev/fbt/fbt_powerpc.c Fri Dec 20 23:18:14 2013 (r259668) @@ -219,7 +219,7 @@ fbt_provide_module_function(linker_file_ return (0); instr = (u_int32_t *) symval-value; - limit = (u_int32_t *) (symval-value + symval-size); + limit = (u_int32_t *) (symval-value + symval-size / sizeof(u_int32_t)); for (; instr limit; instr++) if (*instr == FBT_MFLR_R0) @@ -278,7 +278,7 @@ again: instr++; for (j = 0; j 12 instr limit; j++, instr++) { - if ((*instr == FBT_BCTR) || (*instr == FBT_BLR) | + if ((*instr == FBT_BCTR) || (*instr == FBT_BLR) || FBT_IS_JUMP(*instr)) break; } ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r259671 - head/sys/powerpc/powermac
Author: jhibbits Date: Sat Dec 21 00:07:56 2013 New Revision: 259671 URL: http://svnweb.freebsd.org/changeset/base/259671 Log: Add suspend/resume to DBDMA and ATA on PowerMacs. This, and several subsequent commits, are suspend/resume for various PowerMac drivers, which will include a change to the global suspend/resume code eventually. Modified: head/sys/powerpc/powermac/ata_macio.c head/sys/powerpc/powermac/dbdma.c head/sys/powerpc/powermac/dbdmavar.h Modified: head/sys/powerpc/powermac/ata_macio.c == --- head/sys/powerpc/powermac/ata_macio.c Fri Dec 20 23:57:05 2013 (r259670) +++ head/sys/powerpc/powermac/ata_macio.c Sat Dec 21 00:07:56 2013 (r259671) @@ -114,11 +114,15 @@ static int ata_macio_probe(device_t de static int ata_macio_setmode(device_t dev, int target, int mode); static int ata_macio_attach(device_t dev); static int ata_macio_begin_transaction(struct ata_request *request); +static int ata_macio_suspend(device_t dev); +static int ata_macio_resume(device_t dev); static device_method_t ata_macio_methods[] = { /* Device interface */ DEVMETHOD(device_probe, ata_macio_probe), DEVMETHOD(device_attach,ata_macio_attach), + DEVMETHOD(device_suspend, ata_macio_suspend), + DEVMETHOD(device_resume,ata_macio_resume), /* ATA interface */ DEVMETHOD(ata_setmode, ata_macio_setmode), @@ -336,3 +340,34 @@ ata_macio_begin_transaction(struct ata_r return ata_begin_transaction(request); } + +static int +ata_macio_suspend(device_t dev) +{ + struct ata_dbdma_channel *ch = device_get_softc(dev); + int error; + + if (!ch-sc_ch.attached) + return (0); + + error = ata_suspend(dev); + dbdma_save_state(ch-dbdma); + + return (error); +} + +static int +ata_macio_resume(device_t dev) +{ + struct ata_dbdma_channel *ch = device_get_softc(dev); + int error; + + if (!ch-sc_ch.attached) + return (0); + + dbdma_restore_state(ch-dbdma); + error = ata_resume(dev); + + return (error); +} + Modified: head/sys/powerpc/powermac/dbdma.c == --- head/sys/powerpc/powermac/dbdma.c Fri Dec 20 23:57:05 2013 (r259670) +++ head/sys/powerpc/powermac/dbdma.c Sat Dec 21 00:07:56 2013 (r259671) @@ -343,6 +343,31 @@ dbdma_sync_commands(dbdma_channel_t *cha bus_dmamap_sync(chan-sc_dmatag, chan-sc_dmamap, op); } +void +dbdma_save_state(dbdma_channel_t *chan) +{ + + chan-sc_saved_regs[0] = dbdma_read_reg(chan, CHAN_CMDPTR); + chan-sc_saved_regs[1] = dbdma_read_reg(chan, CHAN_CMDPTR_HI); + chan-sc_saved_regs[2] = dbdma_read_reg(chan, CHAN_INTR_SELECT); + chan-sc_saved_regs[3] = dbdma_read_reg(chan, CHAN_BRANCH_SELECT); + chan-sc_saved_regs[4] = dbdma_read_reg(chan, CHAN_WAIT_SELECT); + + dbdma_stop(chan); +} + +void +dbdma_restore_state(dbdma_channel_t *chan) +{ + + dbdma_wake(chan); + dbdma_write_reg(chan, CHAN_CMDPTR, chan-sc_saved_regs[0]); + dbdma_write_reg(chan, CHAN_CMDPTR_HI, chan-sc_saved_regs[1]); + dbdma_write_reg(chan, CHAN_INTR_SELECT, chan-sc_saved_regs[2]); + dbdma_write_reg(chan, CHAN_BRANCH_SELECT, chan-sc_saved_regs[3]); + dbdma_write_reg(chan, CHAN_WAIT_SELECT, chan-sc_saved_regs[4]); +} + static uint32_t dbdma_read_reg(dbdma_channel_t *chan, u_int offset) { Modified: head/sys/powerpc/powermac/dbdmavar.h == --- head/sys/powerpc/powermac/dbdmavar.hFri Dec 20 23:57:05 2013 (r259670) +++ head/sys/powerpc/powermac/dbdmavar.hSat Dec 21 00:07:56 2013 (r259671) @@ -60,6 +60,7 @@ struct dbdma_channel { bus_dma_tag_t sc_dmatag; bus_dmamap_tsc_dmamap; + uint32_tsc_saved_regs[5]; }; ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r259674 - head/sys/cddl/dev/fbt
Author: jhibbits Date: Sat Dec 21 00:37:32 2013 New Revision: 259674 URL: http://svnweb.freebsd.org/changeset/base/259674 Log: Fix a brain-o. I had misread the limit as a size, but it's a pointer. Submitted by: Howard Su MFC after:2 weeks X-MFC-with: r259668 Modified: head/sys/cddl/dev/fbt/fbt_powerpc.c Modified: head/sys/cddl/dev/fbt/fbt_powerpc.c == --- head/sys/cddl/dev/fbt/fbt_powerpc.c Sat Dec 21 00:20:06 2013 (r259673) +++ head/sys/cddl/dev/fbt/fbt_powerpc.c Sat Dec 21 00:37:32 2013 (r259674) @@ -219,7 +219,7 @@ fbt_provide_module_function(linker_file_ return (0); instr = (u_int32_t *) symval-value; - limit = (u_int32_t *) (symval-value + symval-size / sizeof(u_int32_t)); + limit = (u_int32_t *) (symval-value + symval-size); for (; instr limit; instr++) if (*instr == FBT_MFLR_R0) ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org