2006-08-23 11:10:44 +00:00
|
|
|
/*
|
2009-07-29 02:49:52 +00:00
|
|
|
* Copyright (C) Freescale Semiconductor, Inc. 2006.
|
2006-08-23 11:10:44 +00:00
|
|
|
* Author: Jason Jin<Jason.jin@freescale.com>
|
|
|
|
* Zhang Wei<wei.zhang@freescale.com>
|
|
|
|
*
|
2013-07-08 07:37:19 +00:00
|
|
|
* SPDX-License-Identifier: GPL-2.0+
|
2006-08-23 11:10:44 +00:00
|
|
|
*
|
|
|
|
* with the reference on libata and ahci drvier in kernel
|
|
|
|
*/
|
|
|
|
#include <common.h>
|
|
|
|
|
|
|
|
#include <command.h>
|
2015-11-29 20:18:06 +00:00
|
|
|
#include <dm.h>
|
2006-08-23 11:10:44 +00:00
|
|
|
#include <pci.h>
|
|
|
|
#include <asm/processor.h>
|
2016-09-21 02:28:55 +00:00
|
|
|
#include <linux/errno.h>
|
2006-08-23 11:10:44 +00:00
|
|
|
#include <asm/io.h>
|
|
|
|
#include <malloc.h>
|
2015-09-02 23:24:58 +00:00
|
|
|
#include <memalign.h>
|
2006-08-23 11:10:44 +00:00
|
|
|
#include <scsi.h>
|
2013-08-24 15:10:54 +00:00
|
|
|
#include <libata.h>
|
2006-08-23 11:10:44 +00:00
|
|
|
#include <linux/ctype.h>
|
|
|
|
#include <ahci.h>
|
|
|
|
|
2012-10-29 05:24:02 +00:00
|
|
|
static int ata_io_flush(u8 port);
|
|
|
|
|
2006-08-23 11:10:44 +00:00
|
|
|
struct ahci_probe_ent *probe_ent = NULL;
|
2013-08-24 15:10:54 +00:00
|
|
|
u16 *ataid[AHCI_MAX_PORTS];
|
2006-08-23 11:10:44 +00:00
|
|
|
|
2006-08-23 16:04:43 +00:00
|
|
|
#define writel_with_flush(a,b) do { writel(a,b); readl(b); } while (0)
|
|
|
|
|
2012-10-29 05:23:44 +00:00
|
|
|
/*
|
2012-10-29 05:23:53 +00:00
|
|
|
* Some controllers limit number of blocks they can read/write at once.
|
|
|
|
* Contemporary SSD devices work much faster if the read/write size is aligned
|
|
|
|
* to a power of 2. Let's set default to 128 and allowing to be overwritten if
|
|
|
|
* needed.
|
2012-10-29 05:23:44 +00:00
|
|
|
*/
|
2012-10-29 05:23:53 +00:00
|
|
|
#ifndef MAX_SATA_BLOCKS_READ_WRITE
|
|
|
|
#define MAX_SATA_BLOCKS_READ_WRITE 0x80
|
2012-10-29 05:23:44 +00:00
|
|
|
#endif
|
2006-08-23 11:10:44 +00:00
|
|
|
|
2012-10-29 05:24:00 +00:00
|
|
|
/* Maximum timeouts for each event */
|
2013-08-24 15:10:53 +00:00
|
|
|
#define WAIT_MS_SPINUP 20000
|
2015-06-04 23:58:46 +00:00
|
|
|
#define WAIT_MS_DATAIO 10000
|
2012-10-29 05:24:02 +00:00
|
|
|
#define WAIT_MS_FLUSH 5000
|
2014-07-18 19:38:39 +00:00
|
|
|
#define WAIT_MS_LINKUP 200
|
2012-10-29 05:24:00 +00:00
|
|
|
|
2016-08-31 08:02:15 +00:00
|
|
|
__weak void __iomem *ahci_port_base(void __iomem *base, u32 port)
|
2006-08-23 11:10:44 +00:00
|
|
|
{
|
|
|
|
return base + 0x100 + (port * 0x80);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-07-09 06:37:30 +00:00
|
|
|
static void ahci_setup_port(struct ahci_ioports *port, void __iomem *base,
|
2006-08-23 11:10:44 +00:00
|
|
|
unsigned int port_idx)
|
|
|
|
{
|
|
|
|
base = ahci_port_base(base, port_idx);
|
|
|
|
|
2006-08-23 16:04:43 +00:00
|
|
|
port->cmd_addr = base;
|
|
|
|
port->scr_addr = base + PORT_SCR;
|
2006-08-23 11:10:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#define msleep(a) udelay(a * 1000)
|
2006-08-23 16:04:43 +00:00
|
|
|
|
2015-07-09 06:37:30 +00:00
|
|
|
static void ahci_dcache_flush_range(unsigned long begin, unsigned long len)
|
2012-10-29 05:23:59 +00:00
|
|
|
{
|
|
|
|
const unsigned long start = begin;
|
|
|
|
const unsigned long end = start + len;
|
|
|
|
|
|
|
|
debug("%s: flush dcache: [%#lx, %#lx)\n", __func__, start, end);
|
|
|
|
flush_dcache_range(start, end);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* SATA controller DMAs to physical RAM. Ensure data from the
|
|
|
|
* controller is invalidated from dcache; next access comes from
|
|
|
|
* physical RAM.
|
|
|
|
*/
|
2015-07-09 06:37:30 +00:00
|
|
|
static void ahci_dcache_invalidate_range(unsigned long begin, unsigned long len)
|
2012-10-29 05:23:59 +00:00
|
|
|
{
|
|
|
|
const unsigned long start = begin;
|
|
|
|
const unsigned long end = start + len;
|
|
|
|
|
|
|
|
debug("%s: invalidate dcache: [%#lx, %#lx)\n", __func__, start, end);
|
|
|
|
invalidate_dcache_range(start, end);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Ensure data for SATA controller is flushed out of dcache and
|
|
|
|
* written to physical memory.
|
|
|
|
*/
|
|
|
|
static void ahci_dcache_flush_sata_cmd(struct ahci_ioports *pp)
|
|
|
|
{
|
|
|
|
ahci_dcache_flush_range((unsigned long)pp->cmd_slot,
|
|
|
|
AHCI_PORT_PRIV_DMA_SZ);
|
|
|
|
}
|
|
|
|
|
2015-07-09 06:37:30 +00:00
|
|
|
static int waiting_for_cmd_completed(void __iomem *offset,
|
2006-08-23 16:04:43 +00:00
|
|
|
int timeout_msec,
|
|
|
|
u32 sign)
|
2006-08-23 11:10:44 +00:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
u32 status;
|
2006-08-23 16:04:43 +00:00
|
|
|
|
|
|
|
for (i = 0; ((status = readl(offset)) & sign) && i < timeout_msec; i++)
|
2006-08-23 11:10:44 +00:00
|
|
|
msleep(1);
|
|
|
|
|
2006-08-23 16:04:43 +00:00
|
|
|
return (i < timeout_msec) ? 0 : -1;
|
2006-08-23 11:10:44 +00:00
|
|
|
}
|
|
|
|
|
2013-08-24 15:10:51 +00:00
|
|
|
int __weak ahci_link_up(struct ahci_probe_ent *probe_ent, u8 port)
|
|
|
|
{
|
|
|
|
u32 tmp;
|
|
|
|
int j = 0;
|
2015-07-09 06:37:30 +00:00
|
|
|
void __iomem *port_mmio = probe_ent->port[port].port_mmio;
|
2013-08-24 15:10:51 +00:00
|
|
|
|
2013-10-07 11:07:26 +00:00
|
|
|
/*
|
2013-08-24 15:10:51 +00:00
|
|
|
* Bring up SATA link.
|
|
|
|
* SATA link bringup time is usually less than 1 ms; only very
|
|
|
|
* rarely has it taken between 1-2 ms. Never seen it above 2 ms.
|
|
|
|
*/
|
|
|
|
while (j < WAIT_MS_LINKUP) {
|
|
|
|
tmp = readl(port_mmio + PORT_SCR_STAT);
|
|
|
|
tmp &= PORT_SCR_STAT_DET_MASK;
|
|
|
|
if (tmp == PORT_SCR_STAT_DET_PHYRDY)
|
|
|
|
return 0;
|
|
|
|
udelay(1000);
|
|
|
|
j++;
|
|
|
|
}
|
|
|
|
return 1;
|
|
|
|
}
|
2006-08-23 11:10:44 +00:00
|
|
|
|
2014-07-18 19:38:41 +00:00
|
|
|
#ifdef CONFIG_SUNXI_AHCI
|
|
|
|
/* The sunxi AHCI controller requires this undocumented setup */
|
2015-07-09 06:37:30 +00:00
|
|
|
static void sunxi_dma_init(void __iomem *port_mmio)
|
2014-07-18 19:38:41 +00:00
|
|
|
{
|
|
|
|
clrsetbits_le32(port_mmio + PORT_P0DMACR, 0x0000ff00, 0x00004400);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2015-04-17 14:19:01 +00:00
|
|
|
int ahci_reset(void __iomem *base)
|
2014-12-15 14:02:55 +00:00
|
|
|
{
|
|
|
|
int i = 1000;
|
2015-04-17 14:19:01 +00:00
|
|
|
u32 __iomem *host_ctl_reg = base + HOST_CTL;
|
2014-12-15 14:02:55 +00:00
|
|
|
u32 tmp = readl(host_ctl_reg); /* global controller reset */
|
|
|
|
|
|
|
|
if ((tmp & HOST_RESET) == 0)
|
|
|
|
writel_with_flush(tmp | HOST_RESET, host_ctl_reg);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* reset must complete within 1 second, or
|
|
|
|
* the hardware should be considered fried.
|
|
|
|
*/
|
|
|
|
do {
|
|
|
|
udelay(1000);
|
|
|
|
tmp = readl(host_ctl_reg);
|
|
|
|
i--;
|
|
|
|
} while ((i > 0) && (tmp & HOST_RESET));
|
|
|
|
|
|
|
|
if (i == 0) {
|
|
|
|
printf("controller reset failed (0x%x)\n", tmp);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2006-08-23 11:10:44 +00:00
|
|
|
static int ahci_host_init(struct ahci_probe_ent *probe_ent)
|
|
|
|
{
|
2016-09-08 13:06:45 +00:00
|
|
|
#if !defined(CONFIG_SCSI_AHCI_PLAT) && !defined(CONFIG_DM_SCSI)
|
2015-11-29 20:18:06 +00:00
|
|
|
# ifdef CONFIG_DM_PCI
|
|
|
|
struct udevice *dev = probe_ent->dev;
|
|
|
|
struct pci_child_platdata *pplat = dev_get_parent_platdata(dev);
|
|
|
|
# else
|
2006-08-23 11:10:44 +00:00
|
|
|
pci_dev_t pdev = probe_ent->dev;
|
2011-07-06 16:13:36 +00:00
|
|
|
unsigned short vendor;
|
2015-11-29 20:18:06 +00:00
|
|
|
# endif
|
|
|
|
u16 tmp16;
|
2011-07-06 16:13:36 +00:00
|
|
|
#endif
|
2015-07-09 06:37:30 +00:00
|
|
|
void __iomem *mmio = probe_ent->mmio_base;
|
2012-10-29 05:24:01 +00:00
|
|
|
u32 tmp, cap_save, cmd;
|
2013-08-24 15:10:51 +00:00
|
|
|
int i, j, ret;
|
2015-07-09 06:37:30 +00:00
|
|
|
void __iomem *port_mmio;
|
2013-08-24 15:10:47 +00:00
|
|
|
u32 port_map;
|
2006-08-23 11:10:44 +00:00
|
|
|
|
2012-10-29 05:23:44 +00:00
|
|
|
debug("ahci_host_init: start\n");
|
|
|
|
|
2006-08-23 11:10:44 +00:00
|
|
|
cap_save = readl(mmio + HOST_CAP);
|
2006-08-23 16:04:43 +00:00
|
|
|
cap_save &= ((1 << 28) | (1 << 17));
|
2012-10-29 05:24:01 +00:00
|
|
|
cap_save |= (1 << 27); /* Staggered Spin-up. Not needed. */
|
2006-08-23 11:10:44 +00:00
|
|
|
|
2014-12-15 14:02:55 +00:00
|
|
|
ret = ahci_reset(probe_ent->mmio_base);
|
|
|
|
if (ret)
|
|
|
|
return ret;
|
2006-08-23 11:10:44 +00:00
|
|
|
|
|
|
|
writel_with_flush(HOST_AHCI_EN, mmio + HOST_CTL);
|
|
|
|
writel(cap_save, mmio + HOST_CAP);
|
|
|
|
writel_with_flush(0xf, mmio + HOST_PORTS_IMPL);
|
|
|
|
|
2016-09-08 13:06:45 +00:00
|
|
|
#if !defined(CONFIG_SCSI_AHCI_PLAT) && !defined(CONFIG_DM_SCSI)
|
2015-11-29 20:18:06 +00:00
|
|
|
# ifdef CONFIG_DM_PCI
|
|
|
|
if (pplat->vendor == PCI_VENDOR_ID_INTEL) {
|
|
|
|
u16 tmp16;
|
|
|
|
|
|
|
|
dm_pci_read_config16(dev, 0x92, &tmp16);
|
|
|
|
dm_pci_write_config16(dev, 0x92, tmp16 | 0xf);
|
|
|
|
}
|
|
|
|
# else
|
2006-08-23 11:10:44 +00:00
|
|
|
pci_read_config_word(pdev, PCI_VENDOR_ID, &vendor);
|
|
|
|
|
|
|
|
if (vendor == PCI_VENDOR_ID_INTEL) {
|
|
|
|
u16 tmp16;
|
|
|
|
pci_read_config_word(pdev, 0x92, &tmp16);
|
|
|
|
tmp16 |= 0xf;
|
|
|
|
pci_write_config_word(pdev, 0x92, tmp16);
|
|
|
|
}
|
2015-11-29 20:18:06 +00:00
|
|
|
# endif
|
2011-07-06 16:13:36 +00:00
|
|
|
#endif
|
2006-08-23 11:10:44 +00:00
|
|
|
probe_ent->cap = readl(mmio + HOST_CAP);
|
|
|
|
probe_ent->port_map = readl(mmio + HOST_PORTS_IMPL);
|
2013-08-24 15:10:47 +00:00
|
|
|
port_map = probe_ent->port_map;
|
2006-08-23 11:10:44 +00:00
|
|
|
probe_ent->n_ports = (probe_ent->cap & 0x1f) + 1;
|
|
|
|
|
|
|
|
debug("cap 0x%x port_map 0x%x n_ports %d\n",
|
2006-08-23 16:04:43 +00:00
|
|
|
probe_ent->cap, probe_ent->port_map, probe_ent->n_ports);
|
2006-08-23 11:10:44 +00:00
|
|
|
|
2012-10-29 05:23:44 +00:00
|
|
|
if (probe_ent->n_ports > CONFIG_SYS_SCSI_MAX_SCSI_ID)
|
|
|
|
probe_ent->n_ports = CONFIG_SYS_SCSI_MAX_SCSI_ID;
|
|
|
|
|
2006-08-23 11:10:44 +00:00
|
|
|
for (i = 0; i < probe_ent->n_ports; i++) {
|
2013-08-24 15:10:47 +00:00
|
|
|
if (!(port_map & (1 << i)))
|
|
|
|
continue;
|
2015-07-09 06:37:30 +00:00
|
|
|
probe_ent->port[i].port_mmio = ahci_port_base(mmio, i);
|
2006-08-23 16:04:43 +00:00
|
|
|
port_mmio = (u8 *) probe_ent->port[i].port_mmio;
|
2015-07-09 06:37:30 +00:00
|
|
|
ahci_setup_port(&probe_ent->port[i], mmio, i);
|
2006-08-23 11:10:44 +00:00
|
|
|
|
|
|
|
/* make sure port is not active */
|
|
|
|
tmp = readl(port_mmio + PORT_CMD);
|
|
|
|
if (tmp & (PORT_CMD_LIST_ON | PORT_CMD_FIS_ON |
|
|
|
|
PORT_CMD_FIS_RX | PORT_CMD_START)) {
|
2012-10-29 05:23:50 +00:00
|
|
|
debug("Port %d is active. Deactivating.\n", i);
|
2006-08-23 11:10:44 +00:00
|
|
|
tmp &= ~(PORT_CMD_LIST_ON | PORT_CMD_FIS_ON |
|
|
|
|
PORT_CMD_FIS_RX | PORT_CMD_START);
|
|
|
|
writel_with_flush(tmp, port_mmio + PORT_CMD);
|
|
|
|
|
|
|
|
/* spec says 500 msecs for each bit, so
|
|
|
|
* this is slightly incorrect.
|
|
|
|
*/
|
|
|
|
msleep(500);
|
|
|
|
}
|
|
|
|
|
2014-07-18 19:38:41 +00:00
|
|
|
#ifdef CONFIG_SUNXI_AHCI
|
|
|
|
sunxi_dma_init(port_mmio);
|
|
|
|
#endif
|
|
|
|
|
2012-10-29 05:24:01 +00:00
|
|
|
/* Add the spinup command to whatever mode bits may
|
|
|
|
* already be on in the command register.
|
|
|
|
*/
|
|
|
|
cmd = readl(port_mmio + PORT_CMD);
|
|
|
|
cmd |= PORT_CMD_SPIN_UP;
|
|
|
|
writel_with_flush(cmd, port_mmio + PORT_CMD);
|
|
|
|
|
2013-08-24 15:10:51 +00:00
|
|
|
/* Bring up SATA link. */
|
|
|
|
ret = ahci_link_up(probe_ent, i);
|
|
|
|
if (ret) {
|
2012-10-29 05:24:01 +00:00
|
|
|
printf("SATA link %d timeout.\n", i);
|
|
|
|
continue;
|
|
|
|
} else {
|
|
|
|
debug("SATA link ok.\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Clear error status */
|
|
|
|
tmp = readl(port_mmio + PORT_SCR_ERR);
|
|
|
|
if (tmp)
|
|
|
|
writel(tmp, port_mmio + PORT_SCR_ERR);
|
|
|
|
|
|
|
|
debug("Spinning up device on SATA port %d... ", i);
|
|
|
|
|
|
|
|
j = 0;
|
|
|
|
while (j < WAIT_MS_SPINUP) {
|
|
|
|
tmp = readl(port_mmio + PORT_TFDATA);
|
2013-08-24 15:10:54 +00:00
|
|
|
if (!(tmp & (ATA_BUSY | ATA_DRQ)))
|
2012-10-29 05:24:01 +00:00
|
|
|
break;
|
|
|
|
udelay(1000);
|
2013-08-24 15:10:52 +00:00
|
|
|
tmp = readl(port_mmio + PORT_SCR_STAT);
|
|
|
|
tmp &= PORT_SCR_STAT_DET_MASK;
|
|
|
|
if (tmp == PORT_SCR_STAT_DET_PHYRDY)
|
|
|
|
break;
|
2012-10-29 05:24:01 +00:00
|
|
|
j++;
|
|
|
|
}
|
2013-08-24 15:10:52 +00:00
|
|
|
|
|
|
|
tmp = readl(port_mmio + PORT_SCR_STAT) & PORT_SCR_STAT_DET_MASK;
|
|
|
|
if (tmp == PORT_SCR_STAT_DET_COMINIT) {
|
|
|
|
debug("SATA link %d down (COMINIT received), retrying...\n", i);
|
|
|
|
i--;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2012-10-29 05:24:01 +00:00
|
|
|
printf("Target spinup took %d ms.\n", j);
|
|
|
|
if (j == WAIT_MS_SPINUP)
|
2012-10-29 05:23:49 +00:00
|
|
|
debug("timeout.\n");
|
|
|
|
else
|
|
|
|
debug("ok.\n");
|
2006-08-23 11:10:44 +00:00
|
|
|
|
|
|
|
tmp = readl(port_mmio + PORT_SCR_ERR);
|
|
|
|
debug("PORT_SCR_ERR 0x%x\n", tmp);
|
|
|
|
writel(tmp, port_mmio + PORT_SCR_ERR);
|
|
|
|
|
|
|
|
/* ack any pending irq events for this port */
|
|
|
|
tmp = readl(port_mmio + PORT_IRQ_STAT);
|
|
|
|
debug("PORT_IRQ_STAT 0x%x\n", tmp);
|
|
|
|
if (tmp)
|
|
|
|
writel(tmp, port_mmio + PORT_IRQ_STAT);
|
|
|
|
|
|
|
|
writel(1 << i, mmio + HOST_IRQ_STAT);
|
|
|
|
|
2012-10-29 05:23:51 +00:00
|
|
|
/* register linkup ports */
|
2006-08-23 11:10:44 +00:00
|
|
|
tmp = readl(port_mmio + PORT_SCR_STAT);
|
2012-10-29 05:24:02 +00:00
|
|
|
debug("SATA port %d status: 0x%x\n", i, tmp);
|
2013-08-24 15:10:50 +00:00
|
|
|
if ((tmp & PORT_SCR_STAT_DET_MASK) == PORT_SCR_STAT_DET_PHYRDY)
|
2006-08-23 16:04:43 +00:00
|
|
|
probe_ent->link_port_map |= (0x01 << i);
|
2006-08-23 11:10:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
tmp = readl(mmio + HOST_CTL);
|
|
|
|
debug("HOST_CTL 0x%x\n", tmp);
|
|
|
|
writel(tmp | HOST_IRQ_EN, mmio + HOST_CTL);
|
|
|
|
tmp = readl(mmio + HOST_CTL);
|
|
|
|
debug("HOST_CTL 0x%x\n", tmp);
|
2016-09-08 13:06:45 +00:00
|
|
|
#if !defined(CONFIG_DM_SCSI)
|
2011-07-06 16:13:36 +00:00
|
|
|
#ifndef CONFIG_SCSI_AHCI_PLAT
|
2015-11-29 20:18:06 +00:00
|
|
|
# ifdef CONFIG_DM_PCI
|
|
|
|
dm_pci_read_config16(dev, PCI_COMMAND, &tmp16);
|
|
|
|
tmp |= PCI_COMMAND_MASTER;
|
|
|
|
dm_pci_write_config16(dev, PCI_COMMAND, tmp16);
|
|
|
|
# else
|
2006-08-23 11:10:44 +00:00
|
|
|
pci_read_config_word(pdev, PCI_COMMAND, &tmp16);
|
|
|
|
tmp |= PCI_COMMAND_MASTER;
|
|
|
|
pci_write_config_word(pdev, PCI_COMMAND, tmp16);
|
2015-11-29 20:18:06 +00:00
|
|
|
# endif
|
2016-09-08 13:06:45 +00:00
|
|
|
#endif
|
2011-07-06 16:13:36 +00:00
|
|
|
#endif
|
2006-08-23 11:10:44 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void ahci_print_info(struct ahci_probe_ent *probe_ent)
|
|
|
|
{
|
2016-09-08 13:06:45 +00:00
|
|
|
#if !defined(CONFIG_SCSI_AHCI_PLAT) && !defined(CONFIG_DM_SCSI)
|
|
|
|
# if defined(CONFIG_DM_PCI)
|
2015-11-29 20:18:06 +00:00
|
|
|
struct udevice *dev = probe_ent->dev;
|
|
|
|
# else
|
2006-08-23 11:10:44 +00:00
|
|
|
pci_dev_t pdev = probe_ent->dev;
|
2015-11-29 20:18:06 +00:00
|
|
|
# endif
|
2011-07-06 16:13:36 +00:00
|
|
|
u16 cc;
|
|
|
|
#endif
|
2015-07-09 06:37:30 +00:00
|
|
|
void __iomem *mmio = probe_ent->mmio_base;
|
2012-10-29 05:23:51 +00:00
|
|
|
u32 vers, cap, cap2, impl, speed;
|
2006-08-23 11:10:44 +00:00
|
|
|
const char *speed_s;
|
|
|
|
const char *scc_s;
|
|
|
|
|
|
|
|
vers = readl(mmio + HOST_VERSION);
|
|
|
|
cap = probe_ent->cap;
|
2012-10-29 05:23:51 +00:00
|
|
|
cap2 = readl(mmio + HOST_CAP2);
|
2006-08-23 11:10:44 +00:00
|
|
|
impl = probe_ent->port_map;
|
|
|
|
|
|
|
|
speed = (cap >> 20) & 0xf;
|
|
|
|
if (speed == 1)
|
|
|
|
speed_s = "1.5";
|
|
|
|
else if (speed == 2)
|
|
|
|
speed_s = "3";
|
2012-10-29 05:23:51 +00:00
|
|
|
else if (speed == 3)
|
|
|
|
speed_s = "6";
|
2006-08-23 11:10:44 +00:00
|
|
|
else
|
|
|
|
speed_s = "?";
|
|
|
|
|
2016-09-08 13:06:45 +00:00
|
|
|
#if defined(CONFIG_SCSI_AHCI_PLAT) || defined(CONFIG_DM_SCSI)
|
2011-07-06 16:13:36 +00:00
|
|
|
scc_s = "SATA";
|
|
|
|
#else
|
2015-11-29 20:18:06 +00:00
|
|
|
# ifdef CONFIG_DM_PCI
|
|
|
|
dm_pci_read_config16(dev, 0x0a, &cc);
|
|
|
|
# else
|
2006-08-23 11:10:44 +00:00
|
|
|
pci_read_config_word(pdev, 0x0a, &cc);
|
2015-11-29 20:18:06 +00:00
|
|
|
# endif
|
2006-08-23 11:10:44 +00:00
|
|
|
if (cc == 0x0101)
|
|
|
|
scc_s = "IDE";
|
|
|
|
else if (cc == 0x0106)
|
|
|
|
scc_s = "SATA";
|
|
|
|
else if (cc == 0x0104)
|
|
|
|
scc_s = "RAID";
|
|
|
|
else
|
|
|
|
scc_s = "unknown";
|
2011-07-06 16:13:36 +00:00
|
|
|
#endif
|
2006-08-23 16:04:43 +00:00
|
|
|
printf("AHCI %02x%02x.%02x%02x "
|
|
|
|
"%u slots %u ports %s Gbps 0x%x impl %s mode\n",
|
|
|
|
(vers >> 24) & 0xff,
|
|
|
|
(vers >> 16) & 0xff,
|
|
|
|
(vers >> 8) & 0xff,
|
|
|
|
vers & 0xff,
|
|
|
|
((cap >> 8) & 0x1f) + 1, (cap & 0x1f) + 1, speed_s, impl, scc_s);
|
2006-08-23 11:10:44 +00:00
|
|
|
|
|
|
|
printf("flags: "
|
2012-10-29 05:23:51 +00:00
|
|
|
"%s%s%s%s%s%s%s"
|
|
|
|
"%s%s%s%s%s%s%s"
|
|
|
|
"%s%s%s%s%s%s\n",
|
2006-08-23 16:04:43 +00:00
|
|
|
cap & (1 << 31) ? "64bit " : "",
|
|
|
|
cap & (1 << 30) ? "ncq " : "",
|
|
|
|
cap & (1 << 28) ? "ilck " : "",
|
|
|
|
cap & (1 << 27) ? "stag " : "",
|
|
|
|
cap & (1 << 26) ? "pm " : "",
|
|
|
|
cap & (1 << 25) ? "led " : "",
|
|
|
|
cap & (1 << 24) ? "clo " : "",
|
|
|
|
cap & (1 << 19) ? "nz " : "",
|
|
|
|
cap & (1 << 18) ? "only " : "",
|
|
|
|
cap & (1 << 17) ? "pmp " : "",
|
2012-10-29 05:23:51 +00:00
|
|
|
cap & (1 << 16) ? "fbss " : "",
|
2006-08-23 16:04:43 +00:00
|
|
|
cap & (1 << 15) ? "pio " : "",
|
|
|
|
cap & (1 << 14) ? "slum " : "",
|
2012-10-29 05:23:51 +00:00
|
|
|
cap & (1 << 13) ? "part " : "",
|
|
|
|
cap & (1 << 7) ? "ccc " : "",
|
|
|
|
cap & (1 << 6) ? "ems " : "",
|
|
|
|
cap & (1 << 5) ? "sxs " : "",
|
|
|
|
cap2 & (1 << 2) ? "apst " : "",
|
|
|
|
cap2 & (1 << 1) ? "nvmp " : "",
|
|
|
|
cap2 & (1 << 0) ? "boh " : "");
|
2006-08-23 11:10:44 +00:00
|
|
|
}
|
|
|
|
|
2011-07-06 16:13:36 +00:00
|
|
|
#ifndef CONFIG_SCSI_AHCI_PLAT
|
2016-09-08 13:06:45 +00:00
|
|
|
# if defined(CONFIG_DM_PCI) || defined(CONFIG_DM_SCSI)
|
2015-11-29 20:18:06 +00:00
|
|
|
static int ahci_init_one(struct udevice *dev)
|
|
|
|
# else
|
|
|
|
static int ahci_init_one(pci_dev_t dev)
|
|
|
|
# endif
|
2006-08-23 11:10:44 +00:00
|
|
|
{
|
2016-09-08 13:06:45 +00:00
|
|
|
#if !defined(CONFIG_DM_SCSI)
|
2007-08-02 19:09:49 +00:00
|
|
|
u16 vendor;
|
2016-09-08 13:06:45 +00:00
|
|
|
#endif
|
2006-08-23 11:10:44 +00:00
|
|
|
int rc;
|
|
|
|
|
2007-08-14 19:06:45 +00:00
|
|
|
probe_ent = malloc(sizeof(struct ahci_probe_ent));
|
2013-11-11 14:56:37 +00:00
|
|
|
if (!probe_ent) {
|
|
|
|
printf("%s: No memory for probe_ent\n", __func__);
|
|
|
|
return -ENOMEM;
|
|
|
|
}
|
|
|
|
|
2007-08-14 19:06:45 +00:00
|
|
|
memset(probe_ent, 0, sizeof(struct ahci_probe_ent));
|
2015-11-29 20:18:06 +00:00
|
|
|
probe_ent->dev = dev;
|
2006-08-23 11:10:44 +00:00
|
|
|
|
2006-08-23 16:04:43 +00:00
|
|
|
probe_ent->host_flags = ATA_FLAG_SATA
|
|
|
|
| ATA_FLAG_NO_LEGACY
|
|
|
|
| ATA_FLAG_MMIO
|
|
|
|
| ATA_FLAG_PIO_DMA
|
|
|
|
| ATA_FLAG_NO_ATAPI;
|
|
|
|
probe_ent->pio_mask = 0x1f;
|
|
|
|
probe_ent->udma_mask = 0x7f; /*Fixme,assume to support UDMA6 */
|
2006-08-23 11:10:44 +00:00
|
|
|
|
2016-09-08 13:06:45 +00:00
|
|
|
#if !defined(CONFIG_DM_SCSI)
|
2015-11-29 20:18:06 +00:00
|
|
|
#ifdef CONFIG_DM_PCI
|
|
|
|
probe_ent->mmio_base = dm_pci_map_bar(dev, PCI_BASE_ADDRESS_5,
|
|
|
|
PCI_REGION_MEM);
|
|
|
|
|
|
|
|
/* Take from kernel:
|
|
|
|
* JMicron-specific fixup:
|
|
|
|
* make sure we're in AHCI mode
|
|
|
|
*/
|
|
|
|
dm_pci_read_config16(dev, PCI_VENDOR_ID, &vendor);
|
|
|
|
if (vendor == 0x197b)
|
|
|
|
dm_pci_write_config8(dev, 0x41, 0xa1);
|
|
|
|
#else
|
|
|
|
probe_ent->mmio_base = pci_map_bar(dev, PCI_BASE_ADDRESS_5,
|
2015-04-17 14:19:01 +00:00
|
|
|
PCI_REGION_MEM);
|
2006-08-23 11:10:44 +00:00
|
|
|
|
|
|
|
/* Take from kernel:
|
|
|
|
* JMicron-specific fixup:
|
|
|
|
* make sure we're in AHCI mode
|
|
|
|
*/
|
2015-11-29 20:18:06 +00:00
|
|
|
pci_read_config_word(dev, PCI_VENDOR_ID, &vendor);
|
2006-08-23 16:04:43 +00:00
|
|
|
if (vendor == 0x197b)
|
2015-11-29 20:18:06 +00:00
|
|
|
pci_write_config_byte(dev, 0x41, 0xa1);
|
|
|
|
#endif
|
2016-09-08 13:06:45 +00:00
|
|
|
#else
|
|
|
|
struct scsi_platdata *plat = dev_get_platdata(dev);
|
|
|
|
probe_ent->mmio_base = (void *)plat->base;
|
|
|
|
#endif
|
2006-08-23 11:10:44 +00:00
|
|
|
|
2015-11-29 20:18:06 +00:00
|
|
|
debug("ahci mmio_base=0x%p\n", probe_ent->mmio_base);
|
2006-08-23 11:10:44 +00:00
|
|
|
/* initialize adapter */
|
|
|
|
rc = ahci_host_init(probe_ent);
|
|
|
|
if (rc)
|
|
|
|
goto err_out;
|
|
|
|
|
|
|
|
ahci_print_info(probe_ent);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
2006-08-23 16:04:43 +00:00
|
|
|
err_out:
|
2006-08-23 11:10:44 +00:00
|
|
|
return rc;
|
|
|
|
}
|
2011-07-06 16:13:36 +00:00
|
|
|
#endif
|
2006-08-23 11:10:44 +00:00
|
|
|
|
|
|
|
#define MAX_DATA_BYTE_COUNT (4*1024*1024)
|
2006-08-23 16:04:43 +00:00
|
|
|
|
2006-08-23 11:10:44 +00:00
|
|
|
static int ahci_fill_sg(u8 port, unsigned char *buf, int buf_len)
|
|
|
|
{
|
|
|
|
struct ahci_ioports *pp = &(probe_ent->port[port]);
|
|
|
|
struct ahci_sg *ahci_sg = pp->cmd_tbl_sg;
|
|
|
|
u32 sg_count;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
sg_count = ((buf_len - 1) / MAX_DATA_BYTE_COUNT) + 1;
|
2006-08-23 16:04:43 +00:00
|
|
|
if (sg_count > AHCI_MAX_SG) {
|
2006-08-23 11:10:44 +00:00
|
|
|
printf("Error:Too much sg!\n");
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2006-08-23 16:04:43 +00:00
|
|
|
for (i = 0; i < sg_count; i++) {
|
|
|
|
ahci_sg->addr =
|
2015-07-09 06:37:30 +00:00
|
|
|
cpu_to_le32((unsigned long) buf + i * MAX_DATA_BYTE_COUNT);
|
2006-08-23 11:10:44 +00:00
|
|
|
ahci_sg->addr_hi = 0;
|
2006-08-23 16:04:43 +00:00
|
|
|
ahci_sg->flags_size = cpu_to_le32(0x3fffff &
|
|
|
|
(buf_len < MAX_DATA_BYTE_COUNT
|
|
|
|
? (buf_len - 1)
|
|
|
|
: (MAX_DATA_BYTE_COUNT - 1)));
|
2006-08-23 11:10:44 +00:00
|
|
|
ahci_sg++;
|
|
|
|
buf_len -= MAX_DATA_BYTE_COUNT;
|
|
|
|
}
|
|
|
|
|
|
|
|
return sg_count;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void ahci_fill_cmd_slot(struct ahci_ioports *pp, u32 opts)
|
|
|
|
{
|
|
|
|
pp->cmd_slot->opts = cpu_to_le32(opts);
|
|
|
|
pp->cmd_slot->status = 0;
|
2015-07-09 06:37:30 +00:00
|
|
|
pp->cmd_slot->tbl_addr = cpu_to_le32((u32)pp->cmd_tbl & 0xffffffff);
|
|
|
|
#ifdef CONFIG_PHYS_64BIT
|
|
|
|
pp->cmd_slot->tbl_addr_hi =
|
|
|
|
cpu_to_le32((u32)(((pp->cmd_tbl) >> 16) >> 16));
|
|
|
|
#endif
|
2006-08-23 11:10:44 +00:00
|
|
|
}
|
|
|
|
|
2015-07-09 06:37:30 +00:00
|
|
|
static int wait_spinup(void __iomem *port_mmio)
|
2014-12-31 09:18:39 +00:00
|
|
|
{
|
|
|
|
ulong start;
|
|
|
|
u32 tf_data;
|
|
|
|
|
|
|
|
start = get_timer(0);
|
|
|
|
do {
|
|
|
|
tf_data = readl(port_mmio + PORT_TFDATA);
|
|
|
|
if (!(tf_data & ATA_BUSY))
|
|
|
|
return 0;
|
|
|
|
} while (get_timer(start) < WAIT_MS_SPINUP);
|
|
|
|
|
|
|
|
return -ETIMEDOUT;
|
|
|
|
}
|
2006-08-23 11:10:44 +00:00
|
|
|
|
|
|
|
static int ahci_port_start(u8 port)
|
|
|
|
{
|
|
|
|
struct ahci_ioports *pp = &(probe_ent->port[port]);
|
2015-07-09 06:37:30 +00:00
|
|
|
void __iomem *port_mmio = pp->port_mmio;
|
2006-08-23 11:10:44 +00:00
|
|
|
u32 port_status;
|
2015-07-09 06:37:30 +00:00
|
|
|
void __iomem *mem;
|
2006-08-23 11:10:44 +00:00
|
|
|
|
2006-08-23 16:04:43 +00:00
|
|
|
debug("Enter start port: %d\n", port);
|
2006-08-23 11:10:44 +00:00
|
|
|
port_status = readl(port_mmio + PORT_SCR_STAT);
|
2006-08-23 16:04:43 +00:00
|
|
|
debug("Port %d status: %x\n", port, port_status);
|
|
|
|
if ((port_status & 0xf) != 0x03) {
|
2006-08-23 11:10:44 +00:00
|
|
|
printf("No Link on this port!\n");
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2015-07-09 06:37:30 +00:00
|
|
|
mem = malloc(AHCI_PORT_PRIV_DMA_SZ + 2048);
|
2006-08-23 11:10:44 +00:00
|
|
|
if (!mem) {
|
|
|
|
free(pp);
|
2013-11-11 14:56:37 +00:00
|
|
|
printf("%s: No mem for table!\n", __func__);
|
2006-08-23 11:10:44 +00:00
|
|
|
return -ENOMEM;
|
|
|
|
}
|
|
|
|
|
2015-07-09 06:37:30 +00:00
|
|
|
/* Aligned to 2048-bytes */
|
|
|
|
mem = memalign(2048, AHCI_PORT_PRIV_DMA_SZ);
|
|
|
|
memset(mem, 0, AHCI_PORT_PRIV_DMA_SZ);
|
2006-08-23 11:10:44 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* First item in chunk of DMA memory: 32-slot command table,
|
|
|
|
* 32 bytes each in size
|
|
|
|
*/
|
2012-10-29 05:23:58 +00:00
|
|
|
pp->cmd_slot =
|
|
|
|
(struct ahci_cmd_hdr *)(uintptr_t)virt_to_phys((void *)mem);
|
2015-07-09 06:37:30 +00:00
|
|
|
debug("cmd_slot = %p\n", pp->cmd_slot);
|
2006-08-23 11:10:44 +00:00
|
|
|
mem += (AHCI_CMD_SLOT_SZ + 224);
|
2006-08-23 16:04:43 +00:00
|
|
|
|
2006-08-23 11:10:44 +00:00
|
|
|
/*
|
|
|
|
* Second item: Received-FIS area
|
|
|
|
*/
|
2012-10-29 05:23:58 +00:00
|
|
|
pp->rx_fis = virt_to_phys((void *)mem);
|
2006-08-23 11:10:44 +00:00
|
|
|
mem += AHCI_RX_FIS_SZ;
|
2006-08-23 16:04:43 +00:00
|
|
|
|
2006-08-23 11:10:44 +00:00
|
|
|
/*
|
|
|
|
* Third item: data area for storing a single command
|
|
|
|
* and its scatter-gather table
|
|
|
|
*/
|
2012-10-29 05:23:58 +00:00
|
|
|
pp->cmd_tbl = virt_to_phys((void *)mem);
|
2015-07-09 06:37:30 +00:00
|
|
|
debug("cmd_tbl_dma = %lx\n", pp->cmd_tbl);
|
2006-08-23 11:10:44 +00:00
|
|
|
|
|
|
|
mem += AHCI_CMD_TBL_HDR;
|
2012-10-29 05:23:58 +00:00
|
|
|
pp->cmd_tbl_sg =
|
|
|
|
(struct ahci_sg *)(uintptr_t)virt_to_phys((void *)mem);
|
2006-08-23 11:10:44 +00:00
|
|
|
|
2015-07-09 06:37:30 +00:00
|
|
|
writel_with_flush((unsigned long)pp->cmd_slot,
|
|
|
|
port_mmio + PORT_LST_ADDR);
|
2006-08-23 11:10:44 +00:00
|
|
|
|
|
|
|
writel_with_flush(pp->rx_fis, port_mmio + PORT_FIS_ADDR);
|
|
|
|
|
2014-07-18 19:38:41 +00:00
|
|
|
#ifdef CONFIG_SUNXI_AHCI
|
|
|
|
sunxi_dma_init(port_mmio);
|
|
|
|
#endif
|
|
|
|
|
2006-08-23 11:10:44 +00:00
|
|
|
writel_with_flush(PORT_CMD_ICC_ACTIVE | PORT_CMD_FIS_RX |
|
2006-08-23 16:04:43 +00:00
|
|
|
PORT_CMD_POWER_ON | PORT_CMD_SPIN_UP |
|
|
|
|
PORT_CMD_START, port_mmio + PORT_CMD);
|
2006-08-23 11:10:44 +00:00
|
|
|
|
2006-08-23 16:04:43 +00:00
|
|
|
debug("Exit start port %d\n", port);
|
2006-08-23 11:10:44 +00:00
|
|
|
|
2014-12-31 09:18:39 +00:00
|
|
|
/*
|
|
|
|
* Make sure interface is not busy based on error and status
|
|
|
|
* information from task file data register before proceeding
|
|
|
|
*/
|
|
|
|
return wait_spinup(port_mmio);
|
2006-08-23 11:10:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-10-29 05:23:53 +00:00
|
|
|
static int ahci_device_data_io(u8 port, u8 *fis, int fis_len, u8 *buf,
|
|
|
|
int buf_len, u8 is_write)
|
2006-08-23 11:10:44 +00:00
|
|
|
{
|
|
|
|
|
2006-08-23 16:04:43 +00:00
|
|
|
struct ahci_ioports *pp = &(probe_ent->port[port]);
|
2015-07-09 06:37:30 +00:00
|
|
|
void __iomem *port_mmio = pp->port_mmio;
|
2006-08-23 11:10:44 +00:00
|
|
|
u32 opts;
|
|
|
|
u32 port_status;
|
|
|
|
int sg_count;
|
|
|
|
|
2012-10-29 05:23:53 +00:00
|
|
|
debug("Enter %s: for port %d\n", __func__, port);
|
2006-08-23 11:10:44 +00:00
|
|
|
|
2006-08-23 16:04:43 +00:00
|
|
|
if (port > probe_ent->n_ports) {
|
2012-10-29 05:23:56 +00:00
|
|
|
printf("Invalid port number %d\n", port);
|
2006-08-23 11:10:44 +00:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
port_status = readl(port_mmio + PORT_SCR_STAT);
|
2006-08-23 16:04:43 +00:00
|
|
|
if ((port_status & 0xf) != 0x03) {
|
|
|
|
debug("No Link on port %d!\n", port);
|
2006-08-23 11:10:44 +00:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
memcpy((unsigned char *)pp->cmd_tbl, fis, fis_len);
|
|
|
|
|
2006-08-23 16:04:43 +00:00
|
|
|
sg_count = ahci_fill_sg(port, buf, buf_len);
|
2012-10-29 05:23:53 +00:00
|
|
|
opts = (fis_len >> 2) | (sg_count << 16) | (is_write << 6);
|
2006-08-23 11:10:44 +00:00
|
|
|
ahci_fill_cmd_slot(pp, opts);
|
|
|
|
|
2012-10-29 05:23:59 +00:00
|
|
|
ahci_dcache_flush_sata_cmd(pp);
|
2015-07-09 06:37:30 +00:00
|
|
|
ahci_dcache_flush_range((unsigned long)buf, (unsigned long)buf_len);
|
2012-10-29 05:23:59 +00:00
|
|
|
|
2006-08-23 11:10:44 +00:00
|
|
|
writel_with_flush(1, port_mmio + PORT_CMD_ISSUE);
|
|
|
|
|
2012-10-29 05:24:00 +00:00
|
|
|
if (waiting_for_cmd_completed(port_mmio + PORT_CMD_ISSUE,
|
|
|
|
WAIT_MS_DATAIO, 0x1)) {
|
2006-08-23 11:10:44 +00:00
|
|
|
printf("timeout exit!\n");
|
|
|
|
return -1;
|
|
|
|
}
|
2012-10-29 05:23:59 +00:00
|
|
|
|
2015-07-09 06:37:30 +00:00
|
|
|
ahci_dcache_invalidate_range((unsigned long)buf,
|
|
|
|
(unsigned long)buf_len);
|
2012-10-29 05:23:53 +00:00
|
|
|
debug("%s: %d byte transferred.\n", __func__, pp->cmd_slot->status);
|
2006-08-23 11:10:44 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static char *ata_id_strcpy(u16 *target, u16 *src, int len)
|
|
|
|
{
|
|
|
|
int i;
|
2006-08-23 16:04:43 +00:00
|
|
|
for (i = 0; i < len / 2; i++)
|
2011-06-01 09:10:26 +00:00
|
|
|
target[i] = swab16(src[i]);
|
2006-08-23 11:10:44 +00:00
|
|
|
return (char *)target;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* SCSI INQUIRY command operation.
|
|
|
|
*/
|
|
|
|
static int ata_scsiop_inquiry(ccb *pccb)
|
|
|
|
{
|
2013-08-24 15:10:48 +00:00
|
|
|
static const u8 hdr[] = {
|
2006-08-23 11:10:44 +00:00
|
|
|
0,
|
|
|
|
0,
|
2006-08-23 16:04:43 +00:00
|
|
|
0x5, /* claim SPC-3 version compatibility */
|
2006-08-23 11:10:44 +00:00
|
|
|
2,
|
|
|
|
95 - 4,
|
|
|
|
};
|
|
|
|
u8 fis[20];
|
2014-04-01 14:26:40 +00:00
|
|
|
u16 *idbuf;
|
2013-11-11 14:56:38 +00:00
|
|
|
ALLOC_CACHE_ALIGN_BUFFER(u16, tmpid, ATA_ID_WORDS);
|
2006-08-23 11:10:44 +00:00
|
|
|
u8 port;
|
|
|
|
|
|
|
|
/* Clean ccb data buffer */
|
|
|
|
memset(pccb->pdata, 0, pccb->datalen);
|
|
|
|
|
|
|
|
memcpy(pccb->pdata, hdr, sizeof(hdr));
|
|
|
|
|
2006-08-23 16:04:43 +00:00
|
|
|
if (pccb->datalen <= 35)
|
2006-08-23 11:10:44 +00:00
|
|
|
return 0;
|
|
|
|
|
2012-10-29 05:23:55 +00:00
|
|
|
memset(fis, 0, sizeof(fis));
|
2006-08-23 11:10:44 +00:00
|
|
|
/* Construct the FIS */
|
2006-08-23 16:04:43 +00:00
|
|
|
fis[0] = 0x27; /* Host to device FIS. */
|
|
|
|
fis[1] = 1 << 7; /* Command FIS. */
|
2013-08-24 15:10:54 +00:00
|
|
|
fis[2] = ATA_CMD_ID_ATA; /* Command byte. */
|
2006-08-23 11:10:44 +00:00
|
|
|
|
|
|
|
/* Read id from sata */
|
|
|
|
port = pccb->target;
|
|
|
|
|
2013-08-24 15:10:54 +00:00
|
|
|
if (ahci_device_data_io(port, (u8 *) &fis, sizeof(fis), (u8 *)tmpid,
|
|
|
|
ATA_ID_WORDS * 2, 0)) {
|
2006-08-23 11:10:44 +00:00
|
|
|
debug("scsi_ahci: SCSI inquiry command failure.\n");
|
|
|
|
return -EIO;
|
|
|
|
}
|
|
|
|
|
2014-04-01 14:26:40 +00:00
|
|
|
if (!ataid[port]) {
|
|
|
|
ataid[port] = malloc(ATA_ID_WORDS * 2);
|
|
|
|
if (!ataid[port]) {
|
|
|
|
printf("%s: No memory for ataid[port]\n", __func__);
|
|
|
|
return -ENOMEM;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
idbuf = ataid[port];
|
|
|
|
|
|
|
|
memcpy(idbuf, tmpid, ATA_ID_WORDS * 2);
|
|
|
|
ata_swap_buf_le16(idbuf, ATA_ID_WORDS);
|
2006-08-23 11:10:44 +00:00
|
|
|
|
|
|
|
memcpy(&pccb->pdata[8], "ATA ", 8);
|
2014-04-01 14:26:40 +00:00
|
|
|
ata_id_strcpy((u16 *)&pccb->pdata[16], &idbuf[ATA_ID_PROD], 16);
|
|
|
|
ata_id_strcpy((u16 *)&pccb->pdata[32], &idbuf[ATA_ID_FW_REV], 4);
|
2006-08-23 11:10:44 +00:00
|
|
|
|
2013-08-24 15:10:54 +00:00
|
|
|
#ifdef DEBUG
|
2014-04-01 14:26:40 +00:00
|
|
|
ata_dump_id(idbuf);
|
2013-08-24 15:10:54 +00:00
|
|
|
#endif
|
2006-08-23 11:10:44 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
2012-10-29 05:23:53 +00:00
|
|
|
* SCSI READ10/WRITE10 command operation.
|
2006-08-23 11:10:44 +00:00
|
|
|
*/
|
2012-10-29 05:23:53 +00:00
|
|
|
static int ata_scsiop_read_write(ccb *pccb, u8 is_write)
|
2006-08-23 11:10:44 +00:00
|
|
|
{
|
2015-06-04 23:58:45 +00:00
|
|
|
lbaint_t lba = 0;
|
2012-10-29 05:23:44 +00:00
|
|
|
u16 blocks = 0;
|
2006-08-23 11:10:44 +00:00
|
|
|
u8 fis[20];
|
2012-10-29 05:23:44 +00:00
|
|
|
u8 *user_buffer = pccb->pdata;
|
|
|
|
u32 user_buffer_size = pccb->datalen;
|
2006-08-23 11:10:44 +00:00
|
|
|
|
2012-10-29 05:23:44 +00:00
|
|
|
/* Retrieve the base LBA number from the ccb structure. */
|
2015-06-04 23:58:45 +00:00
|
|
|
if (pccb->cmd[0] == SCSI_READ16) {
|
|
|
|
memcpy(&lba, pccb->cmd + 2, 8);
|
|
|
|
lba = be64_to_cpu(lba);
|
|
|
|
} else {
|
|
|
|
u32 temp;
|
|
|
|
memcpy(&temp, pccb->cmd + 2, 4);
|
|
|
|
lba = be32_to_cpu(temp);
|
|
|
|
}
|
2006-08-23 11:10:44 +00:00
|
|
|
|
2012-10-29 05:23:44 +00:00
|
|
|
/*
|
2015-06-04 23:58:45 +00:00
|
|
|
* Retrieve the base LBA number and the block count from
|
|
|
|
* the ccb structure.
|
2012-10-29 05:23:44 +00:00
|
|
|
*
|
|
|
|
* For 10-byte and 16-byte SCSI R/W commands, transfer
|
2006-08-23 11:10:44 +00:00
|
|
|
* length 0 means transfer 0 block of data.
|
|
|
|
* However, for ATA R/W commands, sector count 0 means
|
|
|
|
* 256 or 65536 sectors, not 0 sectors as in SCSI.
|
|
|
|
*
|
|
|
|
* WARNING: one or two older ATA drives treat 0 as 0...
|
|
|
|
*/
|
2015-06-04 23:58:45 +00:00
|
|
|
if (pccb->cmd[0] == SCSI_READ16)
|
|
|
|
blocks = (((u16)pccb->cmd[13]) << 8) | ((u16) pccb->cmd[14]);
|
|
|
|
else
|
|
|
|
blocks = (((u16)pccb->cmd[7]) << 8) | ((u16) pccb->cmd[8]);
|
2012-10-29 05:23:44 +00:00
|
|
|
|
2015-06-04 23:58:45 +00:00
|
|
|
debug("scsi_ahci: %s %u blocks starting from lba 0x" LBAFU "\n",
|
|
|
|
is_write ? "write" : "read", blocks, lba);
|
2012-10-29 05:23:44 +00:00
|
|
|
|
|
|
|
/* Preset the FIS */
|
2012-10-29 05:23:55 +00:00
|
|
|
memset(fis, 0, sizeof(fis));
|
2012-10-29 05:23:44 +00:00
|
|
|
fis[0] = 0x27; /* Host to device FIS. */
|
|
|
|
fis[1] = 1 << 7; /* Command FIS. */
|
2012-10-29 05:23:53 +00:00
|
|
|
/* Command byte (read/write). */
|
2012-10-29 05:24:03 +00:00
|
|
|
fis[2] = is_write ? ATA_CMD_WRITE_EXT : ATA_CMD_READ_EXT;
|
2006-08-23 11:10:44 +00:00
|
|
|
|
2012-10-29 05:23:44 +00:00
|
|
|
while (blocks) {
|
|
|
|
u16 now_blocks; /* number of blocks per iteration */
|
|
|
|
u32 transfer_size; /* number of bytes per iteration */
|
|
|
|
|
linux/kernel.h: sync min, max, min3, max3 macros with Linux
U-Boot has never cared about the type when we get max/min of two
values, but Linux Kernel does. This commit gets min, max, min3, max3
macros synced with the kernel introducing type checks.
Many of references of those macros must be fixed to suppress warnings.
We have two options:
- Use min, max, min3, max3 only when the arguments have the same type
(or add casts to the arguments)
- Use min_t/max_t instead with the appropriate type for the first
argument
Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Pavel Machek <pavel@denx.de>
Acked-by: Lukasz Majewski <l.majewski@samsung.com>
Tested-by: Lukasz Majewski <l.majewski@samsung.com>
[trini: Fixup arch/blackfin/lib/string.c]
Signed-off-by: Tom Rini <trini@ti.com>
2014-11-06 18:03:31 +00:00
|
|
|
now_blocks = min((u16)MAX_SATA_BLOCKS_READ_WRITE, blocks);
|
2012-10-29 05:23:44 +00:00
|
|
|
|
2013-08-24 15:10:54 +00:00
|
|
|
transfer_size = ATA_SECT_SIZE * now_blocks;
|
2012-10-29 05:23:44 +00:00
|
|
|
if (transfer_size > user_buffer_size) {
|
|
|
|
printf("scsi_ahci: Error: buffer too small.\n");
|
|
|
|
return -EIO;
|
|
|
|
}
|
|
|
|
|
2015-06-04 23:58:45 +00:00
|
|
|
/*
|
|
|
|
* LBA48 SATA command but only use 32bit address range within
|
|
|
|
* that (unless we've enabled 64bit LBA support). The next
|
|
|
|
* smaller command range (28bit) is too small.
|
2012-10-29 05:24:03 +00:00
|
|
|
*/
|
2012-10-29 05:23:44 +00:00
|
|
|
fis[4] = (lba >> 0) & 0xff;
|
|
|
|
fis[5] = (lba >> 8) & 0xff;
|
|
|
|
fis[6] = (lba >> 16) & 0xff;
|
2012-10-29 05:24:03 +00:00
|
|
|
fis[7] = 1 << 6; /* device reg: set LBA mode */
|
|
|
|
fis[8] = ((lba >> 24) & 0xff);
|
2015-06-04 23:58:45 +00:00
|
|
|
#ifdef CONFIG_SYS_64BIT_LBA
|
|
|
|
if (pccb->cmd[0] == SCSI_READ16) {
|
|
|
|
fis[9] = ((lba >> 32) & 0xff);
|
|
|
|
fis[10] = ((lba >> 40) & 0xff);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2012-10-29 05:24:03 +00:00
|
|
|
fis[3] = 0xe0; /* features */
|
2012-10-29 05:23:44 +00:00
|
|
|
|
|
|
|
/* Block (sector) count */
|
|
|
|
fis[12] = (now_blocks >> 0) & 0xff;
|
|
|
|
fis[13] = (now_blocks >> 8) & 0xff;
|
|
|
|
|
2012-10-29 05:23:53 +00:00
|
|
|
/* Read/Write from ahci */
|
|
|
|
if (ahci_device_data_io(pccb->target, (u8 *) &fis, sizeof(fis),
|
2015-03-31 07:02:43 +00:00
|
|
|
user_buffer, transfer_size,
|
2012-10-29 05:23:53 +00:00
|
|
|
is_write)) {
|
|
|
|
debug("scsi_ahci: SCSI %s10 command failure.\n",
|
|
|
|
is_write ? "WRITE" : "READ");
|
2012-10-29 05:23:44 +00:00
|
|
|
return -EIO;
|
|
|
|
}
|
2012-10-29 05:24:02 +00:00
|
|
|
|
|
|
|
/* If this transaction is a write, do a following flush.
|
|
|
|
* Writes in u-boot are so rare, and the logic to know when is
|
|
|
|
* the last write and do a flush only there is sufficiently
|
|
|
|
* difficult. Just do a flush after every write. This incurs,
|
|
|
|
* usually, one extra flush when the rare writes do happen.
|
|
|
|
*/
|
|
|
|
if (is_write) {
|
|
|
|
if (-EIO == ata_io_flush(pccb->target))
|
|
|
|
return -EIO;
|
|
|
|
}
|
2012-10-29 05:23:44 +00:00
|
|
|
user_buffer += transfer_size;
|
|
|
|
user_buffer_size -= transfer_size;
|
|
|
|
blocks -= now_blocks;
|
|
|
|
lba += now_blocks;
|
2006-08-23 11:10:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* SCSI READ CAPACITY10 command operation.
|
|
|
|
*/
|
|
|
|
static int ata_scsiop_read_capacity10(ccb *pccb)
|
|
|
|
{
|
2009-07-13 14:24:00 +00:00
|
|
|
u32 cap;
|
2013-08-24 15:10:54 +00:00
|
|
|
u64 cap64;
|
2012-10-29 05:23:54 +00:00
|
|
|
u32 block_size;
|
2006-08-23 11:10:44 +00:00
|
|
|
|
2006-08-23 16:04:43 +00:00
|
|
|
if (!ataid[pccb->target]) {
|
2006-08-23 11:10:44 +00:00
|
|
|
printf("scsi_ahci: SCSI READ CAPACITY10 command failure. "
|
2006-08-23 16:04:43 +00:00
|
|
|
"\tNo ATA info!\n"
|
2015-11-24 22:46:24 +00:00
|
|
|
"\tPlease run SCSI command INQUIRY first!\n");
|
2006-08-23 11:10:44 +00:00
|
|
|
return -EPERM;
|
|
|
|
}
|
|
|
|
|
2013-08-24 15:10:54 +00:00
|
|
|
cap64 = ata_id_n_sectors(ataid[pccb->target]);
|
|
|
|
if (cap64 > 0x100000000ULL)
|
|
|
|
cap64 = 0xffffffff;
|
2012-10-29 05:23:54 +00:00
|
|
|
|
2013-08-24 15:10:54 +00:00
|
|
|
cap = cpu_to_be32(cap64);
|
2009-07-13 14:24:00 +00:00
|
|
|
memcpy(pccb->pdata, &cap, sizeof(cap));
|
2006-08-23 11:10:44 +00:00
|
|
|
|
2012-10-29 05:23:54 +00:00
|
|
|
block_size = cpu_to_be32((u32)512);
|
|
|
|
memcpy(&pccb->pdata[4], &block_size, 4);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* SCSI READ CAPACITY16 command operation.
|
|
|
|
*/
|
|
|
|
static int ata_scsiop_read_capacity16(ccb *pccb)
|
|
|
|
{
|
|
|
|
u64 cap;
|
|
|
|
u64 block_size;
|
|
|
|
|
|
|
|
if (!ataid[pccb->target]) {
|
|
|
|
printf("scsi_ahci: SCSI READ CAPACITY16 command failure. "
|
|
|
|
"\tNo ATA info!\n"
|
2015-11-24 22:46:24 +00:00
|
|
|
"\tPlease run SCSI command INQUIRY first!\n");
|
2012-10-29 05:23:54 +00:00
|
|
|
return -EPERM;
|
|
|
|
}
|
|
|
|
|
2013-08-24 15:10:54 +00:00
|
|
|
cap = ata_id_n_sectors(ataid[pccb->target]);
|
2012-10-29 05:23:54 +00:00
|
|
|
cap = cpu_to_be64(cap);
|
|
|
|
memcpy(pccb->pdata, &cap, sizeof(cap));
|
|
|
|
|
|
|
|
block_size = cpu_to_be64((u64)512);
|
|
|
|
memcpy(&pccb->pdata[8], &block_size, 8);
|
2006-08-23 11:10:44 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* SCSI TEST UNIT READY command operation.
|
|
|
|
*/
|
|
|
|
static int ata_scsiop_test_unit_ready(ccb *pccb)
|
|
|
|
{
|
|
|
|
return (ataid[pccb->target]) ? 0 : -EPERM;
|
|
|
|
}
|
|
|
|
|
2006-08-23 16:04:43 +00:00
|
|
|
|
2006-08-23 11:10:44 +00:00
|
|
|
int scsi_exec(ccb *pccb)
|
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
|
2006-08-23 16:04:43 +00:00
|
|
|
switch (pccb->cmd[0]) {
|
2015-06-04 23:58:45 +00:00
|
|
|
case SCSI_READ16:
|
2006-08-23 11:10:44 +00:00
|
|
|
case SCSI_READ10:
|
2012-10-29 05:23:53 +00:00
|
|
|
ret = ata_scsiop_read_write(pccb, 0);
|
|
|
|
break;
|
|
|
|
case SCSI_WRITE10:
|
|
|
|
ret = ata_scsiop_read_write(pccb, 1);
|
2006-08-23 11:10:44 +00:00
|
|
|
break;
|
2012-10-29 05:23:54 +00:00
|
|
|
case SCSI_RD_CAPAC10:
|
2006-08-23 11:10:44 +00:00
|
|
|
ret = ata_scsiop_read_capacity10(pccb);
|
|
|
|
break;
|
2012-10-29 05:23:54 +00:00
|
|
|
case SCSI_RD_CAPAC16:
|
|
|
|
ret = ata_scsiop_read_capacity16(pccb);
|
|
|
|
break;
|
2006-08-23 11:10:44 +00:00
|
|
|
case SCSI_TST_U_RDY:
|
|
|
|
ret = ata_scsiop_test_unit_ready(pccb);
|
|
|
|
break;
|
|
|
|
case SCSI_INQUIRY:
|
|
|
|
ret = ata_scsiop_inquiry(pccb);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
printf("Unsupport SCSI command 0x%02x\n", pccb->cmd[0]);
|
2013-04-01 18:29:11 +00:00
|
|
|
return false;
|
2006-08-23 11:10:44 +00:00
|
|
|
}
|
|
|
|
|
2006-08-23 16:04:43 +00:00
|
|
|
if (ret) {
|
|
|
|
debug("SCSI command 0x%02x ret errno %d\n", pccb->cmd[0], ret);
|
2013-04-01 18:29:11 +00:00
|
|
|
return false;
|
2006-08-23 11:10:44 +00:00
|
|
|
}
|
2013-04-01 18:29:11 +00:00
|
|
|
return true;
|
2006-08-23 11:10:44 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2016-09-08 13:06:45 +00:00
|
|
|
#if defined(CONFIG_DM_SCSI)
|
|
|
|
void scsi_low_level_init(int busdevfunc, struct udevice *dev)
|
|
|
|
#else
|
2006-08-23 11:10:44 +00:00
|
|
|
void scsi_low_level_init(int busdevfunc)
|
2016-09-08 13:06:45 +00:00
|
|
|
#endif
|
2006-08-23 11:10:44 +00:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
u32 linkmap;
|
|
|
|
|
2011-07-06 16:13:36 +00:00
|
|
|
#ifndef CONFIG_SCSI_AHCI_PLAT
|
2016-09-08 13:06:45 +00:00
|
|
|
# if defined(CONFIG_DM_PCI)
|
2015-11-29 20:18:06 +00:00
|
|
|
struct udevice *dev;
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
ret = dm_pci_bus_find_bdf(busdevfunc, &dev);
|
|
|
|
if (ret)
|
|
|
|
return;
|
|
|
|
ahci_init_one(dev);
|
2016-09-08 13:06:45 +00:00
|
|
|
# elif defined(CONFIG_DM_SCSI)
|
|
|
|
ahci_init_one(dev);
|
2015-11-29 20:18:06 +00:00
|
|
|
# else
|
2006-08-23 11:10:44 +00:00
|
|
|
ahci_init_one(busdevfunc);
|
2015-11-29 20:18:06 +00:00
|
|
|
# endif
|
2011-07-06 16:13:36 +00:00
|
|
|
#endif
|
2006-08-23 11:10:44 +00:00
|
|
|
|
|
|
|
linkmap = probe_ent->link_port_map;
|
|
|
|
|
2008-10-16 13:01:15 +00:00
|
|
|
for (i = 0; i < CONFIG_SYS_SCSI_MAX_SCSI_ID; i++) {
|
2006-08-23 16:04:43 +00:00
|
|
|
if (((linkmap >> i) & 0x01)) {
|
|
|
|
if (ahci_port_start((u8) i)) {
|
|
|
|
printf("Can not start port %d\n", i);
|
2006-08-23 11:10:44 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-07-06 16:13:36 +00:00
|
|
|
#ifdef CONFIG_SCSI_AHCI_PLAT
|
2015-04-17 14:19:01 +00:00
|
|
|
int ahci_init(void __iomem *base)
|
2011-07-06 16:13:36 +00:00
|
|
|
{
|
|
|
|
int i, rc = 0;
|
|
|
|
u32 linkmap;
|
|
|
|
|
|
|
|
probe_ent = malloc(sizeof(struct ahci_probe_ent));
|
2013-11-11 14:56:37 +00:00
|
|
|
if (!probe_ent) {
|
|
|
|
printf("%s: No memory for probe_ent\n", __func__);
|
|
|
|
return -ENOMEM;
|
|
|
|
}
|
|
|
|
|
2011-07-06 16:13:36 +00:00
|
|
|
memset(probe_ent, 0, sizeof(struct ahci_probe_ent));
|
|
|
|
|
|
|
|
probe_ent->host_flags = ATA_FLAG_SATA
|
|
|
|
| ATA_FLAG_NO_LEGACY
|
|
|
|
| ATA_FLAG_MMIO
|
|
|
|
| ATA_FLAG_PIO_DMA
|
|
|
|
| ATA_FLAG_NO_ATAPI;
|
|
|
|
probe_ent->pio_mask = 0x1f;
|
|
|
|
probe_ent->udma_mask = 0x7f; /*Fixme,assume to support UDMA6 */
|
|
|
|
|
|
|
|
probe_ent->mmio_base = base;
|
|
|
|
|
|
|
|
/* initialize adapter */
|
|
|
|
rc = ahci_host_init(probe_ent);
|
|
|
|
if (rc)
|
|
|
|
goto err_out;
|
|
|
|
|
|
|
|
ahci_print_info(probe_ent);
|
|
|
|
|
|
|
|
linkmap = probe_ent->link_port_map;
|
|
|
|
|
|
|
|
for (i = 0; i < CONFIG_SYS_SCSI_MAX_SCSI_ID; i++) {
|
|
|
|
if (((linkmap >> i) & 0x01)) {
|
|
|
|
if (ahci_port_start((u8) i)) {
|
|
|
|
printf("Can not start port %d\n", i);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
err_out:
|
|
|
|
return rc;
|
|
|
|
}
|
2014-03-07 01:20:56 +00:00
|
|
|
|
|
|
|
void __weak scsi_init(void)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2011-07-06 16:13:36 +00:00
|
|
|
#endif
|
2006-08-23 11:10:44 +00:00
|
|
|
|
2012-10-29 05:24:02 +00:00
|
|
|
/*
|
|
|
|
* In the general case of generic rotating media it makes sense to have a
|
|
|
|
* flush capability. It probably even makes sense in the case of SSDs because
|
|
|
|
* one cannot always know for sure what kind of internal cache/flush mechanism
|
|
|
|
* is embodied therein. At first it was planned to invoke this after the last
|
|
|
|
* write to disk and before rebooting. In practice, knowing, a priori, which
|
|
|
|
* is the last write is difficult. Because writing to the disk in u-boot is
|
|
|
|
* very rare, this flush command will be invoked after every block write.
|
|
|
|
*/
|
|
|
|
static int ata_io_flush(u8 port)
|
|
|
|
{
|
|
|
|
u8 fis[20];
|
|
|
|
struct ahci_ioports *pp = &(probe_ent->port[port]);
|
2015-07-09 06:37:30 +00:00
|
|
|
void __iomem *port_mmio = pp->port_mmio;
|
2012-10-29 05:24:02 +00:00
|
|
|
u32 cmd_fis_len = 5; /* five dwords */
|
|
|
|
|
|
|
|
/* Preset the FIS */
|
|
|
|
memset(fis, 0, 20);
|
|
|
|
fis[0] = 0x27; /* Host to device FIS. */
|
|
|
|
fis[1] = 1 << 7; /* Command FIS. */
|
2012-10-29 05:24:03 +00:00
|
|
|
fis[2] = ATA_CMD_FLUSH_EXT;
|
2012-10-29 05:24:02 +00:00
|
|
|
|
|
|
|
memcpy((unsigned char *)pp->cmd_tbl, fis, 20);
|
|
|
|
ahci_fill_cmd_slot(pp, cmd_fis_len);
|
2016-04-14 08:21:00 +00:00
|
|
|
ahci_dcache_flush_sata_cmd(pp);
|
2012-10-29 05:24:02 +00:00
|
|
|
writel_with_flush(1, port_mmio + PORT_CMD_ISSUE);
|
|
|
|
|
|
|
|
if (waiting_for_cmd_completed(port_mmio + PORT_CMD_ISSUE,
|
|
|
|
WAIT_MS_FLUSH, 0x1)) {
|
|
|
|
debug("scsi_ahci: flush command timeout on port %d.\n", port);
|
|
|
|
return -EIO;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-12-15 14:02:56 +00:00
|
|
|
__weak void scsi_bus_reset(void)
|
2006-08-23 11:10:44 +00:00
|
|
|
{
|
2006-08-23 16:04:43 +00:00
|
|
|
/*Not implement*/
|
2006-08-23 11:10:44 +00:00
|
|
|
}
|