[SeaBIOS] [PATCH] megasas: Add boot support for LSI MegaRAID SAS
Kevin O'Connor
kevin at koconnor.net
Tue Nov 13 01:39:54 CET 2012
On Mon, Nov 12, 2012 at 03:45:19PM +0100, Hannes Reinecke wrote:
> This patch adds support for LSI MegaRAID SAS controllers.
> Currently only 8708EM2 is supported.
Thanks. Some comments below.
[...]
> + SET_LOWFLAT(frame->cmd, MFI_CMD_LD_SCSI_IO);
[...]
> + mlun->frame = memalign_high(256, sizeof(struct megasas_cmd_frame));
Something's not right here. If the memory is allocated in high ram,
then it isn't accessible via GET/SET_LOW. Only memalign_low memory is
available with the GET/SET_LOW macros.
[...]
> + struct megasas_cmd_frame *frame = memalign_high(256, sizeof(*frame));
> + int i;
> +
> + memset(&ld_list, 0, sizeof(ld_list));
> + memset(frame, 0, sizeof(*frame));
> +
> + frame->cmd = MFI_CMD_DCMD;
> + frame->cmd_status = 0xFF;
> + frame->sge_count = 1;
> + frame->flags = 0x0011;
> + frame->data_xfer_len = sizeof(ld_list);
> + frame->dcmd.opcode = 0x03010000;
> + frame->dcmd.sgl_addr = (u32)MAKE_FLATPTR(GET_SEG(SS), &ld_list);
> + frame->dcmd.sgl_len = sizeof(ld_list);
> + frame->context = (u32)frame;
> +
> + if (megasas_fire_cmd(iobase, frame) != 0)
> + return;
Missing free(frame).
> + dprintf(1, "%d LD found\n", ld_list.count);
> + for (i = 0; i < ld_list.count; i++) {
> + dprintf(1, "LD %d:%d state 0x%x\n",
> + ld_list.lds[i].target, ld_list.lds[i].lun,
> + ld_list.lds[i].state);
> + if (ld_list.lds[i].state != 0) {
> + megasas_add_lun(pci, iobase,
> + ld_list.lds[i].target, ld_list.lds[i].lun);
> + }
> + }
> + free(frame);
> +}
Although valid, it's not a good idea to use memalign_high for
temporary space. One should use memalign_tmp for that purpose.
-Kevin
More information about the SeaBIOS
mailing list