#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include extern void hpet_open_close(int, const char **); extern void hpet_info(int, const char **); extern void hpet_poll(int, const char **); extern void hpet_fasync(int, const char **); extern void hpet_read(int, const char **); #include #include struct hpet_command { char *command; void (*func)(int argc, const char ** argv); } hpet_command[] = { { "open-close", hpet_open_close }, { "info", hpet_info }, { "poll", hpet_poll }, { "fasync", hpet_fasync }, }; int main(int argc, const char ** argv) { unsigned int i; argc--; argv++; if (!argc) { fprintf(stderr, "-hpet: requires command\n"); return -1; } for (i = 0; i < (sizeof (hpet_command) / sizeof (hpet_command[0])); i++) if (!strcmp(argv[0], hpet_command[i].command)) { argc--; argv++; fprintf(stderr, "-hpet: executing %s\n", hpet_command[i].command); hpet_command[i].func(argc, argv); return 0; } fprintf(stderr, "do_hpet: command %s not implemented\n", argv[0]); return -1; } void hpet_open_close(int argc, const char **argv) { int fd; if (argc != 1) { fprintf(stderr, "hpet_open_close: device-name\n"); return; } fd = open(argv[0], O_RDONLY); if (fd < 0) fprintf(stderr, "hpet_open_close: open failed\n"); else close(fd); return; } void hpet_info(int argc, const char **argv) { struct hpet_info info; int fd; if (argc != 1) { fprintf(stderr, "hpet_info: device-name\n"); return; } fd = open(argv[0], O_RDONLY); if (fd < 0) { fprintf(stderr, "hpet_info: open of %s failed\n", argv[0]); return; } if (ioctl(fd, HPET_INFO, &info) < 0) { fprintf(stderr, "hpet_info: failed to get info\n"); goto out; } fprintf(stderr, "hpet_info: hi_irqfreq 0x%lx hi_flags 0x%lx ", info.hi_ireqfreq, info.hi_flags); fprintf(stderr, "hi_hpet %d hi_timer %d\n", info.hi_hpet, info.hi_timer); out: close(fd); return; } void hpet_poll(int argc, const char **argv) { unsigned long freq; int iterations, i, fd; struct pollfd pfd; struct hpet_info info; struct timeval stv, etv; struct timezone tz; long usec; if (argc != 3) { fprintf(stderr, "hpet_poll: device-name freq iterations\n"); return; } freq = atoi(argv[1]); iterations = atoi(argv[2]); fd = open(argv[0], O_RDONLY); if (fd < 0) { fprintf(stderr, "hpet_poll: open of %s failed\n", argv[0]); return; } if (ioctl(fd, HPET_IRQFREQ, freq) < 0) { fprintf(stderr, "hpet_poll: HPET_IRQFREQ failed\n"); goto out; } if (ioctl(fd, HPET_INFO, &info) < 0) { fprintf(stderr, "hpet_poll: failed to get info\n"); goto out; } fprintf(stderr, "hpet_poll: info.hi_flags 0x%lx\n", info.hi_flags); if (info.hi_flags && (ioctl(fd, HPET_EPI, 0) < 0)) { fprintf(stderr, "hpet_poll: HPET_EPI failed\n"); goto out; } if (ioctl(fd, HPET_IE_ON, 0) < 0) { fprintf(stderr, "hpet_poll, HPET_IE_ON failed\n"); goto out; } pfd.fd = fd; pfd.events = POLLIN; for (i = 0; i < iterations; i++) { pfd.revents = 0; gettimeofday(&stv, &tz); if (poll(&pfd, 1, -1) < 0) fprintf(stderr, "hpet_poll: poll failed\n"); else { long data; gettimeofday(&etv, &tz); usec = stv.tv_sec * 1000000 + stv.tv_usec; usec = (etv.tv_sec * 1000000 + etv.tv_usec) - usec; fprintf(stderr, "hpet_poll: expired time = 0x%lx\n", usec); fprintf(stderr, "hpet_poll: revents = 0x%x\n", pfd.revents); if (read(fd, &data, sizeof(data)) != sizeof(data)) { fprintf(stderr, "hpet_poll: read failed\n"); } else fprintf(stderr, "hpet_poll: data 0x%lx\n", data); } } out: close(fd); return; } static int hpet_sigio_count; static void hpet_sigio(int val) { fprintf(stderr, "hpet_sigio: called\n"); hpet_sigio_count++; } void hpet_fasync(int argc, const char **argv) { unsigned long freq; int iterations, i, fd, value; sig_t oldsig; struct hpet_info info; hpet_sigio_count = 0; fd = -1; if ((oldsig = signal(SIGIO, hpet_sigio)) == SIG_ERR) { fprintf(stderr, "hpet_fasync: failed to set signal handler\n"); return; } if (argc != 3) { fprintf(stderr, "hpet_fasync: device-name freq iterations\n"); goto out; } fd = open(argv[0], O_RDONLY); if (fd < 0) { fprintf(stderr, "hpet_fasync: failed to open %s\n", argv[0]); return; } if ((fcntl(fd, F_SETOWN, getpid()) == 1) || ((value = fcntl(fd, F_GETFL)) == 1) || (fcntl(fd, F_SETFL, value | O_ASYNC) == 1)) { fprintf(stderr, "hpet_fasync: fcntl failed\n"); goto out; } freq = atoi(argv[1]); iterations = atoi(argv[2]); if (ioctl(fd, HPET_IRQFREQ, freq) < 0) { fprintf(stderr, "hpet_fasync: HPET_IRQFREQ failed\n"); goto out; } if (ioctl(fd, HPET_INFO, &info) < 0) { fprintf(stderr, "hpet_fasync: failed to get info\n"); goto out; } fprintf(stderr, "hpet_fasync: info.hi_flags 0x%lx\n", info.hi_flags); if (info.hi_flags && (ioctl(fd, HPET_EPI, 0) < 0)) { fprintf(stderr, "hpet_fasync: HPET_EPI failed\n"); goto out; } if (ioctl(fd, HPET_IE_ON, 0) < 0) { fprintf(stderr, "hpet_fasync, HPET_IE_ON failed\n"); goto out; } for (i = 0; i < iterations; i++) { (void) pause(); fprintf(stderr, "hpet_fasync: count = %d\n", hpet_sigio_count); } out: signal(SIGIO, oldsig); if (fd >= 0) close(fd); return; } class='oid'>383378d115ab6e702d77896071d36056875602db (diff)parent1b9ec81258827001c869f003e0b8dd2ddc104717 (diff)
Merge tag 'armsoc-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
Pull ARM SoC fixes from Arnd Bergmann: "This is a rather large set of bugfixes, as we just returned from the Christmas break. Most of these are relatively unimportant fixes for regressions introduced during the merge window, and about half of the changes are for mach-omap2. A couple of patches are just cleanups and dead code removal that I would not normally have considered for merging after -rc2, but I decided to take them along with the fixes this time. Notable fixes include: - removing the skeleton.dtsi include broke a number of machines, and we have to put empty /chosen nodes back to be able to pass kernel command lines as before - enabling Samsung platforms no longer hardwires CONFIG_HZ to 200, as it had been for no good reason for a long time" * tag 'armsoc-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (46 commits) MAINTAINERS: extend PSCI entry to cover the newly add PSCI checker code drivers: psci: annotate timer on stack to silence odebug messages ARM64: defconfig: enable DRM_MESON as module ARM64: dts: meson-gx: Add Graphic Controller nodes ARM64: dts: meson-gxl: fix GPIO include ARM: dts: imx6: Disable "weim" node in the dtsi files ARM: dts: qcom: apq8064: Add missing scm clock ARM: davinci: da8xx: Fix sleeping function called from invalid context ARM: davinci: Make __clk_{enable,disable} functions public ARM: davinci: da850: don't add emac clock to lookup table twice ARM: davinci: da850: fix infinite loop in clk_set_rate() ARM: i.MX: remove map_io callback ARM: dts: vf610-zii-dev-rev-b: Add missing newline ARM: dts: imx6qdl-nitrogen6x: remove duplicate iomux entry ARM: dts: imx31: fix AVIC base address ARM: dts: am572x-idk: Add gpios property to control PCIE_RESETn arm64: dts: vexpress: Support GICC_DIR operations ARM: dts: vexpress: Support GICC_DIR operations firmware: arm_scpi: fix reading sensor values on pre-1.0 SCPI firmwares arm64: dts: msm8996: Add required memory carveouts ...
Diffstat (limited to 'include/rdma/opa_smi.h')