scsi.c (2e192b245ed36a63bab0ef576999a95e23f60ecd) | scsi.c (4101f6879256720b30df712089a3df18565f9203) |
---|---|
1/* 2 * (C) Copyright 2001 3 * Denis Peter, MPL AG Switzerland 4 * 5 * SPDX-License-Identifier: GPL-2.0+ 6 */ 7 8/* --- 34 unchanged lines hidden (view full) --- 43static ccb tempccb; /* temporary scsi command buffer */ 44 45static unsigned char tempbuff[512]; /* temporary data buffer */ 46 47static int scsi_max_devs; /* number of highest available scsi device */ 48 49static int scsi_curr_dev; /* current device */ 50 | 1/* 2 * (C) Copyright 2001 3 * Denis Peter, MPL AG Switzerland 4 * 5 * SPDX-License-Identifier: GPL-2.0+ 6 */ 7 8/* --- 34 unchanged lines hidden (view full) --- 43static ccb tempccb; /* temporary scsi command buffer */ 44 45static unsigned char tempbuff[512]; /* temporary data buffer */ 46 47static int scsi_max_devs; /* number of highest available scsi device */ 48 49static int scsi_curr_dev; /* current device */ 50 |
51static block_dev_desc_t scsi_dev_desc[CONFIG_SYS_SCSI_MAX_DEVICE]; | 51static struct blk_desc scsi_dev_desc[CONFIG_SYS_SCSI_MAX_DEVICE]; |
52 53/******************************************************************************** 54 * forward declerations of some Setup Routines 55 */ 56void scsi_setup_test_unit_ready(ccb * pccb); 57void scsi_setup_read6(ccb * pccb, lbaint_t start, unsigned short blocks); 58void scsi_setup_read_ext(ccb * pccb, lbaint_t start, unsigned short blocks); 59void scsi_setup_read16(ccb * pccb, lbaint_t start, unsigned long blocks); 60 61static void scsi_setup_write_ext(ccb *pccb, lbaint_t start, 62 unsigned short blocks); 63void scsi_setup_inquiry(ccb * pccb); 64void scsi_ident_cpy (unsigned char *dest, unsigned char *src, unsigned int len); 65 66 67static int scsi_read_capacity(ccb *pccb, lbaint_t *capacity, 68 unsigned long *blksz); | 52 53/******************************************************************************** 54 * forward declerations of some Setup Routines 55 */ 56void scsi_setup_test_unit_ready(ccb * pccb); 57void scsi_setup_read6(ccb * pccb, lbaint_t start, unsigned short blocks); 58void scsi_setup_read_ext(ccb * pccb, lbaint_t start, unsigned short blocks); 59void scsi_setup_read16(ccb * pccb, lbaint_t start, unsigned long blocks); 60 61static void scsi_setup_write_ext(ccb *pccb, lbaint_t start, 62 unsigned short blocks); 63void scsi_setup_inquiry(ccb * pccb); 64void scsi_ident_cpy (unsigned char *dest, unsigned char *src, unsigned int len); 65 66 67static int scsi_read_capacity(ccb *pccb, lbaint_t *capacity, 68 unsigned long *blksz); |
69static ulong scsi_read(block_dev_desc_t *block_dev, lbaint_t blknr, | 69static ulong scsi_read(struct blk_desc *block_dev, lbaint_t blknr, |
70 lbaint_t blkcnt, void *buffer); | 70 lbaint_t blkcnt, void *buffer); |
71static ulong scsi_write(block_dev_desc_t *block_dev, lbaint_t blknr, | 71static ulong scsi_write(struct blk_desc *block_dev, lbaint_t blknr, |
72 lbaint_t blkcnt, const void *buffer); 73 74 75/********************************************************************************* 76 * (re)-scan the scsi bus and reports scsi device info 77 * to the user if mode = 1 78 */ 79void scsi_scan(int mode) --- 154 unchanged lines hidden (view full) --- 234 bootstage_start(BOOTSTAGE_ID_ACCUM_SCSI, "ahci"); 235 scsi_low_level_init(busdevfunc); 236 scsi_scan(1); 237 bootstage_accum(BOOTSTAGE_ID_ACCUM_SCSI); 238} 239#endif 240 241#ifdef CONFIG_PARTITIONS | 72 lbaint_t blkcnt, const void *buffer); 73 74 75/********************************************************************************* 76 * (re)-scan the scsi bus and reports scsi device info 77 * to the user if mode = 1 78 */ 79void scsi_scan(int mode) --- 154 unchanged lines hidden (view full) --- 234 bootstage_start(BOOTSTAGE_ID_ACCUM_SCSI, "ahci"); 235 scsi_low_level_init(busdevfunc); 236 scsi_scan(1); 237 bootstage_accum(BOOTSTAGE_ID_ACCUM_SCSI); 238} 239#endif 240 241#ifdef CONFIG_PARTITIONS |
242block_dev_desc_t * scsi_get_dev(int dev) | 242struct blk_desc *scsi_get_dev(int dev) |
243{ 244 return (dev < CONFIG_SYS_SCSI_MAX_DEVICE) ? &scsi_dev_desc[dev] : NULL; 245} 246#endif 247 248/****************************************************************************** 249 * scsi boot command intepreter. Derived from diskboot 250 */ --- 120 unchanged lines hidden (view full) --- 371/**************************************************************************************** 372 * scsi_read 373 */ 374 375/* almost the maximum amount of the scsi_ext command.. */ 376#define SCSI_MAX_READ_BLK 0xFFFF 377#define SCSI_LBA48_READ 0xFFFFFFF 378 | 243{ 244 return (dev < CONFIG_SYS_SCSI_MAX_DEVICE) ? &scsi_dev_desc[dev] : NULL; 245} 246#endif 247 248/****************************************************************************** 249 * scsi boot command intepreter. Derived from diskboot 250 */ --- 120 unchanged lines hidden (view full) --- 371/**************************************************************************************** 372 * scsi_read 373 */ 374 375/* almost the maximum amount of the scsi_ext command.. */ 376#define SCSI_MAX_READ_BLK 0xFFFF 377#define SCSI_LBA48_READ 0xFFFFFFF 378 |
379static ulong scsi_read(block_dev_desc_t *block_dev, lbaint_t blknr, | 379static ulong scsi_read(struct blk_desc *block_dev, lbaint_t blknr, |
380 lbaint_t blkcnt, void *buffer) 381{ 382 int device = block_dev->dev; 383 lbaint_t start, blks; 384 uintptr_t buf_addr; 385 unsigned short smallblks = 0; 386 ccb* pccb=(ccb *)&tempccb; 387 device&=0xff; --- 50 unchanged lines hidden (view full) --- 438 439/******************************************************************************* 440 * scsi_write 441 */ 442 443/* Almost the maximum amount of the scsi_ext command.. */ 444#define SCSI_MAX_WRITE_BLK 0xFFFF 445 | 380 lbaint_t blkcnt, void *buffer) 381{ 382 int device = block_dev->dev; 383 lbaint_t start, blks; 384 uintptr_t buf_addr; 385 unsigned short smallblks = 0; 386 ccb* pccb=(ccb *)&tempccb; 387 device&=0xff; --- 50 unchanged lines hidden (view full) --- 438 439/******************************************************************************* 440 * scsi_write 441 */ 442 443/* Almost the maximum amount of the scsi_ext command.. */ 444#define SCSI_MAX_WRITE_BLK 0xFFFF 445 |
446static ulong scsi_write(block_dev_desc_t *block_dev, lbaint_t blknr, | 446static ulong scsi_write(struct blk_desc *block_dev, lbaint_t blknr, |
447 lbaint_t blkcnt, const void *buffer) 448{ 449 int device = block_dev->dev; 450 lbaint_t start, blks; 451 uintptr_t buf_addr; 452 unsigned short smallblks; 453 ccb* pccb = (ccb *)&tempccb; 454 device &= 0xff; --- 279 unchanged lines hidden --- | 447 lbaint_t blkcnt, const void *buffer) 448{ 449 int device = block_dev->dev; 450 lbaint_t start, blks; 451 uintptr_t buf_addr; 452 unsigned short smallblks; 453 ccb* pccb = (ccb *)&tempccb; 454 device &= 0xff; --- 279 unchanged lines hidden --- |