5962 return (PCICFG_FAILURE);
5963 }
5964 } else {
5965 DEBUG0("Correct image was found\n");
5966 image_not_found = 0; /* Image was found */
5967 }
5968 }
5969
5970 *fcode_size = (ddi_get8(h, addr + start_of_fcode + 4) << 24) |
5971 (ddi_get8(h, addr + start_of_fcode + 5) << 16) |
5972 (ddi_get8(h, addr + start_of_fcode + 6) << 8) |
5973 (ddi_get8(h, addr + start_of_fcode + 7));
5974
5975 DEBUG1("Fcode Size %x\n", *fcode_size);
5976
5977 /*
5978 * Allocate page aligned buffer space
5979 */
5980 *fcode_addr = kmem_zalloc(ptob(btopr(*fcode_size)), KM_SLEEP);
5981
5982 if (*fcode_addr == NULL) {
5983 DEBUG0("kmem_zalloc returned NULL\n");
5984 pcicfg_unmap_phys(&h, &p);
5985 return (PCICFG_FAILURE);
5986 }
5987
5988 DEBUG1("Fcode Addr %lx\n", *fcode_addr);
5989
5990 ddi_rep_get8(h, *fcode_addr, addr + start_of_fcode, *fcode_size,
5991 DDI_DEV_AUTOINCR);
5992
5993 pcicfg_unmap_phys(&h, &p);
5994
5995 return (PCICFG_SUCCESS);
5996 }
5997
5998 static int
5999 pcicfg_fcode_assign_bars(ddi_acc_handle_t h, dev_info_t *dip, uint_t bus,
6000 uint_t device, uint_t func, int32_t fc_request, pci_regspec_t *rom_regspec)
6001 {
6002 /*
6003 * Assign values to all BARs so that it is safe to turn on the
6004 * device for accessing the fcode on the PROM. On successful
6005 * exit from this function, "assigned-addresses" are created
6006 * for all BARs and ROM BAR is enabled. Also, rom_regspec is
6007 * filled with the values that can be used to free up this
|
5962 return (PCICFG_FAILURE);
5963 }
5964 } else {
5965 DEBUG0("Correct image was found\n");
5966 image_not_found = 0; /* Image was found */
5967 }
5968 }
5969
5970 *fcode_size = (ddi_get8(h, addr + start_of_fcode + 4) << 24) |
5971 (ddi_get8(h, addr + start_of_fcode + 5) << 16) |
5972 (ddi_get8(h, addr + start_of_fcode + 6) << 8) |
5973 (ddi_get8(h, addr + start_of_fcode + 7));
5974
5975 DEBUG1("Fcode Size %x\n", *fcode_size);
5976
5977 /*
5978 * Allocate page aligned buffer space
5979 */
5980 *fcode_addr = kmem_zalloc(ptob(btopr(*fcode_size)), KM_SLEEP);
5981
5982 DEBUG1("Fcode Addr %lx\n", *fcode_addr);
5983
5984 ddi_rep_get8(h, *fcode_addr, addr + start_of_fcode, *fcode_size,
5985 DDI_DEV_AUTOINCR);
5986
5987 pcicfg_unmap_phys(&h, &p);
5988
5989 return (PCICFG_SUCCESS);
5990 }
5991
5992 static int
5993 pcicfg_fcode_assign_bars(ddi_acc_handle_t h, dev_info_t *dip, uint_t bus,
5994 uint_t device, uint_t func, int32_t fc_request, pci_regspec_t *rom_regspec)
5995 {
5996 /*
5997 * Assign values to all BARs so that it is safe to turn on the
5998 * device for accessing the fcode on the PROM. On successful
5999 * exit from this function, "assigned-addresses" are created
6000 * for all BARs and ROM BAR is enabled. Also, rom_regspec is
6001 * filled with the values that can be used to free up this
|