17 static unsigned int search(
char *p,
char *a,
unsigned int lengthp,
23 for (j = 0; j <= lengtha - lengthp; j++) {
24 for (i = 0; i < lengthp && p[i] == a[i + j]; i++)
34 unsigned char retval = 0;
38 retval = *
offset -
'A' + 0x0A;
40 retval = *
offset -
'a' + 0x0a;
52 u32 search_address,
u32 search_length)
54 char key[] =
"ethernet_mac";
59 sizeof(key) - 1, search_length);
60 if (
offset == search_length) {
62 "Error: Could not locate '%s' in VPD\n", key);
79 for (i = 0; i < 4; i++) {
88 for (i = 0; i < 2; i++) {
96 return *high_dword | *low_dword;
103 u32 high_dword = 0xD0BA00A0;
104 u32 low_dword = 0x0000AD0B;
106 if (search_length != -1)
114 outb(0xc0, io_base + 0x50);
115 outl(high_dword, io_base);
116 outl(low_dword, io_base + 0x04);
117 outb(0x60, io_base + 54);
118 outb(0x00, io_base + 0x50);
124 char key[] =
"keyboard_layout";
125 char kbd_jpn[] =
"xkb:jp::jpn";
129 if (search_length != -1) {
139 offset =
search(key, (
char *)search_address,
sizeof(key) - 1,
141 if (
offset != search_length) {
145 search_length =
sizeof(kbd_jpn);
147 sizeof(kbd_jpn) - 1, search_length);
148 if (
offset != search_length)
164 u32 search_address = 0x0;
165 size_t search_length = -1;
176 if (vpd_file !=
NULL) {
182 vpd_file =
cbfs_map(
"vpd.bin", &search_length);
184 search_address = (
unsigned long)vpd_file;
200 if (ethernet_dev !=
NULL) {
228 outb(0xc0, io_base + 0x50);
230 outb(0x00, io_base + 0x50);
235 unsigned long *current)
struct chip_operations mainboard_ops
int smbios_write_type41(unsigned long *current, int *handle, const char *name, u8 instance, u16 segment, u8 bus, u8 device, u8 function, u8 device_type)
static void * cbfs_map(const char *name, size_t *size_out)
#define printk(level,...)
void outb(u8 val, u16 port)
void outl(u32 val, u16 port)
struct device * dev_find_device(u16 vendor, u16 device, struct device *from)
Find a device of a given vendor and type.
void install_intel_vga_int15_handler(int active_lfp_, int pfit_, int display_, int panel_type_)
@ GMA_INT15_BOOT_DISPLAY_DEFAULT
@ GMA_INT15_ACTIVE_LFP_INT_LVDS
@ GMA_INT15_PANEL_FIT_DEFAULT
void ec_mem_write(u8 addr, u8 data)
static struct region_device rdev
int fmap_locate_area_as_rdev(const char *name, struct region_device *area)
#define BOARD_TRACKPAD_NAME
#define BOARD_TRACKPAD_I2C_ADDR
#define BOARD_TRACKPAD_IRQ
static void mainboard_init(struct device *dev)
static unsigned int search(char *p, char *a, unsigned int lengthp, unsigned int lengtha)
static void program_keyboard_type(u32 search_address, u32 search_length)
static unsigned char get_hex_digit(char *offset)
static int get_mac_address(u32 *high_dword, u32 *low_dword, u32 search_address, u32 search_length)
static int butterfly_onboard_smbios_data(struct device *dev, int *handle, unsigned long *current)
static void program_mac_address(u16 io_base, u32 search_address, u32 search_length)
static void mainboard_enable(struct device *dev)
#define BUTTERFLY_NIC_DEVICE_ID
#define BUTTERFLY_NIC_LED_MODE
#define BUTTERFLY_NIC_VENDOR_ID
static __always_inline u16 pci_read_config16(const struct device *dev, u16 reg)
static __always_inline void pci_write_config8(const struct device *dev, u16 reg, u8 val)
@ SMBIOS_DEVICE_TYPE_OTHER
#define BIOS_DEBUG
BIOS_DEBUG - Verbose output.
void butterfly_ec_init(void)
static size_t region_device_sz(const struct region_device *rdev)
static void * rdev_mmap_full(const struct region_device *rd)
void(* enable_dev)(struct device *dev)
void(* init)(struct device *dev)
struct device_operations * ops