Lines Matching refs:port

24 static void start_cmd(HBA_PORT *port);
25 static void stop_cmd(HBA_PORT *port);
26 static void port_rebase(HBA_PORT *port, int portno);
30 static int ahci_find_cmdslot(HBA_PORT *port);
188 static int check_type(HBA_PORT *port) in check_type() argument
190 uint32_t ssts = port->ssts; in check_type()
200 switch (port->sig) in check_type()
257 static void start_cmd(HBA_PORT *port) in start_cmd() argument
260 while ((port->cmd) & HBA_PxCMD_CR) in start_cmd()
264 port->cmd |= HBA_PxCMD_FRE; in start_cmd()
265 port->cmd |= HBA_PxCMD_ST; in start_cmd()
269 static void stop_cmd(HBA_PORT *port) in stop_cmd() argument
272 port->cmd &= ~HBA_PxCMD_ST; in stop_cmd()
275 port->cmd &= ~HBA_PxCMD_FRE; in stop_cmd()
280 if (port->cmd & HBA_PxCMD_FR) in stop_cmd()
282 if (port->cmd & HBA_PxCMD_CR) in stop_cmd()
288 static void port_rebase(HBA_PORT *port, int portno) in port_rebase() argument
295 stop_cmd(port); // Stop command engine in port_rebase()
302 port->clb = virt_2_phys(ahci_port_base_vaddr + (portno << 10)); in port_rebase()
304 memset((void *)(phys_2_virt(port->clb)), 0, 1024); in port_rebase()
308 port->fb = virt_2_phys(ahci_port_base_vaddr + (32 << 10) + (portno << 8)); in port_rebase()
310 memset((void *)(phys_2_virt(port->fb)), 0, 256); in port_rebase()
314 HBA_CMD_HEADER *cmdheader = (HBA_CMD_HEADER *)(phys_2_virt(port->clb)); in port_rebase()
325 start_cmd(port); // Start command engine in port_rebase()
339 static bool ahci_read(HBA_PORT *port, uint32_t startl, uint32_t starth, uint32_t count, uint64_t bu… in ahci_read() argument
341 port->is = (uint32_t)-1; // Clear pending interrupt bits in ahci_read()
343 int slot = ahci_find_cmdslot(port); in ahci_read()
348 HBA_CMD_HEADER *cmdheader = (HBA_CMD_HEADER *)phys_2_virt(port->clb); in ahci_read()
393 while ((port->tfd & (AHCI_DEV_BUSY | AHCI_DEV_DRQ)) && spin < 1000000) in ahci_read()
403 port->ci = 1 << slot; // Issue command in ahci_read()
413 if ((port->ci & (1 << slot)) == 0) in ahci_read()
415 if (port->is & HBA_PxIS_TFES) // Task file error in ahci_read()
424 if (port->is & HBA_PxIS_TFES) in ahci_read()
433 static bool ahci_write(HBA_PORT *port, uint32_t startl, uint32_t starth, uint32_t count, in ahci_write() argument
437 port->is = 0xffff; // Clear pending interrupt bits in ahci_write()
438 int slot = ahci_find_cmdslot(port); in ahci_write()
442 HBA_CMD_HEADER *cmdheader = (HBA_CMD_HEADER *)phys_2_virt(port->clb); in ahci_write()
483 port->ci = 1; // Issue command in ahci_write()
493 if ((port->ci & (1 << slot)) == 0) in ahci_write()
495 if (port->is & HBA_PxIS_TFES) in ahci_write()
502 if (port->is & HBA_PxIS_TFES) in ahci_write()
513 static int ahci_find_cmdslot(HBA_PORT *port) in ahci_find_cmdslot() argument
516 uint32_t slots = (port->sact | port->ci); in ahci_find_cmdslot()