aboutsummaryrefslogtreecommitdiffstats
path: root/src/hw/ahci.c
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2013-10-02 21:28:08 -0400
committerKevin O'Connor <kevin@koconnor.net>2013-10-14 21:37:56 -0400
commit7c80bb83d9a154a19df75c48a8b42bfb4904a2e4 (patch)
tree9e66c77f7954942d1bef368e108b6fc410997ad6 /src/hw/ahci.c
parent7acaa3cf7decd77542bf3b2ea8aac20a7a6522e9 (diff)
downloadseabios-7c80bb83d9a154a19df75c48a8b42bfb4904a2e4.tar.gz
Run ahci code entirely in 32bit mode.
The ahci driver needs to jump into 32bit mode in order to access portions of the ahci controllers PCI config space. Instead of jumping into 32bit mode just to toggle the ahci registers, jump into 32bit mode for all of the driver interactions. This shrinks the size of the overall code and can lead to further cleanups. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'src/hw/ahci.c')
-rw-r--r--src/hw/ahci.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/src/hw/ahci.c b/src/hw/ahci.c
index 9c2b390b..82a61945 100644
--- a/src/hw/ahci.c
+++ b/src/hw/ahci.c
@@ -23,10 +23,6 @@
#define AHCI_RESET_TIMEOUT 500 // 500 miliseconds
#define AHCI_LINK_TIMEOUT 10 // 10 miliseconds
-/****************************************************************
- * these bits must run in both 16bit and 32bit modes
- ****************************************************************/
-
// prepare sata command fis
static void sata_prep_simple(struct sata_cmd_fis *fis, u8 command)
{
@@ -76,13 +72,13 @@ static void sata_prep_atapi(struct sata_cmd_fis *fis, u16 blocksize)
static u32 ahci_ctrl_readl(struct ahci_ctrl_s *ctrl, u32 reg)
{
u32 addr = GET_GLOBALFLAT(ctrl->iobase) + reg;
- return pci_readl(addr);
+ return readl((void*)addr);
}
static void ahci_ctrl_writel(struct ahci_ctrl_s *ctrl, u32 reg, u32 val)
{
u32 addr = GET_GLOBALFLAT(ctrl->iobase) + reg;
- pci_writel(addr, val);
+ writel((void*)addr, val);
}
static u32 ahci_port_to_ctrl(u32 pnr, u32 port_reg)
@@ -300,7 +296,8 @@ ahci_disk_readwrite(struct disk_op_s *op, int iswrite)
}
// command demuxer
-int process_ahci_op(struct disk_op_s *op)
+int VISIBLE32FLAT
+process_ahci_op(struct disk_op_s *op)
{
if (!CONFIG_AHCI)
return 0;
@@ -322,10 +319,6 @@ int process_ahci_op(struct disk_op_s *op)
}
}
-/****************************************************************
- * everything below is pure 32bit code
- ****************************************************************/
-
static void
ahci_port_reset(struct ahci_ctrl_s *ctrl, u32 pnr)
{