Browse Source

change sata,init on match.

master
root 15 years ago
parent
commit
e1a904f9a7
  1. 3
      sys/dev/pci/atpsata.c
  2. 34
      sys/dev/pci/sata.c
  3. 1
      sys/dev/pci/sata_8620.h

3
sys/dev/pci/atpsata.c

@ -93,7 +93,7 @@ struct cfattach atp_ca = {
sizeof(atp_sata_t),atp_match, atp_attach, sizeof(atp_sata_t),atp_match, atp_attach,
}; };
struct cfdriver atp_cd = { struct cfdriver atp_cd = {
NULL, "atp", DV_DULL, NULL, "atp", DV_DULL
}; };
#define PCI_VENDOR_SATA 0x1191 #define PCI_VENDOR_SATA 0x1191
#define PCI_PRODUCT_SATA 0x000d #define PCI_PRODUCT_SATA 0x000d
@ -161,6 +161,7 @@ static void atp_attach(struct device * parent, struct device * self, void *aux)
{ {
info.sata_reg_base = ioaddr + i * 0x80; info.sata_reg_base = ioaddr + i * 0x80;
info.flags = i; info.flags = i;
info.aa_link.aa_type=0xff; //just for not match ide
config_found(self,(void *)&info,NULL); config_found(self,(void *)&info,NULL);
} }

34
sys/dev/pci/sata.c

@ -1133,8 +1133,15 @@ printf("id = 0x%8x \n",id);
int atp_sata_initialize(u32 reg,u32 flags); int atp_sata_initialize(u32 reg,u32 flags);
typedef struct atp_sata_softc {
/* General disk infos */
struct device sc_dev;
int dev;
int bs,count;
} atp_sata_softc;
struct cfattach sata_ca = { struct cfattach sata_ca = {
sizeof(atp_sata_t),sata_match, sata_attach, sizeof(atp_sata_softc),sata_match, sata_attach,
}; };
@ -1150,20 +1157,24 @@ static int sata_match(
void * aux void * aux
) )
{ {
int err;
atp_sata_info_t *pinfo = aux; atp_sata_info_t *pinfo = aux;
if (pinfo->flags == 0 ||pinfo->flags == 1) if (pinfo->aa_link.aa_type==0xff && (pinfo->flags == 0 ||pinfo->flags == 1))
return 1; {
err = atp_sata_initialize(pinfo->sata_reg_base,pinfo->flags);
if(err)
return 0;
else return 1;
}
else else
return 0; return 0;
} }
static void sata_attach(struct device * parent,struct device * self,void *aux) static void sata_attach(struct device * parent,struct device * self,void *aux)
{ {
int valid; atp_sata_softc *sc = (atp_sata_softc * )self;
atp_sata_info_t *pinfo = aux; atp_sata_info_t *pinfo = aux;
valid = atp_sata_initialize(pinfo->sata_reg_base,pinfo->flags); sc->dev = pinfo->flags;
if(valid)
self->dv_class = DV_DULL;
} }
@ -1221,11 +1232,6 @@ block_dev_desc_t *sata_get_dev(int dev)
block_dev_desc_t sata_dev_desc[CFG_SATA_MAX_DEVICE]; block_dev_desc_t sata_dev_desc[CFG_SATA_MAX_DEVICE];
struct atp_sata_softc {
/* General disk infos */
struct device sc_dev;
int bs,count;
};
#define atp_sata_lookup(dev) (struct atp_sata_softc *)device_lookup(&sata_cd, minor(dev)) #define atp_sata_lookup(dev) (struct atp_sata_softc *)device_lookup(&sata_cd, minor(dev))
void atp_sata_strategy(struct buf *bp) void atp_sata_strategy(struct buf *bp)
@ -1256,7 +1262,7 @@ void atp_sata_strategy(struct buf *bp)
if(bp->b_flags & B_READ){ if(bp->b_flags & B_READ){
fault_timeout = 0; fault_timeout = 0;
ret=atp_sata_read(minor(bp->b_dev),blkno,blkcnt,bp->b_data); ret=atp_sata_read(priv->dev,blkno,blkcnt,bp->b_data);
if(ret != blkcnt||fault_timeout) if(ret != blkcnt||fault_timeout)
bp->b_flags |= B_ERROR; bp->b_flags |= B_ERROR;
dotik(30000, 0); dotik(30000, 0);
@ -1264,7 +1270,7 @@ void atp_sata_strategy(struct buf *bp)
else else
{ {
fault_timeout = 0; fault_timeout = 0;
ret=atp_sata_write(minor(bp->b_dev),blkno,blkcnt,bp->b_data); ret=atp_sata_write(priv->dev,blkno,blkcnt,bp->b_data);
if(ret != blkcnt||fault_timeout) if(ret != blkcnt||fault_timeout)
bp->b_flags |= B_ERROR; bp->b_flags |= B_ERROR;
dotik(30000, 0); dotik(30000, 0);

1
sys/dev/pci/sata_8620.h

@ -346,6 +346,7 @@ typedef struct _ReceiveFIS
* SATA device driver info * SATA device driver info
*/ */
typedef struct atp_sata_info { typedef struct atp_sata_info {
struct ata_atapi_attach aa_link; //just for not match id
u32 sata_reg_base; u32 sata_reg_base;
u32 flags; u32 flags;
} atp_sata_info_t; } atp_sata_info_t;

Loading…
Cancel
Save