~ubuntu-branches/ubuntu/saucy/seabios/saucy-proposed

« back to all changes in this revision

Viewing changes to src/ahci.c

  • Committer: Package Import Robot
  • Author(s): Michael Tokarev
  • Date: 2013-07-08 21:34:44 UTC
  • mfrom: (1.1.7)
  • Revision ID: package-import@ubuntu.com-20130708213444-6ed9q23j39x143lu
Tags: 1.7.3-1
Multi-Arch: allowed

Show diffs side-by-side

added added

removed removed

Lines of Context:
422
422
#define MAXMODEL 40
423
423
 
424
424
/* See ahci spec chapter 10.1 "Software Initialization of HBA" */
425
 
static int ahci_port_init(struct ahci_port_s *port)
 
425
static int ahci_port_setup(struct ahci_port_s *port)
426
426
{
427
427
    struct ahci_ctrl_s *ctrl = port->ctrl;
428
428
    u32 pnr = port->pnr;
549
549
 
550
550
    dprintf(2, "AHCI/%d: probing\n", port->pnr);
551
551
    ahci_port_reset(port->ctrl, port->pnr);
552
 
    rc = ahci_port_init(port);
 
552
    rc = ahci_port_setup(port);
553
553
    if (rc < 0)
554
554
        ahci_port_release(port);
555
555
    else {
567
567
 
568
568
// Initialize an ata controller and detect its drives.
569
569
static void
570
 
ahci_init_controller(struct pci_device *pci)
 
570
ahci_controller_setup(struct pci_device *pci)
571
571
{
572
572
    struct ahci_ctrl_s *ctrl = malloc_fseg(sizeof(*ctrl));
573
573
    struct ahci_port_s *port;
579
579
        return;
580
580
    }
581
581
 
582
 
    if (bounce_buf_init() < 0) {
 
582
    if (create_bounce_buf() < 0) {
583
583
        warn_noalloc();
584
584
        free(ctrl);
585
585
        return;
616
616
 
617
617
// Locate and init ahci controllers.
618
618
static void
619
 
ahci_init(void)
 
619
ahci_scan(void)
620
620
{
621
621
    // Scan PCI bus for ATA adapters
622
622
    struct pci_device *pci;
625
625
            continue;
626
626
        if (pci->prog_if != 1 /* AHCI rev 1 */)
627
627
            continue;
628
 
        ahci_init_controller(pci);
 
628
        ahci_controller_setup(pci);
629
629
    }
630
630
}
631
631
 
637
637
        return;
638
638
 
639
639
    dprintf(3, "init ahci\n");
640
 
    ahci_init();
 
640
    ahci_scan();
641
641
}