Exemplo n.º 1
0
static void do_pio_read(struct s3cmci_host *host)
{
	int res;
	u32 fifo;
	void __iomem *from_ptr;

	/* write real prescaler to host, it might be set slow to fix */
	writel(host->prescaler, host->base + S3C2410_SDIPRE);

	from_ptr = host->base + host->sdidata;

	while ((fifo = fifo_count(host))) {
		if (!host->pio_words) {
			res = get_data_buffer(host, &host->pio_words,
					      &host->pio_ptr);
			if (res) {
				host->pio_active = XFER_NONE;
				host->complete_what = COMPLETION_FINALIZE;

				dbg(host, dbg_pio, "pio_read(): "
				    "complete (no more data).\n");
				return;
			}

			dbg(host, dbg_pio,
			    "pio_read(): new target: [%i]@[%p]\n",
			    host->pio_words, host->pio_ptr);
		}

		dbg(host, dbg_pio,
		    "pio_read(): fifo:[%02i] buffer:[%03i] dcnt:[%08X]\n",
		    fifo, host->pio_words,
		    readl(host->base + S3C2410_SDIDCNT));

		if (fifo > host->pio_words)
			fifo = host->pio_words;

		host->pio_words -= fifo;
		host->pio_count += fifo;

		while (fifo--)
			*(host->pio_ptr++) = readl(from_ptr);
	}

	if (!host->pio_words) {
		res = get_data_buffer(host, &host->pio_words, &host->pio_ptr);
		if (res) {
			dbg(host, dbg_pio,
			    "pio_read(): complete (no more buffers).\n");
			host->pio_active = XFER_NONE;
			host->complete_what = COMPLETION_FINALIZE;

			return;
		}
	}

	enable_imask(host,
		     S3C2410_SDIIMSK_RXFIFOHALF | S3C2410_SDIIMSK_RXFIFOLAST);
}
Exemplo n.º 2
0
static INLINE uint8_t *get_buffer_from_lpar(uint64_t lpar)
{
    uint64_t lpar1 = *(uint64_t *)(*(uint64_t *)((TOC+LPAR_TOC_OFFSET)));
    uint64_t lpar2 = lpar1+0x1000;
    uint64_t lpar3 = lpar1+0x400;

    uint8_t *out1 = get_data_buffer();
    uint8_t *out2 = out1+0x1000;
    uint8_t *out3 = out1+0x400;

    if (lpar == lpar1)
    {
        return out1;
    }
    else if (lpar == lpar2)
    {
        return out2;
    }
    else if (lpar == lpar3)
    {
        return out3;
    }

    DPRINTF("Warning: cannot find buffer for lpar: 0x%lx, using default logic!!!\n", lpar);
    dump_stack_trace2(16);
    return (lpar-lpar1)+out1;
}
Exemplo n.º 3
0
 boost::shared_ptr<parcel_buffer_type> get_buffer(parcel const & p, std::size_t arg_size)
 {
     // generate the name for this data_buffer
     std::string data_buffer_name(p.get_parcel_id().to_string());
     if(!buffer_)
     {
         // clear and preallocate out_buffer_ (or fetch from cache)
         buffer_ = boost::make_shared<parcel_buffer_type>(
             get_data_buffer((arg_size * 12) / 10 + 1024,
                 data_buffer_name)
         );
     }
     else
     {
         buffer_->data_ =
             get_data_buffer((arg_size * 12) / 10 + 1024,
                 data_buffer_name);
     }
     return buffer_;
 }
Exemplo n.º 4
0
static inline void do_pio_write(struct s3cmci_host *host)
{
	int res;
	u32 fifo;

	void __iomem *to_ptr;

	to_ptr = host->base + host->sdidata;

	while ((fifo = FIFO_FREE(host))) {
		if (!host->pio_words) {
			res = get_data_buffer(host, &host->pio_words,
							&host->pio_ptr);
			if (res) {
				dbg(host, dbg_pio, "pio_write(): "
					"complete (no more data).\n");
				host->pio_active = XFER_NONE;

				return;
			}

			dbg(host, dbg_pio, "pio_write(): "
				"new source: [%i]@[%p]\n",
				host->pio_words, host->pio_ptr);

		}

		if (fifo > host->pio_words)
			fifo = host->pio_words;

		host->pio_words-= fifo;
		host->pio_count+= fifo;

		while(fifo--) {
			writel(*(host->pio_ptr++), to_ptr);
		}
	}

	enable_imask(host, S3C2410_SDIIMSK_TXFIFOHALF);
}
Exemplo n.º 5
0
static INLINE uint8_t *get_buffer_from_lpar(uint64_t lpar)
{
	uint64_t *p = (uint64_t *) *(uint64_t *)(TOC+DATA_TOC_OFFSET);
	uint64_t lpar1 = p[LPAR_SUBTOC_OFFSET/8];
	uint64_t lpar2 = lpar1+0x1000;
	uint64_t lpar3 = lpar1+0x400;
	uint64_t lpar4 = lpar1+0x10000;
	
	uint8_t *out1 = get_data_buffer();
	uint8_t *out2 = out1+0x1000;
	uint8_t *out3 = out1+0x400;
	uint8_t *out4 = out1+0x10000;
	
	if (lpar == lpar1)
	{
		return out1;
	}
	else if (lpar == lpar2)
	{
		return out2;
	}
	else if (lpar == lpar3)
	{
		return out3;
	}
	else if (lpar == lpar4)
	{
		return out4;
	}
	else if (lpar == 0)
	{
		return NULL; // Buffer not needed
	}
	
	DPRINTF("Warning: cannot find buffer for lpar: 0x%lx, using default logic (lpar1=0x%lx)!!!\n", lpar, lpar1);
	dump_stack_trace2(16);
	return (lpar-lpar1)+out1;
}
Exemplo n.º 6
0
static void do_pio_read(struct s3cmci_host *host)
{
	int res;
	u32 fifo;
	u32 *ptr;
	u32 fifo_words;
	void __iomem *from_ptr;

	/* write real prescaler to host, it might be set slow to fix */
	writel(host->prescaler, host->base + S3C2410_SDIPRE);

	from_ptr = host->base + host->sdidata;

	while ((fifo = fifo_count(host))) {
		if (!host->pio_bytes) {
			res = get_data_buffer(host, &host->pio_bytes,
					      &host->pio_ptr);
			if (res) {
				host->pio_active = XFER_NONE;
				host->complete_what = COMPLETION_FINALIZE;

				dbg(host, dbg_pio, "pio_read(): "
				    "complete (no more data).\n");
				return;
			}

			dbg(host, dbg_pio,
			    "pio_read(): new target: [%i]@[%p]\n",
			    host->pio_bytes, host->pio_ptr);
		}

		dbg(host, dbg_pio,
		    "pio_read(): fifo:[%02i] buffer:[%03i] dcnt:[%08X]\n",
		    fifo, host->pio_bytes,
		    readl(host->base + S3C2410_SDIDCNT));

		/* If we have reached the end of the block, we can
		 * read a word and get 1 to 3 bytes.  If we in the
		 * middle of the block, we have to read full words,
		 * otherwise we will write garbage, so round down to
		 * an even multiple of 4. */
		if (fifo >= host->pio_bytes)
			fifo = host->pio_bytes;
		else
			fifo -= fifo & 3;

		host->pio_bytes -= fifo;
		host->pio_count += fifo;

		fifo_words = fifo >> 2;
		ptr = host->pio_ptr;
		while (fifo_words--)
			*ptr++ = readl(from_ptr);
		host->pio_ptr = ptr;

		if (fifo & 3) {
			u32 n = fifo & 3;
			u32 data = readl(from_ptr);
			u8 *p = (u8 *)host->pio_ptr;

			while (n--) {
				*p++ = data;
				data >>= 8;
			}
		}
	}
Exemplo n.º 7
0
static void do_pio_read(struct s3cmci_host *host)
{
	int res;
	u32 fifo;
	u32 *ptr;
	u32 fifo_words;
	void __iomem *from_ptr;

	
	writel(host->prescaler, host->base + S3C2410_SDIPRE);

	from_ptr = host->base + host->sdidata;

	while ((fifo = fifo_count(host))) {
		if (!host->pio_bytes) {
			res = get_data_buffer(host, &host->pio_bytes,
					      &host->pio_ptr);
			if (res) {
				host->pio_active = XFER_NONE;
				host->complete_what = COMPLETION_FINALIZE;

				dbg(host, dbg_pio, "pio_read(): "
				    "complete (no more data).\n");
				return;
			}

			dbg(host, dbg_pio,
			    "pio_read(): new target: [%i]@[%p]\n",
			    host->pio_bytes, host->pio_ptr);
		}

		dbg(host, dbg_pio,
		    "pio_read(): fifo:[%02i] buffer:[%03i] dcnt:[%08X]\n",
		    fifo, host->pio_bytes,
		    readl(host->base + S3C2410_SDIDCNT));

		
		if (fifo >= host->pio_bytes)
			fifo = host->pio_bytes;
		else
			fifo -= fifo & 3;

		host->pio_bytes -= fifo;
		host->pio_count += fifo;

		fifo_words = fifo >> 2;
		ptr = host->pio_ptr;
		while (fifo_words--)
			*ptr++ = readl(from_ptr);
		host->pio_ptr = ptr;

		if (fifo & 3) {
			u32 n = fifo & 3;
			u32 data = readl(from_ptr);
			u8 *p = (u8 *)host->pio_ptr;

			while (n--) {
				*p++ = data;
				data >>= 8;
			}
		}
	}