13 #include "create_fw.h"
14 #include "../probe_roms.h"
16 int write_blob(struct isci_orom *isci_orom)
22 fd = fopen(blob_name, "w+");
24 perror("Open file for write failed");
29 count = fwrite(isci_orom, sizeof(struct isci_orom), 1, fd);
31 perror("Write data failed");
41 void set_binary_values(struct isci_orom *isci_orom)
43 int ctrl_idx, phy_idx, port_idx;
45 /* setting OROM signature */
46 strncpy(isci_orom->hdr.signature, sig, strlen(sig));
47 isci_orom->hdr.version = 0x10;
48 isci_orom->hdr.total_block_length = sizeof(struct isci_orom);
49 isci_orom->hdr.hdr_length = sizeof(struct sci_bios_oem_param_block_hdr);
50 isci_orom->hdr.num_elements = num_elements;
52 for (ctrl_idx = 0; ctrl_idx < 2; ctrl_idx++) {
53 isci_orom->ctrl[ctrl_idx].controller.mode_type = mode_type;
54 isci_orom->ctrl[ctrl_idx].controller.max_concurrent_dev_spin_up =
55 max_num_concurrent_dev_spin_up;
56 isci_orom->ctrl[ctrl_idx].controller.do_enable_ssc =
59 for (port_idx = 0; port_idx < 4; port_idx++)
60 isci_orom->ctrl[ctrl_idx].ports[port_idx].phy_mask =
61 phy_mask[ctrl_idx][port_idx];
63 for (phy_idx = 0; phy_idx < 4; phy_idx++) {
64 isci_orom->ctrl[ctrl_idx].phys[phy_idx].sas_address.high =
65 (__u32)(sas_addr[ctrl_idx][phy_idx] >> 32);
66 isci_orom->ctrl[ctrl_idx].phys[phy_idx].sas_address.low =
67 (__u32)(sas_addr[ctrl_idx][phy_idx]);
75 struct isci_orom *isci_orom;
77 isci_orom = malloc(sizeof(struct isci_orom));
78 memset(isci_orom, 0, sizeof(struct isci_orom));
80 set_binary_values(isci_orom);
82 err = write_blob(isci_orom);