diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2008-03-22 20:44:37 -0400 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2008-03-22 20:44:37 -0400 |
commit | 070231b908d0f84c3ab1fb970318f0fb5f7e281a (patch) | |
tree | 49a725a91d3f3bc750322f431a6a5f478afb2e97 | |
parent | fad2da831d14ae49a6368ece19b8b6a967a773e9 (diff) | |
download | seabios-070231b908d0f84c3ab1fb970318f0fb5f7e281a.tar.gz |
Use "FARPTR" consistently in macros.
Rename MAKE_32_PTR to MAKE_FARPTR.
Rename PTR_TO_SEG to FARPTR_TO_SEG.
Rename PTR_TO_OFFSET to FARPTR_TO_OFFSET.
-rw-r--r-- | src/ata.c | 6 | ||||
-rw-r--r-- | src/cdrom.c | 10 | ||||
-rw-r--r-- | src/disk.c | 8 | ||||
-rw-r--r-- | src/farptr.h | 32 | ||||
-rw-r--r-- | src/post.c | 6 |
5 files changed, 31 insertions, 31 deletions
@@ -306,7 +306,7 @@ ata_cmd_packet(u16 biosid, u8 *cmdbuf, u8 cmdlen SET_EBDA(ata.trsfbytes,0L); // Send command to device - outsw_far(iobase1, MAKE_32_PTR(GET_SEG(SS), (u32)cmdbuf), cmdlen / 2); + outsw_far(iobase1, MAKE_FARPTR(GET_SEG(SS), (u32)cmdbuf), cmdlen / 2); u8 status; u16 loops = 0; @@ -495,7 +495,7 @@ init_drive_atapi(u8 devid) memset(buffer, 0, sizeof(buffer)); u16 ret = ata_cmd_data(devid, ATA_CMD_IDENTIFY_DEVICE_PACKET , 1, 1 - , MAKE_32_PTR(GET_SEG(SS), (u32)buffer)); + , MAKE_FARPTR(GET_SEG(SS), (u32)buffer)); if (ret != 0) BX_PANIC("ata-detect: Failed to detect ATAPI device\n"); @@ -536,7 +536,7 @@ init_drive_ata(u8 devid) memset(buffer, 0, sizeof(buffer)); u16 ret = ata_cmd_data(devid, ATA_CMD_IDENTIFY_DEVICE , 1, 1 - , MAKE_32_PTR(GET_SEG(SS), (u32)buffer)); + , MAKE_FARPTR(GET_SEG(SS), (u32)buffer)); if (ret) BX_PANIC("ata-detect: Failed to detect ATA device\n"); diff --git a/src/cdrom.c b/src/cdrom.c index 590569ad..fc616e1a 100644 --- a/src/cdrom.c +++ b/src/cdrom.c @@ -297,7 +297,7 @@ atapi_get_sense(u16 device, u8 *asc, u8 *ascq) atacmd[4] = sizeof(buffer); u16 ret = ata_cmd_packet(device, atacmd, sizeof(atacmd) , 0, sizeof(buffer) - , MAKE_32_PTR(GET_SEG(SS), (u32)buffer)); + , MAKE_FARPTR(GET_SEG(SS), (u32)buffer)); if (ret != 0) return 0x0002; @@ -334,7 +334,7 @@ atapi_is_ready(u16 device) } u16 ret = ata_cmd_packet(device, packet, sizeof(packet) , 0, sizeof(buf) - , MAKE_32_PTR(GET_SEG(SS), (u32)buf)); + , MAKE_FARPTR(GET_SEG(SS), (u32)buf)); if (ret == 0) break; @@ -432,7 +432,7 @@ cdrom_boot() // Read the Boot Record Volume Descriptor u8 buffer[2048]; ret = cdrom_read(device, 0x11, 2048 - , MAKE_32_PTR(GET_SEG(SS), (u32)buffer), 0); + , MAKE_FARPTR(GET_SEG(SS), (u32)buffer), 0); if (ret) return 3; @@ -447,7 +447,7 @@ cdrom_boot() // And we read the Boot Catalog ret = cdrom_read(device, lba, 2048 - , MAKE_32_PTR(GET_SEG(SS), (u32)buffer), 0); + , MAKE_FARPTR(GET_SEG(SS), (u32)buffer), 0); if (ret) return 7; @@ -485,7 +485,7 @@ cdrom_boot() // And we read the image in memory ret = cdrom_read(device, lba, nbsectors*512 - , MAKE_32_PTR(boot_segment, 0), 0); + , MAKE_FARPTR(boot_segment, 0), 0); if (ret) return 12; @@ -78,7 +78,7 @@ basic_access(struct bregs *regs, u8 device, u16 command) + (u32)sector - 1); irq_enable(); u8 status = ata_cmd_data(device, command, lba, count - , MAKE_32_PTR(segment, offset)); + , MAKE_FARPTR(segment, offset)); irq_disable(); // Set nb of sector transferred @@ -139,7 +139,7 @@ emu_access(struct bregs *regs, u8 device, u16 command) irq_enable(); u8 status = cdrom_read(device, lba, count*512 - , MAKE_32_PTR(segment, offset), before*512); + , MAKE_FARPTR(segment, offset), before*512); irq_disable(); if (status != 0) { BX_INFO("int13_harddisk: function %02x, error %02x !\n" @@ -189,10 +189,10 @@ extended_access(struct bregs *regs, u8 device, u16 command) u8 status; if (type == ATA_TYPE_ATA) status = ata_cmd_data(device, command, lba, count - , MAKE_32_PTR(segment, offset)); + , MAKE_FARPTR(segment, offset)); else status = cdrom_read(device, lba, count*2048 - , MAKE_32_PTR(segment, offset), 0); + , MAKE_FARPTR(segment, offset), 0); irq_disable(); diff --git a/src/farptr.h b/src/farptr.h index 1dea4b65..cc8cd68e 100644 --- a/src/farptr.h +++ b/src/farptr.h @@ -95,9 +95,9 @@ extern void __force_link_error__unknown_type(); // Macros for converting to/from 32bit style pointers to their // equivalent 16bit segment/offset values. -#define PTR_TO_SEG(p) (((u32)(p)) >> 4) -#define PTR_TO_OFFSET(p) (((u32)(p)) & 0xf) -#define MAKE_32_PTR(seg,off) ((void*)(((seg)<<4)+(off))) +#define FARPTR_TO_SEG(p) (((u32)(p)) >> 4) +#define FARPTR_TO_OFFSET(p) (((u32)(p)) & 0xf) +#define MAKE_FARPTR(seg,off) ((void*)(((seg)<<4)+(off))) #ifdef MODE16 @@ -113,35 +113,35 @@ extern void __force_link_error__unknown_type(); #define SET_FARPTR(ptr, val) __SET_FARPTR((ptr), (val)) static inline void insb_far(u16 port, void *farptr, u16 count) { - SET_SEG(ES, PTR_TO_SEG(farptr)); - insb(port, (u8*)PTR_TO_OFFSET(farptr), count); + SET_SEG(ES, FARPTR_TO_SEG(farptr)); + insb(port, (u8*)FARPTR_TO_OFFSET(farptr), count); } static inline void insw_far(u16 port, void *farptr, u16 count) { - SET_SEG(ES, PTR_TO_SEG(farptr)); - insw(port, (u16*)PTR_TO_OFFSET(farptr), count); + SET_SEG(ES, FARPTR_TO_SEG(farptr)); + insw(port, (u16*)FARPTR_TO_OFFSET(farptr), count); } static inline void insl_far(u16 port, void *farptr, u16 count) { - SET_SEG(ES, PTR_TO_SEG(farptr)); - insl(port, (u32*)PTR_TO_OFFSET(farptr), count); + SET_SEG(ES, FARPTR_TO_SEG(farptr)); + insl(port, (u32*)FARPTR_TO_OFFSET(farptr), count); } static inline void outsb_far(u16 port, void *farptr, u16 count) { - SET_SEG(ES, PTR_TO_SEG(farptr)); - outsb(port, (u8*)PTR_TO_OFFSET(farptr), count); + SET_SEG(ES, FARPTR_TO_SEG(farptr)); + outsb(port, (u8*)FARPTR_TO_OFFSET(farptr), count); } static inline void outsw_far(u16 port, void *farptr, u16 count) { - SET_SEG(ES, PTR_TO_SEG(farptr)); - outsw(port, (u16*)PTR_TO_OFFSET(farptr), count); + SET_SEG(ES, FARPTR_TO_SEG(farptr)); + outsw(port, (u16*)FARPTR_TO_OFFSET(farptr), count); } static inline void outsl_far(u16 port, void *farptr, u16 count) { - SET_SEG(ES, PTR_TO_SEG(farptr)); - outsl(port, (u32*)PTR_TO_OFFSET(farptr), count); + SET_SEG(ES, FARPTR_TO_SEG(farptr)); + outsl(port, (u32*)FARPTR_TO_OFFSET(farptr), count); } #else // In 32-bit mode there is no need to mess with the segments. #define GET_FARVAR(seg, var) \ - (*((typeof(&(var)))MAKE_32_PTR((seg), (u32)&(var)))) + (*((typeof(&(var)))MAKE_FARPTR((seg), (u32)&(var)))) #define SET_FARVAR(seg, var, val) \ do { GET_FARVAR((seg), (var)) = (val); } while (0) #define GET_VAR(seg, var) (var) @@ -330,7 +330,7 @@ rom_scan(u32 start, u32 end) if (checksum(rom, len) != 0) continue; p = (u8*)(((u32)p + len) / 2048 * 2048); - callrom(PTR_TO_SEG(rom), PTR_TO_OFFSET(rom + 3)); + callrom(FARPTR_TO_SEG(rom), FARPTR_TO_OFFSET(rom + 3)); // Look at the ROM's PnP Expansion header. Properly, we're supposed // to init all the ROMs and then go back and build an IPL table of @@ -351,11 +351,11 @@ rom_scan(u32 start, u32 end) struct ipl_entry_s *ip = &ipl->table[ipl->count]; ip->type = IPL_TYPE_BEV; - ip->vector = (PTR_TO_SEG(rom) << 16) | entry; + ip->vector = (FARPTR_TO_SEG(rom) << 16) | entry; u16 desc = *(u16*)&rom[0x1a+0x10]; if (desc) - ip->description = (PTR_TO_SEG(rom) << 16) | desc; + ip->description = (FARPTR_TO_SEG(rom) << 16) | desc; ipl->count++; } |