Пример #1
0
static int load_cpu_fw_direct(const char *fn, u8 __iomem *mem, struct cx18 *cx, long size)
{
    const struct firmware *fw = NULL;
    int retries = 3;
    int i, j;
    u32 __iomem *dst = (u32 __iomem *)mem;
    const u32 *src;

retry:
    if (!retries || request_firmware(&fw, fn, &cx->dev->dev)) {
        CX18_ERR("Unable to open firmware %s (must be %ld bytes)\n",
                fn, size);
        CX18_ERR("Did you put the firmware in the hotplug firmware directory?\n");
        return -ENOMEM;
    }

    src = (const u32 *)fw->data;

    if (fw->size != size) {
        /* Due to race conditions in firmware loading (esp. with
           udev <0.95) the wrong file was sometimes loaded. So we check
           filesizes to see if at least the right-sized file was
           loaded. If not, then we retry. */
        CX18_INFO("retry: file loaded was not %s (expected size %ld, got %zd)\n",
                fn, size, fw->size);
        release_firmware(fw);
        retries--;
        goto retry;
    }
    for (i = 0; i < fw->size; i += 4096) {
        setup_page(i);
        for (j = i; j < fw->size && j < i + 4096; j += 4) {
            /* no need for endianness conversion on the ppc */
            __raw_writel(*src, dst);
            if (__raw_readl(dst) != *src) {
                CX18_ERR("Mismatch at offset %x\n", i);
                release_firmware(fw);
                return -EIO;
            }
            dst++;
            src++;
        }
    }
    if (!test_bit(CX18_F_I_LOADED_FW, &cx->i_flags))
        CX18_INFO("loaded %s firmware (%zd bytes)\n", fn, fw->size);
    release_firmware(fw);
    return size;
}
Пример #2
0
int *ezpstart()
{
   register int   i, *adr;
   int   *save_globl();

   setup_page();
   setup_strings();
   liney = (SYSDOM*)scrsave;
   staffy = (int*)&liney[MAXLIN];
   measnum = &staffy[MAXSYS];
   systems = (SYSDOM*)&measnum[MAXSYS];
   brackets = (LBRACK*)&systems[MAXSYS];
   braces = (LBRACE*)&brackets[MAXCON];
   for (i = 0; i < MAXCON; i++) {
      braces[i].top = 0;
      braces[i].psym = (PSYM*)0L;
      braces[i].size = 0;
      brackets[i].top = 0;
      brackets[i].size = 0;
   }
   abortp = voff = FALSE;
   init_symb_structs();
   adr = (int*)&braces[MAXCON];
   s_image = (short*)save_globl( adr );
   calc_bufsize();
   graf_mouse( ARROW );
   wind_get( DESKTOP, WF_WORKXYWH, &desk.g_x, &desk.g_y, &desk.g_w,
         &desk.g_h );
   prinaddr->ob_x = (desk.g_x + desk.g_w - prinaddr->ob_width) >> 1;
   prinaddr->ob_y = (desk.g_y + desk.g_h - prinaddr->ob_height) >> 1;
   ((TEDINFO*)(prinaddr[PRNTYPE].ob_spec))->te_ptext = prname;
   objc_draw( prinaddr, ROOT, MAX_DEPTH, prinaddr->ob_x - 3,
         prinaddr->ob_y - 3, prinaddr->ob_width + 6, prinaddr->ob_height + 6 );
   objc_offset( prinaddr, ABORT, &abort.g_x, &abort.g_y );
   abort.g_w = prinaddr[ABORT].ob_width;
   abort.g_h = prinaddr[ABORT].ob_height;
   set_interrupt();
   return adr;
}
Пример #3
0
long cx18_mb_ack(struct cx18 *cx, const struct cx18_mailbox *mb)
{
    const struct cx18_api_info *info = find_api_info(mb->cmd);
    struct cx18_mailbox __iomem *ack_mb;
    u32 ack_irq;
    u8 rpu = CPU;

    if (info == NULL && mb->cmd) {
        CX18_WARN("Cannot ack unknown command %x\n", mb->cmd);
        return -EINVAL;
    }
    if (info)
        rpu = info->rpu;

    switch (rpu) {
    case HPU:
        ack_irq = IRQ_EPU_TO_HPU_ACK;
        ack_mb = &cx->scb->hpu2epu_mb;
        break;
    case APU:
        ack_irq = IRQ_EPU_TO_APU_ACK;
        ack_mb = &cx->scb->apu2epu_mb;
        break;
    case CPU:
        ack_irq = IRQ_EPU_TO_CPU_ACK;
        ack_mb = &cx->scb->cpu2epu_mb;
        break;
    default:
        CX18_WARN("Unknown RPU for command %x\n", mb->cmd);
        return -EINVAL;
    }

    setup_page(SCB_OFFSET);
    write_sync(mb->request, &ack_mb->ack);
    write_reg(ack_irq, SW2_INT_SET);
    return 0;
}
Пример #4
0
static int cx18_api_call(struct cx18 *cx, u32 cmd, int args, u32 data[])
{
    const struct cx18_api_info *info = find_api_info(cmd);
    u32 state = 0, irq = 0, req, oldreq, err;
    struct cx18_mailbox __iomem *mb;
    wait_queue_head_t *waitq;
    int timeout = 100;
    int cnt = 0;
    int sig = 0;
    int i;

    if (info == NULL) {
        CX18_WARN("unknown cmd %x\n", cmd);
        return -EINVAL;
    }

    if (cmd == CX18_CPU_DE_SET_MDL)
        CX18_DEBUG_HI_API("%s\n", info->name);
    else
        CX18_DEBUG_API("%s\n", info->name);
    setup_page(SCB_OFFSET);
    mb = cx18_mb_is_complete(cx, info->rpu, &state, &irq, &req);

    if (mb == NULL) {
        CX18_ERR("mb %s busy\n", info->name);
        return -EBUSY;
    }

    oldreq = req - 1;
    writel(cmd, &mb->cmd);
    for (i = 0; i < args; i++)
        writel(data[i], &mb->args[i]);
    writel(0, &mb->error);
    writel(req, &mb->request);

    switch (info->rpu) {
    case APU: waitq = &cx->mb_apu_waitq; break;
    case CPU: waitq = &cx->mb_cpu_waitq; break;
    case EPU: waitq = &cx->mb_epu_waitq; break;
    case HPU: waitq = &cx->mb_hpu_waitq; break;
    default: return -EINVAL;
    }
    if (info->flags & API_FAST)
        timeout /= 2;
    write_reg(irq, SW1_INT_SET);

    while (!sig && readl(&mb->ack) != readl(&mb->request) && cnt < 660) {
        if (cnt > 200 && !in_atomic())
            sig = cx18_msleep_timeout(10, 1);
        cnt++;
    }
    if (sig)
        return -EINTR;
    if (cnt == 660) {
        writel(oldreq, &mb->request);
        CX18_ERR("mb %s failed\n", info->name);
        return -EINVAL;
    }
    for (i = 0; i < MAX_MB_ARGUMENTS; i++)
        data[i] = readl(&mb->args[i]);
    err = readl(&mb->error);
    if (!in_atomic() && (info->flags & API_SLOW))
        cx18_msleep_timeout(300, 0);
    if (err)
        CX18_DEBUG_API("mailbox error %08x for command %s\n", err,
                info->name);
    return err ? -EIO : 0;
}
Пример #5
0
static int load_apu_fw_direct(const char *fn, u8 __iomem *dst, struct cx18 *cx, long size)
{
    const struct firmware *fw = NULL;
    int retries = 3;
    int i, j;
    const u32 *src;
    struct cx18_apu_rom_seghdr seghdr;
    const u8 *vers;
    u32 offset = 0;
    u32 apu_version = 0;
    int sz;

retry:
    if (!retries || request_firmware(&fw, fn, &cx->dev->dev)) {
        CX18_ERR("unable to open firmware %s (must be %ld bytes)\n",
                fn, size);
        CX18_ERR("did you put the firmware in the hotplug firmware directory?\n");
        return -ENOMEM;
    }

    src = (const u32 *)fw->data;
    vers = fw->data + sizeof(seghdr);
    sz = fw->size;

    if (fw->size != size) {
        /* Due to race conditions in firmware loading (esp. with
           udev <0.95) the wrong file was sometimes loaded. So we check
           filesizes to see if at least the right-sized file was
           loaded. If not, then we retry. */
        CX18_INFO("retry: file loaded was not %s (expected size %ld, got %zd)\n",
                   fn, size, fw->size);
        release_firmware(fw);
        retries--;
        goto retry;
    }
    apu_version = (vers[0] << 24) | (vers[4] << 16) | vers[32];
    while (offset + sizeof(seghdr) < size) {
        /* TODO: byteswapping */
        memcpy(&seghdr, src + offset / 4, sizeof(seghdr));
        offset += sizeof(seghdr);
        if (seghdr.sync1 != APU_ROM_SYNC1 ||
            seghdr.sync2 != APU_ROM_SYNC2) {
            offset += seghdr.size;
            continue;
        }
        CX18_DEBUG_INFO("load segment %x-%x\n", seghdr.addr,
                seghdr.addr + seghdr.size - 1);
        if (offset + seghdr.size > sz)
            break;
        for (i = 0; i < seghdr.size; i += 4096) {
            setup_page(offset + i);
            for (j = i; j < seghdr.size && j < i + 4096; j += 4) {
                /* no need for endianness conversion on the ppc */
                __raw_writel(src[(offset + j) / 4], dst + seghdr.addr + j);
                if (__raw_readl(dst + seghdr.addr + j) != src[(offset + j) / 4]) {
                    CX18_ERR("Mismatch at offset %x\n", offset + j);
                    release_firmware(fw);
                    return -EIO;
                }
            }
        }
        offset += seghdr.size;
    }
    if (!test_bit(CX18_F_I_LOADED_FW, &cx->i_flags))
        CX18_INFO("loaded %s firmware V%08x (%zd bytes)\n",
                fn, apu_version, fw->size);
    release_firmware(fw);
    /* Clear bit0 for APU to start from 0 */
    write_reg(read_reg(0xc72030) & ~1, 0xc72030);
    return size;
}
Пример #6
0
void cx18_init_scb(struct cx18 *cx)
{
	setup_page(SCB_OFFSET);
	memset_io(cx->scb, 0, 0x10000);

	writel(IRQ_APU_TO_CPU,     &cx->scb->apu2cpu_irq);
	writel(IRQ_CPU_TO_APU_ACK, &cx->scb->cpu2apu_irq_ack);
	writel(IRQ_HPU_TO_CPU,     &cx->scb->hpu2cpu_irq);
	writel(IRQ_CPU_TO_HPU_ACK, &cx->scb->cpu2hpu_irq_ack);
	writel(IRQ_PPU_TO_CPU,     &cx->scb->ppu2cpu_irq);
	writel(IRQ_CPU_TO_PPU_ACK, &cx->scb->cpu2ppu_irq_ack);
	writel(IRQ_EPU_TO_CPU,     &cx->scb->epu2cpu_irq);
	writel(IRQ_CPU_TO_EPU_ACK, &cx->scb->cpu2epu_irq_ack);

	writel(IRQ_CPU_TO_APU,     &cx->scb->cpu2apu_irq);
	writel(IRQ_APU_TO_CPU_ACK, &cx->scb->apu2cpu_irq_ack);
	writel(IRQ_HPU_TO_APU,     &cx->scb->hpu2apu_irq);
	writel(IRQ_APU_TO_HPU_ACK, &cx->scb->apu2hpu_irq_ack);
	writel(IRQ_PPU_TO_APU,     &cx->scb->ppu2apu_irq);
	writel(IRQ_APU_TO_PPU_ACK, &cx->scb->apu2ppu_irq_ack);
	writel(IRQ_EPU_TO_APU,     &cx->scb->epu2apu_irq);
	writel(IRQ_APU_TO_EPU_ACK, &cx->scb->apu2epu_irq_ack);

	writel(IRQ_CPU_TO_HPU,     &cx->scb->cpu2hpu_irq);
	writel(IRQ_HPU_TO_CPU_ACK, &cx->scb->hpu2cpu_irq_ack);
	writel(IRQ_APU_TO_HPU,     &cx->scb->apu2hpu_irq);
	writel(IRQ_HPU_TO_APU_ACK, &cx->scb->hpu2apu_irq_ack);
	writel(IRQ_PPU_TO_HPU,     &cx->scb->ppu2hpu_irq);
	writel(IRQ_HPU_TO_PPU_ACK, &cx->scb->hpu2ppu_irq_ack);
	writel(IRQ_EPU_TO_HPU,     &cx->scb->epu2hpu_irq);
	writel(IRQ_HPU_TO_EPU_ACK, &cx->scb->hpu2epu_irq_ack);

	writel(IRQ_CPU_TO_PPU,     &cx->scb->cpu2ppu_irq);
	writel(IRQ_PPU_TO_CPU_ACK, &cx->scb->ppu2cpu_irq_ack);
	writel(IRQ_APU_TO_PPU,     &cx->scb->apu2ppu_irq);
	writel(IRQ_PPU_TO_APU_ACK, &cx->scb->ppu2apu_irq_ack);
	writel(IRQ_HPU_TO_PPU,     &cx->scb->hpu2ppu_irq);
	writel(IRQ_PPU_TO_HPU_ACK, &cx->scb->ppu2hpu_irq_ack);
	writel(IRQ_EPU_TO_PPU,     &cx->scb->epu2ppu_irq);
	writel(IRQ_PPU_TO_EPU_ACK, &cx->scb->ppu2epu_irq_ack);

	writel(IRQ_CPU_TO_EPU,     &cx->scb->cpu2epu_irq);
	writel(IRQ_EPU_TO_CPU_ACK, &cx->scb->epu2cpu_irq_ack);
	writel(IRQ_APU_TO_EPU,     &cx->scb->apu2epu_irq);
	writel(IRQ_EPU_TO_APU_ACK, &cx->scb->epu2apu_irq_ack);
	writel(IRQ_HPU_TO_EPU,     &cx->scb->hpu2epu_irq);
	writel(IRQ_EPU_TO_HPU_ACK, &cx->scb->epu2hpu_irq_ack);
	writel(IRQ_PPU_TO_EPU,     &cx->scb->ppu2epu_irq);
	writel(IRQ_EPU_TO_PPU_ACK, &cx->scb->epu2ppu_irq_ack);

	writel(SCB_OFFSET + offsetof(struct cx18_scb, apu2cpu_mb),
			&cx->scb->apu2cpu_mb_offset);
	writel(SCB_OFFSET + offsetof(struct cx18_scb, hpu2cpu_mb),
			&cx->scb->hpu2cpu_mb_offset);
	writel(SCB_OFFSET + offsetof(struct cx18_scb, ppu2cpu_mb),
			&cx->scb->ppu2cpu_mb_offset);
	writel(SCB_OFFSET + offsetof(struct cx18_scb, epu2cpu_mb),
			&cx->scb->epu2cpu_mb_offset);
	writel(SCB_OFFSET + offsetof(struct cx18_scb, cpu2apu_mb),
			&cx->scb->cpu2apu_mb_offset);
	writel(SCB_OFFSET + offsetof(struct cx18_scb, hpu2apu_mb),
			&cx->scb->hpu2apu_mb_offset);
	writel(SCB_OFFSET + offsetof(struct cx18_scb, ppu2apu_mb),
			&cx->scb->ppu2apu_mb_offset);
	writel(SCB_OFFSET + offsetof(struct cx18_scb, epu2apu_mb),
			&cx->scb->epu2apu_mb_offset);
	writel(SCB_OFFSET + offsetof(struct cx18_scb, cpu2hpu_mb),
			&cx->scb->cpu2hpu_mb_offset);
	writel(SCB_OFFSET + offsetof(struct cx18_scb, apu2hpu_mb),
			&cx->scb->apu2hpu_mb_offset);
	writel(SCB_OFFSET + offsetof(struct cx18_scb, ppu2hpu_mb),
			&cx->scb->ppu2hpu_mb_offset);
	writel(SCB_OFFSET + offsetof(struct cx18_scb, epu2hpu_mb),
			&cx->scb->epu2hpu_mb_offset);
	writel(SCB_OFFSET + offsetof(struct cx18_scb, cpu2ppu_mb),
			&cx->scb->cpu2ppu_mb_offset);
	writel(SCB_OFFSET + offsetof(struct cx18_scb, apu2ppu_mb),
			&cx->scb->apu2ppu_mb_offset);
	writel(SCB_OFFSET + offsetof(struct cx18_scb, hpu2ppu_mb),
			&cx->scb->hpu2ppu_mb_offset);
	writel(SCB_OFFSET + offsetof(struct cx18_scb, epu2ppu_mb),
			&cx->scb->epu2ppu_mb_offset);
	writel(SCB_OFFSET + offsetof(struct cx18_scb, cpu2epu_mb),
			&cx->scb->cpu2epu_mb_offset);
	writel(SCB_OFFSET + offsetof(struct cx18_scb, apu2epu_mb),
			&cx->scb->apu2epu_mb_offset);
	writel(SCB_OFFSET + offsetof(struct cx18_scb, hpu2epu_mb),
			&cx->scb->hpu2epu_mb_offset);
	writel(SCB_OFFSET + offsetof(struct cx18_scb, ppu2epu_mb),
			&cx->scb->ppu2epu_mb_offset);

	writel(SCB_OFFSET + offsetof(struct cx18_scb, cpu_state),
			&cx->scb->ipc_offset);

	writel(1, &cx->scb->hpu_state);
	writel(1, &cx->scb->epu_state);
}
Пример #7
0
static void
generate_all_charts (GtkNotebook *notebook)
{
	GogPlot *plot = NULL;
	int i;
	gint current_page;

	current_page = gtk_notebook_get_current_page (notebook);

	/* clean up old pages */
	for (i = gtk_notebook_get_n_pages (notebook) - 1; i >= 0; i--) {
		gtk_notebook_remove_page (notebook, i);
	}

	plot = setup_page (notebook, "GogPiePlot");
	insert_1_5d_data (plot);
	plot = setup_page (notebook, "GogRingPlot");
	insert_1_5d_data (plot);

	plot = setup_page (notebook, "GogRadarPlot");
	insert_1_5d_data (plot);
	plot = setup_page (notebook, "GogRadarAreaPlot");
	insert_1_5d_data (plot);
	plot = setup_page (notebook, "GogPolarPlot");
	insert_polar_data (plot);

	plot = setup_page (notebook, "GogBoxPlot");
	insert_box_data (plot);
	plot = setup_page (notebook, "GogHistogramPlot");
	insert_histogram_data (plot);

	plot = setup_page (notebook, "GogXYPlot");
	insert_xy_data (plot);
	plot = setup_page (notebook, "GogBubblePlot");
	insert_bubble_data (plot);
	plot = setup_page (notebook, "GogXYColorPlot");
	insert_bubble_data (plot);

	plot = setup_page (notebook, "GogLinePlot");
	insert_1_5d_data (plot);
	plot = setup_page (notebook, "GogAreaPlot");
	insert_1_5d_data (plot);
	plot = setup_page (notebook, "GogBarColPlot");
	insert_1_5d_data (plot);
	plot = setup_page (notebook, "GogDropBarPlot");
	insert_dropbar_data (plot);
	plot = setup_page (notebook, "GogMinMaxPlot");
	insert_minmax_data (plot);

	plot = setup_page (notebook, "GogContourPlot");
	insert_xyz_data (plot);
	plot = setup_page (notebook, "GogSurfacePlot");
	insert_xyz_data (plot);


	/* These charts are included because they are for compatibility
	   with the weird excel, Jean suggest to drop them. See bug
	   http://bugzilla.gnome.org/show_bug.cgi?id=547408 for more detail.
	*/
	/*
	plot = setup_page (notebook, "XLContourPlot");
	plot = setup_page (notebook, "XLSurfacePlot");
	*/

	/* FIXME: These charts are included for they have critical warning */
	/*
	plot = setup_page (notebook, "GogLogFitCurve");

	plot = setup_page (notebook, "GogLinRegCurve");
	plot = setup_page (notebook, "GogExpRegCurve");
	plot = setup_page (notebook, "GogPowerRegCurve");
	plot = setup_page (notebook, "GogLogRegCurve");
	plot = setup_page (notebook, "GogPolynomRegCurve");

	plot = setup_page (notebook, "GogMovingAvg");
	plot = setup_page (notebook, "GogExpSmooth");
	*/
	gtk_widget_show_all (GTK_WIDGET (notebook));
	if (current_page != -1)
		gtk_notebook_set_current_page (notebook, current_page);
}